@zhivex-ai/harness 1.1.1 → 1.2.0-rc.13

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 (119) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +14 -7
  3. package/SECURITY.md +1 -1
  4. package/SUPPORT.md +3 -3
  5. package/benchmarks/README.md +17 -0
  6. package/contracts/public-api.json +95 -5
  7. package/contracts/stable-api-signatures.json +38 -38
  8. package/dist/acp-cli.d.ts +2 -0
  9. package/dist/acp-cli.js +15938 -0
  10. package/dist/cli/arguments.d.ts +7 -1
  11. package/dist/cli/cli-credentials.d.ts +6 -1
  12. package/dist/cli/cli-options.d.ts +1 -1
  13. package/dist/cli/cli-profiles.d.ts +15 -0
  14. package/dist/cli/cli-stream.d.ts +3 -3
  15. package/dist/cli/console/console-budget.d.ts +9 -0
  16. package/dist/cli/console/console-commands.d.ts +3 -3
  17. package/dist/cli/console/console-compaction.d.ts +18 -0
  18. package/dist/cli/console/console-input.d.ts +22 -3
  19. package/dist/cli/console/console-navigation.d.ts +3 -0
  20. package/dist/cli/console/console-presentation.d.ts +9 -2
  21. package/dist/cli/console/console-progress.d.ts +6 -0
  22. package/dist/cli/console/console-reasoning.d.ts +3 -0
  23. package/dist/cli/doctor.d.ts +2 -2
  24. package/dist/cli/presentation.d.ts +8 -1
  25. package/dist/cli/qwen-connection.d.ts +23 -0
  26. package/dist/cli/run-document.d.ts +4 -4
  27. package/dist/cli/terminal/activity-history.d.ts +15 -0
  28. package/dist/cli/terminal/session-grants.d.ts +4 -0
  29. package/dist/cli/terminal/terminal-markdown.d.ts +7 -4
  30. package/dist/cli/terminal/terminal-table.d.ts +6 -0
  31. package/dist/cli/terminal/terminal-ui.d.ts +3 -0
  32. package/dist/cli/terminal/tool-activity.d.ts +21 -10
  33. package/dist/cli/tool-execution.d.ts +1 -0
  34. package/dist/cli-3jmy4h5h.js +5798 -0
  35. package/dist/cli-entry-1bx83sw4.js +4 -0
  36. package/dist/cli-entry-427869g9.js +2009 -0
  37. package/dist/cli-entry-64pdp3k5.js +17 -0
  38. package/dist/cli-entry-b1mfvmxe.js +376 -0
  39. package/dist/cli-entry-c2f58zj2.js +13602 -0
  40. package/dist/cli-entry.d.ts +2 -0
  41. package/dist/cli.d.ts +1 -0
  42. package/dist/cli.js +15 -19168
  43. package/dist/client/acp-stdio.d.ts +9 -0
  44. package/dist/client/acp.d.ts +18 -0
  45. package/dist/client/index.d.ts +2 -0
  46. package/dist/client/json-contracts.d.ts +22 -8
  47. package/dist/config-1k9t4jhh.js +59 -0
  48. package/dist/context/adaptive-compaction.d.ts +2 -0
  49. package/dist/context/compaction.d.ts +3 -1
  50. package/dist/context/qwen-reasoning.d.ts +5 -0
  51. package/dist/context/scoped-context.d.ts +61 -0
  52. package/dist/context/semantic-compaction.d.ts +21 -0
  53. package/dist/context/task-memory.d.ts +13 -8
  54. package/dist/execution/execution-environment.d.ts +5 -0
  55. package/dist/execution/oci-observability.d.ts +2 -0
  56. package/dist/execution/patch-diagnostics.d.ts +6 -0
  57. package/dist/hostile-repository-demo.js +4614 -1930
  58. package/dist/index.d.ts +13 -1
  59. package/dist/index.js +16435 -12486
  60. package/dist/integrations/mcp.d.ts +23 -3
  61. package/dist/models/catalog.d.ts +76 -0
  62. package/dist/models/compaction-recommendations.d.ts +28 -0
  63. package/dist/models/sdk-catalog-adapter.d.ts +7 -0
  64. package/dist/persistence/operations.d.ts +10 -6
  65. package/dist/persistence/state-backup-stream.d.ts +4 -0
  66. package/dist/persistence/state-backup.d.ts +52 -0
  67. package/dist/persistence/state-gitignore.d.ts +2 -0
  68. package/dist/persistence/workspace-checkpoints.d.ts +149 -0
  69. package/dist/providers/meta-continuation.d.ts +1 -1
  70. package/dist/providers/meta-errors.d.ts +2 -0
  71. package/dist/providers/meta-replay.d.ts +2 -0
  72. package/dist/providers/qwen-context.d.ts +2 -0
  73. package/dist/providers/qwen-hosted-policy.d.ts +5 -0
  74. package/dist/providers/reasoning.d.ts +18 -0
  75. package/dist/runtime/config.d.ts +12 -3
  76. package/dist/runtime/context-runtime.d.ts +12 -0
  77. package/dist/runtime/error-diagnostics.d.ts +641 -0
  78. package/dist/runtime/harness.d.ts +13 -4
  79. package/dist/runtime/model-edit-references.d.ts +8 -0
  80. package/dist/runtime/oci-delivery.d.ts +17 -0
  81. package/dist/runtime/progress-monitor.d.ts +33 -0
  82. package/dist/runtime/provider-diagnostics.d.ts +35 -0
  83. package/dist/runtime/runtime-checkpoints.d.ts +3 -0
  84. package/dist/runtime/runtime-diagnostics.d.ts +5 -5
  85. package/dist/runtime/runtime-policy.d.ts +14 -6
  86. package/dist/runtime/time-to-safe-fix.d.ts +308 -1
  87. package/dist/runtime/tool-execution.d.ts +11 -0
  88. package/dist/runtime/tool-policy.d.ts +55 -0
  89. package/dist/runtime/tool-scheduling.d.ts +5 -0
  90. package/dist/runtime/usage-ledger.d.ts +1 -0
  91. package/dist/service-cli.js +9422 -6622
  92. package/dist/service-client-cli-yx56n0hc.js +1086 -0
  93. package/dist/tools/dependency-read.d.ts +63 -0
  94. package/dist/tools/execution.d.ts +8 -8
  95. package/dist/tools/workspace.d.ts +31 -15
  96. package/dist/verify-historical-migrations.js +5272 -2437
  97. package/dist/workspace/file-security.d.ts +6 -0
  98. package/dist/zhx.js +15 -19168
  99. package/docs/ACP.md +55 -0
  100. package/docs/CLI.md +292 -29
  101. package/docs/CONTEXT_ENGINEERING.md +184 -20
  102. package/docs/CREDENTIALS.md +38 -6
  103. package/docs/DURABLE_OPERATIONS.md +10 -0
  104. package/docs/EXTENSIBILITY.md +101 -4
  105. package/docs/FIRST_USE.md +7 -5
  106. package/docs/MODEL_CATALOG.md +52 -1
  107. package/docs/README.md +1 -0
  108. package/docs/REPOSITORY_EDITING.md +42 -0
  109. package/docs/STABILITY.md +2 -0
  110. package/docs/SUPPORT_MATRIX_1_1.md +17 -0
  111. package/docs/USAGE.md +9 -0
  112. package/docs/WORKSPACE_CHECKPOINTS.md +27 -0
  113. package/docs/images/cli-conversation.png +0 -0
  114. package/docs/support-matrix-1.1.json +29 -0
  115. package/evaluations/golden-expectations.json +5 -0
  116. package/evaluations/representative-assembly-matrix.json +145 -1
  117. package/evaluations/representative-repositories-v2.jsonl +7 -0
  118. package/examples/README.md +2 -2
  119. package/package.json +19 -13
