opencode-matrixx 2.6.3 → 2.6.4

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/dist/agents/dynamic-agent-prompt-builder.d.ts +5 -3
  2. package/dist/agents/mouse/agent.d.ts +1 -1
  3. package/dist/agents/oracle/behavioral-summary.d.ts +1 -1
  4. package/dist/agents/oracle/identity-constraints.d.ts +1 -1
  5. package/dist/agents/oracle/plan-generation.d.ts +1 -1
  6. package/dist/agents/oracle/plan-template.d.ts +1 -1
  7. package/dist/agents/oracle/system-prompt.d.ts +4 -3
  8. package/dist/agents/smith.d.ts +1 -1
  9. package/dist/agents/types.d.ts +1 -1
  10. package/dist/cli.js +115 -10
  11. package/dist/config/migrations/index.d.ts +1 -0
  12. package/dist/config/migrations/model-migration.d.ts +18 -0
  13. package/dist/config/resolve-tiers.d.ts +1 -1
  14. package/dist/config/schema/failure-counter.d.ts +7 -0
  15. package/dist/config/schema/hooks.d.ts +1 -0
  16. package/dist/config/schema/matrixx-config.d.ts +43 -0
  17. package/dist/config/schema/model-config.d.ts +81 -0
  18. package/dist/config/schema/morpheus.d.ts +4 -0
  19. package/dist/config/schema.d.ts +2 -0
  20. package/dist/create-hooks.d.ts +1 -0
  21. package/dist/features/background-agent/manager.d.ts +8 -0
  22. package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
  23. package/dist/features/mission-state/plan-storage.d.ts +1 -0
  24. package/dist/features/mission-state/plan-storage.test.d.ts +1 -0
  25. package/dist/features/session-state/state.d.ts +26 -0
  26. package/dist/features/session-state/state.test.d.ts +1 -0
  27. package/dist/features/task-storage/types.d.ts +1 -0
  28. package/dist/hooks/context-mode-enforcer/constants.d.ts +1 -1
  29. package/dist/hooks/failure-counter/counter.d.ts +7 -0
  30. package/dist/hooks/failure-counter/counter.test.d.ts +1 -0
  31. package/dist/hooks/failure-counter/hook.d.ts +18 -0
  32. package/dist/hooks/failure-counter/index.d.ts +3 -0
  33. package/dist/hooks/failure-counter/patterns.d.ts +6 -0
  34. package/dist/hooks/failure-counter/patterns.test.d.ts +1 -0
  35. package/dist/hooks/index.d.ts +1 -0
  36. package/dist/hooks/interactive-bash-session/hook.test.d.ts +1 -0
  37. package/dist/hooks/keyword-detector/analyze/default.d.ts +1 -1
  38. package/dist/hooks/keyword-detector/search/default.d.ts +1 -1
  39. package/dist/hooks/keyword-detector/ultrawork/deepseek.d.ts +1 -1
  40. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +1 -1
  41. package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +1 -1
  42. package/dist/hooks/keyword-detector/ultrawork/glm.d.ts +1 -1
  43. package/dist/hooks/keyword-detector/ultrawork/mimo.d.ts +1 -1
  44. package/dist/hooks/stop-continuation-guard/hook.d.ts +3 -2
  45. package/dist/hooks/stop-continuation-guard/repro.test.d.ts +1 -0
  46. package/dist/hooks/task-continuation-enforcer/awaiting-user.test.d.ts +1 -0
  47. package/dist/hooks/task-continuation-enforcer/continuation-injection.d.ts +2 -0
  48. package/dist/hooks/task-continuation-enforcer/countdown.d.ts +2 -0
  49. package/dist/hooks/task-continuation-enforcer/handler.d.ts +2 -0
  50. package/dist/hooks/task-continuation-enforcer/idle-event.d.ts +2 -0
  51. package/dist/hooks/task-continuation-enforcer/staleness.d.ts +16 -0
  52. package/dist/hooks/task-continuation-enforcer/staleness.test.d.ts +1 -0
  53. package/dist/hooks/task-continuation-enforcer/todo.d.ts +15 -0
  54. package/dist/hooks/task-continuation-enforcer/types.d.ts +6 -0
  55. package/dist/hooks/task-edit-guard/constants.d.ts +2 -0
  56. package/dist/hooks/todo-continuation-enforcer/awaiting-user.test.d.ts +1 -0
  57. package/dist/hooks/todo-continuation-enforcer/types.d.ts +3 -0
  58. package/dist/index.js +28049 -26859
  59. package/dist/matrixx.schema.json +228 -1
  60. package/dist/plugin/hooks/create-core-hooks.d.ts +1 -0
  61. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
  62. package/dist/plugin-handlers/oracle-agent-config-builder.d.ts +2 -1
  63. package/dist/shared/awaiting-user.d.ts +12 -0
  64. package/dist/shared/merge-categories.d.ts +12 -1
  65. package/dist/shared/model-requirements.d.ts +9 -0
  66. package/dist/shared/model-tiers.d.ts +28 -15
  67. package/dist/shared/tier-resolver.d.ts +9 -9
  68. package/dist/tools/delegate-task/categories.d.ts +12 -1
  69. package/dist/tools/delegate-task/complexity-constants.d.ts +15 -11
  70. package/dist/tools/delegate-task/executor-types.d.ts +4 -1
  71. package/dist/tools/delegate-task/index.d.ts +1 -1
  72. package/dist/tools/delegate-task/types.d.ts +4 -1
  73. package/dist/tools/index.d.ts +5 -0
  74. package/dist/tools/plan/constants.d.ts +10 -0
  75. package/dist/tools/plan/index.d.ts +6 -0
  76. package/dist/tools/plan/plan-create.d.ts +3 -0
  77. package/dist/tools/plan/plan-delete.d.ts +3 -0
  78. package/dist/tools/plan/plan-list.d.ts +3 -0
  79. package/dist/tools/plan/plan-read.d.ts +3 -0
  80. package/dist/tools/plan/plan-update.d.ts +3 -0
  81. package/dist/tools/plan/types.d.ts +28 -0
  82. package/dist/tools/task/constants.d.ts +5 -0
  83. package/dist/tools/task/types.d.ts +2 -0
  84. package/package.json +1 -1
