opencode-matrixx 2.6.2 → 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 (151) hide show
  1. package/README.md +0 -2
  2. package/dist/agents/dynamic-agent-prompt-builder.d.ts +5 -3
  3. package/dist/agents/mouse/agent.d.ts +1 -1
  4. package/dist/agents/oracle/behavioral-summary.d.ts +1 -1
  5. package/dist/agents/oracle/identity-constraints.d.ts +1 -1
  6. package/dist/agents/oracle/plan-generation.d.ts +1 -1
  7. package/dist/agents/oracle/plan-template.d.ts +1 -1
  8. package/dist/agents/oracle/system-prompt.d.ts +4 -3
  9. package/dist/agents/smith.d.ts +1 -1
  10. package/dist/agents/types.d.ts +1 -1
  11. package/dist/cli.js +138 -20
  12. package/dist/config/migrations/index.d.ts +1 -0
  13. package/dist/config/migrations/model-migration.d.ts +18 -0
  14. package/dist/config/resolve-tiers.d.ts +1 -1
  15. package/dist/config/schema/experimental.d.ts +2 -0
  16. package/dist/config/schema/failure-counter.d.ts +7 -0
  17. package/dist/config/schema/headroom.d.ts +1 -1
  18. package/dist/config/schema/hooks.d.ts +5 -8
  19. package/dist/config/schema/matrixx-config.d.ts +70 -9
  20. package/dist/config/schema/model-config.d.ts +81 -0
  21. package/dist/config/schema/morpheus.d.ts +4 -2
  22. package/dist/config/schema/security.d.ts +49 -0
  23. package/dist/config/schema.d.ts +2 -0
  24. package/dist/create-hooks.d.ts +3 -4
  25. package/dist/features/background-agent/manager.d.ts +8 -0
  26. package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
  27. package/dist/features/mission-state/plan-storage.d.ts +1 -0
  28. package/dist/features/mission-state/plan-storage.test.d.ts +1 -0
  29. package/dist/features/session-state/state.d.ts +26 -0
  30. package/dist/features/session-state/state.test.d.ts +1 -0
  31. package/dist/features/task-storage/types.d.ts +1 -0
  32. package/dist/hooks/context-mode-enforcer/constants.d.ts +1 -1
  33. package/dist/hooks/context-window-limit-recovery/index.d.ts +8 -0
  34. package/dist/hooks/context-window-limit-recovery/parser-patterns.d.ts +11 -0
  35. package/dist/hooks/context-window-limit-recovery/parser.d.ts +15 -0
  36. package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/recovery-hook.d.ts +2 -0
  37. package/dist/hooks/context-window-limit-recovery/storage.d.ts +3 -0
  38. package/dist/hooks/{anthropic-context-window-limit-recovery/tool-result-storage-sdk.d.ts → context-window-limit-recovery/tool-result-store.d.ts} +10 -0
  39. package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/types.d.ts +1 -1
  40. package/dist/hooks/context-window-monitor.d.ts +5 -1
  41. package/dist/hooks/failure-counter/counter.d.ts +7 -0
  42. package/dist/hooks/failure-counter/counter.test.d.ts +1 -0
  43. package/dist/hooks/failure-counter/hook.d.ts +18 -0
  44. package/dist/hooks/failure-counter/index.d.ts +3 -0
  45. package/dist/hooks/failure-counter/patterns.d.ts +6 -0
  46. package/dist/hooks/failure-counter/patterns.test.d.ts +1 -0
  47. package/dist/hooks/index.d.ts +3 -4
  48. package/dist/hooks/input-secret-guard/detection-rules.d.ts +10 -0
  49. package/dist/hooks/input-secret-guard/detector.d.ts +22 -0
  50. package/dist/hooks/input-secret-guard/detector.test.d.ts +1 -0
  51. package/dist/hooks/input-secret-guard/hook.d.ts +19 -0
  52. package/dist/hooks/input-secret-guard/hook.test.d.ts +1 -0
  53. package/dist/hooks/input-secret-guard/index.d.ts +1 -0
  54. package/dist/hooks/input-secret-guard/redactor.d.ts +2 -0
  55. package/dist/hooks/input-secret-guard/redactor.test.d.ts +1 -0
  56. package/dist/hooks/input-secret-guard/session-allow-cache.d.ts +6 -0
  57. package/dist/hooks/input-secret-guard/session-allow-cache.test.d.ts +1 -0
  58. package/dist/hooks/interactive-bash-session/hook.test.d.ts +1 -0
  59. package/dist/hooks/keyword-detector/analyze/default.d.ts +1 -1
  60. package/dist/hooks/keyword-detector/search/default.d.ts +1 -1
  61. package/dist/hooks/keyword-detector/ultrawork/deepseek.d.ts +1 -1
  62. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +2 -9
  63. package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +1 -1
  64. package/dist/hooks/keyword-detector/ultrawork/glm.d.ts +1 -1
  65. package/dist/hooks/keyword-detector/ultrawork/mimo.d.ts +1 -1
  66. package/dist/hooks/preemptive-compaction-trigger.d.ts +1 -1
  67. package/dist/hooks/rules-injector/constants.d.ts +0 -1
  68. package/dist/hooks/rules-injector/parser.d.ts +0 -1
  69. package/dist/hooks/rules-injector/rule-file-finder.d.ts +2 -4
  70. package/dist/hooks/rules-injector/types.d.ts +2 -3
  71. package/dist/hooks/stop-continuation-guard/hook.d.ts +3 -2
  72. package/dist/hooks/stop-continuation-guard/repro.test.d.ts +1 -0
  73. package/dist/hooks/task-continuation-enforcer/awaiting-user.test.d.ts +1 -0
  74. package/dist/hooks/task-continuation-enforcer/constants.d.ts +1 -0
  75. package/dist/hooks/task-continuation-enforcer/continuation-injection.d.ts +2 -0
  76. package/dist/hooks/task-continuation-enforcer/countdown.d.ts +2 -0
  77. package/dist/hooks/task-continuation-enforcer/handler.d.ts +2 -0
  78. package/dist/hooks/task-continuation-enforcer/idle-event.d.ts +2 -0
  79. package/dist/hooks/task-continuation-enforcer/staleness.d.ts +16 -0
  80. package/dist/hooks/task-continuation-enforcer/staleness.test.d.ts +1 -0
  81. package/dist/hooks/task-continuation-enforcer/todo.d.ts +15 -0
  82. package/dist/hooks/task-continuation-enforcer/types.d.ts +6 -0
  83. package/dist/hooks/task-continuation-enforcer/ulw-bootstrap.test.d.ts +1 -0
  84. package/dist/hooks/task-edit-guard/constants.d.ts +2 -0
  85. package/dist/hooks/todo-continuation-enforcer/awaiting-user.test.d.ts +1 -0
  86. package/dist/hooks/todo-continuation-enforcer/types.d.ts +3 -0
  87. package/dist/index.js +36175 -35248
  88. package/dist/matrixx.schema.json +373 -73
  89. package/dist/plugin/hooks/create-core-hooks.d.ts +3 -4
  90. package/dist/plugin/hooks/create-session-hooks.d.ts +3 -4
  91. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +1 -2
  92. package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -0
  93. package/dist/plugin-handlers/oracle-agent-config-builder.d.ts +2 -1
  94. package/dist/shared/awaiting-user.d.ts +12 -0
  95. package/dist/shared/context-limit-resolver.d.ts +1 -0
  96. package/dist/shared/context-limits.d.ts +36 -0
  97. package/dist/shared/index.d.ts +0 -1
  98. package/dist/shared/merge-categories.d.ts +12 -1
  99. package/dist/shared/migration/hook-names.d.ts +1 -0
  100. package/dist/shared/model-requirements.d.ts +9 -0
  101. package/dist/shared/model-sanitizer.d.ts +1 -1
  102. package/dist/shared/model-tiers.d.ts +28 -15
  103. package/dist/shared/tier-resolver.d.ts +9 -9
  104. package/dist/tools/delegate-task/categories.d.ts +12 -1
  105. package/dist/tools/delegate-task/complexity-constants.d.ts +15 -11
  106. package/dist/tools/delegate-task/executor-types.d.ts +4 -1
  107. package/dist/tools/delegate-task/index.d.ts +1 -1
  108. package/dist/tools/delegate-task/types.d.ts +4 -1
  109. package/dist/tools/index.d.ts +5 -0
  110. package/dist/tools/plan/constants.d.ts +10 -0
  111. package/dist/tools/plan/index.d.ts +6 -0
  112. package/dist/tools/plan/plan-create.d.ts +3 -0
  113. package/dist/tools/plan/plan-delete.d.ts +3 -0
  114. package/dist/tools/plan/plan-list.d.ts +3 -0
  115. package/dist/tools/plan/plan-read.d.ts +3 -0
  116. package/dist/tools/plan/plan-update.d.ts +3 -0
  117. package/dist/tools/plan/types.d.ts +28 -0
  118. package/dist/tools/task/constants.d.ts +5 -0
  119. package/dist/tools/task/types.d.ts +2 -0
  120. package/package.json +1 -1
  121. package/dist/hooks/anthropic-context-window-limit-recovery/empty-content-recovery-sdk.d.ts +0 -11
  122. package/dist/hooks/anthropic-context-window-limit-recovery/index.d.ts +0 -8
  123. package/dist/hooks/anthropic-context-window-limit-recovery/message-storage-directory.d.ts +0 -3
  124. package/dist/hooks/anthropic-context-window-limit-recovery/parser.d.ts +0 -2
  125. package/dist/hooks/anthropic-context-window-limit-recovery/storage-paths.d.ts +0 -3
  126. package/dist/hooks/anthropic-context-window-limit-recovery/storage.d.ts +0 -4
  127. package/dist/hooks/anthropic-context-window-limit-recovery/tool-result-storage.d.ts +0 -10
  128. package/dist/hooks/directory-readme-injector/constants.d.ts +0 -2
  129. package/dist/hooks/directory-readme-injector/finder.d.ts +0 -5
  130. package/dist/hooks/directory-readme-injector/hook.d.ts +0 -6
  131. package/dist/hooks/directory-readme-injector/index.d.ts +0 -1
  132. package/dist/hooks/directory-readme-injector/injector.d.ts +0 -16
  133. package/dist/hooks/directory-readme-injector/storage.d.ts +0 -1
  134. package/dist/hooks/mcp-startup-notification/index.d.ts +0 -9
  135. package/dist/hooks/question-label-truncator/hook.d.ts +0 -7
  136. package/dist/hooks/question-label-truncator/index.d.ts +0 -1
  137. package/dist/shared/migration/agent-category.d.ts +0 -19
  138. package/dist/shared/migration/agent-names.d.ts +0 -6
  139. package/dist/shared/migration/config-migration.d.ts +0 -1
  140. package/dist/shared/migration/model-versions.d.ts +0 -13
  141. package/dist/shared/migration.d.ts +0 -5
  142. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/aggressive-truncation-strategy.d.ts +0 -0
  143. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/client.d.ts +0 -0
  144. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/empty-content-recovery.d.ts +0 -0
  145. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/executor.d.ts +0 -0
  146. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/message-builder.d.ts +0 -0
  147. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/recovery-strategy.d.ts +0 -0
  148. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/state.d.ts +0 -0
  149. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/summarize-retry-strategy.d.ts +0 -0
  150. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/target-token-truncation.d.ts +0 -0
  151. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/tool-part-types.d.ts +0 -0
