pantheon-opencode 1.6.2-beta.4 → 1.6.2-beta.5
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 +8 -0
- package/README.md +174 -3
- package/bin/pantheon-init.mjs +6 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/decision-router-budget.mjs +3 -3
- package/scripts/decision-router-v2-budget.mjs +218 -0
- package/scripts/decision-router-v2-egress.mjs +272 -0
- package/scripts/decision-router.mjs +268 -46
- package/scripts/docs-check-changelog.mjs +5 -3
- package/scripts/install/decision-layer-preview.mjs +376 -0
- package/scripts/install/decision-router-config.mjs +158 -11
- package/scripts/mcp_resources.py +11 -9
- package/scripts/release-notes.mjs +30 -7
- package/scripts/versioning.mjs +41 -5
- package/src/mcp/eval_store.py +11 -4
- package/src/mcp/mcp_resources.py +11 -9
- package/src/mcp/memory_mcp.py +293 -150
- package/src/pantheon/local-decision-prompt.ts +181 -36
- package/src/pantheon/local-decision-skills.ts +115 -5
- package/src/pantheon/local-decision-tool.ts +35 -1
- package/src/pantheon/v2-decision-budget.ts +456 -0
- package/src/pantheon/v2-decision-contracts.ts +300 -0
- package/src/pantheon/v2-decision-egress.ts +203 -0
- package/src/pantheon/v2-decision-events.ts +180 -0
- package/src/pantheon/v2-decision-heuristic.ts +121 -0
- package/src/pantheon/v2-decision-points/p1-agent.ts +91 -0
- package/src/pantheon/v2-decision-points/p10-claims.ts +243 -0
- package/src/pantheon/v2-decision-points/p11-catalog.ts +220 -0
- package/src/pantheon/v2-decision-points/p2-skill.ts +83 -0
- package/src/pantheon/v2-decision-points/p3-complexity.ts +108 -0
- package/src/pantheon/v2-decision-points/p4-memory.ts +137 -0
- package/src/pantheon/v2-decision-points/p5-themis-verify.ts +190 -0
- package/src/pantheon/v2-decision-points/p6-council.ts +161 -0
- package/src/pantheon/v2-decision-points/p7-loop.ts +263 -0
- package/src/pantheon/v2-decision-points/p8-guardrail.ts +366 -0
- package/src/pantheon/v2-decision-points/p9-memory-compaction.ts +304 -0
- package/src/pantheon/v2-decision-points.ts +242 -0
- package/src/pantheon/v2-decision-policy.ts +166 -0
- package/src/pantheon/v2-decision-premises.ts +146 -0
- package/src/pantheon/v2-decision-prompt-surface.ts +115 -0
- package/src/pantheon/v2-decision-rank.ts +91 -0
- package/src/pantheon/v2-decision-registry.ts +391 -0
- package/src/pantheon/v2-decision-resource-ids.ts +127 -0
- package/src/pantheon/v2-decision-shadow.ts +123 -0
- package/src/pantheon/v2-decision-telemetry.ts +214 -0
- package/src/pantheon/v2-decision-verify.ts +51 -0
- package/src/pantheon/v2-tools.ts +21 -2
- package/src/plugin-v2.ts +305 -3
- package/src/plugins/tui/dist/tui-v2.js +3 -3
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
package/src/plugin-v2.ts
CHANGED
|
@@ -136,6 +136,16 @@ import {
|
|
|
136
136
|
registerV2Bridge,
|
|
137
137
|
type V2ContextLike,
|
|
138
138
|
} from './pantheon/v2-bridge.ts'
|
|
139
|
+
import { createP7LoopPoint, p7LoopEnabledFromEnv } from './pantheon/v2-decision-points/p7-loop.ts'
|
|
140
|
+
import {
|
|
141
|
+
createP8Guardrail,
|
|
142
|
+
p8GuardrailEnabledFromEnv,
|
|
143
|
+
} from './pantheon/v2-decision-points/p8-guardrail.ts'
|
|
144
|
+
import { evaluateCompactionMemoryPoint } from './pantheon/v2-decision-points/p9-memory-compaction.ts'
|
|
145
|
+
import { evaluateCatalogPoint } from './pantheon/v2-decision-points/p11-catalog.ts'
|
|
146
|
+
import { DECISION_POINT_REGISTRY } from './pantheon/v2-decision-points.ts'
|
|
147
|
+
import { observePromptSurface } from './pantheon/v2-decision-prompt-surface.ts'
|
|
148
|
+
import { createTelemetrySink, type TelemetrySink } from './pantheon/v2-decision-telemetry.ts'
|
|
139
149
|
import {
|
|
140
150
|
type AuthoritativeSession,
|
|
141
151
|
evaluateV2Delegation,
|
|
@@ -662,9 +672,23 @@ async function registerV2Tools(
|
|
|
662
672
|
const visionReady = typeof model?.list === 'function'
|
|
663
673
|
if (!visionReady) markUnsupported('vision-tool')
|
|
664
674
|
const visionRuntime = visionReady ? ({ model } as V2VisionRuntime) : undefined
|
|
665
|
-
|
|
675
|
+
// P3 (complexity) declares `tool.invoke`; its construction site is the
|
|
676
|
+
// local selector's execute, fed by that tool's own input schema. The sink
|
|
677
|
+
// is the 0b record path (in-memory, bounded, I/O-free) and every record
|
|
678
|
+
// carries `mode: 'shadow'` — the mode the registry declares.
|
|
679
|
+
const p3Sink = createTelemetrySink()
|
|
680
|
+
p3TelemetrySink = p3Sink
|
|
681
|
+
const toolDefs = createV2ToolDefinitions(visionRuntime, {
|
|
682
|
+
complexitySink: (record) => {
|
|
683
|
+
p3Sink.emit({ ...record, mode: 'shadow' })
|
|
684
|
+
},
|
|
685
|
+
})
|
|
666
686
|
if (boundedRead !== undefined) toolDefs.push(boundedRead)
|
|
667
687
|
|
|
688
|
+
// P11's record sink, created per registration (in-memory, bounded, I/O-free).
|
|
689
|
+
const p11Sink = createTelemetrySink()
|
|
690
|
+
p11TelemetrySink = p11Sink
|
|
691
|
+
|
|
668
692
|
await toolCtx.transform((draft: V2ToolDraft) => {
|
|
669
693
|
// Catalog grouping only. The host computes a tool's registration id as
|
|
670
694
|
// `options.namespace === undefined ? name : `${namespace}_${name}``, and
|
|
@@ -686,6 +710,24 @@ async function registerV2Tools(
|
|
|
686
710
|
execute: def.execute,
|
|
687
711
|
})
|
|
688
712
|
}
|
|
713
|
+
|
|
714
|
+
// P11 (catalog) shadow observation on the only measured catalogue
|
|
715
|
+
// surface: the draft the host hands this callback — `{list, get,
|
|
716
|
+
// namespace, add, update, remove}`, 20 host tools, 46 with MCP servers
|
|
717
|
+
// registered (F-07). `ctx.catalog` is absent at every measured point
|
|
718
|
+
// (F-05) and is not used. The adapter reads and nothing else: `list()` is
|
|
719
|
+
// called, the six members are type-checked, and no add/update/remove is
|
|
720
|
+
// ever invoked, so the registration above is the only mutation. Shadow
|
|
721
|
+
// has no responder, so the record names the validated `choice` question
|
|
722
|
+
// (`catalog.no.answer`) instead of inventing a selection. Runs after the
|
|
723
|
+
// adds so the draft it reads is the one the host will keep.
|
|
724
|
+
try {
|
|
725
|
+
evaluateCatalogPoint(draft, (record) => {
|
|
726
|
+
p11Sink.emit({ ...record, mode: 'shadow' })
|
|
727
|
+
})
|
|
728
|
+
} catch {
|
|
729
|
+
// Observation must never fail the tool registration.
|
|
730
|
+
}
|
|
689
731
|
})
|
|
690
732
|
return true
|
|
691
733
|
} catch {
|
|
@@ -695,6 +737,105 @@ async function registerV2Tools(
|
|
|
695
737
|
|
|
696
738
|
// ─── V2 Event Subscription ──────────────────────────────────────────────
|
|
697
739
|
|
|
740
|
+
/**
|
|
741
|
+
* The P7 telemetry sink created by the most recent event subscription.
|
|
742
|
+
*
|
|
743
|
+
* P7 writes through the 0b record path (`createTelemetrySink`): in-memory,
|
|
744
|
+
* bounded and I/O-free by design, so a test that asserts "the decision was
|
|
745
|
+
* actually recorded" has to read the same collector the wiring wrote to.
|
|
746
|
+
* Exported only for tests/pantheon/plugin-v2-contract.test.ts — production has
|
|
747
|
+
* no caller, and nothing in the plugin reads this back.
|
|
748
|
+
*/
|
|
749
|
+
export function getP7TelemetrySinkForTests(): TelemetrySink | undefined {
|
|
750
|
+
return p7TelemetrySink
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
let p7TelemetrySink: TelemetrySink | undefined
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* The P8 telemetry sink created by the most recent permission-hook
|
|
757
|
+
* registration.
|
|
758
|
+
*
|
|
759
|
+
* P8 records every outcome it is responsible for — `guardrail.narrow`,
|
|
760
|
+
* `guardrail.keep`, `guardrail.refusal`, `p8.write.rejected`,
|
|
761
|
+
* `p8.write.delegation` and `p8.write.unconfirmed` — through the 0b record path
|
|
762
|
+
* (`createTelemetrySink`, in-memory, bounded, I/O-free). A guardrail that
|
|
763
|
+
* narrows without a record is indistinguishable from an inert one, which is
|
|
764
|
+
* exactly the defect PH5-1 closed. Every record carries the P8 registry `mode`
|
|
765
|
+
* (`off`), never `active`, and a `narrow` is recorded only when a re-read of
|
|
766
|
+
* the event still holds it (N9/N10). Exported only for
|
|
767
|
+
* tests/pantheon/plugin-v2-contract.test.ts.
|
|
768
|
+
*/
|
|
769
|
+
export function getP8TelemetrySinkForTests(): TelemetrySink | undefined {
|
|
770
|
+
return p8TelemetrySink
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
let p8TelemetrySink: TelemetrySink | undefined
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* The prompt-surface telemetry sink created by the most recent prompt-hook
|
|
777
|
+
* registration.
|
|
778
|
+
*
|
|
779
|
+
* P1 and P2 observe the same admission payload through `observePromptSurface`;
|
|
780
|
+
* each shadow record is reduced through the 0b record path
|
|
781
|
+
* (`createTelemetrySink`, in-memory, bounded, I/O-free) and carries
|
|
782
|
+
* `mode: 'shadow'` — the registry mode both declare. Nothing in production
|
|
783
|
+
* reads this collector back, so the write is only a claim if a reader can
|
|
784
|
+
* assert it: this accessor is that reader, and
|
|
785
|
+
* tests/pantheon/plugin-v2-contract.test.ts is its only caller.
|
|
786
|
+
*/
|
|
787
|
+
export function getPromptSurfaceTelemetrySinkForTests(): TelemetrySink | undefined {
|
|
788
|
+
return promptSurfaceTelemetrySink
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
let promptSurfaceTelemetrySink: TelemetrySink | undefined
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* The P3 telemetry sink created by the most recent tool registration.
|
|
795
|
+
*
|
|
796
|
+
* P3 is constructed at `tool.invoke`: `pantheon_local_decision`'s execute calls
|
|
797
|
+
* the adapter with the tool input, which carries `complexity` and `gateStatus`.
|
|
798
|
+
* Records are reduced through the same in-memory 0b path and carry the P3
|
|
799
|
+
* registry `mode` (`shadow`). Exported only for
|
|
800
|
+
* tests/pantheon/plugin-v2-contract.test.ts and the wiring audit.
|
|
801
|
+
*/
|
|
802
|
+
export function getP3TelemetrySinkForTests(): TelemetrySink | undefined {
|
|
803
|
+
return p3TelemetrySink
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
let p3TelemetrySink: TelemetrySink | undefined
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* The P9 telemetry sink created by the most recent compaction-hook
|
|
810
|
+
* registration.
|
|
811
|
+
*
|
|
812
|
+
* P9 declares `session.hook('compaction')` and observes the MEASURED carrier
|
|
813
|
+
* only: the top-level `sessionID` and the `system` part array (F-01, F-02).
|
|
814
|
+
* Records go through the same in-memory, bounded 0b path and carry the P9
|
|
815
|
+
* registry `mode` (`shadow`). Exported only for
|
|
816
|
+
* tests/pantheon/plugin-v2-contract.test.ts and the wiring audit.
|
|
817
|
+
*/
|
|
818
|
+
export function getP9TelemetrySinkForTests(): TelemetrySink | undefined {
|
|
819
|
+
return p9TelemetrySink
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
let p9TelemetrySink: TelemetrySink | undefined
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* The P11 telemetry sink created by the most recent tool registration.
|
|
826
|
+
*
|
|
827
|
+
* P11 declares `tool.transform` and reads the draft the host hands that
|
|
828
|
+
* callback (F-07) — the only measured catalogue surface, since `ctx.catalog` is
|
|
829
|
+
* absent (F-05). Records go through the in-memory, bounded 0b path and carry the
|
|
830
|
+
* P11 registry `mode` (`shadow`). Exported only for
|
|
831
|
+
* tests/pantheon/plugin-v2-contract.test.ts and the wiring audit.
|
|
832
|
+
*/
|
|
833
|
+
export function getP11TelemetrySinkForTests(): TelemetrySink | undefined {
|
|
834
|
+
return p11TelemetrySink
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
let p11TelemetrySink: TelemetrySink | undefined
|
|
838
|
+
|
|
698
839
|
/**
|
|
699
840
|
* Attempt to subscribe to session events via V2 ctx.event.subscribe.
|
|
700
841
|
*
|
|
@@ -713,12 +854,45 @@ function subscribeV2Events(
|
|
|
713
854
|
return undefined
|
|
714
855
|
}
|
|
715
856
|
|
|
857
|
+
// P7 loop adapter (PLAN §5.1 branch 1, selected by PROBE-D §7). Constructed
|
|
858
|
+
// here but inert unless PANTHEON_V2_P7_LOOP is set: the flag is OFF by
|
|
859
|
+
// default, and activation is Phase 4b — not this change. Observation is
|
|
860
|
+
// synchronous and self-contained, so it cannot block the stream, cannot
|
|
861
|
+
// throw into the dispatch, and does not alter the cleanup below.
|
|
862
|
+
//
|
|
863
|
+
// The sink is the 0b telemetry record path (`createTelemetrySink`, in-memory
|
|
864
|
+
// and bounded, no I/O). Each shadow record is reduced to its own allowlisted
|
|
865
|
+
// fields plus `mode: 'migration'` — the P7 registry mode — and nothing else:
|
|
866
|
+
// the execution count is not on the allowlist, so it is not recorded, and no
|
|
867
|
+
// prompt, response or user content can reach the record. A disabled adapter
|
|
868
|
+
// never calls the sink, so flag-off still emits zero records.
|
|
869
|
+
const telemetrySink = createTelemetrySink()
|
|
870
|
+
p7TelemetrySink = telemetrySink
|
|
871
|
+
const loopPoint = createP7LoopPoint({
|
|
872
|
+
enabled: p7LoopEnabledFromEnv(),
|
|
873
|
+
sink: (record) => {
|
|
874
|
+
telemetrySink.emit({ ...record, mode: 'migration' })
|
|
875
|
+
},
|
|
876
|
+
})
|
|
877
|
+
|
|
716
878
|
const controller = new AbortController()
|
|
717
879
|
void (async () => {
|
|
718
880
|
try {
|
|
719
881
|
// biome-ignore lint/style/noNonNullAssertion: subscribe guaranteed by guard above
|
|
720
882
|
for await (const event of eventCtx.subscribe!({ signal: controller.signal })) {
|
|
721
883
|
await handleV2SessionEvent(event)
|
|
884
|
+
try {
|
|
885
|
+
loopPoint.observe(event)
|
|
886
|
+
} catch {
|
|
887
|
+
// The adapter contains its own failures; this keeps a future
|
|
888
|
+
// regression out of the dispatch loop.
|
|
889
|
+
}
|
|
890
|
+
// KNOWN DEFECT, out of scope for Phase 4a: this branch and
|
|
891
|
+
// `handleV2SessionEvent`'s `session.compacted` case key on types the
|
|
892
|
+
// measured host never delivers — `session.idle` 0/11 runs and
|
|
893
|
+
// `session.compacted` 0/11 (PROBE-C, F-12). The live turn-end signal
|
|
894
|
+
// is `session.execution.succeeded`, observed above. The branches are
|
|
895
|
+
// left untouched on purpose; removing them is a separate change.
|
|
722
896
|
if (event.type === 'session.idle' || event.type === 'session.deleted') {
|
|
723
897
|
const properties = event.properties ?? {}
|
|
724
898
|
const info = properties.info
|
|
@@ -1124,6 +1298,13 @@ async function registerV2SessionHooks(context: PluginContext): Promise<boolean>
|
|
|
1124
1298
|
}
|
|
1125
1299
|
|
|
1126
1300
|
try {
|
|
1301
|
+
// Prompt-surface shadow points (P1 and P2) share this payload. P3 moved to
|
|
1302
|
+
// `tool.invoke`, where its input actually carries a complexity vector; P6
|
|
1303
|
+
// and P10 are unwired because no measured surface carries their inputs.
|
|
1304
|
+
// The sink is in-memory and bounded, exactly like P7/P8; it is created per
|
|
1305
|
+
// registration so one setup cannot observe another's records.
|
|
1306
|
+
const promptSurfaceSink = createTelemetrySink()
|
|
1307
|
+
promptSurfaceTelemetrySink = promptSurfaceSink
|
|
1127
1308
|
// "prompt" hook — preserve attached image references and add model-visible
|
|
1128
1309
|
// instructions so Zeus can inspect visual context and pass it to the
|
|
1129
1310
|
// implementation specialist before editing.
|
|
@@ -1154,6 +1335,15 @@ async function registerV2SessionHooks(context: PluginContext): Promise<boolean>
|
|
|
1154
1335
|
// captured before Pantheon's own visual context, and the router caches
|
|
1155
1336
|
// per session/message, so a repeated admission cannot call twice.
|
|
1156
1337
|
await applyDecisionRouterToPrompt(admission, permissionAssert, userRequest)
|
|
1338
|
+
|
|
1339
|
+
// Shadow observation only. The projection carries `prompt.agents` and
|
|
1340
|
+
// `prompt.skills` and nothing else, so no prompt text or file bytes
|
|
1341
|
+
// reach a record; observeShadow clones and freezes it, so admission is
|
|
1342
|
+
// not mutated. A failure here is contained by the outer catch and never
|
|
1343
|
+
// reaches the host.
|
|
1344
|
+
observePromptSurface(admission, (record) => {
|
|
1345
|
+
promptSurfaceSink.emit({ ...record, mode: 'shadow' })
|
|
1346
|
+
})
|
|
1157
1347
|
} catch {
|
|
1158
1348
|
// Fail-open: malformed/unsupported prompt shapes must not block input.
|
|
1159
1349
|
}
|
|
@@ -1793,6 +1983,23 @@ async function registerV2ToolHooks(
|
|
|
1793
1983
|
|
|
1794
1984
|
// ─── V2 Permission Hook ─────────────────────────────────────────────────
|
|
1795
1985
|
|
|
1986
|
+
/**
|
|
1987
|
+
* Read `event.effect` after P8 wrote to it, for the record.
|
|
1988
|
+
*
|
|
1989
|
+
* A hostile getter reads as `null`, which can only downgrade a recorded
|
|
1990
|
+
* `narrow` to `keep`, never upgrade one — the failure direction is "the record
|
|
1991
|
+
* claims less", never "the record claims an effect the event does not hold".
|
|
1992
|
+
*/
|
|
1993
|
+
function readPermissionEffect(event: unknown): string | null {
|
|
1994
|
+
try {
|
|
1995
|
+
if (event === null || typeof event !== 'object') return null
|
|
1996
|
+
const effect = (event as { readonly effect?: unknown }).effect
|
|
1997
|
+
return typeof effect === 'string' ? effect : null
|
|
1998
|
+
} catch {
|
|
1999
|
+
return null
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
|
|
1796
2003
|
/**
|
|
1797
2004
|
* Register permission hook via V2 ctx.permission.hook.
|
|
1798
2005
|
*
|
|
@@ -1815,6 +2022,48 @@ async function registerV2PermissionHook(
|
|
|
1815
2022
|
return false
|
|
1816
2023
|
}
|
|
1817
2024
|
|
|
2025
|
+
// P8 guardrail (PLAN §5 P8, Phase 5). Constructed once at registration and
|
|
2026
|
+
// inert by default: `PANTHEON_V2_P8_GUARDRAIL` is absent in a default
|
|
2027
|
+
// install, and absent means disabled — this ships no behavioural change.
|
|
2028
|
+
// Enabled, it may only replace a wider effect with `deny`; it is synchronous,
|
|
2029
|
+
// never throws, and never runs for `decision.egress` or an existing deny.
|
|
2030
|
+
// Its outcome is recorded through the 0b telemetry path (in-memory, bounded,
|
|
2031
|
+
// I/O-free) so a narrow, a refusal and a rejected write are observable; the
|
|
2032
|
+
// disabled guardrail emits nothing.
|
|
2033
|
+
const p8Guardrail = createP8Guardrail({ enabled: p8GuardrailEnabledFromEnv() })
|
|
2034
|
+
const p8Sink = createTelemetrySink()
|
|
2035
|
+
p8TelemetrySink = p8Sink
|
|
2036
|
+
// The record's `mode` mirrors the P8 registry entry — `off` today — instead
|
|
2037
|
+
// of asserting `active` (N10a). A record may never advertise an activation
|
|
2038
|
+
// the registry and C8 deny, and deriving the value from the registry means
|
|
2039
|
+
// the two cannot drift apart again. `mode` describes the point's declared
|
|
2040
|
+
// mode; `decision`/`reason` carry the observation.
|
|
2041
|
+
const p8RegistryMode = DECISION_POINT_REGISTRY.find((point) => point.id === 'P8')?.mode ?? 'off'
|
|
2042
|
+
/**
|
|
2043
|
+
* Record one P8 outcome.
|
|
2044
|
+
*
|
|
2045
|
+
* `event` is re-read immediately before emitting: `narrowed`/`wrote` are the
|
|
2046
|
+
* guardrail's own post-write read, and a `Proxy` whose descriptor trap lies
|
|
2047
|
+
* can make that read and the next one disagree (N9). A `narrow` is therefore
|
|
2048
|
+
* recorded only when the event still holds `deny`; otherwise the record
|
|
2049
|
+
* states the effect that is actually there (`guardrail.keep` with
|
|
2050
|
+
* `p8.write.unconfirmed`), so sink and proof cannot contradict each other.
|
|
2051
|
+
*/
|
|
2052
|
+
const recordP8 = (result: ReturnType<typeof p8Guardrail.apply>, event: unknown): void => {
|
|
2053
|
+
if (!p8Guardrail.enabled) return
|
|
2054
|
+
try {
|
|
2055
|
+
const unconfirmed = result.narrowed && readPermissionEffect(event) !== 'deny'
|
|
2056
|
+
p8Sink.emit({
|
|
2057
|
+
point: 'P8',
|
|
2058
|
+
decision: unconfirmed ? 'guardrail.keep' : result.decision,
|
|
2059
|
+
reason: unconfirmed ? 'p8.write.unconfirmed' : result.reason,
|
|
2060
|
+
mode: p8RegistryMode,
|
|
2061
|
+
})
|
|
2062
|
+
} catch {
|
|
2063
|
+
// Telemetry is best-effort and must not affect permission flow.
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
|
|
1818
2067
|
try {
|
|
1819
2068
|
await permCtx.hook('evaluate', async (rawEvent: unknown) => {
|
|
1820
2069
|
const event = rawEvent as V2PermissionEvent | null
|
|
@@ -1936,8 +2185,29 @@ async function registerV2PermissionHook(
|
|
|
1936
2185
|
// Native-only resources remain under host policy. If a Pantheon target
|
|
1937
2186
|
// appears anywhere, the shared policy evaluates the complete resource set.
|
|
1938
2187
|
decision = evaluateV2Delegation(event, session, event.effect, origin)
|
|
1939
|
-
|
|
1940
|
-
|
|
2188
|
+
|
|
2189
|
+
// P8 (Phase 5): read the effect left in place and, only when the flag is
|
|
2190
|
+
// on and a declared rule matches, replace it with `deny`. Off by default,
|
|
2191
|
+
// synchronous, contained — it cannot grant, delay or throw into admission.
|
|
2192
|
+
//
|
|
2193
|
+
// Apply BEFORE recording (PH5-1): `writeProof` reads `event.effect`, so a
|
|
2194
|
+
// proof written first recorded `effectAfter: allow` for an event P8 then
|
|
2195
|
+
// narrowed. The order below is apply → final effect → record, and the
|
|
2196
|
+
// record carries the post-apply effect plus the guardrail outcome.
|
|
2197
|
+
//
|
|
2198
|
+
// Record only after the effect is final (N10b). `deny()` below rewrites
|
|
2199
|
+
// the effect, and a record emitted before it would describe a state the
|
|
2200
|
+
// handler never leaves behind; when the delegation policy already denies,
|
|
2201
|
+
// the deny is the policy's, so P8 claims no narrowing at all — it changed
|
|
2202
|
+
// nothing about that outcome. `deny()` also throws on an immutable event,
|
|
2203
|
+
// and a record emitted after a throw would describe an unreached state.
|
|
2204
|
+
const p8Result = p8Guardrail.apply(event)
|
|
2205
|
+
if (decision === 'deny') {
|
|
2206
|
+
deny('caller or target is not allowed by delegation policy')
|
|
2207
|
+
return
|
|
2208
|
+
}
|
|
2209
|
+
writeProof()
|
|
2210
|
+
recordP8(p8Result, event)
|
|
1941
2211
|
})
|
|
1942
2212
|
return true
|
|
1943
2213
|
} catch {
|
|
@@ -2187,6 +2457,10 @@ export const plugin = define({
|
|
|
2187
2457
|
// active goals per session, and the store needs no host API (same
|
|
2188
2458
|
// `.pantheon/goals` directory V1 uses).
|
|
2189
2459
|
const goalStore = new GoalStore({ dir: '.pantheon/goals' })
|
|
2460
|
+
// P9's record sink, created per registration (in-memory, bounded,
|
|
2461
|
+
// I/O-free) so one setup cannot observe another's records.
|
|
2462
|
+
const p9Sink = createTelemetrySink()
|
|
2463
|
+
p9TelemetrySink = p9Sink
|
|
2190
2464
|
try {
|
|
2191
2465
|
// 2.0.16 `SessionHooks` key is `compaction` (the migration doc maps
|
|
2192
2466
|
// `experimental.session.compacting` → `ctx.session.hook("compaction")`).
|
|
@@ -2235,6 +2509,34 @@ export const plugin = define({
|
|
|
2235
2509
|
: typeof payload?.session?.id === 'string'
|
|
2236
2510
|
? payload.session.id
|
|
2237
2511
|
: undefined
|
|
2512
|
+
|
|
2513
|
+
// P9 (compaction) shadow observation, on the MEASURED carrier only.
|
|
2514
|
+
// The 2.2.5 compaction payload carries a TOP-LEVEL `sessionID` and
|
|
2515
|
+
// no nested `session` object at all (PROBE-A, 11/11 runs), so the
|
|
2516
|
+
// event is handed to the adapter as-is and it reads
|
|
2517
|
+
// `payload.sessionID` — never `session.id`, which is absent there.
|
|
2518
|
+
// A payload that carries only a nested id therefore produces NO
|
|
2519
|
+
// decision (fail-closed) rather than being keyed by a carrier the
|
|
2520
|
+
// host was never observed to send. This runs BEFORE the pruner and
|
|
2521
|
+
// the context injection below, so `systemPartCount` describes the
|
|
2522
|
+
// host payload and not the blocks Pantheon appends; the adapter
|
|
2523
|
+
// clones what it reads and pushes nothing itself, so the injected
|
|
2524
|
+
// context is unchanged — shadow is the record, nothing else.
|
|
2525
|
+
// Child-session compaction is measured and needs no separate path:
|
|
2526
|
+
// PROBE-G §3.1 fired this hook on a real child 3/3 with the CHILD
|
|
2527
|
+
// sessionID at top level and the same payload shape (7 keys, no
|
|
2528
|
+
// nested `session`, `system` array of 4). Compaction with
|
|
2529
|
+
// `reason:"overflow"` was NOT inducible in 6 error shapes (PROBE-G
|
|
2530
|
+
// §3.2 — the host retried and completed, and the one
|
|
2531
|
+
// failure-recovery compaction was persisted as `reason:"auto"`), so
|
|
2532
|
+
// that path remains unmeasured and is not designed for here.
|
|
2533
|
+
try {
|
|
2534
|
+
evaluateCompactionMemoryPoint({ payload }, (record) => {
|
|
2535
|
+
p9Sink.emit({ ...record, mode: 'shadow' })
|
|
2536
|
+
})
|
|
2537
|
+
} catch {
|
|
2538
|
+
// Observation must never reach the compaction request.
|
|
2539
|
+
}
|
|
2238
2540
|
const prunerConfig = resolveContextPrunerConfig(context.options)
|
|
2239
2541
|
const stats = pruneMessages(payload?.messages, prunerConfig, 'compaction')
|
|
2240
2542
|
logContextPrune(stats, sessionID)
|
|
@@ -5022,7 +5022,7 @@ function QuotaPluginDetails(props) {
|
|
|
5022
5022
|
setProp(_el$58, "paddingTop", 1);
|
|
5023
5023
|
insertNode(_el$59, createTextNode(`Plugin`));
|
|
5024
5024
|
setProp(_el$59, "attributes", 1);
|
|
5025
|
-
insert(_el$61, `Pantheon TUI v1.6.2-beta.
|
|
5025
|
+
insert(_el$61, `Pantheon TUI v1.6.2-beta.5`);
|
|
5026
5026
|
insertNode(_el$62, createTextNode(`Status de conexão consultado pelo OpenCode; segredos não são exibidos.`));
|
|
5027
5027
|
insert(_el$64, () => `Status da quota: ${quotaSnapshotStatusLabel(props.snapshot.status, props.snapshot.error)}`);
|
|
5028
5028
|
insert(_el$58, createComponent(Show, {
|
|
@@ -8300,7 +8300,7 @@ function Sidebar(props) {
|
|
|
8300
8300
|
setProp(_el$12, "width", "100%");
|
|
8301
8301
|
setProp(_el$12, "padding", 1);
|
|
8302
8302
|
setProp(_el$13, "attributes", 1);
|
|
8303
|
-
insert(_el$13, `Pantheon v1.6.2-beta.
|
|
8303
|
+
insert(_el$13, `Pantheon v1.6.2-beta.5`);
|
|
8304
8304
|
insert(_el$14, () => presetHeaderLine(model.preset().name ?? "", model.provider()));
|
|
8305
8305
|
insert(_el$12, createComponent(Show, {
|
|
8306
8306
|
get when() {
|
|
@@ -9027,7 +9027,7 @@ function HomeStatus(props) {
|
|
|
9027
9027
|
const muted = () => props.context.theme?.text?.muted ?? props.context.theme?.text?.base;
|
|
9028
9028
|
return (() => {
|
|
9029
9029
|
var _el$72 = createElement("text");
|
|
9030
|
-
insert(_el$72, () => `Pantheon v1.6.2-beta.
|
|
9030
|
+
insert(_el$72, () => `Pantheon v1.6.2-beta.5${preset().name ? ` ▸ ${preset().name}` : ""}`);
|
|
9031
9031
|
effect((_$p) => setProp(_el$72, "fg", muted(), _$p));
|
|
9032
9032
|
return _el$72;
|
|
9033
9033
|
})();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-tui",
|
|
3
|
-
"version": "1.6.2-beta.
|
|
3
|
+
"version": "1.6.2-beta.5",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pantheon-tui",
|
|
9
|
-
"version": "1.6.2-beta.
|
|
9
|
+
"version": "1.6.2-beta.5",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@opencode-ai/plugin": "1.18.33",
|