arkaos 3.27.0 → 3.28.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/VERSION +1 -1
- package/core/runtime/__pycache__/llm_provider.cpython-313.pyc +0 -0
- package/core/runtime/llm_provider.py +1 -0
- package/dashboard/app/pages/workflows.vue +92 -4
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/__pycache__/dashboard-api.cpython-313.pyc +0 -0
- package/scripts/dashboard-api.py +69 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.28.0
|
|
Binary file
|
|
@@ -368,6 +368,7 @@ def _current_category() -> str:
|
|
|
368
368
|
PR60 v2.77.0 — orchestration layers can set
|
|
369
369
|
``ARKA_CALL_CATEGORY=skill:<slug>`` /
|
|
370
370
|
``subagent:<dept>`` or ``subagent:<dept>:<agent_id>`` /
|
|
371
|
+
``workflow:<workflow_id>`` /
|
|
371
372
|
``plugin:<id>`` / ``mcp:<server>`` before
|
|
372
373
|
invoking the provider so `/arka costs --by-category` (PR47) can
|
|
373
374
|
attribute spend. Returns "" when unset, which lands in the base
|
|
@@ -19,9 +19,38 @@ interface Workflow {
|
|
|
19
19
|
content: string
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const { fetchApi } = useApi()
|
|
22
|
+
const { fetchApi, apiBase } = useApi()
|
|
23
23
|
const { data, status, error, refresh } = await fetchApi<{ workflows: Workflow[] }>('/api/workflows')
|
|
24
24
|
|
|
25
|
+
// PR89b v3.28.0 — recent runs for the selected workflow.
|
|
26
|
+
interface WorkflowRun {
|
|
27
|
+
session_id: string
|
|
28
|
+
started_at: string
|
|
29
|
+
ended_at: string
|
|
30
|
+
duration_s: number | null
|
|
31
|
+
calls: number
|
|
32
|
+
cost_usd: number | null
|
|
33
|
+
tokens_in: number
|
|
34
|
+
tokens_out: number
|
|
35
|
+
}
|
|
36
|
+
const runs = ref<WorkflowRun[]>([])
|
|
37
|
+
const runsLoading = ref(false)
|
|
38
|
+
const sidePanelTab = ref<'yaml' | 'runs'>('yaml')
|
|
39
|
+
|
|
40
|
+
async function loadRuns(id: string) {
|
|
41
|
+
runsLoading.value = true
|
|
42
|
+
try {
|
|
43
|
+
const res = await $fetch<{ runs: WorkflowRun[] }>(
|
|
44
|
+
`${apiBase}/api/workflows/${id}/runs?limit=10`,
|
|
45
|
+
)
|
|
46
|
+
runs.value = res.runs ?? []
|
|
47
|
+
} catch {
|
|
48
|
+
runs.value = []
|
|
49
|
+
} finally {
|
|
50
|
+
runsLoading.value = false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
25
54
|
const workflows = computed(() => data.value?.workflows ?? [])
|
|
26
55
|
const search = ref('')
|
|
27
56
|
const deptFilter = ref<'all' | string>('all')
|
|
@@ -123,7 +152,7 @@ const columns: TableColumn<Workflow>[] = [
|
|
|
123
152
|
th: 'py-2 first:rounded-l-lg last:rounded-r-lg border-y border-default first:border-l last:border-r',
|
|
124
153
|
td: 'border-b border-default',
|
|
125
154
|
}"
|
|
126
|
-
@select="(row: { original: Workflow }) => selected = row.original"
|
|
155
|
+
@select="(row: { original: Workflow }) => { selected = row.original; sidePanelTab = 'yaml'; runs = []; loadRuns(row.original.id) }"
|
|
127
156
|
>
|
|
128
157
|
<template #name-cell="{ row }">
|
|
129
158
|
<div class="min-w-0">
|
|
@@ -160,7 +189,7 @@ const columns: TableColumn<Workflow>[] = [
|
|
|
160
189
|
<div class="px-4 py-3 border-b border-default bg-elevated/30">
|
|
161
190
|
<div class="flex items-start justify-between gap-3">
|
|
162
191
|
<div class="min-w-0">
|
|
163
|
-
<p class="text-xs text-muted uppercase tracking-wide">
|
|
192
|
+
<p class="text-xs text-muted uppercase tracking-wide">Workflow</p>
|
|
164
193
|
<p class="font-semibold truncate">{{ selected.name }}</p>
|
|
165
194
|
<p class="text-xs text-muted font-mono truncate">{{ selected.file }}</p>
|
|
166
195
|
</div>
|
|
@@ -175,8 +204,67 @@ const columns: TableColumn<Workflow>[] = [
|
|
|
175
204
|
<p v-if="selected.description" class="text-xs text-muted mt-2">
|
|
176
205
|
{{ selected.description }}
|
|
177
206
|
</p>
|
|
207
|
+
<div class="flex items-center gap-1 mt-3 text-xs">
|
|
208
|
+
<button
|
|
209
|
+
type="button"
|
|
210
|
+
class="px-2 py-1 rounded-md transition-colors"
|
|
211
|
+
:class="sidePanelTab === 'yaml' ? 'bg-elevated/60 text-default font-semibold' : 'text-muted hover:text-default'"
|
|
212
|
+
@click="sidePanelTab = 'yaml'"
|
|
213
|
+
>
|
|
214
|
+
YAML
|
|
215
|
+
</button>
|
|
216
|
+
<button
|
|
217
|
+
type="button"
|
|
218
|
+
class="px-2 py-1 rounded-md transition-colors"
|
|
219
|
+
:class="sidePanelTab === 'runs' ? 'bg-elevated/60 text-default font-semibold' : 'text-muted hover:text-default'"
|
|
220
|
+
@click="sidePanelTab = 'runs'"
|
|
221
|
+
>
|
|
222
|
+
Runs
|
|
223
|
+
</button>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
<div v-if="sidePanelTab === 'yaml'" class="overflow-x-auto">
|
|
227
|
+
<pre class="p-4 text-xs font-mono whitespace-pre">{{ selected.content }}</pre>
|
|
228
|
+
</div>
|
|
229
|
+
<div v-else class="p-4">
|
|
230
|
+
<div v-if="runsLoading" class="py-6 text-center text-sm text-muted">
|
|
231
|
+
<UIcon name="i-lucide-loader-2" class="size-4 animate-spin inline" /> Loading…
|
|
232
|
+
</div>
|
|
233
|
+
<div v-else-if="!runs.length" class="py-6 text-center text-sm text-muted">
|
|
234
|
+
<UIcon name="i-lucide-history" class="size-6 mx-auto mb-2" />
|
|
235
|
+
No recorded runs yet. Set
|
|
236
|
+
<code class="font-mono text-xs">ARKA_CALL_CATEGORY=workflow:{{ selected.id }}</code>
|
|
237
|
+
in the orchestrator to populate this.
|
|
238
|
+
</div>
|
|
239
|
+
<ul v-else class="space-y-2">
|
|
240
|
+
<li
|
|
241
|
+
v-for="r in runs"
|
|
242
|
+
:key="r.session_id"
|
|
243
|
+
class="rounded-lg border border-default p-3"
|
|
244
|
+
>
|
|
245
|
+
<div class="flex items-center justify-between gap-3 text-xs">
|
|
246
|
+
<span class="font-mono text-muted truncate">{{ r.session_id }}</span>
|
|
247
|
+
<span class="text-muted shrink-0">{{ r.started_at }}</span>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="flex items-center gap-3 text-xs mt-2">
|
|
250
|
+
<span>
|
|
251
|
+
<span class="text-muted">Calls</span>
|
|
252
|
+
<span class="font-mono font-semibold ml-1">{{ r.calls }}</span>
|
|
253
|
+
</span>
|
|
254
|
+
<span>
|
|
255
|
+
<span class="text-muted">Cost</span>
|
|
256
|
+
<span class="font-mono font-semibold ml-1">
|
|
257
|
+
{{ r.cost_usd === null ? '—' : `$${r.cost_usd.toFixed(3)}` }}
|
|
258
|
+
</span>
|
|
259
|
+
</span>
|
|
260
|
+
<span v-if="r.duration_s !== null">
|
|
261
|
+
<span class="text-muted">Duration</span>
|
|
262
|
+
<span class="font-mono font-semibold ml-1">{{ r.duration_s }}s</span>
|
|
263
|
+
</span>
|
|
264
|
+
</div>
|
|
265
|
+
</li>
|
|
266
|
+
</ul>
|
|
178
267
|
</div>
|
|
179
|
-
<pre class="p-4 text-xs font-mono overflow-x-auto whitespace-pre">{{ selected.content }}</pre>
|
|
180
268
|
</div>
|
|
181
269
|
<div
|
|
182
270
|
v-else
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
Binary file
|
package/scripts/dashboard-api.py
CHANGED
|
@@ -1617,6 +1617,75 @@ def department_detail(dept_id: str):
|
|
|
1617
1617
|
|
|
1618
1618
|
# --- Workflows (PR88b v3.24.0) ---
|
|
1619
1619
|
|
|
1620
|
+
@app.get("/api/workflows/{workflow_id}/runs")
|
|
1621
|
+
def workflow_runs(workflow_id: str, limit: int = 20):
|
|
1622
|
+
"""PR89b v3.28.0 — list recent runs of a workflow.
|
|
1623
|
+
|
|
1624
|
+
Parses the PR47 cost telemetry JSONL for rows tagged
|
|
1625
|
+
``workflow:<workflow_id>`` and groups them by ``session_id``.
|
|
1626
|
+
Returns ``{runs: [{session_id, started_at, ended_at, duration_s,
|
|
1627
|
+
calls, cost_usd, tokens_in, tokens_out}]}`` sorted desc by start.
|
|
1628
|
+
|
|
1629
|
+
Workflows must set ``ARKA_CALL_CATEGORY=workflow:<id>`` before
|
|
1630
|
+
each call for this to populate. Returns an empty list when no
|
|
1631
|
+
matching entries exist (the common case until orchestrators opt in).
|
|
1632
|
+
"""
|
|
1633
|
+
target_category = f"workflow:{workflow_id}"
|
|
1634
|
+
try:
|
|
1635
|
+
from core.runtime.llm_cost_telemetry import _load_slice
|
|
1636
|
+
except Exception:
|
|
1637
|
+
return {"runs": []}
|
|
1638
|
+
entries, _ = _load_slice(None, None)
|
|
1639
|
+
sessions: dict[str, dict] = {}
|
|
1640
|
+
for entry in entries:
|
|
1641
|
+
if entry.get("category") != target_category:
|
|
1642
|
+
continue
|
|
1643
|
+
sid = str(entry.get("session_id") or "")
|
|
1644
|
+
if not sid:
|
|
1645
|
+
continue
|
|
1646
|
+
ts = entry.get("ts") or ""
|
|
1647
|
+
bucket = sessions.setdefault(sid, {
|
|
1648
|
+
"session_id": sid,
|
|
1649
|
+
"started_at": ts,
|
|
1650
|
+
"ended_at": ts,
|
|
1651
|
+
"calls": 0,
|
|
1652
|
+
"cost_usd": 0.0,
|
|
1653
|
+
"any_cost_known": False,
|
|
1654
|
+
"tokens_in": 0,
|
|
1655
|
+
"tokens_out": 0,
|
|
1656
|
+
})
|
|
1657
|
+
bucket["calls"] += 1
|
|
1658
|
+
if ts and ts < bucket["started_at"]:
|
|
1659
|
+
bucket["started_at"] = ts
|
|
1660
|
+
if ts and ts > bucket["ended_at"]:
|
|
1661
|
+
bucket["ended_at"] = ts
|
|
1662
|
+
bucket["tokens_in"] += int(entry.get("tokens_in") or 0)
|
|
1663
|
+
bucket["tokens_out"] += int(entry.get("tokens_out") or 0)
|
|
1664
|
+
cost = entry.get("estimated_cost_usd")
|
|
1665
|
+
if isinstance(cost, (int, float)):
|
|
1666
|
+
bucket["cost_usd"] += float(cost)
|
|
1667
|
+
bucket["any_cost_known"] = True
|
|
1668
|
+
|
|
1669
|
+
runs = list(sessions.values())
|
|
1670
|
+
for r in runs:
|
|
1671
|
+
r["cost_usd"] = round(r["cost_usd"], 6) if r.pop("any_cost_known") else None
|
|
1672
|
+
r["duration_s"] = _iso_duration_s(r["started_at"], r["ended_at"])
|
|
1673
|
+
runs.sort(key=lambda r: str(r.get("started_at") or ""), reverse=True)
|
|
1674
|
+
return {"runs": runs[: max(0, int(limit))]}
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
def _iso_duration_s(start_iso: str, end_iso: str) -> Optional[int]:
|
|
1678
|
+
if not start_iso or not end_iso:
|
|
1679
|
+
return None
|
|
1680
|
+
try:
|
|
1681
|
+
from datetime import datetime
|
|
1682
|
+
start = datetime.fromisoformat(start_iso.replace("Z", "+00:00"))
|
|
1683
|
+
end = datetime.fromisoformat(end_iso.replace("Z", "+00:00"))
|
|
1684
|
+
return max(0, int((end - start).total_seconds()))
|
|
1685
|
+
except (ValueError, TypeError):
|
|
1686
|
+
return None
|
|
1687
|
+
|
|
1688
|
+
|
|
1620
1689
|
@app.get("/api/workflows")
|
|
1621
1690
|
def workflows_list():
|
|
1622
1691
|
"""Scan departments/*/workflows/*.yaml and return metadata + content."""
|