@mastra/code-sdk 1.21.0-alpha.2 → 1.21.0-alpha.3

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.
@@ -14,15 +14,15 @@ export declare class LazyNotificationsStorage extends NotificationsStorage {
14
14
  private readonly storage;
15
15
  constructor(storage: MastraCompositeStore);
16
16
  private getNotificationsStorage;
17
- createNotification(input: CreateNotificationInput): Promise<import("@mastra/core/storage").NotificationRecord>;
18
- listNotifications(input: ListNotificationsInput): Promise<import("@mastra/core/storage").NotificationRecord[]>;
19
- listDueNotifications(input: ListDueNotificationsInput): Promise<import("@mastra/core/storage").NotificationRecord[]>;
17
+ createNotification(input: CreateNotificationInput): Promise<import("@mastra/core/notifications").NotificationRecord>;
18
+ listNotifications(input: ListNotificationsInput): Promise<import("@mastra/core/notifications").NotificationRecord[]>;
19
+ listDueNotifications(input: ListDueNotificationsInput): Promise<import("@mastra/core/notifications").NotificationRecord[]>;
20
20
  getNotification(input: {
21
21
  threadId: string;
22
22
  id: string;
23
- }): Promise<import("@mastra/core/storage").NotificationRecord | null>;
24
- updateNotification(input: UpdateNotificationInput): Promise<import("@mastra/core/storage").NotificationRecord>;
25
- updateNotificationsStatus(input: UpdateNotificationsStatusInput): Promise<import("@mastra/core/storage").NotificationRecord[]>;
23
+ }): Promise<import("@mastra/core/notifications").NotificationRecord | null>;
24
+ updateNotification(input: UpdateNotificationInput): Promise<import("@mastra/core/notifications").NotificationRecord>;
25
+ updateNotificationsStatus(input: UpdateNotificationsStatusInput): Promise<import("@mastra/core/notifications").NotificationRecord[]>;
26
26
  dangerouslyClearAll(): Promise<void>;
27
27
  }
28
28
  export type PostToolObserver = (context: ToolAfterHookContext) => void | Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/agents/tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAA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,GAAG,SAAS,EAC1B,MAAM,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAmB,GAC/C,IAAI,CA8BN"}
@@ -30,8 +30,9 @@ function wrapExperimentalAgent(agent, selection) {
30
30
  return agent;
31
31
  }
