opencode-codex-memory 0.10.2 → 0.10.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.
package/README.md CHANGED
@@ -34,7 +34,7 @@ to your existing global `~/.config/opencode/opencode.jsonc` or `opencode.json`
34
34
  ```jsonc
35
35
  {
36
36
  "$schema": "https://opencode.ai/config.json",
37
- "plugins": [{ "package": "opencode-codex-memory@0.10.2" }],
37
+ "plugins": [{ "package": "opencode-codex-memory@0.10.3" }],
38
38
  }
39
39
  ```
40
40
 
@@ -43,7 +43,7 @@ to your existing global `~/.config/opencode/opencode.jsonc` or `opencode.json`
43
43
  ```json
44
44
  {
45
45
  "$schema": "https://opencode.ai/config.json",
46
- "plugin": ["opencode-codex-memory@0.10.2"]
46
+ "plugin": ["opencode-codex-memory@0.10.3"]
47
47
  }
48
48
  ```
49
49
 
@@ -1,4 +1,4 @@
1
- import type { PluginInput, PluginOptions } from "@opencode-ai/plugin";
1
+ import type { PluginInput, PluginOptions, ToolDefinition } from "@opencode-ai/plugin";
2
2
  /** Test seam: wait for all hook-launched work, including follow-up phase 2. */
3
3
  export declare function waitForBackgroundTasks(): Promise<void>;
