@zhivex-ai/harness 1.1.0-rc.2 → 1.1.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/README.md +6 -3
  3. package/contracts/public-api.json +7 -0
  4. package/contracts/stable-api-signatures.json +29 -29
  5. package/dist/{approval-diff.d.ts → approvals/approval-diff.d.ts} +1 -1
  6. package/dist/{approval-preview.d.ts → approvals/approval-preview.d.ts} +3 -3
  7. package/dist/cli/arguments.d.ts +105 -0
  8. package/dist/cli/changes.d.ts +2 -0
  9. package/dist/{cli-credentials.d.ts → cli/cli-credentials.d.ts} +14 -2
  10. package/dist/{cli-options.d.ts → cli/cli-options.d.ts} +1 -1
  11. package/dist/{cli-profiles.d.ts → cli/cli-profiles.d.ts} +17 -1
  12. package/dist/{cli-stream.d.ts → cli/cli-stream.d.ts} +3 -3
  13. package/dist/cli/configured-harness.d.ts +12 -0
  14. package/dist/{console-context.d.ts → cli/console/console-context.d.ts} +2 -2
  15. package/dist/cli/console/console-model-catalog.d.ts +8 -0
  16. package/dist/{console-navigation.d.ts → cli/console/console-navigation.d.ts} +4 -2
  17. package/dist/cli/console.d.ts +2 -0
  18. package/dist/cli/doctor.d.ts +52 -0
  19. package/dist/cli/errors.d.ts +8 -0
  20. package/dist/cli/help-text.d.ts +2 -0
  21. package/dist/cli/presentation.d.ts +23 -0
  22. package/dist/cli/resume-metadata.d.ts +12 -0
  23. package/dist/cli/routing.d.ts +6 -0
  24. package/dist/cli/run-commands.d.ts +4 -0
  25. package/dist/{run-document.d.ts → cli/run-document.d.ts} +9 -9
  26. package/dist/cli/run-management.d.ts +2 -0
  27. package/dist/{service-client-cli.d.ts → cli/service-client-cli.d.ts} +1 -1
  28. package/dist/cli/session-management.d.ts +8 -0
  29. package/dist/cli/setup.d.ts +10 -0
  30. package/dist/cli/state.d.ts +2 -0
  31. package/dist/cli/task-input.d.ts +6 -0
  32. package/dist/{terminal-ui.d.ts → cli/terminal/terminal-ui.d.ts} +2 -0
  33. package/dist/cli/terminal/tool-activity.d.ts +19 -0
  34. package/dist/cli.d.ts +32 -184
  35. package/dist/cli.js +11577 -10275
  36. package/dist/client/adapter.d.ts +4 -0
  37. package/dist/client/index.d.ts +15 -0
  38. package/dist/{json-contracts.d.ts → client/json-contracts.d.ts} +6 -0
  39. package/dist/{local-service.d.ts → client/local-service.d.ts} +2 -2
  40. package/dist/{client-contract.d.ts → client/protocol.d.ts} +3 -6
  41. package/dist/{service-events.d.ts → client/service-events.d.ts} +1 -1
  42. package/dist/context/adaptive-compaction.d.ts +16 -0
  43. package/dist/{compaction.d.ts → context/compaction.d.ts} +1 -1
  44. package/dist/{context-engineering.d.ts → context/context-engineering.d.ts} +2 -2
  45. package/dist/{context-metrics.d.ts → context/context-metrics.d.ts} +2 -0
  46. package/dist/{task-memory.d.ts → context/task-memory.d.ts} +2 -2
  47. package/dist/{execution-environment.d.ts → execution/execution-environment.d.ts} +4 -4
  48. package/dist/hostile-repository-demo.js +1276 -447
  49. package/dist/index.d.ts +49 -48
  50. package/dist/index.js +2117 -1096
  51. package/dist/internal/desktop/persistence.d.ts +14 -0
  52. package/dist/internal/desktop/protocol.d.ts +8 -0
  53. package/dist/internal/desktop/providers.d.ts +9 -0
  54. package/dist/internal/desktop/runtime.d.ts +7 -0
  55. package/dist/models/catalog-store.d.ts +15 -0
  56. package/dist/models/catalog.d.ts +74 -0
  57. package/dist/{operations.d.ts → persistence/operations.d.ts} +2 -1
  58. package/dist/{state-backup.d.ts → persistence/state-backup.d.ts} +1 -1
  59. package/dist/{capabilities.d.ts → providers/capabilities.d.ts} +1 -1
  60. package/dist/providers/meta-continuation.d.ts +1 -0
  61. package/dist/{providers.d.ts → providers/providers.d.ts} +4 -0
  62. package/dist/{routing.d.ts → providers/routing.d.ts} +1 -1
  63. package/dist/{config.d.ts → runtime/config.d.ts} +5 -1
  64. package/dist/runtime/delegation-contracts.d.ts +23 -0
  65. package/dist/runtime/error-diagnostics.d.ts +186 -0
  66. package/dist/{harness.d.ts → runtime/harness.d.ts} +13 -135
  67. package/dist/{orchestration.d.ts → runtime/orchestration.d.ts} +2 -0
  68. package/dist/{runtime-diagnostics.d.ts → runtime/runtime-diagnostics.d.ts} +1 -0
  69. package/dist/{runtime-policy.d.ts → runtime/runtime-policy.d.ts} +21 -5
  70. package/dist/{time-to-safe-fix.d.ts → runtime/time-to-safe-fix.d.ts} +149 -0
  71. package/dist/service-cli.js +1473 -583
  72. package/dist/tools/execution.d.ts +47 -0
  73. package/dist/tools/shared.d.ts +67 -0
  74. package/dist/tools/workspace.d.ts +85 -0
  75. package/dist/verify-historical-migrations.js +1451 -622
  76. package/dist/zhx.js +11577 -10275
  77. package/docs/CLI.md +56 -2
  78. package/docs/CONTEXT_ENGINEERING.md +29 -2
  79. package/docs/CREDENTIALS.md +16 -6
  80. package/docs/DURABLE_OPERATIONS.md +6 -0
  81. package/docs/EXTENSIBILITY.md +58 -1
  82. package/docs/FIRST_USE.md +25 -12
  83. package/docs/MODEL_CATALOG.md +48 -0
  84. package/docs/README.md +1 -0
  85. package/docs/THREAT_MODEL.md +1 -1
  86. package/docs/TIME_TO_SAFE_FIX.md +2 -0
  87. package/docs/USAGE.md +3 -3
  88. package/evaluations/representative-assembly-matrix.json +91 -1
  89. package/examples/README.md +3 -3
  90. package/package.json +18 -11
  91. package/dist/console-model-catalog.d.ts +0 -25
  92. /package/dist/{approval-history.d.ts → approvals/approval-history.d.ts} +0 -0
  93. /package/dist/{cli-help.d.ts → cli/cli-help.d.ts} +0 -0
  94. /package/dist/{console-commands.d.ts → cli/console/console-commands.d.ts} +0 -0
  95. /package/dist/{console-input.d.ts → cli/console/console-input.d.ts} +0 -0
  96. /package/dist/{console-presentation.d.ts → cli/console/console-presentation.d.ts} +0 -0
  97. /package/dist/{console-welcome.d.ts → cli/console/console-welcome.d.ts} +0 -0
  98. /package/dist/{terminal-continuation.d.ts → cli/terminal/terminal-continuation.d.ts} +0 -0
  99. /package/dist/{terminal-markdown.d.ts → cli/terminal/terminal-markdown.d.ts} +0 -0
  100. /package/dist/{package-manager.d.ts → execution/package-manager.d.ts} +0 -0
  101. /package/dist/{process-runtime.d.ts → execution/process-runtime.d.ts} +0 -0
  102. /package/dist/{mcp.d.ts → integrations/mcp.d.ts} +0 -0
  103. /package/dist/{persistence-secrets.d.ts → persistence/persistence-secrets.d.ts} +0 -0
  104. /package/dist/{recorded-workspace.d.ts → persistence/recorded-workspace.d.ts} +0 -0
  105. /package/dist/{sessions.d.ts → persistence/sessions.d.ts} +0 -0
  106. /package/dist/{sqlite-access.d.ts → persistence/sqlite-access.d.ts} +0 -0
  107. /package/dist/{sqlite-database.d.ts → persistence/sqlite-database.d.ts} +0 -0
  108. /package/dist/{state-directory.d.ts → persistence/state-directory.d.ts} +0 -0
  109. /package/dist/{errors.d.ts → runtime/errors.d.ts} +0 -0
  110. /package/dist/{model-budget.d.ts → runtime/model-budget.d.ts} +0 -0
  111. /package/dist/{repair-controller.d.ts → runtime/repair-controller.d.ts} +0 -0
  112. /package/dist/{repair-progress.d.ts → runtime/repair-progress.d.ts} +0 -0
  113. /package/dist/{repair-verifier.d.ts → runtime/repair-verifier.d.ts} +0 -0
  114. /package/dist/{run-interruption.d.ts → runtime/run-interruption.d.ts} +0 -0
  115. /package/dist/{runtime-checkpoints.d.ts → runtime/runtime-checkpoints.d.ts} +0 -0
  116. /package/dist/{usage-ledger.d.ts → runtime/usage-ledger.d.ts} +0 -0
  117. /package/dist/{tool-registry.d.ts → tools/tool-registry.d.ts} +0 -0
  118. /package/dist/{bounded-reads.d.ts → workspace/bounded-reads.d.ts} +0 -0
  119. /package/dist/{change-envelope.d.ts → workspace/change-envelope.d.ts} +0 -0
  120. /package/dist/{edit-contracts.d.ts → workspace/edit-contracts.d.ts} +0 -0
  121. /package/dist/{file-security.d.ts → workspace/file-security.d.ts} +0 -0
  122. /package/dist/{replacement-edits.d.ts → workspace/replacement-edits.d.ts} +0 -0
  123. /package/dist/{workspace-mutation-lock.d.ts → workspace/workspace-mutation-lock.d.ts} +0 -0
  124. /package/dist/{workspace.d.ts → workspace/workspace.d.ts} +0 -0
