Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions a0/memory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 67:23 0:0 1:2
# 67:23 0:0 2:2
"""Memory — continuity substrate.

Memory is not raw history.
Expand Down Expand Up @@ -111,4 +111,4 @@ def _load(self) -> None:
)
except (json.JSONDecodeError, KeyError):
pass
# 67:23 0:0 1:2
# 67:23 0:0 2:2
4 changes: 2 additions & 2 deletions a0python/a0/guardian/ui/web/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 94:180 0:0 0:0
# 94:179 0:0 0:0
"""Guardian web UI — Gradio application.

Three tabs:
Expand Down Expand Up @@ -324,4 +324,4 @@ def main() -> None:

if __name__ == "__main__":
main()
# 94:180 0:0 0:0
# 94:179 0:0 0:0
4 changes: 2 additions & 2 deletions a0python/a0/memory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 69:9 0:0 1:3
# 69:9 0:0 2:3
"""Memory — continuity substrate.

Memory is not raw history.
Expand Down Expand Up @@ -95,4 +95,4 @@ def _load(self) -> None:
)
except (json.JSONDecodeError, KeyError):
pass
# 69:9 0:0 1:3
# 69:9 0:0 2:3
4 changes: 2 additions & 2 deletions client/src/pages/transcripts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 805:10 1:1 1:8
// 805:10 2:1 2:8
import { useState, useRef, useMemo, Fragment } from "react";
import { useQuery, useMutation } from "@tanstack/react-query";
import { queryClient } from "@/lib/queryClient";
Expand Down Expand Up @@ -850,4 +850,4 @@ export default function TranscriptsPage() {
</div>
);
}
// 805:10 1:1 1:8
// 805:10 2:1 2:8
4 changes: 2 additions & 2 deletions python/database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 36:0 0:0 33:0
# 36:0 0:0 36:0
import os
import asyncio
from urllib.parse import urlparse, parse_qs, urlencode, urlunparse
Expand Down Expand Up @@ -44,4 +44,4 @@ async def get_session():
except Exception:
await session.rollback()
raise
# 36:0 0:0 33:0
# 36:0 0:0 36:0
4 changes: 2 additions & 2 deletions python/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 329:312 0:0 10:19
# 329:312 0:0 10:20
import os
import time
from contextlib import asynccontextmanager
Expand Down Expand Up @@ -673,4 +673,4 @@ async def ui_structure():
@app.get("/{full_path:path}", include_in_schema=False)
async def serve_spa(full_path: str):
return FileResponse(os.path.join(STATIC_DIR, "index.html"))
# 329:312 0:0 10:19
# 329:312 0:0 10:20
4 changes: 2 additions & 2 deletions python/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 358:23 0:0 3:0
# 358:23 0:0 5:0
from sqlalchemy import (
Column, Integer, String, Text, Boolean, Float, DateTime, JSON,
ARRAY, ForeignKey, UniqueConstraint, Index, text
Expand Down Expand Up @@ -448,4 +448,4 @@ class GeneratedImage(Base):
featured = Column(Boolean, nullable=False, server_default=text("false"))
tags = Column(JSONB, server_default=text("'[]'::jsonb"))
skill_origin = Column(Text)
# 358:23 0:0 3:0
# 358:23 0:0 5:0
4 changes: 2 additions & 2 deletions python/routes/agents.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 262:31 1:3 2:8
# 265:31 1:3 2:8
import time
import logging
from fastapi import APIRouter, HTTPException, Request
Expand Down Expand Up @@ -324,4 +324,4 @@ def _num(v, caster):
}


# 262:31 1:3 2:8
# 265:31 1:3 2:8
4 changes: 2 additions & 2 deletions python/routes/instances_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 335:41 3:17 1:3
# 338:41 3:17 1:4
# DOC module: instances_api
# DOC label: Model Instances
# DOC description: CRUD for model instances (D&D party), per-instance memory, task board, and chat/archive sub-routes.
Expand Down Expand Up @@ -453,4 +453,4 @@ async def get_archives(iid: str):
return [{"id": str(r["id"]), "label": r["label"],
"archived_at": str(r["archived_at"]), "merge_status": r["merge_status"]}
for r in rows]
# 335:41 3:17 1:3
# 338:41 3:17 1:4
4 changes: 2 additions & 2 deletions python/routes/memory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 306:10 0:6 1:2
# 306:10 0:6 2:2
import math
import random
from fastapi import APIRouter, HTTPException, Request
Expand Down Expand Up @@ -372,4 +372,4 @@ async def get_subcore_state():
"anomalies": anomalies,
},
}
# 306:10 0:6 1:2
# 306:10 0:6 2:2
4 changes: 2 additions & 2 deletions python/routes/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 9:12 1:1 3:1
# 9:12 1:1 5:1
# DOC module: models
# DOC label: Models
# DOC description: Unified model catalog — every model the caller can actually use, with provider + role-assignment + tier provenance.
Expand Down Expand Up @@ -29,4 +29,4 @@ async def list_models(request: Request) -> dict:
user's disabled_models list.
"""
return await list_models_for_user(_uid(request))
# 9:12 1:1 3:1
# 9:12 1:1 5:1
4 changes: 2 additions & 2 deletions python/routes/system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 226:12 0:6 1:4
# 226:12 0:6 2:4
from fastapi import APIRouter, HTTPException, Request
from pydantic import BaseModel
from typing import Optional, Any
Expand Down Expand Up @@ -283,4 +283,4 @@ async def get_doc_file(file: str, request: Request):
patch_endpoint="/api/v1/system/toggles/{subsystem}",
query_key="/api/v1/system/toggles",
))
# 226:12 0:6 1:4
# 226:12 0:6 2:4
4 changes: 2 additions & 2 deletions python/routes/transcripts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 231:75 3:6 1:4
# 231:75 3:6 2:4
# DOC module: transcripts
# DOC label: Transcripts
# DOC endpoint: POST /api/v1/transcripts/upload | Upload a transcript file (txt/md/html/json/pdf/zip) for EDCMBONE scoring
Expand Down Expand Up @@ -361,4 +361,4 @@ async def explain_report_endpoint(request: Request, report_id: int):
status_code=502,
detail=f"explainer failed: {type(exc).__name__}: {exc}",
)
# 231:75 3:6 1:4
# 231:75 3:6 2:4
4 changes: 2 additions & 2 deletions python/services/agent_instance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 112:47 0:0 2:3
# 112:47 0:0 3:3
"""AgentInstance — runtime handle for "the thing that calls a model".

Unifies three concepts that previously each had bespoke plumbing:
Expand Down Expand Up @@ -175,4 +175,4 @@ def __repr__(self) -> str:
f"tools={self.use_tools}, "
f"resolved={self.provider_id!r})"
)
# 112:47 0:0 2:3
# 112:47 0:0 3:3
4 changes: 2 additions & 2 deletions python/services/agent_lifecycle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 91:55 0:0 3:2
# 91:55 0:0 5:2
# N:M
"""Canonical in-memory sub-agent registry (Task #122).

Expand Down Expand Up @@ -167,4 +167,4 @@ def registry_snapshot() -> list[dict]:
for name, (_e, meta) in items
]
# N:M
# 91:55 0:0 3:2
# 91:55 0:0 5:2
4 changes: 2 additions & 2 deletions python/services/attachments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 160:33 0:0 2:1
# 176:35 0:0 2:1
"""attachments — attachment resolution, extraction, and provider message building.

Extracted from inference.py. Activated only when a message carries
Expand Down Expand Up @@ -246,4 +246,4 @@ def build_provider_messages(messages: list[dict], provider_id: str) -> list[dict
composed_text = (composed_text or "") + marker
out.append({**base, "content": composed_text})
return out
# 160:33 0:0 2:1
# 176:35 0:0 2:1
4 changes: 2 additions & 2 deletions python/services/interdependent_bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 61:4
# 61:4 0:0 1:0
"""Interdependent-core bootstrap checks for a0 startup."""

from __future__ import annotations
Expand Down Expand Up @@ -78,4 +78,4 @@ def require_interdependent_core_ready() -> dict:
f"(status={state.get('status')}, dist={state.get('dist')}, "
f"version={state.get('version')}, payload_py={state.get('payload_py')})."
)
# 61:4
# 61:4 0:0 1:0
4 changes: 2 additions & 2 deletions python/services/run_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 70:13 0:0 8:0
# 70:13 0:0 9:0
# N:M
"""Run-scoped ContextVars for ZFAE recursion tracking.