@@ -0,0 +1,36 @@
1
+ import type { ExperimentalConfig } from "../config/schema/experimental";
2
+ import type { ContextLimitModelCacheState } from "./context-limit-resolver";
3
+ import { isAnthropicProvider, resolveActualContextLimit } from "./context-limit-resolver";
4
+ /**
5
+ * Single source for context window thresholds and limit defaults.
6
+ * Boundary: monitor 70% warn (read-only) → preemptive 78% (proactive) → recovery (reactive, error-parse only).
7
+ * Shared constants consumed via context-limits.ts + token-cache.ts.
8
+ *
9
+ * Thresholds:
10
+ * - CONTEXT_WARNING_THRESHOLD (0.70) — read-only monitor warning, Anthropic only.
11
+ * - PREEMPTIVE_COMPACTION_THRESHOLD (0.78) — proactive compaction trigger.
12
+ * Limits:
13
+ * - ANTHROPIC_DISPLAY_LIMIT (1_000_000) — UI display cap for Anthropic 1M context.
14
+ * - DEFAULT_ANTHROPIC_ACTUAL_LIMIT (200_000) — fallback when 1M not enabled.
15
+ * - DEFAULT_NON_ANTHROPIC_FALLBACK_LIMIT (128_000) — generic LLM fallback.
16
+ *
17
+ * Re-exports isAnthropicProvider + resolveActualContextLimit from resolver for single import surface.
18
+ */
19
+ /** Warn threshold for monitor (read-only, does not trigger compaction). */
20
+ export declare const CONTEXT_WARNING_THRESHOLD: 0.7;
21
+ /** Proactive compaction threshold (preemptive-compaction trigger). */
22
+ export declare const PREEMPTIVE_COMPACTION_THRESHOLD: 0.78;
23
+ /** Default actual limit for Anthropic without 1M enabled. */
24
+ export declare const DEFAULT_ANTHROPIC_ACTUAL_LIMIT: 200000;
25
+ /** Generic fallback for non-Anthropic providers. */
26
+ export declare const DEFAULT_NON_ANTHROPIC_FALLBACK_LIMIT: 128000;
27
+ /** Display limit for Anthropic 1M UI. */
28
+ export declare const ANTHROPIC_DISPLAY_LIMIT: 1000000;
29
+ export type { ContextLimitModelCacheState };
30
+ export { isAnthropicProvider, resolveActualContextLimit };
31
+ /** Wrapper around resolveActualContextLimit for display vs actual semantics. */
32
+ export declare function getActualLimit(providerID: string, modelID: string, modelCacheState?: ContextLimitModelCacheState): number | null;
33
+ /** Display limit is fixed 1M for Anthropic UI; actual may be smaller. */
34
+ export declare function getDisplayLimit(): number;
35
+ export declare function resolveWarningThreshold(experimental?: ExperimentalConfig): number;
36
+ export declare function resolvePreemptiveThreshold(experimental?: ExperimentalConfig): number;
@@ -18,7 +18,6 @@ export * from "./git-worktree";
18
18
  export * from "./is-abort-error";
