Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

10.9 KB
Raw Blame
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "agent-core/agent-event.schema.json",
  "title": "AgentEvent",
  "description": "C-4 event yielded by Agent.run. In-process only; never persisted as-is. Committed context lives in C-5 rows, which events reference by id. Mapping to Avibe outputs: loop-control.md section 6.",
  "type": "object",
  "required": [
    "type",
    "turn_id",
    "seq"
  ],
  "properties": {
    "type": {
      "enum": [
        "run_started",
        "text_delta",
        "thinking_delta",
        "message_committed",
        "tool_started",
        "tool_progress",
        "tool_finished",
        "steer_applied",
        "compaction_started",
        "compaction_finished",
        "compaction_failed",
        "context_exhausted",
        "run_ended",
        "error"
      ]
    },
    "turn_id": {
      "type": "string",
      "description": "`session_turns.id` of the Turn the run belongs to, the same identity as `agent_events.turn_id`. The Harness Run id (`agent_events.run_id`) is known to the adapter and not carried here."
    },
    "seq": {
      "type": "integer",
      "minimum": 0,
      "description": "Monotonic within the run."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "type": {
            "enum": [
              "text_delta",
              "thinking_delta"
            ]
          }
        }
      },
      "then": {
        "required": [
          "delta"
        ],
        "properties": {
          "delta": {
            "type": "string"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "message_committed"
          }
        }
      },
      "then": {
        "required": [
          "message_id",
          "context_seq",
          "final"
        ],
        "properties": {
          "message_id": {
            "type": "string",
            "description": "`messages.id` of the committed assistant row."
          },
          "context_seq": {
            "type": "integer"
          },
          "final": {
            "type": "boolean",
            "description": "True for the run's final response (`result` row)."
          },
          "superseded": {
            "type": "boolean",
            "default": false,
            "description": "True for a non-final response that is a completed reply pending input took the final word from: tool-free, not failed, a reply (`has_reply`), not stopped at its output limit, and committed non-final only because a steer or follow-up was pending. Its row commits as `result`, a reply that does not end the Turn (released versions committed `output`). Never true for narration beside tool calls, a stream error's partial, or a truncated reply."
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "tool_started"
          }
        }
      },
      "then": {
        "required": [
          "tool_call_id",
          "name",
          "preview"
        ],
        "properties": {
          "tool_call_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "preview": {
            "type": "string",
            "maxLength": 500,
            "description": "Display preview of the arguments."
          },
          "job_id": {
            "type": "string"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "tool_progress"
          }
        }
      },
      "then": {
        "required": [
          "tool_call_id",
          "tail"
        ],
        "properties": {
          "tool_call_id": {
            "type": "string"
          },
          "tail": {
            "type": "string",
            "description": "Latest output lines, normalized."
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "tool_finished"
          }
        }
      },
      "then": {
        "required": [
          "tool_call_id",
          "event_id",
          "is_error"
        ],
        "properties": {
          "tool_call_id": {
            "type": "string"
          },
          "event_id": {
            "type": "string",
            "description": "`agent_events.id` of the committed tool_result row."
          },
          "is_error": {
            "type": "boolean"
          },
          "watch_id": {
            "type": "string",
            "description": "Present when the job was handed to Watch."
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "steer_applied"
          }
        }
      },
      "then": {
        "required": [
          "message_id"
        ],
        "properties": {
          "message_id": {
            "type": "string"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "compaction_finished"
          }
        }
      },
      "then": {
        "required": [
          "event_id",
          "reason",
          "mode",
          "tokens_before",
          "tokens_after_estimate"
        ],
        "properties": {
          "event_id": {
            "type": "string"
          },
          "reason": {
            "enum": [
              "threshold",
              "overflow"
            ]
          },
          "mode": {
            "enum": [
              "normal",
              "rolling",
              "dropped"
            ]
          },
          "tokens_before": {
            "type": "integer",
            "minimum": 0
          },
          "tokens_after_estimate": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "compaction_failed"
          }
        }
      },
      "then": {
        "required": [
          "reason",
          "error"
        ],
        "properties": {
          "reason": {
            "enum": [
              "threshold",
              "overflow"
            ]
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "compaction_started"
          }
        }
      },
      "then": {
        "required": [
          "reason"
        ],
        "properties": {
          "reason": {
            "enum": [
              "threshold",
              "overflow"
            ]
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "context_exhausted"
          }
        }
      },
      "then": {
        "description": "The overflow ladder could not make the request fit (context.md section 8 d): what fills the context, for the adapter's stop message. The run then ends `context_exhausted`.",
        "required": [
          "limit",
          "parts"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "description": "L_in of the hop."
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "tokens"
              ],
              "additionalProperties": false,
              "properties": {
                "name": {
                  "enum": [
                    "system",
                    "tools",
                    "history",
                    "current_request",
                    "latest_tool_batch",
                    "output"
                  ]
                },
                "tokens": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "description": "Estimated tokens of the request's parts: `history` is everything before the last unit (the checkpoint included), the last unit is `current_request` (an input) or `latest_tool_batch` (a response and its results), and `output` is the reserved max_tokens plus the margin M."
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "run_ended"
          }
        }
      },
      "then": {
        "required": [
          "reason"
        ],
        "properties": {
          "reason": {
            "enum": [
              "completed",
              "aborted",
              "error",
              "ended_by_hook",
              "context_exhausted"
            ]
          },
          "cause": {
            "description": "The error event that decided the reason (the first cause), when an error did; a diagnostic never does.",
            "type": "object",
            "required": [
              "kind",
              "message",
              "origin"
            ],
            "properties": {
              "kind": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": { "type": "boolean", "default": false },
              "continuable": { "type": "boolean", "default": false },
              "retry_after_s": { "type": ["number", "null"], "minimum": 0 },
              "origin": {
                "enum": [
                  "source",
                  "local"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "error"
          }
        }
      },
      "then": {
        "required": [
          "kind",
          "message",
          "origin"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "retryable": { "type": "boolean", "default": false },
          "continuable": { "type": "boolean", "default": false },
          "retry_after_s": { "type": ["number", "null"], "minimum": 0 },
          "origin": {
            "description": "source: the served model produced the failure (a provider error other than an overflow, an answer the loop rejected, a response the transcript cannot hold); local: everything else (a Stop, an overflow or context exhaustion, a hook, tool, or store error).",
            "enum": [
              "source",
              "local"
            ]
          }
        }
      }
    }
  ],
  "examples": [
    {
      "type": "tool_started",
      "turn_id": "trn_3f9c2a71",
      "seq": 14,
      "tool_call_id": "toolu_01AbC",
      "name": "bash",
      "preview": "pytest tests/test_paths.py -q",
      "job_id": "job_31c"
    },
    {
      "type": "tool_finished",
      "turn_id": "trn_3f9c2a71",
      "seq": 19,
      "tool_call_id": "toolu_01AbC",
      "event_id": "evt_0065cd1a2b",
      "is_error": false,
      "watch_id": "wch_8f2k"
    }
  ]
}