@@ -167,7 +167,8 @@
167
167
  "evolution-compressor",
168
168
  "evolution-hitl",
169
169
  "context-mode-enforcer",
170
- "task-edit-guard"
170
+ "task-edit-guard",
171
+ "failure-counter"
171
172
  ]
172
173
  },
173
174
  {}
@@ -4722,6 +4723,31 @@
4722
4723
  ],
4723
4724
  "additionalProperties": false
4724
4725
  },
4726
+ "failure_counter": {
4727
+ "type": "object",
4728
+ "properties": {
4729
+ "enabled": {
4730
+ "default": true,
4731
+ "type": "boolean"
4732
+ },
4733
+ "threshold": {
4734
+ "default": 2,
4735
+ "type": "number",
4736
+ "minimum": 1,
4737
+ "maximum": 10
4738
+ },
4739
+ "resetOnSuccess": {
4740
+ "default": true,
4741
+ "type": "boolean"
4742
+ }
4743
+ },
4744
+ "required": [
4745
+ "enabled",
4746
+ "threshold",
4747
+ "resetOnSuccess"
4748
+ ],
4749
+ "additionalProperties": false
4750
+ },
4725
4751
  "background_task": {
4726
4752
  "type": "object",
4727
4753
  "properties": {
@@ -4915,6 +4941,17 @@
4915
4941
  "global",
4916
4942
  "project"
4917
4943
  ]
4944
+ },
4945
+ "stale_after_hours": {
4946
+ "description": "Pending tasks with no file activity for this many hours are considered stale (default: 24). Stale tasks are excluded from task-continuation directives.",
4947
+ "type": "integer",
4948
+ "minimum": 1,
4949
+ "maximum": 9007199254740991
4950
+ },
4951
+ "session_scoped": {
4952
+ "description": "When true, the task-continuation-enforcer only considers tasks created by the current session (or its subagent sessions). When false, all project tasks are considered regardless of session origin.",
4953
+ "default": true,
4954
+ "type": "boolean"
4918
4955
  }
4919
4956
  },
4920
4957
  "additionalProperties": false
@@ -5523,6 +5560,196 @@
5523
5560
  "items": {
5524
5561
  "type": "string"
5525
5562
  }