@@ -0,0 +1,4 @@
1
+ import { type ZhivexHarness } from "../runtime/harness.js";
2
+ import { type HarnessClientAdapter, type HarnessClientAdapterOptions } from "./protocol.js";
3
+ /** One trusted host, one workspace/scope, one connection epoch; no multi-writer guarantee. */
4
+ export declare const createHarnessClientAdapter: (harness: ZhivexHarness, options?: HarnessClientAdapterOptions) => Promise<HarnessClientAdapter>;
@@ -0,0 +1,15 @@
1
+ /** Compatibility facade. New internal consumers use the focused modules. */
2
+ export { HARNESS_CLIENT_PROTOCOL_VERSION } from "./protocol.js";
3
+ export { harnessClientCommandSchema } from "./protocol.js";
4
+ export { harnessClientRequestSchema } from "./protocol.js";
5
+ export type { HarnessClientCommand } from "./protocol.js";
6
+ export type { HarnessClientRequest } from "./protocol.js";
7
+ export type { HarnessClientErrorCode } from "./protocol.js";
8
+ export type { HarnessClientSession } from "./protocol.js";
9
+ export type { HarnessClientRun } from "./protocol.js";
10
+ export type { HarnessClientData } from "./protocol.js";
11
+ export type { HarnessClientResponse } from "./protocol.js";
12
+ export type { HarnessClientNegotiation } from "./protocol.js";
13
+ export type { HarnessClientAdapterOptions } from "./protocol.js";
14
+ export type { HarnessClientAdapter } from "./protocol.js";
15
+ export { createHarnessClientAdapter } from "./adapter.js";
@@ -132,6 +132,7 @@ export declare const cliRunResultDocumentSchema: z.ZodObject<{
132
132
  tester: "tester";
133
133
  }>>;
