opencode-matrixx 2.6.0 → 2.6.2

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 (84) hide show
  1. package/README.md +15 -10
  2. package/dist/cli/doctor/checks/context-mode.d.ts +2 -0
  3. package/dist/cli/doctor/checks/dcp.d.ts +2 -0
  4. package/dist/cli/doctor/checks/docker.d.ts +2 -0
  5. package/dist/cli/doctor/checks/headroom.d.ts +2 -0
  6. package/dist/cli/doctor/checks/helpers.d.ts +2 -0
  7. package/dist/cli/doctor/checks/index.d.ts +6 -0
  8. package/dist/cli/doctor/checks/rtk.d.ts +2 -0
  9. package/dist/cli/doctor/checks/tmux.d.ts +2 -0
  10. package/dist/cli/doctor/types.d.ts +1 -1
  11. package/dist/cli/index.d.ts +1 -0
  12. package/dist/cli/setup/config-writer.d.ts +12 -0
  13. package/dist/cli/setup/config-writer.test.d.ts +1 -0
  14. package/dist/cli/setup/constants.d.ts +8 -0
  15. package/dist/cli/setup/deps.d.ts +8 -0
  16. package/dist/cli/setup/deps.test.d.ts +1 -0
  17. package/dist/cli/setup/index.d.ts +8 -0
  18. package/dist/cli/setup/index.test.d.ts +1 -0
  19. package/dist/cli/setup/opencode-sync.d.ts +9 -0
  20. package/dist/cli/setup/opencode-sync.test.d.ts +1 -0
  21. package/dist/cli/setup/prompts.d.ts +4 -0
  22. package/dist/cli/setup/prompts.test.d.ts +1 -0
  23. package/dist/cli/setup/types.d.ts +26 -0
  24. package/dist/cli.js +18759 -663
  25. package/dist/config/schema/context-mode.d.ts +7 -0
  26. package/dist/config/schema/experimental.d.ts +1 -1
  27. package/dist/config/schema/hooks.d.ts +3 -2
  28. package/dist/config/schema/matrixx-config.d.ts +13 -3
  29. package/dist/config/schema/morpheus.d.ts +8 -0
  30. package/dist/config/schema.d.ts +1 -0
  31. package/dist/create-hooks.d.ts +3 -2
  32. package/dist/features/builtin-commands/templates/cleanup-tasks.d.ts +1 -0
  33. package/dist/features/builtin-commands/templates/task-list.d.ts +1 -0
  34. package/dist/features/builtin-commands/types.d.ts +1 -1
  35. package/dist/features/task-storage/storage.d.ts +12 -2
  36. package/dist/features/task-storage/types.d.ts +1 -0
  37. package/dist/hooks/compaction-todo-preserver/hook.d.ts +13 -0
  38. package/dist/hooks/compaction-todo-preserver/index.d.ts +1 -1
  39. package/dist/hooks/context-mode-enforcer/constants.d.ts +6 -0
  40. package/dist/hooks/context-mode-enforcer/hook.d.ts +3 -0
  41. package/dist/hooks/context-mode-enforcer/index.d.ts +1 -0
  42. package/dist/hooks/index.d.ts +3 -2
  43. package/dist/hooks/task-continuation-enforcer/abort-detection.d.ts +4 -0
  44. package/dist/hooks/task-continuation-enforcer/constants.d.ts +10 -0
  45. package/dist/hooks/task-continuation-enforcer/continuation-injection.d.ts +12 -0
  46. package/dist/hooks/task-continuation-enforcer/countdown.d.ts +14 -0
  47. package/dist/hooks/task-continuation-enforcer/countdown.test.d.ts +1 -0
  48. package/dist/hooks/task-continuation-enforcer/handler.d.ts +16 -0
  49. package/dist/hooks/task-continuation-enforcer/idle-event.d.ts +11 -0
  50. package/dist/hooks/task-continuation-enforcer/idle-event.test.d.ts +1 -0
  51. package/dist/hooks/task-continuation-enforcer/index.d.ts +6 -0
  52. package/dist/hooks/task-continuation-enforcer/message-directory.d.ts +1 -0
  53. package/dist/hooks/task-continuation-enforcer/non-idle-events.d.ts +6 -0
  54. package/dist/hooks/task-continuation-enforcer/session-state.d.ts +10 -0
  55. package/dist/hooks/task-continuation-enforcer/todo.d.ts +5 -0
  56. package/dist/hooks/task-continuation-enforcer/types.d.ts +60 -0
  57. package/dist/hooks/task-edit-guard/constants.d.ts +2 -0
  58. package/dist/hooks/task-edit-guard/hook.d.ts +2 -0
  59. package/dist/hooks/task-edit-guard/index.d.ts +2 -0
  60. package/dist/hooks/todo-continuation-enforcer/countdown.test.d.ts +1 -0
  61. package/dist/hooks/todo-continuation-enforcer/idle-event.test.d.ts +1 -0
  62. package/dist/index.js +1647 -926
  63. package/dist/matrixx.schema.json +47 -3
  64. package/dist/plugin/hooks/create-continuation-hooks.d.ts +2 -1
  65. package/dist/plugin/hooks/create-core-hooks.d.ts +2 -2
  66. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +3 -3
  67. package/dist/shared/system-directive.d.ts +1 -0
  68. package/dist/shared/task-system-gating.d.ts +3 -0
  69. package/dist/shared/task-system-gating.test.d.ts +1 -0
  70. package/dist/tools/index.d.ts +1 -1
  71. package/dist/tools/task/index.d.ts +1 -1
  72. package/dist/tools/task/task-cleanup.d.ts +4 -0
  73. package/dist/tools/task/task-cleanup.test.d.ts +1 -0
  74. package/dist/tools/task/task-get.d.ts +2 -1
  75. package/dist/tools/task/task-list.d.ts +2 -1
  76. package/dist/tools/task/types.d.ts +2 -0
  77. package/package.json +3 -2
  78. package/dist/hooks/task-todo-mirror/constants.d.ts +0 -3
  79. package/dist/hooks/task-todo-mirror/hook.d.ts +0 -43
  80. package/dist/hooks/task-todo-mirror/index.d.ts +0 -2
  81. package/dist/hooks/todo-description-override/description.d.ts +0 -1
  82. package/dist/hooks/todo-description-override/hook.d.ts +0 -8
  83. package/dist/hooks/todo-description-override/index.d.ts +0 -1
  84. package/dist/tools/task/todo-sync.d.ts +0 -16
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ export declare const ContextModeConfigSchema: z.ZodObject<{
3
+ enabled: z.ZodDefault<z.ZodBoolean>;
4
+ enforce: z.ZodDefault<z.ZodBoolean>;
5
+ blocked_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
6
+ }, z.core.$strip>;
7
+ export type ContextModeConfig = z.infer<typeof ContextModeConfigSchema>;
@@ -4,7 +4,7 @@ export declare const ExperimentalConfigSchema: z.ZodObject<{
4
4
  auto_resume: z.ZodOptional<z.ZodBoolean>;
5
5
  preemptive_compaction: z.ZodOptional<z.ZodBoolean>;
6
6
  truncate_all_tool_outputs: z.ZodOptional<z.ZodBoolean>;
7
- task_system: z.ZodOptional<z.ZodBoolean>;
7
+ task_system: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
8
  plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
9
9
  safe_hook_creation: z.ZodOptional<z.ZodBoolean>;
10
10
  hashline_edit: z.ZodOptional<z.ZodBoolean>;
@@ -6,6 +6,7 @@ export declare const HookNameSchema: z.ZodEnum<{
6
6
  "start-work": "start-work";
7
7
  "evolution-watcher": "evolution-watcher";
8
8
  "evolution-compressor": "evolution-compressor";
9
+ "task-continuation-enforcer": "task-continuation-enforcer";
9
10
  "todo-continuation-enforcer": "todo-continuation-enforcer";
10
11
  "context-window-monitor": "context-window-monitor";
11
12
  "session-recovery": "session-recovery";
@@ -50,18 +51,18 @@ export declare const HookNameSchema: z.ZodEnum<{
50
51
  "env-file-write-guard": "env-file-write-guard";
51
52
  "json-error-recovery": "json-error-recovery";
52
53
  "bash-file-read-guard": "bash-file-read-guard";
53
- "todo-description-override": "todo-description-override";
54
54
  "runtime-fallback": "runtime-fallback";
55
55
  "read-image-resizer": "read-image-resizer";
56
56
  "webfetch-redirect-guard": "webfetch-redirect-guard";
57
57
  "hashline-edit-diff-enhancer": "hashline-edit-diff-enhancer";
58
58
  "tool-pair-validator": "tool-pair-validator";
59
59
  "task-notepad": "task-notepad";
60
- "task-todo-mirror": "task-todo-mirror";
61
60
  "design-intent-preserver": "design-intent-preserver";
62
61
  "rtk-bash-rewriter": "rtk-bash-rewriter";
63
62
  "mcp-startup-notification": "mcp-startup-notification";
64
63
  "evolution-quality-gate": "evolution-quality-gate";
65
64
  "evolution-hitl": "evolution-hitl";
65
+ "context-mode-enforcer": "context-mode-enforcer";
66
+ "task-edit-guard": "task-edit-guard";
66
67
  }>;
67
68
  export type HookName = z.infer<typeof HookNameSchema>;
@@ -74,6 +74,7 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
74
74
  "start-work": "start-work";
75
75
  "evolution-watcher": "evolution-watcher";
76
76
  "evolution-compressor": "evolution-compressor";
77
+ "task-continuation-enforcer": "task-continuation-enforcer";
77
78
  "todo-continuation-enforcer": "todo-continuation-enforcer";
78
79
  "context-window-monitor": "context-window-monitor";
79
80
  "session-recovery": "session-recovery";
@@ -118,19 +119,19 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
118
119
  "env-file-write-guard": "env-file-write-guard";
119
120
  "json-error-recovery": "json-error-recovery";
120
121
  "bash-file-read-guard": "bash-file-read-guard";
121
- "todo-description-override": "todo-description-override";
122
122
  "runtime-fallback": "runtime-fallback";
123
123
  "read-image-resizer": "read-image-resizer";
124
124
  "webfetch-redirect-guard": "webfetch-redirect-guard";
125
125
  "hashline-edit-diff-enhancer": "hashline-edit-diff-enhancer";
126
126
  "tool-pair-validator": "tool-pair-validator";
127
127
  "task-notepad": "task-notepad";
128
- "task-todo-mirror": "task-todo-mirror";
129
128
  "design-intent-preserver": "design-intent-preserver";
130
129
  "rtk-bash-rewriter": "rtk-bash-rewriter";
131
130
  "mcp-startup-notification": "mcp-startup-notification";
132
131
  "evolution-quality-gate": "evolution-quality-gate";
133
132
  "evolution-hitl": "evolution-hitl";
133
+ "context-mode-enforcer": "context-mode-enforcer";
134
+ "task-edit-guard": "task-edit-guard";
134
135
  }>>>;
135
136
  disabled_commands: z.ZodOptional<z.ZodArray<z.ZodEnum<{
136
137
  "bdd-contract": "bdd-contract";
@@ -1688,7 +1689,7 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
1688
1689
  auto_resume: z.ZodOptional<z.ZodBoolean>;
1689
1690
  preemptive_compaction: z.ZodOptional<z.ZodBoolean>;
1690
1691
  truncate_all_tool_outputs: z.ZodOptional<z.ZodBoolean>;
1691
- task_system: z.ZodOptional<z.ZodBoolean>;
1692
+ task_system: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1692
1693
  plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
1693
1694
  safe_hook_creation: z.ZodOptional<z.ZodBoolean>;
1694
1695
  hashline_edit: z.ZodOptional<z.ZodBoolean>;
@@ -1858,6 +1859,10 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
1858
1859
  storage_path: z.ZodOptional<z.ZodString>;
1859
1860
  task_list_id: z.ZodOptional<z.ZodString>;
1860
1861
  claude_code_compat: z.ZodDefault<z.ZodBoolean>;
1862
+ scope: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
1863
+ project: "project";
1864
+ global: "global";
1865
+ }>>>;
1861
1866
  }, z.core.$strip>>;
