opencode-matrixx 2.6.10 → 2.6.11

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 (80) hide show
  1. package/README.md +6 -5
  2. package/dist/agents/architect/default.d.ts +1 -1
  3. package/dist/agents/architect/gpt.d.ts +1 -1
  4. package/dist/agents/dynamic-agent-prompt-builder.d.ts +6 -5
  5. package/dist/cli.js +30 -77
  6. package/dist/config/schema/agent-overrides.d.ts +126 -126
  7. package/dist/config/schema/commands.d.ts +0 -5
  8. package/dist/config/schema/dcp.d.ts +3 -3
  9. package/dist/config/schema/hooks.d.ts +3 -0
  10. package/dist/config/schema/internal/permission.d.ts +8 -8
  11. package/dist/config/schema/knowledge.d.ts +34 -0
  12. package/dist/config/schema/matrixx-config.d.ts +145 -125
  13. package/dist/config/schema/tool-gating.d.ts +9 -0
  14. package/dist/config/schema.d.ts +2 -0
  15. package/dist/create-hooks.d.ts +3 -0
  16. package/dist/features/background-agent/manager.d.ts +19 -0
  17. package/dist/features/bdd/schema.d.ts +5 -5
  18. package/dist/features/builtin-commands/types.d.ts +1 -1
  19. package/dist/features/knowledge-hub/index.d.ts +3 -0
  20. package/dist/features/knowledge-hub/loader.d.ts +11 -0
  21. package/dist/features/knowledge-hub/loader.test.d.ts +1 -0
  22. package/dist/features/knowledge-hub/resolver.d.ts +2 -0
  23. package/dist/features/knowledge-hub/resolver.test.d.ts +1 -0
  24. package/dist/features/mission-state/constants.d.ts +20 -0
  25. package/dist/features/mission-state/index.d.ts +1 -0
  26. package/dist/features/mission-state/plan-storage.d.ts +32 -6
  27. package/dist/features/mission-state/reconcile.d.ts +75 -0
  28. package/dist/features/mission-state/reconcile.test.d.ts +1 -0
  29. package/dist/features/mission-state/storage.d.ts +26 -0
  30. package/dist/features/mission-state/types.d.ts +6 -0
  31. package/dist/hooks/auto-slash-command/executor.d.ts +11 -3
  32. package/dist/hooks/auto-slash-command/hook.d.ts +0 -2
  33. package/dist/hooks/index.d.ts +3 -0
  34. package/dist/hooks/knowledge-hub-guard/approvals.d.ts +5 -0
  35. package/dist/hooks/knowledge-hub-guard/hook.d.ts +15 -0
  36. package/dist/hooks/knowledge-hub-guard/hook.test.d.ts +1 -0
  37. package/dist/hooks/knowledge-hub-guard/index.d.ts +3 -0
  38. package/dist/hooks/knowledge-hub-injector/hook.d.ts +26 -0
  39. package/dist/hooks/knowledge-hub-injector/hook.test.d.ts +1 -0
  40. package/dist/hooks/knowledge-hub-injector/index.d.ts +2 -0
  41. package/dist/hooks/knowledge-hub-search-nudge/hook.d.ts +16 -0
  42. package/dist/hooks/knowledge-hub-search-nudge/hook.test.d.ts +1 -0
  43. package/dist/hooks/knowledge-hub-search-nudge/index.d.ts +2 -0
  44. package/dist/hooks/plan-persister/index.d.ts +4 -0
  45. package/dist/hooks/plan-persister/task-link.d.ts +31 -0
  46. package/dist/hooks/plan-persister/task-sync.d.ts +39 -0
  47. package/dist/hooks/plan-persister/task-sync.test.d.ts +1 -0
  48. package/dist/hooks/start-work/index.d.ts +1 -0
  49. package/dist/hooks/start-work/plan-filter.d.ts +48 -0
  50. package/dist/index.js +2970 -2122
  51. package/dist/matrixx.schema.json +89 -119
  52. package/dist/plugin/hooks/create-core-hooks.d.ts +3 -0
  53. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +3 -1
  54. package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -1
  55. package/dist/plugin/tool-gating.d.ts +33 -0
  56. package/dist/shared/dcp-guidance.d.ts +16 -0
  57. package/dist/{tools/dcp-switch-profile/tools.d.ts → shared/dcp-switch-profile.d.ts} +1 -3
  58. package/dist/shared/index.d.ts +1 -0
  59. package/dist/tools/background-task/constants.d.ts +1 -0
  60. package/dist/tools/background-task/create-background-wait-all.d.ts +3 -0
  61. package/dist/tools/background-task/index.d.ts +1 -1
  62. package/dist/tools/background-task/tools.d.ts +1 -0
  63. package/dist/tools/background-task/types.d.ts +3 -0
  64. package/dist/tools/delegate-task/constants.d.ts +6 -0
  65. package/dist/tools/delegate-task/prompt-builder.d.ts +1 -0
  66. package/dist/tools/delegate-task/prompt-builder.tdd.test.d.ts +1 -0
  67. package/dist/tools/delegate-task/tdd-enforcement.test.d.ts +1 -0
  68. package/dist/tools/delegate-task/tools.d.ts +6 -0
  69. package/dist/tools/delegate-task/types.d.ts +1 -0
  70. package/dist/tools/index.d.ts +1 -1
  71. package/dist/tools/knowledge-hub-confirm/index.d.ts +1 -0
  72. package/dist/tools/knowledge-hub-confirm/tools.d.ts +12 -0
  73. package/dist/tools/knowledge-hub-confirm/tools.test.d.ts +1 -0
  74. package/package.json +1 -1
  75. package/dist/features/builtin-commands/templates/bdd-backend.d.ts +0 -1
  76. package/dist/features/builtin-commands/templates/bdd-contract.d.ts +0 -1
  77. package/dist/features/builtin-commands/templates/bdd-frontend.d.ts +0 -1
  78. package/dist/features/builtin-commands/templates/bdd-tests.d.ts +0 -1
  79. package/dist/features/builtin-commands/templates/dcp-profile.d.ts +0 -1
  80. package/dist/tools/dcp-switch-profile/index.d.ts +0 -1
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ /** Startup-token tool auto-gating — defer rarely-needed LLM tools until auto-detect or opt-in */
3
+ export declare const ToolGatingConfigSchema: z.ZodObject<{
4
+ bdd_tools: z.ZodOptional<z.ZodBoolean>;
5
+ pdf_figures: z.ZodOptional<z.ZodBoolean>;
6
+ look_at: z.ZodOptional<z.ZodBoolean>;
7
+ preset_tools: z.ZodDefault<z.ZodBoolean>;
8
+ }, z.core.$strip>;
9
+ export type ToolGatingConfig = z.infer<typeof ToolGatingConfigSchema>;
@@ -16,6 +16,7 @@ export * from "./schema/experimental";
16
16
  export * from "./schema/failure-counter";
