@ccx-agent/opencode-ccx 0.2.10 → 0.2.12

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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ Claude Code solved this with a sophisticated behavioral framework — but it's l
23
23
 
24
24
  ccx extracts the core behavioral principles from Claude Code's prompt architecture and makes them work in OpenCode — with any model, any provider.
25
25
 
26
- It's not a wrapper or a proxy. It's a complete behavioral framework: 8 composable system prompt sections, 5 specialized subagents, 10 runtime hooks that dynamically adapt the agent's behavior every turn.
26
+ It's not a wrapper or a proxy. It's a complete behavioral framework: 8 composable system prompt sections, 4 default subagents (+ optional coordinator), and 10 runtime hooks that dynamically adapt the agent's behavior every turn.
27
27
 
28
28
  **Before ccx:** Agent writes 200 lines, adds 3 helper files, says "done."
29
29
 
@@ -124,15 +124,15 @@ The main agent comes with 8 composable system prompt sections derived from Claud
124
124
  | **output-efficiency** | Lead with the answer, skip filler, report at milestones not continuously |
125
125
  | **environment** | Dynamic workspace context — cwd, git status, platform, shell |
126
126
 
127
- ### 5 Specialized Subagents
127
+ ### Subagents (Claude-like defaults)
128
128
 
129
- | Agent | Mode | Purpose |
130
- |-------|------|---------|
131
- | **ccx-explore** | read-only | Fast codebase search — parallel glob/grep/read across large repos |
132
- | **ccx-plan** | read-only | Software architect — produces step-by-step plans with critical file lists |
133
- | **ccx-verification** | read-only | Adversarial verifier — VERDICT protocol (PASS/FAIL/PARTIAL), runs real commands, catches self-rationalizations |
134
- | **ccx-general-purpose** | read-write | Multi-strategy worker for tasks outside other specialists |
135
- | **ccx-coordinator** | orchestrator | Decomposes complex work into Research, Synthesis, Implementation, Verification across parallel workers |
129
+ | Agent | Mode | Default | Purpose |
130
+ |-------|------|---------|---------|
131
+ | **ccx-explore** | read-only | on | Fast codebase search — parallel glob/grep/read across large repos |
132
+ | **ccx-plan** | read-only | on | Software architect — produces step-by-step plans with critical file lists |
133
+ | **ccx-verification** | read-only | on | Adversarial verifier — VERDICT protocol (PASS/FAIL/PARTIAL), runs real commands, catches self-rationalizations |
134
+ | **ccx-general-purpose** | read-write | on | Multi-strategy worker for tasks outside other specialists |
135
+ | **ccx-coordinator** | orchestrator | off | Decomposes complex work into Research, Synthesis, Implementation, Verification across parallel workers. Tool surface is restricted to `task` + `question` |
136
136
 
137
137
  ### 10 Runtime Hooks
138
138
 
@@ -142,7 +142,7 @@ ccx uses every major hook point in the OpenCode plugin API to dynamically shape
142
142
 
143
143
  | Hook | What it does |
144
144
  |------|-------------|
145
- | **config** | Registers the ccx agent + 5 subagents with their system prompts and tool restrictions |
145
+ | **config** | Registers the ccx agent + enabled subagents (coordinator is opt-in) with their system prompts and tool restrictions |
146
146
  | **tool** | Creates agent dispatch tools for the subagent registry |
147
147
 
148
148
  #### Per-Turn Hooks (every LLM call)
@@ -153,7 +153,7 @@ ccx uses every major hook point in the OpenCode plugin API to dynamically shape
153
153
  | **chat.params** | Tunes temperature/topP per agent — low for plan/verification (precision), higher for explore (creativity) |
154
154
  | **experimental.chat.system.transform** | Dynamically injects project instructions (CLAUDE.md), session context (edited files list), and verification reminders into the system prompt |
155
155
  | **tool.definition** | Appends safety rules to bash/edit/write tool descriptions, usage hints to glob/grep/read |
156
- | **experimental.chat.messages.transform** | Trims long tool outputs (>8KB), collapses consecutive reasoning parts to save context |
156
+ | **experimental.chat.messages.transform** | Automatically microcompacts older clearable tool outputs (keeps recent 5), trims long tool outputs (>8KB), collapses consecutive reasoning parts to save context |
157
157
 
158
158
  #### Event Hooks (reactive)
159
159
 
@@ -174,11 +174,14 @@ ccx was built by studying Claude Code's prompt architecture and adapting its cor
174
174
  | Claude Code Feature | ccx Implementation |
175
175
  |--------------------|--------------------|
176
176
  | 8-section system prompt | 8 composable prompt sections, near-identical content |
177
- | 5 subagent types (explore, plan, verify, general, coordinator) | Same 5 agents with equivalent prompts |
178
- | Verification contract (3+ file edits → mandatory review) | Dynamic system prompt injection |
177
+ | Agent orchestration guidance | Same guidance style: use specialized subagents when appropriate, avoid overuse, avoid duplicate delegated work |
178
+ | Explore escalation threshold | `explore_min_queries=3` default (matches Claude CLI external default) |
179
+ | Coordinator default | Disabled by default, opt-in via config |
180
+ | Verification contract | Configurable. Strict contract is opt-in (`verification.enforce_contract=true`) |
179
181
  | VERDICT protocol (PASS/FAIL/PARTIAL) | Identical format and adversarial strategies |
180
182
  | Project instructions (CLAUDE.md) | Auto-loaded from CLAUDE.md / .claude/instructions.md / AGENTS.md |
181
183
  | Tool safety hints | `tool.definition` hook appends rules to bash/edit/write descriptions |
184
+ | Tool-output microcompact | Older `read/grep/glob/bash/webfetch` results are compacted automatically while preserving recent outputs |
182
185
  | Context compaction preservation | Custom compaction prompt via `experimental.session.compacting` |
183
186
  | Trust boundary / prompt injection defense | Explicit section in system prompt |
184
187
 
@@ -193,6 +196,19 @@ ccx was built by studying Claude Code's prompt architecture and adapting its cor
193
196
  | Plan mode with user approval gate | Requires TUI integration (experimental) |
194
197
  | AST-level bash command analysis | Possible but high complexity cost |
195
198
 
