tempergraph 0.7.1__py3-none-any.whl
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.
- tempergraph/__init__.py +8 -0
- tempergraph/__main__.py +5 -0
- tempergraph/api.py +428 -0
- tempergraph/audit/__init__.py +305 -0
- tempergraph/audit/catalog.py +342 -0
- tempergraph/audit/definition.py +387 -0
- tempergraph/audit/history.py +414 -0
- tempergraph/audit/history_rules.py +268 -0
- tempergraph/audit/history_rules_more.py +244 -0
- tempergraph/audit/host.py +270 -0
- tempergraph/audit/owned.py +96 -0
- tempergraph/audit/prompts.py +89 -0
- tempergraph/audit/report.py +248 -0
- tempergraph/audit/revisit.py +220 -0
- tempergraph/audit/surface.py +224 -0
- tempergraph/audit/text_health.py +176 -0
- tempergraph/audit/tools.py +391 -0
- tempergraph/author/__init__.py +2 -0
- tempergraph/author/blueprint.py +346 -0
- tempergraph/author/compare.py +122 -0
- tempergraph/author/criteria_lint.py +200 -0
- tempergraph/author/draw.py +112 -0
- tempergraph/author/inventory.py +210 -0
- tempergraph/author/literals.py +138 -0
- tempergraph/author/scaffold.py +568 -0
- tempergraph/author/session.py +439 -0
- tempergraph/author/trial.py +391 -0
- tempergraph/author/verify.py +353 -0
- tempergraph/builtin/__init__.py +1 -0
- tempergraph/builtin/upgrade.py +288 -0
- tempergraph/catalog.py +134 -0
- tempergraph/check_helpers.py +99 -0
- tempergraph/cli/__init__.py +1 -0
- tempergraph/cli/audit.py +190 -0
- tempergraph/cli/author.py +361 -0
- tempergraph/cli/improve.py +564 -0
- tempergraph/cli/improve_review.py +111 -0
- tempergraph/cli/install.py +35 -0
- tempergraph/cli/main.py +1261 -0
- tempergraph/cli/observe_cli.py +544 -0
- tempergraph/cli/outcome.py +77 -0
- tempergraph/cli/schedule_cli.py +1090 -0
- tempergraph/cli/upgrade.py +126 -0
- tempergraph/cli/workflows.py +96 -0
- tempergraph/compiler/__init__.py +6 -0
- tempergraph/compiler/graph.py +305 -0
- tempergraph/compiler/state.py +229 -0
- tempergraph/constants.py +72 -0
- tempergraph/contracts.py +1025 -0
- tempergraph/data/executor_compat.json +11 -0
- tempergraph/data/promotion.json +35 -0
- tempergraph/data/release.json +20 -0
- tempergraph/detach.py +65 -0
- tempergraph/docs.py +90 -0
- tempergraph/durability/__init__.py +2 -0
- tempergraph/durability/alias.py +66 -0
- tempergraph/durability/carry.py +591 -0
- tempergraph/durability/checkpoint.py +179 -0
- tempergraph/durability/control.py +109 -0
- tempergraph/durability/engine_file.py +301 -0
- tempergraph/durability/lock.py +138 -0
- tempergraph/durability/status.py +390 -0
- tempergraph/engine_identity.py +42 -0
- tempergraph/executor_compat.py +56 -0
- tempergraph/executors/__init__.py +4 -0
- tempergraph/executors/binding.py +91 -0
- tempergraph/executors/capabilities.py +95 -0
- tempergraph/executors/claude.py +603 -0
- tempergraph/executors/launcher.py +394 -0
- tempergraph/executors/mcpconfig.py +156 -0
- tempergraph/executors/mcpproxy.py +216 -0
- tempergraph/executors/preflight.py +196 -0
- tempergraph/executors/registry.py +71 -0
- tempergraph/executors/scripted.py +18 -0
- tempergraph/executors/session.py +107 -0
- tempergraph/executors/standins.py +118 -0
- tempergraph/executors/summary.py +110 -0
- tempergraph/executors/viewcatalog.py +27 -0
- tempergraph/git.py +403 -0
- tempergraph/identity.py +65 -0
- tempergraph/improve/__init__.py +5 -0
- tempergraph/improve/analysis.py +437 -0
- tempergraph/improve/artifact.py +477 -0
- tempergraph/improve/autonomy.py +192 -0
- tempergraph/improve/bindings.py +191 -0
- tempergraph/improve/calibration.py +1016 -0
- tempergraph/improve/causes.py +416 -0
- tempergraph/improve/child.py +651 -0
- tempergraph/improve/codehost.py +520 -0
- tempergraph/improve/digest.py +472 -0
- tempergraph/improve/escape.py +100 -0
- tempergraph/improve/filing.py +1047 -0
- tempergraph/improve/harvest.py +158 -0
- tempergraph/improve/issue_context.py +192 -0
- tempergraph/improve/lenses.py +204 -0
- tempergraph/improve/lessons.py +233 -0
- tempergraph/improve/loop_report.py +138 -0
- tempergraph/improve/loop_summary.py +85 -0
- tempergraph/improve/lost.py +119 -0
- tempergraph/improve/measure.py +121 -0
- tempergraph/improve/params.py +98 -0
- tempergraph/improve/pause_facts.py +134 -0
- tempergraph/improve/pr_later.py +186 -0
- tempergraph/improve/prebinding.py +130 -0
- tempergraph/improve/promotion.py +413 -0
- tempergraph/improve/proposals.py +934 -0
- tempergraph/improve/record.py +322 -0
- tempergraph/improve/release.py +89 -0
- tempergraph/improve/reliability.py +457 -0
- tempergraph/improve/repeat.py +115 -0
- tempergraph/improve/review.py +910 -0
- tempergraph/improve/suites.py +586 -0
- tempergraph/improve/trials.py +525 -0
- tempergraph/install/__init__.py +11 -0
- tempergraph/install/bootstrap.py +133 -0
- tempergraph/install/environment.py +173 -0
- tempergraph/install/launch.py +37 -0
- tempergraph/install/python.py +53 -0
- tempergraph/install/reconcile.py +52 -0
- tempergraph/install/selfcheck.py +29 -0
- tempergraph/install/shim.py +81 -0
- tempergraph/install/update.py +400 -0
- tempergraph/model/__init__.py +0 -0
- tempergraph/model/diagram.py +185 -0
- tempergraph/model/flow.py +324 -0
- tempergraph/model/prompt_lint.py +203 -0
- tempergraph/model/retire.py +52 -0
- tempergraph/model/subworkflow.py +274 -0
- tempergraph/model/text.py +67 -0
- tempergraph/model/validate.py +1158 -0
- tempergraph/observe/__init__.py +1 -0
- tempergraph/observe/attention.py +196 -0
- tempergraph/observe/detail.py +773 -0
- tempergraph/observe/forget.py +138 -0
- tempergraph/observe/hooks.py +272 -0
- tempergraph/observe/labels.py +95 -0
- tempergraph/observe/overlay.py +46 -0
- tempergraph/observe/report.py +402 -0
- tempergraph/observe/risk_report.py +110 -0
- tempergraph/observe/rows.py +444 -0
- tempergraph/observe/sinks.py +793 -0
- tempergraph/observe/supervision_cost.py +797 -0
- tempergraph/observe/supervision_report.py +295 -0
- tempergraph/observe/switch_report.py +140 -0
- tempergraph/package/__init__.py +2 -0
- tempergraph/package/change_report.py +116 -0
- tempergraph/package/changelog.py +263 -0
- tempergraph/package/docs_check.py +115 -0
- tempergraph/package/importer.py +90 -0
- tempergraph/package/inventory.py +111 -0
- tempergraph/package/loader.py +250 -0
- tempergraph/package/manifest.py +256 -0
- tempergraph/package/readiness.py +124 -0
- tempergraph/package/registry.py +383 -0
- tempergraph/package/rules.py +128 -0
- tempergraph/package/scan.py +65 -0
- tempergraph/package/selftest.py +348 -0
- tempergraph/package/stamp.py +213 -0
- tempergraph/package/transforms.py +481 -0
- tempergraph/package/upgrade.py +625 -0
- tempergraph/provenance.py +183 -0
- tempergraph/py.typed +0 -0
- tempergraph/release.py +17 -0
- tempergraph/render/__init__.py +0 -0
- tempergraph/render/output.py +72 -0
- tempergraph/render/prompt.py +166 -0
- tempergraph/render/template.py +86 -0
- tempergraph/run/__init__.py +2 -0
- tempergraph/run/asking.py +233 -0
- tempergraph/run/audit.py +63 -0
- tempergraph/run/check_worker.py +167 -0
- tempergraph/run/checks.py +517 -0
- tempergraph/run/commands.py +210 -0
- tempergraph/run/complexity.py +268 -0
- tempergraph/run/contest.py +76 -0
- tempergraph/run/council.py +368 -0
- tempergraph/run/council_run.py +527 -0
- tempergraph/run/events.py +279 -0
- tempergraph/run/finalize.py +132 -0
- tempergraph/run/gate.py +747 -0
- tempergraph/run/guard.py +89 -0
- tempergraph/run/judging.py +357 -0
- tempergraph/run/ladder.py +230 -0
- tempergraph/run/log.py +600 -0
- tempergraph/run/mapping.py +183 -0
- tempergraph/run/nodes.py +2304 -0
- tempergraph/run/outcome.py +255 -0
- tempergraph/run/outcome_record.py +292 -0
- tempergraph/run/outcome_trust.py +99 -0
- tempergraph/run/rerun.py +351 -0
- tempergraph/run/reserve.py +85 -0
- tempergraph/run/resources.py +76 -0
- tempergraph/run/risk.py +231 -0
- tempergraph/run/runner.py +1579 -0
- tempergraph/run/scriptcache.py +178 -0
- tempergraph/run/selfcheck.py +105 -0
- tempergraph/run/session_record.py +72 -0
- tempergraph/run/subrun.py +278 -0
- tempergraph/run/supervision.py +125 -0
- tempergraph/run/tool_access.py +101 -0
- tempergraph/schedule/__init__.py +25 -0
- tempergraph/schedule/credentials.py +167 -0
- tempergraph/schedule/echo.py +169 -0
- tempergraph/schedule/exact.py +275 -0
- tempergraph/schedule/export.py +164 -0
- tempergraph/schedule/launch.py +89 -0
- tempergraph/schedule/ledger.py +133 -0
- tempergraph/schedule/loop.py +176 -0
- tempergraph/schedule/model.py +440 -0
- tempergraph/schedule/policies.py +414 -0
- tempergraph/schedule/store.py +150 -0
- tempergraph/schedule/tick.py +377 -0
- tempergraph/schedule/token.py +81 -0
- tempergraph/schedule/triggers.py +210 -0
- tempergraph/schedule/words.py +423 -0
- tempergraph/security/__init__.py +0 -0
- tempergraph/security/launch.py +25 -0
- tempergraph/security/scrub.py +58 -0
- tempergraph/settings.py +950 -0
- tempergraph/store/__init__.py +0 -0
- tempergraph/store/codelog.py +73 -0
- tempergraph/store/layout.py +198 -0
- tempergraph/store/logs.py +325 -0
- tempergraph/store/manifest.py +99 -0
- tempergraph/store/migrate.py +188 -0
- tempergraph/workspace.py +874 -0
- tempergraph-0.7.1.dist-info/METADATA +70 -0
- tempergraph-0.7.1.dist-info/RECORD +232 -0
- tempergraph-0.7.1.dist-info/WHEEL +5 -0
- tempergraph-0.7.1.dist-info/entry_points.txt +5 -0
- tempergraph-0.7.1.dist-info/top_level.txt +2 -0
- tempergraph_pytest_plugin.py +64 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""`tempergraph improve review <selector>`, `improve review show <selector>`, `improve review summary` (SRV-B23).
|
|
2
|
+
|
|
3
|
+
`improve review <selector>` plans and runs a review of one run now, `reason: person`, under the per-run cap; a
|
|
4
|
+
person's review always reads `full` (the `signals` plans belong to the loop's own reviews in stable mode), and
|
|
5
|
+
`--full` is accepted and changes nothing. `--dry-run` prints the plan and its estimate and spends nothing. `show` and `summary` are
|
|
6
|
+
read-only. Exit 0, or 2 for a bad selector or option. Results stay on the machine (SRV-B22).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from tempergraph.constants import ExitCode
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def add_review_parser(isub: Any) -> None:
|
|
18
|
+
rv = isub.add_parser("review", help="the session review of a run (SRV): run, show, summary")
|
|
19
|
+
rv.add_argument("first", metavar="selector", help="a thread selector, or `show` / `summary`")
|
|
20
|
+
rv.add_argument("second", nargs="?", default=None, help=argparse.SUPPRESS)
|
|
21
|
+
rv.add_argument("--session", action="append", default=[], metavar="KEY", help="review only these sessions")
|
|
22
|
+
rv.add_argument("--full", action="store_true", help="read every session (release 1 always does)")
|
|
23
|
+
rv.add_argument("--dry-run", action="store_true", help="print the plan and the estimate; spend nothing")
|
|
24
|
+
rv.add_argument("--version", default=None, help="summary: one workflow version")
|
|
25
|
+
rv.add_argument("--json", action="store_true")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _ledger_cost(root: Any, thread: str) -> float:
|
|
29
|
+
from tempergraph.improve.review import _jsonl
|
|
30
|
+
|
|
31
|
+
total = 0.0
|
|
32
|
+
for r in _jsonl(root / "ledger.jsonl"):
|
|
33
|
+
if r.get("kind") == "run_segment" and r.get("thread_id") == thread:
|
|
34
|
+
c = r.get("cost") or {}
|
|
35
|
+
total += float(c.get("reported") or 0.0) + float(c.get("estimated_only") or 0.0)
|
|
36
|
+
return total
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _text(doc: dict[str, Any]) -> str:
|
|
40
|
+
lines = []
|
|
41
|
+
plan = doc.get("plan") or {}
|
|
42
|
+
lines.append(f"plan: depth {plan.get('depth')}, {len(plan.get('targets') or [])} sessions, "
|
|
43
|
+
f"cap {plan.get('cap_usd')} USD, about {plan.get('estimate_tokens')} tokens")
|
|
44
|
+
for s in plan.get("skipped") or []:
|
|
45
|
+
lines.append(f" skipped {s.get('session_key')}: {s.get('reason')}")
|
|
46
|
+
for s in doc.get("sessions") or []:
|
|
47
|
+
lines.append(f"{s.get('session_key')}: {len(s.get('observations') or [])} kept, "
|
|
48
|
+
f"{s.get('unsupported')} unsupported")
|
|
49
|
+
for o in s.get("observations") or []:
|
|
50
|
+
lines.append(f" {o.get('category')} turns {o.get('turns')} remedy {o.get('remedy_class')}: "
|
|
51
|
+
f"{o.get('note') or ''}")
|
|
52
|
+
art = doc.get("artifact")
|
|
53
|
+
if isinstance(art, dict):
|
|
54
|
+
kind = str(art.get("kind"))
|
|
55
|
+
if kind == "artifact_review_skipped":
|
|
56
|
+
lines.append(f"artifact review skipped: {art.get('reason')}")
|
|
57
|
+
elif kind == "artifact_review_failed":
|
|
58
|
+
lines.append(f"artifact review failed: {art.get('error_class')}")
|
|
59
|
+
else:
|
|
60
|
+
lines.append(f"artifact review: {len(art.get('observations') or [])} kept, "
|
|
61
|
+
f"{art.get('unsupported')} unsupported")
|
|
62
|
+
for o in art.get("observations") or []:
|
|
63
|
+
cites = [f"{d.get('file')}:{d.get('line')}" for d in o.get("diff") or []]
|
|
64
|
+
std = o.get("standard")
|
|
65
|
+
if isinstance(std, dict):
|
|
66
|
+
cites.append(f"{std.get('file')}:{std.get('line')}")
|
|
67
|
+
pr = o.get("prompt")
|
|
68
|
+
if isinstance(pr, dict):
|
|
69
|
+
cites.append(f"{pr.get('unit')}:{pr.get('line')}")
|
|
70
|
+
rq = o.get("request")
|
|
71
|
+
if isinstance(rq, dict):
|
|
72
|
+
cites.append(f"request:{rq.get('line')}")
|
|
73
|
+
lines.append(f" {o.get('category')} remedy {o.get('remedy_class')} cites {', '.join(cites)}"
|
|
74
|
+
f" criterion {o.get('criterion')}: {o.get('note') or ''}")
|
|
75
|
+
for r in doc.get("rows") or []:
|
|
76
|
+
lines.append(f"{r['workflow']} {r['unit']} {r['category']} {r['check']}: {r['count']}")
|
|
77
|
+
return "\n".join(lines) + "\n"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def cmd_review(env: Any, a: argparse.Namespace) -> int:
|
|
81
|
+
from tempergraph.cli.main import UsageError, _emit, _one, _root
|
|
82
|
+
from tempergraph.improve import review
|
|
83
|
+
from tempergraph.improve.record import unit_decls
|
|
84
|
+
|
|
85
|
+
def out(doc: dict[str, Any]) -> int:
|
|
86
|
+
if a.json:
|
|
87
|
+
_emit(env, doc)
|
|
88
|
+
else:
|
|
89
|
+
env.out.write(_text(doc))
|
|
90
|
+
return int(ExitCode.FINISHED)
|
|
91
|
+
|
|
92
|
+
root = _root(env)
|
|
93
|
+
if a.first == "summary":
|
|
94
|
+
return out(review.summary(root, a.second, a.version))
|
|
95
|
+
if a.first == "show":
|
|
96
|
+
if a.second is None:
|
|
97
|
+
raise UsageError("improve review show takes a selector")
|
|
98
|
+
spec, tid = _one(env, a.second)
|
|
99
|
+
return out(review.show(root, spec.name, tid.split("/", 1)[-1]))
|
|
100
|
+
if a.second is not None:
|
|
101
|
+
raise UsageError("improve review takes one selector, or show <selector>, or summary [workflow]")
|
|
102
|
+
spec, tid = _one(env, a.first)
|
|
103
|
+
task = tid.split("/", 1)[-1]
|
|
104
|
+
t = {"state_root": str(root), "workflow": spec.name, "task_id": task, "thread": tid, "review": "full",
|
|
105
|
+
"mode": spec.improvement_mode, "executor": spec.default_executor, "units": unit_decls(spec),
|
|
106
|
+
"run_cost_usd": _ledger_cost(root, tid)}
|
|
107
|
+
got = review.run(t, env.registry, reason="person", keys=tuple(a.session), force_full=True, dry_run=a.dry_run)
|
|
108
|
+
doc = {"schema_version": 1, "thread": tid, "plan": got["plan"], "done": got["done"], "failed": got["failed"],
|
|
109
|
+
"cost": got["cost"], **({} if a.dry_run else {"sessions": review.show(root, spec.name, task)["sessions"]})}
|
|
110
|
+
return out(doc)
|
|
111
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""`tempergraph install` through the shim (UPD-B18, UPD-B19: the same code as the plugin's launcher runs)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from tempergraph.install.bootstrap import install, parser
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def add_parsers(sub: Any) -> None:
|
|
12
|
+
sub.add_parser("install", help="first install of the engine (UPD-B18, UPD-B19)", parents=[parser()], add_help=False)
|
|
13
|
+
add_update(sub)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def add_update(sub: Any) -> None:
|
|
17
|
+
from tempergraph.install.update import parser as update_parser
|
|
18
|
+
|
|
19
|
+
sub.add_parser("update", help="move to the plugin copy's engine release; rollback; prune (UPD-B14, UPD-B6)",
|
|
20
|
+
parents=[update_parser()], add_help=False)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def cmd_update(env: Any, a: argparse.Namespace) -> int:
|
|
24
|
+
from tempergraph.install.update import update
|
|
25
|
+
|
|
26
|
+
argv = [f"--{k.replace('_', '-')}" for k in ("check", "dry_run", "json", "rollback", "restore_backups",
|
|
27
|
+
"prune_engines") if getattr(a, k)]
|
|
28
|
+
return update(argv + [x for e in a.extras for x in ("--with", e)], out=env.out)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def cmd_install(env: Any, a: argparse.Namespace) -> int:
|
|
32
|
+
argv = (["--check"] if a.check else []) + (["--json"] if a.json else []) + \
|
|
33
|
+
[x for e in a.extras for x in ("--with", e)] + (["--add-to-path"] if a.add_to_path else []) + \
|
|
34
|
+
(["--repair"] if a.repair else [])
|
|
35
|
+
return install(argv, out=env.out)
|