pantheon-opencode 1.6.0-beta.15 → 1.6.0-beta.18
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 +52 -1
- package/README.md +95 -26
- package/README.pt-BR.md +14 -14
- package/package.json +3 -3
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/_pantheon_paths.py +24 -0
- package/scripts/doctor.mjs +7 -2
- package/scripts/install-mcp.mjs +1 -1
- package/scripts/mcp_persistence.py +1489 -1039
- package/scripts/memory_mcp.py +12 -843
- package/scripts/test-opencode-v2-sandbox.sh +2 -115
- package/skills-lock.json +3 -3
- package/src/agents/apollo.md +1 -2
- package/src/agents/athena.md +1 -2
- package/src/agents/gaia.md +0 -1
- package/src/agents/hermes.md +1 -1
- package/src/agents/iris.md +0 -1
- package/src/agents/mnemosyne.md +3 -2
- package/src/agents/zeus.md +1 -1
- package/src/mcp/_pantheon_paths.py +24 -0
- package/src/mcp/mcp_codemap_module.py +86 -18
- package/src/mcp/mcp_persistence.py +1489 -1039
- package/src/mcp/memory_mcp.py +101 -57
- package/src/pantheon/goal-loop.ts +11 -8
- package/src/pantheon/task-result-guard.ts +38 -2
- package/src/pantheon/v2-execute-after.ts +117 -20
- package/src/pantheon/v2-tools.ts +10 -1
- package/src/plugin-v2.ts +6 -4
- package/src/plugin.ts +3 -2
- package/src/plugins/tui/dist/tui-v2.js +2 -2
- 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/routing.yml +4 -4
- package/src/skills/codemap/SKILL.md +1 -1
- package/src/skills/memory-bank/SKILL.md +17 -13
- package/src/skills/session-goal/SKILL.md +12 -22
- package/scripts/probe-context-rehydrate.mjs +0 -263
|
@@ -477,7 +477,7 @@ function Sidebar(props) {
|
|
|
477
477
|
setProp(_el$, "width", "100%");
|
|
478
478
|
setProp(_el$, "padding", 1);
|
|
479
479
|
setProp(_el$2, "attributes", 1);
|
|
480
|
-
insert(_el$2, `Pantheon v1.6.0-beta.
|
|
480
|
+
insert(_el$2, `Pantheon v1.6.0-beta.18`);
|
|
481
481
|
insertNode(_el$3, createTextNode(`OpenCode V2 · plugin TUI ativo`));
|
|
482
482
|
insert(_el$, createComponent(Show, {
|
|
483
483
|
get when() {
|
|
@@ -623,7 +623,7 @@ function HomeStatus(props) {
|
|
|
623
623
|
const muted = () => props.context.theme?.text?.muted ?? props.context.theme?.text?.base;
|
|
624
624
|
return (() => {
|
|
625
625
|
var _el$20 = createElement("text");
|
|
626
|
-
insert(_el$20, () => `Pantheon v1.6.0-beta.
|
|
626
|
+
insert(_el$20, () => `Pantheon v1.6.0-beta.18${preset().name ? ` ⚡ ${preset().name}` : ""}`);
|
|
627
627
|
effect((_$p) => setProp(_el$20, "fg", muted(), _$p));
|
|
628
628
|
return _el$20;
|
|
629
629
|
})();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-tui",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.18",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pantheon-tui",
|
|
9
|
-
"version": "1.6.0-beta.
|
|
9
|
+
"version": "1.6.0-beta.18",
|
|
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.0-beta.
|
|
4
|
+
"version": "1.6.0-beta.18",
|
|
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": {
|
package/src/routing.yml
CHANGED
|
@@ -596,12 +596,12 @@ hashline:
|
|
|
596
596
|
# with per-line sha256 tags (12#XJ|content); hashline_edit anchors edits to
|
|
597
597
|
# those refs. Documentation mirror — the plugin resolves behavior in code.
|
|
598
598
|
full_auto:
|
|
599
|
-
enabled: false #
|
|
600
|
-
max_continuations: 25 # hard cap
|
|
599
|
+
enabled: false # Documentation only; no runtime config enables the loop in this build.
|
|
600
|
+
max_continuations: 25 # Documented hard cap; routing.yml is not loaded for loop settings.
|
|
601
601
|
# Full-auto only continues a task/scope explicitly authorized by the user.
|
|
602
602
|
# It never authorizes auth/security gates, risky data/schema or destructive
|
|
603
603
|
# operations, global config, broad permissions, production deploy, push, or merge.
|
|
604
604
|
# Low-risk execution is proportional: no forced plan/discovery/council/artifact
|
|
605
|
-
# for a bounded fix; use focused verification.
|
|
606
|
-
#
|
|
605
|
+
# for a bounded fix; use focused verification. This section documents guards
|
|
606
|
+
# and defaults only; the plugin uses GOAL_LOOP_DEFAULTS directly.
|
|
607
607
|
# Wave 3 (PR #46): one active goal per session (pending → in_progress → done).
|
|
@@ -50,5 +50,5 @@ Generate a hierarchical map of the codebase to understand its structure, key mod
|
|
|
50
50
|
Antes de glob/grep manual, tente `code_query`:
|
|
51
51
|
- `code_query("MyClass")` → busca FTS5 por entidade
|
|
52
52
|
- Fallback para glob/grep se não indexado ou query vazia
|
|
53
|
-
- `code_index
|
|
53
|
+
- `code_index` não está disponível sob os grants atuais: nenhum agente recebeu essa permissão. Os resultados de consulta dependem de um índice já existente.
|
|
54
54
|
- `code_neighbors(entity_id, depth=2)` para grafo de imports/calls
|
|
@@ -12,12 +12,19 @@ Complete guide to Pantheon memory bank — structure, rules, optimization, and m
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Actual Storage Model
|
|
16
16
|
|
|
17
17
|
| System | Where | Owner | Lifetime | Purpose |
|
|
18
18
|
|--------|-------|-------|----------|---------|
|
|
19
|
-
| **Memory
|
|
20
|
-
| **
|
|
19
|
+
| **Durable Memory** | `pantheon-memory` MCP (SQLite `memory.db`) | Agents with the relevant tool grant | No entry TTL; retained until explicitly forgotten | Reusable facts and decisions |
|
|
20
|
+
| **Persistence** | `pantheon-persistence` MCP | Agents with the relevant tool grant | Optional, separate checkpoint/KV store; checkpoint TTLs apply | Explicit session/workflow checkpoints and temporary state |
|
|
21
|
+
| **Memory Bank** | `.pantheon/memory-bank/` | Team | Files persist in the working tree; Git tracking depends on repository ignore/commit policy | Project context: architecture, patterns, progress, ADRs |
|
|
22
|
+
|
|
23
|
+
Pantheon does not implement `/memories/repo/` or `/memories/session/` stores.
|
|
24
|
+
Memory Bank files are read explicitly or on demand through
|
|
25
|
+
`pantheon://memory-bank/{path}` from `pantheon-resources`; they are not
|
|
26
|
+
auto-loaded. Memory namespaces are organizational filters, not access-control
|
|
27
|
+
boundaries, and tools are available only when the active agent is granted them.
|
|
21
28
|
|
|
22
29
|
---
|
|
23
30
|
|
|
@@ -68,13 +75,9 @@ committed under the repository's policy are shared through Git.
|
|
|
68
75
|
|
|
69
76
|
---
|
|
70
77
|
|
|
71
|
-
## Session →
|
|
78
|
+
## Session → Project Context Graduation
|
|
72
79
|
|
|
73
80
|
```
|
|
74
|
-
During sprint:
|
|
75
|
-
Athena writes plan → /memories/session/sprint-plan.md (ephemeral)
|
|
76
|
-
Agents track wip → /memories/session/wip.md (ephemeral)
|
|
77
|
-
|
|
78
81
|
At sprint close:
|
|
79
82
|
@mnemosyne consolidates → .pantheon/memory-bank/01-active-context.md
|
|
80
83
|
→ .pantheon/memory-bank/02-progress-log.md (appended)
|
|
@@ -91,8 +94,9 @@ At sprint close:
|
|
|
91
94
|
| Milestone completions | Any agent | `02-progress-log.md` (append) |
|
|
92
95
|
| Task records | Mnemosyne (on request) | `_tasks/TASK000X-*.md` |
|
|
93
96
|
| Architecture decisions | Mnemosyne (on request) | `_notes/NOTE000X-*.md` |
|
|
94
|
-
|
|
|
95
|
-
| Conversation
|
|
97
|
+
| Reusable durable fact or decision | Agent with explicit `memory_store` grant, when retention is warranted | `pantheon-memory` |
|
|
98
|
+
| Conversation-only goal | Current session instructions / `/pantheon-focus` | Not durable; no `/memories/session/` store |
|
|
99
|
+
| Project narrative and ADRs | Mnemosyne on explicit request | `.pantheon/memory-bank/` |
|
|
96
100
|
|
|
97
101
|
---
|
|
98
102
|
|
|
@@ -147,10 +151,10 @@ At sprint close → explicit @mnemosyne invocation
|
|
|
147
151
|
|
|
148
152
|
### ❌ Duplicating information
|
|
149
153
|
```
|
|
150
|
-
# Wrong:
|
|
154
|
+
# Wrong: duplicate the same fact in both durable Memory and a project document
|
|
151
155
|
|
|
152
|
-
# Right:
|
|
153
|
-
Narrative context → 00-project.md (
|
|
156
|
+
# Right: Durable reusable fact → pantheon-memory (when warranted and granted)
|
|
157
|
+
Narrative context → 00-project.md (read on demand)
|
|
154
158
|
```
|
|
155
159
|
|
|
156
160
|
---
|
|
@@ -72,28 +72,18 @@ Before each major delegation or decision, run this quick check:
|
|
|
72
72
|
|
|
73
73
|
## Cross-Session Continuity
|
|
74
74
|
|
|
75
|
-
V2 does not
|
|
76
|
-
conversation and must not be described as surviving
|
|
77
|
-
session. For multi-phase work that needs persistent
|
|
78
|
-
`/pantheon-deepwork`; otherwise ask before writing a goal to a
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/memories/session/current-goal.md
|
|
88
|
-
|
|
89
|
-
# Active Session Goal
|
|
90
|
-
Goal: Implement JWT authentication
|
|
91
|
-
Started: 2026-05-15
|
|
92
|
-
Status: Phase 2 of 3 (backend done, frontend in progress)
|
|
93
|
-
Next: POST /auth/refresh endpoint
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
This file-based approach requires explicit authorization and is not automatic.
|
|
75
|
+
The V2 plugin does not register the V1 `pantheon_goal_*` tools. `/pantheon-focus`
|
|
76
|
+
only anchors the current conversation and must not be described as surviving
|
|
77
|
+
compaction or a new session. For multi-phase work that needs persistent
|
|
78
|
+
checkpoints, use `/pantheon-deepwork`; otherwise ask before writing a goal to a
|
|
79
|
+
project file.
|
|
80
|
+
|
|
81
|
+
Pantheon does not implement a `/memories/session/` filesystem store. The V1
|
|
82
|
+
goal tools are deprecated legacy manual record tools: stored goals are not
|
|
83
|
+
automatically continued in the current build. Durable manual goals are
|
|
84
|
+
available through the separate Persistence MCP `goal_*` surface in this branch;
|
|
85
|
+
do not present it as released or as part of the V2 plugin. `/pantheon-focus`
|
|
86
|
+
remains a non-persistent conversation anchor.
|
|
97
87
|
|
|
98
88
|
---
|
|
99
89
|
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawnSync } from 'node:child_process'
|
|
3
|
-
/**
|
|
4
|
-
* Offline/ambiental probe for context_rehydrate and context_session_summary.
|
|
5
|
-
*
|
|
6
|
-
* The Python child imports the installed persistence server and exercises the
|
|
7
|
-
* real FastMCP tools against a temporary SQLite database. No OpenCode command,
|
|
8
|
-
* network call, LLM, or user database is involved. Missing package/runtime is
|
|
9
|
-
* NOT_TESTED/AMBIENTAL rather than a false PASS.
|
|
10
|
-
*/
|
|
11
|
-
import { existsSync, mkdtempSync, rmSync } from 'node:fs'
|
|
12
|
-
import { tmpdir } from 'node:os'
|
|
13
|
-
import { join } from 'node:path'
|
|
14
|
-
import { fileURLToPath } from 'node:url'
|
|
15
|
-
|
|
16
|
-
const requestedVersion = valueFor('--version')
|
|
17
|
-
const jsonOutput = process.argv.includes('--json')
|
|
18
|
-
const runtime = fileURLToPath(new URL('./mcp_persistence.py', import.meta.url))
|
|
19
|
-
|
|
20
|
-
function valueFor(name) {
|
|
21
|
-
const index = process.argv.indexOf(name)
|
|
22
|
-
return index >= 0 ? process.argv[index + 1] : undefined
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function emit(status, detail, checks = []) {
|
|
26
|
-
const result = { status, version: requestedVersion, detail, checks }
|
|
27
|
-
if (jsonOutput) process.stdout.write(JSON.stringify(result))
|
|
28
|
-
else process.stdout.write(`${status}: ${detail}\n`)
|
|
29
|
-
if (status === 'FAIL') process.exitCode = 1
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function unavailable(detail) {
|
|
33
|
-
emit('NOT_TESTED', detail)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function pythonCandidates() {
|
|
37
|
-
const venvPython = process.env.HOME
|
|
38
|
-
? join(process.env.HOME, '.config', 'opencode', '.venv', 'bin', 'python')
|
|
39
|
-
: undefined
|
|
40
|
-
return [process.env.PANTHEON_PYTHON, venvPython, 'python3'].filter(Boolean)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const PYTHON_HARNESS = `
|
|
44
|
-
import asyncio
|
|
45
|
-
import importlib.util
|
|
46
|
-
import json
|
|
47
|
-
import os
|
|
48
|
-
import sys
|
|
49
|
-
from pathlib import Path
|
|
50
|
-
|
|
51
|
-
runtime_path = Path(sys.argv[1]).resolve()
|
|
52
|
-
db_root = Path(sys.argv[2]).resolve()
|
|
53
|
-
sys.path.insert(0, str(runtime_path.parent))
|
|
54
|
-
sys.argv = [str(runtime_path), "--global-db", str(db_root / "global.db"),
|
|
55
|
-
"--project-db", str(db_root / "project.db")]
|
|
56
|
-
|
|
57
|
-
spec = importlib.util.spec_from_file_location("probe_mcp_persistence", runtime_path)
|
|
58
|
-
if spec is None or spec.loader is None:
|
|
59
|
-
raise RuntimeError("could not load persistence runtime")
|
|
60
|
-
module = importlib.util.module_from_spec(spec)
|
|
61
|
-
spec.loader.exec_module(module)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
async def call(name, arguments):
|
|
65
|
-
result = await module.mcp.call_tool(name, arguments)
|
|
66
|
-
structured = getattr(result, "structured_content", None)
|
|
67
|
-
if structured is not None:
|
|
68
|
-
metadata = getattr(result, "meta", None) or {}
|
|
69
|
-
if metadata.get("fastmcp", {}).get("wrap_result"):
|
|
70
|
-
return structured.get("result") if isinstance(structured, dict) else structured
|
|
71
|
-
return structured
|
|
72
|
-
if isinstance(result, tuple):
|
|
73
|
-
structured = result[1]
|
|
74
|
-
if structured is not None:
|
|
75
|
-
if isinstance(structured, dict) and "result" in structured:
|
|
76
|
-
return structured["result"]
|
|
77
|
-
return structured
|
|
78
|
-
result = result[0]
|
|
79
|
-
if isinstance(result, dict):
|
|
80
|
-
return result
|
|
81
|
-
if not result:
|
|
82
|
-
return None
|
|
83
|
-
text = getattr(result[0], "text", str(result[0]))
|
|
84
|
-
try:
|
|
85
|
-
return json.loads(text)
|
|
86
|
-
except (TypeError, ValueError, json.JSONDecodeError):
|
|
87
|
-
return text
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
async def main():
|
|
91
|
-
checks = []
|
|
92
|
-
slug = "context-rehydrate-probe"
|
|
93
|
-
session_id = "synthetic-session"
|
|
94
|
-
checkpoint = {
|
|
95
|
-
"version": 1,
|
|
96
|
-
"goal": {"id": "probe-goal", "objective": "verify context recovery",
|
|
97
|
-
"status": "in_progress"},
|
|
98
|
-
"phase": {"current": 2, "total": 3, "name": "offline validation"},
|
|
99
|
-
"delegations": {"in_flight": [{"alias": "apo-probe", "agent": "apollo",
|
|
100
|
-
"task_id": "probe-task"}]},
|
|
101
|
-
}
|
|
102
|
-
tail = ["phase 1 complete", "phase 2 payload validated"]
|
|
103
|
-
|
|
104
|
-
# context_save creates the real session-qualified latest pointer. Keeping
|
|
105
|
-
# tail under its own key also tests the runtime's latest/tail fallback.
|
|
106
|
-
await call("context_save", {"slug": slug, "key": "tail",
|
|
107
|
-
"content": json.dumps(tail),
|
|
108
|
-
"session_id": session_id})
|
|
109
|
-
await call("context_save", {"slug": slug, "key": "phase:2",
|
|
110
|
-
"content": json.dumps(checkpoint),
|
|
111
|
-
"session_id": session_id})
|
|
112
|
-
latest = await call("context_get", {"slug": slug, "key": "latest",
|
|
113
|
-
"session_id": session_id})
|
|
114
|
-
stored_tail = await call("context_get", {"slug": slug, "key": "tail",
|
|
115
|
-
"session_id": session_id})
|
|
116
|
-
if latest is None or stored_tail is None:
|
|
117
|
-
raise AssertionError("synthetic latest/tail checkpoint payload is null")
|
|
118
|
-
checks.append("synthetic latest/tail/goal/phase/delegation checkpoint: PASS")
|
|
119
|
-
|
|
120
|
-
os.environ.pop("PANTHEON_COMPACTION", None)
|
|
121
|
-
os.environ.pop("PANTHEON_SESSION_END_SUMMARY", None)
|
|
122
|
-
blocks = await call("context_rehydrate", {"slug": slug,
|
|
123
|
-
"session_id": session_id})
|
|
124
|
-
summary = await call("context_session_summary", {"slug": slug,
|
|
125
|
-
"session_id": session_id})
|
|
126
|
-
if not isinstance(blocks, list) or not blocks:
|
|
127
|
-
raise AssertionError("context_rehydrate returned a null/empty payload")
|
|
128
|
-
if not isinstance(summary, str) or not summary:
|
|
129
|
-
raise AssertionError("context_session_summary returned a null/empty payload")
|
|
130
|
-
for fragment in ("verify context recovery", "phase 2/3", "apo-probe",
|
|
131
|
-
"phase 2 payload validated"):
|
|
132
|
-
if not any(fragment in block for block in blocks) and fragment not in summary:
|
|
133
|
-
raise AssertionError(f"payload is missing {fragment!r}")
|
|
134
|
-
checks.append("context_rehydrate non-null payload: PASS")
|
|
135
|
-
checks.append("context_session_summary non-null payload: PASS")
|
|
136
|
-
|
|
137
|
-
missing_blocks = await call("context_rehydrate", {"slug": "probe-absent",
|
|
138
|
-
"session_id": session_id})
|
|
139
|
-
missing_summary = await call("context_session_summary", {"slug": "probe-absent",
|
|
140
|
-
"session_id": session_id})
|
|
141
|
-
if missing_blocks is not None or missing_summary is not None:
|
|
142
|
-
raise AssertionError("absent checkpoint must return null payloads")
|
|
143
|
-
checks.append("absence returns null: PASS")
|
|
144
|
-
|
|
145
|
-
expired_slug = "context-expired-probe"
|
|
146
|
-
await call("context_save", {"slug": expired_slug, "key": "phase:1",
|
|
147
|
-
"content": json.dumps(checkpoint), "ttl": 1,
|
|
148
|
-
"session_id": session_id})
|
|
149
|
-
# Use the public TTL contract (positive seconds) and let the entry expire;
|
|
150
|
-
# negative TTLs are rejected by validation and must not be special-cased.
|
|
151
|
-
await asyncio.sleep(1.2)
|
|
152
|
-
expired_blocks = await call("context_rehydrate", {"slug": expired_slug,
|
|
153
|
-
"session_id": session_id})
|
|
154
|
-
expired_summary = await call("context_session_summary", {"slug": expired_slug,
|
|
155
|
-
"session_id": session_id})
|
|
156
|
-
if expired_blocks is not None or expired_summary is not None:
|
|
157
|
-
raise AssertionError("expired checkpoint must return null payloads")
|
|
158
|
-
checks.append("expiration returns null: PASS")
|
|
159
|
-
|
|
160
|
-
invalid_slug = "context-invalid-probe"
|
|
161
|
-
await call("context_save", {"slug": invalid_slug, "key": "phase:1",
|
|
162
|
-
"content": "not-json", "session_id": session_id})
|
|
163
|
-
invalid_blocks = await call("context_rehydrate", {"slug": invalid_slug,
|
|
164
|
-
"session_id": session_id})
|
|
165
|
-
invalid_summary = await call("context_session_summary", {"slug": invalid_slug,
|
|
166
|
-
"session_id": session_id})
|
|
167
|
-
if invalid_blocks is not None or invalid_summary is not None:
|
|
168
|
-
raise AssertionError("invalid checkpoint must return null payloads")
|
|
169
|
-
checks.append("invalid payload returns null: PASS")
|
|
170
|
-
|
|
171
|
-
os.environ["PANTHEON_COMPACTION"] = "off"
|
|
172
|
-
switched_blocks = await call("context_rehydrate", {"slug": slug,
|
|
173
|
-
"session_id": session_id})
|
|
174
|
-
if switched_blocks is not None:
|
|
175
|
-
raise AssertionError("PANTHEON_COMPACTION=off must return null")
|
|
176
|
-
os.environ.pop("PANTHEON_COMPACTION", None)
|
|
177
|
-
os.environ["PANTHEON_SESSION_END_SUMMARY"] = "off"
|
|
178
|
-
switched_summary = await call("context_session_summary", {"slug": slug,
|
|
179
|
-
"session_id": session_id})
|
|
180
|
-
if switched_summary is not None:
|
|
181
|
-
raise AssertionError("PANTHEON_SESSION_END_SUMMARY=off must return null")
|
|
182
|
-
checks.append("kill-switches return null: PASS")
|
|
183
|
-
print(json.dumps({"checks": checks}))
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
asyncio.run(main())
|
|
187
|
-
`
|
|
188
|
-
|
|
189
|
-
async function main() {
|
|
190
|
-
if (requestedVersion !== 'v1' && requestedVersion !== 'v2') {
|
|
191
|
-
emit('FAIL', 'usage: --version v1|v2 [--json]')
|
|
192
|
-
return
|
|
193
|
-
}
|
|
194
|
-
if (!existsSync(runtime)) {
|
|
195
|
-
unavailable('installed package does not include mcp_persistence.py')
|
|
196
|
-
return
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const root = mkdtempSync(join(tmpdir(), 'pantheon-context-probe-'))
|
|
200
|
-
const dbRoot = join(root, 'db')
|
|
201
|
-
const python = pythonCandidates().find((candidate) =>
|
|
202
|
-
candidate.includes('/') ? existsSync(candidate) : true,
|
|
203
|
-
)
|
|
204
|
-
if (!python) {
|
|
205
|
-
rmSync(root, { recursive: true, force: true })
|
|
206
|
-
unavailable('Python persistence runtime is not available')
|
|
207
|
-
return
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
try {
|
|
211
|
-
const child = spawnSync(python, ['-c', PYTHON_HARNESS, runtime, dbRoot], {
|
|
212
|
-
encoding: 'utf8',
|
|
213
|
-
timeout: 30000,
|
|
214
|
-
env: process.env,
|
|
215
|
-
})
|
|
216
|
-
if (child.error) {
|
|
217
|
-
const detail = child.error instanceof Error ? child.error.message : String(child.error)
|
|
218
|
-
if (/EACCES|permission denied|not found/i.test(detail)) {
|
|
219
|
-
emit('AMBIENTAL', `persistence runtime unavailable: ${detail}`)
|
|
220
|
-
} else {
|
|
221
|
-
unavailable(`persistence runtime unavailable: ${detail}`)
|
|
222
|
-
}
|
|
223
|
-
return
|
|
224
|
-
}
|
|
225
|
-
if (child.signal === 'SIGTERM') {
|
|
226
|
-
emit('AMBIENTAL', 'persistence probe timed out after 30s')
|
|
227
|
-
return
|
|
228
|
-
}
|
|
229
|
-
if (/IncompleteFieldDefinitionWarning|pydantic_settings/i.test(child.stderr)) {
|
|
230
|
-
emit('FAIL', 'persistence probe emitted an incomplete pydantic_settings field warning')
|
|
231
|
-
return
|
|
232
|
-
}
|
|
233
|
-
if (child.status !== 0) {
|
|
234
|
-
const detail = `${child.stderr || child.stdout || 'persistence probe failed'}`.trim()
|
|
235
|
-
if (
|
|
236
|
-
/No module named|ModuleNotFoundError|can't open file|No such file|importerror/i.test(detail)
|
|
237
|
-
) {
|
|
238
|
-
unavailable(`persistence runtime unavailable: ${detail.slice(0, 320)}`)
|
|
239
|
-
} else {
|
|
240
|
-
emit('FAIL', `offline persistence checks failed: ${detail.slice(0, 320)}`)
|
|
241
|
-
}
|
|
242
|
-
return
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const lines = child.stdout.trim().split('\n').filter(Boolean)
|
|
246
|
-
const payload = JSON.parse(lines.at(-1) || '')
|
|
247
|
-
if (!Array.isArray(payload.checks) || payload.checks.length < 6) {
|
|
248
|
-
emit('FAIL', 'offline persistence probe returned incomplete checks')
|
|
249
|
-
return
|
|
250
|
-
}
|
|
251
|
-
emit(
|
|
252
|
-
'PASS',
|
|
253
|
-
'offline synthetic persistence checks passed; no LLM or user DB was used',
|
|
254
|
-
payload.checks,
|
|
255
|
-
)
|
|
256
|
-
} catch (error) {
|
|
257
|
-
emit('FAIL', error instanceof Error ? error.message : String(error))
|
|
258
|
-
} finally {
|
|
259
|
-
rmSync(root, { recursive: true, force: true })
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
await main()
|