harness-everything 1.5.4 → 1.6.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/.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 +27 -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/behavioral-evals/paired-benchmark.js +2 -2
- package/behavioral-evals/run-with-plugin.js +8 -3
- package/behavioral-evals/run.js +5 -3
- 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/ab-test-harness.js +2 -2
- 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-2j-behavioral-runner.test.js +45 -1
- package/ci/mechanism-2j-fixture-entrypoints.test.js +39 -0
- package/ci/mechanism-2x-release-commit-message.test.js +34 -23
- package/ci/mechanism-32-paired-benchmark.test.js +38 -0
- 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-468-dispatch-cli.test.js +23 -0
- package/ci/mechanism-552-ledger-pairs.test.js +2 -0
- package/ci/mechanism-system-one-curves.test.js +26 -3
- package/ci/mechanism-system-one-cycle.test.js +5 -4
- package/ci/mechanism-system-one-live.test.js +6 -1
- 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 +9 -4
- package/docs/platform-compatibility.json +3 -3
- package/docs/system-one-cycle.md +5 -5
- package/docs/system-one-routing.md +10 -7
- package/docs/system-one-training.md +4 -5
- package/harness-everything/SKILL.md +1 -1
- package/harness-everything/scripts/system-one/router.js +0 -1
- 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/router.js +0 -1
- package/sbom.cdx.json +7 -7
- package/scripts/dispatch.js +3 -2
- package/scripts/system-one-curves.js +4 -32
package/SECURITY.md
CHANGED
|
@@ -1,33 +1,54 @@
|
|
|
1
1
|
# Security Policy
|
|
2
2
|
|
|
3
|
+
**Harness Everything** (npm package `harness-everything`, CLI `harness`) is an AI Agent Behavior and Orchestration Runtime (AI Agent Harness) providing skills, routing, lifecycle hooks, and host integrations.
|
|
4
|
+
|
|
5
|
+
## Supported Versions
|
|
6
|
+
|
|
7
|
+
Security fixes are applied on a best-effort basis to the latest released minor version line. Older minor and major versions are not supported; users should upgrade to the latest release.
|
|
8
|
+
|
|
9
|
+
| Version | Supported |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Latest released minor line | Yes (security and bug fixes) |
|
|
12
|
+
| Older minor / major versions | No |
|
|
13
|
+
| `main` (unreleased) | Development / pre-release |
|
|
14
|
+
|
|
3
15
|
## Reporting a Vulnerability
|
|
4
16
|
|
|
5
|
-
If you discover a security vulnerability in Harness, please report it responsibly.
|
|
17
|
+
If you discover a security vulnerability in Harness Everything, please report it responsibly.
|
|
6
18
|
|
|
7
19
|
**Do not open a public issue for security vulnerabilities.**
|
|
8
20
|
|
|
9
|
-
|
|
21
|
+
- If GitHub Security Advisories / private vulnerability reporting is available on the repository, you may submit a private report there.
|
|
22
|
+
- Otherwise (or if you prefer direct contact), email: `dyphn1@hotmail.com`
|
|
10
23
|
|
|
11
|
-
|
|
24
|
+
Please include:
|
|
12
25
|
- Description of the vulnerability
|
|
13
26
|
- Steps to reproduce
|
|
14
27
|
- Potential impact
|
|
28
|
+
- Affected version and host environment (if applicable)
|
|
15
29
|
|
|
16
30
|
## Response Timeline
|
|
17
31
|
|
|
18
|
-
-
|
|
19
|
-
|
|
32
|
+
Harness Everything is an open-source project; the following timelines are **best-effort targets** rather than contractual SLAs:
|
|
33
|
+
|
|
34
|
+
- **Acknowledgement:** within 48 hours
|
|
35
|
+
- **Initial assessment and fix or mitigation plan:** within 7 days for confirmed vulnerabilities
|
|
20
36
|
|
|
21
37
|
## Scope
|
|
22
38
|
|
|
23
|
-
This policy covers the Harness-everything repository
|
|
39
|
+
This policy covers the `Harness-everything` repository, the published `harness-everything` npm package (and `harness` CLI), and the packaged host plugins and lifecycle hooks. (Note: the public OpenAI Skills-only submission artifact in `submission/openai/` is a skills-only listing without local lifecycle hooks.)
|
|
40
|
+
|
|
41
|
+
## Release Supply-Chain Posture
|
|
42
|
+
|
|
43
|
+
- **npm Trusted Publishing:** Official releases are published from GitHub Actions using npm OIDC Trusted Publishing with provenance (`NPM_CONFIG_PROVENANCE=true`), without long-lived npm publish tokens.
|
|
44
|
+
- **SBOM:** Each release generates and validates a CycloneDX Software Bill of Materials (`sbom.cdx.json`) attached to the corresponding GitHub Release.
|
|
24
45
|
|
|
25
46
|
## Hooks and Runtime Behavior
|
|
26
47
|
|
|
27
|
-
Harness installs execution hooks (action gate, scope guard, stop gate
|
|
48
|
+
Harness Everything installs or packages execution hooks and host adapters (such as the action gate, scope guard, and stop gate in Claude Code, and corresponding mechanisms in supported hosts). These mechanisms:
|
|
28
49
|
|
|
29
50
|
- Enforce file-scope boundaries
|
|
30
51
|
- Track verification state
|
|
31
52
|
- Block unsafe operations
|
|
32
53
|
|
|
33
|
-
If you find a bypass or unintended behavior in these mechanisms, please report it.
|
|
54
|
+
If you find a bypass or unintended behavior in these mechanisms, please report it using the private channels above.
|
package/SUPPORT.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# Support
|
|
2
2
|
|
|
3
|
-
Harness Everything is an open-source
|
|
3
|
+
**Harness Everything** (npm package `harness-everything`, CLI `harness`) is an open-source AI Agent Behavior and Orchestration Runtime (AI Agent Harness) for software-development workflows across Claude Code, OpenCode V2, Codex, ChatGPT, and compatible coding-agent hosts. Only the public OpenAI Skills-only submission artifact (`submission/openai/`) is distributed as skills-only without local lifecycle hooks.
|
|
4
4
|
|
|
5
5
|
## Get help
|
|
6
6
|
|
|
7
|
-
For installation, routing, skill behavior, or publication-related problems, open a GitHub issue:
|
|
7
|
+
For installation, routing, hook/plugin behavior, skill behavior, or publication-related problems, open a GitHub issue:
|
|
8
8
|
|
|
9
9
|
https://github.com/dyphn1/Harness-everything/issues
|
|
10
10
|
|
|
11
11
|
Please include:
|
|
12
12
|
|
|
13
13
|
- the host and version you were using;
|
|
14
|
-
- the Harness Everything version or commit;
|
|
14
|
+
- the Harness Everything (`harness-everything`) version or commit;
|
|
15
15
|
- the smallest prompt or workflow that reproduces the problem;
|
|
16
16
|
- expected and observed behavior;
|
|
17
17
|
- relevant logs with secrets, credentials, private source, and personal data removed.
|
|
@@ -24,4 +24,4 @@ https://github.com/dyphn1/Harness-everything/blob/main/SECURITY.md
|
|
|
24
24
|
|
|
25
25
|
## Scope
|
|
26
26
|
|
|
27
|
-
Harness Everything does not operate a hosted support service, hosted backend, or separate user account. Support covers the open-source
|
|
27
|
+
Harness Everything does not operate a hosted support service, hosted backend, or separate user account. Support covers the open-source `harness-everything` runtime, CLI, packaged host plugins/hooks, and documented workflows on a best-effort basis; support for Claude Code, OpenCode, Codex, ChatGPT, GitHub, package registries, and other third-party services remains with those providers.
|
package/TERMS.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Terms of Use
|
|
2
2
|
|
|
3
|
-
Harness Everything is open-source
|
|
3
|
+
**Harness Everything** (npm package `harness-everything`, CLI `harness`) is an open-source AI Agent Behavior and Orchestration Runtime (AI Agent Harness) distributed under the Apache License 2.0. Use, copying, modification, and distribution of the software are governed by the terms of the repository `LICENSE` file.
|
|
4
4
|
|
|
5
5
|
## No hosted service
|
|
6
6
|
|
|
7
|
-
The project does not provide a hosted service or separate user account. The
|
|
7
|
+
The project does not provide a hosted service or separate user account. The runtime packages skills, routing, and local hooks/plugins that run through the user's supported coding-agent environment (such as Claude Code, OpenCode V2, Codex, or ChatGPT; only the public OpenAI Skills-only submission artifact in `submission/openai/` is skills-only without local lifecycle hooks).
|
|
8
8
|
|
|
9
9
|
## User responsibility
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Harness workflows can guide an agent to inspect code, modify files, run commands
|
|
|
12
12
|
|
|
13
13
|
## Third-party platforms
|
|
14
14
|
|
|
15
|
-
Use of
|
|
15
|
+
Use of Claude Code, OpenCode, Codex, ChatGPT, GitHub, package registries, external tools, or connected services remains subject to the applicable third-party terms. Harness Everything does not grant additional rights to those services and does not bypass their authorization or workspace controls.
|
|
16
16
|
|
|
17
17
|
## Warranty and liability
|
|
18
18
|
|
|
@@ -312,7 +312,7 @@ function buildInvocation(engine, model, prompt, ws, maxTurns) {
|
|
|
312
312
|
if (engine === 'opencode') {
|
|
313
313
|
return resolveCliInvocation({
|
|
314
314
|
command: 'opencode',
|
|
315
|
-
args: ['run', '--format', 'json', '--auto', '--
|
|
315
|
+
args: ['run', '--format', 'json', '--auto', '--standalone', '-m', model, prompt],
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
318
|
if (engine === 'claude') {
|
|
@@ -433,7 +433,7 @@ function runArm(c, context, arm, pairDir, execute = spawnSync) {
|
|
|
433
433
|
const started = Date.now();
|
|
434
434
|
const result = execute(invocation.command, invocation.args, {
|
|
435
435
|
cwd: prepared.ws,
|
|
436
|
-
env: { ...process.env, HARNESS_STATE_HOME: stateHome },
|
|
436
|
+
env: { ...process.env, HARNESS_STATE_HOME: stateHome, PWD: prepared.ws },
|
|
437
437
|
encoding: 'utf8',
|
|
438
438
|
timeout: context.engine === 'opencode' ? 20 * 60 * 1000 : 15 * 60 * 1000,
|
|
439
439
|
maxBuffer: 64 * 1024 * 1024,
|
|
@@ -172,15 +172,20 @@ function installHarnessWithPlugin(ws) {
|
|
|
172
172
|
function runHeadless(prompt, ws, maxTurns) {
|
|
173
173
|
const outPath = path.join(path.dirname(ws), path.basename(ws) + '.transcript.json');
|
|
174
174
|
const model = process.env.BEHAVIORAL_MODEL;
|
|
175
|
-
const args = ['run', '--format', 'json', '--auto', '--
|
|
175
|
+
const args = ['run', '--format', 'json', '--auto', '--standalone'];
|
|
176
176
|
if (model) args.push('-m', model);
|
|
177
177
|
// Pass the prompt as one argv element; shell quoting corrupts prompts on
|
|
178
178
|
// Windows and previously reduced full requests to fragments such as `Add.`.
|
|
179
179
|
args.push(prompt);
|
|
180
180
|
const outputFd = fs.openSync(outPath, 'w');
|
|
181
181
|
try {
|
|
182
|
-
execFileSync('opencode', args,
|
|
183
|
-
|
|
182
|
+
execFileSync('opencode', args, {
|
|
183
|
+
cwd: ws,
|
|
184
|
+
env: { ...process.env, PWD: ws },
|
|
185
|
+
stdio: ['ignore', outputFd, 'inherit'],
|
|
186
|
+
timeout: 20 * 60 * 1000,
|
|
187
|
+
windowsHide: true,
|
|
188
|
+
});
|
|
184
189
|
} finally {
|
|
185
190
|
fs.closeSync(outputFd);
|
|
186
191
|
}
|
package/behavioral-evals/run.js
CHANGED
|
@@ -338,7 +338,7 @@ function installHarness(ws, loadedSkills) {
|
|
|
338
338
|
|
|
339
339
|
function buildEngineInvocation(engine, prompt, ws, maxTurns, arm = 'treatment') {
|
|
340
340
|
if (engine === 'opencode') {
|
|
341
|
-
const args = ['run', '--format', 'json', '--auto', '--
|
|
341
|
+
const args = ['run', '--format', 'json', '--auto', '--standalone'];
|
|
342
342
|
const model = process.env.BEHAVIORAL_MODEL;
|
|
343
343
|
if (model) args.push('-m', model);
|
|
344
344
|
args.push(prompt);
|
|
@@ -401,7 +401,7 @@ function resolveCliInvocation(invocation) {
|
|
|
401
401
|
return direct ? { command: direct, args: invocation.args.slice() } : invocation;
|
|
402
402
|
}
|
|
403
403
|
|
|
404
|
-
function runHeadless(prompt, ws, maxTurns, engine, arm) {
|
|
404
|
+
function runHeadless(prompt, ws, maxTurns, engine, arm, execute = execFileSync) {
|
|
405
405
|
// Keep the transcript OUTSIDE the workspace: grader artifacts must never
|
|
406
406
|
// show up in git-status-based scope checks.
|
|
407
407
|
const outPath = path.join(path.dirname(ws), path.basename(ws) + '.transcript.jsonl');
|
|
@@ -411,8 +411,9 @@ function runHeadless(prompt, ws, maxTurns, engine, arm) {
|
|
|
411
411
|
try {
|
|
412
412
|
// Pass the prompt as one argv element. A shell wrapper on Windows can
|
|
413
413
|
// reinterpret spaces and punctuation, truncating prompts to `Add.`.
|
|
414
|
-
|
|
414
|
+
execute(executable.command, executable.args, {
|
|
415
415
|
cwd: ws,
|
|
416
|
+
env: { ...process.env, PWD: ws },
|
|
416
417
|
stdio: ['ignore', outputFd, 'inherit'],
|
|
417
418
|
timeout: engine === 'opencode' ? 20 * 60 * 1000 : 15 * 60 * 1000,
|
|
418
419
|
windowsHide: true,
|
|
@@ -1238,6 +1239,7 @@ module.exports = {
|
|
|
1238
1239
|
buildEngineInvocation,
|
|
1239
1240
|
buildWorkspace,
|
|
1240
1241
|
runFixtureSetup,
|
|
1242
|
+
runHeadless,
|
|
1241
1243
|
prepareWorkspace,
|
|
1242
1244
|
countToolCalls,
|
|
1243
1245
|
extractAgentEvents,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# OpenCode V2 steering fix on Linux for #450
|
|
2
|
+
|
|
3
|
+
| Field | Observed value |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| Host | OpenCode 2.4.1, official Linux x64 release, long-lived server |
|
|
6
|
+
| OS | Debian GNU/Linux 13.7, x86_64, kernel 6.18.64 |
|
|
7
|
+
| Node | 24.22.3 |
|
|
8
|
+
| Candidate | Branch based on `970f1684`. Tested `opencode-plugin/index.mjs` SHA-256 `bdcf699b759e9fd51defd0a9501c67da1cadb528fae4909df5fe6b097f93d10d`. |
|
|
9
|
+
| Scope | Project plugin, disposable Git workspace, profile and Harness store |
|
|
10
|
+
|
|
11
|
+
The workspace loaded the candidate from `.opencode/plugins/harness-enforcement.js` alongside the key-only steering probe. The server ran as `opencode serve --hostname 127.0.0.1 --port <port>`. Three `opencode --server <address> run --model fixture/fixture --format json` calls drove one session. B and C used the session ID obtained from A.
|
|
12
|
+
|
|
13
|
+
The fixture was a loopback OpenAI-compatible endpoint that returned a shell tool call to run `sleep 12` for A, then text with a valid label for the shared result and for C. B was submitted while the OpenCode shell tool was running. The host handled scheduling, inbox promotion, tool execution, lifecycle events and plugin calls. The fixture supplied deterministic model output.
|
|
14
|
+
|
|
15
|
+
| Scenario | Host events | Observation |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| A then steering B | The two prompt IDs matched their respective inbox deliveries inside one execution, followed by one success | Two rows with `final-message-unavailable` and no label |
|
|
18
|
+
| Sequential C | A new start, C inbox delivery and success | One row with a valid label |
|
|
19
|
+
|
|
20
|
+
The [sanitized lifecycle](lifecycle.sanitized.jsonl) includes relative times, pseudonymous IDs, event keys and durable sequence numbers. The [observation excerpt](observations.sanitized.json) preserves the three dispositions. The earlier [macOS trace](../opencode-2026-11-28-450-steering-trace/README.md) is the pre-fix witness. Replayed completions, interruption, reset and workspace controls are covered by deterministic tests.
|
package/benchmarks/results/live-host/opencode-2026-12-02-450-steering/lifecycle.sanitized.jsonl
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{"dt_ms":0,"hook":"prompt","sid":"s1","mid":"m2","deliveryValue":"steer"}
|
|
2
|
+
{"dt_ms":6,"event":"session.inbox.enqueued","sid":"s1","mid":"m2","seq":1,"dataKeys":["sessionID","inboxID","item"]}
|
|
3
|
+
{"dt_ms":39,"event":"session.execution.started","sid":"s1","seq":2,"dataKeys":["sessionID"]}
|
|
4
|
+
{"dt_ms":43,"event":"session.inbox.delivered","sid":"s1","mid":"m2","seq":4,"dataKeys":["sessionID","inboxID"]}
|
|
5
|
+
{"dt_ms":144,"event":"session.tool.called","sid":"s1","seq":11,"dataKeys":["sessionID","assistantMessageID","id","input","executed"]}
|
|
6
|
+
{"dt_ms":477,"hook":"prompt","sid":"s1","mid":"m4","deliveryValue":"steer"}
|
|
7
|
+
{"dt_ms":481,"event":"session.inbox.enqueued","sid":"s1","mid":"m4","seq":13,"dataKeys":["sessionID","inboxID","item"]}
|
|
8
|
+
{"dt_ms":12443,"event":"session.inbox.delivered","sid":"s1","mid":"m4","seq":16,"dataKeys":["sessionID","inboxID"]}
|
|
9
|
+
{"dt_ms":12483,"event":"session.execution.succeeded","sid":"s1","seq":23,"dataKeys":["sessionID"]}
|
|
10
|
+
{"dt_ms":12748,"hook":"prompt","sid":"s1","mid":"m6","deliveryValue":"steer"}
|
|
11
|
+
{"dt_ms":12752,"event":"session.inbox.enqueued","sid":"s1","mid":"m6","seq":24,"dataKeys":["sessionID","inboxID","item"]}
|
|
12
|
+
{"dt_ms":12774,"event":"session.execution.started","sid":"s1","seq":25,"dataKeys":["sessionID"]}
|
|
13
|
+
{"dt_ms":12774,"event":"session.inbox.delivered","sid":"s1","mid":"m6","seq":26,"dataKeys":["sessionID","inboxID"]}
|
|
14
|
+
{"dt_ms":12824,"event":"session.execution.succeeded","sid":"s1","seq":33,"dataKeys":["sessionID"]}
|
package/benchmarks/results/live-host/opencode-2026-12-02-450-steering/observations.sanitized.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"turn": 1,
|
|
4
|
+
"host": "opencode",
|
|
5
|
+
"selfReport": false,
|
|
6
|
+
"selfReportReason": "final-message-unavailable"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"turn": 2,
|
|
10
|
+
"host": "opencode",
|
|
11
|
+
"selfReport": false,
|
|
12
|
+
"selfReportReason": "final-message-unavailable"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"turn": 3,
|
|
16
|
+
"host": "opencode",
|
|
17
|
+
"selfReport": true,
|
|
18
|
+
"selfReportReason": null
|
|
19
|
+
}
|
|
20
|
+
]
|
package/bin/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Harness
|
|
4
|
-
*
|
|
3
|
+
* Harness Everything CLI
|
|
4
|
+
* Behavior and orchestration runtime for AI coding agents
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const { spawnSync } = require('child_process');
|
|
@@ -16,6 +16,11 @@ if (!command || command === '--help' || command === '-h') {
|
|
|
16
16
|
process.exit(0);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
if (command === '--version' || command === '-v' || command === 'version') {
|
|
20
|
+
showVersion();
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
switch (command) {
|
|
20
25
|
case 'install':
|
|
21
26
|
case 'add':
|
|
@@ -49,20 +54,35 @@ switch (command) {
|
|
|
49
54
|
process.exit(1);
|
|
50
55
|
}
|
|
51
56
|
|
|
57
|
+
function showVersion() {
|
|
58
|
+
const pkgPath = path.resolve(__dirname, '..', 'package.json');
|
|
59
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
60
|
+
console.log(pkg.version);
|
|
61
|
+
}
|
|
62
|
+
|
|
52
63
|
function showHelp() {
|
|
53
64
|
console.log(`
|
|
54
|
-
Harness
|
|
65
|
+
Harness Everything - Behavior and Orchestration Runtime CLI
|
|
55
66
|
|
|
56
67
|
Usage:
|
|
68
|
+
npx harness-everything <command> [options]
|
|
69
|
+
harness <command> [options]
|
|
70
|
+
npx.cmd harness-everything <command> [options] # Windows PowerShell
|
|
71
|
+
|
|
72
|
+
Examples:
|
|
73
|
+
npx harness-everything install
|
|
74
|
+
harness install
|
|
75
|
+
harness --version
|
|
76
|
+
|
|
77
|
+
Dev/testing (GitHub source):
|
|
57
78
|
npx github:dyphn1/Harness-everything <command> [options]
|
|
58
|
-
npx.cmd github:dyphn1/Harness-everything <command> [options] # Windows PowerShell
|
|
59
79
|
|
|
60
80
|
Windows PowerShell note:
|
|
61
81
|
Use npx.cmd so restrictive ExecutionPolicy cannot redirect this command to npx.ps1.
|
|
62
82
|
Harness does not require changing ExecutionPolicy.
|
|
63
83
|
|
|
64
84
|
Commands:
|
|
65
|
-
install Install Harness
|
|
85
|
+
install Install Harness Everything hooks & skills into the local repository
|
|
66
86
|
Options:
|
|
67
87
|
--claude Install Claude Code hooks (.claude/settings.json)
|
|
68
88
|
--cursor Install Cursor project rules (.cursorrules)
|
|
@@ -82,12 +102,12 @@ Commands:
|
|
|
82
102
|
behavior silently on failure)
|
|
83
103
|
add/skills/skill Add/install modular skills into the local workspace
|
|
84
104
|
Usage:
|
|
85
|
-
npx
|
|
105
|
+
npx harness-everything add [skill-names...]
|
|
86
106
|
Options:
|
|
87
107
|
-g, --global Install skills to home directory (~/.agents/skills)
|
|
88
108
|
--symlink/--copy See 'install' above
|
|
89
109
|
(Runs interactively if no skill names are specified)
|
|
90
|
-
uninstall Remove Harness
|
|
110
|
+
uninstall Remove Harness Everything hooks, advisory files & skills
|
|
91
111
|
Options:
|
|
92
112
|
--local Remove from local workspace
|
|
93
113
|
-g, --global Also remove from home directory (~/.agents, etc.)
|
|
@@ -122,8 +142,11 @@ Commands:
|
|
|
122
142
|
the explicit stand-in for a hard stop gate on platforms where
|
|
123
143
|
no equivalent hook is active - call it before declaring a task complete.
|
|
124
144
|
|
|
145
|
+
version Show the CLI version
|
|
146
|
+
|
|
125
147
|
Options:
|
|
126
148
|
--help, -h Show this help text
|
|
149
|
+
--version, -v Show the CLI version
|
|
127
150
|
`);
|
|
128
151
|
}
|
|
129
152
|
|
package/ci/ab-test-harness.js
CHANGED
|
@@ -181,8 +181,8 @@ function runHeadless(prompt, cwd, engine) {
|
|
|
181
181
|
const outPath = path.join(os.tmpdir(), `ab-test-${Date.now()}-${Math.random().toString(36).slice(2)}.json`);
|
|
182
182
|
const outputFd = fs.openSync(outPath, 'w');
|
|
183
183
|
try {
|
|
184
|
-
execFileSync('opencode', ['run', '-m', model, prompt, '--format', 'json', '--auto', '--
|
|
185
|
-
{ cwd, stdio: ['ignore', outputFd, 'inherit'], timeout: 10 * 60 * 1000, windowsHide: true });
|
|
184
|
+
execFileSync('opencode', ['run', '-m', model, prompt, '--format', 'json', '--auto', '--standalone'],
|
|
185
|
+
{ cwd, env: { ...process.env, PWD: cwd }, stdio: ['ignore', outputFd, 'inherit'], timeout: 10 * 60 * 1000, windowsHide: true });
|
|
186
186
|
} catch (err) {
|
|
187
187
|
// Timeout or crash — return empty trace
|
|
188
188
|
fs.rmSync(outPath, { force: true });
|
package/ci/action-gate.test.js
CHANGED
|
@@ -600,6 +600,192 @@ try {
|
|
|
600
600
|
const issueStop = actionGate.rejectPendingAtStop(unexecutedIssue, { sessionDir });
|
|
601
601
|
check(issueStop.rejected > 0 && readAudit(sessionDir, unexecutedIssue.tool_use_id).disposition === 'rejected', 'Stop rejects an unexecuted issue deferral');
|
|
602
602
|
|
|
603
|
+
// Codex routine Issue creation (host-deferred)
|
|
604
|
+
const issueCreateTools = [
|
|
605
|
+
'mcp__codex_apps__github__create_issue',
|
|
606
|
+
'mcp__codex_apps__github_create_issue',
|
|
607
|
+
'mcp__github__create_issue',
|
|
608
|
+
];
|
|
609
|
+
const issueCreateInput = {
|
|
610
|
+
repository_full_name: 'dyphn1/Harness-everything',
|
|
611
|
+
title: 'Private fixture issue title',
|
|
612
|
+
body: 'Private fixture issue body',
|
|
613
|
+
};
|
|
614
|
+
for (const tool of issueCreateTools) {
|
|
615
|
+
const candidate = issuePayload(tool, issueCreateInput, 'issue-create-positive-' + issueCreateTools.indexOf(tool));
|
|
616
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
617
|
+
check(result.kind === 'allow' && result.exitCode === 0 && result.stdout === null, 'Issue create exact Codex MCP tool ' + tool + ' defers to host');
|
|
618
|
+
check(result.record && result.record.disposition === 'deferred-to-host' && result.record.matchedRule === 'routine-issue-create', 'Issue create records routine-issue-create host-deferred id');
|
|
619
|
+
const descriptor = result.descriptor || (result.record && result.record.actionDescriptor);
|
|
620
|
+
check(descriptor && descriptor.action === 'mutate' && descriptor.classification === 'gated', 'Issue create remains a gated mutation');
|
|
621
|
+
check(!Object.prototype.hasOwnProperty.call(result, 'permissionDecision'), 'Issue create emits no Harness permission decision');
|
|
622
|
+
check(!JSON.stringify(result.record).includes('Private fixture issue title') && !JSON.stringify(result.record).includes('Private fixture issue body'), 'Issue create audit does not persist raw title or body');
|
|
623
|
+
}
|
|
624
|
+
for (const [label, input] of [
|
|
625
|
+
['repo_full_name selector', { repo_full_name: 'dyphn1/Harness-everything', title: 'Minimal title' }],
|
|
626
|
+
['owner+repo selector', { owner: 'dyphn1', repo: 'Harness-everything', title: 'Owner repo title', body: '' }],
|
|
627
|
+
['full optional fields', {
|
|
628
|
+
repository_full_name: 'dyphn1/Harness-everything',
|
|
629
|
+
title: 'Full fields title',
|
|
630
|
+
body: 'Issue body',
|
|
631
|
+
labels: ['bug', 'p2'],
|
|
632
|
+
assignees: ['dyphn1'],
|
|
633
|
+
milestone: 7,
|
|
634
|
+
}],
|
|
635
|
+
['empty labels and assignees arrays', {
|
|
636
|
+
repository_full_name: 'dyphn1/Harness-everything',
|
|
637
|
+
title: 'Empty arrays title',
|
|
638
|
+
labels: [],
|
|
639
|
+
assignees: [],
|
|
640
|
+
}],
|
|
641
|
+
]) {
|
|
642
|
+
const candidate = issuePayload(issueCreateTools[0], input, 'issue-create-shape-' + label.replace(/[^a-z0-9]+/gi, '-'));
|
|
643
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
644
|
+
check(result.kind === 'allow' && result.exitCode === 0 && result.record && result.record.matchedRule === 'routine-issue-create', 'Issue create accepts ' + label);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
const issueCreateInvalidInputs = [
|
|
648
|
+
['create null input', null],
|
|
649
|
+
['create array input', []],
|
|
650
|
+
['create empty input', {}],
|
|
651
|
+
['create missing repo selector', { title: 'No repo' }],
|
|
652
|
+
['create ownerless repository_full_name', { repository_full_name: 'repo-only', title: 'Ownerless' }],
|
|
653
|
+
['create nested slash repository_full_name', { repository_full_name: 'a/b/c', title: 'Nested' }],
|
|
654
|
+
['create ownerless repo_full_name', { repo_full_name: 'repo-only', title: 'Ownerless' }],
|
|
655
|
+
['create owner without repo', { owner: 'dyphn1', title: 'Missing repo' }],
|
|
656
|
+
['create repo without owner', { repo: 'Harness-everything', title: 'Missing owner' }],
|
|
657
|
+
['create owner with slash', { owner: 'dyphn1/sub', repo: 'Harness-everything', title: 'Bad owner' }],
|
|
658
|
+
['create conflicting selectors full+owner', { repository_full_name: 'dyphn1/Harness-everything', owner: 'dyphn1', repo: 'Harness-everything', title: 'Conflict' }],
|
|
659
|
+
['create conflicting selectors full+repo_full_name', { repository_full_name: 'dyphn1/Harness-everything', repo_full_name: 'dyphn1/Harness-everything', title: 'Conflict' }],
|
|
660
|
+
['create missing title', { repository_full_name: 'dyphn1/Harness-everything', body: 'No title' }],
|
|
661
|
+
['create empty title', { repository_full_name: 'dyphn1/Harness-everything', title: '' }],
|
|
662
|
+
['create whitespace title', { repository_full_name: 'dyphn1/Harness-everything', title: ' ' }],
|
|
663
|
+
['create non-string title', { repository_full_name: 'dyphn1/Harness-everything', title: 123 }],
|
|
664
|
+
['create null body', { ...issueCreateInput, body: null }],
|
|
665
|
+
['create non-string body', { ...issueCreateInput, body: { text: 'obj' } }],
|
|
666
|
+
['create non-array labels', { ...issueCreateInput, labels: 'bug' }],
|
|
667
|
+
['create null labels', { ...issueCreateInput, labels: null }],
|
|
668
|
+
['create empty string label', { ...issueCreateInput, labels: ['bug', ''] }],
|
|
669
|
+
['create non-string label', { ...issueCreateInput, labels: [1] }],
|
|
670
|
+
['create null assignees', { ...issueCreateInput, assignees: null }],
|
|
671
|
+
['create whitespace assignee', { ...issueCreateInput, assignees: [' '] }],
|
|
672
|
+
['create zero milestone', { ...issueCreateInput, milestone: 0 }],
|
|
673
|
+
['create fractional milestone', { ...issueCreateInput, milestone: 1.5 }],
|
|
674
|
+
['create string milestone', { ...issueCreateInput, milestone: '3' }],
|
|
675
|
+
['create null milestone', { ...issueCreateInput, milestone: null }],
|
|
676
|
+
['create extra state key', { ...issueCreateInput, state: 'closed' }],
|
|
677
|
+
['create extra null unknown key', { ...issueCreateInput, unknown: null }],
|
|
678
|
+
['create extra draft key', { ...issueCreateInput, draft: true }],
|
|
679
|
+
['create input action_descriptor key', { ...issueCreateInput, action_descriptor: { action: 'delete' } }],
|
|
680
|
+
];
|
|
681
|
+
for (const [name, input] of issueCreateInvalidInputs) {
|
|
682
|
+
const result = actionGate.evaluatePreToolUse(issuePayload(issueCreateTools[0], input, 'issue-create-invalid-' + name.replace(/[^a-z0-9]+/gi, '-')), {
|
|
683
|
+
host: 'codex', sessionDir, ruleTable: table,
|
|
684
|
+
});
|
|
685
|
+
check(result.kind === 'block' && result.exitCode === 2 && result.record.disposition === 'rejected', name + ' remains gated');
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
for (const tool of [
|
|
689
|
+
'create_issue',
|
|
690
|
+
'mcp__codex_apps__github__create_issues',
|
|
691
|
+
'mcp__codex_apps__github_create_issue_extra',
|
|
692
|
+
'mcp__demo__foo_create_issue',
|
|
693
|
+
'mcp__demo__create_issue_and_delete',
|
|
694
|
+
'mcp__demo__delete_create_issue',
|
|
695
|
+
'local__mcp__codex_apps__github_create_issue',
|
|
696
|
+
'mcp____create_issue',
|
|
697
|
+
]) {
|
|
698
|
+
const result = actionGate.evaluatePreToolUse(issuePayload(tool, issueCreateInput, 'issue-create-spoof-' + tool.replace(/[^a-z0-9]+/gi, '-')), {
|
|
699
|
+
host: 'codex', sessionDir, ruleTable: table,
|
|
700
|
+
});
|
|
701
|
+
check(result.kind === 'block' && result.exitCode === 2, 'near-match or non-MCP ' + tool + ' stays gated');
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
for (const tool of [
|
|
705
|
+
'mcp__demo__create_issue',
|
|
706
|
+
'mcp__get_provider__create_issue',
|
|
707
|
+
'mcp__linear__create_issue',
|
|
708
|
+
]) {
|
|
709
|
+
const validUnknownProvider = issuePayload(tool, issueCreateInput, 'issue-create-unknown-provider-' + tool.replace(/[^a-z0-9]+/gi, '-'));
|
|
710
|
+
const result = actionGate.evaluatePreToolUse(validUnknownProvider, { host: 'codex', sessionDir, ruleTable: table });
|
|
711
|
+
check(result.kind === 'block' && result.exitCode === 2 && result.record.disposition === 'rejected'
|
|
712
|
+
&& result.rule && result.rule.id === 'structured-mutate',
|
|
713
|
+
'unknown provider ' + tool + ' with valid input stays gated');
|
|
714
|
+
check(result.record.actionDescriptor.toolFamily === 'mcp'
|
|
715
|
+
&& result.record.actionDescriptor.action === 'mutate'
|
|
716
|
+
&& result.record.actionDescriptor.classification === 'gated',
|
|
717
|
+
'unknown provider ' + tool + ' stays classified as a gated mcp mutation');
|
|
718
|
+
|
|
719
|
+
for (const action of ['read', 'unknown']) {
|
|
720
|
+
const downgradeAttempt = issuePayload(tool, issueCreateInput, 'issue-create-unknown-downgrade-' + tool.replace(/[^a-z0-9]+/gi, '-') + '-' + action, {
|
|
721
|
+
action_descriptor: { toolFamily: 'shell', action },
|
|
722
|
+
});
|
|
723
|
+
const downgradeResult = actionGate.evaluatePreToolUse(downgradeAttempt, { host: 'codex', sessionDir, ruleTable: table });
|
|
724
|
+
check(downgradeResult.kind === 'block' && downgradeResult.exitCode === 2
|
|
725
|
+
&& downgradeResult.rule && downgradeResult.rule.id === 'structured-mutate'
|
|
726
|
+
&& downgradeResult.record.actionDescriptor.toolFamily === 'mcp'
|
|
727
|
+
&& downgradeResult.record.actionDescriptor.action === 'mutate'
|
|
728
|
+
&& downgradeResult.record.actionDescriptor.classification === 'gated',
|
|
729
|
+
'unknown provider ' + tool + ' cannot be downgraded by explicit ' + action + ' descriptor');
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
const misleadingCreateProvider = issuePayload('mcp__get_provider__create_issue', { ...issueCreateInput, unknown: true }, 'issue-create-get-provider');
|
|
734
|
+
check(actionGate.evaluatePreToolUse(misleadingCreateProvider, { host: 'codex', sessionDir, ruleTable: table }).kind === 'block', 'provider namespace read token cannot downgrade exact create_issue mutation');
|
|
735
|
+
|
|
736
|
+
for (const action of ['delete', 'publish', 'deploy', 'send']) {
|
|
737
|
+
const candidate = issuePayload(issueCreateTools[0], issueCreateInput, 'issue-create-high-risk-' + action, {
|
|
738
|
+
action_descriptor: { toolFamily: 'shell', action },
|
|
739
|
+
});
|
|
740
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
741
|
+
check(result.kind === 'block' && result.exitCode === 2, 'create_issue explicit higher-risk ' + action + ' descriptor stays gated');
|
|
742
|
+
check(result.record.actionDescriptor.toolFamily === 'mcp', 'actual create_issue tool identity overrides a spoofed shell family');
|
|
743
|
+
}
|
|
744
|
+
for (const action of ['read', 'unknown']) {
|
|
745
|
+
const candidate = issuePayload(issueCreateTools[0], issueCreateInput, 'issue-create-downgrade-' + action, {
|
|
746
|
+
action_descriptor: { toolFamily: 'shell', action },
|
|
747
|
+
});
|
|
748
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
749
|
+
check(result.kind === 'allow' && result.record.matchedRule === 'routine-issue-create'
|
|
750
|
+
&& result.record.actionDescriptor.toolFamily === 'mcp' && result.record.actionDescriptor.action === 'mutate',
|
|
751
|
+
'create_issue explicit ' + action + ' descriptor cannot downgrade the exact Issue creation mutation');
|
|
752
|
+
const blocked = issuePayload(issueCreateTools[0], { ...issueCreateInput, unknown: true }, 'issue-create-downgrade-blocked-' + action, {
|
|
753
|
+
action_descriptor: { toolFamily: 'shell', action },
|
|
754
|
+
});
|
|
755
|
+
check(actionGate.evaluatePreToolUse(blocked, { host: 'codex', sessionDir, ruleTable: table }).kind === 'block',
|
|
756
|
+
'create_issue explicit ' + action + ' descriptor cannot bypass invalid-input gate');
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
for (const host of ['claude', 'opencode', 'unknown']) {
|
|
760
|
+
const candidate = issuePayload(issueCreateTools[0], issueCreateInput, 'issue-create-host-' + host);
|
|
761
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host, sessionDir, ruleTable: table });
|
|
762
|
+
check(result.rule && result.rule.id === 'structured-mutate', host + ' create_issue keeps its existing mutation gate');
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
for (let requiredAt = 0; requiredAt < 4; requiredAt++) {
|
|
766
|
+
const optionalHints = Object.assign({}, ...gateEnvelopes({ required: false }));
|
|
767
|
+
const hints = { ...optionalHints, ...gateEnvelopes({ required: true })[requiredAt] };
|
|
768
|
+
const candidate = issuePayload(issueCreateTools[0], issueCreateInput, 'issue-create-required-' + requiredAt, hints);
|
|
769
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
770
|
+
check(result.kind === 'block' && result.exitCode === 2 && result.record.disposition === 'rejected', 'required actionGate envelope ' + requiredAt + ' wins for issue create');
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
const issueCreateAuditOne = issuePayload(issueCreateTools[0], { ...issueCreateInput, title: 'Audit title one', body: 'Audit body one' }, 'issue-create-audit-one');
|
|
774
|
+
const issueCreateAuditTwo = issuePayload(issueCreateTools[1], { ...issueCreateInput, title: 'Audit title two', body: 'Audit body two' }, 'issue-create-audit-two');
|
|
775
|
+
const preCreateOne = actionGate.evaluatePreToolUse(issueCreateAuditOne, { host: 'codex', sessionDir, ruleTable: table });
|
|
776
|
+
const preCreateTwo = actionGate.evaluatePreToolUse(issueCreateAuditTwo, { host: 'codex', sessionDir, ruleTable: table });
|
|
777
|
+
check(preCreateOne.record.commandHash !== preCreateTwo.record.commandHash, 'different create_issue payloads have different audit hashes');
|
|
778
|
+
const postCreateOne = actionGate.finalizeExecution(issueCreateAuditOne, 'success', { sessionDir });
|
|
779
|
+
check(postCreateOne.record.disposition === 'executed' && postCreateOne.record.executionOutcome === 'success' && !postCreateOne.record.executionFailure, 'create_issue PostToolUse success is recorded');
|
|
780
|
+
const postCreateTwo = actionGate.finalizeExecution(issueCreateAuditTwo, 'failure', { sessionDir });
|
|
781
|
+
check(postCreateTwo.record.disposition === 'executed' && postCreateTwo.record.executionOutcome === 'failure' && postCreateTwo.record.executionFailure === true, 'create_issue PostToolUse failure is recorded');
|
|
782
|
+
const alteredCreate = { ...issueCreateAuditOne, tool_input: { ...issueCreateAuditOne.tool_input, title: 'Tampered after PreToolUse' } };
|
|
783
|
+
check(actionGate.finalizeExecution(alteredCreate, 'success', { sessionDir }).record.disposition === 'integrity-violation', 'changed create_issue payload cannot reuse a deferred audit record');
|
|
784
|
+
const unexecutedCreate = issuePayload(issueCreateTools[0], { ...issueCreateInput, title: 'Never executed issue' }, 'issue-create-unexecuted-stop');
|
|
785
|
+
actionGate.evaluatePreToolUse(unexecutedCreate, { host: 'codex', sessionDir, ruleTable: table });
|
|
786
|
+
const createStop = actionGate.rejectPendingAtStop(unexecutedCreate, { sessionDir });
|
|
787
|
+
check(createStop.rejected > 0 && readAudit(sessionDir, unexecutedCreate.tool_use_id).disposition === 'rejected', 'Stop rejects an unexecuted create_issue deferral');
|
|
788
|
+
|
|
603
789
|
|
|
604
790
|
} catch (err) {
|
|
605
791
|
console.error(err.stack || err.message);
|
|
@@ -155,5 +155,25 @@ for (const rel of ['.claude/harness-everything', '.agents/harness-everything', '
|
|
|
155
155
|
check(`no orphaned global ${rel}`, !fs.existsSync(path.join(home, rel)));
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
const pkgVersion = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).version;
|
|
159
|
+
for (const flag of ['--version', '-v', 'version']) {
|
|
160
|
+
const res = run([flag]);
|
|
161
|
+
check(
|
|
162
|
+
`CLI ${flag} exits 0 and outputs package.json#version`,
|
|
163
|
+
res.status === 0 && res.stdout.trim() === pkgVersion,
|
|
164
|
+
`status=${res.status}, stdout=${JSON.stringify(res.stdout)}, stderr=${JSON.stringify(res.stderr)}`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const helpRes = run(['--help']);
|
|
169
|
+
check(
|
|
170
|
+
'CLI --help exits 0 and documents --version, -v, and version',
|
|
171
|
+
helpRes.status === 0 &&
|
|
172
|
+
helpRes.stdout.includes('--version') &&
|
|
173
|
+
helpRes.stdout.includes('-v') &&
|
|
174
|
+
/\bversion\b/.test(helpRes.stdout),
|
|
175
|
+
`status=${helpRes.status}, stdout=${JSON.stringify(helpRes.stdout)}`
|
|
176
|
+
);
|
|
177
|
+
|
|
158
178
|
cleanup();
|
|
159
179
|
console.log('\nInstaller local + global round-trip: PASSED');
|
|
@@ -27,8 +27,10 @@ const POLL_MS = 10;
|
|
|
27
27
|
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
28
28
|
|
|
29
29
|
// OpenCode 2.x events are flat: {id, created, type, durable, data:{sessionID,...}}.
|
|
30
|
+
let eventSequence = 0;
|
|
30
31
|
function v2Event(type, sessionID, data = {}) {
|
|
31
|
-
|
|
32
|
+
const seq = ++eventSequence;
|
|
33
|
+
return { id: `evt-${seq}`, created: Date.now(), type, durable: { aggregateID: sessionID, seq, version: 1 }, data: { sessionID, ...data } };
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
async function createV2Driver(options = {}) {
|
|
@@ -174,6 +174,9 @@ try {
|
|
|
174
174
|
['mcp__codex_apps__github_update_issue', {
|
|
175
175
|
repository_full_name: 'dyphn1/Harness-everything', issue_number: 502, state: 'closed', state_reason: 'completed',
|
|
176
176
|
}, 'routine-issue-completed-close', 'failure'],
|
|
177
|
+
['mcp__codex_apps__github__create_issue', {
|
|
178
|
+
repository_full_name: 'dyphn1/Harness-everything', title: 'private issue title fixture', body: 'private issue body fixture',
|
|
179
|
+
}, 'routine-issue-create', 'success'],
|
|
177
180
|
]) {
|
|
178
181
|
const candidate = {
|
|
179
182
|
...payload('', { toolUseId: `${gateName}-${expectedRule}`, turnId: 'issue-turn' }),
|
|
@@ -194,11 +197,29 @@ try {
|
|
|
194
197
|
assert.strictEqual(pre.record.commandHash, hash);
|
|
195
198
|
assert.strictEqual(pre.record.actionDescriptor.payloadHash, hash);
|
|
196
199
|
assert.ok(!JSON.stringify(pre.record).includes('private issue comment fixture'));
|
|
200
|
+
assert.ok(!JSON.stringify(pre.record).includes('private issue title fixture'));
|
|
201
|
+
assert.ok(!JSON.stringify(pre.record).includes('private issue body fixture'));
|
|
197
202
|
const post = gate.finalizeExecution(candidate, outcome, { sessionDir });
|
|
198
203
|
assert.strictEqual(post.record.disposition, 'executed');
|
|
199
204
|
assert.strictEqual(post.record.executionOutcome, outcome);
|
|
200
205
|
assert.strictEqual(post.record.commandHash, hash);
|
|
201
206
|
}
|
|
207
|
+
for (const unknownTool of ['mcp__demo__create_issue', 'mcp__get_provider__create_issue']) {
|
|
208
|
+
const unknownCandidate = {
|
|
209
|
+
...payload('', { toolUseId: `${gateName}-unknown-${unknownTool}`, turnId: 'issue-turn' }),
|
|
210
|
+
tool_name: unknownTool,
|
|
211
|
+
tool_input: {
|
|
212
|
+
repository_full_name: 'dyphn1/Harness-everything',
|
|
213
|
+
title: 'private unknown provider title',
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
const blocked = gate.evaluatePreToolUse(unknownCandidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
217
|
+
assert.strictEqual(blocked.kind, 'block', `${gateName} ${unknownTool} must stay gated`);
|
|
218
|
+
assert.strictEqual(blocked.exitCode, 2);
|
|
219
|
+
assert.strictEqual(blocked.rule.id, 'structured-mutate');
|
|
220
|
+
assert.strictEqual(blocked.record.actionDescriptor.action, 'mutate');
|
|
221
|
+
assert.strictEqual(blocked.record.actionDescriptor.classification, 'gated');
|
|
222
|
+
}
|
|
202
223
|
}
|
|
203
224
|
const metadataEntry = preAdapter.processPayload({
|
|
204
225
|
...payload('', { toolUseId: 'metadata-entry' }),
|