pantheon-opencode 2.1.1 → 2.1.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.
@@ -183,6 +183,7 @@ export const DEFAULT_BLOCKED_TOOLS: ReadonlySet<string> = new Set([
183
183
  'edit',
184
184
  'write',
185
185
  'bash',
186
+ 'shell',
186
187
  'task',
187
188
  'hashline_edit',
188
189
  // `pantheon_model` writes active-preset.json in BOTH the project and the
@@ -278,13 +279,34 @@ function isDeniedReadPath(candidate: string, target: boolean): boolean {
278
279
  export type GuardPathResolver = (rawPath: string) => GuardPathResolution
279
280
 
280
281
  /**
281
- * Glob expansion is controlled by the host and its symlink-follow behavior is
282
- * not part of this guard's contract. Only exact, non-glob paths are safe to
283
- * preflight; fail closed on glob metacharacters rather than infer the host's
284
- * expansion semantics.
282
+ * File extensions that identify source code or test files. Zeus must delegate
283
+ * source code exploration and search to @apollo.
285
284
  */
286
- function hasGlobMeta(value: string): boolean {
287
- return ['*', '?', '[', ']', '{', '}', '(', ')'].some((meta) => value.includes(meta))
285
+ const CODE_FILE_EXTENSIONS =
286
+ /\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|c|cpp|h|hpp|java|kt|rb|php|swift|cs|scala|vue|svelte)$/i
287
+
288
+ // Glob patterns that Zeus is denied from evaluating.
289
+ // Zeus is the orchestrator and must NOT read source code, tests, or scripts.
290
+ //
291
+ // Denied:
292
+ // - Direct targets into denied code roots (src/, tests/, scripts/)
293
+ // - Path traversal (../, ..)
294
+ // - Source code extensions (.ts, .py, etc.)
295
+ //
296
+ // Allowed:
297
+ // - Project-level metadata and non-code patterns: *, *.json, *.md, **/package.json, docs/**, .pantheon/**, memories/**
298
+ export function isDeniedGlobPattern(pattern: string): boolean {
299
+ const normalized = normalizeGuardPath(pattern)
300
+ if (normalized.startsWith('../') || normalized === '..' || normalized.includes('/../')) {
301
+ return true
302
+ }
303
+ if (isDeniedReadPath(normalized, true)) {
304
+ return true
305
+ }
306
+ if (CODE_FILE_EXTENSIONS.test(normalized)) {
307
+ return true
308
+ }
309
+ return false
288
310
  }
289
311
 
290
312
  /**
@@ -372,10 +394,10 @@ export function zeusReadGuard(
372
394
  if (tool === 'grep' && candidate.target) deny()
373
395
  continue
374
396
  }
375
- // Resolve every direct grep/glob path before any policy decision. Wildcard
376
- // expansion itself cannot be safely preflighted using the host's unknown
377
- // symlink semantics, so Zeus may glob exact paths only.
378
- if (tool === 'glob' && candidate.target && hasGlobMeta(effectivePath)) deny()
397
+ // Resolve every direct grep/glob path before any policy decision.
398
+ // Zeus is allowed to glob project-level metadata and non-code files (*, **/package.json),
399
+ // but denied from globbing code roots (src/, tests/, scripts/) or source code files.
400
+ if (tool === 'glob' && candidate.target && isDeniedGlobPattern(effectivePath)) deny()
379
401
  if (isDeniedReadPath(effectivePath, candidate.target)) deny()
380
402
  }
381
403
  }
@@ -46,6 +46,8 @@
46
46
  * @module pantheon/tools
47
47
  */
48
48
 
49
+ import { exec } from 'node:child_process'
50
+ import { promisify } from 'node:util'
49
51
  import { createCostCommand } from './cost-command.ts'
50
52
  import type { ShadowSink } from './decision-shadow.ts'
51
53
  import { createDeepworkTool } from './deepwork/deepwork-tool.ts'
