@zhivex-ai/harness 1.3.0 → 1.4.0-rc.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/CHANGELOG.md +15 -0
- package/README.md +11 -8
- package/SECURITY.md +1 -1
- package/SUPPORT.md +2 -2
- package/contracts/engine-api.json +50 -0
- package/contracts/public-api.json +162 -0
- package/contracts/stable-api-signatures.json +9 -9
- package/dist/acp-cli.js +36 -10
- package/dist/cli/arguments.d.ts +5 -1
- package/dist/cli/memory.d.ts +2 -0
- package/dist/{cli-entry-1gfg3brj.js → cli-entry-0c8vd42w.js} +725 -388
- package/dist/{cli-entry-bx3vjw7h.js → cli-entry-645q3vwx.js} +29 -3
- package/dist/{cli-etsmtst3.js → cli-mejgq79m.js} +94 -6
- package/dist/cli.js +2 -2
- package/dist/compat/cli-options.d.ts +12 -1
- package/dist/compat/code-support.js +2 -2
- package/dist/context/project-memory-context.d.ts +6 -0
- package/dist/engine/acp.js +6 -6
- package/dist/engine/client.js +5 -5
- package/dist/engine/desktop-state-v1.js +3 -3
- package/dist/engine/index.d.ts +4 -0
- package/dist/engine/index.js +85 -8
- package/dist/engine/mcp-stdio-v1.js +2 -2
- package/dist/engine/service.js +6 -6
- package/dist/hostile-repository-demo.js +1019 -696
- package/dist/{index-hnaxfpb5.js → index-4nf70nq1.js} +53 -6
- package/dist/{index-h0mqx2ed.js → index-aqe7236b.js} +279 -2
- package/dist/{index-42gp2hy8.js → index-ds5e9x3a.js} +1 -1
- package/dist/{index-azmwjp95.js → index-fm6ahk8m.js} +3 -2
- package/dist/{index-8zzhggxv.js → index-g0wfcb65.js} +1 -1
- package/dist/{index-a97bezbz.js → index-hwff3qx5.js} +10 -4
- package/dist/{index-6m08wvab.js → index-ma9a5re7.js} +1 -1
- package/dist/{index-w2sj0wkw.js → index-n86069yc.js} +2 -2
- package/dist/{index-2jrdcj6b.js → index-wq2tax80.js} +15 -1
- package/dist/index.js +8 -8
- package/dist/persistence/project-memory-command.d.ts +11 -0
- package/dist/persistence/project-memory.d.ts +109 -0
- package/dist/persistence/sessions.d.ts +4 -0
- package/dist/runtime/harness.d.ts +4 -0
- package/dist/service-cli.js +6 -6
- package/dist/{service-client-cli-3365rfav.js → service-client-cli-2ye331s3.js} +2 -2
- package/dist/verify-historical-migrations.js +716 -392
- package/dist/zhx.js +2 -2
- package/docs/CLI.md +4 -0
- package/docs/CODE_RELEASE.md +57 -17
- package/docs/CONTEXT_ENGINEERING.md +2 -0
- package/docs/DURABLE_OPERATIONS.md +2 -0
- package/docs/ENGINE_API.md +11 -7
- package/docs/FIRST_USE.md +6 -6
- package/docs/PROJECT_MEMORY.md +157 -0
- package/docs/README.md +2 -0
- package/docs/STABILITY.md +1 -1
- package/docs/WORKSPACE_CHECKPOINTS.md +11 -1
- package/evaluations/representative-assembly-matrix.json +10 -1
- package/examples/README.md +4 -4
- package/package.json +3 -2
|
@@ -35,6 +35,8 @@ var CLI_OPTION_NAMES = [
|
|
|
35
35
|
"--workspace",
|
|
36
36
|
"--state-dir",
|
|
37
37
|
"--mcp-config",
|
|
38
|
+
"--no-memory",
|
|
39
|
+
"--source",
|
|
38
40
|
"--context-config",
|
|
39
41
|
"--no-project-context",
|
|
40
42
|
"--patch",
|
|
@@ -166,6 +168,7 @@ var childBudgets = [
|
|
|
166
168
|
"--subagent-timeout-ms"
|
|
167
169
|
];
|
|
168
170
|
var agent = [
|
|
171
|
+
"--no-memory",
|
|
169
172
|
"--compaction-model",
|
|
170
173
|
"--compaction-provider",
|
|
171
174
|
"--tool-policy",
|
|
@@ -217,7 +220,7 @@ var CLI_COMMAND_OPTION_CONTRACTS = {
|
|
|
217
220
|
providers: contract(["--json"]),
|
|
218
221
|
policy: contract(["--service", ...agent, "--json"]),
|
|
219
222
|
doctor: contract([...provider, ...profile, ...locator, ...project, ...execution, ...budgets, "--allow-check", "--require-capability", "--subagent", "--json"]),
|
|
220
|
-
resume: contract(["--tool-policy", "--service", "--session", ...locator, "--approve", "--deny", "--json", "--jsonl"], [["--approve", "--deny"]]),
|
|
223
|
+
resume: contract(["--no-memory", "--tool-policy", "--service", "--session", ...locator, "--approve", "--deny", "--json", "--jsonl"], [["--approve", "--deny"]]),
|
|
221
224
|
"runs:list": contract([...locator, "--status", "--limit", "--cursor", "--json"]),
|
|
222
225
|
"runs:inspect": contract([...locator, "--json"]),
|
|
223
226
|
"runs:cancel": contract([...locator, "--reason", "--cascade", "--final", "--json"]),
|
|
@@ -241,6 +244,17 @@ var CLI_COMMAND_OPTION_CONTRACTS = {
|
|
|
241
244
|
"checkpoints:recover": contract([...locator, "--json"]),
|
|
242
245
|
"changes:create": contract(["--patch"], ["--patch"]),
|
|
243
246
|
"changes:verify": contract(["--patch", "--preconditions", "--now"], ["--patch"]),
|
|
247
|
+
"memory:remember": contract([...locator, "--json", "--source"]),
|
|
248
|
+
"memory:suggest": contract([...locator, "--json", "--source"]),
|
|
249
|
+
"memory:list": contract([...locator, "--json"]),
|
|
250
|
+
"memory:read": contract([...locator, "--json"]),
|
|
251
|
+
"memory:update": contract([...locator, "--json", "--source"]),
|
|
252
|
+
"memory:forget": contract([...locator, "--json"]),
|
|
253
|
+
"memory:accept": contract([...locator, "--json"]),
|
|
254
|
+
"memory:clear": contract([...locator, "--json"]),
|
|
255
|
+
"memory:enable": contract([...locator, "--json"]),
|
|
256
|
+
"memory:disable": contract([...locator, "--json"]),
|
|
257
|
+
"memory:context": contract([...locator, "--json"]),
|
|
244
258
|
"state:status": contract([...locator, "--json"]),
|
|
245
259
|
"state:export": contract([...locator, "--json"]),
|
|
246
260
|
"state:import": contract([...locator, "--apply", "--json"]),
|
|
@@ -277,6 +291,17 @@ var validateCliCommandOptions = (commandKey, counts) => {
|
|
|
277
291
|
};
|
|
278
292
|
// src/cli/cli-help.ts
|
|
279
293
|
var usage = {
|
|
294
|
+
"memory:remember": 'zhx memory remember "content" [--source "provenance"]',
|
|
295
|
+
"memory:suggest": 'zhx memory suggest "content" [--source "provenance"]',
|
|
296
|
+
"memory:list": "zhx memory list",
|
|
297
|
+
"memory:read": "zhx memory read <id>",
|
|
298
|
+
"memory:update": 'zhx memory update <id> <revision> "content" [--source "provenance"]',
|
|
299
|
+
"memory:forget": "zhx memory forget <id> <revision>",
|
|
300
|
+
"memory:accept": "zhx memory accept <id> <reviewedRevision>",
|
|
301
|
+
"memory:clear": "zhx memory clear",
|
|
302
|
+
"memory:enable": "zhx memory enable",
|
|
303
|
+
"memory:disable": "zhx memory disable",
|
|
304
|
+
"memory:context": 'zhx memory context "query"',
|
|
280
305
|
"checkpoints:storage": "zhx checkpoints storage",
|
|
281
306
|
"checkpoints:prune-review": "zhx checkpoints prune-review <checkpoint:id|restore:id> [...]",
|
|
282
307
|
"checkpoints:prune-apply": "zhx checkpoints prune-apply <reviewedPlanId> <checkpoint:id|restore:id> [...]",
|
|
@@ -402,7 +427,7 @@ Use zhx help all for the full reference and exit codes.`;
|
|
|
402
427
|
// package.json
|
|
403
428
|
var package_default = {
|
|
404
429
|
name: "@zhivex-ai/harness",
|
|
405
|
-
version: "1.
|
|
430
|
+
version: "1.4.0-rc.1",
|
|
406
431
|
description: "Governed, provider-portable runtime for coding agents with durable approvals and isolated repository execution.",
|
|
407
432
|
type: "module",
|
|
408
433
|
license: "MIT",
|
|
@@ -537,7 +562,8 @@ var package_default = {
|
|
|
537
562
|
"docs/adr/0002-isolated-mcp-stdio.md",
|
|
538
563
|
"docs/VERTEX.md",
|
|
539
564
|
"docs/TOOL_POLICY.md",
|
|
540
|
-
"docs/fixtures/mcp-stdio-contract-v1.json"
|
|
565
|
+
"docs/fixtures/mcp-stdio-contract-v1.json",
|
|
566
|
+
"docs/PROJECT_MEMORY.md"
|
|
541
567
|
],
|
|
542
568
|
scripts: {
|
|
543
569
|
"models:check": "bun run scripts/validate-model-catalog.ts",
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
createHarnessResumeMetadata,
|
|
52
52
|
createHarnessRouteModels,
|
|
53
53
|
credentialModel,
|
|
54
|
+
decodeProjectMemory,
|
|
54
55
|
digestChangeEnvelopeArtifact,
|
|
55
56
|
estimateMessages,
|
|
56
57
|
fileDigestSchema,
|
|
@@ -80,12 +81,14 @@ import {
|
|
|
80
81
|
openCliSessionStore,
|
|
81
82
|
openHarnessActivityStore,
|
|
82
83
|
openHarnessPersistence,
|
|
84
|
+
openHarnessProjectMemory,
|
|
83
85
|
openWorkspaceCheckpointStore,
|
|
84
86
|
orchestrationObserver,
|
|
85
87
|
parseCliArgs,
|
|
86
88
|
parseHarnessModelRoute,
|
|
87
89
|
persistedCliOptions,
|
|
88
90
|
printTerminalResult,
|
|
91
|
+
projectMemoryRecordKey,
|
|
89
92
|
publishPendingPolicyDecision,
|
|
90
93
|
readHarnessResumeConfig,
|
|
91
94
|
readHarnessResumeRoutes,
|
|
@@ -120,14 +123,14 @@ import {
|
|
|
120
123
|
withTemporaryHarnessProfiles,
|
|
121
124
|
workspaceCheckpointSchema,
|
|
122
125
|
workspaceRestoreOperationSchema
|
|
123
|
-
} from "./cli-entry-
|
|
126
|
+
} from "./cli-entry-0c8vd42w.js";
|
|
124
127
|
import {
|
|
125
128
|
BUN_ENGINE_RANGE,
|
|
126
129
|
HARNESS_VERSION,
|
|
127
130
|
NODE_ENGINE_RANGE,
|
|
128
131
|
formatCliHelp,
|
|
129
132
|
shortCliHelp
|
|
130
|
-
} from "./cli-entry-
|
|
133
|
+
} from "./cli-entry-645q3vwx.js";
|
|
131
134
|
import {
|
|
132
135
|
DEFAULT_HARNESS_MAX_STEPS,
|
|
133
136
|
DEFAULT_PROVIDER_REGISTRY,
|
|
@@ -315,6 +318,8 @@ Options (automation and advanced configuration):
|
|
|
315
318
|
--state-dir <path> Durable run-state directory
|
|
316
319
|
--mcp-config <path> Declarative governed MCP JSON configuration
|
|
317
320
|
--context-config <path> Project context/rules/skills manifest (default: .zhivex/harness.json)
|
|
321
|
+
--no-memory Disable project-memory retrieval for this invocation
|
|
322
|
+
--source <text> Provenance label for explicit memory input
|
|
318
323
|
--no-project-context Disable AGENTS.md and the project context manifest
|
|
319
324
|
--patch <path> Exact patch/artifact bytes bound to a change envelope
|
|
320
325
|
--preconditions <path> Verification preconditions JSON for changes verify
|
|
@@ -2425,7 +2430,7 @@ ${summarizeApproval(approval)}
|
|
|
2425
2430
|
])],
|
|
2426
2431
|
subagentModels: createHarnessRouteModels(persistedRoutes),
|
|
2427
2432
|
store: persistence.store,
|
|
2428
|
-
|
|
2433
|
+
projectMemory: options.projectMemory ?? true,
|
|
2429
2434
|
onTelemetryEvent: orchestrationObserver(options.json || options.jsonl)
|
|
2430
2435
|
});
|
|
2431
2436
|
const approve = options.approve;
|
|
@@ -3152,6 +3157,82 @@ var manageChanges = async (options) => {
|
|
|
3152
3157
|
process.exitCode = CLI_EXIT_CODES.runtimeError;
|
|
3153
3158
|
};
|
|
3154
3159
|
|
|
3160
|
+
// src/persistence/project-memory-command.ts
|
|
3161
|
+
async function executeHarnessMemoryCommand(options, command, args, source = "Explicit operator input") {
|
|
3162
|
+
const counts = {
|
|
3163
|
+
remember: 1,
|
|
3164
|
+
list: 0,
|
|
3165
|
+
read: 1,
|
|
3166
|
+
update: 3,
|
|
3167
|
+
forget: 2,
|
|
3168
|
+
suggest: 1,
|
|
3169
|
+
accept: 2,
|
|
3170
|
+
clear: 0,
|
|
3171
|
+
enable: 0,
|
|
3172
|
+
disable: 0,
|
|
3173
|
+
context: 1
|
|
3174
|
+
};
|
|
3175
|
+
if (!Object.hasOwn(counts, command) || args.length !== counts[command])
|
|
3176
|
+
throw new HarnessConfigError("Invalid memory command arguments. Use memory --help.");
|
|
3177
|
+
const memory = await openHarnessProjectMemory(options);
|
|
3178
|
+
try {
|
|
3179
|
+
let result;
|
|
3180
|
+
switch (command) {
|
|
3181
|
+
case "list":
|
|
3182
|
+
result = memory.list();
|
|
3183
|
+
break;
|
|
3184
|
+
case "read":
|
|
3185
|
+
result = memory.read(args[0]);
|
|
3186
|
+
break;
|
|
3187
|
+
case "remember":
|
|
3188
|
+
result = memory.remember({ content: args[0], source });
|
|
3189
|
+
break;
|
|
3190
|
+
case "suggest":
|
|
3191
|
+
result = memory.suggest({ content: args[0], source });
|
|
3192
|
+
break;
|
|
3193
|
+
case "update":
|
|
3194
|
+
result = memory.update(args[0], Number(args[1]), { content: args[2], source });
|
|
3195
|
+
break;
|
|
3196
|
+
case "accept":
|
|
3197
|
+
result = memory.accept(args[0], Number(args[1]));
|
|
3198
|
+
break;
|
|
3199
|
+
case "forget":
|
|
3200
|
+
memory.forget(args[0], Number(args[1]));
|
|
3201
|
+
result = { forgotten: args[0] };
|
|
3202
|
+
break;
|
|
3203
|
+
case "clear":
|
|
3204
|
+
result = { cleared: memory.clear() };
|
|
3205
|
+
break;
|
|
3206
|
+
case "enable":
|
|
3207
|
+
case "disable":
|
|
3208
|
+
memory.setEnabled(command === "enable");
|
|
3209
|
+
result = { enabled: command === "enable" };
|
|
3210
|
+
break;
|
|
3211
|
+
case "context":
|
|
3212
|
+
result = memory.retrieve(args[0]);
|
|
3213
|
+
break;
|
|
3214
|
+
}
|
|
3215
|
+
const view = memory.list();
|
|
3216
|
+
return {
|
|
3217
|
+
schemaVersion: 1,
|
|
3218
|
+
kind: "memory-command",
|
|
3219
|
+
command,
|
|
3220
|
+
workspaceKey: view.workspaceKey,
|
|
3221
|
+
scopeKey: view.scopeKey,
|
|
3222
|
+
result
|
|
3223
|
+
};
|
|
3224
|
+
} finally {
|
|
3225
|
+
memory.close();
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
// src/cli/memory.ts
|
|
3230
|
+
async function manageMemory(options) {
|
|
3231
|
+
const document = await executeHarnessMemoryCommand(resolveHarnessConfig(options), options.memoryCommand, options.memoryArguments ?? [], options.memorySource);
|
|
3232
|
+
process.stdout.write(`${JSON.stringify(document, null, 2)}
|
|
3233
|
+
`);
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3155
3236
|
// src/persistence/state-backup-stream.ts
|
|
3156
3237
|
var MAGIC = `ZHIVEX-STATE-SEGMENTS-1
|
|
3157
3238
|
`;
|
|
@@ -3668,6 +3749,7 @@ var readPayload = async (config, recordedWorkspace, accessLease) => {
|
|
|
3668
3749
|
updatedAt: row.updated_at_ms
|
|
3669
3750
|
}));
|
|
3670
3751
|
const memoryKeys = new Set(runs.map((run) => `${binding.scopePrefix}${String(run.state.runId)}`));
|
|
3752
|
+
memoryKeys.add(projectMemoryRecordKey(binding));
|
|
3671
3753
|
const memory = database.query("SELECT memory_key, messages_json, updated_at_ms FROM zhivex_agent_memory ORDER BY memory_key").all().filter((row) => memoryKeys.has(row.memory_key)).map((row) => ({
|
|
3672
3754
|
key: row.memory_key,
|
|
3673
3755
|
messages: z3.array(z3.unknown()).parse(JSON.parse(row.messages_json)),
|
|
@@ -3910,7 +3992,10 @@ var validateBundleBinding = async (config, bundle) => {
|
|
|
3910
3992
|
const memoryKeys = new Set;
|
|
3911
3993
|
for (const entry of bundle.records.memory) {
|
|
3912
3994
|
const memoryRunId = entry.key.startsWith(expected.scopePrefix) ? entry.key.slice(expected.scopePrefix.length) : "";
|
|
3913
|
-
|
|
3995
|
+
const projectRecord = entry.key === projectMemoryRecordKey(expected);
|
|
3996
|
+
if (projectRecord)
|
|
3997
|
+
decodeProjectMemory(entry.messages, expected);
|
|
3998
|
+
if (memoryKeys.has(entry.key) || !projectRecord && !runIds.has(memoryRunId)) {
|
|
3914
3999
|
throw new HarnessStateConflictError(`Memory record ${entry.key} is not bound to an imported run.`);
|
|
3915
4000
|
}
|
|
3916
4001
|
memoryKeys.add(entry.key);
|
|
@@ -4049,7 +4134,7 @@ var importHarnessStateBackup = async (config, bundle, options = {}) => {
|
|
|
4049
4134
|
toolJournal: new Set(availableTables.has("zhivex_agent_runs_tool_journal") ? database.query("SELECT run_key, tool_call_id, entry_json, revision, updated_at_ms FROM zhivex_agent_runs_tool_journal").all().filter((row) => destinationRunKeys.has(row.run_key)).map((row) => `${row.run_key}\x00${row.tool_call_id}`) : []),
|
|
4050
4135
|
idempotency: new Set(availableTables.has("zhivex_agent_runs_idempotency") ? database.query("SELECT idempotency_key, run_id, updated_at_ms FROM zhivex_agent_runs_idempotency").all().filter((row) => destinationRunKeys.has(row.run_id)).map((row) => row.idempotency_key) : []),
|
|
4051
4136
|
parents: new Set(availableTables.has("zhivex_agent_runs_parents") ? database.query("SELECT run_id, parent_run_id, updated_at_ms FROM zhivex_agent_runs_parents").all().filter((row) => destinationRunKeys.has(row.run_id)).map((row) => row.run_id) : []),
|
|
4052
|
-
memory: new Set(availableTables.has("zhivex_agent_memory") ? database.query("SELECT memory_key, messages_json, updated_at_ms FROM zhivex_agent_memory").all().filter((row) => destinationRunRows.some((run) => {
|
|
4137
|
+
memory: new Set(availableTables.has("zhivex_agent_memory") ? database.query("SELECT memory_key, messages_json, updated_at_ms FROM zhivex_agent_memory").all().filter((row) => row.memory_key === projectMemoryRecordKey(bundle.binding) || destinationRunRows.some((run) => {
|
|
4053
4138
|
const state = JSON.parse(run.state_json);
|
|
4054
4139
|
return row.memory_key === `${bundle.binding.scopePrefix}${String(state.runId)}`;
|
|
4055
4140
|
})).map((row) => row.memory_key) : []),
|
|
@@ -4360,7 +4445,7 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
4360
4445
|
parsedOptions = { ...parsedOptions, prompt: await readStdinTask() };
|
|
4361
4446
|
}
|
|
4362
4447
|
if (parsedOptions.serviceFile) {
|
|
4363
|
-
const { runServiceCli } = await import("./service-client-cli-
|
|
4448
|
+
const { runServiceCli } = await import("./service-client-cli-2ye331s3.js");
|
|
4364
4449
|
await runServiceCli(parsedOptions, annotateCliStreamError);
|
|
4365
4450
|
return;
|
|
4366
4451
|
}
|
|
@@ -4417,6 +4502,9 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
4417
4502
|
case "changes":
|
|
4418
4503
|
await manageChanges(options);
|
|
4419
4504
|
return;
|
|
4505
|
+
case "memory":
|
|
4506
|
+
await manageMemory(options);
|
|
4507
|
+
return;
|
|
4420
4508
|
case "state":
|
|
4421
4509
|
await manageState(options);
|
|
4422
4510
|
return;
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
HARNESS_VERSION,
|
|
4
4
|
shortCliHelp
|
|
5
|
-
} from "./cli-entry-
|
|
5
|
+
} from "./cli-entry-645q3vwx.js";
|
|
6
6
|
import {
|
|
7
7
|
__require
|
|
8
8
|
} from "./cli-entry-1bx83sw4.js";
|
|
@@ -16,6 +16,6 @@ if (argv.length === 1 && ["--version", "-v", "version"].includes(argv[0])) {
|
|
|
16
16
|
process.stdout.write(`${shortCliHelp(HARNESS_VERSION)}
|
|
17
17
|
`);
|
|
18
18
|
} else {
|
|
19
|
-
const { runCli } = await import("./cli-
|
|
19
|
+
const { runCli } = await import("./cli-mejgq79m.js");
|
|
20
20
|
await runCli(argv);
|
|
21
21
|
}
|
|
@@ -8,7 +8,7 @@ export interface CliCommandOptionContract {
|
|
|
8
8
|
repeatable: readonly string[];
|
|
9
9
|
conflicts: Readonly<Record<string, readonly string[]>>;
|
|
10
10
|
}
|
|
11
|
-
export declare const CLI_OPTION_NAMES: readonly ["--compaction-model", "--compaction-provider", "--provider", "--model", "--reasoning", "--profile", "--route", "--workspace", "--state-dir", "--mcp-config", "--context-config", "--no-project-context", "--patch", "--preconditions", "--now", "--require-verified-delivery", "--execution", "--oci-runtime", "--oci-image", "--oci-allow-command", "--oci-shell", "--oci-max-process-runtime-ms", "--oci-max-process-output-bytes", "--oci-max-memory-mb", "--oci-max-pids", "--oci-max-cpus", "--oci-max-workspace-bytes", "--oci-max-file-write-bytes", "--oci-tmpfs-mb", "--store", "--tenant", "--user", "--namespace", "--idempotency-key", "--token-budget", "--context-tokens", "--no-token-budget", "--max-steps", "--timeout-ms", "--max-tool-calls", "--max-tool-errors", "--max-input-tokens", "--max-output-tokens", "--max-total-tokens", "--subagent-max-steps", "--subagent-max-tool-calls", "--subagent-max-tool-errors", "--subagent-max-input-tokens", "--subagent-max-output-tokens", "--subagent-max-total-tokens", "--subagent-timeout-ms", "--max-parallel-reviews", "--max-cost-usd", "--input-cost-per-million", "--output-cost-per-million", "--allow-check", "--require-capability", "--subagent", "--reviewer", "--approval-mode", "--yes", "--approve", "--deny", "--json", "--jsonl", "--session", "--continue", "--update", "--status", "--limit", "--cursor", "--before", "--reason", "--cascade", "--final", "--service", "--apply", "--help", "--version", "--search", "--tool-policy", "--pricing-file", "--usage-limit-usd"];
|
|
11
|
+
export declare const CLI_OPTION_NAMES: readonly ["--compaction-model", "--compaction-provider", "--provider", "--model", "--reasoning", "--profile", "--route", "--workspace", "--state-dir", "--mcp-config", "--no-memory", "--source", "--context-config", "--no-project-context", "--patch", "--preconditions", "--now", "--require-verified-delivery", "--execution", "--oci-runtime", "--oci-image", "--oci-allow-command", "--oci-shell", "--oci-max-process-runtime-ms", "--oci-max-process-output-bytes", "--oci-max-memory-mb", "--oci-max-pids", "--oci-max-cpus", "--oci-max-workspace-bytes", "--oci-max-file-write-bytes", "--oci-tmpfs-mb", "--store", "--tenant", "--user", "--namespace", "--idempotency-key", "--token-budget", "--context-tokens", "--no-token-budget", "--max-steps", "--timeout-ms", "--max-tool-calls", "--max-tool-errors", "--max-input-tokens", "--max-output-tokens", "--max-total-tokens", "--subagent-max-steps", "--subagent-max-tool-calls", "--subagent-max-tool-errors", "--subagent-max-input-tokens", "--subagent-max-output-tokens", "--subagent-max-total-tokens", "--subagent-timeout-ms", "--max-parallel-reviews", "--max-cost-usd", "--input-cost-per-million", "--output-cost-per-million", "--allow-check", "--require-capability", "--subagent", "--reviewer", "--approval-mode", "--yes", "--approve", "--deny", "--json", "--jsonl", "--session", "--continue", "--update", "--status", "--limit", "--cursor", "--before", "--reason", "--cascade", "--final", "--service", "--apply", "--help", "--version", "--search", "--tool-policy", "--pricing-file", "--usage-limit-usd"];
|
|
12
12
|
export type CliOptionName = (typeof CLI_OPTION_NAMES)[number];
|
|
13
13
|
export declare const CLI_OPTION_DEFINITIONS: Readonly<Record<CliOptionName, CliOptionDefinition>>;
|
|
14
14
|
export declare const CLI_COMMAND_OPTION_CONTRACTS: {
|
|
@@ -43,6 +43,17 @@ export declare const CLI_COMMAND_OPTION_CONTRACTS: {
|
|
|
43
43
|
readonly "checkpoints:recover": CliCommandOptionContract;
|
|
44
44
|
readonly "changes:create": CliCommandOptionContract;
|
|
45
45
|
readonly "changes:verify": CliCommandOptionContract;
|
|
46
|
+
readonly "memory:remember": CliCommandOptionContract;
|
|
47
|
+
readonly "memory:suggest": CliCommandOptionContract;
|
|
48
|
+
readonly "memory:list": CliCommandOptionContract;
|
|
49
|
+
readonly "memory:read": CliCommandOptionContract;
|
|
50
|
+
readonly "memory:update": CliCommandOptionContract;
|
|
51
|
+
readonly "memory:forget": CliCommandOptionContract;
|
|
52
|
+
readonly "memory:accept": CliCommandOptionContract;
|
|
53
|
+
readonly "memory:clear": CliCommandOptionContract;
|
|
54
|
+
readonly "memory:enable": CliCommandOptionContract;
|
|
55
|
+
readonly "memory:disable": CliCommandOptionContract;
|
|
56
|
+
readonly "memory:context": CliCommandOptionContract;
|
|
46
57
|
readonly "state:status": CliCommandOptionContract;
|
|
47
58
|
readonly "state:export": CliCommandOptionContract;
|
|
48
59
|
readonly "state:import": CliCommandOptionContract;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../index-wg1sd3at.js";
|
|
4
4
|
import {
|
|
5
5
|
estimateMessages
|
|
6
|
-
} from "../index-
|
|
6
|
+
} from "../index-g0wfcb65.js";
|
|
7
7
|
import {
|
|
8
8
|
TASK_SOURCE_KEY,
|
|
9
9
|
USAGE_LEDGER_KEY,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
inspectUsageLedger,
|
|
14
14
|
taskSources,
|
|
15
15
|
usagePricingSchema
|
|
16
|
-
} from "../index-
|
|
16
|
+
} from "../index-ds5e9x3a.js";
|
|
17
17
|
import {
|
|
18
18
|
FileChangedWhileReadingError,
|
|
19
19
|
FileSizeLimitError,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LanguageModelMiddleware } from "@zhivex-ai/core";
|
|
2
|
+
import type { HarnessProjectMemory } from "../persistence/project-memory.js";
|
|
3
|
+
/** Per-request projection; memory text never enters system instructions or durable
|
|
4
|
+
* run messages. Reload for every request so edits, forgetting and opt-out apply
|
|
5
|
+
* even to a resumed run. Existing conversation history has its own retention. */
|
|
6
|
+
export declare function createProjectMemoryMiddleware(memory: HarnessProjectMemory): LanguageModelMiddleware;
|
package/dist/engine/acp.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
discardMcpWorkspaceSnapshot,
|
|
3
3
|
launchDockerMcpGroup,
|
|
4
4
|
prepareMcpWorkspaceSnapshot
|
|
5
|
-
} from "../index-
|
|
5
|
+
} from "../index-ma9a5re7.js";
|
|
6
6
|
import {
|
|
7
7
|
createAcpConnection,
|
|
8
8
|
issueAcpMcpSessionProvider,
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
createHarness,
|
|
13
13
|
createHarnessClientAdapter
|
|
14
|
-
} from "../index-
|
|
15
|
-
import"../index-
|
|
16
|
-
import"../index-
|
|
17
|
-
import"../index-
|
|
18
|
-
import"../index-
|
|
14
|
+
} from "../index-4nf70nq1.js";
|
|
15
|
+
import"../index-aqe7236b.js";
|
|
16
|
+
import"../index-g0wfcb65.js";
|
|
17
|
+
import"../index-ds5e9x3a.js";
|
|
18
|
+
import"../index-fm6ahk8m.js";
|
|
19
19
|
import"../index-z0qxmkm2.js";
|
|
20
20
|
import"../index-yb239ghk.js";
|
|
21
21
|
import"../index-gq9xagx2.js";
|
package/dist/engine/client.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createHarnessClientAdapter,
|
|
3
3
|
runResultDocument,
|
|
4
4
|
terminalContinuationMessages
|
|
5
|
-
} from "../index-
|
|
6
|
-
import"../index-
|
|
7
|
-
import"../index-
|
|
8
|
-
import"../index-
|
|
9
|
-
import"../index-
|
|
5
|
+
} from "../index-4nf70nq1.js";
|
|
6
|
+
import"../index-aqe7236b.js";
|
|
7
|
+
import"../index-g0wfcb65.js";
|
|
8
|
+
import"../index-ds5e9x3a.js";
|
|
9
|
+
import"../index-fm6ahk8m.js";
|
|
10
10
|
import"../index-z0qxmkm2.js";
|
|
11
11
|
import"../index-yb239ghk.js";
|
|
12
12
|
import"../index-gq9xagx2.js";
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
createArchivedHarnessStateBackup,
|
|
3
3
|
createHarnessStateBackup,
|
|
4
4
|
validateRecordedWorkspace
|
|
5
|
-
} from "../index-
|
|
5
|
+
} from "../index-hwff3qx5.js";
|
|
6
6
|
import {
|
|
7
7
|
HARNESS_SQLITE_FILE
|
|
8
|
-
} from "../index-
|
|
8
|
+
} from "../index-aqe7236b.js";
|
|
9
9
|
import {
|
|
10
10
|
validateStateDirectory
|
|
11
|
-
} from "../index-
|
|
11
|
+
} from "../index-ds5e9x3a.js";
|
|
12
12
|
import"../index-z0qxmkm2.js";
|
|
13
13
|
import {
|
|
14
14
|
SqliteDatabase,
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/** Terminal-free host engine surface. Named aliases retain their historical stability tiers. */
|
|
2
|
+
/** Experimental operator-owned project memory. See docs/PROJECT_MEMORY.md. */
|
|
3
|
+
export { HARNESS_PROJECT_MEMORY_SCHEMA_VERSION, HARNESS_PROJECT_MEMORY_LIMITS, openHarnessProjectMemory } from "../persistence/project-memory.js";
|
|
4
|
+
export type { HarnessProjectMemory, HarnessProjectMemoryEntry, HarnessProjectMemoryInput, HarnessProjectMemoryOptions, HarnessProjectMemoryView } from "../persistence/project-memory.js";
|
|
5
|
+
export { HARNESS_MEMORY_COMMANDS, executeHarnessMemoryCommand } from "../persistence/project-memory-command.js";
|
|
2
6
|
export { DEFAULT_ALLOWED_CHECKS, DEFAULT_OCI_EXECUTION, DEFAULT_SUBAGENT_BUDGET, HARNESS_CONFIG_MIGRATABLE_SCHEMA_VERSIONS, HARNESS_CONFIG_SCHEMA_VERSION, HARNESS_EXECUTION_BACKENDS, HARNESS_EXECUTION_POLICY_VERSION, HARNESS_OCI_RUNTIMES, HARNESS_OCI_SHELL_MODES, HARNESS_REQUIRED_CAPABILITIES, HARNESS_SUBAGENT_PROFILES, BUILTIN_PROVIDER_REGISTRATIONS, DEFAULT_PROVIDER_REGISTRY, PROVIDERS, PROVIDER_DESCRIPTORS, createProviderModel, createProviderRegistry, defaultHarnessNamespace, migrateHarnessConfigInput, parseProvider, providerAvailability, providerDescriptor, resolveHarnessConfig } from "../runtime/config.js";
|
|
3
7
|
export type { BuiltInHarnessProvider, HarnessBudget, HarnessCompactionConfig, HarnessContextConfig, HarnessConfig, HarnessConfigInput, HarnessConfigMigrationResult, HarnessCostBudget, HarnessExecutionBackend, HarnessExecutionConfig, HarnessOciRuntime, HarnessOciShellMode, HarnessOrchestrationConfig, HarnessProvider, HarnessProviderRegistry, HarnessRequiredCapability, HarnessStoreBackend, HarnessSubagentProfile, ProviderCapability, ProviderAvailability, ProviderCredentials, ProviderDescriptor, ProviderDiagnosticsDescriptor, ProviderEnumDiagnostic, ProviderModelFactory, ProviderModelFactoryContext, ProviderPresenceDiagnostic, ProviderRegistration, ProviderSupport } from "../runtime/config.js";
|
|
4
8
|
export { createHarnessRouteModels, parseHarnessModelRoute, resolveHarnessModelRoutes, serializeHarnessModelRoutes } from "../providers/routing.js";
|
package/dist/engine/index.js
CHANGED
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
inspectHarnessState,
|
|
74
74
|
readHarnessStateBackup,
|
|
75
75
|
stateBackupBundleSchema
|
|
76
|
-
} from "../index-
|
|
76
|
+
} from "../index-hwff3qx5.js";
|
|
77
77
|
import {
|
|
78
78
|
CLI_COMMAND_OPTION_CONTRACTS,
|
|
79
79
|
CLI_OPTION_DEFINITIONS,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
resolveHarnessModelRoutes,
|
|
84
84
|
serializeHarnessModelRoutes,
|
|
85
85
|
validateCliCommandOptions
|
|
86
|
-
} from "../index-
|
|
86
|
+
} from "../index-wq2tax80.js";
|
|
87
87
|
import {
|
|
88
88
|
harnessLocalCredentialsSchema,
|
|
89
89
|
openHarnessActivityStore,
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
recoverHarnessLocalService,
|
|
92
92
|
requestHarnessLocalService,
|
|
93
93
|
startHarnessLocalService
|
|
94
|
-
} from "../index-
|
|
94
|
+
} from "../index-n86069yc.js";
|
|
95
95
|
import {
|
|
96
96
|
createAcpConnection,
|
|
97
97
|
serveAcpStdio
|
|
@@ -144,9 +144,11 @@ import {
|
|
|
144
144
|
runHarness,
|
|
145
145
|
runHarnessReviewGroup,
|
|
146
146
|
selectHarnessModel
|
|
147
|
-
} from "../index-
|
|
147
|
+
} from "../index-4nf70nq1.js";
|
|
148
148
|
import {
|
|
149
149
|
HARNESS_OPERATIONS_SCHEMA_VERSION,
|
|
150
|
+
HARNESS_PROJECT_MEMORY_LIMITS,
|
|
151
|
+
HARNESS_PROJECT_MEMORY_SCHEMA_VERSION,
|
|
150
152
|
HARNESS_SQLITE_FILE,
|
|
151
153
|
TERMINAL_RUN_STATUSES,
|
|
152
154
|
cancelHarnessRun,
|
|
@@ -155,9 +157,10 @@ import {
|
|
|
155
157
|
listHarnessRuns,
|
|
156
158
|
migrateLegacyFileRuns,
|
|
157
159
|
openHarnessPersistence,
|
|
160
|
+
openHarnessProjectMemory,
|
|
158
161
|
openWorkspaceCheckpointStore
|
|
159
|
-
} from "../index-
|
|
160
|
-
import"../index-
|
|
162
|
+
} from "../index-aqe7236b.js";
|
|
163
|
+
import"../index-g0wfcb65.js";
|
|
161
164
|
import {
|
|
162
165
|
HARNESS_SESSION_INDEX_FILE,
|
|
163
166
|
HARNESS_SESSION_SCHEMA_VERSION,
|
|
@@ -173,7 +176,7 @@ import {
|
|
|
173
176
|
readTaskAcceptanceLedger,
|
|
174
177
|
taskAcceptanceContractSchema,
|
|
175
178
|
validateStateDirectory
|
|
176
|
-
} from "../index-
|
|
179
|
+
} from "../index-ds5e9x3a.js";
|
|
177
180
|
import {
|
|
178
181
|
BUN_ENGINE_RANGE,
|
|
179
182
|
HARNESS_MCP_CONFIG_SCHEMA_VERSION,
|
|
@@ -184,7 +187,7 @@ import {
|
|
|
184
187
|
createHttpMcpClient,
|
|
185
188
|
loadHarnessMcpConfiguration,
|
|
186
189
|
normalizeHarnessMcpConfiguration
|
|
187
|
-
} from "../index-
|
|
190
|
+
} from "../index-fm6ahk8m.js";
|
|
188
191
|
import {
|
|
189
192
|
CliOciRuntimeAdapter,
|
|
190
193
|
HARNESS_EXECUTION_ARTIFACT_SCHEMA_VERSION,
|
|
@@ -271,6 +274,75 @@ import {
|
|
|
271
274
|
streamResultDocument
|
|
272
275
|
} from "../index-qfpz5y2v.js";
|
|
273
276
|
import"../index-1bx83sw4.js";
|
|
277
|
+
// src/persistence/project-memory-command.ts
|
|
278
|
+
var HARNESS_MEMORY_COMMANDS = ["remember", "list", "read", "update", "forget", "suggest", "accept", "clear", "enable", "disable", "context"];
|
|
279
|
+
async function executeHarnessMemoryCommand(options, command, args, source = "Explicit operator input") {
|
|
280
|
+
const counts = {
|
|
281
|
+
remember: 1,
|
|
282
|
+
list: 0,
|
|
283
|
+
read: 1,
|
|
284
|
+
update: 3,
|
|
285
|
+
forget: 2,
|
|
286
|
+
suggest: 1,
|
|
287
|
+
accept: 2,
|
|
288
|
+
clear: 0,
|
|
289
|
+
enable: 0,
|
|
290
|
+
disable: 0,
|
|
291
|
+
context: 1
|
|
292
|
+
};
|
|
293
|
+
if (!Object.hasOwn(counts, command) || args.length !== counts[command])
|
|
294
|
+
throw new HarnessConfigError("Invalid memory command arguments. Use memory --help.");
|
|
295
|
+
const memory = await openHarnessProjectMemory(options);
|
|
296
|
+
try {
|
|
297
|
+
let result;
|
|
298
|
+
switch (command) {
|
|
299
|
+
case "list":
|
|
300
|
+
result = memory.list();
|
|
301
|
+
break;
|
|
302
|
+
case "read":
|
|
303
|
+
result = memory.read(args[0]);
|
|
304
|
+
break;
|
|
305
|
+
case "remember":
|
|
306
|
+
result = memory.remember({ content: args[0], source });
|
|
307
|
+
break;
|
|
308
|
+
case "suggest":
|
|
309
|
+
result = memory.suggest({ content: args[0], source });
|
|
310
|
+
break;
|
|
311
|
+
case "update":
|
|
312
|
+
result = memory.update(args[0], Number(args[1]), { content: args[2], source });
|
|
313
|
+
break;
|
|
314
|
+
case "accept":
|
|
315
|
+
result = memory.accept(args[0], Number(args[1]));
|
|
316
|
+
break;
|
|
317
|
+
case "forget":
|
|
318
|
+
memory.forget(args[0], Number(args[1]));
|
|
319
|
+
result = { forgotten: args[0] };
|
|
320
|
+
break;
|
|
321
|
+
case "clear":
|
|
322
|
+
result = { cleared: memory.clear() };
|
|
323
|
+
break;
|
|
324
|
+
case "enable":
|
|
325
|
+
case "disable":
|
|
326
|
+
memory.setEnabled(command === "enable");
|
|
327
|
+
result = { enabled: command === "enable" };
|
|
328
|
+
break;
|
|
329
|
+
case "context":
|
|
330
|
+
result = memory.retrieve(args[0]);
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
const view = memory.list();
|
|
334
|
+
return {
|
|
335
|
+
schemaVersion: 1,
|
|
336
|
+
kind: "memory-command",
|
|
337
|
+
command,
|
|
338
|
+
workspaceKey: view.workspaceKey,
|
|
339
|
+
scopeKey: view.scopeKey,
|
|
340
|
+
result
|
|
341
|
+
};
|
|
342
|
+
} finally {
|
|
343
|
+
memory.close();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
274
346
|
// src/persistence/governance-report.ts
|
|
275
347
|
import { createHash as createHash2 } from "node:crypto";
|
|
276
348
|
import { z as z2 } from "zod";
|
|
@@ -770,11 +842,14 @@ export {
|
|
|
770
842
|
HARNESS_LIFECYCLE_EVENTS,
|
|
771
843
|
HARNESS_MCP_CONFIG_SCHEMA_VERSION,
|
|
772
844
|
HARNESS_MCP_PERMISSIONS,
|
|
845
|
+
HARNESS_MEMORY_COMMANDS,
|
|
773
846
|
HARNESS_OCI_LABEL,
|
|
774
847
|
HARNESS_OCI_LABEL_VALUE,
|
|
775
848
|
HARNESS_OCI_RUNTIMES,
|
|
776
849
|
HARNESS_OCI_SHELL_MODES,
|
|
777
850
|
HARNESS_OPERATIONS_SCHEMA_VERSION,
|
|
851
|
+
HARNESS_PROJECT_MEMORY_LIMITS,
|
|
852
|
+
HARNESS_PROJECT_MEMORY_SCHEMA_VERSION,
|
|
778
853
|
HARNESS_REQUIRED_CAPABILITIES,
|
|
779
854
|
HARNESS_SESSION_INDEX_FILE,
|
|
780
855
|
HARNESS_SESSION_SCHEMA_VERSION,
|
|
@@ -895,6 +970,7 @@ export {
|
|
|
895
970
|
editProposalInputSchema,
|
|
896
971
|
editProposalSchema,
|
|
897
972
|
estimateMessageTokens,
|
|
973
|
+
executeHarnessMemoryCommand,
|
|
898
974
|
executionFingerprintInput,
|
|
899
975
|
exportHarnessGovernanceReport,
|
|
900
976
|
exportHarnessStateBackup,
|
|
@@ -934,6 +1010,7 @@ export {
|
|
|
934
1010
|
openCliSessionStore,
|
|
935
1011
|
openHarnessActivityStore,
|
|
936
1012
|
openHarnessPersistence,
|
|
1013
|
+
openHarnessProjectMemory,
|
|
937
1014
|
openSessionStore,
|
|
938
1015
|
openWorkspaceCheckpointStore,
|
|
939
1016
|
parseCliJsonDocument,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
mcpResourcePlanSchema,
|
|
9
9
|
prepareMcpWorkspaceSnapshot,
|
|
10
10
|
recoverDockerMcpResources
|
|
11
|
-
} from "../index-
|
|
12
|
-
import"../index-
|
|
11
|
+
} from "../index-ma9a5re7.js";
|
|
12
|
+
import"../index-fm6ahk8m.js";
|
|
13
13
|
import"../index-z0qxmkm2.js";
|
|
14
14
|
import"../index-yb239ghk.js";
|
|
15
15
|
import"../index-gq9xagx2.js";
|
package/dist/engine/service.js
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
recoverHarnessLocalService,
|
|
6
6
|
requestHarnessLocalService,
|
|
7
7
|
startHarnessLocalService
|
|
8
|
-
} from "../index-
|
|
9
|
-
import"../index-
|
|
10
|
-
import"../index-
|
|
11
|
-
import"../index-
|
|
12
|
-
import"../index-
|
|
13
|
-
import"../index-
|
|
8
|
+
} from "../index-n86069yc.js";
|
|
9
|
+
import"../index-4nf70nq1.js";
|
|
10
|
+
import"../index-aqe7236b.js";
|
|
11
|
+
import"../index-g0wfcb65.js";
|
|
12
|
+
import"../index-ds5e9x3a.js";
|
|
13
|
+
import"../index-fm6ahk8m.js";
|
|
14
14
|
import"../index-z0qxmkm2.js";
|
|
15
15
|
import"../index-yb239ghk.js";
|
|
16
16
|
import"../index-gq9xagx2.js";
|