@r1z4x/tezgah 1.1.0 → 1.3.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/CHANGELOG.md +33 -1
- package/MANIFEST +2 -0
- package/bin/tezgah-taste +509 -5
- package/docs/clarity-baseline.json +1 -1
- package/docs/index.json +5 -2
- package/docs/judge.md +23 -9
- package/docs/operations.md +79 -21
- package/hooks/projects-posttooluse.py +7 -0
- package/hooks/tezgah_context.py +28 -1
- package/hooks/tezgah_judge.py +53 -14
- package/hooks/tezgah_taste.py +86 -10
- package/hooks/tezgah_taste_ledger.py +628 -0
- package/hosts/codex/hook.py +6 -1
- package/hosts/cursor/hook.py +6 -1
- package/hosts/omp/hook.py +6 -0
- package/hosts/opencode/plugins/tezgah.js +10 -6
- package/package.json +1 -1
package/hosts/omp/hook.py
CHANGED
|
@@ -63,6 +63,7 @@ try:
|
|
|
63
63
|
SUBAGENT_CHANNEL, bind_session, note, note_tool, stop_reason, untrusted_label,
|
|
64
64
|
untrusted_source)
|
|
65
65
|
from tezgah_paths import off, root_for # noqa: E402
|
|
66
|
+
from tezgah_taste import write_note # noqa: E402
|
|
66
67
|
from tezgah_untrusted import marks # noqa: E402
|
|
67
68
|
except Exception as exc:
|
|
68
69
|
import_failed(exc)
|
|
@@ -246,6 +247,11 @@ def handle(payload):
|
|
|
246
247
|
# deny: the bridge puts it in front of the content itself, so the model
|
|
247
248
|
# reads where the text came from - or, on an effect after such a read,
|
|
248
249
|
# the taint notice - while it reads the result.
|
|
250
|
+
# the opt-in taste note for the first write to this file type
|
|
251
|
+
# (hooks/tezgah_taste.write_note) rides the same label
|
|
252
|
+
taste = (safe(session_id, write_note, session_id, inp, cwd, tool)
|
|
253
|
+
if failed is not True else None)
|
|
254
|
+
label = "\n".join(t for t in (label, taste) if t)
|
|
249
255
|
if label:
|
|
250
256
|
out["label"] = label
|
|
251
257
|
return out
|
|
@@ -1266,9 +1266,10 @@ async function recordEvidence(sessionID, tool, args, result, workspace, cwd,
|
|
|
1266
1266
|
// hooks/tezgah_taste.note_write in process, and this host writes its edit row
|
|
1267
1267
|
// here, so the same call goes to that module through a process. The marker
|
|
1268
1268
|
// lives where the kill switches do (tezgah_paths.armed), so off it costs two
|
|
1269
|
-
// stats and spawns nothing.
|
|
1269
|
+
// stats and spawns nothing. The process prints the taste note for the first
|
|
1270
|
+
// write to this file type (tezgah_taste.write_note), returned to the caller.
|
|
1270
1271
|
if (kind === "edit" && row.exit !== 1 && off("taste-on")) {
|
|
1271
|
-
await noteTaste(sessionID, row.id, args, cwd)
|
|
1272
|
+
return await noteTaste(sessionID, row.id, args, cwd)
|
|
1272
1273
|
}
|
|
1273
1274
|
}
|
|
1274
1275
|
|
|
@@ -2374,7 +2375,8 @@ function captureSnapshot(tool, args, dir, sessionID) {
|
|
|
2374
2375
|
|
|
2375
2376
|
// hooks/tezgah_taste.py's own entry point, found beside the bin the snapshot
|
|
2376
2377
|
// capture runs (the installed bins are links into the checkout, which holds no
|
|
2377
|
-
// copy of hooks/ under CONFIG). Best effort
|
|
2378
|
+
// copy of hooks/ under CONFIG). Best effort, like captureSnapshot: a failure is
|
|
2379
|
+
// ignored. It resolves to the taste note the process printed, else undefined.
|
|
2378
2380
|
function noteTaste(sessionID, id, args, cwd) {
|
|
2379
2381
|
let script
|
|
2380
2382
|
try {
|
|
@@ -2383,7 +2385,8 @@ function noteTaste(sessionID, id, args, cwd) {
|
|
|
2383
2385
|
} catch { return undefined }
|
|
2384
2386
|
return collect([script, JSON.stringify({
|
|
2385
2387
|
session_id: sessionID, id, input: args, cwd, host: "opencode" })],
|
|
2386
|
-
{ stdio: "ignore" }, null,
|
|
2388
|
+
{ stdio: ["ignore", "pipe", "ignore"] }, null,
|
|
2389
|
+
(code, out) => (code === 0 && out.trim() ? out.trim() : undefined))
|
|
2387
2390
|
}
|
|
2388
2391
|
|
|
2389
2392
|
export const Tezgah = async ({ directory }) => {
|
|
@@ -2736,8 +2739,9 @@ export const Tezgah = async ({ directory }) => {
|
|
|
2736
2739
|
if (notice) labelResult(output, notice)
|
|
2737
2740
|
const kind = await classify(tool, args)
|
|
2738
2741
|
if (kind) await record(sessionID, kind)
|
|
2739
|
-
await recordEvidence(sessionID, tool, args, output, workspace,
|
|
2740
|
-
|
|
2742
|
+
const taste = await recordEvidence(sessionID, tool, args, output, workspace,
|
|
2743
|
+
dir, own || inherited)
|
|
2744
|
+
if (taste) labelResult(output, taste)
|
|
2741
2745
|
} catch {}
|
|
2742
2746
|
},
|
|
2743
2747
|
|
package/package.json
CHANGED