opencode-matrixx 1.0.2 → 1.1.0

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 (117) hide show
  1. package/README.md +49 -7
  2. package/dist/agents/architect/default.d.ts +1 -1
  3. package/dist/agents/architect/gpt.d.ts +1 -1
  4. package/dist/agents/index.d.ts +1 -0
  5. package/dist/agents/mouse/agent.d.ts +1 -1
  6. package/dist/agents/oracle/behavioral-summary.d.ts +1 -1
  7. package/dist/agents/oracle/high-accuracy-mode.d.ts +1 -1
  8. package/dist/agents/oracle/identity-constraints.d.ts +1 -1
  9. package/dist/agents/oracle/interview-mode.d.ts +1 -1
  10. package/dist/agents/oracle/plan-generation.d.ts +1 -1
  11. package/dist/agents/oracle/plan-template.d.ts +1 -1
  12. package/dist/agents/oracle/system-prompt.d.ts +1 -1
  13. package/dist/agents/smith.d.ts +1 -1
  14. package/dist/agents/types.d.ts +1 -1
  15. package/dist/agents/zion.d.ts +7 -0
  16. package/dist/cli/index.js +724 -171
  17. package/dist/config/index.d.ts +2 -2
  18. package/dist/config/schema/agent-definitions.d.ts +4 -0
  19. package/dist/config/schema/agent-names.d.ts +7 -0
  20. package/dist/config/schema/categories.d.ts +2 -0
  21. package/dist/config/schema/hooks.d.ts +6 -0
  22. package/dist/config/schema/matrixx-config.d.ts +30 -0
  23. package/dist/config/schema/model-capabilities.d.ts +8 -0
  24. package/dist/config/schema/runtime-fallback.d.ts +10 -0
  25. package/dist/config/schema/tdd-enforcer.d.ts +5 -0
  26. package/dist/config/schema.d.ts +4 -0
  27. package/dist/create-hooks.d.ts +6 -0
  28. package/dist/features/builtin-commands/templates/handoff.d.ts +1 -1
  29. package/dist/features/builtin-commands/templates/pickup.d.ts +1 -1
  30. package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
  31. package/dist/features/builtin-skills/skills/crypto-market-analysis.d.ts +4 -0
  32. package/dist/features/builtin-skills/skills/crypto-onchain.d.ts +4 -0
  33. package/dist/features/builtin-skills/skills/crypto-trading.d.ts +4 -0
  34. package/dist/features/builtin-skills/skills/index.d.ts +5 -0
  35. package/dist/features/builtin-skills/skills/review-work.d.ts +4 -0
  36. package/dist/features/builtin-skills/skills/tdd-enforcer.d.ts +4 -0
  37. package/dist/features/mission-state/constants.d.ts +4 -4
  38. package/dist/features/mission-state/storage.d.ts +1 -1
  39. package/dist/features/run-continuation-state/constants.d.ts +1 -0
  40. package/dist/features/run-continuation-state/index.d.ts +3 -0
  41. package/dist/features/run-continuation-state/storage.d.ts +6 -0
  42. package/dist/features/run-continuation-state/types.d.ts +12 -0
  43. package/dist/features/team-mode/index.d.ts +2 -0
  44. package/dist/features/team-mode/team-layout-tmux/index.d.ts +1 -0
  45. package/dist/features/team-mode/team-layout-tmux/layout.d.ts +15 -0
  46. package/dist/features/team-mode/team-worktree/cleanup.d.ts +3 -0
  47. package/dist/features/team-mode/team-worktree/index.d.ts +2 -0
  48. package/dist/features/team-mode/team-worktree/manager.d.ts +15 -0
  49. package/dist/features/team-mode/types.d.ts +210 -0
  50. package/dist/hooks/handoff-injector/constants.d.ts +2 -2
  51. package/dist/hooks/hashline-edit-diff-enhancer/hook.d.ts +28 -0
  52. package/dist/hooks/hashline-edit-diff-enhancer/index.d.ts +1 -0
  53. package/dist/hooks/index.d.ts +6 -0
  54. package/dist/hooks/keyword-detector/ultrawork/planner.d.ts +1 -1
  55. package/dist/hooks/matrix-loop/constants.d.ts +1 -1
  56. package/dist/hooks/mouse-notepad/constants.d.ts +1 -1
  57. package/dist/hooks/preemptive-compaction-degradation-monitor.d.ts +55 -0
  58. package/dist/hooks/preemptive-compaction-no-text-tail.d.ts +18 -0
  59. package/dist/hooks/preemptive-compaction-trigger.d.ts +13 -0
  60. package/dist/hooks/preemptive-compaction-types.d.ts +53 -0
  61. package/dist/hooks/preemptive-compaction.d.ts +5 -13
  62. package/dist/hooks/prometheus-md-only/constants.d.ts +1 -1
  63. package/dist/hooks/prometheus-md-only/path-policy.d.ts +3 -3
  64. package/dist/hooks/read-image-resizer/hook.d.ts +12 -0
  65. package/dist/hooks/read-image-resizer/image-dimensions.d.ts +2 -0
  66. package/dist/hooks/read-image-resizer/image-resizer.d.ts +5 -0
  67. package/dist/hooks/read-image-resizer/index.d.ts +1 -0
  68. package/dist/hooks/read-image-resizer/png-fallback-resizer.d.ts +2 -0
  69. package/dist/hooks/read-image-resizer/types.d.ts +14 -0
  70. package/dist/hooks/runtime-fallback/agent-resolver.d.ts +6 -0
  71. package/dist/hooks/runtime-fallback/auto-retry-signal.d.ts +4 -0
  72. package/dist/hooks/runtime-fallback/auto-retry.d.ts +10 -0
  73. package/dist/hooks/runtime-fallback/chat-message-handler.d.ts +20 -0
  74. package/dist/hooks/runtime-fallback/constants.d.ts +4 -0
  75. package/dist/hooks/runtime-fallback/error-classifier.d.ts +13 -0
  76. package/dist/hooks/runtime-fallback/event-handler.d.ts +8 -0
  77. package/dist/hooks/runtime-fallback/fallback-bootstrap-model.d.ts +10 -0
  78. package/dist/hooks/runtime-fallback/fallback-models.d.ts +2 -0
  79. package/dist/hooks/runtime-fallback/fallback-retry-dispatcher.d.ts +11 -0
  80. package/dist/hooks/runtime-fallback/fallback-state.d.ts +6 -0
  81. package/dist/hooks/runtime-fallback/hook.d.ts +2 -0
  82. package/dist/hooks/runtime-fallback/index.d.ts +3 -0
  83. package/dist/hooks/runtime-fallback/is-abort-error.d.ts +1 -0
  84. package/dist/hooks/runtime-fallback/last-user-retry-parts.d.ts +4 -0
  85. package/dist/hooks/runtime-fallback/message-update-handler.d.ts +4 -0
  86. package/dist/hooks/runtime-fallback/model-utils.d.ts +7 -0
  87. package/dist/hooks/runtime-fallback/retry-model-payload.d.ts +11 -0
  88. package/dist/hooks/runtime-fallback/retry-status-utils.d.ts +2 -0
  89. package/dist/hooks/runtime-fallback/session-category-registry.d.ts +6 -0
  90. package/dist/hooks/runtime-fallback/session-messages.d.ts +9 -0
  91. package/dist/hooks/runtime-fallback/session-status-handler.d.ts +3 -0
  92. package/dist/hooks/runtime-fallback/types.d.ts +113 -0
  93. package/dist/hooks/runtime-fallback/visible-assistant-response.d.ts +3 -0
  94. package/dist/hooks/shared/compaction-model-resolver.d.ts +5 -0
  95. package/dist/hooks/todo-description-override/description.d.ts +1 -0
  96. package/dist/hooks/todo-description-override/hook.d.ts +8 -0
  97. package/dist/hooks/todo-description-override/index.d.ts +1 -0
  98. package/dist/hooks/tool-pair-validator/hook.d.ts +28 -0
  99. package/dist/hooks/tool-pair-validator/index.d.ts +1 -0
  100. package/dist/hooks/webfetch-redirect-guard/constants.d.ts +6 -0
  101. package/dist/hooks/webfetch-redirect-guard/hook.d.ts +19 -0
  102. package/dist/hooks/webfetch-redirect-guard/index.d.ts +1 -0
  103. package/dist/hooks/webfetch-redirect-guard/redirect-resolution.d.ts +16 -0
  104. package/dist/index.js +5562 -792
  105. package/dist/plugin/hooks/create-core-hooks.d.ts +6 -0
  106. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
  107. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +5 -1
  108. package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -1
  109. package/dist/plugin/tool-definition.d.ts +9 -0
  110. package/dist/shared/context-limit-resolver.d.ts +5 -0
  111. package/dist/shared/session-model-state.d.ts +7 -0
  112. package/dist/shared/tmux/tmux-utils/spawn-process.d.ts +1 -0
  113. package/dist/tools/ast-grep/pattern-hints.d.ts +4 -0
  114. package/dist/tools/ast-grep/tool-descriptions.d.ts +3 -0
  115. package/dist/tools/delegate-task/constants.d.ts +2 -3
  116. package/dist/tools/delegate-task/prompt-builder.d.ts +1 -0
  117. package/package.json +28 -15
