@tangle-network/agent-interface 0.4.0 → 0.6.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,281 @@
1
+ /**
2
+ * Provider-neutral agent profile types for public SDK consumers.
3
+ *
4
+ * These model portable agent intent at the application boundary. Individual
5
+ * backends translate this shape into their own native profile/configuration
6
+ * formats internally. This is the canonical home; `@tangle-network/sandbox`
7
+ * re-exports these symbols for backward compatibility.
8
+ */
9
+ /**
10
+ * Permission policy value for a capability.
11
+ */
12
+ export type AgentProfilePermissionValue = "allow" | "ask" | "deny";
13
+ export type AgentProfilePermission = AgentProfilePermissionValue | Record<string, AgentProfilePermissionValue>;
14
+ /**
15
+ * Generic resource reference that can be resolved into a file or instruction.
16
+ */
17
+ export type AgentProfileResourceRef = {
18
+ kind: "inline";
19
+ name: string;
20
+ content: string;
21
+ } | {
22
+ kind: "github";
23
+ /**
24
+ * Optional repository in "owner/repo" form. When omitted, providers may
25
+ * only resolve the path if they have an ambient repository context.
26
+ */
27
+ repository?: string;
28
+ path: string;
29
+ ref?: string;
30
+ name?: string;
31
+ };
32
+ /**
33
+ * Helper for creating typed inline resource refs.
34
+ */
35
+ export declare function defineInlineResource(name: string, content: string): AgentProfileResourceRef;
36
+ /**
37
+ * Helper for creating typed GitHub-backed resource refs.
38
+ */
39
+ export declare function defineGitHubResource(path: string, options?: {
40
+ repository?: string;
41
+ ref?: string;
42
+ name?: string;
43
+ }): AgentProfileResourceRef;
44
+ /**
45
+ * Resource mounted into a backend workspace.
46
+ */
47
+ export interface AgentProfileFileMount {
48
+ path: string;
49
+ resource: AgentProfileResourceRef;
50
+ executable?: boolean;
51
+ }
52
+ /**
53
+ * Provider-neutral resource bundle.
54
+ */
55
+ export interface AgentProfileResources {
56
+ /**
57
+ * Generic files to materialize into the agent workspace before execution.
58
+ */
59
+ files?: AgentProfileFileMount[];
60
+ /**
61
+ * Provider-native tool files. Backends materialize these into their standard
62
+ * discovery location when they support file-based tools.
63
+ */
64
+ tools?: AgentProfileResourceRef[];
65
+ /**
66
+ * Agent Skills (`SKILL.md`) packages. Supported by Cursor, Claude Code,
67
+ * Codex-compatible layouts, OpenCode, and Hermes-style skill harnesses.
68
+ */
69
+ skills?: AgentProfileResourceRef[];
70
+ /**
71
+ * Provider-native subagent definition files.
72
+ */
73
+ agents?: AgentProfileResourceRef[];
74
+ /**
75
+ * Provider-native slash command files.
76
+ */
77
+ commands?: AgentProfileResourceRef[];
78
+ /**
79
+ * Additional instructions injected into the agent context.
80
+ */
81
+ instructions?: string | AgentProfileResourceRef;
82
+ /**
83
+ * Fail initialization when a provider cannot materialize a resource.
84
+ */
85
+ failOnError?: boolean;
86
+ }
87
+ /**
88
+ * Portable reasoning/thinking effort. Backends map it to their native control at materialization:
89
+ * codex `model_reasoning_effort`, kimi `--thinking`/`--no-thinking`, claude thinking budget.
90
+ * Ordered low→high: `none` = no extended thinking; `ultracode` = maximum (claude-code's
91
+ * "ultracode" run mode). A backend without a matching native tier clamps to its nearest
92
+ * (e.g. codex maps `xhigh`/`ultracode` → `high`).
93
+ */
94
+ export type ReasoningEffort = 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'ultracode';
95
+ /**
96
+ * Model selection hints for backends.
97
+ */
98
+ export interface AgentProfileModelHints {
99
+ /**
100
+ * Preferred default model (format depends on backend, commonly "provider/model").
101
+ */
102
+ default?: string;
103
+ /**
104
+ * Preferred small/cheap model for lightweight work.
105
+ */
106
+ small?: string;
107
+ /**
108
+ * Optional provider preference hint.
109
+ */
110
+ provider?: string;
111
+ /**
112
+ * Reasoning/thinking effort hint — a first-class, portable model dimension (not buried in
113
+ * `extensions`). Backends map it to their native control at materialization.
114
+ */
115
+ reasoningEffort?: ReasoningEffort;
116
+ /**
117
+ * Backend-agnostic model metadata/hints.
118
+ */
119
+ metadata?: Record<string, unknown>;
120
+ }
121
+ /**
122
+ * Prompt shaping for an agent.
123
+ */
124
+ export interface AgentProfilePrompt {
125
+ /**
126
+ * Full system prompt replacement, when supported.
127
+ */
128
+ systemPrompt?: string;
129
+ /**
130
+ * Additional instruction lines appended to the active prompt.
131
+ */
132
+ instructions?: string[];
133
+ }
134
+ /**
135
+ * Generic subagent definition.
136
+ */
137
+ export interface AgentSubagentProfile {
138
+ description?: string;
139
+ prompt?: string;
140
+ model?: string;
141
+ tools?: Record<string, boolean>;
142
+ permissions?: Record<string, AgentProfilePermission>;
143
+ maxSteps?: number;
144
+ metadata?: Record<string, unknown>;
145
+ }
146
+ export interface AgentProfileHookCommand {
147
+ command: string;
148
+ timeoutMs?: number;
149
+ blocking?: boolean;
150
+ matcher?: string;
151
+ env?: Record<string, string>;
152
+ }
153
+ export interface AgentProfileMode {
154
+ description?: string;
155
+ model?: string;
156
+ prompt?: string;
157
+ tools?: Record<string, boolean>;
158
+ permissions?: Record<string, AgentProfilePermission>;
159
+ metadata?: Record<string, unknown>;
160
+ }
161
+ /**
162
+ * Confidential-execution options for sandbox backends.
163
+ *
164
+ * The Tangle blueprint path translates this into TEE job parameters and fails
165
+ * closed when the requested TEE is unavailable. Callers should verify returned
166
+ * attestation evidence before treating a session as confidential.
167
+ */
168
+ export interface AgentProfileConfidential {
169
+ /**
170
+ * TEE variant requested from the operator.
171
+ */
172
+ tee?: "tdx" | "nitro" | "phala-dstack" | "sev-snp" | "any" | (string & {});
173
+ /**
174
+ * Optional hex-encoded 32-64 byte challenge for deploy-time report data.
175
+ */
176
+ attestationNonce?: string;
177
+ /**
178
+ * Require no persistence across session end when supported by the backend.
179
+ */
180
+ sealed?: boolean;
181
+ /**
182
+ * Ask the SDK/backend to create or require a fresh attestation challenge.
183
+ */
184
+ attestationRefresh?: boolean;
185
+ }
186
+ /**
187
+ * Generic MCP server configuration.
188
+ */
189
+ export interface AgentProfileMcpServer {
190
+ transport?: "stdio" | "sse" | "http";
191
+ command?: string;
192
+ args?: string[];
193
+ env?: Record<string, string>;
194
+ cwd?: string;
195
+ url?: string;
196
+ headers?: Record<string, string>;
197
+ enabled?: boolean;
198
+ metadata?: Record<string, unknown>;
199
+ }
200
+ /**
201
+ * Public provider-neutral agent profile contract.
202
+ */
203
+ export interface AgentProfile {
204
+ name?: string;
205
+ description?: string;
206
+ version?: string;
207
+ tags?: string[];
208
+ prompt?: AgentProfilePrompt;
209
+ model?: AgentProfileModelHints;
210
+ permissions?: Record<string, AgentProfilePermission>;
211
+ tools?: Record<string, boolean>;
212
+ mcp?: Record<string, AgentProfileMcpServer>;
213
+ subagents?: Record<string, AgentSubagentProfile>;
214
+ resources?: AgentProfileResources;
215
+ hooks?: Record<string, AgentProfileHookCommand[]>;
216
+ modes?: Record<string, AgentProfileMode>;
217
+ confidential?: AgentProfileConfidential;
218
+ metadata?: Record<string, unknown>;
219
+ /**
220
+ * Non-portable backend-specific extensions.
221
+ *
222
+ * Use this only for features that cannot be expressed generically.
223
+ * SDK consumers should treat extension keys as backend namespaces.
224
+ */
225
+ extensions?: Record<string, Record<string, unknown> | undefined>;
226
+ }
227
+ /**
228
+ * Helper for declaring typed profiles in application code.
229
+ */
230
+ export declare function defineAgentProfile<T extends AgentProfile>(profile: T): T;
231
+ /**
232
+ * Capabilities describing how a backend interprets AgentProfile.
233
+ */
234
+ export interface AgentProfileCapabilities {
235
+ namedProfiles: boolean;
236
+ systemPrompt: boolean;
237
+ instructions: boolean;
238
+ tools: boolean;
239
+ permissions: boolean;
240
+ mcp: boolean;
241
+ subagents: boolean;
242
+ resources: {
243
+ files: boolean;
244
+ instructions: boolean;
245
+ tools?: boolean;
246
+ skills?: boolean;
247
+ agents?: boolean;
248
+ commands?: boolean;
249
+ };
250
+ hooks?: boolean;
251
+ modes?: boolean;
252
+ runtimeUpdate: boolean;
253
+ validation: boolean;
254
+ /**
255
+ * Backend extension namespaces understood by this backend.
256
+ */
257
+ extensions?: string[];
258
+ }
259
+ /**
260
+ * Validation issue for a profile/backend pairing.
261
+ */
262
+ export interface AgentProfileValidationIssue {
263
+ level: "error" | "warning" | "info";
264
+ code: string;
265
+ message: string;
266
+ path?: string;
267
+ }
268
+ /**
269
+ * Validation output for a provider adapter.
270
+ */
271
+ export interface AgentProfileValidationResult {
272
+ ok: boolean;
273
+ issues: AgentProfileValidationIssue[];
274
+ normalizedProfile?: AgentProfile;
275
+ }
276
+ /**
277
+ * Merge two public AgentProfile values.
278
+ *
279
+ * Overlay fields win on conflicts. Array-like instruction sets are appended.
280
+ */
281
+ export declare function mergeAgentProfiles(base: AgentProfile | undefined, overlay: AgentProfile | undefined): AgentProfile | undefined;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Provider-neutral agent profile types for public SDK consumers.
3
+ *
4
+ * These model portable agent intent at the application boundary. Individual
5
+ * backends translate this shape into their own native profile/configuration
6
+ * formats internally. This is the canonical home; `@tangle-network/sandbox`
7
+ * re-exports these symbols for backward compatibility.
8
+ */
9
+ /**
10
+ * Helper for creating typed inline resource refs.
11
+ */
12
+ export function defineInlineResource(name, content) {
13
+ return { kind: "inline", name, content };
14
+ }
15
+ /**
16
+ * Helper for creating typed GitHub-backed resource refs.
17
+ */
18
+ export function defineGitHubResource(path, options = {}) {
19
+ return {
20
+ kind: "github",
21
+ repository: options.repository,
22
+ path,
23
+ ref: options.ref,
24
+ name: options.name,
25
+ };
26
+ }
27
+ /**
28
+ * Helper for declaring typed profiles in application code.
29
+ */
30
+ export function defineAgentProfile(profile) {
31
+ return profile;
32
+ }
33
+ function mergeStringArrays(base, overlay) {
34
+ if (!base && !overlay)
35
+ return undefined;
36
+ return [...(base ?? []), ...(overlay ?? [])];
37
+ }
38
+ function mergeRecord(base, overlay) {
39
+ if (!base && !overlay)
40
+ return undefined;
41
+ return {
42
+ ...(base ?? {}),
43
+ ...(overlay ?? {}),
44
+ };
45
+ }
46
+ /**
47
+ * Merge two public AgentProfile values.
48
+ *
49
+ * Overlay fields win on conflicts. Array-like instruction sets are appended.
50
+ */
51
+ export function mergeAgentProfiles(base, overlay) {
52
+ if (!base && !overlay)
53
+ return undefined;
54
+ const mergedPrompt = base?.prompt || overlay?.prompt
55
+ ? {
56
+ ...(base?.prompt ?? {}),
57
+ ...(overlay?.prompt ?? {}),
58
+ instructions: mergeStringArrays(base?.prompt?.instructions, overlay?.prompt?.instructions),
59
+ }
60
+ : undefined;
61
+ const mergedResources = base?.resources || overlay?.resources
62
+ ? {
63
+ ...(base?.resources ?? {}),
64
+ ...(overlay?.resources ?? {}),
65
+ files: [
66
+ ...(base?.resources?.files ?? []),
67
+ ...(overlay?.resources?.files ?? []),
68
+ ],
69
+ tools: [
70
+ ...(base?.resources?.tools ?? []),
71
+ ...(overlay?.resources?.tools ?? []),
72
+ ],
73
+ skills: [
74
+ ...(base?.resources?.skills ?? []),
75
+ ...(overlay?.resources?.skills ?? []),
76
+ ],
77
+ agents: [
78
+ ...(base?.resources?.agents ?? []),
79
+ ...(overlay?.resources?.agents ?? []),
80
+ ],
81
+ commands: [
82
+ ...(base?.resources?.commands ?? []),
83
+ ...(overlay?.resources?.commands ?? []),
84
+ ],
85
+ instructions: overlay?.resources?.instructions ?? base?.resources?.instructions,
86
+ }
87
+ : undefined;
88
+ return {
89
+ ...(base ?? {}),
90
+ ...(overlay ?? {}),
91
+ prompt: mergedPrompt,
92
+ permissions: mergeRecord(base?.permissions, overlay?.permissions),
93
+ tools: mergeRecord(base?.tools, overlay?.tools),
94
+ mcp: mergeRecord(base?.mcp, overlay?.mcp),
95
+ subagents: mergeRecord(base?.subagents, overlay?.subagents),
96
+ resources: mergedResources,
97
+ hooks: mergeRecord(base?.hooks, overlay?.hooks),
98
+ modes: mergeRecord(base?.modes, overlay?.modes),
99
+ metadata: mergeRecord(base?.metadata, overlay?.metadata),
100
+ extensions: mergeRecord(base?.extensions, overlay?.extensions),
101
+ };
102
+ }
package/dist/index.d.ts CHANGED
@@ -578,4 +578,5 @@ export interface SdkProviderAdapter {
578
578
  downloadArtifact?(sessionId: string, path: string): Promise<Uint8Array>;
579
579
  submitQuestionAnswer?(answers: Record<string, string[]>): Promise<void>;
580
580
  }