@@ -1,4 +1,5 @@
1
- import { type JsonValue, type McpClient, type McpListedTool, type ToolSet } from "@zhivex-ai/core";
1
+ import { type McpHttpAuthProvider, type McpDestinationPolicy } from "@zhivex-ai/core/mcp-http";
2
+ import { type JsonValue, type McpCallToolOptions, type McpClient, type McpListedTool, type ToolSet } from "@zhivex-ai/core";
2
3
  export declare const HARNESS_MCP_CONFIG_SCHEMA_VERSION: 1;
3
4
  export declare const HARNESS_MCP_PERMISSIONS: readonly ["read", "network", "write", "external-side-effect"];
4
5
  export type HarnessMcpPermission = (typeof HARNESS_MCP_PERMISSIONS)[number];
@@ -6,8 +7,12 @@ export type HarnessMcpTransport = "http" | "custom";
6
7
  export interface HarnessMcpServerConfig {
7
8
  name: string;
8
9
  transport: HarnessMcpTransport;
10
+ /** Explicit migration; absence retains the legacy 2025-06-18 handshake. */
11
+ protocolVersion?: "2025-06-18" | "2025-11-25";
9
12
  url?: string;
10
13
  includeTools: readonly string[];
14
+ /** Exact resource URIs only; templates and wildcard grants are not supported. */
15
+ includeResources?: readonly string[];
11
16
  excludeTools: readonly string[];
12
17
  toolNamePrefix: string;
13
18
  permissions: readonly HarnessMcpPermission[];
@@ -23,13 +28,28 @@ export interface HarnessMcpConfiguration {
23
28
  schemaVersion: typeof HARNESS_MCP_CONFIG_SCHEMA_VERSION;
24
29
  servers: readonly HarnessMcpServerConfig[];
25
30
  }
26
- export type HarnessMcpClients = Readonly<Record<string, McpClient>>;
31
+ export interface HarnessMcpResourceClient extends Omit<McpClient, "listResources" | "readResource"> {
32
+ listResources?(input?: {
33
+ cursor?: string;
34
+ }, options?: McpCallToolOptions): Promise<unknown>;
35
+ readResource?(input: {
36
+ uri: string;
37
+ }, options?: McpCallToolOptions): Promise<unknown>;
38
+ }
39
+ export interface HarnessMcpHttpOptions {
40
+ /** Host-owned SDK OAuth/token provider; never serialized into workspace configuration. */
41
+ auth?: McpHttpAuthProvider;
42
+ /** Additional host DNS/IP/tenant restriction; cannot expand the configured endpoint. */
43
+ destinationPolicy?: McpDestinationPolicy;
44
+ }
45
+ export type HarnessMcpClients = Readonly<Record<string, HarnessMcpResourceClient>>;
27
46
  export declare const normalizeHarnessMcpConfiguration: (value: unknown) => HarnessMcpConfiguration;
28
47
  export declare const loadHarnessMcpConfiguration: (workspace: string, configPath: string) => Promise<HarnessMcpConfiguration>;
29
48
  type FetchImplementation = typeof fetch;
30
- export declare const createHttpMcpClient: (server: HarnessMcpServerConfig, env?: NodeJS.ProcessEnv, fetchImplementation?: FetchImplementation) => McpClient;
49
+ export declare const createHttpMcpClient: (server: HarnessMcpServerConfig, env?: NodeJS.ProcessEnv, fetchImplementation?: FetchImplementation, options?: HarnessMcpHttpOptions) => HarnessMcpResourceClient;
31
50
  export declare const createHarnessMcpTools: (configuration: HarnessMcpConfiguration, options?: {
32
51
  clients?: HarnessMcpClients;
52
+ httpOptions?: Readonly<Record<string, HarnessMcpHttpOptions>>;
33
53
  env?: NodeJS.ProcessEnv;
34
54
  fetchImplementation?: FetchImplementation;
35
55
  }) => Promise<ToolSet>;
@@ -25,6 +25,44 @@ export declare const catalogModelSchema: z.ZodObject<{
25
25
  reason: z.ZodOptional<z.ZodString>;
26
26
  replacement: z.ZodOptional<z.ZodString>;
27
27
  retirementDate: z.ZodOptional<z.ZodISODate>;
28
+ limits: z.ZodOptional<z.ZodObject<{
29
+ contextWindowTokens: z.ZodNumber;
30
+ contextWindowType: z.ZodEnum<{
31
+ combined: "combined";
32
+ input: "input";
33
+ }>;
34
+ maxOutputTokens: z.ZodNumber;
35
+ maxInputTokens: z.ZodOptional<z.ZodNumber>;
36
+ evidence: z.ZodObject<{
37
+ sourceUrl: z.ZodURL;
38
+ checkedAt: z.ZodISODate;
39
+ }, z.core.$strict>;
40
+ }, z.core.$strict>>;
41
+ pricing: z.ZodOptional<z.ZodObject<{
42
+ currency: z.ZodLiteral<"USD">;
43
+ inputPerMillionTokens: z.ZodNumber;
44
+ outputPerMillionTokens: z.ZodNumber;
45
+ cachedInputPerMillionTokens: z.ZodOptional<z.ZodNumber>;
46
+ maxInputTokens: z.ZodOptional<z.ZodNumber>;
47
+ scope: z.ZodString;
48
+ evidence: z.ZodObject<{
49
+ sourceUrl: z.ZodURL;
50
+ checkedAt: z.ZodISODate;
51
+ }, z.core.$strict>;
52
+ }, z.core.$strict>>;
53
+ compaction: z.ZodOptional<z.ZodObject<{
54
+ suitability: z.ZodEnum<{
55
+ candidate: "candidate";
56
+ evaluated: "evaluated";
57
+ unknown: "unknown";
58
+ unsuitable: "unsuitable";
59
+ }>;
60
+ reason: z.ZodString;
61
+ evidence: z.ZodObject<{
62
+ sourceUrl: z.ZodURL;
63
+ checkedAt: z.ZodISODate;
64
+ }, z.core.$strict>;
65
+ }, z.core.$strict>>;
28
66
  }, z.core.$strict>;
29
67
  export declare const modelCatalogSchema: z.ZodObject<{
30
68
  schemaVersion: z.ZodLiteral<1>;
@@ -63,6 +101,44 @@ export declare const modelCatalogSchema: z.ZodObject<{
63
101
  reason: z.ZodOptional<z.ZodString>;
64
102
  replacement: z.ZodOptional<z.ZodString>;
65
103
  retirementDate: z.ZodOptional<z.ZodISODate>;
104
+ limits: z.ZodOptional<z.ZodObject<{
105
+ contextWindowTokens: z.ZodNumber;
106
+ contextWindowType: z.ZodEnum<{
107
+ combined: "combined";
108
+ input: "input";
109
+ }>;
110
+ maxOutputTokens: z.ZodNumber;
111
+ maxInputTokens: z.ZodOptional<z.ZodNumber>;
112
+ evidence: z.ZodObject<{
113
+ sourceUrl: z.ZodURL;
114
+ checkedAt: z.ZodISODate;
115
+ }, z.core.$strict>;
116
+ }, z.core.$strict>>;
117
+ pricing: z.ZodOptional<z.ZodObject<{
118
+ currency: z.ZodLiteral<"USD">;
119
+ inputPerMillionTokens: z.ZodNumber;
120
+ outputPerMillionTokens: z.ZodNumber;
121
+ cachedInputPerMillionTokens: z.ZodOptional<z.ZodNumber>;
122
+ maxInputTokens: z.ZodOptional<z.ZodNumber>;
123
+ scope: z.ZodString;
124
+ evidence: z.ZodObject<{
125
+ sourceUrl: z.ZodURL;
126
+ checkedAt: z.ZodISODate;
127
+ }, z.core.$strict>;
128
+ }, z.core.$strict>>;
129
+ compaction: z.ZodOptional<z.ZodObject<{
130
+ suitability: z.ZodEnum<{
131
+ candidate: "candidate";
132
+ evaluated: "evaluated";
133
+ unknown: "unknown";
134
+ unsuitable: "unsuitable";
135
+ }>;
136
+ reason: z.ZodString;
137
+ evidence: z.ZodObject<{
138
+ sourceUrl: z.ZodURL;
139
+ checkedAt: z.ZodISODate;
140
+ }, z.core.$strict>;
141
+ }, z.core.$strict>>;
66
142
  }, z.core.$strict>>;
67
143
  }, z.core.$strict>>;
68
144
  }, z.core.$strict>;
