@trenchwork/coder 1.5.3 → 1.5.4
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.
|
@@ -24,6 +24,8 @@ export declare function setPermissionMode(mode: PermissionMode): void;
|
|
|
24
24
|
/** Advance to the next mode in the cycle and return it (the Shift+Tab action). */
|
|
25
25
|
export declare function cyclePermissionMode(): PermissionMode;
|
|
26
26
|
export declare function isMutatingTool(name: string): boolean;
|
|
27
|
+
/** True when a tool is safe to run in plan mode (cannot mutate the workspace). */
|
|
28
|
+
export declare function isPlanModeReadOnly(name: string): boolean;
|
|
27
29
|
export declare function isEditTool(name: string): boolean;
|
|
28
30
|
/**
|
|
29
31
|
* The error string a tool returns when plan mode forbids it, or null when the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissionMode.d.ts","sourceRoot":"","sources":["../../src/core/permissionMode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,CAAC;AAMhE,wBAAgB,iBAAiB,IAAI,cAAc,CAElD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAE5D;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,IAAI,cAAc,CAGpD;
|
|
1
|
+
{"version":3,"file":"permissionMode.d.ts","sourceRoot":"","sources":["../../src/core/permissionMode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,CAAC;AAMhE,wBAAgB,iBAAiB,IAAI,cAAc,CAElD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAE5D;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,IAAI,cAAc,CAGpD;AA0CD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAED,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,cAAwB,GAAG,qBAAqB,EAAE,CAM3F;AAED,kEAAkE;AAClE,wBAAgB,cAAc,CAAC,IAAI,GAAE,cAAwB,GAAG,MAAM,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,cAAwB,GAAG,MAAM,GAAG,IAAI,CAMlF"}
|
|
@@ -45,9 +45,37 @@ const EDIT_TOOLS = new Set([
|
|
|
45
45
|
'write', 'write_file', 'edit', 'edit_file', 'multiedit', 'multi_edit',
|
|
46
46
|
'delete_file', 'notebookedit', 'notebook_edit',
|
|
47
47
|
]);
|
|
48
|
+
// Plan mode is DENY-BY-DEFAULT: only tools that cannot change the filesystem,
|
|
49
|
+
// the repo, processes, or spawn something that could are allowed; everything
|
|
50
|
+
// else is blocked. This is the safe-by-default inverse of an allowlist of
|
|
51
|
+
// mutators — a tool added later is blocked in plan mode until it's explicitly
|
|
52
|
+
// vetted here as read-only, so plan mode can't silently leak (the old allowlist
|
|
53
|
+
// missed search_replace, the `git` tool, git_smart_commit, git_create_pr,
|
|
54
|
+
// GitRestore, Skill, Agent — all of which could mutate despite "read-only").
|
|
55
|
+
// bash is NOT here: its args can do anything. TodoWrite IS, because writing the
|
|
56
|
+
// plan is the whole point of plan mode. HITL prompts ask the user; they don't
|
|
57
|
+
// touch the workspace.
|
|
58
|
+
const PLAN_MODE_READONLY = new Set([
|
|
59
|
+
// file / code reads
|
|
60
|
+
'read', 'read_file', 'list_files', 'file_exists', 'glob', 'grep', 'search',
|
|
61
|
+
// web reads
|
|
62
|
+
'web_fetch', 'webfetch', 'web_search', 'websearch', 'webextract',
|
|
63
|
+
// planning artifacts
|
|
64
|
+
'todoread', 'todowrite',
|
|
65
|
+
// background / subagent + git reads
|
|
66
|
+
'bashoutput', 'agent_status', 'agent_output', 'agent_list', 'githistory',
|
|
67
|
+
// memory reads
|
|
68
|
+
'memory_load', 'memory_list',
|
|
69
|
+
// misc reads / user interaction
|
|
70
|
+
'list_skills', 'hitl_status', 'hitl_decision', 'hitl_select', 'hitl_yesno', 'hitl_approval',
|
|
71
|
+
]);
|
|
48
72
|
export function isMutatingTool(name) {
|
|
49
73
|
return MUTATING_TOOLS.has((name || '').toLowerCase());
|
|
50
74
|
}
|
|
75
|
+
/** True when a tool is safe to run in plan mode (cannot mutate the workspace). */
|
|
76
|
+
export function isPlanModeReadOnly(name) {
|
|
77
|
+
return PLAN_MODE_READONLY.has((name || '').toLowerCase());
|
|
78
|
+
}
|
|
51
79
|
export function isEditTool(name) {
|
|
52
80
|
return EDIT_TOOLS.has((name || '').toLowerCase());
|
|
53
81
|
}
|
|
@@ -59,7 +87,8 @@ export function isEditTool(name) {
|
|
|
59
87
|
export function planModeBlock(toolName) {
|
|
60
88
|
if (current !== 'plan')
|
|
61
89
|
return null;
|
|
62
|
-
|
|
90
|
+
// Deny-by-default: allow only vetted read-only tools, block everything else.
|
|
91
|
+
if (isPlanModeReadOnly(toolName))
|
|
63
92
|
return null;
|
|
64
93
|
return `Error: ${toolName} is disabled in plan mode (read-only). Investigate without changing anything, then present a concrete plan; the user approves it before any edits or commands run. Press Shift+Tab to leave plan mode.`;
|
|
65
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-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",
|
|
4
4
|
"description": "Claude Code–class Ink TUI agent for DeepSeek v4 Pro (max thought, ultracode always on). Live follow-up queue, Shift+Tab permission modes, colored diffs, adversarial verifier — your keys, no login. Independent; inspired by Project Glasswing.",
|
|
5
5
|
"deepseek": {
|
|
6
6
|
"rulebookSchema": "src/contracts/schemas/agent-rules.schema.json"
|