harness-everything 0.58.0 → 1.0.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +8 -2
- package/CHANGELOG.md +24 -0
- package/README.md +4 -4
- package/benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/README.md +40 -0
- package/benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/edit-state-final.json +11 -0
- package/benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/events-2026-11-24.jsonl +103 -0
- package/benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/host-version.txt +3 -0
- package/benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/live-event-trace-probe.js +11 -0
- package/benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/plugin-load-lines.txt +2 -0
- package/benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/reminder-excerpt.txt +1 -0
- package/ci/doc-capability-consistency.test.js +4 -2
- package/ci/lib/opencode-v2-driver.js +169 -0
- package/ci/mechanism-2n-opencode-plugin.test.js +387 -223
- package/ci/mechanism-2p-opencode-v2-entrypoint.test.js +24 -15
- package/ci/mechanism-2u-issue-42-regressions.test.js +41 -2
- package/ci/mechanism-2w-platform-compatibility.test.js +16 -3
- package/ci/mechanism-30-opencode-plugin-loadability.test.js +78 -45
- package/ci/mechanism-338-opencode-async.test.js +367 -194
- package/ci/mechanism-341-opencode-lane.test.js +143 -183
- package/ci/mechanism-39-opencode-verify-outcomes.test.js +118 -86
- package/ci/mechanism-394-ledger-match.test.js +105 -3
- package/ci/mechanism-394-opencode-ledger-lesson.test.js +46 -97
- package/ci/mechanism-397-opencode-observations.test.js +58 -47
- package/ci/mechanism-453-opencode-v2-driver.test.js +51 -0
- package/ci/mechanism-453-opencode-v2-only-events.test.js +241 -0
- package/ci/mechanism-516-agy-post-tool-exit.test.js +472 -0
- package/ci/mechanism-516-agy-stop-revision.test.js +215 -0
- package/ci/telemetry.test.js +31 -24
- package/docs/architecture.md +4 -2
- package/docs/platform-capabilities.md +60 -26
- package/docs/platform-compatibility.json +8 -6
- package/docs/system-one-observations.md +1 -1
- package/docs/telemetry.md +1 -1
- package/docs/troubleshooting.md +2 -2
- package/hooks/scripts/agy-post-tool.js +79 -16
- package/hooks/scripts/agy-stop.js +63 -10
- package/hooks/scripts/lib/ledger-match.js +132 -20
- package/hooks/scripts/state-persist.js +7 -1
- package/opencode-plugin/README.md +60 -66
- package/opencode-plugin/index.mjs +11 -13
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- 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/agy-post-tool.js +79 -16
- package/plugins/harness-everything/hooks/scripts/agy-stop.js +63 -10
- package/plugins/harness-everything/hooks/scripts/lib/ledger-match.js +132 -20
- package/plugins/harness-everything/hooks/scripts/state-persist.js +7 -1
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/rules/AGENTS.md +8 -2
- package/sbom.cdx.json +12 -12
|
@@ -661,7 +661,7 @@ function appendTelemetry(workspace, input) {
|
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
-
|
|
664
|
+
const createEnforcement = async ({ client, directory, signal }) => {
|
|
665
665
|
// State is resolved per real workspace and per opencode session. The CJS
|
|
666
666
|
// hooks use the same workspaces/<key>/state/sessions/<id> contract, while
|
|
667
667
|
// the old flat plugin state is intentionally left untouched because it is
|
|
@@ -1033,9 +1033,9 @@ export const HarnessEnforcement = async ({ client, directory, signal }) => {
|
|
|
1033
1033
|
// function" (SchemaError at ["default"]) - this is what tripped the global
|
|
1034
1034
|
// install on this machine's OpenCode 2.1.3.
|
|
1035
1035
|
//
|
|
1036
|
-
// The
|
|
1037
|
-
//
|
|
1038
|
-
//
|
|
1036
|
+
// The private `createEnforcement` factory above keeps an internal hooks-object
|
|
1037
|
+
// shape; this default export adapts it to the V2 hooks. OpenCode 1.x is not
|
|
1038
|
+
// supported. Tool hook events are verified
|
|
1039
1039
|
// OpenCode 2.1.3 shapes: execute.before is {tool, sessionID, agent, messageID,
|
|
1040
1040
|
// id, input} with `input` carrying the tool args; execute.after adds
|
|
1041
1041
|
// {status, result | error}.
|
|
@@ -1129,11 +1129,11 @@ export default {
|
|
|
1129
1129
|
const enforcementFor = workspace => {
|
|
1130
1130
|
if (events.signal.aborted) return Promise.resolve(null)
|
|
1131
1131
|
if (!enforcementByWorkspace.has(workspace)) {
|
|
1132
|
-
enforcementByWorkspace.set(workspace,
|
|
1132
|
+
enforcementByWorkspace.set(workspace, createEnforcement({
|
|
1133
1133
|
signal: events.signal,
|
|
1134
1134
|
client: {
|
|
1135
1135
|
session: {
|
|
1136
|
-
//
|
|
1136
|
+
// The private core calls client.session.prompt({path, body}) twice;
|
|
1137
1137
|
// map it onto the V2 session API instead of duplicating the code.
|
|
1138
1138
|
prompt: ({ path, body }) =>
|
|
1139
1139
|
ctx.session.prompt({
|
|
@@ -1309,13 +1309,11 @@ export default {
|
|
|
1309
1309
|
try {
|
|
1310
1310
|
for await (const raw of ctx.event.subscribe({ signal: events.signal })) {
|
|
1311
1311
|
if (events.signal.aborted) break
|
|
1312
|
-
// OpenCode
|
|
1313
|
-
//
|
|
1314
|
-
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1317
|
-
const turnEnded = raw.type === "session.idle" || raw.type === "session.execution.succeeded"
|
|
1318
|
-
const lifecycleEvent = ["session.idle", "session.created", "session.deleted"].includes(raw.type)
|
|
1312
|
+
// OpenCode V2 events carry the session id at data.sessionID. A turn
|
|
1313
|
+
// completes with session.execution.succeeded; V2 sends no session.idle.
|
|
1314
|
+
const sessionID = raw.data && raw.data.sessionID
|
|
1315
|
+
const turnEnded = raw.type === "session.execution.succeeded"
|
|
1316
|
+
const lifecycleEvent = ["session.created", "session.deleted"].includes(raw.type)
|
|
1319
1317
|
if ((!turnEnded && !lifecycleEvent) || typeof sessionID !== "string" || !sessionID) continue
|
|
1320
1318
|
retryLedgerReleases()
|
|
1321
1319
|
if (raw.type === "session.deleted") invalidatedSessions.add(sessionID)
|
package/package.json
CHANGED
|
@@ -25,6 +25,66 @@ const FILE_MUTATION_TOOLS = new Set([
|
|
|
25
25
|
'multi_replace_file_content'
|
|
26
26
|
]);
|
|
27
27
|
|
|
28
|
+
const FAILED_STATUSES = new Set([
|
|
29
|
+
'failed',
|
|
30
|
+
'fail',
|
|
31
|
+
'error',
|
|
32
|
+
'errored',
|
|
33
|
+
'timed_out',
|
|
34
|
+
'timeout',
|
|
35
|
+
'cancelled',
|
|
36
|
+
'canceled',
|
|
37
|
+
'aborted'
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
function normalizeErrorText(rawError) {
|
|
41
|
+
if (typeof rawError === 'string') return rawError.trim();
|
|
42
|
+
if (rawError === null || rawError === undefined || rawError === false) return '';
|
|
43
|
+
if (typeof rawError === 'object') {
|
|
44
|
+
if (Array.isArray(rawError) && rawError.length === 0) return '';
|
|
45
|
+
if (!Array.isArray(rawError) && Object.keys(rawError).length === 0) return '';
|
|
46
|
+
}
|
|
47
|
+
const serialized = JSON.stringify(rawError);
|
|
48
|
+
return typeof serialized === 'string' ? serialized.trim() : '';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function hasExplicitFailureFlag(obj) {
|
|
52
|
+
return obj.isError === true
|
|
53
|
+
|| obj.is_error === true
|
|
54
|
+
|| obj.success === false
|
|
55
|
+
|| obj.ok === false
|
|
56
|
+
|| obj.interrupted === true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function classifyStructuredOutcome(safePayload, responseObj, error) {
|
|
60
|
+
const rawExitCodes = [
|
|
61
|
+
safePayload.exitCode,
|
|
62
|
+
safePayload.exit_code,
|
|
63
|
+
responseObj.exitCode,
|
|
64
|
+
responseObj.exit_code
|
|
65
|
+
].filter(Number.isInteger);
|
|
66
|
+
const nonzeroCode = rawExitCodes.find(code => code !== 0);
|
|
67
|
+
const exitCode = nonzeroCode ?? rawExitCodes[0];
|
|
68
|
+
|
|
69
|
+
const statuses = [safePayload.status, responseObj.status]
|
|
70
|
+
.filter(value => typeof value === 'string' && value.trim())
|
|
71
|
+
.map(value => value.trim().toLowerCase());
|
|
72
|
+
|
|
73
|
+
// Structured host errors, failure flags, and nonzero exit codes win over any
|
|
74
|
+
// zero or generic metadata fields. Text-only stdout/output markers are never parsed here
|
|
75
|
+
// because retained AGY captures do not distinguish host metadata from stdout.
|
|
76
|
+
const isFailed = Boolean(error && error.trim())
|
|
77
|
+
|| (exitCode !== undefined && exitCode !== 0)
|
|
78
|
+
|| hasExplicitFailureFlag(safePayload)
|
|
79
|
+
|| hasExplicitFailureFlag(responseObj)
|
|
80
|
+
|| statuses.some(status => FAILED_STATUSES.has(status));
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
isFailed,
|
|
84
|
+
exitCode: isFailed ? (exitCode !== undefined && exitCode !== 0 ? exitCode : undefined) : exitCode
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
28
88
|
function mapAgyPayloadToStatePersist(payload) {
|
|
29
89
|
const safePayload = payload && typeof payload === 'object' ? payload : {};
|
|
30
90
|
const sessionId = getAgySessionId(safePayload);
|
|
@@ -56,21 +116,22 @@ function mapAgyPayloadToStatePersist(payload) {
|
|
|
56
116
|
toolInput = { ...args, file_path: filePath };
|
|
57
117
|
}
|
|
58
118
|
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
safePayload.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
119
|
+
const rawResponse = safePayload.toolResponse || safePayload.tool_response || safePayload.result;
|
|
120
|
+
const responseObj = (rawResponse && typeof rawResponse === 'object' && !Array.isArray(rawResponse))
|
|
121
|
+
? rawResponse
|
|
122
|
+
: {};
|
|
123
|
+
const error = normalizeErrorText(safePayload.error) || normalizeErrorText(responseObj.error);
|
|
124
|
+
const stdout = (typeof responseObj.stdout === 'string' && responseObj.stdout)
|
|
125
|
+
|| (typeof safePayload.stdout === 'string' && safePayload.stdout)
|
|
126
|
+
|| (typeof safePayload.output === 'string' && safePayload.output)
|
|
127
|
+
|| (typeof rawResponse === 'string' && rawResponse)
|
|
128
|
+
|| '';
|
|
129
|
+
const stderr = (typeof responseObj.stderr === 'string' && responseObj.stderr)
|
|
130
|
+
|| (typeof safePayload.stderr === 'string' && safePayload.stderr)
|
|
131
|
+
|| error
|
|
132
|
+
|| '';
|
|
72
133
|
|
|
73
|
-
const isFailed =
|
|
134
|
+
const { isFailed, exitCode } = classifyStructuredOutcome(safePayload, responseObj, error);
|
|
74
135
|
|
|
75
136
|
return {
|
|
76
137
|
hook_event_name: isFailed ? 'PostToolUseFailure' : 'PostToolUse',
|
|
@@ -89,7 +150,9 @@ function mapAgyPayloadToStatePersist(payload) {
|
|
|
89
150
|
stderr,
|
|
90
151
|
...(exitCode !== undefined ? { exitCode } : {})
|
|
91
152
|
},
|
|
92
|
-
error: isFailed
|
|
153
|
+
error: isFailed
|
|
154
|
+
? (error || stderr || (exitCode !== undefined ? `Command exited with code ${exitCode}` : 'Tool execution failed'))
|
|
155
|
+
: '',
|
|
93
156
|
...(exitCode !== undefined ? { exitCode } : {})
|
|
94
157
|
};
|
|
95
158
|
}
|
|
@@ -121,4 +184,4 @@ if (require.main === module) {
|
|
|
121
184
|
});
|
|
122
185
|
}
|
|
123
186
|
|
|
124
|
-
module.exports = { main, mapAgyPayloadToStatePersist };
|
|
187
|
+
module.exports = { main, mapAgyPayloadToStatePersist, classifyStructuredOutcome };
|
|
@@ -26,6 +26,7 @@ const {
|
|
|
26
26
|
normalizeAgyStatePayload
|
|
27
27
|
} = require('./lib/agy-adapter-core');
|
|
28
28
|
const { getWorkspaceRoot, getSessionDir } = require('./lib/harness-state');
|
|
29
|
+
const { workspaceFingerprint } = require('./lib/workflow-isolation');
|
|
29
30
|
|
|
30
31
|
const STOP_STATE_FILE = 'agy-stop-state.json';
|
|
31
32
|
|
|
@@ -40,16 +41,58 @@ function readStopState(filePath) {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
function writeStopState(filePath, state) {
|
|
44
|
+
let temp;
|
|
43
45
|
try {
|
|
44
46
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
45
|
-
|
|
47
|
+
temp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
46
48
|
fs.writeFileSync(temp, JSON.stringify(state, null, 2) + '\n', 'utf8');
|
|
47
49
|
fs.renameSync(temp, filePath);
|
|
50
|
+
return true;
|
|
48
51
|
} catch (_) {
|
|
49
|
-
|
|
52
|
+
if (temp) { try { fs.unlinkSync(temp); } catch (_) {} }
|
|
53
|
+
return false;
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
|
|
57
|
+
function clearStopState(filePath) {
|
|
58
|
+
try { fs.unlinkSync(filePath); } catch (_) {}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function pendingRevision(handoff, root, sessionId) {
|
|
62
|
+
const directRevision = Number.isSafeInteger(handoff && handoff.agyDirectMutationRevision)
|
|
63
|
+
? handoff.agyDirectMutationRevision
|
|
64
|
+
: null;
|
|
65
|
+
let contentFingerprint = null;
|
|
66
|
+
try { contentFingerprint = workspaceFingerprint(root, { maxPaths: 5000 }); } catch (_) {}
|
|
67
|
+
return {
|
|
68
|
+
revision: directRevision === null ? `session:${sessionId || 'default'}` : `direct:${directRevision}`,
|
|
69
|
+
directRevision,
|
|
70
|
+
contentFingerprint
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function samePendingRevision(saved, current) {
|
|
75
|
+
if (!saved) return false;
|
|
76
|
+
if (!saved.lastContinuedRevision) {
|
|
77
|
+
// Older markers have no stable revision. Keep their session allowance
|
|
78
|
+
// when handoff state is legacy too; the prior content baseline is unknown.
|
|
79
|
+
return current.directRevision === null && Boolean(saved.lastContinuedFingerprint);
|
|
80
|
+
}
|
|
81
|
+
if (saved.lastContinuedRevision !== current.revision) return false;
|
|
82
|
+
return !current.contentFingerprint || !saved.lastContinuedContentFingerprint
|
|
83
|
+
|| saved.lastContinuedContentFingerprint === current.contentFingerprint;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function stopMarker(revision, reason) {
|
|
87
|
+
return {
|
|
88
|
+
lastContinuedRevision: revision.revision,
|
|
89
|
+
lastContinuedContentFingerprint: revision.contentFingerprint,
|
|
90
|
+
lastContinuedFingerprint: `${revision.revision}${revision.contentFingerprint ? `|workspace:${revision.contentFingerprint}` : ''}`,
|
|
91
|
+
lastContinuedReason: reason,
|
|
92
|
+
updatedAt: new Date().toISOString()
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
53
96
|
const ABNORMAL_TERMINATION_REASONS = new Set([
|
|
54
97
|
'USER_CANCELED',
|
|
55
98
|
'CANCELED',
|
|
@@ -103,17 +146,14 @@ function evaluateStop(payload) {
|
|
|
103
146
|
let pending = null;
|
|
104
147
|
if (isFailed) {
|
|
105
148
|
pending = {
|
|
106
|
-
fingerprint: `failed:${handoff.timestamp || ''}:${handoff.tool || ''}:${handoff.exitCode ?? ''}`,
|
|
107
149
|
reason: 'Harness Verify-Before-Claim: pending tool failure must be resolved before claiming completion.'
|
|
108
150
|
};
|
|
109
151
|
} else if (lastEditAt > 0 && lastVerifyAt < lastEditAt) {
|
|
110
152
|
pending = {
|
|
111
|
-
fingerprint: `edit:${lastEditAt}`,
|
|
112
153
|
reason: 'Harness Verify-Before-Claim: unverified edits exist in session. Run relevant test/build/lint verification before claiming completion.'
|
|
113
154
|
};
|
|
114
155
|
} else if (process.env.HARNESS_REQUIRE_VERIFICATION === '1' && (!lastVerifyAt || lastVerifyAt < lastEditAt)) {
|
|
115
156
|
pending = {
|
|
116
|
-
fingerprint: `strict:${lastVerifyAt}`,
|
|
117
157
|
reason: 'Harness Verify-Before-Claim: objective test verification is required before claiming completion.'
|
|
118
158
|
};
|
|
119
159
|
}
|
|
@@ -121,19 +161,32 @@ function evaluateStop(payload) {
|
|
|
121
161
|
if (pending) {
|
|
122
162
|
const stopStateFile = path.join(sessionDir, STOP_STATE_FILE);
|
|
123
163
|
const saved = readStopState(stopStateFile);
|
|
124
|
-
|
|
164
|
+
const revision = pendingRevision(handoff, root, sessionId);
|
|
165
|
+
if (samePendingRevision(saved, revision)) {
|
|
166
|
+
if (saved.lastContinuedReason !== pending.reason
|
|
167
|
+
|| saved.lastContinuedRevision !== revision.revision
|
|
168
|
+
|| (!saved.lastContinuedContentFingerprint && revision.contentFingerprint)) {
|
|
169
|
+
const marker = stopMarker(revision, pending.reason);
|
|
170
|
+
// A missed probe can refresh diagnostics, but cannot erase the last content baseline.
|
|
171
|
+
if (!revision.contentFingerprint && saved.lastContinuedContentFingerprint) {
|
|
172
|
+
marker.lastContinuedContentFingerprint = saved.lastContinuedContentFingerprint;
|
|
173
|
+
marker.lastContinuedFingerprint = saved.lastContinuedFingerprint;
|
|
174
|
+
}
|
|
175
|
+
writeStopState(stopStateFile, {
|
|
176
|
+
...saved,
|
|
177
|
+
...marker
|
|
178
|
+
});
|
|
179
|
+
}
|
|
125
180
|
return { decision: 'allow' };
|
|
126
181
|
}
|
|
127
|
-
writeStopState(stopStateFile, {
|
|
128
|
-
lastContinuedFingerprint: pending.fingerprint,
|
|
129
|
-
updatedAt: new Date().toISOString()
|
|
130
|
-
});
|
|
182
|
+
if (!writeStopState(stopStateFile, stopMarker(revision, pending.reason))) return { decision: 'allow' };
|
|
131
183
|
return {
|
|
132
184
|
decision: 'continue',
|
|
133
185
|
reason: pending.reason
|
|
134
186
|
};
|
|
135
187
|
}
|
|
136
188
|
|
|
189
|
+
clearStopState(path.join(sessionDir, STOP_STATE_FILE));
|
|
137
190
|
return { decision: 'allow' };
|
|
138
191
|
}
|
|
139
192
|
|
|
@@ -190,40 +190,152 @@ function words(command) {
|
|
|
190
190
|
return tokens;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
function literalRedirectTarget(command, start) {
|
|
194
|
+
let index = start;
|
|
195
|
+
while (index < command.length && /\s/.test(command[index])) index += 1;
|
|
196
|
+
const targetStart = index;
|
|
197
|
+
let quote = null;
|
|
198
|
+
let length = 0;
|
|
199
|
+
for (; index < command.length; index += 1) {
|
|
200
|
+
const char = command[index];
|
|
201
|
+
if (quote === "'") {
|
|
202
|
+
if (char === "'") quote = null;
|
|
203
|
+
else length += 1;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (quote === '"') {
|
|
207
|
+
if (char === '"') quote = null;
|
|
208
|
+
else if (char === '\\' && index + 1 < command.length) { index += 1; length += 1; }
|
|
209
|
+
else if (char === '$' || char === '`') return null;
|
|
210
|
+
else length += 1;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (char === '"' || char === "'") { quote = char; continue; }
|
|
214
|
+
if (char === '\\' && index + 1 < command.length) { index += 1; length += 1; continue; }
|
|
215
|
+
if (/\s/.test(char) || ';|&<>'.includes(char)) break;
|
|
216
|
+
if (char === '#' && index === targetStart) return null;
|
|
217
|
+
if ('()$`'.includes(char) || /[*?\[\]{}]/.test(char) || (char === '~' && length === 0)) return null;
|
|
218
|
+
length += 1;
|
|
219
|
+
}
|
|
220
|
+
return quote || length === 0 ? null : index;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function readRedirect(command, index, fileDescriptor) {
|
|
224
|
+
const char = command[index];
|
|
225
|
+
let operatorEnd = index + 1;
|
|
226
|
+
if (char === '<') {
|
|
227
|
+
if (command[index + 1] === '<' || command[index + 1] === '>') return null;
|
|
228
|
+
} else if (char === '>') {
|
|
229
|
+
if (command[index + 1] === '|') return null;
|
|
230
|
+
if (command[index + 1] === '>') operatorEnd += 1;
|
|
231
|
+
else if (command[index + 1] === '&') {
|
|
232
|
+
if (!fileDescriptor) return null;
|
|
233
|
+
let targetEnd = index + 2;
|
|
234
|
+
const digitsStart = targetEnd;
|
|
235
|
+
while (/[0-9]/.test(command[targetEnd] || '')) targetEnd += 1;
|
|
236
|
+
if (targetEnd === digitsStart ||
|
|
237
|
+
(targetEnd < command.length && !/\s/.test(command[targetEnd]) && !';|&<>'.includes(command[targetEnd]))) return null;
|
|
238
|
+
return targetEnd;
|
|
239
|
+
}
|
|
240
|
+
} else if (char === '&') {
|
|
241
|
+
if (command[index + 1] !== '>' || command[index + 2] === '>') return null;
|
|
242
|
+
operatorEnd += 1;
|
|
243
|
+
} else return null;
|
|
244
|
+
return literalRedirectTarget(command, operatorEnd);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Recognize a bounded top-level command list; redirects are removed before
|
|
248
|
+
// candidate matching so their filenames never become command words.
|
|
195
249
|
function splitSimpleCommandSegments(command) {
|
|
196
250
|
if (typeof command !== 'string' || command.length > LIMITS.command || /[\r\n\0]/.test(command)) return null;
|
|
197
251
|
const segments = [];
|
|
252
|
+
let segment = '';
|
|
198
253
|
let quote = null;
|
|
199
|
-
let
|
|
254
|
+
let tokenStart = true;
|
|
255
|
+
let afterSeparator = false;
|
|
200
256
|
for (let index = 0; index < command.length; index += 1) {
|
|
201
257
|
const char = command[index];
|
|
202
|
-
if (quote) {
|
|
203
|
-
|
|
204
|
-
|
|
258
|
+
if (quote === "'") {
|
|
259
|
+
segment += char;
|
|
260
|
+
if (char === "'") quote = null;
|
|
261
|
+
tokenStart = false;
|
|
262
|
+
afterSeparator = false;
|
|
205
263
|
continue;
|
|
206
264
|
}
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
|
|
265
|
+
if (quote === '"') {
|
|
266
|
+
if (char === '"') { segment += char; quote = null; tokenStart = false; afterSeparator = false; continue; }
|
|
267
|
+
if (char === '\\' && index + 1 < command.length) { segment += char + command[++index]; afterSeparator = false; continue; }
|
|
268
|
+
if (char === '`' || (char === '$' && command[index + 1] === '(')) return null;
|
|
269
|
+
segment += char;
|
|
270
|
+
afterSeparator = false;
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
if (char === '"' || char === "'") { segment += char; quote = char; tokenStart = false; afterSeparator = false; continue; }
|
|
274
|
+
if (char === '\\' && index + 1 < command.length) { segment += char + command[++index]; tokenStart = false; afterSeparator = false; continue; }
|
|
275
|
+
if (char === '`' || (char === '$' && command[index + 1] === '(') || '()'.includes(char)) return null;
|
|
276
|
+
if (char === '#' && tokenStart) {
|
|
277
|
+
if (afterSeparator) return null;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
if (/\s/.test(char)) { segment += char; tokenStart = true; continue; }
|
|
281
|
+
|
|
282
|
+
let descriptorEnd = index;
|
|
283
|
+
if (tokenStart && /[0-9]/.test(char)) {
|
|
284
|
+
while (/[0-9]/.test(command[descriptorEnd] || '')) descriptorEnd += 1;
|
|
285
|
+
if (command[descriptorEnd] === '>' || command[descriptorEnd] === '<') {
|
|
286
|
+
const end = readRedirect(command, descriptorEnd, true);
|
|
287
|
+
if (end === null) return null;
|
|
288
|
+
index = end - 1;
|
|
289
|
+
tokenStart = true;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (char === '<' || char === '>') {
|
|
294
|
+
const end = readRedirect(command, index, false);
|
|
295
|
+
if (end === null) return null;
|
|
296
|
+
index = end - 1;
|
|
297
|
+
tokenStart = true;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (char === '&' && command[index + 1] === '>') {
|
|
301
|
+
const end = readRedirect(command, index, false);
|
|
302
|
+
if (end === null) return null;
|
|
303
|
+
index = end - 1;
|
|
304
|
+
tokenStart = true;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
|
|
210
308
|
let separatorLength = 0;
|
|
211
309
|
if (char === ';') separatorLength = 1;
|
|
212
|
-
else if (char === '&'
|
|
213
|
-
if (command[index + 1] !==
|
|
310
|
+
else if (char === '&') {
|
|
311
|
+
if (command[index + 1] !== '&' || command[index + 2] === '&') return null;
|
|
214
312
|
separatorLength = 2;
|
|
313
|
+
} else if (char === '|') {
|
|
314
|
+
if (command[index + 1] === '&' || command[index + 2] === '|') return null;
|
|
315
|
+
separatorLength = command[index + 1] === '|' ? 2 : 1;
|
|
215
316
|
}
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
317
|
+
if (separatorLength) {
|
|
318
|
+
const current = segment.trim();
|
|
319
|
+
if (!current || segments.length >= LIMITS.commandSegments - 1) return null;
|
|
320
|
+
segments.push(current);
|
|
321
|
+
segment = '';
|
|
322
|
+
index += separatorLength - 1;
|
|
323
|
+
tokenStart = true;
|
|
324
|
+
afterSeparator = true;
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (char === '&' || char === '|') return null;
|
|
328
|
+
segment += char;
|
|
329
|
+
tokenStart = false;
|
|
330
|
+
afterSeparator = false;
|
|
222
331
|
}
|
|
223
332
|
if (quote) return null;
|
|
224
|
-
const finalSegment =
|
|
225
|
-
if (
|
|
226
|
-
|
|
333
|
+
const finalSegment = segment.trim();
|
|
334
|
+
if (afterSeparator) return null;
|
|
335
|
+
if (finalSegment) {
|
|
336
|
+
if (segments.length >= LIMITS.commandSegments) return null;
|
|
337
|
+
segments.push(finalSegment);
|
|
338
|
+
}
|
|
227
339
|
return segments;
|
|
228
340
|
}
|
|
229
341
|
|
|
@@ -139,7 +139,13 @@ function processState(payload) {
|
|
|
139
139
|
const isDirectTool = toolName === 'Edit' || toolName === 'Write' || toolName === 'apply_patch';
|
|
140
140
|
if (isDirectTool && (agy
|
|
141
141
|
? agyDirectMutationInWorkspace(payload, cwdOf(payload, root), root, toolName)
|
|
142
|
-
: directMutationInWorkspace(payload, cwdOf(payload, root), root)))
|
|
142
|
+
: directMutationInWorkspace(payload, cwdOf(payload, root), root))) {
|
|
143
|
+
state.lastEditAt = Date.now();
|
|
144
|
+
if (agy) {
|
|
145
|
+
const revision = Number.isSafeInteger(state.agyDirectMutationRevision) ? state.agyDirectMutationRevision : 0;
|
|
146
|
+
if (revision < Number.MAX_SAFE_INTEGER) state.agyDirectMutationRevision = revision + 1;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
143
149
|
const isShell = toolName === 'Bash' || toolName === 'PowerShell' || toolName === 'exec_command';
|
|
144
150
|
const command = (payload.tool_input && payload.tool_input.command) || '';
|
|
145
151
|
if (isShell) {
|
|
@@ -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": "0.
|
|
4
|
+
"version": "1.0.1",
|
|
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",
|
|
@@ -37,7 +37,7 @@ flowchart LR
|
|
|
37
37
|
| `<skill-name>/SKILL.md` | One canonical skill per top-level directory. Frontmatter: `name`, `description`, `metadata.author`, `metadata.version`. |
|
|
38
38
|
| `hooks/` | Claude Code lifecycle hooks and shared mechanisms (circuit breaker, workflow/action/scope guards, stop gates). Not every host packages every hook. |
|
|
39
39
|
| `harness-everything/scripts/` | Runtime: kernel/tier routing, workflow contract, verification, bootstrap, self-heal. |
|
|
40
|
-
| `opencode-plugin/` | OpenCode native plugin. Mechanism-tested, with partial live-host evidence (see the boundary below). |
|
|
40
|
+
| `opencode-plugin/` | OpenCode V2 native plugin (OpenCode 1.x / V1 unsupported). Mechanism-tested, with partial live-host evidence (see the boundary below). |
|
|
41
41
|
| `.agents/plugins/` + `plugins/harness-everything/` | Local OpenAI/Codex marketplace + `.codex-plugin` package with canonical skill copies and packaged session/prompt hooks. |
|
|
42
42
|
| `submission/openai/` | Public OpenAI Skills-only listing/test inputs. The public artifact does not include local `.codex-plugin` lifecycle hooks. |
|
|
43
43
|
| `evals/<skill>/` | Trigger/routing eval per skill (waza format). Required for every canonical routed skill. |
|
|
@@ -51,7 +51,13 @@ flowchart LR
|
|
|
51
51
|
|
|
52
52
|
## OpenCode evidence boundary
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
- **Support boundary (V2-only, #453):** Harness supports the OpenCode V2 plugin API only; OpenCode 1.x / V1 is unsupported.
|
|
55
|
+
- New features, fixes, tests, and host compatibility work target V2 only. No V1 public entrypoint, V1-only event fallback, V1 hook registration, or compatibility mode may be added.
|
|
56
|
+
- Retain historical V1 artifacts, but never promote them to current V2 capability evidence.
|
|
57
|
+
- Reintroducing V1 support requires an explicit owner-approved support-contract change; it is not a routine compatibility fix.
|
|
58
|
+
- State the V2 API family as the supported boundary. Tested V2 versions are recorded separately (`2.1.3` server-log load-only; `2.1.4` limited session workspace trace; and one isolated `2.1.4` macOS 26.6.2 [V2 lifecycle trace](benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/README.md) establishing V2 default-export load, V2 tool hooks, V2 event envelope + `session.execution.succeeded`, and completion → verification → reminder delivery on a long-lived server — standalone `opencode run` exits before verification finishes; router/context injection, observations, ledger lessons, session create/delete reset, cancellation, global scope, npm install, and other versions/OSes were not exercised); none establishes a validated minimum patch version or coverage of every V2 release.
|
|
59
|
+
|
|
60
|
+
**Historical / unsupported V1 evidence:** the retained [OpenCode evidence](benchmarks/results/live-host/opencode-2026-09-16/README.md) documents project-scope `.js` loading and edit/verification state on OpenCode 1.18.31 (macOS). It is preserved as historical/unsupported evidence only and does not establish current V2 capability:
|
|
55
61
|
|
|
56
62
|
- The final snapshot is post-reset (`hardLock: false`, `count: 1`).
|
|
57
63
|
- Hard lock is only an interactive observation with no retained blocked-tool trace.
|
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:5e19a56c-c29d-5512-8fe8-c5b8456ca9ff",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-11-
|
|
8
|
+
"timestamp": "2026-11-24T21:06:36.371Z",
|
|
9
9
|
"tools": [
|
|
10
10
|
{
|
|
11
11
|
"vendor": "Harness Everything",
|
|
12
12
|
"name": "generate-sbom.js",
|
|
13
|
-
"version": "0.
|
|
13
|
+
"version": "1.0.1"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "application",
|
|
18
|
-
"bom-ref": "pkg:npm/harness-everything@0.
|
|
18
|
+
"bom-ref": "pkg:npm/harness-everything@1.0.1",
|
|
19
19
|
"name": "harness-everything",
|
|
20
|
-
"version": "0.
|
|
21
|
-
"purl": "pkg:npm/harness-everything@0.
|
|
20
|
+
"version": "1.0.1",
|
|
21
|
+
"purl": "pkg:npm/harness-everything@1.0.1"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
@@ -948,15 +948,15 @@
|
|
|
948
948
|
},
|
|
949
949
|
{
|
|
950
950
|
"type": "library",
|
|
951
|
-
"bom-ref": "pkg:npm/fast-uri@3.1.
|
|
951
|
+
"bom-ref": "pkg:npm/fast-uri@3.1.9",
|
|
952
952
|
"name": "fast-uri",
|
|
953
|
-
"version": "3.1.
|
|
953
|
+
"version": "3.1.9",
|
|
954
954
|
"scope": "excluded",
|
|
955
|
-
"purl": "pkg:npm/fast-uri@3.1.
|
|
955
|
+
"purl": "pkg:npm/fast-uri@3.1.9",
|
|
956
956
|
"hashes": [
|
|
957
957
|
{
|
|
958
958
|
"alg": "SHA-512",
|
|
959
|
-
"content": "
|
|
959
|
+
"content": "hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ=="
|
|
960
960
|
}
|
|
961
961
|
]
|
|
962
962
|
},
|
|
@@ -1930,7 +1930,7 @@
|
|
|
1930
1930
|
"ref": "pkg:npm/ajv@8.20.0",
|
|
1931
1931
|
"dependsOn": [
|
|
1932
1932
|
"pkg:npm/fast-deep-equal@3.1.3",
|
|
1933
|
-
"pkg:npm/fast-uri@3.1.
|
|
1933
|
+
"pkg:npm/fast-uri@3.1.9",
|
|
1934
1934
|
"pkg:npm/json-schema-traverse@1.0.0",
|
|
1935
1935
|
"pkg:npm/require-from-string@2.0.2"
|
|
1936
1936
|
]
|
|
@@ -2033,7 +2033,7 @@
|
|
|
2033
2033
|
]
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
|
-
"ref": "pkg:npm/harness-everything@0.
|
|
2036
|
+
"ref": "pkg:npm/harness-everything@1.0.1",
|
|
2037
2037
|
"dependsOn": [
|
|
2038
2038
|
"pkg:npm/%40commitlint/cli@19.8.1",
|
|
2039
2039
|
"pkg:npm/%40commitlint/config-conventional@19.8.1",
|