arkaos 3.25.0 → 3.26.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 CHANGED
@@ -1 +1 @@
1
- 3.25.0
1
+ 3.26.0
@@ -28,6 +28,35 @@ const deptActivity = computed<ActivityRow | null>(() =>
28
28
  (activityData.value?.by_department?.[agent.value?.department ?? ''] ?? null),
29
29
  )
30
30
 
31
+ // PR88d v3.26.0 — agent history (git log + trash entries)
32
+ interface HistoryEvent {
33
+ kind: string
34
+ ts: string | null
35
+ summary: string
36
+ ref?: string
37
+ author?: string
38
+ }
39
+ const { data: historyData } = fetchApi<{ events: HistoryEvent[] }>(
40
+ `/api/agents/${agentId}/history?limit=20`,
41
+ )
42
+
43
+ const historyEvents = computed<HistoryEvent[]>(() => historyData.value?.events ?? [])
44
+
45
+ function historyKindIcon(kind: string): string {
46
+ return ({
47
+ 'git-commit': 'i-lucide-git-commit',
48
+ 'agent-delete': 'i-lucide-trash-2',
49
+ 'agent-move': 'i-lucide-folder-tree',
50
+ } as Record<string, string>)[kind] ?? 'i-lucide-circle'
51
+ }
52
+ function historyKindColor(kind: string): string {
53
+ return ({
54
+ 'git-commit': 'text-blue-500',
55
+ 'agent-delete': 'text-red-500',
56
+ 'agent-move': 'text-amber-500',
57
+ } as Record<string, string>)[kind] ?? 'text-muted'
58
+ }
59
+
31
60
  // PR83d v3.6.0 + PR86b v3.16.0 — activity strip (30d, agent or dept scope)