4
4
  /**
@@ -20,149 +20,7 @@ declare const _default: {
20
20
  setup: typeof setupV2;
21
21
  server(input: PluginInput, opts?: PluginOptions): Promise<{
22
22
  dispose(): Promise<void>;
23
- tool: {
24
- memory_read: {
25
- description: string;
26
- args: {
27
- path: import("zod").ZodString;
28
- line_offset: import("zod").ZodOptional<import("zod").ZodNumber>;
29
- max_lines: import("zod").ZodOptional<import("zod").ZodNumber>;
30
- };
31
- execute(args: {
32
- path: string;
33
- line_offset?: number | undefined;
34
- max_lines?: number | undefined;
35
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
36
- };
37
- memory_search: {
38
- description: string;
39
- args: {
40
- queries: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
41
- match_mode: import("zod").ZodDefault<import("zod").ZodEnum<{
42
- any: "any";
43
- all_on_same_line: "all_on_same_line";
44
- all_within_lines: "all_within_lines";
45
- }>>;
46
- line_count: import("zod").ZodOptional<import("zod").ZodNumber>;
47
- path: import("zod").ZodOptional<import("zod").ZodString>;
48
- cursor: import("zod").ZodOptional<import("zod").ZodString>;
49
- context_lines: import("zod").ZodDefault<import("zod").ZodNumber>;
50
- case_sensitive: import("zod").ZodDefault<import("zod").ZodBoolean>;
51
- normalized: import("zod").ZodDefault<import("zod").ZodBoolean>;
52
- since: import("zod").ZodOptional<import("zod").ZodString>;
53
- until: import("zod").ZodOptional<import("zod").ZodString>;
54
- max_results: import("zod").ZodDefault<import("zod").ZodNumber>;
55
- };
56
- execute(args: {
57
- match_mode: "any" | "all_on_same_line" | "all_within_lines";
58
- context_lines: number;
59
- case_sensitive: boolean;
60
- normalized: boolean;
61
- max_results: number;
62
- queries?: string[] | undefined;
63
- line_count?: number | undefined;
64
- path?: string | undefined;
65
- cursor?: string | undefined;
66
- since?: string | undefined;
67
- until?: string | undefined;
68
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
69
- };
70
- memory_list: {
71
- description: string;
72
- args: {
73
- path: import("zod").ZodDefault<import("zod").ZodString>;
74
- cursor: import("zod").ZodOptional<import("zod").ZodString>;
75
- max_results: import("zod").ZodDefault<import("zod").ZodNumber>;
76
- };
77
- execute(args: {
78
- path: string;
79
- max_results: number;
80
- cursor?: string | undefined;
81
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
82
- };
83
- memory_add_note: {
84
- description: string;
85
- args: {
86
- note: import("zod").ZodString;
87
- title: import("zod").ZodOptional<import("zod").ZodString>;
88
- };
89
- execute(args: {
90
- note: string;
91
- title?: string | undefined;
92
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
93
- };
94
- memory_reset: {
95
- description: string;
96
- args: {
97
- confirm: import("zod").ZodBoolean;
98
- };
99
- execute(args: {
100
- confirm: boolean;
101
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
102
- };
103
- memory_inspect: {
104
- description: string;
105
- args: {
106
- min_consolidated_threads: import("zod").ZodOptional<import("zod").ZodNumber>;
107
- };
108
- execute(args: {
109
- min_consolidated_threads?: number | undefined;
110
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
111
- };
112
- memory_mode: {
113
- description: string;
114
- args: {
115
- mode: import("zod").ZodEnum<{
116
- enabled: "enabled";
117
- disabled: "disabled";
118
- polluted: "polluted";
119
- }>;
120
- sessionId: import("zod").ZodOptional<import("zod").ZodString>;
121
- };
122
- execute(args: {
123
- mode: "enabled" | "disabled" | "polluted";
124
- sessionId?: string | undefined;
125
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
126
- };
127
- } | {
128
- memory_reset: {
129
- description: string;
130
- args: {
131
- confirm: import("zod").ZodBoolean;
132
- };
133
- execute(args: {
134
- confirm: boolean;
135
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
136
- };
137
- memory_inspect: {
138
- description: string;
139
- args: {
140
- min_consolidated_threads: import("zod").ZodOptional<import("zod").ZodNumber>;
141
- };
142
- execute(args: {
143
- min_consolidated_threads?: number | undefined;
144
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
145
- };
146
- memory_mode: {
147
- description: string;
148
- args: {
149
- mode: import("zod").ZodEnum<{
150
- enabled: "enabled";
151
- disabled: "disabled";
152
- polluted: "polluted";
153
- }>;
154
- sessionId: import("zod").ZodOptional<import("zod").ZodString>;
155
- };
156
- execute(args: {
157
- mode: "enabled" | "disabled" | "polluted";
158
- sessionId?: string | undefined;
159
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
160
- };
161
- memory_read?: undefined;
162
- memory_search?: undefined;
163
- memory_list?: undefined;
164
- memory_add_note?: undefined;
165
- };
23
+ tool: MemoryTools;
166
24
  config(input: {
167
25
  agent?: Record<string, unknown>;
168
26
  }): Promise<void>;
@@ -261,3 +119,4 @@ export declare function applyPluginOptions(opts: PluginOptions, { modelFallback
261
119
  export declare function injectAgentDefinitions(config: {
262
120
  agent?: Record<string, unknown>;
263
121
  }): void;
122
+ type MemoryTools = Record<"memory_reset" | "memory_inspect" | "memory_mode", ToolDefinition> & Partial<Record<"memory_read" | "memory_search" | "memory_list" | "memory_add_note", ToolDefinition>>;
@@ -17,6 +17,12 @@ export function isModelSelectionUnavailable(error, model) {
17
17
  const tag = current._tag ?? current.name;
18
18
  if (["InvalidRequestError", "Generate.ModelSelectionError"].includes(tag) && current.message === message)
19
19
  return true;
20
+ // OpenCode 2.4 reports missing explicit models separately from provider failures.
21
+ if (model &&
22
+ (tag === "ModelNotFoundError" || tag === "Generate.ModelNotFoundError") &&
23
+ current.providerID === model.providerID &&
24
+ current.modelID === model.id)
25
+ return true;
20
26
  if (tag === "ServiceUnavailableError" &&
21
27
  current.service === "plugin" &&
22
28
  current.message === PLUGIN_ACTIVATION_PENDING)
@@ -3,13 +3,13 @@
3
3
  *
4
4
  * The memory tools' logic lives in tools/*.ts (V1 tool() definitions) and is
5
5
  * reused verbatim: each V1 definition already bundles {description, args
6
- * (zod raw shape), execute}. V2 accepts any StandardSchema as input, which
7
- * zod v4 satisfies natively, so the adapter just re-wraps the same validate
8
- * + execute path and maps the result shape:
6
+ * (Zod raw shape), execute}. Wrap that shape using the SDK's own tool.schema:
7
+ * its Zod objects implement StandardSchema, which V2 accepts directly.
8
+ * Keep version ownership in the SDK, then map only the result shape:
9
9
  * V1 string | {output, metadata} → V2 {content, metadata}
10
10
  * Inspect additionally reports the V2 host discovery scope and fallback reason.
11
11
  */