@@ -0,0 +1,28 @@
1
+ import type { CatalogModel, ModelCatalog } from "./catalog.js";
2
+ export interface CompactionRecommendationRequest {
3
+ provider: string;
4
+ /** Include instructions, wrappers and transcript in this estimate. */
5
+ inputTokens: number;
6
+ /** Reserve output, including reasoning tokens if the provider counts them here. */
7
+ outputTokens: number;
8
+ /** Only recommend within explicitly available model IDs when supplied. */
9
+ availableModels?: readonly string[];
10
+ /** Inject a clock for reproducible recommendations. */
11
+ now?: number;
12
+ maxEvidenceAgeDays?: number;
13
+ }
14
+ export interface CompactionModelAssessment {
15
+ model: CatalogModel;
16
+ eligible: boolean;
17
+ reasons: string[];
18
+ warnings: string[];
19
+ estimatedCostUsd?: number;
20
+ }
21
+ export interface CompactionModelRecommendations {
22
+ /** Advisory only: callers must preserve an explicit user model selection. */
23
+ recommendedModel?: string;
24
+ candidates: CompactionModelAssessment[];
25
+ excluded: CompactionModelAssessment[];
26
+ }
27
+ /** Deterministic, same-provider advice; never loads credentials or selects a route. */
28
+ export declare function recommendCompactionModels(catalog: ModelCatalog, request: CompactionRecommendationRequest): CompactionModelRecommendations;
@@ -0,0 +1,7 @@
1
+ import { type ModelCatalog as SdkModelCatalog } from "@zhivex-ai/core";
2
+ import type { ModelCatalog } from "./catalog.js";
3
+ /** Preserve the public harness manifest while using the SDK's shared evidence contract.
4
+ * Per-million display rates become per-thousand SDK rates; absent facts stay absent.
5
+ * This is an application-owned snapshot, never the frozen core default inventory.
6
+ */
7
+ export declare function toSdkCompactionCatalog(catalog: ModelCatalog, inputTokens: number): SdkModelCatalog;
@@ -1,6 +1,8 @@
1
1
  import { type AgentRunState, type AgentStatus } from "@zhivex-ai/agents";
