Skip to content

feat(apss): add AgentStateService protobuf schema#5

Merged
vitramir merged 20 commits intomainfrom
feat/apss-proto-v1
Feb 28, 2026
Merged

feat(apss): add AgentStateService protobuf schema#5
vitramir merged 20 commits intomainfrom
feat/apss-proto-v1

Conversation

@rowan-stein
Copy link
Collaborator

This PR adds the Agent Persistent State Service (APSS) protobuf schema:

  • Package: agynio.api.apss.v1
  • Service: AgentStateService
  • Endpoints:
    • AppendMessages (batch append, seq assigned, CAS via version)
    • ListMessages (filters by role/kind/seq, pagination)
    • ReplaceByKind (upsert singleton kinds, archive prior)
    • TrimBySeq (trim/archive by cutoff, optional protected kinds)
    • GetConversationMetadata (version, last_seq, message_count)
  • Message entity uses a single well-typed body: TextBody for now (images later via oneof extension), no external type references.
  • Conversation-level optimistic concurrency with version; monotonic seq per conversation for ordering and efficient trim.

After merge, platform runtime can consume this API as the persistence layer for stateless CLI LLM loop.

@rowan-stein rowan-stein requested a review from a team as a code owner February 26, 2026 14:45
@github-actions
Copy link

github-actions bot commented Feb 26, 2026

The latest Buf updates on your PR. Results from workflow buf-pr / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 28, 2026, 3:46 AM

@casey-brooks
Copy link
Contributor

Test & Lint

  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (no test suite)

@casey-brooks
Copy link
Contributor

Test & Lint

  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (not applicable)

message Message {
string id = 1; // server-assigned UUID
string conversation_id = 2; // routing key
int64 seq = 3; // monotonic per conversation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Role role = 4; // user | assistant | tool
string kind = 5; // free-form tag (e.g., system, summary, memory, restriction, tool_output)
MessageBody body = 6; // payload
MemoryAttrs memory = 7; // optional placement attributes (for memory kinds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

MessageBody body = 6; // payload
MemoryAttrs memory = 7; // optional placement attributes (for memory kinds)
google.protobuf.Timestamp created_at = 8;
bool archived = 9; // soft delete / superseded flag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

MemoryAttrs memory = 7; // optional placement attributes (for memory kinds)
google.protobuf.Timestamp created_at = 8;
bool archived = 9; // soft delete / superseded flag
google.protobuf.Timestamp archived_at = 10;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment on lines 94 to 95
int64 version = 2; // CAS token (monotonic)
int64 last_seq = 3; // highest seq among active messages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment on lines 142 to 143
int64 expect_version = 2;
string idempotency_key = 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment on lines 160 to 162
int64 expect_version = 2;
string idempotency_key = 3;
int64 anchor_seq = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

// Each snapshot item is a materialized message copy with integrity hash.
message SnapshotItem {
string message_id = 1; // original message id
int64 seq = 2; // original message seq
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment on lines 236 to 238
int64 seq_gte = 2;
int64 seq_lte = 3;
bool include_archived = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

bool include_archived = 4;
int32 page_size = 5;
string page_token = 6;
bool descending = 7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

@casey-brooks
Copy link
Contributor

Test & Lint

  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (not applicable)

Comment on lines 140 to 141
int64 expect_version = 2;
int64 anchor_seq = 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment on lines 214 to 215
int64 seq_gte = 2;
int64 seq_lte = 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

// Delete
message DeleteConversationMessagesRequest {
string conversation_id = 1;
int64 expect_version = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment on lines 108 to 109
int64 seq_gte = 4; // inclusive lower bound (optional)
int64 seq_lte = 5; // inclusive upper bound (optional)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete


message AppendConversationMessagesRequest {
string conversation_id = 1;
int64 expect_version = 2; // optimistic concurrency; 0 to bypass on create
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete


message ConversationMetadata {
string conversation_id = 1;
int64 version = 2; // CAS token (monotonic)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

@casey-brooks
Copy link
Contributor

Test & Lint

  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (not applicable)

@casey-brooks
Copy link
Contributor

Test & Lint

  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (not applicable)

@casey-brooks
Copy link
Contributor

Test & Lint

  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (not applicable)

vitramir
vitramir previously approved these changes Feb 28, 2026
@casey-brooks
Copy link
Contributor

Test & Lint

  • buf format -w .
  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (not applicable)

@casey-brooks
Copy link
Contributor

Test & Lint

  • buf format -w .
  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (not applicable)

@casey-brooks
Copy link
Contributor

Test & Lint

  • buf format -w .
  • buf lint — passed (no issues)
  • Tests: 0 passed / 0 failed / 0 skipped (not applicable)

@vitramir vitramir merged commit 070d9cc into main Feb 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants