From 65a2f65f5cb6aa2a7e6b612907cf3b6318a4ab9f Mon Sep 17 00:00:00 2001 From: Heer Ambavi Date: Fri, 18 Sep 2026 17:12:02 +0530 Subject: [PATCH 1/3] add approval policy schema --- .../pre/user-tool-approval-policy-event.md | 6 +++ .../src/agent-session/schemas/events.ts | 2 + .../src/agent-session/schemas/sendEvent.ts | 25 ++++++---- .../trueforge-core/src/core/events/schema.ts | 48 +++++++++++++++++++ packages/trueforge-core/src/core/index.ts | 4 ++ packages/trueforge/src/schemas/events.ts | 2 + 6 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 .changeset/pre/user-tool-approval-policy-event.md diff --git a/.changeset/pre/user-tool-approval-policy-event.md b/.changeset/pre/user-tool-approval-policy-event.md new file mode 100644 index 000000000..9a03d11b2 --- /dev/null +++ b/.changeset/pre/user-tool-approval-policy-event.md @@ -0,0 +1,6 @@ +--- +"@truefoundry/trueforge-core": patch +"@truefoundry/trueforge": patch +--- + +Add `user.tool_approval_policy` event schema (`allow_session`, optional expiry) to send-event items and turn stream / session event unions. Per-call allow remains `user.tool_approval`. diff --git a/packages/trueforge-core/src/agent-session/schemas/events.ts b/packages/trueforge-core/src/agent-session/schemas/events.ts index 370f209c2..6aaa343d4 100644 --- a/packages/trueforge-core/src/agent-session/schemas/events.ts +++ b/packages/trueforge-core/src/agent-session/schemas/events.ts @@ -18,6 +18,7 @@ import { ToolApprovalRequiredEventSchema, ToolResponseEventSchema, ToolResponseRequiredEventSchema, + UserToolApprovalPolicyEventSchema, } from '../../core/events/schema'; import { TurnInputItemSchema, @@ -111,6 +112,7 @@ export const SessionEventSchema = z SandboxCreatedEventSchema, ToolApprovalRequiredEventSchema, ToolResponseRequiredEventSchema, + UserToolApprovalPolicyEventSchema, ]) .openapi('SessionEvent'); diff --git a/packages/trueforge-core/src/agent-session/schemas/sendEvent.ts b/packages/trueforge-core/src/agent-session/schemas/sendEvent.ts index f25a46587..b1f9107ec 100644 --- a/packages/trueforge-core/src/agent-session/schemas/sendEvent.ts +++ b/packages/trueforge-core/src/agent-session/schemas/sendEvent.ts @@ -1,17 +1,26 @@ /** - * Inbound send-event payloads for tip HITL (client → harness), distinct from the - * stream log ({@link PersistedTurnEvent} / session_event). + * Inbound send-event payloads (client → harness), distinct from the stream log + * ({@link PersistedTurnEvent} / session_event). * - * Public send is session-scoped (`POST …/sessions/{id}/events`) with required - * body `turn_id` (one batch → one tip) plus `SessionInboundEventItem`s; rows stamp that - * tip id. v1 union is tip-only; approval policies may relax `turn_id` later. + * Public send is session-scoped (`POST …/sessions/{id}/events`) with body + * `turn_id` + items. Tip HITL uses approval/tool_response; sticky policies use + * `user.tool_approval_policy` (session `allow_session`, optional expiry; may later + * relax tip binding). Per-call allow/deny stays on `user.tool_approval`. * `user.message` stays on createTurn / steer. */ import { z } from '@hono/zod-openapi'; -import { UserToolApprovalMessageSchema, UserToolResponseMessageSchema } from '../../core/events/schema'; +import { + UserToolApprovalMessageSchema, + UserToolApprovalPolicyMessageSchema, + UserToolResponseMessageSchema, +} from '../../core/events/schema'; export const SessionInboundEventItemSchema = z - .discriminatedUnion('type', [UserToolApprovalMessageSchema, UserToolResponseMessageSchema]) - .openapi('SessionInboundEventItem'); + .discriminatedUnion('type', [ + UserToolApprovalMessageSchema, + UserToolResponseMessageSchema, + UserToolApprovalPolicyMessageSchema, + ]) + .openapi('SendTurnEventItem'); export type SessionInboundEventItem = z.infer; diff --git a/packages/trueforge-core/src/core/events/schema.ts b/packages/trueforge-core/src/core/events/schema.ts index bdced8eda..90cccdf67 100644 --- a/packages/trueforge-core/src/core/events/schema.ts +++ b/packages/trueforge-core/src/core/events/schema.ts @@ -40,6 +40,7 @@ export const EventType = { TOOL_RESPONSE_REQUIRED: 'tool.response_required', USER_TOOL_APPROVAL: 'user.tool_approval', USER_TOOL_RESPONSE: 'user.tool_response', + USER_TOOL_APPROVAL_POLICY: 'user.tool_approval_policy', USER_MESSAGE: 'user.message', } as const; @@ -96,6 +97,49 @@ export const UserToolResponseMessageSchema = z }) .openapi('UserToolResponseEvent'); +export const ToolApprovalPolicyAllowSessionSchema = z + .object({ + status: z.literal('allow_session').describe('Allow matching tool calls for the rest of this session.'), + expire_at_timestamp_seconds: z + .number() + .int() + .positive() + .optional() + .describe('Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session.'), + }) + .openapi('ToolApprovalPolicyAllowSession'); + +/** Sticky session allow. Per-call allow/deny stays on {@link UserToolApprovalMessageSchema}. */ +export const ToolApprovalPolicyActionSchema = ToolApprovalPolicyAllowSessionSchema.openapi('ToolApprovalPolicyAction'); + +export const ToolApprovalPolicyItemSchema = z + .object({ + server: z.string().min(1, 'server is required').describe('MCP server name the tool belongs to.'), + tool_name: z.string().min(1, 'tool_name is required').describe('Tool name this policy applies to.'), + action: ToolApprovalPolicyActionSchema, + }) + .openapi('ToolApprovalPolicyItem'); + +/** + * Client inbound sticky approval policy (session-scoped by default). + * Distinct from per-call {@link UserToolApprovalMessageSchema} (`allow` / `deny` on a `tool_call_id`). + */ +export const UserToolApprovalPolicyMessageSchema = z + .object({ + type: z + .literal(EventType.USER_TOOL_APPROVAL_POLICY) + .describe('Sticky allow-session policy for matching tools (optional expiry).'), + thread_id: z.string().nullable().describe('Null when session-scoped; set when delivered against a tip thread.'), + policies: z.array(ToolApprovalPolicyItemSchema).min(1).describe('One or more (server, tool_name) policy entries.'), + }) + .openapi('UserToolApprovalPolicyEvent'); + +/** Durable / SSE form of {@link UserToolApprovalPolicyMessageSchema} with mintable identity. */ +export const UserToolApprovalPolicyEventSchema = UserToolApprovalPolicyMessageSchema.extend({ + id: EventIdSchema, + created_at: z.string().describe('ISO 8601 event timestamp.'), +}).openapi('UserToolApprovalPolicyStreamEvent'); + export const TextContentPartSchema = z .object({ type: z.literal('text').describe('Text content part.'), @@ -373,6 +417,10 @@ export type AgentInfo = z.infer; export type ApprovalDecision = z.infer; export type UserToolApprovalMessage = z.infer; export type UserToolResponseMessage = z.infer; +export type ToolApprovalPolicyAction = z.infer; +export type ToolApprovalPolicyItem = z.infer; +export type UserToolApprovalPolicyMessage = z.infer; +export type UserToolApprovalPolicyEvent = z.infer; export type AgentApprovalDecisionMessage = z.infer; export type InputTokensBreakdown = z.infer; export type ModelMessageUsage = z.infer; diff --git a/packages/trueforge-core/src/core/index.ts b/packages/trueforge-core/src/core/index.ts index 76538942f..622033641 100644 --- a/packages/trueforge-core/src/core/index.ts +++ b/packages/trueforge-core/src/core/index.ts @@ -114,6 +114,8 @@ export { ToolResponseEventSchema, ToolResponseRequiredEventSchema, UserToolApprovalMessageSchema, + UserToolApprovalPolicyEventSchema, + UserToolApprovalPolicyMessageSchema, UserToolResponseMessageSchema, newEventId, } from './events/schema'; @@ -124,6 +126,8 @@ export type { MCPServerInitInfo, ThreadDoneEvent, ThreadOverwriteContextEvent, + UserToolApprovalPolicyEvent, + UserToolApprovalPolicyMessage, } from './events/schema'; export { CompletionUsageSchema } from './llm/LLMTypes'; export type { CompletionUsage } from './llm/LLMTypes'; diff --git a/packages/trueforge/src/schemas/events.ts b/packages/trueforge/src/schemas/events.ts index 4b702a6e1..a4aa9c1df 100644 --- a/packages/trueforge/src/schemas/events.ts +++ b/packages/trueforge/src/schemas/events.ts @@ -22,6 +22,7 @@ import { ToolApprovalRequiredEventSchema, ToolResponseEventSchema, ToolResponseRequiredEventSchema, + UserToolApprovalPolicyEventSchema, } from '@truefoundry/trueforge-core/core'; import { EVENTS_PAGE_LIMIT } from './common'; @@ -41,6 +42,7 @@ export const TurnStreamingEventSchema = z SandboxCreatedEventSchema, ToolApprovalRequiredEventSchema, ToolResponseRequiredEventSchema, + UserToolApprovalPolicyEventSchema, TurnCreatedEventSchema, TurnUpdateEventSchema, TurnDoneEventSchema, From 75db2c17d2579a25bf1feea80ae9a50e04abe4bd Mon Sep 17 00:00:00 2001 From: "trueforge-dev-bot[bot]" Date: Fri, 18 Sep 2026 09:43:26 +0000 Subject: [PATCH 2/3] Regenerate OpenAPI document and SDKs --- ...60918094326-regenerate-sdk-from-openapi.md | 5 + .github/fern/openapi/openapi.json | 111 +++++++++++++++++- docs/openapi.json | 111 +++++++++++++++++- .../src/api/types/SessionEvent.ts | 3 +- .../src/api/types/ToolApprovalPolicyAction.ts | 8 ++ .../src/api/types/ToolApprovalPolicyItem.ts | 11 ++ .../src/api/types/TurnStreamingEvent.ts | 3 +- .../api/types/UserToolApprovalPolicyEvent.ts | 12 ++ .../UserToolApprovalPolicyStreamEvent.ts | 10 ++ packages/trueforge-sdk/src/api/types/index.ts | 4 + .../src/serialization/types/SessionEvent.ts | 5 +- .../types/ToolApprovalPolicyAction.ts | 23 ++++ .../types/ToolApprovalPolicyItem.ts | 23 ++++ .../serialization/types/TurnStreamingEvent.ts | 5 +- .../types/UserToolApprovalPolicyEvent.ts | 23 ++++ .../UserToolApprovalPolicyStreamEvent.ts | 23 ++++ .../src/serialization/types/index.ts | 4 + .../src/trueforge_sdk/__init__.py | 12 ++ .../src/trueforge_sdk/types/__init__.py | 12 ++ .../src/trueforge_sdk/types/session_event.py | 2 + .../types/tool_approval_policy_action.py | 27 +++++ .../types/tool_approval_policy_item.py | 29 +++++ .../types/turn_streaming_event.py | 2 + .../types/user_tool_approval_policy_event.py | 33 ++++++ .../user_tool_approval_policy_stream_event.py | 27 +++++ 25 files changed, 520 insertions(+), 8 deletions(-) create mode 100644 .changeset/20260918094326-regenerate-sdk-from-openapi.md create mode 100644 packages/trueforge-sdk/src/api/types/ToolApprovalPolicyAction.ts create mode 100644 packages/trueforge-sdk/src/api/types/ToolApprovalPolicyItem.ts create mode 100644 packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyEvent.ts create mode 100644 packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyStreamEvent.ts create mode 100644 packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyAction.ts create mode 100644 packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyItem.ts create mode 100644 packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyEvent.ts create mode 100644 packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyStreamEvent.ts create mode 100644 python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_action.py create mode 100644 python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_item.py create mode 100644 python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_event.py create mode 100644 python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_stream_event.py diff --git a/.changeset/20260918094326-regenerate-sdk-from-openapi.md b/.changeset/20260918094326-regenerate-sdk-from-openapi.md new file mode 100644 index 000000000..efd8ff00f --- /dev/null +++ b/.changeset/20260918094326-regenerate-sdk-from-openapi.md @@ -0,0 +1,5 @@ +--- +"@truefoundry/trueforge-sdk": patch +--- + +Regenerate SDK from updated OpenAPI spec. diff --git a/.github/fern/openapi/openapi.json b/.github/fern/openapi/openapi.json index 7a06b406e..a70b1f421 100644 --- a/.github/fern/openapi/openapi.json +++ b/.github/fern/openapi/openapi.json @@ -4036,7 +4036,8 @@ "tool.response_required": "#/components/schemas/ToolResponseRequiredEvent", "turn.created": "#/components/schemas/TurnCreatedEvent", "turn.done": "#/components/schemas/TurnDoneEvent", - "turn.update": "#/components/schemas/TurnUpdateEvent" + "turn.update": "#/components/schemas/TurnUpdateEvent", + "user.tool_approval_policy": "#/components/schemas/UserToolApprovalPolicyStreamEvent" }, "propertyName": "type" }, @@ -4076,6 +4077,9 @@ }, { "$ref": "#/components/schemas/ToolResponseRequiredEvent" + }, + { + "$ref": "#/components/schemas/UserToolApprovalPolicyStreamEvent" } ] }, @@ -4706,6 +4710,49 @@ ], "type": "object" }, + "ToolApprovalPolicyAction": { + "properties": { + "expire_at_timestamp_seconds": { + "description": "Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session.", + "exclusiveMinimum": 0, + "type": "integer" + }, + "status": { + "description": "Allow matching tool calls for the rest of this session.", + "enum": [ + "allow_session" + ], + "type": "string" + } + }, + "required": [ + "status" + ], + "type": "object" + }, + "ToolApprovalPolicyItem": { + "properties": { + "action": { + "$ref": "#/components/schemas/ToolApprovalPolicyAction" + }, + "server": { + "description": "MCP server name the tool belongs to.", + "minLength": 1, + "type": "string" + }, + "tool_name": { + "description": "Tool name this policy applies to.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "server", + "tool_name", + "action" + ], + "type": "object" + }, "ToolApprovalRequiredEvent": { "properties": { "created_at": { @@ -5395,7 +5442,8 @@ "tool.response_required": "#/components/schemas/ToolResponseRequiredEvent", "turn.created": "#/components/schemas/TurnCreatedEvent", "turn.done": "#/components/schemas/TurnDoneEvent", - "turn.update": "#/components/schemas/TurnUpdateEvent" + "turn.update": "#/components/schemas/TurnUpdateEvent", + "user.tool_approval_policy": "#/components/schemas/UserToolApprovalPolicyStreamEvent" }, "propertyName": "type" }, @@ -5430,6 +5478,9 @@ { "$ref": "#/components/schemas/ToolResponseRequiredEvent" }, + { + "$ref": "#/components/schemas/UserToolApprovalPolicyStreamEvent" + }, { "$ref": "#/components/schemas/TurnCreatedEvent" }, @@ -5711,6 +5762,62 @@ ], "type": "object" }, + "UserToolApprovalPolicyEvent": { + "properties": { + "policies": { + "description": "One or more (server, tool_name) policy entries.", + "items": { + "$ref": "#/components/schemas/ToolApprovalPolicyItem" + }, + "minItems": 1, + "type": "array" + }, + "thread_id": { + "description": "Null when session-scoped; set when delivered against a tip thread.", + "type": [ + "string", + "null" + ] + }, + "type": { + "description": "Sticky allow-session policy for matching tools (optional expiry).", + "enum": [ + "user.tool_approval_policy" + ], + "type": "string" + } + }, + "required": [ + "type", + "thread_id", + "policies" + ], + "type": "object" + }, + "UserToolApprovalPolicyStreamEvent": { + "allOf": [ + { + "$ref": "#/components/schemas/UserToolApprovalPolicyEvent" + }, + { + "properties": { + "created_at": { + "description": "ISO 8601 event timestamp.", + "type": "string" + }, + "id": { + "description": "Unique identifier for the event (monotonic ULID).", + "type": "string" + } + }, + "required": [ + "id", + "created_at" + ], + "type": "object" + } + ] + }, "UserToolResponseEvent": { "properties": { "content": { diff --git a/docs/openapi.json b/docs/openapi.json index 7a06b406e..a70b1f421 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -4036,7 +4036,8 @@ "tool.response_required": "#/components/schemas/ToolResponseRequiredEvent", "turn.created": "#/components/schemas/TurnCreatedEvent", "turn.done": "#/components/schemas/TurnDoneEvent", - "turn.update": "#/components/schemas/TurnUpdateEvent" + "turn.update": "#/components/schemas/TurnUpdateEvent", + "user.tool_approval_policy": "#/components/schemas/UserToolApprovalPolicyStreamEvent" }, "propertyName": "type" }, @@ -4076,6 +4077,9 @@ }, { "$ref": "#/components/schemas/ToolResponseRequiredEvent" + }, + { + "$ref": "#/components/schemas/UserToolApprovalPolicyStreamEvent" } ] }, @@ -4706,6 +4710,49 @@ ], "type": "object" }, + "ToolApprovalPolicyAction": { + "properties": { + "expire_at_timestamp_seconds": { + "description": "Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session.", + "exclusiveMinimum": 0, + "type": "integer" + }, + "status": { + "description": "Allow matching tool calls for the rest of this session.", + "enum": [ + "allow_session" + ], + "type": "string" + } + }, + "required": [ + "status" + ], + "type": "object" + }, + "ToolApprovalPolicyItem": { + "properties": { + "action": { + "$ref": "#/components/schemas/ToolApprovalPolicyAction" + }, + "server": { + "description": "MCP server name the tool belongs to.", + "minLength": 1, + "type": "string" + }, + "tool_name": { + "description": "Tool name this policy applies to.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "server", + "tool_name", + "action" + ], + "type": "object" + }, "ToolApprovalRequiredEvent": { "properties": { "created_at": { @@ -5395,7 +5442,8 @@ "tool.response_required": "#/components/schemas/ToolResponseRequiredEvent", "turn.created": "#/components/schemas/TurnCreatedEvent", "turn.done": "#/components/schemas/TurnDoneEvent", - "turn.update": "#/components/schemas/TurnUpdateEvent" + "turn.update": "#/components/schemas/TurnUpdateEvent", + "user.tool_approval_policy": "#/components/schemas/UserToolApprovalPolicyStreamEvent" }, "propertyName": "type" }, @@ -5430,6 +5478,9 @@ { "$ref": "#/components/schemas/ToolResponseRequiredEvent" }, + { + "$ref": "#/components/schemas/UserToolApprovalPolicyStreamEvent" + }, { "$ref": "#/components/schemas/TurnCreatedEvent" }, @@ -5711,6 +5762,62 @@ ], "type": "object" }, + "UserToolApprovalPolicyEvent": { + "properties": { + "policies": { + "description": "One or more (server, tool_name) policy entries.", + "items": { + "$ref": "#/components/schemas/ToolApprovalPolicyItem" + }, + "minItems": 1, + "type": "array" + }, + "thread_id": { + "description": "Null when session-scoped; set when delivered against a tip thread.", + "type": [ + "string", + "null" + ] + }, + "type": { + "description": "Sticky allow-session policy for matching tools (optional expiry).", + "enum": [ + "user.tool_approval_policy" + ], + "type": "string" + } + }, + "required": [ + "type", + "thread_id", + "policies" + ], + "type": "object" + }, + "UserToolApprovalPolicyStreamEvent": { + "allOf": [ + { + "$ref": "#/components/schemas/UserToolApprovalPolicyEvent" + }, + { + "properties": { + "created_at": { + "description": "ISO 8601 event timestamp.", + "type": "string" + }, + "id": { + "description": "Unique identifier for the event (monotonic ULID).", + "type": "string" + } + }, + "required": [ + "id", + "created_at" + ], + "type": "object" + } + ] + }, "UserToolResponseEvent": { "properties": { "content": { diff --git a/packages/trueforge-sdk/src/api/types/SessionEvent.ts b/packages/trueforge-sdk/src/api/types/SessionEvent.ts index 8d305b279..35a085d1b 100644 --- a/packages/trueforge-sdk/src/api/types/SessionEvent.ts +++ b/packages/trueforge-sdk/src/api/types/SessionEvent.ts @@ -14,4 +14,5 @@ export type SessionEvent = | TrueForge.ToolResponseRequiredEvent | TrueForge.TurnCreatedEvent | TrueForge.TurnDoneEvent - | TrueForge.TurnUpdateEvent; + | TrueForge.TurnUpdateEvent + | TrueForge.UserToolApprovalPolicyStreamEvent; diff --git a/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyAction.ts b/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyAction.ts new file mode 100644 index 000000000..25f581e4e --- /dev/null +++ b/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyAction.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface ToolApprovalPolicyAction { + /** Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session. */ + expireAtTimestampSeconds?: number; + /** Allow matching tool calls for the rest of this session. */ + status: "allow_session"; +} diff --git a/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyItem.ts b/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyItem.ts new file mode 100644 index 000000000..722ea5c83 --- /dev/null +++ b/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyItem.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as TrueForge from "../index.js"; + +export interface ToolApprovalPolicyItem { + action: TrueForge.ToolApprovalPolicyAction; + /** MCP server name the tool belongs to. */ + server: string; + /** Tool name this policy applies to. */ + toolName: string; +} diff --git a/packages/trueforge-sdk/src/api/types/TurnStreamingEvent.ts b/packages/trueforge-sdk/src/api/types/TurnStreamingEvent.ts index 61f6515ac..3dd245bc8 100644 --- a/packages/trueforge-sdk/src/api/types/TurnStreamingEvent.ts +++ b/packages/trueforge-sdk/src/api/types/TurnStreamingEvent.ts @@ -15,4 +15,5 @@ export type TurnStreamingEvent = | TrueForge.ToolResponseRequiredEvent | TrueForge.TurnCreatedEvent | TrueForge.TurnDoneEvent - | TrueForge.TurnUpdateEvent; + | TrueForge.TurnUpdateEvent + | TrueForge.UserToolApprovalPolicyStreamEvent; diff --git a/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyEvent.ts b/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyEvent.ts new file mode 100644 index 000000000..9991d6539 --- /dev/null +++ b/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyEvent.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as TrueForge from "../index.js"; + +export interface UserToolApprovalPolicyEvent { + /** One or more (server, tool_name) policy entries. */ + policies: TrueForge.ToolApprovalPolicyItem[]; + /** Null when session-scoped; set when delivered against a tip thread. */ + threadId: string | null; + /** Sticky allow-session policy for matching tools (optional expiry). */ + type: "user.tool_approval_policy"; +} diff --git a/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyStreamEvent.ts b/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyStreamEvent.ts new file mode 100644 index 000000000..54ef6fc6b --- /dev/null +++ b/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyStreamEvent.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as TrueForge from "../index.js"; + +export interface UserToolApprovalPolicyStreamEvent extends TrueForge.UserToolApprovalPolicyEvent { + /** ISO 8601 event timestamp. */ + createdAt: string; + /** Unique identifier for the event (monotonic ULID). */ + id: string; +} diff --git a/packages/trueforge-sdk/src/api/types/index.ts b/packages/trueforge-sdk/src/api/types/index.ts index 9b29138b5..e9abd1710 100644 --- a/packages/trueforge-sdk/src/api/types/index.ts +++ b/packages/trueforge-sdk/src/api/types/index.ts @@ -198,6 +198,8 @@ export * from "./ThreadStateError.js"; export * from "./Timezone.js"; export * from "./TogetherAiModelProvider.js"; export * from "./TokenPagination.js"; +export * from "./ToolApprovalPolicyAction.js"; +export * from "./ToolApprovalPolicyItem.js"; export * from "./ToolApprovalRequiredEvent.js"; export * from "./ToolCall.js"; export * from "./ToolCallRef.js"; @@ -231,6 +233,8 @@ export * from "./UserMessage.js"; export * from "./UserMessageContent.js"; export * from "./UserMessageContentItem.js"; export * from "./UserToolApprovalEvent.js"; +export * from "./UserToolApprovalPolicyEvent.js"; +export * from "./UserToolApprovalPolicyStreamEvent.js"; export * from "./UserToolResponseEvent.js"; export * from "./WebSearchCapability.js"; export * from "./WebSearchConfig.js"; diff --git a/packages/trueforge-sdk/src/serialization/types/SessionEvent.ts b/packages/trueforge-sdk/src/serialization/types/SessionEvent.ts index bd14830f2..0b5a0cc5d 100644 --- a/packages/trueforge-sdk/src/serialization/types/SessionEvent.ts +++ b/packages/trueforge-sdk/src/serialization/types/SessionEvent.ts @@ -15,6 +15,7 @@ import { ToolResponseRequiredEvent } from "./ToolResponseRequiredEvent.js"; import { TurnCreatedEvent } from "./TurnCreatedEvent.js"; import { TurnDoneEvent } from "./TurnDoneEvent.js"; import { TurnUpdateEvent } from "./TurnUpdateEvent.js"; +import { UserToolApprovalPolicyStreamEvent } from "./UserToolApprovalPolicyStreamEvent.js"; export const SessionEvent: core.serialization.Schema = core.serialization.undiscriminatedUnion([ @@ -30,6 +31,7 @@ export const SessionEvent: core.serialization.Schema = core.serialization.object({ + expireAtTimestampSeconds: core.serialization.property( + "expire_at_timestamp_seconds", + core.serialization.number().optional(), + ), + status: core.serialization.stringLiteral("allow_session"), +}); + +export declare namespace ToolApprovalPolicyAction { + export interface Raw { + expire_at_timestamp_seconds?: number | null; + status: "allow_session"; + } +} diff --git a/packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyItem.ts b/packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyItem.ts new file mode 100644 index 000000000..d819e1087 --- /dev/null +++ b/packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyItem.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as TrueForge from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { ToolApprovalPolicyAction } from "./ToolApprovalPolicyAction.js"; + +export const ToolApprovalPolicyItem: core.serialization.ObjectSchema< + serializers.ToolApprovalPolicyItem.Raw, + TrueForge.ToolApprovalPolicyItem +> = core.serialization.object({ + action: ToolApprovalPolicyAction, + server: core.serialization.string(), + toolName: core.serialization.property("tool_name", core.serialization.string()), +}); + +export declare namespace ToolApprovalPolicyItem { + export interface Raw { + action: ToolApprovalPolicyAction.Raw; + server: string; + tool_name: string; + } +} diff --git a/packages/trueforge-sdk/src/serialization/types/TurnStreamingEvent.ts b/packages/trueforge-sdk/src/serialization/types/TurnStreamingEvent.ts index 29756a573..9a22bdb51 100644 --- a/packages/trueforge-sdk/src/serialization/types/TurnStreamingEvent.ts +++ b/packages/trueforge-sdk/src/serialization/types/TurnStreamingEvent.ts @@ -16,6 +16,7 @@ import { ToolResponseRequiredEvent } from "./ToolResponseRequiredEvent.js"; import { TurnCreatedEvent } from "./TurnCreatedEvent.js"; import { TurnDoneEvent } from "./TurnDoneEvent.js"; import { TurnUpdateEvent } from "./TurnUpdateEvent.js"; +import { UserToolApprovalPolicyStreamEvent } from "./UserToolApprovalPolicyStreamEvent.js"; export const TurnStreamingEvent: core.serialization.Schema< serializers.TurnStreamingEvent.Raw, @@ -34,6 +35,7 @@ export const TurnStreamingEvent: core.serialization.Schema< TurnCreatedEvent, TurnDoneEvent, TurnUpdateEvent, + UserToolApprovalPolicyStreamEvent, ]); export declare namespace TurnStreamingEvent { @@ -50,5 +52,6 @@ export declare namespace TurnStreamingEvent { | ToolResponseRequiredEvent.Raw | TurnCreatedEvent.Raw | TurnDoneEvent.Raw - | TurnUpdateEvent.Raw; + | TurnUpdateEvent.Raw + | UserToolApprovalPolicyStreamEvent.Raw; } diff --git a/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyEvent.ts b/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyEvent.ts new file mode 100644 index 000000000..85930d76d --- /dev/null +++ b/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyEvent.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as TrueForge from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { ToolApprovalPolicyItem } from "./ToolApprovalPolicyItem.js"; + +export const UserToolApprovalPolicyEvent: core.serialization.ObjectSchema< + serializers.UserToolApprovalPolicyEvent.Raw, + TrueForge.UserToolApprovalPolicyEvent +> = core.serialization.object({ + policies: core.serialization.list(ToolApprovalPolicyItem), + threadId: core.serialization.property("thread_id", core.serialization.string().nullable()), + type: core.serialization.stringLiteral("user.tool_approval_policy"), +}); + +export declare namespace UserToolApprovalPolicyEvent { + export interface Raw { + policies: ToolApprovalPolicyItem.Raw[]; + thread_id?: string | null; + type: "user.tool_approval_policy"; + } +} diff --git a/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyStreamEvent.ts b/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyStreamEvent.ts new file mode 100644 index 000000000..0c506a1f2 --- /dev/null +++ b/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyStreamEvent.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as TrueForge from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { UserToolApprovalPolicyEvent } from "./UserToolApprovalPolicyEvent.js"; + +export const UserToolApprovalPolicyStreamEvent: core.serialization.ObjectSchema< + serializers.UserToolApprovalPolicyStreamEvent.Raw, + TrueForge.UserToolApprovalPolicyStreamEvent +> = core.serialization + .object({ + createdAt: core.serialization.property("created_at", core.serialization.string()), + id: core.serialization.string(), + }) + .extend(UserToolApprovalPolicyEvent); + +export declare namespace UserToolApprovalPolicyStreamEvent { + export interface Raw extends UserToolApprovalPolicyEvent.Raw { + created_at: string; + id: string; + } +} diff --git a/packages/trueforge-sdk/src/serialization/types/index.ts b/packages/trueforge-sdk/src/serialization/types/index.ts index 9b29138b5..e9abd1710 100644 --- a/packages/trueforge-sdk/src/serialization/types/index.ts +++ b/packages/trueforge-sdk/src/serialization/types/index.ts @@ -198,6 +198,8 @@ export * from "./ThreadStateError.js"; export * from "./Timezone.js"; export * from "./TogetherAiModelProvider.js"; export * from "./TokenPagination.js"; +export * from "./ToolApprovalPolicyAction.js"; +export * from "./ToolApprovalPolicyItem.js"; export * from "./ToolApprovalRequiredEvent.js"; export * from "./ToolCall.js"; export * from "./ToolCallRef.js"; @@ -231,6 +233,8 @@ export * from "./UserMessage.js"; export * from "./UserMessageContent.js"; export * from "./UserMessageContentItem.js"; export * from "./UserToolApprovalEvent.js"; +export * from "./UserToolApprovalPolicyEvent.js"; +export * from "./UserToolApprovalPolicyStreamEvent.js"; export * from "./UserToolResponseEvent.js"; export * from "./WebSearchCapability.js"; export * from "./WebSearchConfig.js"; diff --git a/python/trueforge_sdk/src/trueforge_sdk/__init__.py b/python/trueforge_sdk/src/trueforge_sdk/__init__.py index 7242c3c63..d36bb902c 100644 --- a/python/trueforge_sdk/src/trueforge_sdk/__init__.py +++ b/python/trueforge_sdk/src/trueforge_sdk/__init__.py @@ -207,6 +207,8 @@ Timezone, TogetherAiModelProvider, TokenPagination, + ToolApprovalPolicyAction, + ToolApprovalPolicyItem, ToolApprovalRequiredEvent, ToolCall, ToolCallRef, @@ -240,6 +242,8 @@ UserMessageContent, UserMessageContentItem, UserToolApprovalEvent, + UserToolApprovalPolicyEvent, + UserToolApprovalPolicyStreamEvent, UserToolResponseEvent, WebSearchCapability, WebSearchConfig, @@ -477,6 +481,8 @@ "Timezone": ".types", "TogetherAiModelProvider": ".types", "TokenPagination": ".types", + "ToolApprovalPolicyAction": ".types", + "ToolApprovalPolicyItem": ".types", "ToolApprovalRequiredEvent": ".types", "ToolCall": ".types", "ToolCallRef": ".types", @@ -513,6 +519,8 @@ "UserMessageContent": ".types", "UserMessageContentItem": ".types", "UserToolApprovalEvent": ".types", + "UserToolApprovalPolicyEvent": ".types", + "UserToolApprovalPolicyStreamEvent": ".types", "UserToolResponseEvent": ".types", "WebSearchCapability": ".types", "WebSearchConfig": ".types", @@ -767,6 +775,8 @@ def __dir__(): "Timezone", "TogetherAiModelProvider", "TokenPagination", + "ToolApprovalPolicyAction", + "ToolApprovalPolicyItem", "ToolApprovalRequiredEvent", "ToolCall", "ToolCallRef", @@ -803,6 +813,8 @@ def __dir__(): "UserMessageContent", "UserMessageContentItem", "UserToolApprovalEvent", + "UserToolApprovalPolicyEvent", + "UserToolApprovalPolicyStreamEvent", "UserToolResponseEvent", "WebSearchCapability", "WebSearchConfig", diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/__init__.py b/python/trueforge_sdk/src/trueforge_sdk/types/__init__.py index 2e83715b6..8aeb049c1 100644 --- a/python/trueforge_sdk/src/trueforge_sdk/types/__init__.py +++ b/python/trueforge_sdk/src/trueforge_sdk/types/__init__.py @@ -206,6 +206,8 @@ from .timezone import Timezone from .together_ai_model_provider import TogetherAiModelProvider from .token_pagination import TokenPagination + from .tool_approval_policy_action import ToolApprovalPolicyAction + from .tool_approval_policy_item import ToolApprovalPolicyItem from .tool_approval_required_event import ToolApprovalRequiredEvent from .tool_call import ToolCall from .tool_call_ref import ToolCallRef @@ -239,6 +241,8 @@ from .user_message_content import UserMessageContent from .user_message_content_item import UserMessageContentItem from .user_tool_approval_event import UserToolApprovalEvent + from .user_tool_approval_policy_event import UserToolApprovalPolicyEvent + from .user_tool_approval_policy_stream_event import UserToolApprovalPolicyStreamEvent from .user_tool_response_event import UserToolResponseEvent from .web_search_capability import WebSearchCapability from .web_search_config import WebSearchConfig @@ -444,6 +448,8 @@ "Timezone": ".timezone", "TogetherAiModelProvider": ".together_ai_model_provider", "TokenPagination": ".token_pagination", + "ToolApprovalPolicyAction": ".tool_approval_policy_action", + "ToolApprovalPolicyItem": ".tool_approval_policy_item", "ToolApprovalRequiredEvent": ".tool_approval_required_event", "ToolCall": ".tool_call", "ToolCallRef": ".tool_call_ref", @@ -477,6 +483,8 @@ "UserMessageContent": ".user_message_content", "UserMessageContentItem": ".user_message_content_item", "UserToolApprovalEvent": ".user_tool_approval_event", + "UserToolApprovalPolicyEvent": ".user_tool_approval_policy_event", + "UserToolApprovalPolicyStreamEvent": ".user_tool_approval_policy_stream_event", "UserToolResponseEvent": ".user_tool_response_event", "WebSearchCapability": ".web_search_capability", "WebSearchConfig": ".web_search_config", @@ -706,6 +714,8 @@ def __dir__(): "Timezone", "TogetherAiModelProvider", "TokenPagination", + "ToolApprovalPolicyAction", + "ToolApprovalPolicyItem", "ToolApprovalRequiredEvent", "ToolCall", "ToolCallRef", @@ -739,6 +749,8 @@ def __dir__(): "UserMessageContent", "UserMessageContentItem", "UserToolApprovalEvent", + "UserToolApprovalPolicyEvent", + "UserToolApprovalPolicyStreamEvent", "UserToolResponseEvent", "WebSearchCapability", "WebSearchConfig", diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/session_event.py b/python/trueforge_sdk/src/trueforge_sdk/types/session_event.py index 6119fc25c..2a5183fc6 100644 --- a/python/trueforge_sdk/src/trueforge_sdk/types/session_event.py +++ b/python/trueforge_sdk/src/trueforge_sdk/types/session_event.py @@ -14,6 +14,7 @@ from .turn_created_event import TurnCreatedEvent from .turn_done_event import TurnDoneEvent from .turn_update_event import TurnUpdateEvent +from .user_tool_approval_policy_stream_event import UserToolApprovalPolicyStreamEvent SessionEvent = typing.Union[ McpAuthRequiredEvent, @@ -28,4 +29,5 @@ TurnCreatedEvent, TurnDoneEvent, TurnUpdateEvent, + UserToolApprovalPolicyStreamEvent, ] diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_action.py b/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_action.py new file mode 100644 index 000000000..cce31c8ec --- /dev/null +++ b/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_action.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ToolApprovalPolicyAction(UncheckedBaseModel): + expire_at_timestamp_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session. + """ + + status: typing.Literal["allow_session"] = pydantic.Field(default="allow_session") + """ + Allow matching tool calls for the rest of this session. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 + else: + + class Config: + smart_union = True + extra = pydantic.Extra.allow diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_item.py b/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_item.py new file mode 100644 index 000000000..a710c74a9 --- /dev/null +++ b/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_item.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .tool_approval_policy_action import ToolApprovalPolicyAction + + +class ToolApprovalPolicyItem(UncheckedBaseModel): + action: ToolApprovalPolicyAction + server: str = pydantic.Field() + """ + MCP server name the tool belongs to. + """ + + tool_name: str = pydantic.Field() + """ + Tool name this policy applies to. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 + else: + + class Config: + smart_union = True + extra = pydantic.Extra.allow diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/turn_streaming_event.py b/python/trueforge_sdk/src/trueforge_sdk/types/turn_streaming_event.py index 3570d5ed6..4353c4c04 100644 --- a/python/trueforge_sdk/src/trueforge_sdk/types/turn_streaming_event.py +++ b/python/trueforge_sdk/src/trueforge_sdk/types/turn_streaming_event.py @@ -15,6 +15,7 @@ from .turn_created_event import TurnCreatedEvent from .turn_done_event import TurnDoneEvent from .turn_update_event import TurnUpdateEvent +from .user_tool_approval_policy_stream_event import UserToolApprovalPolicyStreamEvent TurnStreamingEvent = typing.Union[ McpAuthRequiredEvent, @@ -30,4 +31,5 @@ TurnCreatedEvent, TurnDoneEvent, TurnUpdateEvent, + UserToolApprovalPolicyStreamEvent, ] diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_event.py b/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_event.py new file mode 100644 index 000000000..6f319cbce --- /dev/null +++ b/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_event.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .tool_approval_policy_item import ToolApprovalPolicyItem + + +class UserToolApprovalPolicyEvent(UncheckedBaseModel): + policies: typing.List[ToolApprovalPolicyItem] = pydantic.Field() + """ + One or more (server, tool_name) policy entries. + """ + + thread_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Null when session-scoped; set when delivered against a tip thread. + """ + + type: typing.Literal["user.tool_approval_policy"] = pydantic.Field(default="user.tool_approval_policy") + """ + Sticky allow-session policy for matching tools (optional expiry). + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 + else: + + class Config: + smart_union = True + extra = pydantic.Extra.allow diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_stream_event.py b/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_stream_event.py new file mode 100644 index 000000000..277292919 --- /dev/null +++ b/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_stream_event.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .user_tool_approval_policy_event import UserToolApprovalPolicyEvent + + +class UserToolApprovalPolicyStreamEvent(UserToolApprovalPolicyEvent): + created_at: str = pydantic.Field() + """ + ISO 8601 event timestamp. + """ + + id: str = pydantic.Field() + """ + Unique identifier for the event (monotonic ULID). + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 + else: + + class Config: + smart_union = True + extra = pydantic.Extra.allow From b981228bdacd8a003d5641c6a614194e07d084cf Mon Sep 17 00:00:00 2001 From: Heer Ambavi Date: Fri, 18 Sep 2026 17:00:52 +0530 Subject: [PATCH 3/3] address comments --- .../pre/user-tool-approval-policy-event.md | 6 - .changeset/user-tool-approval-policy-event.md | 6 + .github/fern/openapi/openapi.json | 111 +----------------- docs/openapi.json | 111 +----------------- .../src/agent-session/schemas/events.ts | 2 - .../trueforge-core/src/core/events/schema.ts | 28 ++--- packages/trueforge-core/src/core/index.ts | 2 - .../src/api/types/SessionEvent.ts | 3 +- .../src/api/types/ToolApprovalPolicyAction.ts | 8 -- .../src/api/types/ToolApprovalPolicyItem.ts | 11 -- .../src/api/types/TurnStreamingEvent.ts | 3 +- .../api/types/UserToolApprovalPolicyEvent.ts | 12 -- .../UserToolApprovalPolicyStreamEvent.ts | 10 -- packages/trueforge-sdk/src/api/types/index.ts | 4 - .../src/serialization/types/SessionEvent.ts | 5 +- .../types/ToolApprovalPolicyAction.ts | 23 ---- .../types/ToolApprovalPolicyItem.ts | 23 ---- .../serialization/types/TurnStreamingEvent.ts | 5 +- .../types/UserToolApprovalPolicyEvent.ts | 23 ---- .../UserToolApprovalPolicyStreamEvent.ts | 23 ---- .../src/serialization/types/index.ts | 4 - packages/trueforge/src/schemas/events.ts | 2 - .../src/trueforge_sdk/__init__.py | 12 -- .../src/trueforge_sdk/types/__init__.py | 12 -- .../src/trueforge_sdk/types/session_event.py | 2 - .../types/tool_approval_policy_action.py | 27 ----- .../types/tool_approval_policy_item.py | 29 ----- .../types/turn_streaming_event.py | 2 - .../types/user_tool_approval_policy_event.py | 33 ------ .../user_tool_approval_policy_stream_event.py | 27 ----- 30 files changed, 21 insertions(+), 548 deletions(-) delete mode 100644 .changeset/pre/user-tool-approval-policy-event.md create mode 100644 .changeset/user-tool-approval-policy-event.md delete mode 100644 packages/trueforge-sdk/src/api/types/ToolApprovalPolicyAction.ts delete mode 100644 packages/trueforge-sdk/src/api/types/ToolApprovalPolicyItem.ts delete mode 100644 packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyEvent.ts delete mode 100644 packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyStreamEvent.ts delete mode 100644 packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyAction.ts delete mode 100644 packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyItem.ts delete mode 100644 packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyEvent.ts delete mode 100644 packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyStreamEvent.ts delete mode 100644 python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_action.py delete mode 100644 python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_item.py delete mode 100644 python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_event.py delete mode 100644 python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_stream_event.py diff --git a/.changeset/pre/user-tool-approval-policy-event.md b/.changeset/pre/user-tool-approval-policy-event.md deleted file mode 100644 index 9a03d11b2..000000000 --- a/.changeset/pre/user-tool-approval-policy-event.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@truefoundry/trueforge-core": patch -"@truefoundry/trueforge": patch ---- - -Add `user.tool_approval_policy` event schema (`allow_session`, optional expiry) to send-event items and turn stream / session event unions. Per-call allow remains `user.tool_approval`. diff --git a/.changeset/user-tool-approval-policy-event.md b/.changeset/user-tool-approval-policy-event.md new file mode 100644 index 000000000..97d861d6b --- /dev/null +++ b/.changeset/user-tool-approval-policy-event.md @@ -0,0 +1,6 @@ +--- +"@truefoundry/trueforge-core": patch +"@truefoundry/trueforge": patch +--- + +Add `user.tool_approval_policy` send-event schema (`allow_session`, optional ISO `expire_at`). Send-only like `user.tool_approval` / `user.tool_response` — not on the durable stream. diff --git a/.github/fern/openapi/openapi.json b/.github/fern/openapi/openapi.json index a70b1f421..7a06b406e 100644 --- a/.github/fern/openapi/openapi.json +++ b/.github/fern/openapi/openapi.json @@ -4036,8 +4036,7 @@ "tool.response_required": "#/components/schemas/ToolResponseRequiredEvent", "turn.created": "#/components/schemas/TurnCreatedEvent", "turn.done": "#/components/schemas/TurnDoneEvent", - "turn.update": "#/components/schemas/TurnUpdateEvent", - "user.tool_approval_policy": "#/components/schemas/UserToolApprovalPolicyStreamEvent" + "turn.update": "#/components/schemas/TurnUpdateEvent" }, "propertyName": "type" }, @@ -4077,9 +4076,6 @@ }, { "$ref": "#/components/schemas/ToolResponseRequiredEvent" - }, - { - "$ref": "#/components/schemas/UserToolApprovalPolicyStreamEvent" } ] }, @@ -4710,49 +4706,6 @@ ], "type": "object" }, - "ToolApprovalPolicyAction": { - "properties": { - "expire_at_timestamp_seconds": { - "description": "Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session.", - "exclusiveMinimum": 0, - "type": "integer" - }, - "status": { - "description": "Allow matching tool calls for the rest of this session.", - "enum": [ - "allow_session" - ], - "type": "string" - } - }, - "required": [ - "status" - ], - "type": "object" - }, - "ToolApprovalPolicyItem": { - "properties": { - "action": { - "$ref": "#/components/schemas/ToolApprovalPolicyAction" - }, - "server": { - "description": "MCP server name the tool belongs to.", - "minLength": 1, - "type": "string" - }, - "tool_name": { - "description": "Tool name this policy applies to.", - "minLength": 1, - "type": "string" - } - }, - "required": [ - "server", - "tool_name", - "action" - ], - "type": "object" - }, "ToolApprovalRequiredEvent": { "properties": { "created_at": { @@ -5442,8 +5395,7 @@ "tool.response_required": "#/components/schemas/ToolResponseRequiredEvent", "turn.created": "#/components/schemas/TurnCreatedEvent", "turn.done": "#/components/schemas/TurnDoneEvent", - "turn.update": "#/components/schemas/TurnUpdateEvent", - "user.tool_approval_policy": "#/components/schemas/UserToolApprovalPolicyStreamEvent" + "turn.update": "#/components/schemas/TurnUpdateEvent" }, "propertyName": "type" }, @@ -5478,9 +5430,6 @@ { "$ref": "#/components/schemas/ToolResponseRequiredEvent" }, - { - "$ref": "#/components/schemas/UserToolApprovalPolicyStreamEvent" - }, { "$ref": "#/components/schemas/TurnCreatedEvent" }, @@ -5762,62 +5711,6 @@ ], "type": "object" }, - "UserToolApprovalPolicyEvent": { - "properties": { - "policies": { - "description": "One or more (server, tool_name) policy entries.", - "items": { - "$ref": "#/components/schemas/ToolApprovalPolicyItem" - }, - "minItems": 1, - "type": "array" - }, - "thread_id": { - "description": "Null when session-scoped; set when delivered against a tip thread.", - "type": [ - "string", - "null" - ] - }, - "type": { - "description": "Sticky allow-session policy for matching tools (optional expiry).", - "enum": [ - "user.tool_approval_policy" - ], - "type": "string" - } - }, - "required": [ - "type", - "thread_id", - "policies" - ], - "type": "object" - }, - "UserToolApprovalPolicyStreamEvent": { - "allOf": [ - { - "$ref": "#/components/schemas/UserToolApprovalPolicyEvent" - }, - { - "properties": { - "created_at": { - "description": "ISO 8601 event timestamp.", - "type": "string" - }, - "id": { - "description": "Unique identifier for the event (monotonic ULID).", - "type": "string" - } - }, - "required": [ - "id", - "created_at" - ], - "type": "object" - } - ] - }, "UserToolResponseEvent": { "properties": { "content": { diff --git a/docs/openapi.json b/docs/openapi.json index a70b1f421..7a06b406e 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -4036,8 +4036,7 @@ "tool.response_required": "#/components/schemas/ToolResponseRequiredEvent", "turn.created": "#/components/schemas/TurnCreatedEvent", "turn.done": "#/components/schemas/TurnDoneEvent", - "turn.update": "#/components/schemas/TurnUpdateEvent", - "user.tool_approval_policy": "#/components/schemas/UserToolApprovalPolicyStreamEvent" + "turn.update": "#/components/schemas/TurnUpdateEvent" }, "propertyName": "type" }, @@ -4077,9 +4076,6 @@ }, { "$ref": "#/components/schemas/ToolResponseRequiredEvent" - }, - { - "$ref": "#/components/schemas/UserToolApprovalPolicyStreamEvent" } ] }, @@ -4710,49 +4706,6 @@ ], "type": "object" }, - "ToolApprovalPolicyAction": { - "properties": { - "expire_at_timestamp_seconds": { - "description": "Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session.", - "exclusiveMinimum": 0, - "type": "integer" - }, - "status": { - "description": "Allow matching tool calls for the rest of this session.", - "enum": [ - "allow_session" - ], - "type": "string" - } - }, - "required": [ - "status" - ], - "type": "object" - }, - "ToolApprovalPolicyItem": { - "properties": { - "action": { - "$ref": "#/components/schemas/ToolApprovalPolicyAction" - }, - "server": { - "description": "MCP server name the tool belongs to.", - "minLength": 1, - "type": "string" - }, - "tool_name": { - "description": "Tool name this policy applies to.", - "minLength": 1, - "type": "string" - } - }, - "required": [ - "server", - "tool_name", - "action" - ], - "type": "object" - }, "ToolApprovalRequiredEvent": { "properties": { "created_at": { @@ -5442,8 +5395,7 @@ "tool.response_required": "#/components/schemas/ToolResponseRequiredEvent", "turn.created": "#/components/schemas/TurnCreatedEvent", "turn.done": "#/components/schemas/TurnDoneEvent", - "turn.update": "#/components/schemas/TurnUpdateEvent", - "user.tool_approval_policy": "#/components/schemas/UserToolApprovalPolicyStreamEvent" + "turn.update": "#/components/schemas/TurnUpdateEvent" }, "propertyName": "type" }, @@ -5478,9 +5430,6 @@ { "$ref": "#/components/schemas/ToolResponseRequiredEvent" }, - { - "$ref": "#/components/schemas/UserToolApprovalPolicyStreamEvent" - }, { "$ref": "#/components/schemas/TurnCreatedEvent" }, @@ -5762,62 +5711,6 @@ ], "type": "object" }, - "UserToolApprovalPolicyEvent": { - "properties": { - "policies": { - "description": "One or more (server, tool_name) policy entries.", - "items": { - "$ref": "#/components/schemas/ToolApprovalPolicyItem" - }, - "minItems": 1, - "type": "array" - }, - "thread_id": { - "description": "Null when session-scoped; set when delivered against a tip thread.", - "type": [ - "string", - "null" - ] - }, - "type": { - "description": "Sticky allow-session policy for matching tools (optional expiry).", - "enum": [ - "user.tool_approval_policy" - ], - "type": "string" - } - }, - "required": [ - "type", - "thread_id", - "policies" - ], - "type": "object" - }, - "UserToolApprovalPolicyStreamEvent": { - "allOf": [ - { - "$ref": "#/components/schemas/UserToolApprovalPolicyEvent" - }, - { - "properties": { - "created_at": { - "description": "ISO 8601 event timestamp.", - "type": "string" - }, - "id": { - "description": "Unique identifier for the event (monotonic ULID).", - "type": "string" - } - }, - "required": [ - "id", - "created_at" - ], - "type": "object" - } - ] - }, "UserToolResponseEvent": { "properties": { "content": { diff --git a/packages/trueforge-core/src/agent-session/schemas/events.ts b/packages/trueforge-core/src/agent-session/schemas/events.ts index 6aaa343d4..370f209c2 100644 --- a/packages/trueforge-core/src/agent-session/schemas/events.ts +++ b/packages/trueforge-core/src/agent-session/schemas/events.ts @@ -18,7 +18,6 @@ import { ToolApprovalRequiredEventSchema, ToolResponseEventSchema, ToolResponseRequiredEventSchema, - UserToolApprovalPolicyEventSchema, } from '../../core/events/schema'; import { TurnInputItemSchema, @@ -112,7 +111,6 @@ export const SessionEventSchema = z SandboxCreatedEventSchema, ToolApprovalRequiredEventSchema, ToolResponseRequiredEventSchema, - UserToolApprovalPolicyEventSchema, ]) .openapi('SessionEvent'); diff --git a/packages/trueforge-core/src/core/events/schema.ts b/packages/trueforge-core/src/core/events/schema.ts index 90cccdf67..0f4067c6f 100644 --- a/packages/trueforge-core/src/core/events/schema.ts +++ b/packages/trueforge-core/src/core/events/schema.ts @@ -99,47 +99,35 @@ export const UserToolResponseMessageSchema = z export const ToolApprovalPolicyAllowSessionSchema = z .object({ - status: z.literal('allow_session').describe('Allow matching tool calls for the rest of this session.'), - expire_at_timestamp_seconds: z - .number() - .int() - .positive() + type: z.literal('allow_session').describe('Allow matching tool calls for the rest of this session.'), + expire_at: z + .string() .optional() - .describe('Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session.'), + .describe('ISO 8601 timestamp when this session allow expires. Omit to allow for the whole session.'), }) .openapi('ToolApprovalPolicyAllowSession'); -/** Sticky session allow. Per-call allow/deny stays on {@link UserToolApprovalMessageSchema}. */ -export const ToolApprovalPolicyActionSchema = ToolApprovalPolicyAllowSessionSchema.openapi('ToolApprovalPolicyAction'); - export const ToolApprovalPolicyItemSchema = z .object({ server: z.string().min(1, 'server is required').describe('MCP server name the tool belongs to.'), tool_name: z.string().min(1, 'tool_name is required').describe('Tool name this policy applies to.'), - action: ToolApprovalPolicyActionSchema, + action: z.discriminatedUnion('type', [ToolApprovalPolicyAllowSessionSchema]), }) .openapi('ToolApprovalPolicyItem'); /** - * Client inbound sticky approval policy (session-scoped by default). - * Distinct from per-call {@link UserToolApprovalMessageSchema} (`allow` / `deny` on a `tool_call_id`). + * Client inbound sticky approval policy (send-event only; not on the durable stream). + * Same pattern as {@link UserToolApprovalMessageSchema} / {@link UserToolResponseMessageSchema}. */ export const UserToolApprovalPolicyMessageSchema = z .object({ type: z .literal(EventType.USER_TOOL_APPROVAL_POLICY) .describe('Sticky allow-session policy for matching tools (optional expiry).'), - thread_id: z.string().nullable().describe('Null when session-scoped; set when delivered against a tip thread.'), policies: z.array(ToolApprovalPolicyItemSchema).min(1).describe('One or more (server, tool_name) policy entries.'), }) .openapi('UserToolApprovalPolicyEvent'); -/** Durable / SSE form of {@link UserToolApprovalPolicyMessageSchema} with mintable identity. */ -export const UserToolApprovalPolicyEventSchema = UserToolApprovalPolicyMessageSchema.extend({ - id: EventIdSchema, - created_at: z.string().describe('ISO 8601 event timestamp.'), -}).openapi('UserToolApprovalPolicyStreamEvent'); - export const TextContentPartSchema = z .object({ type: z.literal('text').describe('Text content part.'), @@ -417,10 +405,8 @@ export type AgentInfo = z.infer; export type ApprovalDecision = z.infer; export type UserToolApprovalMessage = z.infer; export type UserToolResponseMessage = z.infer; -export type ToolApprovalPolicyAction = z.infer; export type ToolApprovalPolicyItem = z.infer; export type UserToolApprovalPolicyMessage = z.infer; -export type UserToolApprovalPolicyEvent = z.infer; export type AgentApprovalDecisionMessage = z.infer; export type InputTokensBreakdown = z.infer; export type ModelMessageUsage = z.infer; diff --git a/packages/trueforge-core/src/core/index.ts b/packages/trueforge-core/src/core/index.ts index 622033641..77f629469 100644 --- a/packages/trueforge-core/src/core/index.ts +++ b/packages/trueforge-core/src/core/index.ts @@ -114,7 +114,6 @@ export { ToolResponseEventSchema, ToolResponseRequiredEventSchema, UserToolApprovalMessageSchema, - UserToolApprovalPolicyEventSchema, UserToolApprovalPolicyMessageSchema, UserToolResponseMessageSchema, newEventId, @@ -126,7 +125,6 @@ export type { MCPServerInitInfo, ThreadDoneEvent, ThreadOverwriteContextEvent, - UserToolApprovalPolicyEvent, UserToolApprovalPolicyMessage, } from './events/schema'; export { CompletionUsageSchema } from './llm/LLMTypes'; diff --git a/packages/trueforge-sdk/src/api/types/SessionEvent.ts b/packages/trueforge-sdk/src/api/types/SessionEvent.ts index 35a085d1b..8d305b279 100644 --- a/packages/trueforge-sdk/src/api/types/SessionEvent.ts +++ b/packages/trueforge-sdk/src/api/types/SessionEvent.ts @@ -14,5 +14,4 @@ export type SessionEvent = | TrueForge.ToolResponseRequiredEvent | TrueForge.TurnCreatedEvent | TrueForge.TurnDoneEvent - | TrueForge.TurnUpdateEvent - | TrueForge.UserToolApprovalPolicyStreamEvent; + | TrueForge.TurnUpdateEvent; diff --git a/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyAction.ts b/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyAction.ts deleted file mode 100644 index 25f581e4e..000000000 --- a/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyAction.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -export interface ToolApprovalPolicyAction { - /** Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session. */ - expireAtTimestampSeconds?: number; - /** Allow matching tool calls for the rest of this session. */ - status: "allow_session"; -} diff --git a/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyItem.ts b/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyItem.ts deleted file mode 100644 index 722ea5c83..000000000 --- a/packages/trueforge-sdk/src/api/types/ToolApprovalPolicyItem.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as TrueForge from "../index.js"; - -export interface ToolApprovalPolicyItem { - action: TrueForge.ToolApprovalPolicyAction; - /** MCP server name the tool belongs to. */ - server: string; - /** Tool name this policy applies to. */ - toolName: string; -} diff --git a/packages/trueforge-sdk/src/api/types/TurnStreamingEvent.ts b/packages/trueforge-sdk/src/api/types/TurnStreamingEvent.ts index 3dd245bc8..61f6515ac 100644 --- a/packages/trueforge-sdk/src/api/types/TurnStreamingEvent.ts +++ b/packages/trueforge-sdk/src/api/types/TurnStreamingEvent.ts @@ -15,5 +15,4 @@ export type TurnStreamingEvent = | TrueForge.ToolResponseRequiredEvent | TrueForge.TurnCreatedEvent | TrueForge.TurnDoneEvent - | TrueForge.TurnUpdateEvent - | TrueForge.UserToolApprovalPolicyStreamEvent; + | TrueForge.TurnUpdateEvent; diff --git a/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyEvent.ts b/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyEvent.ts deleted file mode 100644 index 9991d6539..000000000 --- a/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyEvent.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as TrueForge from "../index.js"; - -export interface UserToolApprovalPolicyEvent { - /** One or more (server, tool_name) policy entries. */ - policies: TrueForge.ToolApprovalPolicyItem[]; - /** Null when session-scoped; set when delivered against a tip thread. */ - threadId: string | null; - /** Sticky allow-session policy for matching tools (optional expiry). */ - type: "user.tool_approval_policy"; -} diff --git a/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyStreamEvent.ts b/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyStreamEvent.ts deleted file mode 100644 index 54ef6fc6b..000000000 --- a/packages/trueforge-sdk/src/api/types/UserToolApprovalPolicyStreamEvent.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as TrueForge from "../index.js"; - -export interface UserToolApprovalPolicyStreamEvent extends TrueForge.UserToolApprovalPolicyEvent { - /** ISO 8601 event timestamp. */ - createdAt: string; - /** Unique identifier for the event (monotonic ULID). */ - id: string; -} diff --git a/packages/trueforge-sdk/src/api/types/index.ts b/packages/trueforge-sdk/src/api/types/index.ts index e9abd1710..9b29138b5 100644 --- a/packages/trueforge-sdk/src/api/types/index.ts +++ b/packages/trueforge-sdk/src/api/types/index.ts @@ -198,8 +198,6 @@ export * from "./ThreadStateError.js"; export * from "./Timezone.js"; export * from "./TogetherAiModelProvider.js"; export * from "./TokenPagination.js"; -export * from "./ToolApprovalPolicyAction.js"; -export * from "./ToolApprovalPolicyItem.js"; export * from "./ToolApprovalRequiredEvent.js"; export * from "./ToolCall.js"; export * from "./ToolCallRef.js"; @@ -233,8 +231,6 @@ export * from "./UserMessage.js"; export * from "./UserMessageContent.js"; export * from "./UserMessageContentItem.js"; export * from "./UserToolApprovalEvent.js"; -export * from "./UserToolApprovalPolicyEvent.js"; -export * from "./UserToolApprovalPolicyStreamEvent.js"; export * from "./UserToolResponseEvent.js"; export * from "./WebSearchCapability.js"; export * from "./WebSearchConfig.js"; diff --git a/packages/trueforge-sdk/src/serialization/types/SessionEvent.ts b/packages/trueforge-sdk/src/serialization/types/SessionEvent.ts index 0b5a0cc5d..bd14830f2 100644 --- a/packages/trueforge-sdk/src/serialization/types/SessionEvent.ts +++ b/packages/trueforge-sdk/src/serialization/types/SessionEvent.ts @@ -15,7 +15,6 @@ import { ToolResponseRequiredEvent } from "./ToolResponseRequiredEvent.js"; import { TurnCreatedEvent } from "./TurnCreatedEvent.js"; import { TurnDoneEvent } from "./TurnDoneEvent.js"; import { TurnUpdateEvent } from "./TurnUpdateEvent.js"; -import { UserToolApprovalPolicyStreamEvent } from "./UserToolApprovalPolicyStreamEvent.js"; export const SessionEvent: core.serialization.Schema = core.serialization.undiscriminatedUnion([ @@ -31,7 +30,6 @@ export const SessionEvent: core.serialization.Schema = core.serialization.object({ - expireAtTimestampSeconds: core.serialization.property( - "expire_at_timestamp_seconds", - core.serialization.number().optional(), - ), - status: core.serialization.stringLiteral("allow_session"), -}); - -export declare namespace ToolApprovalPolicyAction { - export interface Raw { - expire_at_timestamp_seconds?: number | null; - status: "allow_session"; - } -} diff --git a/packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyItem.ts b/packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyItem.ts deleted file mode 100644 index d819e1087..000000000 --- a/packages/trueforge-sdk/src/serialization/types/ToolApprovalPolicyItem.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as TrueForge from "../../api/index.js"; -import * as core from "../../core/index.js"; -import type * as serializers from "../index.js"; -import { ToolApprovalPolicyAction } from "./ToolApprovalPolicyAction.js"; - -export const ToolApprovalPolicyItem: core.serialization.ObjectSchema< - serializers.ToolApprovalPolicyItem.Raw, - TrueForge.ToolApprovalPolicyItem -> = core.serialization.object({ - action: ToolApprovalPolicyAction, - server: core.serialization.string(), - toolName: core.serialization.property("tool_name", core.serialization.string()), -}); - -export declare namespace ToolApprovalPolicyItem { - export interface Raw { - action: ToolApprovalPolicyAction.Raw; - server: string; - tool_name: string; - } -} diff --git a/packages/trueforge-sdk/src/serialization/types/TurnStreamingEvent.ts b/packages/trueforge-sdk/src/serialization/types/TurnStreamingEvent.ts index 9a22bdb51..29756a573 100644 --- a/packages/trueforge-sdk/src/serialization/types/TurnStreamingEvent.ts +++ b/packages/trueforge-sdk/src/serialization/types/TurnStreamingEvent.ts @@ -16,7 +16,6 @@ import { ToolResponseRequiredEvent } from "./ToolResponseRequiredEvent.js"; import { TurnCreatedEvent } from "./TurnCreatedEvent.js"; import { TurnDoneEvent } from "./TurnDoneEvent.js"; import { TurnUpdateEvent } from "./TurnUpdateEvent.js"; -import { UserToolApprovalPolicyStreamEvent } from "./UserToolApprovalPolicyStreamEvent.js"; export const TurnStreamingEvent: core.serialization.Schema< serializers.TurnStreamingEvent.Raw, @@ -35,7 +34,6 @@ export const TurnStreamingEvent: core.serialization.Schema< TurnCreatedEvent, TurnDoneEvent, TurnUpdateEvent, - UserToolApprovalPolicyStreamEvent, ]); export declare namespace TurnStreamingEvent { @@ -52,6 +50,5 @@ export declare namespace TurnStreamingEvent { | ToolResponseRequiredEvent.Raw | TurnCreatedEvent.Raw | TurnDoneEvent.Raw - | TurnUpdateEvent.Raw - | UserToolApprovalPolicyStreamEvent.Raw; + | TurnUpdateEvent.Raw; } diff --git a/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyEvent.ts b/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyEvent.ts deleted file mode 100644 index 85930d76d..000000000 --- a/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as TrueForge from "../../api/index.js"; -import * as core from "../../core/index.js"; -import type * as serializers from "../index.js"; -import { ToolApprovalPolicyItem } from "./ToolApprovalPolicyItem.js"; - -export const UserToolApprovalPolicyEvent: core.serialization.ObjectSchema< - serializers.UserToolApprovalPolicyEvent.Raw, - TrueForge.UserToolApprovalPolicyEvent -> = core.serialization.object({ - policies: core.serialization.list(ToolApprovalPolicyItem), - threadId: core.serialization.property("thread_id", core.serialization.string().nullable()), - type: core.serialization.stringLiteral("user.tool_approval_policy"), -}); - -export declare namespace UserToolApprovalPolicyEvent { - export interface Raw { - policies: ToolApprovalPolicyItem.Raw[]; - thread_id?: string | null; - type: "user.tool_approval_policy"; - } -} diff --git a/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyStreamEvent.ts b/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyStreamEvent.ts deleted file mode 100644 index 0c506a1f2..000000000 --- a/packages/trueforge-sdk/src/serialization/types/UserToolApprovalPolicyStreamEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as TrueForge from "../../api/index.js"; -import * as core from "../../core/index.js"; -import type * as serializers from "../index.js"; -import { UserToolApprovalPolicyEvent } from "./UserToolApprovalPolicyEvent.js"; - -export const UserToolApprovalPolicyStreamEvent: core.serialization.ObjectSchema< - serializers.UserToolApprovalPolicyStreamEvent.Raw, - TrueForge.UserToolApprovalPolicyStreamEvent -> = core.serialization - .object({ - createdAt: core.serialization.property("created_at", core.serialization.string()), - id: core.serialization.string(), - }) - .extend(UserToolApprovalPolicyEvent); - -export declare namespace UserToolApprovalPolicyStreamEvent { - export interface Raw extends UserToolApprovalPolicyEvent.Raw { - created_at: string; - id: string; - } -} diff --git a/packages/trueforge-sdk/src/serialization/types/index.ts b/packages/trueforge-sdk/src/serialization/types/index.ts index e9abd1710..9b29138b5 100644 --- a/packages/trueforge-sdk/src/serialization/types/index.ts +++ b/packages/trueforge-sdk/src/serialization/types/index.ts @@ -198,8 +198,6 @@ export * from "./ThreadStateError.js"; export * from "./Timezone.js"; export * from "./TogetherAiModelProvider.js"; export * from "./TokenPagination.js"; -export * from "./ToolApprovalPolicyAction.js"; -export * from "./ToolApprovalPolicyItem.js"; export * from "./ToolApprovalRequiredEvent.js"; export * from "./ToolCall.js"; export * from "./ToolCallRef.js"; @@ -233,8 +231,6 @@ export * from "./UserMessage.js"; export * from "./UserMessageContent.js"; export * from "./UserMessageContentItem.js"; export * from "./UserToolApprovalEvent.js"; -export * from "./UserToolApprovalPolicyEvent.js"; -export * from "./UserToolApprovalPolicyStreamEvent.js"; export * from "./UserToolResponseEvent.js"; export * from "./WebSearchCapability.js"; export * from "./WebSearchConfig.js"; diff --git a/packages/trueforge/src/schemas/events.ts b/packages/trueforge/src/schemas/events.ts index a4aa9c1df..4b702a6e1 100644 --- a/packages/trueforge/src/schemas/events.ts +++ b/packages/trueforge/src/schemas/events.ts @@ -22,7 +22,6 @@ import { ToolApprovalRequiredEventSchema, ToolResponseEventSchema, ToolResponseRequiredEventSchema, - UserToolApprovalPolicyEventSchema, } from '@truefoundry/trueforge-core/core'; import { EVENTS_PAGE_LIMIT } from './common'; @@ -42,7 +41,6 @@ export const TurnStreamingEventSchema = z SandboxCreatedEventSchema, ToolApprovalRequiredEventSchema, ToolResponseRequiredEventSchema, - UserToolApprovalPolicyEventSchema, TurnCreatedEventSchema, TurnUpdateEventSchema, TurnDoneEventSchema, diff --git a/python/trueforge_sdk/src/trueforge_sdk/__init__.py b/python/trueforge_sdk/src/trueforge_sdk/__init__.py index d36bb902c..7242c3c63 100644 --- a/python/trueforge_sdk/src/trueforge_sdk/__init__.py +++ b/python/trueforge_sdk/src/trueforge_sdk/__init__.py @@ -207,8 +207,6 @@ Timezone, TogetherAiModelProvider, TokenPagination, - ToolApprovalPolicyAction, - ToolApprovalPolicyItem, ToolApprovalRequiredEvent, ToolCall, ToolCallRef, @@ -242,8 +240,6 @@ UserMessageContent, UserMessageContentItem, UserToolApprovalEvent, - UserToolApprovalPolicyEvent, - UserToolApprovalPolicyStreamEvent, UserToolResponseEvent, WebSearchCapability, WebSearchConfig, @@ -481,8 +477,6 @@ "Timezone": ".types", "TogetherAiModelProvider": ".types", "TokenPagination": ".types", - "ToolApprovalPolicyAction": ".types", - "ToolApprovalPolicyItem": ".types", "ToolApprovalRequiredEvent": ".types", "ToolCall": ".types", "ToolCallRef": ".types", @@ -519,8 +513,6 @@ "UserMessageContent": ".types", "UserMessageContentItem": ".types", "UserToolApprovalEvent": ".types", - "UserToolApprovalPolicyEvent": ".types", - "UserToolApprovalPolicyStreamEvent": ".types", "UserToolResponseEvent": ".types", "WebSearchCapability": ".types", "WebSearchConfig": ".types", @@ -775,8 +767,6 @@ def __dir__(): "Timezone", "TogetherAiModelProvider", "TokenPagination", - "ToolApprovalPolicyAction", - "ToolApprovalPolicyItem", "ToolApprovalRequiredEvent", "ToolCall", "ToolCallRef", @@ -813,8 +803,6 @@ def __dir__(): "UserMessageContent", "UserMessageContentItem", "UserToolApprovalEvent", - "UserToolApprovalPolicyEvent", - "UserToolApprovalPolicyStreamEvent", "UserToolResponseEvent", "WebSearchCapability", "WebSearchConfig", diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/__init__.py b/python/trueforge_sdk/src/trueforge_sdk/types/__init__.py index 8aeb049c1..2e83715b6 100644 --- a/python/trueforge_sdk/src/trueforge_sdk/types/__init__.py +++ b/python/trueforge_sdk/src/trueforge_sdk/types/__init__.py @@ -206,8 +206,6 @@ from .timezone import Timezone from .together_ai_model_provider import TogetherAiModelProvider from .token_pagination import TokenPagination - from .tool_approval_policy_action import ToolApprovalPolicyAction - from .tool_approval_policy_item import ToolApprovalPolicyItem from .tool_approval_required_event import ToolApprovalRequiredEvent from .tool_call import ToolCall from .tool_call_ref import ToolCallRef @@ -241,8 +239,6 @@ from .user_message_content import UserMessageContent from .user_message_content_item import UserMessageContentItem from .user_tool_approval_event import UserToolApprovalEvent - from .user_tool_approval_policy_event import UserToolApprovalPolicyEvent - from .user_tool_approval_policy_stream_event import UserToolApprovalPolicyStreamEvent from .user_tool_response_event import UserToolResponseEvent from .web_search_capability import WebSearchCapability from .web_search_config import WebSearchConfig @@ -448,8 +444,6 @@ "Timezone": ".timezone", "TogetherAiModelProvider": ".together_ai_model_provider", "TokenPagination": ".token_pagination", - "ToolApprovalPolicyAction": ".tool_approval_policy_action", - "ToolApprovalPolicyItem": ".tool_approval_policy_item", "ToolApprovalRequiredEvent": ".tool_approval_required_event", "ToolCall": ".tool_call", "ToolCallRef": ".tool_call_ref", @@ -483,8 +477,6 @@ "UserMessageContent": ".user_message_content", "UserMessageContentItem": ".user_message_content_item", "UserToolApprovalEvent": ".user_tool_approval_event", - "UserToolApprovalPolicyEvent": ".user_tool_approval_policy_event", - "UserToolApprovalPolicyStreamEvent": ".user_tool_approval_policy_stream_event", "UserToolResponseEvent": ".user_tool_response_event", "WebSearchCapability": ".web_search_capability", "WebSearchConfig": ".web_search_config", @@ -714,8 +706,6 @@ def __dir__(): "Timezone", "TogetherAiModelProvider", "TokenPagination", - "ToolApprovalPolicyAction", - "ToolApprovalPolicyItem", "ToolApprovalRequiredEvent", "ToolCall", "ToolCallRef", @@ -749,8 +739,6 @@ def __dir__(): "UserMessageContent", "UserMessageContentItem", "UserToolApprovalEvent", - "UserToolApprovalPolicyEvent", - "UserToolApprovalPolicyStreamEvent", "UserToolResponseEvent", "WebSearchCapability", "WebSearchConfig", diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/session_event.py b/python/trueforge_sdk/src/trueforge_sdk/types/session_event.py index 2a5183fc6..6119fc25c 100644 --- a/python/trueforge_sdk/src/trueforge_sdk/types/session_event.py +++ b/python/trueforge_sdk/src/trueforge_sdk/types/session_event.py @@ -14,7 +14,6 @@ from .turn_created_event import TurnCreatedEvent from .turn_done_event import TurnDoneEvent from .turn_update_event import TurnUpdateEvent -from .user_tool_approval_policy_stream_event import UserToolApprovalPolicyStreamEvent SessionEvent = typing.Union[ McpAuthRequiredEvent, @@ -29,5 +28,4 @@ TurnCreatedEvent, TurnDoneEvent, TurnUpdateEvent, - UserToolApprovalPolicyStreamEvent, ] diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_action.py b/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_action.py deleted file mode 100644 index cce31c8ec..000000000 --- a/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_action.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel - - -class ToolApprovalPolicyAction(UncheckedBaseModel): - expire_at_timestamp_seconds: typing.Optional[int] = pydantic.Field(default=None) - """ - Unix timestamp (seconds) when this session allow expires. Omit to allow for the whole session. - """ - - status: typing.Literal["allow_session"] = pydantic.Field(default="allow_session") - """ - Allow matching tool calls for the rest of this session. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 - else: - - class Config: - smart_union = True - extra = pydantic.Extra.allow diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_item.py b/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_item.py deleted file mode 100644 index a710c74a9..000000000 --- a/python/trueforge_sdk/src/trueforge_sdk/types/tool_approval_policy_item.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel -from .tool_approval_policy_action import ToolApprovalPolicyAction - - -class ToolApprovalPolicyItem(UncheckedBaseModel): - action: ToolApprovalPolicyAction - server: str = pydantic.Field() - """ - MCP server name the tool belongs to. - """ - - tool_name: str = pydantic.Field() - """ - Tool name this policy applies to. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 - else: - - class Config: - smart_union = True - extra = pydantic.Extra.allow diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/turn_streaming_event.py b/python/trueforge_sdk/src/trueforge_sdk/types/turn_streaming_event.py index 4353c4c04..3570d5ed6 100644 --- a/python/trueforge_sdk/src/trueforge_sdk/types/turn_streaming_event.py +++ b/python/trueforge_sdk/src/trueforge_sdk/types/turn_streaming_event.py @@ -15,7 +15,6 @@ from .turn_created_event import TurnCreatedEvent from .turn_done_event import TurnDoneEvent from .turn_update_event import TurnUpdateEvent -from .user_tool_approval_policy_stream_event import UserToolApprovalPolicyStreamEvent TurnStreamingEvent = typing.Union[ McpAuthRequiredEvent, @@ -31,5 +30,4 @@ TurnCreatedEvent, TurnDoneEvent, TurnUpdateEvent, - UserToolApprovalPolicyStreamEvent, ] diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_event.py b/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_event.py deleted file mode 100644 index 6f319cbce..000000000 --- a/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_event.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel -from .tool_approval_policy_item import ToolApprovalPolicyItem - - -class UserToolApprovalPolicyEvent(UncheckedBaseModel): - policies: typing.List[ToolApprovalPolicyItem] = pydantic.Field() - """ - One or more (server, tool_name) policy entries. - """ - - thread_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Null when session-scoped; set when delivered against a tip thread. - """ - - type: typing.Literal["user.tool_approval_policy"] = pydantic.Field(default="user.tool_approval_policy") - """ - Sticky allow-session policy for matching tools (optional expiry). - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 - else: - - class Config: - smart_union = True - extra = pydantic.Extra.allow diff --git a/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_stream_event.py b/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_stream_event.py deleted file mode 100644 index 277292919..000000000 --- a/python/trueforge_sdk/src/trueforge_sdk/types/user_tool_approval_policy_stream_event.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from .user_tool_approval_policy_event import UserToolApprovalPolicyEvent - - -class UserToolApprovalPolicyStreamEvent(UserToolApprovalPolicyEvent): - created_at: str = pydantic.Field() - """ - ISO 8601 event timestamp. - """ - - id: str = pydantic.Field() - """ - Unique identifier for the event (monotonic ULID). - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 - else: - - class Config: - smart_union = True - extra = pydantic.Extra.allow