5563
+ },
5564
+ "tiers": {
5565
+ "type": "object",
5566
+ "propertyNames": {
5567
+ "type": "string"
5568
+ },
5569
+ "additionalProperties": {
5570
+ "type": "object",
5571
+ "properties": {
5572
+ "providerPriority": {
5573
+ "type": "array",
5574
+ "items": {
5575
+ "type": "string"
5576
+ }
5577
+ },
5578
+ "modelPattern": {
5579
+ "type": "string"
5580
+ },
5581
+ "fallbackTier": {
5582
+ "type": "string"
5583
+ },
5584
+ "fallback": {
5585
+ "type": "array",
5586
+ "items": {
5587
+ "type": "object",
5588
+ "properties": {
5589
+ "providers": {
5590
+ "type": "array",
5591
+ "items": {
5592
+ "type": "string",
5593
+ "minLength": 1
5594
+ }
5595
+ },
5596
+ "model": {
5597
+ "type": "string",
5598
+ "minLength": 1
5599
+ },
5600
+ "variant": {
5601
+ "type": "string"
5602
+ }
5603
+ },
5604
+ "required": [
5605
+ "providers",
5606
+ "model"
5607
+ ],
5608
+ "additionalProperties": false
5609
+ }
5610
+ }
5611
+ },
5612
+ "required": [
5613
+ "providerPriority",
5614
+ "modelPattern"
5615
+ ],
5616
+ "additionalProperties": false
5617
+ }
5618
+ },
5619
+ "modelRequirements": {
5620
+ "type": "object",
5621
+ "properties": {
5622
+ "agents": {
5623
+ "type": "object",
5624
+ "propertyNames": {
5625
+ "type": "string"
5626
+ },
5627
+ "additionalProperties": {
5628
+ "type": "object",
5629
+ "properties": {
5630
+ "fallbackChain": {
5631
+ "type": "array",
5632
+ "items": {
5633
+ "type": "object",
5634
+ "properties": {
5635
+ "providers": {
5636
+ "type": "array",
5637
+ "items": {
5638
+ "type": "string",
5639
+ "minLength": 1
5640
+ }
5641
+ },
5642
+ "model": {
5643
+ "type": "string",
5644
+ "minLength": 1
5645
+ },
5646
+ "variant": {
5647
+ "type": "string"
5648
+ }
5649
+ },
5650
+ "required": [
5651
+ "providers",
5652
+ "model"
5653
+ ],
5654
+ "additionalProperties": false
5655
+ }
5656
+ },
5657
+ "requiresModel": {
5658
+ "type": "string"
5659
+ },
5660
+ "requiresAnyModel": {
5661
+ "type": "boolean"
5662
+ },
5663
+ "requiresProvider": {
5664
+ "type": "array",
5665
+ "items": {
5666
+ "type": "string"
5667
+ }
5668
+ },
5669
+ "variant": {
5670
+ "type": "string"
5671
+ }
5672
+ },
5673
+ "required": [
5674
+ "fallbackChain"
5675
+ ],
5676
+ "additionalProperties": false
5677
+ }
5678
+ },
5679
+ "categories": {
5680
+ "type": "object",
5681
+ "propertyNames": {
5682
+ "type": "string"
5683
+ },
5684
+ "additionalProperties": {
5685
+ "type": "object",
5686
+ "properties": {
5687
+ "fallbackChain": {
5688
+ "type": "array",
5689
+ "items": {
5690
+ "type": "object",
5691
+ "properties": {
5692
+ "providers": {
5693
+ "type": "array",
5694
+ "items": {
5695
+ "type": "string",
5696
+ "minLength": 1
5697
+ }
5698
+ },
5699
+ "model": {
5700
+ "type": "string",
5701
+ "minLength": 1
5702
+ },
5703
+ "variant": {
5704
+ "type": "string"
5705
+ }
5706
+ },
5707
+ "required": [
5708
+ "providers",
5709
+ "model"
5710
+ ],
5711
+ "additionalProperties": false
5712
+ }
5713
+ },
5714
+ "requiresModel": {
5715
+ "type": "string"
5716
+ },
5717
+ "requiresAnyModel": {
5718
+ "type": "boolean"
5719
+ },
5720
+ "requiresProvider": {
5721
+ "type": "array",
5722
+ "items": {
5723
+ "type": "string"
5724
+ }
5725
+ },
5726
+ "variant": {
5727
+ "type": "string"
5728
+ }
5729
+ },
5730
+ "required": [
5731
+ "fallbackChain"
5732
+ ],
5733
+ "additionalProperties": false
5734
+ }
5735
+ }
5736
+ },
5737
+ "additionalProperties": false
5738
+ },
5739
+ "complexityDowngrades": {
5740
+ "type": "object",
5741
+ "propertyNames": {
5742
+ "type": "string"
5743
+ },
5744
+ "additionalProperties": {
5745
+ "type": "object",
5746
+ "propertyNames": {
5747
+ "type": "string"
5748
+ },
5749
+ "additionalProperties": {
5750
+ "type": "string"
5751
+ }
5752
+ }
5526
5753
  }
