@miller-tech/uap 1.45.0 → 1.45.1
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/package.json
CHANGED
|
Binary file
|
|
@@ -1409,14 +1409,7 @@ class OpenCodeUAP(BaseInstalledAgent):
|
|
|
1409
1409
|
def create_run_agent_commands(self, instruction: str) -> list[ExecInput]:
|
|
1410
1410
|
model = self.model_name or "llama.cpp/qwen35-a3b-iq4xs"
|
|
1411
1411
|
|
|
1412
|
-
env = {
|
|
1413
|
-
"OPENCODE_FAKE_VCS": "git",
|
|
1414
|
-
# Transparent delivery: the uap-enforce plugin reads these to run
|
|
1415
|
-
# the `uap deliver` convergence loop on the first source edit.
|
|
1416
|
-
"UAP_DELIVER_ENDPOINT": self._api_endpoint,
|
|
1417
|
-
"UAP_DELIVER_MODEL": os.environ.get("UAP_DELIVER_MODEL", "qwen35-a3b"),
|
|
1418
|
-
"UAP_ENFORCE_DELIVERY": os.environ.get("UAP_ENFORCE_DELIVERY", "block"),
|
|
1419
|
-
}
|
|
1412
|
+
env = {"OPENCODE_FAKE_VCS": "git"}
|
|
1420
1413
|
|
|
1421
1414
|
# --- Step 0: Build classified CLAUDE.md and enhanced instruction ---
|
|
1422
1415
|
classified_claude_md = build_classified_claude_md(instruction)
|
|
@@ -1542,17 +1535,6 @@ class OpenCodeUAP(BaseInstalledAgent):
|
|
|
1542
1535
|
# --- Step 5: Environment bootstrapping ---
|
|
1543
1536
|
commands.append(ExecInput(command=ENV_BOOTSTRAP_CMD))
|
|
1544
1537
|
|
|
1545
|
-
# --- Step 5b: Stage raw task instruction for transparent delivery ---
|
|
1546
|
-
# The uap-enforce plugin reads /app/.uap-deliver/task.txt to seed the
|
|
1547
|
-
# `uap deliver` convergence loop on the first source edit.
|
|
1548
|
-
task_b64 = base64.b64encode(instruction.encode()).decode()
|
|
1549
|
-
deliver_task_cmd = (
|
|
1550
|
-
"mkdir -p /app/.uap-deliver && "
|
|
1551
|
-
f"echo '{task_b64}' | base64 -d > /app/.uap-deliver/task.txt && "
|
|
1552
|
-
"echo '[Deliver] task instruction staged for transparent delivery'"
|
|
1553
|
-
)
|
|
1554
|
-
commands.append(ExecInput(command=deliver_task_cmd))
|
|
1555
|
-
|
|
1556
1538
|
# --- Step 6: Run opencode with enhanced instruction ---
|
|
1557
1539
|
# opencode.json baseURL points to proxy at http://127.0.0.1:11435/v1
|
|
1558
1540
|
# which injects tool_choice="required" and forwards to the real LLM
|
|
@@ -41,11 +41,6 @@ export const UapEnforce: Plugin = async ({ $ }) => {
|
|
|
41
41
|
let totalToolCalls = 0;
|
|
42
42
|
const SOFT_BUDGET = 30;
|
|
43
43
|
|
|
44
|
-
// Transparent delivery: the first substantive source edit triggers the
|
|
45
|
-
// `uap deliver` convergence loop ONCE per session. Guarded so it never
|
|
46
|
-
// re-enters or fires per-edit.
|
|
47
|
-
let deliverRan = false;
|
|
48
|
-
|
|
49
44
|
const TELEMETRY_PATH = '/tmp/uap-telemetry.jsonl';
|
|
50
45
|
|
|
51
46
|
const simpleHash = (s: string): string => {
|
|
@@ -65,46 +60,14 @@ export const UapEnforce: Plugin = async ({ $ }) => {
|
|
|
65
60
|
'tool.execute.before': async (input, output) => {
|
|
66
61
|
totalToolCalls++;
|
|
67
62
|
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
if (
|
|
77
|
-
!deliverRan &&
|
|
78
|
-
(input.tool === 'write' || input.tool === 'edit') &&
|
|
79
|
-
process.env.UAP_ENFORCE_DELIVERY !== 'advisory' &&
|
|
80
|
-
!process.env.UAP_DELIVER_BYPASS
|
|
81
|
-
) {
|
|
82
|
-
deliverRan = true; // set first — prevents re-entry / per-edit loops
|
|
83
|
-
try {
|
|
84
|
-
const endpoint = process.env.UAP_DELIVER_ENDPOINT || '';
|
|
85
|
-
const model = process.env.UAP_DELIVER_MODEL || 'qwen35-a3b';
|
|
86
|
-
const endpointArg = endpoint ? `--endpoint ${endpoint}` : '';
|
|
87
|
-
const deliverScript =
|
|
88
|
-
'source $HOME/.nvm/nvm.sh 2>/dev/null || true; ' +
|
|
89
|
-
'TASK="$(cat /app/.uap-deliver/task.txt 2>/dev/null)"; ' +
|
|
90
|
-
'if [ -n "$TASK" ] && command -v uap >/dev/null 2>&1; then ' +
|
|
91
|
-
`echo "[Deliver] converging via uap deliver (model ${model})..."; ` +
|
|
92
|
-
`UAP_DELIVER_ACTIVE=1 uap deliver "$TASK" ${endpointArg} --model ${model} ` +
|
|
93
|
-
'--project-root /app --max-turns 5 --no-until-delivered ' +
|
|
94
|
-
'> /logs/agent/uap-deliver.log 2>&1 || true; ' +
|
|
95
|
-
'echo "[Deliver] convergence loop finished"; ' +
|
|
96
|
-
'else echo "[Deliver] skipped (no task file or uap CLI absent)"; fi';
|
|
97
|
-
await $`bash -lc ${deliverScript}`.nothrow();
|
|
98
|
-
await $`echo ${JSON.stringify(
|
|
99
|
-
JSON.stringify({ event: 'transparent_deliver', tool: input.tool, ts: new Date().toISOString() })
|
|
100
|
-
)} >> ${TELEMETRY_PATH}`
|
|
101
|
-
.quiet()
|
|
102
|
-
.nothrow();
|
|
103
|
-
} catch {
|
|
104
|
-
/* fail open — let the original edit proceed */
|
|
105
|
-
}
|
|
106
|
-
// fall through: the agent's own edit still executes
|
|
107
|
-
}
|
|
63
|
+
// NOTE: a transparent "run `uap deliver` on the first edit" trigger was
|
|
64
|
+
// trialed here and REMOVED. Benchmarking showed it net-harmful: it ran a
|
|
65
|
+
// heavyweight second agent (the deliver convergence loop) against a
|
|
66
|
+
// self-authored PROXY gate that does not match the task's hidden verifier,
|
|
67
|
+
// mutating the workspace and corrupting tasks plain opencode solved
|
|
68
|
+
// (e.g. openssl-selfsigned-cert regressed; 4/6 -> 2/6). deliver's
|
|
69
|
+
// self-gate + agentic executor remain valuable as a STANDALONE `uap
|
|
70
|
+
// deliver` invocation, just not as a per-edit parasite on the agent loop.
|
|
108
71
|
|
|
109
72
|
// --- Worktree enforcement (Layer 4) ---
|
|
110
73
|
// Warn when file writes happen outside a worktree
|