@openpond/harness 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRACT.md +35 -0
- package/dist/common.js +3 -0
- package/dist/index.js +4 -0
- package/dist/models.js +20 -0
- package/dist/provider-loop.js +70 -0
- package/dist/runtime-source.js +2 -0
- package/dist/source-execution.js +65 -0
- package/dist/source-package.js +144 -0
- package/dist/source-runtime.js +125 -0
- package/dist/types/common.d.ts +6 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/models.d.ts +36 -0
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/provider-loop.d.ts +53 -0
- package/dist/types/provider-loop.d.ts.map +1 -0
- package/dist/types/runtime-source.d.ts +2 -0
- package/dist/types/source-execution.d.ts +85 -0
- package/dist/types/source-execution.d.ts.map +1 -0
- package/dist/types/source-package.d.ts +198 -0
- package/dist/types/source-package.d.ts.map +1 -0
- package/dist/types/source-runtime.d.ts +114 -0
- package/dist/types/source-runtime.d.ts.map +1 -0
- package/package.json +8 -2
package/CONTRACT.md
CHANGED
|
@@ -51,3 +51,38 @@ unselected evidence remains available to a later host watermark.
|
|
|
51
51
|
Evaluation execution and model-improvement qualification contracts that bind a
|
|
52
52
|
Harness to a Taskset, scored baseline, Model, verifier, and training signal
|
|
53
53
|
belong to `@openpond/evals`.
|
|
54
|
+
|
|
55
|
+
## Released source transport
|
|
56
|
+
|
|
57
|
+
`openpond.harnessSourcePackage.v1` carries the complete immutable Agent
|
|
58
|
+
snapshot, Harness release and their released file bytes. Creation and readback
|
|
59
|
+
verify both release hashes, dependency references, the exact file population,
|
|
60
|
+
canonical base64, individual file hashes and a 25 MiB total byte limit.
|
|
61
|
+
Rehashing a transport envelope does not authorize different source bytes.
|
|
62
|
+
Instruction and Skill entry files must be policy-visible; verifier and
|
|
63
|
+
host-private assets retain their declared visibility and must never be exposed
|
|
64
|
+
to a policy by iterating the complete source map.
|
|
65
|
+
|
|
66
|
+
This is source transport, not runtime conformance. Hosts authorize export and
|
|
67
|
+
select an execution adapter that consumes the captured source, verifies its
|
|
68
|
+
capabilities and records effective context. A matching Harness release hash
|
|
69
|
+
alone does not prove that instructions, Skills or executable dependencies ran.
|
|
70
|
+
|
|
71
|
+
`createHarnessSourceRuntime` consumes captured source for the declarative
|
|
72
|
+
`openpond.agent-runtime.v1` program. It loads released instruction and Skill
|
|
73
|
+
text, verifies required capabilities, dependency versions and actual tool
|
|
74
|
+
schemas, and exposes policy-visible resources through bounded byte-range reads.
|
|
75
|
+
Private assets never enter its context or reader. Unsupported programs and
|
|
76
|
+
released subagents fail admission. Hosts must provide their actual tools and
|
|
77
|
+
capabilities; this helper does not implement missing execution capabilities.
|
|
78
|
+
The runtime receipt binds the source, effective system prompt, loaded assets
|
|
79
|
+
and tool definitions. Hosts retain that receipt with attempt evidence.
|
|
80
|
+
|
|
81
|
+
`executeHarnessRollout` owns the shared policy/environment round lifecycle,
|
|
82
|
+
released resource calls, retained conversation and exhaustion behavior. Hosts
|
|
83
|
+
supply policy transport and environment step/termination operations. Desktop's
|
|
84
|
+
agent runtime re-exports the same provider loop from this package.
|
|
85
|
+
`@openpond/harness/runtime-source` distributes a self-contained ESM build of
|
|
86
|
+
source admission and rollout execution with its SHA-256. Hosted archives use
|
|
87
|
+
those published bytes instead of implementing a second source reader or loop.
|
|
88
|
+
The clean consumer check executes this distribution without module resolution.
|
package/dist/common.js
CHANGED
|
@@ -10,6 +10,9 @@ export const ImmutableReleaseRefSchema = z.object({
|
|
|
10
10
|
id: ReleaseIdSchema,
|
|
11
11
|
contentHash: ReleaseHashSchema,
|
|
12
12
|
}).strict();
|
|
13
|
+
export const VersionedReleaseRefSchema = ImmutableReleaseRefSchema.extend({
|
|
14
|
+
revision: z.number().int().positive(),
|
|
15
|
+
}).strict();
|
|
13
16
|
export const ImmutableAssetRefSchema = z.object({
|
|
14
17
|
id: ReleaseIdSchema,
|
|
15
18
|
path: z.string().trim().min(1).max(MAX_PORTABLE_PATH_BYTES).refine(safeRelativePath),
|
package/dist/index.js
CHANGED
|
@@ -10,3 +10,7 @@ export * from "./refiner-detection.js";
|
|
|
10
10
|
export * from "./refinement-lifecycle.js";
|
|
11
11
|
export * from "./refiner-support.js";
|
|
12
12
|
export * from "./tools.js";
|
|
13
|
+
export * from "./source-package.js";
|
|
14
|
+
export * from "./source-runtime.js";
|
|
15
|
+
export * from "./provider-loop.js";
|
|
16
|
+
export * from "./source-execution.js";
|
package/dist/models.js
CHANGED
|
@@ -8,3 +8,23 @@ export const ModelRefSchema = z.object({
|
|
|
8
8
|
tokenizerRevision: z.string().trim().min(1).max(500).nullable().default(null),
|
|
9
9
|
chatTemplateHash: ReleaseHashSchema.nullable().default(null),
|
|
10
10
|
}).strict();
|
|
11
|
+
export const PROVIDER_IDS = [
|
|
12
|
+
"openpond",
|
|
13
|
+
"codex",
|
|
14
|
+
"anthropic",
|
|
15
|
+
"openai",
|
|
16
|
+
"xai",
|
|
17
|
+
"google",
|
|
18
|
+
"openrouter",
|
|
19
|
+
"deepseek",
|
|
20
|
+
"zai",
|
|
21
|
+
"moonshot",
|
|
22
|
+
"together",
|
|
23
|
+
"groq",
|
|
24
|
+
"custom-openai-compatible",
|
|
25
|
+
];
|
|
26
|
+
export const ProviderIdSchema = z.enum(PROVIDER_IDS);
|
|
27
|
+
export const ChatModelRefSchema = z.object({
|
|
28
|
+
providerId: ProviderIdSchema,
|
|
29
|
+
modelId: z.string().trim().min(1).max(300),
|
|
30
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export async function* providerRoundSequence(input) {
|
|
2
|
+
if (!Number.isInteger(input.maxRounds) || input.maxRounds < 1) {
|
|
3
|
+
throw new Error("Provider maxRounds must be a positive integer.");
|
|
4
|
+
}
|
|
5
|
+
for (let index = 0; index < input.maxRounds; index += 1) {
|
|
6
|
+
if (input.signal.aborted)
|
|
7
|
+
throw input.signal.reason ?? new Error("Provider loop interrupted.");
|
|
8
|
+
yield {
|
|
9
|
+
index,
|
|
10
|
+
requestId: `${input.turnId}:model:${index}`,
|
|
11
|
+
signal: input.signal
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Owns provider/tool round sequencing, completion, exhaustion, and aborts. */
|
|
16
|
+
export async function runProviderRoundLoop(input) {
|
|
17
|
+
for await (const round of providerRoundSequence(input)) {
|
|
18
|
+
const decision = await input.runRound(round);
|
|
19
|
+
if (decision.type === "complete")
|
|
20
|
+
return decision.result;
|
|
21
|
+
}
|
|
22
|
+
return input.onExhausted();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Owns provider stream consumption and the normalized round result. The host
|
|
26
|
+
* supplies the provider request, usage recorder, and provider-specific delta
|
|
27
|
+
* shapes without duplicating the stream lifecycle.
|
|
28
|
+
*/
|
|
29
|
+
export async function runProviderRound(input) {
|
|
30
|
+
let text = "";
|
|
31
|
+
let reasoningText = "";
|
|
32
|
+
let usage;
|
|
33
|
+
let continuation = null;
|
|
34
|
+
let finishReason;
|
|
35
|
+
const toolCallBatches = [];
|
|
36
|
+
try {
|
|
37
|
+
for await (const delta of input.stream) {
|
|
38
|
+
await input.onDelta?.(delta);
|
|
39
|
+
if (input.signal.aborted) {
|
|
40
|
+
throw input.signal.reason ?? new Error("Provider round interrupted.");
|
|
41
|
+
}
|
|
42
|
+
if (delta.text)
|
|
43
|
+
text += delta.text;
|
|
44
|
+
if (delta.reasoningText)
|
|
45
|
+
reasoningText += delta.reasoningText;
|
|
46
|
+
if (delta.usage !== undefined)
|
|
47
|
+
usage = delta.usage;
|
|
48
|
+
if (delta.continuation !== undefined)
|
|
49
|
+
continuation = delta.continuation;
|
|
50
|
+
if (delta.toolCalls)
|
|
51
|
+
toolCallBatches.push([...delta.toolCalls]);
|
|
52
|
+
if (delta.finishReason !== undefined)
|
|
53
|
+
finishReason = delta.finishReason;
|
|
54
|
+
}
|
|
55
|
+
const result = {
|
|
56
|
+
text,
|
|
57
|
+
reasoningText,
|
|
58
|
+
usage,
|
|
59
|
+
continuation,
|
|
60
|
+
toolCallBatches,
|
|
61
|
+
finishReason,
|
|
62
|
+
};
|
|
63
|
+
await input.onCompleted?.(result);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
await input.onFailed?.(error);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|