zenox 1.3.0 → 1.4.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 +29 -0
- package/dist/agents/types.d.ts +1 -0
- package/dist/background/manager.d.ts +1 -1
- package/dist/config/schema.d.ts +52 -1
- package/dist/index.js +104 -24
- package/dist/shared/agent-variant.d.ts +19 -0
- package/dist/shared/first-message-variant.d.ts +34 -0
- package/dist/shared/index.d.ts +5 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ Zenox supercharges [OpenCode](https://opencode.ai) with specialized AI agents th
|
|
|
21
21
|
|
|
22
22
|
- **4 Specialized Agents** — Explorer, Librarian, Oracle, UI Planner
|
|
23
23
|
- **Background Tasks** — Fire multiple agents in parallel
|
|
24
|
+
- **Thinking Mode Variants** — Configure thinking levels (high, xhigh, max) per agent
|
|
24
25
|
- **Keyword Triggers** — `ultrawork`, `deep research`, `explore codebase`
|
|
25
26
|
- **Session History** — Query past sessions to learn from previous work
|
|
26
27
|
- **Code Intelligence** — Search symbols via LSP
|
|
@@ -185,6 +186,34 @@ Config saves to `~/.config/opencode/zenox.json`:
|
|
|
185
186
|
}
|
|
186
187
|
```
|
|
187
188
|
|
|
189
|
+
### Thinking Mode Variants
|
|
190
|
+
|
|
191
|
+
Configure thinking/reasoning levels for models that support extended thinking (like Claude, GPT with reasoning, etc.):
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"agents": {
|
|
196
|
+
"oracle": {
|
|
197
|
+
"model": "anthropic/claude-opus-4-5",
|
|
198
|
+
"variant": "high"
|
|
199
|
+
},
|
|
200
|
+
"ui-planner": {
|
|
201
|
+
"model": "openai/gpt-5.2-codex",
|
|
202
|
+
"variant": "xhigh"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Available variants (model-dependent):
|
|
209
|
+
- `low` — Minimal thinking
|
|
210
|
+
- `medium` — Balanced thinking
|
|
211
|
+
- `high` — Extended thinking
|
|
212
|
+
- `xhigh` — Extra high thinking
|
|
213
|
+
- `max` — Maximum reasoning depth
|
|
214
|
+
|
|
215
|
+
Variants are applied safely — if an agent doesn't exist or the model doesn't support the variant, it gracefully falls back.
|
|
216
|
+
|
|
188
217
|
### Disable Agents or MCPs
|
|
189
218
|
|
|
190
219
|
```json
|
package/dist/agents/types.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export type AgentFactory = (model?: string) => AgentConfig;
|
|
|
3
3
|
export type BuiltinAgentName = "explorer" | "librarian" | "oracle" | "ui-planner";
|
|
4
4
|
export type AgentOverrideConfig = Partial<AgentConfig> & {
|
|
5
5
|
prompt_append?: string;
|
|
6
|
+
variant?: string;
|
|
6
7
|
};
|
|
7
8
|
export type AgentOverrides = Partial<Record<BuiltinAgentName, AgentOverrideConfig>>;
|
|
@@ -15,7 +15,7 @@ export declare class BackgroundManager {
|
|
|
15
15
|
private mainSessionID;
|
|
16
16
|
private toastManager;
|
|
17
17
|
setToastManager(manager: TaskToastManager): void;
|
|
18
|
-
setMainSession(sessionID: string): void;
|
|
18
|
+
setMainSession(sessionID: string | undefined): void;
|
|
19
19
|
getMainSession(): string | undefined;
|
|
20
20
|
private generateTaskId;
|
|
21
21
|
launch(client: OpencodeClient, input: LaunchInput): Promise<BackgroundTask>;
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -6,14 +6,17 @@ export declare const AgentNameSchema: z.ZodEnum<["explorer", "librarian", "oracl
|
|
|
6
6
|
export type AgentName = z.infer<typeof AgentNameSchema>;
|
|
7
7
|
/**
|
|
8
8
|
* Configuration for overriding an agent's settings
|
|
9
|
-
*
|
|
9
|
+
* Supports model and variant overrides for thinking modes
|
|
10
10
|
*/
|
|
11
11
|
export declare const AgentOverrideConfigSchema: z.ZodObject<{
|
|
12
12
|
model: z.ZodOptional<z.ZodString>;
|
|
13
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
13
14
|
}, "strip", z.ZodTypeAny, {
|
|
14
15
|
model?: string | undefined;
|
|
16
|
+
variant?: string | undefined;
|
|
15
17
|
}, {
|
|
16
18
|
model?: string | undefined;
|
|
19
|
+
variant?: string | undefined;
|
|
17
20
|
}>;
|
|
18
21
|
export type AgentOverrideConfig = z.infer<typeof AgentOverrideConfigSchema>;
|
|
19
22
|
/**
|
|
@@ -22,57 +25,77 @@ export type AgentOverrideConfig = z.infer<typeof AgentOverrideConfigSchema>;
|
|
|
22
25
|
export declare const AgentOverridesSchema: z.ZodObject<{
|
|
23
26
|
explorer: z.ZodOptional<z.ZodObject<{
|
|
24
27
|
model: z.ZodOptional<z.ZodString>;
|
|
28
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
25
29
|
}, "strip", z.ZodTypeAny, {
|
|
26
30
|
model?: string | undefined;
|
|
31
|
+
variant?: string | undefined;
|
|
27
32
|
}, {
|
|
28
33
|
model?: string | undefined;
|
|
34
|
+
variant?: string | undefined;
|
|
29
35
|
}>>;
|
|
30
36
|
librarian: z.ZodOptional<z.ZodObject<{
|
|
31
37
|
model: z.ZodOptional<z.ZodString>;
|
|
38
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
32
39
|
}, "strip", z.ZodTypeAny, {
|
|
33
40
|
model?: string | undefined;
|
|
41
|
+
variant?: string | undefined;
|
|
34
42
|
}, {
|
|
35
43
|
model?: string | undefined;
|
|
44
|
+
variant?: string | undefined;
|
|
36
45
|
}>>;
|
|
37
46
|
oracle: z.ZodOptional<z.ZodObject<{
|
|
38
47
|
model: z.ZodOptional<z.ZodString>;
|
|
48
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
39
49
|
}, "strip", z.ZodTypeAny, {
|
|
40
50
|
model?: string | undefined;
|
|
51
|
+
variant?: string | undefined;
|
|
41
52
|
}, {
|
|
42
53
|
model?: string | undefined;
|
|
54
|
+
variant?: string | undefined;
|
|
43
55
|
}>>;
|
|
44
56
|
"ui-planner": z.ZodOptional<z.ZodObject<{
|
|
45
57
|
model: z.ZodOptional<z.ZodString>;
|
|
58
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
46
59
|
}, "strip", z.ZodTypeAny, {
|
|
47
60
|
model?: string | undefined;
|
|
61
|
+
variant?: string | undefined;
|
|
48
62
|
}, {
|
|
49
63
|
model?: string | undefined;
|
|
64
|
+
variant?: string | undefined;
|
|
50
65
|
}>>;
|
|
51
66
|
}, "strip", z.ZodTypeAny, {
|
|
52
67
|
explorer?: {
|
|
53
68
|
model?: string | undefined;
|
|
69
|
+
variant?: string | undefined;
|
|
54
70
|
} | undefined;
|
|
55
71
|
librarian?: {
|
|
56
72
|
model?: string | undefined;
|
|
73
|
+
variant?: string | undefined;
|
|
57
74
|
} | undefined;
|
|
58
75
|
oracle?: {
|
|
59
76
|
model?: string | undefined;
|
|
77
|
+
variant?: string | undefined;
|
|
60
78
|
} | undefined;
|
|
61
79
|
"ui-planner"?: {
|
|
62
80
|
model?: string | undefined;
|
|
81
|
+
variant?: string | undefined;
|
|
63
82
|
} | undefined;
|
|
64
83
|
}, {
|
|
65
84
|
explorer?: {
|
|
66
85
|
model?: string | undefined;
|
|
86
|
+
variant?: string | undefined;
|
|
67
87
|
} | undefined;
|
|
68
88
|
librarian?: {
|
|
69
89
|
model?: string | undefined;
|
|
90
|
+
variant?: string | undefined;
|
|
70
91
|
} | undefined;
|
|
71
92
|
oracle?: {
|
|
72
93
|
model?: string | undefined;
|
|
94
|
+
variant?: string | undefined;
|
|
73
95
|
} | undefined;
|
|
74
96
|
"ui-planner"?: {
|
|
75
97
|
model?: string | undefined;
|
|
98
|
+
variant?: string | undefined;
|
|
76
99
|
} | undefined;
|
|
77
100
|
}>;
|
|
78
101
|
export type AgentOverrides = z.infer<typeof AgentOverridesSchema>;
|
|
@@ -84,57 +107,77 @@ export declare const ZenoxConfigSchema: z.ZodObject<{
|
|
|
84
107
|
agents: z.ZodOptional<z.ZodObject<{
|
|
85
108
|
explorer: z.ZodOptional<z.ZodObject<{
|
|
86
109
|
model: z.ZodOptional<z.ZodString>;
|
|
110
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
87
111
|
}, "strip", z.ZodTypeAny, {
|
|
88
112
|
model?: string | undefined;
|
|
113
|
+
variant?: string | undefined;
|
|
89
114
|
}, {
|
|
90
115
|
model?: string | undefined;
|
|
116
|
+
variant?: string | undefined;
|
|
91
117
|
}>>;
|
|
92
118
|
librarian: z.ZodOptional<z.ZodObject<{
|
|
93
119
|
model: z.ZodOptional<z.ZodString>;
|
|
120
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
94
121
|
}, "strip", z.ZodTypeAny, {
|
|
95
122
|
model?: string | undefined;
|
|
123
|
+
variant?: string | undefined;
|
|
96
124
|
}, {
|
|
97
125
|
model?: string | undefined;
|
|
126
|
+
variant?: string | undefined;
|
|
98
127
|
}>>;
|
|
99
128
|
oracle: z.ZodOptional<z.ZodObject<{
|
|
100
129
|
model: z.ZodOptional<z.ZodString>;
|
|
130
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
101
131
|
}, "strip", z.ZodTypeAny, {
|
|
102
132
|
model?: string | undefined;
|
|
133
|
+
variant?: string | undefined;
|
|
103
134
|
}, {
|
|
104
135
|
model?: string | undefined;
|
|
136
|
+
variant?: string | undefined;
|
|
105
137
|
}>>;
|
|
106
138
|
"ui-planner": z.ZodOptional<z.ZodObject<{
|
|
107
139
|
model: z.ZodOptional<z.ZodString>;
|
|
140
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
108
141
|
}, "strip", z.ZodTypeAny, {
|
|
109
142
|
model?: string | undefined;
|
|
143
|
+
variant?: string | undefined;
|
|
110
144
|
}, {
|
|
111
145
|
model?: string | undefined;
|
|
146
|
+
variant?: string | undefined;
|
|
112
147
|
}>>;
|
|
113
148
|
}, "strip", z.ZodTypeAny, {
|
|
114
149
|
explorer?: {
|
|
115
150
|
model?: string | undefined;
|
|
151
|
+
variant?: string | undefined;
|
|
116
152
|
} | undefined;
|
|
117
153
|
librarian?: {
|
|
118
154
|
model?: string | undefined;
|
|
155
|
+
variant?: string | undefined;
|
|
119
156
|
} | undefined;
|
|
120
157
|
oracle?: {
|
|
121
158
|
model?: string | undefined;
|
|
159
|
+
variant?: string | undefined;
|
|
122
160
|
} | undefined;
|
|
123
161
|
"ui-planner"?: {
|
|
124
162
|
model?: string | undefined;
|
|
163
|
+
variant?: string | undefined;
|
|
125
164
|
} | undefined;
|
|
126
165
|
}, {
|
|
127
166
|
explorer?: {
|
|
128
167
|
model?: string | undefined;
|
|
168
|
+
variant?: string | undefined;
|
|
129
169
|
} | undefined;
|
|
130
170
|
librarian?: {
|
|
131
171
|
model?: string | undefined;
|
|
172
|
+
variant?: string | undefined;
|
|
132
173
|
} | undefined;
|
|
133
174
|
oracle?: {
|
|
134
175
|
model?: string | undefined;
|
|
176
|
+
variant?: string | undefined;
|
|
135
177
|
} | undefined;
|
|
136
178
|
"ui-planner"?: {
|
|
137
179
|
model?: string | undefined;
|
|
180
|
+
variant?: string | undefined;
|
|
138
181
|
} | undefined;
|
|
139
182
|
}>>;
|
|
140
183
|
disabled_agents: z.ZodOptional<z.ZodArray<z.ZodEnum<["explorer", "librarian", "oracle", "ui-planner"]>, "many">>;
|
|
@@ -144,15 +187,19 @@ export declare const ZenoxConfigSchema: z.ZodObject<{
|
|
|
144
187
|
agents?: {
|
|
145
188
|
explorer?: {
|
|
146
189
|
model?: string | undefined;
|
|
190
|
+
variant?: string | undefined;
|
|
147
191
|
} | undefined;
|
|
148
192
|
librarian?: {
|
|
149
193
|
model?: string | undefined;
|
|
194
|
+
variant?: string | undefined;
|
|
150
195
|
} | undefined;
|
|
151
196
|
oracle?: {
|
|
152
197
|
model?: string | undefined;
|
|
198
|
+
variant?: string | undefined;
|
|
153
199
|
} | undefined;
|
|
154
200
|
"ui-planner"?: {
|
|
155
201
|
model?: string | undefined;
|
|
202
|
+
variant?: string | undefined;
|
|
156
203
|
} | undefined;
|
|
157
204
|
} | undefined;
|
|
158
205
|
disabled_agents?: ("explorer" | "librarian" | "oracle" | "ui-planner")[] | undefined;
|
|
@@ -162,15 +209,19 @@ export declare const ZenoxConfigSchema: z.ZodObject<{
|
|
|
162
209
|
agents?: {
|
|
163
210
|
explorer?: {
|
|
164
211
|
model?: string | undefined;
|
|
212
|
+
variant?: string | undefined;
|
|
165
213
|
} | undefined;
|
|
166
214
|
librarian?: {
|
|
167
215
|
model?: string | undefined;
|
|
216
|
+
variant?: string | undefined;
|
|
168
217
|
} | undefined;
|
|
169
218
|
oracle?: {
|
|
170
219
|
model?: string | undefined;
|
|
220
|
+
variant?: string | undefined;
|
|
171
221
|
} | undefined;
|
|
172
222
|
"ui-planner"?: {
|
|
173
223
|
model?: string | undefined;
|
|
224
|
+
variant?: string | undefined;
|
|
174
225
|
} | undefined;
|
|
175
226
|
} | undefined;
|
|
176
227
|
disabled_agents?: ("explorer" | "librarian" | "oracle" | "ui-planner")[] | undefined;
|
package/dist/index.js
CHANGED
|
@@ -4812,7 +4812,8 @@ var AgentNameSchema = exports_external.enum([
|
|
|
4812
4812
|
"ui-planner"
|
|
4813
4813
|
]);
|
|
4814
4814
|
var AgentOverrideConfigSchema = exports_external.object({
|
|
4815
|
-
model: exports_external.string().optional()
|
|
4815
|
+
model: exports_external.string().optional(),
|
|
4816
|
+
variant: exports_external.string().optional()
|
|
4816
4817
|
});
|
|
4817
4818
|
var AgentOverridesSchema = exports_external.object({
|
|
4818
4819
|
explorer: AgentOverrideConfigSchema.optional(),
|
|
@@ -4969,24 +4970,34 @@ class BackgroundManager {
|
|
|
4969
4970
|
agent: task.agent
|
|
4970
4971
|
}).catch(() => {});
|
|
4971
4972
|
}
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4973
|
+
const sendPrompt = async (retryWithoutAgent = false) => {
|
|
4974
|
+
try {
|
|
4975
|
+
await client.session.prompt({
|
|
4976
|
+
path: { id: sessionID },
|
|
4977
|
+
body: {
|
|
4978
|
+
...retryWithoutAgent ? {} : { agent: input.agent },
|
|
4979
|
+
tools: { task: false },
|
|
4980
|
+
parts: [{ type: "text", text: input.prompt }]
|
|
4981
|
+
}
|
|
4982
|
+
});
|
|
4983
|
+
} catch (err) {
|
|
4984
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
4985
|
+
if (!retryWithoutAgent && (errorMsg.includes("agent.name") || errorMsg.includes("undefined is not an object"))) {
|
|
4986
|
+
console.warn(`[zenox] Agent "${input.agent}" not found. Retrying with default agent.`);
|
|
4987
|
+
return sendPrompt(true);
|
|
4988
|
+
}
|
|
4989
|
+
const existingTask = this.tasks.get(task.id);
|
|
4990
|
+
if (existingTask) {
|
|
4991
|
+
existingTask.status = "failed";
|
|
4992
|
+
existingTask.error = errorMsg;
|
|
4993
|
+
existingTask.completedAt = new Date;
|
|
4994
|
+
if (this.toastManager) {
|
|
4995
|
+
this.toastManager.showFailureToast(task.id, existingTask.error).catch(() => {});
|
|
4996
|
+
}
|
|
4987
4997
|
}
|
|
4988
4998
|
}
|
|
4989
|
-
}
|
|
4999
|
+
};
|
|
5000
|
+
sendPrompt().catch(() => {});
|
|
4990
5001
|
return task;
|
|
4991
5002
|
}
|
|
4992
5003
|
getTask(taskId) {
|
|
@@ -18203,6 +18214,45 @@ Shows which LSP servers are running and their status.`,
|
|
|
18203
18214
|
lsp_status: lspStatus
|
|
18204
18215
|
};
|
|
18205
18216
|
}
|
|
18217
|
+
// src/shared/agent-variant.ts
|
|
18218
|
+
function resolveAgentVariant(config2, agentName) {
|
|
18219
|
+
if (!agentName)
|
|
18220
|
+
return;
|
|
18221
|
+
const agentOverrides = config2.agents;
|
|
18222
|
+
return agentOverrides?.[agentName]?.variant;
|
|
18223
|
+
}
|
|
18224
|
+
function applyAgentVariant(config2, agentName, message) {
|
|
18225
|
+
const variant = resolveAgentVariant(config2, agentName);
|
|
18226
|
+
if (variant !== undefined && message.variant === undefined) {
|
|
18227
|
+
message.variant = variant;
|
|
18228
|
+
}
|
|
18229
|
+
}
|
|
18230
|
+
// src/shared/first-message-variant.ts
|
|
18231
|
+
function createFirstMessageVariantGate() {
|
|
18232
|
+
const pending = new Set;
|
|
18233
|
+
return {
|
|
18234
|
+
markSessionCreated(info) {
|
|
18235
|
+
if (info?.id && !info.parentID) {
|
|
18236
|
+
pending.add(info.id);
|
|
18237
|
+
}
|
|
18238
|
+
},
|
|
18239
|
+
shouldOverride(sessionID) {
|
|
18240
|
+
if (!sessionID)
|
|
18241
|
+
return false;
|
|
18242
|
+
return pending.has(sessionID);
|
|
18243
|
+
},
|
|
18244
|
+
markApplied(sessionID) {
|
|
18245
|
+
if (!sessionID)
|
|
18246
|
+
return;
|
|
18247
|
+
pending.delete(sessionID);
|
|
18248
|
+
},
|
|
18249
|
+
clear(sessionID) {
|
|
18250
|
+
if (!sessionID)
|
|
18251
|
+
return;
|
|
18252
|
+
pending.delete(sessionID);
|
|
18253
|
+
}
|
|
18254
|
+
};
|
|
18255
|
+
}
|
|
18206
18256
|
// src/index.ts
|
|
18207
18257
|
var ZenoxPlugin = async (ctx) => {
|
|
18208
18258
|
const pluginConfig = loadPluginConfig(ctx.directory);
|
|
@@ -18217,6 +18267,7 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18217
18267
|
const todoEnforcerHook = createTodoEnforcerHook(ctx);
|
|
18218
18268
|
const sessionTools = createSessionTools(ctx.client);
|
|
18219
18269
|
const codeIntelligenceTools = createCodeIntelligenceTools(ctx.client);
|
|
18270
|
+
const firstMessageVariantGate = createFirstMessageVariantGate();
|
|
18220
18271
|
const applyModelOverride = (agentName, baseAgent) => {
|
|
18221
18272
|
const override = pluginConfig.agents?.[agentName];
|
|
18222
18273
|
if (override?.model) {
|
|
@@ -18231,6 +18282,16 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18231
18282
|
...codeIntelligenceTools
|
|
18232
18283
|
},
|
|
18233
18284
|
"chat.message": async (input, output) => {
|
|
18285
|
+
const message = output.message;
|
|
18286
|
+
if (firstMessageVariantGate.shouldOverride(input.sessionID)) {
|
|
18287
|
+
const variant = resolveAgentVariant(pluginConfig, input.agent);
|
|
18288
|
+
if (variant !== undefined) {
|
|
18289
|
+
message.variant = variant;
|
|
18290
|
+
}
|
|
18291
|
+
firstMessageVariantGate.markApplied(input.sessionID);
|
|
18292
|
+
} else {
|
|
18293
|
+
applyAgentVariant(pluginConfig, input.agent, message);
|
|
18294
|
+
}
|
|
18234
18295
|
await keywordDetectorHook["chat.message"]?.(input, output);
|
|
18235
18296
|
},
|
|
18236
18297
|
event: async (input) => {
|
|
@@ -18239,10 +18300,19 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18239
18300
|
if (event.type === "session.created") {
|
|
18240
18301
|
const props = event.properties;
|
|
18241
18302
|
const sessionInfo = props?.info;
|
|
18303
|
+
firstMessageVariantGate.markSessionCreated(sessionInfo);
|
|
18242
18304
|
if (sessionInfo?.id && !sessionInfo?.parentID) {
|
|
18243
18305
|
backgroundManager.setMainSession(sessionInfo.id);
|
|
18244
18306
|
}
|
|
18245
18307
|
}
|
|
18308
|
+
if (event.type === "session.deleted") {
|
|
18309
|
+
const props = event.properties;
|
|
18310
|
+
const sessionID = props?.info?.id;
|
|
18311
|
+
firstMessageVariantGate.clear(sessionID);
|
|
18312
|
+
if (sessionID && sessionID === backgroundManager.getMainSession()) {
|
|
18313
|
+
backgroundManager.setMainSession(undefined);
|
|
18314
|
+
}
|
|
18315
|
+
}
|
|
18246
18316
|
if (event.type === "session.idle") {
|
|
18247
18317
|
const props = event.properties;
|
|
18248
18318
|
const sessionID = props?.sessionID;
|
|
@@ -18252,14 +18322,24 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18252
18322
|
if (notification) {
|
|
18253
18323
|
const mainSessionID = backgroundManager.getMainSession();
|
|
18254
18324
|
if (mainSessionID) {
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18325
|
+
const sendNotification = async (omitAgent = false) => {
|
|
18326
|
+
try {
|
|
18327
|
+
await ctx.client.session.prompt({
|
|
18328
|
+
path: { id: mainSessionID },
|
|
18329
|
+
body: {
|
|
18330
|
+
noReply: !notification.allComplete,
|
|
18331
|
+
...omitAgent ? {} : { agent: notification.parentAgent },
|
|
18332
|
+
parts: [{ type: "text", text: notification.message }]
|
|
18333
|
+
}
|
|
18334
|
+
});
|
|
18335
|
+
} catch (err) {
|
|
18336
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
18337
|
+
if (!omitAgent && (errorMsg.includes("agent.name") || errorMsg.includes("undefined"))) {
|
|
18338
|
+
return sendNotification(true);
|
|
18339
|
+
}
|
|
18261
18340
|
}
|
|
18262
|
-
}
|
|
18341
|
+
};
|
|
18342
|
+
await sendNotification();
|
|
18263
18343
|
}
|
|
18264
18344
|
return;
|
|
18265
18345
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Variant Handling
|
|
3
|
+
*
|
|
4
|
+
* Safely resolves and applies agent variants for thinking modes.
|
|
5
|
+
* Defensive implementation to prevent "undefined is not an object" errors.
|
|
6
|
+
*/
|
|
7
|
+
import type { ZenoxConfig } from "../config";
|
|
8
|
+
/**
|
|
9
|
+
* Safely resolve agent variant from config
|
|
10
|
+
* Returns undefined if agent doesn't exist or has no variant configured
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveAgentVariant(config: ZenoxConfig, agentName?: string): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Apply agent variant to message if configured
|
|
15
|
+
* Safe for undefined agents - simply does nothing
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyAgentVariant(config: ZenoxConfig, agentName: string | undefined, message: {
|
|
18
|
+
variant?: string;
|
|
19
|
+
}): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First Message Variant Gate
|
|
3
|
+
*
|
|
4
|
+
* Tracks new sessions to apply variants only on the first message.
|
|
5
|
+
* Prevents variants from being applied to forked/child sessions.
|
|
6
|
+
*/
|
|
7
|
+
type SessionInfo = {
|
|
8
|
+
id?: string;
|
|
9
|
+
parentID?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Creates a gate that tracks which sessions need variant applied on first message
|
|
13
|
+
*/
|
|
14
|
+
export declare function createFirstMessageVariantGate(): {
|
|
15
|
+
/**
|
|
16
|
+
* Mark a newly created session as pending variant application
|
|
17
|
+
* Only marks non-child sessions (no parentID)
|
|
18
|
+
*/
|
|
19
|
+
markSessionCreated(info?: SessionInfo): void;
|
|
20
|
+
/**
|
|
21
|
+
* Check if this session should have variant overridden
|
|
22
|
+
*/
|
|
23
|
+
shouldOverride(sessionID?: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Mark variant as applied for this session
|
|
26
|
+
*/
|
|
27
|
+
markApplied(sessionID?: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Clear session from tracking (on session delete)
|
|
30
|
+
*/
|
|
31
|
+
clear(sessionID?: string): void;
|
|
32
|
+
};
|
|
33
|
+
export type FirstMessageVariantGate = ReturnType<typeof createFirstMessageVariantGate>;
|
|
34
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zenox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "OpenCode plugin with specialized agents (explorer, librarian, oracle, ui-planner), background tasks for parallel execution, and smart orchestration",
|
|
5
5
|
"author": "Ayush",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
"code-intelligence",
|
|
45
45
|
"lsp",
|
|
46
46
|
"todo-enforcer",
|
|
47
|
+
"thinking-modes",
|
|
48
|
+
"variants",
|
|
47
49
|
"ai",
|
|
48
50
|
"llm",
|
|
49
51
|
"cli"
|