@tangle-network/agent-interface 2.15.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,6 +42,12 @@ The public `AgentInstanceRecord` contains a credential-free profile identity, no
42
42
 
43
43
  ## Durable runs, interactions, and context
44
44
 
45
+ `AgentTurnInput.profile` carries the exact `AgentProfile` for a turn through its canonical schema.
46
+ Keep mounted resources and behavior in this typed field, separate from bounded `providerOptions` metadata.
47
+ Providers must honor the profile or refuse it before dispatch; callers must not assume every provider supports per-turn profile changes.
48
+ Provider-specific payload and capability limits still apply.
49
+
50
+
45
51
  `AgentRunControlRef` identifies a retained run without depending on a live JavaScript object and may carry the provider's admission digest so reconstruction can reject changed-input reuse.
46
52
  `RuntimeEventEnvelope` adds stable run, event, sequence, cursor, and timestamp fields around the existing `StreamEvent` union, and its runtime schema validates every canonical event variant.
47
53
  The `child-task` event reports one update of a provider-native child task (a subagent, worker, or delegated task) with a stable `childId`, an optional `parentChildId`, a lifecycle status, start and update times, and the runner, model, usage, and terminal reason when the provider reports them.
@@ -220,6 +220,7 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
220
220
  extensions: z.ZodOptional<z.ZodType<Record<string, Record<string, unknown> | undefined>, unknown, z.core.$ZodTypeInternals<Record<string, Record<string, unknown> | undefined>, unknown>>>;
221
221
  }, z.core.$strict>;
222
222
  requestedProfileDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
223
+ authMode: z.ZodOptional<z.ZodLiteral<"oauth">>;
223
224
  initialPrompt: z.ZodOptional<z.ZodString>;
224
225
  cwd: z.ZodOptional<z.ZodString>;
225
226
  cols: z.ZodOptional<z.ZodNumber>;
