@tangle-network/agent-interface 0.20.0 → 0.21.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.
@@ -0,0 +1,151 @@
1
+ import { defineAgentCandidateBundle } from "./agent-candidate.js";
2
+ export const candidateSha = (digit) => `sha256:${digit.repeat(64)}`;
3
+ export const candidateGit = (digit) => digit.repeat(40);
4
+ export function candidateFixture() {
5
+ return defineAgentCandidateBundle({
6
+ schemaVersion: 1,
7
+ kind: "agent-candidate-bundle",
8
+ digestAlgorithm: "rfc8785-sha256",
9
+ profile: {
10
+ name: "repository-agent",
11
+ harness: "codex",
12
+ model: {
13
+ default: "openai/gpt-5.4",
14
+ reasoningEffort: "high",
15
+ },
16
+ prompt: { systemPrompt: "Solve the repository task." },
17
+ resources: {
18
+ files: [
19
+ {
20
+ path: ".agent/policy.json",
21
+ resource: {
22
+ kind: "inline",
23
+ name: "policy",
24
+ content: "{}",
25
+ sha256: candidateSha("b"),
26
+ byteLength: 2,
27
+ },
28
+ },
29
+ ],
30
+ failOnError: true,
31
+ },
32
+ },
33
+ code: {
34
+ kind: "git-patch",
35
+ repository: {
36
+ kind: "github",
37
+ owner: "tangle-network",
38
+ repo: "agent-runtime",
39
+ },
40
+ baseCommit: candidateGit("1"),
41
+ baseTree: candidateGit("2"),
42
+ candidateTree: candidateGit("4"),
43
+ patch: {
44
+ format: "git-diff-binary",
45
+ artifact: {
46
+ encoding: "base64",
47
+ content: "ZGlmZiAtLWdpdA==",
48
+ sha256: candidateSha("5"),
49
+ byteLength: 10,
50
+ },
51
+ },
52
+ },
53
+ execution: {
54
+ harness: "codex",
55
+ harnessVersion: "0.1.0",
56
+ launch: {
57
+ kind: "candidate-entrypoint",
58
+ interpreter: "node",
59
+ entrypoint: "dist/agent.js",
60
+ args: [{ kind: "public", value: "--mode=benchmark" }],
61
+ },
62
+ instructionDelivery: { kind: "argv-append" },
63
+ cwd: { workspace: "candidate", path: "." },
64
+ env: {
65
+ NODE_ENV: { kind: "public", value: "production" },
66
+ },
67
+ environment: {
68
+ kind: "pinned-container",
69
+ container: { image: "node:22", indexDigest: candidateSha("6") },
70
+ },
71
+ workspace: {
72
+ schemaVersion: 1,
73
+ kind: "agent-candidate-workspace-snapshot",
74
+ digest: candidateSha("c"),
75
+ material: {
76
+ schemaVersion: 1,
77
+ kind: "agent-candidate-workspace-manifest",
78
+ files: [
79
+ {
80
+ path: "dist/agent.js",
81
+ mode: 0o755,
82
+ sha256: candidateSha("d"),
83
+ byteLength: 42,
84
+ },
85
+ ],
86
+ },
87
+ manifest: {
88
+ encoding: "base64",
89
+ content: "e30=",
90
+ sha256: candidateSha("c"),
91
+ byteLength: 2,
92
+ },
93
+ archive: {
94
+ encoding: "base64",
95
+ content: "e30=",
96
+ sha256: candidateSha("e"),
97
+ byteLength: 2,
98
+ },
99
+ },
100
+ isolation: {
101
+ network: "disabled",
102
+ remoteIntegrations: "disabled",
103
+ candidateSecrets: "disabled",
104
+ },
105
+ },
106
+ knowledge: {
107
+ snapshotId: "knowledge-17",
108
+ manifest: {
109
+ locator: {
110
+ kind: "s3",
111
+ bucket: "agent-candidate-artifacts",
112
+ key: "knowledge/knowledge-17.json",
113
+ region: "us-east-1",
114
+ },
115
+ sha256: candidateSha("7"),
116
+ byteLength: 42,
117
+ },
118
+ },
119
+ memory: {
120
+ mode: "isolated",
121
+ scope: "task",
122
+ },
123
+ lineage: {
124
+ source: "optimizer",
125
+ parentDigests: [candidateSha("8")],
126
+ runIds: ["r360-search"],
127
+ profileDiffIds: ["profile-diff-3"],
128
+ modelSnapshots: ["openai/gpt-5.4-2026-06-15"],
129
+ benchmark: {
130
+ name: "pier",
131
+ version: "0.3",
132
+ splitDigest: candidateSha("9"),
133
+ },
134
+ spend: {
135
+ proposal: {
136
+ costUsd: 3.5,
137
+ inputTokens: 100,
138
+ outputTokens: 20,
139
+ modelCalls: 2,
140
+ },
141
+ evaluation: {
142
+ costUsd: 9,
143
+ inputTokens: 900,
144
+ outputTokens: 200,
145
+ modelCalls: 8,
146
+ },
147
+ },
148
+ },
149
+ digest: candidateSha("a"),
150
+ });
151
+ }
package/dist/index.d.ts CHANGED
@@ -600,6 +600,8 @@ export interface SdkProviderAdapter {
600
600
  respondToInteraction?(response: InteractionResponse): Promise<void>;
601
601
  }
