@mastra/opencode 0.0.0-feat-change-lifecycle-20260212011237

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 (3) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/LICENSE.md +15 -0
  3. package/package.json +66 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ # @mastra/opencode
2
+
3
+ ## 0.0.0-feat-change-lifecycle-20260212011237
4
+
5
+ ### Patch Changes
6
+
7
+ - @mastra/opencode: Add opencode plugin for Observational Memory integration ([#12925](https://github.com/mastra-ai/mastra/pull/12925))
8
+
9
+ Added standalone `observe()` API that accepts external messages directly, so integrations can trigger observation without duplicating messages into Mastra's storage.
10
+
11
+ **New exports:**
12
+ - `ObserveHooks` — lifecycle callbacks (`onObservationStart`, `onObservationEnd`, `onReflectionStart`, `onReflectionEnd`) for hooking into observation/reflection cycles
13
+ - `OBSERVATION_CONTEXT_PROMPT` — preamble that introduces the observations block
14
+ - `OBSERVATION_CONTEXT_INSTRUCTIONS` — rules for interpreting observations (placed after the `<observations>` block)
15
+ - `OBSERVATION_CONTINUATION_HINT` — behavioral guidance that prevents models from awkwardly acknowledging the memory system
16
+ - `getOrCreateRecord()` — now public, allows eager record initialization before the first observation cycle
17
+
18
+ ```ts
19
+ import { ObservationalMemory } from '@mastra/memory/processors';
20
+
21
+ const om = new ObservationalMemory({ storage, model: 'google/gemini-2.5-flash' });
22
+
23
+ // Eagerly initialize a record
24
+ await om.getOrCreateRecord(threadId);
25
+
26
+ // Pass messages directly with lifecycle hooks
27
+ await om.observe({
28
+ threadId,
29
+ messages: myMessages,
30
+ hooks: {
31
+ onObservationStart: () => console.log('Observing...'),
32
+ onObservationEnd: () => console.log('Done!'),
33
+ onReflectionStart: () => console.log('Reflecting...'),
34
+ onReflectionEnd: () => console.log('Reflected!'),
35
+ },
36
+ });
37
+ ```
38
+
39
+ **Breaking:** `observe()` now takes an object param instead of positional args. Update calls from `observe(threadId, resourceId)` to `observe({ threadId, resourceId })`.
40
+
41
+ - Updated dependencies [[`7ef618f`](https://github.com/mastra-ai/mastra/commit/7ef618f3c49c27e2f6b27d7f564c557c0734325b), [`b896b41`](https://github.com/mastra-ai/mastra/commit/b896b41343de7fcc14442fb40fe82d189e65bbe2), [`6415277`](https://github.com/mastra-ai/mastra/commit/6415277a438faa00db2af850ead5dee25f40c428), [`0831bbb`](https://github.com/mastra-ai/mastra/commit/0831bbb5bc750c18e9b22b45f18687c964b70828), [`63f7eda`](https://github.com/mastra-ai/mastra/commit/63f7eda605eb3e0c8c35ee3912ffe7c999c69f69), [`a5b67a3`](https://github.com/mastra-ai/mastra/commit/a5b67a3589a74415feb663a55d1858324a2afde9), [`cb8c38e`](https://github.com/mastra-ai/mastra/commit/cb8c38e6f855ad190383a7112ba95abef072d490), [`eb36bd8`](https://github.com/mastra-ai/mastra/commit/eb36bd8c52fcd6ec9674ac3b7a6412405b5983e1), [`3c7441d`](https://github.com/mastra-ai/mastra/commit/3c7441d6334af60112cc9e4140640ff9091e665f)]:
42
+ - @mastra/core@0.0.0-feat-change-lifecycle-20260212011237
43
+ - @mastra/memory@0.0.0-feat-change-lifecycle-20260212011237
44
+ - @mastra/libsql@0.0.0-feat-change-lifecycle-20260212011237
package/LICENSE.md ADDED
@@ -0,0 +1,15 @@
1
+ # Apache License 2.0
2
+
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@mastra/opencode",
3
+ "version": "0.0.0-feat-change-lifecycle-20260212011237",
4
+ "description": "OpenCode plugin for Mastra Observational Memory",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "CHANGELOG.md"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "import": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "require": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.cjs"
21
+ }
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "keywords": [
26
+ "mastra",
27
+ "opencode",
28
+ "observational-memory",
29
+ "plugin"
30
+ ],
31
+ "license": "Apache-2.0",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/mastra-ai/mastra.git",
35
+ "directory": "integrations/opencode"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/mastra-ai/mastra/issues"
39
+ },
40
+ "homepage": "https://mastra.ai",
41
+ "engines": {
42
+ "node": ">=22.13.0"
43
+ },
44
+ "dependencies": {
45
+ "@mastra/memory": "0.0.0-feat-change-lifecycle-20260212011237",
46
+ "@mastra/core": "0.0.0-feat-change-lifecycle-20260212011237",
47
+ "@mastra/libsql": "0.0.0-feat-change-lifecycle-20260212011237"
48
+ },
49
+ "peerDependencies": {
50
+ "@opencode-ai/plugin": "*"
51
+ },
52
+ "devDependencies": {
53
+ "@opencode-ai/plugin": "*",
54
+ "@opencode-ai/sdk": "*",
55
+ "tsup": "^8.5.1",
56
+ "typescript": "^5.9.3",
57
+ "vitest": "4.0.16",
58
+ "@internal/lint": "0.0.0-feat-change-lifecycle-20260212011237",
59
+ "@internal/types-builder": "0.0.0-feat-change-lifecycle-20260212011237"
60
+ },
61
+ "scripts": {
62
+ "build:lib": "tsup --silent --config tsup.config.ts",
63
+ "build:watch": "pnpm build:lib --watch",
64
+ "lint": "eslint ."
65
+ }
66
+ }