pantheon-opencode 1.6.3-beta.16 → 1.6.3-beta.17

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/CHANGELOG.md CHANGED
@@ -10,6 +10,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
10
10
  <!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
11
11
  move this section to a versioned entry and reset the template below. -->
12
12
 
13
+ ## [v1.6.3-beta.17] - 2026-11-05
14
+
15
+ ## 🆕 What's New
16
+ - The J1 gate is now a ladder: off / shadow / warn / enforce (PANTHEON_J1_RISK_SCORE). Enforce awaits the bounded gate and DENIES a high-risk tool call in-session, with the threshold configurable (PANTHEON_J1_ENFORCE_THRESHOLD, default 0.8). Shadow stays the default-on behavior.
17
+ - CALLER_NOT_ALLOWED refusals now teach the fix: allowlist the caller via PANTHEON_JEV_SPECIALIST_CALLERS or ask Zeus to route.
18
+ - Plan persistence contract: Athena returns the plan as her response; Zeus persists PLAN.md — no more refused write attempts on deepwork plans.
19
+
13
20
  ## [v1.6.3-beta.16] - 2026-11-05
14
21
 
15
22
  ## 🆕 What's New
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-opencode",
3
- "version": "1.6.3-beta.16",
3
+ "version": "1.6.3-beta.17",
4
4
  "description": "Multi-agent orchestration for OpenCode \u2014 14 specialized agents, TDD, Themis review gates.",
5
5
  "type": "module",