32
32
  function validateExperimentalAgent(agent, mastra, report = console.info) {
33
- const selection = isEventedAgent(agent) ? "evented" : isDurableAgent(agent) ? "durable" : null;
34
- if (!selection) return;
33
+ const evented = isEventedAgent(agent);
34
+ if (!evented && !isDurableAgent(agent)) return;
35
+ const selection = evented ? "evented" : "durable";
35
36
  if (selection === "evented" && (!mastra || agent.getMastraInstance() !== mastra)) throw new Error("Experimental agent \"evented\" requires the coding agent to be registered on a Mastra host before startup.");
36
37
  const workflowsStore = mastra?.getStorage()?.stores?.workflows;
37
38
  if (!workflowsStore) throw new Error(`Experimental agent "${selection}" requires a configured workflow storage domain.`);
@@ -1 +1 @@
1
- {"version":3,"file":"experimental-agent.js","names":[],"sources":["../src/experimental-agent.ts"],"sourcesContent":["import type { Agent } from '@mastra/core/agent';\nimport { createDurableAgent, createEventedAgent, isDurableAgent, isEventedAgent } from '@mastra/core/agent/durable';\nimport type { Mastra } from '@mastra/core/mastra';\n\nimport { parseExperimentalAgentSetting } from './onboarding/settings.js';\nimport type { ExperimentalAgent, GlobalSettings } from './onboarding/settings.js';\n\nexport interface ExperimentalAgentEnvironment {\n MASTRACODE_EXPERIMENTAL_AGENT?: string;\n}\n\nconst ACCEPTED_VALUES = '\"durable\", \"evented\", or unset';\n\nexport function parseExperimentalAgentEnvironment(\n env: ExperimentalAgentEnvironment = process.env,\n): ExperimentalAgent | null {\n const value = env.MASTRACODE_EXPERIMENTAL_AGENT;\n if (value === undefined || value === '') return null;\n if (value === 'durable' || value === 'evented') return value;\n throw new Error(`Invalid MASTRACODE_EXPERIMENTAL_AGENT value ${JSON.stringify(value)}. Expected ${ACCEPTED_VALUES}.`);\n}\n\nexport function resolveExperimentalAgent(\n settings: Pick<GlobalSettings, 'experimentalAgent' | '_experimentalAgentSettingsPath'>,\n env: ExperimentalAgentEnvironment = process.env,\n): ExperimentalAgent | null {\n const environmentSelection = parseExperimentalAgentEnvironment(env);\n if (environmentSelection) return environmentSelection;\n\n return parseExperimentalAgentSetting(settings.experimentalAgent, settings._experimentalAgentSettingsPath);\n}\n\n/**\n * Reads `MASTRACODE_AGENT_STREAMS`. `off` stops the plain coding agent publishing\n * its runs on a resumable stream; `on` or unset keeps the core default. Any other\n * value, including an empty string, throws so a typo can't silently leave streams on.\n */\nexport function resolveAgentStreamsOff(env: { MASTRACODE_AGENT_STREAMS?: string } = process.env): boolean {\n const value = env.MASTRACODE_AGENT_STREAMS;\n if (value === undefined || value === 'on') return false;\n if (value === 'off') return true;\n throw new Error(`Invalid MASTRACODE_AGENT_STREAMS value ${JSON.stringify(value)}. Expected \"on\", \"off\", or unset.`);\n}\n\nexport function wrapExperimentalAgent(agent: Agent, selection: ExperimentalAgent | null): Agent {\n if (selection === 'durable') return createDurableAgent({ agent }) as unknown as Agent;\n if (selection === 'evented') return createEventedAgent({ agent }) as unknown as Agent;\n return agent;\n}\n\ninterface WorkflowBackedAgent extends Agent {\n getWorkflow(): { engineType?: string };\n}\n\nexport function validateExperimentalAgent(\n agent: Agent,\n mastra: Mastra | undefined,\n report: (message: string) => void = console.info,\n): void {\n const selection: ExperimentalAgent | null = isEventedAgent(agent)\n ? 'evented'\n : isDurableAgent(agent)\n ? 'durable'\n : null;\n if (!selection) return;\n\n if (selection === 'evented' && (!mastra || agent.getMastraInstance() !== mastra)) {\n throw new Error(\n 'Experimental agent \"evented\" requires the coding agent to be registered on a Mastra host before startup.',\n );\n }\n\n const workflowsStore = mastra?.getStorage()?.stores?.workflows;\n if (!workflowsStore) {\n throw new Error(`Experimental agent \"${selection}\" requires a configured workflow storage domain.`);\n }\n if (selection === 'evented' && workflowsStore.supportsConcurrentUpdates?.() !== true) {\n throw new Error(\n 'Experimental agent \"evented\" requires workflow storage with atomic concurrent updates (supportsConcurrentUpdates() must return true).',\n );\n }\n\n const engineType = (agent as WorkflowBackedAgent).getWorkflow().engineType;\n const expectedEngine = selection === 'evented' ? 'evented' : 'default';\n if (engineType !== expectedEngine) {\n throw new Error(\n `Experimental agent \"${selection}\" resolved workflow engine ${JSON.stringify(engineType)} instead of \"${expectedEngine}\".`,\n );\n }\n\n report(`Experimental agent: ${selection} (workflow engine: ${engineType})`);\n}\n"],"mappings":";;;AAWA,MAAM,kBAAkB;AAExB,SAAgB,kCACd,MAAoC,QAAQ,KAClB;CAC1B,MAAM,QAAQ,IAAI;CAClB,IAAI,UAAU,KAAA,KAAa,UAAU,IAAI,OAAO;CAChD,IAAI,UAAU,aAAa,UAAU,WAAW,OAAO;CACvD,MAAM,IAAI,MAAM,+CAA+C,KAAK,UAAU,KAAK,EAAE,aAAa,gBAAgB,EAAE;AACtH;AAEA,SAAgB,yBACd,UACA,MAAoC,QAAQ,KAClB;CAC1B,MAAM,uBAAuB,kCAAkC,GAAG;CAClE,IAAI,sBAAsB,OAAO;CAEjC,OAAO,8BAA8B,SAAS,mBAAmB,SAAS,8BAA8B;AAC1G;;;;;;AAOA,SAAgB,uBAAuB,MAA6C,QAAQ,KAAc;CACxG,MAAM,QAAQ,IAAI;CAClB,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM,OAAO;CAClD,IAAI,UAAU,OAAO,OAAO;CAC5B,MAAM,IAAI,MAAM,0CAA0C,KAAK,UAAU,KAAK,EAAE,kCAAkC;AACpH;AAEA,SAAgB,sBAAsB,OAAc,WAA4C;CAC9F,IAAI,cAAc,WAAW,OAAO,mBAAmB,EAAE,MAAM,CAAC;CAChE,IAAI,cAAc,WAAW,OAAO,mBAAmB,EAAE,MAAM,CAAC;CAChE,OAAO;AACT;AAMA,SAAgB,0BACd,OACA,QACA,SAAoC,QAAQ,MACtC;CACN,MAAM,YAAsC,eAAe,KAAK,IAC5D,YACA,eAAe,KAAK,IAClB,YACA;CACN,IAAI,CAAC,WAAW;CAEhB,IAAI,cAAc,cAAc,CAAC,UAAU,MAAM,kBAAkB,MAAM,SACvE,MAAM,IAAI,MACR,4GACF;CAGF,MAAM,iBAAiB,QAAQ,WAAW,CAAC,EAAE,QAAQ;CACrD,IAAI,CAAC,gBACH,MAAM,IAAI,MAAM,uBAAuB,UAAU,iDAAiD;CAEpG,IAAI,cAAc,aAAa,eAAe,4BAA4B,MAAM,MAC9E,MAAM,IAAI,MACR,yIACF;CAGF,MAAM,aAAc,MAA8B,YAAY,CAAC,CAAC;CAChE,MAAM,iBAAiB,cAAc,YAAY,YAAY;CAC7D,IAAI,eAAe,gBACjB,MAAM,IAAI,MACR,uBAAuB,UAAU,6BAA6B,KAAK,UAAU,UAAU,EAAE,eAAe,eAAe,GACzH;CAGF,OAAO,uBAAuB,UAAU,qBAAqB,WAAW,EAAE;AAC5E"}
1
+ {"version":3,"file":"experimental-agent.js","names":[],"sources":["../src/experimental-agent.ts"],"sourcesContent":["import type { Agent } from '@mastra/core/agent';\nimport { createDurableAgent, createEventedAgent, isDurableAgent, isEventedAgent } from '@mastra/core/agent/durable';\nimport type { Mastra } from '@mastra/core/mastra';\n\nimport { parseExperimentalAgentSetting } from './onboarding/settings.js';\nimport type { ExperimentalAgent, GlobalSettings } from './onboarding/settings.js';\n\nexport interface ExperimentalAgentEnvironment {\n MASTRACODE_EXPERIMENTAL_AGENT?: string;\n}\n\nconst ACCEPTED_VALUES = '\"durable\", \"evented\", or unset';\n\nexport function parseExperimentalAgentEnvironment(\n env: ExperimentalAgentEnvironment = process.env,\n): ExperimentalAgent | null {\n const value = env.MASTRACODE_EXPERIMENTAL_AGENT;\n if (value === undefined || value === '') return null;\n if (value === 'durable' || value === 'evented') return value;\n throw new Error(`Invalid MASTRACODE_EXPERIMENTAL_AGENT value ${JSON.stringify(value)}. Expected ${ACCEPTED_VALUES}.`);\n}\n\nexport function resolveExperimentalAgent(\n settings: Pick<GlobalSettings, 'experimentalAgent' | '_experimentalAgentSettingsPath'>,\n env: ExperimentalAgentEnvironment = process.env,\n): ExperimentalAgent | null {\n const environmentSelection = parseExperimentalAgentEnvironment(env);\n if (environmentSelection) return environmentSelection;\n\n return parseExperimentalAgentSetting(settings.experimentalAgent, settings._experimentalAgentSettingsPath);\n}\n\n/**\n * Reads `MASTRACODE_AGENT_STREAMS`. `off` stops the plain coding agent publishing\n * its runs on a resumable stream; `on` or unset keeps the core default. Any other\n * value, including an empty string, throws so a typo can't silently leave streams on.\n */\nexport function resolveAgentStreamsOff(env: { MASTRACODE_AGENT_STREAMS?: string } = process.env): boolean {\n const value = env.MASTRACODE_AGENT_STREAMS;\n if (value === undefined || value === 'on') return false;\n if (value === 'off') return true;\n throw new Error(`Invalid MASTRACODE_AGENT_STREAMS value ${JSON.stringify(value)}. Expected \"on\", \"off\", or unset.`);\n}\n\nexport function wrapExperimentalAgent(agent: Agent, selection: ExperimentalAgent | null): Agent {\n if (selection === 'durable') return createDurableAgent({ agent }) as unknown as Agent;\n if (selection === 'evented') return createEventedAgent({ agent }) as unknown as Agent;\n return agent;\n}\n\nexport function validateExperimentalAgent(\n agent: Agent,\n mastra: Mastra | undefined,\n report: (message: string) => void = console.info,\n): void {\n const evented = isEventedAgent(agent);\n if (!evented && !isDurableAgent(agent)) return;\n const selection: ExperimentalAgent = evented ? 'evented' : 'durable';\n\n if (selection === 'evented' && (!mastra || agent.getMastraInstance() !== mastra)) {\n throw new Error(\n 'Experimental agent \"evented\" requires the coding agent to be registered on a Mastra host before startup.',\n );\n }\n\n const workflowsStore = mastra?.getStorage()?.stores?.workflows;\n if (!workflowsStore) {\n throw new Error(`Experimental agent \"${selection}\" requires a configured workflow storage domain.`);\n }\n if (selection === 'evented' && workflowsStore.supportsConcurrentUpdates?.() !== true) {\n throw new Error(\n 'Experimental agent \"evented\" requires workflow storage with atomic concurrent updates (supportsConcurrentUpdates() must return true).',\n );\n }\n\n const engineType = agent.getWorkflow().engineType;\n const expectedEngine = selection === 'evented' ? 'evented' : 'default';\n if (engineType !== expectedEngine) {\n throw new Error(\n `Experimental agent \"${selection}\" resolved workflow engine ${JSON.stringify(engineType)} instead of \"${expectedEngine}\".`,\n );\n }\n\n report(`Experimental agent: ${selection} (workflow engine: ${engineType})`);\n}\n"],"mappings":";;;AAWA,MAAM,kBAAkB;AAExB,SAAgB,kCACd,MAAoC,QAAQ,KAClB;CAC1B,MAAM,QAAQ,IAAI;CAClB,IAAI,UAAU,KAAA,KAAa,UAAU,IAAI,OAAO;CAChD,IAAI,UAAU,aAAa,UAAU,WAAW,OAAO;CACvD,MAAM,IAAI,MAAM,+CAA+C,KAAK,UAAU,KAAK,EAAE,aAAa,gBAAgB,EAAE;AACtH;AAEA,SAAgB,yBACd,UACA,MAAoC,QAAQ,KAClB;CAC1B,MAAM,uBAAuB,kCAAkC,GAAG;CAClE,IAAI,sBAAsB,OAAO;CAEjC,OAAO,8BAA8B,SAAS,mBAAmB,SAAS,8BAA8B;AAC1G;;;;;;AAOA,SAAgB,uBAAuB,MAA6C,QAAQ,KAAc;CACxG,MAAM,QAAQ,IAAI;CAClB,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM,OAAO;CAClD,IAAI,UAAU,OAAO,OAAO;CAC5B,MAAM,IAAI,MAAM,0CAA0C,KAAK,UAAU,KAAK,EAAE,kCAAkC;AACpH;AAEA,SAAgB,sBAAsB,OAAc,WAA4C;CAC9F,IAAI,cAAc,WAAW,OAAO,mBAAmB,EAAE,MAAM,CAAC;CAChE,IAAI,cAAc,WAAW,OAAO,mBAAmB,EAAE,MAAM,CAAC;CAChE,OAAO;AACT;AAEA,SAAgB,0BACd,OACA,QACA,SAAoC,QAAQ,MACtC;CACN,MAAM,UAAU,eAAe,KAAK;CACpC,IAAI,CAAC,WAAW,CAAC,eAAe,KAAK,GAAG;CACxC,MAAM,YAA+B,UAAU,YAAY;CAE3D,IAAI,cAAc,cAAc,CAAC,UAAU,MAAM,kBAAkB,MAAM,SACvE,MAAM,IAAI,MACR,4GACF;CAGF,MAAM,iBAAiB,QAAQ,WAAW,CAAC,EAAE,QAAQ;CACrD,IAAI,CAAC,gBACH,MAAM,IAAI,MAAM,uBAAuB,UAAU,iDAAiD;CAEpG,IAAI,cAAc,aAAa,eAAe,4BAA4B,MAAM,MAC9E,MAAM,IAAI,MACR,yIACF;CAGF,MAAM,aAAa,MAAM,YAAY,CAAC,CAAC;CACvC,MAAM,iBAAiB,cAAc,YAAY,YAAY;CAC7D,IAAI,eAAe,gBACjB,MAAM,IAAI,MACR,uBAAuB,UAAU,6BAA6B,KAAK,UAAU,UAAU,EAAE,eAAe,eAAe,GACzH;CAGF,OAAO,uBAAuB,UAAU,qBAAqB,WAAW,EAAE;AAC5E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/code-sdk",
3
- "version": "1.21.0-alpha.2",
3
+ "version": "1.21.0-alpha.3",
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": {
@@ -63,8 +63,8 @@
63
63
  "vscode-languageserver-protocol": "^3.18.5",
64
64
  "yaml": "^2.9.1",
65
65
  "zod": "^4.6.7",
66
- "@mastra/agent-browser": "0.6.0",
67
- "@mastra/client-js": "1.61.2-alpha.2",
66
+ "@mastra/agent-browser": "0.7.0-alpha.0",
67
+ "@mastra/client-js": "1.61.2-alpha.3",
68
68
  "@mastra/duckdb": "1.19.1",
69
69
  "@mastra/fastembed": "1.4.0-alpha.0",
70
70
  "@mastra/github-signals": "0.5.3",
@@ -94,7 +94,7 @@
94
94
  "@internal/lint": "0.0.151",
95
95
  "@internal/types-builder": "0.0.126",
96
96
  "@internal/workspace-test-utils": "0.0.95",
97
- "@mastra/core": "1.86.0-alpha.2"
97
+ "@mastra/core": "1.86.0-alpha.3"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@mastra/core": ">=1.85.1-0 <2.0.0-0"