@@ -23,6 +23,8 @@ export const AgentInteractiveSessionStartSchema = z.strictObject({
23
23
  run: AgentExactRunControlRefSchema,
24
24
  profile: agentProfileSchema,
25
25
  requestedProfileDigest: sha256DigestSchema,
26
+ // A provider-owned CLI login choice, never a credential or token.
27
+ authMode: z.literal("oauth").optional(),
26
28
  initialPrompt: boundedStringSchema.optional(),
27
29
  cwd: boundedStringSchema.min(1).optional(),
28
30
  cols: interactiveDimensionSchema.optional(),
@@ -36,6 +38,9 @@ export function agentInteractiveSessionRequestDigest(coordinates, input) {
36
38
  kind: "agent-interactive-session-start.v1",
37
39
  run: exactCoordinates,
38
40
  requestedProfileDigest: exactInput.requestedProfileDigest,
41
+ ...(exactInput.authMode === undefined
42
+ ? {}
43
+ : { authMode: exactInput.authMode }),
39
44
  ...(exactInput.initialPrompt === undefined
40
45
  ? {}
41
46
  : { initialPrompt: exactInput.initialPrompt }),
@@ -60,6 +65,10 @@ export function exactAgentInteractiveSessionStart(value) {
60
65
  if (parsed.profile.harness === undefined) {
61
66
  throw new Error("interactive agent sessions require AgentProfile.harness");
62
67
  }
68
+ if (parsed.authMode === "oauth" &&
69
+ parsed.profile.harness !== "claude-code") {
70
+ throw new Error("Claude Code OAuth mode requires the claude-code harness");
71
+ }
63
72
  const digest = canonicalAgentProfileDigest(parsed.profile);
64
73
  if (digest !== parsed.requestedProfileDigest) {
65
74
  throw new Error("interactive agent session requested profile digest does not match its profile");
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import type { AgentRuntimeAttachments } from "./runtime-attachments.js";
3
3
  export { AgentRuntimeAttachmentsSchema, type AgentRuntimeAttachments } from "./runtime-attachments.js";
4
4
  import type { Sha256Digest } from "./agent-candidate.js";
5
- import type { AgentProfileCapabilities, AgentProfileValidationResult } from "./agent-profile.js";
5
+ import type { AgentProfile, AgentProfileCapabilities, AgentProfileValidationResult } from "./agent-profile.js";
6
6
  import type { InputPart } from "./parts.js";
7
7
  import type { StreamEvent } from "./stream-events.js";
8
8
  import { type TokenUsage } from "./execution-types.js";
@@ -16,6 +16,8 @@ import type { AgentEnvironmentObservation } from "./environment-observation.js";
16
16
  import type { AgentInteractiveSession, AgentInteractiveSessionRef, AgentInteractiveSessionStart } from "./environment-interactive.js";
17
17
  import type { AgentTerminalSession, TerminalAttachRequest, TerminalAttachResult } from "./environment-terminal.js";
18
18
  export interface AgentTurnInput {
19
+ /** Exact behavior for this turn, separate from bounded provider metadata. */
20
+ profile?: AgentProfile;
19
21
  prompt?: string;
20
22
  parts?: InputPart[];
21
23
  sessionId?: string;
@@ -38,6 +40,201 @@ export interface AgentTurnInput {
38
40
  providerOptions?: Record<string, unknown>;
39
41
  }
40
42
  export declare const AgentTurnInputSchema: z.ZodObject<{
43
+ profile: z.ZodOptional<z.ZodObject<{
44
+ name: z.ZodOptional<z.ZodString>;
45
+ description: z.ZodOptional<z.ZodString>;
46
+ version: z.ZodOptional<z.ZodString>;
47
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ prompt: z.ZodOptional<z.ZodObject<{
49
+ systemPrompt: z.ZodOptional<z.ZodString>;
50
+ appendSystemPrompt: z.ZodOptional<z.ZodString>;
51
+ instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
+ }, z.core.$strict>>;
53
+ model: z.ZodOptional<z.ZodObject<{
54
+ default: z.ZodOptional<z.ZodString>;
55
+ small: z.ZodOptional<z.ZodString>;
56
+ provider: z.ZodOptional<z.ZodString>;
57
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
58
+ high: "high";
59
+ low: "low";
60
+ medium: "medium";
61
+ minimal: "minimal";
62
+ none: "none";
63
+ ultracode: "ultracode";
64
+ xhigh: "xhigh";
65
+ }>>;
66
+ maxVisibleOutputTokens: z.ZodOptional<z.ZodNumber>;
67
+ maxReasoningTokens: z.ZodOptional<z.ZodNumber>;
68
+ maxTotalOutputTokens: z.ZodOptional<z.ZodNumber>;
69
+ metadata: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
70
+ }, z.core.$strict>>;
71
+ harness: z.ZodOptional<z.ZodEnum<{
72
+ acp: "acp";
73
+ amp: "amp";
74
+ "claude-code": "claude-code";
75
+ "cli-base": "cli-base";
76
+ codex: "codex";
77
+ cursor: "cursor";
78
+ "factory-droids": "factory-droids";
79
+ forge: "forge";
80
+ gemini: "gemini";
81
+ hermes: "hermes";
82
+ "kimi-code": "kimi-code";
83
+ nanoclaw: "nanoclaw";
84
+ openclaw: "openclaw";
85
+ opencode: "opencode";
86
+ pi: "pi";
87
+ prime: "prime";
88
+ }>>;
89
+ permissions: z.ZodOptional<z.ZodType<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown, z.core.$ZodTypeInternals<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown>>>;
90
+ tools: z.ZodOptional<z.ZodType<Record<string, boolean>, unknown, z.core.$ZodTypeInternals<Record<string, boolean>, unknown>>>;
91
+ mcp: z.ZodOptional<z.ZodType<Record<string, import("./agent-profile.js").AgentProfileMcpServer>, unknown, z.core.$ZodTypeInternals<Record<string, import("./agent-profile.js").AgentProfileMcpServer>, unknown>>>;
92
+ connections: z.ZodOptional<z.ZodArray<z.ZodObject<{
93
+ connectionId: z.ZodString;
94
+ capabilities: z.ZodArray<z.ZodString>;
95
+ alias: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strict>>>;
97
+ subagents: z.ZodOptional<z.ZodType<Record<string, {
98
+ description?: string | undefined;
99
+ prompt?: string | undefined;
100
+ model?: string | undefined;
101
+ tools?: Record<string, boolean> | undefined;
102
+ permissions?: Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">> | undefined;
103
+ maxSteps?: number | undefined;
104
+ metadata?: Record<string, unknown> | undefined;
105
+ }>, unknown, z.core.$ZodTypeInternals<Record<string, {
106
+ description?: string | undefined;
107
+ prompt?: string | undefined;
108
+ model?: string | undefined;
109
+ tools?: Record<string, boolean> | undefined;
110
+ permissions?: Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">> | undefined;
111
+ maxSteps?: number | undefined;
112
+ metadata?: Record<string, unknown> | undefined;
113
+ }>, unknown>>>;
114
+ resources: z.ZodOptional<z.ZodObject<{
115
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
116
+ path: z.ZodString;
117
+ resource: z.ZodUnion<readonly [z.ZodObject<{
118
+ kind: z.ZodLiteral<"inline">;
119
+ name: z.ZodString;
120
+ content: z.ZodString;
121
+ }, z.core.$strict>, z.ZodObject<{
122
+ kind: z.ZodLiteral<"github">;
123
+ repository: z.ZodOptional<z.ZodString>;
124
+ path: z.ZodString;
125
+ ref: z.ZodOptional<z.ZodString>;
126
+ name: z.ZodOptional<z.ZodString>;
127
+ }, z.core.$strict>]>;
128
+ executable: z.ZodOptional<z.ZodBoolean>;
129
+ }, z.core.$strict>>>;
130
+ tools: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
131
+ kind: z.ZodLiteral<"inline">;
132
+ name: z.ZodString;
133
+ content: z.ZodString;
134
+ }, z.core.$strict>, z.ZodObject<{
135
+ kind: z.ZodLiteral<"github">;
136
+ repository: z.ZodOptional<z.ZodString>;
137
+ path: z.ZodString;
138
+ ref: z.ZodOptional<z.ZodString>;
139
+ name: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strict>]>>>;
141
+ skills: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
142
+ kind: z.ZodLiteral<"inline">;
143
+ name: z.ZodString;
144
+ content: z.ZodString;
145
+ }, z.core.$strict>, z.ZodObject<{
146
+ kind: z.ZodLiteral<"github">;
147
+ repository: z.ZodOptional<z.ZodString>;
148
+ path: z.ZodString;
149
+ ref: z.ZodOptional<z.ZodString>;
150
+ name: z.ZodOptional<z.ZodString>;
151
+ }, z.core.$strict>]>>>;
152
+ agents: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
153
+ kind: z.ZodLiteral<"inline">;
154
+ name: z.ZodString;
155
+ content: z.ZodString;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ kind: z.ZodLiteral<"github">;
158
+ repository: z.ZodOptional<z.ZodString>;
159
+ path: z.ZodString;
160
+ ref: z.ZodOptional<z.ZodString>;
161
+ name: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strict>]>>>;
163
+ commands: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
164
+ kind: z.ZodLiteral<"inline">;
165
+ name: z.ZodString;
166
+ content: z.ZodString;
167
+ }, z.core.$strict>, z.ZodObject<{
168
+ kind: z.ZodLiteral<"github">;
169
+ repository: z.ZodOptional<z.ZodString>;
170
+ path: z.ZodString;
171
+ ref: z.ZodOptional<z.ZodString>;
172
+ name: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strict>]>>>;
174
+ instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
175
+ kind: z.ZodLiteral<"inline">;
176
+ name: z.ZodString;
177
+ content: z.ZodString;
178
+ }, z.core.$strict>, z.ZodObject<{
179
+ kind: z.ZodLiteral<"github">;
180
+ repository: z.ZodOptional<z.ZodString>;
181
+ path: z.ZodString;
182
+ ref: z.ZodOptional<z.ZodString>;
183
+ name: z.ZodOptional<z.ZodString>;
184
+ }, z.core.$strict>]>]>>;
185
+ failOnError: z.ZodOptional<z.ZodBoolean>;
186
+ }, z.core.$strict>>;
187
+ hooks: z.ZodOptional<z.ZodType<Record<string, {
188
+ command: string;
189
+ timeoutMs?: number | undefined;
190
+ blocking?: boolean | undefined;
191
+ matcher?: string | undefined;
192
+ env?: Record<string, {
193
+ kind: "public";
194
+ value: string;
195
+ } | {
196
+ kind: "secret-ref";
197
+ key: string;
198
+ format?: "bearer" | "raw" | undefined;
199
+ }> | undefined;
200
+ }[]>, unknown, z.core.$ZodTypeInternals<Record<string, {
201
+ command: string;
202
+ timeoutMs?: number | undefined;
203
+ blocking?: boolean | undefined;
204
+ matcher?: string | undefined;
205
+ env?: Record<string, {
206
+ kind: "public";
207
+ value: string;
208
+ } | {
209
+ kind: "secret-ref";
210
+ key: string;
211
+ format?: "bearer" | "raw" | undefined;
212
+ }> | undefined;
213
+ }[]>, unknown>>>;
214
+ modes: z.ZodOptional<z.ZodType<Record<string, {
215
+ description?: string | undefined;
216
+ model?: string | undefined;
217
+ prompt?: string | undefined;
218
+ tools?: Record<string, boolean> | undefined;
219
+ permissions?: Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">> | undefined;
220
+ metadata?: Record<string, unknown> | undefined;
221
+ }>, unknown, z.core.$ZodTypeInternals<Record<string, {
222
+ description?: string | undefined;
223
+ model?: string | undefined;
224
+ prompt?: string | undefined;
225
+ tools?: Record<string, boolean> | undefined;
226
+ permissions?: Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">> | undefined;
227
+ metadata?: Record<string, unknown> | undefined;
228
+ }>, unknown>>>;
229
+ confidential: z.ZodOptional<z.ZodObject<{
230
+ tee: z.ZodOptional<z.ZodString>;
231
+ attestationNonce: z.ZodOptional<z.ZodString>;
232
+ sealed: z.ZodOptional<z.ZodBoolean>;
233
+ attestationRefresh: z.ZodOptional<z.ZodBoolean>;
234
+ }, z.core.$strict>>;
235
+ metadata: z.ZodOptional<z.ZodType<import("./agent-profile.js").AgentProfileMetadata, unknown, z.core.$ZodTypeInternals<import("./agent-profile.js").AgentProfileMetadata, unknown>>>;
236
+ extensions: z.ZodOptional<z.ZodType<Record<string, Record<string, unknown> | undefined>, unknown, z.core.$ZodTypeInternals<Record<string, Record<string, unknown> | undefined>, unknown>>>;
237
+ }, z.core.$strict>>;
41
238
  prompt: z.ZodOptional<z.ZodCustom<string, string>>;
