@tangle-network/agent-interface 0.4.0 → 0.5.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,268 @@
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
+ * Model selection hints for backends.
89
+ */
90
+ export interface AgentProfileModelHints {
91
+ /**
92
+ * Preferred default model (format depends on backend, commonly "provider/model").
93
+ */
94
+ default?: string;
95
+ /**
96
+ * Preferred small/cheap model for lightweight work.
97
+ */
98
+ small?: string;
99
+ /**
100
+ * Optional provider preference hint.
101
+ */
102
+ provider?: string;
103
+ /**
104
+ * Backend-agnostic model metadata/hints.
105
+ */
106
+ metadata?: Record<string, unknown>;
107
+ }
108
+ /**
109
+ * Prompt shaping for an agent.
110
+ */
111
+ export interface AgentProfilePrompt {
112
+ /**
113
+ * Full system prompt replacement, when supported.
114
+ */
115
+ systemPrompt?: string;
116
+ /**
117
+ * Additional instruction lines appended to the active prompt.
118
+ */
119
+ instructions?: string[];
120
+ }
121
+ /**
122
+ * Generic subagent definition.
123
+ */
124
+ export interface AgentSubagentProfile {
125
+ description?: string;
126
+ prompt?: string;
127
+ model?: string;
128
+ tools?: Record<string, boolean>;
129
+ permissions?: Record<string, AgentProfilePermission>;
130
+ maxSteps?: number;
131
+ metadata?: Record<string, unknown>;
132
+ }
133
+ export interface AgentProfileHookCommand {
134
+ command: string;
135
+ timeoutMs?: number;
136
+ blocking?: boolean;
137
+ matcher?: string;
138
+ env?: Record<string, string>;
139
+ }
140
+ export interface AgentProfileMode {
141
+ description?: string;
142
+ model?: string;
143
+ prompt?: string;
144
+ tools?: Record<string, boolean>;
145
+ permissions?: Record<string, AgentProfilePermission>;
146
+ metadata?: Record<string, unknown>;
147
+ }
148
+ /**
149
+ * Confidential-execution options for sandbox backends.
150
+ *
151
+ * The Tangle blueprint path translates this into TEE job parameters and fails
152
+ * closed when the requested TEE is unavailable. Callers should verify returned
153
+ * attestation evidence before treating a session as confidential.
154
+ */
155
+ export interface AgentProfileConfidential {
156
+ /**
157
+ * TEE variant requested from the operator.
158
+ */
159
+ tee?: "tdx" | "nitro" | "phala-dstack" | "sev-snp" | "any" | (string & {});
160
+ /**
161
+ * Optional hex-encoded 32-64 byte challenge for deploy-time report data.
162
+ */
163
+ attestationNonce?: string;
164
+ /**
165
+ * Require no persistence across session end when supported by the backend.
166
+ */
167
+ sealed?: boolean;
168
+ /**
169
+ * Ask the SDK/backend to create or require a fresh attestation challenge.
170
+ */
171
+ attestationRefresh?: boolean;
172
+ }
173
+ /**
174
+ * Generic MCP server configuration.
175
+ */
176
+ export interface AgentProfileMcpServer {
177
+ transport?: "stdio" | "sse" | "http";
178
+ command?: string;
179
+ args?: string[];
180
+ env?: Record<string, string>;
181
+ cwd?: string;
182
+ url?: string;
183
+ headers?: Record<string, string>;
184
+ enabled?: boolean;
185
+ metadata?: Record<string, unknown>;
186
+ }
187
+ /**
188
+ * Public provider-neutral agent profile contract.
189
+ */
190
+ export interface AgentProfile {
191
+ name?: string;
192
+ description?: string;
193
+ version?: string;
194
+ tags?: string[];
195
+ prompt?: AgentProfilePrompt;
196
+ model?: AgentProfileModelHints;
197
+ permissions?: Record<string, AgentProfilePermission>;
198
+ tools?: Record<string, boolean>;
199
+ mcp?: Record<string, AgentProfileMcpServer>;
200
+ subagents?: Record<string, AgentSubagentProfile>;
201
+ resources?: AgentProfileResources;
202
+ hooks?: Record<string, AgentProfileHookCommand[]>;
203
+ modes?: Record<string, AgentProfileMode>;
204
+ confidential?: AgentProfileConfidential;
205
+ metadata?: Record<string, unknown>;
206
+ /**
207
+ * Non-portable backend-specific extensions.
208
+ *
209
+ * Use this only for features that cannot be expressed generically.
210
+ * SDK consumers should treat extension keys as backend namespaces.
211
+ */
212
+ extensions?: Record<string, Record<string, unknown> | undefined>;
213
+ }
214
+ /**
215
+ * Helper for declaring typed profiles in application code.
216
+ */
217
+ export declare function defineAgentProfile<T extends AgentProfile>(profile: T): T;
218
+ /**
219
+ * Capabilities describing how a backend interprets AgentProfile.
220
+ */
221
+ export interface AgentProfileCapabilities {
222
+ namedProfiles: boolean;
223
+ systemPrompt: boolean;
224
+ instructions: boolean;
225
+ tools: boolean;
226
+ permissions: boolean;
227
+ mcp: boolean;
228
+ subagents: boolean;
229
+ resources: {
230
+ files: boolean;
231
+ instructions: boolean;
232
+ tools?: boolean;
233
+ skills?: boolean;
234
+ agents?: boolean;
235
+ commands?: boolean;
236
+ };
237
+ hooks?: boolean;
238
+ modes?: boolean;
239
+ runtimeUpdate: boolean;
240
+ validation: boolean;
241
+ /**
242
+ * Backend extension namespaces understood by this backend.
243
+ */
244
+ extensions?: string[];
245
+ }
246
+ /**
247
+ * Validation issue for a profile/backend pairing.
248
+ */
249
+ export interface AgentProfileValidationIssue {
250
+ level: "error" | "warning" | "info";
251
+ code: string;
252
+ message: string;
253
+ path?: string;
254
+ }
255
+ /**
256
+ * Validation output for a provider adapter.
257
+ */
258
+ export interface AgentProfileValidationResult {
259
+ ok: boolean;
260
+ issues: AgentProfileValidationIssue[];
261
+ normalizedProfile?: AgentProfile;
262
+ }
263
+ /**
264
+ * Merge two public AgentProfile values.
265
+ *
266
+ * Overlay fields win on conflicts. Array-like instruction sets are appended.
267
+ */
268
+ 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,41 @@ 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
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
120
+ }, z.core.$strip>;
121
+ export declare const agentProfilePromptSchema: z.ZodObject<{
122
+ systemPrompt: z.ZodOptional<z.ZodString>;
123
+ instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
124
+ }, z.core.$strip>;
125
+ export declare const agentSubagentProfileSchema: z.ZodObject<{
126
+ description: z.ZodOptional<z.ZodString>;
127
+ prompt: z.ZodOptional<z.ZodString>;
128
+ model: z.ZodOptional<z.ZodString>;
129
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
130
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
131
+ allow: "allow";
132
+ ask: "ask";
133
+ deny: "deny";
134
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
135
+ allow: "allow";
136
+ ask: "ask";
137
+ deny: "deny";
138
+ }>>]>>>;
139
+ maxSteps: z.ZodOptional<z.ZodNumber>;
140
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
141
+ }, z.core.$strip>;
203
142
  export declare const agentProfileHookCommandSchema: z.ZodObject<{
204
143
  command: z.ZodString;
205
144
  timeoutMs: z.ZodOptional<z.ZodNumber>;
206
145
  blocking: z.ZodOptional<z.ZodBoolean>;
207
146
  matcher: z.ZodOptional<z.ZodString>;
208
147
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
209
- }, z.core.$loose>;
148
+ }, z.core.$strip>;
210
149
  export declare const agentProfileModeSchema: z.ZodObject<{
211
150
  description: z.ZodOptional<z.ZodString>;
212
151
  model: z.ZodOptional<z.ZodString>;
@@ -214,12 +153,200 @@ export declare const agentProfileModeSchema: z.ZodObject<{
214
153
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
215
154
  permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
216
155
  allow: "allow";
217
- deny: "deny";
218
156
  ask: "ask";
157
+ deny: "deny";
219
158
  }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
220
159
  allow: "allow";
160
+ ask: "ask";
161
+ deny: "deny";
162
+ }>>]>>>;
163
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
164
+ }, z.core.$strip>;
165
+ export declare const agentProfileConfidentialSchema: z.ZodObject<{
166
+ tee: z.ZodOptional<z.ZodString>;
167
+ attestationNonce: z.ZodOptional<z.ZodString>;
168
+ sealed: z.ZodOptional<z.ZodBoolean>;
169
+ attestationRefresh: z.ZodOptional<z.ZodBoolean>;
170
+ }, z.core.$strip>;
171
+ export declare const agentProfileMcpServerSchema: z.ZodObject<{
172
+ transport: z.ZodOptional<z.ZodEnum<{
173
+ stdio: "stdio";
174
+ sse: "sse";
175
+ http: "http";
176
+ }>>;
177
+ command: z.ZodOptional<z.ZodString>;
178
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
179
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
180
+ cwd: z.ZodOptional<z.ZodString>;
181
+ url: z.ZodOptional<z.ZodString>;
182
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
183
+ enabled: z.ZodOptional<z.ZodBoolean>;
184
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
185
+ }, z.core.$strip>;
186
+ /**
187
+ * The complete provider-neutral agent profile schema — the runtime validator for
188
+ * the canonical {@link AgentProfile} TS contract. Kept structurally in lock-step
189
+ * with that interface by the compile-time guard at the bottom of this file.
190
+ */
191
+ export declare const agentProfileSchema: z.ZodObject<{
192
+ name: z.ZodOptional<z.ZodString>;
193
+ description: z.ZodOptional<z.ZodString>;
194
+ version: z.ZodOptional<z.ZodString>;
195
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
196
+ prompt: z.ZodOptional<z.ZodObject<{
197
+ systemPrompt: z.ZodOptional<z.ZodString>;
198
+ instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
199
+ }, z.core.$strip>>;
200
+ model: z.ZodOptional<z.ZodObject<{
201
+ default: z.ZodOptional<z.ZodString>;
202
+ small: z.ZodOptional<z.ZodString>;
203
+ provider: z.ZodOptional<z.ZodString>;
204
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
205
+ }, z.core.$strip>>;
206
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
207
+ allow: "allow";
208
+ ask: "ask";
221
209
  deny: "deny";
210
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
211
+ allow: "allow";
222
212
  ask: "ask";
213
+ deny: "deny";
223
214
  }>>]>>>;