5527
5754
  },
5528
5755
  "additionalProperties": false
@@ -46,6 +46,7 @@ export declare function createCoreHooks(args: {
46
46
  matrixLoop: ReturnType<typeof import("../../hooks").createMatrixLoopHook> | null;
47
47
  editErrorRecovery: ReturnType<typeof import("../../hooks").createEditErrorRecoveryHook> | null;
48
48
  delegateTaskRetry: ReturnType<typeof import("../../hooks").createDelegateTaskRetryHook> | null;
49
+ failureCounter: ReturnType<typeof import("../../hooks").createFailureCounterHook> | null;
49
50
  startWork: ReturnType<typeof import("../../hooks").createStartWorkHook> | null;
50
51
  oracleMdOnly: ReturnType<typeof import("../../hooks").createOracleMdOnlyHook> | null;
51
52
  mouseNotepad: ReturnType<typeof import("../../hooks").createMouseNotepadHook> | null;
@@ -1,5 +1,5 @@
1
1
  import type { HookName, MatrixxConfig } from "../../config";
2
- import { createAgentUsageReminderHook, createAutoUpdateCheckerHook, createContextWindowLimitRecoveryHook, createContextWindowMonitorHook, createDelegateTaskRetryHook, createEditErrorRecoveryHook, createInteractiveBashSessionHook, createMatrixLoopHook, createMouseNotepadHook, createNonInteractiveEnvHook, createOracleMdOnlyHook, createPreemptiveCompactionHook, createRtkBashRewriterHook, createRuntimeFallbackHook, createSessionNotification, createSessionRecoveryHook, createStartWorkHook, createTaskResumeInfoHook, createThinkModeHook } from "../../hooks";
2
+ import { createAgentUsageReminderHook, createAutoUpdateCheckerHook, createContextWindowLimitRecoveryHook, createContextWindowMonitorHook, createDelegateTaskRetryHook, createEditErrorRecoveryHook, createFailureCounterHook, createInteractiveBashSessionHook, createMatrixLoopHook, createMouseNotepadHook, createNonInteractiveEnvHook, createOracleMdOnlyHook, createPreemptiveCompactionHook, createRtkBashRewriterHook, createRuntimeFallbackHook, createSessionNotification, createSessionRecoveryHook, createStartWorkHook, createTaskResumeInfoHook, createThinkModeHook } from "../../hooks";
3
3
  import { createAnthropicEffortHook } from "../../hooks/anthropic-effort";
4
4
  import type { PluginContext } from "../types";
5
5
  export type SessionHooks = {
@@ -16,6 +16,7 @@ export type SessionHooks = {
16
16
  matrixLoop: ReturnType<typeof createMatrixLoopHook> | null;
17
17
  editErrorRecovery: ReturnType<typeof createEditErrorRecoveryHook> | null;
18
18
  delegateTaskRetry: ReturnType<typeof createDelegateTaskRetryHook> | null;
19
+ failureCounter: ReturnType<typeof createFailureCounterHook> | null;
19
20
  startWork: ReturnType<typeof createStartWorkHook> | null;
20
21
  oracleMdOnly: ReturnType<typeof createOracleMdOnlyHook> | null;
21
22
  mouseNotepad: ReturnType<typeof createMouseNotepadHook> | null;
@@ -1,4 +1,4 @@
1
- import type { CategoryConfig } from "../config/schema";
1
+ import type { CategoryConfig, ModelRequirements } from "../config/schema";
2
2
  type OracleOverride = Record<string, unknown> & {
3
3
  category?: string;
4
4
  model?: string;
@@ -20,5 +20,6 @@ export declare function buildOracleAgentConfig(params: {
20
20
  userCategories: Record<string, CategoryConfig> | undefined;
21
21
  currentModel: string | undefined;
22
22
  globalOverrideModel?: string;
23
+ modelRequirements?: ModelRequirements;
23
24
  }): Promise<Record<string, unknown>>;
24
25
  export {};
@@ -0,0 +1,12 @@
1
+ export declare const AWAITING_USER_SUPPRESS_MS: number;
2
+ export interface AwaitingUserState {
3
+ awaitingUser?: boolean;
4
+ awaitingUserSince?: number;
5
+ }
6
+ export declare function isAwaitingUserState(state: unknown): boolean;
7
+ export declare function markAwaitingUser(state: unknown, now?: number): void;
8
+ export declare function clearAwaitingUser(state: unknown): void;
9
+ export declare function hasPendingQuestionMessage(messages: Array<unknown>): boolean;
10
+ export declare function isAwaitingUser(state: unknown, messages?: Array<unknown>): boolean;
11
+ export declare function getToolName(properties: Record<string, unknown> | undefined): string | undefined;
12
+ export declare function isQuestionTool(properties: Record<string, unknown> | undefined): boolean;
@@ -7,4 +7,15 @@ import type { CategoriesConfig, CategoryConfig } from "../config/schema";
7
7
  * returning, the tier fields are resolved against the live provider cache
8
8
  * (or the static fallback) so callers always see concrete `model:` strings.
9
9
  */
10
- export declare function mergeCategories(userCategories?: CategoriesConfig): Record<string, CategoryConfig>;
10
+ export declare function mergeCategories(userCategories?: CategoriesConfig, config?: {
11
+ tiers?: Record<string, {
12
+ providerPriority: string[];
13
+ modelPattern: string;
14
+ fallbackTier?: string;
15
+ fallback?: {
16
+ providers: string[];
17
+ model: string;
18
+ variant?: string;
19
+ }[];
20
+ }>;
21
+ } | null): Record<string, CategoryConfig>;
@@ -1,3 +1,4 @@
1
+ import { type ModelRequirements } from "../config/schema/model-config";
1
2
  export type FallbackEntry = {
2
3
  providers: string[];
3
4
  model: string;
@@ -10,5 +11,13 @@ export type ModelRequirement = {
10
11
  requiresAnyModel?: boolean;
11
12
  requiresProvider?: string[];
12
13
  };
14
+ export declare const DEFAULT_AGENT_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
15
+ export declare const DEFAULT_CATEGORY_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
13
16
  export declare const AGENT_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
14
17
  export declare const CATEGORY_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
18
+ export declare function getAgentModelRequirements(config?: {
19
+ modelRequirements?: ModelRequirements;
20
+ } | null): Record<string, ModelRequirement>;
21
+ export declare function getCategoryModelRequirements(config?: {
22
+ modelRequirements?: ModelRequirements;
23
+ } | null): Record<string, ModelRequirement>;
@@ -2,30 +2,43 @@
2
2
  * Tier registry — abstract model classifications resolved against the live provider list.
3
3
  *
4
4
  * Tiers are matched by regex against "provider/model" strings, with a `providerPriority`
5
- * list to choose between providers when multiple match. A `staticFallback` is used at
6
- * first run when the live provider list is not yet available.
7
- *
8
- * Adding a new model does NOT require code changes — the regex patterns intentionally
9
- * match model families (e.g. `claude-opus`) so a new opus-4-7 model is picked up
10
- * automatically.
5
+ * list to choose between providers when multiple match. Patterns are stored as
6
+ * strings in `config.tiers[].modelPattern` and compiled at runtime via
7
+ * `new RegExp` with try/catch (invalid -> never matches). No hardcoded
8
+ * `provider` or model literals — all specs are config-driven via
9
+ * `MatrixxConfig.tiers`. When config is empty, factories return empty/undefined
10
+ * gracefully.
11
11
  */
12
- export type TierName = "free" | "fast" | "standard" | "premium" | "frontier";
12
+ export type TierName = string;
13
13
  export interface TierSpec {
14
- name: TierName;
14
+ name: string;
15
15
  /** Provider priority — first provider with a matching model wins. */
16
16
  providerPriority: string[];
17
17
  /** Regex tested against each "provider/model" string in the live provider list. */
18
18
  modelPattern: RegExp;
19
19
  /** Tier to recurse into if this tier cannot be satisfied. */
20
- fallbackTier?: TierName;
21
- /** Static fallbacks used at first run when the live provider list is empty
22
- * but the connected providers cache already lists which providers are reachable. */
23
- staticFallback: {
20
+ fallbackTier?: string;
21
+ /** Fallbacks used when the live provider list is empty but config provides them. */
22
+ fallback?: {
24
23
  providers: string[];
25
24
  model: string;
26
25
  variant?: string;
27
26
  }[];
28
27
  }
29
- export declare const TIER_SPECS: Record<TierName, TierSpec>;
30
- export declare const TIER_NAMES: TierName[];
31
- export declare function parseTierReference(value: string | undefined | null): TierName | null;
28
+ export type TiersConfig = Record<string, {
29
+ providerPriority: string[];
30
+ modelPattern: string;
31
+ fallbackTier?: string;
32
+ fallback?: {
33
+ providers: string[];
34
+ model: string;
35
+ variant?: string;
36
+ }[];
37
+ }>;
38
+ export type TierConfigHolder = {
39
+ tiers?: TiersConfig;
40
+ } | null | undefined;
41
+ export declare function buildTierSpecs(config: TierConfigHolder): Record<string, TierSpec>;
42
+ export declare function getTierSpec(tierName: string, config: TierConfigHolder): TierSpec | undefined;
43
+ export declare function getTierNames(config: TierConfigHolder): string[];
44
+ export declare function parseTierReference(value: string | undefined | null, config?: TierConfigHolder): string | null;
@@ -1,4 +1,4 @@
1
- import { parseTierReference, type TierName } from "./model-tiers";
1
+ import { type TierConfigHolder } from "./model-tiers";
2
2
  export interface TierResolverContext {
3
3
  availableModels: Set<string>;
4
4
  connectedProviders: string[] | null;
@@ -7,20 +7,20 @@ export type TierProvenance = "tier-resolved" | "tier-static-fallback";
7
7
  export interface TierResolutionResult {
8
8
  model: string;
9
9
  provenance: TierProvenance;
10
- tier: TierName;
10
+ tier: string;
11
11
  }
12
12
  /**
13
13
  * Resolve a tier alias to a concrete "provider/model" string.
14
14
  *
15
15
  * Strategy:
16
16
  * 1. Live resolution: walk `providerPriority`, test `modelPattern` against
17
- * each `provider/model` in the available set.
18
- * 2. Static fallback: pick the first static fallback whose provider is
19
- * connected (used at first run when the live cache is cold).
17
+ * each `provider/model` in the available set (config-driven, compiled at runtime).
18
+ * 2. Config fallback: pick the first `fallback` whose provider is
19
+ * connected (used at first run when the live cache is cold, user-provided).
20
20
  * 3. Recurse into `fallbackTier` if defined.
21
21
  *
22
- * Returns null when no match is possible (no live models, no static fallback
23
- * available, no fallback tier).
22
+ * Returns null when no match is possible (no live models, no fallback
23
+ * available, no fallback tier). When config is empty, returns null gracefully.
24
24
  */
25
- export declare function resolveTier(tier: TierName, ctx: TierResolverContext): TierResolutionResult | null;
26
- export { parseTierReference };
25
+ export declare function resolveTier(tier: string, ctx: TierResolverContext, config?: TierConfigHolder): TierResolutionResult | null;
26
+ export declare function parseTierReference(value: string | undefined | null, config?: TierConfigHolder): string | null;
@@ -1,4 +1,4 @@
1
- import type { CategoriesConfig, CategoryConfig } from "../../config/schema";
1
+ import type { CategoriesConfig, CategoryConfig, ModelRequirements } from "../../config/schema";
2
2
  import type { TierResolverContext } from "../../shared/tier-resolver";
3
3
  interface ResolveCategoryConfigOptions {
4
4
  userCategories?: CategoriesConfig;
@@ -6,6 +6,17 @@ interface ResolveCategoryConfigOptions {
6
6
  systemDefaultModel?: string;
7
7
  availableModels?: Set<string>;
8
8
  tierContext?: TierResolverContext;
9
+ modelRequirements?: ModelRequirements;
10
+ tiers?: Record<string, {
11
+ providerPriority: string[];
12
+ modelPattern: string;
13
+ fallbackTier?: string;
14
+ fallback?: {
15
+ providers: string[];
16
+ model: string;
17
+ variant?: string;
18
+ }[];
19
+ }>;
9
20
  }
10
21
  interface ResolveCategoryConfigResult {
11
22
  config: CategoryConfig;
@@ -1,24 +1,28 @@
1
+ import type { Tiers } from "../../config/schema";
2
+ import { type TierResolverContext } from "../../shared/tier-resolver";
1
3
  import type { ComplexityLevel } from "./complexity-types";
2
- /**
3
- * Built-in complexity-to-model downgrade targets per category.
4
- * Key: category name, Value: map of complexity level → model string.
5
- * Only levels 1-2 are downgradable; levels 3+ use the category's resolved model.
6
- */
7
- export declare const BUILTIN_COMPLEXITY_DOWNGRADES: Record<string, Partial<Record<ComplexityLevel, string>>>;
4
+ export type ComplexityDowngradesConfig = Record<string, Record<string, string>>;
5
+ export type ComplexityConfigHolder = {
6
+ complexityDowngrades?: ComplexityDowngradesConfig;
7
+ tiers?: Tiers;
8
+ };
8
9
  /**
9
10
  * Resolve the model for a given category and complexity level.
10
11
  *
11
- * Returns the original model unchanged if:
12
- * - Complexity is 3+ (not eligible for downgrade)
13
- * - No downgrade target exists for this category/level combination
12
+ * Config-driven: no built-in literals. Downgrade map is resolved as:
13
+ * userDowngrades ?? config.complexityDowngrades?.[category] ?? {}
14
+ * If no entry for this complexity, returns original (no downgrade).
15
+ * If value starts with "tier:", resolves via live tier resolver.
14
16
  *
15
17
  * @param category - The task category name
16
18
  * @param complexity - The complexity level (1-5)
17
19
  * @param originalModel - The currently resolved model string
18
- * @param userDowngrades - Optional per-category user override from CategoryConfig
20
+ * @param userDowngrades - Optional per-category user override from CategoryConfig.complexity_downgrades
21
+ * @param config - Optional holder with global complexityDowngrades and tiers
22
+ * @param tierContext - Optional live provider context for tier: resolution
19
23
  * @returns The model to use and whether a downgrade was applied
20
24
  */
21
- export declare function resolveComplexityModel(category: string, complexity: ComplexityLevel, originalModel: string, userDowngrades?: Record<string, string>): {
25
+ export declare function resolveComplexityModel(category: string, complexity: ComplexityLevel, originalModel: string, userDowngrades?: Record<string, string>, config?: ComplexityConfigHolder | ComplexityDowngradesConfig, tierContext?: TierResolverContext): {
22
26
  model: string;
23
27
  downgraded: boolean;
24
28
  };
@@ -1,4 +1,4 @@
1
- import type { AgentOverrides, BrowserAutomationProvider, CategoriesConfig } from "../../config/schema";
1
+ import type { AgentOverrides, BrowserAutomationProvider, CategoriesConfig, ComplexityDowngrades, ModelRequirements, Tiers } from "../../config/schema";
2
2
  import type { BackgroundManager } from "../../features/background-agent";
3
3
  import type { OpencodeClient } from "./types";
4
4
  export interface ExecutorContext {
@@ -10,6 +10,9 @@ export interface ExecutorContext {
10
10
  globalModel?: string;
11
11
  browserProvider?: BrowserAutomationProvider;
12
12
  agentOverrides?: AgentOverrides;
13
+ modelRequirements?: ModelRequirements;
14
+ complexityDowngrades?: ComplexityDowngrades;
15
+ tiers?: Tiers;
13
16
  onSyncSessionCreated?: (event: {
14
17
  sessionID: string;
15
18
  parentID: string;
@@ -1,4 +1,4 @@
1
- export { BUILTIN_COMPLEXITY_DOWNGRADES, resolveComplexityModel } from "./complexity-constants";
1
+ export { resolveComplexityModel } from "./complexity-constants";
2
2
  export { autoScoreComplexity } from "./complexity-scorer";
3
3
  export type { ComplexityInput, ComplexityLevel } from "./complexity-types";
4
4
  export * from "./constants";
@@ -1,6 +1,6 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
2
  import type { AvailableCategory, AvailableSkill } from "../../agents/dynamic-agent-prompt-builder";
3
- import type { AgentOverrides, BrowserAutomationProvider, CategoriesConfig } from "../../config/schema";
3
+ import type { AgentOverrides, BrowserAutomationProvider, CategoriesConfig, ComplexityDowngrades, ModelRequirements, Tiers } from "../../config/schema";
4
4
  import type { BackgroundManager } from "../../features/background-agent";
5
5
  export type OpencodeClient = PluginInput["client"];
6
6
  export interface DelegateTaskArgs {
@@ -69,6 +69,9 @@ export interface DelegateTaskToolOptions {
69
69
  availableCategories?: AvailableCategory[];
70
70
  availableSkills?: AvailableSkill[];
71
71
  agentOverrides?: AgentOverrides;
72
+ modelRequirements?: ModelRequirements;
73
+ complexityDowngrades?: ComplexityDowngrades;
74
+ tiers?: Tiers;
72
75
  onSyncSessionCreated?: (event: SyncSessionCreatedEvent) => Promise<void>;
73
76
  }
74
77
  export interface BuildSystemContentInput {
@@ -9,6 +9,11 @@ export { createGrepTools } from "./grep";
9
9
  export { createHandoffTools } from "./handoff";
10
10
  export { interactive_bash, startBackgroundCheck as startTmuxCheck } from "./interactive-bash";
11
11
  export { createPdfExtractFiguresTool } from "./pdf-extract-figures";
12
+ export { createPlanCreateTool } from "./plan/plan-create";
13
+ export { createPlanDeleteTool } from "./plan/plan-delete";
14
+ export { createPlanListTool } from "./plan/plan-list";
15
+ export { createPlanReadTool } from "./plan/plan-read";
16
+ export { createPlanUpdateTool } from "./plan/plan-update";
12
17
  export { createSessionManagerTools } from "./session-manager";
13
18
  export { sessionExists } from "./session-manager/storage";
14
19
  export { createSkillTool } from "./skill";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Plan Tool Constants
3
+ * Reuses mission-state storage caps with strict scoping for .matrixx/plans/*.md
4
+ */
5
+ export declare const PLANS_DIR = ".matrixx/plans";
6
+ export declare const MAX_PLAN_FILE_BYTES = 102400;
7
+ export declare const PLAN_FILENAME_KEBAB_REGEX: RegExp;
8
+ export declare const PLAN_BASENAME_KEBAB_REGEX: RegExp;
9
+ export declare const META_TAG_PREFIX = "<!-- plan-persister:";
10
+ export declare const META_TAG_SUFFIX = "-->";
@@ -0,0 +1,6 @@
1
+ export { MAX_PLAN_FILE_BYTES, PLAN_FILENAME_KEBAB_REGEX, PLANS_DIR } from "./constants";
2
+ export { createPlanCreateTool } from "./plan-create";
3
+ export { createPlanDeleteTool } from "./plan-delete";
4
+ export { createPlanListTool } from "./plan-list";
5
+ export { createPlanReadTool } from "./plan-read";
6
+ export { createPlanUpdateTool } from "./plan-update";
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin/tool";
2
+ import type { PluginContext } from "../../plugin/types";
3
+ export declare function createPlanCreateTool(ctx?: PluginContext): ToolDefinition;
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin/tool";
2
+ import type { PluginContext } from "../../plugin/types";
3
+ export declare function createPlanDeleteTool(ctx?: PluginContext): ToolDefinition;
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin/tool";
2
+ import type { PluginContext } from "../../plugin/types";
3
+ export declare function createPlanListTool(ctx?: PluginContext): ToolDefinition;
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin/tool";
2
+ import type { PluginContext } from "../../plugin/types";
3
+ export declare function createPlanReadTool(ctx?: PluginContext): ToolDefinition;
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin/tool";
2
+ import type { PluginContext } from "../../plugin/types";
3
+ export declare function createPlanUpdateTool(ctx?: PluginContext): ToolDefinition;
@@ -0,0 +1,28 @@
1
+ import type { RawHashlineEdit } from "../hashline-edit/normalize-edits";
2
+ export declare function resolveDirectory(contextDirectory: unknown, ctxDirectory: unknown): string;
3
+ export declare function validatePlanFilePath(filePath: string, directory: string): {
4
+ resolved: string;
5
+ } | {
6
+ error: string;
7
+ };
8
+ export interface PlanCreateArgs {
9
+ filePath: string;
10
+ content: string;
11
+ }
12
+ export interface PlanReadArgs {
13
+ filePath: string;
14
+ }
15
+ export interface PlanUpdateArgs {
16
+ filePath: string;
17
+ edits: RawHashlineEdit[];
18
+ }
19
+ export interface PlanDeleteArgs {
20
+ filePath: string;
21
+ }
22
+ export interface PlanInfo {
23
+ fileName: string;
24
+ filePath: string;
25
+ mtime: string;
26
+ mtimeMs: number;
27
+ size: number;
28
+ }
@@ -1 +1,6 @@
1
+ /**
2
+ * Task ID format: `T-` followed by dash-separated alphanumeric segments.
3
+ * Rejects truncated/empty IDs ("T-"), trailing dashes ("T-abc-"), and
4
+ * double dashes ("T-a--b"). Matches generateTaskId() output (T-{uuid}).
5
+ */
1
6
  export declare const TASK_ID_PATTERN: RegExp;
@@ -6,6 +6,8 @@ export declare const TaskStatusSchema: z.ZodEnum<{
6
6
  in_progress: "in_progress";
7
7
  }>;
8
8
  export type TaskStatus = z.infer<typeof TaskStatusSchema>;
9
+ /** Task ID must match T-{uuid}-style format (rejects truncated IDs like "T-"). */
10
+ export declare const TaskIdSchema: z.ZodString;
9
11
  export declare const TaskObjectSchema: z.ZodObject<{
10
12
  id: z.ZodString;
11
13
  subject: z.ZodString;