199
+ ### Workflow parity summary (current defaults)
200
+
201
+ With the default ccx config shown below, workflow behavior is aligned to Claude CLI's external/default orchestration style:
202
+
203
+ - subagents are used when needed, not by default for every task
204
+ - broad exploration escalates after directed search becomes insufficient (`explore_min_queries=3`)
205
+ - coordinator-style multi-hop orchestration is off by default
206
+ - recursive subagent delegation is discouraged by default
207
+ - strict mandatory verification contract is off by default (opt-in)
208
+ - when enabled, coordinator runs orchestration-only with a constrained tool surface (`task` + `question`)
209
+
210
+ This is behavior-level parity, not engine-level identity. Engine internals (runtime schedulers, fork execution model, feature-flag infrastructure) are different and remain outside plugin scope.
211
+
196
212
  ---
197
213
 
198
214
  ## The Verification Agent
@@ -251,7 +267,21 @@ or `FAIL` with reproduction steps, or `PARTIAL` with what couldn't be verified a
251
267
 
252
268
  ## Configuration
253
269
 
254
- Create `~/.config/opencode/ccx.json` (global) or `.opencode/ccx.json` (project-level):
270
+ Config is loaded in this order (first hit wins):
271
+
272
+ 1. `.opencode/ccx.json` (project-level)
273
+ 2. `~/.config/opencode/ccx.json` (global)
274
+ 3. built-in defaults
275
+
276
+ Notes:
277
+ - The config loader supports JSON with comments (`//` and `/* ... */`).
278
+ - Project config overrides global config (it does not deep-merge both files).
279
+
280
+ Create one of the following files:
281
+ - `.opencode/ccx.json` (project-level)
282
+ - `~/.config/opencode/ccx.json` (global)
283
+
284
+ Example:
255
285
 
256
286
  ```json
257
287
  {
@@ -260,8 +290,18 @@ Create `~/.config/opencode/ccx.json` (global) or `.opencode/ccx.json` (project-l
260
290
  "disabled_hooks": [],
261
291
  "output_style": null,
262
292
  "verification": {
263
- "auto_remind": true,
264
- "min_file_edits": 3
293
+ "auto_remind": false,
294
+ "enforce_contract": false,
295
+ "min_file_edits": 3,
296
+ "spot_check_min_commands": 2
297
+ },
298
+ "risk_guard": {
299
+ "enforce_high_risk_confirmation": true
300
+ },
301
+ "subagent_orchestration": {
302
+ "explore_min_queries": 3,
303
+ "coordinator_enabled": false,
304
+ "allow_subagent_delegation": false
265
305
  }
266
306
  }
267
307
  ```
@@ -272,8 +312,14 @@ Create `~/.config/opencode/ccx.json` (global) or `.opencode/ccx.json` (project-l
272
312
  | `disabled_sections` | `string[]` | `[]` | Prompt sections to skip (e.g., `["tone-style"]`) |
273
313
  | `disabled_hooks` | `string[]` | `[]` | Hooks to disable (e.g., `["risk-guard"]`) |
274
314
  | `output_style` | `string \| null` | `null` | Custom output style name |
275
- | `verification.auto_remind` | `boolean` | `true` | Auto-nudge verification after edits |
315
+ | `verification.auto_remind` | `boolean` | `false` | Auto-nudge verification after edits |
316
+ | `verification.enforce_contract` | `boolean` | `false` | Enable strict verification contract wording and reminder logic |
276
317
  | `verification.min_file_edits` | `number` | `3` | File edit threshold before nudge |
318
+ | `verification.spot_check_min_commands` | `number` | `2` | Minimum verifier commands to re-run after PASS spot-check |
319
+ | `risk_guard.enforce_high_risk_confirmation` | `boolean` | `true` | Block high-risk commands unless explicit user confirmation is present |
320
+ | `subagent_orchestration.explore_min_queries` | `number` | `3` | Escalate to `ccx-explore` when directed lookup likely needs more than this query count |
321
+ | `subagent_orchestration.coordinator_enabled` | `boolean` | `false` | Register and advertise `ccx-coordinator` subagent |
322
+ | `subagent_orchestration.allow_subagent_delegation` | `boolean` | `false` | Permit subagents to delegate further. When `false`, runtime recursion guard blocks nested `task` delegation from `ccx-*` subagents unless explicit delegation-approval metadata is present |
277
323
 
278
324
  ---
279
325
 
@@ -2,6 +2,7 @@ export type AgentDefinition = {
2
2
  name: string;
3
3
  description: string;
4
4
  getSystemPrompt: () => string;
5
+ allowedTools?: string[];
5
6
  disallowedTools?: string[];
6
7
  readOnly?: boolean;
7
8
  };
@@ -6,7 +6,17 @@ export declare const configSchema: z.ZodObject<{
6
6
  output_style: z.ZodDefault<z.ZodNullable<z.ZodString>>;
7
7
  verification: z.ZodDefault<z.ZodObject<{
8
8
  auto_remind: z.ZodDefault<z.ZodBoolean>;
9
+ enforce_contract: z.ZodDefault<z.ZodBoolean>;
9
10
  min_file_edits: z.ZodDefault<z.ZodInt>;
11
+ spot_check_min_commands: z.ZodDefault<z.ZodInt>;
12
+ }, z.core.$strip>>;
13
+ risk_guard: z.ZodDefault<z.ZodObject<{
14
+ enforce_high_risk_confirmation: z.ZodDefault<z.ZodBoolean>;
15
+ }, z.core.$strip>>;
16
+ subagent_orchestration: z.ZodDefault<z.ZodObject<{
17
+ explore_min_queries: z.ZodDefault<z.ZodInt>;
18
+ coordinator_enabled: z.ZodDefault<z.ZodBoolean>;
19
+ allow_subagent_delegation: z.ZodDefault<z.ZodBoolean>;
10
20
  }, z.core.$strip>>;
11
21
  }, z.core.$strip>;
12
22
  export type OhMyCCAgentConfig = z.infer<typeof configSchema>;
@@ -16,5 +16,6 @@ type ChatMessageOutput = {
16
16
  [key: string]: unknown;
17
17
  }>;
18
18
  };
19
+ export declare function getSessionAgent(sessionID: string): string | undefined;
19
20
  export declare function createChatMessageHook(_config: OhMyCCAgentConfig): (input: ChatMessageInput, _output: ChatMessageOutput) => Promise<void>;
