Files
EvoScientist-WebUI/docs/schemas/usage-event-v1.schema.json
m4 fe982f7f95
CI / macos-latest / Node 20 (push) Has been cancelled
CI / ubuntu-latest / Node 20 (push) Has been cancelled
CI / windows-latest / Node 20 (push) Has been cancelled
feat: add workspace isolation and administration UI
2026-07-19 12:17:18 +08:00

156 lines
4.5 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://evoscientist.dev/schemas/usage-event-v1.schema.json",
"title": "EvoScientist UsageEvent v1",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"event_id",
"event_type",
"source",
"authority_class",
"revision",
"deployment_id",
"workspace_id",
"model_call_id",
"parent_run_id",
"provider_request_id",
"thread_id",
"source_session_id",
"turn_id",
"workspace_dir",
"scope",
"source_agent",
"provider_profile_id",
"provider_revision",
"provider_adapter",
"model_alias",
"upstream_model_id",
"usage_status",
"input_tokens",
"output_tokens",
"provider_total_tokens",
"input_token_details",
"output_token_details",
"started_at",
"observed_at",
"completed_at"
],
"$defs": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 256,
"pattern": "^[^\\u0000-\\u001f\\u007f]+$"
},
"nullableId": { "anyOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }] },
"modelString": {
"type": "string",
"minLength": 1,
"maxLength": 512,
"pattern": "^[^\\u0000-\\u001f\\u007f]+$"
},
"utcTime": { "type": "string", "format": "date-time", "pattern": "Z$" },
"nullableTime": {
"anyOf": [{ "$ref": "#/$defs/utcTime" }, { "type": "null" }]
},
"token": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
"nullableToken": {
"anyOf": [{ "$ref": "#/$defs/token" }, { "type": "null" }]
},
"details": {
"type": "object",
"propertyNames": {
"minLength": 1,
"maxLength": 128,
"pattern": "^[^\\u0000-\\u001f\\u007f]+$"
},
"additionalProperties": { "$ref": "#/$defs/token" }
}
},
"properties": {
"schema_version": { "const": 1 },
"event_id": {
"type": "string",
"minLength": 1,
"maxLength": 1024,
"pattern": "^[^\\u0000-\\u001f\\u007f]+$"
},
"event_type": { "const": "usage_observed" },
"source": { "const": "callback_final" },
"authority_class": { "const": "observed_final" },
"revision": { "const": 1 },
"deployment_id": { "$ref": "#/$defs/id" },
"workspace_id": { "$ref": "#/$defs/id" },
"model_call_id": { "$ref": "#/$defs/id" },
"parent_run_id": { "$ref": "#/$defs/nullableId" },
"provider_request_id": { "$ref": "#/$defs/nullableId" },
"thread_id": { "$ref": "#/$defs/nullableId" },
"source_session_id": { "$ref": "#/$defs/nullableId" },
"turn_id": { "$ref": "#/$defs/nullableId" },
"workspace_dir": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 4096,
"pattern": "^[^\\u0000-\\u001f\\u007f]+$"
},
{ "type": "null" }
]
},
"scope": {
"enum": [
"main",
"sync_subagent",
"async_subagent",
"tool_selector",
"summarizer",
"memory",
"scheduler",
"autoskills",
"diagnostic",
"skill_eval",
"unattributed"
]
},
"source_agent": { "$ref": "#/$defs/nullableId" },
"provider_profile_id": { "$ref": "#/$defs/modelString" },
"provider_revision": { "$ref": "#/$defs/nullableId" },
"provider_adapter": { "$ref": "#/$defs/modelString" },
"model_alias": { "$ref": "#/$defs/modelString" },
"upstream_model_id": { "$ref": "#/$defs/modelString" },
"usage_status": { "enum": ["confirmed", "unknown"] },
"input_tokens": { "$ref": "#/$defs/nullableToken" },
"output_tokens": { "$ref": "#/$defs/nullableToken" },
"provider_total_tokens": { "$ref": "#/$defs/nullableToken" },
"input_token_details": { "$ref": "#/$defs/details" },
"output_token_details": { "$ref": "#/$defs/details" },
"started_at": { "$ref": "#/$defs/nullableTime" },
"observed_at": { "$ref": "#/$defs/utcTime" },
"completed_at": { "$ref": "#/$defs/utcTime" }
},
"allOf": [
{
"if": { "properties": { "usage_status": { "const": "confirmed" } } },
"then": {
"properties": {
"input_tokens": { "$ref": "#/$defs/token" },
"output_tokens": { "$ref": "#/$defs/token" }
}
}
},
{
"if": { "properties": { "usage_status": { "const": "unknown" } } },
"then": {
"properties": {
"input_tokens": { "type": "null" },
"output_tokens": { "type": "null" },
"provider_total_tokens": { "type": "null" }
}
}
}
]
}