feat(api): add optional AgentDelegation metadata for Stage 8

Additive Message/AgentPostMessage fields so agents can route INVESTIGATE tasks without spoofable human HTTP posts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kaien 2026-08-10 17:39:45 +03:00
parent a50cd3a886
commit 848fe6ed79
2 changed files with 314 additions and 191 deletions

File diff suppressed because it is too large Load Diff

View File

@ -143,6 +143,17 @@ message Topic {
google.protobuf.Timestamp created_at = 4; google.protobuf.Timestamp created_at = 4;
} }
// AgentDelegation is optional machine-readable routing metadata on AGENT
// messages. Text content remains the human-readable task description;
// delegation only carries deterministic target + kind. Delegation is NOT
// human approval and does NOT authorize mutation.
message AgentDelegation {
// Canonical Chat author_id (UUID) of the target AGENT participant.
string target_author_id = 1;
// Stage 8 kinds: INVESTIGATE.
string kind = 2;
}
message Message { message Message {
string id = 1; // UUID, canonical message id string id = 1; // UUID, canonical message id
int64 sequence = 2; // server-assigned monotonic sequence (ordering + durable cursor) int64 sequence = 2; // server-assigned monotonic sequence (ordering + durable cursor)
@ -155,6 +166,8 @@ message Message {
string root_message_id = 9; // root of the reply chain (== id for non-replies) string root_message_id = 9; // root of the reply chain (== id for non-replies)
int32 reply_depth = 10; // 0 for non-replies, parent depth + 1 for replies; hard max 20 int32 reply_depth = 10; // 0 for non-replies, parent depth + 1 for replies; hard max 20
google.protobuf.Timestamp created_at = 11; // original creation time; age = now - created_at google.protobuf.Timestamp created_at = 11; // original creation time; age = now - created_at
// Optional; only set on AGENT messages that intentionally delegate.
optional AgentDelegation delegation = 12;
} }
message ListTopicsRequest {} message ListTopicsRequest {}
@ -190,6 +203,8 @@ message PostMessageRequest {
// Idempotency key: retrying PostMessage with the same author_id and key // Idempotency key: retrying PostMessage with the same author_id and key
// returns the original message instead of creating a duplicate. // returns the original message instead of creating a duplicate.
string idempotency_key = 7; string idempotency_key = 7;
// Agents must not use this path; Human HTTP PostMessage rejects delegation.
optional AgentDelegation delegation = 8;
} }
message AgentPostMessageRequest { message AgentPostMessageRequest {
@ -199,6 +214,9 @@ message AgentPostMessageRequest {
// Mandatory: retrying with the same key returns the original message // Mandatory: retrying with the same key returns the original message
// (duplicated=true) instead of creating a duplicate. // (duplicated=true) instead of creating a duplicate.
string idempotency_key = 4; string idempotency_key = 4;
// Optional machine-readable delegation. Server validates target is an
// existing AGENT participant; sender identity comes from auth, not client.
optional AgentDelegation delegation = 5;
} }
message PostMessageResponse { message PostMessageResponse {