20
21
  export {};
@@ -11,7 +11,6 @@ type MessageInfo = {
11
11
  [key: string]: unknown;
12
12
  }>;
13
13
  };
14
- export declare function enableMicrocompact(): void;
15
14
  export declare function createMessageTransformHook(): (_input: Record<string, unknown>, output: {
16
15
  messages: MessageInfo[];
17
16
  }) => Promise<void>;
@@ -1 +1,2 @@
1
- export declare function createRiskGuard(): (input: unknown, output: unknown) => Promise<void>;
1
+ import type { OhMyCCAgentConfig } from "../config/schema";
2
+ export declare function createRiskGuard(config: OhMyCCAgentConfig): (input: unknown, output: unknown) => Promise<void>;
package/dist/index.js CHANGED
@@ -13553,8 +13553,18 @@ function date4(params) {
13553
13553
  config(en_default());
13554
13554
  // src/config/schema.ts
13555
13555
  var verificationSchema = exports_external.object({
13556
- auto_remind: exports_external.boolean().default(true),
13557
- min_file_edits: exports_external.int().nonnegative().default(3)
13556
+ auto_remind: exports_external.boolean().default(false),
13557
+ enforce_contract: exports_external.boolean().default(false),
13558
+ min_file_edits: exports_external.int().nonnegative().default(3),
13559
+ spot_check_min_commands: exports_external.int().positive().default(2)
13560
+ });
13561
+ var riskGuardSchema = exports_external.object({
13562
+ enforce_high_risk_confirmation: exports_external.boolean().default(true)
13563
+ });
13564
+ var subagentOrchestrationSchema = exports_external.object({
13565
+ explore_min_queries: exports_external.int().positive().default(3),
13566
+ coordinator_enabled: exports_external.boolean().default(false),
13567
+ allow_subagent_delegation: exports_external.boolean().default(false)
13558
13568
  });
13559
13569
  var configSchema = exports_external.object({
13560
13570
  enabled: exports_external.boolean().default(true),
@@ -13562,8 +13572,18 @@ var configSchema = exports_external.object({
13562
13572
  disabled_hooks: exports_external.array(exports_external.string()).default([]),
13563
13573
  output_style: exports_external.string().min(1).nullable().default(null),
13564
13574
  verification: verificationSchema.default({
13565
- auto_remind: true,
13566
- min_file_edits: 3
13575
+ auto_remind: false,
13576
+ enforce_contract: false,
13577
+ min_file_edits: 3,
13578
+ spot_check_min_commands: 2
13579
+ }),
13580
+ risk_guard: riskGuardSchema.default({
13581
+ enforce_high_risk_confirmation: true
13582
+ }),
13583
+ subagent_orchestration: subagentOrchestrationSchema.default({
13584
+ explore_min_queries: 3,
13585
+ coordinator_enabled: false,
13586
+ allow_subagent_delegation: false
13567
13587
  })
13568
13588
  });
13569
13589
 
@@ -13639,6 +13659,10 @@ function loadConfig(directory) {
13639
13659
  }
13640
13660
 
13641
13661
  // src/hooks/chat-message.ts
13662
+ var sessionAgentById = new Map;
13663
+ function getSessionAgent(sessionID) {
13664
+ return sessionAgentById.get(sessionID);
13665
+ }
13642
13666
  function createChatMessageHook(_config) {
13643
13667
  return async (input, _output) => {
13644
13668
  if (!_config.enabled)
@@ -13646,6 +13670,9 @@ function createChatMessageHook(_config) {
13646
13670
  const { sessionID, agent } = input;
13647
13671
  if (!sessionID)
13648
13672
  return;
13673
+ if (agent) {
13674
+ sessionAgentById.set(sessionID, agent);
13675
+ }
13649
13676
  if (agent && !agent.startsWith("ccx"))
13650
13677
  return;
13651
13678
  };
@@ -13967,6 +13994,7 @@ Tool usage:
13967
13994
  - "Read" \u2014 when you already know the exact path to examine
13968
13995
  - "Bash" \u2014 permitted only for non-mutating operations (ls, git status, git log, git diff, find, grep, cat, head, tail)
13969
13996
  - "Bash" is off-limits for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or anything that creates or alters files
13997
+ - Execute the assigned search directly. Delegate again only when the caller explicitly asks for delegation or your instructions explicitly permit it
13970
13998
  - Calibrate your search depth according to the thoroughness level the caller requests
13971
13999
  - Deliver your findings as a direct text response \u2014 never try to write results to a file
13972
14000
 
@@ -14012,8 +14040,9 @@ You will receive a set of requirements and potentially a guiding perspective on
14012
14040
  - Map the current system structure
14013
14041
  - Locate analogous features that can serve as templates
14014
14042
  - Walk through the relevant execution flows
14015
- - "Bash" is allowed exclusively for non-mutating commands (ls, git status, git log, git diff, find, grep, cat, head, tail)
14016
- - "Bash" is off-limits for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or anything that creates or modifies files
14043
+ - "Bash" is allowed exclusively for non-mutating commands (ls, git status, git log, git diff, find, grep, cat, head, tail)
14044
+ - "Bash" is off-limits for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or anything that creates or modifies files
14045
+ - Execute planning work directly. Delegate again only when the caller explicitly asks for delegation or your instructions explicitly permit it
14017
14046
 
14018
14047
  3. **Architect the Solution**:
14019
14048
  - Formulate an implementation strategy aligned with your assigned perspective
@@ -14058,7 +14087,8 @@ Operating principles:
14058
14087
  - When analyzing: begin with broad searches, then zoom in. If one search strategy comes up empty, try a different angle.
14059
14088
  - Be comprehensive: inspect multiple directories, account for alternative naming styles, and look for related modules.
14060
14089
  - NEVER generate new files unless the task strictly demands it. ALWAYS modify an existing file rather than creating a fresh one.
14061
- - NEVER spontaneously produce documentation files (*.md) or README files. Only generate documentation when the user explicitly asks for it.`;
14090
+ - NEVER spontaneously produce documentation files (*.md) or README files. Only generate documentation when the user explicitly asks for it.
14091
+ - If you are running as a subagent, execute directly. Delegate again only when the caller explicitly asks for delegation or your instructions explicitly permit it.`;
14062
14092
  function getGeneralPurposeAgentPrompt() {
14063
14093
  return `${SHARED_PREFIX} Once finished, provide a brief summary of what was accomplished and any notable discoveries \u2014 this will be relayed to the user, so focus on the essential takeaways.
14064
14094
 
@@ -14086,6 +14116,8 @@ You ARE permitted to write throwaway test harnesses to a temporary directory (/t
14086
14116
 
14087
14117
  Inspect what tools are actually available in your session rather than making assumptions. You may have access to browser automation, HTTP fetching, or additional MCP capabilities \u2014 do not neglect tools you failed to check for.
14088
14118
 
14119
+ Execute verification directly in this session. Delegate again only when the caller explicitly asks for delegation or your instructions explicitly permit it.
14120
+
14089
14121
  === WHAT YOU RECEIVE ===
14090
14122
  You will be given: the original task specification, the list of changed files, the implementation approach, and optionally a path to a plan or spec document.
14091
14123
 
@@ -14341,29 +14373,48 @@ When a worker reports failure:
14341
14373
 
14342
14374
  - Reserve direct answers for simple questions that need no tool invocation.
14343
14375
  - For substantial engineering work, operate through workers.
14376
+ - Do not spawn additional coordinator agents. Keep delegation chains shallow and route work to execution-focused workers.
14344
14377
  - Do not assign one worker to monitor another worker.
14345
14378
  - Do not speculate about results that have not yet arrived.
14346
14379
  - After dispatching workers, inform the user what was launched and what remains pending.
14347
14380
  - Digest findings before assigning follow-up work.
14348
14381
  - Never implement directly when delegation is an option.
14349
14382
 
14383
+ ## Tool Surface (Enforced)
14384
+
14385
+ - Your tool surface is intentionally narrow: use 1) the \`task\` tool to delegate work, and 2) the \`question\` tool only when user input is strictly required.
14386
+ - Do not execute implementation tools directly (Bash/Read/Edit/Write/Glob/Grep/etc.) from coordinator mode.
14387
+
14350
14388
  Your operating loop is: comprehend -> decompose -> delegate -> digest -> delegate next phase -> verify -> report.`;
14351
14389
  }
14352
14390
  var COORDINATOR_AGENT_DEFINITION = {
14353
14391
  name: "coordinator",
14354
14392
  description: "Task orchestration agent for complex engineering work. Deploy this when a request should be decomposed into research, implementation, and verification phases distributed across multiple worker agents rather than executed by a single agent.",
14355
- getSystemPrompt: getCoordinatorAgentPrompt
14393
+ getSystemPrompt: getCoordinatorAgentPrompt,
14394
+ allowedTools: ["task", "question"]
14356
14395
  };
14357
14396
 
14358
14397
  // src/hooks/config-handler.ts
14359
- var SUBAGENT_DEFINITIONS = [
14398
+ var BASE_SUBAGENT_DEFINITIONS = [
14360
14399
  EXPLORE_AGENT_DEFINITION,
14361
14400
  PLAN_AGENT_DEFINITION,
14362
14401
  GENERAL_PURPOSE_AGENT_DEFINITION,
14363
- VERIFICATION_AGENT_DEFINITION,
14364
- COORDINATOR_AGENT_DEFINITION
14402
+ VERIFICATION_AGENT_DEFINITION
14365
14403
  ];
14404
+ function getEnabledSubagentDefinitions(config2) {
14405
+ if (config2.subagent_orchestration.coordinator_enabled) {
14406
+ return [...BASE_SUBAGENT_DEFINITIONS, COORDINATOR_AGENT_DEFINITION];
14407
+ }
14408
+ return BASE_SUBAGENT_DEFINITIONS;
14409
+ }
14366
14410
  function buildToolRestrictions(def) {
14411
+ if (def.allowedTools && def.allowedTools.length > 0) {
14412
+ const tools2 = { "*": false };
14413
+ for (const tool of def.allowedTools) {
14414
+ tools2[tool.toLowerCase()] = true;
14415
+ }
14416
+ return tools2;
14417
+ }
14367
14418
  if (!def.disallowedTools || def.disallowedTools.length === 0)
14368
14419
  return;
14369
14420
  const tools = { "*": true };
@@ -14372,41 +14423,60 @@ function buildToolRestrictions(def) {
14372
14423
  }
14373
14424
  return tools;
14374
14425
  }
14375
- function buildSubagentGuidance() {
14376
- const agentList = SUBAGENT_DEFINITIONS.map((def) => `- **ccx-${def.name}**: ${def.description}`).join(`
14426
+ function buildSubagentGuidance(config2) {
14427
+ const exploreMinQueries = config2.subagent_orchestration.explore_min_queries;
14428
+ const spotCheckMinCommands = config2.verification.spot_check_min_commands;
14429
+ const enabledSubagents = getEnabledSubagentDefinitions(config2);
14430
+ const agentList = enabledSubagents.map((def) => `- **ccx-${def.name}**: ${def.description}`).join(`
14377
14431
  `);
14432
+ const whenToUse = [
14433
+ `- Invoke the **task** tool with subagent_type \`ccx-explore\` for wide-ranging codebase exploration or in-depth research. For targeted lookups (a known file, class, or function name), use Glob or Grep directly \u2014 escalate to ccx-explore only when a simple search falls short or when the task clearly requires more than ${exploreMinQueries} queries.`,
14434
+ "- Invoke the **task** tool with subagent_type `ccx-plan` when an implementation strategy should be designed before any code is written. The plan agent examines the codebase in read-only mode and produces a step-by-step approach with key files identified.",
14435
+ "- Invoke the **task** tool with subagent_type `ccx-general-purpose` for multi-step work that does not fall under any other specialist's domain."
14436
+ ];
14437
+ if (config2.subagent_orchestration.coordinator_enabled) {
14438
+ whenToUse.push("- Invoke the **task** tool with subagent_type `ccx-coordinator` for complex tasks best decomposed into research, implementation, and verification phases distributed across multiple workers.");
14439
+ }
14440
+ const subagentUsageRules = [
14441
+ "- Subagents excel at running independent queries concurrently and keeping bulky output out of the main context, but avoid overusing them when the work is simple enough to handle directly.",
14442
+ "- Do NOT redo work that a subagent is already performing \u2014 once you delegate a research task, refrain from executing the same searches yourself.",
14443
+ "- When dispatching subagents, inform the user about what was launched and what results you are awaiting.",
14444
+ "- You may launch several subagents concurrently by issuing multiple task tool calls within a single response."
14445
+ ];
14446
+ if (config2.subagent_orchestration.allow_subagent_delegation) {
14447
+ subagentUsageRules.push("- If you are already operating as a subagent, prefer executing directly and keep delegation chains shallow.");
14448
+ } else {
14449
+ subagentUsageRules.push("- If you are already operating as a subagent, execute directly and avoid recursively dispatching more subagents unless the user explicitly requests delegation.");
14450
+ }
14451
+ const verificationSection = config2.verification.enforce_contract ? `## Verification contract
14452
+
14453
+ The rule: whenever non-trivial implementation occurs during your turn, an independent adversarial review must take place before you declare completion \u2014 whether you wrote the code yourself or a subagent did. You are the gatekeeper. Non-trivial is defined as: 3+ file edits, backend/API changes, or infrastructure changes.
14454
+
14455
+ Launch the **task** tool with subagent_type \`ccx-verification\`. Supply the ORIGINAL user task description, the list of changed files, and the approach used. Your own review and commentary do NOT count \u2014 only the verification agent assigns a verdict; you may not self-assign PARTIAL.
14456
+
14457
+ - On **FAIL**: address the reported issue, then resume the verifier session with the failure details plus your correction. Iterate until PASS.
14458
+ - On **PASS**: perform a spot-check \u2014 re-execute at least ${spotCheckMinCommands} commands from the verifier's report and confirm outputs match. If any PASS step lacks a Command run block or the output differs, resume the verifier with the discrepancy.
14459
+ - On **PARTIAL**: communicate what passed and what remained unverifiable due to environment constraints.` : "## Verification guidance\n\nFor significant implementation changes, prefer independent verification with subagent_type `ccx-verification` before reporting completion.";
14378
14460
  return `# Subagent orchestration
14379
14461
 
14380
- The \`task\` tool lets you launch specialized subagents. Leverage them to distribute work in parallel and shield your primary context window from being overwhelmed by verbose output.
14462
+ Use the \`task\` tool with specialized subagents when the current task clearly matches their role. Subagents are useful for parallelizing independent work and protecting the main context window from bulky output, but they should not be used excessively.
14381
14463
 
14382
- Reach for the task tool proactively when the current job aligns with a subagent's specialty. If a subagent's description indicates proactive usage, invoke it on your own initiative rather than waiting for the user to request it.
14464
+ Avoid duplicate work: once a search or investigation is delegated, do not run the same lookups in parallel from the current agent.
14383
14465
 
14384
14466
  ## Available subagents
14385
14467
  ${agentList}
14386
14468
 
14387
14469
  ## When to use subagents
14388
14470
 
14389
- - Invoke the **task** tool with subagent_type \`ccx-explore\` for wide-ranging codebase exploration or in-depth research. For targeted lookups (a known file, class, or function name), use Glob or Grep directly \u2014 escalate to ccx-explore only when a simple search falls short or clearly demands many queries.
14390
- - Invoke the **task** tool with subagent_type \`ccx-plan\` when an implementation strategy should be designed before any code is written. The plan agent examines the codebase in read-only mode and produces a step-by-step approach with key files identified.
14391
- - Invoke the **task** tool with subagent_type \`ccx-general-purpose\` for multi-step work that does not fall under any other specialist's domain.
14392
- - Invoke the **task** tool with subagent_type \`ccx-coordinator\` for complex tasks best decomposed into research, implementation, and verification phases distributed across multiple workers.
14471
+ ${whenToUse.join(`
14472
+ `)}
14393
14473
 
14394
- ## Verification contract
14395
-
14396
- The rule: whenever non-trivial implementation occurs during your turn, an independent adversarial review must take place before you declare completion \u2014 whether you wrote the code yourself or a subagent did. You are the gatekeeper. Non-trivial is defined as: 3+ file edits, backend/API changes, or infrastructure changes.
14397
-
14398
- Launch the **task** tool with subagent_type \`ccx-verification\`. Supply the ORIGINAL user task description, the list of changed files, and the approach used. Your own review and commentary do NOT count \u2014 only the verification agent assigns a verdict; you may not self-assign PARTIAL.
14399
-
14400
- - On **FAIL**: address the reported issue, then resume the verifier session with the failure details plus your correction. Iterate until PASS.
14401
- - On **PASS**: perform a spot-check \u2014 re-execute 2-3 commands from the verifier's report and confirm outputs match. If any PASS step lacks a Command run block or the output differs, resume the verifier with the discrepancy.
14402
- - On **PARTIAL**: communicate what passed and what remained unverifiable due to environment constraints.
14474
+ ${verificationSection}
14403
14475
 
14404
14476
  ## Subagent usage rules
14405
14477
 
14406
- - Subagents excel at running independent queries concurrently and keeping bulky output out of the main context, but avoid overusing them when the work is simple enough to handle directly.
14407
- - Do NOT redo work that a subagent is already performing \u2014 once you delegate a research task, refrain from executing the same searches yourself.
14408
- - When dispatching subagents, inform the user about what was launched and what results you are awaiting.
14409
- - You may launch several subagents concurrently by issuing multiple task tool calls within a single response.`;
14478
+ ${subagentUsageRules.join(`
14479
+ `)}`;
14410
14480
  }
14411
14481
  function createConfigHook(config2, directory) {
14412
14482
  return async (input) => {
@@ -14424,7 +14494,7 @@ function createConfigHook(config2, directory) {
14424
14494
  outputStyle: config2.output_style ?? undefined,
14425
14495
  disabledSectionIDs: config2.disabled_sections
14426
14496
  });
14427
- const subagentGuidance = buildSubagentGuidance();
14497
+ const subagentGuidance = buildSubagentGuidance(config2);
14428
14498
  const mainPrompt = [...systemSections, subagentGuidance].join(`
14429
14499
 
14430
14500
  `);
@@ -14434,8 +14504,9 @@ function createConfigHook(config2, directory) {
14434
14504
  prompt: mainPrompt,
14435
14505
  tools: { "*": true }
14436
14506
  };
14507
+ const enabledSubagents = getEnabledSubagentDefinitions(config2);
14437
14508
  const subagents = {};
14438
- for (const def of SUBAGENT_DEFINITIONS) {
14509
+ for (const def of enabledSubagents) {
14439
14510
  subagents[`ccx-${def.name}`] = {
14440
14511
  description: def.description,
14441
14512
  mode: "subagent",
@@ -14562,7 +14633,7 @@ function getFilePath(value) {
14562
14633
  }
14563
14634
  function createVerificationReminder(config2) {
14564
14635
  return async (input, _output) => {
14565
- if (!config2.verification.auto_remind || !isRecord2(input)) {
14636
+ if (!config2.verification.enforce_contract || !config2.verification.auto_remind || !isRecord2(input)) {
14566
14637
  return;
14567
14638
  }
14568
14639
  const sessionID = typeof input.sessionID === "string" ? input.sessionID : undefined;
@@ -14673,15 +14744,16 @@ Files edited in this session (${editedFilesCount} total): ${editedFiles.join(",
14673
14744
  resolve: () => {
14674
14745
  if (!sessionID)
14675
14746
  return null;
14676
- if (!config2.verification.auto_remind)
14747
+ if (!config2.verification.enforce_contract || !config2.verification.auto_remind)
14677
14748
  return null;
14678
14749
  if (!requiresVerification(sessionID, config2.verification.min_file_edits)) {
14679
14750
  return null;
14680
14751
  }
14681
14752
  const { editedFilesCount } = getVerificationState(sessionID);
14753
+ const spotCheckMinCommands = config2.verification.spot_check_min_commands;
14682
14754
  return `# Verification Reminder
14683
14755
 
14684
- You have edited ${editedFilesCount} files in this session. It is recommended to run verification (via ccx-verification subagent) before declaring the task complete.`;
14756
+ You have edited ${editedFilesCount} files in this session. It is recommended to run verification (via ccx-verification subagent) before declaring the task complete. If verifier returns PASS, you must re-run at least ${spotCheckMinCommands} commands from the verifier report and confirm outputs match before reporting completion.`;
14685
14757
  }
14686
14758
  })
14687
14759
  ];
@@ -14727,6 +14799,71 @@ function createEnvironmentContext(directory) {
14727
14799
  };
14728
14800
  }
14729
14801
 
14802
+ // src/hooks/idle-compaction.ts
14803
+ var sessionStates = new Map;
14804
+ var IDLE_THRESHOLD_MS = 30 * 60 * 1000;
14805
+ var MIN_TURNS_BEFORE_COMPACT = 10;
14806
+ function getIdleState(sessionID) {
14807
+ const existing = sessionStates.get(sessionID);
14808
+ if (existing)
14809
+ return existing;
14810
+ const state = {
14811
+ lastIdleTimestamp: 0,
14812
+ turnCount: 0,
14813
+ compactedAt: 0
14814
+ };
14815
+ sessionStates.set(sessionID, state);
14816
+ return state;
14817
+ }
14818
+ function recordSessionIdle(sessionID) {
14819
+ const state = getIdleState(sessionID);
14820
+ state.lastIdleTimestamp = Date.now();
14821
+ }
14822
+ function recordSessionTurn(sessionID) {
14823
+ getIdleState(sessionID).turnCount++;
14824
+ }
14825
+ function shouldCompactOnReturn(sessionID) {
14826
+ const state = getIdleState(sessionID);
14827
+ if (state.lastIdleTimestamp === 0)
14828
+ return false;
14829
+ if (state.turnCount < MIN_TURNS_BEFORE_COMPACT)
14830
+ return false;
14831
+ const idleDuration = Date.now() - state.lastIdleTimestamp;
14832
+ if (idleDuration < IDLE_THRESHOLD_MS)
14833
+ return false;
14834
+ const turnsSinceCompact = state.turnCount - state.compactedAt;
14835
+ return turnsSinceCompact >= MIN_TURNS_BEFORE_COMPACT;
14836
+ }
14837
+ function markCompacted(sessionID) {
14838
+ const state = getIdleState(sessionID);
14839
+ state.compactedAt = state.turnCount;
14840
+ }
14841
+ function createIdleCompactionHook(config2, client) {
14842
+ const typedClient = client;
14843
+ return {
14844
+ onEvent: async (event) => {
14845
+ if (!config2.enabled)
14846
+ return;
14847
+ if (event.type !== "session.idle")
14848
+ return;
14849
+ const sessionID = event.properties?.sessionID;
14850
+ if (!sessionID)
14851
+ return;
14852
+ recordSessionIdle(sessionID);
14853
+ },
14854
+ onChatMessage: async (sessionID) => {
14855
+ if (!config2.enabled)
14856
+ return;
14857
+ if (!shouldCompactOnReturn(sessionID))
14858
+ return;
14859
+ try {
14860
+ await typedClient.session.summarize({ path: { id: sessionID } });
14861
+ markCompacted(sessionID);
14862
+ } catch {}
14863
+ }
14864
+ };
14865
+ }
14866
+
14730
14867
  // src/hooks/message-transform.ts
14731
14868
  var MAX_TOOL_OUTPUT_LENGTH = 8000;
14732
14869
  var TOOL_OUTPUT_TRIM_TO = 4000;
@@ -14792,96 +14929,44 @@ function collapseConsecutiveReasoningParts(messages) {
14792
14929
  msg.parts = collapsed;
14793
14930
  }
14794
14931
  }
14795
- var microcompactEnabled = false;
14796
- function enableMicrocompact() {
14797
- microcompactEnabled = true;
14798
- }
14799
14932
  function createMessageTransformHook() {
14800
14933
  return async (_input, output) => {
14801
- if (microcompactEnabled) {
14802
- microcompactOldToolOutputs(output.messages);
14803
- microcompactEnabled = false;
14804
- }
14934
+ microcompactOldToolOutputs(output.messages);
14805
14935
  trimLongToolOutputs(output.messages);
14806
14936
  collapseConsecutiveReasoningParts(output.messages);
14807
14937
  };
14808
14938
  }
14809
14939
 
14810
- // src/hooks/idle-compaction.ts
14811
- var sessionStates = new Map;
14812
- var IDLE_THRESHOLD_MS = 30 * 60 * 1000;
14813
- var MIN_TURNS_BEFORE_COMPACT = 10;
14814
- function getIdleState(sessionID) {
14815
- const existing = sessionStates.get(sessionID);
14816
- if (existing)
14817
- return existing;
14818
- const state = {
14819
- lastIdleTimestamp: 0,
14820
- turnCount: 0,
14821
- compactedAt: 0
14822
- };
14823
- sessionStates.set(sessionID, state);
14824
- return state;
14825
- }
14826
- function recordSessionIdle(sessionID) {
14827
- const state = getIdleState(sessionID);
14828
- state.lastIdleTimestamp = Date.now();
14829
- }
14830
- function recordSessionTurn(sessionID) {
14831
- getIdleState(sessionID).turnCount++;
14940
+ // src/hooks/risk-guard.ts
14941
+ var RISK_RULES = [
14942
+ { pattern: /rm\s+-rf\b/i, level: "high", name: "rm-rf" },
14943
+ { pattern: /git\s+push\s+--force(?:-with-lease)?\b/i, level: "high", name: "git-force-push" },
14944
+ { pattern: /git\s+reset\s+--hard\b/i, level: "high", name: "git-hard-reset" },
14945
+ { pattern: /drop\s+table\b/i, level: "high", name: "sql-drop-table" },
14946
+ { pattern: /truncate\s+table\b/i, level: "high", name: "sql-truncate-table" },
14947
+ { pattern: /delete\s+from\b/i, level: "medium", name: "sql-delete" }
14948
+ ];
14949
+ var TASK_LAUNCH_TOOL_NAMES = new Set(["task"]);
14950
+ function isGuardedSubagentName(value) {
14951
+ return typeof value === "string" && value.startsWith("ccx-") && value !== "ccx-coordinator";
14832
14952
  }
14833
- function shouldCompactOnReturn(sessionID) {
14834
- const state = getIdleState(sessionID);
14835
- if (state.lastIdleTimestamp === 0)
14953
+ function hasExplicitDelegationApproval(value) {
14954
+ if (!isRecord4(value))
14836
14955
  return false;
14837
- if (state.turnCount < MIN_TURNS_BEFORE_COMPACT)
14838
- return false;
14839
- const idleDuration = Date.now() - state.lastIdleTimestamp;
14840
- if (idleDuration < IDLE_THRESHOLD_MS)
14956
+ if (value.subagentDelegation === true || value.subagentDelegation === "approved") {
14957
+ return true;
14958
+ }
14959
+ if (value.allow_subagent_delegation === true || value.allowSubagentDelegation === true) {
14960
+ return true;
14961
+ }
14962
+ if (value.ccx_subagent_delegation === true || value.ccxSubagentDelegation === true) {
14963
+ return true;
14964
+ }
14965
+ const metadata = isRecord4(value.metadata) ? value.metadata : undefined;
14966
+ if (!metadata)
14841
14967
  return false;
14842
- const turnsSinceCompact = state.turnCount - state.compactedAt;
14843
- return turnsSinceCompact >= MIN_TURNS_BEFORE_COMPACT;
14844
- }
14845
- function markCompacted(sessionID) {
14846
- const state = getIdleState(sessionID);
14847
- state.compactedAt = state.turnCount;
14848
- }
14849
- function createIdleCompactionHook(config2, client) {
14850
- const typedClient = client;
14851
- return {
14852
- onEvent: async (event) => {
14853
- if (!config2.enabled)
14854
- return;
14855
- if (event.type !== "session.idle")
14856
- return;
14857
- const sessionID = event.properties?.sessionID;
14858
- if (!sessionID)
14859
- return;
14860
- recordSessionIdle(sessionID);
14861
- },
14862
- onChatMessage: async (sessionID) => {
14863
- if (!config2.enabled)
14864
- return;
14865
- if (!shouldCompactOnReturn(sessionID))
14866
- return;
14867
- enableMicrocompact();
14868
- try {
14869
- await typedClient.session.summarize({ path: { id: sessionID } });
14870
- markCompacted(sessionID);
14871
- } catch {}
14872
- }
14873
- };
14968
+ return metadata.subagentDelegation === true || metadata.subagentDelegation === "approved" || metadata.allow_subagent_delegation === true || metadata.allowSubagentDelegation === true || metadata.ccx_subagent_delegation === true || metadata.ccxSubagentDelegation === true;
14874
14969
  }
14875
-
14876
- // src/hooks/risk-guard.ts
14877
- var RISK_PATTERNS = [
14878
- /rm\s+-rf\b/i,
14879
- /git\s+push\s+--force(?:-with-lease)?\b/i,
14880
- /git\s+reset\s+--hard\b/i,
14881
- /drop\s+table\b/i,
14882
- /truncate\s+table\b/i,
14883
- /delete\s+from\b/i
14884
- ];
14885
14970
  function isRecord4(value) {
14886
14971
  return typeof value === "object" && value !== null;
14887
14972
  }
@@ -14897,24 +14982,62 @@ function collectRiskText(value) {
14897
14982
  }
14898
14983
  return [];
14899
14984
  }
14900
- function createRiskGuard() {
14985
+ function hasExplicitUserConfirmation(value) {
14986
+ if (!isRecord4(value))
14987
+ return false;
14988
+ const metadata = isRecord4(value.metadata) ? value.metadata : undefined;
14989
+ if (!metadata)
14990
+ return false;
14991
+ const confirmation = metadata.riskConfirmation;
14992
+ return confirmation === true || confirmation === "approved";
14993
+ }
14994
+ function createRiskGuard(config2) {
14901
14995
  return async (input, output) => {
14902
14996
  if (!isRecord4(output)) {
14903
14997
  return;
14904
14998
  }
14999
+ const toolName = isRecord4(input) && typeof input.tool === "string" ? input.tool.toLowerCase() : "";
15000
+ if (!config2.subagent_orchestration.allow_subagent_delegation && TASK_LAUNCH_TOOL_NAMES.has(toolName)) {
15001
+ const sessionID = isRecord4(input) && typeof input.sessionID === "string" ? input.sessionID : undefined;
15002
+ const directAgent = isRecord4(input) && typeof input.agent === "string" ? input.agent : undefined;
15003
+ const currentAgent = directAgent ?? (sessionID ? getSessionAgent(sessionID) : undefined);
15004
+ const approved = hasExplicitDelegationApproval(input) || hasExplicitDelegationApproval(output.args);
15005
+ if (isGuardedSubagentName(currentAgent) && !approved) {
15006
+ output.blocked = true;
15007
+ output.warning = "Nested subagent delegation is blocked by runtime policy. Execute directly in the current subagent, or provide explicit delegation approval metadata.";
15008
+ const metadata2 = isRecord4(output.metadata) ? output.metadata : {};
15009
+ metadata2.subagentRecursionGuard = {
15010
+ flagged: true,
15011
+ blocked: true,
15012
+ tool: toolName,
15013
+ agent: currentAgent,
15014
+ reason: "nested-subagent-delegation-blocked"
15015
+ };
15016
+ output.metadata = metadata2;
15017
+ return;
15018
+ }
15019
+ }
14905
15020
  const argsText = collectRiskText(output.args).join(`
14906
15021
  `);
14907
- const matchedPattern = RISK_PATTERNS.find((pattern) => pattern.test(argsText));
14908
- if (!matchedPattern) {
15022
+ const matchedRule = RISK_RULES.find((rule) => rule.pattern.test(argsText));
15023
+ if (!matchedRule) {
14909
15024
  return;
14910
15025
  }
14911
- const toolName = isRecord4(input) && typeof input.tool === "string" ? input.tool : "tool";
14912
- const warning = `Potentially destructive ${toolName} invocation detected. Review arguments carefully before continuing.`;
15026
+ const riskyToolName = isRecord4(input) && typeof input.tool === "string" ? input.tool : "tool";
15027
+ const warning = matchedRule.level === "high" ? `High-risk ${riskyToolName} invocation detected (${matchedRule.name}). Explicit user confirmation is required before execution.` : `Potentially destructive ${riskyToolName} invocation detected (${matchedRule.name}). Review arguments carefully before continuing.`;
15028
+ if (matchedRule.level === "high" && config2.risk_guard.enforce_high_risk_confirmation) {
15029
+ const confirmed = hasExplicitUserConfirmation(input);
15030
+ if (!confirmed) {
15031
+ output.blocked = true;
15032
+ }
15033
+ }
14913
15034
  output.warning = warning;
14914
15035
  const metadata = isRecord4(output.metadata) ? output.metadata : {};
14915
15036
  metadata.riskGuard = {
14916
15037
  flagged: true,
14917
- pattern: matchedPattern.source
15038
+ level: matchedRule.level,
15039
+ pattern: matchedRule.pattern.source,
15040
+ name: matchedRule.name
14918
15041
  };
14919
15042
  output.metadata = metadata;
14920
15043
  };
@@ -27270,13 +27393,18 @@ function tool(input) {
27270
27393
  }
27271
27394
  tool.schema = exports_external2;
27272
27395
  // src/plugin/tool-registry.ts
27273
- var agentDefinitions = [
27274
- COORDINATOR_AGENT_DEFINITION,
27396
+ var BASE_AGENT_DEFINITIONS = [
27275
27397
  EXPLORE_AGENT_DEFINITION,
27276
27398
  PLAN_AGENT_DEFINITION,
27277
27399
  GENERAL_PURPOSE_AGENT_DEFINITION,
27278
27400
  VERIFICATION_AGENT_DEFINITION
27279
27401
  ];
27402
+ function getEnabledAgentDefinitions(config3) {
27403
+ if (config3.subagent_orchestration.coordinator_enabled) {
27404
+ return [...BASE_AGENT_DEFINITIONS, COORDINATOR_AGENT_DEFINITION];
27405
+ }
27406
+ return BASE_AGENT_DEFINITIONS;
27407
+ }
27280
27408
  function createAgentTool(definition) {
27281
27409
  return tool({
27282
27410
  description: definition.description,
@@ -27287,6 +27415,7 @@ function createAgentTool(definition) {
27287
27415
  return [
27288
27416
  `Agent: ${definition.name}`,
27289
27417
  `Read-only: ${definition.readOnly ? "yes" : "no"}`,
27418
+ `Allowed tools: ${(definition.allowedTools ?? []).join(", ") || "all"}`,
27290
27419
  `Disallowed tools: ${(definition.disallowedTools ?? []).join(", ") || "none"}`,
27291
27420
  "System prompt:",
27292
27421
  definition.getSystemPrompt(),
@@ -27298,7 +27427,8 @@ function createAgentTool(definition) {
27298
27427
  }
27299
27428
  });
27300
27429
  }
27301
- function createAgentTools() {
27430
+ function createAgentTools(config3) {
27431
+ const agentDefinitions = getEnabledAgentDefinitions(config3);
27302
27432
  return Object.fromEntries(agentDefinitions.map((definition) => [definition.name, createAgentTool(definition)]));
27303
27433
  }
27304
27434
 
@@ -27306,7 +27436,7 @@ function createAgentTools() {
27306
27436
  function createPluginInterface(args) {
27307
27437
  const { ctx, config: config3 } = args;
27308
27438
  const configHook = createConfigHook(config3, ctx.directory);
27309
- const riskGuard = createRiskGuard();
27439
+ const riskGuard = createRiskGuard(config3);
27310
27440
  const verificationReminder = createVerificationReminder(config3);
27311
27441
  const environmentContext = createEnvironmentContext(ctx.directory);
27312
27442
  const gitContext = createGitContextHook(ctx.directory);
@@ -27319,7 +27449,7 @@ function createPluginInterface(args) {
27319
27449
  const idleCompaction = createIdleCompactionHook(config3, ctx.client);
27320
27450
  return {
27321
27451
  config: configHook,
27322
- tool: createAgentTools(),
27452
+ tool: createAgentTools(config3),
27323
27453
  "tool.execute.before": riskGuard,
27324
27454
  "tool.execute.after": async (input, output) => {
27325
27455
  await verificationReminder(input, output);
@@ -1,3 +1,4 @@
1
1
  import { tool } from "@opencode-ai/plugin";
2
+ import type { OhMyCCAgentConfig } from "../config/schema";
2
3
  export type ToolDefinition = ReturnType<typeof tool>;
3
- export declare function createAgentTools(): Record<string, ToolDefinition>;
4
+ export declare function createAgentTools(config: OhMyCCAgentConfig): Record<string, ToolDefinition>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccx-agent/opencode-ccx",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Production-grade prompt engineering for OpenCode — disciplined coding, risk-aware actions, adversarial verification",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",