mastracode 0.20.0-alpha.5 → 0.20.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/agents/memory.d.ts.map +1 -1
  3. package/dist/analytics.d.ts +18 -0
  4. package/dist/analytics.d.ts.map +1 -0
  5. package/dist/{chunk-MRBSZXEB.js → chunk-IF34ACMO.js} +25 -7
  6. package/dist/chunk-IF34ACMO.js.map +1 -0
  7. package/dist/{chunk-6BXLJNXS.cjs → chunk-KNG5WGWI.cjs} +35 -6
  8. package/dist/chunk-KNG5WGWI.cjs.map +1 -0
  9. package/dist/{chunk-RFXWSWD7.cjs → chunk-O35I4LJB.cjs} +2196 -1036
  10. package/dist/chunk-O35I4LJB.cjs.map +1 -0
  11. package/dist/{chunk-HA5AIGC6.cjs → chunk-RGAZFJ3A.cjs} +60 -42
  12. package/dist/chunk-RGAZFJ3A.cjs.map +1 -0
  13. package/dist/{chunk-DRUKVGKO.js → chunk-UFGZAHVG.js} +1393 -233
  14. package/dist/chunk-UFGZAHVG.js.map +1 -0
  15. package/dist/{chunk-YJMT2SB2.js → chunk-YWSTUM47.js} +35 -6
  16. package/dist/chunk-YWSTUM47.js.map +1 -0
  17. package/dist/cli.cjs +148 -18
  18. package/dist/cli.cjs.map +1 -1
  19. package/dist/cli.js +131 -4
  20. package/dist/cli.js.map +1 -1
  21. package/dist/index.cjs +3 -3
  22. package/dist/index.d.ts +7 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/onboarding/settings.d.ts +9 -0
  26. package/dist/onboarding/settings.d.ts.map +1 -1
  27. package/dist/schema.d.ts +1 -0
  28. package/dist/schema.d.ts.map +1 -1
  29. package/dist/tui/chat-boundary-reconciliation.d.ts +4 -0
  30. package/dist/tui/chat-boundary-reconciliation.d.ts.map +1 -0
  31. package/dist/tui/command-dispatch.d.ts.map +1 -1
  32. package/dist/tui/commands/goal.d.ts.map +1 -1
  33. package/dist/tui/commands/login.d.ts.map +1 -1
  34. package/dist/tui/commands/om.d.ts +1 -0
  35. package/dist/tui/commands/om.d.ts.map +1 -1
  36. package/dist/tui/commands/settings.d.ts.map +1 -1
  37. package/dist/tui/commands/threads.d.ts.map +1 -1
  38. package/dist/tui/commands/types.d.ts +2 -0
  39. package/dist/tui/commands/types.d.ts.map +1 -1
  40. package/dist/tui/components/ask-question-dialog.d.ts +4 -0
  41. package/dist/tui/components/ask-question-dialog.d.ts.map +1 -1
  42. package/dist/tui/components/assistant-message.d.ts +2 -0
  43. package/dist/tui/components/assistant-message.d.ts.map +1 -1
  44. package/dist/tui/components/chat-boundary-spacer.d.ts +13 -0
  45. package/dist/tui/components/chat-boundary-spacer.d.ts.map +1 -0
  46. package/dist/tui/components/chat-spacing.d.ts +9 -0
  47. package/dist/tui/components/chat-spacing.d.ts.map +1 -0
  48. package/dist/tui/components/idle-counter.d.ts +14 -0
  49. package/dist/tui/components/idle-counter.d.ts.map +1 -0
  50. package/dist/tui/components/om-marker.d.ts +1 -0
  51. package/dist/tui/components/om-marker.d.ts.map +1 -1
  52. package/dist/tui/components/om-settings.d.ts +2 -0
  53. package/dist/tui/components/om-settings.d.ts.map +1 -1
  54. package/dist/tui/components/plan-approval-inline.d.ts +3 -0
  55. package/dist/tui/components/plan-approval-inline.d.ts.map +1 -1
  56. package/dist/tui/components/settings.d.ts +2 -0
  57. package/dist/tui/components/settings.d.ts.map +1 -1
  58. package/dist/tui/components/task-progress.d.ts +4 -0
  59. package/dist/tui/components/task-progress.d.ts.map +1 -1
  60. package/dist/tui/components/tool-execution-enhanced.d.ts +64 -2
  61. package/dist/tui/components/tool-execution-enhanced.d.ts.map +1 -1
  62. package/dist/tui/components/tool-execution-interface.d.ts +16 -1
  63. package/dist/tui/components/tool-execution-interface.d.ts.map +1 -1
  64. package/dist/tui/components/user-message.d.ts +4 -0
  65. package/dist/tui/components/user-message.d.ts.map +1 -1
  66. package/dist/tui/event-dispatch.d.ts +0 -3
  67. package/dist/tui/event-dispatch.d.ts.map +1 -1
  68. package/dist/tui/handlers/agent-lifecycle.d.ts.map +1 -1
  69. package/dist/tui/handlers/message.d.ts.map +1 -1
  70. package/dist/tui/handlers/om.d.ts.map +1 -1
  71. package/dist/tui/handlers/prompts.d.ts.map +1 -1
  72. package/dist/tui/handlers/tool.d.ts +0 -5
  73. package/dist/tui/handlers/tool.d.ts.map +1 -1
  74. package/dist/tui/handlers/types.d.ts +2 -0
  75. package/dist/tui/handlers/types.d.ts.map +1 -1
  76. package/dist/tui/mastra-tui.d.ts +8 -0
  77. package/dist/tui/mastra-tui.d.ts.map +1 -1
  78. package/dist/tui/modal-question.d.ts +2 -0
  79. package/dist/tui/modal-question.d.ts.map +1 -1
  80. package/dist/tui/render-messages.d.ts.map +1 -1
  81. package/dist/tui/setup.d.ts.map +1 -1
  82. package/dist/tui/state.d.ts +13 -1
  83. package/dist/tui/state.d.ts.map +1 -1
  84. package/dist/tui.cjs +19 -19
  85. package/dist/tui.js +2 -2
  86. package/package.json +9 -8
  87. package/dist/chunk-6BXLJNXS.cjs.map +0 -1
  88. package/dist/chunk-DRUKVGKO.js.map +0 -1
  89. package/dist/chunk-HA5AIGC6.cjs.map +0 -1
  90. package/dist/chunk-MRBSZXEB.js.map +0 -1
  91. package/dist/chunk-RFXWSWD7.cjs.map +0 -1
  92. package/dist/chunk-YJMT2SB2.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.20.0-alpha.7