134
134
  childBudget: z.ZodObject<{
135
+ unlimitedTokens: z.ZodOptional<z.ZodBoolean>;
135
136
  maxSteps: z.ZodNumber;
136
137
  maxToolCalls: z.ZodNumber;
137
138
  maxToolErrors: z.ZodNumber;
@@ -257,6 +258,7 @@ export declare const cliDoctorDocumentSchema: z.ZodObject<{
257
258
  maxSteps: z.ZodNumber;
258
259
  timeoutMs: z.ZodNumber;
259
260
  budget: z.ZodObject<{
261
+ unlimitedTokens: z.ZodOptional<z.ZodBoolean>;
260
262
  maxSteps: z.ZodNumber;
261
263
  maxToolCalls: z.ZodNumber;
262
264
  maxToolErrors: z.ZodNumber;
@@ -292,6 +294,7 @@ export declare const cliDoctorDocumentSchema: z.ZodObject<{
292
294
  tester: "tester";
293
295
  }>>;
294
296
  childBudget: z.ZodObject<{
297
+ unlimitedTokens: z.ZodOptional<z.ZodBoolean>;
295
298
  maxSteps: z.ZodNumber;
296
299
  maxToolCalls: z.ZodNumber;
297
300
  maxToolErrors: z.ZodNumber;
@@ -828,6 +831,7 @@ export declare const cliJsonDocumentSchema: z.ZodUnion<readonly [z.ZodObject<{
828
831
  tester: "tester";
829
832
  }>>;
830
833
  childBudget: z.ZodObject<{
834
+ unlimitedTokens: z.ZodOptional<z.ZodBoolean>;
831
835
  maxSteps: z.ZodNumber;
832
836
  maxToolCalls: z.ZodNumber;
833
837
  maxToolErrors: z.ZodNumber;
@@ -950,6 +954,7 @@ export declare const cliJsonDocumentSchema: z.ZodUnion<readonly [z.ZodObject<{
950
954
  maxSteps: z.ZodNumber;
951
955
  timeoutMs: z.ZodNumber;
952
956
  budget: z.ZodObject<{
957
+ unlimitedTokens: z.ZodOptional<z.ZodBoolean>;
953
958
  maxSteps: z.ZodNumber;
954
959
  maxToolCalls: z.ZodNumber;
955
960
  maxToolErrors: z.ZodNumber;
@@ -985,6 +990,7 @@ export declare const cliJsonDocumentSchema: z.ZodUnion<readonly [z.ZodObject<{
985
990
  tester: "tester";
986
991
  }>>;
987
992
  childBudget: z.ZodObject<{
993
+ unlimitedTokens: z.ZodOptional<z.ZodBoolean>;
988
994
  maxSteps: z.ZodNumber;
989
995
  maxToolCalls: z.ZodNumber;
990
996
  maxToolErrors: z.ZodNumber;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
- import { type HarnessClientResponse, type HarnessClientNegotiation } from "./client-contract.js";
2
+ import { type HarnessClientResponse, type HarnessClientNegotiation } from "./protocol.js";
3
3
  import { type HarnessActivityPage } from "./service-events.js";
4
- import type { ZhivexHarness } from "./harness.js";
4
+ import type { ZhivexHarness } from "../runtime/harness.js";
5
5
  export interface HarnessLocalService {
6
6
  readonly socketPath: string;
7
7
  readonly credentialsPath: string;
@@ -1,9 +1,8 @@
1
- import { type ApprovalDecisionView } from "./approval-history.js";
2
- import { type ApprovalFilePreview } from "./approval-preview.js";
1
+ import { type ApprovalDecisionView } from "../approvals/approval-history.js";
2
+ import { type ApprovalFilePreview } from "../approvals/approval-preview.js";
3
3
  import { z } from "zod";
4
4
  import type { AgentStreamEvent } from "@zhivex-ai/agents";
5
- import { type ZhivexHarness } from "./harness.js";
6
- import { type CliSession } from "./sessions.js";
5
+ import { type CliSession } from "../persistence/sessions.js";
7
6
  export declare const HARNESS_CLIENT_PROTOCOL_VERSION: 1;
8
7
  /** Strict command union; configuration, credentials and filesystem paths are host-owned. */
9
8
  export declare const harnessClientCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -204,5 +203,3 @@ export interface HarnessClientAdapter {
204
203
  /** Closes this connection and its session index, not the host-owned harness. */
205
204
  close(): void;
206
205
  }
207
- /** One trusted host, one workspace/scope, one connection epoch; no multi-writer guarantee. */
208
- export declare const createHarnessClientAdapter: (harness: ZhivexHarness, options?: HarnessClientAdapterOptions) => Promise<HarnessClientAdapter>;
@@ -1,5 +1,5 @@
1
1
  import { type AgentStreamEvent } from "@zhivex-ai/agents";
2
- import type { HarnessConfig } from "./config.js";
2
+ import type { HarnessConfig } from "../runtime/config.js";
3
3
  export interface HarnessActivityEvent {
4
4
  schemaVersion: 1;
5
5
  eventId: string;
@@ -0,0 +1,16 @@
1
+ import type { AgentCompactionOptions, ModelMessage, ToolSet } from "@zhivex-ai/core";
2
+ export declare const estimateMessages: (messages: readonly ModelMessage[]) => number;
3
+ /** Boundaries that never separate a call/approval from its correlated result. */
4
+ export declare const safeRetentionCuts: (messages: readonly ModelMessage[]) => number[];
5
+ /** SDK adapter: estimateTokens runs synchronously before keepRecentMessages is
6
+ * read. The consumer regression tests pin this ordering to the installed SDK.
7
+ * The SDK still owns protected groups, pending approvals, records and checkpoints.
8
+ */
9
+ export declare const createAdaptiveCompaction: (config: {
10
+ maxMessages: number;
11
+ maxEstimatedInputTokens: number;
12
+ keepRecentMessages: number;
13
+ }, options?: {
14
+ tools?: ToolSet;
15
+ remainingInputTokens?: () => number;
16
+ }) => AgentCompactionOptions;
@@ -1,5 +1,5 @@
1
1
  import type { ModelMessage } from "@zhivex-ai/core";
2
- export declare const COMPACTION_STRATEGY = "bounded-evidence-v4";
2
+ export declare const COMPACTION_STRATEGY = "bounded-evidence-v5";
3
3
  /** Lossy recollection, never an approval or an authoritative verification receipt. */
4
4
  export declare const summarizeHarnessMessages: (messages: readonly ModelMessage[], maxCharacters?: number) => {
5
5
  summary: string;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { type FileDigest } from "./edit-contracts.js";
3
- import type { Workspace } from "./workspace.js";
2
+ import { type FileDigest } from "../workspace/edit-contracts.js";
3
+ import type { Workspace } from "../workspace/workspace.js";
4
4
  export declare const HARNESS_CONTEXT_CONFIG_SCHEMA_VERSION: 1;
5
5
  export declare const HARNESS_CONTEXT_BUNDLE_SCHEMA_VERSION: 1;
6
6
  export declare const DEFAULT_HARNESS_CONTEXT_MANIFEST: ".zhivex/harness.json";
@@ -1,4 +1,6 @@
1
1
  import type { ModelGenerateInput } from "@zhivex-ai/core";
2
+ /** Shared conservative heuristic; not a tokenizer or billing guarantee. */
3
+ export declare const estimateContextTokens: (counts: ReturnType<typeof measureContext>) => number;
2
4
  /** Provider-neutral serialized character counts, not billed tokens or wire bytes. */
3
5
  export declare const measureContext: (input: ModelGenerateInput) => {
4
6
  systemCharacters: number;
@@ -11,7 +11,7 @@ export declare const captureTaskSources: (metadata: unknown, messages: readonly
11
11
  text: string;
12
12
  }[];
13
13
  export declare const createTaskTools: () => {
14
- read_task: import("@zhivex-ai/core").ToolDefinition<z.ZodObject<{
14
+ read_task: import("@zhivex-ai/agents").ToolDefinition<z.ZodObject<{
15
15
  id: z.ZodOptional<z.ZodString>;
16
16
  offset: z.ZodDefault<z.ZodNumber>;
17
17
  }, z.core.$strip>, {
@@ -22,7 +22,7 @@ export declare const createTaskTools: () => {
22
22
  totalCharacters: number;
23
23
  nextOffset: number | null;
24
24
  }, any>;
25
- repair_plan: import("@zhivex-ai/core").ToolDefinition<z.ZodObject<{
25
+ repair_plan: import("@zhivex-ai/agents").ToolDefinition<z.ZodObject<{
26
26
  hypothesis: z.ZodString;
27
27
  expectedBehavior: z.ZodString;
28
28
  paths: z.ZodArray<z.ZodString>;
@@ -1,7 +1,7 @@
1
1
  import { type AgentExecutionEnvironment, type AgentExecutionEnvironmentAcquireRequest, type AgentExecutionEnvironmentBinding, type AgentExecutionEnvironmentSession, type ToolExecutionContext } from "@zhivex-ai/agents";
2
- import { HARNESS_EXECUTION_POLICY_VERSION, type HarnessConfig, type HarnessExecutionConfig, type HarnessOciRuntime } from "./config.js";
3
- import { type FileDigest, type MutationAuditEntry } from "./edit-contracts.js";
4
- import { Workspace, type CommandResult } from "./workspace.js";
2
+ import { HARNESS_EXECUTION_POLICY_VERSION, type HarnessConfig, type HarnessExecutionConfig, type HarnessOciRuntime } from "../runtime/config.js";
3
+ import { type FileDigest, type MutationAuditEntry } from "../workspace/edit-contracts.js";
4
+ import { Workspace, type CommandResult } from "../workspace/workspace.js";
5
5
  export declare const HARNESS_EXECUTION_ARTIFACT_SCHEMA_VERSION: 1;
6
6
  export declare const HARNESS_OCI_LABEL = "com.zhivex.harness.execution";
7
7
  export declare const HARNESS_OCI_LABEL_VALUE = "v1";
@@ -200,7 +200,7 @@ export declare const executionFingerprintInput: (execution: HarnessConfig["execu
200
200
  policyVersion: typeof HARNESS_EXECUTION_POLICY_VERSION;
201
201
  runtime: HarnessOciRuntime;
202
202
  allowedCommands: readonly string[];
203
- shellMode: import("./config.js").HarnessOciShellMode;
203
+ shellMode: import("../index.js").HarnessOciShellMode;
204
204
  maxProcessRuntimeMs: number;
205
205
  maxProcessOutputBytes: number;
206
206
  maxMemoryMb: number;