@@ -476,6 +478,16 @@ const TODOWRITE_INPUT = {
476
478
  },
477
479
  } as const
478
480
 
481
+ let latestSessionTodos: unknown[] = []
482
+
483
+ export function getLatestSessionTodos(): unknown[] {
484
+ return latestSessionTodos
485
+ }
486
+
487
+ export function setLatestSessionTodos(todos: unknown[]): void {
488
+ latestSessionTodos = todos
489
+ }
490
+
479
491
  /** A V2 pass-through `todowrite`: the host stores the tool part in the
480
492
  * transcript, and the TUI todo panel renders the newest completed write. The
481
493
  * tool itself is stateless — the transcript IS the store. */
@@ -487,13 +499,98 @@ const todowriteTool: V2ToolDef = {
487
499
  input: TODOWRITE_INPUT,
488
500
  output: {},
489
501
  execute: async (input) => {
490
- const todos = Array.isArray((input as Record<string, unknown>).todos)
491
- ? (input as Record<string, unknown>).todos
492
- : []
502
+ const rawTodos = (input as Record<string, unknown>).todos
503
+ const todos: unknown[] = Array.isArray(rawTodos) ? (rawTodos as unknown[]) : []
504
+ latestSessionTodos = todos
493
505
  return { ok: true, todos, output: JSON.stringify({ todos }) }
494
506
  },
495
507
  }
496
508
 
509
+ const TODOREAD_INPUT = {
510
+ type: 'object',
511
+ additionalProperties: false,
512
+ properties: {
513
+ status: {
514
+ type: 'string',
515
+ description: 'Optional filter by task status (pending, in_progress, completed, cancelled)',
516
+ },
517
+ },
518
+ } as const
519
+
520
+ /** A V2 `todoread`: returns the newest task list written via `todowrite`. */
521
+ const todoreadTool: V2ToolDef = {
522
+ name: 'todoread',
523
+ description:
524
+ 'Read the active session task checklist. Returns the newest list of tasks written via todowrite.',
525
+ input: TODOREAD_INPUT,
526
+ output: {},
527
+ execute: async (input) => {
528
+ const statusFilter = (input as Record<string, unknown>)?.status
529
+ let todos = latestSessionTodos
530
+ if (typeof statusFilter === 'string' && statusFilter.trim() !== '') {
531
+ todos = todos.filter(
532
+ (t) =>
533
+ typeof t === 'object' &&
534
+ t !== null &&
535
+ (t as Record<string, unknown>).status === statusFilter,
536
+ )
537
+ }
538
+ return {
539
+ ok: true,
540
+ todos,
541
+ output: JSON.stringify({ todos }),
542
+ }
543
+ },
544
+ }
545
+
546
+ const execAsync = promisify(exec)
547
+
548
+ const SHELL_INPUT = {
549
+ type: 'object',
550
+ required: ['command'],
551
+ properties: {
552
+ command: {
553
+ type: 'string',
554
+ description: 'The shell command to execute in the workspace directory',
555
+ },
556
+ },
557
+ } as const
558
+
559
+ /**
560
+ * A V2 fallback shell tool alias. OpenCode registers `bash`, but models frequently
561
+ * attempt to invoke `shell` because of agent permission YAML conventions.
562
+ * This alias ensures terminal commands execute seamlessly without tool-not-found errors.
563
+ */
564
+ const shellTool: V2ToolDef = {
565
+ name: 'shell',
566
+ description: 'Execute a shell command in the workspace directory. Alias for bash execution.',
567
+ input: SHELL_INPUT,
568
+ output: {},
569
+ execute: async (input, context) => {
570
+ const command = String((input as Record<string, unknown>).command ?? '')
571
+ if (!command.trim()) {
572
+ return { output: '', ok: false, error: 'Command cannot be empty' }
573
+ }
574
+ const toolCtx = toolContext(context)
575
+ const cwd = toolCtx.directory || process.cwd()
576
+ try {
577
+ const { stdout, stderr } = await execAsync(command, {
578
+ cwd,
579
+ maxBuffer: 10 * 1024 * 1024,
580
+ shell: '/bin/bash',
581
+ })
582
+ const output = [stdout, stderr].filter(Boolean).join('\n')
583
+ return { output, ok: true }
584
+ } catch (err: unknown) {
585
+ const execError = err as { stdout?: string; stderr?: string; message?: string }
586
+ const output = [execError.stdout, execError.stderr, execError.message]
587
+ .filter(Boolean)
588
+ .join('\n')
589
+ return { output, ok: false, error: output }
590
+ }
591
+ },
592
+ }
593
+
497
594
  export function createV2ToolDefinitions(
498
595
  visionRuntime?: V2VisionRuntime,
499
596
  shadow: V2ToolShadowOptions = {},
@@ -545,6 +642,8 @@ export function createV2ToolDefinitions(
545
642
  }),
