@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.
- package/CHANGELOG.md +109 -0
- package/README.md +6 -3
- package/contracts/public-api.json +7 -0
- package/contracts/stable-api-signatures.json +29 -29
- package/dist/{approval-diff.d.ts → approvals/approval-diff.d.ts} +1 -1
- package/dist/{approval-preview.d.ts → approvals/approval-preview.d.ts} +3 -3
- package/dist/cli/arguments.d.ts +105 -0
- package/dist/cli/changes.d.ts +2 -0
- package/dist/{cli-credentials.d.ts → cli/cli-credentials.d.ts} +14 -2
- package/dist/{cli-options.d.ts → cli/cli-options.d.ts} +1 -1
- package/dist/{cli-profiles.d.ts → cli/cli-profiles.d.ts} +17 -1
- package/dist/{cli-stream.d.ts → cli/cli-stream.d.ts} +3 -3
- package/dist/cli/configured-harness.d.ts +12 -0
- package/dist/{console-context.d.ts → cli/console/console-context.d.ts} +2 -2
- package/dist/cli/console/console-model-catalog.d.ts +8 -0
- package/dist/{console-navigation.d.ts → cli/console/console-navigation.d.ts} +4 -2
- package/dist/cli/console.d.ts +2 -0
- package/dist/cli/doctor.d.ts +52 -0
- package/dist/cli/errors.d.ts +8 -0
- package/dist/cli/help-text.d.ts +2 -0
- package/dist/cli/presentation.d.ts +23 -0
- package/dist/cli/resume-metadata.d.ts +12 -0
- package/dist/cli/routing.d.ts +6 -0
- package/dist/cli/run-commands.d.ts +4 -0
- package/dist/{run-document.d.ts → cli/run-document.d.ts} +9 -9
- package/dist/cli/run-management.d.ts +2 -0
- package/dist/{service-client-cli.d.ts → cli/service-client-cli.d.ts} +1 -1
- package/dist/cli/session-management.d.ts +8 -0
- package/dist/cli/setup.d.ts +10 -0
- package/dist/cli/state.d.ts +2 -0
- package/dist/cli/task-input.d.ts +6 -0
- package/dist/{terminal-ui.d.ts → cli/terminal/terminal-ui.d.ts} +2 -0
- package/dist/cli/terminal/tool-activity.d.ts +19 -0
- package/dist/cli.d.ts +32 -184
- package/dist/cli.js +11577 -10275
- package/dist/client/adapter.d.ts +4 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/{json-contracts.d.ts → client/json-contracts.d.ts} +6 -0
- package/dist/{local-service.d.ts → client/local-service.d.ts} +2 -2
- package/dist/{client-contract.d.ts → client/protocol.d.ts} +3 -6
- package/dist/{service-events.d.ts → client/service-events.d.ts} +1 -1
- package/dist/context/adaptive-compaction.d.ts +16 -0
- package/dist/{compaction.d.ts → context/compaction.d.ts} +1 -1
- package/dist/{context-engineering.d.ts → context/context-engineering.d.ts} +2 -2
- package/dist/{context-metrics.d.ts → context/context-metrics.d.ts} +2 -0
- package/dist/{task-memory.d.ts → context/task-memory.d.ts} +2 -2
- package/dist/{execution-environment.d.ts → execution/execution-environment.d.ts} +4 -4
- package/dist/hostile-repository-demo.js +1276 -447
- package/dist/index.d.ts +49 -48
- package/dist/index.js +2117 -1096
- package/dist/internal/desktop/persistence.d.ts +14 -0
- package/dist/internal/desktop/protocol.d.ts +8 -0
- package/dist/internal/desktop/providers.d.ts +9 -0
- package/dist/internal/desktop/runtime.d.ts +7 -0
- package/dist/models/catalog-store.d.ts +15 -0
- package/dist/models/catalog.d.ts +74 -0
- package/dist/{operations.d.ts → persistence/operations.d.ts} +2 -1
- package/dist/{state-backup.d.ts → persistence/state-backup.d.ts} +1 -1
- package/dist/{capabilities.d.ts → providers/capabilities.d.ts} +1 -1
- package/dist/providers/meta-continuation.d.ts +1 -0
- package/dist/{providers.d.ts → providers/providers.d.ts} +4 -0
- package/dist/{routing.d.ts → providers/routing.d.ts} +1 -1
- package/dist/{config.d.ts → runtime/config.d.ts} +5 -1
- package/dist/runtime/delegation-contracts.d.ts +23 -0
- package/dist/runtime/error-diagnostics.d.ts +186 -0
- package/dist/{harness.d.ts → runtime/harness.d.ts} +13 -135
- package/dist/{orchestration.d.ts → runtime/orchestration.d.ts} +2 -0
- package/dist/{runtime-diagnostics.d.ts → runtime/runtime-diagnostics.d.ts} +1 -0
- package/dist/{runtime-policy.d.ts → runtime/runtime-policy.d.ts} +21 -5
- package/dist/{time-to-safe-fix.d.ts → runtime/time-to-safe-fix.d.ts} +149 -0
- package/dist/service-cli.js +1473 -583
- package/dist/tools/execution.d.ts +47 -0
- package/dist/tools/shared.d.ts +67 -0
- package/dist/tools/workspace.d.ts +85 -0
- package/dist/verify-historical-migrations.js +1451 -622
- package/dist/zhx.js +11577 -10275
- package/docs/CLI.md +56 -2
- package/docs/CONTEXT_ENGINEERING.md +29 -2
- package/docs/CREDENTIALS.md +16 -6
- package/docs/DURABLE_OPERATIONS.md +6 -0
- package/docs/EXTENSIBILITY.md +58 -1
- package/docs/FIRST_USE.md +25 -12
- package/docs/MODEL_CATALOG.md +48 -0
- package/docs/README.md +1 -0
- package/docs/THREAT_MODEL.md +1 -1
- package/docs/TIME_TO_SAFE_FIX.md +2 -0
- package/docs/USAGE.md +3 -3
- package/evaluations/representative-assembly-matrix.json +91 -1
- package/examples/README.md +3 -3
- package/package.json +18 -11
- package/dist/console-model-catalog.d.ts +0 -25
- /package/dist/{approval-history.d.ts → approvals/approval-history.d.ts} +0 -0
- /package/dist/{cli-help.d.ts → cli/cli-help.d.ts} +0 -0
- /package/dist/{console-commands.d.ts → cli/console/console-commands.d.ts} +0 -0
- /package/dist/{console-input.d.ts → cli/console/console-input.d.ts} +0 -0
- /package/dist/{console-presentation.d.ts → cli/console/console-presentation.d.ts} +0 -0
- /package/dist/{console-welcome.d.ts → cli/console/console-welcome.d.ts} +0 -0
- /package/dist/{terminal-continuation.d.ts → cli/terminal/terminal-continuation.d.ts} +0 -0
- /package/dist/{terminal-markdown.d.ts → cli/terminal/terminal-markdown.d.ts} +0 -0
- /package/dist/{package-manager.d.ts → execution/package-manager.d.ts} +0 -0
- /package/dist/{process-runtime.d.ts → execution/process-runtime.d.ts} +0 -0
- /package/dist/{mcp.d.ts → integrations/mcp.d.ts} +0 -0
- /package/dist/{persistence-secrets.d.ts → persistence/persistence-secrets.d.ts} +0 -0
- /package/dist/{recorded-workspace.d.ts → persistence/recorded-workspace.d.ts} +0 -0
- /package/dist/{sessions.d.ts → persistence/sessions.d.ts} +0 -0
- /package/dist/{sqlite-access.d.ts → persistence/sqlite-access.d.ts} +0 -0
- /package/dist/{sqlite-database.d.ts → persistence/sqlite-database.d.ts} +0 -0
- /package/dist/{state-directory.d.ts → persistence/state-directory.d.ts} +0 -0
- /package/dist/{errors.d.ts → runtime/errors.d.ts} +0 -0
- /package/dist/{model-budget.d.ts → runtime/model-budget.d.ts} +0 -0
- /package/dist/{repair-controller.d.ts → runtime/repair-controller.d.ts} +0 -0
- /package/dist/{repair-progress.d.ts → runtime/repair-progress.d.ts} +0 -0
- /package/dist/{repair-verifier.d.ts → runtime/repair-verifier.d.ts} +0 -0
- /package/dist/{run-interruption.d.ts → runtime/run-interruption.d.ts} +0 -0
- /package/dist/{runtime-checkpoints.d.ts → runtime/runtime-checkpoints.d.ts} +0 -0
- /package/dist/{usage-ledger.d.ts → runtime/usage-ledger.d.ts} +0 -0
- /package/dist/{tool-registry.d.ts → tools/tool-registry.d.ts} +0 -0
- /package/dist/{bounded-reads.d.ts → workspace/bounded-reads.d.ts} +0 -0
- /package/dist/{change-envelope.d.ts → workspace/change-envelope.d.ts} +0 -0
- /package/dist/{edit-contracts.d.ts → workspace/edit-contracts.d.ts} +0 -0
- /package/dist/{file-security.d.ts → workspace/file-security.d.ts} +0 -0
- /package/dist/{replacement-edits.d.ts → workspace/replacement-edits.d.ts} +0 -0
- /package/dist/{workspace-mutation-lock.d.ts → workspace/workspace-mutation-lock.d.ts} +0 -0
- /package/dist/{workspace.d.ts → workspace/workspace.d.ts} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CliCredentials } from "./cli-credentials.js";
|
|
2
|
+
import { ConsoleInput } from "./console/console-input.js";
|
|
3
|
+
import { type HarnessSubagentProfile } from "../runtime/config.js";
|
|
4
|
+
import { type HarnessModelRoute } from "../providers/routing.js";
|
|
5
|
+
import { type CliOptions } from "./arguments.js";
|
|
6
|
+
export declare const createConfiguredHarness: (options: CliOptions, extraProfiles?: readonly HarnessSubagentProfile[], persistedRoutes?: ReadonlyMap<HarnessSubagentProfile, HarnessModelRoute>, credentials?: {
|
|
7
|
+
store: CliCredentials;
|
|
8
|
+
input: ConsoleInput;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
harness: import("../index.js").ZhivexHarness;
|
|
11
|
+
routes: ReadonlyMap<"explorer" | "implementer" | "reviewer" | "tester", HarnessModelRoute>;
|
|
12
|
+
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ZhivexHarness } from "
|
|
2
|
-
import type { Workspace } from "
|
|
1
|
+
import type { ZhivexHarness } from "../../runtime/harness.js";
|
|
2
|
+
import type { Workspace } from "../../workspace/workspace.js";
|
|
3
3
|
export declare const formatConsoleContext: (context: ZhivexHarness["context"], options?: {
|
|
4
4
|
attachments: ReturnType<ConsoleAttachments["list"]>;
|
|
5
5
|
config: ZhivexHarness["config"];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ConsoleInput } from "./console-input.js";
|
|
2
|
-
import type
|
|
3
|
-
|
|
2
|
+
import { type ModelCatalog } from "../../models/catalog.js";
|
|
3
|
+
import type { ProviderAvailability } from "../../providers/providers.js";
|
|
4
|
+
export declare const consoleModelChoices: (provider: string, defaultModel: string, current?: string, catalog?: ModelCatalog) => {
|
|
4
5
|
value: string;
|
|
5
6
|
label: string;
|
|
7
|
+
group: "other" | "primary";
|
|
6
8
|
detail: string;
|
|
7
9
|
}[];
|
|
8
10
|
export type ConsoleNavigationResult = {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type CredentialStatus } from "./cli-credentials.js";
|
|
2
|
+
import { providerAvailability, resolveHarnessConfig, type HarnessProvider } from "../runtime/config.js";
|
|
3
|
+
import { type HarnessOciRuntimeAdapter } from "../execution/execution-environment.js";
|
|
4
|
+
import { CLI_JSON_SCHEMA_VERSION } from "./cli-stream.js";
|
|
5
|
+
export type DoctorCheckStatus = "pass" | "warn" | "fail";
|
|
6
|
+
export interface DoctorCheck {
|
|
7
|
+
id: string;
|
|
8
|
+
status: DoctorCheckStatus;
|
|
9
|
+
message: string;
|
|
10
|
+
details: Record<string, boolean | number | string | readonly string[]>;
|
|
11
|
+
}
|
|
12
|
+
import { type CliOptions } from "./arguments.js";
|
|
13
|
+
export interface DoctorReport {
|
|
14
|
+
schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
|
|
15
|
+
kind: "doctor";
|
|
16
|
+
ok: boolean;
|
|
17
|
+
harnessVersion: string;
|
|
18
|
+
configSchemaVersion: number;
|
|
19
|
+
configuration: {
|
|
20
|
+
provider: HarnessProvider;
|
|
21
|
+
model: string;
|
|
22
|
+
workspace: string;
|
|
23
|
+
stateDirectory: string;
|
|
24
|
+
storeBackend: string;
|
|
25
|
+
scope: ReturnType<typeof resolveHarnessConfig>["scope"];
|
|
26
|
+
maxSteps: number;
|
|
27
|
+
timeoutMs: number;
|
|
28
|
+
agentProfile: "strict" | "repair";
|
|
29
|
+
budget: ReturnType<typeof resolveHarnessConfig>["budget"];
|
|
30
|
+
costBudget?: ReturnType<typeof resolveHarnessConfig>["costBudget"];
|
|
31
|
+
compaction: ReturnType<typeof resolveHarnessConfig>["compaction"];
|
|
32
|
+
allowedChecks: readonly string[];
|
|
33
|
+
requiredCapabilities: ReturnType<typeof resolveHarnessConfig>["requiredCapabilities"];
|
|
34
|
+
orchestration: ReturnType<typeof resolveHarnessConfig>["orchestration"];
|
|
35
|
+
context: ReturnType<typeof resolveHarnessConfig>["context"];
|
|
36
|
+
execution: ReturnType<typeof resolveHarnessConfig>["execution"];
|
|
37
|
+
mcpConfigPath?: string;
|
|
38
|
+
};
|
|
39
|
+
checks: DoctorCheck[];
|
|
40
|
+
providers: ReturnType<typeof providerAvailability>;
|
|
41
|
+
}
|
|
42
|
+
export interface DoctorContext {
|
|
43
|
+
env?: NodeJS.ProcessEnv;
|
|
44
|
+
credentialStatus?: CredentialStatus;
|
|
45
|
+
nodeVersion?: string;
|
|
46
|
+
/** @deprecated Test-only compatibility injection for the secondary Bun runtime. */
|
|
47
|
+
bunVersion?: string;
|
|
48
|
+
ociRuntimeAdapter?: HarnessOciRuntimeAdapter;
|
|
49
|
+
}
|
|
50
|
+
export declare const createDoctorReport: (options?: Pick<CliOptions, "provider" | "model" | "workspace" | "stateDirectory" | "storeBackend" | "tenantId" | "userId" | "namespace" | "maxSteps" | "agentProfile" | "timeoutMs" | "maxToolCalls" | "maxToolErrors" | "unlimitedTokens" | "maxInputTokens" | "maxOutputTokens" | "maxTotalTokens" | "maxCostUsd" | "inputCostPerMillion" | "outputCostPerMillion" | "allowedChecks" | "requiredCapabilities" | "subagentProfiles" | "subagentMaxSteps" | "subagentMaxToolCalls" | "subagentMaxToolErrors" | "subagentMaxInputTokens" | "subagentMaxOutputTokens" | "subagentMaxTotalTokens" | "subagentTimeoutMs" | "maxParallelReviews" | "executionBackend" | "ociRuntime" | "ociImage" | "ociAllowedCommands" | "ociShellMode" | "ociMaxProcessRuntimeMs" | "ociMaxProcessOutputBytes" | "ociMaxMemoryMb" | "ociMaxPids" | "ociMaxCpus" | "ociMaxWorkspaceBytes" | "ociMaxFileWriteBytes" | "ociTmpfsMb" | "mcpConfigPath" | "contextConfigPath" | "projectContext">, context?: DoctorContext) => Promise<DoctorReport>;
|
|
51
|
+
export declare const formatDoctorReport: (report: DoctorReport) => string;
|
|
52
|
+
export declare const doctor: (options: CliOptions) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const cliRecoveryHint: (error: unknown, argv: string[]) => string;
|
|
2
|
+
export declare const CLI_EXIT_CODES: {
|
|
3
|
+
readonly success: 0;
|
|
4
|
+
readonly runtimeError: 1;
|
|
5
|
+
readonly usageError: 2;
|
|
6
|
+
readonly doctorFailed: 3;
|
|
7
|
+
};
|
|
8
|
+
export declare const cliExitCodeForError: (error: unknown) => 1 | 2;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TerminalMarkdown } from "./terminal/terminal-markdown.js";
|
|
2
|
+
import { type AgentApprovalRequest, type AgentApprovalResponse, type AgentRunOutput, type AgentStreamEvent } from "@zhivex-ai/agents";
|
|
3
|
+
import { type HarnessRunOptions, type ZhivexHarness } from "../runtime/harness.js";
|
|
4
|
+
import { type AgentTelemetryObserver } from "@zhivex-ai/agents/ops";
|
|
5
|
+
import { type CliOptions } from "./arguments.js";
|
|
6
|
+
export declare const annotateCliStreamError: (error: unknown, lastSequence: number | undefined) => Error;
|
|
7
|
+
export declare const cliStreamErrorSequence: (error: unknown) => number;
|
|
8
|
+
export declare const terminalErrorMessage: (error: unknown) => string;
|
|
9
|
+
export declare const summarizeApproval: (approval: AgentApprovalRequest) => string;
|
|
10
|
+
export declare const approvalResponses: (approvals: readonly AgentApprovalRequest[], approve: boolean, reason: string) => AgentApprovalResponse[];
|
|
11
|
+
export declare const terminalApprovalResolver: (automaticallyApprove: boolean, ask?: (question: string) => Promise<string>) => NonNullable<HarnessRunOptions["resolveApprovals"]>;
|
|
12
|
+
export declare const printTerminalResult: (result: AgentRunOutput, harness: ZhivexHarness, output: Pick<CliOptions, "json" | "jsonl">, tracker: {
|
|
13
|
+
streamedText: boolean;
|
|
14
|
+
sequence?: number;
|
|
15
|
+
markdown?: TerminalMarkdown;
|
|
16
|
+
}) => void;
|
|
17
|
+
export declare const flushToolActivity: (tracker: object) => void | undefined;
|
|
18
|
+
export declare const streamSink: (output: Pick<CliOptions, "json" | "jsonl">, tracker: {
|
|
19
|
+
streamedText: boolean;
|
|
20
|
+
sequence?: number;
|
|
21
|
+
markdown?: TerminalMarkdown;
|
|
22
|
+
}, compact?: boolean) => (event: AgentStreamEvent) => Promise<void>;
|
|
23
|
+
export declare const orchestrationObserver: (json: boolean) => AgentTelemetryObserver;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AgentRunInput, type AgentRunState } from "@zhivex-ai/agents";
|
|
2
|
+
import { type HarnessConfig, type HarnessConfigInput, type HarnessSubagentProfile } from "../runtime/config.js";
|
|
3
|
+
import { type HarnessModelRoute } from "../providers/routing.js";
|
|
4
|
+
import { type CliOptions } from "./arguments.js";
|
|
5
|
+
export declare const HARNESS_RESUME_METADATA_KEY: "zhivexHarnessResume";
|
|
6
|
+
export declare const HARNESS_RESUME_METADATA_SCHEMA_VERSION: 1;
|
|
7
|
+
export declare const harnessConfigInput: (config: HarnessConfig) => HarnessConfigInput;
|
|
8
|
+
export declare const persistedCliOptions: (input: HarnessConfigInput | undefined) => Partial<CliOptions>;
|
|
9
|
+
export declare const createHarnessResumeMetadata: (config: HarnessConfig, routes?: ReadonlyMap<HarnessSubagentProfile, HarnessModelRoute>) => NonNullable<AgentRunInput["metadata"]>;
|
|
10
|
+
export declare const readHarnessResumeConfig: (state: Pick<AgentRunState, "metadata">) => HarnessConfigInput | undefined;
|
|
11
|
+
export declare const readHarnessResumeRoutes: (state: Pick<AgentRunState, "metadata">) => Map<"explorer" | "implementer" | "reviewer" | "tester", HarnessModelRoute>;
|
|
12
|
+
export declare const resumeCommand: (runId: string, config: HarnessConfig, approve?: boolean) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type HarnessConfig, type HarnessSubagentProfile } from "../runtime/config.js";
|
|
2
|
+
import { type HarnessModelRoute } from "../providers/routing.js";
|
|
3
|
+
import { type CliOptions } from "./arguments.js";
|
|
4
|
+
export declare const resolvedRouting: (options: CliOptions) => Map<"explorer" | "implementer" | "reviewer" | "tester", HarnessModelRoute>;
|
|
5
|
+
export declare const assertRoutePricingIsSafe: (routes: ReadonlyMap<HarnessSubagentProfile, HarnessModelRoute>, costBudget: HarnessConfig["costBudget"]) => void;
|
|
6
|
+
export declare const withTemporaryHarnessProfiles: <T>(profiles: readonly HarnessSubagentProfile[], configure: (profiles: readonly HarnessSubagentProfile[]) => Promise<void>, operation: () => Promise<T>) => Promise<T>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type AgentRunOutput } from "@zhivex-ai/agents";
|
|
2
|
-
import type { ZhivexHarness } from "
|
|
2
|
+
import type { ZhivexHarness } from "../runtime/harness.js";
|
|
3
3
|
export declare const runResultDocument: (result: AgentRunOutput, harness: ZhivexHarness) => {
|
|
4
4
|
schemaVersion: 1;
|
|
5
5
|
kind: "run-result";
|
|
6
6
|
runId: string;
|
|
7
|
-
status: import("@zhivex-ai/
|
|
7
|
+
status: import("@zhivex-ai/agents").AgentStatus;
|
|
8
8
|
provider: string;
|
|
9
9
|
model: string;
|
|
10
10
|
output: string;
|
|
@@ -32,7 +32,7 @@ export declare const runResultDocument: (result: AgentRunOutput, harness: Zhivex
|
|
|
32
32
|
runId: string;
|
|
33
33
|
agentId: string | undefined;
|
|
34
34
|
toolName: string | undefined;
|
|
35
|
-
status: import("@zhivex-ai/
|
|
35
|
+
status: import("@zhivex-ai/agents").AgentStatus;
|
|
36
36
|
steps: number;
|
|
37
37
|
toolCalls: number;
|
|
38
38
|
toolErrors: number;
|
|
@@ -61,22 +61,22 @@ export declare const runResultDocument: (result: AgentRunOutput, harness: Zhivex
|
|
|
61
61
|
priceStatuses: ("estimate" | "missing" | "stale")[];
|
|
62
62
|
}[];
|
|
63
63
|
} | null;
|
|
64
|
-
budget: import("@zhivex-ai/
|
|
64
|
+
budget: import("@zhivex-ai/agents").AgentBudgetStatus;
|
|
65
65
|
costBudget?: {
|
|
66
66
|
limitUsd: number;
|
|
67
67
|
estimate: import("@zhivex-ai/core").CostEstimate;
|
|
68
68
|
};
|
|
69
69
|
scope: import("@zhivex-ai/core").AgentStoreScope | undefined;
|
|
70
|
-
capabilities: import("
|
|
70
|
+
capabilities: import("../index.js").HarnessModelCapabilityReport;
|
|
71
71
|
orchestration: {
|
|
72
72
|
profiles: readonly ("explorer" | "implementer" | "reviewer" | "tester")[];
|
|
73
|
-
childBudget: import("
|
|
73
|
+
childBudget: import("../index.js").HarnessBudget;
|
|
74
74
|
mcpServers: string[];
|
|
75
75
|
};
|
|
76
76
|
execution: {
|
|
77
77
|
backend: "oci";
|
|
78
|
-
binding: import("@zhivex-ai/
|
|
79
|
-
image: import("
|
|
78
|
+
binding: import("@zhivex-ai/agents").AgentExecutionEnvironmentBinding | undefined;
|
|
79
|
+
image: import("../index.js").OciImageInspection;
|
|
80
80
|
} | {
|
|
81
81
|
binding?: never;
|
|
82
82
|
image?: never;
|
|
@@ -85,7 +85,7 @@ export declare const runResultDocument: (result: AgentRunOutput, harness: Zhivex
|
|
|
85
85
|
store: {
|
|
86
86
|
backend: "file" | "sqlite";
|
|
87
87
|
stateDirectory: string;
|
|
88
|
-
migration: import("
|
|
88
|
+
migration: import("../index.js").HarnessMigrationResult | undefined;
|
|
89
89
|
};
|
|
90
90
|
stateDirectory: string;
|
|
91
91
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CliOptions } from "./
|
|
1
|
+
import type { CliOptions } from "./arguments.js";
|
|
2
2
|
export declare const runServiceCli: (options: CliOptions, annotate: (error: unknown, sequence: number) => Error) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type AgentStatus } from "@zhivex-ai/agents";
|
|
2
|
+
import { type HarnessConfig } from "../runtime/config.js";
|
|
3
|
+
import { type SessionRunStatus } from "../persistence/sessions.js";
|
|
4
|
+
import { type CliOptions } from "./arguments.js";
|
|
5
|
+
export declare const openSessionStoreForConfig: (config: HarnessConfig) => Promise<import("../index.js").CliSessionStore>;
|
|
6
|
+
export declare const manageSessions: (options: CliOptions) => Promise<void>;
|
|
7
|
+
export declare const sessionStatus: (status: AgentStatus) => SessionRunStatus;
|
|
8
|
+
export declare const updateIndexedSessionRun: (config: HarnessConfig, runId: string, status: AgentStatus) => Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CliOptions } from "./arguments.js";
|
|
2
|
+
export declare const providersDocument: (env?: NodeJS.ProcessEnv) => {
|
|
3
|
+
schemaVersion: 1;
|
|
4
|
+
kind: "providers";
|
|
5
|
+
providers: readonly import("../index.js").ProviderAvailability[];
|
|
6
|
+
};
|
|
7
|
+
export declare const initializeCli: (options: CliOptions, context?: {
|
|
8
|
+
onboarding?: boolean;
|
|
9
|
+
}) => Promise<boolean>;
|
|
10
|
+
export declare const listProviders: (json: boolean) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Readable } from "node:stream";
|
|
2
|
+
export declare const MAX_STDIN_TASK_BYTES: number;
|
|
3
|
+
/** Stdin is opt-in and is consumed before constructing a provider or opening state. */
|
|
4
|
+
export declare function readStdinTask(input?: Readable & {
|
|
5
|
+
isTTY?: boolean;
|
|
6
|
+
}): Promise<string>;
|
|
@@ -42,6 +42,8 @@ export declare const formatVerificationSummary: (results: readonly {
|
|
|
42
42
|
* Produce a compact activity line from a redacted event subset. Tool inputs,
|
|
43
43
|
* outputs, provider payloads, repository text, and raw errors are never read.
|
|
44
44
|
*/
|
|
45
|
+
/** Only known runtime diagnostics are projected; provider payloads remain private. */
|
|
46
|
+
export declare const terminalRunFailure: (error: unknown) => string;
|
|
45
47
|
export declare const formatTerminalEvent: (event: AgentStreamEvent, options?: TerminalAppearanceOptions) => string | undefined;
|
|
46
48
|
export interface TerminalHeaderInput {
|
|
47
49
|
version: string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A bounded activity line; transcript entries are committed only at message boundaries. */
|
|
2
|
+
export declare class ToolActivity {
|
|
3
|
+
private write;
|
|
4
|
+
private tty;
|
|
5
|
+
private columns;
|
|
6
|
+
private completed;
|
|
7
|
+
private active;
|
|
8
|
+
private visible;
|
|
9
|
+
private dirty;
|
|
10
|
+
private reads;
|
|
11
|
+
private searches;
|
|
12
|
+
private other;
|
|
13
|
+
constructor(write: (text: string) => void, tty: boolean, columns?: () => number);
|
|
14
|
+
start(): void;
|
|
15
|
+
finish(name: string): void;
|
|
16
|
+
private line;
|
|
17
|
+
private render;
|
|
18
|
+
flush(): void;
|
|
19
|
+
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,186 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { runResultDocument } from "./run-document.js";
|
|
3
|
-
|
|
4
|
-
import { providerAvailability, resolveHarnessConfig, type HarnessConfig, type HarnessConfigInput, type HarnessProvider, type HarnessSubagentProfile } from "./config.js";
|
|
5
|
-
import { type HarnessOciRuntimeAdapter } from "./execution-environment.js";
|
|
6
|
-
import { type HarnessModelRoute } from "./routing.js";
|
|
7
|
-
import { CLI_JSON_SCHEMA_VERSION } from "./cli-stream.js";
|
|
8
|
-
import { HarnessError } from "./errors.js";
|
|
9
|
-
export { CLI_JSON_SCHEMA_VERSION } from "./cli-stream.js";
|
|
10
|
-
export declare const HARNESS_RESUME_METADATA_KEY: "zhivexHarnessResume";
|
|
11
|
-
export declare const HARNESS_RESUME_METADATA_SCHEMA_VERSION: 1;
|
|
12
|
-
export declare const CLI_EXIT_CODES: {
|
|
13
|
-
readonly success: 0;
|
|
14
|
-
readonly runtimeError: 1;
|
|
15
|
-
readonly usageError: 2;
|
|
16
|
-
readonly doctorFailed: 3;
|
|
17
|
-
};
|
|
18
|
-
export declare const annotateCliStreamError: (error: unknown, lastSequence: number | undefined) => Error;
|
|
19
|
-
export declare const cliStreamErrorSequence: (error: unknown) => number;
|
|
20
|
-
export declare const terminalErrorMessage: (error: unknown) => string;
|
|
21
|
-
export declare const CLI_COMMANDS: readonly ["init", "run", "review", "chat", "providers", "doctor", "resume", "runs", "sessions", "changes", "state", "help", "version"];
|
|
22
|
-
export declare const CLI_RUNS_COMMANDS: readonly ["list", "inspect", "cancel", "cleanup", "export"];
|
|
23
|
-
export declare const CLI_SESSIONS_COMMANDS: readonly ["list", "inspect", "rename", "fork", "archive"];
|
|
24
|
-
export declare const CLI_CHANGES_COMMANDS: readonly ["create", "verify"];
|
|
25
|
-
export declare const CLI_STATE_COMMANDS: readonly ["status", "export", "import"];
|
|
26
|
-
type Command = (typeof CLI_COMMANDS)[number];
|
|
27
|
-
type RunsCommand = (typeof CLI_RUNS_COMMANDS)[number];
|
|
28
|
-
type SessionsCommand = (typeof CLI_SESSIONS_COMMANDS)[number];
|
|
29
|
-
type ChangesCommand = (typeof CLI_CHANGES_COMMANDS)[number];
|
|
30
|
-
type StateCommand = (typeof CLI_STATE_COMMANDS)[number];
|
|
31
|
-
export interface CliOptions {
|
|
32
|
-
serviceFile?: string;
|
|
33
|
-
command: Command;
|
|
34
|
-
helpTopic?: string;
|
|
35
|
-
profile?: string;
|
|
36
|
-
provider?: string;
|
|
37
|
-
model?: string;
|
|
38
|
-
workspace?: string;
|
|
39
|
-
stateDirectory?: string;
|
|
40
|
-
storeBackend?: string;
|
|
41
|
-
tenantId?: string;
|
|
42
|
-
userId?: string;
|
|
43
|
-
namespace?: string;
|
|
44
|
-
maxSteps?: number;
|
|
45
|
-
timeoutMs?: number;
|
|
46
|
-
maxToolCalls?: number;
|
|
47
|
-
maxToolErrors?: number;
|
|
48
|
-
maxInputTokens?: number;
|
|
49
|
-
maxOutputTokens?: number;
|
|
50
|
-
maxTotalTokens?: number;
|
|
51
|
-
maxCostUsd?: number;
|
|
52
|
-
inputCostPerMillion?: number;
|
|
53
|
-
outputCostPerMillion?: number;
|
|
54
|
-
allowedChecks?: string[];
|
|
55
|
-
requiredCapabilities?: string[];
|
|
56
|
-
subagentProfiles?: HarnessSubagentProfile[];
|
|
57
|
-
reviewers?: HarnessSubagentProfile[];
|
|
58
|
-
routes?: string[];
|
|
59
|
-
subagentMaxSteps?: number;
|
|
60
|
-
subagentMaxToolCalls?: number;
|
|
61
|
-
subagentMaxToolErrors?: number;
|
|
62
|
-
subagentMaxInputTokens?: number;
|
|
63
|
-
subagentMaxOutputTokens?: number;
|
|
64
|
-
subagentMaxTotalTokens?: number;
|
|
65
|
-
subagentTimeoutMs?: number;
|
|
66
|
-
maxParallelReviews?: number;
|
|
67
|
-
executionBackend?: string;
|
|
68
|
-
agentProfile?: string;
|
|
69
|
-
ociRuntime?: string;
|
|
70
|
-
ociImage?: string;
|
|
71
|
-
ociAllowedCommands?: string[];
|
|
72
|
-
ociShellMode?: string;
|
|
73
|
-
ociMaxProcessRuntimeMs?: number;
|
|
74
|
-
ociMaxProcessOutputBytes?: number;
|
|
75
|
-
ociMaxMemoryMb?: number;
|
|
76
|
-
ociMaxPids?: number;
|
|
77
|
-
ociMaxCpus?: number;
|
|
78
|
-
ociMaxWorkspaceBytes?: number;
|
|
79
|
-
ociMaxFileWriteBytes?: number;
|
|
80
|
-
ociTmpfsMb?: number;
|
|
81
|
-
mcpConfigPath?: string;
|
|
82
|
-
contextConfigPath?: string;
|
|
83
|
-
projectContext?: boolean;
|
|
84
|
-
prompt?: string;
|
|
85
|
-
runId?: string;
|
|
86
|
-
idempotencyKey?: string;
|
|
87
|
-
runsCommand?: RunsCommand;
|
|
88
|
-
sessionsCommand?: SessionsCommand;
|
|
89
|
-
changesCommand?: ChangesCommand;
|
|
90
|
-
stateCommand?: StateCommand;
|
|
91
|
-
artifactPath?: string;
|
|
92
|
-
patchPath?: string;
|
|
93
|
-
preconditionsPath?: string;
|
|
94
|
-
verificationTime?: string;
|
|
95
|
-
backupPath?: string;
|
|
96
|
-
sessionId?: string;
|
|
97
|
-
sessionTitle?: string;
|
|
98
|
-
sessionSearch?: string;
|
|
99
|
-
pricingFile?: string;
|
|
100
|
-
usageLimitUsd?: number;
|
|
101
|
-
continueSession: boolean;
|
|
102
|
-
implicitCommand: boolean;
|
|
103
|
-
statuses?: AgentStatus[];
|
|
104
|
-
limit?: number;
|
|
105
|
-
cursor?: string;
|
|
106
|
-
before?: number;
|
|
107
|
-
reason?: string;
|
|
108
|
-
cascade: boolean;
|
|
109
|
-
final: boolean;
|
|
110
|
-
apply: boolean;
|
|
111
|
-
yes: boolean;
|
|
112
|
-
approve?: boolean;
|
|
113
|
-
json: boolean;
|
|
114
|
-
jsonl: boolean;
|
|
115
|
-
}
|
|
116
|
-
export declare class CliUsageError extends HarnessError {
|
|
117
|
-
constructor(message: string);
|
|
118
|
-
}
|
|
119
|
-
export declare const createHarnessResumeMetadata: (config: HarnessConfig, routes?: ReadonlyMap<HarnessSubagentProfile, HarnessModelRoute>) => NonNullable<AgentRunInput["metadata"]>;
|
|
120
|
-
export declare const readHarnessResumeConfig: (state: Pick<AgentRunState, "metadata">) => HarnessConfigInput | undefined;
|
|
121
|
-
export declare const readHarnessResumeRoutes: (state: Pick<AgentRunState, "metadata">) => Map<"explorer" | "implementer" | "reviewer" | "tester", HarnessModelRoute>;
|
|
122
|
-
export declare const resumeCommand: (runId: string, config: HarnessConfig, approve?: boolean) => string;
|
|
123
|
-
export declare const parseCliArgs: (argv: string[]) => CliOptions;
|
|
124
|
-
export declare const CLI_HELP_TEXT: string;
|
|
125
|
-
export declare const CLI_FULL_HELP_TEXT: string;
|
|
126
|
-
export declare const summarizeApproval: (approval: AgentApprovalRequest) => string;
|
|
127
|
-
export declare const withTemporaryHarnessProfiles: <T>(profiles: readonly HarnessSubagentProfile[], configure: (profiles: readonly HarnessSubagentProfile[]) => Promise<void>, operation: () => Promise<T>) => Promise<T>;
|
|
128
|
-
export declare const providersDocument: (env?: NodeJS.ProcessEnv) => {
|
|
129
|
-
schemaVersion: 1;
|
|
130
|
-
kind: "providers";
|
|
131
|
-
providers: readonly import("./providers.js").ProviderAvailability[];
|
|
132
|
-
};
|
|
133
|
-
export declare const confirmDefaultProfileSelection: (profile: {
|
|
134
|
-
provider: HarnessProvider;
|
|
135
|
-
model: string;
|
|
136
|
-
}, ask: (prompt: string) => Promise<string>) => Promise<{
|
|
137
|
-
provider: HarnessProvider;
|
|
138
|
-
model: string;
|
|
139
|
-
} | undefined>;
|
|
140
|
-
export type DoctorCheckStatus = "pass" | "warn" | "fail";
|
|
141
|
-
export interface DoctorCheck {
|
|
142
|
-
id: string;
|
|
143
|
-
status: DoctorCheckStatus;
|
|
144
|
-
message: string;
|
|
145
|
-
details: Record<string, boolean | number | string | readonly string[]>;
|
|
146
|
-
}
|
|
147
|
-
export interface DoctorReport {
|
|
148
|
-
schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
|
|
149
|
-
kind: "doctor";
|
|
150
|
-
ok: boolean;
|
|
151
|
-
harnessVersion: string;
|
|
152
|
-
configSchemaVersion: number;
|
|
153
|
-
configuration: {
|
|
154
|
-
provider: HarnessProvider;
|
|
155
|
-
model: string;
|
|
156
|
-
workspace: string;
|
|
157
|
-
stateDirectory: string;
|
|
158
|
-
storeBackend: string;
|
|
159
|
-
scope: ReturnType<typeof resolveHarnessConfig>["scope"];
|
|
160
|
-
maxSteps: number;
|
|
161
|
-
timeoutMs: number;
|
|
162
|
-
agentProfile: "strict" | "repair";
|
|
163
|
-
budget: ReturnType<typeof resolveHarnessConfig>["budget"];
|
|
164
|
-
costBudget?: ReturnType<typeof resolveHarnessConfig>["costBudget"];
|
|
165
|
-
compaction: ReturnType<typeof resolveHarnessConfig>["compaction"];
|
|
166
|
-
allowedChecks: readonly string[];
|
|
167
|
-
requiredCapabilities: ReturnType<typeof resolveHarnessConfig>["requiredCapabilities"];
|
|
168
|
-
orchestration: ReturnType<typeof resolveHarnessConfig>["orchestration"];
|
|
169
|
-
context: ReturnType<typeof resolveHarnessConfig>["context"];
|
|
170
|
-
execution: ReturnType<typeof resolveHarnessConfig>["execution"];
|
|
171
|
-
mcpConfigPath?: string;
|
|
172
|
-
};
|
|
173
|
-
checks: DoctorCheck[];
|
|
174
|
-
providers: ReturnType<typeof providerAvailability>;
|
|
175
|
-
}
|
|
176
|
-
export interface DoctorContext {
|
|
177
|
-
env?: NodeJS.ProcessEnv;
|
|
178
|
-
nodeVersion?: string;
|
|
179
|
-
/** @deprecated Test-only compatibility injection for the secondary Bun runtime. */
|
|
180
|
-
bunVersion?: string;
|
|
181
|
-
ociRuntimeAdapter?: HarnessOciRuntimeAdapter;
|
|
182
|
-
}
|
|
183
|
-
export declare const createDoctorReport: (options?: Pick<CliOptions, "provider" | "model" | "workspace" | "stateDirectory" | "storeBackend" | "tenantId" | "userId" | "namespace" | "maxSteps" | "agentProfile" | "timeoutMs" | "maxToolCalls" | "maxToolErrors" | "maxInputTokens" | "maxOutputTokens" | "maxTotalTokens" | "maxCostUsd" | "inputCostPerMillion" | "outputCostPerMillion" | "allowedChecks" | "requiredCapabilities" | "subagentProfiles" | "subagentMaxSteps" | "subagentMaxToolCalls" | "subagentMaxToolErrors" | "subagentMaxInputTokens" | "subagentMaxOutputTokens" | "subagentMaxTotalTokens" | "subagentTimeoutMs" | "maxParallelReviews" | "executionBackend" | "ociRuntime" | "ociImage" | "ociAllowedCommands" | "ociShellMode" | "ociMaxProcessRuntimeMs" | "ociMaxProcessOutputBytes" | "ociMaxMemoryMb" | "ociMaxPids" | "ociMaxCpus" | "ociMaxWorkspaceBytes" | "ociMaxFileWriteBytes" | "ociTmpfsMb" | "mcpConfigPath" | "contextConfigPath" | "projectContext">, context?: DoctorContext) => Promise<DoctorReport>;
|
|
184
|
-
export declare const formatDoctorReport: (report: DoctorReport) => string;
|
|
185
|
-
export declare const cliExitCodeForError: (error: unknown) => 1 | 2;
|
|
2
|
+
export { runResultDocument } from "./cli/run-document.js";
|
|
3
|
+
export { CLI_JSON_SCHEMA_VERSION } from "./cli/cli-stream.js";
|
|
186
4
|
export declare const main: (argv?: string[]) => Promise<void>;
|
|
5
|
+
export { HARNESS_RESUME_METADATA_KEY } from "./cli/resume-metadata.js";
|
|
6
|
+
export { HARNESS_RESUME_METADATA_SCHEMA_VERSION } from "./cli/resume-metadata.js";
|
|
7
|
+
export { CLI_EXIT_CODES } from "./cli/errors.js";
|
|
8
|
+
export { annotateCliStreamError } from "./cli/presentation.js";
|
|
9
|
+
export { cliStreamErrorSequence } from "./cli/presentation.js";
|
|
10
|
+
export { terminalErrorMessage } from "./cli/presentation.js";
|
|
11
|
+
export { CLI_COMMANDS } from "./cli/arguments.js";
|
|
12
|
+
export { CLI_RUNS_COMMANDS } from "./cli/arguments.js";
|
|
13
|
+
export { CLI_SESSIONS_COMMANDS } from "./cli/arguments.js";
|
|
14
|
+
export { CLI_CHANGES_COMMANDS } from "./cli/arguments.js";
|
|
15
|
+
export { CLI_STATE_COMMANDS } from "./cli/arguments.js";
|
|
16
|
+
export type { CliOptions } from "./cli/arguments.js";
|
|
17
|
+
export { CliUsageError } from "./cli/arguments.js";
|
|
18
|
+
export { createHarnessResumeMetadata } from "./cli/resume-metadata.js";
|
|
19
|
+
export { readHarnessResumeConfig } from "./cli/resume-metadata.js";
|
|
20
|
+
export { readHarnessResumeRoutes } from "./cli/resume-metadata.js";
|
|
21
|
+
export { resumeCommand } from "./cli/resume-metadata.js";
|
|
22
|
+
export { parseCliArgs } from "./cli/arguments.js";
|
|
23
|
+
export { CLI_HELP_TEXT } from "./cli/help-text.js";
|
|
24
|
+
export { CLI_FULL_HELP_TEXT } from "./cli/help-text.js";
|
|
25
|
+
export { summarizeApproval } from "./cli/presentation.js";
|
|
26
|
+
export { withTemporaryHarnessProfiles } from "./cli/routing.js";
|
|
27
|
+
export { providersDocument } from "./cli/setup.js";
|
|
28
|
+
export type { DoctorCheckStatus } from "./cli/doctor.js";
|
|
29
|
+
export type { DoctorCheck } from "./cli/doctor.js";
|
|
30
|
+
export type { DoctorReport } from "./cli/doctor.js";
|
|
31
|
+
export type { DoctorContext } from "./cli/doctor.js";
|
|
32
|
+
export { createDoctorReport } from "./cli/doctor.js";
|
|
33
|
+
export { formatDoctorReport } from "./cli/doctor.js";
|
|
34
|
+
export { cliExitCodeForError } from "./cli/errors.js";
|