581
+ export * from "./agent-profile.js";
581
582
  export * from "./profile-schema.js";
package/dist/index.js CHANGED
@@ -122,4 +122,5 @@ export function resolveNativeWebTools(tools) {
122
122
  }
123
123
  return posture;
124
124
  }
125
+ export * from "./agent-profile.js";
125
126
  export * from "./profile-schema.js";
@@ -1,33 +1,22 @@
1
1
  import { z } from "zod";
2
2
  export declare const agentProfilePermissionValueSchema: z.ZodEnum<{
3
3
  allow: "allow";
4
- deny: "deny";
5
4
  ask: "ask";
5
+ deny: "deny";
6
6
  }>;
7
7
  export declare const agentProfilePermissionSchema: z.ZodUnion<readonly [z.ZodEnum<{
8
8
  allow: "allow";
9
- deny: "deny";
10
9
  ask: "ask";
10
+ deny: "deny";
11
11
  }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
12
12
  allow: "allow";
13
- deny: "deny";
14
13
  ask: "ask";
14
+ deny: "deny";
15
15
  }>>]>;
16
16
  export declare const agentProfileResourceRefSchema: z.ZodUnion<readonly [z.ZodObject<{
17
- content: z.ZodString;
18
- name: z.ZodString;
19
- }, z.core.$strip>, z.ZodObject<{
20
17
  kind: z.ZodLiteral<"inline">;
21
- content: z.ZodString;
22
18
  name: z.ZodString;
23
- }, z.core.$strip>, z.ZodObject<{
24
- npm: z.ZodString;
25
- name: z.ZodOptional<z.ZodString>;
26
- version: z.ZodOptional<z.ZodString>;
27
- }, z.core.$strip>, z.ZodObject<{
28
- github: z.ZodString;
29
- ref: z.ZodOptional<z.ZodString>;
30
- name: z.ZodOptional<z.ZodString>;
19
+ content: z.ZodString;
31
20
  }, z.core.$strip>, z.ZodObject<{
32
21
  kind: z.ZodLiteral<"github">;
33
22
  repository: z.ZodOptional<z.ZodString>;
@@ -38,20 +27,9 @@ export declare const agentProfileResourceRefSchema: z.ZodUnion<readonly [z.ZodOb
38
27
  export declare const agentProfileFileMountSchema: z.ZodObject<{
39
28
  path: z.ZodString;
40
29
  resource: z.ZodUnion<readonly [z.ZodObject<{
41
- content: z.ZodString;
42
- name: z.ZodString;
43
- }, z.core.$strip>, z.ZodObject<{
44
30
  kind: z.ZodLiteral<"inline">;
45
- content: z.ZodString;
46
31
  name: z.ZodString;
47
- }, z.core.$strip>, z.ZodObject<{
48
- npm: z.ZodString;
49
- name: z.ZodOptional<z.ZodString>;
50
- version: z.ZodOptional<z.ZodString>;
51
- }, z.core.$strip>, z.ZodObject<{
52
- github: z.ZodString;
53
- ref: z.ZodOptional<z.ZodString>;
54
- name: z.ZodOptional<z.ZodString>;
32
+ content: z.ZodString;
55
33
  }, z.core.$strip>, z.ZodObject<{
56
34
  kind: z.ZodLiteral<"github">;
57
35
  repository: z.ZodOptional<z.ZodString>;
@@ -61,22 +39,26 @@ export declare const agentProfileFileMountSchema: z.ZodObject<{
61
39
  }, z.core.$strip>]>;
62
40
  executable: z.ZodOptional<z.ZodBoolean>;
63
41
  }, z.core.$strip>;
64
- export declare const agentProfileResourcesSchema: z.ZodOptional<z.ZodObject<{
42
+ export declare const agentProfileResourcesSchema: z.ZodObject<{
43
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ path: z.ZodString;
45
+ resource: z.ZodUnion<readonly [z.ZodObject<{
46
+ kind: z.ZodLiteral<"inline">;
47
+ name: z.ZodString;
48
+ content: z.ZodString;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ kind: z.ZodLiteral<"github">;
51
+ repository: z.ZodOptional<z.ZodString>;
52
+ path: z.ZodString;
53
+ ref: z.ZodOptional<z.ZodString>;
54
+ name: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>]>;
56
+ executable: z.ZodOptional<z.ZodBoolean>;
57
+ }, z.core.$strip>>>;
65
58
  tools: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
66
- content: z.ZodString;
67
- name: z.ZodString;
68
- }, z.core.$strip>, z.ZodObject<{
69
59
  kind: z.ZodLiteral<"inline">;
70
- content: z.ZodString;
71
60
  name: z.ZodString;
72
- }, z.core.$strip>, z.ZodObject<{
73
- npm: z.ZodString;
74
- name: z.ZodOptional<z.ZodString>;
75
- version: z.ZodOptional<z.ZodString>;
76
- }, z.core.$strip>, z.ZodObject<{
77
- github: z.ZodString;
78
- ref: z.ZodOptional<z.ZodString>;
79
- name: z.ZodOptional<z.ZodString>;
61
+ content: z.ZodString;
80
62
  }, z.core.$strip>, z.ZodObject<{
81
63
  kind: z.ZodLiteral<"github">;
82
64
  repository: z.ZodOptional<z.ZodString>;
@@ -85,20 +67,9 @@ export declare const agentProfileResourcesSchema: z.ZodOptional<z.ZodObject<{
85
67
  name: z.ZodOptional<z.ZodString>;
86
68
  }, z.core.$strip>]>>>;
87
69
  skills: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
88
- content: z.ZodString;
89
- name: z.ZodString;
90
- }, z.core.$strip>, z.ZodObject<{
91
70
  kind: z.ZodLiteral<"inline">;
92
- content: z.ZodString;
93
71
  name: z.ZodString;
94
- }, z.core.$strip>, z.ZodObject<{
95
- npm: z.ZodString;
96
- name: z.ZodOptional<z.ZodString>;
97
- version: z.ZodOptional<z.ZodString>;
98
- }, z.core.$strip>, z.ZodObject<{
99
- github: z.ZodString;
100
- ref: z.ZodOptional<z.ZodString>;
101
- name: z.ZodOptional<z.ZodString>;
72
+ content: z.ZodString;
102
73
  }, z.core.$strip>, z.ZodObject<{
103
74
  kind: z.ZodLiteral<"github">;
104
75
  repository: z.ZodOptional<z.ZodString>;
@@ -107,20 +78,9 @@ export declare const agentProfileResourcesSchema: z.ZodOptional<z.ZodObject<{
107
78
  name: z.ZodOptional<z.ZodString>;
108
79
  }, z.core.$strip>]>>>;
109
80
  agents: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
110
- content: z.ZodString;
111
- name: z.ZodString;
112
- }, z.core.$strip>, z.ZodObject<{
113
81
  kind: z.ZodLiteral<"inline">;
114
- content: z.ZodString;
115
82
  name: z.ZodString;
116
- }, z.core.$strip>, z.ZodObject<{
117
- npm: z.ZodString;
118
- name: z.ZodOptional<z.ZodString>;
119
- version: z.ZodOptional<z.ZodString>;
120
- }, z.core.$strip>, z.ZodObject<{
121
- github: z.ZodString;
122
- ref: z.ZodOptional<z.ZodString>;
123
- name: z.ZodOptional<z.ZodString>;
83
+ content: z.ZodString;
124
84
  }, z.core.$strip>, z.ZodObject<{
125
85
  kind: z.ZodLiteral<"github">;
126
86
  repository: z.ZodOptional<z.ZodString>;
@@ -129,20 +89,9 @@ export declare const agentProfileResourcesSchema: z.ZodOptional<z.ZodObject<{
129
89
  name: z.ZodOptional<z.ZodString>;
130
90
  }, z.core.$strip>]>>>;
131
91
  commands: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
132
- content: z.ZodString;
133
- name: z.ZodString;
134
- }, z.core.$strip>, z.ZodObject<{
135
92
  kind: z.ZodLiteral<"inline">;
136
- content: z.ZodString;
137
93
  name: z.ZodString;
138
- }, z.core.$strip>, z.ZodObject<{
139
- npm: z.ZodString;
140
- name: z.ZodOptional<z.ZodString>;
141
- version: z.ZodOptional<z.ZodString>;
142
- }, z.core.$strip>, z.ZodObject<{
143
- github: z.ZodString;
144
- ref: z.ZodOptional<z.ZodString>;
145
- name: z.ZodOptional<z.ZodString>;
94
+ content: z.ZodString;
146
95
  }, z.core.$strip>, z.ZodObject<{
147
96
  kind: z.ZodLiteral<"github">;
148
97
  repository: z.ZodOptional<z.ZodString>;
@@ -150,47 +99,10 @@ export declare const agentProfileResourcesSchema: z.ZodOptional<z.ZodObject<{
150
99
  ref: z.ZodOptional<z.ZodString>;
151
100
  name: z.ZodOptional<z.ZodString>;
152
101
  }, z.core.$strip>]>>>;
153
- files: z.ZodOptional<z.ZodArray<z.ZodObject<{
154
- path: z.ZodString;
155
- resource: z.ZodUnion<readonly [z.ZodObject<{
156
- content: z.ZodString;
157
- name: z.ZodString;
158
- }, z.core.$strip>, z.ZodObject<{
159
- kind: z.ZodLiteral<"inline">;
160
- content: z.ZodString;
161
- name: z.ZodString;
162
- }, z.core.$strip>, z.ZodObject<{
163
- npm: z.ZodString;
164
- name: z.ZodOptional<z.ZodString>;
165
- version: z.ZodOptional<z.ZodString>;
166
- }, z.core.$strip>, z.ZodObject<{
167
- github: z.ZodString;
168
- ref: z.ZodOptional<z.ZodString>;
169
- name: z.ZodOptional<z.ZodString>;
170
- }, z.core.$strip>, z.ZodObject<{
171
- kind: z.ZodLiteral<"github">;
172
- repository: z.ZodOptional<z.ZodString>;
173
- path: z.ZodString;
174
- ref: z.ZodOptional<z.ZodString>;
175
- name: z.ZodOptional<z.ZodString>;
176
- }, z.core.$strip>]>;
177
- executable: z.ZodOptional<z.ZodBoolean>;
178
- }, z.core.$strip>>>;
179
102
  instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
180
- content: z.ZodString;
181
- name: z.ZodString;
182
- }, z.core.$strip>, z.ZodObject<{
183
103
  kind: z.ZodLiteral<"inline">;
184
- content: z.ZodString;
185
104
  name: z.ZodString;
186
- }, z.core.$strip>, z.ZodObject<{
187
- npm: z.ZodString;
188
- name: z.ZodOptional<z.ZodString>;
189
- version: z.ZodOptional<z.ZodString>;
190
- }, z.core.$strip>, z.ZodObject<{
191
- github: z.ZodString;
192
- ref: z.ZodOptional<z.ZodString>;
193
- name: z.ZodOptional<z.ZodString>;
105
+ content: z.ZodString;
194
106
  }, z.core.$strip>, z.ZodObject<{
195
107
  kind: z.ZodLiteral<"github">;
196
108
  repository: z.ZodOptional<z.ZodString>;
@@ -199,14 +111,49 @@ export declare const agentProfileResourcesSchema: z.ZodOptional<z.ZodObject<{
199
111
  name: z.ZodOptional<z.ZodString>;
200
112
  }, z.core.$strip>]>]>>;