32
61
  interface ActivityStrip {
33
62
  period: string
@@ -443,6 +472,43 @@ function formatTokens(n: number): string {
443
472
  />
444
473
  </section>
445
474
 
475
+ <!-- ===== HISTORY TIMELINE (PR88d) ===== -->
476
+ <section
477
+ v-if="historyEvents.length > 0"
478
+ class="rounded-xl border border-default bg-elevated/10 p-5"
479
+ >
480
+ <h3 class="text-sm font-semibold uppercase tracking-wide text-muted mb-4">
481
+ History
482
+ </h3>
483
+ <ol class="relative border-l border-default ml-2 space-y-3">
484
+ <li
485
+ v-for="(ev, idx) in historyEvents"
486
+ :key="idx"
487
+ class="ml-4"
488
+ >
489
+ <span
490
+ class="absolute -left-1.5 size-3 rounded-full bg-elevated border border-default flex items-center justify-center"
491
+ >
492
+ <UIcon :name="historyKindIcon(ev.kind)" :class="['size-2', historyKindColor(ev.kind)]" />
493
+ </span>
494
+ <div class="rounded-lg border border-default p-3 bg-elevated/20">
495
+ <div class="flex items-center gap-2 flex-wrap text-xs">
496
+ <span class="font-mono text-muted">{{ ev.ts ? formatRelative(ev.ts) : '—' }}</span>
497
+ <UBadge
498
+ :label="ev.kind"
499
+ :color="ev.kind === 'git-commit' ? 'primary' : ev.kind === 'agent-move' ? 'warning' : 'error'"
500
+ variant="subtle"
501
+ size="xs"
502
+ />
503
+ <code v-if="ev.ref" class="font-mono text-muted">{{ ev.ref }}</code>
504
+ <span v-if="ev.author" class="text-muted">· {{ ev.author }}</span>
505
+ </div>
506
+ <p class="text-sm mt-1">{{ ev.summary }}</p>
507
+ </div>
508
+ </li>
509
+ </ol>
510
+ </section>
511
+
446
512
  <AgentEditDrawer
447
513
  v-model="editOpen"
448
514
  :agent="agent"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkaos",
3
- "version": "3.25.0",
3
+ "version": "3.26.0",
4
4
  "description": "The Operating System for AI Agent Teams",
5
5
  "type": "module",
6
6
  "bin": {
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "arkaos-core"
3
- version = "3.25.0"
3
+ version = "3.26.0"
4
4
  description = "Core engine for ArkaOS — The Operating System for AI Agent Teams"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -322,6 +322,96 @@ def agent_activity_strip(agent_id: str, period: str = "month"):
322
322
  }
323
323
 
324
324
 
325
+ @app.get("/api/agents/{agent_id}/history")
326
+ def agent_history(agent_id: str, limit: int = 20):
327
+ """PR88d v3.26.0 — combined history for an agent.
328
+
329
+ Sources:
330
+ - git log of the YAML file (commit hash, date, subject, author)
331
+ - trash entries (agent-delete + agent-move) where ``item_id``
332
+ matches
333
+
334
+ Returns ``{events: [{kind, ts, summary, ref?, author?}]}`` sorted
335
+ desc by ts.
336
+ """
337
+ events: list[dict] = []
338
+ yaml_file = _resolve_agent_yaml(agent_id)
339
+ if yaml_file is not None:
340
+ events.extend(_agent_git_log(yaml_file, limit=limit))
341
+ try:
342
+ from core import trash as _trash
343
+ for entry in _trash.list_trash(limit=50):
344
+ if entry.get("item_id") == agent_id and str(entry.get("kind", "")).startswith("agent-"):
345
+ events.append({
346
+ "kind": entry.get("kind"),
347
+ "ts": _trash_ts_to_iso(entry.get("timestamp")),
348
+ "summary": _trash_summary(entry),
349
+ "ref": entry.get("id"),
350
+ })
351
+ except Exception: # noqa: BLE001
352
+ pass
353
+ events.sort(key=lambda e: str(e.get("ts") or ""), reverse=True)
354
+ return {"events": events[: max(0, int(limit))]}
355
+
356
+
357
+ def _agent_git_log(yaml_file: Path, limit: int = 20) -> list[dict]:
358
+ """Run ``git log`` on the YAML file. Best-effort — empty on error."""
359
+ try:
360
+ rel = yaml_file.relative_to(ARKAOS_ROOT).as_posix()
361
+ except ValueError:
362
+ return []
363
+ try:
364
+ result = subprocess.run(
365
+ [
366
+ "git", "log", "--follow", f"-n{int(limit)}",
367
+ "--pretty=format:%H%x09%cI%x09%an%x09%s",
368
+ "--", rel,
369
+ ],
370
+ cwd=str(ARKAOS_ROOT),
371
+ capture_output=True, text=True, timeout=5,
372
+ )
373
+ except (subprocess.SubprocessError, OSError):
374
+ return []
375
+ if result.returncode != 0:
376
+ return []
377
+ rows: list[dict] = []
378
+ for line in result.stdout.strip().split("\n"):
379
+ if not line:
380
+ continue
381
+ parts = line.split("\t", 3)
382
+ if len(parts) < 4:
383
+ continue
384
+ sha, iso, author, subject = parts
385
+ rows.append({
386
+ "kind": "git-commit",
387
+ "ts": iso,
388
+ "summary": subject,
389
+ "ref": sha[:8],
390
+ "author": author,
391
+ })
392
+ return rows
393
+
394
+
395
+ def _trash_ts_to_iso(ts: object) -> str | None:
396
+ if ts is None:
397
+ return None
398
+ try:
399
+ from datetime import datetime, timezone
400
+ return datetime.fromtimestamp(float(ts), tz=timezone.utc).isoformat()
401
+ except (TypeError, ValueError, OSError):
402
+ return None
403
+
404
+
405
+ def _trash_summary(entry: dict) -> str:
406
+ kind = entry.get("kind") or ""
407
+ if kind == "agent-move":
408
+ new_path = entry.get("new_path") or ""
409
+ return f"Moved to {Path(new_path).parent.parent.name if new_path else '?'}"
410
+ if kind == "agent-delete":
411
+ return "Deleted (restorable from /trash)"
412
+ return kind
413
+
414
+
325
415
  @app.get("/api/agents/{agent_id}/activity")
326
416
  def agent_activity_detail(agent_id: str, period: str = "month"):
327
417
  """PR86b v3.16.0 — alias for /activity-strip. Same payload shape.