@ccx-agent/opencode-ccx 0.2.12 → 0.3.2
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 +98 -13
- package/dist/config/schema.d.ts +35 -0
- package/dist/hooks/bash-analyzer.d.ts +13 -0
- package/dist/hooks/bg-tasks.d.ts +29 -0
- package/dist/hooks/context-bundle.d.ts +5 -0
- package/dist/hooks/session-workflows.d.ts +25 -0
- package/dist/hooks/ssrf-guard.d.ts +15 -0
- package/dist/hooks/tool-definition.d.ts +2 -1
- package/dist/index.js +12511 -272
- package/dist/prompts/project-instructions.d.ts +11 -0
- package/dist/prompts/tool-hints.d.ts +9 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ The main agent comes with 8 composable system prompt sections derived from Claud
|
|
|
134
134
|
| **ccx-general-purpose** | read-write | on | Multi-strategy worker for tasks outside other specialists |
|
|
135
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
|
+
### 12 Runtime Hooks
|
|
138
138
|
|
|
139
139
|
ccx uses every major hook point in the OpenCode plugin API to dynamically shape agent behavior:
|
|
140
140
|
|
|
@@ -149,20 +149,33 @@ ccx uses every major hook point in the OpenCode plugin API to dynamically shape
|
|
|
149
149
|
|
|
150
150
|
| Hook | What it does |
|
|
151
151
|
|------|-------------|
|
|
152
|
-
| **chat.message** | Tracks file edits across the session for verification threshold detection |
|
|
152
|
+
| **chat.message** | Tracks file edits across the session for verification threshold detection, and routes inline session-workflow commands (`/ccx-fork`, `/ccx-bg`, `/ccx-fullctx`, `/ccx-bg-status`) |
|
|
153
153
|
| **chat.params** | Tunes temperature/topP per agent — low for plan/verification (precision), higher for explore (creativity) |
|
|
154
|
-
| **experimental.chat.system.transform** | Dynamically injects project instructions (CLAUDE.md), session context (edited files list), and verification reminders into the system prompt |
|
|
155
|
-
| **tool.definition** |
|
|
154
|
+
| **experimental.chat.system.transform** | Dynamically injects project instructions (CLAUDE.md tree, global CCX.md), session context (edited files list), and verification reminders into the system prompt |
|
|
155
|
+
| **tool.definition** | Injects detailed per-tool usage notes, preferred alternatives, parallelism guidance, and safety rules for `bash` / `read` / `edit` / `write` / `glob` / `grep` / `webfetch` / `task` / `todowrite` |
|
|
156
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
|
|
|
160
160
|
| Hook | What it does |
|
|
161
161
|
|------|-------------|
|
|
162
|
-
| **tool.execute.before** | Risk Guard
|
|
162
|
+
| **tool.execute.before** | Three stages: (1) Context-Bundle injects cwd / git snapshot / recently changed files into `task` tool args so subagents share a baseline; (2) SSRF Guard pre-checks `webfetch` URLs against private, link-local, and cloud-metadata ranges (incl. IPv4-mapped IPv6) with async DNS resolution; (3) Risk Guard runs AST-level bash analysis to flag `rm -rf`, critical-path deletion, `find -delete`, pipe-to-shell, `git push --force`, `kubectl delete`, `terraform apply -auto-approve`, SQL `DROP`/`DELETE`-without-WHERE, and other destructive patterns — including wrapper unwrap (`sudo`/`xargs`/`env`) |
|
|
163
163
|
| **tool.execute.after** | Tracks file edits, feeds the dynamic verification reminder system |
|
|
164
164
|
| **experimental.session.compacting** | Customizes context compaction to preserve: original task, implementation plan, edited files, verification status, architectural decisions |
|
|
165
165
|
|
|
166
|
+
#### Session Workflow Commands
|
|
167
|
+
|
|
168
|
+
ccx exposes inline commands inside any chat message. They drive the underlying OpenCode session APIs directly so you can branch, dispatch, and replay work without waiting for the main agent to finish its turn:
|
|
169
|
+
|
|
170
|
+
| Command | Backed by | Purpose |
|
|
171
|
+
|---------|-----------|---------|
|
|
172
|
+
| `/ccx-fork [messageID]` | `POST /session/{id}/fork` | Fork the current session at the latest message (or at an explicit `messageID`) for what-if branching |
|
|
173
|
+
| `/ccx-bg [agent] <prompt>` | `POST /session/{id}/prompt_async` | Queue a background prompt against the current session, optionally targeting a specific agent |
|
|
174
|
+
| `/ccx-fullctx <agent> <prompt>` | `POST /session/{id}/fork` + `POST /session/{id}/prompt_async` | Create a fork-child session that inherits full parent context, then dispatch the subtask asynchronously to the named agent |
|
|
175
|
+
| `/ccx-bg-status [taskID]` | in-memory task registry + `GET /session/{id}/message` | Show recent background tasks, or inspect one task and refresh its running/completed/failed state |
|
|
176
|
+
|
|
177
|
+
All commands are opt-in via `subagent_orchestration.session_workflows.enabled` and the literals are configurable.
|
|
178
|
+
|
|
166
179
|
---
|
|
167
180
|
|
|
168
181
|
## Claude Code Alignment
|
|
@@ -179,8 +192,10 @@ ccx was built by studying Claude Code's prompt architecture and adapting its cor
|
|
|
179
192
|
| Coordinator default | Disabled by default, opt-in via config |
|
|
180
193
|
| Verification contract | Configurable. Strict contract is opt-in (`verification.enforce_contract=true`) |
|
|
181
194
|
| VERDICT protocol (PASS/FAIL/PARTIAL) | Identical format and adversarial strategies |
|
|
182
|
-
| Project instructions (CLAUDE.md) |
|
|
183
|
-
|
|
|
195
|
+
| Project instructions (CLAUDE.md) | Recursive upward discovery from cwd, merging every `CLAUDE.md` / `.claude/instructions.md` / `AGENTS.md` along the path plus a global `~/.config/opencode/ccx/CCX.md` (root-first ordering, budget-capped) |
|
|
196
|
+
| AST-level bash command analysis | Full AST inspection via `bash-parser` with wrapper unwrap (`sudo` / `xargs` / `env`), critical-path detection, `find -delete` / pipe-to-shell / eval-curl / `dd` to block device / `mkfs` / SQL DROP/DELETE-without-WHERE / `git push --force` / `kubectl delete` / `terraform apply -auto-approve` rules, plus user-level allow/block lists |
|
|
197
|
+
| SSRF defense for fetch tools | Pre-flight guard blocking private (10/8, 172.16/12, 192.168/16), CGNAT (100.64/10), link-local (169.254/16), IPv6 ULA (fc00::/7), link-local (fe80::/10), IPv4-mapped IPv6, and non-http(s) schemes; async DNS resolution with 2s timeout |
|
|
198
|
+
| Tool safety hints | `tool.definition` hook injects detailed per-tool usage notes, parallelism rules, git safety protocol, and preferred-alternative guidance for 9 tools (`bash` / `read` / `edit` / `write` / `glob` / `grep` / `webfetch` / `task` / `todowrite`) |
|
|
184
199
|
| Tool-output microcompact | Older `read/grep/glob/bash/webfetch` results are compacted automatically while preserving recent outputs |
|
|
185
200
|
| Context compaction preservation | Custom compaction prompt via `experimental.session.compacting` |
|
|
186
201
|
| Trust boundary / prompt injection defense | Explicit section in system prompt |
|
|
@@ -194,7 +209,6 @@ ccx was built by studying Claude Code's prompt architecture and adapting its cor
|
|
|
194
209
|
| Fork mode (shared prompt cache across subagents) | Engine-level session management |
|
|
195
210
|
| AI-powered safety classifier (YOLO mode) | Would require LLM call in hook, adds latency |
|
|
196
211
|
| Plan mode with user approval gate | Requires TUI integration (experimental) |
|
|
197
|
-
| AST-level bash command analysis | Possible but high complexity cost |
|
|
198
212
|
|
|
199
213
|
### Workflow parity summary (current defaults)
|
|
200
214
|
|
|
@@ -206,6 +220,9 @@ With the default ccx config shown below, workflow behavior is aligned to Claude
|
|
|
206
220
|
- recursive subagent delegation is discouraged by default
|
|
207
221
|
- strict mandatory verification contract is off by default (opt-in)
|
|
208
222
|
- when enabled, coordinator runs orchestration-only with a constrained tool surface (`task` + `question`)
|
|
223
|
+
- every dispatched subagent receives an automatically injected context bundle (cwd / git snapshot / recently changed files) so it starts from the same baseline as the parent
|
|
224
|
+
- inline `/ccx-fork`, `/ccx-bg`, `/ccx-fullctx`, and `/ccx-bg-status` commands let users branch sessions, queue background prompts, dispatch full-context fork subtasks, and inspect async task state
|
|
225
|
+
- bash AST analysis, SSRF pre-flight check, recursive CLAUDE.md discovery, and detailed per-tool hints are on by default and can be toggled per-field in `ccx.json`
|
|
209
226
|
|
|
210
227
|
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
228
|
|
|
@@ -296,12 +313,47 @@ Example:
|
|
|
296
313
|
"spot_check_min_commands": 2
|
|
297
314
|
},
|
|
298
315
|
"risk_guard": {
|
|
299
|
-
"enforce_high_risk_confirmation": true
|
|
316
|
+
"enforce_high_risk_confirmation": true,
|
|
317
|
+
"ast_analysis": true,
|
|
318
|
+
"extra_blocked_commands": [],
|
|
319
|
+
"extra_allowed_commands": []
|
|
320
|
+
},
|
|
321
|
+
"ssrf_guard": {
|
|
322
|
+
"enabled": true,
|
|
323
|
+
"allow_loopback": true,
|
|
324
|
+
"extra_blocked_hosts": [],
|
|
325
|
+
"extra_allowed_hosts": []
|
|
326
|
+
},
|
|
327
|
+
"project_instructions": {
|
|
328
|
+
"enabled": true,
|
|
329
|
+
"recursive": true,
|
|
330
|
+
"global_file": true,
|
|
331
|
+
"max_depth": 8,
|
|
332
|
+
"max_total_bytes": 64000,
|
|
333
|
+
"filenames": ["CLAUDE.md", ".claude/instructions.md", "AGENTS.md"]
|
|
334
|
+
},
|
|
335
|
+
"tool_hints": {
|
|
336
|
+
"enabled": true,
|
|
337
|
+
"disabled_tools": []
|
|
300
338
|
},
|
|
301
339
|
"subagent_orchestration": {
|
|
302
340
|
"explore_min_queries": 3,
|
|
303
341
|
"coordinator_enabled": false,
|
|
304
|
-
"allow_subagent_delegation": false
|
|
342
|
+
"allow_subagent_delegation": false,
|
|
343
|
+
"context_bundle": {
|
|
344
|
+
"enabled": true,
|
|
345
|
+
"include_cwd": true,
|
|
346
|
+
"include_git": true,
|
|
347
|
+
"include_recent_files": true,
|
|
348
|
+
"max_recent_files": 8
|
|
349
|
+
},
|
|
350
|
+
"session_workflows": {
|
|
351
|
+
"enabled": true,
|
|
352
|
+
"fork_command": "/ccx-fork",
|
|
353
|
+
"background_command": "/ccx-bg",
|
|
354
|
+
"full_context_command": "/ccx-fullctx",
|
|
355
|
+
"status_command": "/ccx-bg-status"
|
|
356
|
+
}
|
|
305
357
|
}
|
|
306
358
|
}
|
|
307
359
|
```
|
|
@@ -317,9 +369,34 @@ Example:
|
|
|
317
369
|
| `verification.min_file_edits` | `number` | `3` | File edit threshold before nudge |
|
|
318
370
|
| `verification.spot_check_min_commands` | `number` | `2` | Minimum verifier commands to re-run after PASS spot-check |
|
|
319
371
|
| `risk_guard.enforce_high_risk_confirmation` | `boolean` | `true` | Block high-risk commands unless explicit user confirmation is present |
|
|
372
|
+
| `risk_guard.ast_analysis` | `boolean` | `true` | Run AST-level bash inspection (wrapper unwrap, flag semantics, critical-path detection). Disable to fall back to a narrower inspection of bash-only tool inputs |
|
|
373
|
+
| `risk_guard.extra_blocked_commands` | `string[]` | `[]` | Additional command names always flagged as high-risk (e.g., `["kubectl", "helm"]`) |
|
|
374
|
+
| `risk_guard.extra_allowed_commands` | `string[]` | `[]` | Command names to skip entirely (useful for per-project overrides) |
|
|
375
|
+
| `ssrf_guard.enabled` | `boolean` | `true` | Pre-check `webfetch` URLs and block private/link-local/cloud-metadata targets |
|
|
376
|
+
| `ssrf_guard.allow_loopback` | `boolean` | `true` | Allow `127.0.0.1` / `::1` / `localhost` for local dev servers |
|
|
377
|
+
| `ssrf_guard.extra_blocked_hosts` | `string[]` | `[]` | Hostnames (or IP literals) to always block |
|
|
378
|
+
| `ssrf_guard.extra_allowed_hosts` | `string[]` | `[]` | Hostnames (or IP literals) to allow even if they land in a private range — useful for internal infrastructure the agent legitimately needs to reach |
|
|
379
|
+
| `project_instructions.enabled` | `boolean` | `true` | Load project instruction files (CLAUDE.md / AGENTS.md / etc.) into the system prompt |
|
|
380
|
+
| `project_instructions.recursive` | `boolean` | `true` | Walk upwards from the working directory and merge every instruction file along the way. When `false`, only the current directory is inspected |
|
|
381
|
+
| `project_instructions.global_file` | `boolean` | `true` | Also load `~/.config/opencode/ccx/CCX.md` (or `instructions.md` / `CLAUDE.md` in the same directory) as a user-level preference file |
|
|
382
|
+
| `project_instructions.max_depth` | `number` | `8` | Maximum number of parent directories to scan during recursive discovery |
|
|
383
|
+
| `project_instructions.max_total_bytes` | `number` | `64000` | Total byte budget for the assembled instruction section. Later (more specific) files are prioritized; the tail is truncated when the budget is exceeded |
|
|
384
|
+
| `project_instructions.filenames` | `string[]` | `["CLAUDE.md", ".claude/instructions.md", "AGENTS.md"]` | Filenames to look for at each directory level |
|
|
385
|
+
| `tool_hints.enabled` | `boolean` | `true` | Append detailed per-tool usage notes to tool descriptions at startup |
|
|
386
|
+
| `tool_hints.disabled_tools` | `string[]` | `[]` | Tool names that should receive no hint (e.g., `["bash"]` if you prefer the raw description) |
|
|
320
387
|
| `subagent_orchestration.explore_min_queries` | `number` | `3` | Escalate to `ccx-explore` when directed lookup likely needs more than this query count |
|
|
321
388
|
| `subagent_orchestration.coordinator_enabled` | `boolean` | `false` | Register and advertise `ccx-coordinator` subagent |
|
|
322
389
|
| `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 |
|
|
390
|
+
| `subagent_orchestration.context_bundle.enabled` | `boolean` | `true` | Inject a shared context bundle (cwd, git snapshot, recently changed files) into `task` tool args before execution |
|
|
391
|
+
| `subagent_orchestration.context_bundle.include_cwd` | `boolean` | `true` | Include the working directory in the injected bundle |
|
|
392
|
+
| `subagent_orchestration.context_bundle.include_git` | `boolean` | `true` | Include the per-session git snapshot in the injected bundle |
|
|
393
|
+
| `subagent_orchestration.context_bundle.include_recent_files` | `boolean` | `true` | Include `git ls-files --modified --others` output in the injected bundle |
|
|
394
|
+
| `subagent_orchestration.context_bundle.max_recent_files` | `number` | `8` | Cap the number of recent files included in the bundle |
|
|
395
|
+
| `subagent_orchestration.session_workflows.enabled` | `boolean` | `true` | Enable inline session workflow commands (fork, background, full-context) in user messages |
|
|
396
|
+
| `subagent_orchestration.session_workflows.fork_command` | `string` | `/ccx-fork` | Command literal that triggers `session.fork`. Optional argument: explicit `messageID` to fork at |
|
|
397
|
+
| `subagent_orchestration.session_workflows.background_command` | `string` | `/ccx-bg` | Command literal that triggers `session.promptAsync`. Usage: `/ccx-bg [agent] <prompt>` |
|
|
398
|
+
| `subagent_orchestration.session_workflows.full_context_command` | `string` | `/ccx-fullctx` | Command literal that forks the session and dispatches a full-context subtask via `session.fork` + `session.promptAsync`. Usage: `/ccx-fullctx <agent> <prompt>` |
|
|
399
|
+
| `subagent_orchestration.session_workflows.status_command` | `string` | `/ccx-bg-status` | Command literal that lists background tasks or shows status for one task ID |
|
|
323
400
|
|
|
324
401
|
---
|
|
325
402
|
|
|
@@ -329,11 +406,18 @@ Example:
|
|
|
329
406
|
ccx/
|
|
330
407
|
├── src/
|
|
331
408
|
│ ├── index.ts # Plugin entry — composes everything
|
|
332
|
-
│ ├── prompts/ #
|
|
409
|
+
│ ├── prompts/ # System prompt sections + composer
|
|
410
|
+
│ │ ├── tool-hints.ts # Detailed per-tool usage guidance
|
|
411
|
+
│ │ └── project-instructions.ts # Recursive CLAUDE.md + global CCX.md loader
|
|
333
412
|
│ ├── agents/ # 5 subagent definitions with tailored prompts
|
|
334
|
-
│ ├── hooks/ #
|
|
413
|
+
│ ├── hooks/ # Runtime hooks
|
|
335
414
|
│ │ ├── config-handler.ts # Agent registration
|
|
336
|
-
│ │ ├──
|
|
415
|
+
│ │ ├── bash-analyzer.ts # AST-level bash risk rules
|
|
416
|
+
│ │ ├── risk-guard.ts # Destructive command detection (AST-powered)
|
|
417
|
+
│ │ ├── ssrf-guard.ts # Pre-flight URL/host SSRF check for webfetch
|
|
418
|
+
│ │ ├── context-bundle.ts # Inject cwd/git/recent-files into task tool args
|
|
419
|
+
│ │ ├── session-workflows.ts # /ccx-fork, /ccx-bg, /ccx-fullctx, /ccx-bg-status commands
|
|
420
|
+
│ │ ├── bg-tasks.ts # Background task lifecycle registry
|
|
337
421
|
│ │ ├── verification-reminder.ts # Edit tracking + nudge
|
|
338
422
|
│ │ ├── environment-context.ts # Session environment capture
|
|
339
423
|
│ │ ├── dynamic-system-prompt.ts # Per-turn system prompt injection
|
|
@@ -343,6 +427,7 @@ ccx/
|
|
|
343
427
|
│ │ ├── tool-definition.ts # Tool description enhancement
|
|
344
428
|
│ │ └── message-transform.ts # Message history optimization
|
|
345
429
|
│ ├── config/ # Zod schema + JSONC config loader
|
|
430
|
+
│ ├── types/ # Local .d.ts for untyped dependencies (bash-parser)
|
|
346
431
|
│ └── plugin/ # OpenCode plugin interface + agent tool registry
|
|
347
432
|
├── .github/workflows/
|
|
348
433
|
│ └── publish.yml # Auto-publish to npm on tag push
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -12,11 +12,46 @@ export declare const configSchema: z.ZodObject<{
|
|
|
12
12
|
}, z.core.$strip>>;
|
|
13
13
|
risk_guard: z.ZodDefault<z.ZodObject<{
|
|
14
14
|
enforce_high_risk_confirmation: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
+
ast_analysis: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
+
extra_blocked_commands: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
17
|
+
extra_allowed_commands: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
ssrf_guard: z.ZodDefault<z.ZodObject<{
|
|
20
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
+
allow_loopback: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
+
extra_blocked_hosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
23
|
+
extra_allowed_hosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
project_instructions: z.ZodDefault<z.ZodObject<{
|
|
26
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
+
recursive: z.ZodDefault<z.ZodBoolean>;
|
|
28
|
+
global_file: z.ZodDefault<z.ZodBoolean>;
|
|
29
|
+
max_depth: z.ZodDefault<z.ZodInt>;
|
|
30
|
+
max_total_bytes: z.ZodDefault<z.ZodInt>;
|
|
31
|
+
filenames: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
tool_hints: z.ZodDefault<z.ZodObject<{
|
|
34
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
35
|
+
disabled_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
15
36
|
}, z.core.$strip>>;
|
|
16
37
|
subagent_orchestration: z.ZodDefault<z.ZodObject<{
|
|
17
38
|
explore_min_queries: z.ZodDefault<z.ZodInt>;
|
|
18
39
|
coordinator_enabled: z.ZodDefault<z.ZodBoolean>;
|
|
19
40
|
allow_subagent_delegation: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
context_bundle: z.ZodDefault<z.ZodObject<{
|
|
42
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
43
|
+
include_cwd: z.ZodDefault<z.ZodBoolean>;
|
|
44
|
+
include_git: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
+
include_recent_files: z.ZodDefault<z.ZodBoolean>;
|
|
46
|
+
max_recent_files: z.ZodDefault<z.ZodInt>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
session_workflows: z.ZodDefault<z.ZodObject<{
|
|
49
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
fork_command: z.ZodDefault<z.ZodString>;
|
|
51
|
+
background_command: z.ZodDefault<z.ZodString>;
|
|
52
|
+
full_context_command: z.ZodDefault<z.ZodString>;
|
|
53
|
+
status_command: z.ZodDefault<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
20
55
|
}, z.core.$strip>>;
|
|
21
56
|
}, z.core.$strip>;
|
|
22
57
|
export type OhMyCCAgentConfig = z.infer<typeof configSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RiskLevel = "high" | "medium" | "low";
|
|
2
|
+
export type RiskFinding = {
|
|
3
|
+
level: RiskLevel;
|
|
4
|
+
name: string;
|
|
5
|
+
message: string;
|
|
6
|
+
command: string;
|
|
7
|
+
};
|
|
8
|
+
export type AnalyzerOptions = {
|
|
9
|
+
extraBlockedCommands?: string[];
|
|
10
|
+
extraAllowedCommands?: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare function analyzeBashCommand(source: string, options?: AnalyzerOptions): RiskFinding[];
|
|
13
|
+
export declare function pickHighestFinding(findings: RiskFinding[]): RiskFinding | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type BgTaskStatus = "queued" | "running" | "completed" | "failed";
|
|
2
|
+
export type BgTaskRecord = {
|
|
3
|
+
id: string;
|
|
4
|
+
parentSessionID: string;
|
|
5
|
+
targetSessionID: string;
|
|
6
|
+
requestMessageID: string;
|
|
7
|
+
agent?: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
status: BgTaskStatus;
|
|
10
|
+
createdAt: number;
|
|
11
|
+
startedAt?: number;
|
|
12
|
+
finishedAt?: number;
|
|
13
|
+
error?: string;
|
|
14
|
+
fullContext: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function createBgTask(args: {
|
|
17
|
+
parentSessionID: string;
|
|
18
|
+
targetSessionID: string;
|
|
19
|
+
requestMessageID: string;
|
|
20
|
+
agent?: string;
|
|
21
|
+
prompt: string;
|
|
22
|
+
fullContext: boolean;
|
|
23
|
+
}): BgTaskRecord;
|
|
24
|
+
export declare function markBgTaskRunning(id: string): void;
|
|
25
|
+
export declare function markBgTaskFailed(id: string, error: string): void;
|
|
26
|
+
export declare function markBgTaskCompleted(id: string): void;
|
|
27
|
+
export declare function getBgTask(id: string): BgTaskRecord | undefined;
|
|
28
|
+
export declare function listBgTasksForSession(sessionID: string): BgTaskRecord[];
|
|
29
|
+
export declare function formatBgTaskLine(task: BgTaskRecord): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { OhMyCCAgentConfig } from "../config/schema";
|
|
2
|
+
type ChatMessageInput = {
|
|
3
|
+
sessionID: string;
|
|
4
|
+
agent?: string;
|
|
5
|
+
model?: {
|
|
6
|
+
providerID: string;
|
|
7
|
+
modelID: string;
|
|
8
|
+
};
|
|
9
|
+
messageID?: string;
|
|
10
|
+
};
|
|
11
|
+
type ChatMessageOutput = {
|
|
12
|
+
message: Record<string, unknown>;
|
|
13
|
+
parts: Array<{
|
|
14
|
+
type: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
export declare const FORK_CHILD_MARKER_BEGIN = "<ccx-fork-child>";
|
|
20
|
+
export declare const FORK_CHILD_MARKER_END = "</ccx-fork-child>";
|
|
21
|
+
export declare function createSessionWorkflowsHook(args: {
|
|
22
|
+
config: OhMyCCAgentConfig;
|
|
23
|
+
client: unknown;
|
|
24
|
+
}): (input: ChatMessageInput, output: ChatMessageOutput) => Promise<void>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OhMyCCAgentConfig } from "../config/schema";
|
|
2
|
+
export declare function isBlockedAddress(address: string, allowLoopback: boolean): boolean;
|
|
3
|
+
type UrlInspection = {
|
|
4
|
+
url: string;
|
|
5
|
+
reason: string;
|
|
6
|
+
blocked: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type SsrfGuardOptions = {
|
|
9
|
+
allowLoopback: boolean;
|
|
10
|
+
extraBlockedHosts: Set<string>;
|
|
11
|
+
extraAllowedHosts: Set<string>;
|
|
12
|
+
};
|
|
13
|
+
export declare function inspectUrl(url: string, options: SsrfGuardOptions): Promise<UrlInspection>;
|
|
14
|
+
export declare function createSsrfGuard(config: OhMyCCAgentConfig): (input: unknown, output: unknown) => Promise<void>;
|
|
15
|
+
export {};
|