@zhivex-ai/harness 1.2.0 → 1.3.0-rc.7

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 (164) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +9 -10
  3. package/contracts/engine-api.json +2921 -0
  4. package/contracts/public-api.json +267 -1
  5. package/contracts/stable-api-signatures.json +43 -43
  6. package/dist/acp-cli.js +137 -15002
  7. package/dist/approvals/approval-history.d.ts +22 -0
  8. package/dist/approvals/explicit-review.d.ts +24 -0
  9. package/dist/approvals/host-policy-identity.d.ts +3 -0
  10. package/dist/cli/arguments.d.ts +6 -2
  11. package/dist/cli/checkpoints.d.ts +230 -0
  12. package/dist/cli/cli-options.d.ts +2 -41
  13. package/dist/cli/cli-profiles.d.ts +4 -2
  14. package/dist/cli/cli-stream.d.ts +2 -167
  15. package/dist/cli/governance-report.d.ts +5 -0
  16. package/dist/cli/policy-decisions.d.ts +9 -0
  17. package/dist/cli/policy.d.ts +5 -0
  18. package/dist/cli/presentation.d.ts +3 -1
  19. package/dist/cli/run-document.d.ts +2 -91
  20. package/dist/cli/terminal/terminal-continuation.d.ts +2 -3
  21. package/dist/cli/terminal/terminal-ui.d.ts +4 -0
  22. package/dist/{cli-entry-c2f58zj2.js → cli-entry-ae7x44d4.js} +14969 -10731
  23. package/dist/{cli-entry-427869g9.js → cli-entry-d5788aay.js} +388 -47
  24. package/dist/cli-entry-ev76ezcd.js +656 -0
  25. package/dist/{cli-3jmy4h5h.js → cli-t7hrhayq.js} +918 -2223
  26. package/dist/cli.js +3 -5
  27. package/dist/client/acp-mcp-admission.d.ts +32 -0
  28. package/dist/client/acp-mcp-host.d.ts +19 -0
  29. package/dist/client/acp-mcp-session.d.ts +14 -0
  30. package/dist/client/acp-stdio.d.ts +2 -0
  31. package/dist/client/acp.d.ts +4 -1
  32. package/dist/client/adapter.d.ts +13 -1
  33. package/dist/client/continuation.d.ts +3 -0
  34. package/dist/client/json-contracts.d.ts +107 -4
  35. package/dist/client/local-service.d.ts +2 -0
  36. package/dist/client/protocol.d.ts +127 -1
  37. package/dist/client/run-document.d.ts +91 -0
  38. package/dist/client/service-events.d.ts +4 -0
  39. package/dist/client/stream.d.ts +167 -0
  40. package/dist/compat/cli-options.d.ts +53 -0
  41. package/dist/compat/code-support.d.ts +22 -0
  42. package/dist/compat/code-support.js +74 -0
  43. package/dist/{config-1k9t4jhh.js → config-c002f06f.js} +1 -1
  44. package/dist/config-j3jga5wh.js +61 -0
  45. package/dist/context/adaptive-compaction.d.ts +1 -0
  46. package/dist/context/compaction.d.ts +1 -1
  47. package/dist/context/request-measurements.d.ts +17 -0
  48. package/dist/context/request-projection.d.ts +10 -0
  49. package/dist/context/task-memory.d.ts +1 -0
  50. package/dist/engine/acp.d.ts +6 -0
  51. package/dist/engine/acp.js +205 -0
  52. package/dist/engine/client.d.ts +6 -0
  53. package/dist/engine/client.js +28 -0
  54. package/dist/engine/desktop-providers-v1.d.ts +4 -0
  55. package/dist/engine/desktop-providers-v1.js +18 -0
  56. package/dist/engine/desktop-state-v1.d.ts +10 -0
  57. package/dist/engine/desktop-state-v1.js +168 -0
  58. package/dist/engine/index.d.ts +73 -0
  59. package/dist/engine/index.js +977 -0
  60. package/dist/engine/mcp-stdio-v1.d.ts +11 -0
  61. package/dist/engine/mcp-stdio-v1.js +108 -0
  62. package/dist/engine/models.d.ts +3 -0
  63. package/dist/engine/models.js +894 -0
  64. package/dist/engine/protocol.d.ts +7 -0
  65. package/dist/engine/protocol.js +182 -0
  66. package/dist/engine/service.d.ts +5 -0
  67. package/dist/engine/service.js +28 -0
  68. package/dist/execution/acceptance-snapshot.d.ts +2 -0
  69. package/dist/execution/execution-environment.d.ts +10 -0
  70. package/dist/execution/mcp-oci-channel.d.ts +11 -0
  71. package/dist/execution/mcp-oci-server.d.ts +38 -0
  72. package/dist/execution/mcp-oci-workspace.d.ts +23 -0
  73. package/dist/execution/mcp-resource-recovery.d.ts +19 -0
  74. package/dist/execution/mcp-workspace-snapshot.d.ts +20 -0
  75. package/dist/hostile-repository-demo.js +3368 -1304
  76. package/dist/index-1bx83sw4.js +4 -0
  77. package/dist/index-2gz7jv7g.js +549 -0
  78. package/dist/{cli-entry-b1mfvmxe.js → index-2jrdcj6b.js} +72 -115
  79. package/dist/index-3ah1f369.js +356 -0
  80. package/dist/index-42gp2hy8.js +1555 -0
  81. package/dist/index-4jw3tvy8.js +301 -0
  82. package/dist/index-8705zxpr.js +145 -0
  83. package/dist/index-8vm2m34s.js +2080 -0
  84. package/dist/index-8zzhggxv.js +477 -0
  85. package/dist/index-a97bezbz.js +1073 -0
  86. package/dist/index-gq9xagx2.js +1343 -0
  87. package/dist/index-h0mqx2ed.js +1373 -0
  88. package/dist/index-jgrx804e.js +5589 -0
  89. package/dist/index-qfpz5y2v.js +174 -0
  90. package/dist/index-t60rva31.js +1004 -0
  91. package/dist/index-wg1sd3at.js +80 -0
  92. package/dist/index-xqxeypt5.js +888 -0
  93. package/dist/index-yb239ghk.js +961 -0
  94. package/dist/index-z0qxmkm2.js +3389 -0
  95. package/dist/index-z4e8d0ph.js +1768 -0
  96. package/dist/index.js +251 -18649
  97. package/dist/integrations/mcp-host-session.d.ts +26 -0
  98. package/dist/integrations/mcp-stdio-admission.d.ts +54 -0
  99. package/dist/integrations/mcp-stdio-client.d.ts +44 -0
  100. package/dist/integrations/mcp-stdio-framing.d.ts +18 -0
  101. package/dist/integrations/mcp-stdio-launch.d.ts +20 -0
  102. package/dist/integrations/mcp-stdio-session.d.ts +7 -0
  103. package/dist/integrations/mcp-stdio-tools.d.ts +12 -0
  104. package/dist/internal/desktop/catalog.d.ts +2 -0
  105. package/dist/internal/desktop/persistence.d.ts +2 -3
  106. package/dist/internal/desktop/providers.d.ts +1 -0
  107. package/dist/models/catalog.d.ts +2 -0
  108. package/dist/persistence/governance-context.d.ts +126 -0
  109. package/dist/persistence/governance-report.d.ts +299 -0
  110. package/dist/persistence/host-database-backup.d.ts +28 -0
  111. package/dist/persistence/mcp-execution-journal.d.ts +19 -0
  112. package/dist/persistence/mcp-reconciliation.d.ts +33 -0
  113. package/dist/persistence/mcp-resource-journal.d.ts +54 -0
  114. package/dist/persistence/workspace-checkpoints.d.ts +138 -0
  115. package/dist/providers/anthropic-continuation.d.ts +5 -0
  116. package/dist/providers/providers.d.ts +1 -1
  117. package/dist/providers/vertex-auth.d.ts +27 -0
  118. package/dist/runtime/delegation-contracts.d.ts +9 -0
  119. package/dist/runtime/delegation-correction.d.ts +9 -0
  120. package/dist/runtime/delegation-result.d.ts +73 -0
  121. package/dist/runtime/error-diagnostics.d.ts +86 -0
  122. package/dist/runtime/harness.d.ts +11 -1
  123. package/dist/runtime/policy-decisions.d.ts +66 -0
  124. package/dist/runtime/policy-inspection.d.ts +52 -0
  125. package/dist/runtime/provider-diagnostics.d.ts +1 -0
  126. package/dist/runtime/runtime-instructions.d.ts +8 -0
  127. package/dist/runtime/task-acceptance-checks.d.ts +103 -0
  128. package/dist/runtime/task-acceptance-delivery.d.ts +107 -0
  129. package/dist/runtime/task-acceptance-host.d.ts +20 -0
  130. package/dist/runtime/task-acceptance-record.d.ts +107 -0
  131. package/dist/runtime/task-acceptance-validation.d.ts +25 -0
  132. package/dist/runtime/task-acceptance.d.ts +47 -0
  133. package/dist/runtime/time-to-safe-fix.d.ts +83 -0
  134. package/dist/runtime/tool-policy-file.d.ts +23 -0
  135. package/dist/runtime/tool-policy-paths.d.ts +5 -0
  136. package/dist/runtime/tool-policy.d.ts +6 -0
  137. package/dist/service-cli.js +19 -14504
  138. package/dist/{service-client-cli-yx56n0hc.js → service-client-cli-kns4mf57.js} +307 -248
  139. package/dist/verify-historical-migrations.js +3314 -1251
  140. package/dist/workspace/path-policy.d.ts +4 -0
  141. package/dist/zhx.js +3 -5
  142. package/docs/ACP.md +14 -2
  143. package/docs/ANTHROPIC.md +33 -0
  144. package/docs/CLI.md +132 -0
  145. package/docs/CLIENT_PROTOCOL.md +45 -0
  146. package/docs/CODE_RELEASE.md +93 -0
  147. package/docs/ENGINE_API.md +319 -0
  148. package/docs/EXTENSIBILITY.md +46 -3
  149. package/docs/FIRST_USE.md +6 -6
  150. package/docs/LOCAL_SERVICE.md +13 -0
  151. package/docs/MCP_STDIO.md +20 -0
  152. package/docs/README.md +6 -0
  153. package/docs/STABILITY.md +9 -1
  154. package/docs/SUPPORT_MATRIX.md +1 -1
  155. package/docs/TOOL_POLICY.md +81 -0
  156. package/docs/VERTEX.md +50 -0
  157. package/docs/adr/0002-isolated-mcp-stdio.md +135 -0
  158. package/docs/fixtures/mcp-stdio-contract-v1.json +189 -0
  159. package/docs/support-matrix.json +2 -0
  160. package/evaluations/representative-assembly-matrix.json +64 -1
  161. package/evaluations/task-acceptance-routes.json +7 -0
  162. package/examples/README.md +1 -1
  163. package/package.json +74 -12
  164. package/dist/cli-entry-64pdp3k5.js +0 -17