602
602
  export * from "./interaction.js";
603
+ export * from "./agent-candidate.js";
604
+ export * from "./agent-candidate-schema.js";
603
605
  export * from "./agent-profile.js";
604
606
  export * from "./profile-diff.js";
605
607
  export * from "./harness.js";
package/dist/index.js CHANGED
@@ -123,6 +123,8 @@ export function resolveNativeWebTools(tools) {
123
123
  return posture;
124
124
  }
125
125
  export * from "./interaction.js";
126
+ export * from "./agent-candidate.js";
127
+ export * from "./agent-candidate-schema.js";
126
128
  export * from "./agent-profile.js";
127
129
  export * from "./profile-diff.js";
128
130
  export * from "./harness.js";
@@ -124,9 +124,9 @@ export declare const InteractionSubjectSchema: z.ZodDiscriminatedUnion<[z.ZodObj
124
124
  }, z.core.$strip>], "type">;
125
125
  export type InteractionSubject = z.infer<typeof InteractionSubjectSchema>;
126
126
  export declare const InteractionOutcomeSchema: z.ZodEnum<{
127
+ cancelled: "cancelled";
127
128
  accepted: "accepted";
128
129
  declined: "declined";
129
- cancelled: "cancelled";
130
130
  }>;
131
131
  export type InteractionOutcome = z.infer<typeof InteractionOutcomeSchema>;
132
132
  /** Field values keyed by `InteractionField.name`. Validated against `answerSpec`. */
@@ -134,9 +134,9 @@ export declare const InteractionDataSchema: z.ZodRecord<z.ZodString, z.ZodUnion<
134
134
  export type InteractionData = z.infer<typeof InteractionDataSchema>;
135
135
  export declare const InteractionResolutionSchema: z.ZodObject<{
136
136
  outcome: z.ZodEnum<{
137
+ cancelled: "cancelled";
137
138
  accepted: "accepted";
138
139
  declined: "declined";
139
- cancelled: "cancelled";
140
140
  }>;
141
141
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
142
142
  }, z.core.$strip>;
@@ -207,9 +207,9 @@ export declare const InteractionRequestSchema: z.ZodObject<{
207
207
  }, z.core.$strip>;
208
208
  default: z.ZodOptional<z.ZodObject<{
209
209
  outcome: z.ZodEnum<{
210
+ cancelled: "cancelled";
210
211
  accepted: "accepted";
211
212
  declined: "declined";
212
- cancelled: "cancelled";
213
213
  }>;
214
214
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
215
215
  }, z.core.$strip>>;