@@ -0,0 +1,6 @@
1
+ import type { FallbackState, FallbackResult } from "./types";
2
+ import type { RuntimeFallbackConfig } from "../../config";
3
+ export declare function createFallbackState(originalModel: string): FallbackState;
4
+ export declare function isModelInCooldown(model: string, state: FallbackState, cooldownSeconds: number): boolean;
5
+ export declare function findNextAvailableFallback(state: FallbackState, fallbackModels: string[], cooldownSeconds: number): string | undefined;
6
+ export declare function prepareFallback(sessionID: string, state: FallbackState, fallbackModels: string[], config: Required<RuntimeFallbackConfig>): FallbackResult;
@@ -0,0 +1,2 @@
1
+ import type { RuntimeFallbackHook, RuntimeFallbackOptions, RuntimeFallbackPluginInput } from "./types";
2
+ export declare function createRuntimeFallbackHook(ctx: RuntimeFallbackPluginInput, options?: RuntimeFallbackOptions): RuntimeFallbackHook;
@@ -0,0 +1,3 @@
1
+ export { createRuntimeFallbackHook } from "./hook";
2
+ export type { RuntimeFallbackHook, RuntimeFallbackOptions } from "./types";
3
+ export { SessionCategoryRegistry } from "./session-category-registry";
@@ -0,0 +1 @@
1
+ export declare function isAbortError(error: unknown): boolean;
@@ -0,0 +1,4 @@
1
+ export declare function getLastUserRetryParts(messagesResponse: unknown): Array<{
2
+ type: "text";
3
+ text: string;
4
+ }>;
@@ -0,0 +1,4 @@
1
+ import type { HookDeps } from "./types";
2
+ import type { AutoRetryHelpers } from "./auto-retry";
3
+ export { hasVisibleAssistantResponse } from "./visible-assistant-response";
4
+ export declare function createMessageUpdateHandler(deps: HookDeps, helpers: AutoRetryHelpers): (props: Record<string, unknown> | undefined) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ export declare function parseModelString(model: string): {
2
+ providerID: string;
3
+ modelID: string;
4
+ variant?: string;
5
+ } | undefined;
6
+ export declare function normalizeFallbackModels(models: string | string[] | undefined): string[] | undefined;
7
+ export declare function flattenToFallbackModelStrings(models: string[] | undefined): string[] | undefined;
@@ -0,0 +1,11 @@
1
+ export declare function buildRetryModelPayload(model: string, agentSettings?: {
2
+ variant?: string;
3
+ reasoningEffort?: string;
4
+ }): {
5
+ model: {
6
+ providerID: string;
7
+ modelID: string;
8
+ };
9
+ variant?: string;
10
+ reasoningEffort?: string;
11
+ } | undefined;
@@ -0,0 +1,2 @@
1
+ export declare function normalizeRetryStatusMessage(message: string): string;
2
+ export declare function extractRetryAttempt(statusAttempt: unknown, message: string): string;
@@ -0,0 +1,6 @@
1
+ export declare const SessionCategoryRegistry: {
2
+ register(sessionID: string, category: string): void;
3
+ get(sessionID: string): string | undefined;
4
+ remove(sessionID: string): void;
5
+ clear(): void;
6
+ };
@@ -0,0 +1,9 @@
1
+ export type SessionMessagePart = {
2
+ type?: string;
3
+ text?: string;
4
+ };
5
+ export type SessionMessage = {
6
+ info?: Record<string, unknown>;
7
+ parts?: SessionMessagePart[];
8
+ };
9
+ export declare function extractSessionMessages(messagesResponse: unknown): SessionMessage[] | undefined;
@@ -0,0 +1,3 @@
1
+ import type { HookDeps } from "./types";
2
+ import type { AutoRetryHelpers } from "./auto-retry";
3
+ export declare function createSessionStatusHandler(deps: HookDeps, helpers: AutoRetryHelpers, sessionStatusRetryKeys: Map<string, string>): (props: Record<string, unknown> | undefined) => Promise<void>;
@@ -0,0 +1,113 @@
1
+ import type { RuntimeFallbackConfig, MatrixxConfig } from "../../config";
2
+ export interface RuntimeFallbackInterval {
3
+ unref: () => void;
4
+ }
5
+ export type RuntimeFallbackTimeout = object | number;
6
+ export interface RuntimeFallbackPluginInput {
7
+ client: {
8
+ session: {
9
+ abort: (input: {
10
+ path: {
11
+ id: string;
12
+ };
13
+ }) => Promise<unknown>;
14
+ messages: (input: {
15
+ path: {
16
+ id: string;
17
+ };
18
+ query: {
19
+ directory: string;
20
+ };
21
+ }) => Promise<unknown>;
22
+ promptAsync: (input: {
23
+ path: {
24
+ id: string;
25
+ };
26
+ body: {
27
+ agent?: string;
28
+ model: {
29
+ providerID: string;
30
+ modelID: string;
31
+ };
32
+ parts: Array<{
33
+ type: "text";
34
+ text: string;
35
+ }>;
36
+ };
37
+ query: {
38
+ directory: string;
39
+ };
40
+ }) => Promise<unknown>;
41
+ };
42
+ tui: {
43
+ showToast: (input: {
44
+ body: {
45
+ title: string;
46
+ message: string;
47
+ variant: "success" | "error" | "info" | "warning";
48
+ duration: number;
49
+ };
50
+ }) => Promise<unknown>;
51
+ };
52
+ };
53
+ directory: string;
54
+ }
55
+ export interface FallbackState {
56
+ originalModel: string;
57
+ currentModel: string;
58
+ fallbackIndex: number;
59
+ failedModels: Map<string, number>;
60
+ attemptCount: number;
61
+ pendingFallbackModel?: string;
62
+ }
63
+ export interface FallbackResult {
64
+ success: boolean;
65
+ newModel?: string;
66
+ error?: string;
67
+ maxAttemptsReached?: boolean;
68
+ }
69
+ export interface RuntimeFallbackOptions {
70
+ config?: RuntimeFallbackConfig;
71
+ pluginConfig?: MatrixxConfig;
72
+ session_timeout_ms?: number;
73
+ }
74
+ export interface RuntimeFallbackHook {
75
+ event: (input: {
76
+ event: {
77
+ type: string;
78
+ properties?: unknown;
79
+ };
80
+ }) => Promise<void>;
81
+ "chat.message"?: (input: {
82
+ sessionID: string;
83
+ agent?: string;
84
+ model?: {
85
+ providerID: string;
86
+ modelID: string;
87
+ };
88
+ }, output: {
89
+ message: {
90
+ model?: {
91
+ providerID: string;
92
+ modelID: string;
93
+ };
94
+ };
95
+ parts?: Array<{
96
+ type: string;
97
+ text?: string;
98
+ }>;
99
+ }) => Promise<void>;
100
+ dispose?: () => void;
101
+ }
102
+ export interface HookDeps {
103
+ ctx: RuntimeFallbackPluginInput;
104
+ config: Required<RuntimeFallbackConfig>;
105
+ options: RuntimeFallbackOptions | undefined;
106
+ pluginConfig: MatrixxConfig | undefined;
107
+ sessionStates: Map<string, FallbackState>;
108
+ sessionLastAccess: Map<string, number>;
109
+ sessionRetryInFlight: Set<string>;
110
+ sessionAwaitingFallbackResult: Set<string>;
111
+ sessionFallbackTimeouts: Map<string, RuntimeFallbackTimeout>;
112
+ sessionStatusRetryKeys: Map<string, string>;
113
+ }
@@ -0,0 +1,3 @@
1
+ import type { HookDeps } from "./types";
2
+ import { extractAutoRetrySignal } from "./error-classifier";
3
+ export declare function hasVisibleAssistantResponse(extractAutoRetrySignalFn: typeof extractAutoRetrySignal): (ctx: HookDeps["ctx"], sessionID: string, _info: Record<string, unknown> | undefined) => Promise<boolean>;
@@ -0,0 +1,5 @@
1
+ import type { MatrixxConfig } from "../../config";
2
+ export declare function resolveCompactionModel(pluginConfig: MatrixxConfig, sessionID: string, originalProviderID: string, originalModelID: string): {
3
+ providerID: string;
4
+ modelID: string;
5
+ };
@@ -0,0 +1 @@
1
+ export declare const TODOWRITE_DESCRIPTION = "Manage your todo list with ATOMIC, single-responsibility items.\n\nRULES:\n- One todo = one specific, verifiable action (not \"Update everything\" or \"Fix issues\")\n- Each todo must be completable in isolation \u2014 no vague catch-alls\n- Todos must be nameable with a single precise phrase\n- Mark in_progress BEFORE starting work, completed IMMEDIATELY after finishing\n- Only ONE todo in_progress at a time\n\nANTI-PATTERNS (will be rejected by reviewers):\n- \"Update X and Y and Z\" \u2192 SPLIT into 3 separate todos\n- \"Fix issues\" \u2192 SPECIFY which file, function, or behavior\n- \"Refactor\" \u2192 SPECIFY what is being refactored and to what end\n- \"Improve\" \u2192 SPECIFY the measurable outcome\n\nSTATUS TRANSITIONS:\n pending \u2192 in_progress \u2192 completed\n pending \u2192 cancelled (if no longer needed)\n\nNever batch-complete todos. Mark each one complete the moment it is done.";
@@ -0,0 +1,8 @@
1
+ export declare function createTodoDescriptionOverrideHook(): {
2
+ "tool.definition": (input: {
3
+ toolID: string;
4
+ }, output: {
5
+ description: string;
6
+ parameters: unknown;
7
+ }) => Promise<void>;
8
+ };
@@ -0,0 +1 @@
1
+ export { createTodoDescriptionOverrideHook } from "./hook";
@@ -0,0 +1,28 @@
1
+ import type { Message, Part } from "@opencode-ai/sdk";
2
+ type ToolUsePart = {
3
+ type: "tool_use";
4
+ id: string;
5
+ [key: string]: unknown;
6
+ };
7
+ type ToolResultPart = {
8
+ type: "tool_result";
9
+ tool_use_id: string;
10
+ content: string;
11
+ [key: string]: unknown;
12
+ };
13
+ type TransformPart = Part | ToolUsePart | ToolResultPart;
14
+ type TransformMessageInfo = Message | {
15
+ role: "user";
16
+ sessionID?: string;
17
+ };
18
+ interface MessageWithParts {
19
+ info: TransformMessageInfo;
20
+ parts: TransformPart[];
21
+ }
22
+ type MessagesTransformHook = {
23
+ "experimental.chat.messages.transform"?: (input: Record<string, never>, output: {
24
+ messages: MessageWithParts[];
25
+ }) => Promise<void>;
26
+ };
27
+ export declare function createToolPairValidatorHook(): MessagesTransformHook;
28
+ export {};
@@ -0,0 +1 @@
1
+ export { createToolPairValidatorHook } from "./hook";
@@ -0,0 +1,6 @@
1
+ export declare const DEFAULT_WEBFETCH_TIMEOUT_MS = 30000;
2
+ export declare const MAX_WEBFETCH_TIMEOUT_MS = 120000;
3
+ export declare const MAX_WEBFETCH_REDIRECTS = 10;
4
+ export declare const WEBFETCH_REDIRECT_GUARD_STALE_TIMEOUT_MS: number;
5
+ export declare const WEBFETCH_REDIRECT_ERROR_PATTERNS: readonly [RegExp, RegExp];
6
+ export declare const WEBFETCH_REDIRECT_STATUSES: Set<number>;
@@ -0,0 +1,19 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ type ToolExecuteInput = {
3
+ tool: string;
4
+ sessionID: string;
5
+ callID: string;
6
+ };
7
+ type ToolExecuteBeforeOutput = {
8
+ args: Record<string, unknown>;
9
+ };
10
+ type ToolExecuteAfterOutput = {
11
+ title: string;
12
+ output: string;
13
+ metadata: Record<string, unknown>;
14
+ };
15
+ export declare function createWebFetchRedirectGuardHook(_ctx: PluginInput): {
16
+ "tool.execute.before": (input: ToolExecuteInput, output: ToolExecuteBeforeOutput) => Promise<void>;
17
+ "tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteAfterOutput) => Promise<void>;
18
+ };
19
+ export {};
@@ -0,0 +1 @@
1
+ export { createWebFetchRedirectGuardHook } from "./hook";
@@ -0,0 +1,16 @@
1
+ export type WebFetchFormat = "markdown" | "text" | "html";
2
+ type RedirectResolutionParams = {
3
+ url: string;
4
+ format: WebFetchFormat;
5
+ timeoutSeconds?: number;
6
+ };
7
+ export type RedirectResolutionResult = {
8
+ type: "resolved";
9
+ url: string;
10
+ } | {
11
+ type: "exceeded";
12
+ url: string;
13
+ maxRedirects: number;
14
+ };
15
+ export declare function resolveWebFetchRedirects(params: RedirectResolutionParams): Promise<RedirectResolutionResult>;
16
+ export {};