@zhivex-ai/harness 1.0.0 → 1.1.0-rc.2
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 +97 -1
- package/README.md +52 -306
- package/SECURITY.md +1 -1
- package/SUPPORT.md +7 -3
- package/benchmarks/README.md +3 -3
- package/contracts/client-protocol-v1.schema.json +341 -0
- package/contracts/public-api.json +100 -1
- package/contracts/stable-api-signatures.json +14 -14
- package/dist/approval-diff.d.ts +45 -0
- package/dist/approval-history.d.ts +38 -0
- package/dist/approval-preview.d.ts +26 -0
- package/dist/cli-credentials.d.ts +38 -0
- package/dist/cli-help.d.ts +3 -0
- package/dist/cli-options.d.ts +1 -1
- package/dist/cli-stream.d.ts +3 -3
- package/dist/cli.d.ts +15 -69
- package/dist/cli.js +13796 -10032
- package/dist/client-contract.d.ts +208 -0
- package/dist/console-commands.d.ts +6 -0
- package/dist/console-context.d.ts +5 -1
- package/dist/console-input.d.ts +44 -4
- package/dist/console-model-catalog.d.ts +25 -0
- package/dist/console-navigation.d.ts +27 -0
- package/dist/console-presentation.d.ts +18 -0
- package/dist/console-welcome.d.ts +13 -0
- package/dist/execution-environment.d.ts +4 -0
- package/dist/harness.d.ts +3 -0
- package/dist/hostile-repository-demo.js +1913 -798
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7908 -6330
- package/dist/local-service.d.ts +34 -0
- package/dist/operations.d.ts +23 -1
- package/dist/orchestration.d.ts +3 -0
- package/dist/persistence-secrets.d.ts +2 -0
- package/dist/recorded-workspace.d.ts +4 -0
- package/dist/run-document.d.ts +91 -0
- package/dist/runtime-policy.d.ts +4 -4
- package/dist/service-cli.d.ts +2 -0
- package/dist/service-cli.js +10858 -0
- package/dist/service-client-cli.d.ts +2 -0
- package/dist/service-events.d.ts +50 -0
- package/dist/sessions.d.ts +3 -0
- package/dist/sqlite-access.d.ts +26 -0
- package/dist/sqlite-database.d.ts +2 -0
- package/dist/state-backup.d.ts +8 -0
- package/dist/task-memory.d.ts +2 -2
- package/dist/terminal-continuation.d.ts +3 -0
- package/dist/terminal-markdown.d.ts +1 -0
- package/dist/terminal-ui.d.ts +5 -0
- package/dist/usage-ledger.d.ts +84 -0
- package/dist/verify-historical-migrations.js +5699 -5191
- package/dist/workspace.d.ts +22 -0
- package/dist/zhx.js +13796 -10032
- package/docs/CLI.md +136 -30
- package/docs/CLIENT_PROTOCOL.md +212 -0
- package/docs/CREDENTIALS.md +59 -0
- package/docs/DURABLE_OPERATIONS.md +2 -2
- package/docs/FIRST_USE.md +82 -0
- package/docs/FIRST_USE_EXAMPLE.md +40 -0
- package/docs/HOSTILE_REPOSITORY_DEMO.md +1 -1
- package/docs/LOCAL_SERVICE.md +142 -0
- package/docs/README.md +24 -23
- package/docs/THREAT_MODEL.md +1 -1
- package/docs/TIME_TO_SAFE_FIX.md +2 -2
- package/docs/USAGE.md +181 -0
- package/evaluations/daily-cli-cohort.json +33 -0
- package/evaluations/representative-assembly-matrix.json +19 -1
- package/examples/README.md +26 -0
- package/examples/first-use/greeting.test.ts +3 -0
- package/examples/first-use/greeting.ts +1 -0
- package/examples/first-use/package.json +7 -0
- package/package.json +34 -9
- package/ROADMAP.md +0 -414
- package/benchmarks/baselines/context-navigation-2026-09-09.json +0 -94
- package/benchmarks/baselines/efficiency-2026-09-08.json +0 -233
- package/benchmarks/baselines/external-final-2026-09-08.json +0 -588
- package/benchmarks/baselines/external-intermediate-2026-09-08.json +0 -116
- package/benchmarks/baselines/external-matched-openai-2026-09-08.json +0 -1922
- package/benchmarks/baselines/external-matched-qwen-2026-09-08.json +0 -1706
- package/benchmarks/baselines/external-pilot-2026-09-08.json +0 -439
- package/benchmarks/baselines/external-qwen-flash-2026-09-08.json +0 -1570
- package/benchmarks/baselines/external-qwen-remediation-2026-09-09.json +0 -1509
- package/benchmarks/baselines/external-qwen-sdk-114-progress-2026-09-09.json +0 -2509
- package/benchmarks/baselines/external-sdk-upgrade-2026-09-08.json +0 -564
- package/benchmarks/baselines/external-verifier-recovery-2026-09-09.json +0 -794
- package/benchmarks/baselines/full-harness-review-2026-09-10.json +0 -134
- package/benchmarks/baselines/harness-audit-2026-09-09.json +0 -136
- package/benchmarks/baselines/harness-remediation-2026-09-09.json +0 -160
- package/benchmarks/baselines/oci-remediation-2026-09-10.json +0 -535
- package/benchmarks/baselines/rc14-holdout-2026-09-10.json +0 -854
- package/benchmarks/baselines/repair-architecture-audit-2026-09-09.json +0 -75
- package/benchmarks/baselines/time-to-safe-fix-live-expanded-2026-08-21.json +0 -186
- package/benchmarks/baselines/time-to-safe-fix-live-smoke-2026-08-21.json +0 -186
- package/docs/GA_READINESS.md +0 -29
- package/docs/GEMINI_1_0_DECISION.md +0 -9
- package/docs/LIVE_CERTIFICATION.md +0 -107
- package/docs/RC13_SECURITY_REVIEW.md +0 -28
- package/docs/RC14_DELEGATED_SECURITY_DECISION.md +0 -80
- package/docs/RC14_SECURITY_REVIEW.md +0 -40
- package/docs/RELEASE.md +0 -96
- package/docs/ROLLBACK.md +0 -9
- package/docs/SECURITY_REVIEW_EVIDENCE.md +0 -17
- package/docs/ga-readiness.json +0 -366
- package/docs/reports/EFFICIENCY_REVIEW.md +0 -156
- package/docs/reports/EXTERNAL_COMPARISON.md +0 -434
- package/docs/reports/FULL_HARNESS_REVIEW_2026-09-10.md +0 -200
- package/docs/reports/GA_BUDGET_REMEDIATION_2026-09-19.md +0 -38
- package/docs/reports/GA_REPAIR_RECOVERY_2026-09-19.md +0 -700
- package/docs/reports/GA_VALIDATION_2026-09-19.md +0 -111
- package/docs/reports/HARNESS_ARCHITECTURE_REVIEW_2026-09-09.md +0 -202
- package/docs/reports/HARNESS_AUDIT_2026-09-09.md +0 -306
- package/docs/reports/HARNESS_REMEDIATION_2026-09-09.md +0 -74
- package/docs/reports/HARNESS_REMEDIATION_2026-09-10.md +0 -90
- package/docs/reports/MODEL_COMPARISON_2026-09-09.md +0 -184
- package/docs/reports/QWEN_REMEDIATION_COMPARISON_2026-09-09.md +0 -142
- package/docs/reports/RC14_VALIDATION_2026-09-10.md +0 -45
- package/docs/reports/README.md +0 -26
- package/docs/reports/evidence/ga-budget-remediation-2026-09-19.json +0 -133
- package/docs/reports/evidence/ga-catalog-ablation-2026-09-19.json +0 -699
- package/docs/reports/evidence/ga-catalog-ablation-plan-2026-09-19.json +0 -40
- package/docs/reports/evidence/ga-catalog-observed-2026-09-19.json +0 -985
- package/docs/reports/evidence/ga-catalog-observed-plan-2026-09-19.json +0 -28
- package/docs/reports/evidence/ga-catalog-observed-status-2026-09-19.json +0 -15
- package/docs/reports/evidence/ga-complete-local-check-2026-09-19.json +0 -47
- package/docs/reports/evidence/ga-completion-reminder-2026-09-19.json +0 -22
- package/docs/reports/evidence/ga-fresh-cohort-plan-2026-09-19.json +0 -54
- package/docs/reports/evidence/ga-fresh-cohort-preparation-2026-09-19.json +0 -242
- package/docs/reports/evidence/ga-fresh-cohort-result-2026-09-19.json +0 -4318
- package/docs/reports/evidence/ga-local-validation-followup-2026-09-19.json +0 -66
- package/docs/reports/evidence/ga-node-consumers-2026-09-19.json +0 -31
- package/docs/reports/evidence/ga-package-content-validation-2026-09-19.json +0 -22
- package/docs/reports/evidence/ga-plan-completion-2026-09-19.json +0 -39
- package/docs/reports/evidence/ga-plan-reserve-2026-09-19.json +0 -573
- package/docs/reports/evidence/ga-plan-reserve-plan-2026-09-19.json +0 -24
- package/docs/reports/evidence/ga-plan-transition-2026-09-19.json +0 -19
- package/docs/reports/evidence/ga-private-verifier-plan-2026-09-19.json +0 -24
- package/docs/reports/evidence/ga-private-verifier-root-cause-2026-09-19.json +0 -41
- package/docs/reports/evidence/ga-published-sdk-2026-09-19.json +0 -35
- package/docs/reports/evidence/ga-python-checkout-imports-2026-09-19.json +0 -95
- package/docs/reports/evidence/ga-python-origin-delivery-2026-09-19.json +0 -211
- package/docs/reports/evidence/ga-python-origin-delivery-plan-2026-09-19.json +0 -27
- package/docs/reports/evidence/ga-qwen-patched-package-2026-09-19.json +0 -1092
- package/docs/reports/evidence/ga-qwen-patched-package-plan-2026-09-19.json +0 -18
- package/docs/reports/evidence/ga-qwen-published-2026-09-19.json +0 -571
- package/docs/reports/evidence/ga-qwen-published-plan-2026-09-19.json +0 -18
- package/docs/reports/evidence/ga-qwen-tool-choice-2026-09-19.json +0 -85
- package/docs/reports/evidence/ga-qwen-tool-choice-patched-2026-09-19.json +0 -85
- package/docs/reports/evidence/ga-recovery-development-2026-09-19.json +0 -1066
- package/docs/reports/evidence/ga-recovery-graded-development-2026-09-19.json +0 -1313
- package/docs/reports/evidence/ga-recovery-graded-v2-2026-09-19.json +0 -1151
- package/docs/reports/evidence/ga-recovery-v3-2026-09-19.json +0 -3943
- package/docs/reports/evidence/ga-recovery-v4-2026-09-19.json +0 -1055
- package/docs/reports/evidence/ga-recovery-v5-2026-09-19.json +0 -1245
- package/docs/reports/evidence/ga-recovery-v6-2026-09-19.json +0 -699
- package/docs/reports/evidence/ga-recovery-v7-2026-09-19.json +0 -854
- package/docs/reports/evidence/ga-recovery-v8-2026-09-19.json +0 -596
- package/docs/reports/evidence/ga-required-delivery-2026-09-19.json +0 -25
- package/docs/reports/evidence/ga-required-delivery-live-2026-09-19.json +0 -1337
- package/docs/reports/evidence/ga-required-delivery-live-plan-2026-09-19.json +0 -25
- package/docs/reports/evidence/ga-retained-candidate-grading-2026-09-19.json +0 -30
- package/docs/reports/evidence/ga-tool-selection-live-2026-09-19.json +0 -559
- package/docs/reports/evidence/ga-tool-selection-live-plan-2026-09-19.json +0 -28
- package/docs/reports/evidence/ga-tool-selection-recovery-2026-09-19.json +0 -27
- package/docs/reports/evidence/ga-validation-2026-09-19.json +0 -236
- package/docs/reports/evidence/ga-verifier-discovery-live-2026-09-19.json +0 -1369
- package/docs/reports/evidence/ga-verifier-discovery-plan-2026-09-19.json +0 -29
- package/docs/reports/evidence/ga-verifier-failure-identification-2026-09-19.json +0 -30
- package/docs/reports/evidence/ga-verifier-feedback-2026-09-19.json +0 -65
- package/docs/reports/evidence/ga-verifier-hints-live-2026-09-19.json +0 -1297
- package/docs/reports/evidence/ga-verifier-hints-plan-2026-09-19.json +0 -27
- package/docs/reports/evidence/ga-work-boundary-context-analysis-2026-09-19.json +0 -113
- package/docs/reports/evidence/ga-work-boundary-live-2026-09-19.json +0 -301
- package/docs/reports/evidence/ga-work-boundary-live-plan-2026-09-19.json +0 -84
- package/docs/reports/evidence/ga-work-budget-planning-2026-09-19.json +0 -32
- package/docs/reports/evidence/ga-working-context-2026-09-19.json +0 -22
- package/docs/reports/evidence/rc14-delegated-security-review-2026-09-20.json +0 -81
- package/docs/reports/evidence/rc14-ga-gate-2026-09-20.json +0 -18
- package/docs/reports/evidence/rc14-representative-2026-09-20.json +0 -509
- package/docs/reports/evidence/rc14-security-regressions-2026-09-20.json +0 -64
- package/docs/reports/evidence/security-current-2026-09-19.json +0 -91
- package/docs/reports/evidence/security-remediation-2026-09-19.json +0 -97
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { type ApprovalDecisionView } from "./approval-history.js";
|
|
2
|
+
import { type ApprovalFilePreview } from "./approval-preview.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { AgentStreamEvent } from "@zhivex-ai/agents";
|
|
5
|
+
import { type ZhivexHarness } from "./harness.js";
|
|
6
|
+
import { type CliSession } from "./sessions.js";
|
|
7
|
+
export declare const HARNESS_CLIENT_PROTOCOL_VERSION: 1;
|
|
8
|
+
/** Strict command union; configuration, credentials and filesystem paths are host-owned. */
|
|
9
|
+
export declare const harnessClientCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
projectId: z.ZodString;
|
|
11
|
+
method: z.ZodLiteral<"project.get">;
|
|
12
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
+
projectId: z.ZodString;
|
|
14
|
+
method: z.ZodLiteral<"session.list">;
|
|
15
|
+
search: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
projectId: z.ZodString;
|
|
18
|
+
idempotencyKey: z.ZodString;
|
|
19
|
+
method: z.ZodLiteral<"session.create">;
|
|
20
|
+
title: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
22
|
+
projectId: z.ZodString;
|
|
23
|
+
sessionId: z.ZodString;
|
|
24
|
+
method: z.ZodLiteral<"session.get">;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
projectId: z.ZodString;
|
|
27
|
+
sessionId: z.ZodString;
|
|
28
|
+
idempotencyKey: z.ZodString;
|
|
29
|
+
method: z.ZodLiteral<"session.rename">;
|
|
30
|
+
expectedRevision: z.ZodNumber;
|
|
31
|
+
title: z.ZodString;
|
|
32
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
+
projectId: z.ZodString;
|
|
34
|
+
sessionId: z.ZodString;
|
|
35
|
+
idempotencyKey: z.ZodString;
|
|
36
|
+
method: z.ZodLiteral<"run.start">;
|
|
37
|
+
expectedRevision: z.ZodNumber;
|
|
38
|
+
prompt: z.ZodString;
|
|
39
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
40
|
+
projectId: z.ZodString;
|
|
41
|
+
sessionId: z.ZodString;
|
|
42
|
+
runId: z.ZodString;
|
|
43
|
+
method: z.ZodLiteral<"run.get">;
|
|
44
|
+
includeReview: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
includeDiff: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
decisionOffset: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
48
|
+
projectId: z.ZodString;
|
|
49
|
+
sessionId: z.ZodString;
|
|
50
|
+
runId: z.ZodString;
|
|
51
|
+
idempotencyKey: z.ZodString;
|
|
52
|
+
method: z.ZodLiteral<"approval.resolve">;
|
|
53
|
+
expectedRevision: z.ZodNumber;
|
|
54
|
+
decisions: z.ZodArray<z.ZodObject<{
|
|
55
|
+
approvalId: z.ZodString;
|
|
56
|
+
digest: z.ZodString;
|
|
57
|
+
approve: z.ZodBoolean;
|
|
58
|
+
}, z.core.$strict>>;
|
|
59
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
+
projectId: z.ZodString;
|
|
61
|
+
sessionId: z.ZodString;
|
|
62
|
+
runId: z.ZodString;
|
|
63
|
+
idempotencyKey: z.ZodString;
|
|
64
|
+
method: z.ZodLiteral<"run.cancel">;
|
|
65
|
+
expectedRevision: z.ZodNumber;
|
|
66
|
+
}, z.core.$strict>], "method">;
|
|
67
|
+
export declare const harnessClientRequestSchema: z.ZodObject<{
|
|
68
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
69
|
+
requestId: z.ZodString;
|
|
70
|
+
connectionId: z.ZodString;
|
|
71
|
+
command: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
72
|
+
projectId: z.ZodString;
|
|
73
|
+
method: z.ZodLiteral<"project.get">;
|
|
74
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
+
projectId: z.ZodString;
|
|
76
|
+
method: z.ZodLiteral<"session.list">;
|
|
77
|
+
search: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
79
|
+
projectId: z.ZodString;
|
|
80
|
+
idempotencyKey: z.ZodString;
|
|
81
|
+
method: z.ZodLiteral<"session.create">;
|
|
82
|
+
title: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
+
projectId: z.ZodString;
|
|
85
|
+
sessionId: z.ZodString;
|
|
86
|
+
method: z.ZodLiteral<"session.get">;
|
|
87
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
88
|
+
projectId: z.ZodString;
|
|
89
|
+
sessionId: z.ZodString;
|
|
90
|
+
idempotencyKey: z.ZodString;
|
|
91
|
+
method: z.ZodLiteral<"session.rename">;
|
|
92
|
+
expectedRevision: z.ZodNumber;
|
|
93
|
+
title: z.ZodString;
|
|
94
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
95
|
+
projectId: z.ZodString;
|
|
96
|
+
sessionId: z.ZodString;
|
|
97
|
+
idempotencyKey: z.ZodString;
|
|
98
|
+
method: z.ZodLiteral<"run.start">;
|
|
99
|
+
expectedRevision: z.ZodNumber;
|
|
100
|
+
prompt: z.ZodString;
|
|
101
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
102
|
+
projectId: z.ZodString;
|
|
103
|
+
sessionId: z.ZodString;
|
|
104
|
+
runId: z.ZodString;
|
|
105
|
+
method: z.ZodLiteral<"run.get">;
|
|
106
|
+
includeReview: z.ZodOptional<z.ZodBoolean>;
|
|
107
|
+
includeDiff: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
decisionOffset: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
110
|
+
projectId: z.ZodString;
|
|
111
|
+
sessionId: z.ZodString;
|
|
112
|
+
runId: z.ZodString;
|
|
113
|
+
idempotencyKey: z.ZodString;
|
|
114
|
+
method: z.ZodLiteral<"approval.resolve">;
|
|
115
|
+
expectedRevision: z.ZodNumber;
|
|
116
|
+
decisions: z.ZodArray<z.ZodObject<{
|
|
117
|
+
approvalId: z.ZodString;
|
|
118
|
+
digest: z.ZodString;
|
|
119
|
+
approve: z.ZodBoolean;
|
|
120
|
+
}, z.core.$strict>>;
|
|
121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
122
|
+
projectId: z.ZodString;
|
|
123
|
+
sessionId: z.ZodString;
|
|
124
|
+
runId: z.ZodString;
|
|
125
|
+
idempotencyKey: z.ZodString;
|
|
126
|
+
method: z.ZodLiteral<"run.cancel">;
|
|
127
|
+
expectedRevision: z.ZodNumber;
|
|
128
|
+
}, z.core.$strict>], "method">;
|
|
129
|
+
}, z.core.$strict>;
|
|
130
|
+
export type HarnessClientCommand = z.infer<typeof harnessClientCommandSchema>;
|
|
131
|
+
export type HarnessClientRequest = z.infer<typeof harnessClientRequestSchema>;
|
|
132
|
+
export type HarnessClientErrorCode = "INVALID_REQUEST" | "VERSION_UNSUPPORTED" | "CONNECTION_EXPIRED" | "NOT_FOUND" | "REVISION_CONFLICT" | "IDEMPOTENCY_CONFLICT" | "CAPACITY_EXCEEDED" | "APPROVAL_MISMATCH" | "INVALID_STATE" | "BUSY" | "EXECUTION_FAILED";
|
|
133
|
+
export interface HarnessClientSession extends CliSession {
|
|
134
|
+
}
|
|
135
|
+
export interface HarnessClientRun {
|
|
136
|
+
runId: string;
|
|
137
|
+
revision: number;
|
|
138
|
+
status: string;
|
|
139
|
+
output: string;
|
|
140
|
+
cliResult?: unknown;
|
|
141
|
+
decisions?: ApprovalDecisionView[];
|
|
142
|
+
decisionTotal?: number;
|
|
143
|
+
decisionNextOffset?: number;
|
|
144
|
+
approvals: {
|
|
145
|
+
approvalId: string;
|
|
146
|
+
digest: string;
|
|
147
|
+
provider: string;
|
|
148
|
+
kind: string;
|
|
149
|
+
action: unknown;
|
|
150
|
+
expiresAt: number;
|
|
151
|
+
filePreview?: ApprovalFilePreview;
|
|
152
|
+
}[];
|
|
153
|
+
}
|
|
154
|
+
export type HarnessClientData = {
|
|
155
|
+
kind: "project";
|
|
156
|
+
projectId: string;
|
|
157
|
+
} | {
|
|
158
|
+
kind: "session";
|
|
159
|
+
session: HarnessClientSession;
|
|
160
|
+
} | {
|
|
161
|
+
kind: "sessions";
|
|
162
|
+
sessions: HarnessClientSession[];
|
|
163
|
+
} | {
|
|
164
|
+
kind: "run";
|
|
165
|
+
session: HarnessClientSession;
|
|
166
|
+
run: HarnessClientRun;
|
|
167
|
+
};
|
|
168
|
+
export type HarnessClientResponse = {
|
|
169
|
+
protocolVersion: 1;
|
|
170
|
+
requestId: string | null;
|
|
171
|
+
} & ({
|
|
172
|
+
ok: true;
|
|
173
|
+
data: HarnessClientData;
|
|
174
|
+
} | {
|
|
175
|
+
ok: false;
|
|
176
|
+
error: {
|
|
177
|
+
code: HarnessClientErrorCode;
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
export type HarnessClientNegotiation = {
|
|
181
|
+
ok: true;
|
|
182
|
+
protocolVersion: 1;
|
|
183
|
+
connectionId: string;
|
|
184
|
+
projectId: string;
|
|
185
|
+
capabilities: readonly string[];
|
|
186
|
+
} | {
|
|
187
|
+
ok: false;
|
|
188
|
+
error: {
|
|
189
|
+
code: "VERSION_UNSUPPORTED" | "CONNECTION_EXPIRED";
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
export interface HarnessClientAdapterOptions {
|
|
193
|
+
approvalMaxAgeMs?: number;
|
|
194
|
+
now?: () => number;
|
|
195
|
+
onPrompt?: (sessionId: string, runId: string, prompt: string) => void | Promise<void>;
|
|
196
|
+
onEvent?: (sessionId: string, runId: string, event: AgentStreamEvent) => void | Promise<void>;
|
|
197
|
+
onCheckpoint?: (sessionId: string, runId: string, status: string) => void | Promise<void>;
|
|
198
|
+
}
|
|
199
|
+
export interface HarnessClientAdapter {
|
|
200
|
+
negotiate(versions: readonly number[]): HarnessClientNegotiation;
|
|
201
|
+
dispatch(request: unknown): Promise<HarnessClientResponse>;
|
|
202
|
+
/** Trusted host shutdown control; requests cancellation without finalizing effects. */
|
|
203
|
+
cancelActive(): Promise<void>;
|
|
204
|
+
/** Closes this connection and its session index, not the host-owned harness. */
|
|
205
|
+
close(): void;
|
|
206
|
+
}
|
|
207
|
+
/** One trusted host, one workspace/scope, one connection epoch; no multi-writer guarantee. */
|
|
208
|
+
export declare const createHarnessClientAdapter: (harness: ZhivexHarness, options?: HarnessClientAdapterOptions) => Promise<HarnessClientAdapter>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Presentation shared by the direct console and the local-service client. */
|
|
2
|
+
export declare const CONSOLE_COMMAND_CATALOG: readonly [readonly ["/menu", "Open navigation menu", true], readonly ["/help", "Show commands; /help all shows everything", true], readonly ["/credentials", "Manage provider keys in the system keychain or this session", false], readonly ["/provider", "Select a provider", false], readonly ["/model", "Select a model", false], readonly ["/route", "Configure specialist model routes", false], readonly ["/status", "Inspect the current session and run", true], readonly ["/diff", "Review workspace changes", false], readonly ["/review", "Review a task", false], readonly ["/resume", "Reopen a conversation by session ID", true], readonly ["/pending", "Inspect pending approvals", true], readonly ["/approve", "Approve the pending actions", true], readonly ["/deny", "Deny the pending actions", true], readonly ["/compact", "Compact conversation context", false], readonly ["/new", "Start a new conversation", true], readonly ["/rename", "Rename the current conversation", true], readonly ["/clear", "Clear conversation context", false], readonly ["/exit", "Exit the console", true], readonly ["/paste", "Compose a literal multiline draft", true], readonly ["/verbose", "Toggle full or compact activity details", false], readonly ["/context", "Inspect project rules and selected context", false], readonly ["/attach", "Attach a workspace file to the next request", false], readonly ["/attachments", "List selected attachments", false], readonly ["/detach", "Remove selected attachments", false], readonly ["/sessions", "Find saved conversations", true], readonly ["/usage", "Inspect transport usage", false], readonly ["/cancel", "Cancel the active run", true]];
|
|
3
|
+
export type ConsoleMode = "direct" | "service";
|
|
4
|
+
export declare const consoleCommands: (mode?: ConsoleMode) => (readonly ["/approve", "Approve the pending actions", true] | readonly ["/attach", "Attach a workspace file to the next request", false] | readonly ["/attachments", "List selected attachments", false] | readonly ["/cancel", "Cancel the active run", true] | readonly ["/clear", "Clear conversation context", false] | readonly ["/compact", "Compact conversation context", false] | readonly ["/context", "Inspect project rules and selected context", false] | readonly ["/credentials", "Manage provider keys in the system keychain or this session", false] | readonly ["/deny", "Deny the pending actions", true] | readonly ["/detach", "Remove selected attachments", false] | readonly ["/diff", "Review workspace changes", false] | readonly ["/exit", "Exit the console", true] | readonly ["/help", "Show commands; /help all shows everything", true] | readonly ["/menu", "Open navigation menu", true] | readonly ["/model", "Select a model", false] | readonly ["/new", "Start a new conversation", true] | readonly ["/paste", "Compose a literal multiline draft", true] | readonly ["/pending", "Inspect pending approvals", true] | readonly ["/provider", "Select a provider", false] | readonly ["/rename", "Rename the current conversation", true] | readonly ["/resume", "Reopen a conversation by session ID", true] | readonly ["/review", "Review a task", false] | readonly ["/route", "Configure specialist model routes", false] | readonly ["/sessions", "Find saved conversations", true] | readonly ["/status", "Inspect the current session and run", true] | readonly ["/usage", "Inspect transport usage", false] | readonly ["/verbose", "Toggle full or compact activity details", false])[];
|
|
5
|
+
export declare const searchConsoleCommands: (query: string, mode?: ConsoleMode) => (readonly ["/approve", "Approve the pending actions", true] | readonly ["/attach", "Attach a workspace file to the next request", false] | readonly ["/attachments", "List selected attachments", false] | readonly ["/cancel", "Cancel the active run", true] | readonly ["/clear", "Clear conversation context", false] | readonly ["/compact", "Compact conversation context", false] | readonly ["/context", "Inspect project rules and selected context", false] | readonly ["/credentials", "Manage provider keys in the system keychain or this session", false] | readonly ["/deny", "Deny the pending actions", true] | readonly ["/detach", "Remove selected attachments", false] | readonly ["/diff", "Review workspace changes", false] | readonly ["/exit", "Exit the console", true] | readonly ["/help", "Show commands; /help all shows everything", true] | readonly ["/menu", "Open navigation menu", true] | readonly ["/model", "Select a model", false] | readonly ["/new", "Start a new conversation", true] | readonly ["/paste", "Compose a literal multiline draft", true] | readonly ["/pending", "Inspect pending approvals", true] | readonly ["/provider", "Select a provider", false] | readonly ["/rename", "Rename the current conversation", true] | readonly ["/resume", "Reopen a conversation by session ID", true] | readonly ["/review", "Review a task", false] | readonly ["/route", "Configure specialist model routes", false] | readonly ["/sessions", "Find saved conversations", true] | readonly ["/status", "Inspect the current session and run", true] | readonly ["/usage", "Inspect transport usage", false] | readonly ["/verbose", "Toggle full or compact activity details", false])[];
|
|
6
|
+
export declare const formatConsoleHelp: (mode?: ConsoleMode, all?: boolean) => string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ZhivexHarness } from "./harness.js";
|
|
2
2
|
import type { Workspace } from "./workspace.js";
|
|
3
|
-
export declare const formatConsoleContext: (context: ZhivexHarness["context"]
|
|
3
|
+
export declare const formatConsoleContext: (context: ZhivexHarness["context"], options?: {
|
|
4
|
+
attachments: ReturnType<ConsoleAttachments["list"]>;
|
|
5
|
+
config: ZhivexHarness["config"];
|
|
6
|
+
messages: unknown[];
|
|
7
|
+
}) => string;
|
|
4
8
|
export declare const formatConsoleDiff: (diff: string, color: boolean) => string;
|
|
5
9
|
/** Explicit attachments use the same bounded, secret-excluding reads as model tools. */
|
|
6
10
|
export declare class ConsoleAttachments {
|
package/dist/console-input.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type Readable, Writable } from "node:stream";
|
|
2
|
+
import { type ConsoleMode } from "./console-commands.js";
|
|
3
|
+
export declare const CONSOLE_COMMANDS: ("/approve" | "/attach" | "/attachments" | "/cancel" | "/clear" | "/compact" | "/context" | "/credentials" | "/deny" | "/detach" | "/diff" | "/exit" | "/help" | "/menu" | "/model" | "/new" | "/paste" | "/pending" | "/provider" | "/rename" | "/resume" | "/review" | "/route" | "/sessions" | "/status" | "/usage" | "/verbose")[];
|
|
3
4
|
export declare const MAX_CONSOLE_INPUT_BYTES: number;
|
|
4
5
|
export declare const completeConsoleCommand: (line: string) => [string[], string];
|
|
5
6
|
/** Lines received without an active question are discarded, never replayed as approvals. */
|
|
@@ -7,18 +8,57 @@ export declare class ConsoleInput {
|
|
|
7
8
|
private readonly input;
|
|
8
9
|
private readonly output;
|
|
9
10
|
private readonly terminal;
|
|
11
|
+
private readonly mode;
|
|
12
|
+
private hidden;
|
|
10
13
|
private readonly reader;
|
|
14
|
+
private readonly keyboard;
|
|
15
|
+
private readonly display;
|
|
16
|
+
private readonly decoder;
|
|
17
|
+
private escape;
|
|
18
|
+
private clipboard;
|
|
19
|
+
private clipboardBytes;
|
|
20
|
+
private clipboardAllowed;
|
|
21
|
+
private draftWasPaste;
|
|
22
|
+
lastSubmissionWasPaste: boolean;
|
|
11
23
|
private closed;
|
|
12
24
|
private completeCommands;
|
|
13
25
|
private history;
|
|
14
26
|
private historyPosition;
|
|
15
27
|
private historyDraft;
|
|
28
|
+
private historyDraftWasPaste;
|
|
16
29
|
private pending;
|
|
17
30
|
private paste;
|
|
18
31
|
onInterrupt: (() => void) | undefined;
|
|
19
|
-
constructor(input: Readable, output: Writable, terminal?: boolean);
|
|
32
|
+
constructor(input: Readable, output: Writable, terminal?: boolean, mode?: ConsoleMode);
|
|
33
|
+
private selection;
|
|
34
|
+
private selectionMatches;
|
|
35
|
+
private finishSelection;
|
|
36
|
+
select<T>(title: string, items: readonly {
|
|
37
|
+
value: T;
|
|
38
|
+
label: string;
|
|
39
|
+
detail?: string;
|
|
40
|
+
}[]): Promise<T | undefined>;
|
|
41
|
+
private taskPrompt;
|
|
42
|
+
private shortcutsShown;
|
|
43
|
+
private historySearch;
|
|
44
|
+
private historyMatches;
|
|
45
|
+
private finishHistorySearch;
|
|
46
|
+
private menuVisible;
|
|
47
|
+
private menuSelection;
|
|
48
|
+
private menuQuery;
|
|
49
|
+
private menuDismissed;
|
|
50
|
+
private escapeMenuTimer;
|
|
51
|
+
private standaloneMenuEscape;
|
|
52
|
+
private hideMenu;
|
|
53
|
+
private renderMenu;
|
|
54
|
+
private readonly onEnd;
|
|
55
|
+
private readonly onResize;
|
|
56
|
+
private finishSecret;
|
|
57
|
+
secret(prompt: string): Promise<string>;
|
|
58
|
+
private readonly onData;
|
|
59
|
+
private insert;
|
|
20
60
|
private readonly onKeypress;
|
|
21
|
-
rememberPrompt(prompt: string): void;
|
|
61
|
+
rememberPrompt(prompt: string, literal?: boolean): void;
|
|
22
62
|
clearHistory(): void;
|
|
23
63
|
private interrupt;
|
|
24
64
|
get isClosed(): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const CONSOLE_MODEL_CATALOG: {
|
|
2
|
+
readonly sdkVersion: "1.25.1";
|
|
3
|
+
readonly providers: {
|
|
4
|
+
readonly openai: {
|
|
5
|
+
readonly revision: "2026-09-12";
|
|
6
|
+
readonly sourceSha256: "af33783afbf76d7fd12776a2a19244663c286a0f7bc6f05549e2ffe8a3e41900";
|
|
7
|
+
readonly models: readonly ["gpt-6-astra", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-4o-mini"];
|
|
8
|
+
};
|
|
9
|
+
readonly qwen: {
|
|
10
|
+
readonly revision: "2026-09-20";
|
|
11
|
+
readonly sourceSha256: "f52a311095ad69f94bdfdbb71f7011ec7e19d24a5c7d7a116f53d7d13c8c6008";
|
|
12
|
+
readonly models: readonly ["qwen3.8-omni-flash", "qwen3.8-max-0902", "qwen3.8-max", "qwen3.8-flash", "qwen3.8-max-preview", "qwen3.7-max", "qwen3.7-plus", "qwen3.6-flash", "qwen3.5-omni-plus", "qwen-plus"];
|
|
13
|
+
};
|
|
14
|
+
readonly gemini: {
|
|
15
|
+
readonly revision: "2026-09-16";
|
|
16
|
+
readonly sourceSha256: "ef26943ffd54a786e06f232adf06585ccfdddb6450dd090b2e7bc01d668153b4";
|
|
17
|
+
readonly models: readonly ["gemini-3.8-flash", "gemini-3.7-flash", "gemini-3.6-flash", "gemini-3.5-flash-lite", "gemini-3.5-flash", "gemini-3.1-pro-preview", "gemini-3.1-pro-preview-customtools", "gemini-3-flash-preview", "gemini-3.1-flash-lite"];
|
|
18
|
+
};
|
|
19
|
+
readonly meta: {
|
|
20
|
+
readonly revision: "2026-09-04";
|
|
21
|
+
readonly sourceSha256: "0e655bb5cee4dd5430336bec10d1a9cfb08a4fdc5902c211d91599f6f92492f6";
|
|
22
|
+
readonly models: readonly ["muse-spark-1.3", "muse-spark-1.2", "muse-spark-1.2-contributor", "muse-spark-1.1"];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ConsoleInput } from "./console-input.js";
|
|
2
|
+
import type { ProviderAvailability } from "./providers.js";
|
|
3
|
+
export declare const consoleModelChoices: (provider: string, defaultModel: string, current?: string) => {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
detail: string;
|
|
7
|
+
}[];
|
|
8
|
+
export type ConsoleNavigationResult = {
|
|
9
|
+
command: string;
|
|
10
|
+
} | {
|
|
11
|
+
provider: string;
|
|
12
|
+
model: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const navigateConsole: (input: Pick<ConsoleInput, "select" | "question">, options: {
|
|
15
|
+
entry: "menu" | "provider" | "model";
|
|
16
|
+
current: {
|
|
17
|
+
provider: string;
|
|
18
|
+
model: string;
|
|
19
|
+
};
|
|
20
|
+
providers: readonly ProviderAvailability[];
|
|
21
|
+
sessions: () => Promise<readonly {
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
detail?: string;
|
|
25
|
+
}[]>;
|
|
26
|
+
service?: boolean;
|
|
27
|
+
}) => Promise<ConsoleNavigationResult | undefined>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Bound presentation metadata without allowing paths/titles to control the terminal. */
|
|
2
|
+
export declare const consoleLabel: (text: string, width: number) => string;
|
|
3
|
+
export declare const formatComposer: (input: {
|
|
4
|
+
model: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
status: string;
|
|
7
|
+
attachments?: number;
|
|
8
|
+
automaticApprovals?: boolean;
|
|
9
|
+
}, columns?: number, color?: boolean) => string;
|
|
10
|
+
export declare const CONSOLE_SHORTCUTS: string;
|
|
11
|
+
export declare const chooseConsoleItem: <T>(title: string, items: readonly {
|
|
12
|
+
value: T;
|
|
13
|
+
label: string;
|
|
14
|
+
detail?: string;
|
|
15
|
+
}[], io: {
|
|
16
|
+
write(text: string): void;
|
|
17
|
+
ask(prompt: string): Promise<string>;
|
|
18
|
+
}) => Promise<T | undefined>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const ZHIVEX_TERMINAL_LOGO: string;
|
|
2
|
+
export declare const formatConsoleWelcome: (input: {
|
|
3
|
+
version: string;
|
|
4
|
+
workspace: string;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
sessionTitle?: string;
|
|
7
|
+
provider?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
service?: boolean;
|
|
10
|
+
}, options?: {
|
|
11
|
+
color?: boolean;
|
|
12
|
+
columns?: number;
|
|
13
|
+
}) => string;
|
|
@@ -168,6 +168,10 @@ export interface HarnessExecutionSession extends AgentExecutionEnvironmentSessio
|
|
|
168
168
|
export declare const harnessExecutionSession: (context: ToolExecutionContext | undefined) => HarnessExecutionSession | undefined;
|
|
169
169
|
export interface HarnessOciExecutionEnvironment extends AgentExecutionEnvironment {
|
|
170
170
|
acquire(request: AgentExecutionEnvironmentAcquireRequest): Promise<HarnessExecutionSession>;
|
|
171
|
+
previewPatch(request: Pick<AgentExecutionEnvironmentAcquireRequest, "runId" | "scope">, expectedPatchId: FileDigest): Promise<{
|
|
172
|
+
patchId: FileDigest;
|
|
173
|
+
entries: EnvironmentPatchEntry[];
|
|
174
|
+
}>;
|
|
171
175
|
readonly image: OciImageInspection;
|
|
172
176
|
readonly runtime: HarnessOciRuntimeAdapter;
|
|
173
177
|
}
|
package/dist/harness.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UsageLedger, type UsageAccountingOptions } from "./usage-ledger.js";
|
|
1
2
|
import { createModelBudget } from "./model-budget.js";
|
|
2
3
|
import { createRepairProgress } from "./repair-progress.js";
|
|
3
4
|
import { Agent, type AgentApprovalRequest, type AgentApprovalResponse, type AgentRunInput, type AgentRunOutput, type AgentStreamEvent, type LanguageModel, type ToolDefinition } from "@zhivex-ai/agents";
|
|
@@ -16,6 +17,7 @@ export declare const HARNESS_INSTRUCTIONS = "You are Zhivex Harness, a provider-
|
|
|
16
17
|
/** Render only guidance whose named tools exist in this runtime's catalog. */
|
|
17
18
|
export declare const renderHarnessInstructions: (names: readonly string[]) => string;
|
|
18
19
|
export interface CreateHarnessOptions extends HarnessConfigInput {
|
|
20
|
+
usageAccounting?: UsageAccountingOptions;
|
|
19
21
|
env?: NodeJS.ProcessEnv;
|
|
20
22
|
providerRegistry?: HarnessProviderRegistry;
|
|
21
23
|
modelInstance?: LanguageModel;
|
|
@@ -31,6 +33,7 @@ export interface CreateHarnessOptions extends HarnessConfigInput {
|
|
|
31
33
|
onLifecycleHookError?: (failure: HarnessLifecycleHookFailure) => void | Promise<void>;
|
|
32
34
|
}
|
|
33
35
|
export interface ZhivexHarness {
|
|
36
|
+
usageLedger?: UsageLedger;
|
|
34
37
|
config: HarnessConfig;
|
|
35
38
|
workspace: Workspace;
|
|
36
39
|
agent: Agent<LanguageModel>;
|