okstra 0.100.0 → 0.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/runtime/BUILD.json
CHANGED
|
@@ -67,6 +67,47 @@ def _populate_execution_row(row: dict, source: dict) -> None:
|
|
|
67
67
|
row["cliCostUsd"] = usage["cliEstimatedCostUsd"]
|
|
68
68
|
|
|
69
69
|
|
|
70
|
+
def _worker_detail_label(worker: dict) -> str:
|
|
71
|
+
role = str(worker.get("role") or worker.get("workerId") or "Worker").strip()
|
|
72
|
+
agent = str(worker.get("agent") or "").strip()
|
|
73
|
+
status = str(worker.get("status") or "").strip()
|
|
74
|
+
suffix = ", ".join(value for value in (agent, status) if value)
|
|
75
|
+
return f"{role} ({suffix})" if suffix else role
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _worker_detail_row(label: str, usage: dict) -> dict:
|
|
79
|
+
if usage.get("source") == "unavailable":
|
|
80
|
+
return {
|
|
81
|
+
"label": label,
|
|
82
|
+
"totalTokens": None,
|
|
83
|
+
"billableTokens": None,
|
|
84
|
+
"costUsd": None,
|
|
85
|
+
"cliTotalTokens": None,
|
|
86
|
+
"cliCostUsd": None,
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
"label": label,
|
|
90
|
+
"totalTokens": usage.get("totalTokens"),
|
|
91
|
+
"billableTokens": usage.get("billableEquivalentTokens"),
|
|
92
|
+
"costUsd": usage.get("estimatedCostUsd"),
|
|
93
|
+
"cliTotalTokens": usage.get("cliTotalTokens"),
|
|
94
|
+
"cliCostUsd": usage.get("cliEstimatedCostUsd"),
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _worker_detail_rows(team_state: dict) -> list[dict]:
|
|
99
|
+
rows = []
|
|
100
|
+
for worker in team_state.get("workers") or []:
|
|
101
|
+
if isinstance(worker, dict):
|
|
102
|
+
rows.append(
|
|
103
|
+
_worker_detail_row(_worker_detail_label(worker), worker.get("usage") or {})
|
|
104
|
+
)
|
|
105
|
+
unattributed = (team_state.get("usageSummary") or {}).get("unattributedWorkerUsage")
|
|
106
|
+
if isinstance(unattributed, dict):
|
|
107
|
+
rows.append(_worker_detail_row("Unattributed worker usage", unattributed))
|
|
108
|
+
return rows
|
|
109
|
+
|
|
110
|
+
|
|
70
111
|
def populate_data_token_cells(data_path: Path, team_state: dict) -> int:
|
|
71
112
|
"""Mutate ``data_path`` (final-report data.json) in place: fill
|
|
72
113
|
``tokenUsage`` rows and ``executionStatus`` row token cells from
|
|
@@ -122,6 +163,7 @@ def populate_data_token_cells(data_path: Path, team_state: dict) -> int:
|
|
|
122
163
|
"costUsd": lead_cost + worker_cost,
|
|
123
164
|
})
|
|
124
165
|
token_usage.setdefault("cli", {})["costUsd"] = cli_cost
|
|
166
|
+
token_usage["workerDetails"] = _worker_detail_rows(team_state)
|
|
125
167
|
changes += 4
|
|
126
168
|
|
|
127
169
|
# Execution Status by Agent — per-row token / cost / duration.
|
|
@@ -227,6 +227,11 @@
|
|
|
227
227
|
"lead": { "$ref": "#/$defs/TokenUsageRow" },
|
|
228
228
|
"worker": { "$ref": "#/$defs/TokenUsageRow" },
|
|
229
229
|
"grand": { "$ref": "#/$defs/TokenUsageRow" },
|
|
230
|
+
"workerDetails": {
|
|
231
|
+
"type": "array",
|
|
232
|
+
"description": "Optional Phase 7 expansion rows rendered under the Worker subtotal.",
|
|
233
|
+
"items": { "$ref": "#/$defs/TokenUsageWorkerDetailRow" }
|
|
234
|
+
},
|
|
230
235
|
"cli": {
|
|
231
236
|
"type": "object",
|
|
232
237
|
"additionalProperties": false,
|
|
@@ -968,6 +973,52 @@
|
|
|
968
973
|
}
|
|
969
974
|
},
|
|
970
975
|
|
|
976
|
+
"TokenUsageWorkerDetailRow": {
|
|
977
|
+
"type": "object",
|
|
978
|
+
"required": [
|
|
979
|
+
"label",
|
|
980
|
+
"totalTokens",
|
|
981
|
+
"billableTokens",
|
|
982
|
+
"costUsd",
|
|
983
|
+
"cliTotalTokens",
|
|
984
|
+
"cliCostUsd"
|
|
985
|
+
],
|
|
986
|
+
"additionalProperties": false,
|
|
987
|
+
"properties": {
|
|
988
|
+
"label": { "type": "string", "minLength": 1 },
|
|
989
|
+
"totalTokens": {
|
|
990
|
+
"oneOf": [
|
|
991
|
+
{ "type": "integer", "minimum": 0 },
|
|
992
|
+
{ "type": "null" }
|
|
993
|
+
]
|
|
994
|
+
},
|
|
995
|
+
"billableTokens": {
|
|
996
|
+
"oneOf": [
|
|
997
|
+
{ "type": "integer", "minimum": 0 },
|
|
998
|
+
{ "type": "null" }
|
|
999
|
+
]
|
|
1000
|
+
},
|
|
1001
|
+
"costUsd": {
|
|
1002
|
+
"oneOf": [
|
|
1003
|
+
{ "type": "number", "minimum": 0 },
|
|
1004
|
+
{ "type": "null" }
|
|
1005
|
+
]
|
|
1006
|
+
},
|
|
1007
|
+
"cliTotalTokens": {
|
|
1008
|
+
"oneOf": [
|
|
1009
|
+
{ "type": "integer", "minimum": 0 },
|
|
1010
|
+
{ "type": "null" }
|
|
1011
|
+
]
|
|
1012
|
+
},
|
|
1013
|
+
"cliCostUsd": {
|
|
1014
|
+
"oneOf": [
|
|
1015
|
+
{ "type": "number", "minimum": 0 },
|
|
1016
|
+
{ "type": "null" }
|
|
1017
|
+
]
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1021
|
+
|
|
971
1022
|
"RoundHistoryRow": {
|
|
972
1023
|
"type": "object",
|
|
973
1024
|
"required": [
|
|
@@ -686,6 +686,9 @@ implementation-option: {{ frontmatter.implementationOption | yaml_scalar }}
|
|
|
686
686
|
|------|-----------|------------------------|------------|
|
|
687
687
|
| {{ t("tokenSummary.rowLead") }} | `{{ tokenUsage.lead.totalTokens | format_int }}` | `{{ tokenUsage.lead.billableTokens | format_int }}` | `{{ tokenUsage.lead.costUsd | format_usd }}` |
|
|
688
688
|
| {{ t("tokenSummary.rowWorkerTotal") }} | `{{ tokenUsage.worker.totalTokens | format_int }}` | `{{ tokenUsage.worker.billableTokens | format_int }}` | `{{ tokenUsage.worker.costUsd | format_usd }}` |
|
|
689
|
+
{% for row in tokenUsage.workerDetails or [] -%}
|
|
690
|
+
| - {{ row.label | mdcell }} | `{{ row.totalTokens | format_int }}`{% if row.cliTotalTokens is not none and row.cliTotalTokens > 0 %}<br>CLI: `{{ row.cliTotalTokens | format_int }}`{% endif %} | `{{ row.billableTokens | format_int }}` | `{{ row.costUsd | format_usd }}`{% if row.cliCostUsd is not none and row.cliCostUsd > 0 %}<br>+ CLI `{{ row.cliCostUsd | format_usd }}`{% endif %} |
|
|
691
|
+
{% endfor -%}
|
|
689
692
|
| {{ t("tokenSummary.rowGrandTotal") }} | **`{{ tokenUsage.grand.totalTokens | format_int }}`** | **`{{ tokenUsage.grand.billableTokens | format_int }}`** | **`{{ tokenUsage.grand.costUsd | format_usd }}`** |
|
|
690
693
|
{% if tokenUsage.cli and tokenUsage.cli.costUsd is not none and tokenUsage.cli.costUsd > 0 -%}
|
|
691
694
|
| {{ t("tokenSummary.rowCliExtra") }} | | | `{{ tokenUsage.cli.costUsd | format_usd }}` |
|