19
19
  export * from "./jsonc-parser";
20
20
  export * from "./logger";
21
- export * from "./migration";
22
21
  export * from "./model-availability";
23
22
  export * from "./model-requirements";
24
23
  export { type ModelResolutionProvenance, type ModelResolutionRequest, type ModelResolutionResult, normalizeModel, resolveModelPipeline, } from "./model-resolution-pipeline";
@@ -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
+ export declare const LEGACY_HOOK_NAME_MAP: Record<string, string>;
1
2
  export declare const HOOK_NAME_MAP: Record<string, string | null>;
2
3
  export declare function migrateHookNames(hooks: string[]): {
3
4
  migrated: string[];
@@ -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>;
@@ -1,3 +1,3 @@
1
- type CommandSource = "claude-code" | "opencode";
1
+ type CommandSource = "other" | "opencode";
2
2
  export declare function sanitizeModelField(model: unknown, source?: CommandSource): string | undefined;
3
3
  export {};
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-matrixx",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,11 +0,0 @@
1
- import type { Client } from "./client";
2
- export declare function fixEmptyMessagesWithSDK(params: {
3
- sessionID: string;
4
- client: Client;
5
- placeholderText: string;
6
- messageIndex?: number;
7
- }): Promise<{
8
- fixed: boolean;
9
- fixedMessageIds: string[];
10
- scannedEmptyCount: number;
11
- }>;
@@ -1,8 +0,0 @@
1
- export { executeCompact, getLastAssistant } from "./executor";
2
- export * from "./message-builder";
3
- export { parseAnthropicTokenLimitError } from "./parser";
4
- export type { AnthropicContextWindowLimitRecoveryOptions } from "./recovery-hook";
5
- export { createAnthropicContextWindowLimitRecoveryHook } from "./recovery-hook";
6
- export * from "./recovery-strategy";
7
- export * from "./state";
8
- export type { AutoCompactState, ParsedTokenLimitError, TruncateState } from "./types";
@@ -1,3 +0,0 @@
1
- import { getMessageDir } from "../../shared/opencode-message-dir";
2
- export { getMessageDir };
3
- export declare function getMessageIds(sessionID: string): string[];
@@ -1,2 +0,0 @@
1
- import type { ParsedTokenLimitError } from "./types";
2
- export declare function parseAnthropicTokenLimitError(err: unknown): ParsedTokenLimitError | null;
@@ -1,3 +0,0 @@
1
- import { MESSAGE_STORAGE, PART_STORAGE } from "../../shared";
2
- export { MESSAGE_STORAGE as MESSAGE_STORAGE_DIR, PART_STORAGE as PART_STORAGE_DIR };
3
- export declare const TRUNCATION_MESSAGE = "[TOOL RESULT TRUNCATED - Context limit exceeded. Original output was too large and has been truncated to recover the session. Please re-run this tool if you need the full output.]";
@@ -1,4 +0,0 @@
1
- export { truncateUntilTargetTokens } from "./target-token-truncation";
2
- export type { AggressiveTruncateResult, ToolResultInfo } from "./tool-part-types";
3
- export { countTruncatedResults, findLargestToolResult, findToolResultsBySize, getTotalToolOutputSize, truncateToolResult, } from "./tool-result-storage";
4
- export { countTruncatedResultsFromSDK, findToolResultsBySizeFromSDK, getTotalToolOutputSizeFromSDK, truncateToolResultAsync, } from "./tool-result-storage-sdk";
@@ -1,10 +0,0 @@
1
- import type { ToolResultInfo } from "./tool-part-types";
2
- export declare function findToolResultsBySize(sessionID: string): ToolResultInfo[];
3
- export declare function findLargestToolResult(sessionID: string): ToolResultInfo | null;
4
- export declare function truncateToolResult(partPath: string): {
5
- success: boolean;
6
- toolName?: string;
7
- originalSize?: number;
8
- };
9
- export declare function getTotalToolOutputSize(sessionID: string): number;
10
- export declare function countTruncatedResults(sessionID: string): number;
@@ -1,2 +0,0 @@
1
- export declare const README_INJECTOR_STORAGE: string;
2
- export declare const README_FILENAME = "README.md";
@@ -1,5 +0,0 @@
1
- export declare function resolveFilePath(rootDirectory: string, path: string): string | null;
2
- export declare function findReadmeMdUp(input: {
3
- startDir: string;
4
- rootDir: string;
5
- }): Promise<string[]>;
@@ -1,6 +0,0 @@
1
- import type { PluginInput } from "@opencode-ai/plugin";
2
- export declare function createDirectoryReadmeInjectorHook(ctx: PluginInput): {
3
- "tool.execute.before": (input: import("../directory-injector/factory").ToolExecuteInput, output: import("../directory-injector/factory").ToolExecuteBeforeOutput) => Promise<void>;
4
- "tool.execute.after": (input: import("../directory-injector/factory").ToolExecuteInput, output: import("../directory-injector/factory").ToolExecuteOutput) => Promise<void>;
5
- event: ({ event }: import("../directory-injector/factory").EventInput) => Promise<void>;
6
- };
@@ -1 +0,0 @@
1
- export { createDirectoryReadmeInjectorHook } from "./hook";
@@ -1,16 +0,0 @@
1
- import type { PluginInput } from "@opencode-ai/plugin";
2
- import type { createDynamicTruncator } from "../../shared/dynamic-truncator";
3
- type DynamicTruncator = ReturnType<typeof createDynamicTruncator>;
4
- export declare function processFilePathForReadmeInjection(input: {
5
- ctx: PluginInput;
6
- truncator: DynamicTruncator;
7
- sessionCaches: Map<string, Set<string>>;
8
- filePath: string;
9
- sessionID: string;
10
- output: {
11
- title: string;
12
- output: string;
13
- metadata: unknown;
14
- };
15
- }): Promise<void>;
16
- export {};
@@ -1 +0,0 @@
1
- export declare const loadInjectedPaths: (sessionID: string) => Set<string>, saveInjectedPaths: (sessionID: string, paths: Set<string>) => void, clearInjectedPaths: (sessionID: string) => void;
@@ -1,9 +0,0 @@
1
- import type { PluginInput } from "@opencode-ai/plugin";
2
- export declare function createMcpStartupNotificationHook(ctx: PluginInput): {
3
- event: ({ event }: {
4
- event: {
5
- type: string;
6
- properties?: unknown;
7
- };
8
- }) => void;
9
- };
@@ -1,7 +0,0 @@
1
- export declare function createQuestionLabelTruncatorHook(): {
2
- "tool.execute.before": (input: {
3
- tool: string;
4
- }, output: {
5
- args: Record<string, unknown>;
6
- }) => Promise<void>;
7
- };
@@ -1 +0,0 @@
1
- export { createQuestionLabelTruncatorHook } from "./hook";
@@ -1,19 +0,0 @@
1
- /**
2
- * @deprecated LEGACY MIGRATION ONLY
3
- *
4
- * This map exists solely for migrating old configs that used hardcoded model strings.
5
- * It maps legacy model strings to semantic category names, allowing users to migrate
6
- * from explicit model configs to category-based configs.
7
- *
8
- * DO NOT add new entries here. New agents should use:
9
- * - Category-based config (preferred): { category: "red-pill" }
10
- * - Or inherit from OpenCode's config.model
11
- *
12
- * This map will be removed in a future major version once migration period ends.
13
- */
14
- export declare const MODEL_TO_CATEGORY_MAP: Record<string, string>;
15
- export declare function migrateAgentConfigToCategory(config: Record<string, unknown>): {
16
- migrated: Record<string, unknown>;
17
- changed: boolean;
18
- };
19
- export declare function shouldDeleteAgentConfig(config: Record<string, unknown>, category: string): boolean;
@@ -1,6 +0,0 @@
1
- export declare const AGENT_NAME_MAP: Record<string, string>;
2
- export declare const BUILTIN_AGENT_NAMES: Set<string>;
3
- export declare function migrateAgentNames(agents: Record<string, unknown>): {
4
- migrated: Record<string, unknown>;
5
- changed: boolean;
6
- };
@@ -1 +0,0 @@
1
- export declare function migrateConfigFile(configPath: string, rawConfig: Record<string, unknown>): boolean;
@@ -1,13 +0,0 @@
1
- /**
2
- * Model version migration map: old full model strings → new full model strings.
3
- * Used to auto-upgrade hardcoded model versions in user configs when the plugin
4
- * bumps to newer model versions.
5
- *
6
- * Keys are full "provider/model" strings. Only openai and anthropic entries needed.
7
- */
8
- export declare const MODEL_VERSION_MAP: Record<string, string>;
9
- export declare function migrateModelVersions(configs: Record<string, unknown>, appliedMigrations?: Set<string>): {
10
- migrated: Record<string, unknown>;
11
- changed: boolean;
12
- newMigrations: string[];
13
- };
@@ -1,5 +0,0 @@
1
- export { MODEL_TO_CATEGORY_MAP, migrateAgentConfigToCategory, shouldDeleteAgentConfig } from "./migration/agent-category";
2
- export { AGENT_NAME_MAP, BUILTIN_AGENT_NAMES, migrateAgentNames } from "./migration/agent-names";
3
- export { migrateConfigFile } from "./migration/config-migration";
4
- export { HOOK_NAME_MAP, migrateHookNames } from "./migration/hook-names";
5
- export { MODEL_VERSION_MAP, migrateModelVersions } from "./migration/model-versions";