Expand Down Expand Up @@ -105,4 +105,4 @@ def snapshot() -> dict:
"max_tool_rounds": current_max_tool_rounds.get(),
}
# N:M
# 70:13 0:0 8:0
# 70:13 0:0 9:0
4 changes: 2 additions & 2 deletions python/services/run_logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 123:17 0:0 8:3
# 123:17 0:0 10:3
# N:M
"""Per-run buffered structured logger backed by the agent_logs table.

Expand Down Expand Up @@ -162,4 +162,4 @@ async def dump_run_jsonl(run_id: str) -> bytes:
def queued_count() -> int:
return len(_QUEUE)
# N:M
# 123:17 0:0 8:3
# 123:17 0:0 10:3
4 changes: 2 additions & 2 deletions python/services/spawn_db.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 159:28
# 159:28 0:0 2:2
"""spawn_db — raw database operations for the spawn executor.

Owns: claim, heartbeat, persist-provider, mark-terminal, retry scheduling,
Expand Down Expand Up @@ -209,4 +209,4 @@ async def _maybe_schedule_retry(
except Exception:
pass
return True
# 159:28
# 159:28 0:0 2:2
4 changes: 2 additions & 2 deletions python/services/spawn_executor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 175:131
# 175:131 0:0 2:7
# N:M
"""spawn_executor — execute the rows that sub_agent_spawn writes.

Expand Down Expand Up @@ -333,4 +333,4 @@ async def _poll_loop() -> None:
def inflight_count() -> int:
"""Introspection helper — returns the number of in-flight execution tasks."""
return len(_inflight)
# 175:131
# 175:131 0:0 2:7
4 changes: 2 additions & 2 deletions python/services/spawn_pcna.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 53:20
# 53:20 0:0 1:3
"""spawn_pcna — provider resolution and PCNA helpers for the spawn executor.

Owns: resolve_provider (active/explicit), snapshot_pcna, try_get_primary_pcna,
Expand Down Expand Up @@ -87,4 +87,4 @@ def _retire_fork_quietly(parent_pcna: Any, sub_name: str) -> None:
merge_sub_agent(parent_pcna, sub_name)
except Exception:
pass
# 53:20
# 53:20 0:0 1:3
4 changes: 2 additions & 2 deletions python/services/spawn_sweep.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 113:30
# 113:30 0:0 1:5
"""spawn_sweep — stale-claim reaper and no-orphan invariant check.

Owns: _reap_stale_claims (single sweep pass), _emit_worker_lost_event,
Expand Down Expand Up @@ -163,4 +163,4 @@ async def check_no_orphan_invariant() -> dict:
"ok": not registry_orphans and not worker_orphans,
"worker_id": WORKER_ID,
}
# 113:30
# 113:30 0:0 1:5
4 changes: 2 additions & 2 deletions python/storage/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 393:56 0:0 2:2
# 393:56 0:0 4:2
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional
from sqlalchemy import select, update, delete, func, desc, asc, or_
Expand Down Expand Up @@ -507,4 +507,4 @@ async def delete_custom_tool(self, id: int) -> None:
# class: security
# call: python.tests.contracts.chat.test_create_anonymous_owner_null
# === END CONTRACTS ===
# 393:56 0:0 2:2
# 393:56 0:0 4:2
4 changes: 2 additions & 2 deletions python/storage/domain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 5:7
# 5:7 0:0 4:3
# Combiner — do not add methods here. Add them to the appropriate mixin:
# transcripts.py — uploads, sources, reports, messages, explanations, credits
# memory.py — seeds, projection, tensor snapshots, EDCM metrics
Expand All @@ -17,4 +17,4 @@ class DatabaseStorage(TranscriptMixin, MemoryMixin, SystemMixin):


storage = DatabaseStorage()
# 5:7
# 5:7 0:0 4:3
4 changes: 2 additions & 2 deletions python/storage/memory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 93:4
# 93:4 0:0 2:3
from datetime import datetime
from typing import Any, Dict, List, Optional
from sqlalchemy import select, update, desc, asc
Expand Down Expand Up @@ -112,4 +112,4 @@ async def get_memory_tensor_snapshots(self, limit: int = 20) -> List[Dict[str, A
select(MemoryTensorSnapshot).order_by(desc(MemoryTensorSnapshot.created_at)).limit(limit)
)
return [_row_to_dict(r) for r in result.scalars().all()]
# 93:4
# 93:4 0:0 2:3
4 changes: 2 additions & 2 deletions python/storage/system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 201:15
# 201:15 0:0 2:3
from datetime import datetime
from typing import Any, Dict, List, Optional
from sqlalchemy import select, update, delete, func, desc, asc, text as _sa_text
Expand Down Expand Up @@ -255,4 +255,4 @@ async def revoke_approval_scope(self, user_id: str, scope: str) -> bool:
.where(ApprovalScope.user_id == user_id, ApprovalScope.scope == scope)
)
return result.rowcount > 0
# 201:15
# 201:15 0:0 2:3
4 changes: 2 additions & 2 deletions python/storage/transcripts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 287:36
# 287:36 0:0 2:3
from datetime import datetime
from typing import Any, Dict, List, Optional
from sqlalchemy import select, update, delete, func, desc, asc, text as _sa_text
Expand Down Expand Up @@ -355,4 +355,4 @@ async def remove_explanation_credits(self, user_id: str, packs: int) -> Dict[str
select(ExplanationCredits).where(ExplanationCredits.user_id == user_id)
)
return _row_to_dict(result.scalar_one())
# 287:36
# 287:36 0:0 2:3
4 changes: 2 additions & 2 deletions server/attachments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 90:4 2:1 2:2
// 104:4 2:1 2:2
import path from "path";
import fs from "fs";
import crypto from "crypto";
Expand Down Expand Up @@ -115,4 +115,4 @@ export function registerAttachmentRoutes(app: Express) {
});
});
}
// 90:4 2:1 2:2
// 104:4 2:1 2:2
4 changes: 2 additions & 2 deletions tests/test_interdependent_bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 49:0
# 49:0 0:0 0:0
import importlib.util
from pathlib import Path

Expand Down Expand Up @@ -66,4 +66,4 @@ def _runtime_fail(_):
got = ib.check_interdependent_core()
assert got["status"] == "error"
assert got["error"] == "boom"
# 49:0
# 49:0 0:0 0:0
4 changes: 2 additions & 2 deletions tests/test_openai_policy_hmmm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 13:0
# 13:0 0:0 0:0
import json
from pathlib import Path

Expand All @@ -17,4 +17,4 @@ def test_openai_hmmm_seed_items_use_structured_fields():
assert isinstance(item[field], str)
assert item[field]
assert len({item[field] for field in _HMMM_FIELDS}) > 1
# 13:0
# 13:0 0:0 0:0
Loading