201
113
  failOnError: z.ZodOptional<z.ZodBoolean>;
202
- }, z.core.$strip>>;
114
+ }, z.core.$strip>;
115
+ export declare const agentProfileModelHintsSchema: z.ZodObject<{
116
+ default: z.ZodOptional<z.ZodString>;
117
+ small: z.ZodOptional<z.ZodString>;
118
+ provider: z.ZodOptional<z.ZodString>;
119
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
120
+ none: "none";
121
+ low: "low";
122
+ medium: "medium";
123
+ high: "high";
124
+ xhigh: "xhigh";
125
+ ultracode: "ultracode";
126
+ }>>;
127
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
128
+ }, z.core.$strip>;
129
+ export declare const agentProfilePromptSchema: z.ZodObject<{
130
+ systemPrompt: z.ZodOptional<z.ZodString>;
131
+ instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
+ }, z.core.$strip>;
133
+ export declare const agentSubagentProfileSchema: z.ZodObject<{
134
+ description: z.ZodOptional<z.ZodString>;
135
+ prompt: z.ZodOptional<z.ZodString>;
136
+ model: z.ZodOptional<z.ZodString>;
137
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
138
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
139
+ allow: "allow";
140
+ ask: "ask";
141
+ deny: "deny";
142
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
143
+ allow: "allow";
144
+ ask: "ask";
145
+ deny: "deny";
146
+ }>>]>>>;
147
+ maxSteps: z.ZodOptional<z.ZodNumber>;
148
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
149
+ }, z.core.$strip>;
203
150
  export declare const agentProfileHookCommandSchema: z.ZodObject<{
204
151
  command: z.ZodString;
205
152
  timeoutMs: z.ZodOptional<z.ZodNumber>;
206
153
  blocking: z.ZodOptional<z.ZodBoolean>;
207
154
  matcher: z.ZodOptional<z.ZodString>;
208
155
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
209
- }, z.core.$loose>;
156
+ }, z.core.$strip>;
210
157
  export declare const agentProfileModeSchema: z.ZodObject<{
211
158
  description: z.ZodOptional<z.ZodString>;
212
159
  model: z.ZodOptional<z.ZodString>;
@@ -214,12 +161,208 @@ export declare const agentProfileModeSchema: z.ZodObject<{
214
161
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
215
162
  permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
216
163
  allow: "allow";
217
- deny: "deny";
218
164
  ask: "ask";
165
+ deny: "deny";
219
166
  }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
220
167
  allow: "allow";
168
+ ask: "ask";
169
+ deny: "deny";
170
+ }>>]>>>;
171
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
172
+ }, z.core.$strip>;
173
+ export declare const agentProfileConfidentialSchema: z.ZodObject<{
174
+ tee: z.ZodOptional<z.ZodString>;
175
+ attestationNonce: z.ZodOptional<z.ZodString>;
176
+ sealed: z.ZodOptional<z.ZodBoolean>;
177
+ attestationRefresh: z.ZodOptional<z.ZodBoolean>;
178
+ }, z.core.$strip>;
179
+ export declare const agentProfileMcpServerSchema: z.ZodObject<{
180
+ transport: z.ZodOptional<z.ZodEnum<{
181
+ stdio: "stdio";
182
+ sse: "sse";
183
+ http: "http";
184
+ }>>;
185
+ command: z.ZodOptional<z.ZodString>;
186
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
187
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
188
+ cwd: z.ZodOptional<z.ZodString>;
189
+ url: z.ZodOptional<z.ZodString>;
190
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
191
+ enabled: z.ZodOptional<z.ZodBoolean>;
192
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
193
+ }, z.core.$strip>;
194
+ /**
195
+ * The complete provider-neutral agent profile schema — the runtime validator for
196
+ * the canonical {@link AgentProfile} TS contract. Kept structurally in lock-step
197
+ * with that interface by the compile-time guard at the bottom of this file.
198
+ */
199
+ export declare const agentProfileSchema: z.ZodObject<{
200
+ name: z.ZodOptional<z.ZodString>;
201
+ description: z.ZodOptional<z.ZodString>;
202
+ version: z.ZodOptional<z.ZodString>;
203
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
+ prompt: z.ZodOptional<z.ZodObject<{
205
+ systemPrompt: z.ZodOptional<z.ZodString>;
206
+ instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
207
+ }, z.core.$strip>>;
208
+ model: z.ZodOptional<z.ZodObject<{
209
+ default: z.ZodOptional<z.ZodString>;
210
+ small: z.ZodOptional<z.ZodString>;
211
+ provider: z.ZodOptional<z.ZodString>;
212
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
213
+ none: "none";
214
+ low: "low";
215
+ medium: "medium";
216
+ high: "high";
217
+ xhigh: "xhigh";
218
+ ultracode: "ultracode";
219
+ }>>;
220
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
221
+ }, z.core.$strip>>;
222
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
223
+ allow: "allow";
224
+ ask: "ask";
221
225
  deny: "deny";