546
643
  )
547
644
  definitions.push(todowriteTool)
645
+ definitions.push(todoreadTool)
646
+ definitions.push(shellTool)
548
647
  definitions.push(createV2SkillSearchDefinition())
549
648
  definitions.push(createDeepworkTool())
550
649
  if (visionRuntime) definitions.push(createV2VisionTool(visionRuntime))
@@ -12,6 +12,168 @@ import path4 from "node:path";
12
12
  import { fileURLToPath as fileURLToPath5 } from "node:url";
13
13
  import { define } from "@opencode-ai/plugin/v2/promise";
14
14
 
15
+ // src/pantheon/auto-permissions.ts
16
+ var READ_ONLY_AGENTS = /* @__PURE__ */ new Set(["zeus", "athena", "apollo", "gaia"]);
17
+ var SAFE_DEV_BINARIES = /* @__PURE__ */ new Set([
18
+ "git",
19
+ "npm",
20
+ "npx",
21
+ "node",
22
+ "python",
23
+ "python3",
24
+ "pytest",
25
+ "ruff",
26
+ "cat",
27
+ "ls",
28
+ "mkdir",
29
+ "cp",
30
+ "mv",
31
+ "touch",
32
+ "grep",
33
+ "find",
34
+ "head",
35
+ "tail",
36
+ "diff",
37
+ "echo",
38
+ "which",
39
+ "tar",
40
+ "zip",
41
+ "unzip",
42
+ "curl",
43
+ "jq",
44
+ "sed",
45
+ "awk",
46
+ "biome",
47
+ "tsc",
48
+ "pnpm",
49
+ "yarn",
50
+ "bun",
51
+ "cargo",
52
+ "go",
53
+ "sh",
54
+ "bash"
55
+ ]);
56
+ function autoPermissionsEnabled(env = process.env) {
57
+ const val = (env.PANTHEON_AUTO_PERMISSIONS ?? "").trim().toLowerCase();
58
+ return val !== "off" && val !== "0" && val !== "false";
59
+ }
60
+ function isDangerousCommand(command) {
61
+ const trimmed = command.trim();
62
+ if (!trimmed) return false;
63
+ if (/\bsudo\b/.test(trimmed)) return true;
64
+ if (/\brm\s+(-[a-zA-Z]*r[a-zA-Z]*f|-[a-zA-Z]*f[a-zA-Z]*r|--force)\s+(\/\s*$|\/\*\s*$|~\/?\s*$|\$HOME)/.test(
65
+ trimmed
66
+ ))
67
+ return true;
68
+ if (/(curl|wget)\b.*\|\s*(ba)?sh\b/.test(trimmed)) return true;
69
+ if (/\bmkfs(\.[a-z0-9]+)?\b/.test(trimmed)) return true;
70
+ if (/\bdd\s+if=/.test(trimmed)) return true;
71
+ if (/\bchmod\s+(-[a-zA-Z]*R[a-zA-Z]*\s+)?777\s+\//.test(trimmed)) return true;
72
+ if (/\b(>\s*|\bcp\b.*|\bmv\b.*)\s+\/(etc|boot|sys|proc|root|usr)(\/|$)/.test(trimmed)) return true;
73
+ return false;
74
+ }
75
+ function isSafeDevCommand(command) {
76
+ const trimmed = command.trim();
77
+ if (!trimmed) return false;
78
+ if (isDangerousCommand(trimmed)) return false;
79
+ const segments = trimmed.split(/[|&;]/);
80
+ for (const rawSeg of segments) {
81
+ const seg = rawSeg.trim();
82
+ if (!seg) continue;
83
+ const tokens = seg.split(/\s+/).filter(Boolean);
84
+ let binary = tokens[0] ?? "";
85
+ let tokenIdx = 0;
86
+ while (binary.includes("=") && tokenIdx < tokens.length - 1) {
87
+ tokenIdx += 1;
88
+ binary = tokens[tokenIdx] ?? "";
89
+ }
90
+ const cleanBinary = binary.replace(/^.*\//, "");
91
+ if (!SAFE_DEV_BINARIES.has(cleanBinary)) {
92
+ return false;
93
+ }
94
+ }
95
+ return true;
96
+ }
97
+ function isUnconstrainedTestSuite(command) {
98
+ const trimmed = command.trim();
99
+ if (!trimmed) return false;
100
+ if (/^(npm|pnpm|yarn|bun)\s+(run\s+)?(test|test:all)(\s+--)?\s*$/.test(trimmed)) {
101
+ return true;
102
+ }
103
+ if (/^(python3?\s+-m\s+)?pytest\s*$/.test(trimmed)) {
104
+ return true;
105
+ }
106
+ if (/^(npx\s+)?(vitest|jest)(\s+run)?\s*$/.test(trimmed)) {
107
+ return true;
108
+ }
109
+ if (/^cargo\s+test\s*$/.test(trimmed)) {
110
+ return true;
111
+ }
112
+ return false;
113
+ }
114
+ function evaluateAutoPermission(event, options = {}) {
115
+ const env = options.env ?? process.env;
116
+ if (!autoPermissionsEnabled(env)) {
117
+ return { decision: "disabled" };
118
+ }
119
+ if (event.effect === "deny") {
120
+ return { decision: "preserve-deny" };
121
+ }
122
+ if (event.effect === "allow") {
123
+ return { decision: "preserve-allow" };
124
+ }
125
+ const action = String(event.action ?? "").toLowerCase().trim();
126
+ const agent = String(event.agent ?? "").toLowerCase().trim();
127
+ if (action === "todowrite" || action === "todoread" || action === "pantheon_deepwork" || action.startsWith("pantheon_")) {
128
+ event.effect = "allow";
129
+ return { decision: "allow", reason: "pantheon-native-tool" };
130
+ }
131
+ if (READ_ONLY_AGENTS.has(agent)) {
132
+ if (["edit", "write", "hashline_edit", "bash", "shell"].includes(action)) {
133
+ event.effect = "deny";
134
+ event.message = `Pantheon auto-permissions denied: read-only agent '${agent}' cannot execute mutating action '${action}'`;
135
+ return { decision: "deny", reason: "read-only-role-violation" };
136
+ }
137
+ }
138
+ if (["read", "glob", "grep", "webfetch", "question"].includes(action)) {
139
+ const firstResource = Array.isArray(event.resources) && typeof event.resources[0] === "string" ? event.resources[0] : "";
140
+ if (firstResource.startsWith("http://") || firstResource.startsWith("https://")) {
141
+ return { decision: "passthrough" };
142
+ }
143
+ event.effect = "allow";
144
+ return { decision: "allow", reason: "safe-read-action" };
145
+ }
146
+ if (action === "bash" || action === "shell") {
147
+ const rawCmd = Array.isArray(event.resources) && typeof event.resources[0] === "string" ? event.resources[0] : "";
148
+ if (rawCmd) {
149
+ if (isDangerousCommand(rawCmd)) {
150
+ event.effect = "deny";
151
+ event.message = "Pantheon auto-permissions denied: destructive or privilege-escalating command";
152
+ return { decision: "deny", reason: "dangerous-command" };
153
+ }
154
+ if (isUnconstrainedTestSuite(rawCmd)) {
155
+ event.effect = "ask";
156
+ event.message = "Pantheon test-economy: unconstrained test suite detected in dev loop. Use a focused test slice (sub-10s) or provide scope justification.";
157
+ return {
158
+ decision: "unconstrained-suite",
159
+ reason: "unconstrained-test-suite-forbidden-in-dev-loop"
160
+ };
161
+ }
162
+ if (isSafeDevCommand(rawCmd)) {
163
+ event.effect = "allow";
164
+ return { decision: "allow", reason: "safe-dev-command" };
165
+ }
166
+ }
167
+ }
168
+ if (["edit", "write", "hashline_edit"].includes(action)) {
169
+ if (!READ_ONLY_AGENTS.has(agent)) {
170
+ event.effect = "allow";
171
+ return { decision: "allow", reason: "implementer-workspace-edit" };
172
+ }
173
+ }
174
+ return { decision: "passthrough" };
175
+ }
176
+
15
177
  // src/pantheon/behavior-overrides.ts
16
178
  var OVERRIDE_CONTENT_MAX = 8e3;
17
179
  var OVERRIDE_REASON_MAX = 200;
@@ -3693,6 +3855,7 @@ var DEFAULT_BLOCKED_TOOLS = /* @__PURE__ */ new Set([
3693
3855
  "edit",
3694
3856
  "write",
3695
3857
  "bash",
3858
+ "shell",
3696
3859
  "task",
3697
3860
  "hashline_edit",
3698
3861
  // `pantheon_model` writes active-preset.json in BOTH the project and the
@@ -3734,8 +3897,19 @@ function isDeniedReadPath(candidate, target) {
3734
3897
  }
3735
3898
  return false;
3736
3899
  }
3737
- function hasGlobMeta(value) {
3738
- return ["*", "?", "[", "]", "{", "}", "(", ")"].some((meta) => value.includes(meta));
3900
+ var CODE_FILE_EXTENSIONS = /\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|c|cpp|h|hpp|java|kt|rb|php|swift|cs|scala|vue|svelte)$/i;
3901
+ function isDeniedGlobPattern(pattern) {
3902
+ const normalized = normalizeGuardPath(pattern);
3903
+ if (normalized.startsWith("../") || normalized === ".." || normalized.includes("/../")) {
3904
+ return true;
3905
+ }
3906
+ if (isDeniedReadPath(normalized, true)) {
3907
+ return true;
3908
+ }
3909
+ if (CODE_FILE_EXTENSIONS.test(normalized)) {
3910
+ return true;
3911
+ }
3912
+ return false;
3739
3913
  }
3740
3914
  function zeusReadGuard(tool2, args, agent, resolvePath) {
3741
3915
  if (agent !== "zeus") return;
@@ -3770,7 +3944,7 @@ function zeusReadGuard(tool2, args, agent, resolvePath) {
3770
3944
  if (tool2 === "grep" && candidate.target) deny();
3771
3945
  continue;
3772
3946
  }
3773
- if (tool2 === "glob" && candidate.target && hasGlobMeta(effectivePath)) deny();
3947
+ if (tool2 === "glob" && candidate.target && isDeniedGlobPattern(effectivePath)) deny();
3774
3948
  if (isDeniedReadPath(effectivePath, candidate.target)) deny();
3775
3949
  }
3776
3950
  }
@@ -3804,8 +3978,8 @@ var ReadOnlySessionRegistry = class {
3804
3978
  }
3805
3979
  };
3806
3980
  var readOnlyRegistry = new ReadOnlySessionRegistry();
3807
- var READ_ONLY_AGENTS = /* @__PURE__ */ new Set(["apollo", "gaia"]);
3808
- function syncReadOnlySession(registry, sessionID, agent, readOnlyAgents = READ_ONLY_AGENTS) {
3981
+ var READ_ONLY_AGENTS2 = /* @__PURE__ */ new Set(["apollo", "gaia"]);
3982
+ function syncReadOnlySession(registry, sessionID, agent, readOnlyAgents = READ_ONLY_AGENTS2) {
3809
3983
  const normalized = normalizeDelegationAgent(agent);
3810
3984
  if (normalized === void 0 || !readOnlyAgents.has(normalized)) {
3811
3985
  registry.unregister(sessionID);
@@ -10558,6 +10732,10 @@ var TodoEnforcer = class {
10558
10732
  }
10559
10733
  };
10560
10734
 
10735
+ // src/pantheon/tools.ts
10736
+ import { exec } from "node:child_process";
10737
+ import { promisify } from "node:util";
10738
+
10561
10739
  // src/pantheon/cost-command.ts
10562
10740
  import { execFile } from "node:child_process";
10563
10741
  import { accessSync, constants as constants3, existsSync as existsSync5, statSync as statSync3 } from "node:fs";
@@ -12425,6 +12603,12 @@ function createDeepworkTool(cwd = process.cwd()) {
12425
12603
  });
12426
12604
  const projection = generateChatProjection(initialPlan, effectiveCwd);
12427
12605
  const approvalQ = buildApprovalQuestion(initialPlan);
12606
+ const todoPayload = {
12607
+ todos: tasks.map((t) => ({
12608
+ content: `[${t.id}] ${t.title}`,
12609
+ status: t.state === "done" ? "completed" : t.state === "in_progress" ? "in_progress" : "pending"
12610
+ }))
12611
+ };
12428
12612
  return {
12429
12613
  output: [
12430
12614
  `\u2705 Plano de Deepwork '${title}' inicializado com sucesso em \`.pantheon/deepwork/${slug}/\`!`,
@@ -12432,6 +12616,11 @@ function createDeepworkTool(cwd = process.cwd()) {
12432
12616
  `- \u{1F517} **Deeplink plan.json:** [Abrir plan.json](file://${deepworkPlanJsonPath(effectiveCwd, slug)})`,
12433
12617
  "",
12434
12618
  projection,
12619
+ "",
12620
+ "**TUI Todo Sync:** Espelhe as tarefas chamando `todowrite` com:",
12621
+ `\`\`\`json
12622
+ ${JSON.stringify(todoPayload, null, 2)}
12623
+ \`\`\``,
12435
12624
  "",
12436
12625
  "**Pergunta de Aprova\xE7\xE3o Nativa (Gate 1):**",
12437
12626
  `\`${JSON.stringify(approvalQ)}\``
@@ -14142,16 +14331,87 @@ var TODOWRITE_INPUT = {
14142
14331
  }
14143
14332
  }
14144
14333
  };
14334
+ var latestSessionTodos = [];
14145
14335
  var todowriteTool = {
14146
14336
  name: "todowrite",
14147
14337
  description: "Write the session task checklist (full replace). The TUI todo panel renders the newest list; mark each item in_progress/completed as soon as its state changes.",
14148
14338
  input: TODOWRITE_INPUT,
14149
14339
  output: {},
14150
14340
  execute: async (input) => {
14151
- const todos = Array.isArray(input.todos) ? input.todos : [];
14341
+ const rawTodos = input.todos;
14342
+ const todos = Array.isArray(rawTodos) ? rawTodos : [];
14343
+ latestSessionTodos = todos;
14152
14344
  return { ok: true, todos, output: JSON.stringify({ todos }) };
14153
14345
  }
14154
14346
  };
14347
+ var TODOREAD_INPUT = {
14348
+ type: "object",
14349
+ additionalProperties: false,
14350
+ properties: {
14351
+ status: {
14352
+ type: "string",
14353
+ description: "Optional filter by task status (pending, in_progress, completed, cancelled)"
14354
+ }
14355
+ }
14356
+ };
14357
+ var todoreadTool = {
14358
+ name: "todoread",
14359
+ description: "Read the active session task checklist. Returns the newest list of tasks written via todowrite.",
14360
+ input: TODOREAD_INPUT,
14361
+ output: {},
14362
+ execute: async (input) => {
14363
+ const statusFilter = input?.status;
14364
+ let todos = latestSessionTodos;
14365
+ if (typeof statusFilter === "string" && statusFilter.trim() !== "") {
14366
+ todos = todos.filter(
14367
+ (t) => typeof t === "object" && t !== null && t.status === statusFilter
14368
+ );
14369
+ }
14370
+ return {
14371
+ ok: true,
14372
+ todos,
14373
+ output: JSON.stringify({ todos })
14374
+ };
14375
+ }
14376
+ };
14377
+ var execAsync = promisify(exec);
14378
+ var SHELL_INPUT = {
14379
+ type: "object",
14380
+ required: ["command"],
14381
+ properties: {
14382
+ command: {
14383
+ type: "string",
14384
+ description: "The shell command to execute in the workspace directory"
14385
+ }
14386
+ }
14387
+ };
14388
+ var shellTool = {
14389
+ name: "shell",
14390
+ description: "Execute a shell command in the workspace directory. Alias for bash execution.",
14391
+ input: SHELL_INPUT,
14392
+ output: {},
14393
+ execute: async (input, context) => {
14394
+ const command = String(input.command ?? "");
14395
+ if (!command.trim()) {
14396
+ return { output: "", ok: false, error: "Command cannot be empty" };
14397
+ }
14398
+ const toolCtx = toolContext(context);
14399
+ const cwd = toolCtx.directory || process.cwd();
14400
+ try {
14401
+ const { stdout, stderr } = await execAsync(command, {
14402
+ cwd,
14403
+ maxBuffer: 10 * 1024 * 1024,
14404
+ shell: "/bin/bash"
14405
+ });
14406
+ const output = [stdout, stderr].filter(Boolean).join("\n");
14407
+ return { output, ok: true };
14408
+ } catch (err) {
14409
+ const execError = err;
14410
+ const output = [execError.stdout, execError.stderr, execError.message].filter(Boolean).join("\n");
14411
+ return { output, ok: false, error: output };
14412
+ }
14413
+ }
14414
+ };
14155
14415
  function createV2ToolDefinitions(visionRuntime, shadow = {}, jevRuntime) {
14156
14416
  const definitions = [
14157
14417
  {
@@ -14182,6 +14442,8 @@ function createV2ToolDefinitions(visionRuntime, shadow = {}, jevRuntime) {
14182
14442
  })
14183
14443
  );
14184
14444
  definitions.push(todowriteTool);
14445
+ definitions.push(todoreadTool);
14446
+ definitions.push(shellTool);
14185
14447
  definitions.push(createV2SkillSearchDefinition());
14186
14448
  definitions.push(createDeepworkTool());
14187
14449
  if (visionRuntime) definitions.push(createV2VisionTool(visionRuntime));
@@ -15260,6 +15522,9 @@ async function registerV2PermissionHook(context, subagentOrigins) {
15260
15522
  deny("caller or target is not allowed by delegation policy");
15261
15523
  return;
15262
15524
  }
15525
+ if (event.effect !== "deny") {
15526
+ evaluateAutoPermission(event, { cwd: domains.location?.directory || process.cwd() });
15527
+ }
15263
15528
  writeProof();
15264
15529
  recordP8(p8Result, event);
15265
15530
  });
package/src/plugin.ts CHANGED
@@ -95,6 +95,7 @@ import type {
95
95
  ReferenceDraft,
96
96
  } from '@opencode-ai/plugin/v2/promise'
97
97
  import { define } from '@opencode-ai/plugin/v2/promise'
98
+ import { evaluateAutoPermission } from './pantheon/auto-permissions.ts'
98
99
  import { type EffectiveOverrides, mergeOverrides } from './pantheon/behavior-overrides.ts'
99
100
  import {
100
101
  BOUNDED_READ_TOOL,
@@ -2516,6 +2517,12 @@ async function registerV2PermissionHook(
2516
2517
  deny('caller or target is not allowed by delegation policy')
2517
2518
  return
2518
2519
  }
2520
+
2521
+ // Auto-Permissions: Evaluate safe workspace actions if the event is not denied
2522
+ if (event.effect !== 'deny') {
2523
+ evaluateAutoPermission(event, { cwd: domains.location?.directory || process.cwd() })
2524
+ }
2525
+
2519
2526
  writeProof()
2520
2527
  recordP8(p8Result, event)
2521
2528
  })
@@ -2062,7 +2062,7 @@ async function readChangelogForBundle(bundleUrl) {
2062
2062
  }
2063
2063
  /** The ambient build-time version, or null outside a tsdown build. */
2064
2064
  function embeddedVersion() {
2065
- return "2.1.1";
2065
+ return "2.1.3";
2066
2066
  }
2067
2067
  /**
2068
2068
  * Resolve the running Pantheon version for the what's-new window: the plugin
@@ -2287,7 +2287,7 @@ function persistUpdateCheckState(previous, latest) {
2287
2287
  } catch {}
2288
2288
  }
2289
2289
  function resolveRunningVersion() {
2290
- return "2.1.1";
2290
+ return "2.1.3";
2291
2291
  }
2292
2292
  const VALUE_WIDTH = 24;
2293
2293
  function SettingsWindow(props) {
@@ -6513,7 +6513,7 @@ async function checkForPantheonUpdate(context) {
6513
6513
  const latest = String((await response.json())?.version ?? "");
6514
6514
  if (!latest) return;
6515
6515
  const notice = pickUpdateNotice({
6516
- currentVersion: "2.1.1",
6516
+ currentVersion: "2.1.3",
6517
6517
  latestVersion: latest,
6518
6518
  state: readState(),
6519
6519
  nowMs: Date.now()
@@ -7325,7 +7325,7 @@ function Sidebar(props) {
7325
7325
  get children() {
7326
7326
  var _el$13 = createElement("text");
7327
7327
  setProp(_el$13, "attributes", 1);
7328
- insert(_el$13, `Pantheon v2.1.1`);
7328
+ insert(_el$13, `Pantheon v2.1.3`);
7329
7329
  effect((_$p) => setProp(_el$13, "fg", text(), _$p));
7330
7330
  return _el$13;
7331
7331
  }
@@ -8097,7 +8097,7 @@ function HomeStatus(props) {
8097
8097
  },
8098
8098
  get children() {
8099
8099
  var _el$73 = createElement("text");
8100
- insert(_el$73, () => `Pantheon v2.1.1${preset().name ? ` ▸ ${preset().name}` : ""}`);
8100
+ insert(_el$73, () => `Pantheon v2.1.3${preset().name ? ` ▸ ${preset().name}` : ""}`);
8101
8101
  effect((_$p) => setProp(_el$73, "fg", muted(), _$p));
8102
8102
  return _el$73;
8103
8103
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "2.1.1",
9
+ "version": "2.1.3",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@opencode/plugin": "2.0.26",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
3
  "type": "module",
4
- "version": "2.1.1",
4
+ "version": "2.1.3",
5
5
  "description": "Pantheon TUI plugin \u2014 V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
6
6
  "license": "MIT",
7
7
  "engines": {