2
- import type { AgentMemoryStore, AgentRunStore } from "@zhivex-ai/agents/ops";
2
+ import type { AgentMemoryStore, AgentRunStore, SqliteAgentRunStoreOptions } from "@zhivex-ai/agents/ops";
3
3
  import { type HarnessConfig, type HarnessStoreBackend } from "../runtime/config.js";
4
+ import { SqliteDatabase } from "./sqlite-database.js";
5
+ type SqliteDatabaseLike = SqliteAgentRunStoreOptions["db"];
4
6
  export declare const HARNESS_SQLITE_FILE = "operations.sqlite";
5
7
  export declare const HARNESS_OPERATIONS_SCHEMA_VERSION: 1;
6
8
  export declare const TERMINAL_RUN_STATUSES: readonly ["completed", "failed", "cancelled", "timed_out"];
@@ -126,8 +128,8 @@ export declare const inspectHarnessRun: (store: AgentRunStore, config: HarnessCo
126
128
  };
127
129
  };
128
130
  runtimeDiagnostics: {
129
- schemaVersion: 1;
130
- profile: "repair";
131
+ schemaVersion: 2;
132
+ requireVerifiedDelivery: boolean;
131
133
  budget: {
132
134
  inputTokens: number;
133
135
  outputTokens: number;
@@ -191,9 +193,9 @@ export declare const inspectHarnessRun: (store: AgentRunStore, config: HarnessCo
191
193
  }[];
192
194
  } | null;
193
195
  effectiveRuntime: {
194
- schemaVersion: 1;
195
- policyVersion: "repair-v2-durable-closure";
196
- profile: "repair" | "strict";
196
+ schemaVersion: 2;
197
+ policyVersion: "assistant-v3-durable-closure";
198
+ requireVerifiedDelivery: boolean;
197
199
  backend: "none" | "oci";
198
200
  budget: {
199
201
  unlimitedTokens?: boolean | undefined;
@@ -313,7 +315,9 @@ export declare const cleanupHarnessRuns: (store: AgentRunStore, config: HarnessC
313
315
  statuses: AgentStatus[];
314
316
  deleted: number;
315
317
  }>;
318
+ export declare const sqliteAdapter: (database: SqliteDatabase) => SqliteDatabaseLike;
316
319
  export declare const migrateLegacyFileRuns: (directory: string, target: AgentRunStore, config: HarnessConfig) => Promise<HarnessMigrationResult>;
317
320
  export declare const openHarnessPersistence: (config: HarnessConfig, options?: {
318
321
  migrateLegacyFileStore?: boolean;
319
322
  }) => Promise<HarnessPersistence>;
323
+ export {};
@@ -0,0 +1,4 @@
1
+ /** Canonical JSON without allocating a serialized copy of the entire bundle. */
2
+ export declare function canonicalChunks(value: unknown): Generator<string>;
3
+ export declare function segmentedChunks(value: unknown): Generator<string>;
4
+ export declare function readBackupTransport(source: string, legacyMaxBytes: number): Promise<unknown>;
@@ -99,6 +99,58 @@ export declare const stateBackupBundleSchema: z.ZodObject<{
99
99
  completedAt: z.ZodNullable<z.ZodNumber>;
100
100
  metadataBytes: z.ZodNumber;
101
101
  }, z.core.$strict>>;
102
+ workspaceCheckpoints: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
103
+ id: z.ZodString;
104
+ workspaceKey: z.ZodString;
105
+ scopeKey: z.ZodString;
106
+ kind: z.ZodLiteral<"checkpoint">;
107
+ body: z.ZodObject<{
108
+ id: z.ZodString;
109
+ sessionId: z.ZodString;
110
+ turnId: z.ZodString;
111
+ files: z.ZodArray<z.ZodObject<{
112
+ path: z.ZodString;
113
+ digest: z.ZodString;
114
+ content: z.ZodString;
115
+ mode: z.ZodNumber;
116
+ }, z.core.$strict>>;
117
+ }, z.core.$strict>;
118
+ }, z.core.$strict>, z.ZodObject<{
119
+ id: z.ZodString;
120
+ workspaceKey: z.ZodString;
121
+ scopeKey: z.ZodString;
122
+ kind: z.ZodLiteral<"restore">;
123
+ body: z.ZodObject<{
124
+ id: z.ZodString;
125
+ checkpoint: z.ZodObject<{
126
+ id: z.ZodString;
127
+ sessionId: z.ZodString;
128
+ turnId: z.ZodString;
129
+ files: z.ZodArray<z.ZodObject<{
130
+ path: z.ZodString;
131
+ digest: z.ZodString;
132
+ content: z.ZodString;
133
+ mode: z.ZodNumber;
134
+ }, z.core.$strict>>;
135
+ }, z.core.$strict>;
136
+ proposalId: z.ZodString;
137
+ expected: z.ZodRecord<z.ZodString, z.ZodString>;
138
+ stage: z.ZodEnum<{
139
+ applied: "applied";
140
+ applying: "applying";
141
+ completed: "completed";
142
+ forked: "forked";
143
+ forking: "forking";
144
+ prepared: "prepared";
145
+ }>;
146
+ forkSessionId: z.ZodOptional<z.ZodString>;
147
+ }, z.core.$strict>;
148
+ }, z.core.$strict>], "kind">>>;
149
+ budgetLedgers: z.ZodOptional<z.ZodArray<z.ZodObject<{
150
+ key: z.ZodString;
151
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
152
+ updatedAt: z.ZodNumber;
153
+ }, z.core.$strict>>>;
102
154
  }, z.core.$strict>;
