opencode-matrixx 2.6.1 → 2.6.3

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 (88) hide show
  1. package/README.md +12 -12
  2. package/dist/cli.js +63 -10
  3. package/dist/config/schema/context-mode.d.ts +7 -0
  4. package/dist/config/schema/experimental.d.ts +2 -0
  5. package/dist/config/schema/headroom.d.ts +1 -1
  6. package/dist/config/schema/hooks.d.ts +5 -8
  7. package/dist/config/schema/matrixx-config.d.ts +33 -9
  8. package/dist/config/schema/morpheus.d.ts +0 -2
  9. package/dist/config/schema/security.d.ts +49 -0
  10. package/dist/config/schema.d.ts +1 -0
  11. package/dist/create-hooks.d.ts +3 -4
  12. package/dist/hooks/context-mode-enforcer/constants.d.ts +6 -0
  13. package/dist/hooks/context-mode-enforcer/hook.d.ts +3 -0
  14. package/dist/hooks/context-mode-enforcer/index.d.ts +1 -0
  15. package/dist/hooks/context-window-limit-recovery/index.d.ts +8 -0
  16. package/dist/hooks/context-window-limit-recovery/parser-patterns.d.ts +11 -0
  17. package/dist/hooks/context-window-limit-recovery/parser.d.ts +15 -0
  18. package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/recovery-hook.d.ts +2 -0
  19. package/dist/hooks/context-window-limit-recovery/storage.d.ts +3 -0
  20. 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
  21. package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/types.d.ts +1 -1
  22. package/dist/hooks/context-window-monitor.d.ts +5 -1
  23. package/dist/hooks/index.d.ts +3 -4
  24. package/dist/hooks/input-secret-guard/detection-rules.d.ts +10 -0
  25. package/dist/hooks/input-secret-guard/detector.d.ts +22 -0
  26. package/dist/hooks/input-secret-guard/detector.test.d.ts +1 -0
  27. package/dist/hooks/input-secret-guard/hook.d.ts +19 -0
  28. package/dist/hooks/input-secret-guard/hook.test.d.ts +1 -0
  29. package/dist/hooks/input-secret-guard/index.d.ts +1 -0
  30. package/dist/hooks/input-secret-guard/redactor.d.ts +2 -0
  31. package/dist/hooks/input-secret-guard/redactor.test.d.ts +1 -0
  32. package/dist/hooks/input-secret-guard/session-allow-cache.d.ts +6 -0
  33. package/dist/hooks/input-secret-guard/session-allow-cache.test.d.ts +1 -0
  34. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +2 -9
  35. package/dist/hooks/preemptive-compaction-trigger.d.ts +1 -1
  36. package/dist/hooks/rules-injector/constants.d.ts +0 -1
  37. package/dist/hooks/rules-injector/parser.d.ts +0 -1
  38. package/dist/hooks/rules-injector/rule-file-finder.d.ts +2 -4
  39. package/dist/hooks/rules-injector/types.d.ts +2 -3
  40. package/dist/hooks/task-continuation-enforcer/constants.d.ts +1 -0
  41. package/dist/hooks/task-continuation-enforcer/countdown.test.d.ts +1 -0
  42. package/dist/hooks/task-continuation-enforcer/idle-event.test.d.ts +1 -0
  43. package/dist/hooks/task-continuation-enforcer/ulw-bootstrap.test.d.ts +1 -0
  44. package/dist/hooks/todo-continuation-enforcer/countdown.test.d.ts +1 -0
  45. package/dist/hooks/todo-continuation-enforcer/idle-event.test.d.ts +1 -0
  46. package/dist/index.js +9688 -9855
  47. package/dist/matrixx.schema.json +176 -72
  48. package/dist/plugin/hooks/create-core-hooks.d.ts +3 -4
  49. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -4
  50. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +2 -2
  51. package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -0
  52. package/dist/shared/context-limit-resolver.d.ts +1 -0
  53. package/dist/shared/context-limits.d.ts +36 -0
  54. package/dist/shared/index.d.ts +0 -1
  55. package/dist/shared/migration/hook-names.d.ts +1 -0
  56. package/dist/shared/model-sanitizer.d.ts +1 -1
  57. package/package.json +1 -1
  58. package/dist/hooks/anthropic-context-window-limit-recovery/empty-content-recovery-sdk.d.ts +0 -11
  59. package/dist/hooks/anthropic-context-window-limit-recovery/index.d.ts +0 -8
  60. package/dist/hooks/anthropic-context-window-limit-recovery/message-storage-directory.d.ts +0 -3
  61. package/dist/hooks/anthropic-context-window-limit-recovery/parser.d.ts +0 -2
  62. package/dist/hooks/anthropic-context-window-limit-recovery/storage-paths.d.ts +0 -3
  63. package/dist/hooks/anthropic-context-window-limit-recovery/storage.d.ts +0 -4
  64. package/dist/hooks/anthropic-context-window-limit-recovery/tool-result-storage.d.ts +0 -10
  65. package/dist/hooks/directory-readme-injector/constants.d.ts +0 -2
  66. package/dist/hooks/directory-readme-injector/finder.d.ts +0 -5
  67. package/dist/hooks/directory-readme-injector/hook.d.ts +0 -6
  68. package/dist/hooks/directory-readme-injector/index.d.ts +0 -1
  69. package/dist/hooks/directory-readme-injector/injector.d.ts +0 -16
  70. package/dist/hooks/directory-readme-injector/storage.d.ts +0 -1
  71. package/dist/hooks/mcp-startup-notification/index.d.ts +0 -9
  72. package/dist/hooks/question-label-truncator/hook.d.ts +0 -7
  73. package/dist/hooks/question-label-truncator/index.d.ts +0 -1
  74. package/dist/shared/migration/agent-category.d.ts +0 -19
  75. package/dist/shared/migration/agent-names.d.ts +0 -6
  76. package/dist/shared/migration/config-migration.d.ts +0 -1
  77. package/dist/shared/migration/model-versions.d.ts +0 -13
  78. package/dist/shared/migration.d.ts +0 -5
  79. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/aggressive-truncation-strategy.d.ts +0 -0
  80. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/client.d.ts +0 -0
  81. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/empty-content-recovery.d.ts +0 -0
  82. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/executor.d.ts +0 -0
  83. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/message-builder.d.ts +0 -0
  84. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/recovery-strategy.d.ts +0 -0
  85. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/state.d.ts +0 -0
  86. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/summarize-retry-strategy.d.ts +0 -0
  87. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/target-token-truncation.d.ts +0 -0
  88. /package/dist/hooks/{anthropic-context-window-limit-recovery → context-window-limit-recovery}/tool-part-types.d.ts +0 -0
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  >
2
2
  > [![Matrixx](./.github/assets/orchestrator-architect.png?v=3)](https://github.com/klpanagi/opencode-matrixx)
3
3
  >
4
- > Matrixx is **highly inspired by** [oh-my-opencode](https://github.com/code-yeongyu/oh-my-opencode) — the project that pioneered the "oh-my-zsh for OpenCode" concept.
5
- > Full credit to [code-yeongyu](https://github.com/code-yeongyu) for the original vision.
6
4
  >
7
5
 
8
6
  <div align="center">
@@ -13,7 +11,7 @@
13
11
  [![License: SUL-1.0](https://img.shields.io/badge/license-SUL--1.0-blue.svg)](https://github.com/klpanagi/opencode-matrixx/blob/master/LICENSE)
14
12
 
15
13
  **Multi-model agent orchestration for [OpenCode](https://github.com/sst/opencode).**<br/>
16
- **14 specialized agents. ~52 lifecycle hooks. 28 tools. One plugin.**
14
+ **14 specialized agents. 64 lifecycle hooks. 22 tools. 36 skills. One plugin.**
17
15
 
18
16
  </div>
19
17
 
@@ -43,7 +41,7 @@ Morpheus (Claude Opus) → Plans the implementation
43
41
  | Problem | Matrixx Solution |
44
42
  |---------|------------------|
45
43
  | One model does everything poorly | **14 specialists** — right model for the right job |
46
- | Agent forgets what it was doing | **Todo Continuation** — forces completion, no exceptions |
44
+ | Agent forgets what it was doing | **Task Continuation** — `task-continuation-enforcer` (file-backed `.matrixx/tasks`, survives `/clear`, project-scoped) — forces completion |
47
45
  | Slow sequential tool calls | **Parallel background agents** — 5+ running simultaneously |
48
46
  | AI-generated code looks like AI | **Comment Checker** — code indistinguishable from human-written |
49
47
  | Context window fills up fast | **Aggressive delegation** — subagents carry the load |
@@ -160,7 +158,7 @@ Use `--json` for machine-readable output or `--category <name>` for a specific c
160
158
 
161
159
  **Model:** Claude Opus 4.6 · `temperature: 0.1`
162
160
 
163
- Plans, delegates, and executes. Fires background agents in parallel, leverages LSP and AST-Grep for surgical refactoring, and never stops until the TODO list is empty. Morpheus sees the code for what it truly is — and routes every task to the agent best suited for it.
161
+ Plans, delegates, and executes. Fires background agents in parallel, leverages LSP and AST-Grep for surgical refactoring, and never stops until the task list is empty. Morpheus sees the code for what it truly is — and routes every task to the agent best suited for it.
164
162
 
165
163
  ---
166
164
 
@@ -355,10 +353,10 @@ Every agent, model, temperature, and permission is fully customizable. [**Meet t
355
353
 
356
354
  | | |
357
355
  |---|---|
358
- | **Agent Orchestration** | 15 agents (incl. **Mouse** dedicated executor, **Sati** frontend specialist, **Sentinel** security auditor, **Cipher** DSL expert), parallel background execution, category-based routing, session continuity |
356
+ | **Agent Orchestration** | 14 agents (incl. **Mouse** task executor, **Sati** frontend specialist, **Sentinel** security auditor, **Cipher** DSL expert), parallel background execution, category-based routing (`source`/`deep-jack`/…), session continuity, file-backed tasks |
359
357
  | **Developer Tools** | LSP (goto def, rename, diagnostics), AST-Grep (search & replace), Tmux terminal |
360
- | **~52 Lifecycle Hooks** | Context injection, think mode, comment checking, todo enforcement, error recovery, quality gate |
361
- || **33 Built-in Skills** | DSL engineering (11), security (9), browser, git, frontend (7 via **Sati**), saturation research, AI slop detection, software dev pipeline |
358
+ | **64 Lifecycle Hooks** | Context injection, think mode, comment checking, task/todo continuation enforcement, error recovery, quality gate, preemptive compaction, session recovery |
359
+ | **36 Built-in Skills** | DSL engineering (11), security (9), browser, git, frontend (7 via **Sati**), BDD (4: `bdd-contract`/`backend`/`frontend`/`tests` + pipeline), saturation research, AI slop detection, TDD (`tdd-enforcer` opt-in), software dev pipeline |
362
360
  | **Curated MCPs** | Exa (web search), Context7 (official docs), Grep.app (GitHub code search), Document Reader |
363
361
  | **Claude Code Compat** | Full compatibility — commands, agents, skills, MCPs, hooks from `settings.json` |
364
362
  | **Software Dev Pipeline** | 6-phase TDD workflow (PLAN→BUILD→VERIFY→REVIEW→SECURE→SHIP), 5 team roles, adaptive phases |
@@ -379,9 +377,9 @@ Matrixx includes a structured **6-phase development pipeline** that coordinates
379
377
 
380
378
  | Role | Agent | Skills | Purpose |
381
379
  |------|-------|--------|---------|
382
- | **Architect** | Oracle (Claude Opus) | — | System design, architecture decisions, task breakdown |
383
- | **Developer** | Source category | `git-master`, `tdd-enforcer` | Implementation code with TDD |
384
- | **Tester** | Source category | `tdd-enforcer`, `quality-gate` | Test authoring, coverage, verification |
380
+ | **Architect** | Oracle (`claude-sonnet-4-6`) | — | System design, architecture decisions, plan (`/.matrixx/plans/*.md`) breakdown |
381
+ | **Developer** | `category="source"` (Mouse) | `git-master`, `tdd-enforcer` (opt-in `tdd_enforcer.enabled=true`) | Implementation — RED→GREEN→REFACTOR per task |
382
+ | **Tester** | `category="source"` (Mouse) | `tdd-enforcer`, `quality-gate` | Test authoring (`src/**/*.test.ts`, `//#given//#when//#then`), coverage |
385
383
  | **Quality Evaluator** | Red-pill category | `quality-gate`, `review-work` | Lint, typecheck, 5-agent code review |
386
384
  | **Security Expert** | Sentinel (Claude Opus) | `security-core`, `security-sast`, `security-api`, `security-dependencies` | Vulnerability scanning, CVE checks |
387
385
 
@@ -389,7 +387,7 @@ Matrixx includes a structured **6-phase development pipeline** that coordinates
389
387
 
390
388
  | Phase | Skip? | Role | Exit Criteria |
391
389
  |-------|-------|------|---------------|
392
- | **PLAN** | Small tasks | Architect | Approach defined, files listed, edge cases documented |
390
+ | **PLAN** | Small tasks | Architect (Oracle) | Approach defined, files listed, edge cases + test decision (`TDD/tests-after/none`) documented |
393
391
  | **BUILD** | Never | Developer | TDD (RED→GREEN→REFACTOR), `bun test` passes |
394
392
  | **VERIFY** | Never | Quality | `lint` + `typecheck` + `test` + `build` — all pass |
395
393
  | **REVIEW** | Small tasks | Quality (5-agent) | All reviewers PASS, no CRITICAL/MAJOR issues |
@@ -665,6 +663,8 @@ To disable, set `headroom.enabled: false` or run OpenCode without `headroom wrap
665
663
  | [Orchestration](docs/orchestration-guide.md) | How agents coordinate, delegate, and recover |
666
664
  | [Categories & Skills](docs/category-skill-guide.md) | Task categories, skill injection, delegation patterns |
667
665
  | [Context Management](docs/context-management.md) | 5-layer context stack (Native, RTK, context-mode, DCP, Headroom) — setup, config, verification |
666
+ | [Task System](docs/task-system.md) | File-backed execution substrate (`.matrixx/tasks/T-{uuid}.json`), dependency graph, `task-continuation-enforcer` |
667
+ | [TDD](docs/tdd.md) | RED→GREEN→REFACTOR planning (Oracle) + enforcement (`tdd-enforcer` opt-in) |
668
668
 
669
669
  ---
670
670
 
package/dist/cli.js CHANGED
@@ -15868,6 +15868,13 @@ var CommentCheckerConfigSchema = exports_external.object({
15868
15868
  custom_prompt: exports_external.string().optional()
15869
15869
  });
15870
15870
 
15871
+ // src/config/schema/context-mode.ts
15872
+ var ContextModeConfigSchema = exports_external.object({
15873
+ enabled: exports_external.boolean().default(true),
15874
+ enforce: exports_external.boolean().default(false),
15875
+ blocked_tools: exports_external.array(exports_external.string()).default(["read", "grep", "glob"])
15876
+ });
15877
+
15871
15878
  // src/config/schema/dcp.ts
15872
15879
  var DcpCompressOverrideSchema = exports_external.object({
15873
15880
  maxContextLimit: exports_external.union([exports_external.number(), exports_external.string().regex(/^\d+%$/)]).optional(),
@@ -16114,6 +16121,8 @@ var ExperimentalConfigSchema = exports_external.object({
16114
16121
  truncate_all_tool_outputs: exports_external.boolean().optional(),
16115
16122
  task_system: exports_external.boolean().optional().default(true),
16116
16123
  plugin_load_timeout_ms: exports_external.number().min(1000).optional(),
16124
+ context_warning_threshold: exports_external.number().min(0.1).max(0.95).optional(),
16125
+ preemptive_compaction_threshold: exports_external.number().min(0.1).max(0.95).optional(),
16117
16126
  safe_hook_creation: exports_external.boolean().optional(),
16118
16127
  hashline_edit: exports_external.boolean().optional()
16119
16128
  });
@@ -16127,21 +16136,18 @@ var HeadroomConfigSchema = exports_external.object({
16127
16136
  });
16128
16137
 
16129
16138
  // src/config/schema/hooks.ts
16130
- var HookNameSchema = exports_external.enum([
16139
+ var HookNameEnum = exports_external.enum([
16131
16140
  "task-continuation-enforcer",
16132
16141
  "todo-continuation-enforcer",
16133
16142
  "context-window-monitor",
16134
16143
  "session-recovery",
16135
16144
  "session-notification",
16136
16145
  "comment-checker",
16137
- "grep-output-truncator",
16138
16146
  "tool-output-truncator",
16139
- "question-label-truncator",
16140
16147
  "directory-agents-injector",
16141
- "directory-readme-injector",
16142
16148
  "empty-task-response-detector",
16143
16149
  "think-mode",
16144
- "anthropic-context-window-limit-recovery",
16150
+ "context-window-limit-recovery",
16145
16151
  "preemptive-compaction",
16146
16152
  "rules-injector",
16147
16153
  "background-notification",
@@ -16172,6 +16178,7 @@ var HookNameSchema = exports_external.enum([
16172
16178
  "anthropic-effort",
16173
16179
  "hashline-read-enhancer",
16174
16180
  "secret-leak-guard",
16181
+ "input-secret-guard",
16175
16182
  "env-context-injector",
16176
16183
  "env-file-write-guard",
16177
16184
  "json-error-recovery",
@@ -16185,13 +16192,16 @@ var HookNameSchema = exports_external.enum([
16185
16192
  "task-notepad",
16186
16193
  "design-intent-preserver",
16187
16194
  "rtk-bash-rewriter",
16188
- "mcp-startup-notification",
16189
16195
  "evolution-watcher",
16190
16196
  "evolution-compressor",
16191
- "evolution-quality-gate",
16192
16197
  "evolution-hitl",
16198
+ "context-mode-enforcer",
16193
16199
  "task-edit-guard"
16194
16200
  ]);
16201
+ var HookNameSchema = exports_external.union([
16202
+ HookNameEnum,
16203
+ exports_external.literal("anthropic-context-window-limit-recovery").transform(() => "context-window-limit-recovery")
16204
+ ]);
16195
16205
 
16196
16206
  // src/config/schema/matrix-loop.ts
16197
16207
  var MatrixLoopConfigSchema = exports_external.object({
@@ -16210,7 +16220,6 @@ var MatrixxSelfConfigSkillConfigSchema = exports_external.object({
16210
16220
  var MorpheusTasksConfigSchema = exports_external.object({
16211
16221
  storage_path: exports_external.string().optional(),
16212
16222
  task_list_id: exports_external.string().optional(),
16213
- claude_code_compat: exports_external.boolean().default(false),
16214
16223
  scope: exports_external.enum(["global", "project"]).default("project").optional().describe("Task storage scope: project \u2192 .matrixx/tasks per project (default), global \u2192 ~/.config/opencode/tasks/{listId}")
16215
16224
  });
16216
16225
  var MorpheusConfigSchema = exports_external.object({
@@ -16279,10 +16288,23 @@ var DependencyAuditConfigSchema = exports_external.object({
16279
16288
  enabled: exports_external.boolean().default(false),
16280
16289
  on_package_change: exports_external.boolean().default(true)
16281
16290
  });
16291
+ var InputSecretGuardModeSchema = exports_external.enum(["prompt", "block", "off"]);
16292
+ var InputSecretGuardConfigSchema = exports_external.object({
16293
+ enabled: exports_external.boolean().default(true),
16294
+ mode: InputSecretGuardModeSchema.default("prompt"),
16295
+ blocklist_mode: exports_external.enum(["prompt", "block"]).default("prompt"),
16296
+ warnlist_mode: exports_external.enum(["prompt", "off"]).default("prompt"),
16297
+ allowlist_patterns: exports_external.array(exports_external.string()).optional(),
16298
+ detection: exports_external.object({
16299
+ entropy_threshold: exports_external.number().min(0).max(8).default(4.5),
16300
+ max_scan_bytes: exports_external.number().int().min(1024).max(256 * 1024).default(64 * 1024)
16301
+ }).optional()
16302
+ });
16282
16303
  var SecurityConfigSchema = exports_external.object({
16283
16304
  secret_scanning: SecretScanningConfigSchema.optional(),
16284
16305
  env_file_guard: EnvFileGuardConfigSchema.optional(),
16285
- dependency_audit: DependencyAuditConfigSchema.optional()
16306
+ dependency_audit: DependencyAuditConfigSchema.optional(),
16307
+ input_secret_guard: InputSecretGuardConfigSchema.optional()
16286
16308
  });
16287
16309
 
16288
16310
  // src/config/schema/skills.ts
@@ -16381,6 +16403,7 @@ var MatrixxConfigSchema = exports_external.object({
16381
16403
  agent_definitions: AgentDefinitionsConfigSchema.optional(),
16382
16404
  matrixx_self_config: MatrixxSelfConfigSkillConfigSchema.optional(),
16383
16405
  headroom: HeadroomConfigSchema.optional(),
16406
+ context_mode: ContextModeConfigSchema.optional(),
16384
16407
  rtk: RtkConfigSchema.optional(),
16385
16408
  evolution: EvolutionConfigSchema.optional(),
16386
16409
  _migrations: exports_external.array(exports_external.string()).optional()
@@ -16461,6 +16484,27 @@ var configValidationCheck = {
16461
16484
  // src/cli/doctor/checks/context-mode.ts
16462
16485
  import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
16463
16486
  import { join as join7 } from "path";
16487
+ function loadContextModeConfig() {
16488
+ const dir = getOpenCodeConfigDir({ binary: "opencode" });
16489
+ const bases = [join7(dir, "matrixx"), join7(process.cwd(), ".opencode", "matrixx"), join7(process.cwd(), "matrixx")];
16490
+ for (const base of bases) {
16491
+ for (const ext of [".jsonc", ".json"]) {
16492
+ const p = `${base}${ext}`;
16493
+ if (!existsSync6(p))
16494
+ continue;
16495
+ try {
16496
+ const c = readFileSync5(p, "utf-8");
16497
+ const parsed = parseJsoncSafe(c);
16498
+ if (!parsed.data || parsed.errors.length > 0)
16499
+ continue;
16500
+ const cm = parsed.data.context_mode;
16501
+ if (cm && typeof cm.enabled === "boolean")
16502
+ return { enabled: cm.enabled };
16503
+ } catch {}
16504
+ }
16505
+ }
16506
+ return null;
16507
+ }
16464
16508
  function hasContextModePlugin() {
16465
16509
  const dir = getOpenCodeConfigDir({ binary: "opencode" });
16466
16510
  for (const name of ["opencode.jsonc", "opencode.json"]) {
@@ -16489,6 +16533,15 @@ var contextModeCheck = {
16489
16533
  name: "context-mode-integration",
16490
16534
  category: "integrations",
16491
16535
  check: () => {
16536
+ const cfg = loadContextModeConfig();
16537
+ if (cfg && !cfg.enabled) {
16538
+ return {
16539
+ name: "context-mode-integration",
16540
+ status: "pass",
16541
+ message: "context-mode disabled via matrixx.jsonc \u2014 skipping",
16542
+ detail: "Set context_mode.enabled:true in matrixx.jsonc to enable discipline and enforcer"
16543
+ };
16544
+ }
16492
16545
  const hasPlugin = hasContextModePlugin();
16493
16546
  const cacheDir = getOmoOpenCodeCacheDir();
16494
16547
  const hasCache = existsSync6(cacheDir);
@@ -18779,7 +18832,7 @@ Run with --yes to overwrite without prompt.`;
18779
18832
  const lines = [
18780
18833
  "",
18781
18834
  "\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510",
18782
- "\u2502 Matrixx Setup Complete" + dry.padEnd(12) + "\u2502",
18835
+ `\u2502 Matrixx Setup Complete${dry.padEnd(12)}\u2502`,
18783
18836
  "\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518",
18784
18837
  "",
18785
18838
  report,
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ export declare const ContextModeConfigSchema: z.ZodObject<{
3
+ enabled: z.ZodDefault<z.ZodBoolean>;
4
+ enforce: z.ZodDefault<z.ZodBoolean>;
5
+ blocked_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
6
+ }, z.core.$strip>;
7
+ export type ContextModeConfig = z.infer<typeof ContextModeConfigSchema>;
@@ -6,6 +6,8 @@ export declare const ExperimentalConfigSchema: z.ZodObject<{
6
6
  truncate_all_tool_outputs: z.ZodOptional<z.ZodBoolean>;
7
7
  task_system: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
8
  plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
9
+ context_warning_threshold: z.ZodOptional<z.ZodNumber>;
10
+ preemptive_compaction_threshold: z.ZodOptional<z.ZodNumber>;
9
11
  safe_hook_creation: z.ZodOptional<z.ZodBoolean>;
10
12
  hashline_edit: z.ZodOptional<z.ZodBoolean>;
11
13
  }, z.core.$strip>;
@@ -12,7 +12,7 @@ import { z } from "zod";
12
12
  * so the proxy sits transparently in front of the transport.
13
13
  * - Native transport integration is deferred until the compaction hook
14
14
  * stabilizes (Headroom #76 collision risk with
15
- * anthropic-context-window-limit-recovery).
15
+ * context-window-limit-recovery).
16
16
  */
17
17
  export declare const HeadroomConfigSchema: z.ZodObject<{
18
18
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const HookNameSchema: z.ZodEnum<{
2
+ export declare const HookNameSchema: z.ZodUnion<readonly [z.ZodEnum<{
3
3
  architect: "architect";
4
4
  "quality-gate": "quality-gate";
5
5
  "matrix-loop": "matrix-loop";
@@ -12,14 +12,11 @@ export declare const HookNameSchema: z.ZodEnum<{
12
12
  "session-recovery": "session-recovery";
13
13
  "session-notification": "session-notification";
14
14
  "comment-checker": "comment-checker";
15
- "grep-output-truncator": "grep-output-truncator";
16
15
  "tool-output-truncator": "tool-output-truncator";
17
- "question-label-truncator": "question-label-truncator";
18
16
  "directory-agents-injector": "directory-agents-injector";
19
- "directory-readme-injector": "directory-readme-injector";
20
17
  "empty-task-response-detector": "empty-task-response-detector";
21
18
  "think-mode": "think-mode";
22
- "anthropic-context-window-limit-recovery": "anthropic-context-window-limit-recovery";
19
+ "context-window-limit-recovery": "context-window-limit-recovery";
23
20
  "preemptive-compaction": "preemptive-compaction";
24
21
  "rules-injector": "rules-injector";
25
22
  "background-notification": "background-notification";
@@ -47,6 +44,7 @@ export declare const HookNameSchema: z.ZodEnum<{
47
44
  "anthropic-effort": "anthropic-effort";
48
45
  "hashline-read-enhancer": "hashline-read-enhancer";
49
46
  "secret-leak-guard": "secret-leak-guard";
47
+ "input-secret-guard": "input-secret-guard";
50
48
  "env-context-injector": "env-context-injector";
51
49
  "env-file-write-guard": "env-file-write-guard";
52
50
  "json-error-recovery": "json-error-recovery";
@@ -59,9 +57,8 @@ export declare const HookNameSchema: z.ZodEnum<{
59
57
  "task-notepad": "task-notepad";
60
58
  "design-intent-preserver": "design-intent-preserver";
61
59
  "rtk-bash-rewriter": "rtk-bash-rewriter";
62
- "mcp-startup-notification": "mcp-startup-notification";
63
- "evolution-quality-gate": "evolution-quality-gate";
64
60
  "evolution-hitl": "evolution-hitl";
61
+ "context-mode-enforcer": "context-mode-enforcer";
65
62
  "task-edit-guard": "task-edit-guard";
66
- }>;
63
+ }>, z.ZodPipe<z.ZodLiteral<"anthropic-context-window-limit-recovery">, z.ZodTransform<"context-window-limit-recovery", "anthropic-context-window-limit-recovery">>]>;
67
64
  export type HookName = z.infer<typeof HookNameSchema>;
@@ -67,7 +67,7 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
67
67
  "bdd-frontend": "bdd-frontend";
68
68
  "bdd-tests": "bdd-tests";
69
69
  }>>>;
70
- disabled_hooks: z.ZodOptional<z.ZodArray<z.ZodEnum<{
70
+ disabled_hooks: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
71
71
  architect: "architect";
72
72
  "quality-gate": "quality-gate";
73
73
  "matrix-loop": "matrix-loop";
@@ -80,14 +80,11 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
80
80
  "session-recovery": "session-recovery";
81
81
  "session-notification": "session-notification";
82
82
  "comment-checker": "comment-checker";
83
- "grep-output-truncator": "grep-output-truncator";
84
83
  "tool-output-truncator": "tool-output-truncator";
85
- "question-label-truncator": "question-label-truncator";
86
84
  "directory-agents-injector": "directory-agents-injector";
87
- "directory-readme-injector": "directory-readme-injector";
88
85
  "empty-task-response-detector": "empty-task-response-detector";
89
86
  "think-mode": "think-mode";
90
- "anthropic-context-window-limit-recovery": "anthropic-context-window-limit-recovery";
87
+ "context-window-limit-recovery": "context-window-limit-recovery";
91
88
  "preemptive-compaction": "preemptive-compaction";
92
89
  "rules-injector": "rules-injector";
93
90
  "background-notification": "background-notification";
@@ -115,6 +112,7 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
115
112
  "anthropic-effort": "anthropic-effort";
116
113
  "hashline-read-enhancer": "hashline-read-enhancer";
117
114
  "secret-leak-guard": "secret-leak-guard";
115
+ "input-secret-guard": "input-secret-guard";
118
116
  "env-context-injector": "env-context-injector";
119
117
  "env-file-write-guard": "env-file-write-guard";
120
118
  "json-error-recovery": "json-error-recovery";
@@ -127,11 +125,10 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
127
125
  "task-notepad": "task-notepad";
128
126
  "design-intent-preserver": "design-intent-preserver";
129
127
  "rtk-bash-rewriter": "rtk-bash-rewriter";
130
- "mcp-startup-notification": "mcp-startup-notification";
131
- "evolution-quality-gate": "evolution-quality-gate";
132
128
  "evolution-hitl": "evolution-hitl";
129
+ "context-mode-enforcer": "context-mode-enforcer";
133
130
  "task-edit-guard": "task-edit-guard";
134
- }>>>;
131
+ }>, z.ZodPipe<z.ZodLiteral<"anthropic-context-window-limit-recovery">, z.ZodTransform<"context-window-limit-recovery", "anthropic-context-window-limit-recovery">>]>>>;
135
132
  disabled_commands: z.ZodOptional<z.ZodArray<z.ZodEnum<{
136
133
  "bdd-contract": "bdd-contract";
137
134
  "bdd-backend": "bdd-backend";
@@ -1690,6 +1687,8 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
1690
1687
  truncate_all_tool_outputs: z.ZodOptional<z.ZodBoolean>;
1691
1688
  task_system: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1692
1689
  plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
1690
+ context_warning_threshold: z.ZodOptional<z.ZodNumber>;
1691
+ preemptive_compaction_threshold: z.ZodOptional<z.ZodNumber>;
1693
1692
  safe_hook_creation: z.ZodOptional<z.ZodBoolean>;
1694
1693
  hashline_edit: z.ZodOptional<z.ZodBoolean>;
1695
1694
  }, z.core.$strip>>;
@@ -1857,7 +1856,6 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
1857
1856
  tasks: z.ZodOptional<z.ZodObject<{
1858
1857
  storage_path: z.ZodOptional<z.ZodString>;
1859
1858
  task_list_id: z.ZodOptional<z.ZodString>;
1860
- claude_code_compat: z.ZodDefault<z.ZodBoolean>;
1861
1859
  scope: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
1862
1860
  project: "project";
1863
1861
  global: "global";
@@ -1892,6 +1890,27 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
1892
1890
  enabled: z.ZodDefault<z.ZodBoolean>;
1893
1891
  on_package_change: z.ZodDefault<z.ZodBoolean>;
1894
1892
  }, z.core.$strip>>;
1893
+ input_secret_guard: z.ZodOptional<z.ZodObject<{
1894
+ enabled: z.ZodDefault<z.ZodBoolean>;
1895
+ mode: z.ZodDefault<z.ZodEnum<{
1896
+ prompt: "prompt";
1897
+ off: "off";
1898
+ block: "block";
1899
+ }>>;
1900
+ blocklist_mode: z.ZodDefault<z.ZodEnum<{
1901
+ prompt: "prompt";
1902
+ block: "block";
1903
+ }>>;
1904
+ warnlist_mode: z.ZodDefault<z.ZodEnum<{
1905
+ prompt: "prompt";
1906
+ off: "off";
1907
+ }>>;
1908
+ allowlist_patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
1909
+ detection: z.ZodOptional<z.ZodObject<{
1910
+ entropy_threshold: z.ZodDefault<z.ZodNumber>;
1911
+ max_scan_bytes: z.ZodDefault<z.ZodNumber>;
1912
+ }, z.core.$strip>>;
1913
+ }, z.core.$strip>>;
1895
1914
  }, z.core.$strip>>;
1896
1915
  runtime_fallback: z.ZodOptional<z.ZodObject<{
1897
1916
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -1912,6 +1931,11 @@ export declare const MatrixxConfigSchema: z.ZodObject<{
1912
1931
  project: z.ZodOptional<z.ZodString>;
1913
1932
  backend: z.ZodOptional<z.ZodString>;
1914
1933
  }, z.core.$strip>>;
1934
+ context_mode: z.ZodOptional<z.ZodObject<{
1935
+ enabled: z.ZodDefault<z.ZodBoolean>;
1936
+ enforce: z.ZodDefault<z.ZodBoolean>;
1937
+ blocked_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
1938
+ }, z.core.$strip>>;
1915
1939
  rtk: z.ZodOptional<z.ZodObject<{
1916
1940
  enabled: z.ZodDefault<z.ZodBoolean>;
1917
1941
  binary_path: z.ZodOptional<z.ZodString>;
@@ -2,7 +2,6 @@ import { z } from "zod";
2
2
  declare const MorpheusTasksConfigSchema: z.ZodObject<{
3
3
  storage_path: z.ZodOptional<z.ZodString>;
4
4
  task_list_id: z.ZodOptional<z.ZodString>;
5
- claude_code_compat: z.ZodDefault<z.ZodBoolean>;
6
5
  scope: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
7
6
  project: "project";
8
7
  global: "global";
@@ -12,7 +11,6 @@ export declare const MorpheusConfigSchema: z.ZodObject<{
12
11
  tasks: z.ZodOptional<z.ZodObject<{
13
12
  storage_path: z.ZodOptional<z.ZodString>;
14
13
  task_list_id: z.ZodOptional<z.ZodString>;
15
- claude_code_compat: z.ZodDefault<z.ZodBoolean>;
16
14
  scope: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
17
15
  project: "project";
18
16
  global: "global";
@@ -12,6 +12,32 @@ declare const EnvFileGuardConfigSchema: z.ZodObject<{
12
12
  blocked_patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
13
13
  allowed_paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
14
  }, z.core.$strip>;
15
+ declare const InputSecretGuardModeSchema: z.ZodEnum<{
16
+ prompt: "prompt";
17
+ off: "off";
18
+ block: "block";
19
+ }>;
20
+ declare const InputSecretGuardConfigSchema: z.ZodObject<{
21
+ enabled: z.ZodDefault<z.ZodBoolean>;
22
+ mode: z.ZodDefault<z.ZodEnum<{
23
+ prompt: "prompt";
24
+ off: "off";
25
+ block: "block";
26
+ }>>;
27
+ blocklist_mode: z.ZodDefault<z.ZodEnum<{
28
+ prompt: "prompt";
29
+ block: "block";
30
+ }>>;
31
+ warnlist_mode: z.ZodDefault<z.ZodEnum<{
32
+ prompt: "prompt";
33
+ off: "off";
34
+ }>>;
35
+ allowlist_patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
36
+ detection: z.ZodOptional<z.ZodObject<{
37
+ entropy_threshold: z.ZodDefault<z.ZodNumber>;
38
+ max_scan_bytes: z.ZodDefault<z.ZodNumber>;
39
+ }, z.core.$strip>>;
40
+ }, z.core.$strip>;
15
41
  export declare const SecurityConfigSchema: z.ZodObject<{
16
42
  secret_scanning: z.ZodOptional<z.ZodObject<{
17
43
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -30,8 +56,31 @@ export declare const SecurityConfigSchema: z.ZodObject<{
30
56
  enabled: z.ZodDefault<z.ZodBoolean>;
31
57
  on_package_change: z.ZodDefault<z.ZodBoolean>;
32
58
  }, z.core.$strip>>;
59
+ input_secret_guard: z.ZodOptional<z.ZodObject<{
60
+ enabled: z.ZodDefault<z.ZodBoolean>;
61
+ mode: z.ZodDefault<z.ZodEnum<{
62
+ prompt: "prompt";
63
+ off: "off";
64
+ block: "block";
65
+ }>>;
66
+ blocklist_mode: z.ZodDefault<z.ZodEnum<{
67
+ prompt: "prompt";
68
+ block: "block";
69
+ }>>;
70
+ warnlist_mode: z.ZodDefault<z.ZodEnum<{
71
+ prompt: "prompt";
72
+ off: "off";
73
+ }>>;
74
+ allowlist_patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ detection: z.ZodOptional<z.ZodObject<{
76
+ entropy_threshold: z.ZodDefault<z.ZodNumber>;
77
+ max_scan_bytes: z.ZodDefault<z.ZodNumber>;
78
+ }, z.core.$strip>>;
79
+ }, z.core.$strip>>;
33
80
  }, z.core.$strip>;
34
81
  export type SecurityConfig = z.infer<typeof SecurityConfigSchema>;
35
82
  export type SecretScanningConfig = z.infer<typeof SecretScanningConfigSchema>;
36
83
  export type EnvFileGuardConfig = z.infer<typeof EnvFileGuardConfigSchema>;
84
+ export type InputSecretGuardConfig = z.infer<typeof InputSecretGuardConfigSchema>;
85
+ export type InputSecretGuardMode = z.infer<typeof InputSecretGuardModeSchema>;
37
86
  export {};
@@ -9,6 +9,7 @@ export * from "./schema/browser-automation";
9
9
  export * from "./schema/categories";
10
10
  export * from "./schema/commands";
11
11
  export * from "./schema/comment-checker";
12
+ export * from "./schema/context-mode";
12
13
  export * from "./schema/dcp";
13
14
  export * from "./schema/evolution";
14
15
  export * from "./schema/experimental";
@@ -26,6 +26,7 @@ export declare function createHooks(args: {
26
26
  planPersister: ReturnType<typeof import("./hooks").createPlanPersister> | null;
27
27
  evolutionCompressor: ReturnType<typeof import("./hooks").createEvolutionCompressorHook> | null;
28
28
  evolutionHitl: ReturnType<typeof import("./hooks").createEvolutionHitlHook> | null;
29
+ inputSecretGuard: ReturnType<typeof import("./hooks").createInputSecretGuardHook> | null;
29
30
  keywordDetector: ReturnType<typeof import("./hooks").createKeywordDetectorHook> | null;
30
31
  contextInjectorMessagesTransform: ReturnType<typeof import("./features/context-injector").createContextInjectorMessagesTransformHook>;
31
32
  envContextInjector: ReturnType<typeof import("./hooks").createEnvContextInjectorHook> | null;
@@ -35,7 +36,6 @@ export declare function createHooks(args: {
35
36
  commentChecker: ReturnType<typeof import("./hooks").createCommentCheckerHooks> | null;
36
37
  toolOutputTruncator: ReturnType<typeof import("./hooks").createToolOutputTruncatorHook> | null;
37
38
  directoryAgentsInjector: ReturnType<typeof import("./hooks").createDirectoryAgentsInjectorHook> | null;
38
- directoryReadmeInjector: ReturnType<typeof import("./hooks").createDirectoryReadmeInjectorHook> | null;
39
39
  emptyTaskResponseDetector: ReturnType<typeof import("./hooks").createEmptyTaskResponseDetectorHook> | null;
40
40
  rulesInjector: ReturnType<typeof import("./hooks").createRulesInjectorHook> | null;
41
41
  tasksTodowriteDisabler: ReturnType<typeof import("./hooks").createTasksTodowriteDisablerHook> | null;
@@ -45,6 +45,7 @@ export declare function createHooks(args: {
45
45
  envFileWriteGuard: ReturnType<typeof import("./hooks").createEnvFileWriteGuardHook> | null;
46
46
  jsonErrorRecovery: ReturnType<typeof import("./hooks").createJsonErrorRecoveryHook> | null;
47
47
  bashFileReadGuard: ReturnType<typeof import("./hooks").createBashFileReadGuardHook> | null;
48
+ contextModeEnforcer: ReturnType<typeof import("./hooks").createContextModeEnforcerHook> | null;
48
49
  readImageResizer: ReturnType<typeof import("./hooks").createReadImageResizerHook> | null;
49
50
  webfetchRedirectGuard: ReturnType<typeof import("./hooks").createWebFetchRedirectGuardHook> | null;
50
51
  hashlineEditDiffEnhancer: ReturnType<typeof import("./hooks").createHashlineEditDiffEnhancerHook> | null;
@@ -57,7 +58,7 @@ export declare function createHooks(args: {
57
58
  sessionRecovery: ReturnType<typeof import("./hooks").createSessionRecoveryHook> | null;
58
59
  sessionNotification: ReturnType<typeof import("./hooks").createSessionNotification> | null;
59
60
  thinkMode: ReturnType<typeof import("./hooks").createThinkModeHook> | null;
60
- anthropicContextWindowLimitRecovery: ReturnType<typeof import("./hooks").createAnthropicContextWindowLimitRecoveryHook> | null;
61
+ contextWindowLimitRecovery: ReturnType<typeof import("./hooks").createContextWindowLimitRecoveryHook> | null;
61
62
  autoUpdateChecker: ReturnType<typeof import("./hooks").createAutoUpdateCheckerHook> | null;
62
63
  agentUsageReminder: ReturnType<typeof import("./hooks").createAgentUsageReminderHook> | null;
63
64
  nonInteractiveEnv: ReturnType<typeof import("./hooks").createNonInteractiveEnvHook> | null;
@@ -68,10 +69,8 @@ export declare function createHooks(args: {
68
69
  startWork: ReturnType<typeof import("./hooks").createStartWorkHook> | null;
69
70
  oracleMdOnly: ReturnType<typeof import("./hooks").createOracleMdOnlyHook> | null;
70
71
  mouseNotepad: ReturnType<typeof import("./hooks").createMouseNotepadHook> | null;
71
- questionLabelTruncator: ReturnType<typeof import("./hooks").createQuestionLabelTruncatorHook>;
72
72
  taskResumeInfo: ReturnType<typeof import("./hooks").createTaskResumeInfoHook>;
73
73
  anthropicEffort: ReturnType<typeof import("./hooks/anthropic-effort").createAnthropicEffortHook> | null;
74
74
  runtimeFallback: ReturnType<typeof import("./hooks").createRuntimeFallbackHook> | null;
75
75
  rtkBashRewriter: ReturnType<typeof import("./hooks").createRtkBashRewriterHook> | null;
76
- mcpStartupNotification: ReturnType<typeof import("./hooks").createMcpStartupNotificationHook> | null;
77
76
  };
@@ -0,0 +1,6 @@
1
+ export declare const HOOK_NAME = "context-mode-enforcer";
2
+ export declare const WARN_MESSAGE_READ = "Use ctx_search / ctx_batch_execute / ctx_execute for analysis \u2014 raw read/grep/glob bypasses FTS5 sandbox and pollutes context. Use Read only with hashline IDs for Edit.";
3
+ export declare const BLOCK_MESSAGE_GREP_GLOB = "Blocked: raw grep/glob is forbidden when context-mode is enforced. Use ctx_search (indexed) \u2192 grep/glob fallback only when ctx_* unavailable, or ctx_batch_execute / ctx_execute for multi-file analysis.";
4
+ export declare const WARN_MESSAGE_BASH_READ = "Use ctx_* / Read tool instead of `cat`/`head`/`tail`/`grep` via bash for analysis. Raw bash file reads bypass sandbox.";
5
+ export declare const DEFAULT_BLOCKED_TOOLS: readonly ["grep", "glob"];
6
+ export declare const WARN_ONLY_TOOLS: readonly ["read"];
@@ -0,0 +1,3 @@
1
+ import type { Hooks } from "@opencode-ai/plugin";
2
+ import type { MatrixxConfig } from "../../config";
3
+ export declare function createContextModeEnforcerHook(pluginConfig: MatrixxConfig): Hooks;
@@ -0,0 +1 @@
1
+ export { createContextModeEnforcerHook } from "./hook";
@@ -0,0 +1,8 @@
1
+ export { executeCompact, getLastAssistant } from "./executor";
2
+ export * from "./message-builder";
3
+ export { parseAnthropicTokenLimitError, parseTokenLimitError } from "./parser";
4
+ export type { AnthropicContextWindowLimitRecoveryOptions, ContextWindowLimitRecoveryOptions } from "./recovery-hook";
5
+ export { createAnthropicContextWindowLimitRecoveryHook, createContextWindowLimitRecoveryHook } from "./recovery-hook";
6
+ export * from "./recovery-strategy";
7
+ export * from "./state";
8
+ export type { AutoCompactState, ParsedTokenLimitError, TruncateState } from "./types";
@@ -0,0 +1,11 @@
1
+ export declare const TOKEN_LIMIT_PATTERNS: RegExp[];
2
+ export declare const TOKEN_LIMIT_KEYWORDS: string[];
3
+ export declare const THINKING_BLOCK_ERROR_PATTERNS: RegExp[];
4
+ export declare const MESSAGE_INDEX_PATTERN: RegExp;
5
+ export declare function extractTokensFromMessage(message: string): {
6
+ current: number;
7
+ max: number;
8
+ } | null;
9
+ export declare function extractMessageIndex(text: string): number | undefined;
10
+ export declare function isThinkingBlockError(text: string): boolean;
11
+ export declare function isTokenLimitError(text: string): boolean;
@@ -0,0 +1,15 @@
1
+ import type { ParsedTokenLimitError } from "./types";
2
+ export { extractMessageIndex, extractTokensFromMessage, isThinkingBlockError, isTokenLimitError, MESSAGE_INDEX_PATTERN, THINKING_BLOCK_ERROR_PATTERNS, TOKEN_LIMIT_KEYWORDS, TOKEN_LIMIT_PATTERNS } from "./parser-patterns";
3
+ export interface GenericErrorData {
4
+ type: "error";
5
+ error: {
6
+ type: string;
7
+ message: string;
8
+ };
9
+ request_id?: string;
10
+ }
11
+ /** @deprecated use GenericErrorData */
12
+ export type AnthropicErrorData = GenericErrorData;
13
+ export declare function parseTokenLimitError(err: unknown): ParsedTokenLimitError | null;
14
+ /** @deprecated use parseTokenLimitError */
15
+ export declare const parseAnthropicTokenLimitError: typeof parseTokenLimitError;
@@ -11,3 +11,5 @@ export declare function createAnthropicContextWindowLimitRecoveryHook(ctx: Plugi
11
11
  };
12
12
  }) => Promise<void>;
13
13
  };
14
+ export type ContextWindowLimitRecoveryOptions = AnthropicContextWindowLimitRecoveryOptions;
15
+ export declare const createContextWindowLimitRecoveryHook: typeof createAnthropicContextWindowLimitRecoveryHook;
@@ -0,0 +1,3 @@
1
+ export { truncateUntilTargetTokens } from "./target-token-truncation";
2
+ export type { AggressiveTruncateResult, ToolResultInfo } from "./tool-part-types";
3
+ export { countTruncatedResults, countTruncatedResultsFromSDK, findLargestToolResult, findToolResultsBySize, findToolResultsBySizeFromSDK, getTotalToolOutputSize, getTotalToolOutputSizeFromSDK, TRUNCATION_MESSAGE, truncateToolResult, truncateToolResultAsync, } from "./tool-result-store";