6
6
  "workspaces": [
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon",
3
3
  "publisher": "ils15",
4
- "version": "1.6.3-beta.16",
4
+ "version": "1.6.3-beta.17",
5
5
  "displayName": "Pantheon",
6
6
  "description": "Conductor-Delegate orchestration platform with 14 specialized agents, 21 skills, and OpenCode support.",
7
7
  "agents": "./src/agents",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.backends._legacy:_Backend"
4
4
 
5
5
  [project]
6
6
  name = "pantheon"
7
- version = "1.6.3-beta.16"
7
+ version = "1.6.3-beta.17"
8
8
  description = "Multi-agent orchestration framework"
9
9
  requires-python = ">=3.11"
10
10
  # Python sources under src/mcp/ import fastmcp/pydantic at runtime, but those
@@ -248,3 +248,5 @@ For external docs/specs, use `webfetch` (see `internet-search` skill for pattern
248
248
 
249
249
  ## Skills
250
250
  Planejamento: `spec-driven-development`, `artifact-management`
251
+
252
+ Your plan is your DELIVERABLE: return it fully in your response. You cannot write files or persist PLAN.md — say so once and hand the plan back; Zeus persists it.
@@ -94,6 +94,14 @@ call before firing it.
94
94
  cheap and typed, an MCP call is the LAST resort for state the session
95
95
  cannot reconstruct.
96
96
 
97
+ ## Plan persistence (deepwork PLAN.md)
98
+
99
+ Athena is plan-only and cannot write files; a plan she produces returns as her
100
+ response. YOU persist it: write `.pantheon/deepwork/<slug>/PLAN.md` yourself
101
+ (or hand the write to the specialist that owns the artifact) right after her
102
+ plan lands. Never ask Athena to save, and never delegate persistence to her —
103
+ the field refusal (beta.16) was the frontmatter working as designed.
104
+
97
105
  ## Vague multi-part request? Refine into a contract first
98
106
 
99
107
  When the user's request spans multiple concerns without explicit acceptance
@@ -449,10 +449,14 @@ export async function runJevDecision(
449
449
  ? (toolContext as JevToolContext)
450
450
  : undefined
451
451
  const caller = context?.agent
452
- if (typeof caller !== 'string' || caller.length === 0) return refusal('CALLER_NOT_ALLOWED')
452
+ if (typeof caller !== 'string' || caller.length === 0)
453
+ return refusal('CALLER_NOT_ALLOWED', 'CALLER_NOT_ALLOWLISTED')
453
454
  const allowlist = runtime.specialistCallers ?? []
454
455
  if (caller !== 'zeus' && !allowlist.includes(caller)) {
455
- return refusal('CALLER_NOT_ALLOWED')
456
+ return refusal(
457
+ 'CALLER_NOT_ALLOWED',
458
+ 'CALLER_NOT_ALLOWLISTED — allowlist this caller via PANTHEON_JEV_SPECIALIST_CALLERS (then restart) or ask Zeus to route',
459
+ )
456
460
  }
457
461
 
458
462
  const requested = (input ?? {}) as { mode?: unknown; questions?: unknown }
@@ -120,12 +120,50 @@ const WRITE_TOOLS: ReadonlySet<string> = new Set([
120
120
  'hashline_edit',
121
121
  ])
122
122
 
123
- /** Whether the operator explicitly enabled the flag. Absence means off. */
123
+ /**
124
+ * The escalation ladder (field beta.14: the operator wants iterative
125
+ * escalation, not a binary flag). `on`/`1`/`true` map to `shadow` for
126
+ * back-compatibility with the shipped setup.
127
+ * off — nothing fires (hard zero)
128
+ * shadow — observe + record; invisible in the session (today's behavior)
129
+ * warn — RESERVED (needs a V2 client channel; currently behaves as shadow)
130
+ * enforce — an affirmative high-risk score DENIES the tool call (the host
131
+ * surfaces the block message in the session); gate unavailability
132
+ * never blocks (fail-open, documented)
133
+ */
134
+ export type J1RiskGateMode = 'off' | 'shadow' | 'warn' | 'enforce'
135
+
136
+ export const J1_ENFORCE_THRESHOLD_ENV = 'PANTHEON_J1_ENFORCE_THRESHOLD'
137
+ export const J1_ENFORCE_THRESHOLD_DEFAULT = 0.8
138
+
139
+ export function j1ModeFromEnv(
140
+ env: Record<string, string | undefined> = process.env,
141
+ ): J1RiskGateMode {
142
+ const raw = (env[J1_RISK_GATE_FLAG_ENV] ?? '').trim().toLowerCase()
143
+ if (raw === 'enforce') return 'enforce'
144
+ if (raw === 'warn') return 'warn'
145
+ return FLAG_ON.has(raw) ? 'shadow' : 'off'
146
+ }
147
+
148
+ /** Back-compatible: any non-off mode counts as enabled. */
124
149
  export function j1RiskGateEnabledFromEnv(
125
150
  env: Record<string, string | undefined> = process.env,
126
151
  ): boolean {
127
- const raw = (env[J1_RISK_GATE_FLAG_ENV] ?? '').trim().toLowerCase()
128
- return FLAG_ON.has(raw)
152
+ return j1ModeFromEnv(env) !== 'off'
153
+ }
154
+
155
+ /**
156
+ * The enforce-mode deny threshold (0..1). Invalid or out-of-range values fall
157
+ * back to the documented default — an operator typo must not disable the gate.
158
+ */
159
+ export function j1EnforceThresholdFromEnv(
160
+ env: Record<string, string | undefined> = process.env,
161
+ ): number {
162
+ const text = (env[J1_ENFORCE_THRESHOLD_ENV] ?? '').trim()
163
+ if (text === '') return J1_ENFORCE_THRESHOLD_DEFAULT
164
+ const raw = Number(text)
165
+ if (!Number.isFinite(raw) || raw < 0 || raw > 1) return J1_ENFORCE_THRESHOLD_DEFAULT
166
+ return raw
129
167
  }
130
168
 
131
169
  /**
@@ -408,12 +446,25 @@ function abortDeadline(signal: AbortSignal): Promise<'timeout'> {
408
446
  * settles its own ledger reservation in the background (settlement of an
409
447
  * already-fired call — not a retry, and it writes no record).
410
448
  */
449
+ export interface J1Verdict {
450
+ /** 'block' only in enforce mode with an affirmative high-risk score. */
451
+ block: boolean
452
+ riskScore: number | null
453
+ reason: string
454
+ }
455
+
411
456
  export function createJ1RiskGateObserver(
412
- options: J1RiskGateObserverOptions,
413
- ): (event: unknown) => Promise<void> {
457
+ options: J1RiskGateObserverOptions & {
458
+ /** enforce: the caller awaits and denies on { block: true }. */
459
+ mode?: J1RiskGateMode
460
+ threshold?: number
461
+ },
462
+ ): (event: unknown) => Promise<void | J1Verdict> {
414
463
  const timeoutMs = options.timeoutMs ?? J1_RISK_GATE_TIMEOUT_MS
415
464
  const sink = options.sink
416
- return async (event: unknown): Promise<void> => {
465
+ const enforce = options.mode === 'enforce'
466
+ const threshold = options.threshold ?? J1_ENFORCE_THRESHOLD_DEFAULT
467
+ return async (event: unknown): Promise<void | J1Verdict> => {
417
468
  try {
418
469
  const payload = (event ?? {}) as J1ExecuteBeforeEvent
419
470
  if (!isRiskGateTarget(payload.tool)) return
@@ -467,6 +518,18 @@ export function createJ1RiskGateObserver(
467
518
  }),
468
519
  sink,
469
520
  )
521
+ if (enforce) {
522
+ const risk = evaluation.riskScore
523
+ const block = risk !== null && risk >= threshold
524
+ return {
525
+ block,
526
+ riskScore: risk,
527
+ reason: block
528
+ ? `J1 enforce: risco ${risk.toFixed(2)} >= threshold ${threshold}`
529
+ : 'allow',
530
+ }
531
+ }
532
+ return
470
533
  } finally {
471
534
  clearTimeout(timer)
472
535
  }
package/src/plugin-v2.ts CHANGED
@@ -126,7 +126,9 @@ import {
126
126
  import {
127
127
  createJ1RiskGateObserver,
128
128
  isRiskGateTarget,
129
- j1RiskGateEnabledFromEnv,
129
+ type J1Verdict,
130
+ j1EnforceThresholdFromEnv,
131
+ j1ModeFromEnv,
130
132
  } from './pantheon/jev-risk-gate.ts'
131
133
  import { DECISION_EGRESS_ACTION } from './pantheon/local-decision-egress-gate.ts'
132
134
  import { applyDecisionRouterToPrompt } from './pantheon/local-decision-prompt.ts'
@@ -1984,14 +1986,17 @@ async function registerV2ToolHooks(
1984
1986
  // ledger reservation, permission kill-switch) and records shadow records
1985
1987
  // only — it is fired WITHOUT await inside the before-handler (fire-and-
1986
1988
  // observe), self-bounds at 2s with an AbortController, and never retries.
1987
- let j1Observer: ((event: unknown) => Promise<void>) | undefined
1988
- if (jevRuntime !== undefined && j1RiskGateEnabledFromEnv()) {
1989
+ const j1Mode = j1ModeFromEnv()
1990
+ let j1Observer: ((event: unknown) => Promise<void | J1Verdict>) | undefined
1991
+ if (jevRuntime !== undefined && j1Mode !== 'off') {
1989
1992
  const j1Sink = createTelemetrySink()
1990
1993
  j1TelemetrySink = j1Sink
1991
1994
  j1Observer = createJ1RiskGateObserver({
1992
1995
  runtime: jevRuntime,
1996
+ mode: j1Mode,
1997
+ threshold: j1EnforceThresholdFromEnv(),
1993
1998
  sink: (record) => {
1994
- j1Sink.emit({ ...record, mode: 'shadow' })
1999
+ j1Sink.emit({ ...record, mode: j1Mode === 'enforce' ? 'enforce' : 'shadow' })
1995
2000
  },
1996
2001
  })
1997
2002
  }
@@ -2148,7 +2153,22 @@ async function registerV2ToolHooks(
2148
2153
  // the flag is off — the only cost of the flag-on check below is the
2149
2154
  // truthiness read.
2150
2155
  if (j1Observer !== undefined && isRiskGateTarget((event as { tool?: unknown }).tool)) {
2151
- void j1Observer(event)
2156
+ // Ladder semantics: shadow/warn stay fire-and-observe (latency
2157
+ // unchanged); ENFORCE awaits (bounded 2s) and DENIES via throw —
2158
+ // the host surfaces the thrown message in the session, which is the
2159
+ // block's visible form. Unavailability never denies (fail-open by
2160
+ // design: a dead budget must not brick every shell call).
2161
+ if (j1Mode === 'enforce') {
2162
+ const verdict = (await j1Observer(event)) as J1Verdict | undefined
2163
+ if (verdict?.block === true) {
2164
+ throw new Error(
2165
+ `[J1 enforce] chamada bloqueada: risco ${verdict.riskScore?.toFixed(2)} ` +
2166
+ `>= threshold (ajuste PANTHEON_J1_ENFORCE_THRESHOLD ou rebaixe o modo para shadow/warn)`,
2167
+ )
2168
+ }
2169
+ } else {
2170
+ void j1Observer(event)
2171
+ }
2152
2172
  }
2153
2173
  // J3 turn-complexity shadow classification. Same fire-and-observe
2154
2174
  // discipline as J1: the dispatch's latency is unchanged, the observer
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "1.6.3-beta.16",
3
+ "version": "1.6.3-beta.17",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "1.6.3-beta.16",
9
+ "version": "1.6.3-beta.17",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@opencode-ai/plugin": "1.18.33",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
3
  "type": "module",
4
- "version": "1.6.3-beta.16",
4
+ "version": "1.6.3-beta.17",
5
5
  "description": "Pantheon TUI plugin — V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
6
6
  "license": "MIT",
7
7
  "engines": {