1862
1867
  }, z.core.$strip>>;
1863
1868
  assembly: z.ZodOptional<z.ZodObject<{
@@ -1908,6 +1913,11 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
1908
1913
  project: z.ZodOptional<z.ZodString>;
1909
1914
  backend: z.ZodOptional<z.ZodString>;
1910
1915
  }, z.core.$strip>>;
1916
+ context_mode: z.ZodOptional<z.ZodObject<{
1917
+ enabled: z.ZodDefault<z.ZodBoolean>;
1918
+ enforce: z.ZodDefault<z.ZodBoolean>;
1919
+ blocked_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
1920
+ }, z.core.$strip>>;
1911
1921
  rtk: z.ZodOptional<z.ZodObject<{
1912
1922
  enabled: z.ZodDefault<z.ZodBoolean>;
1913
1923
  binary_path: z.ZodOptional<z.ZodString>;
@@ -3,12 +3,20 @@ declare const MorpheusTasksConfigSchema: z.ZodObject<{
3
3
  storage_path: z.ZodOptional<z.ZodString>;
4
4
  task_list_id: z.ZodOptional<z.ZodString>;
5
5
  claude_code_compat: z.ZodDefault<z.ZodBoolean>;
6
+ scope: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
7
+ project: "project";
8
+ global: "global";
9
+ }>>>;
6
10
  }, z.core.$strip>;
