@zhivex-ai/harness 0.5.0

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.
@@ -0,0 +1,22 @@
1
+ import type { LanguageModel } from "@zhivex-ai/agents";
2
+ import type { HarnessRequiredCapability } from "./config.js";
3
+ export interface HarnessModelCapabilityReport {
4
+ provider: string;
5
+ model: string;
6
+ supportTier?: string;
7
+ capabilities: Record<HarnessRequiredCapability, boolean>;
8
+ }
9
+ export interface HarnessModelCandidate {
10
+ id?: string;
11
+ model: LanguageModel;
12
+ priority?: number;
13
+ }
14
+ export interface HarnessModelSelection {
15
+ id?: string;
16
+ model: LanguageModel;
17
+ report: HarnessModelCapabilityReport;
18
+ score: number;
19
+ }
20
+ export declare const inspectHarnessModelCapabilities: (model: LanguageModel) => HarnessModelCapabilityReport;
21
+ export declare const assertHarnessModelCapabilities: (model: LanguageModel, required: readonly HarnessRequiredCapability[], context?: string) => HarnessModelCapabilityReport;
22
+ export declare const selectHarnessModel: (candidates: readonly HarnessModelCandidate[], required: readonly HarnessRequiredCapability[]) => HarnessModelSelection;
package/dist/cli.d.ts ADDED
@@ -0,0 +1,191 @@
1
+ #!/usr/bin/env bun
2
+ import { type AgentApprovalRequest, type AgentRunOutput, type AgentStatus } from "@zhivex-ai/agents";
3
+ import { providerAvailability, resolveHarnessConfig, type HarnessProvider, type HarnessSubagentProfile } from "./config.js";
4
+ import { type ZhivexHarness } from "./harness.js";
5
+ export declare const CLI_JSON_SCHEMA_VERSION: 1;
6
+ export declare const CLI_EXIT_CODES: {
7
+ readonly success: 0;
8
+ readonly runtimeError: 1;
9
+ readonly usageError: 2;
10
+ readonly doctorFailed: 3;
11
+ };
12
+ type Command = "run" | "review" | "chat" | "providers" | "doctor" | "resume" | "runs" | "help" | "version";
13
+ type RunsCommand = "list" | "inspect" | "cancel" | "cleanup" | "export";
14
+ export interface CliOptions {
15
+ command: Command;
16
+ provider?: string;
17
+ model?: string;
18
+ workspace?: string;
19
+ stateDirectory?: string;
20
+ storeBackend?: string;
21
+ tenantId?: string;
22
+ userId?: string;
23
+ namespace?: string;
24
+ maxSteps?: number;
25
+ timeoutMs?: number;
26
+ maxToolCalls?: number;
27
+ maxToolErrors?: number;
28
+ maxInputTokens?: number;
29
+ maxOutputTokens?: number;
30
+ maxTotalTokens?: number;
31
+ maxCostUsd?: number;
32
+ inputCostPerMillion?: number;
33
+ outputCostPerMillion?: number;
34
+ allowedChecks?: string[];
35
+ requiredCapabilities?: string[];
36
+ subagentProfiles?: string[];
37
+ reviewers?: HarnessSubagentProfile[];
38
+ subagentMaxSteps?: number;
39
+ subagentMaxToolCalls?: number;
40
+ subagentMaxToolErrors?: number;
41
+ subagentMaxInputTokens?: number;
42
+ subagentMaxOutputTokens?: number;
43
+ subagentMaxTotalTokens?: number;
44
+ subagentTimeoutMs?: number;
45
+ maxParallelReviews?: number;
46
+ mcpConfigPath?: string;
47
+ prompt?: string;
48
+ runId?: string;
49
+ idempotencyKey?: string;
50
+ runsCommand?: RunsCommand;
51
+ statuses?: AgentStatus[];
52
+ limit?: number;
53
+ cursor?: string;
54
+ before?: number;
55
+ reason?: string;
56
+ cascade: boolean;
57
+ final: boolean;
58
+ yes: boolean;
59
+ approve?: boolean;
60
+ json: boolean;
61
+ }
62
+ export declare class CliUsageError extends Error {
63
+ constructor(message: string);
64
+ }
65
+ export declare const parseCliArgs: (argv: string[]) => CliOptions;
66
+ export declare const summarizeApproval: (approval: AgentApprovalRequest) => string;
67
+ export declare const runResultDocument: (result: AgentRunOutput, harness: ZhivexHarness) => {
68
+ scope: import("@zhivex-ai/core").AgentStoreScope | undefined;
69
+ capabilities: import("./capabilities.js").HarnessModelCapabilityReport;
70
+ orchestration: {
71
+ profiles: readonly ("explorer" | "implementer" | "tester" | "reviewer")[];
72
+ childBudget: import("./config.js").HarnessBudget;
73
+ mcpServers: string[];
74
+ };
75
+ store: {
76
+ backend: "sqlite" | "file";
77
+ stateDirectory: string;
78
+ migration: import("./operations.js").HarnessMigrationResult | undefined;
79
+ };
80
+ stateDirectory: string;
81
+ costBudget?: {
82
+ limitUsd: number;
83
+ estimate: import("@zhivex-ai/core").CostEstimate;
84
+ };
85
+ schemaVersion: 1;
86
+ kind: "run-result";
87
+ runId: string;
88
+ status: AgentStatus;
89
+ provider: string;
90
+ model: string;
91
+ output: string;
92
+ steps: number;
93
+ toolCalls: number;
94
+ mutations: readonly {
95
+ id: string;
96
+ operation: "create" | "update" | "move" | "quarantine" | "restore";
97
+ path: string;
98
+ timestamp: string;
99
+ destination?: string | undefined;
100
+ beforeDigest?: string | undefined;
101
+ afterDigest?: string | undefined;
102
+ quarantineId?: string | undefined;
103
+ }[];
104
+ pendingApprovals: {
105
+ childAgentId?: string;
106
+ childRunId?: string;
107
+ id: string;
108
+ kind: "provider" | "local-tool" | "subagent";
109
+ name: string;
110
+ arguments: string;
111
+ }[];
112
+ children: {
113
+ runId: string;
114
+ agentId: string | undefined;
115
+ toolName: string | undefined;
116
+ status: AgentStatus;
117
+ steps: number;
118
+ toolCalls: number;
119
+ toolErrors: number;
120
+ usage: import("@zhivex-ai/core").TokenUsage | undefined;
121
+ }[];
122
+ usage: import("@zhivex-ai/core").TokenUsage | undefined;
123
+ budget: import("@zhivex-ai/core").AgentBudgetStatus;
124
+ };
125
+ export declare const providersDocument: (env?: NodeJS.ProcessEnv) => {
126
+ schemaVersion: 1;
127
+ kind: "providers";
128
+ providers: {
129
+ configured: boolean;
130
+ credentials: {
131
+ name: string;
132
+ present: boolean;
133
+ }[];
134
+ configuration: {
135
+ workspaceIdConfigured?: boolean;
136
+ regionConfigured?: boolean;
137
+ regionValid?: boolean;
138
+ customEndpoint: boolean;
139
+ endpointValid: boolean;
140
+ endpointSecure: boolean;
141
+ };
142
+ id: HarnessProvider;
143
+ name: string;
144
+ defaultModel: string;
145
+ credentialNames: readonly string[];
146
+ capabilities: readonly import("./config.js").ProviderCapability[];
147
+ support: import("./config.js").ProviderSupport;
148
+ }[];
149
+ };
150
+ export type DoctorCheckStatus = "pass" | "warn" | "fail";
151
+ export interface DoctorCheck {
152
+ id: string;
153
+ status: DoctorCheckStatus;
154
+ message: string;
155
+ details: Record<string, boolean | number | string | readonly string[]>;
156
+ }
157
+ export interface DoctorReport {
158
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
159
+ kind: "doctor";
160
+ ok: boolean;
161
+ harnessVersion: string;
162
+ configSchemaVersion: number;
163
+ configuration: {
164
+ provider: HarnessProvider;
165
+ model: string;
166
+ workspace: string;
167
+ stateDirectory: string;
168
+ storeBackend: string;
169
+ scope: ReturnType<typeof resolveHarnessConfig>["scope"];
170
+ maxSteps: number;
171
+ timeoutMs: number;
172
+ budget: ReturnType<typeof resolveHarnessConfig>["budget"];
173
+ costBudget?: ReturnType<typeof resolveHarnessConfig>["costBudget"];
174
+ compaction: ReturnType<typeof resolveHarnessConfig>["compaction"];
175
+ allowedChecks: readonly string[];
176
+ requiredCapabilities: ReturnType<typeof resolveHarnessConfig>["requiredCapabilities"];
177
+ orchestration: ReturnType<typeof resolveHarnessConfig>["orchestration"];
178
+ mcpConfigPath?: string;
179
+ };
180
+ checks: DoctorCheck[];
181
+ providers: ReturnType<typeof providerAvailability>;
182
+ }
183
+ export interface DoctorContext {
184
+ env?: NodeJS.ProcessEnv;
185
+ bunVersion?: string;
186
+ }
187
+ export declare const createDoctorReport: (options?: Pick<CliOptions, "provider" | "model" | "workspace" | "stateDirectory" | "storeBackend" | "tenantId" | "userId" | "namespace" | "maxSteps" | "timeoutMs" | "maxToolCalls" | "maxToolErrors" | "maxInputTokens" | "maxOutputTokens" | "maxTotalTokens" | "maxCostUsd" | "inputCostPerMillion" | "outputCostPerMillion" | "allowedChecks" | "requiredCapabilities" | "subagentProfiles" | "subagentMaxSteps" | "subagentMaxToolCalls" | "subagentMaxToolErrors" | "subagentMaxInputTokens" | "subagentMaxOutputTokens" | "subagentMaxTotalTokens" | "subagentTimeoutMs" | "maxParallelReviews" | "mcpConfigPath">, context?: DoctorContext) => Promise<DoctorReport>;
188
+ export declare const formatDoctorReport: (report: DoctorReport) => string;
189
+ export declare const cliExitCodeForError: (error: unknown) => 2 | 1;
190
+ export declare const main: (argv?: string[]) => Promise<void>;
191
+ export {};