@tangle-network/agent-interface 0.17.1 → 0.19.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interaction.d.ts +5 -0
- package/dist/interaction.js +17 -2
- package/dist/profile-diff.d.ts +61 -0
- package/dist/profile-diff.js +230 -0
- package/dist/profile-schema.d.ts +43 -0
- package/dist/profile-schema.js +55 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -601,6 +601,7 @@ export interface SdkProviderAdapter {
|
|
|
601
601
|
}
|
|
602
602
|
export * from "./interaction.js";
|
|
603
603
|
export * from "./agent-profile.js";
|
|
604
|
+
export * from "./profile-diff.js";
|
|
604
605
|
export * from "./harness.js";
|
|
605
606
|
export * from "./harness-capabilities.js";
|
|
606
607
|
export * from "./profile-schema.js";
|
package/dist/index.js
CHANGED
|
@@ -124,6 +124,7 @@ export function resolveNativeWebTools(tools) {
|
|
|
124
124
|
}
|
|
125
125
|
export * from "./interaction.js";
|
|
126
126
|
export * from "./agent-profile.js";
|
|
127
|
+
export * from "./profile-diff.js";
|
|
127
128
|
export * from "./harness.js";
|
|
128
129
|
export * from "./harness-capabilities.js";
|
|
129
130
|
export * from "./profile-schema.js";
|
package/dist/interaction.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare const InteractionFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
49
49
|
description: z.ZodOptional<z.ZodString>;
|
|
50
50
|
}, z.core.$strip>>;
|
|
51
51
|
multi: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
allowCustom: z.ZodOptional<z.ZodBoolean>;
|
|
52
53
|
default: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
54
|
name: z.ZodString;
|
|
54
55
|
label: z.ZodString;
|
|
@@ -92,6 +93,7 @@ export declare const InteractionAnswerSpecSchema: z.ZodObject<{
|
|
|
92
93
|
description: z.ZodOptional<z.ZodString>;
|
|
93
94
|
}, z.core.$strip>>;
|
|
94
95
|
multi: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
allowCustom: z.ZodOptional<z.ZodBoolean>;
|
|
95
97
|
default: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
96
98
|
name: z.ZodString;
|
|
97
99
|
label: z.ZodString;
|
|
@@ -190,6 +192,7 @@ export declare const InteractionRequestSchema: z.ZodObject<{
|
|
|
190
192
|
description: z.ZodOptional<z.ZodString>;
|
|
191
193
|
}, z.core.$strip>>;
|
|
192
194
|
multi: z.ZodOptional<z.ZodBoolean>;
|
|
195
|
+
allowCustom: z.ZodOptional<z.ZodBoolean>;
|
|
193
196
|
default: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
194
197
|
name: z.ZodString;
|
|
195
198
|
label: z.ZodString;
|
|
@@ -261,6 +264,8 @@ export type LegacyQuestion = {
|
|
|
261
264
|
description?: string;
|
|
262
265
|
}>;
|
|
263
266
|
multiSelect?: boolean;
|
|
267
|
+
/** When true the select field accepts write-in answers beyond `options`. */
|
|
268
|
+
allowCustom?: boolean;
|
|
264
269
|
};
|
|
265
270
|
/**
|
|
266
271
|
* Build an answer spec from the legacy `question` event shape. Each question
|
package/dist/interaction.js
CHANGED
|
@@ -62,6 +62,12 @@ export const InteractionFieldSchema = z.discriminatedUnion("type", [
|
|
|
62
62
|
.min(1),
|
|
63
63
|
/** When true the user may pick more than one option. */
|
|
64
64
|
multi: z.boolean().optional(),
|
|
65
|
+
/**
|
|
66
|
+
* When true the answer may contain write-in values outside `options`
|
|
67
|
+
* (e.g. a rendered "Other…" choice carrying the user's own text).
|
|
68
|
+
* Write-ins must still be non-empty strings.
|
|
69
|
+
*/
|
|
70
|
+
allowCustom: z.boolean().optional(),
|
|
65
71
|
default: z.array(z.string()).optional(),
|
|
66
72
|
}),
|
|
67
73
|
/** Like `text` but the value is sensitive (token/key) and must be masked. */
|
|
@@ -185,6 +191,7 @@ export function questionAnswerSpec(questions) {
|
|
|
185
191
|
label: q.question,
|
|
186
192
|
required: true,
|
|
187
193
|
multi: q.multiSelect === true,
|
|
194
|
+
...(q.allowCustom === true ? { allowCustom: true } : {}),
|
|
188
195
|
options: q.options.map((o) => ({ value: o.label, label: o.label, description: o.description })),
|
|
189
196
|
};
|
|
190
197
|
}
|
|
@@ -239,8 +246,16 @@ export function validateInteractionAnswer(spec, data) {
|
|
|
239
246
|
errors.push(`field "${field.name}" requires a selection`);
|
|
240
247
|
const allowed = new Set(field.options.map((o) => o.value));
|
|
241
248
|
for (const choice of v) {
|
|
242
|
-
if (
|
|
243
|
-
|
|
249
|
+
if (allowed.has(choice))
|
|
250
|
+
continue;
|
|
251
|
+
if (field.allowCustom === true) {
|
|
252
|
+
// Write-ins are open but stay fail-closed on shape: string, non-blank.
|
|
253
|
+
if (typeof choice !== "string" || choice.trim() === "") {
|
|
254
|
+
errors.push(`field "${field.name}" has blank write-in value`);
|
|
255
|
+
}
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
errors.push(`field "${field.name}" has invalid option "${choice}"`);
|
|
244
259
|
}
|
|
245
260
|
break;
|
|
246
261
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AgentProfile } from "./agent-profile.js";
|
|
2
|
+
export type AgentProfileDiffAxis = "identity" | "prompt" | "model" | "permissions" | "tools" | "mcp" | "connections" | "subagents" | "resources" | "hooks" | "modes" | "confidential" | "metadata" | "extensions";
|
|
3
|
+
export type AgentProfileRemoveList = true | readonly string[];
|
|
4
|
+
export interface AgentProfilePromptRemoval {
|
|
5
|
+
systemPrompt?: true;
|
|
6
|
+
instructions?: AgentProfileRemoveList;
|
|
7
|
+
}
|
|
8
|
+
export interface AgentProfileResourceRemoval {
|
|
9
|
+
files?: AgentProfileRemoveList;
|
|
10
|
+
tools?: AgentProfileRemoveList;
|
|
11
|
+
skills?: AgentProfileRemoveList;
|
|
12
|
+
agents?: AgentProfileRemoveList;
|
|
13
|
+
commands?: AgentProfileRemoveList;
|
|
14
|
+
instructions?: true;
|
|
15
|
+
failOnError?: true;
|
|
16
|
+
}
|
|
17
|
+
export interface AgentProfileDiffRemoval {
|
|
18
|
+
identity?: true;
|
|
19
|
+
tags?: AgentProfileRemoveList;
|
|
20
|
+
prompt?: true | AgentProfilePromptRemoval;
|
|
21
|
+
model?: AgentProfileRemoveList;
|
|
22
|
+
permissions?: AgentProfileRemoveList;
|
|
23
|
+
tools?: AgentProfileRemoveList;
|
|
24
|
+
mcp?: AgentProfileRemoveList;
|
|
25
|
+
connections?: AgentProfileRemoveList;
|
|
26
|
+
subagents?: AgentProfileRemoveList;
|
|
27
|
+
resources?: true | AgentProfileResourceRemoval;
|
|
28
|
+
hooks?: AgentProfileRemoveList;
|
|
29
|
+
modes?: AgentProfileRemoveList;
|
|
30
|
+
confidential?: true;
|
|
31
|
+
metadata?: AgentProfileRemoveList;
|
|
32
|
+
extensions?: AgentProfileRemoveList;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A portable profile improvement artifact.
|
|
36
|
+
*
|
|
37
|
+
* `set` is an AgentProfile overlay: profile arrays are appended with the same
|
|
38
|
+
* semantics as {@link mergeAgentProfiles}. `remove` deletes whole axes or named
|
|
39
|
+
* entries after the overlay is applied. This keeps the optimized unit the full
|
|
40
|
+
* AgentProfile instead of a benchmark-specific file mount.
|
|
41
|
+
*/
|
|
42
|
+
export interface AgentProfileDiff {
|
|
43
|
+
schemaVersion: 1;
|
|
44
|
+
kind: "agent-profile-diff";
|
|
45
|
+
id?: string;
|
|
46
|
+
title?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
rationale?: string;
|
|
49
|
+
source?: {
|
|
50
|
+
kind: "trace" | "frontier-author" | "human" | "optimizer" | "compound";
|
|
51
|
+
artifacts?: readonly string[];
|
|
52
|
+
notes?: readonly string[];
|
|
53
|
+
};
|
|
54
|
+
set?: AgentProfile;
|
|
55
|
+
remove?: AgentProfileDiffRemoval;
|
|
56
|
+
metadata?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
export declare function defineAgentProfileDiff<T extends AgentProfileDiff>(diff: T): T;
|
|
59
|
+
export declare function applyAgentProfileDiff(base: AgentProfile, diff: AgentProfileDiff): AgentProfile;
|
|
60
|
+
export declare function changedAgentProfileAxes(diff: AgentProfileDiff): AgentProfileDiffAxis[];
|
|
61
|
+
export declare function pruneAgentProfileDiff(diff: AgentProfileDiff, axesToRemove: readonly AgentProfileDiffAxis[]): AgentProfileDiff;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { mergeAgentProfiles } from "./agent-profile.js";
|
|
2
|
+
export function defineAgentProfileDiff(diff) {
|
|
3
|
+
return diff;
|
|
4
|
+
}
|
|
5
|
+
function asMutable(value) {
|
|
6
|
+
return value ? [...value] : undefined;
|
|
7
|
+
}
|
|
8
|
+
function removeKeys(record, removal) {
|
|
9
|
+
if (!record || removal === undefined)
|
|
10
|
+
return record;
|
|
11
|
+
if (removal === true)
|
|
12
|
+
return undefined;
|
|
13
|
+
const next = {
|
|
14
|
+
...record,
|
|
15
|
+
};
|
|
16
|
+
for (const key of removal)
|
|
17
|
+
delete next[key];
|
|
18
|
+
return Object.keys(next).length > 0 ? next : undefined;
|
|
19
|
+
}
|
|
20
|
+
function removeValues(values, removal) {
|
|
21
|
+
if (!values || removal === undefined)
|
|
22
|
+
return values;
|
|
23
|
+
if (removal === true)
|
|
24
|
+
return undefined;
|
|
25
|
+
const removeSet = new Set(removal);
|
|
26
|
+
const next = values.filter((value) => !removeSet.has(value));
|
|
27
|
+
return next.length > 0 ? next : undefined;
|
|
28
|
+
}
|
|
29
|
+
function resourceName(resource) {
|
|
30
|
+
return resource.kind === "inline" ? resource.name : resource.name ?? resource.path;
|
|
31
|
+
}
|
|
32
|
+
function removeResourceRefs(refs, removal) {
|
|
33
|
+
if (!refs || removal === undefined)
|
|
34
|
+
return refs;
|
|
35
|
+
if (removal === true)
|
|
36
|
+
return undefined;
|
|
37
|
+
const removeSet = new Set(removal);
|
|
38
|
+
const next = refs.filter((ref) => {
|
|
39
|
+
const name = resourceName(ref);
|
|
40
|
+
return !(name && removeSet.has(name));
|
|
41
|
+
});
|
|
42
|
+
return next.length > 0 ? next : undefined;
|
|
43
|
+
}
|
|
44
|
+
function removeResources(resources, removal) {
|
|
45
|
+
if (!resources || removal === undefined)
|
|
46
|
+
return resources;
|
|
47
|
+
if (removal === true)
|
|
48
|
+
return undefined;
|
|
49
|
+
const next = { ...resources };
|
|
50
|
+
if (removal.files !== undefined) {
|
|
51
|
+
if (removal.files === true) {
|
|
52
|
+
next.files = undefined;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const removeSet = new Set(removal.files);
|
|
56
|
+
next.files = next.files?.filter((file) => {
|
|
57
|
+
const name = resourceName(file.resource);
|
|
58
|
+
return !removeSet.has(file.path) && !(name && removeSet.has(name));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
next.tools = removeResourceRefs(next.tools, removal.tools);
|
|
63
|
+
next.skills = removeResourceRefs(next.skills, removal.skills);
|
|
64
|
+
next.agents = removeResourceRefs(next.agents, removal.agents);
|
|
65
|
+
next.commands = removeResourceRefs(next.commands, removal.commands);
|
|
66
|
+
if (removal.instructions)
|
|
67
|
+
next.instructions = undefined;
|
|
68
|
+
if (removal.failOnError)
|
|
69
|
+
next.failOnError = undefined;
|
|
70
|
+
for (const key of [
|
|
71
|
+
"files",
|
|
72
|
+
"tools",
|
|
73
|
+
"skills",
|
|
74
|
+
"agents",
|
|
75
|
+
"commands",
|
|
76
|
+
]) {
|
|
77
|
+
if (next[key]?.length === 0)
|
|
78
|
+
next[key] = undefined;
|
|
79
|
+
}
|
|
80
|
+
return Object.values(next).some((value) => value !== undefined)
|
|
81
|
+
? next
|
|
82
|
+
: undefined;
|
|
83
|
+
}
|
|
84
|
+
function applyRemoval(profile, remove) {
|
|
85
|
+
if (!remove)
|
|
86
|
+
return profile;
|
|
87
|
+
const next = { ...profile };
|
|
88
|
+
if (remove.identity) {
|
|
89
|
+
next.name = undefined;
|
|
90
|
+
next.description = undefined;
|
|
91
|
+
next.version = undefined;
|
|
92
|
+
}
|
|
93
|
+
next.tags = removeValues(asMutable(next.tags), remove.tags);
|
|
94
|
+
if (remove.prompt === true) {
|
|
95
|
+
next.prompt = undefined;
|
|
96
|
+
}
|
|
97
|
+
else if (remove.prompt && next.prompt) {
|
|
98
|
+
const prompt = { ...next.prompt };
|
|
99
|
+
if (remove.prompt.systemPrompt)
|
|
100
|
+
prompt.systemPrompt = undefined;
|
|
101
|
+
prompt.instructions = removeValues(prompt.instructions, remove.prompt.instructions);
|
|
102
|
+
next.prompt = Object.values(prompt).some((value) => value !== undefined)
|
|
103
|
+
? prompt
|
|
104
|
+
: undefined;
|
|
105
|
+
}
|
|
106
|
+
next.model = removeKeys(next.model, remove.model);
|
|
107
|
+
next.permissions = removeKeys(next.permissions, remove.permissions);
|
|
108
|
+
next.tools = removeKeys(next.tools, remove.tools);
|
|
109
|
+
next.mcp = removeKeys(next.mcp, remove.mcp);
|
|
110
|
+
next.subagents = removeKeys(next.subagents, remove.subagents);
|
|
111
|
+
next.resources = removeResources(next.resources, remove.resources);
|
|
112
|
+
next.hooks = removeKeys(next.hooks, remove.hooks);
|
|
113
|
+
next.modes = removeKeys(next.modes, remove.modes);
|
|
114
|
+
if (remove.confidential)
|
|
115
|
+
next.confidential = undefined;
|
|
116
|
+
next.metadata = removeKeys(next.metadata, remove.metadata);
|
|
117
|
+
next.extensions = removeKeys(next.extensions, remove.extensions);
|
|
118
|
+
if (next.connections && remove.connections !== undefined) {
|
|
119
|
+
if (remove.connections === true) {
|
|
120
|
+
next.connections = undefined;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const removeSet = new Set(remove.connections);
|
|
124
|
+
const filtered = next.connections.filter((connection) => !removeSet.has(connection.connectionId) &&
|
|
125
|
+
!(connection.alias && removeSet.has(connection.alias)));
|
|
126
|
+
next.connections = filtered.length > 0 ? filtered : undefined;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return next;
|
|
130
|
+
}
|
|
131
|
+
export function applyAgentProfileDiff(base, diff) {
|
|
132
|
+
const merged = mergeAgentProfiles(base, diff.set) ?? {};
|
|
133
|
+
return applyRemoval(merged, diff.remove);
|
|
134
|
+
}
|
|
135
|
+
export function changedAgentProfileAxes(diff) {
|
|
136
|
+
const axes = new Set();
|
|
137
|
+
const set = diff.set;
|
|
138
|
+
if (set) {
|
|
139
|
+
if (set.name || set.description || set.version || set.tags)
|
|
140
|
+
axes.add("identity");
|
|
141
|
+
for (const axis of [
|
|
142
|
+
"prompt",
|
|
143
|
+
"model",
|
|
144
|
+
"permissions",
|
|
145
|
+
"tools",
|
|
146
|
+
"mcp",
|
|
147
|
+
"connections",
|
|
148
|
+
"subagents",
|
|
149
|
+
"resources",
|
|
150
|
+
"hooks",
|
|
151
|
+
"modes",
|
|
152
|
+
"confidential",
|
|
153
|
+
"metadata",
|
|
154
|
+
"extensions",
|
|
155
|
+
]) {
|
|
156
|
+
if (set[axis] !== undefined)
|
|
157
|
+
axes.add(axis);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const remove = diff.remove;
|
|
161
|
+
if (remove) {
|
|
162
|
+
if (remove.identity || remove.tags)
|
|
163
|
+
axes.add("identity");
|
|
164
|
+
for (const axis of [
|
|
165
|
+
"prompt",
|
|
166
|
+
"model",
|
|
167
|
+
"permissions",
|
|
168
|
+
"tools",
|
|
169
|
+
"mcp",
|
|
170
|
+
"connections",
|
|
171
|
+
"subagents",
|
|
172
|
+
"resources",
|
|
173
|
+
"hooks",
|
|
174
|
+
"modes",
|
|
175
|
+
"confidential",
|
|
176
|
+
"metadata",
|
|
177
|
+
"extensions",
|
|
178
|
+
]) {
|
|
179
|
+
if (remove[axis] !== undefined)
|
|
180
|
+
axes.add(axis);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return [...axes].sort();
|
|
184
|
+
}
|
|
185
|
+
export function pruneAgentProfileDiff(diff, axesToRemove) {
|
|
186
|
+
const removeSet = new Set(axesToRemove);
|
|
187
|
+
const set = diff.set ? { ...diff.set } : undefined;
|
|
188
|
+
const remove = diff.remove ? { ...diff.remove } : undefined;
|
|
189
|
+
if (removeSet.has("identity") && set) {
|
|
190
|
+
set.name = undefined;
|
|
191
|
+
set.description = undefined;
|
|
192
|
+
set.version = undefined;
|
|
193
|
+
set.tags = undefined;
|
|
194
|
+
}
|
|
195
|
+
if (removeSet.has("identity") && remove) {
|
|
196
|
+
remove.identity = undefined;
|
|
197
|
+
remove.tags = undefined;
|
|
198
|
+
}
|
|
199
|
+
for (const axis of [
|
|
200
|
+
"prompt",
|
|
201
|
+
"model",
|
|
202
|
+
"permissions",
|
|
203
|
+
"tools",
|
|
204
|
+
"mcp",
|
|
205
|
+
"connections",
|
|
206
|
+
"subagents",
|
|
207
|
+
"resources",
|
|
208
|
+
"hooks",
|
|
209
|
+
"modes",
|
|
210
|
+
"confidential",
|
|
211
|
+
"metadata",
|
|
212
|
+
"extensions",
|
|
213
|
+
]) {
|
|
214
|
+
if (!removeSet.has(axis))
|
|
215
|
+
continue;
|
|
216
|
+
if (set)
|
|
217
|
+
set[axis] = undefined;
|
|
218
|
+
if (remove)
|
|
219
|
+
remove[axis] = undefined;
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
...diff,
|
|
223
|
+
...(set && Object.values(set).some((value) => value !== undefined)
|
|
224
|
+
? { set }
|
|
225
|
+
: { set: undefined }),
|
|
226
|
+
...(remove && Object.values(remove).some((value) => value !== undefined)
|
|
227
|
+
? { remove }
|
|
228
|
+
: { remove: undefined }),
|
|
229
|
+
};
|
|
230
|
+
}
|
package/dist/profile-schema.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AgentProfile } from "./agent-profile.js";
|
|
3
|
+
import type { AgentProfileDiff } from "./profile-diff.js";
|
|
3
4
|
import { type SandboxSizePreset } from "./sandbox-size.js";
|
|
4
5
|
export declare const agentProfilePermissionValueSchema: z.ZodEnum<{
|
|
5
6
|
allow: "allow";
|
|
@@ -199,6 +200,47 @@ export declare const agentProfileConnectionSchema: z.ZodObject<{
|
|
|
199
200
|
capabilities: z.ZodArray<z.ZodString>;
|
|
200
201
|
alias: z.ZodOptional<z.ZodString>;
|
|
201
202
|
}, z.core.$strip>;
|
|
203
|
+
export declare const agentProfilePromptRemovalSchema: z.ZodObject<{
|
|
204
|
+
systemPrompt: z.ZodOptional<z.ZodLiteral<true>>;
|
|
205
|
+
instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
export declare const agentProfileResourceRemovalSchema: z.ZodObject<{
|
|
208
|
+
files: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
209
|
+
tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
210
|
+
skills: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
211
|
+
agents: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
212
|
+
commands: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
213
|
+
instructions: z.ZodOptional<z.ZodLiteral<true>>;
|
|
214
|
+
failOnError: z.ZodOptional<z.ZodLiteral<true>>;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
export declare const agentProfileDiffRemovalSchema: z.ZodObject<{
|
|
217
|
+
identity: z.ZodOptional<z.ZodLiteral<true>>;
|
|
218
|
+
tags: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
219
|
+
prompt: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
220
|
+
systemPrompt: z.ZodOptional<z.ZodLiteral<true>>;
|
|
221
|
+
instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
222
|
+
}, z.core.$strip>]>>;
|
|
223
|
+
model: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
224
|
+
permissions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
225
|
+
tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
226
|
+
mcp: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
227
|
+
connections: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
228
|
+
subagents: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
229
|
+
resources: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
230
|
+
files: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
231
|
+
tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
232
|
+
skills: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
233
|
+
agents: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
234
|
+
commands: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
235
|
+
instructions: z.ZodOptional<z.ZodLiteral<true>>;
|
|
236
|
+
failOnError: z.ZodOptional<z.ZodLiteral<true>>;
|
|
237
|
+
}, z.core.$strip>]>>;
|
|
238
|
+
hooks: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
239
|
+
modes: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
240
|
+
confidential: z.ZodOptional<z.ZodLiteral<true>>;
|
|
241
|
+
metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
242
|
+
extensions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
|
|
243
|
+
}, z.core.$strip>;
|
|
202
244
|
/**
|
|
203
245
|
* The complete provider-neutral agent profile schema — the runtime validator for
|
|
204
246
|
* the canonical {@link AgentProfile} TS contract. Kept structurally in lock-step
|
|
@@ -380,6 +422,7 @@ export declare const agentProfileSchema: z.ZodObject<{
|
|
|
380
422
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
381
423
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodUndefined]>>>;
|
|
382
424
|
}, z.core.$strip>;
|
|
425
|
+
export declare const agentProfileDiffSchema: z.ZodType<AgentProfileDiff>;
|
|
383
426
|
/**
|
|
384
427
|
* A registered capability: a stable id paired with its canonical
|
|
385
428
|
* {@link AgentProfile}. `definition` is the full profile (prompt/model/tools/
|
package/dist/profile-schema.js
CHANGED
|
@@ -97,6 +97,37 @@ export const agentProfileConnectionSchema = z.object({
|
|
|
97
97
|
capabilities: z.array(z.string().min(1)).min(1),
|
|
98
98
|
alias: z.string().min(1).optional(),
|
|
99
99
|
});
|
|
100
|
+
const removeListSchema = z.union([z.literal(true), z.array(z.string().min(1))]);
|
|
101
|
+
export const agentProfilePromptRemovalSchema = z.object({
|
|
102
|
+
systemPrompt: z.literal(true).optional(),
|
|
103
|
+
instructions: removeListSchema.optional(),
|
|
104
|
+
});
|
|
105
|
+
export const agentProfileResourceRemovalSchema = z.object({
|
|
106
|
+
files: removeListSchema.optional(),
|
|
107
|
+
tools: removeListSchema.optional(),
|
|
108
|
+
skills: removeListSchema.optional(),
|
|
109
|
+
agents: removeListSchema.optional(),
|
|
110
|
+
commands: removeListSchema.optional(),
|
|
111
|
+
instructions: z.literal(true).optional(),
|
|
112
|
+
failOnError: z.literal(true).optional(),
|
|
113
|
+
});
|
|
114
|
+
export const agentProfileDiffRemovalSchema = z.object({
|
|
115
|
+
identity: z.literal(true).optional(),
|
|
116
|
+
tags: removeListSchema.optional(),
|
|
117
|
+
prompt: z.union([z.literal(true), agentProfilePromptRemovalSchema]).optional(),
|
|
118
|
+
model: removeListSchema.optional(),
|
|
119
|
+
permissions: removeListSchema.optional(),
|
|
120
|
+
tools: removeListSchema.optional(),
|
|
121
|
+
mcp: removeListSchema.optional(),
|
|
122
|
+
connections: removeListSchema.optional(),
|
|
123
|
+
subagents: removeListSchema.optional(),
|
|
124
|
+
resources: z.union([z.literal(true), agentProfileResourceRemovalSchema]).optional(),
|
|
125
|
+
hooks: removeListSchema.optional(),
|
|
126
|
+
modes: removeListSchema.optional(),
|
|
127
|
+
confidential: z.literal(true).optional(),
|
|
128
|
+
metadata: removeListSchema.optional(),
|
|
129
|
+
extensions: removeListSchema.optional(),
|
|
130
|
+
});
|
|
100
131
|
/**
|
|
101
132
|
* The complete provider-neutral agent profile schema — the runtime validator for
|
|
102
133
|
* the canonical {@link AgentProfile} TS contract. Kept structurally in lock-step
|
|
@@ -125,6 +156,30 @@ export const agentProfileSchema = z.object({
|
|
|
125
156
|
.record(z.string(), z.union([z.record(z.string(), z.unknown()), z.undefined()]))
|
|
126
157
|
.optional(),
|
|
127
158
|
});
|
|
159
|
+
export const agentProfileDiffSchema = z.object({
|
|
160
|
+
schemaVersion: z.literal(1),
|
|
161
|
+
kind: z.literal("agent-profile-diff"),
|
|
162
|
+
id: z.string().min(1).optional(),
|
|
163
|
+
title: z.string().min(1).optional(),
|
|
164
|
+
description: z.string().optional(),
|
|
165
|
+
rationale: z.string().optional(),
|
|
166
|
+
source: z
|
|
167
|
+
.object({
|
|
168
|
+
kind: z.enum([
|
|
169
|
+
"trace",
|
|
170
|
+
"frontier-author",
|
|
171
|
+
"human",
|
|
172
|
+
"optimizer",
|
|
173
|
+
"compound",
|
|
174
|
+
]),
|
|
175
|
+
artifacts: z.array(z.string().min(1)).optional(),
|
|
176
|
+
notes: z.array(z.string()).optional(),
|
|
177
|
+
})
|
|
178
|
+
.optional(),
|
|
179
|
+
set: agentProfileSchema.optional(),
|
|
180
|
+
remove: agentProfileDiffRemovalSchema.optional(),
|
|
181
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
182
|
+
});
|
|
128
183
|
const _agentProfileSchemaMatchesInterface = true;
|
|
129
184
|
void _agentProfileSchemaMatchesInterface;
|
|
130
185
|
export const capabilitySchema = z.object({
|