feat(tui): add usage report

This commit is contained in:
Felipe Coury
2026-05-21 15:09:14 -03:00
parent a6bedc8a7c
commit afafcc98ec
63 changed files with 2355 additions and 14 deletions
@@ -4030,6 +4030,24 @@
],
"type": "object"
},
"UsageRange": {
"enum": [
"day",
"week"
],
"type": "string"
},
"UsageReadParams": {
"properties": {
"range": {
"$ref": "#/definitions/UsageRange"
}
},
"required": [
"range"
],
"type": "object"
},
"UserInput": {
"oneOf": [
{
@@ -4829,6 +4847,30 @@
"title": "Plugin/listRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"usage/read"
],
"title": "Usage/readRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/UsageReadParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Usage/readRequest",
"type": "object"
},
{
"properties": {
"id": {
@@ -829,6 +829,30 @@
"title": "Plugin/listRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/v2/RequestId"
},
"method": {
"enum": [
"usage/read"
],
"title": "Usage/readRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/v2/UsageReadParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Usage/readRequest",
"type": "object"
},
{
"properties": {
"id": {
@@ -18555,6 +18579,169 @@
"title": "TurnSteerResponse",
"type": "object"
},
"UsageContributorKind": {
"enum": [
"skill",
"subagent",
"app",
"mcpServer",
"plugin"
],
"type": "string"
},
"UsageEntry": {
"properties": {
"attributedTokens": {
"format": "int64",
"type": "integer"
},
"id": {
"type": "string"
},
"kind": {
"$ref": "#/definitions/v2/UsageContributorKind"
},
"label": {
"type": "string"
},
"percentOfUsage": {
"format": "uint8",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"attributedTokens",
"id",
"kind",
"label",
"percentOfUsage"
],
"type": "object"
},
"UsageHeadline": {
"properties": {
"entry": {
"$ref": "#/definitions/v2/UsageEntry"
},
"note": {
"type": [
"string",
"null"
]
}
},
"required": [
"entry"
],
"type": "object"
},
"UsageRange": {
"enum": [
"day",
"week"
],
"type": "string"
},
"UsageReadParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"range": {
"$ref": "#/definitions/v2/UsageRange"
}
},
"required": [
"range"
],
"title": "UsageReadParams",
"type": "object"
},
"UsageReadResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"report": {
"$ref": "#/definitions/v2/UsageReport"
}
},
"required": [
"report"
],
"title": "UsageReadResponse",
"type": "object"
},
"UsageReport": {
"properties": {
"apps": {
"items": {
"$ref": "#/definitions/v2/UsageEntry"
},
"type": "array"
},
"generatedAt": {
"format": "int64",
"type": "integer"
},
"headline": {
"anyOf": [
{
"$ref": "#/definitions/v2/UsageHeadline"
},
{
"type": "null"
}
]
},
"mcpServers": {
"items": {
"$ref": "#/definitions/v2/UsageEntry"
},
"type": "array"
},
"plugins": {
"items": {
"$ref": "#/definitions/v2/UsageEntry"
},
"type": "array"
},
"range": {
"$ref": "#/definitions/v2/UsageRange"
},
"skills": {
"items": {
"$ref": "#/definitions/v2/UsageEntry"
},
"type": "array"
},
"subagents": {
"items": {
"$ref": "#/definitions/v2/UsageEntry"
},
"type": "array"
},
"totalTokens": {
"format": "int64",
"type": "integer"
},
"trackedFrom": {
"format": "int64",
"type": [
"integer",
"null"
]
}
},
"required": [
"apps",
"generatedAt",
"mcpServers",
"plugins",
"range",
"skills",
"subagents",
"totalTokens"
],
"type": "object"
},
"UserInput": {
"oneOf": [
{
@@ -1555,6 +1555,30 @@
"title": "Plugin/listRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"usage/read"
],
"title": "Usage/readRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/UsageReadParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Usage/readRequest",
"type": "object"
},
{
"properties": {
"id": {
@@ -16379,6 +16403,169 @@
"title": "TurnSteerResponse",
"type": "object"
},
"UsageContributorKind": {
"enum": [
"skill",
"subagent",
"app",
"mcpServer",
"plugin"
],
"type": "string"
},
"UsageEntry": {
"properties": {
"attributedTokens": {
"format": "int64",
"type": "integer"
},
"id": {
"type": "string"
},
"kind": {
"$ref": "#/definitions/UsageContributorKind"
},
"label": {
"type": "string"
},
"percentOfUsage": {
"format": "uint8",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"attributedTokens",
"id",
"kind",
"label",
"percentOfUsage"
],
"type": "object"
},
"UsageHeadline": {
"properties": {
"entry": {
"$ref": "#/definitions/UsageEntry"
},
"note": {
"type": [
"string",
"null"
]
}
},
"required": [
"entry"
],
"type": "object"
},
"UsageRange": {
"enum": [
"day",
"week"
],
"type": "string"
},
"UsageReadParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"range": {
"$ref": "#/definitions/UsageRange"
}
},
"required": [
"range"
],
"title": "UsageReadParams",
"type": "object"
},
"UsageReadResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"report": {
"$ref": "#/definitions/UsageReport"
}
},
"required": [
"report"
],
"title": "UsageReadResponse",
"type": "object"
},
"UsageReport": {
"properties": {
"apps": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"generatedAt": {
"format": "int64",
"type": "integer"
},
"headline": {
"anyOf": [
{
"$ref": "#/definitions/UsageHeadline"
},
{
"type": "null"
}
]
},
"mcpServers": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"plugins": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"range": {
"$ref": "#/definitions/UsageRange"
},
"skills": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"subagents": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"totalTokens": {
"format": "int64",
"type": "integer"
},
"trackedFrom": {
"format": "int64",
"type": [
"integer",
"null"
]
}
},
"required": [
"apps",
"generatedAt",
"mcpServers",
"plugins",
"range",
"skills",
"subagents",
"totalTokens"
],
"type": "object"
},
"UserInput": {
"oneOf": [
{
@@ -0,0 +1,22 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"UsageRange": {
"enum": [
"day",
"week"
],
"type": "string"
}
},
"properties": {
"range": {
"$ref": "#/definitions/UsageRange"
}
},
"required": [
"range"
],
"title": "UsageReadParams",
"type": "object"
}
@@ -0,0 +1,152 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"UsageContributorKind": {
"enum": [
"skill",
"subagent",
"app",
"mcpServer",
"plugin"
],
"type": "string"
},
"UsageEntry": {
"properties": {
"attributedTokens": {
"format": "int64",
"type": "integer"
},
"id": {
"type": "string"
},
"kind": {
"$ref": "#/definitions/UsageContributorKind"
},
"label": {
"type": "string"
},
"percentOfUsage": {
"format": "uint8",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"attributedTokens",
"id",
"kind",
"label",
"percentOfUsage"
],
"type": "object"
},
"UsageHeadline": {
"properties": {
"entry": {
"$ref": "#/definitions/UsageEntry"
},
"note": {
"type": [
"string",
"null"
]
}
},
"required": [
"entry"
],
"type": "object"
},
"UsageRange": {
"enum": [
"day",
"week"
],
"type": "string"
},
"UsageReport": {
"properties": {
"apps": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"generatedAt": {
"format": "int64",
"type": "integer"
},
"headline": {
"anyOf": [
{
"$ref": "#/definitions/UsageHeadline"
},
{
"type": "null"
}
]
},
"mcpServers": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"plugins": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"range": {
"$ref": "#/definitions/UsageRange"
},
"skills": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"subagents": {
"items": {
"$ref": "#/definitions/UsageEntry"
},
"type": "array"
},
"totalTokens": {
"format": "int64",
"type": "integer"
},
"trackedFrom": {
"format": "int64",
"type": [
"integer",
"null"
]
}
},
"required": [
"apps",
"generatedAt",
"mcpServers",
"plugins",
"range",
"skills",
"subagents",
"totalTokens"
],
"type": "object"
}
},
"properties": {
"report": {
"$ref": "#/definitions/UsageReport"
}
},
"required": [
"report"
],
"title": "UsageReadResponse",
"type": "object"
}