@@ -223,9 +223,9 @@ export declare const InteractionRequestSchema: z.ZodObject<{
223
223
  export type InteractionRequest = z.infer<typeof InteractionRequestSchema>;
224
224
  export declare const InteractionResponseSchema: z.ZodObject<{
225
225
  outcome: z.ZodEnum<{
226
+ cancelled: "cancelled";
226
227
  accepted: "accepted";
227
228
  declined: "declined";
228
- cancelled: "cancelled";
229
229
  }>;
230
230
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
231
231
  id: z.ZodString;
@@ -1,5 +1,6 @@
1
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";
2
+ declare const agentProfileDiffPropertyAxes: readonly ["prompt", "model", "harness", "permissions", "tools", "mcp", "connections", "subagents", "resources", "hooks", "modes", "confidential", "metadata", "extensions"];
3
+ export type AgentProfileDiffAxis = "identity" | (typeof agentProfileDiffPropertyAxes)[number];
3
4
  export type AgentProfileRemoveList = true | readonly string[];
4
5
  export interface AgentProfilePromptRemoval {
5
6
  systemPrompt?: true;
@@ -19,6 +20,7 @@ export interface AgentProfileDiffRemoval {
19
20
  tags?: AgentProfileRemoveList;
20
21
  prompt?: true | AgentProfilePromptRemoval;
21
22
  model?: AgentProfileRemoveList;
23
+ harness?: true;
22
24
  permissions?: AgentProfileRemoveList;
23
25
  tools?: AgentProfileRemoveList;
24
26
  mcp?: AgentProfileRemoveList;
@@ -59,3 +61,4 @@ export declare function defineAgentProfileDiff<T extends AgentProfileDiff>(diff:
59
61
  export declare function applyAgentProfileDiff(base: AgentProfile, diff: AgentProfileDiff): AgentProfile;
60
62
  export declare function changedAgentProfileAxes(diff: AgentProfileDiff): AgentProfileDiffAxis[];
61
63
  export declare function pruneAgentProfileDiff(diff: AgentProfileDiff, axesToRemove: readonly AgentProfileDiffAxis[]): AgentProfileDiff;
64
+ export {};
@@ -1,4 +1,22 @@
1
1
  import { mergeAgentProfiles } from "./agent-profile.js";
2
+ const agentProfileDiffPropertyAxes = [
3
+ "prompt",
4
+ "model",
5
+ "harness",
6
+ "permissions",
7
+ "tools",
8
+ "mcp",
9
+ "connections",
10
+ "subagents",
11
+ "resources",
12
+ "hooks",
13
+ "modes",
14
+ "confidential",
15
+ "metadata",
16
+ "extensions",
17
+ ];
18
+ const _agentProfileDiffPropertyAxesAreExhaustive = true;
19
+ void _agentProfileDiffPropertyAxesAreExhaustive;
2
20
  export function defineAgentProfileDiff(diff) {
3
21
  return diff;
4
22
  }
@@ -90,7 +108,9 @@ function applyRemoval(profile, remove) {
90
108
  next.description = undefined;
91
109
  next.version = undefined;
92
110
  }
93
- next.tags = removeValues(asMutable(next.tags), remove.tags);
111
+ if (remove.tags !== undefined) {
112
+ next.tags = removeValues(asMutable(next.tags), remove.tags);
113
+ }
94
114
  if (remove.prompt === true) {
95
115
  next.prompt = undefined;
96
116
  }
@@ -103,18 +123,40 @@ function applyRemoval(profile, remove) {
103
123
  ? prompt
104
124
  : undefined;
105
125
  }
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);
126
+ if (remove.model !== undefined) {
127
+ next.model = removeKeys(next.model, remove.model);
128
+ }
129
+ if (remove.harness !== undefined)
130
+ next.harness = undefined;
131
+ if (remove.permissions !== undefined) {
132
+ next.permissions = removeKeys(next.permissions, remove.permissions);
133
+ }
134
+ if (remove.tools !== undefined) {
135
+ next.tools = removeKeys(next.tools, remove.tools);
136
+ }
137
+ if (remove.mcp !== undefined) {
138
+ next.mcp = removeKeys(next.mcp, remove.mcp);
139
+ }
140
+ if (remove.subagents !== undefined) {
141
+ next.subagents = removeKeys(next.subagents, remove.subagents);
142
+ }
143
+ if (remove.resources !== undefined) {
144
+ next.resources = removeResources(next.resources, remove.resources);
145
+ }
146
+ if (remove.hooks !== undefined) {
147
+ next.hooks = removeKeys(next.hooks, remove.hooks);
148
+ }
149
+ if (remove.modes !== undefined) {
150
+ next.modes = removeKeys(next.modes, remove.modes);
151
+ }
114
152
  if (remove.confidential)
115
153
  next.confidential = undefined;
116
- next.metadata = removeKeys(next.metadata, remove.metadata);
117
- next.extensions = removeKeys(next.extensions, remove.extensions);
154
+ if (remove.metadata !== undefined) {
155
+ next.metadata = removeKeys(next.metadata, remove.metadata);
156
+ }
157
+ if (remove.extensions !== undefined) {
158
+ next.extensions = removeKeys(next.extensions, remove.extensions);
159
+ }
118
160
  if (next.connections && remove.connections !== undefined) {
119
161
  if (remove.connections === true) {
120
162
  next.connections = undefined;
@@ -138,21 +180,7 @@ export function changedAgentProfileAxes(diff) {
138
180
  if (set) {
139
181
  if (set.name || set.description || set.version || set.tags)
140
182
  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
- ]) {
183
+ for (const axis of agentProfileDiffPropertyAxes) {
156
184
  if (set[axis] !== undefined)
157
185
  axes.add(axis);
158
186
  }
@@ -161,21 +189,7 @@ export function changedAgentProfileAxes(diff) {
161
189
  if (remove) {
162
190
  if (remove.identity || remove.tags)
163
191
  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
- ]) {
192
+ for (const axis of agentProfileDiffPropertyAxes) {
179
193
  if (remove[axis] !== undefined)
180
194
  axes.add(axis);
181
195
  }
@@ -187,36 +201,22 @@ export function pruneAgentProfileDiff(diff, axesToRemove) {
187
201
  const set = diff.set ? { ...diff.set } : undefined;
188
202
  const remove = diff.remove ? { ...diff.remove } : undefined;
189
203
  if (removeSet.has("identity") && set) {
190
- set.name = undefined;
191
- set.description = undefined;
192
- set.version = undefined;
193
- set.tags = undefined;
204
+ delete set.name;
205
+ delete set.description;
206
+ delete set.version;
207
+ delete set.tags;
194
208
  }
195
209
  if (removeSet.has("identity") && remove) {
196
- remove.identity = undefined;
197
- remove.tags = undefined;
210
+ delete remove.identity;
211
+ delete remove.tags;
198
212
  }
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
- ]) {
213
+ for (const axis of agentProfileDiffPropertyAxes) {
214
214
  if (!removeSet.has(axis))
215
215
  continue;
216
216
  if (set)
217
- set[axis] = undefined;
217
+ delete set[axis];
218
218
  if (remove)
219
- remove[axis] = undefined;
219
+ delete remove[axis];
220
220
  }
221
221
  return {
222
222
  ...diff,
@@ -221,6 +221,7 @@ export declare const agentProfileDiffRemovalSchema: z.ZodObject<{
221
221
  instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
222
222
  }, z.core.$strip>]>>;
223
223
  model: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
224
+ harness: z.ZodOptional<z.ZodLiteral<true>>;
224
225
  permissions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
225
226
  tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
226
227
  mcp: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
@@ -117,6 +117,7 @@ export const agentProfileDiffRemovalSchema = z.object({
117
117
  tags: removeListSchema.optional(),
118
118
  prompt: z.union([z.literal(true), agentProfilePromptRemovalSchema]).optional(),
119
119
  model: removeListSchema.optional(),
120
+ harness: z.literal(true).optional(),
120
121
  permissions: removeListSchema.optional(),
121
122
  tools: removeListSchema.optional(),
122
123
  mcp: removeListSchema.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",