Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ fn continuation_endpoint_rotation_rejects_retired_name() {
assert_eq!(canonical.tool_name(), "rotate_agent_continuation_endpoint");
assert!(matches!(
canonical,
ToolCall::RotateAgentContinuationEndpoint { .. }
ToolCall::RotateAgentContinuationEndpoint(..)
));

{
Expand Down
1 change: 1 addition & 0 deletions crates/webcodex-tool-contracts/src/tool_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ pub const TOOL_CALL_WRAPPER_FIELDS: &[&str] = &[TOOL_CALL_TOOL_FIELD, TOOL_CALL_
pub const AGENT_CONTINUATION_REF_PATTERN: &str = "^~ac[1-9][0-9]{0,18}$";

include!("tool_call/input_types.rs");
include!("tool_call/communication_inputs.rs");
include!("tool_call/canonical_enum.rs");
include!("tool_call/parsing.rs");
260 changes: 18 additions & 242 deletions crates/webcodex-tool-contracts/src/tool_call/canonical_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,8 @@ pub enum ToolCall {
dependency_policy: Option<webcodex_core::project_build::ProjectDependencyPolicy>,
/// Rust-only Cargo dependency fetching (not an OS/network sandbox).
#[serde(default)]
dependency_resolution_policy: Option<webcodex_core::project_build::ProjectDependencyResolutionPolicy>,
dependency_resolution_policy:
Option<webcodex_core::project_build::ProjectDependencyResolutionPolicy>,
/// Total build execution budget, default 1800 seconds, clamped to 7 days.
/// Host handoff timing never extends this budget or starts a second build.
#[serde(default)]
Expand Down Expand Up @@ -1594,7 +1595,8 @@ pub enum ToolCall {
dependency_policy: Option<webcodex_core::project_validation::ProjectDependencyPolicy>,
/// Cargo dependency fetching only (not an OS network sandbox).
#[serde(default)]
dependency_resolution_policy: Option<webcodex_core::project_validation::ProjectDependencyResolutionPolicy>,
dependency_resolution_policy:
Option<webcodex_core::project_validation::ProjectDependencyResolutionPolicy>,
/// Test-only selector and count postconditions. Rust uses a libtest substring,
/// Go uses native -run regexp, and Python pytest uses -k. Node TAP supports
/// count requirements but rejects test filters. Omission keeps unfiltered positive-test proof by default.
Expand Down Expand Up @@ -1998,7 +2000,8 @@ pub enum ToolCall {
summary: String,
/// Exact keyed replay does not mutate; changed reuse conflicts.
#[schemars(length(min = 1, max = 128))]
idempotency_key: String, },
idempotency_key: String,
},

/// Open the readonly workbench. Empty arguments show a chooser; a Project is selected only
/// when explicitly supplied. Session selection never creates a recorder or execution context.
Expand Down Expand Up @@ -2463,95 +2466,16 @@ pub enum ToolCall {
},

/// Create a durable Server-owned Agent identity and mutable self-description card.
CreateAgentIdentity {
/// Mutable non-unique Agent handle. It is self-description metadata, not canonical identity or
/// authority.
#[schemars(length(min = 1, max = 64))]
#[schemars(regex(pattern = "^[A-Za-z0-9._-]+$"))]
handle: String,
/// Mutable non-unique Agent display name.
#[schemars(length(min = 1, max = 128))]
display_name: String,
#[schemars(extend("default" = ""))]
/// Optional Agent Card description, bounded by 2048 UTF-8 bytes server-side.
#[schemars(length(max = 2048))]
#[serde(default)]
description: Option<String>,
/// Bounded self-description labels. Labels never grant authority.
#[schemars(length(max = 16))]
#[schemars(inner(length(min = 1, max = 64)))]
#[serde(default)]
specialty_labels: Vec<String>,
/// Caller-generated operation key. Exact replay under the same communication principal returns the
/// original durable resource; reuse with changed input is rejected.
#[schemars(length(min = 1, max = 128))]
idempotency_key: String,
},
CreateAgentIdentity(CreateAgentIdentityInput),

/// List Agent identities owned by the current communication principal.
ListAgentIdentities {
/// Optional exact canonical Agent id owned by the current communication principal.
#[schemars(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
agent_id: Option<String>,
#[schemars(extend("default" = 0))]
/// Zero-based bounded page offset.
#[schemars(range(min = 0))]
#[serde(default)]
offset: Option<usize>,
#[schemars(extend("default" = 50))]
/// Maximum records to return. Values above 100 are accepted and clamped to 100.
#[schemars(range(min = 1))]
#[serde(default)]
limit: Option<usize>,
},
ListAgentIdentities(ListAgentIdentitiesInput),

/// CAS-update mutable Agent Card metadata without changing canonical identity.
UpdateAgentIdentity {
/// Canonical durable Agent id to update.
#[schemars(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$"))]
agent_id: String,
/// Exact profile revision fence. A stale value is rejected without mutation.
#[schemars(range(min = 1))]
expected_profile_revision: i64,
#[schemars(length(min = 1, max = 64))]
#[schemars(regex(pattern = "^[A-Za-z0-9._-]+$"))]
#[serde(default)]
handle: Option<String>,
/// Replacement display name.
#[schemars(length(min = 1, max = 128))]
#[serde(default)]
display_name: Option<String>,
/// Replacement description, bounded by 2048 UTF-8 bytes server-side.
#[schemars(length(max = 2048))]
#[serde(default)]
description: Option<String>,
/// Bounded self-description labels. Labels never grant authority.
#[schemars(length(max = 16))]
#[schemars(inner(length(min = 1, max = 64)))]
#[serde(default)]
specialty_labels: Option<Vec<String>>,
},
UpdateAgentIdentity(UpdateAgentIdentityInput),

/// Rotate the server-local continuation Endpoint/controller generation for a durable Agent.
RotateAgentContinuationEndpoint {
/// Canonical durable Agent id owned by the current communication principal.
#[schemars(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$"))]
agent_id: String,
/// Server-local continuation adapter label, for example ChatGPT. This is recorded metadata only: it
/// does not initiate, configure, or authorize an external connection.
#[schemars(length(min = 1, max = 64))]
host: String,
/// Optional opaque host-local attachment label copied into server-local Endpoint metadata. It is
/// not durable Agent identity, remote-host authority, or a connection selector.
#[schemars(length(max = 128))]
#[serde(default)]
client_attachment_id: Option<String>,
/// Caller-generated operation key. Exact replay under the same communication principal returns the
/// original durable resource; reuse with changed input is rejected.
#[schemars(length(min = 1, max = 128))]
idempotency_key: String,
},
RotateAgentContinuationEndpoint(RotateAgentContinuationEndpointInput),

/// Present one exact Agent/Endpoint continuation controller card. Never infers a target.
/// Pass agent_continuation_ref, or the explicit tuple. Do not pass both.
Expand Down Expand Up @@ -2679,173 +2603,25 @@ pub enum ToolCall {
},

/// Detach an Endpoint while preserving the durable Agent.
DetachAgentEndpoint {
/// Canonical Agent Endpoint id attached by the current communication principal.
#[schemars(regex(pattern = "^wc_endpoint_[A-Za-z0-9_-]{16}$"))]
endpoint_id: String,
},
DetachAgentEndpoint(DetachAgentEndpointInput),

/// Create a durable Conversation with the current Human principal and Agents.
CreateConversation {
/// Optional mutable room title.
#[schemars(length(max = 200))]
#[serde(default)]
title: Option<String>,
/// Owned Agent participants to add with the current Human principal.
#[schemars(length(min = 1, max = 16))]
#[schemars(inner(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$")))]
agent_ids: Vec<String>,
/// Caller-generated operation key. Exact replay under the same communication principal returns the
/// original durable resource; reuse with changed input is rejected.
#[schemars(length(min = 1, max = 128))]
idempotency_key: String,
},
CreateConversation(CreateConversationInput),

/// List Conversations for a Human view or an explicitly attached Agent view.
ListConversations {
/// Optional Agent view. Must be paired with exact Endpoint fencing; omit all three fields for the
/// current Human principal.
#[schemars(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
agent_id: Option<String>,
/// Active Endpoint proving the optional Agent view.
#[schemars(regex(pattern = "^wc_endpoint_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
endpoint_id: Option<String>,
/// Exact Server-assigned current Endpoint generation. Stale generations fail closed.
#[schemars(range(min = 1))]
#[serde(default)]
expected_controller_generation: Option<i64>,
#[schemars(extend("default" = 0))]
/// Zero-based bounded page offset.
#[schemars(range(min = 0))]
#[serde(default)]
offset: Option<usize>,
#[schemars(extend("default" = 50))]
/// Maximum records to return. Values above 100 are accepted and clamped to 100.
#[schemars(range(min = 1))]
#[serde(default)]
limit: Option<usize>,
},
ListConversations(ListConversationsInput),

/// Read an ordered append-only Conversation transcript page.
ReadConversation {
/// Canonical Conversation id.
#[schemars(regex(pattern = "^wc_conv_[A-Za-z0-9_-]{16}$"))]
conversation_id: String,
/// Optional Agent view. Must be paired with exact Endpoint fencing; omit all three fields for the
/// current Human principal.
#[schemars(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
agent_id: Option<String>,
/// Active Endpoint proving the optional Agent view.
#[schemars(regex(pattern = "^wc_endpoint_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
endpoint_id: Option<String>,
/// Exact Server-assigned current Endpoint generation. Stale generations fail closed.
#[schemars(range(min = 1))]
#[serde(default)]
expected_controller_generation: Option<i64>,
#[schemars(extend("default" = 0))]
/// Return append-only transcript messages with seq greater than this cursor.
#[schemars(range(min = 0))]
#[serde(default)]
after_seq: Option<i64>,
#[schemars(extend("default" = 50))]
/// Maximum records to return. Values above 100 are accepted and clamped to 100.
#[schemars(range(min = 1))]
#[serde(default)]
limit: Option<usize>,
},
ReadConversation(ReadConversationInput),

/// Atomically append a Message and recipient-specific Agent deliveries.
PostConversationMessage {
/// Canonical Conversation id.
#[schemars(regex(pattern = "^wc_conv_[A-Za-z0-9_-]{16}$"))]
conversation_id: String,
/// Append-only message body, bounded by 4096 UTF-8 bytes server-side.
#[schemars(length(min = 1, max = 4096))]
body: String,
/// Agent author provenance. Omit for the current Human principal; Agent authors require
/// endpoint_id.
#[schemars(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
author_agent_id: Option<String>,
/// Active Endpoint proving an Agent-authored message. Omit for Human authors.
#[schemars(regex(pattern = "^wc_endpoint_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
endpoint_id: Option<String>,
/// Exact Server-assigned current Endpoint generation. Stale generations fail closed.
#[schemars(range(min = 1))]
#[serde(default)]
expected_controller_generation: Option<i64>,
/// Optional explicit Agent Inbox recipients. Omit to deliver to every Agent participant except the
/// author; an explicit empty array posts to the transcript/room without Agent deliveries.
#[schemars(length(min = 0, max = 16))]
#[schemars(inner(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$")))]
#[serde(default)]
recipient_agent_ids: Option<Vec<String>>,
/// Optional parent Message in the same Conversation.
#[schemars(regex(pattern = "^wc_cmsg_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
reply_to: Option<String>,
/// Caller-generated operation key. Exact replay under the same communication principal returns the
/// original durable resource; reuse with changed input is rejected.
#[schemars(length(min = 1, max = 128))]
#[serde(default)]
idempotency_key: Option<String>,
/// Exact durable Wake that already crossed a Host dispatch or explicit-activation fence and
/// provides stable resumed-turn reply replay identity. Use with reply_operation_index instead of
/// idempotency_key.
#[schemars(regex(pattern = "^wc_wake_[A-Za-z0-9_-]{16}$"))]
#[serde(default)]
wake_reply_id: Option<String>,
/// Stable per-send index within one Wake. Reuse the same index only for an exact uncertain retry;
/// use a different index for each intentional additional Message.
#[schemars(range(min = 0, max = 31))]
#[serde(default)]
reply_operation_index: Option<i64>,
},
PostConversationMessage(PostConversationMessageInput),

/// List queued deliveries for an Agent proven by an active Endpoint.
ListAgentInbox {
/// Canonical recipient Agent id.
#[schemars(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$"))]
agent_id: String,
/// Active Endpoint proving access to this Agent Inbox.
#[schemars(regex(pattern = "^wc_endpoint_[A-Za-z0-9_-]{16}$"))]
endpoint_id: String,
/// Exact Server-assigned current Endpoint generation. Stale generations fail closed.
#[schemars(range(min = 1))]
expected_controller_generation: i64,
#[schemars(extend("default" = 0))]
/// Return queued deliveries with durable delivery_order greater than this cursor.
#[schemars(range(min = 0))]
#[serde(default)]
after_delivery_order: Option<i64>,
#[schemars(extend("default" = 50))]
/// Maximum records to return. Values above 100 are accepted and clamped to 100.
#[schemars(range(min = 1))]
#[serde(default)]
limit: Option<usize>,
},
ListAgentInbox(ListAgentInboxInput),

/// Mark exact recipient-specific Agent deliveries consumed.
ConsumeAgentDeliveries {
/// Canonical recipient Agent id.
#[schemars(regex(pattern = "^wc_dagent_[A-Za-z0-9_-]{16}$"))]
agent_id: String,
/// Active Endpoint proving access to this Agent Inbox.
#[schemars(regex(pattern = "^wc_endpoint_[A-Za-z0-9_-]{16}$"))]
endpoint_id: String,
/// Exact Server-assigned current Endpoint generation. Stale generations fail closed.
#[schemars(range(min = 1))]
expected_controller_generation: i64,
/// Deliveries to mark consumed. Repeating already-consumed ids is a safe desired-state retry.
#[schemars(length(min = 1, max = 100))]
#[schemars(inner(regex(pattern = "^wc_delivery_[A-Za-z0-9_-]{16}$")))]
delivery_ids: Vec<String>,
},
ConsumeAgentDeliveries(ConsumeAgentDeliveriesInput),

/// Verify one exact Agent/Endpoint activation and return bounded current
/// Conversation, Inbox, Wake, Host-binding, and reply-replay context.
Expand Down Expand Up @@ -4268,4 +4044,4 @@ pub enum ToolCall {
#[serde(default = "default_true")]
include_risk_summary: bool,
},
}
}
Loading
Loading