226
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
227
+ allow: "allow";
222
228
  ask: "ask";
229
+ deny: "deny";
223
230
  }>>]>>>;
231
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
232
+ mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
233
+ transport: z.ZodOptional<z.ZodEnum<{
234
+ stdio: "stdio";
235
+ sse: "sse";
236
+ http: "http";
237
+ }>>;
238
+ command: z.ZodOptional<z.ZodString>;
239
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
240
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
241
+ cwd: z.ZodOptional<z.ZodString>;
242
+ url: z.ZodOptional<z.ZodString>;
243
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
244
+ enabled: z.ZodOptional<z.ZodBoolean>;
245
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
246
+ }, z.core.$strip>>>;
247
+ subagents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
248
+ description: z.ZodOptional<z.ZodString>;
249
+ prompt: z.ZodOptional<z.ZodString>;
250
+ model: z.ZodOptional<z.ZodString>;
251
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
252
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
253
+ allow: "allow";
254
+ ask: "ask";
255
+ deny: "deny";
256
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
257
+ allow: "allow";
258
+ ask: "ask";
259
+ deny: "deny";
260
+ }>>]>>>;
261
+ maxSteps: z.ZodOptional<z.ZodNumber>;
262
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
263
+ }, z.core.$strip>>>;
264
+ resources: z.ZodOptional<z.ZodObject<{
265
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
266
+ path: z.ZodString;
267
+ resource: z.ZodUnion<readonly [z.ZodObject<{
268
+ kind: z.ZodLiteral<"inline">;
269
+ name: z.ZodString;
270
+ content: z.ZodString;
271
+ }, z.core.$strip>, z.ZodObject<{
272
+ kind: z.ZodLiteral<"github">;
273
+ repository: z.ZodOptional<z.ZodString>;
274
+ path: z.ZodString;
275
+ ref: z.ZodOptional<z.ZodString>;
276
+ name: z.ZodOptional<z.ZodString>;
277
+ }, z.core.$strip>]>;
278
+ executable: z.ZodOptional<z.ZodBoolean>;
279
+ }, z.core.$strip>>>;
280
+ tools: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
281
+ kind: z.ZodLiteral<"inline">;
282
+ name: z.ZodString;
283
+ content: z.ZodString;
284
+ }, z.core.$strip>, z.ZodObject<{
285
+ kind: z.ZodLiteral<"github">;
286
+ repository: z.ZodOptional<z.ZodString>;
287
+ path: z.ZodString;
288
+ ref: z.ZodOptional<z.ZodString>;
289
+ name: z.ZodOptional<z.ZodString>;
290
+ }, z.core.$strip>]>>>;
291
+ skills: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
292
+ kind: z.ZodLiteral<"inline">;
293
+ name: z.ZodString;
294
+ content: z.ZodString;
295
+ }, z.core.$strip>, z.ZodObject<{
296
+ kind: z.ZodLiteral<"github">;
297
+ repository: z.ZodOptional<z.ZodString>;
298
+ path: z.ZodString;
299
+ ref: z.ZodOptional<z.ZodString>;
300
+ name: z.ZodOptional<z.ZodString>;
301
+ }, z.core.$strip>]>>>;
302
+ agents: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
303
+ kind: z.ZodLiteral<"inline">;
304
+ name: z.ZodString;
305
+ content: z.ZodString;
306
+ }, z.core.$strip>, z.ZodObject<{
307
+ kind: z.ZodLiteral<"github">;
308
+ repository: z.ZodOptional<z.ZodString>;
309
+ path: z.ZodString;
310
+ ref: z.ZodOptional<z.ZodString>;
311
+ name: z.ZodOptional<z.ZodString>;
312
+ }, z.core.$strip>]>>>;
313
+ commands: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
314
+ kind: z.ZodLiteral<"inline">;
315
+ name: z.ZodString;
316
+ content: z.ZodString;
317
+ }, z.core.$strip>, z.ZodObject<{
318
+ kind: z.ZodLiteral<"github">;
319
+ repository: z.ZodOptional<z.ZodString>;
320
+ path: z.ZodString;
321
+ ref: z.ZodOptional<z.ZodString>;
322
+ name: z.ZodOptional<z.ZodString>;
323
+ }, z.core.$strip>]>>>;
324
+ instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
325
+ kind: z.ZodLiteral<"inline">;
326
+ name: z.ZodString;
327
+ content: z.ZodString;
328
+ }, z.core.$strip>, z.ZodObject<{
329
+ kind: z.ZodLiteral<"github">;
330
+ repository: z.ZodOptional<z.ZodString>;
331
+ path: z.ZodString;
332
+ ref: z.ZodOptional<z.ZodString>;
333
+ name: z.ZodOptional<z.ZodString>;
334
+ }, z.core.$strip>]>]>>;
335
+ failOnError: z.ZodOptional<z.ZodBoolean>;
336
+ }, z.core.$strip>>;
337
+ hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
338
+ command: z.ZodString;
339
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
340
+ blocking: z.ZodOptional<z.ZodBoolean>;
341
+ matcher: z.ZodOptional<z.ZodString>;
342
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
343
+ }, z.core.$strip>>>>;
344
+ modes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
345
+ description: z.ZodOptional<z.ZodString>;
346
+ model: z.ZodOptional<z.ZodString>;
347
+ prompt: z.ZodOptional<z.ZodString>;
348
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
349
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
350
+ allow: "allow";
351
+ ask: "ask";
352
+ deny: "deny";
353
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
354
+ allow: "allow";
355
+ ask: "ask";
356
+ deny: "deny";
357
+ }>>]>>>;
358
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
359
+ }, z.core.$strip>>>;
360
+ confidential: z.ZodOptional<z.ZodObject<{
361
+ tee: z.ZodOptional<z.ZodString>;
362
+ attestationNonce: z.ZodOptional<z.ZodString>;
363
+ sealed: z.ZodOptional<z.ZodBoolean>;
364
+ attestationRefresh: z.ZodOptional<z.ZodBoolean>;
365
+ }, z.core.$strip>>;
224
366
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
225
- }, z.core.$loose>;
367
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodUndefined]>>>;
368
+ }, z.core.$strip>;
@@ -1,32 +1,15 @@
1
1
  import { z } from "zod";