@@ -0,0 +1,28 @@
1
+ import type { HarnessConfig } from "../runtime/config.js";
2
+ import { type SqliteAccessLease } from "./sqlite-access.js";
3
+ export declare const DESKTOP_DATABASE_BACKUP_LIMIT: number;
4
+ export interface DesktopDatabaseBackup {
5
+ directory: string;
6
+ size: number;
7
+ sha256: string;
8
+ logicalChecksum: string;
9
+ }
10
+ export interface DesktopBackupConfig extends HarnessConfig {
11
+ workspaceAbsent?: true;
12
+ accessLease?: SqliteAccessLease;
13
+ }
14
+ /** Full SQLite snapshot, including visual activity and any other tables.
15
+ * Caller must hold desktop admission closed and provide host-controlled paths.
16
+ * This captures one database; cross-project/index consistency belongs to the update transaction.
17
+ */
18
+ export declare function createDesktopDatabaseBackup(config: DesktopBackupConfig, backupRoot: string): Promise<DesktopDatabaseBackup>;
19
+ /** Rechecks the immutable copy against the host-held receipt before recovery may consume it. */
20
+ export declare function verifyDesktopDatabaseBackup(backup: DesktopDatabaseBackup): Promise<void>;
21
+ /** Worker state check under an exclusive inherited lease. Reads the live database
22
+ * without migrations, checkpointing, opening sessions or recreating a checkout.
23
+ * Core export validation covers its records; it is not an equality comparison
24
+ * against the backup or a semantic validator for every desktop activity table.
25
+ */
26
+ export declare function verifyDesktopDatabaseState(config: DesktopBackupConfig & {
27
+ accessLease: SqliteAccessLease;
28
+ }): Promise<void>;
@@ -0,0 +1,19 @@
1
+ import type { AgentRunStore, AgentStoreScope, McpClient } from '@zhivex-ai/core';
2
+ import type { McpStdioLaunchProposal } from '../integrations/mcp-stdio-admission.js';
3
+ export declare class McpExecutionJournalError extends Error {
4
+ readonly code: 'persistence_failed' | 'identity_changed' | 'replay_denied' | 'outcome_unknown' | 'cleanup_required';
5
+ readonly outcomeUnknown: boolean;
6
+ constructor(code: 'persistence_failed' | 'identity_changed' | 'replay_denied' | 'outcome_unknown' | 'cleanup_required', outcomeUnknown: boolean);
7
+ }
8
+ /** Reuses the scoped operations journal. Never stores raw arguments, secrets or server output. */
9
+ export declare function createJournaledMcpClient(options: {
10
+ client: McpClient & {
11
+ close(): Promise<void>;
12
+ };
13
+ proposal: Readonly<McpStdioLaunchProposal>;
14
+ store: AgentRunStore;
15
+ runId: string;
16
+ scope: AgentStoreScope;
17
+ }): McpClient & {
18
+ close(): Promise<void>;
19
+ };
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import type { AgentRunStore, AgentStoreScope } from '@zhivex-ai/core';
3
+ declare const decisionSchema: z.ZodObject<{
4
+ toolCallId: z.ZodString;
5
+ expectedRevision: z.ZodNumber;
6
+ outcome: z.ZodEnum<{
7
+ effect_confirmed: "effect_confirmed";
8
+ no_effect_confirmed: "no_effect_confirmed";
9
+ }>;
10
+ evidenceDigest: z.ZodString;
11
+ }, z.core.$strict>;
12
+ export type McpReconciliationDecision = z.infer<typeof decisionSchema>;
13
+ export interface McpReconciliationReview extends McpReconciliationDecision {
14
+ readonly runId: string;
15
+ readonly scope: Readonly<AgentStoreScope>;
16
+ readonly proposalHash: string;
17
+ readonly argumentsHash: string;
18
+ readonly toolNameHash: string;
19
+ }
20
+ /** Host-only decision authority. No model tool or workspace configuration exposes it.
21
+ * A resolution never supplies a fabricated result or replays the original key.
22
+ * Fresh execution still requires fresh host admission and agent approval.
23
+ */
24
+ export declare function createMcpReconciliationAuthority(options: {
25
+ store: AgentRunStore;
26
+ runId: string;
27
+ scope: AgentStoreScope;
28
+ hostId: string;
29
+ authorize(review: Readonly<McpReconciliationReview>): Promise<boolean>;
30
+ }): Readonly<{
31
+ reconcile(input: McpReconciliationDecision): Promise<void>;
32
+ }>;
33
+ export {};
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ import type { AgentRunStore, AgentStoreScope } from '@zhivex-ai/core';
3
+ import type { McpStdioLaunchProposal } from '../integrations/mcp-stdio-admission.js';
4
+ declare const phases: readonly ['reserved', 'provisioning', 'ready', 'closing', 'closed', 'cleanup_required'];
5
+ export type McpResourcePhase = typeof phases[number];
6
+ export declare const mcpResourcePlanSchema: z.ZodObject<{
7
+ schemaVersion: z.ZodLiteral<1>;
8
+ kind: z.ZodLiteral<"isolated-mcp-resources">;
9
+ leaseId: z.ZodString;
10
+ scopeHash: z.ZodString;
11
+ hostHash: z.ZodString;
12
+ proposalHash: z.ZodString;
13
+ daemonId: z.ZodString;
14
+ ownerPid: z.ZodNumber;
15
+ ownerInstance: z.ZodString;
16
+ serverImageId: z.ZodString;
17
+ provisionerImageId: z.ZodString;
18
+ serverName: z.ZodString;
19
+ volumeName: z.ZodString;
20
+ seederName: z.ZodString;
21
+ }, z.core.$strict>;
22
+ export type McpResourcePlan = Readonly<z.infer<typeof mcpResourcePlanSchema>>;
23
+ export declare const mcpResourceOutputSchema: z.ZodObject<{
24
+ schemaVersion: z.ZodLiteral<1>;
25
+ phase: z.ZodEnum<{
26
+ cleanup_required: "cleanup_required";
27
+ closed: "closed";
28
+ closing: "closing";
29
+ provisioning: "provisioning";
30
+ ready: "ready";
31
+ reserved: "reserved";
32
+ }>;
33
+ }, z.core.$strict>;
34
+ export interface McpResourceLeaseJournal {
35
+ readonly plan: McpResourcePlan;
36
+ /** Label values contain only scoped identifiers, never commands or credentials. */
37
+ readonly labels: Readonly<Record<string, string>>;
38
+ advance(phase: McpResourcePhase): Promise<void>;
39
+ }
40
+ /** Reserve all names durably before creating any Docker resource. Host identity is host-owned. */
41
+ export declare function reserveMcpResources(options: {
42
+ store: AgentRunStore;
43
+ runId: string;
44
+ scope: AgentStoreScope;
45
+ hostId: string;
46
+ daemonId: string;
47
+ proposal: Readonly<McpStdioLaunchProposal>;
48
+ serverImageId: string;
49
+ provisionerImageId: string;
50
+ }): Promise<McpResourceLeaseJournal>;
51
+ /** Reconstruct only non-secret ownership labels from a validated durable plan. */
52
+ export declare function mcpResourceLabels(plan: McpResourcePlan): Readonly<Record<string, string>>;
53
+ export declare function matchesMcpResourceScope(plan: McpResourcePlan, runId: string, scope: AgentStoreScope, hostId: string): boolean;
54
+ export {};
@@ -40,6 +40,10 @@ export declare const workspaceRestoreOperationSchema: z.ZodObject<{
40
40
  }, z.core.$strict>;