4
+
5
+ ### Minor Changes
6
+
7
+ - Added PostHog product analytics for MastraCode sessions, prompts, thread changes, command usage, and interactive prompts. Set MASTRA_TELEMETRY_DISABLED=1 to disable telemetry. ([#15173](https://github.com/mastra-ai/mastra/pull/15173))
8
+
9
+ ### Patch Changes
10
+
11
+ - Improved MastraCode quiet mode so terminal sessions are easier to scan. ([#16771](https://github.com/mastra-ai/mastra/pull/16771))
12
+ - Quiet mode is now the default for new installs, and existing classic users get a one-time prompt to choose whether to enable it.
13
+ - Added compact tool previews with a configurable preview-line limit, including an option to hide previews.
14
+ - Improved repeated tool-call rendering, path continuation handling, task wrapping, shell/error previews, and spacing between tools, messages, plans, and completed subagents.
15
+ - Added edited line ranges to workspace edit results so tool UIs can show where replacements happened.
16
+
17
+ - Updated dependencies [[`ac79462`](https://github.com/mastra-ai/mastra/commit/ac79462b98f1062394c45093aa515b0766f27ee2), [`19281c7`](https://github.com/mastra-ai/mastra/commit/19281c70424f757219782de16c2699743c5e04d0)]:
18
+ - @mastra/core@1.36.0-alpha.5
19
+
20
+ ## 0.20.0-alpha.6
21
+
22
+ ### Minor Changes
23
+
24
+ - Added automatic return to Plan mode when a goal started from an approved plan finishes. ([#16676](https://github.com/mastra-ai/mastra/pull/16676))
25
+
26
+ ### Patch Changes
27
+
28
+ - Add an "Observe attachments" toggle in `/om` settings that controls whether ([#16682](https://github.com/mastra-ai/mastra/pull/16682))
29
+ file and image attachments are forwarded to the Observer LLM. Turn it off when
30
+ running with a text-only observer model. Stored as `omObserveAttachments` in
31
+ global settings and seeded into the harness state at startup.
32
+
33
+ - Updated MastraCode to use provider-aware Observational Memory idle activation. ([#16663](https://github.com/mastra-ai/mastra/pull/16663))
34
+
35
+ MastraCode now sets `activateAfterIdle: "auto"`, shows an idle-time counter above the input after one minute of inactivity, and combines back-to-back OM activation markers into a single line.
36
+
37
+ - Updated dependencies [[`c272d50`](https://github.com/mastra-ai/mastra/commit/c272d50610a54496b6b6d92ccd4d37b333a2613a), [`d8692af`](https://github.com/mastra-ai/mastra/commit/d8692afa253028e39cdce2aafa0ac414071a762e), [`14b69c6`](https://github.com/mastra-ai/mastra/commit/14b69c6b05ce1e50c140b030a48cafb41d0746e3), [`4bd4e8e`](https://github.com/mastra-ai/mastra/commit/4bd4e8e042f6687559f49a560a7914cee9b85447), [`841a222`](https://github.com/mastra-ai/mastra/commit/841a222560d8c19238f8213713f30535cdd82284), [`96d225b`](https://github.com/mastra-ai/mastra/commit/96d225b05ed52ff250e0a342a7e6398e291945f0)]:
38
+ - @mastra/core@1.36.0-alpha.4
39
+ - @mastra/memory@1.19.0-alpha.1
40
+ - @mastra/mcp@1.8.0-alpha.1
41
+ - @mastra/fastembed@1.1.0-alpha.0
42
+
3
43
  ## 0.20.0-alpha.5
4
44
 
5
45
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/agents/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAuExC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,YAAY,IAC3E,oBAAoB;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,YA0D/D"}
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/agents/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAuExC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,YAAY,IAC3E,oBAAoB;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,YA4D/D"}
@@ -0,0 +1,18 @@
1
+ export declare function getMastraAnalyticsDistinctId(hostname?: string): string;
2
+ export type MastraCodeAnalyticsEvent = 'mastracode_session_started' | 'mastracode_prompt_submitted' | 'mastracode_thread_changed' | 'mastracode_model_changed' | 'mastracode_command_used' | 'mastracode_interactive_prompt_shown';
3
+ export interface MastraCodeAnalytics {
4
+ capture(event: MastraCodeAnalyticsEvent, properties?: Record<string, unknown>): void;
5
+ trackCommand(command: string, properties?: Record<string, unknown>): void;
6
+ trackInteractivePrompt(promptType: string, properties?: Record<string, unknown>): void;
7
+ shutdown(): Promise<void>;
8
+ isEnabled(): boolean;
9
+ }
10
+ interface MastraCodeAnalyticsOptions {
11
+ version: string;
12
+ host?: string;
13
+ apiKey?: string;
14
+ }
15
+ export declare function isTelemetryDisabled(env?: NodeJS.ProcessEnv): boolean;
16
+ export declare function createMastraCodeAnalytics(options: MastraCodeAnalyticsOptions): MastraCodeAnalytics;
17
+ export {};
18
+ //# sourceMappingURL=analytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAUA,wBAAgB,4BAA4B,CAAC,QAAQ,SAAgB,GAAG,MAAM,CAE7E;AAeD,MAAM,MAAM,wBAAwB,GAChC,4BAA4B,GAC5B,6BAA6B,GAC7B,2BAA2B,GAC3B,0BAA0B,GAC1B,yBAAyB,GACzB,qCAAqC,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,KAAK,EAAE,wBAAwB,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrF,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1E,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC;CACtB;AAED,UAAU,0BAA0B;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA8FD,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAOjF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CAOlG"}
@@ -1,4 +1,4 @@
1
- import { setAuthStorage, setAuthStorage3, setAuthStorage2, loadSettings, MEMORY_GATEWAY_PROVIDER, getDynamicModel, getAvailableModePacks, getAvailableOmPacks, resolveModelDefaults, resolveOmRoleModel, mastra, releaseThreadLock, acquireThreadLock, getCustomProviderId, toCustomProviderModelId, getCopilotModelCatalog, saveSettings, resolveModel, OBSERVABILITY_AUTH_PREFIX } from './chunk-YJMT2SB2.js';
1
+ import { setAuthStorage, setAuthStorage3, setAuthStorage2, loadSettings, MEMORY_GATEWAY_PROVIDER, getDynamicModel, getAvailableModePacks, getAvailableOmPacks, resolveModelDefaults, resolveOmRoleModel, mastra, releaseThreadLock, acquireThreadLock, getCustomProviderId, toCustomProviderModelId, getCopilotModelCatalog, saveSettings, resolveModel, OBSERVABILITY_AUTH_PREFIX } from './chunk-YWSTUM47.js';
2
2
  import { AuthStorage, detectProject, getResourceIdOverride, getStorageConfig, getObservabilityDatabasePath, getVectorDatabasePath, getCurrentGitBranch, getOmScope, getDatabasePath, getAppDataDir } from './chunk-5YJR6NJL.js';
3
3
  import { MC_TOOLS, getToolCategory, TOOL_NAME_OVERRIDES } from './chunk-TTAAM2XR.js';
4
4
  import * as path from 'path';
@@ -1028,7 +1028,8 @@ function getDynamicMemory(storage, vector) {
1028
1028
  const refThreshold = state?.reflectionThreshold ?? DEFAULT_REF_THRESHOLD;
1029
1029
  const caveman = state?.cavemanObservations ?? false;
1030
1030
  const observerPreviousObservationTokens = 1e3;
1031
- const cacheKey = `${obsThreshold}:${refThreshold}:${omScope}:${observerPreviousObservationTokens}:${caveman ? 1 : 0}`;
1031
+ const observeAttachments = state?.observeAttachments ?? true;
1032
+ const cacheKey = `${obsThreshold}:${refThreshold}:${omScope}:${observerPreviousObservationTokens}:${caveman ? 1 : 0}:${observeAttachments ? 1 : 0}`;
1032
1033
  if (cachedMemory && cachedMemoryKey === cacheKey) {
1033
1034
  return cachedMemory;
1034
1035
  }
@@ -1047,7 +1048,7 @@ ${CAVEMAN_OM_INSTRUCTION}` : DYNAMIC_AGENTS_MD_INSTRUCTION;
1047
1048
  temporalMarkers: true,
1048
1049
  retrieval: vector ? { vector: true } : true,
1049
1050
  scope: omScope,
1050
- activateAfterIdle: "5m",
1051
+ activateAfterIdle: "auto",
1051
1052
  activateOnProviderChange: true,
1052
1053
  observation: {
1053
1054
  bufferTokens: isResourceScope ? false : 1 / 5,
@@ -1057,7 +1058,8 @@ ${CAVEMAN_OM_INSTRUCTION}` : DYNAMIC_AGENTS_MD_INSTRUCTION;
1057
1058
  blockAfter: 2,
1058
1059
  previousObserverTokens: observerPreviousObservationTokens,
1059
1060
  threadTitle: true,
1060
- instruction: observerInstruction
1061
+ instruction: observerInstruction,
1062
+ observeAttachments
1061
1063
  },
1062
1064
  reflection: {
1063
1065
  bufferActivation: isResourceScope ? void 0 : 1 / 2,
@@ -2672,6 +2674,11 @@ var stateSchema = z.object({
2672
2674
  // Off by default — caveman style is opt-in via `/om` settings; observers and
2673
2675
  // reflectors fall back to their built-in (prose) behavior unless enabled.
2674
2676
  cavemanObservations: z.boolean().default(false),
2677
+ // Whether OM forwards image/file attachment parts to the Observer LLM.
2678
+ // On by default; turn off when using a text-only observer model that
2679
+ // would error on multimodal input. Placeholder text lines for filtered
2680
+ // attachments are kept either way.
2681
+ observeAttachments: z.boolean().default(true),
2675
2682
  // Observational Memory scope — 'thread' (per-conversation) or 'resource' (shared across threads)
2676
2683
  omScope: z.enum(["thread", "resource"]).optional(),
2677
2684
  // Thinking level for model reasoning effort
@@ -2897,6 +2904,11 @@ async function createMastraCode(config) {
2897
2904
  project.resourceId = resourceIdOverride;
2898
2905
  project.resourceIdOverride = true;
2899
2906
  }
2907
+ const signalsPubSub = config?.pubsub;
2908
+ const crossProcessPubSub = config?.crossProcessPubSub ?? false;
2909
+ if (crossProcessPubSub && !signalsPubSub) {
2910
+ throw new Error("crossProcessPubSub requires a pubsub instance");
2911
+ }
2900
2912
  const storageConfig = config?.storage ?? getStorageConfig(project.rootPath, globalSettings.storage);
2901
2913
  const storageResult = await createStorage(storageConfig);
2902
2914
  const storageWarning = storageResult.warning;
@@ -3079,6 +3091,7 @@ async function createMastraCode(config) {
3079
3091
  const effectiveObservationThreshold = globalSettings.models.omObservationThreshold ?? void 0;
3080
3092
  const effectiveReflectionThreshold = globalSettings.models.omReflectionThreshold ?? void 0;
3081
3093
  const effectiveCavemanObservations = globalSettings.models.omCavemanObservations ?? void 0;
3094
+ const effectiveObserveAttachments = globalSettings.models.omObserveAttachments ?? void 0;
3082
3095
  const modes = (config?.modes ?? defaultModes).map((mode) => {
3083
3096
  const savedModel = effectiveDefaults[mode.id];
3084
3097
  return savedModel ? { ...mode, defaultModelId: savedModel } : mode;
@@ -3120,6 +3133,9 @@ async function createMastraCode(config) {
3120
3133
  if (effectiveCavemanObservations !== void 0) {
3121
3134
  globalInitialState.cavemanObservations = effectiveCavemanObservations;
3122
3135
  }
3136
+ if (effectiveObserveAttachments !== void 0) {
3137
+ globalInitialState.observeAttachments = effectiveObserveAttachments;
3138
+ }
3123
3139
  if (globalSettings.preferences.yolo !== null) {
3124
3140
  globalInitialState.yolo = globalSettings.preferences.yolo;
3125
3141
  }
@@ -3140,6 +3156,7 @@ async function createMastraCode(config) {
3140
3156
  storage,
3141
3157
  observability,
3142
3158
  memory,
3159
+ pubsub: signalsPubSub,
3143
3160
  stateSchema,
3144
3161
  subagents,
3145
3162
  resolveModel: (modelId) => resolveModel(modelId),
@@ -3230,7 +3247,7 @@ async function createMastraCode(config) {
3230
3247
  }
3231
3248
  return customModels;
3232
3249
  },
3233
- threadLock: {
3250
+ threadLock: crossProcessPubSub ? void 0 : {
3234
3251
  acquire: acquireThreadLock,
3235
3252
  release: releaseThreadLock
3236
3253
  }
@@ -3256,6 +3273,7 @@ async function createMastraCode(config) {
3256
3273
  resolveModel,
3257
3274
  storageWarning,
3258
3275
  observabilityWarning,
3276
+ signalsPubSub,
3259
3277
  builtinPacks,
3260
3278
  builtinOmPacks,
3261
3279
  effectiveDefaults
@@ -3263,5 +3281,5 @@ async function createMastraCode(config) {
3263
3281
  }
3264
3282
 
3265
3283
  export { createAuthStorage, createMastraCode };
3266
- //# sourceMappingURL=chunk-MRBSZXEB.js.map
3267
- //# sourceMappingURL=chunk-MRBSZXEB.js.map
3284
+ //# sourceMappingURL=chunk-IF34ACMO.js.map
3285
+ //# sourceMappingURL=chunk-IF34ACMO.js.map