17
17
  export * from "./schema/headroom";
18
18
  export * from "./schema/hooks";
19
+ export * from "./schema/knowledge";
19
20
  export * from "./schema/matrix-loop";
20
21
  export * from "./schema/matrixx-config";
21
22
  export * from "./schema/matrixx-self-config";
@@ -32,4 +33,5 @@ export * from "./schema/task";
32
33
  export * from "./schema/tasks";
33
34
  export * from "./schema/tdd-enforcer";
34
35
  export * from "./schema/tmux";
36
+ export * from "./schema/tool-gating";
35
37
  export * from "./schema/websearch";
@@ -29,6 +29,7 @@ export declare function createHooks(args: {
29
29
  inputSecretGuard: ReturnType<typeof import("./hooks").createInputSecretGuardHook> | null;
30
30
  keywordDetector: ReturnType<typeof import("./hooks").createKeywordDetectorHook> | null;
31
31
  contextInjectorMessagesTransform: ReturnType<typeof import("./features/context-injector").createContextInjectorMessagesTransformHook>;
32
+ knowledgeHubInjector: ReturnType<typeof import("./hooks").createKnowledgeHubInjectorHook> | null;
32
33
  envContextInjector: ReturnType<typeof import("./hooks").createEnvContextInjectorHook> | null;
33
34
  thinkingBlockValidator: ReturnType<typeof import("./hooks").createThinkingBlockValidatorHook> | null;
34
35
  toolPairValidator: ReturnType<typeof import("./hooks").createToolPairValidatorHook> | null;
@@ -54,6 +55,8 @@ export declare function createHooks(args: {
54
55
  taskNotepad: ReturnType<typeof import("./hooks").createTaskNotepadHook> | null;
55
56
  taskEditGuard: ReturnType<typeof import("./hooks").createTaskEditGuardHook> | null;
56
57
  documentReaderGuard: ReturnType<typeof import("./hooks").createDocumentReaderGuardHook> | null;
58
+ knowledgeHubGuard: ReturnType<typeof import("./hooks").createKnowledgeHubGuardHook> | null;
59
+ knowledgeHubSearchNudge: ReturnType<typeof import("./hooks").createKnowledgeHubSearchNudgeHook> | null;
57
60
  evolutionWatcher: ReturnType<typeof import("./hooks").createEvolutionWatcherHook> | null;
58
61
  contextWindowMonitor: ReturnType<typeof import("./hooks").createContextWindowMonitorHook> | null;
59
62
  preemptiveCompaction: ReturnType<typeof import("./hooks").createPreemptiveCompactionHook> | null;
@@ -184,6 +184,25 @@ export declare class BackgroundManager {
184
184
  * Returns the number of tasks cancelled.
185
185
  */
186
186
  cancelAllForSession(parentSessionID: string): number;
187
+ /**
188
+ * Wait for all descendant tasks (running/pending) to reach a terminal state.
189
+ * Polls every `pollIntervalMs` until all tasks are terminal or `timeoutMs` elapses.
190
+ * Returns per-task results: completed tasks and timed-out (still running) tasks.
191
+ */
192
+ waitForAllDescendants(sessionID: string, timeoutMs?: number, pollIntervalMs?: number): Promise<{
193
+ completed: Array<{
194
+ id: string;
195
+ description: string;
196
+ agent: string;
197
+ status: string;
198
+ }>;
199
+ timedOut: Array<{
200
+ id: string;
201
+ description: string;
202
+ agent: string;
203
+ status: string;
204
+ }>;
205
+ }>;
187
206
  private startPolling;
188
207
  private stopPolling;
189
208
  private registerProcessCleanup;
@@ -86,8 +86,8 @@ export declare const HttpMethodSchema: z.ZodEnum<{
86
86
  }>;
87
87
  export declare const ResponseFormatSchema: z.ZodEnum<{
88
88
  binary: "binary";
89
- text: "text";
90
89
  json: "json";
90
+ text: "text";
91
91
  html: "html";
92
92
  xml: "xml";
93
93
  }>;
@@ -118,8 +118,8 @@ export declare const ApiResponseSchema: z.ZodObject<{
118
118
  status: z.ZodNumber;
119
119
  format: z.ZodEnum<{
120
120
  binary: "binary";
121
- text: "text";
122
121
  json: "json";
122
+ text: "text";
123
123
  html: "html";
124
124
  xml: "xml";
125
125
  }>;
@@ -174,8 +174,8 @@ export declare const ApiAnnotationsSchema: z.ZodObject<{
174
174
  status: z.ZodNumber;
175
175
  format: z.ZodEnum<{
176
176
  binary: "binary";
177
- text: "text";
178
177
  json: "json";
178
+ text: "text";
179
179
  html: "html";
180
180
  xml: "xml";
181
181
  }>;
@@ -236,8 +236,8 @@ export declare const ContractAnnotationsSchema: z.ZodObject<{
236
236
  status: z.ZodNumber;
237
237
  format: z.ZodEnum<{
238
238
  binary: "binary";
239
- text: "text";
240
239
  json: "json";
240
+ text: "text";
241
241
  html: "html";
242
242
  xml: "xml";
243
243
  }>;
@@ -366,8 +366,8 @@ export declare const ContractSchema: z.ZodObject<{
366
366
  status: z.ZodNumber;
367
367
  format: z.ZodEnum<{
368
368
  binary: "binary";
369
- text: "text";
370
369
  json: "json";
370
+ text: "text";
371
371
  html: "html";
372
372
  xml: "xml";
373
373
  }>;
@@ -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" | "preset" | "end-ultrawork" | "research" | "assembly" | "ultrawork" | "bdd-backend" | "bdd-contract" | "bdd-frontend" | "bdd-pipeline" | "bdd-tests" | "dcp-profile" | "evolution" | "cleanup-tasks" | "task-list";
2
+ export type BuiltinCommandName = "init-deep" | "matrix-loop" | "cancel-loop" | "ulw-loop" | "refactor" | "start-work" | "stop-continuation" | "handoff" | "pickup" | "remove-deadcode" | "preset" | "end-ultrawork" | "research" | "assembly" | "ultrawork" | "bdd-pipeline" | "evolution" | "cleanup-tasks" | "task-list";
3
3
  export type BuiltinCommands = Record<string, CommandDefinition>;
@@ -0,0 +1,3 @@
1
+ export type { LoadedHub } from "./loader";
2
+ export { expandHubPath, loadKnowledgeHubs } from "./loader";
3
+ export { resolveKnowledgeFile } from "./resolver";
@@ -0,0 +1,11 @@
1
+ import { type KnowledgeConfig, type KnowledgeHub } from "../../config/schema/knowledge";
2
+ export interface LoadedHub {
3
+ name: string;
4
+ root: string;
5
+ indexPath: string;
6
+ scope: KnowledgeHub["scope"];
7
+ mode: KnowledgeHub["mode"];
8
+ exclude: string[];
9
+ }
10
+ export declare function expandHubPath(rawPath: string, projectDir?: string): string;
11
+ export declare function loadKnowledgeHubs(config: KnowledgeConfig | KnowledgeHub[], projectDir?: string): LoadedHub[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { LoadedHub } from "./loader";
2
+ export declare function resolveKnowledgeFile(hubs: LoadedHub[], ref: string): string | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -10,8 +10,28 @@ export declare const ORACLE_PLANS_DIR = ".matrixx/plans";
10
10
  */
11
11
  /** Relative path from project root to plans directory */
12
12
  export declare const PLANS_DIR = ".matrixx/plans";
13
+ /** Subdir of PLANS_DIR holding archived stale plans; excluded from listings. */
14
+ export declare const PLANS_ARCHIVE_DIR_NAME = "_archive";
15
+ /** Default staleness window (hours) shared by task + plan archival. */
16
+ export declare const DEFAULT_STALE_AFTER_HOURS = 24;
13
17
  /** HTML comment marker for machine metadata at the end of a plan file */
14
18
  export declare const META_TAG_PREFIX = "<!-- plan-persister:";
15
19
  export declare const META_TAG_SUFFIX = "-->";
16
20
  /** Safety cap: max bytes for a single plan file read */
17
21
  export declare const MAX_PLAN_FILE_BYTES = 102400;
22
+ /**
23
+ * Plan Checkbox Patterns
24
+ *
25
+ * Single source of truth for plan progress counting (see getPlanProgress).
26
+ * All patterns are anchored to column 0: indented sub-checkboxes
27
+ * (acceptance criteria, Definition-of-Done nests) never count.
28
+ * Do NOT inline checkbox regexes elsewhere — import these instead.
29
+ */
30
+ /** Top-level unchecked box: `- [ ]` or `* [ ]` */
31
+ export declare const TOP_UNCHECKED_RE: RegExp;
32
+ /** Top-level checked box: `- [x]` / `- [X]` (case-insensitive) */
33
+ export declare const TOP_CHECKED_RE: RegExp;
34
+ /** Numbered unchecked task (Oracle format): `- [ ] 1. Task` */
35
+ export declare const NUMBERED_UNCHECKED_RE: RegExp;
36
+ /** Numbered checked task (Oracle format): `- [x] 2. Task` */
37
+ export declare const NUMBERED_CHECKED_RE: RegExp;
@@ -1,5 +1,6 @@
1
1
  export * from "./constants";
2
2
  export * from "./plan-storage";
3
+ export * from "./reconcile";
3
4
  export * from "./rehydrate";
4
5
  export * from "./storage";
5
6
  export * from "./types";
@@ -25,13 +25,39 @@ export declare function atomicWrite(filePath: string, content: string): boolean;
25
25
  */
26
26
  export declare function writePlanFile(directory: string, planPath: string, content: string): boolean;
27
27
  /**
28
- * Sync markdown checkbox status to match todos.
29
- *
30
- * For each `- [ ]` or `- [x]` line, finds the matching todo by content
31
- * and marks it completed if the todo status is completed/cancelled.
32
- * Lines without a matching todo keep their current state.
33
- * Checked boxes are never unchecked — sync only transitions [ ] → [x].
28
+ * Verification-style guard: boxes matching verify/verification/checklist/
29
+ * definition-of-done/final check with zero task overlap are never
30
+ * force-completed — state kept, line reported via `flaggedVerification`.
31
+ */
32
+ export declare const VERIFICATION_STYLE_RE: RegExp;
33
+ /** Lowercase, strip punctuation/numbers, split tokens, drop stop-words. */
34
+ export declare function normalizeCheckboxText(text: string): string[];
35
+ export declare const isVerificationStyle: (text: string) => boolean;
36
+ /**
37
+ * Token overlap: match on >= 2 shared content tokens, or on shorter-side
38
+ * ratio >= 0.5 with normalized-set equality (equality keeps exact matches
39
+ * like "Task A"; without it one generic word cross-matches every sibling,
40
+ * e.g. "Task D" would flip on completed "Task A").
41
+ */
42
+ export declare function checkboxOverlap(a: string, b: string): {
43
+ shared: number;
44
+ score: number;
45
+ matched: boolean;
46
+ };
47
+ export interface SyncCheckboxesResult {
48
+ content: string;
49
+ flaggedVerification: string[];
50
+ }
51
+ /**
52
+ * Sync checkboxes to todos by token overlap (indented lines sync too, though
53
+ * Task 2 counting ignores them). Best overlap wins, ties go first. Checked
54
+ * boxes never uncheck ([ ] → [x] only); unmatched lines keep state.
34
55
  */
56
+ export declare function syncCheckboxesDetailed(content: string, todos: Array<{
57
+ content: string;
58
+ status: string;
59
+ }>): SyncCheckboxesResult;
60
+ /** String-only wrapper (backward compatible with plan-persister hook). */
35
61
  export declare function syncCheckboxes(content: string, todos: Array<{
36
62
  content: string;
37
63
  status: string;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Plan reconciliation + stale-plan archival policy.
3
+ *
4
+ * The reconciler re-runs the Tasks 3-4 linkage pass (checkboxOverlap +
5
+ * verification guard from plan-storage) with a confidence gate: only
6
+ * high-confidence token overlap auto-checks, the rest is reported for
7
+ * manual plan_update. Runs are idempotent — a converged plan yields no writes.
8
+ *
9
+ * Archival moves stale orphans to .matrixx/plans/_archive/ (never deletes).
10
+ */
11
+ import type { MatrixxConfig } from "../../config/schema";
12
+ export interface ReconcileTodo {
13
+ content: string;
14
+ status: string;
15
+ }
16
+ export interface ReconcileResult {
17
+ content: string;
18
+ checked: string[];
19
+ lowConfidence: string[];
20
+ flaggedVerification: string[];
21
+ changed: boolean;
22
+ }
23
+ export interface ReconcileFileResult extends ReconcileResult {
24
+ wrote: boolean;
25
+ }
26
+ /**
27
+ * High-confidence gate: token overlap matched (Task 3 thresholds) AND the
28
+ * box is not verification-flagged. Verification-style boxes with genuine
29
+ * overlap still flip (overlap wins); zero-overlap verification boxes land
30
+ * in flaggedVerification and never auto-check.
31
+ */
32
+ export declare function isHighConfidence(boxText: string, todoContent: string, flaggedVerification?: string[]): boolean;
33
+ /** Reconcile plan content against runtime todos; pure, no disk writes. */
34
+ export declare function reconcilePlanContent(content: string, todos: ReconcileTodo[]): ReconcileResult;
35
+ /** Reconcile one plan file; writes only when content changed (idempotent). */
36
+ export declare function reconcilePlanFile(planPath: string, todos: ReconcileTodo[]): ReconcileFileResult;
37
+ /** Invocation point for start-work: reconcile only when plans compete (>1). */
38
+ export declare function shouldReconcileOnStartWork(incompleteCount: number): boolean;
39
+ export interface ActiveTaskSubjects {
40
+ subjects: string[];
41
+ unknownTaskFiles: string[];
42
+ }
43
+ /**
44
+ * Subjects of active (pending/in_progress) tasks. Strict-schema drops
45
+ * (readJsonSafe -> null) are counted + logged as unknown — never treated
46
+ * as completed, never silently ignored.
47
+ */
48
+ export declare function readActiveTaskSubjects(directory: string, config?: Partial<MatrixxConfig>): ActiveTaskSubjects;
49
+ /** A plan whose file cannot be stat'ed is treated as fresh (not stale). */
50
+ export declare function isStaleByMtime(planPath: string, staleAfterHours?: number): boolean;
51
+ export type ArchiveDecision = "active-plan" | "linked-active-tasks" | "fresh" | "unreadable" | "stale-orphan";
52
+ /** Archive candidacy: stale mtime AND zero linked active tasks AND not active. */
53
+ export declare function isArchiveCandidate(planPath: string, content: string | null, subjects: string[], staleAfterHours: number, activePlan?: string | null): {
54
+ candidate: boolean;
55
+ reason: ArchiveDecision;
56
+ };
57
+ export interface ArchiveScanOptions {
58
+ staleAfterHours?: number;
59
+ activePlan?: string | null;
60
+ activeTaskSubjects?: string[];
61
+ config?: Partial<MatrixxConfig>;
62
+ dryRun?: boolean;
63
+ }
64
+ export interface ArchiveResult {
65
+ candidates: string[];
66
+ moved: string[];
67
+ unknownTaskFiles: string[];
68
+ before: number;
69
+ after: number;
70
+ }
71
+ /**
72
+ * Move stale orphans to _archive/ preserving bytes (incl. plan-persister
73
+ * meta). Dry-run reports candidates with zero moves. Never deletes.
74
+ */
75
+ export declare function archiveStalePlans(directory: string, opts?: ArchiveScanOptions): ArchiveResult;
@@ -0,0 +1 @@
1
+ export {};
@@ -5,6 +5,23 @@
5
5
  */
6
6
  import type { MissionState, PlanProgress } from "./types";
7
7
  export declare function readMissionState(directory: string): MissionState | null;
8
+ /**
9
+ * Normalize a parsed mission.json value in memory (no disk rewrite).
10
+ * Legacy files used a singular `session_id` string; modern files use
11
+ * `session_ids[]`. Missing or non-array values become `[]` unless a
12
+ * legacy `session_id` string is present, which becomes `[session_id]`.
13
+ */
14
+ export declare function normalizeMissionState(parsed: unknown): MissionState | null;
15
+ /**
16
+ * Rotate the mission when its active plan is complete: clear mission.json
17
+ * so the next start-work run auto-selects instead of zombie-resuming.
18
+ * Returns `{ rotated: true, state: null }` after clearing, otherwise the
19
+ * preserved state. Never rewrites an incomplete or missing mission.
20
+ */
21
+ export declare function rotateMissionIfComplete(directory: string): {
22
+ rotated: boolean;
23
+ state: MissionState | null;
24
+ };
8
25
  export declare function writeMissionState(directory: string, state: MissionState): boolean;
9
26
  export declare function appendSessionId(directory: string, sessionId: string): MissionState | null;
10
27
  export declare function clearMissionState(directory: string): boolean;
@@ -13,6 +30,15 @@ export declare function clearMissionState(directory: string): boolean;
13
30
  * Oracle stores plans at: {project}/.matrixx/plans/{name}.md
14
31
  */
15
32
  export declare function findOraclePlans(directory: string): string[];
33
+ /**
34
+ * Count checkbox progress from plan content.
35
+ *
36
+ * Single content-level implementation behind getPlanProgress: numbered
37
+ * task lines (Oracle format) win when present, otherwise all top-level
38
+ * checkboxes count. Indented boxes never count. Do NOT inline checkbox
39
+ * regexes elsewhere — import the Task 2 constants instead.
40
+ */
41
+ export declare function countPlanProgressFromContent(content: string): PlanProgress;
16
42
  /**
17
43
  * Parse a plan file and count checkbox progress.
18
44
  */
@@ -23,6 +23,12 @@ export interface PlanProgress {
23
23
  completed: number;
24
24
  /** Whether all tasks are done */
25
25
  isComplete: boolean;
26
+ /**
27
+ * True when total is 0 (empty, prose-only, or missing plan).
28
+ * isComplete stays true by vacuity; callers should log/warn and
29
+ * route these plans to human triage instead of treating them as done.
30
+ */
31
+ needsTriage?: boolean;
26
32
  }
27
33
  /**
28
34
  * Plan Persistence Types
@@ -1,11 +1,19 @@
1
- import type { createOpencodeClient } from "@opencode-ai/sdk";
2
1
  import type { BuiltinSkill } from "../../features/builtin-skills";
3
2
  import type { ParsedSlashCommand } from "./types";
4
3
  export interface ExecutorOptions {
5
4
  skills?: BuiltinSkill[];
6
- /** OpenCode SDK client for discovering plugin-registered commands */
7
- client?: ReturnType<typeof createOpencodeClient>;
8
5
  }
6
+ /**
7
+ * Ownership rule: the hook expands only matrixx-owned scopes (builtin,
8
+ * markdown command dirs, skills). Plugin-scope commands belong to other
9
+ * plugins and must fall through so the owning plugin handles them natively —
10
+ * claiming them renders instruction-less blocks (e.g. /dcp-compress). Empty
11
+ * templates are declined in every scope for the same reason.
12
+ */
13
+ export declare function isHookOwnedCommand(cmd: {
14
+ scope: string;
15
+ content?: string;
16
+ }): boolean;
9
17
  interface ExecuteResult {
10
18
  success: boolean;
11
19
  replacementText?: string;
@@ -2,8 +2,6 @@ import type { BuiltinSkill } from "../../features/builtin-skills";
2
2
  import type { AutoSlashCommandHookInput, AutoSlashCommandHookOutput, CommandExecuteBeforeInput, CommandExecuteBeforeOutput } from "./types";
3
3
  export interface AutoSlashCommandHookOptions {
4
4
  skills?: BuiltinSkill[];
5
- /** OpenCode SDK client for discovering plugin-registered commands */
6
- client?: ReturnType<typeof import("@opencode-ai/sdk").createOpencodeClient>;
7
5
  }
8
6
  export declare function createAutoSlashCommandHook(options?: AutoSlashCommandHookOptions): {
9
7
  "chat.message": (input: AutoSlashCommandHookInput, output: AutoSlashCommandHookOutput) => Promise<void>;
@@ -31,6 +31,9 @@ export { createInputSecretGuardHook } from "./input-secret-guard";
31
31
  export { createInteractiveBashSessionHook } from "./interactive-bash-session";
32
32
  export { createJsonErrorRecoveryHook } from "./json-error-recovery";
33
33
  export { createKeywordDetectorHook } from "./keyword-detector";
34
+ export { createKnowledgeHubGuardHook } from "./knowledge-hub-guard";
35
+ export { createKnowledgeHubInjectorHook } from "./knowledge-hub-injector";
36
+ export { createKnowledgeHubSearchNudgeHook } from "./knowledge-hub-search-nudge";
34
37
  export { createMatrixLoopHook, type MatrixLoopHook } from "./matrix-loop";
35
38
  export { createMouseNotepadHook } from "./mouse-notepad";
36
39
  export { createNonInteractiveEnvHook } from "./non-interactive-env";
@@ -0,0 +1,5 @@
1
+ export declare const HUB_WRITE_APPROVAL_TTL_MS: number;
2
+ export declare function normalizeApprovedPath(absPath: string): string;
3
+ export declare function approveHubWrite(sessionID: string, absPath: string, ttlMs?: number): string;
4
+ export declare function isHubWriteApproved(sessionID: string, absPath: string): boolean;
5
+ export declare function clearHubWriteApprovals(): void;
@@ -0,0 +1,15 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { LoadedHub } from "../../features/knowledge-hub/loader";
3
+ export interface KnowledgeHubGuardOptions {
4
+ hubs?: LoadedHub[];
5
+ getHubs?: () => LoadedHub[];
6
+ }
7
+ export declare function createKnowledgeHubGuardHook(ctx: PluginInput, options?: KnowledgeHubGuardOptions): {
8
+ "tool.execute.before": (input: {
9
+ tool: string;
10
+ sessionID: string;
11
+ callID: string;
12
+ }, output: {
13
+ args: Record<string, unknown>;
14
+ }) => Promise<void>;
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export { approveHubWrite, clearHubWriteApprovals, HUB_WRITE_APPROVAL_TTL_MS, isHubWriteApproved } from "./approvals";
2
+ export type { KnowledgeHubGuardOptions } from "./hook";
3
+ export { createKnowledgeHubGuardHook } from "./hook";
@@ -0,0 +1,26 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { Message, Part } from "@opencode-ai/sdk";
3
+ import type { KnowledgeHub } from "../../config/schema/knowledge";
4
+ import { type ContextCollector } from "../../features/context-injector";
5
+ export interface KnowledgeHubInjectorOptions {
6
+ hubs?: KnowledgeHub[];
7
+ getHubs?: () => KnowledgeHub[];
8
+ pinnedFiles?: string[];
9
+ collector?: ContextCollector;
10
+ }
11
+ interface MessageWithParts {
12
+ info: Message;
13
+ parts: Part[];
14
+ }
15
+ export declare function createKnowledgeHubInjectorHook(ctx: PluginInput, options?: KnowledgeHubInjectorOptions): {
16
+ "experimental.chat.messages.transform": (_input: Record<string, never>, output: {
17
+ messages: MessageWithParts[];
18
+ }) => Promise<void>;
19
+ event: ({ event }: {
20
+ event: {
21
+ type: string;
22
+ properties?: unknown;
23
+ };
24
+ }) => Promise<void>;
25
+ };
26
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export type { KnowledgeHubInjectorOptions } from "./hook";
2
+ export { createKnowledgeHubInjectorHook } from "./hook";
@@ -0,0 +1,16 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { LoadedHub } from "../../features/knowledge-hub/loader";
3
+ export interface KnowledgeHubSearchNudgeOptions {
4
+ hubs?: LoadedHub[];
5
+ getHubs?: () => LoadedHub[];
6
+ }
7
+ export declare function createKnowledgeHubSearchNudgeHook(ctx: PluginInput, options?: KnowledgeHubSearchNudgeOptions): {
8
+ "tool.execute.before": (input: {
9
+ tool: string;
10
+ sessionID: string;
11
+ callID: string;
12
+ }, output: {
13
+ args: Record<string, unknown>;
14
+ message?: string;
15
+ }) => Promise<void>;
16
+ };
@@ -0,0 +1,2 @@
1
+ export type { KnowledgeHubSearchNudgeOptions } from "./hook";
2
+ export { createKnowledgeHubSearchNudgeHook } from "./hook";
@@ -1,2 +1,6 @@
1
1
  export type { PlanPersister } from "./hook";
2
2
  export { createPlanPersister } from "./hook";
3
+ export type { LinkageDecision, LinkageOptions, LinkedTodos } from "./task-link";
4
+ export { collectLinkedTodos, isTaskLinkedToMission, isTerminalTaskStatus } from "./task-link";
5
+ export type { FilteredSyncInput, FilteredSyncResult, MatchedBox, SyncTriggerInput, SyncTriggerResult, } from "./task-sync";
6
+ export { applyFilteredSync, maybeSyncTaskToPlans } from "./task-sync";
@@ -0,0 +1,31 @@
1
+ import type { MatrixxConfig } from "../../config/schema";
2
+ import type { MissionState } from "../../features/mission-state/types";
3
+ import type { TaskObject } from "../../tools/task/types";
4
+ export declare function isTerminalTaskStatus(status: string): boolean;
5
+ export interface LinkageOptions {
6
+ directory: string;
7
+ sessionScoped: boolean;
8
+ resolveParent?: (parentID: string) => TaskObject | null;
9
+ }
10
+ export interface LinkageDecision {
11
+ linked: boolean;
12
+ reason: string;
13
+ }
14
+ export declare function isTaskLinkedToMission(task: TaskObject, mission: MissionState, opts: LinkageOptions, depth?: number, seen?: ReadonlySet<string>): LinkageDecision;
15
+ export interface LinkedTodos {
16
+ todos: Array<{
17
+ content: string;
18
+ status: string;
19
+ }>;
20
+ unknown: number;
21
+ skipped: Array<{
22
+ id: string;
23
+ reason: string;
24
+ }>;
25
+ }
26
+ /**
27
+ * Filtered replacement for the old unfiltered union read: strict-parse every
28
+ * task file (null = log + count as unknown, never a vote), drop stale files,
29
+ * and admit only mission-linked tasks.
30
+ */
31
+ export declare function collectLinkedTodos(directory: string, mission: MissionState, config?: Partial<MatrixxConfig>): LinkedTodos;
@@ -0,0 +1,39 @@
1
+ import type { MatrixxConfig } from "../../config/schema";
2
+ import type { MissionState } from "../../features/mission-state/types";
3
+ import type { TaskObject } from "../../tools/task/types";
4
+ import { collectLinkedTodos } from "./task-link";
5
+ export interface FilteredSyncInput {
6
+ directory: string;
7
+ mission: MissionState;
8
+ planPath: string;
9
+ todos: Array<{
10
+ content: string;
11
+ status: string;
12
+ }>;
13
+ actorSessionId: string;
14
+ matchSubject?: string;
15
+ }
16
+ export interface MatchedBox {
17
+ line: string;
18
+ shared: number;
19
+ score: number;
20
+ }
21
+ export interface FilteredSyncResult {
22
+ ok: boolean;
23
+ skippedReason?: string;
24
+ total: number;
25
+ completed: number;
26
+ flaggedVerification: string[];
27
+ matched?: MatchedBox;
28
+ }
29
+ export declare function applyFilteredSync(input: FilteredSyncInput): Promise<FilteredSyncResult>;
30
+ export interface SyncTriggerInput {
31
+ directory: string;
32
+ task: TaskObject;
33
+ config?: Partial<MatrixxConfig>;
34
+ }
35
+ export interface SyncTriggerResult extends FilteredSyncResult {
36
+ linked: boolean;
37
+ }
38
+ export declare function maybeSyncTaskToPlans(input: SyncTriggerInput): Promise<SyncTriggerResult>;
39
+ export { collectLinkedTodos };
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,2 @@
1
+ export * from "./plan-filter";
1
2
  export { createStartWorkHook, HOOK_NAME } from "./start-work-hook";