215
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
216
+ mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
217
+ transport: z.ZodOptional<z.ZodEnum<{
218
+ stdio: "stdio";
219
+ sse: "sse";
220
+ http: "http";
221
+ }>>;
222
+ command: z.ZodOptional<z.ZodString>;
223
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
224
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
225
+ cwd: z.ZodOptional<z.ZodString>;
226
+ url: z.ZodOptional<z.ZodString>;
227
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
228
+ enabled: z.ZodOptional<z.ZodBoolean>;
229
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
230
+ }, z.core.$strip>>>;
231
+ subagents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
232
+ description: z.ZodOptional<z.ZodString>;
233
+ prompt: z.ZodOptional<z.ZodString>;
234
+ model: z.ZodOptional<z.ZodString>;
235
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
236
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
237
+ allow: "allow";
238
+ ask: "ask";
239
+ deny: "deny";
240
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
241
+ allow: "allow";
242
+ ask: "ask";
243
+ deny: "deny";
244
+ }>>]>>>;
245
+ maxSteps: z.ZodOptional<z.ZodNumber>;
246
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
247
+ }, z.core.$strip>>>;
248
+ resources: z.ZodOptional<z.ZodObject<{
249
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
250
+ path: z.ZodString;
251
+ resource: z.ZodUnion<readonly [z.ZodObject<{
252
+ kind: z.ZodLiteral<"inline">;
253
+ name: z.ZodString;
254
+ content: z.ZodString;
255
+ }, z.core.$strip>, z.ZodObject<{
256
+ kind: z.ZodLiteral<"github">;
257
+ repository: z.ZodOptional<z.ZodString>;
258
+ path: z.ZodString;
259
+ ref: z.ZodOptional<z.ZodString>;
260
+ name: z.ZodOptional<z.ZodString>;
261
+ }, z.core.$strip>]>;
262
+ executable: z.ZodOptional<z.ZodBoolean>;
263
+ }, z.core.$strip>>>;
264
+ tools: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
265
+ kind: z.ZodLiteral<"inline">;
266
+ name: z.ZodString;
267
+ content: z.ZodString;
268
+ }, z.core.$strip>, z.ZodObject<{
269
+ kind: z.ZodLiteral<"github">;
270
+ repository: z.ZodOptional<z.ZodString>;
271
+ path: z.ZodString;
272
+ ref: z.ZodOptional<z.ZodString>;
273
+ name: z.ZodOptional<z.ZodString>;
274
+ }, z.core.$strip>]>>>;
275
+ skills: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
276
+ kind: z.ZodLiteral<"inline">;
277
+ name: z.ZodString;
278
+ content: z.ZodString;
279
+ }, z.core.$strip>, z.ZodObject<{
280
+ kind: z.ZodLiteral<"github">;
281
+ repository: z.ZodOptional<z.ZodString>;
282
+ path: z.ZodString;
283
+ ref: z.ZodOptional<z.ZodString>;
284
+ name: z.ZodOptional<z.ZodString>;
285
+ }, z.core.$strip>]>>>;
286
+ agents: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
287
+ kind: z.ZodLiteral<"inline">;
288
+ name: z.ZodString;
289
+ content: z.ZodString;
290
+ }, z.core.$strip>, z.ZodObject<{
291
+ kind: z.ZodLiteral<"github">;
292
+ repository: z.ZodOptional<z.ZodString>;
293
+ path: z.ZodString;
294
+ ref: z.ZodOptional<z.ZodString>;
295
+ name: z.ZodOptional<z.ZodString>;
296
+ }, z.core.$strip>]>>>;
297
+ commands: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
298
+ kind: z.ZodLiteral<"inline">;
299
+ name: z.ZodString;
300
+ content: z.ZodString;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ kind: z.ZodLiteral<"github">;
303
+ repository: z.ZodOptional<z.ZodString>;
304
+ path: z.ZodString;
305
+ ref: z.ZodOptional<z.ZodString>;
306
+ name: z.ZodOptional<z.ZodString>;
307
+ }, z.core.$strip>]>>>;
308
+ instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
309
+ kind: z.ZodLiteral<"inline">;
310
+ name: z.ZodString;
311
+ content: z.ZodString;
312
+ }, z.core.$strip>, z.ZodObject<{
313
+ kind: z.ZodLiteral<"github">;
314
+ repository: z.ZodOptional<z.ZodString>;
315
+ path: z.ZodString;
316
+ ref: z.ZodOptional<z.ZodString>;
317
+ name: z.ZodOptional<z.ZodString>;
318
+ }, z.core.$strip>]>]>>;
319
+ failOnError: z.ZodOptional<z.ZodBoolean>;
320
+ }, z.core.$strip>>;
321
+ hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
322
+ command: z.ZodString;
323
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
324
+ blocking: z.ZodOptional<z.ZodBoolean>;
325
+ matcher: z.ZodOptional<z.ZodString>;
326
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
327
+ }, z.core.$strip>>>>;
328
+ modes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
329
+ description: z.ZodOptional<z.ZodString>;
330
+ model: z.ZodOptional<z.ZodString>;
331
+ prompt: z.ZodOptional<z.ZodString>;
332
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
333
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
334
+ allow: "allow";
335
+ ask: "ask";
336
+ deny: "deny";
337
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
338
+ allow: "allow";
339
+ ask: "ask";
340
+ deny: "deny";
341
+ }>>]>>>;
342
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
343
+ }, z.core.$strip>>>;
344
+ confidential: z.ZodOptional<z.ZodObject<{
345
+ tee: z.ZodOptional<z.ZodString>;
346
+ attestationNonce: z.ZodOptional<z.ZodString>;
347
+ sealed: z.ZodOptional<z.ZodBoolean>;
348
+ attestationRefresh: z.ZodOptional<z.ZodBoolean>;
349
+ }, z.core.$strip>>;
224
350
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
225
- }, z.core.$loose>;
351
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodUndefined]>>>;
352
+ }, 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,90 @@ 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
+ metadata: z.record(z.string(), z.unknown()).optional(),
41
+ });
42
+ export const agentProfilePromptSchema = z.object({
43
+ systemPrompt: z.string().optional(),
44
+ instructions: z.array(z.string()).optional(),
45
+ });
46
+ export const agentSubagentProfileSchema = z.object({
47
+ description: z.string().optional(),
48
+ prompt: z.string().optional(),
49
+ model: z.string().optional(),
50
+ tools: z.record(z.string(), z.boolean()).optional(),
51
+ permissions: z.record(z.string(), agentProfilePermissionSchema).optional(),
52
+ maxSteps: z.number().optional(),
53
+ metadata: z.record(z.string(), z.unknown()).optional(),
54
+ });
55
+ export const agentProfileHookCommandSchema = z.object({
59
56
  command: z.string(),
60
57
  timeoutMs: z.number().positive().optional(),
61
58
  blocking: z.boolean().optional(),
62
59
  matcher: z.string().optional(),
63
60
  env: z.record(z.string(), z.string()).optional(),
64
- })
65
- .passthrough();
66
- export const agentProfileModeSchema = z
67
- .object({
61
+ });
62
+ export const agentProfileModeSchema = z.object({
68
63
  description: z.string().optional(),
69
64
  model: z.string().optional(),
70
65
  prompt: z.string().optional(),
71
66
  tools: z.record(z.string(), z.boolean()).optional(),
72
67
  permissions: z.record(z.string(), agentProfilePermissionSchema).optional(),
73
68
  metadata: z.record(z.string(), z.unknown()).optional(),
74
- })
75
- .passthrough();
69
+ });
70
+ export const agentProfileConfidentialSchema = z.object({
71
+ tee: z.string().optional(),
72
+ attestationNonce: z.string().optional(),
73
+ sealed: z.boolean().optional(),
74
+ attestationRefresh: z.boolean().optional(),
75
+ });
76
+ export const agentProfileMcpServerSchema = z.object({
77
+ transport: z.enum(["stdio", "sse", "http"]).optional(),
78
+ command: z.string().optional(),
79
+ args: z.array(z.string()).optional(),
80
+ env: z.record(z.string(), z.string()).optional(),
81
+ cwd: z.string().optional(),
82
+ url: z.string().optional(),
83
+ headers: z.record(z.string(), z.string()).optional(),
84
+ enabled: z.boolean().optional(),
85
+ metadata: z.record(z.string(), z.unknown()).optional(),
86
+ });
87
+ /**
88
+ * The complete provider-neutral agent profile schema — the runtime validator for
89
+ * the canonical {@link AgentProfile} TS contract. Kept structurally in lock-step
90
+ * with that interface by the compile-time guard at the bottom of this file.
91
+ */
92
+ export const agentProfileSchema = z.object({
93
+ name: z.string().optional(),
94
+ description: z.string().optional(),
95
+ version: z.string().optional(),
96
+ tags: z.array(z.string()).optional(),
97
+ prompt: agentProfilePromptSchema.optional(),
98
+ model: agentProfileModelHintsSchema.optional(),
99
+ permissions: z.record(z.string(), agentProfilePermissionSchema).optional(),
100
+ tools: z.record(z.string(), z.boolean()).optional(),
101
+ mcp: z.record(z.string(), agentProfileMcpServerSchema).optional(),
102
+ subagents: z.record(z.string(), agentSubagentProfileSchema).optional(),
103
+ resources: agentProfileResourcesSchema.optional(),
104
+ hooks: z.record(z.string(), z.array(agentProfileHookCommandSchema)).optional(),
105
+ modes: z.record(z.string(), agentProfileModeSchema).optional(),
106
+ confidential: agentProfileConfidentialSchema.optional(),
107
+ metadata: z.record(z.string(), z.unknown()).optional(),
108
+ extensions: z
109
+ .record(z.string(), z.union([z.record(z.string(), z.unknown()), z.undefined()]))
110
+ .optional(),
111
+ });
112
+ const _agentProfileSchemaMatchesInterface = true;
113
+ 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.5.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",