@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.
- package/CHANGELOG.md +64 -0
- package/README.md +9 -10
- package/contracts/engine-api.json +2921 -0
- package/contracts/public-api.json +267 -1
- package/contracts/stable-api-signatures.json +43 -43
- package/dist/acp-cli.js +137 -15002
- package/dist/approvals/approval-history.d.ts +22 -0
- package/dist/approvals/explicit-review.d.ts +24 -0
- package/dist/approvals/host-policy-identity.d.ts +3 -0
- package/dist/cli/arguments.d.ts +6 -2
- package/dist/cli/checkpoints.d.ts +230 -0
- package/dist/cli/cli-options.d.ts +2 -41
- package/dist/cli/cli-profiles.d.ts +4 -2
- package/dist/cli/cli-stream.d.ts +2 -167
- package/dist/cli/governance-report.d.ts +5 -0
- package/dist/cli/policy-decisions.d.ts +9 -0
- package/dist/cli/policy.d.ts +5 -0
- package/dist/cli/presentation.d.ts +3 -1
- package/dist/cli/run-document.d.ts +2 -91
- package/dist/cli/terminal/terminal-continuation.d.ts +2 -3
- package/dist/cli/terminal/terminal-ui.d.ts +4 -0
- package/dist/{cli-entry-c2f58zj2.js → cli-entry-ae7x44d4.js} +14969 -10731
- package/dist/{cli-entry-427869g9.js → cli-entry-d5788aay.js} +388 -47
- package/dist/cli-entry-ev76ezcd.js +656 -0
- package/dist/{cli-3jmy4h5h.js → cli-t7hrhayq.js} +918 -2223
- package/dist/cli.js +3 -5
- package/dist/client/acp-mcp-admission.d.ts +32 -0
- package/dist/client/acp-mcp-host.d.ts +19 -0
- package/dist/client/acp-mcp-session.d.ts +14 -0
- package/dist/client/acp-stdio.d.ts +2 -0
- package/dist/client/acp.d.ts +4 -1
- package/dist/client/adapter.d.ts +13 -1
- package/dist/client/continuation.d.ts +3 -0
- package/dist/client/json-contracts.d.ts +107 -4
- package/dist/client/local-service.d.ts +2 -0
- package/dist/client/protocol.d.ts +127 -1
- package/dist/client/run-document.d.ts +91 -0
- package/dist/client/service-events.d.ts +4 -0
- package/dist/client/stream.d.ts +167 -0
- package/dist/compat/cli-options.d.ts +53 -0
- package/dist/compat/code-support.d.ts +22 -0
- package/dist/compat/code-support.js +74 -0
- package/dist/{config-1k9t4jhh.js → config-c002f06f.js} +1 -1
- package/dist/config-j3jga5wh.js +61 -0
- package/dist/context/adaptive-compaction.d.ts +1 -0
- package/dist/context/compaction.d.ts +1 -1
- package/dist/context/request-measurements.d.ts +17 -0
- package/dist/context/request-projection.d.ts +10 -0
- package/dist/context/task-memory.d.ts +1 -0
- package/dist/engine/acp.d.ts +6 -0
- package/dist/engine/acp.js +205 -0
- package/dist/engine/client.d.ts +6 -0
- package/dist/engine/client.js +28 -0
- package/dist/engine/desktop-providers-v1.d.ts +4 -0
- package/dist/engine/desktop-providers-v1.js +18 -0
- package/dist/engine/desktop-state-v1.d.ts +10 -0
- package/dist/engine/desktop-state-v1.js +168 -0
- package/dist/engine/index.d.ts +73 -0
- package/dist/engine/index.js +977 -0
- package/dist/engine/mcp-stdio-v1.d.ts +11 -0
- package/dist/engine/mcp-stdio-v1.js +108 -0
- package/dist/engine/models.d.ts +3 -0
- package/dist/engine/models.js +894 -0
- package/dist/engine/protocol.d.ts +7 -0
- package/dist/engine/protocol.js +182 -0
- package/dist/engine/service.d.ts +5 -0
- package/dist/engine/service.js +28 -0
- package/dist/execution/acceptance-snapshot.d.ts +2 -0
- package/dist/execution/execution-environment.d.ts +10 -0
- package/dist/execution/mcp-oci-channel.d.ts +11 -0
- package/dist/execution/mcp-oci-server.d.ts +38 -0
- package/dist/execution/mcp-oci-workspace.d.ts +23 -0
- package/dist/execution/mcp-resource-recovery.d.ts +19 -0
- package/dist/execution/mcp-workspace-snapshot.d.ts +20 -0
- package/dist/hostile-repository-demo.js +3368 -1304
- package/dist/index-1bx83sw4.js +4 -0
- package/dist/index-2gz7jv7g.js +549 -0
- package/dist/{cli-entry-b1mfvmxe.js → index-2jrdcj6b.js} +72 -115
- package/dist/index-3ah1f369.js +356 -0
- package/dist/index-42gp2hy8.js +1555 -0
- package/dist/index-4jw3tvy8.js +301 -0
- package/dist/index-8705zxpr.js +145 -0
- package/dist/index-8vm2m34s.js +2080 -0
- package/dist/index-8zzhggxv.js +477 -0
- package/dist/index-a97bezbz.js +1073 -0
- package/dist/index-gq9xagx2.js +1343 -0
- package/dist/index-h0mqx2ed.js +1373 -0
- package/dist/index-jgrx804e.js +5589 -0
- package/dist/index-qfpz5y2v.js +174 -0
- package/dist/index-t60rva31.js +1004 -0
- package/dist/index-wg1sd3at.js +80 -0
- package/dist/index-xqxeypt5.js +888 -0
- package/dist/index-yb239ghk.js +961 -0
- package/dist/index-z0qxmkm2.js +3389 -0
- package/dist/index-z4e8d0ph.js +1768 -0
- package/dist/index.js +251 -18649
- package/dist/integrations/mcp-host-session.d.ts +26 -0
- package/dist/integrations/mcp-stdio-admission.d.ts +54 -0
- package/dist/integrations/mcp-stdio-client.d.ts +44 -0
- package/dist/integrations/mcp-stdio-framing.d.ts +18 -0
- package/dist/integrations/mcp-stdio-launch.d.ts +20 -0
- package/dist/integrations/mcp-stdio-session.d.ts +7 -0
- package/dist/integrations/mcp-stdio-tools.d.ts +12 -0
- package/dist/internal/desktop/catalog.d.ts +2 -0
- package/dist/internal/desktop/persistence.d.ts +2 -3
- package/dist/internal/desktop/providers.d.ts +1 -0
- package/dist/models/catalog.d.ts +2 -0
- package/dist/persistence/governance-context.d.ts +126 -0
- package/dist/persistence/governance-report.d.ts +299 -0
- package/dist/persistence/host-database-backup.d.ts +28 -0
- package/dist/persistence/mcp-execution-journal.d.ts +19 -0
- package/dist/persistence/mcp-reconciliation.d.ts +33 -0
- package/dist/persistence/mcp-resource-journal.d.ts +54 -0
- package/dist/persistence/workspace-checkpoints.d.ts +138 -0
- package/dist/providers/anthropic-continuation.d.ts +5 -0
- package/dist/providers/providers.d.ts +1 -1
- package/dist/providers/vertex-auth.d.ts +27 -0
- package/dist/runtime/delegation-contracts.d.ts +9 -0
- package/dist/runtime/delegation-correction.d.ts +9 -0
- package/dist/runtime/delegation-result.d.ts +73 -0
- package/dist/runtime/error-diagnostics.d.ts +86 -0
- package/dist/runtime/harness.d.ts +11 -1
- package/dist/runtime/policy-decisions.d.ts +66 -0
- package/dist/runtime/policy-inspection.d.ts +52 -0
- package/dist/runtime/provider-diagnostics.d.ts +1 -0
- package/dist/runtime/runtime-instructions.d.ts +8 -0
- package/dist/runtime/task-acceptance-checks.d.ts +103 -0
- package/dist/runtime/task-acceptance-delivery.d.ts +107 -0
- package/dist/runtime/task-acceptance-host.d.ts +20 -0
- package/dist/runtime/task-acceptance-record.d.ts +107 -0
- package/dist/runtime/task-acceptance-validation.d.ts +25 -0
- package/dist/runtime/task-acceptance.d.ts +47 -0
- package/dist/runtime/time-to-safe-fix.d.ts +83 -0
- package/dist/runtime/tool-policy-file.d.ts +23 -0
- package/dist/runtime/tool-policy-paths.d.ts +5 -0
- package/dist/runtime/tool-policy.d.ts +6 -0
- package/dist/service-cli.js +19 -14504
- package/dist/{service-client-cli-yx56n0hc.js → service-client-cli-kns4mf57.js} +307 -248
- package/dist/verify-historical-migrations.js +3314 -1251
- package/dist/workspace/path-policy.d.ts +4 -0
- package/dist/zhx.js +3 -5
- package/docs/ACP.md +14 -2
- package/docs/ANTHROPIC.md +33 -0
- package/docs/CLI.md +132 -0
- package/docs/CLIENT_PROTOCOL.md +45 -0
- package/docs/CODE_RELEASE.md +93 -0
- package/docs/ENGINE_API.md +319 -0
- package/docs/EXTENSIBILITY.md +46 -3
- package/docs/FIRST_USE.md +6 -6
- package/docs/LOCAL_SERVICE.md +13 -0
- package/docs/MCP_STDIO.md +20 -0
- package/docs/README.md +6 -0
- package/docs/STABILITY.md +9 -1
- package/docs/SUPPORT_MATRIX.md +1 -1
- package/docs/TOOL_POLICY.md +81 -0
- package/docs/VERTEX.md +50 -0
- package/docs/adr/0002-isolated-mcp-stdio.md +135 -0
- package/docs/fixtures/mcp-stdio-contract-v1.json +189 -0
- package/docs/support-matrix.json +2 -0
- package/evaluations/representative-assembly-matrix.json +64 -1
- package/evaluations/task-acceptance-routes.json +7 -0
- package/examples/README.md +1 -1
- package/package.json +74 -12
- package/dist/cli-entry-64pdp3k5.js +0 -17
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Explicit Harness integration surface. See contracts/engine-api.json for stability tiers. */
|
|
2
|
+
export { HARNESS_CLIENT_PROTOCOL_VERSION, harnessClientCommandSchema, harnessClientRequestSchema } from "../client/protocol.js";
|
|
3
|
+
export type { HarnessClientCommand, HarnessClientRequest, HarnessClientErrorCode, HarnessClientSession, HarnessClientRun, HarnessClientData, HarnessClientResponse, HarnessClientNegotiation, HarnessClientAdapterOptions, HarnessClientAdapter } from "../client/protocol.js";
|
|
4
|
+
export { CLI_JSON_SCHEMA_VERSION, CLI_EVENT_SCHEMA_VERSION, streamEventDocument, serializeStreamEvent, streamResultDocument, serializeStreamResult } from "../client/stream.js";
|
|
5
|
+
export type { StreamRunResultSource } from "../client/stream.js";
|
|
6
|
+
export type { HarnessActivityEvent, HarnessActivityRun, HarnessActivitySnapshot, HarnessActivityPage } from "../client/service-events.js";
|
|
7
|
+
export type { ApprovalDecisionView } from "../approvals/approval-history.js";
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// src/client/protocol.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var HARNESS_CLIENT_PROTOCOL_VERSION = 1;
|
|
4
|
+
var id = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/);
|
|
5
|
+
var revision = z.number().int().nonnegative().safe();
|
|
6
|
+
var scoped = { projectId: id };
|
|
7
|
+
var session = { ...scoped, sessionId: id };
|
|
8
|
+
var run = { ...session, runId: id };
|
|
9
|
+
var mutation = { idempotencyKey: id };
|
|
10
|
+
var checkpoint = { ...session, checkpointId: z.string().uuid() };
|
|
11
|
+
var restore = { ...session, operationId: z.string().uuid() };
|
|
12
|
+
var fileDigest = z.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
13
|
+
var harnessClientCommandSchema = z.discriminatedUnion("method", [
|
|
14
|
+
z.object({ method: z.literal("project.get"), ...scoped }).strict(),
|
|
15
|
+
z.object({ method: z.literal("policy.get"), ...scoped }).strict(),
|
|
16
|
+
z.object({ method: z.literal("session.list"), ...scoped, search: z.string().max(256).optional() }).strict(),
|
|
17
|
+
z.object({ method: z.literal("session.create"), ...scoped, ...mutation, title: z.string().max(256).optional() }).strict(),
|
|
18
|
+
z.object({ method: z.literal("session.get"), ...session }).strict(),
|
|
19
|
+
z.object({ method: z.literal("session.rename"), ...session, ...mutation, expectedRevision: revision, title: z.string().max(256) }).strict(),
|
|
20
|
+
z.object({ method: z.literal("checkpoint.list"), ...session }).strict(),
|
|
21
|
+
z.object({ method: z.literal("checkpoint.inspect"), ...checkpoint }).strict(),
|
|
22
|
+
z.object({
|
|
23
|
+
method: z.literal("checkpoint.capture"),
|
|
24
|
+
...session,
|
|
25
|
+
...mutation,
|
|
26
|
+
expectedRevision: revision,
|
|
27
|
+
turnId: id,
|
|
28
|
+
paths: z.array(z.string().min(1).max(1024)).min(1).max(20)
|
|
29
|
+
}).strict(),
|
|
30
|
+
z.object({
|
|
31
|
+
method: z.literal("restore.prepare"),
|
|
32
|
+
...checkpoint,
|
|
33
|
+
...mutation,
|
|
34
|
+
expectedRevision: revision,
|
|
35
|
+
expected: z.record(z.string().min(1).max(1024), fileDigest).refine((value) => Object.keys(value).length >= 1 && Object.keys(value).length <= 20)
|
|
36
|
+
}).strict(),
|
|
37
|
+
z.object({ method: z.literal("restore.get"), ...restore }).strict(),
|
|
38
|
+
z.object({ method: z.literal("restore.apply"), ...restore, ...mutation, expectedRevision: revision, reviewedProposalId: fileDigest }).strict(),
|
|
39
|
+
z.object({ method: z.literal("restore.recoverFork"), ...restore, ...mutation, expectedRevision: revision, forkSessionId: id }).strict(),
|
|
40
|
+
z.object({ method: z.literal("run.start"), ...session, ...mutation, expectedRevision: revision, prompt: z.string().min(1).max(64 * 1024) }).strict(),
|
|
41
|
+
z.object({ method: z.literal("run.get"), ...run, includeReview: z.boolean().optional(), includeDiff: z.boolean().optional(), decisionOffset: z.number().int().min(0).max(512).optional() }).strict(),
|
|
42
|
+
z.object({
|
|
43
|
+
method: z.literal("approval.resolve"),
|
|
44
|
+
...run,
|
|
45
|
+
...mutation,
|
|
46
|
+
expectedRevision: revision,
|
|
47
|
+
decisions: z.array(z.object({ approvalId: z.string().min(1).max(256), digest: z.string().regex(/^[a-f0-9]{64}$/), approve: z.boolean() }).strict()).min(1).max(64)
|
|
48
|
+
}).strict(),
|
|
49
|
+
z.object({ method: z.literal("run.cancel"), ...run, ...mutation, expectedRevision: revision }).strict()
|
|
50
|
+
]);
|
|
51
|
+
var harnessClientRequestSchema = z.object({
|
|
52
|
+
protocolVersion: z.literal(HARNESS_CLIENT_PROTOCOL_VERSION),
|
|
53
|
+
requestId: id,
|
|
54
|
+
connectionId: id,
|
|
55
|
+
command: harnessClientCommandSchema
|
|
56
|
+
}).strict();
|
|
57
|
+
// src/client/stream.ts
|
|
58
|
+
var CLI_JSON_SCHEMA_VERSION = 1;
|
|
59
|
+
var CLI_EVENT_SCHEMA_VERSION = 1;
|
|
60
|
+
var streamEventDocument = (event, sequence = 0) => {
|
|
61
|
+
if (!Number.isSafeInteger(sequence) || sequence < 0) {
|
|
62
|
+
throw new Error("JSONL event sequence must be a non-negative integer.");
|
|
63
|
+
}
|
|
64
|
+
const base = {
|
|
65
|
+
schemaVersion: CLI_EVENT_SCHEMA_VERSION,
|
|
66
|
+
kind: "run-event",
|
|
67
|
+
sequence,
|
|
68
|
+
type: event.type
|
|
69
|
+
};
|
|
70
|
+
switch (event.type) {
|
|
71
|
+
case "text-delta":
|
|
72
|
+
return { ...base, textDelta: event.textDelta };
|
|
73
|
+
case "tool-call":
|
|
74
|
+
return { ...base, toolCallId: event.toolCall.id, toolName: event.toolCall.name };
|
|
75
|
+
case "tool-result":
|
|
76
|
+
return {
|
|
77
|
+
...base,
|
|
78
|
+
toolCallId: event.toolResult.toolCallId,
|
|
79
|
+
toolName: event.toolResult.toolName,
|
|
80
|
+
isError: event.toolResult.isError
|
|
81
|
+
};
|
|
82
|
+
case "tool-approval-request":
|
|
83
|
+
case "agent-approval-request":
|
|
84
|
+
return {
|
|
85
|
+
...base,
|
|
86
|
+
approvalRequestId: event.approval.id,
|
|
87
|
+
approvalKind: event.approval.kind ?? "provider",
|
|
88
|
+
toolName: event.approval.name
|
|
89
|
+
};
|
|
90
|
+
case "agent-approval-resolved":
|
|
91
|
+
return {
|
|
92
|
+
...base,
|
|
93
|
+
approvalRequestId: event.approval.approvalRequestId,
|
|
94
|
+
approved: event.approval.approve
|
|
95
|
+
};
|
|
96
|
+
case "provider-data":
|
|
97
|
+
return { ...base, provider: event.provider };
|
|
98
|
+
case "image-generation":
|
|
99
|
+
return {
|
|
100
|
+
...base,
|
|
101
|
+
provider: event.provider,
|
|
102
|
+
partial: event.partial,
|
|
103
|
+
...event.id ? { id: event.id } : {},
|
|
104
|
+
...event.index !== undefined ? { index: event.index } : {}
|
|
105
|
+
};
|
|
106
|
+
case "finish":
|
|
107
|
+
return {
|
|
108
|
+
...base,
|
|
109
|
+
...event.finishReason ? { finishReason: event.finishReason } : {},
|
|
110
|
+
...event.usage ? { usage: event.usage } : {}
|
|
111
|
+
};
|
|
112
|
+
case "error":
|
|
113
|
+
return { ...base, error: "Provider stream failed." };
|
|
114
|
+
case "agent-run-start":
|
|
115
|
+
return { ...base, currentStep: event.currentStep, maxSteps: event.maxSteps };
|
|
116
|
+
case "agent-step-start":
|
|
117
|
+
return { ...base, stepIndex: event.stepIndex };
|
|
118
|
+
case "agent-step-finish":
|
|
119
|
+
return {
|
|
120
|
+
...base,
|
|
121
|
+
stepIndex: event.step.index,
|
|
122
|
+
status: event.step.status,
|
|
123
|
+
toolCalls: event.step.toolResults.length
|
|
124
|
+
};
|
|
125
|
+
case "agent-compaction":
|
|
126
|
+
return {
|
|
127
|
+
...base,
|
|
128
|
+
compactionId: event.compaction.id,
|
|
129
|
+
reasons: event.compaction.reasons,
|
|
130
|
+
messageCountBefore: event.compaction.messageCountBefore,
|
|
131
|
+
messageCountAfter: event.compaction.messageCountAfter
|
|
132
|
+
};
|
|
133
|
+
case "agent-run-finish":
|
|
134
|
+
return {
|
|
135
|
+
...base,
|
|
136
|
+
runId: event.state.runId,
|
|
137
|
+
status: event.status,
|
|
138
|
+
provider: event.state.provider,
|
|
139
|
+
model: event.state.modelId
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
var serializeStreamEvent = (event, sequence = 0) => JSON.stringify(streamEventDocument(event, sequence));
|
|
144
|
+
var streamResultDocument = (result, sequence = 0) => {
|
|
145
|
+
if (!Number.isSafeInteger(sequence) || sequence < 0) {
|
|
146
|
+
throw new Error("JSONL result sequence must be a non-negative integer.");
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
schemaVersion: CLI_EVENT_SCHEMA_VERSION,
|
|
150
|
+
kind: "run-stream-result",
|
|
151
|
+
sequence,
|
|
152
|
+
runId: result.runId,
|
|
153
|
+
status: result.status,
|
|
154
|
+
provider: result.provider,
|
|
155
|
+
model: result.model,
|
|
156
|
+
steps: result.steps,
|
|
157
|
+
toolCalls: result.toolCalls,
|
|
158
|
+
pendingApprovals: (result.pendingApprovals ?? []).map((approval) => ({
|
|
159
|
+
id: approval.id,
|
|
160
|
+
kind: approval.kind,
|
|
161
|
+
name: approval.name,
|
|
162
|
+
...approval.childRunId ? { childRunId: approval.childRunId } : {},
|
|
163
|
+
...approval.childAgentId ? { childAgentId: approval.childAgentId } : {}
|
|
164
|
+
})),
|
|
165
|
+
children: (result.children ?? []).map((child) => ({
|
|
166
|
+
runId: child.runId,
|
|
167
|
+
status: child.status
|
|
168
|
+
}))
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
var serializeStreamResult = (result, sequence = 0) => JSON.stringify(streamResultDocument(result, sequence));
|
|
172
|
+
export {
|
|
173
|
+
CLI_EVENT_SCHEMA_VERSION,
|
|
174
|
+
CLI_JSON_SCHEMA_VERSION,
|
|
175
|
+
HARNESS_CLIENT_PROTOCOL_VERSION,
|
|
176
|
+
harnessClientCommandSchema,
|
|
177
|
+
harnessClientRequestSchema,
|
|
178
|
+
serializeStreamEvent,
|
|
179
|
+
serializeStreamResult,
|
|
180
|
+
streamEventDocument,
|
|
181
|
+
streamResultDocument
|
|
182
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Explicit Harness integration surface. See contracts/engine-api.json for stability tiers. */
|
|
2
|
+
export { harnessLocalCredentialsSchema, startHarnessLocalService, readHarnessLocalCredentials, requestHarnessLocalService, recoverHarnessLocalService } from "../client/local-service.js";
|
|
3
|
+
export type { HarnessLocalService, HarnessLocalServiceOptions, HarnessLocalCredentials } from "../client/local-service.js";
|
|
4
|
+
export { openHarnessActivityStore } from "../client/service-events.js";
|
|
5
|
+
export type { HarnessActivityEvent, HarnessActivityRun, HarnessActivitySnapshot, HarnessActivityPage, HarnessActivityStore, HarnessActivityOptions } from "../client/service-events.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
harnessLocalCredentialsSchema,
|
|
3
|
+
openHarnessActivityStore,
|
|
4
|
+
readHarnessLocalCredentials,
|
|
5
|
+
recoverHarnessLocalService,
|
|
6
|
+
requestHarnessLocalService,
|
|
7
|
+
startHarnessLocalService
|
|
8
|
+
} from "../index-2gz7jv7g.js";
|
|
9
|
+
import"../index-jgrx804e.js";
|
|
10
|
+
import"../index-h0mqx2ed.js";
|
|
11
|
+
import"../index-8zzhggxv.js";
|
|
12
|
+
import"../index-42gp2hy8.js";
|
|
13
|
+
import"../index-t60rva31.js";
|
|
14
|
+
import"../index-z0qxmkm2.js";
|
|
15
|
+
import"../index-yb239ghk.js";
|
|
16
|
+
import"../index-gq9xagx2.js";
|
|
17
|
+
import"../index-8705zxpr.js";
|
|
18
|
+
import"../index-xqxeypt5.js";
|
|
19
|
+
import"../index-qfpz5y2v.js";
|
|
20
|
+
import"../index-1bx83sw4.js";
|
|
21
|
+
export {
|
|
22
|
+
harnessLocalCredentialsSchema,
|
|
23
|
+
openHarnessActivityStore,
|
|
24
|
+
readHarnessLocalCredentials,
|
|
25
|
+
recoverHarnessLocalService,
|
|
26
|
+
requestHarnessLocalService,
|
|
27
|
+
startHarnessLocalService
|
|
28
|
+
};
|
|
@@ -93,6 +93,14 @@ export declare class CliOciRuntimeAdapter implements HarnessOciRuntimeAdapter {
|
|
|
93
93
|
removeRunContainers(runId: string): Promise<number>;
|
|
94
94
|
cleanupOrphans(): Promise<number>;
|
|
95
95
|
}
|
|
96
|
+
interface SnapshotFile {
|
|
97
|
+
path: string;
|
|
98
|
+
digest: FileDigest;
|
|
99
|
+
contents: Buffer;
|
|
100
|
+
mode: number;
|
|
101
|
+
bytes: number;
|
|
102
|
+
}
|
|
103
|
+
type SnapshotFileMetadata = Omit<SnapshotFile, "contents">;
|
|
96
104
|
export interface HarnessExecutionIoMetrics {
|
|
97
105
|
inventoryPasses: number;
|
|
98
106
|
inventoryPages: number;
|
|
@@ -106,6 +114,8 @@ export interface HarnessExecutionIoMetrics {
|
|
|
106
114
|
workspacePublishes: number;
|
|
107
115
|
workspaceExports: number;
|
|
108
116
|
}
|
|
117
|
+
export declare const collectSnapshotInventory: (workspace: Workspace, maxWorkspaceBytes: number, metrics?: HarnessExecutionIoMetrics, maxEntries?: number) => Promise<Map<string, SnapshotFileMetadata>>;
|
|
118
|
+
export declare const readSnapshotFile: (workspace: Workspace, expected: SnapshotFileMetadata, metrics?: HarnessExecutionIoMetrics, requireSingleLink?: boolean) => Promise<SnapshotFile>;
|
|
109
119
|
interface EnvironmentPatchEntry {
|
|
110
120
|
path: string;
|
|
111
121
|
operation: "create" | "update" | "delete";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IsolatedMcpChannel } from '../integrations/mcp-stdio-client.js';
|
|
2
|
+
/** Internal cleanup primitive; the owning channel supplies its fixed Docker endpoint. */
|
|
3
|
+
export declare function removeDockerMcpBoundary(cli: (args: string[]) => Promise<string>, id: string): Promise<void>;
|
|
4
|
+
/** Internal handle for a host-created OCI container, never a client-supplied command. */
|
|
5
|
+
export declare function openDockerMcpChannel(options: {
|
|
6
|
+
containerId: string;
|
|
7
|
+
imageId: string;
|
|
8
|
+
sessionMs: number;
|
|
9
|
+
maxOutputBytes: number;
|
|
10
|
+
attest?: (inspection: unknown) => void;
|
|
11
|
+
}): Promise<IsolatedMcpChannel>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { reserveMcpResources } from '../persistence/mcp-resource-journal.js';
|
|
2
|
+
import { withAdmittedMcpLaunch } from '../integrations/mcp-stdio-launch.js';
|
|
3
|
+
import { IsolatedMcpStdioClient } from '../integrations/mcp-stdio-client.js';
|
|
4
|
+
import type { McpStdioLaunchProposal } from '../integrations/mcp-stdio-admission.js';
|
|
5
|
+
import { createIsolatedMcpTools } from '../integrations/mcp-stdio-tools.js';
|
|
6
|
+
export declare function effectiveMcpContainerEnvironment(input: unknown): Record<string, string>;
|
|
7
|
+
/** Complete pre-start checks in addition to openDockerMcpChannel's isolation checks. */
|
|
8
|
+
export declare function attestMcpServer(inspection: unknown, expected: {
|
|
9
|
+
imageId: string;
|
|
10
|
+
volumeName: string;
|
|
11
|
+
proposal: Readonly<McpStdioLaunchProposal>;
|
|
12
|
+
environment: Readonly<Record<string, string>>;
|
|
13
|
+
}): void;
|
|
14
|
+
/** Internal host API. Per-tool approvals and durable lifecycle integration remain above this layer. */
|
|
15
|
+
export declare function launchDockerMcpServer(options: Omit<Parameters<typeof withAdmittedMcpLaunch>[0], 'seed'> & {
|
|
16
|
+
provisionerImageId: string;
|
|
17
|
+
resourceJournal?: Pick<Parameters<typeof reserveMcpResources>[0], 'store' | 'runId' | 'scope' | 'hostId'>;
|
|
18
|
+
}): Promise<IsolatedMcpStdioClient>;
|
|
19
|
+
/** Agent-facing internal bridge; does not expose the unguarded transport client. */
|
|
20
|
+
type McpToolLaunchOptions = Parameters<typeof launchDockerMcpServer>[0] & {
|
|
21
|
+
journal: NonNullable<Parameters<typeof createIsolatedMcpTools>[0]['journal']> & {
|
|
22
|
+
hostId: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function launchDockerMcpTools(options: McpToolLaunchOptions): Promise<Readonly<{
|
|
26
|
+
tools: import("@zhivex-ai/core").ToolSet;
|
|
27
|
+
hostSession: Readonly<Record<never, never>>;
|
|
28
|
+
close: () => Promise<void>;
|
|
29
|
+
}>>;
|
|
30
|
+
/** One host-owned batch. Recovery is performed by the first launch; later members
|
|
31
|
+
* belong to that batch and must not treat their live siblings as crashed owners. */
|
|
32
|
+
export declare function launchDockerMcpGroup(input: readonly (McpToolLaunchOptions & {
|
|
33
|
+
proposal: McpStdioLaunchProposal;
|
|
34
|
+
})[], signal?: AbortSignal): Promise<Readonly<{
|
|
35
|
+
hostSession: Readonly<Record<never, never>>;
|
|
36
|
+
close: () => Promise<void>;
|
|
37
|
+
}>>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { McpResourceLeaseJournal } from '../persistence/mcp-resource-journal.js';
|
|
2
|
+
import type { McpStdioLaunchProposal } from '../integrations/mcp-stdio-admission.js';
|
|
3
|
+
type File = {
|
|
4
|
+
path: string;
|
|
5
|
+
contents: Uint8Array;
|
|
6
|
+
executable: boolean;
|
|
7
|
+
};
|
|
8
|
+
export interface DockerMcpWorkspaceLease {
|
|
9
|
+
/** Private volume must be mounted only by the admitted server, read-only unless write was admitted. */
|
|
10
|
+
readonly volumeName: string;
|
|
11
|
+
/** Keep the seeder alive until the server mounts the tmpfs, otherwise its data disappears. */
|
|
12
|
+
stopSeeder(): Promise<void>;
|
|
13
|
+
/** The owner must first remove every server using this volume. */
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/** Host-only creator, invoked inside withAdmittedMcpLaunch's seed callback. */
|
|
17
|
+
export declare function createDockerMcpWorkspace(options: {
|
|
18
|
+
provisionerImageId: string;
|
|
19
|
+
resources?: McpResourceLeaseJournal;
|
|
20
|
+
proposal: Readonly<McpStdioLaunchProposal>;
|
|
21
|
+
files: AsyncIterable<File>;
|
|
22
|
+
}): Promise<DockerMcpWorkspaceLease>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AgentRunStore, AgentStoreScope } from '@zhivex-ai/core';
|
|
2
|
+
type DockerCli = (args: string[]) => Promise<string>;
|
|
3
|
+
/** Internal recovery primitive. CLI must target the host-selected Docker daemon. */
|
|
4
|
+
export declare function recoverMcpResources(options: {
|
|
5
|
+
store: AgentRunStore;
|
|
6
|
+
runId: string;
|
|
7
|
+
scope: AgentStoreScope;
|
|
8
|
+
hostId: string;
|
|
9
|
+
cli: DockerCli;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
closed: number;
|
|
12
|
+
deferred: number;
|
|
13
|
+
}>;
|
|
14
|
+
/** Host-only entry point; never discovers or sweeps resources outside persisted names. */
|
|
15
|
+
export declare function recoverDockerMcpResources(options: Omit<Parameters<typeof recoverMcpResources>[0], 'cli'>): Promise<{
|
|
16
|
+
closed: number;
|
|
17
|
+
deferred: number;
|
|
18
|
+
}>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Workspace } from '../workspace/workspace.js';
|
|
2
|
+
export interface McpWorkspaceSnapshot {
|
|
3
|
+
readonly digest: string;
|
|
4
|
+
readonly workspace: string;
|
|
5
|
+
readonly files: number;
|
|
6
|
+
readonly bytes: number;
|
|
7
|
+
}
|
|
8
|
+
/** Host-only snapshot preparation. No container, secrets, commands or model input. */
|
|
9
|
+
export declare function prepareMcpWorkspaceSnapshot(workspace: Workspace, maxWorkspaceBytes: number): Promise<McpWorkspaceSnapshot>;
|
|
10
|
+
/** Single-use, identity-bound handoff to the trusted OCI volume seeder. */
|
|
11
|
+
export declare function consumeMcpWorkspaceSnapshot(snapshot: McpWorkspaceSnapshot, expected: {
|
|
12
|
+
snapshotDigest: string;
|
|
13
|
+
workspace: string;
|
|
14
|
+
maxWorkspaceBytes: number;
|
|
15
|
+
}, seed: (files: AsyncIterable<{
|
|
16
|
+
path: string;
|
|
17
|
+
contents: Uint8Array;
|
|
18
|
+
executable: boolean;
|
|
19
|
+
}>) => Promise<void>): Promise<void>;
|
|
20
|
+
export declare function discardMcpWorkspaceSnapshot(snapshot: McpWorkspaceSnapshot): Promise<void>;
|