12
- import { z } from "zod";
12
+ import { tool } from "@opencode-ai/plugin";
13
13
  type CallContext = {
14
14
  sessionID: string;
15
15
  messageID: string;
@@ -25,7 +25,7 @@ type Ask = (ctx: CallContext, request: {
25
25
  interface V2ToolDefinition {
26
26
  name: string;
27
27
  description: string;
28
- input: z.ZodTypeAny;
28
+ input: ReturnType<typeof tool.schema.object>;
29
29
  /**
30
30
  * OpenCode 2 defaults plugin tools into Code Mode (`execute`). The read-path
31
31
  * prompt tells the model to call these by name. Leaving the default hides
@@ -3,13 +3,13 @@
3
3
  *
4
4
  * The memory tools' logic lives in tools/*.ts (V1 tool() definitions) and is
5
5
  * reused verbatim: each V1 definition already bundles {description, args
6
- * (zod raw shape), execute}. V2 accepts any StandardSchema as input, which
7
- * zod v4 satisfies natively, so the adapter just re-wraps the same validate
8
- * + execute path and maps the result shape:
6
+ * (Zod raw shape), execute}. Wrap that shape using the SDK's own tool.schema:
7
+ * its Zod objects implement StandardSchema, which V2 accepts directly.
8
+ * Keep version ownership in the SDK, then map only the result shape:
9
9
  * V1 string | {output, metadata} → V2 {content, metadata}
10
10
  * Inspect additionally reports the V2 host discovery scope and fallback reason.
11
11
  */
12
- import { z } from "zod";
12
+ import { tool } from "@opencode-ai/plugin";
13
13
  import { memory_read, memory_search, memory_list, memory_add_note } from "../../tools/memory.js";
14
14
  import { memory_inspect, memory_mode } from "../../tools/control.js";
15
15
  import { pluginOptions } from "../options.js";
@@ -18,7 +18,7 @@ function adaptTool(name, v1, ask) {
18
18
  return {
19
19
  name,
20
20
  description: v1.description,
21
- input: z.object(v1.args),
21
+ input: tool.schema.object(v1.args),
22
22
  options: { codemode: false },
23
23
  async execute(input, tctx) {
24
24
  const v1ctx = {
@@ -1,3 +1,4 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
1
2
  /**
2
3
  * Shared by the memory_reset tool (after user approval) and the OpenCode 2
3
4
  * memory panel (whose confirmation is the approval).
@@ -6,36 +7,6 @@ export declare function performMemoryReset(): {
6
7
  ok: boolean;
7
8
  message: string;
8
9
  };
9
- export declare const memory_reset: {
10
- description: string;
11
- args: {
12
- confirm: import("zod").ZodBoolean;
13
- };
14
- execute(args: {
15
- confirm: boolean;
16
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
17
- };
18
- export declare const memory_inspect: {
19
- description: string;
20
- args: {
21
- min_consolidated_threads: import("zod").ZodOptional<import("zod").ZodNumber>;
22
- };
23
- execute(args: {
24
- min_consolidated_threads?: number | undefined;
25
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
26
- };
27
- export declare const memory_mode: {
28
- description: string;
29
- args: {
30
- mode: import("zod").ZodEnum<{
31
- enabled: "enabled";
32
- disabled: "disabled";
33
- polluted: "polluted";
34
- }>;
35
- sessionId: import("zod").ZodOptional<import("zod").ZodString>;
36
- };
37
- execute(args: {
38
- mode: "enabled" | "disabled" | "polluted";
39
- sessionId?: string | undefined;
40
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
41
- };
10
+ export declare const memory_reset: ToolDefinition;
11
+ export declare const memory_inspect: ToolDefinition;
12
+ export declare const memory_mode: ToolDefinition;
@@ -1,70 +1,5 @@
1
- export declare const memory_read: {
2
- description: string;
3
- args: {
4
- path: import("zod").ZodString;
5
- line_offset: import("zod").ZodOptional<import("zod").ZodNumber>;
6
- max_lines: import("zod").ZodOptional<import("zod").ZodNumber>;
7
- };
8
- execute(args: {
9
- path: string;
10
- line_offset?: number | undefined;
11
- max_lines?: number | undefined;
12
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
13
- };
14
- export declare const memory_list: {
15
- description: string;
16
- args: {
17
- path: import("zod").ZodDefault<import("zod").ZodString>;
18
- cursor: import("zod").ZodOptional<import("zod").ZodString>;
19
- max_results: import("zod").ZodDefault<import("zod").ZodNumber>;
20
- };
21
- execute(args: {
22
- path: string;
23
- max_results: number;
24
- cursor?: string | undefined;
25
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
26
- };
27
- export declare const memory_search: {
28
- description: string;
29
- args: {
30
- queries: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
31
- match_mode: import("zod").ZodDefault<import("zod").ZodEnum<{
32
- any: "any";
33
- all_on_same_line: "all_on_same_line";
34
- all_within_lines: "all_within_lines";
35
- }>>;
36
- line_count: import("zod").ZodOptional<import("zod").ZodNumber>;
37
- path: import("zod").ZodOptional<import("zod").ZodString>;
38
- cursor: import("zod").ZodOptional<import("zod").ZodString>;
39
- context_lines: import("zod").ZodDefault<import("zod").ZodNumber>;
40
- case_sensitive: import("zod").ZodDefault<import("zod").ZodBoolean>;
41
- normalized: import("zod").ZodDefault<import("zod").ZodBoolean>;
42
- since: import("zod").ZodOptional<import("zod").ZodString>;
43
- until: import("zod").ZodOptional<import("zod").ZodString>;
44
- max_results: import("zod").ZodDefault<import("zod").ZodNumber>;
45
- };
46
- execute(args: {
47
- match_mode: "any" | "all_on_same_line" | "all_within_lines";
48
- context_lines: number;
49
- case_sensitive: boolean;
50
- normalized: boolean;
51
- max_results: number;
52
- queries?: string[] | undefined;
53
- line_count?: number | undefined;
54
- path?: string | undefined;
55
- cursor?: string | undefined;
56
- since?: string | undefined;
57
- until?: string | undefined;
58
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
59
- };
60
- export declare const memory_add_note: {
61
- description: string;
62
- args: {
63
- note: import("zod").ZodString;
64
- title: import("zod").ZodOptional<import("zod").ZodString>;
65
- };
66
- execute(args: {
67
- note: string;
68
- title?: string | undefined;
69
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
70
- };
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ export declare const memory_read: ToolDefinition;
3
+ export declare const memory_list: ToolDefinition;
4
+ export declare const memory_search: ToolDefinition;
5
+ export declare const memory_add_note: ToolDefinition;
@@ -14,6 +14,7 @@ function sessionTool(definition) {
14
14
  }
15
15
  const tool = Object.assign(sessionTool, { schema: defineTool.schema });
16
16
  const MAX_READ_BYTES = 256 * 1024;
17
+ // Keep public declarations on the SDK's type rather than a nested Zod import.
17
18
  export const memory_read = tool({
18
19
  description: "Read a file from the persistent memory workspace (MEMORY.md, rollout_summaries/*, skills/*, etc.). " +
19
20
  "Paths are relative to the memory root and cannot escape it. Supports line_offset/max_lines for " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codex-memory",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "Persistent memory plugin for opencode — ports codex's two-phase memory system (extraction → consolidation → injection → citation feedback)",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -65,22 +65,21 @@
65
65
  ],
66
66
  "license": "Apache-2.0",
67
67
  "dependencies": {
68
- "@opencode-ai/plugin": "^1.18.0",
69
- "@opencode/client": "2.0.5",
70
- "diff": "^9.0.0",
71
- "isomorphic-git": "^1.38.6",
72
- "xdg-basedir": "^5.1.0",
73
- "zod": "4.1.8"
68
+ "@opencode-ai/plugin": "1.19.6",
69
+ "@opencode/client": "2.4.1",
70
+ "diff": "9.0.0",
71
+ "isomorphic-git": "1.44.19",
72
+ "xdg-basedir": "5.1.0"
74
73
  },
75
74
  "devDependencies": {
76
- "@opencode/plugin": "2.0.3",
77
- "@opencode/theme": "2.0.3",
78
- "@opentui/core": "0.5.10",
79
- "@opentui/solid": "0.5.10",
80
- "@types/bun": "^1.1.0",
81
- "prettier": "^3.9.10",
82
- "solid-js": "1.9.15",
83
- "typescript": "^5.5.0"
75
+ "@opencode/plugin": "2.4.1",
76
+ "@opencode/theme": "2.4.1",
77
+ "@opentui/core": "0.9.9",
78
+ "@opentui/solid": "0.9.9",
79
+ "@types/bun": "1.4.5",
80
+ "prettier": "3.10.1",
81
+ "solid-js": "1.9.20",
82
+ "typescript": "5.9.3"
84
83
  },
85
84
  "peerDependencies": {
86
85
  "@opencode/client": ">=2.0.3",