@mastra/code-sdk 1.6.0-alpha.8 → 1.6.0
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/README.md +6 -120
- package/dist/agents/memory.d.ts +1 -1
- package/dist/agents/memory.d.ts.map +1 -1
- package/dist/agents/memory.js +6 -7
- package/dist/agents/memory.js.map +1 -1
- package/package.json +18 -18
package/README.md
CHANGED
|
@@ -24,128 +24,14 @@ const { mastra, controller } = await mountAgentControllerOnMastra({
|
|
|
24
24
|
});
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## Documentation
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
import { Mastra } from '@mastra/core/mastra';
|
|
31
|
-
import { prepareAgentControllerMount } from '@mastra/code-sdk';
|
|
32
|
-
|
|
33
|
-
const prepared = await prepareAgentControllerMount({ cwd: process.cwd() });
|
|
34
|
-
|
|
35
|
-
export const mastra = new Mastra(prepared.mastraArgs);
|
|
36
|
-
|
|
37
|
-
await prepared.finalize();
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Add input processors
|
|
41
|
-
|
|
42
|
-
Embedding surfaces can prepend stateless input processors without replacing Mastra Code's required policy and compatibility processors:
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
const phaseProcessor = {
|
|
46
|
-
id: 'current-phase',
|
|
47
|
-
async processInputStep({ messages }) {
|
|
48
|
-
await reconcileCompletedTools(messages);
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const prepared = await prepareAgentControllerMount({
|
|
53
|
-
cwd: process.cwd(),
|
|
54
|
-
inputProcessors: [phaseProcessor],
|
|
55
|
-
});
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Configured processors run before Mastra Code's built-in input processors. Keep processor instances stateless because the mounted agent shares them across sessions and runs.
|
|
59
|
-
|
|
60
|
-
## Process memory diagnostics
|
|
61
|
-
|
|
62
|
-
Use `ProcessMemoryDiagnostics` to collect low-perturbation memory evidence from a long-running Node.js process. The service records process memory, V8 heap-space statistics, naturally occurring garbage collection (GC) events, and sampled allocation profiles. It doesn't force GC or write heap snapshots.
|
|
63
|
-
|
|
64
|
-
> **Warning:** Allocation profiles can contain prompts, credentials, file contents, and tool arguments. Store them in a restricted location, don't upload them as telemetry, and delete them when you finish the investigation.
|
|
65
|
-
|
|
66
|
-
The environment factory applies the supported defaults and validation rules:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
import {
|
|
70
|
-
createProcessMemoryDiagnosticsFromEnvironment,
|
|
71
|
-
startConfiguredProcessMemoryDiagnostics,
|
|
72
|
-
} from '@mastra/code-sdk/process-memory-diagnostics';
|
|
73
|
-
|
|
74
|
-
const setup = createProcessMemoryDiagnosticsFromEnvironment(process.env);
|
|
75
|
-
const diagnostics = await startConfiguredProcessMemoryDiagnostics(setup, warning => {
|
|
76
|
-
console.warn(warning);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
// Create and run your Mastra Code process adapter.
|
|
81
|
-
} finally {
|
|
82
|
-
await diagnostics.stop();
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Construct and start diagnostics before creating Mastra Code. Stop work-producing services first during shutdown, then await `diagnostics.stop()` to write the final process sample and allocation profile.
|
|
29
|
+
- [@mastra/code-sdk documentation](https://mastra.ai/reference/code-sdk/mount-agent-controller)
|
|
87
30
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
| Environment variable | Default | Minimum | Description |
|
|
91
|
-
| ---------------------------------------------- | --------------------------------- | ------- | ----------------------------------------------------------- |
|
|
92
|
-
| `MASTRACODE_PROFILE` | Disabled | N/A | Enables startup profiling for `1`, `true`, `yes`, or `on` |
|
|
93
|
-
| `MASTRACODE_PROFILE_DIR` | `<Mastra Code app-data>/profiles` | N/A | Parent directory for private, unique run directories |
|
|
94
|
-
| `MASTRACODE_PROFILE_SAMPLE_INTERVAL_MS` | `10000` | `1000` | Process and V8 sample interval in milliseconds |
|
|
95
|
-
| `MASTRACODE_PROFILE_CAPTURE_INTERVAL_MS` | `300000` | `10000` | Durable allocation-profile capture interval in milliseconds |
|
|
96
|
-
| `MASTRACODE_PROFILE_ALLOCATION_INTERVAL_BYTES` | `524288` | `32768` | V8 allocation-sampling interval in bytes |
|
|
97
|
-
|
|
98
|
-
Truthy values are case-insensitive and may contain surrounding whitespace. Other values leave startup profiling disabled. Invalid numeric values produce an actionable error instead of starting a higher-overhead profiler.
|
|
99
|
-
|
|
100
|
-
### Artifacts
|
|
101
|
-
|
|
102
|
-
Each run directory contains:
|
|
103
|
-
|
|
104
|
-
- `metadata.json`: Immutable runtime and configuration metadata
|
|
105
|
-
- `process-samples.jsonl`: Append-only RSS, JavaScript heap, external memory, ArrayBuffer memory, resource usage, and V8 heap-space samples
|
|
106
|
-
- `gc-events.jsonl`: Append-only GC kind, flags, duration, and nearby memory values when V8 emits GC performance entries. A run can contain zero events.
|
|
107
|
-
- `allocation-<sequence>-<timestamp>.heapprofile`: Atomic Chrome allocation-sampling profiles. Each capture closes one sampling epoch and immediately starts the next.
|
|
108
|
-
|
|
109
|
-
The service requests mode `0700` for run directories and `0600` for files on POSIX systems. Other platforms may apply permissions differently.
|
|
110
|
-
|
|
111
|
-
Compare JavaScript heap growth with resident set size (RSS). Rising heap-space usage points to retained JavaScript objects. Rising RSS with a stable JavaScript heap can point to external buffers, ArrayBuffers, native libraries, memory-mapped files, or allocator behavior. Allocation profiles include objects collected by major and minor GC, which helps distinguish sustained retention from transient allocation pressure.
|
|
112
|
-
|
|
113
|
-
Sampling and periodic writes add overhead. Larger allocation intervals and longer capture intervals reduce it. A manual or periodic capture rotates allocation sampling without triggering a heap snapshot or forced GC.
|
|
114
|
-
|
|
115
|
-
Atomically completed captures survive later `SIGINT`, `SIGTERM`, `SIGHUP`, `SIGKILL`, or native crashes. Awaited shutdown can write a final capture for graceful signals and application errors. JavaScript can't guarantee a final capture after immediate `SIGKILL`, a native crash, or power loss, so use periodic captures for those cases.
|
|
116
|
-
|
|
117
|
-
Delete a run after analysis with your platform's file-removal tools. Never commit captured profiles.
|
|
118
|
-
|
|
119
|
-
## Dynamic workflows
|
|
120
|
-
|
|
121
|
-
The local controller registers the Workflow Builder before workers start. In build mode, users can ask the code agent to create a workflow in natural language. The builder discovers registered agents, tools, and workflows, validates a complete definition, then persists and registers it immediately.
|
|
122
|
-
|
|
123
|
-
Use the workflow service to manage saved workflows from a custom SDK surface:
|
|
124
|
-
|
|
125
|
-
```ts
|
|
126
|
-
import { deleteWorkflow, getWorkflow, listWorkflows, runWorkflow } from '@mastra/code-sdk/workflows/service';
|
|
127
|
-
|
|
128
|
-
const { workflows } = await listWorkflows(mastra);
|
|
129
|
-
const firstWorkflow = workflows[0];
|
|
130
|
-
if (!firstWorkflow) throw new Error('No Dynamic Workflows are available.');
|
|
131
|
-
|
|
132
|
-
const definition = await getWorkflow(mastra, firstWorkflow.id);
|
|
133
|
-
if (!definition) throw new Error(`Workflow "${firstWorkflow.id}" was not found.`);
|
|
134
|
-
|
|
135
|
-
const result = await runWorkflow(mastra, definition.id, { topic: 'dynamic workflows' });
|
|
136
|
-
await deleteWorkflow(mastra, definition.id);
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Pass the session request context to `runWorkflow` when workflow agent steps need the session-selected model. You can also pass an event callback as the fifth argument to render workflow step progress.
|
|
140
|
-
|
|
141
|
-
Deep modules are available as subpath imports, e.g.:
|
|
142
|
-
|
|
143
|
-
```ts
|
|
144
|
-
import { loadSettings } from '@mastra/code-sdk/onboarding/settings';
|
|
145
|
-
```
|
|
31
|
+
## Changelog
|
|
146
32
|
|
|
147
|
-
|
|
33
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/mastracode/sdk/CHANGELOG.md) for version history and release notes.
|
|
148
34
|
|
|
149
|
-
##
|
|
35
|
+
## Support
|
|
150
36
|
|
|
151
|
-
|
|
37
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/agents/memory.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { MastraCompositeStore } from '@mastra/core/storage';
|
|
|
3
3
|
import type { MastraVector } from '@mastra/core/vector';
|
|
4
4
|
import { Memory } from '@mastra/memory';
|
|
5
5
|
/**
|
|
6
|
-
* The organization rung local (TUI/studio) knowledge is
|
|
6
|
+
* The organization rung local (TUI/studio) knowledge is curated under. A fixed
|
|
7
7
|
* literal on purpose: deriving it from a hostname or path would fragment local
|
|
8
8
|
* knowledge per checkout into scopes nothing ever reads.
|
|
9
9
|
*/
|
|
@@ -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,EAAgB,MAAM,gBAAgB,CAAC;AAkEtD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,UAAU,CAAC;AA6B9C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,YAAY,IAM3E,oBAAoB;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,
|
|
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,EAAgB,MAAM,gBAAgB,CAAC;AAkEtD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,UAAU,CAAC;AA6B9C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,YAAY,IAM3E,oBAAoB;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,YA0G/D"}
|
package/dist/agents/memory.js
CHANGED
|
@@ -55,7 +55,7 @@ Don't say "Agent did x", say "did x". It will be assumed the agent did what was
|
|
|
55
55
|
|
|
56
56
|
Drop caveman for: security warnings, irreversible action confirmations, multi-step sequences where fragment order risks misread, user asks to clarify or repeats question, and anything that requires remembering verbatim content. Resume caveman after clear part done`;
|
|
57
57
|
/**
|
|
58
|
-
* The organization rung local (TUI/studio) knowledge is
|
|
58
|
+
* The organization rung local (TUI/studio) knowledge is curated under. A fixed
|
|
59
59
|
* literal on purpose: deriving it from a hostname or path would fragment local
|
|
60
60
|
* knowledge per checkout into scopes nothing ever reads.
|
|
61
61
|
*/
|
|
@@ -70,7 +70,7 @@ function reportOrgUnresolved(controller, factoryProjectId) {
|
|
|
70
70
|
reportedOrgUnresolved.add(sessionId);
|
|
71
71
|
}
|
|
72
72
|
const session = controller?.session;
|
|
73
|
-
console.error(`[Subconscious] Knowledge
|
|
73
|
+
console.error(`[Subconscious] Knowledge curation disabled: no organization resolved for session ${session?.id ?? "unknown"} (project ${factoryProjectId ?? "none"}). Knowledge is not written rather than written where it cannot be read.`);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Dynamic memory factory function.
|
|
@@ -97,14 +97,14 @@ function getDynamicMemory(storage, vector) {
|
|
|
97
97
|
} else requestContext.set("organizationId", LOCAL_KNOWLEDGE_ORG_ID);
|
|
98
98
|
if (isFactory) requestContext.set("knowledgeResourceId", factoryProjectId);
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const subconsciousAvailable = subconsciousEnabled && !orgUnresolvedRefusal;
|
|
101
101
|
const omScope = state?.omScope ?? getOmScope(state?.projectPath);
|
|
102
102
|
const obsThreshold = state?.observationThreshold ?? 3e4;
|
|
103
103
|
const refThreshold = state?.reflectionThreshold ?? 4e4;
|
|
104
104
|
const caveman = state?.cavemanObservations ?? false;
|
|
105
105
|
const observerPreviousObservationTokens = 1e3;
|
|
106
106
|
const observeAttachments = state?.observeAttachments;
|
|
107
|
-
const cacheKey = `${obsThreshold}:${refThreshold}:${omScope}:${observerPreviousObservationTokens}:${caveman ? 1 : 0}:${observeAttachments}:${isFactory ? 1 : 0}:${
|
|
107
|
+
const cacheKey = `${obsThreshold}:${refThreshold}:${omScope}:${observerPreviousObservationTokens}:${caveman ? 1 : 0}:${observeAttachments}:${isFactory ? 1 : 0}:${subconsciousAvailable ? 1 : 0}`;
|
|
108
108
|
if (cachedMemory && cachedMemoryKey === cacheKey) return cachedMemory;
|
|
109
109
|
const isResourceScope = omScope === "resource";
|
|
110
110
|
const observerInstruction = caveman ? `${DYNAMIC_AGENTS_MD_INSTRUCTION}\n\n${CAVEMAN_OM_INSTRUCTION}` : DYNAMIC_AGENTS_MD_INSTRUCTION;
|
|
@@ -119,11 +119,10 @@ function getDynamicMemory(storage, vector) {
|
|
|
119
119
|
enabled: true,
|
|
120
120
|
temporalMarkers: true,
|
|
121
121
|
retrieval: vector ? { vector: true } : true,
|
|
122
|
-
experimental_subconscious:
|
|
122
|
+
experimental_subconscious: subconsciousAvailable ? new Subconscious({
|
|
123
123
|
defaultScope: "resource",
|
|
124
124
|
maxScope: "resource",
|
|
125
|
-
pins:
|
|
126
|
-
...isFactory ? { curationCadence: 3 } : {},
|
|
125
|
+
pins: true,
|
|
127
126
|
...isFactory ? { maxSteps: 25 } : {}
|
|
128
127
|
}) : void 0,
|
|
129
128
|
scope: omScope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","names":[],"sources":["../../src/agents/memory.ts"],"sourcesContent":["import type { AgentControllerRequestContext } from '@mastra/core/agent-controller';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport type { MastraCompositeStore } from '@mastra/core/storage';\nimport type { MastraVector } from '@mastra/core/vector';\nimport { fastembed } from '@mastra/fastembed';\nimport { Memory, Subconscious } from '@mastra/memory';\nimport { DEFAULT_OM_MODEL_ID, DEFAULT_OBS_THRESHOLD, DEFAULT_REF_THRESHOLD } from '../constants.js';\nimport type { MastraCodeState } from '../schema.js';\nimport { getOmScope } from '../utils/project.js';\nimport { resolveModel } from './model.js';\n\n/**\n * Read controller state from requestContext.\n * Used by both the memory factory and the OM model functions.\n */\nfunction getAgentControllerState(requestContext: RequestContext): MastraCodeState | undefined {\n const ctx = requestContext.get('controller') as AgentControllerRequestContext<MastraCodeState> | undefined;\n return ctx?.getState() as MastraCodeState | undefined;\n}\n\n/**\n * Observer model function — reads the current observer model ID from\n * controller state via requestContext (now propagated by OM's agent.generate).\n */\nfunction getObserverModel({ requestContext }: { requestContext: RequestContext }) {\n const state = getAgentControllerState(requestContext);\n return resolveModel(state?.observerModelId ?? DEFAULT_OM_MODEL_ID, {\n remapForCodexOAuth: true,\n requestContext,\n });\n}\n\n/**\n * Reflector model function — reads the current reflector model ID from\n * controller state via requestContext (now propagated by OM's agent.generate).\n */\nfunction getReflectorModel({ requestContext }: { requestContext: RequestContext }) {\n const state = getAgentControllerState(requestContext);\n return resolveModel(state?.reflectorModelId ?? DEFAULT_OM_MODEL_ID, {\n remapForCodexOAuth: true,\n requestContext,\n });\n}\n\nconst DYNAMIC_AGENTS_MD_INSTRUCTION =\n 'Messages wrapped in <system-reminder type=\"dynamic-agents-md\" ...>...</system-reminder> are ephemeral project-context instructions injected from files on disk. Do NOT observe or extract information from these messages — they are reloaded automatically when needed and should not be stored in memory.';\n\n// Derived from https://github.com/JuliusBrussee/caveman and adapted for OM use with fixed full-level compression.\nconst CAVEMAN_OM_INSTRUCTION = `Respond terse like smart caveman. All technical substance stay. Only fluff die.\n\nUse full caveman compression style.\n\nDrop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries (sure/certainly/of course/happy to), hedging. Fragments OK. Short synonyms (big not extensive, fix not \"implement a solution for\"). Technical terms exact. Code blocks unchanged. Errors quoted exact. Leave out the words \"agent\" and \"assistant\" at the start of each observation line, it is assumed each line is referring to the assistant unless it specifically says it was about the user. Leave out parenthesis and other text characters like * that would not contribute to understanding the observations.\n\nPattern: \\`[thing] [action] [reason]. [next step]\\`\n\nNot: \"Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by...\"\nYes: \"Bug in auth middleware. Token expiry check use < not <=. Fix:\"\n\nExample 1\n🔴 14:31 user asks why React component rerenders\n🟡 14:32 saw inline object prop create new ref each render, cause rerender\n✅ 14:34 fixed render issue by wrap object in useMemo\n\nExample 2\n🟡 15:10 explained pool reuse DB connections, skip repeat handshake overhead\n\nDon't say \"Agent did x\", say \"did x\". It will be assumed the agent did what was observed. The who should only be specified for the user or other third parties: \"user asked x\"\n\nDrop caveman for: security warnings, irreversible action confirmations, multi-step sequences where fragment order risks misread, user asks to clarify or repeats question, and anything that requires remembering verbatim content. Resume caveman after clear part done`;\n\n/**\n * The organization rung local (TUI/studio) knowledge is captured under. A fixed\n * literal on purpose: deriving it from a hostname or path would fragment local\n * knowledge per checkout into scopes nothing ever reads.\n */\nexport const LOCAL_KNOWLEDGE_ORG_ID = 'local';\n\n// One error per session, not per memory resolution. Keyed on the session id\n// rather than the controller object: the controller is read off the request\n// context on every resolution, so it is a fresh object per request and would\n// dedupe nothing. Bounded so a long-running Factory process cannot grow this\n// without limit — refusing sessions are rare, and losing the oldest ids only\n// costs one extra log line.\nconst REPORTED_ORG_UNRESOLVED_LIMIT = 500;\nconst reportedOrgUnresolved = new Set<string>();\n\nfunction reportOrgUnresolved(\n controller: AgentControllerRequestContext<MastraCodeState> | undefined,\n factoryProjectId: string | undefined,\n) {\n const sessionId = controller?.session?.id;\n if (sessionId) {\n if (reportedOrgUnresolved.has(sessionId)) return;\n if (reportedOrgUnresolved.size >= REPORTED_ORG_UNRESOLVED_LIMIT) {\n reportedOrgUnresolved.delete(reportedOrgUnresolved.values().next().value as string);\n }\n reportedOrgUnresolved.add(sessionId);\n }\n const session = controller?.session;\n console.error(\n `[Subconscious] Knowledge capture disabled: no organization resolved for session ${session?.id ?? 'unknown'} (project ${factoryProjectId ?? 'none'}). Knowledge is not written rather than written where it cannot be read.`,\n );\n}\n\n/**\n * Dynamic memory factory function.\n * Reads OM thresholds from controller state via requestContext.\n * Model functions also read from requestContext (no mutable bridge needed).\n */\nexport function getDynamicMemory(storage: MastraCompositeStore, vector?: MastraVector) {\n // Cache is scoped per storage instance (per getDynamicMemory call) so a\n // Memory bound to one storage is never reused after storage changes.\n let cachedMemory: Memory | null = null;\n let cachedMemoryKey: string | null = null;\n\n return ({ requestContext }: { requestContext: RequestContext }) => {\n const controller = requestContext.get('controller') as AgentControllerRequestContext<MastraCodeState> | undefined;\n const state = controller?.getState() as MastraCodeState | undefined;\n const subconsciousEnabled = Boolean(vector) && process.env.MASTRACODE_EXPERIMENTAL_SUBCONSCIOUS === '1';\n const factoryProjectId = state?.factoryProjectId;\n const isFactory = typeof factoryProjectId === 'string' && factoryProjectId.trim().length > 0;\n\n // A Factory-owned session that could not resolve its org refuses to capture:\n // writing under a substituted identity produces knowledge the fail-closed\n // read path can never see.\n let orgUnresolvedRefusal = false;\n\n if (subconsciousEnabled) {\n // Factory seeds the authoritative org id into session state. There is no\n // fallback: a session owner is a USER id, never an organization.\n const factoryOrgId = state?.factoryOrgId;\n const factoryOwned = isFactory || state?.factoryOrgUnresolved === true;\n if (typeof factoryOrgId === 'string' && factoryOrgId.trim()) {\n requestContext.set('organizationId', factoryOrgId);\n } else if (factoryOwned) {\n orgUnresolvedRefusal = true;\n reportOrgUnresolved(controller, factoryProjectId);\n } else {\n // TUI/studio: an explicit, named scope rather than a cascaded identity.\n requestContext.set('organizationId', LOCAL_KNOWLEDGE_ORG_ID);\n }\n // Factory runs share one knowledge graph per project: anchor the\n // subconscious knowledge scope's resource rung on the project id.\n if (isFactory) {\n requestContext.set('knowledgeResourceId', factoryProjectId);\n }\n }\n\n const captureEnabled = subconsciousEnabled && !orgUnresolvedRefusal;\n\n const omScope = state?.omScope ?? getOmScope(state?.projectPath);\n\n const obsThreshold = state?.observationThreshold ?? DEFAULT_OBS_THRESHOLD;\n const refThreshold = state?.reflectionThreshold ?? DEFAULT_REF_THRESHOLD;\n const caveman = state?.cavemanObservations ?? false;\n\n const observerPreviousObservationTokens = 1000;\n const observeAttachments = state?.observeAttachments;\n // Factory sessions get a factory-only Subconscious config, so the cache key\n // carries a factory presence bit to keep the two configs from cross-serving.\n const cacheKey = `${obsThreshold}:${refThreshold}:${omScope}:${observerPreviousObservationTokens}:${caveman ? 1 : 0}:${observeAttachments}:${isFactory ? 1 : 0}:${captureEnabled ? 1 : 0}`;\n if (cachedMemory && cachedMemoryKey === cacheKey) {\n return cachedMemory;\n }\n\n // Async buffering is not supported with resource scope — disable it\n const isResourceScope = omScope === 'resource';\n\n const observerInstruction = caveman\n ? `${DYNAMIC_AGENTS_MD_INSTRUCTION}\\n\\n${CAVEMAN_OM_INSTRUCTION}`\n : DYNAMIC_AGENTS_MD_INSTRUCTION;\n const reflectionInstruction = caveman ? CAVEMAN_OM_INSTRUCTION : undefined;\n\n cachedMemory = new Memory({\n storage,\n vector: vector || false,\n embedder: vector ? fastembed.small : undefined,\n options: {\n // Generate a durable title from the first user message. Every client uses\n // the same title in its thread list and active-session chrome.\n generateTitle: { model: getObserverModel },\n observationalMemory: {\n enabled: true,\n temporalMarkers: true,\n retrieval: vector ? { vector: true } : true,\n experimental_subconscious: captureEnabled\n ? new Subconscious({\n defaultScope: 'resource',\n maxScope: 'resource',\n // Capture-time pinning is a factory-only opinion; every other\n // client keeps plain curator-maintained pins.\n pins: isFactory ? { capturePinning: true } : true,\n // Factory sessions run the curator every 3 observation runs;\n // other clients leave the cadence trigger dormant.\n ...(isFactory ? { curationCadence: 3 } : {}),\n // Real curation over a factory worklist needs tool room: the\n // default 5-step budget exhausts mid-batch and the curator never\n // reaches its cursor acknowledgment (observed live 2026-08-13).\n ...(isFactory ? { maxSteps: 25 } : {}),\n })\n : undefined,\n scope: omScope,\n activateAfterIdle: 'auto',\n activateOnProviderChange: true,\n observation: {\n bufferTokens: isResourceScope ? false : 1 / 5,\n bufferActivation: isResourceScope ? undefined : 2000,\n model: getObserverModel,\n messageTokens: obsThreshold,\n blockAfter: 2,\n previousObserverTokens: observerPreviousObservationTokens,\n threadTitle: true,\n instruction: observerInstruction,\n observeAttachments,\n },\n reflection: {\n bufferActivation: isResourceScope ? undefined : 1 / 2,\n blockAfter: 1.1,\n model: getReflectorModel,\n observationTokens: refThreshold,\n instruction: reflectionInstruction,\n },\n },\n },\n });\n cachedMemoryKey = cacheKey;\n\n return cachedMemory;\n };\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAS,wBAAwB,gBAA6D;CAE5F,OADY,eAAe,IAAI,YACtB,CAAC,EAAE,SAAS;AACvB;;;;;AAMA,SAAS,iBAAiB,EAAE,kBAAsD;CAEhF,OAAO,aADO,wBAAwB,cACd,CAAC,EAAE,mBAAmB,qBAAqB;EACjE,oBAAoB;EACpB;CACF,CAAC;AACH;;;;;AAMA,SAAS,kBAAkB,EAAE,kBAAsD;CAEjF,OAAO,aADO,wBAAwB,cACd,CAAC,EAAE,oBAAoB,qBAAqB;EAClE,oBAAoB;EACpB;CACF,CAAC;AACH;AAEA,MAAM,gCACJ;AAGF,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4B/B,MAAa,yBAAyB;AAQtC,MAAM,gCAAgC;AACtC,MAAM,wCAAwB,IAAI,IAAY;AAE9C,SAAS,oBACP,YACA,kBACA;CACA,MAAM,YAAY,YAAY,SAAS;CACvC,IAAI,WAAW;EACb,IAAI,sBAAsB,IAAI,SAAS,GAAG;EAC1C,IAAI,sBAAsB,QAAQ,+BAChC,sBAAsB,OAAO,sBAAsB,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAe;EAEpF,sBAAsB,IAAI,SAAS;CACr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YAAY;EAEpC,MAAM,sBAAsB,UACxB,GAAG,8BAA8B,MAAM,2BACvC;EACJ,MAAM,wBAAwB,UAAU,yBAAyB,KAAA;EAEjE,eAAe,IAAI,OAAO;GACxB;GACA,QAAQ,UAAU;GAClB,UAAU,SAAS,UAAU,QAAQ,KAAA;GACrC,SAAS;IAGP,eAAe,EAAE,OAAO,iBAAiB;IACzC,qBAAqB;KACnB,SAAS;KACT,iBAAiB;KACjB,WAAW,SAAS,EAAE,QAAQ,KAAK,IAAI;KACvC,2BAA2B,iBACvB,IAAI,aAAa;MACf,cAAc;MACd,UAAU;MAGV,MAAM,YAAY,EAAE,gBAAgB,KAAK,IAAI;MAG7C,GAAI,YAAY,EAAE,iBAAiB,EAAE,IAAI,CAAC;MAI1C,GAAI,YAAY,EAAE,UAAU,GAAG,IAAI,CAAC;KACtC,CAAC,IACD,KAAA;KACJ,OAAO;KACP,mBAAmB;KACnB,0BAA0B;KAC1B,aAAa;MACX,cAAc,kBAAkB,QAAQ,IAAI;MAC5C,kBAAkB,kBAAkB,KAAA,IAAY;MAChD,OAAO;MACP,eAAe;MACf,YAAY;MACZ,wBAAwB;MACxB,aAAa;MACb,aAAa;MACb;KACF;KACA,YAAY;MACV,kBAAkB,kBAAkB,KAAA,IAAY,IAAI;MACpD,YAAY;MACZ,OAAO;MACP,mBAAmB;MACnB,aAAa;KACf;IACF;GACF;EACF,CAAC;EACD,kBAAkB;EAElB,OAAO;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"memory.js","names":[],"sources":["../../src/agents/memory.ts"],"sourcesContent":["import type { AgentControllerRequestContext } from '@mastra/core/agent-controller';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport type { MastraCompositeStore } from '@mastra/core/storage';\nimport type { MastraVector } from '@mastra/core/vector';\nimport { fastembed } from '@mastra/fastembed';\nimport { Memory, Subconscious } from '@mastra/memory';\nimport { DEFAULT_OM_MODEL_ID, DEFAULT_OBS_THRESHOLD, DEFAULT_REF_THRESHOLD } from '../constants.js';\nimport type { MastraCodeState } from '../schema.js';\nimport { getOmScope } from '../utils/project.js';\nimport { resolveModel } from './model.js';\n\n/**\n * Read controller state from requestContext.\n * Used by both the memory factory and the OM model functions.\n */\nfunction getAgentControllerState(requestContext: RequestContext): MastraCodeState | undefined {\n const ctx = requestContext.get('controller') as AgentControllerRequestContext<MastraCodeState> | undefined;\n return ctx?.getState() as MastraCodeState | undefined;\n}\n\n/**\n * Observer model function — reads the current observer model ID from\n * controller state via requestContext (now propagated by OM's agent.generate).\n */\nfunction getObserverModel({ requestContext }: { requestContext: RequestContext }) {\n const state = getAgentControllerState(requestContext);\n return resolveModel(state?.observerModelId ?? DEFAULT_OM_MODEL_ID, {\n remapForCodexOAuth: true,\n requestContext,\n });\n}\n\n/**\n * Reflector model function — reads the current reflector model ID from\n * controller state via requestContext (now propagated by OM's agent.generate).\n */\nfunction getReflectorModel({ requestContext }: { requestContext: RequestContext }) {\n const state = getAgentControllerState(requestContext);\n return resolveModel(state?.reflectorModelId ?? DEFAULT_OM_MODEL_ID, {\n remapForCodexOAuth: true,\n requestContext,\n });\n}\n\nconst DYNAMIC_AGENTS_MD_INSTRUCTION =\n 'Messages wrapped in <system-reminder type=\"dynamic-agents-md\" ...>...</system-reminder> are ephemeral project-context instructions injected from files on disk. Do NOT observe or extract information from these messages — they are reloaded automatically when needed and should not be stored in memory.';\n\n// Derived from https://github.com/JuliusBrussee/caveman and adapted for OM use with fixed full-level compression.\nconst CAVEMAN_OM_INSTRUCTION = `Respond terse like smart caveman. All technical substance stay. Only fluff die.\n\nUse full caveman compression style.\n\nDrop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries (sure/certainly/of course/happy to), hedging. Fragments OK. Short synonyms (big not extensive, fix not \"implement a solution for\"). Technical terms exact. Code blocks unchanged. Errors quoted exact. Leave out the words \"agent\" and \"assistant\" at the start of each observation line, it is assumed each line is referring to the assistant unless it specifically says it was about the user. Leave out parenthesis and other text characters like * that would not contribute to understanding the observations.\n\nPattern: \\`[thing] [action] [reason]. [next step]\\`\n\nNot: \"Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by...\"\nYes: \"Bug in auth middleware. Token expiry check use < not <=. Fix:\"\n\nExample 1\n🔴 14:31 user asks why React component rerenders\n🟡 14:32 saw inline object prop create new ref each render, cause rerender\n✅ 14:34 fixed render issue by wrap object in useMemo\n\nExample 2\n🟡 15:10 explained pool reuse DB connections, skip repeat handshake overhead\n\nDon't say \"Agent did x\", say \"did x\". It will be assumed the agent did what was observed. The who should only be specified for the user or other third parties: \"user asked x\"\n\nDrop caveman for: security warnings, irreversible action confirmations, multi-step sequences where fragment order risks misread, user asks to clarify or repeats question, and anything that requires remembering verbatim content. Resume caveman after clear part done`;\n\n/**\n * The organization rung local (TUI/studio) knowledge is curated under. A fixed\n * literal on purpose: deriving it from a hostname or path would fragment local\n * knowledge per checkout into scopes nothing ever reads.\n */\nexport const LOCAL_KNOWLEDGE_ORG_ID = 'local';\n\n// One error per session, not per memory resolution. Keyed on the session id\n// rather than the controller object: the controller is read off the request\n// context on every resolution, so it is a fresh object per request and would\n// dedupe nothing. Bounded so a long-running Factory process cannot grow this\n// without limit — refusing sessions are rare, and losing the oldest ids only\n// costs one extra log line.\nconst REPORTED_ORG_UNRESOLVED_LIMIT = 500;\nconst reportedOrgUnresolved = new Set<string>();\n\nfunction reportOrgUnresolved(\n controller: AgentControllerRequestContext<MastraCodeState> | undefined,\n factoryProjectId: string | undefined,\n) {\n const sessionId = controller?.session?.id;\n if (sessionId) {\n if (reportedOrgUnresolved.has(sessionId)) return;\n if (reportedOrgUnresolved.size >= REPORTED_ORG_UNRESOLVED_LIMIT) {\n reportedOrgUnresolved.delete(reportedOrgUnresolved.values().next().value as string);\n }\n reportedOrgUnresolved.add(sessionId);\n }\n const session = controller?.session;\n console.error(\n `[Subconscious] Knowledge curation disabled: no organization resolved for session ${session?.id ?? 'unknown'} (project ${factoryProjectId ?? 'none'}). Knowledge is not written rather than written where it cannot be read.`,\n );\n}\n\n/**\n * Dynamic memory factory function.\n * Reads OM thresholds from controller state via requestContext.\n * Model functions also read from requestContext (no mutable bridge needed).\n */\nexport function getDynamicMemory(storage: MastraCompositeStore, vector?: MastraVector) {\n // Cache is scoped per storage instance (per getDynamicMemory call) so a\n // Memory bound to one storage is never reused after storage changes.\n let cachedMemory: Memory | null = null;\n let cachedMemoryKey: string | null = null;\n\n return ({ requestContext }: { requestContext: RequestContext }) => {\n const controller = requestContext.get('controller') as AgentControllerRequestContext<MastraCodeState> | undefined;\n const state = controller?.getState() as MastraCodeState | undefined;\n const subconsciousEnabled = Boolean(vector) && process.env.MASTRACODE_EXPERIMENTAL_SUBCONSCIOUS === '1';\n const factoryProjectId = state?.factoryProjectId;\n const isFactory = typeof factoryProjectId === 'string' && factoryProjectId.trim().length > 0;\n\n // A Factory-owned session that could not resolve its org refuses to curate:\n // writing under a substituted identity produces knowledge the fail-closed\n // read path can never see.\n let orgUnresolvedRefusal = false;\n\n if (subconsciousEnabled) {\n // Factory seeds the authoritative org id into session state. There is no\n // fallback: a session owner is a USER id, never an organization.\n const factoryOrgId = state?.factoryOrgId;\n const factoryOwned = isFactory || state?.factoryOrgUnresolved === true;\n if (typeof factoryOrgId === 'string' && factoryOrgId.trim()) {\n requestContext.set('organizationId', factoryOrgId);\n } else if (factoryOwned) {\n orgUnresolvedRefusal = true;\n reportOrgUnresolved(controller, factoryProjectId);\n } else {\n // TUI/studio: an explicit, named scope rather than a cascaded identity.\n requestContext.set('organizationId', LOCAL_KNOWLEDGE_ORG_ID);\n }\n // Factory runs share one knowledge graph per project: anchor the\n // subconscious knowledge scope's resource rung on the project id.\n if (isFactory) {\n requestContext.set('knowledgeResourceId', factoryProjectId);\n }\n }\n\n const subconsciousAvailable = subconsciousEnabled && !orgUnresolvedRefusal;\n\n const omScope = state?.omScope ?? getOmScope(state?.projectPath);\n\n const obsThreshold = state?.observationThreshold ?? DEFAULT_OBS_THRESHOLD;\n const refThreshold = state?.reflectionThreshold ?? DEFAULT_REF_THRESHOLD;\n const caveman = state?.cavemanObservations ?? false;\n\n const observerPreviousObservationTokens = 1000;\n const observeAttachments = state?.observeAttachments;\n // Factory sessions get a factory-only Subconscious config, so the cache key\n // carries a factory presence bit to keep the two configs from cross-serving.\n const cacheKey = `${obsThreshold}:${refThreshold}:${omScope}:${observerPreviousObservationTokens}:${caveman ? 1 : 0}:${observeAttachments}:${isFactory ? 1 : 0}:${subconsciousAvailable ? 1 : 0}`;\n if (cachedMemory && cachedMemoryKey === cacheKey) {\n return cachedMemory;\n }\n\n // Async buffering is not supported with resource scope — disable it\n const isResourceScope = omScope === 'resource';\n\n const observerInstruction = caveman\n ? `${DYNAMIC_AGENTS_MD_INSTRUCTION}\\n\\n${CAVEMAN_OM_INSTRUCTION}`\n : DYNAMIC_AGENTS_MD_INSTRUCTION;\n const reflectionInstruction = caveman ? CAVEMAN_OM_INSTRUCTION : undefined;\n\n cachedMemory = new Memory({\n storage,\n vector: vector || false,\n embedder: vector ? fastembed.small : undefined,\n options: {\n // Generate a durable title from the first user message. Every client uses\n // the same title in its thread list and active-session chrome.\n generateTitle: { model: getObserverModel },\n observationalMemory: {\n enabled: true,\n temporalMarkers: true,\n retrieval: vector ? { vector: true } : true,\n experimental_subconscious: subconsciousAvailable\n ? new Subconscious({\n defaultScope: 'resource',\n maxScope: 'resource',\n pins: true,\n ...(isFactory ? { maxSteps: 25 } : {}),\n })\n : undefined,\n scope: omScope,\n activateAfterIdle: 'auto',\n activateOnProviderChange: true,\n observation: {\n bufferTokens: isResourceScope ? false : 1 / 5,\n bufferActivation: isResourceScope ? undefined : 2000,\n model: getObserverModel,\n messageTokens: obsThreshold,\n blockAfter: 2,\n previousObserverTokens: observerPreviousObservationTokens,\n threadTitle: true,\n instruction: observerInstruction,\n observeAttachments,\n },\n reflection: {\n bufferActivation: isResourceScope ? undefined : 1 / 2,\n blockAfter: 1.1,\n model: getReflectorModel,\n observationTokens: refThreshold,\n instruction: reflectionInstruction,\n },\n },\n },\n });\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,IAAI,CAAC;KACtC,CAAC,IACD,KAAA;KACJ,OAAO;KACP,mBAAmB;KACnB,0BAA0B;KAC1B,aAAa;MACX,cAAc,kBAAkB,QAAQ,IAAI;MAC5C,kBAAkB,kBAAkB,KAAA,IAAY;MAChD,OAAO;MACP,eAAe;MACf,YAAY;MACZ,wBAAwB;MACxB,aAAa;MACb,aAAa;MACb;KACF;KACA,YAAY;MACV,kBAAkB,kBAAkB,KAAA,IAAY,IAAI;MACpD,YAAY;MACZ,OAAO;MACP,mBAAmB;MACnB,aAAa;KACf;IACF;GACF;EACF,CAAC;EACD,kBAAkB;EAElB,OAAO;CACT;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/code-sdk",
|
|
3
|
-
"version": "1.6.0
|
|
3
|
+
"version": "1.6.0",
|
|
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": {
|
|
@@ -56,20 +56,20 @@
|
|
|
56
56
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
57
57
|
"yaml": "^2.7.1",
|
|
58
58
|
"zod": "^4.3.6",
|
|
59
|
-
"@mastra/duckdb": "1.6.4
|
|
60
|
-
"@mastra/
|
|
61
|
-
"@mastra/
|
|
62
|
-
"@mastra/
|
|
63
|
-
"@mastra/
|
|
64
|
-
"@mastra/
|
|
65
|
-
"@mastra/
|
|
66
|
-
"@mastra/observability": "1.17.5
|
|
67
|
-
"@mastra/parallel": "0.1.1
|
|
68
|
-
"@mastra/
|
|
69
|
-
"@mastra/
|
|
70
|
-
"@mastra/
|
|
71
|
-
"@mastra/
|
|
72
|
-
"@mastra/
|
|
59
|
+
"@mastra/duckdb": "1.6.4",
|
|
60
|
+
"@mastra/core": "1.64.0",
|
|
61
|
+
"@mastra/agent-browser": "0.5.2",
|
|
62
|
+
"@mastra/github-signals": "0.4.0",
|
|
63
|
+
"@mastra/mcp": "1.17.3",
|
|
64
|
+
"@mastra/libsql": "1.22.3",
|
|
65
|
+
"@mastra/fastembed": "1.3.1",
|
|
66
|
+
"@mastra/observability": "1.17.5",
|
|
67
|
+
"@mastra/parallel": "0.1.1",
|
|
68
|
+
"@mastra/pg": "1.22.3",
|
|
69
|
+
"@mastra/schema-compat": "1.3.8",
|
|
70
|
+
"@mastra/stagehand": "0.3.4",
|
|
71
|
+
"@mastra/tavily": "1.1.2",
|
|
72
|
+
"@mastra/memory": "1.28.2"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@libsql/client": "^0.17.4",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"typescript": "^6.0.3",
|
|
81
81
|
"typescript-eslint": "^8.57.0",
|
|
82
82
|
"vitest": "4.1.10",
|
|
83
|
-
"@internal/
|
|
84
|
-
"@internal/
|
|
85
|
-
"@internal/
|
|
83
|
+
"@internal/types-builder": "0.0.105",
|
|
84
|
+
"@internal/workspace-test-utils": "0.0.74",
|
|
85
|
+
"@internal/lint": "0.0.130"
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=22.19.0"
|