2
- export const agentProfilePermissionValueSchema = z.enum([
3
- "allow",
4
- "deny",
5
- "ask",
6
- ]);
2
+ export const agentProfilePermissionValueSchema = z.enum(["allow", "deny", "ask"]);
7
3
  export const agentProfilePermissionSchema = z.union([
8
4
  agentProfilePermissionValueSchema,
9
5
  z.record(z.string(), agentProfilePermissionValueSchema),
10
6
  ]);
7
+ // Mirrors the canonical AgentProfileResourceRef (inline | github), kind-discriminated.
11
8
  export const agentProfileResourceRefSchema = z.union([
12
- z.object({
13
- content: z.string(),
14
- name: z.string(),
15
- }),
16
9
  z.object({
17
10
  kind: z.literal("inline"),
18
- content: z.string(),
19
11
  name: z.string(),
20
- }),
21
- z.object({
22
- npm: z.string(),
23
- name: z.string().optional(),
24
- version: z.string().optional(),
25
- }),
26
- z.object({
27
- github: z.string(),
28
- ref: z.string().optional(),
29
- name: z.string().optional(),
12
+ content: z.string(),
30
13
  }),
31
14
  z.object({
32
15
  kind: z.literal("github"),
@@ -41,35 +24,91 @@ export const agentProfileFileMountSchema = z.object({
41
24
  resource: agentProfileResourceRefSchema,
42
25
  executable: z.boolean().optional(),
43
26
  });
44
- export const agentProfileResourcesSchema = z
45
- .object({
27
+ export const agentProfileResourcesSchema = z.object({
28
+ files: z.array(agentProfileFileMountSchema).optional(),
46
29
  tools: z.array(agentProfileResourceRefSchema).optional(),
47
30
  skills: z.array(agentProfileResourceRefSchema).optional(),
48
31
  agents: z.array(agentProfileResourceRefSchema).optional(),
49
32
  commands: z.array(agentProfileResourceRefSchema).optional(),
50
- files: z.array(agentProfileFileMountSchema).optional(),
51
- instructions: z
52
- .union([z.string(), agentProfileResourceRefSchema])
53
- .optional(),
33
+ instructions: z.union([z.string(), agentProfileResourceRefSchema]).optional(),
54
34
  failOnError: z.boolean().optional(),
55
- })
56
- .optional();
57
- export const agentProfileHookCommandSchema = z
58
- .object({
35
+ });
36
+ export const agentProfileModelHintsSchema = z.object({
37
+ default: z.string().optional(),
38
+ small: z.string().optional(),
39
+ provider: z.string().optional(),
40
+ reasoningEffort: z.enum(['none', 'low', 'medium', 'high', 'xhigh', 'ultracode']).optional(),
41
+ metadata: z.record(z.string(), z.unknown()).optional(),
42
+ });
43
+ export const agentProfilePromptSchema = z.object({
44
+ systemPrompt: z.string().optional(),
45
+ instructions: z.array(z.string()).optional(),
46
+ });
47
+ export const agentSubagentProfileSchema = z.object({
48
+ description: z.string().optional(),
49
+ prompt: z.string().optional(),
50
+ model: z.string().optional(),
51
+ tools: z.record(z.string(), z.boolean()).optional(),
52
+ permissions: z.record(z.string(), agentProfilePermissionSchema).optional(),
53
+ maxSteps: z.number().optional(),
54
+ metadata: z.record(z.string(), z.unknown()).optional(),
55
+ });
56
+ export const agentProfileHookCommandSchema = z.object({
59
57
  command: z.string(),
60
58
  timeoutMs: z.number().positive().optional(),
61
59
  blocking: z.boolean().optional(),
62
60
  matcher: z.string().optional(),
63
61
  env: z.record(z.string(), z.string()).optional(),
64
- })
65
- .passthrough();
66
- export const agentProfileModeSchema = z
67
- .object({
62
+ });
63
+ export const agentProfileModeSchema = z.object({
68
64
  description: z.string().optional(),
69
65
  model: z.string().optional(),
70
66
  prompt: z.string().optional(),
71
67
  tools: z.record(z.string(), z.boolean()).optional(),
72
68
  permissions: z.record(z.string(), agentProfilePermissionSchema).optional(),
73
69
  metadata: z.record(z.string(), z.unknown()).optional(),
74
- })
75
- .passthrough();
70
+ });
71
+ export const agentProfileConfidentialSchema = z.object({
72
+ tee: z.string().optional(),
73
+ attestationNonce: z.string().optional(),
74
+ sealed: z.boolean().optional(),
75
+ attestationRefresh: z.boolean().optional(),
76
+ });
77
+ export const agentProfileMcpServerSchema = z.object({
78
+ transport: z.enum(["stdio", "sse", "http"]).optional(),
79
+ command: z.string().optional(),
80
+ args: z.array(z.string()).optional(),
81
+ env: z.record(z.string(), z.string()).optional(),
82
+ cwd: z.string().optional(),
83
+ url: z.string().optional(),
84
+ headers: z.record(z.string(), z.string()).optional(),
85
+ enabled: z.boolean().optional(),
86
+ metadata: z.record(z.string(), z.unknown()).optional(),
87
+ });
88
+ /**
89
+ * The complete provider-neutral agent profile schema — the runtime validator for
90
+ * the canonical {@link AgentProfile} TS contract. Kept structurally in lock-step
91
+ * with that interface by the compile-time guard at the bottom of this file.
92
+ */
93
+ export const agentProfileSchema = z.object({
94
+ name: z.string().optional(),
95
+ description: z.string().optional(),
96
+ version: z.string().optional(),
97
+ tags: z.array(z.string()).optional(),
98
+ prompt: agentProfilePromptSchema.optional(),
99
+ model: agentProfileModelHintsSchema.optional(),
100
+ permissions: z.record(z.string(), agentProfilePermissionSchema).optional(),
101
+ tools: z.record(z.string(), z.boolean()).optional(),
102
+ mcp: z.record(z.string(), agentProfileMcpServerSchema).optional(),
103
+ subagents: z.record(z.string(), agentSubagentProfileSchema).optional(),
104
+ resources: agentProfileResourcesSchema.optional(),
105
+ hooks: z.record(z.string(), z.array(agentProfileHookCommandSchema)).optional(),
106
+ modes: z.record(z.string(), agentProfileModeSchema).optional(),
107
+ confidential: agentProfileConfidentialSchema.optional(),
108
+ metadata: z.record(z.string(), z.unknown()).optional(),
109
+ extensions: z
110
+ .record(z.string(), z.union([z.record(z.string(), z.unknown()), z.undefined()]))
111
+ .optional(),
112
+ });
113
+ const _agentProfileSchemaMatchesInterface = true;
114
+ void _agentProfileSchemaMatchesInterface;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",