@mastra/code-sdk 1.15.1-alpha.3 → 1.15.1-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.d.ts.map +1 -1
- package/dist/agents/mastracode-gateway.js +6 -5
- package/dist/agents/mastracode-gateway.js.map +1 -1
- 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 +15 -0
- package/dist/providers/openai-codex.d.ts.map +1 -1
- package/dist/providers/openai-codex.js +50 -11
- 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
|
@@ -2,7 +2,7 @@ import { runWorkflow } from "../../workflows/service.js";
|
|
|
2
2
|
import { withEphemeralMemory } from "./ephemeral-memory.js";
|
|
3
3
|
import { createTool } from "@mastra/core/tools";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/tools/workflows/run-workflow.ts
|
|
6
6
|
const runWorkflowTool = createTool({
|
|
7
7
|
id: "run-workflow",
|
|
8
8
|
description: "Run a saved workflow by id with the provided input data. Returns the run result inline. Use when the user asks you to \"run X\", \"execute X\", or asks for the outcome of a saved workflow.",
|
|
@@ -46,7 +46,6 @@ const runWorkflowTool = createTool({
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
//#endregion
|
|
50
49
|
export { runWorkflowTool };
|
|
51
50
|
|
|
52
51
|
//# sourceMappingURL=run-workflow.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createTool } from "@mastra/core/tools";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { WORKFLOW_BUILDER_MAPPING_CONFIG_DESCRIPTION as MAPPING_CONFIG_DESCRIPTION, normalizeWorkflowBuilderDefinition, workflowBuilderDefinitionSchema } from "@mastra/core/workflows/builder";
|
|
4
|
-
|
|
4
|
+
// src/tools/workflows/save-workflow.ts
|
|
5
5
|
const workflowDefinitionInputSchema = z.preprocess(normalizeWorkflowBuilderDefinition, workflowBuilderDefinitionSchema);
|
|
6
6
|
const saveWorkflowTool = createTool({
|
|
7
7
|
id: "save-workflow",
|
|
@@ -22,7 +22,6 @@ const saveWorkflowTool = createTool({
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
//#endregion
|
|
26
25
|
export { MAPPING_CONFIG_DESCRIPTION, saveWorkflowTool, workflowDefinitionInputSchema };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=save-workflow.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/tools/workflows/tool-ids.ts
|
|
2
2
|
const WORKFLOW_AUTHORING_TOOL_IDS = {
|
|
3
3
|
listAgents: "list-available-agents",
|
|
4
4
|
listClassifiers: "list-available-classifiers",
|
|
@@ -14,7 +14,6 @@ const WORKFLOW_MANAGEMENT_TOOL_IDS = {
|
|
|
14
14
|
deleteWorkflow: "delete-workflow"
|
|
15
15
|
};
|
|
16
16
|
const WORKFLOW_BUILDER_NOISE_TOOL_IDS = [...Object.values(WORKFLOW_AUTHORING_TOOL_IDS), ...Object.values(WORKFLOW_MANAGEMENT_TOOL_IDS)];
|
|
17
|
-
//#endregion
|
|
18
17
|
export { WORKFLOW_AUTHORING_TOOL_IDS, WORKFLOW_BUILDER_NOISE_TOOL_IDS, WORKFLOW_MANAGEMENT_TOOL_IDS };
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=tool-ids.js.map
|
package/dist/utils/binaries.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFile, execFileSync } from "child_process";
|
|
2
|
-
|
|
2
|
+
// src/utils/binaries.ts
|
|
3
3
|
const COMMON_BINARIES = [
|
|
4
4
|
"python",
|
|
5
5
|
"python3",
|
|
@@ -72,7 +72,6 @@ async function detectCommonBinariesAsync() {
|
|
|
72
72
|
inFlightPromise = null;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
//#endregion
|
|
76
75
|
export { detectCommonBinaries, detectCommonBinariesAsync };
|
|
77
76
|
|
|
78
77
|
//# sourceMappingURL=binaries.js.map
|
package/dist/utils/debug-log.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAppDataDir } from "./project.js";
|
|
2
2
|
import * as path$1 from "path";
|
|
3
3
|
import * as fs$1 from "fs";
|
|
4
|
-
|
|
4
|
+
// src/utils/debug-log.ts
|
|
5
5
|
const MAX_LOG_SIZE = 5242880;
|
|
6
6
|
const KEEP_SIZE = 4194304;
|
|
7
7
|
/**
|
|
@@ -53,7 +53,6 @@ function setupDebugLogging() {
|
|
|
53
53
|
console.warn = noop;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
//#endregion
|
|
57
56
|
export { setupDebugLogging, truncateLogFile };
|
|
58
57
|
|
|
59
58
|
//# sourceMappingURL=debug-log.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScoresStorage } from "@mastra/core/storage";
|
|
2
|
-
|
|
2
|
+
// src/utils/discarding-scores-storage.ts
|
|
3
3
|
/**
|
|
4
4
|
* A scores domain that accepts writes and keeps nothing.
|
|
5
5
|
*
|
|
@@ -48,7 +48,6 @@ function empty(pagination) {
|
|
|
48
48
|
scores: []
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
//#endregion
|
|
52
51
|
export { DiscardingScoresStorage };
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=discarding-scores-storage.js.map
|
package/dist/utils/errors.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../auth/provider-auth-error.js";
|
|
2
|
-
|
|
2
|
+
// src/utils/errors.ts
|
|
3
3
|
/**
|
|
4
4
|
* Error handling utilities for the Mastra Code TUI.
|
|
5
5
|
* Parses API errors and provides user-friendly messages.
|
|
@@ -190,7 +190,6 @@ async function withRetry(fn, options = {}) {
|
|
|
190
190
|
}
|
|
191
191
|
throw lastError?.originalError || /* @__PURE__ */ new Error("Retry failed");
|
|
192
192
|
}
|
|
193
|
-
//#endregion
|
|
194
193
|
export { parseError, sleep, withRetry };
|
|
195
194
|
|
|
196
195
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GatewayRegistry } from "@mastra/core/llm";
|
|
2
|
-
|
|
2
|
+
// src/utils/gateway-sync.ts
|
|
3
3
|
/**
|
|
4
4
|
* Gateway sync utility for keeping the model registry up to date.
|
|
5
5
|
*
|
|
@@ -55,7 +55,6 @@ function stopGatewaySync() {
|
|
|
55
55
|
syncInterval = null;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { startGatewaySync, stopGatewaySync, syncGateways };
|
|
60
59
|
|
|
61
60
|
//# sourceMappingURL=gateway-sync.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/local-observability.ts
|
|
2
2
|
/**
|
|
3
3
|
* Age limits for the local trace store: 14 days for spans, metrics and logs,
|
|
4
4
|
* 30 days for scores and feedback. Spans, logs and scores use the same windows
|
|
@@ -51,7 +51,6 @@ async function openLocalObservabilityStore(path) {
|
|
|
51
51
|
pruned: pruneExistingTables(store).catch(() => [])
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
//#endregion
|
|
55
54
|
export { LOCAL_OBSERVABILITY_RETENTION, openLocalObservabilityStore };
|
|
56
55
|
|
|
57
56
|
//# sourceMappingURL=local-observability.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAppDataDir } from "./project.js";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
|
|
4
|
+
// src/utils/maintenance-lock.ts
|
|
5
5
|
/**
|
|
6
6
|
* Mutual exclusion between storage maintenance (`mastracode prune`) and running
|
|
7
7
|
* mastracode sessions, using the same pid-file / stale-PID pattern as
|
|
@@ -193,7 +193,6 @@ function acquireMaintenanceLock() {
|
|
|
193
193
|
}
|
|
194
194
|
return release;
|
|
195
195
|
}
|
|
196
|
-
//#endregion
|
|
197
196
|
export { MALFORMED_PID_FILE_GRACE_MS, MaintenanceLockError, UNKNOWN_OWNER, acquireMaintenanceLock, getLiveSessionPids, getMaintenanceLockOwner, getMaintenanceLockPath, registerSession, registerSessionAndWaitForMaintenance, resetSessionRegistrationsForTesting, unregisterSession };
|
|
198
197
|
|
|
199
198
|
//# sourceMappingURL=maintenance-lock.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { notificationDispatchLeaseKey } from "./signals-pubsub.js";
|
|
2
2
|
import { dispatchDueNotifications } from "@mastra/core/notifications";
|
|
3
3
|
import { AsyncLocalStorage } from "async_hooks";
|
|
4
|
-
|
|
4
|
+
// src/utils/notification-dispatch.ts
|
|
5
5
|
const DEFAULT_INTERVAL_MS = 1e4;
|
|
6
6
|
const DEFAULT_LEASE_TTL_MS = 6e4;
|
|
7
7
|
/**
|
|
@@ -125,7 +125,6 @@ function createResourceNotificationDispatcher(options) {
|
|
|
125
125
|
tick
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
//#endregion
|
|
129
128
|
export { createResourceNotificationDispatcher, isDispatchingNotificationsFor, shouldHoldNotificationDelivery };
|
|
130
129
|
|
|
131
130
|
//# sourceMappingURL=notification-dispatch.js.map
|
package/dist/utils/open-url.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn } from "child_process";
|
|
2
|
-
|
|
2
|
+
// src/utils/open-url.ts
|
|
3
3
|
/**
|
|
4
4
|
* Best-effort browser opening for OAuth and other login flows.
|
|
5
5
|
*/
|
|
@@ -24,7 +24,6 @@ function openUrlInBrowser(url) {
|
|
|
24
24
|
child.on("error", () => {});
|
|
25
25
|
child.unref();
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { openUrlInBrowser };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=open-url.js.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
|
|
2
|
+
// src/utils/path-security.ts
|
|
3
3
|
function isPathWithinRoot(candidatePath, rootPath) {
|
|
4
4
|
const relativePath = path.relative(rootPath, candidatePath);
|
|
5
5
|
return relativePath === "" || !relativePath.startsWith(`..${path.sep}`) && relativePath !== ".." && !path.isAbsolute(relativePath);
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { isPathWithinRoot };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=path-security.js.map
|
package/dist/utils/plan-diff.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/plan-diff.ts
|
|
2
2
|
/** Produce structured diff entries between two plan texts using an LCS diff. */
|
|
3
3
|
function generatePlanDiff(oldText, newText) {
|
|
4
4
|
const oldLines = oldText.split(/\r?\n/);
|
|
@@ -56,7 +56,6 @@ function shouldShowDiff(previousPlan, plan, maxChangedRatio = .5) {
|
|
|
56
56
|
if (changed === 0) return false;
|
|
57
57
|
return changed / Math.max(entries.length, 1) <= maxChangedRatio;
|
|
58
58
|
}
|
|
59
|
-
//#endregion
|
|
60
59
|
export { generatePlanDiff, shouldShowDiff };
|
|
61
60
|
|
|
62
61
|
//# sourceMappingURL=plan-diff.js.map
|
package/dist/utils/plans.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DEFAULT_CONFIG_DIR } from "../constants.js";
|
|
|
2
2
|
import { getAppDataDir } from "./project.js";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs/promises";
|
|
5
|
-
|
|
5
|
+
// src/utils/plans.ts
|
|
6
6
|
/** Global plans directory for approved-plan archives. */
|
|
7
7
|
function getPlansDir() {
|
|
8
8
|
return process.env.MASTRA_PLANS_DIR ?? path.join(getAppDataDir(), "plans");
|
|
@@ -111,7 +111,6 @@ async function approvePlanFile(opts) {
|
|
|
111
111
|
});
|
|
112
112
|
return path.basename(planPath);
|
|
113
113
|
}
|
|
114
|
-
//#endregion
|
|
115
114
|
export { approvePlanFile, getLocalPlansDir, getLocalPlansRelativeDir, getPlanFilename, getPlansDir, getSuggestedPlanRelativePath, isPlanFilePath, readPlanFile, resolvePlanPath, savePlanToDisk };
|
|
116
115
|
|
|
117
116
|
//# sourceMappingURL=plans.js.map
|
package/dist/utils/project.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createHash } from "crypto";
|
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import { execFile, execSync } from "child_process";
|
|
6
6
|
import os from "os";
|
|
7
|
-
|
|
7
|
+
// src/utils/project.ts
|
|
8
8
|
/**
|
|
9
9
|
* Project detection utilities
|
|
10
10
|
*
|
|
@@ -358,7 +358,6 @@ function loadStringField(filePath, field) {
|
|
|
358
358
|
return null;
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
//#endregion
|
|
362
361
|
export { detectProject, getAppDataDir, getCurrentGitBranch, getCurrentGitBranchAsync, getDatabasePath, getObservabilityDatabasePath, getOmScope, getResourceIdOverride, getStorageConfig, getUserId, getUserName, getVectorDatabasePath };
|
|
363
362
|
|
|
364
363
|
//# sourceMappingURL=project.js.map
|
package/dist/utils/prune-cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import { DEFAULT_RETENTION, createStorageMaintenance, resolveLocalDbFiles, runSt
|
|
|
6
6
|
import { createStorage, createVectorStore } from "./storage-factory.js";
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { LibSQLVector } from "@mastra/libsql";
|
|
9
|
-
|
|
9
|
+
// src/utils/prune-cli.ts
|
|
10
10
|
/**
|
|
11
11
|
* `mastracode prune` — storage maintenance from a non-interactive shell.
|
|
12
12
|
*
|
|
@@ -121,7 +121,6 @@ function describeStorageTarget(config) {
|
|
|
121
121
|
if (config.connectionString) return `pg ${redactUrl(config.connectionString)}`;
|
|
122
122
|
return `pg postgres://${`${config.host ?? "localhost"}${config.port ? `:${config.port}` : ""}`}/${config.database ?? ""}`;
|
|
123
123
|
}
|
|
124
|
-
//#endregion
|
|
125
124
|
export { describeStorageTarget, runPruneCommand };
|
|
126
125
|
|
|
127
126
|
//# sourceMappingURL=prune-cli.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isAbsolute, join } from "path";
|
|
2
2
|
import { mkdir } from "fs/promises";
|
|
3
3
|
import { PubSub, UnixSocketPubSub } from "@mastra/core/events";
|
|
4
|
-
|
|
4
|
+
// src/utils/signals-pubsub.ts
|
|
5
5
|
const DEFAULT_SOCKET_ROOT = "/tmp/mc";
|
|
6
6
|
const SHARED_SCOPE_DIR = "_shared";
|
|
7
7
|
const THREAD_STREAM_PREFIX = "agent.thread-stream.";
|
|
@@ -406,7 +406,6 @@ var SignalsPubSub = class extends PubSub {
|
|
|
406
406
|
function createSignalsPubSub(resourceId, options) {
|
|
407
407
|
return new SignalsPubSub(resourceId, options);
|
|
408
408
|
}
|
|
409
|
-
//#endregion
|
|
410
409
|
export { createSignalsPubSub, notificationDispatchLeaseKey };
|
|
411
410
|
|
|
412
411
|
//# sourceMappingURL=signals-pubsub.js.map
|
|
@@ -3,7 +3,7 @@ import { isPathWithinRoot } from "./path-security.js";
|
|
|
3
3
|
import * as path$1 from "path";
|
|
4
4
|
import { promises } from "fs";
|
|
5
5
|
import { parse } from "yaml";
|
|
6
|
-
|
|
6
|
+
// src/utils/slash-command-loader.ts
|
|
7
7
|
/**
|
|
8
8
|
* Parse a command file and extract metadata and template
|
|
9
9
|
* Supports both frontmatter-based and plain markdown files
|
|
@@ -136,7 +136,6 @@ Shell commands with !command will be executed and output included.
|
|
|
136
136
|
console.error("Error initializing commands directory:", error);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
//#endregion
|
|
140
139
|
export { extractCommandName, getProjectCommandsDir, initCommandsDirectory, loadCustomCommands, parseCommandFile, scanCommandDirectory };
|
|
141
140
|
|
|
142
141
|
//# sourceMappingURL=slash-command-loader.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as path$1 from "path";
|
|
2
2
|
import { promises } from "fs";
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
|
-
|
|
4
|
+
// src/utils/slash-command-processor.ts
|
|
5
5
|
/**
|
|
6
6
|
* Process a slash command by replacing variables and executing shell commands
|
|
7
7
|
*/
|
|
@@ -103,7 +103,6 @@ function groupCommandsByNamespace(commands) {
|
|
|
103
103
|
}
|
|
104
104
|
return groups;
|
|
105
105
|
}
|
|
106
|
-
//#endregion
|
|
107
106
|
export { formatCommandForDisplay, groupCommandsByNamespace, processSlashCommand };
|
|
108
107
|
|
|
109
108
|
//# sourceMappingURL=slash-command-processor.js.map
|
package/dist/utils/stdin-pipe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs$1 from "fs";
|
|
2
2
|
import * as tty from "tty";
|
|
3
|
-
|
|
3
|
+
// src/utils/stdin-pipe.ts
|
|
4
4
|
/** Maximum piped input size (1 MB). Content beyond this is truncated. */
|
|
5
5
|
const MAX_PIPE_BYTES = 1048576;
|
|
6
6
|
/**
|
|
@@ -90,7 +90,6 @@ function reopenStdinFromTTY() {
|
|
|
90
90
|
});
|
|
91
91
|
return true;
|
|
92
92
|
}
|
|
93
|
-
//#endregion
|
|
94
93
|
export { drainPipedStdin, reopenStdinFromTTY, sanitizePipedOutput };
|
|
95
94
|
|
|
96
95
|
//# sourceMappingURL=stdin-pipe.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getDatabasePath, getVectorDatabasePath } from "./project.js";
|
|
2
2
|
import { DEFAULT_RETENTION } from "./storage-maintenance.js";
|
|
3
3
|
import { LibSQLStore, LibSQLVector } from "@mastra/libsql";
|
|
4
|
-
|
|
4
|
+
// src/utils/storage-factory.ts
|
|
5
5
|
const MASTRA_CODE_LOCAL_PRAGMAS = {
|
|
6
6
|
cacheSize: -128e3,
|
|
7
7
|
mmapSize: 536870912
|
|
@@ -115,7 +115,6 @@ async function createVectorStore(config, effectiveBackend = config.backend) {
|
|
|
115
115
|
authToken: libsqlConfig.vectorAuthToken
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
//#endregion
|
|
119
118
|
export { MASTRA_CODE_LOCAL_PRAGMAS, buildLibSQLStore, buildLibSQLVector, createStorage, createVectorStore };
|
|
120
119
|
|
|
121
120
|
//# sourceMappingURL=storage-factory.js.map
|
|
@@ -4,7 +4,7 @@ import { closeSync, existsSync, openSync, readSync, renameSync, rmSync, statSync
|
|
|
4
4
|
import { setFlagsFromString } from "v8";
|
|
5
5
|
import { runInNewContext } from "vm";
|
|
6
6
|
import Database from "libsql";
|
|
7
|
-
|
|
7
|
+
// src/utils/storage-maintenance.ts
|
|
8
8
|
/**
|
|
9
9
|
* Storage maintenance — retention defaults and disk reclamation for mastracode.
|
|
10
10
|
*
|
|
@@ -349,7 +349,6 @@ async function runStorageMaintenance(opts) {
|
|
|
349
349
|
const saved = compacted.reduce((sum, r) => sum + Math.max(0, r.bytesBefore - r.bytesAfter), 0);
|
|
350
350
|
log(skipSummary ? `Reclaimed ${formatBytes(saved)}; ${skipSummary}.` : `Reclaimed ${formatBytes(saved)}.`);
|
|
351
351
|
}
|
|
352
|
-
//#endregion
|
|
353
352
|
export { DEFAULT_RETENTION, createStorageMaintenance, formatBytes, reclaimLibSQLDisk, requiredFreeBytes, resolveLocalDbFiles, runStorageMaintenance };
|
|
354
353
|
|
|
355
354
|
//# sourceMappingURL=storage-maintenance.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAppDataDir } from "./project.js";
|
|
2
2
|
import * as path$1 from "path";
|
|
3
3
|
import * as fs$1 from "fs";
|
|
4
|
-
|
|
4
|
+
// src/utils/thread-lock.ts
|
|
5
5
|
/**
|
|
6
6
|
* Thread lock — ensures only one process writes to a thread at a time.
|
|
7
7
|
*
|
|
@@ -106,7 +106,6 @@ function releaseAllThreadLocks() {
|
|
|
106
106
|
}
|
|
107
107
|
} catch {}
|
|
108
108
|
}
|
|
109
|
-
//#endregion
|
|
110
109
|
export { ThreadLockError, acquireThreadLock, getThreadLockOwner, releaseAllThreadLocks, releaseThreadLock };
|
|
111
110
|
|
|
112
111
|
//# sourceMappingURL=thread-lock.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { estimateTokenCount, sliceByTokens } from "tokenx";
|
|
2
|
-
|
|
2
|
+
// src/utils/token-estimator.ts
|
|
3
3
|
function sanitizeInput(text) {
|
|
4
4
|
if (!text) return "";
|
|
5
5
|
return (typeof text === `string` ? text : JSON.stringify(text)).replaceAll(`<|endoftext|>`, ``).replaceAll(`<|endofprompt|>`, ``);
|
|
@@ -15,7 +15,6 @@ function truncateStringForTokenEstimate(text, desiredTokenCount, fromEnd = true)
|
|
|
15
15
|
return `[Truncated ~${totalTokens - desiredTokenCount} tokens]
|
|
16
16
|
${kept}`;
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { tokenEstimate, truncateStringForTokenEstimate };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=token-estimator.js.map
|
|
@@ -3,7 +3,7 @@ import { readFileSync, realpathSync } from "fs";
|
|
|
3
3
|
import { execFile } from "child_process";
|
|
4
4
|
import { homedir } from "os";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
|
-
|
|
6
|
+
// src/utils/update-check.ts
|
|
7
7
|
/**
|
|
8
8
|
* Check for newer versions of mastracode on npm.
|
|
9
9
|
*/
|
|
@@ -427,7 +427,6 @@ async function performUpdate(pm, targetVersion, plan) {
|
|
|
427
427
|
}
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
|
-
//#endregion
|
|
431
430
|
export { detectPackageManager, fetchChangelog, fetchLatestVersion, getCurrentVersion, getInstallCommand, isNewerVersion, locateOwnInstall, parseChangelog, performUpdate, planUpdate, resolveUpdateOutcome, runUpdate };
|
|
432
431
|
|
|
433
432
|
//# sourceMappingURL=update-check.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findSessionForThread } from "../agents/background-completion.js";
|
|
2
2
|
import { notificationDispatchLeaseKey } from "./signals-pubsub.js";
|
|
3
|
-
|
|
3
|
+
// src/utils/wake-session.ts
|
|
4
4
|
/** A session here serves the thread's resource, but the thread belongs to another project. */
|
|
5
5
|
const FOREIGN_THREAD = Symbol("foreign-thread");
|
|
6
6
|
/** A stable key for a session's thread scope, or `undefined` when it has none. */
|
|
@@ -80,7 +80,6 @@ function threadLeaseScope(session, metadata = {}) {
|
|
|
80
80
|
if (!keys.every((key) => metadata[key] !== void 0)) return void 0;
|
|
81
81
|
return threadScopeKey(Object.fromEntries(keys.map((key) => [key, String(metadata[key])])));
|
|
82
82
|
}
|
|
83
|
-
//#endregion
|
|
84
83
|
export { FOREIGN_THREAD, findWakeSession, sessionLeaseScopes, threadScopeKey };
|
|
85
84
|
|
|
86
85
|
//# sourceMappingURL=wake-session.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/voice/stt-registry.ts
|
|
2
2
|
/**
|
|
3
3
|
* The curated STT catalog. Order matters: the first entry for a provider is its
|
|
4
4
|
* default model, and the first overall entry (`openai`/`whisper-1`) is the
|
|
@@ -138,7 +138,6 @@ function resolveSTTModel(provider, model) {
|
|
|
138
138
|
}
|
|
139
139
|
return DEFAULT_STT_MODEL;
|
|
140
140
|
}
|
|
141
|
-
//#endregion
|
|
142
141
|
export { DEFAULT_STT_MODEL, DEFAULT_STT_PROVIDER, STT_MODELS, defaultModelForProvider, resolveSTTModel, sttModelsForProvider, sttProviders };
|
|
143
142
|
|
|
144
143
|
//# sourceMappingURL=stt-registry.js.map
|
|
@@ -5,7 +5,7 @@ import { LazyNotificationsStorage } from "../agents/tools.js";
|
|
|
5
5
|
import { workflowBuilderAgent } from "../agents/workflow-builder-agent.js";
|
|
6
6
|
import { LocalFilesystem, LocalSandbox, Workspace, createWorkspaceTools } from "@mastra/core/workspace";
|
|
7
7
|
import { createNotificationInboxTool } from "@mastra/core/notifications";
|
|
8
|
-
|
|
8
|
+
// src/workflows/register-primitives.ts
|
|
9
9
|
async function registerWorkflowBuilderPrimitives(mastra, options) {
|
|
10
10
|
const { projectPath, allowedPaths = [], codeAgent, mcpManager } = options;
|
|
11
11
|
mastra.addAgent(workflowBuilderAgent, "workflow-builder");
|
|
@@ -37,7 +37,6 @@ async function registerWorkflowBuilderPrimitives(mastra, options) {
|
|
|
37
37
|
}
|
|
38
38
|
if (mcpManager) for (const [toolId, tool] of Object.entries(mcpManager.getTools())) mastra.addTool(tool, toolId);
|
|
39
39
|
}
|
|
40
|
-
//#endregion
|
|
41
40
|
export { registerWorkflowBuilderPrimitives };
|
|
42
41
|
|
|
43
42
|
//# sourceMappingURL=register-primitives.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/workflows/service.ts
|
|
2
2
|
async function workflowDefinitionsStore(mastra) {
|
|
3
3
|
const storage = mastra.getStorage();
|
|
4
4
|
if (!storage) throw new Error("Storage is not configured on the Mastra instance.");
|
|
@@ -47,7 +47,6 @@ async function runWorkflow(mastra, workflowId, inputData, requestContext, onEven
|
|
|
47
47
|
} catch {}
|
|
48
48
|
return await output.result;
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { deleteWorkflow, getWorkflow, listWorkflows, runWorkflow };
|
|
52
51
|
|
|
53
52
|
//# sourceMappingURL=service.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/code-sdk",
|
|
3
|
-
"version": "1.15.1-alpha.
|
|
3
|
+
"version": "1.15.1-alpha.5",
|
|
4
4
|
"description": "Mastra Code SDK: the agent core behind Mastra Code (everything except the TUI) — build your own UIs and surfaces on top of it",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -45,50 +45,54 @@
|
|
|
45
45
|
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@agentclientprotocol/sdk": "^0.21.
|
|
49
|
-
"@ai-sdk/amazon-bedrock": "^3.0.
|
|
50
|
-
"@ai-sdk/anthropic": "^3.0.
|
|
51
|
-
"@ai-sdk/openai": "^3.0.
|
|
52
|
-
"@ai-sdk/openai-compatible": "^2.0.
|
|
53
|
-
"@ast-grep/napi": "^0.42.
|
|
54
|
-
"@aws-sdk/credential-providers": "^3.
|
|
55
|
-
"ai": "^6.0.
|
|
48
|
+
"@agentclientprotocol/sdk": "^0.21.1",
|
|
49
|
+
"@ai-sdk/amazon-bedrock": "^3.0.141",
|
|
50
|
+
"@ai-sdk/anthropic": "^3.0.135",
|
|
51
|
+
"@ai-sdk/openai": "^3.0.131",
|
|
52
|
+
"@ai-sdk/openai-compatible": "^2.0.87",
|
|
53
|
+
"@ast-grep/napi": "^0.42.3",
|
|
54
|
+
"@aws-sdk/credential-providers": "^3.1156.0",
|
|
55
|
+
"ai": "^6.0.315",
|
|
56
56
|
"execa": "^9.6.1",
|
|
57
57
|
"libsql": "^0.5.29",
|
|
58
|
-
"posthog-node": "^5.
|
|
58
|
+
"posthog-node": "^5.57.1",
|
|
59
59
|
"smol-toml": "1.9.0",
|
|
60
|
-
"tokenx": "^1.
|
|
60
|
+
"tokenx": "^1.6.0",
|
|
61
61
|
"vscode-jsonrpc": "^8.2.1",
|
|
62
|
-
"vscode-languageserver-protocol": "^3.18.
|
|
63
|
-
"yaml": "^2.
|
|
62
|
+
"vscode-languageserver-protocol": "^3.18.5",
|
|
63
|
+
"yaml": "^2.9.1",
|
|
64
64
|
"zod": "^4.6.7",
|
|
65
|
-
"@mastra/agent-browser": "0.5.
|
|
66
|
-
"@mastra/client-js": "1.57.0-alpha.
|
|
67
|
-
"@mastra/
|
|
68
|
-
"@mastra/fastembed": "1.3.5-alpha.1",
|
|
69
|
-
"@mastra/duckdb": "1.16.0-alpha.0",
|
|
65
|
+
"@mastra/agent-browser": "0.5.5-alpha.0",
|
|
66
|
+
"@mastra/client-js": "1.57.0-alpha.4",
|
|
67
|
+
"@mastra/duckdb": "1.16.0-alpha.1",
|
|
70
68
|
"@mastra/github-signals": "0.5.2",
|
|
71
|
-
"@mastra/
|
|
72
|
-
"@mastra/
|
|
73
|
-
"@mastra/
|
|
74
|
-
"@mastra/parallel": "0.1.
|
|
75
|
-
"@mastra/
|
|
76
|
-
"@mastra/
|
|
77
|
-
"@mastra/schema-compat": "1.3.
|
|
78
|
-
"@mastra/stagehand": "0.3.7-alpha.
|
|
79
|
-
"@mastra/tavily": "1.1.3"
|
|
69
|
+
"@mastra/mcp": "2.6.0-alpha.1",
|
|
70
|
+
"@mastra/libsql": "1.27.1-alpha.0",
|
|
71
|
+
"@mastra/fastembed": "1.3.5-alpha.2",
|
|
72
|
+
"@mastra/parallel": "0.1.4-alpha.0",
|
|
73
|
+
"@mastra/pg": "1.33.0-alpha.2",
|
|
74
|
+
"@mastra/memory": "1.39.1-alpha.2",
|
|
75
|
+
"@mastra/schema-compat": "1.3.17-alpha.0",
|
|
76
|
+
"@mastra/stagehand": "0.3.7-alpha.1",
|
|
77
|
+
"@mastra/tavily": "1.1.3",
|
|
78
|
+
"@mastra/observability": "1.21.1-alpha.2"
|
|
80
79
|
},
|
|
81
80
|
"devDependencies": {
|
|
82
|
-
"@copilotkit/aimock": "^1.
|
|
81
|
+
"@copilotkit/aimock": "^1.46.0",
|
|
83
82
|
"@libsql/client": "^0.18.0",
|
|
84
|
-
"@types/node": "22.
|
|
83
|
+
"@types/node": "22.19.15",
|
|
84
|
+
"msw": "^2.12.11",
|
|
85
85
|
"tsdown": "0.23.1",
|
|
86
|
-
"tsx": "^4.23.
|
|
86
|
+
"tsx": "^4.23.15",
|
|
87
87
|
"typescript": "^6.0.3",
|
|
88
88
|
"vitest": "4.1.12",
|
|
89
|
-
"@internal/lint": "0.0.145",
|
|
90
89
|
"@internal/types-builder": "0.0.120",
|
|
91
|
-
"@internal/workspace-test-utils": "0.0.89"
|
|
90
|
+
"@internal/workspace-test-utils": "0.0.89",
|
|
91
|
+
"@internal/lint": "0.0.145",
|
|
92
|
+
"@mastra/core": "1.80.0-alpha.4"
|
|
93
|
+
},
|
|
94
|
+
"peerDependencies": {
|
|
95
|
+
"@mastra/core": ">=1.80.0-0 <2.0.0-0"
|
|
92
96
|
},
|
|
93
97
|
"engines": {
|
|
94
98
|
"node": ">=22.19.0"
|