103
155
  checksum: z.ZodString;
104
156
  }, z.core.$strict>;
@@ -0,0 +1,2 @@
1
+ /** Call after validating and creating the state directory, before writing state. */
2
+ export declare function protectStateFromGit(workspace: string, stateDirectory: string): Promise<void>;
@@ -0,0 +1,149 @@
1
+ import { z } from "zod";
2
+ import { Workspace } from "../workspace/workspace.js";
3
+ import { type FileDigest } from "../workspace/edit-contracts.js";
4
+ import { type CliSessionStore } from "./sessions.js";
5
+ export declare const workspaceCheckpointSchema: z.ZodObject<{
6
+ id: z.ZodString;
7
+ sessionId: z.ZodString;
8
+ turnId: z.ZodString;
9
+ files: z.ZodArray<z.ZodObject<{
10
+ path: z.ZodString;
11
+ digest: z.ZodString;
12
+ content: z.ZodString;
13
+ mode: z.ZodNumber;
14
+ }, z.core.$strict>>;
15
+ }, z.core.$strict>;
16
+ export declare const workspaceRestoreOperationSchema: z.ZodObject<{
17
+ id: z.ZodString;
18
+ checkpoint: z.ZodObject<{
19
+ id: z.ZodString;
20
+ sessionId: z.ZodString;
21
+ turnId: z.ZodString;
22
+ files: z.ZodArray<z.ZodObject<{
23
+ path: z.ZodString;
24
+ digest: z.ZodString;
25
+ content: z.ZodString;
26
+ mode: z.ZodNumber;
27
+ }, z.core.$strict>>;
28
+ }, z.core.$strict>;
29
+ proposalId: z.ZodString;
30
+ expected: z.ZodRecord<z.ZodString, z.ZodString>;
31
+ stage: z.ZodEnum<{
32
+ applied: "applied";
33
+ applying: "applying";
34
+ completed: "completed";
35
+ forked: "forked";
36
+ forking: "forking";
37
+ prepared: "prepared";
38
+ }>;
39
+ forkSessionId: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strict>;
41
+ export type WorkspaceCheckpoint = z.infer<typeof workspaceCheckpointSchema>;
42
+ export type WorkspaceRestoreOperation = z.infer<typeof workspaceRestoreOperationSchema>;
43
+ /** Existing text files only. No deletion, creation, binary file, or mode rollback. */
44
+ export declare const openWorkspaceCheckpointStore: (workspace: Workspace, sessions: CliSessionStore) => Promise<{
45
+ close: () => void;
46
+ getCheckpoint: (id: string) => {
47
+ id: string;
48
+ sessionId: string;
49
+ turnId: string;
50
+ files: {
51
+ path: string;
52
+ digest: string;
53
+ content: string;
54
+ mode: number;
55
+ }[];
56
+ };
57
+ getOperation: (id: string) => {
58
+ id: string;
59
+ checkpoint: {
60
+ id: string;
61
+ sessionId: string;
62
+ turnId: string;
63
+ files: {
64
+ path: string;
65
+ digest: string;
66
+ content: string;
67
+ mode: number;
68
+ }[];
69
+ };
70
+ proposalId: string;
71
+ expected: Record<string, string>;
72
+ stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
73
+ forkSessionId?: string | undefined;
74
+ };
75
+ capture: (input: {
76
+ sessionId: string;
77
+ turnId: string;
78
+ paths: readonly string[];
79
+ }) => Promise<WorkspaceCheckpoint>;
80
+ prepareRestore: (checkpointId: string, expectedCurrent: Readonly<Record<string, FileDigest>>) => Promise<{
81
+ operation: {
82
+ id: string;
83
+ checkpoint: {
84
+ id: string;
85
+ sessionId: string;
86
+ turnId: string;
87
+ files: {
88
+ path: string;
89
+ digest: string;
90
+ content: string;
91
+ mode: number;
92
+ }[];
93
+ };
94
+ proposalId: string;
95
+ expected: Record<string, string>;
96
+ stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
97
+ forkSessionId?: string | undefined;
98
+ };
99
+ proposal: {
100
+ schemaVersion: 1;
101
+ kind: "edit-proposal";
102
+ proposalId: string;
103
+ digestAlgorithm: "sha256";
104
+ changes: {
105
+ path: string;
106
+ expectedDigest: string | undefined;
107
+ content: string;
108
+ }[];
109
+ };
110
+ }>;
111
+ /** Trusted operator invocation after reviewing this exact proposal ID. */
112
+ applyRestore: (id: string, reviewedProposalId: FileDigest) => Promise<{
113
+ id: string;
114
+ checkpoint: {
115
+ id: string;
116
+ sessionId: string;
117
+ turnId: string;
118
+ files: {
119
+ path: string;
120
+ digest: string;
121
+ content: string;
122
+ mode: number;
123
+ }[];
124
+ };
125
+ proposalId: string;
126
+ expected: Record<string, string>;
127
+ stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
128
+ forkSessionId?: string | undefined;
129
+ }>;
130
+ /** Resolve only the uncertain fork window; never creates another fork. */
131
+ recoverFork: (id: string, forkSessionId: string) => Promise<{
132
+ id: string;
133
+ checkpoint: {
134
+ id: string;
135
+ sessionId: string;
136
+ turnId: string;
137
+ files: {
138
+ path: string;
139
+ digest: string;
140
+ content: string;
141
+ mode: number;
142
+ }[];
143
+ };
144
+ proposalId: string;
145
+ expected: Record<string, string>;
146
+ stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
147
+ forkSessionId?: string | undefined;
148
+ }>;
149
+ }>;
@@ -1 +1 @@
1
- export declare const createMetaContinuationFetch: (fetcher?: typeof fetch, waitMs?: number) => typeof fetch;
1
+ export declare const createMetaContinuationFetch: (fetcher?: typeof fetch, backoff?: number | readonly number[]) => typeof fetch;
@@ -0,0 +1,2 @@
1
+ /** Persist only fixed diagnostic labels, never provider messages or payloads. */
2
+ export declare function annotateMetaRequestError(error: unknown): never;
@@ -0,0 +1,2 @@
1
+ import { type MetaProviderOptions } from "@zhivex-ai/meta";
2
+ export declare const createMetaReplayModel: (options: MetaProviderOptions, modelId: string) => import("@zhivex-ai/core").LanguageModel<import("@zhivex-ai/meta").MetaLanguageModelOptions>;
@@ -0,0 +1,2 @@
1
+ import type { LanguageModelMiddleware } from "@zhivex-ai/core";
2
+ export declare const qwenLocalContext: LanguageModelMiddleware;
@@ -0,0 +1,5 @@
1
+ import { type LanguageModel } from "@zhivex-ai/core";
2
+ /** Model Studio's Kimi K3 documentation currently requires Chat Completions and
3
+ * thinking-only mode. Narrow the installed SDK snapshot until it catches up.
4
+ * https://help.aliyun.com/en/model-studio/kimi-api (2026-09-26). */
5
+ export declare function withQwenHostedPolicy(model: LanguageModel): LanguageModel;
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { type LanguageModel, type ModelCapabilities } from "@zhivex-ai/core";
3
+ export declare const reasoningEffortSchema: z.ZodEnum<{
4
+ default: "default";
5
+ high: "high";
6
+ low: "low";
7
+ max: "max";
8
+ medium: "medium";
9
+ minimal: "minimal";
10
+ none: "none";
11
+ xhigh: "xhigh";
12
+ }>;
13
+ export type HarnessReasoningEffort = z.infer<typeof reasoningEffortSchema>;
14
+ export declare const supportedReasoningEfforts: (capabilities: ModelCapabilities) => HarnessReasoningEffort[];
15
+ /** Capability inspection constructs an adapter only; it performs no requests and
16
+ * neither loads real credentials nor changes process environment. */
17
+ export declare function modelReasoningEfforts(provider: string, model: string): HarnessReasoningEffort[];
18
+ export declare function withReasoningEffort(model: LanguageModel, value?: HarnessReasoningEffort): LanguageModel;
@@ -1,3 +1,4 @@
1
+ import { type HarnessReasoningEffort } from "../providers/reasoning.js";
1
2
  import type { LanguageModel } from "@zhivex-ai/agents";
2
3
  import type { AgentStoreScope } from "@zhivex-ai/agents/ops";
3
4
  import { BUILTIN_PROVIDER_REGISTRATIONS, DEFAULT_PROVIDER_REGISTRY, PROVIDERS, PROVIDER_DESCRIPTORS, createProviderRegistry, type BuiltInHarnessProvider, type HarnessProvider, type HarnessProviderRegistry, type ProviderAvailability, type ProviderCapability, type ProviderCredentials, type ProviderDescriptor, type ProviderDiagnosticsDescriptor, type ProviderEnumDiagnostic, type ProviderModelFactory, type ProviderModelFactoryContext, type ProviderPresenceDiagnostic, type ProviderRegistration, type ProviderSupport } from "../providers/providers.js";
@@ -25,6 +26,7 @@ export declare const DEFAULT_OCI_EXECUTION: {
25
26
  };
26
27
  export declare const HARNESS_REQUIRED_CAPABILITIES: readonly ["streaming", "tools", "structured-output", "parallel-tools", "reasoning", "web-search"];
27
28
  export declare const HARNESS_SUBAGENT_PROFILES: readonly ["explorer", "implementer", "tester", "reviewer"];
29
+ export declare const DEFAULT_HARNESS_MAX_STEPS = 50;
28
30
  export declare const DEFAULT_HARNESS_BUDGET: {
29
31
  readonly maxToolCalls: 32;
30
32
  readonly maxToolErrors: 4;
@@ -65,6 +67,10 @@ export interface HarnessBudget {
65
67
  includeChildRuns: boolean;
66
68
  }
67
69
  export interface HarnessCompactionConfig {
70
+ model?: {
71
+ provider: string;
72
+ model: string;
73
+ };
68
74
  maxMessages: number;
69
75
  maxEstimatedInputTokens: number;
70
76
  keepRecentMessages: number;
@@ -106,13 +112,13 @@ export interface HarnessConfig {
106
112
  schemaVersion: typeof HARNESS_CONFIG_SCHEMA_VERSION;
107
113
  provider: HarnessProvider;
108
114
  model: string;
115
+ reasoningEffort?: HarnessReasoningEffort;
109
116
  workspace: string;
110
117
  stateDirectory: string;
111
118
  storeBackend: HarnessStoreBackend;
112
119
  scope: AgentStoreScope;
113
120
  maxSteps: number;
114
121
  timeoutMs: number;
115
- agentProfile: "strict" | "repair";
116
122
  requireVerifiedDelivery: boolean;
117
123
  budget: HarnessBudget;
118
124
  costBudget?: HarnessCostBudget;
@@ -128,6 +134,7 @@ export interface HarnessConfigInput {
128
134
  schemaVersion?: number;
129
135
  provider?: string;
130
136
  model?: string;
137
+ reasoningEffort?: HarnessReasoningEffort;
131
138
  workspace?: string;
132
139
  stateDirectory?: string;
133
140
  storeBackend?: string;
@@ -136,8 +143,7 @@ export interface HarnessConfigInput {
136
143
  namespace?: string;
137
144
  maxSteps?: number;
138
145
  timeoutMs?: number;
139
- agentProfile?: string;
140
- /** Require an actual verified repair; only available with agentProfile repair. */
146
+ /** Require an actual verified repair instead of allowing an analysis-only completion. */
141
147
  requireVerifiedDelivery?: boolean;
142
148
  maxToolCalls?: number;
143
149
  maxToolErrors?: number;
@@ -152,6 +158,9 @@ export interface HarnessConfigInput {
152
158
  compactionMaxMessages?: number;
153
159
  compactionMaxEstimatedInputTokens?: number;
154
160
  compactionKeepRecentMessages?: number;
161
+ /** Explicit utility route. Omit for deterministic, zero-call compaction. */
162
+ compactionModel?: string;
163
+ compactionProvider?: string;
155
164
  allowedChecks?: readonly string[];
156
165
  requiredCapabilities?: readonly string[];
157
166
  subagentProfiles?: readonly string[];
@@ -0,0 +1,12 @@
1
+ import type { AgentRunStore } from "@zhivex-ai/agents/ops";
2
+ import type { LanguageModelMiddleware, ToolSet } from "@zhivex-ai/core";
3
+ import type { Workspace } from "../workspace/workspace.js";
4
+ export declare const SCOPED_CONTEXT_KEY = "zhivexScopedContext";
5
+ /** Per invocation; only SDK-owned saves persist these observers. */
6
+ export declare function createContextRuntime(workspace: Workspace, metadata: Record<string, unknown>, enabled: boolean, options?: {
7
+ newUserRequest?: boolean;
8
+ }): Promise<{
9
+ wrapTools: (tools: ToolSet) => ToolSet;
10
+ middleware: LanguageModelMiddleware<import("@zhivex-ai/core").ProviderOptions>;
11
+ store: (original: AgentRunStore, runId: string) => AgentRunStore;
12
+ }>;