@openpond/evals 0.12.3 → 0.12.4
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/LEARNING.md +22 -0
- package/dist/tool-learning/actions.js +62 -0
- package/dist/tool-learning/consultation.js +198 -0
- package/dist/tool-learning/episodes.js +284 -0
- package/dist/tool-learning/index.js +6 -0
- package/dist/tool-learning/installations.js +151 -0
- package/dist/tool-learning/policy.js +38 -0
- package/dist/tool-learning/primitives.js +87 -0
- package/dist/types/tool-learning/actions.d.ts +54 -0
- package/dist/types/tool-learning/actions.d.ts.map +1 -0
- package/dist/types/tool-learning/consultation.d.ts +229 -0
- package/dist/types/tool-learning/consultation.d.ts.map +1 -0
- package/dist/types/tool-learning/episodes.d.ts +1058 -0
- package/dist/types/tool-learning/episodes.d.ts.map +1 -0
- package/dist/types/tool-learning/index.d.ts +7 -0
- package/dist/types/tool-learning/index.d.ts.map +1 -0
- package/dist/types/tool-learning/installations.d.ts +296 -0
- package/dist/types/tool-learning/installations.d.ts.map +1 -0
- package/dist/types/tool-learning/policy.d.ts +3 -0
- package/dist/types/tool-learning/policy.d.ts.map +1 -0
- package/dist/types/tool-learning/primitives.d.ts +73 -0
- package/dist/types/tool-learning/primitives.d.ts.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TOOL_LEARNING_LIMITS, ToolLearningClientSchema, ToolLearningHashSchema as Hash, ToolLearningIdSchema as Id, ToolLearningRefSchema as Ref, ToolLearningScopeSchema, ToolLearningTimestampSchema as Timestamp, boundedToolLearningSchema, } from "./primitives.js";
|
|
3
|
+
export const ToolLearningCapturePolicySchema = z
|
|
4
|
+
.object({
|
|
5
|
+
revision: z.number().int().positive(),
|
|
6
|
+
permittedTools: z.array(z.string().min(1).max(200)).min(1).max(100),
|
|
7
|
+
workspaceRootHashes: z.array(Hash).min(1).max(32),
|
|
8
|
+
permittedFields: z
|
|
9
|
+
.array(z.enum(["action", "intent", "state", "result_excerpt", "artifact_reference"]))
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(5),
|
|
12
|
+
unchangedControls: z
|
|
13
|
+
.object({
|
|
14
|
+
numerator: z.number().int().nonnegative(),
|
|
15
|
+
denominator: z.number().int().positive(),
|
|
16
|
+
})
|
|
17
|
+
.strict(),
|
|
18
|
+
maximumEventBytes: z.number().int().positive().max(TOOL_LEARNING_LIMITS.eventBytes),
|
|
19
|
+
maximumEpisodeBytes: z.number().int().positive().max(TOOL_LEARNING_LIMITS.episodeBytes),
|
|
20
|
+
maximumEpisodeEvents: z.number().int().positive().max(TOOL_LEARNING_LIMITS.eventsPerEpisode),
|
|
21
|
+
maximumQueueBytes: z.number().int().positive().max(TOOL_LEARNING_LIMITS.queueBytes),
|
|
22
|
+
maximumQueueEvents: z.number().int().positive().max(TOOL_LEARNING_LIMITS.queueEvents),
|
|
23
|
+
maximumQueueAgeSeconds: z.number().int().positive().max(TOOL_LEARNING_LIMITS.queueAgeSeconds),
|
|
24
|
+
rawRetentionDays: z.number().int().min(1).max(30),
|
|
25
|
+
purposes: z
|
|
26
|
+
.array(z.enum(["capture", "consultation"]))
|
|
27
|
+
.min(1)
|
|
28
|
+
.max(2),
|
|
29
|
+
modelUpdates: z.literal("requires_separate_review"),
|
|
30
|
+
variantGeneration: z.literal("disabled"),
|
|
31
|
+
})
|
|
32
|
+
.strict()
|
|
33
|
+
.superRefine((policy, context) => {
|
|
34
|
+
if (policy.unchangedControls.numerator > policy.unchangedControls.denominator)
|
|
35
|
+
context.addIssue({
|
|
36
|
+
code: "custom",
|
|
37
|
+
path: ["unchangedControls"],
|
|
38
|
+
message: "Sampling probability cannot exceed one.",
|
|
39
|
+
});
|
|
40
|
+
for (const key of [
|
|
41
|
+
"permittedTools",
|
|
42
|
+
"workspaceRootHashes",
|
|
43
|
+
"permittedFields",
|
|
44
|
+
"purposes",
|
|
45
|
+
])
|
|
46
|
+
if (new Set(policy[key]).size !== policy[key].length)
|
|
47
|
+
context.addIssue({
|
|
48
|
+
code: "custom",
|
|
49
|
+
path: [key],
|
|
50
|
+
message: "Policy entries must be unique.",
|
|
51
|
+
});
|
|
52
|
+
if (policy.maximumEpisodeBytes < policy.maximumEventBytes ||
|
|
53
|
+
policy.maximumQueueBytes < policy.maximumEventBytes)
|
|
54
|
+
context.addIssue({
|
|
55
|
+
code: "custom",
|
|
56
|
+
message: "Episode and queue capacities must fit one permitted event.",
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
export const ToolLearningCoverageSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
receipt: Ref.nullable(),
|
|
62
|
+
start: z.enum(["observed", "documented", "unsupported", "unqualified"]),
|
|
63
|
+
resume: z.enum(["observed", "documented", "unsupported", "unqualified"]),
|
|
64
|
+
compaction: z.enum(["observed", "documented", "unsupported", "unqualified"]),
|
|
65
|
+
executionFailure: z.enum(["observed", "documented", "unsupported", "unqualified"]),
|
|
66
|
+
processFailure: z.enum(["observed", "documented", "unsupported", "unqualified"]),
|
|
67
|
+
validationFailure: z.enum(["observed", "documented", "unsupported", "unqualified"]),
|
|
68
|
+
nestedCalls: z.enum(["observed", "documented", "unsupported", "unqualified"]),
|
|
69
|
+
contextRefresh: z.enum([
|
|
70
|
+
"session_start",
|
|
71
|
+
"start_resume",
|
|
72
|
+
"start_resume_compaction",
|
|
73
|
+
"revision_aware_turn",
|
|
74
|
+
"unqualified",
|
|
75
|
+
]),
|
|
76
|
+
gaps: z.array(z.string().min(1).max(500)).max(32),
|
|
77
|
+
})
|
|
78
|
+
.strict()
|
|
79
|
+
.superRefine((coverage, context) => {
|
|
80
|
+
if (Object.values(coverage).includes("observed") && !coverage.receipt)
|
|
81
|
+
context.addIssue({
|
|
82
|
+
code: "custom",
|
|
83
|
+
path: ["receipt"],
|
|
84
|
+
message: "Observed coverage requires a qualification receipt.",
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
export const ToolLearningRegistrationSchema = boundedToolLearningSchema(z
|
|
88
|
+
.object({
|
|
89
|
+
schemaVersion: z.literal("openpond.toolLearningRegistration.v1"),
|
|
90
|
+
operationId: Id,
|
|
91
|
+
installationId: Id,
|
|
92
|
+
projectId: Id,
|
|
93
|
+
machineSourceId: Id,
|
|
94
|
+
client: ToolLearningClientSchema,
|
|
95
|
+
clientVersion: z.string().min(1).max(200),
|
|
96
|
+
adapterRelease: Ref,
|
|
97
|
+
collectionPolicy: ToolLearningCapturePolicySchema,
|
|
98
|
+
})
|
|
99
|
+
.strict(), TOOL_LEARNING_LIMITS.eventBytes);
|
|
100
|
+
/** Status deliberately exposes capability/expiry metadata, never the credential. */
|
|
101
|
+
export const ToolLearningInstallationSchema = z
|
|
102
|
+
.object({
|
|
103
|
+
schemaVersion: z.literal("openpond.toolLearningInstallation.v1"),
|
|
104
|
+
id: Id,
|
|
105
|
+
revision: z.number().int().positive(),
|
|
106
|
+
scope: ToolLearningScopeSchema,
|
|
107
|
+
ownerUserId: Id,
|
|
108
|
+
machineSourceId: Id,
|
|
109
|
+
client: ToolLearningClientSchema,
|
|
110
|
+
clientVersion: z.string().min(1).max(200),
|
|
111
|
+
adapterRelease: Ref,
|
|
112
|
+
state: z.enum(["pending_client_trust", "enabled", "disabled", "revoked"]),
|
|
113
|
+
collectionPolicy: ToolLearningCapturePolicySchema,
|
|
114
|
+
collectionPolicyHash: Hash,
|
|
115
|
+
coverage: ToolLearningCoverageSchema,
|
|
116
|
+
credential: z
|
|
117
|
+
.object({
|
|
118
|
+
id: Id,
|
|
119
|
+
expiresAt: Timestamp,
|
|
120
|
+
revokedAt: Timestamp.nullable(),
|
|
121
|
+
capabilities: z
|
|
122
|
+
.array(z.enum(["episode_append", "manifest_read", "consultation_submit", "consultation_read"]))
|
|
123
|
+
.min(1)
|
|
124
|
+
.max(4),
|
|
125
|
+
})
|
|
126
|
+
.strict()
|
|
127
|
+
.nullable(),
|
|
128
|
+
createdAt: Timestamp,
|
|
129
|
+
updatedAt: Timestamp,
|
|
130
|
+
})
|
|
131
|
+
.strict();
|
|
132
|
+
export const ToolLearningInstallationUpdateSchema = z
|
|
133
|
+
.object({
|
|
134
|
+
operationId: Id,
|
|
135
|
+
expectedRevision: z.number().int().positive(),
|
|
136
|
+
state: z.enum(["enabled", "disabled", "revoked"]),
|
|
137
|
+
})
|
|
138
|
+
.strict();
|
|
139
|
+
export const ToolEpisodeOriginSchema = z
|
|
140
|
+
.object({
|
|
141
|
+
schemaVersion: z.literal("openpond.toolEpisodeOrigin.v1"),
|
|
142
|
+
installationId: Id,
|
|
143
|
+
projectId: Id,
|
|
144
|
+
ownerUserId: Id,
|
|
145
|
+
episode: Ref,
|
|
146
|
+
event: Ref,
|
|
147
|
+
appendReceipt: Ref,
|
|
148
|
+
purpose: z.literal("private_dataset_evidence"),
|
|
149
|
+
trainingConsent: z.literal("not_granted"),
|
|
150
|
+
})
|
|
151
|
+
.strict();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ToolEpisodeEventSchema } from "./episodes.js";
|
|
2
|
+
import { ToolLearningCapturePolicySchema } from "./installations.js";
|
|
3
|
+
import { toolLearningContentHash } from "./primitives.js";
|
|
4
|
+
/** Shared local-persistence/intake boundary. A hash alone does not grant consent. */
|
|
5
|
+
export function assertToolEpisodeCapturePolicy(eventValue, policyValue) {
|
|
6
|
+
const event = ToolEpisodeEventSchema.parse(eventValue);
|
|
7
|
+
const policy = ToolLearningCapturePolicySchema.parse(policyValue);
|
|
8
|
+
if (!policy.purposes.includes("capture"))
|
|
9
|
+
throw new Error("tool_learning_capture_not_enabled");
|
|
10
|
+
if (event.sanitization.policyRevision !== policy.revision ||
|
|
11
|
+
event.sanitization.policyHash !== toolLearningContentHash(policy))
|
|
12
|
+
throw new Error("tool_learning_capture_policy_changed");
|
|
13
|
+
if (new TextEncoder().encode(JSON.stringify(event)).byteLength > policy.maximumEventBytes)
|
|
14
|
+
throw new Error("tool_learning_event_policy_limit");
|
|
15
|
+
const permits = (field) => policy.permittedFields.includes(field);
|
|
16
|
+
if (event.eventKind === "attempt") {
|
|
17
|
+
if (!policy.permittedTools.includes(event.payload.tool.name))
|
|
18
|
+
throw new Error("tool_learning_tool_outside_collection_policy");
|
|
19
|
+
if (!permits("action") ||
|
|
20
|
+
(!permits("intent") && event.payload.intent !== "") ||
|
|
21
|
+
(!permits("state") && Object.keys(event.payload.environment.state).length > 0) ||
|
|
22
|
+
(!permits("artifact_reference") && event.payload.contextAssets.length > 0))
|
|
23
|
+
throw new Error("tool_learning_attempt_field_outside_collection_policy");
|
|
24
|
+
}
|
|
25
|
+
if (event.eventKind === "observation") {
|
|
26
|
+
if ((!permits("result_excerpt") &&
|
|
27
|
+
(event.payload.resultExcerpt !== "" ||
|
|
28
|
+
(event.payload.outcome === "failed" && event.payload.message !== ""))) ||
|
|
29
|
+
(!permits("artifact_reference") && event.payload.assets.length > 0))
|
|
30
|
+
throw new Error("tool_learning_result_field_outside_collection_policy");
|
|
31
|
+
}
|
|
32
|
+
if (event.eventKind === "verification" &&
|
|
33
|
+
((!permits("result_excerpt") && event.payload.reason !== "") ||
|
|
34
|
+
(!permits("artifact_reference") && event.payload.outputArtifacts.length > 0)))
|
|
35
|
+
throw new Error("tool_learning_verification_field_outside_collection_policy");
|
|
36
|
+
if (event.eventKind === "lineage" && !permits("intent") && event.payload.reason !== "")
|
|
37
|
+
throw new Error("tool_learning_lineage_field_outside_collection_policy");
|
|
38
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { contentHash, ReleaseHashSchema, ReleaseIdSchema, ReleaseTimestampSchema, } from "@openpond/harness";
|
|
3
|
+
import { assertBoundedTaskJson } from "../task-schema-validation.js";
|
|
4
|
+
export const TOOL_LEARNING_LIMITS = Object.freeze({
|
|
5
|
+
eventBytes: 65_536,
|
|
6
|
+
actionBytes: 16_384,
|
|
7
|
+
resultBytes: 8_192,
|
|
8
|
+
stateBytes: 8_192,
|
|
9
|
+
eventsPerAppend: 32,
|
|
10
|
+
eventsPerEpisode: 256,
|
|
11
|
+
episodeBytes: 2_097_152,
|
|
12
|
+
assetBytes: 1_048_576,
|
|
13
|
+
assetsPerEpisode: 16,
|
|
14
|
+
queueBytes: 52_428_800,
|
|
15
|
+
queueEvents: 5_000,
|
|
16
|
+
queueAgeSeconds: 86_400,
|
|
17
|
+
capabilities: 32,
|
|
18
|
+
consultationRounds: 3,
|
|
19
|
+
consultationBytes: 65_536,
|
|
20
|
+
manifestSeconds: 300,
|
|
21
|
+
});
|
|
22
|
+
export const ToolLearningIdSchema = ReleaseIdSchema;
|
|
23
|
+
export const ToolLearningHashSchema = ReleaseHashSchema;
|
|
24
|
+
export const ToolLearningTimestampSchema = ReleaseTimestampSchema;
|
|
25
|
+
export const ToolLearningClientSchema = z.enum(["codex", "claude_code", "opencode", "openpond"]);
|
|
26
|
+
export const ToolLearningRefSchema = z
|
|
27
|
+
.object({ id: ReleaseIdSchema, contentHash: ReleaseHashSchema })
|
|
28
|
+
.strict();
|
|
29
|
+
export const ToolLearningScopeSchema = z
|
|
30
|
+
.object({ teamId: ReleaseIdSchema, projectId: ReleaseIdSchema })
|
|
31
|
+
.strict();
|
|
32
|
+
/** Run the existing non-recursive JSON bound before Zod traverses producer data. */
|
|
33
|
+
export function boundedToolLearningSchema(schema, maximumBytes) {
|
|
34
|
+
return z.preprocess((value, context) => {
|
|
35
|
+
try {
|
|
36
|
+
assertBoundedTaskJson(value, maximumBytes);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
context.addIssue({
|
|
40
|
+
code: "custom",
|
|
41
|
+
message: "Tool learning data exceeds its JSON boundary.",
|
|
42
|
+
});
|
|
43
|
+
return z.NEVER;
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}, schema);
|
|
47
|
+
}
|
|
48
|
+
export function toolLearningText(maximumBytes) {
|
|
49
|
+
return z
|
|
50
|
+
.string()
|
|
51
|
+
.max(maximumBytes)
|
|
52
|
+
.refine((value) => new TextEncoder().encode(value).byteLength <= maximumBytes, "Tool learning text exceeds its UTF-8 byte limit.");
|
|
53
|
+
}
|
|
54
|
+
export const ToolLearningStateSchema = boundedToolLearningSchema(z
|
|
55
|
+
.record(z.string().min(1).max(120), z.union([toolLearningText(2_000), z.number().finite(), z.boolean(), z.null()]))
|
|
56
|
+
.refine((value) => Object.keys(value).length <= 32, "Use at most 32 explicit state fields."), TOOL_LEARNING_LIMITS.stateBytes);
|
|
57
|
+
export const ToolLearningEnvironmentSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
application: z.string().trim().min(1).max(200),
|
|
60
|
+
version: z.string().trim().min(1).max(200),
|
|
61
|
+
state: ToolLearningStateSchema,
|
|
62
|
+
fingerprint: ReleaseHashSchema,
|
|
63
|
+
})
|
|
64
|
+
.strict();
|
|
65
|
+
export const ToolLearningAssetSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
id: ReleaseIdSchema,
|
|
68
|
+
contentHash: ReleaseHashSchema,
|
|
69
|
+
mediaType: z.enum(["text/plain", "application/json", "text/x-python", "text/x-diff"]),
|
|
70
|
+
sizeBytes: z.number().int().nonnegative().max(TOOL_LEARNING_LIMITS.assetBytes),
|
|
71
|
+
purpose: z.enum(["action", "result", "state", "verification"]),
|
|
72
|
+
})
|
|
73
|
+
.strict();
|
|
74
|
+
export const ToolLearningSanitizationSchema = z
|
|
75
|
+
.object({
|
|
76
|
+
policyRevision: z.number().int().positive(),
|
|
77
|
+
policyHash: ReleaseHashSchema,
|
|
78
|
+
redactedFields: z.number().int().nonnegative().max(10_000),
|
|
79
|
+
omittedFields: z.number().int().nonnegative().max(10_000),
|
|
80
|
+
truncated: z.boolean(),
|
|
81
|
+
})
|
|
82
|
+
.strict();
|
|
83
|
+
/** Hash only the validated public envelope; no raw hook/transcript data enters it. */
|
|
84
|
+
export function toolLearningContentHash(value, maximumBytes = TOOL_LEARNING_LIMITS.eventBytes) {
|
|
85
|
+
assertBoundedTaskJson(value, maximumBytes);
|
|
86
|
+
return contentHash(value);
|
|
87
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ToolLearningActionSchema: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
kind: z.ZodLiteral<"python">;
|
|
4
|
+
code: z.ZodString;
|
|
5
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6
|
+
kind: z.ZodLiteral<"shell">;
|
|
7
|
+
command: z.ZodString;
|
|
8
|
+
shell: z.ZodString;
|
|
9
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10
|
+
kind: z.ZodLiteral<"tool_arguments">;
|
|
11
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
12
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"edit">;
|
|
14
|
+
patch: z.ZodString;
|
|
15
|
+
baseFiles: z.ZodArray<z.ZodObject<{
|
|
16
|
+
path: z.ZodString;
|
|
17
|
+
contentHash: z.ZodNullable<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>>;
|
|
19
|
+
}, z.core.$strict>], "kind">>;
|
|
20
|
+
export type ToolLearningAction = z.infer<typeof ToolLearningActionSchema>;
|
|
21
|
+
export declare const ToolLearningRepairSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"replacement">;
|
|
23
|
+
expectedActionHash: z.ZodString;
|
|
24
|
+
environmentFingerprint: z.ZodString;
|
|
25
|
+
action: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
|
+
kind: z.ZodLiteral<"python">;
|
|
27
|
+
code: z.ZodString;
|
|
28
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
29
|
+
kind: z.ZodLiteral<"shell">;
|
|
30
|
+
command: z.ZodString;
|
|
31
|
+
shell: z.ZodString;
|
|
32
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
+
kind: z.ZodLiteral<"tool_arguments">;
|
|
34
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
35
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
36
|
+
kind: z.ZodLiteral<"edit">;
|
|
37
|
+
patch: z.ZodString;
|
|
38
|
+
baseFiles: z.ZodArray<z.ZodObject<{
|
|
39
|
+
path: z.ZodString;
|
|
40
|
+
contentHash: z.ZodNullable<z.ZodString>;
|
|
41
|
+
}, z.core.$strict>>;
|
|
42
|
+
}, z.core.$strict>], "kind">>;
|
|
43
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
44
|
+
kind: z.ZodLiteral<"patch">;
|
|
45
|
+
expectedActionHash: z.ZodString;
|
|
46
|
+
environmentFingerprint: z.ZodString;
|
|
47
|
+
files: z.ZodArray<z.ZodObject<{
|
|
48
|
+
path: z.ZodString;
|
|
49
|
+
expectedContentHash: z.ZodString;
|
|
50
|
+
patch: z.ZodString;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
}, z.core.$strict>], "kind">;
|
|
53
|
+
export type ToolLearningRepair = z.infer<typeof ToolLearningRepairSchema>;
|
|
54
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/tool-learning/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsBxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;6BA4BpC,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA4BnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ToolLearningCapabilitySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
application: z.ZodString;
|
|
5
|
+
versions: z.ZodArray<z.ZodString>;
|
|
6
|
+
tools: z.ZodArray<z.ZodString>;
|
|
7
|
+
mode: z.ZodLiteral<"recovery">;
|
|
8
|
+
routingInstruction: z.ZodString;
|
|
9
|
+
qualification: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
kind: z.ZodLiteral<"integration">;
|
|
11
|
+
receipt: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
contentHash: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
|
+
kind: z.ZodLiteral<"learned">;
|
|
17
|
+
receipt: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
contentHash: z.ZodString;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
trainingRun: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
contentHash: z.ZodString;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
adapter: z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
contentHash: z.ZodString;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
evaluation: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
contentHash: z.ZodString;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
activation: z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
contentHash: z.ZodString;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
}, z.core.$strict>], "kind">;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export declare const ToolLearningManifestSchema: z.ZodPreprocess<z.ZodObject<{
|
|
40
|
+
schemaVersion: z.ZodLiteral<"openpond.toolLearningManifest.v1">;
|
|
41
|
+
installationId: z.ZodString;
|
|
42
|
+
scope: z.ZodObject<{
|
|
43
|
+
teamId: z.ZodString;
|
|
44
|
+
projectId: z.ZodString;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
revision: z.ZodNumber;
|
|
47
|
+
contentHash: z.ZodString;
|
|
48
|
+
issuedAt: z.ZodString;
|
|
49
|
+
expiresAt: z.ZodString;
|
|
50
|
+
modelRelease: z.ZodObject<{
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
contentHash: z.ZodString;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
responseSchema: z.ZodLiteral<"openpond.toolLearningDecision.v1">;
|
|
55
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
application: z.ZodString;
|
|
58
|
+
versions: z.ZodArray<z.ZodString>;
|
|
59
|
+
tools: z.ZodArray<z.ZodString>;
|
|
60
|
+
mode: z.ZodLiteral<"recovery">;
|
|
61
|
+
routingInstruction: z.ZodString;
|
|
62
|
+
qualification: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
63
|
+
kind: z.ZodLiteral<"integration">;
|
|
64
|
+
receipt: z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
contentHash: z.ZodString;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"learned">;
|
|
70
|
+
receipt: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
contentHash: z.ZodString;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
trainingRun: z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
contentHash: z.ZodString;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
adapter: z.ZodObject<{
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
contentHash: z.ZodString;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
evaluation: z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
contentHash: z.ZodString;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
activation: z.ZodObject<{
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
contentHash: z.ZodString;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
}, z.core.$strict>], "kind">;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
export type ToolLearningManifest = z.infer<typeof ToolLearningManifestSchema>;
|
|
94
|
+
export declare const ToolLearningConsultationRequestSchema: z.ZodPreprocess<z.ZodObject<{
|
|
95
|
+
schemaVersion: z.ZodLiteral<"openpond.toolLearningConsultation.v1">;
|
|
96
|
+
operationId: z.ZodString;
|
|
97
|
+
installationId: z.ZodString;
|
|
98
|
+
scope: z.ZodObject<{
|
|
99
|
+
teamId: z.ZodString;
|
|
100
|
+
projectId: z.ZodString;
|
|
101
|
+
}, z.core.$strict>;
|
|
102
|
+
sessionId: z.ZodString;
|
|
103
|
+
callId: z.ZodString;
|
|
104
|
+
capabilityId: z.ZodString;
|
|
105
|
+
manifestHash: z.ZodString;
|
|
106
|
+
modelRelease: z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
contentHash: z.ZodString;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
mode: z.ZodLiteral<"recovery">;
|
|
111
|
+
intent: z.ZodString;
|
|
112
|
+
action: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
113
|
+
kind: z.ZodLiteral<"python">;
|
|
114
|
+
code: z.ZodString;
|
|
115
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
116
|
+
kind: z.ZodLiteral<"shell">;
|
|
117
|
+
command: z.ZodString;
|
|
118
|
+
shell: z.ZodString;
|
|
119
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
120
|
+
kind: z.ZodLiteral<"tool_arguments">;
|
|
121
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
kind: z.ZodLiteral<"edit">;
|
|
124
|
+
patch: z.ZodString;
|
|
125
|
+
baseFiles: z.ZodArray<z.ZodObject<{
|
|
126
|
+
path: z.ZodString;
|
|
127
|
+
contentHash: z.ZodNullable<z.ZodString>;
|
|
128
|
+
}, z.core.$strict>>;
|
|
129
|
+
}, z.core.$strict>], "kind">>;
|
|
130
|
+
actionHash: z.ZodString;
|
|
131
|
+
environment: z.ZodObject<{
|
|
132
|
+
application: z.ZodString;
|
|
133
|
+
version: z.ZodString;
|
|
134
|
+
state: z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
135
|
+
fingerprint: z.ZodString;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
contextHash: z.ZodString;
|
|
138
|
+
failure: z.ZodObject<{
|
|
139
|
+
message: z.ZodString;
|
|
140
|
+
observation: z.ZodObject<{
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
contentHash: z.ZodString;
|
|
143
|
+
}, z.core.$strict>;
|
|
144
|
+
}, z.core.$strict>;
|
|
145
|
+
round: z.ZodNumber;
|
|
146
|
+
}, z.core.$strict>>;
|
|
147
|
+
export type ToolLearningConsultationRequest = z.infer<typeof ToolLearningConsultationRequestSchema>;
|
|
148
|
+
/** Only model-authored task content; transport failures never become proceed. */
|
|
149
|
+
export declare const ToolLearningDecisionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
150
|
+
decision: z.ZodLiteral<"proceed">;
|
|
151
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
152
|
+
decision: z.ZodLiteral<"revise">;
|
|
153
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
154
|
+
category: z.ZodString;
|
|
155
|
+
feedback: z.ZodString;
|
|
156
|
+
}, z.core.$strict>>;
|
|
157
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
158
|
+
decision: z.ZodLiteral<"needs_context">;
|
|
159
|
+
missing: z.ZodArray<z.ZodObject<{
|
|
160
|
+
field: z.ZodString;
|
|
161
|
+
reason: z.ZodString;
|
|
162
|
+
}, z.core.$strict>>;
|
|
163
|
+
}, z.core.$strict>], "decision">;
|
|
164
|
+
export declare const ToolLearningConsultationResponseSchema: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
165
|
+
operationId: z.ZodString;
|
|
166
|
+
installationId: z.ZodString;
|
|
167
|
+
capabilityId: z.ZodString;
|
|
168
|
+
manifestHash: z.ZodString;
|
|
169
|
+
modelRelease: z.ZodObject<{
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
contentHash: z.ZodString;
|
|
172
|
+
}, z.core.$strict>;
|
|
173
|
+
actionHash: z.ZodString;
|
|
174
|
+
contextHash: z.ZodString;
|
|
175
|
+
schemaVersion: z.ZodLiteral<"openpond.toolLearningDecision.v1">;
|
|
176
|
+
state: z.ZodLiteral<"completed">;
|
|
177
|
+
decision: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
178
|
+
decision: z.ZodLiteral<"proceed">;
|
|
179
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
180
|
+
decision: z.ZodLiteral<"revise">;
|
|
181
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
182
|
+
category: z.ZodString;
|
|
183
|
+
feedback: z.ZodString;
|
|
184
|
+
}, z.core.$strict>>;
|
|
185
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
186
|
+
decision: z.ZodLiteral<"needs_context">;
|
|
187
|
+
missing: z.ZodArray<z.ZodObject<{
|
|
188
|
+
field: z.ZodString;
|
|
189
|
+
reason: z.ZodString;
|
|
190
|
+
}, z.core.$strict>>;
|
|
191
|
+
}, z.core.$strict>], "decision">;
|
|
192
|
+
usageReceipt: z.ZodObject<{
|
|
193
|
+
id: z.ZodString;
|
|
194
|
+
contentHash: z.ZodString;
|
|
195
|
+
}, z.core.$strict>;
|
|
196
|
+
completedAt: z.ZodString;
|
|
197
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
198
|
+
operationId: z.ZodString;
|
|
199
|
+
installationId: z.ZodString;
|
|
200
|
+
capabilityId: z.ZodString;
|
|
201
|
+
manifestHash: z.ZodString;
|
|
202
|
+
modelRelease: z.ZodObject<{
|
|
203
|
+
id: z.ZodString;
|
|
204
|
+
contentHash: z.ZodString;
|
|
205
|
+
}, z.core.$strict>;
|
|
206
|
+
actionHash: z.ZodString;
|
|
207
|
+
contextHash: z.ZodString;
|
|
208
|
+
schemaVersion: z.ZodLiteral<"openpond.toolLearningDecision.v1">;
|
|
209
|
+
state: z.ZodLiteral<"unavailable">;
|
|
210
|
+
reason: z.ZodEnum<{
|
|
211
|
+
budget_exhausted: "budget_exhausted";
|
|
212
|
+
cancelled: "cancelled";
|
|
213
|
+
disabled: "disabled";
|
|
214
|
+
dispatch_uncertain: "dispatch_uncertain";
|
|
215
|
+
expired_manifest: "expired_manifest";
|
|
216
|
+
invalid_output: "invalid_output";
|
|
217
|
+
revoked: "revoked";
|
|
218
|
+
timeout: "timeout";
|
|
219
|
+
unsupported_scope: "unsupported_scope";
|
|
220
|
+
}>;
|
|
221
|
+
usageReceipt: z.ZodNullable<z.ZodObject<{
|
|
222
|
+
id: z.ZodString;
|
|
223
|
+
contentHash: z.ZodString;
|
|
224
|
+
}, z.core.$strict>>;
|
|
225
|
+
}, z.core.$strict>], "state">>;
|
|
226
|
+
export type ToolLearningConsultationResponse = z.infer<typeof ToolLearningConsultationResponseSchema>;
|
|
227
|
+
/** Invoke before exposing a result to the agent; even valid JSON may be stale. */
|
|
228
|
+
export declare function assertToolLearningConsultationResponse(requestValue: unknown, responseValue: unknown): ToolLearningConsultationResponse;
|
|
229
|
+
//# sourceMappingURL=consultation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consultation.d.ts","sourceRoot":"","sources":["../../../src/tool-learning/consultation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsB9B,CAAC;AAwCZ,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAGtC,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAgDjD,CAAC;AACF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG,iFAAiF;AACjF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;gCAkCrC,CAAC;AAWH,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAiClD,CAAC;AACF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAC;AAEF,kFAAkF;AAClF,wBAAgB,sCAAsC,CACpD,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,GACrB,gCAAgC,CAmBlC"}
|