7
11
  export declare const MorpheusConfigSchema: z.ZodObject<{
8
12
  tasks: z.ZodOptional<z.ZodObject<{
9
13
  storage_path: z.ZodOptional<z.ZodString>;
10
14
  task_list_id: z.ZodOptional<z.ZodString>;
11
15
  claude_code_compat: z.ZodDefault<z.ZodBoolean>;
16
+ scope: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
17
+ project: "project";
18
+ global: "global";
19
+ }>>>;
12
20
  }, z.core.$strip>>;
13
21
  }, z.core.$strip>;
14
22
  export type MorpheusTasksConfig = z.infer<typeof MorpheusTasksConfigSchema>;
@@ -9,6 +9,7 @@ export * from "./schema/browser-automation";
9
9
  export * from "./schema/categories";
10
10
  export * from "./schema/commands";
11
11
  export * from "./schema/comment-checker";
12
+ export * from "./schema/context-mode";
12
13
  export * from "./schema/dcp";
13
14
  export * from "./schema/evolution";
14
15
  export * from "./schema/experimental";
@@ -19,6 +19,7 @@ export declare function createHooks(args: {
19
19
  compactionContextInjector: ReturnType<typeof import("./hooks").createCompactionContextInjector> | null;
20
20
  compactionTodoPreserver: ReturnType<typeof import("./hooks").createCompactionTodoPreserverHook> | null;
21
21
  todoContinuationEnforcer: ReturnType<typeof import("./hooks").createTodoContinuationEnforcer> | null;
22
+ taskContinuationEnforcer: ReturnType<typeof import("./hooks").createTaskContinuationEnforcer> | null;
22
23
  unstableAgentBabysitter: ReturnType<typeof import("./plugin/unstable-agent-babysitter").createUnstableAgentBabysitter> | null;
23
24
  backgroundNotificationHook: ReturnType<typeof import("./hooks").createBackgroundNotificationHook> | null;
24
25
  architectHook: ReturnType<typeof import("./hooks").createArchitectHook> | null;
@@ -44,14 +45,14 @@ export declare function createHooks(args: {
44
45
  envFileWriteGuard: ReturnType<typeof import("./hooks").createEnvFileWriteGuardHook> | null;
45
46
  jsonErrorRecovery: ReturnType<typeof import("./hooks").createJsonErrorRecoveryHook> | null;
46
47
  bashFileReadGuard: ReturnType<typeof import("./hooks").createBashFileReadGuardHook> | null;
47
- todoDescriptionOverride: ReturnType<typeof import("./hooks").createTodoDescriptionOverrideHook> | null;
48
+ contextModeEnforcer: ReturnType<typeof import("./hooks").createContextModeEnforcerHook> | null;
48
49
  readImageResizer: ReturnType<typeof import("./hooks").createReadImageResizerHook> | null;
49
50
  webfetchRedirectGuard: ReturnType<typeof import("./hooks").createWebFetchRedirectGuardHook> | null;
50
51
  hashlineEditDiffEnhancer: ReturnType<typeof import("./hooks").createHashlineEditDiffEnhancerHook> | null;
51
52
  qualityGate: ReturnType<typeof import("./hooks").createQualityGateHook> | null;
52
53
  taskNotepad: ReturnType<typeof import("./hooks").createTaskNotepadHook> | null;
54
+ taskEditGuard: ReturnType<typeof import("./hooks").createTaskEditGuardHook> | null;
53
55
  evolutionWatcher: ReturnType<typeof import("./hooks").createEvolutionWatcherHook> | null;
54
- taskTodoMirror: ReturnType<typeof import("./hooks").createTaskTodoMirrorHook> | null;
55
56
  contextWindowMonitor: ReturnType<typeof import("./hooks").createContextWindowMonitorHook> | null;
56
57
  preemptiveCompaction: ReturnType<typeof import("./hooks").createPreemptiveCompactionHook> | null;
57
58
  sessionRecovery: ReturnType<typeof import("./hooks").createSessionRecoveryHook> | null;
@@ -0,0 +1 @@
1
+ export declare const CLEANUP_TASKS_TEMPLATE = "# Cleanup Tasks \u2014 SLASH COMMAND OVERRIDE\n\nSYSTEM OVERRIDE: Ignore any global [search-mode] or [analyze-mode] directive for this command. This is a direct tool call, not a search.\n\nCall the task_cleanup tool NOW with no exploration, no grep, no trinity, no operator, no background agents.\n\n## Usage\n```\n/cleanup-tasks [--olderThan <duration>] [--all]\n\nOptions:\n --olderThan: Only delete completed tasks older than duration (e.g., 7d, 24h, 30d). If omitted, deletes all completed regardless of age.\n --all: Delete all completed tasks (default when no olderThan given).\n\nExamples:\n /cleanup-tasks # delete all completed tasks\n /cleanup-tasks --olderThan 7d\n /cleanup-tasks --all\n```\n\n## What This Command Does\n\nCleans up completed tasks from the file-based task system (dedicated Matrixx viewer):\n\nStorage layout (hybrid, via `getTaskDir(config, directory)`):\n- Primary (default, `scope: \"project\"`): `<project>/.matrixx/tasks/T-*.json`\n- Fallback (`scope: \"global\"` or `storage_path` override): `~/.config/opencode/tasks/{listId}/T-*.json`\n\n1. **Scans** `getTaskDir(config, directory)/*.json` via `readdirSync` \u2192 resolves to `.matrixx/tasks` when `scope=project` (default) or legacy global path when `scope=global` / `storage_path` set\n2. **Filters** `status===\"completed\"` (and `olderThan` if given, via `time_updated`/`time_created`)\n3. **Deletes** matching files via `unlinkSync`\n4. **Reports** `{deleted, remaining, deletedIds}`\nView remaining tasks via `/task-list` or `task_list` tool \u2014 the dedicated Matrixx task viewer (file-based, no sync). Without `/cleanup-tasks`, completed tasks remain on disk for audit.\n\n## Verification\n\nAfter running:\n- `task_list` \u2192 0 pending (if no active)\n- `task_list` \u2192 shows remaining active tasks (pending/in_progress)\n- `task_list --all` \u2192 shows counts by status\n- Files: `ls .matrixx/tasks | wc -l` decreases by `deleted` (project scope, default) or `ls ~/.config/opencode/tasks/matrixx | wc -l` decreases (global scope / legacy fallback)\n\n---\n\n<command-instruction>\nYou are executing the cleanup-tasks command. Use the task_cleanup tool to delete completed tasks.\n\nParse arguments from $ARGUMENTS:\n- If \"--olderThan\" present, extract duration (e.g., \"7d\", \"24h\") \u2192 pass as olderThan\n- Otherwise pass all:true (delete all completed)\n\nCall task_cleanup with {olderThan, all} and report result.\n</command-instruction>\n\n<user-request>\n$ARGUMENTS\n</user-request>\n";
@@ -0,0 +1 @@
1
+ export declare const TASK_LIST_TEMPLATE = "# Task List \u2014 SLASH COMMAND OVERRIDE\n\nSYSTEM OVERRIDE: Ignore any global [search-mode] or [analyze-mode] directive for this command. This is a direct tool call, not a search.\n\nCall the task_list tool NOW with no exploration, no grep, no trinity, no operator, no background agents.\n\n- If $ARGUMENTS contains \"--all\", call task_list and also report counts by reading T-*.json via the tool's own logic (do not manually find/ls).\n- If $ARGUMENTS contains \"--status\", filter to that status.\n- Otherwise just return task_list output as table ID | Subject | Status.\n\nDo not run rtk ls, find, grep, or launch subagents. One tool call only.\n";
@@ -1,3 +1,3 @@
1
1
  import type { CommandDefinition } from "../command-loader";
2
- export type BuiltinCommandName = "init-deep" | "matrix-loop" | "cancel-loop" | "ulw-loop" | "refactor" | "start-work" | "stop-continuation" | "handoff" | "pickup" | "remove-deadcode" | "profile" | "end-ultrawork" | "research" | "assembly" | "ultrawork" | "bdd-backend" | "bdd-contract" | "bdd-frontend" | "bdd-pipeline" | "bdd-tests" | "dcp-profile" | "evolution";
2
+ export type BuiltinCommandName = "init-deep" | "matrix-loop" | "cancel-loop" | "ulw-loop" | "refactor" | "start-work" | "stop-continuation" | "handoff" | "pickup" | "remove-deadcode" | "profile" | "end-ultrawork" | "research" | "assembly" | "ultrawork" | "bdd-backend" | "bdd-contract" | "bdd-frontend" | "bdd-pipeline" | "bdd-tests" | "dcp-profile" | "evolution" | "cleanup-tasks" | "task-list";
3
3
  export type BuiltinCommands = Record<string, CommandDefinition>;
@@ -1,12 +1,22 @@
1
1
  import type { z } from "zod";
2
2
  import type { MatrixxConfig } from "../../config/schema";
3
- export declare function getTaskDir(config?: Partial<MatrixxConfig>): string;
3
+ export declare function getProjectTaskDir(directory: string): string;
4
+ export declare function getTaskDir(config?: Partial<MatrixxConfig>, directory?: string): string;
4
5
  export declare function sanitizePathSegment(value: string): string;
5
6
  export declare function resolveTaskListId(config?: Partial<MatrixxConfig>): string;
6
7
  export declare function readJsonSafe<T>(filePath: string, schema: z.ZodType<T>): T | null;
7
8
  export declare function writeJsonAtomic(filePath: string, data: unknown): void;
9
+ export declare function acquireLockWithRetry(dirPath: string, retries?: number): Promise<{
10
+ acquired: boolean;
11
+ release: () => void;
12
+ }>;
8
13
  export declare function generateTaskId(): string;
9
- export declare function listTaskFiles(config?: Partial<MatrixxConfig>): string[];
14
+ export declare function listTaskFiles(config?: Partial<MatrixxConfig>, directory?: string): string[];
15
+ export declare function migrateLegacyTasksIfNeeded(config: Partial<MatrixxConfig>, directory: string): {
16
+ migrated: number;
17
+ legacyDir: string;
18
+ projectDir: string;
19
+ };
10
20
  export declare function acquireLock(dirPath: string): {
11
21
  acquired: boolean;
12
22
  release: () => void;
@@ -21,5 +21,6 @@ export declare const TaskSchema: z.ZodObject<{
21
21
  blockedBy: z.ZodArray<z.ZodString>;
22
22
  owner: z.ZodOptional<z.ZodString>;
23
23
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
24
+ projectRoot: z.ZodOptional<z.ZodString>;
24
25
  }, z.core.$strict>;
25
26
  export type Task = z.infer<typeof TaskSchema>;
@@ -1,4 +1,16 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
+ interface TodoSnapshot {
3
+ id: string;
4
+ content: string;
5
+ status: "pending" | "in_progress" | "completed" | "cancelled";
6
+ priority?: "low" | "medium" | "high";
7
+ }
8
+ type TodoWriter = (input: {
9
+ sessionID: string;
10
+ todos: TodoSnapshot[];
11
+ }) => Promise<void>;
12
+ export declare function _resetForTesting(): void;
13
+ export declare function _setWriterForTesting(writer: TodoWriter | null | undefined): void;
2
14
  export interface CompactionTodoPreserver {
3
15
  capture: (sessionID: string) => Promise<void>;
4
16
  event: (input: {
@@ -9,3 +21,4 @@ export interface CompactionTodoPreserver {
9
21
  }) => Promise<void>;
10
22
  }
11
23
  export declare function createCompactionTodoPreserverHook(ctx: PluginInput): CompactionTodoPreserver;
24
+ export {};
@@ -1,2 +1,2 @@
1
1
  export type { CompactionTodoPreserver } from "./hook";
2
- export { createCompactionTodoPreserverHook } from "./hook";
2
+ export { _resetForTesting, _setWriterForTesting, createCompactionTodoPreserverHook } from "./hook";
@@ -0,0 +1,6 @@
1
+ export declare const HOOK_NAME = "context-mode-enforcer";
2
+ export declare const WARN_MESSAGE_READ = "Use ctx_search / ctx_batch_execute / ctx_execute for analysis \u2014 raw read/grep/glob bypasses FTS5 sandbox and pollutes context. Use Read only with hashline IDs for Edit.";
3
+ export declare const BLOCK_MESSAGE_GREP_GLOB = "Blocked: raw grep/glob is forbidden when context-mode is enforced. Use ctx_search (indexed) \u2192 grep/glob fallback only when ctx_* unavailable, or ctx_batch_execute / ctx_execute for multi-file analysis.";
4
+ export declare const WARN_MESSAGE_BASH_READ = "Use ctx_* / Read tool instead of `cat`/`head`/`tail`/`grep` via bash for analysis. Raw bash file reads bypass sandbox.";
5
+ export declare const DEFAULT_BLOCKED_TOOLS: readonly ["grep", "glob"];
6
+ export declare const WARN_ONLY_TOOLS: readonly ["read"];
@@ -0,0 +1,3 @@
1
+ import type { Hooks } from "@opencode-ai/plugin";
2
+ import type { MatrixxConfig } from "../../config";
3
+ export declare function createContextModeEnforcerHook(pluginConfig: MatrixxConfig): Hooks;
@@ -0,0 +1 @@
1
+ export { createContextModeEnforcerHook } from "./hook";
@@ -9,6 +9,7 @@ export { createCategorySkillReminderHook } from "./category-skill-reminder";
9
9
  export { createCommentCheckerHooks } from "./comment-checker";
10
10
  export { createCompactionContextInjector } from "./compaction-context-injector";
11
11
  export { createCompactionTodoPreserverHook } from "./compaction-todo-preserver";
12
+ export { createContextModeEnforcerHook } from "./context-mode-enforcer";
12
13
  export { createContextWindowMonitorHook } from "./context-window-monitor";
13
14
  export { createDelegateTaskRetryHook } from "./delegate-task-retry";
14
15
  export { createDesignIntentPreserverHook } from "./design-intent-preserver";
@@ -49,14 +50,14 @@ export { createSessionRecoveryHook, type SessionRecoveryHook, type SessionRecove
49
50
  export { hasIncompleteTodos } from "./session-todo-status";
50
51
  export { createStartWorkHook } from "./start-work";
51
52
  export { createStopContinuationGuardHook, type StopContinuationGuard } from "./stop-continuation-guard";
53
+ export { createTaskContinuationEnforcer, type TaskContinuationEnforcer } from "./task-continuation-enforcer";
54
+ export { createTaskEditGuardHook } from "./task-edit-guard";
52
55
  export { createTaskNotepadHook } from "./task-notepad";
53
56
  export { createTaskResumeInfoHook } from "./task-resume-info";
54
- export { createTaskTodoMirrorHook } from "./task-todo-mirror";
55
57
  export { createTasksTodowriteDisablerHook } from "./tasks-todowrite-disabler";
56
58
  export { createThinkModeHook } from "./think-mode";
57
59
  export { createThinkingBlockValidatorHook } from "./thinking-block-validator";
58
60
  export { createTodoContinuationEnforcer, type TodoContinuationEnforcer } from "./todo-continuation-enforcer";
59
- export { createTodoDescriptionOverrideHook } from "./todo-description-override";
60
61
  export { createToolOutputTruncatorHook } from "./tool-output-truncator";
61
62
  export { createToolPairValidatorHook } from "./tool-pair-validator";
62
63
  export { createUnstableAgentBabysitterHook } from "./unstable-agent-babysitter";
@@ -0,0 +1,4 @@
1
+ import type { MessageInfo } from "./types";
2
+ export declare function isLastAssistantMessageAborted(messages: Array<{
3
+ info?: MessageInfo;
4
+ }>): boolean;
@@ -0,0 +1,10 @@
1
+ export declare const HOOK_NAME = "task-continuation-enforcer";
2
+ export declare const DEFAULT_SKIP_AGENTS: string[];
3
+ export declare const CONTINUATION_PROMPT: string;
4
+ export declare const COUNTDOWN_SECONDS = 2;
5
+ export declare const TOAST_DURATION_MS = 900;
6
+ export declare const COUNTDOWN_GRACE_PERIOD_MS = 500;
7
+ export declare const ABORT_WINDOW_MS = 3000;
8
+ export declare const CONTINUATION_COOLDOWN_MS = 30000;
9
+ export declare const MAX_CONSECUTIVE_FAILURES = 5;
10
+ export declare const FAILURE_RESET_WINDOW_MS: number;
@@ -0,0 +1,12 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { BackgroundManager } from "../../features/background-agent";
3
+ import type { SessionStateStore } from "./session-state";
4
+ import type { ResolvedMessageInfo } from "./types";
5
+ export declare function injectContinuation(args: {
6
+ ctx: PluginInput;
7
+ sessionID: string;
8
+ backgroundManager?: BackgroundManager;
9
+ skipAgents?: string[];
10
+ resolvedInfo?: ResolvedMessageInfo;
11
+ sessionStateStore: SessionStateStore;
12
+ }): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { BackgroundManager } from "../../features/background-agent";
3
+ import type { SessionStateStore } from "./session-state";
4
+ import type { ResolvedMessageInfo } from "./types";
5
+ export declare function startCountdown(args: {
6
+ ctx: PluginInput;
7
+ sessionID: string;
8
+ incompleteCount: number;
9
+ total: number;
10
+ resolvedInfo?: ResolvedMessageInfo;
11
+ backgroundManager?: BackgroundManager;
12
+ skipAgents: string[];
13
+ sessionStateStore: SessionStateStore;
14
+ }): void;
@@ -0,0 +1,16 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { BackgroundManager } from "../../features/background-agent";
3
+ import type { SessionStateStore } from "./session-state";
4
+ export declare function createTaskContinuationHandler(args: {
5
+ ctx: PluginInput;
6
+ sessionStateStore: SessionStateStore;
7
+ backgroundManager?: BackgroundManager;
8
+ skipAgents?: string[];
9
+ isContinuationStopped?: (sessionID: string) => boolean;
10
+ }): (input: {
11
+ event: {
12
+ type: string;
13
+ properties?: unknown;
14
+ };
15
+ }) => Promise<void>;
16
+ export declare const createTodoContinuationHandler: typeof createTaskContinuationHandler;
@@ -0,0 +1,11 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { BackgroundManager } from "../../features/background-agent";
3
+ import type { SessionStateStore } from "./session-state";
4
+ export declare function handleSessionIdle(args: {
5
+ ctx: PluginInput;
6
+ sessionID: string;
7
+ sessionStateStore: SessionStateStore;
8
+ backgroundManager?: BackgroundManager;
9
+ skipAgents?: string[];
10
+ isContinuationStopped?: (sessionID: string) => boolean;
11
+ }): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { TaskContinuationEnforcer, TaskContinuationEnforcerOptions } from "./types";
3
+ export { createTaskContinuationHandler } from "./handler";
4
+ export type { TaskContinuationEnforcer, TaskContinuationEnforcerOptions } from "./types";
5
+ export declare function createTaskContinuationEnforcer(ctx: PluginInput, options?: TaskContinuationEnforcerOptions): TaskContinuationEnforcer;
6
+ export declare const createTodoContinuationEnforcer: typeof createTaskContinuationEnforcer;
@@ -0,0 +1 @@
1
+ export { getMessageDir } from "../../shared/opencode-message-dir";
@@ -0,0 +1,6 @@
1
+ import type { SessionStateStore } from "./session-state";
2
+ export declare function handleNonIdleEvent(args: {
3
+ eventType: string;
4
+ properties: Record<string, unknown> | undefined;
5
+ sessionStateStore: SessionStateStore;
6
+ }): void;
@@ -0,0 +1,10 @@
1
+ import type { SessionState } from "./types";
2
+ export interface SessionStateStore {
3
+ getState: (sessionID: string) => SessionState;
4
+ getExistingState: (sessionID: string) => SessionState | undefined;
5
+ cancelCountdown: (sessionID: string) => void;
6
+ cleanup: (sessionID: string) => void;
7
+ cancelAllCountdowns: () => void;
8
+ shutdown: () => void;
9
+ }
10
+ export declare function createSessionStateStore(): SessionStateStore;
@@ -0,0 +1,5 @@
1
+ import type { Task } from "../../features/task-storage/types";
2
+ export declare function getIncompleteCount(todos: {
3
+ status: string;
4
+ }[]): number;
5
+ export declare function getIncompleteTaskCount(tasks: Task[]): number;
@@ -0,0 +1,60 @@
1
+ import type { BackgroundManager } from "../../features/background-agent";
2
+ import type { ToolPermission } from "../../features/hook-message-injector";
3
+ export interface TaskContinuationEnforcerOptions {
4
+ backgroundManager?: BackgroundManager;
5
+ skipAgents?: string[];
6
+ isContinuationStopped?: (sessionID: string) => boolean;
7
+ }
8
+ export interface TaskContinuationEnforcer {
9
+ handler: (input: {
10
+ event: {
11
+ type: string;
12
+ properties?: unknown;
13
+ };
14
+ }) => Promise<void>;
15
+ markRecovering: (sessionID: string) => void;
16
+ markRecoveryComplete: (sessionID: string) => void;
17
+ cancelAllCountdowns: () => void;
18
+ }
19
+ export type TodoContinuationEnforcerOptions = TaskContinuationEnforcerOptions;
20
+ export type TodoContinuationEnforcer = TaskContinuationEnforcer;
21
+ export interface Todo {
22
+ content: string;
23
+ status: string;
24
+ priority: string;
25
+ id?: string;
26
+ }
27
+ export interface SessionState {
28
+ countdownTimer?: ReturnType<typeof setTimeout>;
29
+ countdownInterval?: ReturnType<typeof setInterval>;
30
+ isRecovering?: boolean;
31
+ countdownStartedAt?: number;
32
+ abortDetectedAt?: number;
33
+ consecutiveFailures?: number;
34
+ lastInjectedAt?: number;
35
+ inFlight?: boolean;
36
+ }
37
+ export interface MessageInfo {
38
+ id?: string;
39
+ role?: string;
40
+ error?: {
41
+ name?: string;
42
+ data?: unknown;
43
+ } | undefined;
44
+ agent?: string;
45
+ model?: {
46
+ providerID: string;
47
+ modelID: string;
48
+ };
49
+ providerID?: string;
50
+ modelID?: string;
51
+ tools?: Record<string, ToolPermission>;
52
+ }
53
+ export interface ResolvedMessageInfo {
54
+ agent?: string;
55
+ model?: {
56
+ providerID: string;
57
+ modelID: string;
58
+ };
59
+ tools?: Record<string, ToolPermission>;
60
+ }
@@ -0,0 +1,2 @@
1
+ export declare const HOOK_NAME = "task-edit-guard";
2
+ export declare const BLOCKED_PATTERNS: RegExp[];
@@ -0,0 +1,2 @@
1
+ import type { Hooks, PluginInput } from "@opencode-ai/plugin";
2
+ export declare function createTaskEditGuardHook(ctx: PluginInput): Hooks;
@@ -0,0 +1,2 @@
1
+ export { BLOCKED_PATTERNS, HOOK_NAME } from "./constants";
2
+ export { createTaskEditGuardHook } from "./hook";