Skip to content

Commit 5dba707

Browse files
committed
Fix lint on Codex apply-patch proxy types
1 parent 978c406 commit 5dba707

4 files changed

Lines changed: 19 additions & 15 deletions

File tree

docs/IMPLEMENTATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ Sixteen packages under `src/agent/directors/<id>/` register in `DIRECTOR_REGISTR
161161
5. Primary chat role is Skywalker: `buildChatRole()``createSkywalkerSystemPrompt()`. Product mutation tools (`write_file` / `edit_file` / `delete_file`) live in CORE (and `SKYWALKER_TOOLS`) so they are advertised on the primary without a `tool_search` round-trip. DIY tiny/bounded edits on the parent; spawn build/docs directors for substantial work — a prompt judgment call, not a toolset strip. `PRIMARY_DENIED_PRODUCT_TOOLS` is gone. Shell file-writes stay denied; MCP tools are not re-filtered by a product-write deny list. Optional `writePaths` (when a profile sets it) only gate path-keyed product tools.
162162

163163
**Codex tool proxies.** When the active provider is Codex (`isCodexProviderName`), `createAgentToolset` and `runSubAgent` mount `apply_patch`, `shell`, and `update_plan` stringTools from `createCodexToolProxies`, all forwarding through the same posix `ToolRunner` seam (`runTool`) so permission plugins still apply. `apply_patch` parses the Codex envelope and forwards each op (`write_file` / `delete_file` / `read_file`). `shell` — the native Codex name is `shell`, not `exec_command`, per the pinned base-instructions text quoted in `codex-responses-adapter.ts`'s bridge message — normalizes Codex's `command` (string or `["bash","-lc",script]`-style argv array), `workdir`, and `timeout_ms` onto `run_shell`'s `{command, cwd?, timeout?}` and is gated by `allowShellFromCapabilities` (mirrors `allowDeleteFromCapabilities` against `run_shell`). `update_plan` maps Codex's `plan: [{step, status}]` onto `manage_tasks(action: "create")`; `pending`/`in_progress`/`completed` map to `todo`/`doing`/`done` — `manage_tasks`'s `cancelled` status has no Codex equivalent and is never produced by this proxy. Primary strips `apply_patch` after mount (Corbits DIY stays on `write_file` / `edit_file` / `delete_file`); `shell` and `update_plan` stay on primary (same classification as `run_shell` / `manage_tasks`). Build and docs leaf allowlists (`BUILD_TOOLS` / `DOCS_TOOLS`) include `apply_patch` so Codex workers keep the proxy after the capability filter. `CORE_TOOL_NAMES` does not list it.
164+
164165
6. Shipped directors omit `writePaths`. The optional field is still enforced in the permission gate via ALS identity (`identity-context.ts` + `write-path-policy.ts`) when a plugin/custom profile sets it.
165166
7. Spawn effort: pin > package `modelRole` default (`defaultEffortForDirector`; intern=low; plan/review/orchestrator=high; implement/explore/docs/test=medium) > orchestrator/worker binary > parent inheritance. Optional skills are listed in the identity header for awareness; workers do not mount `use_skill` (guidance is baked into package system prompts). Primary mounts `use_skill` for its own skill list.
166167

src/agent/codex-apply-patch.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ const END_OF_FILE = "*** End of File";
2727

2828
export type HunkLineKind = " " | "-" | "+";
2929

30-
export type PatchHunkLine = {
30+
export interface PatchHunkLine {
3131
kind: HunkLineKind;
3232
text: string;
33-
};
33+
}
3434

35-
export type PatchHunk = {
35+
export interface PatchHunk {
3636
/** Optional text after `@@` (class/method anchor). */
3737
header?: string;
3838
lines: PatchHunkLine[];
3939
endOfFile?: boolean;
40-
};
40+
}
4141

42-
export type PatchAddOp = {
42+
export interface PatchAddOp {
4343
type: "add";
4444
path: string;
4545
/**
@@ -48,25 +48,25 @@ export type PatchAddOp = {
4848
* An Add File with no `+` lines yields `""`.
4949
*/
5050
content: string;
51-
};
51+
}
5252

53-
export type PatchDeleteOp = {
53+
export interface PatchDeleteOp {
5454
type: "delete";
5555
path: string;
56-
};
56+
}
5757

58-
export type PatchUpdateOp = {
58+
export interface PatchUpdateOp {
5959
type: "update";
6060
path: string;
6161
moveTo?: string;
6262
hunks: PatchHunk[];
63-
};
63+
}
6464

6565
export type PatchOp = PatchAddOp | PatchDeleteOp | PatchUpdateOp;
6666

67-
export type ParsedPatch = {
67+
export interface ParsedPatch {
6868
ops: PatchOp[];
69-
};
69+
}
7070

7171
export class CodexApplyPatchError extends Error {
7272
constructor(message: string) {

src/agent/codex-tool-proxies.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
import { DOCS_TOOLS, BUILD_TOOLS } from "./directors/tool-sets.js";
1313
import { applyManageTasks, parseManageTasksArgs, type Task } from "./tasks.js";
1414

15-
type Call = { name: string; args: Record<string, unknown> };
15+
interface Call {
16+
name: string;
17+
args: Record<string, unknown>;
18+
}
1619

1720
// `manage_tasks` is deliberately NOT a branch here: the real posixTools
1821
// registry runTool forwards to has no manage_tasks handler (only

src/agent/codex-tool-proxies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export type CodexRunManageTasks = (
3333
args: Record<string, unknown>,
3434
) => Promise<{ content: string; isError?: boolean }>;
3535

36-
export type CreateCodexToolProxiesOpts = {
36+
export interface CreateCodexToolProxiesOpts {
3737
isCodex: boolean;
3838
runTool: CodexRunTool;
3939
/** Dispatches update_plan's translated manage_tasks(action="create") call. */
@@ -49,7 +49,7 @@ export type CreateCodexToolProxiesOpts = {
4949
* Docs leaves pass false because DOCS_TOOLS omits run_shell.
5050
*/
5151
allowShell?: boolean;
52-
};
52+
}
5353

5454
const ApplyPatchArgs = type({
5555
input: "string>0",

0 commit comments

Comments
 (0)