@tangle-network/agent-interface 0.28.0 → 0.30.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.
Files changed (30) hide show
  1. package/dist/agent-candidate-code-schema.d.ts +0 -8
  2. package/dist/agent-candidate-code-schema.js +0 -1
  3. package/dist/agent-candidate-execution-plan-schema.d.ts +193 -350
  4. package/dist/agent-candidate-execution-plan-schema.js +98 -131
  5. package/dist/agent-candidate-lineage-schema.d.ts +1 -28
  6. package/dist/agent-candidate-lineage-schema.js +3 -33
  7. package/dist/agent-candidate-outcome-schema.d.ts +48 -18
  8. package/dist/agent-candidate-outcome-schema.js +19 -24
  9. package/dist/agent-candidate-profile-schema.d.ts +3 -28
  10. package/dist/agent-candidate-profile-schema.js +15 -27
  11. package/dist/agent-candidate-promotion-schema.d.ts +10981 -2356
  12. package/dist/agent-candidate-promotion-schema.js +495 -105
  13. package/dist/agent-candidate-receipt-schema.d.ts +268 -303
  14. package/dist/agent-candidate-receipt-schema.js +82 -8
  15. package/dist/agent-candidate-schema-common.d.ts +8 -0
  16. package/dist/agent-candidate-schema-common.js +35 -1
  17. package/dist/agent-candidate-schema.d.ts +3 -52
  18. package/dist/agent-candidate-schema.js +3 -28
  19. package/dist/agent-candidate-task-schema.d.ts +643 -0
  20. package/dist/agent-candidate-task-schema.js +191 -0
  21. package/dist/agent-candidate.d.ts +191 -75
  22. package/dist/agent-candidate.test-fixture.d.ts +0 -26
  23. package/dist/agent-candidate.test-fixture.js +0 -26
  24. package/dist/agent-profile.d.ts +33 -9
  25. package/dist/harness-capabilities.d.ts +2 -2
  26. package/dist/harness-capabilities.js +23 -14
  27. package/dist/profile-schema.d.ts +65 -84
  28. package/dist/profile-schema.js +82 -32
  29. package/dist/profile-security.js +2 -0
  30. package/package.json +2 -2
@@ -12,12 +12,12 @@ export const agentProfilePermissionSchema = z.union([
12
12
  ]);
13
13
  // Mirrors the canonical AgentProfileResourceRef (inline | github), kind-discriminated.
