zenox 1.4.0 → 1.4.1

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.
@@ -9,8 +9,7 @@
9
9
  * - Skips child sessions (background tasks)
10
10
  * - Cooldown to prevent spam (10 seconds between reminders)
11
11
  * - Shows toast notification when enforcing
12
- *
13
- * Inspired by oh-my-opencode's todo-continuation-enforcer
12
+ * - Mode-aware: preserves Plan/Build agent context
14
13
  */
15
14
  import type { PluginInput } from "@opencode-ai/plugin";
16
15
  import type { Event } from "@opencode-ai/sdk";
package/dist/index.js CHANGED
@@ -17799,6 +17799,7 @@ ${primaryKeyword.context}`;
17799
17799
  // src/hooks/todo-enforcer/index.ts
17800
17800
  var COOLDOWN_MS = 1e4;
17801
17801
  var TOAST_DURATION3 = 3000;
17802
+ var SKIP_AGENTS = ["plan"];
17802
17803
  var CONTINUATION_PROMPT = `[TODO CONTINUATION REMINDER]
17803
17804
 
17804
17805
  You have incomplete tasks in your todo list. Continue working on them.
@@ -17836,6 +17837,7 @@ function createTodoEnforcerHook(ctx) {
17836
17837
  if (now - state.lastEnforcedAt < COOLDOWN_MS) {
17837
17838
  return;
17838
17839
  }
17840
+ let agent;
17839
17841
  try {
17840
17842
  const sessionResult = await ctx.client.session.get({
17841
17843
  path: { id: sessionID }
@@ -17844,9 +17846,24 @@ function createTodoEnforcerHook(ctx) {
17844
17846
  if (session?.parentID) {
17845
17847
  return;
17846
17848
  }
17849
+ const msgs = await ctx.client.session.messages({
17850
+ path: { id: sessionID },
17851
+ query: { limit: 5 }
17852
+ });
17853
+ const messages = msgs.data ?? [];
17854
+ for (let i = messages.length - 1;i >= 0; i--) {
17855
+ const info = messages[i]?.info;
17856
+ if (info?.agent) {
17857
+ agent = info.agent;
17858
+ break;
17859
+ }
17860
+ }
17847
17861
  } catch {
17848
17862
  return;
17849
17863
  }
17864
+ if (agent && SKIP_AGENTS.includes(agent)) {
17865
+ return;
17866
+ }
17850
17867
  let todos = [];
17851
17868
  try {
17852
17869
  const todosResult = await ctx.client.session.todo({
@@ -17878,23 +17895,38 @@ Current incomplete tasks:
17878
17895
  ${todoList}
17879
17896
 
17880
17897
  ${statusLine}`;
17881
- try {
17898
+ const sendPrompt = async (omitAgent = false) => {
17882
17899
  await ctx.client.session.prompt({
17883
17900
  path: { id: sessionID },
17884
17901
  body: {
17885
17902
  noReply: false,
17903
+ ...omitAgent || !agent ? {} : { agent },
17886
17904
  parts: [{ type: "text", text: prompt }]
17887
17905
  }
17888
17906
  });
17889
- await ctx.client.tui.showToast({
17890
- body: {
17891
- title: "\uD83D\uDCCB Todo Reminder",
17892
- message: `${incomplete.length} task(s) remaining`,
17893
- variant: "info",
17894
- duration: TOAST_DURATION3
17907
+ };
17908
+ try {
17909
+ await sendPrompt();
17910
+ } catch (err) {
17911
+ const errorMsg = err instanceof Error ? err.message : String(err);
17912
+ if (errorMsg.includes("agent") || errorMsg.includes("undefined")) {
17913
+ try {
17914
+ await sendPrompt(true);
17915
+ } catch {
17916
+ return;
17895
17917
  }
17896
- }).catch(() => {});
17897
- } catch {}
17918
+ } else {
17919
+ return;
17920
+ }
17921
+ }
17922
+ await ctx.client.tui.showToast({
17923
+ body: {
17924
+ title: "\uD83D\uDCCB Todo Reminder",
17925
+ message: `${incomplete.length} task(s) remaining`,
17926
+ variant: "info",
17927
+ duration: TOAST_DURATION3
17928
+ }
17929
+ }).catch(() => {});
17898
17930
  if (sessionStates.size > 50) {
17899
17931
  cleanupOldStates();
17900
17932
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zenox",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
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",