41
41
  export type WorkspaceCheckpoint = z.infer<typeof workspaceCheckpointSchema>;
42
42
  export type WorkspaceRestoreOperation = z.infer<typeof workspaceRestoreOperationSchema>;
43
+ declare const retentionSelection: z.ZodObject<{
44
+ checkpointIds: z.ZodArray<z.ZodString>;
45
+ completedRestoreIds: z.ZodArray<z.ZodString>;
46
+ }, z.core.$strict>;
43
47
  /** Existing text files only. No deletion, creation, binary file, or mode rollback. */
44
48
  export declare const openWorkspaceCheckpointStore: (workspace: Workspace, sessions: CliSessionStore) => Promise<{
45
49
  close: () => void;
@@ -72,6 +76,139 @@ export declare const openWorkspaceCheckpointStore: (workspace: Workspace, sessio
72
76
  stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
73
77
  forkSessionId?: string | undefined;
74
78
  };
79
+ storageStatus: () => {
80
+ policy: 'explicit-reviewed-removal';
81
+ automaticEviction: false;
82
+ maxRecords: number;
83
+ maxRecordBytes: number;
84
+ maxFilesPerCheckpoint: number;
85
+ maxFileBytes: number;
86
+ records: number;
87
+ availableRecords: number;
88
+ serializedBytes: number;
89
+ pendingRestores: number;
90
+ checkpoints: {
91
+ id: string;
92
+ referenced: boolean;
93
+ }[];
94
+ };
95
+ prepareRetention: (input: z.infer<typeof retentionSelection>) => {
96
+ planId: string;
97
+ selection: {
98
+ checkpointIds: string[];
99
+ completedRestoreIds: string[];
100
+ };
101
+ records: {
102
+ id: string;
103
+ kind: string;
104
+ sessionId: string;
105
+ bytes: number;
106
+ }[];
107
+ recordsBefore: number;
108
+ recordsAfter: number;
109
+ bytesRemoved: number;
110
+ workspaceFilesChanged: false;
111
+ conversationsChanged: false;
112
+ };
113
+ /** Explicit operator review. Atomic scoped deletion never removes workspace files or sessions. */
114
+ applyRetention: (selection: z.infer<typeof retentionSelection>, reviewedPlanId: FileDigest) => Promise<{
115
+ planId: string;
116
+ selection: {
117
+ checkpointIds: string[];
118
+ completedRestoreIds: string[];
119
+ };
120
+ records: {
121
+ id: string;
122
+ kind: string;
123
+ sessionId: string;
124
+ bytes: number;
125
+ }[];
126
+ recordsBefore: number;
127
+ recordsAfter: number;
128
+ bytesRemoved: number;
129
+ workspaceFilesChanged: false;
130
+ conversationsChanged: false;
131
+ }>;
132
+ /** Scoped metadata only; file contents are disclosed only by explicit review. */
133
+ listCheckpoints: (sessionId: string) => {
134
+ id: string;
135
+ sessionId: string;
136
+ turnId: string;
137
+ files: {
138
+ path: string;
139
+ digest: string;
140
+ bytes: number;
141
+ mode: number;
142
+ }[];
143
+ }[];
144
+ listRestores: (sessionId: string) => {
145
+ id: string;
146
+ checkpointId: string;
147
+ proposalId: string;
148
+ stage: "applied" | "applying" | "completed" | "forked" | "forking" | "prepared";
149
+ forkSessionId?: string;
150
+ }[];
151
+ /** Read projection, not authorization. Digests must still be supplied to prepareRestore.
152
+ * Missing/protected/binary/oversized files are unavailable, never recreated. */
153
+ inspectCheckpoint: (id: string) => Promise<{
154
+ checkpoint: {
155
+ id: string;
156
+ sessionId: string;
157
+ turnId: string;
158
+ files: {
159
+ path: string;
160
+ digest: string;
161
+ bytes: number;
162
+ mode: number;
163
+ }[];
164
+ };
165
+ files: ({
166
+ path: string;
167
+ status: "mode-conflict";
168
+ before?: never;
169
+ after?: never;
170
+ expectedDigest?: never;
171
+ afterDigest?: never;
172
+ mode?: never;
173
+ } | {
174
+ path: string;
175
+ status: "available";
176
+ before: string;
177
+ after: string;
178
+ expectedDigest: string;
179
+ afterDigest: string;
180
+ mode: number;
181
+ } | {
182
+ before?: never;
183
+ after?: never;
184
+ expectedDigest?: never;
185
+ afterDigest?: never;
186
+ mode?: never;
187
+ path: string;
188
+ status: "unavailable";
189
+ })[];
190
+ coverage: {
191
+ existingTextOnly: true;
192
+ maxFiles: number;
193
+ maxFileBytes: number;
194
+ creation: false;
195
+ deletion: false;
196
+ binary: false;
197
+ modeRollback: false;
198
+ fullWorkspaceSnapshot: false;
199
+ };
200
+ }>;
201
+ /** Exact prepared diff. Reading it never forks a conversation or writes files. */
202
+ previewRestore: (id: string) => Promise<{
203
+ proposalId: string;
204
+ files: {
205
+ path: string;
206
+ expectedDigest: FileDigest | null;
207
+ before: string | null;
208
+ after: string;
209
+ afterDigest: FileDigest;
210
+ }[];
211
+ }>;
75
212
  capture: (input: {
76
213
  sessionId: string;
77
214
  turnId: string;
@@ -147,3 +284,4 @@ export declare const openWorkspaceCheckpointStore: (workspace: Workspace, sessio
147
284
  forkSessionId?: string | undefined;
148
285
  }>;
149
286
  }>;
287
+ export {};
@@ -0,0 +1,5 @@
1
+ import { type LanguageModel, type StreamEvent } from "@zhivex-ai/core";
2
+ /** SDK 0.12.4 exposes thinking/signature deltas as provider-data. Reassemble the
3
+ * signed block before it enters durable history; never replay raw delta objects. */
4
+ export declare function assembleAnthropicContinuation(events: AsyncIterable<StreamEvent>): AsyncIterable<StreamEvent>;
5
+ export declare const withAnthropicContinuation: (model: LanguageModel) => LanguageModel;
@@ -1,6 +1,6 @@
1
1
  import type { LanguageModel } from "@zhivex-ai/agents";
2
2
  import { type ModelGenerateInput, type ToolCall } from "@zhivex-ai/core";
3
- export declare const PROVIDERS: readonly ["meta", "qwen", "openai", "gemini"];
3
+ export declare const PROVIDERS: readonly ["meta", "qwen", "openai", "gemini", "anthropic", "vertex"];
4
4
  export type BuiltInHarnessProvider = (typeof PROVIDERS)[number];
5
5
  export type HarnessProvider = BuiltInHarnessProvider | (string & {});
6
6
  export type ProviderCapability = "streaming" | "tool-calling" | "approval-resume";
@@ -0,0 +1,27 @@
1
+ export interface VertexRoute {
2
+ readonly projectId: string;
3
+ readonly location: string;
4
+ }
5
+ /** Reject malformed resource segments without including customer identifiers in errors. */
6
+ export declare function vertexRoute(env: NodeJS.ProcessEnv): VertexRoute;
7
+ /** Configuration presence only; does not assert ADC validity or contact Google. */
8
+ export declare function vertexConfigured(env: NodeJS.ProcessEnv): boolean;
9
+ export declare const VERTEX_ENVIRONMENT: readonly ["GOOGLE_CLOUD_PROJECT", "VERTEX_LOCATION", "GOOGLE_APPLICATION_CREDENTIALS"];
10
+ export declare function vertexEnvironment(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
11
+ interface TokenSource {
12
+ getAccessToken(): Promise<string | null | undefined>;
13
+ }
14
+ type AuthFactory = (options: {
15
+ projectId: string;
16
+ scopes: string[];
17
+ keyFilename?: string;
18
+ }) => TokenSource;
19
+ /** ADC owns token caching/refresh. Never cache a bearer token in Harness configuration. */
20
+ export declare function vertexTokenSource(env: NodeJS.ProcessEnv, route: VertexRoute, createAuth?: AuthFactory): () => Promise<string>;
21
+ export declare class VertexAuthenticationError extends Error {
22
+ readonly status = 401;
23
+ readonly retryable = false;
24
+ constructor();
25
+ }
26
+ export declare function createVertexModel(model: string, env: NodeJS.ProcessEnv, createAuth?: AuthFactory): import("@zhivex-ai/core").LanguageModel<import("@zhivex-ai/vertex").VertexLanguageModelOptions>;
27
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { type LanguageModel } from "@zhivex-ai/core";
2
+ import { type DelegationResultContract } from "./delegation-result.js";
2
3
  /** Trusted application input, never constructed from a model tool call. */
3
4
  export interface HarnessDelegationContract {
4
5
  taskId: string;
@@ -6,6 +7,8 @@ export interface HarnessDelegationContract {
6
7
  prompt: string;
7
8
  allowedReadPaths: readonly string[];
8
9
  requiredOutput: string;
10
+ /** Opt-in experimental result evidence; legacy marker contracts remain unchanged. */
11
+ resultContract?: DelegationResultContract;
9
12
  }
10
13
  export declare const normalizeDelegationContracts: (value?: readonly HarnessDelegationContract[]) => Readonly<{
11
14
  taskId: string;
@@ -13,6 +16,12 @@ export declare const normalizeDelegationContracts: (value?: readonly HarnessDele
13
16
  prompt: string;
14
17
  requiredOutput: string;
15
18
  allowedReadPaths: readonly string[];
19
+ resultContract?: Readonly<{
20
+ requiredReadPaths: readonly string[];
21
+ schemaVersion: 1;
22
+ humanReviewRequired: boolean;
23
+ maxCorrections: number;
24
+ }>;
16
25
  }>[];
17
26
  export declare const delegationPrompt: (contract: HarnessDelegationContract) => string;
18
27
  export declare const delegationFingerprint: (contracts: readonly HarnessDelegationContract[]) => string;
@@ -0,0 +1,9 @@
1
+ import { type LanguageModel, type ToolExecutionResult, type ToolSet } from '@zhivex-ai/core';
2
+ import type { HarnessDelegationContract } from './delegation-contracts.js';
3
+ export declare const DELEGATION_FEEDBACK_TOOL = "__harness_result_feedback";
4
+ export declare const delegationCorrectionCount: (results: readonly ToolExecutionResult[]) => number;
5
+ /** Internal no-effect continuation lets SDK steps, journals, budgets and cancellation govern every retry. */
6
+ export declare function createDelegationCorrection(model: LanguageModel, contract: HarnessDelegationContract): {
7
+ model: LanguageModel;
8
+ tools: ToolSet;
9
+ };
@@ -0,0 +1,73 @@
1
+ import { z } from 'zod';
2
+ import { type AgentRunState, type AgentRunStore, type AgentStoreScope, type ToolExecutionResult } from '@zhivex-ai/core';
3
+ import type { HarnessDelegationContract } from './delegation-contracts.js';
4
+ export declare const delegationResultContractSchema: z.ZodObject<{
5
+ schemaVersion: z.ZodLiteral<1>;
6
+ requiredReadPaths: z.ZodArray<z.ZodString>;
7
+ humanReviewRequired: z.ZodBoolean;
8
+ maxCorrections: z.ZodNumber;
9
+ }, z.core.$strict>;
10
+ export type DelegationResultContract = Readonly<Omit<z.infer<typeof delegationResultContractSchema>, 'requiredReadPaths'> & {
11
+ requiredReadPaths: readonly string[];
12
+ }>;
13
+ export declare const delegationResultSchema: z.ZodObject<{
14
+ schemaVersion: z.ZodLiteral<1>;
15
+ taskId: z.ZodString;
16
+ status: z.ZodEnum<{
17
+ completed: "completed";
18
+ incomplete: "incomplete";
19
+ }>;
20
+ inspectedFiles: z.ZodArray<z.ZodObject<{
21
+ path: z.ZodString;
22
+ digest: z.ZodString;
23
+ evidence: z.ZodArray<z.ZodObject<{
24
+ toolCallId: z.ZodString;
25
+ startLine: z.ZodNumber;
26
+ endLine: z.ZodNumber;
27
+ }, z.core.$strict>>;
28
+ }, z.core.$strict>>;
29
+ findings: z.ZodArray<z.ZodObject<{
30
+ id: z.ZodString;
31
+ message: z.ZodString;
32
+ evidence: z.ZodArray<z.ZodObject<{
33
+ toolCallId: z.ZodString;
34
+ startLine: z.ZodNumber;
35
+ endLine: z.ZodNumber;
36
+ path: z.ZodString;
37
+ }, z.core.$strict>>;
38
+ }, z.core.$strict>>;
39
+ }, z.core.$strict>;
40
+ export type DelegationResult = z.infer<typeof delegationResultSchema>;
41
+ export type DelegationAcceptanceReason = 'valid' | 'invalid_json' | 'invalid_schema' | 'task_mismatch' | 'incomplete' | 'duplicate_claim' | 'path_denied' | 'evidence_missing' | 'coverage_missing';
42
+ export interface DelegationAcceptance {
43
+ schemaVersion: 1;
44
+ taskId: string;
45
+ accepted: boolean;
46
+ reason: DelegationAcceptanceReason;
47
+ semanticReview: 'pending' | 'not_requested';
48
+ result?: DelegationResult;
49
+ }
50
+ /** Receipts must come from the host's child state, never from the declared result. */
51
+ export declare function validateDelegationResult(contract: HarnessDelegationContract, text: string, toolResults: readonly ToolExecutionResult[]): DelegationAcceptance;
52
+ /** SDK outputText can concatenate narration from earlier tool steps; the final response owns the result. */
53
+ export declare const delegationTerminalText: (state: Pick<AgentRunState, 'steps' | 'outputText'>) => string;
54
+ /** Parent independently checks durable child evidence rather than trusting the child's prose. */
55
+ export declare function inspectDelegatedResults(state: AgentRunState, contracts: readonly HarnessDelegationContract[], store: AgentRunStore, defaultScope?: AgentStoreScope): Promise<({
56
+ taskId: string;
57
+ childRunId: null;
58
+ childStatus: string;
59
+ accepted: boolean;
60
+ reason: string;
61
+ semanticReview: string;
62
+ correctionsUsed?: never;
63
+ } | {
64
+ taskId: string;
65
+ childRunId: string;
66
+ childStatus: string;
67
+ accepted: boolean;
68
+ correctionsUsed: number;
69
+ reason: string;
70
+ semanticReview: "not_requested" | "pending";
71
+ })[]>;
72
+ /** Persist host-computed observations even when output guardrails receive SDK copies. */
73
+ export declare function delegationAcceptanceStore(store: AgentRunStore, contracts: readonly HarnessDelegationContract[], scope: AgentStoreScope): AgentRunStore;
@@ -99,6 +99,7 @@ export declare const benchmarkSpanSchema: z.ZodObject<{
99
99
  context_length_exceeded: "context_length_exceeded";
100
100
  invalid_request: "invalid_request";
101
101
  model_unavailable: "model_unavailable";
102
+ payment_required: "payment_required";
102
103
  permission: "permission";
103
104
  previous_response_unavailable: "previous_response_unavailable";
104
105
  rate_limit: "rate_limit";
@@ -177,6 +178,7 @@ export declare const benchmarkProgressSchema: z.ZodObject<{
177
178
  context_length_exceeded: "context_length_exceeded";
178
179
  invalid_request: "invalid_request";
179
180
  model_unavailable: "model_unavailable";
181
+ payment_required: "payment_required";
180
182
  permission: "permission";
181
183
  previous_response_unavailable: "previous_response_unavailable";
182
184
  rate_limit: "rate_limit";
@@ -275,6 +277,7 @@ export declare const benchmarkProgressSchema: z.ZodObject<{
275
277
  context_length_exceeded: "context_length_exceeded";
276
278
  invalid_request: "invalid_request";
277
279
  model_unavailable: "model_unavailable";
280
+ payment_required: "payment_required";
278
281
  permission: "permission";
279
282
  previous_response_unavailable: "previous_response_unavailable";
280
283
  rate_limit: "rate_limit";
@@ -454,6 +457,7 @@ export declare const errorDetailsSchema: z.ZodObject<{
454
457
  context_length_exceeded: "context_length_exceeded";
455
458
  invalid_request: "invalid_request";
456
459
  model_unavailable: "model_unavailable";
460
+ payment_required: "payment_required";
457
461
  permission: "permission";
458
462
  previous_response_unavailable: "previous_response_unavailable";
459
463
  rate_limit: "rate_limit";
@@ -552,6 +556,7 @@ export declare const errorDetailsSchema: z.ZodObject<{
552
556
  context_length_exceeded: "context_length_exceeded";
553
557
  invalid_request: "invalid_request";
554
558
  model_unavailable: "model_unavailable";
559
+ payment_required: "payment_required";
555
560
  permission: "permission";
556
561
  previous_response_unavailable: "previous_response_unavailable";
557
562
  rate_limit: "rate_limit";
@@ -667,6 +672,7 @@ export declare const errorDetailsSchema: z.ZodObject<{
667
672
  ZodError: "ZodError";
668
673
  }>>;
669
674
  checkpoint: z.ZodOptional<z.ZodEnum<{
675
+ continuity_phase: "continuity_phase";
670
676
  execution_approval_sequence: "execution_approval_sequence";
671
677
  execution_approval_tool: "execution_approval_tool";
672
678
  execution_command_arguments: "execution_command_arguments";
@@ -689,6 +695,8 @@ export declare const errorDetailsSchema: z.ZodObject<{
689
695
  request_persistence: "request_persistence";
690
696
  request_status: "request_status";
691
697
  resume_arguments: "resume_arguments";
698
+ resume_compaction: "resume_compaction";
699
+ resume_continuation: "resume_continuation";
692
700
  resume_effect: "resume_effect";
693
701
  resume_file_content: "resume_file_content";
694
702
  resume_file_read: "resume_file_read";
@@ -730,6 +738,7 @@ export declare const errorDetailsSchema: z.ZodObject<{
730
738
  context_length_exceeded: "context_length_exceeded";
731
739
  invalid_request: "invalid_request";
732
740
  model_unavailable: "model_unavailable";
741
+ payment_required: "payment_required";
733
742
  permission: "permission";
734
743
  previous_response_unavailable: "previous_response_unavailable";
735
744
  rate_limit: "rate_limit";
@@ -771,6 +780,21 @@ export declare const errorDetailsSchema: z.ZodObject<{
771
780
  contract: "contract";
772
781
  path: "path";
773
782
  }>>;
783
+ liveRunState: z.ZodOptional<z.ZodObject<{
784
+ status: z.ZodEnum<{
785
+ cancelled: "cancelled";
786
+ completed: "completed";
787
+ failed: "failed";
788
+ running: "running";
789
+ waiting_approval: "waiting_approval";
790
+ }>;
791
+ steps: z.ZodNumber;
792
+ maxSteps: z.ZodNumber;
793
+ pendingApprovals: z.ZodNumber;
794
+ toolResults: z.ZodNumber;
795
+ toolErrors: z.ZodNumber;
796
+ compactions: z.ZodNumber;
797
+ }, z.core.$strict>>;
774
798
  editEffect: z.ZodOptional<z.ZodObject<{
775
799
  resultReceipts: z.ZodNumber;
776
800
  errorReceipts: z.ZodNumber;
@@ -787,6 +811,68 @@ export declare const errorDetailsSchema: z.ZodObject<{
787
811
  shape: "shape";
788
812
  unknown_fields: "unknown_fields";
789
813
  }>>>;
814
+ executionArguments: z.ZodOptional<z.ZodObject<{
815
+ rootType: z.ZodEnum<{
816
+ array: "array";
817
+ boolean: "boolean";
818
+ null: "null";
819
+ number: "number";
820
+ object: "object";
821
+ string: "string";
822
+ undefined: "undefined";
823
+ }>;
824
+ commandPresent: z.ZodBoolean;
825
+ commandType: z.ZodEnum<{
826
+ array: "array";
827
+ boolean: "boolean";
828
+ null: "null";
829
+ number: "number";
830
+ object: "object";
831
+ string: "string";
832
+ undefined: "undefined";
833
+ }>;
834
+ commandMatchesExpected: z.ZodBoolean;
835
+ argsPresent: z.ZodBoolean;
836
+ argsType: z.ZodEnum<{
837
+ array: "array";
838
+ boolean: "boolean";
839
+ null: "null";
840
+ number: "number";
841
+ object: "object";
842
+ string: "string";
843
+ undefined: "undefined";
844
+ }>;
845
+ expectedArgCount: z.ZodNumber;
846
+ actualArgCount: z.ZodOptional<z.ZodNumber>;
847
+ extraArgCount: z.ZodNumber;
848
+ extraFieldCount: z.ZodNumber;
849
+ argumentMismatches: z.ZodArray<z.ZodObject<{
850
+ index: z.ZodNumber;
851
+ actualType: z.ZodEnum<{
852
+ array: "array";
853
+ boolean: "boolean";
854
+ null: "null";
855
+ number: "number";
856
+ object: "object";
857
+ string: "string";
858
+ undefined: "undefined";
859
+ }>;
860
+ matchesExpected: z.ZodBoolean;
861
+ nestedMemberCount: z.ZodOptional<z.ZodNumber>;
862
+ }, z.core.$strict>>;
863
+ }, z.core.$strict>>;
864
+ continuity: z.ZodOptional<z.ZodObject<{
865
+ phase: z.ZodNumber;
866
+ failedChecks: z.ZodArray<z.ZodEnum<{
867
+ codename: "codename";
868
+ compacted: "compacted";
869
+ compatibility: "compatibility";
870
+ completed: "completed";
871
+ noTools: "noTools";
872
+ objective: "objective";
873
+ rejectedApproach: "rejectedApproach";
874
+ }>>;
875
+ }, z.core.$strict>>;
790
876
  budget: z.ZodOptional<z.ZodObject<{
791
877
  budgetLimit: z.ZodEnum<{
792
878
  maxInputTokens: "maxInputTokens";