14
14
  export const agentProfileResourceRefSchema = z.union([
15
- z.object({
15
+ z.strictObject({
16
16
  kind: z.literal("inline"),
17
17
  name: z.string(),
18
18
  content: z.string(),
19
19
  }),
20
- z.object({
20
+ z.strictObject({
21
21
  kind: z.literal("github"),
22
22
  repository: z.string().optional(),
23
23
  path: z.string(),
@@ -25,34 +25,43 @@ export const agentProfileResourceRefSchema = z.union([
25
25
  name: z.string().optional(),
26
26
  }),
27
27
  ]);
28
- export const agentProfileFileMountSchema = z.object({
28
+ export const agentProfileFileMountSchema = z.strictObject({
29
29
  path: z.string(),
30
30
  resource: agentProfileResourceRefSchema,
31
31
  executable: z.boolean().optional(),
32
32
  });
33
- export const agentProfileResourcesSchema = z.object({
33
+ export const agentProfileResourcesSchema = z.strictObject({
34
34
  files: z.array(agentProfileFileMountSchema).optional(),
35
35
  tools: z.array(agentProfileResourceRefSchema).optional(),
36
36
  skills: z.array(agentProfileResourceRefSchema).optional(),
37
37
  agents: z.array(agentProfileResourceRefSchema).optional(),
38
38
  commands: z.array(agentProfileResourceRefSchema).optional(),
39
- instructions: z.union([z.string(), agentProfileResourceRefSchema]).optional(),
39
+ instructions: z
40
+ .union([z.string(), agentProfileResourceRefSchema])
41
+ .optional(),
40
42
  failOnError: z.boolean().optional(),
41
43
  });
42
- export const agentProfileModelHintsSchema = z.object({
44
+ export const reasoningEffortSchema = z.enum([
45
+ "none",
46
+ "minimal",
47
+ "low",
48
+ "medium",
49
+ "high",
50
+ "xhigh",
51
+ "ultracode",
52
+ ]);
53
+ export const agentProfileModelHintsSchema = z.strictObject({
43
54
  default: z.string().optional(),
44
55
  small: z.string().optional(),
45
56
  provider: z.string().optional(),
46
- reasoningEffort: z
47
- .enum(["none", "minimal", "low", "medium", "high", "xhigh", "ultracode"])
48
- .optional(),
57
+ reasoningEffort: reasoningEffortSchema.optional(),
49
58
  metadata: z.record(z.string(), z.unknown()).optional(),
50
59
  });
51
- export const agentProfilePromptSchema = z.object({
60
+ export const agentProfilePromptSchema = z.strictObject({
52
61
  systemPrompt: z.string().optional(),
53
62
  instructions: z.array(z.string()).optional(),
54
63
  });
55
- export const agentSubagentProfileSchema = z.object({
64
+ export const agentSubagentProfileSchema = z.strictObject({
56
65
  description: z.string().optional(),
57
66
  prompt: z.string().optional(),
58
67
  model: z.string().optional(),
@@ -61,14 +70,14 @@ export const agentSubagentProfileSchema = z.object({
61
70
  maxSteps: z.number().optional(),
62
71
  metadata: z.record(z.string(), z.unknown()).optional(),
63
72
  });
64
- export const agentProfileHookCommandSchema = z.object({
73
+ export const agentProfileHookCommandSchema = z.strictObject({
65
74
  command: z.string(),
66
75
  timeoutMs: z.number().positive().optional(),
67
76
  blocking: z.boolean().optional(),
68
77
  matcher: z.string().optional(),
69
78
  env: z.record(z.string(), z.string()).optional(),
70
79
  });
71
- export const agentProfileModeSchema = z.object({
80
+ export const agentProfileModeSchema = z.strictObject({
72
81
  description: z.string().optional(),
73
82
  model: z.string().optional(),
74
83
  prompt: z.string().optional(),
@@ -76,34 +85,73 @@ export const agentProfileModeSchema = z.object({
76
85
  permissions: z.record(z.string(), agentProfilePermissionSchema).optional(),
77
86
  metadata: z.record(z.string(), z.unknown()).optional(),
78
87
  });
79
- export const agentProfileConfidentialSchema = z.object({
88
+ export const agentProfileConfidentialSchema = z.strictObject({
80
89
  tee: z.string().optional(),
81
90
  attestationNonce: z.string().optional(),
82
91
  sealed: z.boolean().optional(),
83
92
  attestationRefresh: z.boolean().optional(),
84
93
  });
85
- export const agentProfileMcpServerSchema = z.object({
86
- transport: z.enum(["stdio", "sse", "http"]).optional(),
87
- command: z.string().optional(),
94
+ const nonBlankMcpValueSchema = z
95
+ .string()
96
+ .refine((value) => value.trim().length > 0, "value cannot be blank");
97
+ const remoteMcpUrlSchema = nonBlankMcpValueSchema.refine((value) => {
98
+ try {
99
+ const url = new URL(value);
100
+ return url.protocol === "http:" || url.protocol === "https:";
101
+ }
102
+ catch {
103
+ return false;
104
+ }
105
+ }, "remote MCP url must be an absolute HTTP(S) URL");
106
+ const agentProfileLocalMcpServerSchema = z.strictObject({
107
+ transport: z.literal("stdio").optional(),
108
+ command: nonBlankMcpValueSchema,
88
109
  args: z.array(z.string()).optional(),
89
110
  env: z.record(z.string(), z.string()).optional(),
90
111
  cwd: z.string().optional(),
91
- url: z.string().optional(),
112
+ url: z.undefined().optional(),
113
+ headers: z.undefined().optional(),
114
+ enabled: z.literal(true).optional(),
115
+ metadata: z.record(z.string(), z.unknown()).optional(),
116
+ });
117
+ const agentProfileRemoteMcpServerSchema = z.strictObject({
118
+ transport: z.enum(["sse", "http"]).optional(),
119
+ command: z.undefined().optional(),
120
+ args: z.undefined().optional(),
121
+ env: z.undefined().optional(),
122
+ cwd: z.undefined().optional(),
123
+ url: remoteMcpUrlSchema,
92
124
  headers: z.record(z.string(), z.string()).optional(),
93
- enabled: z.boolean().optional(),
125
+ enabled: z.literal(true).optional(),
94
126
  metadata: z.record(z.string(), z.unknown()).optional(),
95
127
  });
96
- export const agentProfileConnectionSchema = z.object({
128
+ const agentProfileDisabledMcpServerSchema = z.strictObject({
129
+ enabled: z.literal(false),
130
+ transport: z.undefined().optional(),
131
+ command: z.undefined().optional(),
132
+ args: z.undefined().optional(),
133
+ env: z.undefined().optional(),
134
+ cwd: z.undefined().optional(),
135
+ url: z.undefined().optional(),
136
+ headers: z.undefined().optional(),
137
+ metadata: z.record(z.string(), z.unknown()).optional(),
138
+ });
139
+ export const agentProfileMcpServerSchema = z.union([
140
+ agentProfileLocalMcpServerSchema,
141
+ agentProfileRemoteMcpServerSchema,
142
+ agentProfileDisabledMcpServerSchema,
143
+ ]);
144
+ export const agentProfileConnectionSchema = z.strictObject({
97
145
  connectionId: z.string().min(1),
98
146
  capabilities: z.array(z.string().min(1)).min(1),
99
147
  alias: z.string().min(1).optional(),
100
148
  });
101
149
  const removeListSchema = z.union([z.literal(true), z.array(z.string().min(1))]);
102
- export const agentProfilePromptRemovalSchema = z.object({
150
+ export const agentProfilePromptRemovalSchema = z.strictObject({
103
151
  systemPrompt: z.literal(true).optional(),
104
152
  instructions: removeListSchema.optional(),
105
153
  });
106
- export const agentProfileResourceRemovalSchema = z.object({
154
+ export const agentProfileResourceRemovalSchema = z.strictObject({
107
155
  files: removeListSchema.optional(),
108
156
  tools: removeListSchema.optional(),
109
157
  skills: removeListSchema.optional(),
@@ -112,10 +160,12 @@ export const agentProfileResourceRemovalSchema = z.object({
112
160
  instructions: z.literal(true).optional(),
113
161
  failOnError: z.literal(true).optional(),
114
162
  });
115
- export const agentProfileDiffRemovalSchema = z.object({
163
+ export const agentProfileDiffRemovalSchema = z.strictObject({
116
164
  identity: z.literal(true).optional(),
117
165
  tags: removeListSchema.optional(),
118
- prompt: z.union([z.literal(true), agentProfilePromptRemovalSchema]).optional(),
166
+ prompt: z
167
+ .union([z.literal(true), agentProfilePromptRemovalSchema])
168
+ .optional(),
119
169
  model: removeListSchema.optional(),
120
170
  harness: z.literal(true).optional(),
121
171
  permissions: removeListSchema.optional(),
@@ -123,7 +173,9 @@ export const agentProfileDiffRemovalSchema = z.object({
123
173
  mcp: removeListSchema.optional(),
124
174
  connections: removeListSchema.optional(),
125
175
  subagents: removeListSchema.optional(),
126
- resources: z.union([z.literal(true), agentProfileResourceRemovalSchema]).optional(),
176
+ resources: z
177
+ .union([z.literal(true), agentProfileResourceRemovalSchema])
178
+ .optional(),
127
179
  hooks: removeListSchema.optional(),
128
180
  modes: removeListSchema.optional(),
129
181
  confidential: z.literal(true).optional(),
@@ -135,7 +187,7 @@ export const agentProfileDiffRemovalSchema = z.object({
135
187
  * the canonical {@link AgentProfile} TS contract. Kept structurally in lock-step
136
188
  * with that interface by the compile-time guard at the bottom of this file.
137
189
  */
138
- export const agentProfileSchema = z.object({
190
+ export const agentProfileSchema = z.strictObject({
139
191
  name: z.string().optional(),
140
192
  description: z.string().optional(),
141
193
  version: z.string().optional(),
@@ -159,15 +211,14 @@ export const agentProfileSchema = z.object({
159
211
  .record(z.string(), z.union([z.record(z.string(), z.unknown()), z.undefined()]))
160
212
  .optional(),
161
213
  });
162
- export const agentProfileDiffSchema = z
163
- .object({
214
+ export const agentProfileDiffSchema = z.strictObject({
164
215
  kind: z.literal("agent-profile-diff"),
165
216
  id: z.string().min(1).optional(),
166
217
  title: z.string().min(1).optional(),
167
218
  description: z.string().optional(),
168
219
  rationale: z.string().optional(),
169
220
  source: z
170
- .object({
221
+ .strictObject({
171
222
  kind: z.enum([
172
223
  "trace",
173
224
  "frontier-author",
@@ -182,11 +233,10 @@ export const agentProfileDiffSchema = z
182
233
  set: agentProfileSchema.optional(),
183
234
  remove: agentProfileDiffRemovalSchema.optional(),
184
235
  metadata: z.record(z.string(), z.unknown()).optional(),
185
- })
186
- .strict();
236
+ });
187
237
  const _agentProfileSchemaMatchesInterface = true;
188
238
  void _agentProfileSchemaMatchesInterface;
189
- export const capabilitySchema = z.object({
239
+ export const capabilitySchema = z.strictObject({
190
240
  id: z.string().min(1),
191
241
  definition: agentProfileSchema,
192
242
  recommendedSize: z.enum(SANDBOX_SIZE_PRESET_NAMES).optional(),
@@ -105,6 +105,8 @@ function isLocalMcpServer(server) {
105
105
  export function validateAgentProfileSecurity(profile, policy = DEFAULT_CLOUD_AGENT_PROFILE_SECURITY_POLICY) {
106
106
  const issues = [];
107
107
  for (const [name, server] of Object.entries(profile.mcp ?? {})) {
108
+ if (server.enabled === false)
109
+ continue;
108
110
  if (isLocalMcpServer(server)) {
109
111
  if (!policy.allowLocalMcp) {
110
112
  issues.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsc -p tsconfig.json",
46
- "check-types": "tsc --noEmit",
46
+ "check-types": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
47
47
  "clean": "rm -rf dist tsconfig.tsbuildinfo",
48
48
  "test": "vitest run",
49
49
  "test:watch": "vitest"