42
239
  parts: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
43
240
  type: z.ZodLiteral<"text">;
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export { AgentRuntimeAttachmentsSchema } from "./runtime-attachments.js";
3
3
  import { canonicalCandidateDigest, canonicalCandidateJson, } from "./agent-candidate-schema-common.js";
4
+ import { agentProfileSchema } from "./profile-schema.js";
4
5
  import { TokenUsageSchema } from "./execution-types.js";
5
6
  import { InteractionCapabilitiesSchema, RequestedInteractionsSchema } from "./interaction.js";
6
7
  import { ContextTransferReceiptSchema, ContextTransferRequestSchema, NativeContextBoundaryProofSchema, NativeContextContinuationAcknowledgementSchema, NativeContextContinuationRequestSchema, nativeContextContinuationAcknowledgementMatches } from "./portable-context.js";
@@ -10,6 +11,7 @@ import { boundedEventContentJsonSchema, boundedEventContentRecordSchema, bounded
10
11
  import { InputPartSchema } from "./portable-context-shared.js";
11
12
  import { deepFreeze } from "./deep-freeze.js";
12
13
  export const AgentTurnInputSchema = z.strictObject({
14
+ profile: agentProfileSchema.optional(),
13
15
  // A prompt is what the agent is asked to do, so it is CONTENT: its size is set by the work,
14
16
  // not by the protocol. Held to the metadata bound it capped a manager's brief at 16,384
15
17
  // characters, which refused a director handing a checker a 27 KB patch to re-verify a measured
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "2.15.0",
3
+ "version": "2.17.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",