ltcai 9.6.0 → 9.8.0
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/README.md +98 -306
- package/auto_setup.py +11 -1
- package/docs/CHANGELOG.md +91 -0
- package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
- package/docs/DEVELOPMENT.md +1 -1
- package/docs/ONBOARDING.md +1 -1
- package/docs/PERFORMANCE.md +106 -0
- package/docs/TRUST_MODEL.md +1 -1
- package/docs/WHY_LATTICE.md +1 -1
- package/docs/kg-schema.md +1 -1
- package/kg_schema.py +11 -1
- package/knowledge_graph.py +12 -2
- package/knowledge_graph_api.py +11 -1
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/graph/proactive.py +583 -0
- package/lattice_brain/graph/retrieval.py +301 -8
- package/lattice_brain/graph/retrieval_vector.py +145 -0
- package/lattice_brain/ingestion.py +757 -16
- package/lattice_brain/quality.py +44 -9
- package/lattice_brain/runtime/multi_agent.py +38 -2
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/brain_intelligence.py +39 -2
- package/latticeai/api/change_proposals.py +32 -3
- package/latticeai/api/chat.py +17 -0
- package/latticeai/api/chat_helpers.py +48 -0
- package/latticeai/api/chat_stream.py +9 -1
- package/latticeai/api/local_files.py +120 -2
- package/latticeai/api/review_queue.py +66 -2
- package/latticeai/app_factory.py +3 -0
- package/latticeai/core/agent.py +193 -135
- package/latticeai/core/agent_eval.py +278 -4
- package/latticeai/core/legacy_compatibility.py +15 -1
- package/latticeai/core/marketplace.py +1 -1
- package/latticeai/core/workspace_os.py +1 -1
- package/latticeai/runtime/router_registration.py +2 -0
- package/latticeai/services/architecture_readiness.py +1 -1
- package/latticeai/services/automation_intelligence.py +151 -14
- package/latticeai/services/brain_intelligence.py +169 -1
- package/latticeai/services/change_proposals.py +56 -4
- package/latticeai/services/product_readiness.py +1 -1
- package/latticeai/services/review_queue.py +43 -2
- package/llm_router.py +10 -1
- package/local_knowledge_api.py +10 -1
- package/ltcai_cli.py +11 -1
- package/mcp_registry.py +10 -1
- package/p_reinforce.py +10 -1
- package/package.json +1 -1
- package/scripts/brain_quality_eval.py +1 -1
- package/scripts/check_current_release_docs.mjs +1 -1
- package/scripts/profile_kg.py +360 -0
- package/setup_wizard.py +10 -1
- package/src-tauri/Cargo.lock +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/tauri.conf.json +1 -1
- package/static/app/asset-manifest.json +11 -11
- package/static/app/assets/{Act-BkOEmwBi.js → Act-Dd3z8AzF.js} +2 -1
- package/static/app/assets/Brain-BMkgdWnI.js +321 -0
- package/static/app/assets/Capture-D2Aw9gkv.js +1 -0
- package/static/app/assets/Library-Yreq-KW5.js +1 -0
- package/static/app/assets/System-CXNmmtEo.js +1 -0
- package/static/app/assets/{index-85wQvEie.css → index-7gY9t9Sd.css} +1 -1
- package/static/app/assets/index-CndfILiF.js +18 -0
- package/static/app/assets/primitives-DxsIXb6G.js +1 -0
- package/static/app/assets/textarea-DH7ne8VI.js +1 -0
- package/static/app/index.html +2 -2
- package/static/sw.js +1 -1
- package/static/app/assets/Brain-C9ITUsQ_.js +0 -321
- package/static/app/assets/Capture-C-ppTeud.js +0 -1
- package/static/app/assets/Library-CGQbgWTu.js +0 -1
- package/static/app/assets/System-djmj0n2_.js +0 -1
- package/static/app/assets/index-AF0-4XVv.js +0 -18
- package/static/app/assets/primitives-jbb2qv4Q.js +0 -1
- package/static/app/assets/textarea-CFoo0OxJ.js +0 -1
|
@@ -34,6 +34,7 @@ from latticeai.core.agent import (
|
|
|
34
34
|
AgentState,
|
|
35
35
|
SingleAgentRuntime,
|
|
36
36
|
)
|
|
37
|
+
from latticeai.tools import ToolError
|
|
37
38
|
|
|
38
39
|
_AUTO_POLICY = {
|
|
39
40
|
"auto_approve": True, "risk": "low", "shell": False, "network": False,
|
|
@@ -43,6 +44,61 @@ _DESTRUCTIVE_POLICY = {
|
|
|
43
44
|
"auto_approve": False, "risk": "destructive", "shell": True, "network": False,
|
|
44
45
|
"destructive": True, "sandbox": False, "rollback": "none",
|
|
45
46
|
}
|
|
47
|
+
# Mirrors production write-tool governance when the change governor is wired:
|
|
48
|
+
# not auto-approved, so only the governor's additive/proposed verdicts (never
|
|
49
|
+
# the model) decide whether a write runs or is staged for review.
|
|
50
|
+
_GOVERNED_WRITE_POLICY = {
|
|
51
|
+
"auto_approve": False, "risk": "write", "shell": False, "network": False,
|
|
52
|
+
"destructive": False, "sandbox": "workspace", "rollback": "git",
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Deterministic Brain-port fixtures. Grounding scenarios assert their final
|
|
56
|
+
# message against these exact values (node ids, concepts, snippets), so a
|
|
57
|
+
# response that was not derived from the tool result — a hallucination in
|
|
58
|
+
# loop terms — cannot pass.
|
|
59
|
+
_EVAL_INGEST_RESULT = {
|
|
60
|
+
"ok": True,
|
|
61
|
+
"node_id": "node-ing-1",
|
|
62
|
+
"concepts": ["mlx", "quantization"],
|
|
63
|
+
"relations": [{"from": "mlx", "to": "quantization", "type": "related_to"}],
|
|
64
|
+
}
|
|
65
|
+
_EVAL_SEARCH_RESULT = {
|
|
66
|
+
"ok": True,
|
|
67
|
+
"matches": [
|
|
68
|
+
{"id": "node-42", "title": "Q3 roadmap", "snippet": "ship v9.8 by August"}
|
|
69
|
+
],
|
|
70
|
+
"count": 1,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class _EvalChangeGovernor:
|
|
75
|
+
"""Deterministic stand-in for ChangeProposalService's governor port.
|
|
76
|
+
|
|
77
|
+
Mirrors the wire contract of
|
|
78
|
+
:meth:`latticeai.services.change_proposals.ChangeProposalService.review`:
|
|
79
|
+
``None`` falls through, additive writes get ``allow_additive``, and
|
|
80
|
+
mutations of "existing" paths come back ``proposed`` with a proposal id —
|
|
81
|
+
exactly what the agent loop routes into the review queue.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
governed_tools = frozenset({"write_file", "edit_file"})
|
|
85
|
+
|
|
86
|
+
def __init__(self) -> None:
|
|
87
|
+
self.proposals: List[Dict[str, Any]] = []
|
|
88
|
+
|
|
89
|
+
def review(self, name, args, *, policy=None, user_email=None, workspace_id=None, conversation_id=None):
|
|
90
|
+
if name not in self.governed_tools:
|
|
91
|
+
return None
|
|
92
|
+
path = str(args.get("path") or "")
|
|
93
|
+
if path.startswith("existing"):
|
|
94
|
+
proposal = {"id": f"eval-proposal-{len(self.proposals) + 1}", "path": path}
|
|
95
|
+
self.proposals.append(proposal)
|
|
96
|
+
return {
|
|
97
|
+
"decision": "proposed",
|
|
98
|
+
"classification": {"change_class": "mutation"},
|
|
99
|
+
"proposal": proposal,
|
|
100
|
+
}
|
|
101
|
+
return {"decision": "allow_additive", "classification": {"change_class": "additive"}}
|
|
46
102
|
|
|
47
103
|
|
|
48
104
|
@dataclass
|
|
@@ -56,6 +112,16 @@ class Scenario:
|
|
|
56
112
|
expect_min: Dict[str, int] = field(default_factory=dict)
|
|
57
113
|
expect_exact: Dict[str, Any] = field(default_factory=dict)
|
|
58
114
|
expect_tool_outcomes: Dict[str, int] = field(default_factory=dict)
|
|
115
|
+
# Exact ordered sequence of tool names that actually executed (successful
|
|
116
|
+
# execute_tool calls only — proposed/blocked/failed calls never run).
|
|
117
|
+
expect_tool_calls: List[str] = field(default_factory=list)
|
|
118
|
+
# Wire a change governor so governed tools follow the proposal path.
|
|
119
|
+
use_governor: bool = False
|
|
120
|
+
# Substrings the final user-facing message must contain. Grounding
|
|
121
|
+
# scenarios point these at tokens that only exist in the fake tool port's
|
|
122
|
+
# canned results (node ids, snippets, proposal ids), so an answer that is
|
|
123
|
+
# not grounded in the retrieved/executed evidence fails the scenario.
|
|
124
|
+
expect_final_contains: List[str] = field(default_factory=list)
|
|
59
125
|
max_steps: int = 8
|
|
60
126
|
|
|
61
127
|
|
|
@@ -69,7 +135,12 @@ class _Req:
|
|
|
69
135
|
self.message = message
|
|
70
136
|
|
|
71
137
|
|
|
72
|
-
def _build_deps(
|
|
138
|
+
def _build_deps(
|
|
139
|
+
replies: List[str],
|
|
140
|
+
tool_log: List[Dict[str, Any]],
|
|
141
|
+
*,
|
|
142
|
+
governor: Any = None,
|
|
143
|
+
) -> AgentDeps:
|
|
73
144
|
queue = list(replies)
|
|
74
145
|
|
|
75
146
|
async def generate_as(model_id, message, context, max_tokens, temperature):
|
|
@@ -83,14 +154,27 @@ def _build_deps(replies: List[str], tool_log: List[Dict[str, Any]]) -> AgentDeps
|
|
|
83
154
|
return '{"action": "noop"}'
|
|
84
155
|
|
|
85
156
|
def execute_tool(name: str, args: dict) -> dict:
|
|
157
|
+
# File-producing tools fail like the real dispatcher when the model
|
|
158
|
+
# forgets the target path — scenarios use this to exercise recovery.
|
|
159
|
+
if name in ("write_file", "generate_file") and not args.get("path"):
|
|
160
|
+
raise ToolError(f"{name} requires args.path")
|
|
86
161
|
tool_log.append({"name": name, "args": args})
|
|
162
|
+
# Brain ports return canned, stable payloads so grounding scenarios
|
|
163
|
+
# can assert the final answer cites what was actually retrieved.
|
|
164
|
+
if name == "knowledge_graph_ingest":
|
|
165
|
+
return dict(_EVAL_INGEST_RESULT)
|
|
166
|
+
if name == "knowledge_graph_search":
|
|
167
|
+
return dict(_EVAL_SEARCH_RESULT)
|
|
87
168
|
return {"ok": True, "path": args.get("path", "")}
|
|
88
169
|
|
|
89
170
|
def policy_for(name: str, args: dict) -> dict:
|
|
90
171
|
if name == "delete_everything":
|
|
91
172
|
return dict(_DESTRUCTIVE_POLICY)
|
|
173
|
+
if governor is not None and name in ("write_file", "edit_file"):
|
|
174
|
+
return dict(_GOVERNED_WRITE_POLICY)
|
|
92
175
|
return dict(_AUTO_POLICY)
|
|
93
176
|
|
|
177
|
+
write_policy = dict(_GOVERNED_WRITE_POLICY) if governor is not None else dict(_AUTO_POLICY)
|
|
94
178
|
return AgentDeps(
|
|
95
179
|
generate_as=generate_as,
|
|
96
180
|
generate=generate,
|
|
@@ -99,17 +183,21 @@ def _build_deps(replies: List[str], tool_log: List[Dict[str, Any]]) -> AgentDeps
|
|
|
99
183
|
risk_level=lambda p: p["risk"],
|
|
100
184
|
check_role=lambda name, user: None,
|
|
101
185
|
tool_governance={
|
|
102
|
-
"write_file":
|
|
186
|
+
"write_file": write_policy,
|
|
103
187
|
"read_file": dict(_AUTO_POLICY),
|
|
188
|
+
"generate_file": dict(_AUTO_POLICY),
|
|
189
|
+
"knowledge_graph_ingest": dict(_AUTO_POLICY),
|
|
190
|
+
"knowledge_graph_search": dict(_AUTO_POLICY),
|
|
104
191
|
"delete_everything": dict(_DESTRUCTIVE_POLICY),
|
|
105
192
|
},
|
|
106
|
-
file_create_actions=frozenset({"write_file"}),
|
|
193
|
+
file_create_actions=frozenset({"write_file", "generate_file"}),
|
|
107
194
|
recent_chat_context=lambda **kw: "",
|
|
108
195
|
clear_history=lambda keep: {"ok": True},
|
|
109
196
|
knowledge_save=lambda *a, **kw: None,
|
|
110
197
|
audit=lambda *a, **kw: None,
|
|
111
198
|
planner_prompt="plan", executor_prompt="exec", critic_prompt="critic",
|
|
112
199
|
memory_updater_prompt="mem", agent_root=Path("/tmp/agent-eval"),
|
|
200
|
+
change_governor=governor,
|
|
113
201
|
)
|
|
114
202
|
|
|
115
203
|
|
|
@@ -193,12 +281,185 @@ def default_scenarios() -> List[Scenario]:
|
|
|
193
281
|
expect_min={"parse_errors": 3},
|
|
194
282
|
expect_exact={"tool_outcomes": {}},
|
|
195
283
|
),
|
|
284
|
+
# ── file generation ─────────────────────────────────────────────
|
|
285
|
+
Scenario(
|
|
286
|
+
name="file-generation-happy-path",
|
|
287
|
+
replies=[
|
|
288
|
+
'{"action": "plan", "goal": "generate landing page", '
|
|
289
|
+
'"steps": [{"action": "generate_file"}]}',
|
|
290
|
+
# Small local models wrap the payload in reasoning + fences;
|
|
291
|
+
# the loop must still extract one clean tool call.
|
|
292
|
+
"<think>layout first, then hero copy</think>\n"
|
|
293
|
+
'```json\n{"thoughts": "produce the full document", '
|
|
294
|
+
'"action": "generate_file", "args": {"path": "site/index.html", '
|
|
295
|
+
'"content": "<!DOCTYPE html><html><body>hello</body></html>"}}\n```',
|
|
296
|
+
_FINAL,
|
|
297
|
+
_PASS,
|
|
298
|
+
],
|
|
299
|
+
expect_exact={"parse_errors": 0},
|
|
300
|
+
expect_tool_outcomes={"ok": 1},
|
|
301
|
+
expect_tool_calls=["generate_file"],
|
|
302
|
+
),
|
|
303
|
+
Scenario(
|
|
304
|
+
name="file-generation-bad-args-recovers",
|
|
305
|
+
replies=[
|
|
306
|
+
'{"action": "plan", "goal": "generate report", '
|
|
307
|
+
'"steps": [{"action": "generate_file"}]}',
|
|
308
|
+
# Malformed tool call: the model forgot the target path, the
|
|
309
|
+
# tool port fails like the real dispatcher would…
|
|
310
|
+
'{"thoughts": "write it", "action": "generate_file", '
|
|
311
|
+
'"args": {"content": "<html></html>"}}',
|
|
312
|
+
# …and the next turn recovers with a complete call.
|
|
313
|
+
'{"thoughts": "add the missing path", "action": "generate_file", '
|
|
314
|
+
'"args": {"path": "reports/q3.html", "content": "<html></html>"}}',
|
|
315
|
+
_FINAL,
|
|
316
|
+
_PASS,
|
|
317
|
+
],
|
|
318
|
+
expect_tool_outcomes={"error": 1, "ok": 1},
|
|
319
|
+
expect_tool_calls=["generate_file"],
|
|
320
|
+
),
|
|
321
|
+
# ── multi-step workflow ─────────────────────────────────────────
|
|
322
|
+
Scenario(
|
|
323
|
+
name="multi-step-workflow-chain",
|
|
324
|
+
replies=[
|
|
325
|
+
'{"action": "plan", "goal": "read spec, generate report, save summary", '
|
|
326
|
+
'"steps": [{"action": "read_file"}, {"action": "generate_file"}, '
|
|
327
|
+
'{"action": "write_file"}]}',
|
|
328
|
+
'{"thoughts": "step 1: read the source spec", '
|
|
329
|
+
'"action": "read_file", "args": {"path": "spec.md"}}',
|
|
330
|
+
'{"thoughts": "step 2: the spec asks for an HTML report", '
|
|
331
|
+
'"action": "generate_file", "args": {"path": "report.html", '
|
|
332
|
+
'"content": "<html><body>report</body></html>"}}',
|
|
333
|
+
'{"thoughts": "step 3: persist a short summary next to it", '
|
|
334
|
+
'"action": "write_file", "args": {"path": "summary.txt", '
|
|
335
|
+
'"content": "report generated"}}',
|
|
336
|
+
_FINAL,
|
|
337
|
+
_PASS,
|
|
338
|
+
],
|
|
339
|
+
expect_exact={"parse_errors": 0},
|
|
340
|
+
expect_min={"llm_calls": 6},
|
|
341
|
+
expect_tool_outcomes={"ok": 3},
|
|
342
|
+
expect_tool_calls=["read_file", "generate_file", "write_file"],
|
|
343
|
+
),
|
|
344
|
+
# ── governed-tool proposal path ─────────────────────────────────
|
|
345
|
+
Scenario(
|
|
346
|
+
name="governed-write-proposal-path",
|
|
347
|
+
use_governor=True,
|
|
348
|
+
replies=[
|
|
349
|
+
# write_file is NOT auto-approved here, but it is governed —
|
|
350
|
+
# approve() must not hard-block the plan (core invariant:
|
|
351
|
+
# governed tools are excluded from the non-auto set).
|
|
352
|
+
'{"action": "plan", "goal": "update existing page, add new note", '
|
|
353
|
+
'"steps": [{"action": "write_file"}]}',
|
|
354
|
+
# Mutation of existing content → staged as proposal, not written.
|
|
355
|
+
'{"thoughts": "rewrite the existing page", "action": "write_file", '
|
|
356
|
+
'"args": {"path": "existing/site.html", "content": "<new>"}}',
|
|
357
|
+
# Additive create → governor allows it to run immediately.
|
|
358
|
+
'{"thoughts": "add a fresh note", "action": "write_file", '
|
|
359
|
+
'"args": {"path": "fresh/new-note.md", "content": "hello"}}',
|
|
360
|
+
_FINAL,
|
|
361
|
+
_PASS,
|
|
362
|
+
],
|
|
363
|
+
expect_exact={"parse_errors": 0},
|
|
364
|
+
expect_tool_outcomes={"proposed": 1, "ok": 1},
|
|
365
|
+
expect_tool_calls=["write_file"],
|
|
366
|
+
),
|
|
367
|
+
# ── brain ingestion ─────────────────────────────────────────────
|
|
368
|
+
Scenario(
|
|
369
|
+
name="ingestion-chain-confirms-save",
|
|
370
|
+
replies=[
|
|
371
|
+
'{"action": "plan", "goal": "ingest web article into the Brain", '
|
|
372
|
+
'"steps": [{"action": "knowledge_graph_ingest"}]}',
|
|
373
|
+
# Weak-model dressing (think block) around a clean ingest call.
|
|
374
|
+
"<think>save the text first, then confirm with the node id</think>\n"
|
|
375
|
+
'{"thoughts": "ingest the pasted article", '
|
|
376
|
+
'"action": "knowledge_graph_ingest", "args": {"source": "web", '
|
|
377
|
+
'"url": "https://example.com/mlx-notes", '
|
|
378
|
+
'"text": "MLX quantization notes"}}',
|
|
379
|
+
# Confirmation cites the node id the ingest port returned —
|
|
380
|
+
# the loop must carry the tool result into the final turn.
|
|
381
|
+
'{"action": "final", "message": "Saved to the Brain as node-ing-1."}',
|
|
382
|
+
_PASS,
|
|
383
|
+
],
|
|
384
|
+
expect_exact={"parse_errors": 0},
|
|
385
|
+
expect_tool_outcomes={"ok": 1},
|
|
386
|
+
expect_tool_calls=["knowledge_graph_ingest"],
|
|
387
|
+
expect_final_contains=["node-ing-1"],
|
|
388
|
+
),
|
|
389
|
+
# ── concept extraction ──────────────────────────────────────────
|
|
390
|
+
Scenario(
|
|
391
|
+
name="concept-extraction-reflected-in-answer",
|
|
392
|
+
replies=[
|
|
393
|
+
'{"action": "plan", "goal": "ingest the note and report extracted concepts", '
|
|
394
|
+
'"steps": [{"action": "knowledge_graph_ingest"}]}',
|
|
395
|
+
'{"thoughts": "ingest the file so the pipeline extracts concepts", '
|
|
396
|
+
'"action": "knowledge_graph_ingest", "args": {"source": "file", '
|
|
397
|
+
'"path": "notes/mlx.md", "text": "quantization on MLX"}}',
|
|
398
|
+
# The confirmation must surface what the pipeline extracted
|
|
399
|
+
# (concepts + relation), not merely say "done".
|
|
400
|
+
'{"action": "final", "message": "Ingested notes/mlx.md - extracted '
|
|
401
|
+
'concepts mlx and quantization (mlx -> quantization, related_to)."}',
|
|
402
|
+
_PASS,
|
|
403
|
+
],
|
|
404
|
+
expect_exact={"parse_errors": 0},
|
|
405
|
+
expect_tool_outcomes={"ok": 1},
|
|
406
|
+
expect_tool_calls=["knowledge_graph_ingest"],
|
|
407
|
+
expect_final_contains=["mlx", "quantization", "related_to"],
|
|
408
|
+
),
|
|
409
|
+
# ── RAG-grounded answer ─────────────────────────────────────────
|
|
410
|
+
Scenario(
|
|
411
|
+
name="rag-grounded-answer-cites-retrieval",
|
|
412
|
+
replies=[
|
|
413
|
+
'{"action": "plan", "goal": "answer from the Brain, not from priors", '
|
|
414
|
+
'"steps": [{"action": "knowledge_graph_search"}]}',
|
|
415
|
+
'{"thoughts": "retrieve evidence before answering", '
|
|
416
|
+
'"action": "knowledge_graph_search", "args": {"query": "Q3 roadmap"}}',
|
|
417
|
+
# Grounded: cites the retrieved node id and snippet — both exist
|
|
418
|
+
# only in the fake port's canned search result, so an ungrounded
|
|
419
|
+
# (hallucinated) final message cannot satisfy the expectation.
|
|
420
|
+
'{"action": "final", "message": "Per Q3 roadmap (node-42): ship v9.8 by August."}',
|
|
421
|
+
_PASS,
|
|
422
|
+
],
|
|
423
|
+
expect_exact={"parse_errors": 0},
|
|
424
|
+
expect_tool_outcomes={"ok": 1},
|
|
425
|
+
expect_tool_calls=["knowledge_graph_search"],
|
|
426
|
+
expect_final_contains=["node-42", "ship v9.8 by August"],
|
|
427
|
+
),
|
|
428
|
+
# ── automation suggestion under proposal-first governance ───────
|
|
429
|
+
Scenario(
|
|
430
|
+
name="automation-suggestion-proposal-first",
|
|
431
|
+
use_governor=True,
|
|
432
|
+
replies=[
|
|
433
|
+
'{"action": "plan", "goal": "recurring daily question detected - stage a '
|
|
434
|
+
'digest automation for review", '
|
|
435
|
+
'"steps": [{"action": "knowledge_graph_search"}, {"action": "write_file"}]}',
|
|
436
|
+
# Evidence first: confirm the repeated pattern from the Brain.
|
|
437
|
+
'{"thoughts": "confirm the pattern is real before suggesting automation", '
|
|
438
|
+
'"action": "knowledge_graph_search", '
|
|
439
|
+
'"args": {"query": "recurring question daily digest"}}',
|
|
440
|
+
# Proposal-first: changing existing automation state is a
|
|
441
|
+
# mutation, so the governor stages it as a review proposal —
|
|
442
|
+
# the model can never silently install/enable an automation.
|
|
443
|
+
'{"thoughts": "stage the automation as a reviewable proposal", '
|
|
444
|
+
'"action": "write_file", '
|
|
445
|
+
'"args": {"path": "existing/automations/daily-digest.json", '
|
|
446
|
+
'"content": "trigger interval, disabled draft, review_queue"}}',
|
|
447
|
+
'{"action": "final", "message": "Automation staged for review as '
|
|
448
|
+
'eval-proposal-1 - enable it from the review queue."}',
|
|
449
|
+
_PASS,
|
|
450
|
+
],
|
|
451
|
+
expect_exact={"parse_errors": 0},
|
|
452
|
+
expect_tool_outcomes={"ok": 1, "proposed": 1},
|
|
453
|
+
expect_tool_calls=["knowledge_graph_search"],
|
|
454
|
+
expect_final_contains=["eval-proposal-1", "review"],
|
|
455
|
+
),
|
|
196
456
|
]
|
|
197
457
|
|
|
198
458
|
|
|
199
459
|
async def _run_scenario(scenario: Scenario) -> Dict[str, Any]:
|
|
200
460
|
tool_log: List[Dict[str, Any]] = []
|
|
201
|
-
|
|
461
|
+
governor = _EvalChangeGovernor() if scenario.use_governor else None
|
|
462
|
+
deps = _build_deps(scenario.replies, tool_log, governor=governor)
|
|
202
463
|
runtime = SingleAgentRuntime(deps)
|
|
203
464
|
ctx = AgentRunContext()
|
|
204
465
|
ctx.state = AgentState.PLANNING
|
|
@@ -226,6 +487,17 @@ async def _run_scenario(scenario: Scenario) -> Dict[str, Any]:
|
|
|
226
487
|
failures.append(
|
|
227
488
|
f"tool_outcomes[{outcome}]={summary['tool_outcomes'].get(outcome, 0)} != {count}"
|
|
228
489
|
)
|
|
490
|
+
executed = [call["name"] for call in tool_log]
|
|
491
|
+
if scenario.expect_tool_calls and executed != scenario.expect_tool_calls:
|
|
492
|
+
failures.append(f"tool_calls={executed} != {scenario.expect_tool_calls}")
|
|
493
|
+
for needle in scenario.expect_final_contains:
|
|
494
|
+
if needle not in ctx.final_message:
|
|
495
|
+
failures.append(f"final_message missing {needle!r}")
|
|
496
|
+
if governor is not None and summary["tool_outcomes"].get("proposed", 0) != len(governor.proposals):
|
|
497
|
+
failures.append(
|
|
498
|
+
f"governor proposals={len(governor.proposals)} != "
|
|
499
|
+
f"traced proposed={summary['tool_outcomes'].get('proposed', 0)}"
|
|
500
|
+
)
|
|
229
501
|
return {
|
|
230
502
|
"name": scenario.name,
|
|
231
503
|
"ok": not failures,
|
|
@@ -233,6 +505,8 @@ async def _run_scenario(scenario: Scenario) -> Dict[str, Any]:
|
|
|
233
505
|
"final_state": ctx.state.value,
|
|
234
506
|
"summary": summary,
|
|
235
507
|
"tool_calls": len(tool_log),
|
|
508
|
+
"executed_tools": executed,
|
|
509
|
+
"proposals": len(governor.proposals) if governor is not None else 0,
|
|
236
510
|
}
|
|
237
511
|
|
|
238
512
|
|
|
@@ -14,7 +14,7 @@ from pathlib import Path
|
|
|
14
14
|
from typing import Any, Dict, List
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
LEGACY_COMPATIBILITY_VERSION = "9.
|
|
17
|
+
LEGACY_COMPATIBILITY_VERSION = "9.8.0"
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
@dataclass(frozen=True)
|
|
@@ -82,6 +82,20 @@ LEGACY_SHIMS: List[LegacyShim] = [
|
|
|
82
82
|
reason="Old gardener scripts referenced the root reinforcement helper.",
|
|
83
83
|
removal_phase="major-release-after-8.x",
|
|
84
84
|
),
|
|
85
|
+
LegacyShim(
|
|
86
|
+
path="mcp_registry.py",
|
|
87
|
+
owner="latticeai.core.mcp_registry",
|
|
88
|
+
replacement="import latticeai.core.mcp_registry",
|
|
89
|
+
reason="Older integrations imported the MCP registry from the repo root.",
|
|
90
|
+
removal_phase="major-release-after-9.x",
|
|
91
|
+
),
|
|
92
|
+
LegacyShim(
|
|
93
|
+
path="llm_router.py",
|
|
94
|
+
owner="latticeai.models.router",
|
|
95
|
+
replacement="import latticeai.models.router",
|
|
96
|
+
reason="Historical scripts and tests imported the LLM router from the repo root.",
|
|
97
|
+
removal_phase="major-release-after-9.x",
|
|
98
|
+
),
|
|
85
99
|
LegacyShim(
|
|
86
100
|
path="server.py",
|
|
87
101
|
owner="latticeai.server_app",
|
|
@@ -49,7 +49,7 @@ __all__ = [
|
|
|
49
49
|
"remove_skill_directory",
|
|
50
50
|
]
|
|
51
51
|
|
|
52
|
-
WORKSPACE_OS_VERSION = "9.
|
|
52
|
+
WORKSPACE_OS_VERSION = "9.8.0"
|
|
53
53
|
|
|
54
54
|
# Workspace types separate single-user Personal workspaces from shared
|
|
55
55
|
# Organization workspaces. Both keep the same local-first JSON store; the type
|
|
@@ -604,6 +604,7 @@ def register_review_and_brain_tail_routers(
|
|
|
604
604
|
gardener: Any,
|
|
605
605
|
create_setup_router: Any,
|
|
606
606
|
model_router: Any,
|
|
607
|
+
change_proposals: Any = None,
|
|
607
608
|
) -> Any:
|
|
608
609
|
"""Register the final review/browser/brain tail routes in legacy order."""
|
|
609
610
|
|
|
@@ -616,6 +617,7 @@ def register_review_and_brain_tail_routers(
|
|
|
616
617
|
gate_write=gate_write,
|
|
617
618
|
run_review_item=run_review_item,
|
|
618
619
|
append_audit_event=append_audit_event,
|
|
620
|
+
change_proposals=change_proposals,
|
|
619
621
|
),
|
|
620
622
|
create_browser_router(
|
|
621
623
|
pipeline=ingestion_pipeline,
|