harness-everything 1.5.3 → 1.6.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.yml +68 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +33 -0
- package/.github/ISSUE_TEMPLATE/platform_compatibility.yml +80 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +19 -0
- package/.github/dependabot.yml +13 -0
- package/.github/workflows/ci.yml +2 -2
- package/.github/workflows/release.yml +1 -1
- package/CHANGELOG.md +24 -0
- package/PRIVACY.md +34 -14
- package/README.md +76 -311
- package/ROADMAP.md +50 -0
- package/SECURITY.md +29 -8
- package/SUPPORT.md +4 -4
- package/TERMS.md +3 -3
- package/benchmarks/results/live-host/agy-2026-12-02-linux-loader/README.md +33 -0
- package/benchmarks/results/live-host/opencode-2026-12-02-450-steering/README.md +20 -0
- package/benchmarks/results/live-host/opencode-2026-12-02-450-steering/lifecycle.sanitized.jsonl +14 -0
- package/benchmarks/results/live-host/opencode-2026-12-02-450-steering/observations.sanitized.json +20 -0
- package/bin/cli.js +30 -7
- package/ci/action-gate.test.js +186 -0
- package/ci/installer-roundtrip.test.js +20 -0
- package/ci/lib/opencode-v2-driver.js +3 -1
- package/ci/mechanism-2aa-codex-action-gate-policy.test.js +21 -0
- package/ci/mechanism-2ap-sbom.test.js +6 -6
- package/ci/mechanism-2x-release-commit-message.test.js +34 -23
- package/ci/mechanism-341-opencode-lane.test.js +5 -1
- package/ci/mechanism-397-cycle-import.test.js +5 -1
- package/ci/mechanism-397-opencode-observations.test.js +260 -24
- package/ci/mechanism-548-bigint-identity.test.js +252 -5
- package/ci/mechanism-552-ledger-pairs.test.js +2 -0
- package/ci/mechanism-error-ledger-promote.test.js +122 -1
- package/ci/mechanism-system-one-install.test.js +50 -0
- package/ci/mechanism-task-git-authorization.test.js +14 -0
- package/docs/README.md +81 -0
- package/docs/codex-action-gate.md +1 -1
- package/docs/platform-capabilities.md +17 -5
- package/docs/platform-compatibility.json +6 -6
- package/docs/system-one-cycle.md +2 -1
- package/harness-everything/SKILL.md +1 -1
- package/harness-everything/scripts/system-one/cua_adapter.py +4 -2
- package/harness-everything/scripts/system-one/install.js +1 -5
- package/harness-everything/scripts/system-one/manifest.js +7 -3
- package/harness-everything/scripts/system-one/provider.js +3 -4
- package/hooks/scripts/action-gate.js +82 -2
- package/opencode-plugin/index.mjs +97 -35
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +15 -2
- package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/scripts/action-gate.js +82 -2
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +4 -2
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +1 -5
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/manifest.js +7 -3
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +3 -4
- package/sbom.cdx.json +7 -7
- package/scripts/system-one-cycle/package.js +2 -2
|
@@ -257,22 +257,24 @@ function runKernelRouter(payload, signal, unavailable) {
|
|
|
257
257
|
})
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
const contextRole = message => message?.info?.role || message?.info?.type || message?.role || message?.type
|
|
261
|
+
const contextMessageID = message => message?.info?.id ?? message?.id
|
|
262
|
+
|
|
260
263
|
function assistantTextForCurrentTurn(messages, userMessageID) {
|
|
261
264
|
const items = Array.isArray(messages) ? messages : Array.isArray(messages?.data) ? messages.data : []
|
|
262
|
-
const role = message => message?.info?.role || message?.info?.type || message?.role || message?.type
|
|
263
|
-
const messageID = message => message?.info?.id ?? message?.id
|
|
264
265
|
let lastUser = userMessageID
|
|
265
|
-
? items.findIndex(message =>
|
|
266
|
+
? items.findIndex(message => contextMessageID(message) === userMessageID && contextRole(message) === "user")
|
|
266
267
|
: -1
|
|
267
268
|
if (!userMessageID) {
|
|
268
269
|
for (let i = items.length - 1; i >= 0; i--) {
|
|
269
|
-
if (
|
|
270
|
+
if (contextRole(items[i]) === "user") { lastUser = i; break }
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
273
|
if (lastUser < 0) return null
|
|
273
|
-
|
|
274
|
+
const nextUser = items.findIndex((message, i) => i > lastUser && contextRole(message) === "user")
|
|
275
|
+
for (let i = (nextUser === -1 ? items.length : nextUser) - 1; i > lastUser; i--) {
|
|
274
276
|
const message = items[i]
|
|
275
|
-
if (
|
|
277
|
+
if (contextRole(message) !== "assistant") continue
|
|
276
278
|
const parts = Array.isArray(message.parts) ? message.parts : Array.isArray(message.content) ? message.content : []
|
|
277
279
|
const text = parts
|
|
278
280
|
.filter(part => part?.type === "text" && typeof part.text === "string")
|
|
@@ -308,30 +310,33 @@ function observeOpenCodeTool(event, workspace) {
|
|
|
308
310
|
} catch { /* turn observation is always fail-open */ }
|
|
309
311
|
}
|
|
310
312
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
function finishPromptObservation(sessionID, prompt, lastMessage = null) {
|
|
314
|
+
if (!prompt?.observing) return
|
|
315
|
+
// The collector has one pending observation per session. Close this prompt
|
|
316
|
+
// before admitting its replacement, and invalidate any outstanding read.
|
|
317
|
+
prompt.observing = false
|
|
315
318
|
try {
|
|
316
|
-
|
|
317
|
-
if (!observations || !observations.enabled()) return
|
|
318
|
-
let lastMessage = null
|
|
319
|
-
const context = await awaitAbortableHostRead(() => ctx.session.context({ sessionID }), signal)
|
|
320
|
-
if (context.status === "aborted" || signal?.aborted) return
|
|
321
|
-
if (context.status === "resolved") lastMessage = assistantTextForCurrentTurn(context.value, prompt?.messageID)
|
|
322
|
-
const payload = {
|
|
319
|
+
systemOneObservations().handle({
|
|
323
320
|
hook_event_name: "Stop",
|
|
324
321
|
host: "opencode",
|
|
325
322
|
session_id: sessionID,
|
|
326
|
-
...(prompt
|
|
323
|
+
...(prompt.messageID ? { turn_id: prompt.messageID } : {}),
|
|
327
324
|
cwd: prompt.workspace,
|
|
328
325
|
...(lastMessage === null ? {} : { last_assistant_message: lastMessage }),
|
|
329
|
-
}
|
|
330
|
-
if (signal?.aborted) return
|
|
331
|
-
observations.handle(payload)
|
|
326
|
+
})
|
|
332
327
|
} catch { /* turn observation is always fail-open */ }
|
|
333
328
|
}
|
|
334
329
|
|
|
330
|
+
async function observeOpenCodeCompletion(sessionID, ctx, prompt, signal) {
|
|
331
|
+
if (!prompt.observing || signal.aborted) return
|
|
332
|
+
const context = await awaitAbortableHostRead(() => ctx.session.context({ sessionID }), signal)
|
|
333
|
+
if (context.status === "aborted" || signal.aborted || !prompt.observing) return
|
|
334
|
+
const lastMessage = context.status === "resolved"
|
|
335
|
+
? assistantTextForCurrentTurn(context.value, prompt.messageID)
|
|
336
|
+
: null
|
|
337
|
+
finishPromptObservation(sessionID, prompt, lastMessage)
|
|
338
|
+
}
|
|
339
|
+
|
|
335
340
|
function awaitAbortableHostRead(read, signal) {
|
|
336
341
|
return new Promise(resolveRead => {
|
|
337
342
|
let settled = false
|
|
@@ -1065,6 +1070,7 @@ export default {
|
|
|
1065
1070
|
async setup(ctx) {
|
|
1066
1071
|
const events = new AbortController()
|
|
1067
1072
|
const promptRoutes = new Map()
|
|
1073
|
+
const observationExecutions = new Map()
|
|
1068
1074
|
const sessionBindings = new Map()
|
|
1069
1075
|
const sessionOwners = new Map()
|
|
1070
1076
|
const pendingLedgerLessons = new Map()
|
|
@@ -1227,9 +1233,10 @@ export default {
|
|
|
1227
1233
|
await previous.routerPromise
|
|
1228
1234
|
return
|
|
1229
1235
|
}
|
|
1236
|
+
const priorObservation = previous?.observing ? previous : previous?.priorObservation
|
|
1230
1237
|
invalidatedSessions.delete(event.sessionID)
|
|
1231
1238
|
const prompt = { messageID, text: event.prompt.text, routerOutput: null, routerPromise: null,
|
|
1232
|
-
workspace: null, hooks: null, status: "pending" }
|
|
1239
|
+
workspace: null, hooks: null, status: "pending", observing: false, completionReceived: false, priorObservation }
|
|
1233
1240
|
promptRoutes.set(event.sessionID, prompt)
|
|
1234
1241
|
prompt.routerPromise = (previous?.routerPromise || Promise.resolve())
|
|
1235
1242
|
.catch(() => null)
|
|
@@ -1247,12 +1254,15 @@ export default {
|
|
|
1247
1254
|
if (events.signal.aborted || promptRoutes.get(event.sessionID) !== prompt) return
|
|
1248
1255
|
bindSessionWorkspace(event.sessionID, prompt.workspace, prompt.hooks)
|
|
1249
1256
|
prompt.status = "resolved"
|
|
1257
|
+
finishPromptObservation(event.sessionID, prompt.priorObservation)
|
|
1258
|
+
prompt.priorObservation = null
|
|
1250
1259
|
try {
|
|
1251
1260
|
if (events.signal.aborted) return
|
|
1252
1261
|
const observations = systemOneObservations()
|
|
1253
1262
|
if (observations && observations.enabled()) {
|
|
1254
1263
|
observations.handle({ hook_event_name: "UserPromptSubmit", host: "opencode", session_id: event.sessionID,
|
|
1255
1264
|
...(prompt.messageID ? { turn_id: prompt.messageID } : {}), cwd: prompt.workspace, prompt: event.prompt.text })
|
|
1265
|
+
prompt.observing = true
|
|
1256
1266
|
}
|
|
1257
1267
|
} catch { /* turn observation is always fail-open */ }
|
|
1258
1268
|
if (events.signal.aborted) return
|
|
@@ -1267,7 +1277,8 @@ export default {
|
|
|
1267
1277
|
})
|
|
1268
1278
|
await ctx.session.hook("context", event => {
|
|
1269
1279
|
if (events.signal.aborted) return
|
|
1270
|
-
const
|
|
1280
|
+
const prompt = promptRoutes.get(event?.sessionID)
|
|
1281
|
+
const output = !prompt?.completionReceived && prompt?.routerOutput
|
|
1271
1282
|
if (output && (!event.kind || event.kind === "primary") && Array.isArray(event.system)
|
|
1272
1283
|
&& !event.system.some(part => part && part.text === output)) event.system.push({ type: "text", text: output })
|
|
1273
1284
|
deliverLedgerLessons(event)
|
|
@@ -1294,6 +1305,8 @@ export default {
|
|
|
1294
1305
|
return trackPending(async () => {
|
|
1295
1306
|
if (events.signal.aborted) return
|
|
1296
1307
|
const prompt = promptRoutes.get(event?.sessionID)
|
|
1308
|
+
const execution = observationExecutions.get(event?.sessionID)
|
|
1309
|
+
const ownsToolObservation = !execution || (execution.active && !execution.shared && execution.prompt === prompt)
|
|
1297
1310
|
const binding = await bindingForSession(event?.sessionID)
|
|
1298
1311
|
if (events.signal.aborted || !binding?.workspace) return
|
|
1299
1312
|
retryLedgerReleases()
|
|
@@ -1320,12 +1333,55 @@ export default {
|
|
|
1320
1333
|
output: failureOutput },
|
|
1321
1334
|
})
|
|
1322
1335
|
}
|
|
1323
|
-
if (prompt?.
|
|
1336
|
+
if (ownsToolObservation && prompt?.observing && promptRoutes.get(event.sessionID) === prompt) {
|
|
1337
|
+
observeOpenCodeTool(event, prompt.workspace)
|
|
1338
|
+
}
|
|
1324
1339
|
if (!binding.hooks) return
|
|
1325
1340
|
return binding.hooks["tool.execute.after"](toolEventInput(event), { args: event.input })
|
|
1326
1341
|
})
|
|
1327
1342
|
})
|
|
1328
1343
|
|
|
1344
|
+
const observeExecution = (sessionID, prompt, raw, succeeded) => {
|
|
1345
|
+
if (invalidatedSessions.has(sessionID)) return
|
|
1346
|
+
// V2 execution and delivery events share a durable session log. Without
|
|
1347
|
+
// its sequence, a terminal event cannot be bound to the current prompt.
|
|
1348
|
+
const seq = raw.durable?.seq
|
|
1349
|
+
if (!Number.isSafeInteger(seq)) return
|
|
1350
|
+
const execution = observationExecutions.get(sessionID)
|
|
1351
|
+
if (execution && seq <= execution.seq) return
|
|
1352
|
+
if (raw.type === "session.execution.started") {
|
|
1353
|
+
observationExecutions.set(sessionID, {
|
|
1354
|
+
seq, active: true, prompt: null, firstDelivery: null, shared: false,
|
|
1355
|
+
})
|
|
1356
|
+
return
|
|
1357
|
+
}
|
|
1358
|
+
if (raw.type === "session.inbox.delivered") {
|
|
1359
|
+
const inboxID = raw.data.inboxID
|
|
1360
|
+
if (!execution?.active || typeof inboxID !== "string" || !inboxID) return
|
|
1361
|
+
// The host uses the user prompt's message ID as its inbox ID.
|
|
1362
|
+
// Delivery and terminal events share the same ordered session log.
|
|
1363
|
+
if (inboxID === prompt?.messageID) execution.prompt = prompt
|
|
1364
|
+
if (execution.firstDelivery && execution.firstDelivery !== inboxID) execution.shared = true
|
|
1365
|
+
execution.firstDelivery ??= inboxID
|
|
1366
|
+
execution.seq = seq
|
|
1367
|
+
return
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
const target = execution?.prompt
|
|
1371
|
+
observationExecutions.set(sessionID, { seq, active: false, prompt: null })
|
|
1372
|
+
if (!target || target !== prompt || target.status !== "resolved" || target.completionReceived) return
|
|
1373
|
+
target.completionReceived = true
|
|
1374
|
+
if (!succeeded || execution?.shared || !target.observing) {
|
|
1375
|
+
finishPromptObservation(sessionID, target)
|
|
1376
|
+
promptRoutes.delete(sessionID)
|
|
1377
|
+
return
|
|
1378
|
+
}
|
|
1379
|
+
trackPending(async () => {
|
|
1380
|
+
try { await observeOpenCodeCompletion(sessionID, ctx, target, events.signal) }
|
|
1381
|
+
finally { if (promptRoutes.get(sessionID) === target) promptRoutes.delete(sessionID) }
|
|
1382
|
+
})
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1329
1385
|
trackPending(async () => {
|
|
1330
1386
|
try {
|
|
1331
1387
|
for await (const raw of ctx.event.subscribe({ signal: events.signal })) {
|
|
@@ -1334,21 +1390,28 @@ export default {
|
|
|
1334
1390
|
// completes with session.execution.succeeded; V2 sends no session.idle.
|
|
1335
1391
|
const sessionID = raw.data && raw.data.sessionID
|
|
1336
1392
|
const turnEnded = raw.type === "session.execution.succeeded"
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1393
|
+
const unsuccessful = raw.type === "session.execution.interrupted" || raw.type === "session.execution.failed"
|
|
1394
|
+
const started = raw.type === "session.execution.started"
|
|
1395
|
+
const delivered = raw.type === "session.inbox.delivered"
|
|
1396
|
+
const lifecycleEvent = raw.type === "session.created" || raw.type === "session.deleted"
|
|
1397
|
+
if (typeof sessionID !== "string" || !sessionID) continue
|
|
1398
|
+
|
|
1399
|
+
const prompt = promptRoutes.get(sessionID)
|
|
1400
|
+
if (started || delivered || turnEnded || unsuccessful) observeExecution(sessionID, prompt, raw, turnEnded)
|
|
1401
|
+
|
|
1402
|
+
if (!turnEnded && !lifecycleEvent) continue
|
|
1339
1403
|
retryLedgerReleases()
|
|
1340
1404
|
if (raw.type === "session.deleted") invalidatedSessions.add(sessionID)
|
|
1341
1405
|
else if (raw.type === "session.created") invalidatedSessions.delete(sessionID)
|
|
1342
|
-
if (
|
|
1406
|
+
if (lifecycleEvent) {
|
|
1343
1407
|
releaseSessionLedger(sessionID)
|
|
1408
|
+
finishPromptObservation(sessionID, prompt?.priorObservation)
|
|
1409
|
+
finishPromptObservation(sessionID, prompt)
|
|
1344
1410
|
promptRoutes.delete(sessionID)
|
|
1345
|
-
|
|
1346
|
-
const prompt = promptRoutes.get(sessionID)
|
|
1347
|
-
if (turnEnded && prompt?.status === "resolved") {
|
|
1348
|
-
trackPending(() => observeOpenCodeCompletion(sessionID, ctx, promptRoutes, events.signal))
|
|
1411
|
+
observationExecutions.delete(sessionID)
|
|
1349
1412
|
}
|
|
1350
1413
|
let bindings
|
|
1351
|
-
if (
|
|
1414
|
+
if (lifecycleEvent) {
|
|
1352
1415
|
bindings = [...(sessionOwners.get(sessionID) || [])]
|
|
1353
1416
|
if (!bindings.length && !invalidatedSessions.has(sessionID)) {
|
|
1354
1417
|
const binding = await bindingForSession(sessionID)
|
|
@@ -1362,14 +1425,13 @@ export default {
|
|
|
1362
1425
|
type: turnEnded ? "session.idle" : raw.type,
|
|
1363
1426
|
properties: { ...raw, ...(isRecord(raw.properties) ? raw.properties : {}), sessionID },
|
|
1364
1427
|
}
|
|
1365
|
-
const cleanupDelivery = raw.type === "session.created" || raw.type === "session.deleted"
|
|
1366
1428
|
const delivery = trackPending(() => Promise.allSettled(bindings.filter(binding => binding?.hooks?.event)
|
|
1367
1429
|
.map(binding => Promise.resolve().then(() => {
|
|
1368
|
-
if (events.signal.aborted && !
|
|
1430
|
+
if (events.signal.aborted && !lifecycleEvent) return
|
|
1369
1431
|
return binding.hooks.event({ event })
|
|
1370
1432
|
}))))
|
|
1371
1433
|
if (!turnEnded) await delivery
|
|
1372
|
-
if (
|
|
1434
|
+
if (lifecycleEvent) {
|
|
1373
1435
|
promptRoutes.delete(sessionID)
|
|
1374
1436
|
sessionBindings.delete(sessionID)
|
|
1375
1437
|
sessionOwners.delete(sessionID)
|
package/package.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harness-everything",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Harness
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Harness Everything — behavior and orchestration runtime (AI Agent Harness) for AI coding agents.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai-agent",
|
|
7
|
+
"coding-agent",
|
|
8
|
+
"agent-harness",
|
|
9
|
+
"claude-code",
|
|
10
|
+
"codex",
|
|
11
|
+
"opencode",
|
|
12
|
+
"antigravity",
|
|
13
|
+
"skills",
|
|
14
|
+
"hooks",
|
|
15
|
+
"orchestration",
|
|
16
|
+
"workflow"
|
|
17
|
+
],
|
|
5
18
|
"main": "harness-everything/scripts/bootstrap.js",
|
|
6
19
|
"bin": {
|
|
7
20
|
"harness": "./bin/cli.js"
|
|
@@ -157,12 +157,39 @@ const ISSUE_COMPLETED_CLOSE_TOOLS = new Set([
|
|
|
157
157
|
'mcp__codex_apps__github__update_issue',
|
|
158
158
|
'mcp__codex_apps__github_update_issue',
|
|
159
159
|
]);
|
|
160
|
-
|
|
160
|
+
const ISSUE_CREATE_TOOLS = new Set([
|
|
161
|
+
'mcp__codex_apps__github__create_issue',
|
|
162
|
+
'mcp__codex_apps__github_create_issue',
|
|
163
|
+
'mcp__github__create_issue',
|
|
164
|
+
]);
|
|
165
|
+
// Issue exceptions require an owner/name repository selector; an ownerless
|
|
161
166
|
// name is uncertain and must keep the original gate.
|
|
162
167
|
const OWNER_REPO_SELECTOR = /^[^/\s]+\/[^/\s]+$/;
|
|
168
|
+
const SINGLE_REPO_SEGMENT = /^[^/\s]+$/;
|
|
169
|
+
const ISSUE_CREATE_ALLOWED_KEYS = new Set([
|
|
170
|
+
'repository_full_name',
|
|
171
|
+
'repo_full_name',
|
|
172
|
+
'owner',
|
|
173
|
+
'repo',
|
|
174
|
+
'title',
|
|
175
|
+
'body',
|
|
176
|
+
'labels',
|
|
177
|
+
'assignees',
|
|
178
|
+
'milestone',
|
|
179
|
+
]);
|
|
180
|
+
|
|
181
|
+
function isIssueCreateTool(name) {
|
|
182
|
+
const text = String(name || '');
|
|
183
|
+
if (text === 'mcp__codex_apps__github_create_issue') return true;
|
|
184
|
+
const segments = text.split('__');
|
|
185
|
+
return segments.length >= 3
|
|
186
|
+
&& segments[0].toLowerCase() === 'mcp'
|
|
187
|
+
&& segments.slice(1, -1).every(Boolean)
|
|
188
|
+
&& segments[segments.length - 1] === 'create_issue';
|
|
189
|
+
}
|
|
163
190
|
|
|
164
191
|
function isRoutineIssueTool(name) {
|
|
165
|
-
return ISSUE_COMMENT_TOOLS.has(name) || ISSUE_COMPLETED_CLOSE_TOOLS.has(name);
|
|
192
|
+
return ISSUE_COMMENT_TOOLS.has(name) || ISSUE_COMPLETED_CLOSE_TOOLS.has(name) || isIssueCreateTool(name);
|
|
166
193
|
}
|
|
167
194
|
|
|
168
195
|
function hasExactKeys(input, expected) {
|
|
@@ -170,6 +197,48 @@ function hasExactKeys(input, expected) {
|
|
|
170
197
|
return keys.length === expected.length && expected.every(key => Object.prototype.hasOwnProperty.call(input, key));
|
|
171
198
|
}
|
|
172
199
|
|
|
200
|
+
function isNonEmptyStringArray(value) {
|
|
201
|
+
return Array.isArray(value) && value.every(item => typeof item === 'string' && item.trim() !== '');
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function hasValidRepoSelector(input) {
|
|
205
|
+
const hasRepositoryFullName = Object.prototype.hasOwnProperty.call(input, 'repository_full_name');
|
|
206
|
+
const hasRepoFullName = Object.prototype.hasOwnProperty.call(input, 'repo_full_name');
|
|
207
|
+
const hasOwner = Object.prototype.hasOwnProperty.call(input, 'owner');
|
|
208
|
+
const hasRepo = Object.prototype.hasOwnProperty.call(input, 'repo');
|
|
209
|
+
|
|
210
|
+
const selectorForms = (hasRepositoryFullName ? 1 : 0)
|
|
211
|
+
+ (hasRepoFullName ? 1 : 0)
|
|
212
|
+
+ ((hasOwner || hasRepo) ? 1 : 0);
|
|
213
|
+
if (selectorForms !== 1) return false;
|
|
214
|
+
|
|
215
|
+
if (hasRepositoryFullName) {
|
|
216
|
+
return typeof input.repository_full_name === 'string' && OWNER_REPO_SELECTOR.test(input.repository_full_name);
|
|
217
|
+
}
|
|
218
|
+
if (hasRepoFullName) {
|
|
219
|
+
return typeof input.repo_full_name === 'string' && OWNER_REPO_SELECTOR.test(input.repo_full_name);
|
|
220
|
+
}
|
|
221
|
+
return hasOwner && hasRepo
|
|
222
|
+
&& typeof input.owner === 'string' && SINGLE_REPO_SEGMENT.test(input.owner)
|
|
223
|
+
&& typeof input.repo === 'string' && SINGLE_REPO_SEGMENT.test(input.repo);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function isRoutineIssueCreation(payload) {
|
|
227
|
+
if (!ISSUE_CREATE_TOOLS.has(toolNameOf(payload))) return false;
|
|
228
|
+
const input = toolInputOf(payload);
|
|
229
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)) return false;
|
|
230
|
+
const keys = Object.keys(input);
|
|
231
|
+
if (!keys.every(key => ISSUE_CREATE_ALLOWED_KEYS.has(key))) return false;
|
|
232
|
+
if (!hasValidRepoSelector(input)) return false;
|
|
233
|
+
if (typeof input.title !== 'string' || input.title.trim() === '') return false;
|
|
234
|
+
if (Object.prototype.hasOwnProperty.call(input, 'body') && typeof input.body !== 'string') return false;
|
|
235
|
+
if (Object.prototype.hasOwnProperty.call(input, 'labels') && !isNonEmptyStringArray(input.labels)) return false;
|
|
236
|
+
if (Object.prototype.hasOwnProperty.call(input, 'assignees') && !isNonEmptyStringArray(input.assignees)) return false;
|
|
237
|
+
if (Object.prototype.hasOwnProperty.call(input, 'milestone')
|
|
238
|
+
&& (!Number.isSafeInteger(input.milestone) || input.milestone <= 0)) return false;
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
|
|
173
242
|
function isRoutineIssueComment(payload) {
|
|
174
243
|
const input = toolInputOf(payload);
|
|
175
244
|
return ISSUE_COMMENT_TOOLS.has(toolNameOf(payload))
|
|
@@ -239,6 +308,16 @@ function structuredRule(payload, options = {}) {
|
|
|
239
308
|
hostDeferredReason: 'Codex routine Issue completed-close operations defer to native task scope and permissions.',
|
|
240
309
|
};
|
|
241
310
|
}
|
|
311
|
+
if (detectHost(payload, options.host) === 'codex' && descriptor.action === 'mutate'
|
|
312
|
+
&& isRoutineIssueCreation(payload) && !(hint && hint.required)) {
|
|
313
|
+
return {
|
|
314
|
+
descriptor,
|
|
315
|
+
rule: null,
|
|
316
|
+
hostDeferred: true,
|
|
317
|
+
hostDeferredId: 'routine-issue-create',
|
|
318
|
+
hostDeferredReason: 'Codex routine Issue creation defers to native task scope and permissions.',
|
|
319
|
+
};
|
|
320
|
+
}
|
|
242
321
|
if (descriptor.classification === 'gated') {
|
|
243
322
|
return {
|
|
244
323
|
descriptor,
|
|
@@ -774,4 +853,5 @@ module.exports = {
|
|
|
774
853
|
normalizeActionDescriptor,
|
|
775
854
|
structuredRule,
|
|
776
855
|
isRoutinePullRequestCreation,
|
|
856
|
+
isRoutineIssueCreation,
|
|
777
857
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "harness-everything",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Miya Daniel",
|
package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py
CHANGED
|
@@ -195,9 +195,9 @@ def load_active_bundle(active_path, expected_fingerprint=None, scorer_loader=Non
|
|
|
195
195
|
pointer = json.loads(active_path.read_text(encoding='utf-8'))
|
|
196
196
|
if (not isinstance(pointer, dict) or set(pointer) != {'schemaVersion', 'version', 'dir', 'previous', 'activatedAt'}
|
|
197
197
|
or pointer.get('schemaVersion') != 1 or not isinstance(pointer.get('version'), str)
|
|
198
|
-
or not
|
|
198
|
+
or not VERSION_PATTERN.fullmatch(pointer['version']) or not isinstance(pointer.get('dir'), str)
|
|
199
199
|
or not Path(pointer['dir']).is_absolute()
|
|
200
|
-
or (pointer.get('previous') is not None and (not isinstance(pointer['previous'], str) or not
|
|
200
|
+
or (pointer.get('previous') is not None and (not isinstance(pointer['previous'], str) or not VERSION_PATTERN.fullmatch(pointer['previous'])))
|
|
201
201
|
or not isinstance(pointer.get('activatedAt'), str)):
|
|
202
202
|
raise ValueError('active-pointer')
|
|
203
203
|
directory = Path(pointer['dir'])
|
|
@@ -260,6 +260,8 @@ MAX_CLIENTS = 64
|
|
|
260
260
|
READ_DEADLINE_S = 1.0 # never longer than the Node client's 1000 ms call deadline
|
|
261
261
|
STARTUP_REASONS = ('artifact-hash', 'checkpoint-format')
|
|
262
262
|
ID_PATTERN = re.compile(r'[a-z0-9._-]{1,80}')
|
|
263
|
+
# Version IDs match manifest.js; request tasks and options use ID_PATTERN.
|
|
264
|
+
VERSION_PATTERN = re.compile(r'[a-z0-9][a-z0-9._-]{0,79}')
|
|
263
265
|
HASH_PATTERN = re.compile(r'[0-9a-f]{64}')
|
|
264
266
|
_USER_SID = []
|
|
265
267
|
|
|
@@ -7,7 +7,7 @@ const path = require('node:path');
|
|
|
7
7
|
const { createHash, randomBytes } = require('node:crypto');
|
|
8
8
|
const { spawnSync } = require('node:child_process');
|
|
9
9
|
const { PINNED_CUA_S1_REVISION } = require('./provider');
|
|
10
|
-
const { STAGES, validateVersionManifest } = require('./manifest');
|
|
10
|
+
const { STAGES, validVersion, validateVersionManifest } = require('./manifest');
|
|
11
11
|
|
|
12
12
|
const PINS = Object.freeze({
|
|
13
13
|
cuaS1Revision: PINNED_CUA_S1_REVISION,
|
|
@@ -23,10 +23,6 @@ const versionDir = (dir, version) => path.join(path.resolve(dir), 'versions', ve
|
|
|
23
23
|
const activePath = dir => path.join(path.resolve(dir), 'active.json');
|
|
24
24
|
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
25
25
|
|
|
26
|
-
function validVersion(version) {
|
|
27
|
-
return typeof version === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(version)
|
|
28
|
-
&& version !== '.' && version !== '..';
|
|
29
|
-
}
|
|
30
26
|
function assertVersion(version) {
|
|
31
27
|
if (!validVersion(version)) throw new Error('invalid-version: use a single safe version id');
|
|
32
28
|
}
|
|
@@ -6,11 +6,15 @@ const path = require('node:path');
|
|
|
6
6
|
const STAGES = ['validity', 'intent', 'tier'];
|
|
7
7
|
const SAFE_ID = /^[a-z0-9._-]{1,80}$/;
|
|
8
8
|
const HASH = /^[a-f0-9]{64}$/;
|
|
9
|
-
const VERSION = /^[
|
|
9
|
+
const VERSION = /^[a-z0-9][a-z0-9._-]{0,79}$/;
|
|
10
10
|
const SAFE_PATH_PART = /^[A-Za-z0-9._-]+$/;
|
|
11
11
|
const exact = (value, keys) => value && typeof value === 'object' && !Array.isArray(value)
|
|
12
12
|
&& Object.keys(value).length === keys.length && keys.every(key => Object.hasOwn(value, key));
|
|
13
13
|
|
|
14
|
+
function validVersion(version) {
|
|
15
|
+
return typeof version === 'string' && VERSION.test(version);
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
function safeRelative(value) {
|
|
15
19
|
return typeof value === 'string' && value.length > 0 && !value.includes('\\')
|
|
16
20
|
&& !path.posix.isAbsolute(value) && !path.win32.isAbsolute(value)
|
|
@@ -20,7 +24,7 @@ function safeRelative(value) {
|
|
|
20
24
|
function validateVersionManifest(manifest, expectedVersion) {
|
|
21
25
|
const fail = detail => { throw new TypeError(`invalid-manifest: ${detail}`); };
|
|
22
26
|
if (!exact(manifest, ['schemaVersion', 'version', 'createdAt', 'stages', 'evaluation'])
|
|
23
|
-
|| manifest.schemaVersion !== 1 ||
|
|
27
|
+
|| manifest.schemaVersion !== 1 || !validVersion(manifest.version)
|
|
24
28
|
|| (expectedVersion !== undefined && manifest.version !== expectedVersion)
|
|
25
29
|
|| typeof manifest.createdAt !== 'string' || !Number.isFinite(Date.parse(manifest.createdAt))
|
|
26
30
|
|| !exact(manifest.stages, STAGES)
|
|
@@ -63,4 +67,4 @@ if (require.main === module) {
|
|
|
63
67
|
} catch (_) { process.exitCode = 1; }
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
module.exports = { STAGES, validateVersionManifest };
|
|
70
|
+
module.exports = { STAGES, validVersion, validateVersionManifest };
|
|
@@ -5,7 +5,7 @@ const path = require('node:path');
|
|
|
5
5
|
const { createHash } = require('node:crypto');
|
|
6
6
|
const { spawnSync } = require('node:child_process');
|
|
7
7
|
const { createRequest, validateRequest, validateResponse } = require('./contract');
|
|
8
|
-
const { STAGES, validateVersionManifest } = require('./manifest');
|
|
8
|
+
const { STAGES, validVersion, validateVersionManifest } = require('./manifest');
|
|
9
9
|
// Upstream cua_s1 source revision documented in docs/system-one-routing.md.
|
|
10
10
|
const PINNED_CUA_S1_REVISION = 'b7f7e2d8714609853a29c7d049140bc46aec0954';
|
|
11
11
|
const ADAPTER = path.join(__dirname, 'cua_adapter.py');
|
|
@@ -18,7 +18,6 @@ const adapterName = value => typeof value === 'string' && /^[a-z][a-z0-9_-]{0,63
|
|
|
18
18
|
// Thresholds calibrated on validation for this checkpoint (docs/system-one-training.md).
|
|
19
19
|
const inRange = (v, lo, hi) => typeof v === 'number' && Number.isFinite(v) && v >= lo && v <= hi;
|
|
20
20
|
const LIVE_STAGES = STAGES;
|
|
21
|
-
const SAFE_ID = /^[a-z0-9._-]{1,80}$/;
|
|
22
21
|
const sha256 = value => createHash('sha256').update(value).digest('hex');
|
|
23
22
|
const MAX_LAYER_BYTES = 32 * 1024 * 1024;
|
|
24
23
|
// secondaryThreshold is optional and belongs to intent checkpoints (docs/system-one-intent.md#scoring).
|
|
@@ -141,9 +140,9 @@ function readActive(env = process.env) {
|
|
|
141
140
|
if (!pointerStat.isFile() || pointerStat.isSymbolicLink() || pointerStat.size > 65536) return null;
|
|
142
141
|
const pointer = JSON.parse(fs.readFileSync(pointerPath, 'utf8'));
|
|
143
142
|
if (!exact(pointer, ['schemaVersion', 'version', 'dir', 'previous', 'activatedAt']) || pointer.schemaVersion !== 1
|
|
144
|
-
||
|
|
143
|
+
|| !validVersion(pointer.version)
|
|
145
144
|
|| typeof pointer.dir !== 'string' || !path.isAbsolute(pointer.dir)
|
|
146
|
-
|| !(pointer.previous === null || (
|
|
145
|
+
|| !(pointer.previous === null || validVersion(pointer.previous))
|
|
147
146
|
|| typeof pointer.activatedAt !== 'string' || !Number.isFinite(Date.parse(pointer.activatedAt))) return null;
|
|
148
147
|
const dir = pointer.dir;
|
|
149
148
|
const dirStat = fs.lstatSync(dir);
|
package/sbom.cdx.json
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
"$schema": "https://cyclonedx.org/schema/bom-1.7.schema.json",
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.7",
|
|
5
|
-
"serialNumber": "urn:uuid:
|
|
5
|
+
"serialNumber": "urn:uuid:8e7500b3-03df-5eee-ab1e-38dd6b82ac08",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-12-
|
|
8
|
+
"timestamp": "2026-12-04T01:36:30.394Z",
|
|
9
9
|
"tools": [
|
|
10
10
|
{
|
|
11
11
|
"vendor": "Harness Everything",
|
|
12
12
|
"name": "generate-sbom.js",
|
|
13
|
-
"version": "1.
|
|
13
|
+
"version": "1.6.0"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "application",
|
|
18
|
-
"bom-ref": "pkg:npm/harness-everything@1.
|
|
18
|
+
"bom-ref": "pkg:npm/harness-everything@1.6.0",
|
|
19
19
|
"name": "harness-everything",
|
|
20
|
-
"version": "1.
|
|
21
|
-
"purl": "pkg:npm/harness-everything@1.
|
|
20
|
+
"version": "1.6.0",
|
|
21
|
+
"purl": "pkg:npm/harness-everything@1.6.0"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
@@ -2033,7 +2033,7 @@
|
|
|
2033
2033
|
]
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
|
-
"ref": "pkg:npm/harness-everything@1.
|
|
2036
|
+
"ref": "pkg:npm/harness-everything@1.6.0",
|
|
2037
2037
|
"dependsOn": [
|
|
2038
2038
|
"pkg:npm/%40commitlint/cli@19.8.1",
|
|
2039
2039
|
"pkg:npm/%40commitlint/config-conventional@19.8.1",
|
|
@@ -6,7 +6,7 @@ const path = require('node:path');
|
|
|
6
6
|
const { spawnSync } = require('node:child_process');
|
|
7
7
|
const { REPO, dataPath, writeJson, assertPrivateDataDir } = require('./common');
|
|
8
8
|
const { TASKS, validateFitStage } = require('./train');
|
|
9
|
-
const { validateVersionManifest } = require('../../harness-everything/scripts/system-one/manifest');
|
|
9
|
+
const { validVersion, validateVersionManifest } = require('../../harness-everything/scripts/system-one/manifest');
|
|
10
10
|
|
|
11
11
|
function trainerCatalogs() {
|
|
12
12
|
const trainer = path.join(REPO, 'scripts', 'system-one-train.py');
|
|
@@ -27,7 +27,7 @@ function trainerCatalogs() {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function validateVersion(version) {
|
|
30
|
-
if (
|
|
30
|
+
if (!validVersion(version)) throw new Error('invalid --version');
|
|
31
31
|
return version;
|
|
32
32
|
}
|
|
33
33
|
|