text stringlengths 185 73.3k | repo stringlengths 7 100 | path stringlengths 4 146 | language stringclasses 7
values | hash stringlengths 16 16 | score float64 7 8.5 | stars int64 0 237k |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
"""Render the simple LeaderWorkerSet manifest template with strict tokens."""
from __future__ import annotations
import argparse
import json
import re
from pathlib import Path
from typing import Mapping
import yaml
TOKEN = re.compile(r"{{\s*([a-z][a-z0-9_]*)\s*}}")
def render_template(temp... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/scripts/k8s/render_lws.py | .py | af4f1cab80e16327 | 7.65 | 1 |
#!/usr/bin/env python3
"""Load the executable Multi-node framework v1 intermediate plan."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import yaml
PLAN_API_VERSION = "multi-node/v1"
PLAN_KIND = "MultiNodePlan"
MAX_PORT = 65535
class PlanEr... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/scripts/plan.py | .py | e8b250591064e2b4 | 7.65 | 1 |
#!/usr/bin/env python3
"""Small process-lifecycle helpers for the Multi-node framework runner."""
from __future__ import annotations
import os
import signal
import subprocess
import threading
import time
from contextlib import contextmanager
from dataclasses import dataclass
from pathlib import Path
from types import... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/scripts/process.py | .py | 83717a53fbdf28ca | 7.65 | 1 |
#!/usr/bin/env python3
"""Immutable Multi-node framework outcomes and small JSON serialization helpers."""
from __future__ import annotations
import json
import os
import tempfile
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Iterable, Mapping
RESULT_SCHEMA_VERSION = "multi-node... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/scripts/result.py | .py | b660a65ae4559ac7 | 7.65 | 1 |
"""Niyet Tespiti (Intent Detection) - Ajan Orkestratorun ilk katmani.
TASARIM KARARI: Sprint 4'te ModernBERT/LLM tabanli siniflandirma planlanmis
olsa da, ilk hat icin ANAHTAR KELIME tabanli deterministik kurallar
kullanilir - projenin "net/sayisal durumlarda deterministik arac, ancak
belirsizlikte LLM'e basvur" ilkes... | Sara-Toptamur36/katilim-ai | agent/intent.py | .py | 9a30025d701fd27a | 7.24 | 2 |
"""Ajan Orkestratoru - tek giris noktasi.
Mimari (rapor Bolum 8): Intent Detection -> Tool Router -> (SQL/Calculator/
Dictionary/RAG/Fallback) -> Response Generator -> Terminology Check ->
Verifier -> Provenance.
BU DOSYANIN KAPSAMI: Intent Detection + Tool Router + alti dal
(Hesaplama, Sozluk, Karsilastirma, Toplam ... | Sara-Toptamur36/katilim-ai | agent/orchestrator.py | .py | 53b95a3d05d0f200 | 7.24 | 2 |
"""Kullanici sorusundan Hesap Makinesi / Karsilastirma araclari icin
parametre cikarimi.
ONEMLI SINIR: Bu modul, KISA ve YAPILANDIRILMIŞ kullanici sorularindan
(ornek: "500.000 TL, %1,99 oranla 24 ay vadeyle taksitim ne kadar olur?")
sayisal parametre cikarir. Bu, Yagmur'un UZUN banka kampanya sayfalarindan
finansal a... | Sara-Toptamur36/katilim-ai | agent/parametre_cikar.py | .py | d03bfa0a5bffdc01 | 7.24 | 2 |
"""Alembic ortam yapilandirmasi.
Veritabani adresi ORTAM DEGISKENINDEN okunur, alembic.ini'ye yazilmaz.
Boylece parola repoya girmez (bkz. .gitignore -> .env).
"""
import os
from logging.config import fileConfig
from alembic import context
from sqlalchemy import engine_from_config, pool
# Projedeki modelleri autoge... | Sara-Toptamur36/katilim-ai | alembic/env.py | .py | 8902d8bbfa4f421c | 7.24 | 2 |
"""nakit iade ve indirim orani sutunlari eklendi
Revision ID: 348b48b28c29
Revises: c9d2e4a17b30
Create Date: 2026-08-24 18:59:42.081684
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '348b48b28c29'
down_revision: Union... | Sara-Toptamur36/katilim-ai | alembic/versions/348b48b28c29_nakit_iade_ve_indirim_orani_sutunlari_.py | .py | 82de41634d52c36a | 7.24 | 2 |
"""kullanicilar tablosu eklendi
Revision ID: 3f40c72cb489
Revises: 86a1d27e0191
Create Date: 2026-08-01 00:14:42.437600
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '3f40c72cb489'
down_revision: Union[str, Sequence[st... | Sara-Toptamur36/katilim-ai | alembic/versions/3f40c72cb489_kullanicilar_tablosu_eklendi.py | .py | 75dbeda21cebd71c | 7.24 | 2 |
"""sikayet denetim alanlari eklendi
Complaint Insight plan revizyonu (26 Agustos 2026) - P0 kalemleri:
- icerik_hash / yineleme_supheli : dedup/spam ISARETLEME (engelleme
degil), complaint/toplama.py::_dedup_anahtari
- tema_surumu : hangi kural setiyle siniflandirildi,
complaint/tema_sin... | Sara-Toptamur36/katilim-ai | alembic/versions/4fae96f0556c_sikayet_denetim_alanlari_eklendi.py | .py | 85f5352e5f10d363 | 7.24 | 2 |
"""kampanyalar ve audit_kayitlari tablolari
Revision ID: 6c6458e33bd5
Revises:
Create Date: 2026-07-27 20:44:53.883231
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '6c6458e33bd5'
down_revision: Union[str, Sequence[st... | Sara-Toptamur36/katilim-ai | alembic/versions/6c6458e33bd5_kampanyalar_ve_audit_kayitlari_tablolari.py | .py | 99f643dc9d203fe1 | 7.24 | 2 |
"""taksit_sayisi ve erteleme_suresi_ay alanlari eklendi
Revision ID: 86a1d27e0191
Revises: 6c6458e33bd5
Create Date: 2026-07-31 21:05:07.395553
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '86a1d27e0191'
down_revision... | Sara-Toptamur36/katilim-ai | alembic/versions/86a1d27e0191_taksit_sayisi_ve_erteleme_suresi_ay_.py | .py | 8831a0256281172e | 7.24 | 2 |
"""dogrulanan_alanlar eklendi
Revision ID: b70604b6218d
Revises: 3f40c72cb489
Create Date: 2026-08-11 22:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'b70604b6218d'
down_revision: Union[str, Sequence[str]... | Sara-Toptamur36/katilim-ai | alembic/versions/b70604b6218d_dogrulanan_alanlar_eklendi.py | .py | ebe57f2e8d1ab840 | 7.24 | 2 |
"""sikayetler tablosu eklendi
Sikayet verisi kampanya tablosuna KARISMAZ (Rehber_Zeynep_Veri.md kirmizi
cizgisi) - bu yuzden AYRI bir tablodur ve `kampanyalar`a FOREIGN KEY
BILEREK konulmamistir: eslesme silinebilir/duzeltilebilir bir HIPOTEZDIR
(bkz. complaint/kampanya_eslestirme.py), semanin garantisi degil.
Tablo ... | Sara-Toptamur36/katilim-ai | alembic/versions/c9d2e4a17b30_sikayetler_tablosu_eklendi.py | .py | d7bcb11d325f4450 | 7.24 | 2 |
"""kar payi tablosu eklendi
Revision ID: f5f4763fa380
Revises: b70604b6218d
Create Date: 2026-08-19 23:58:34.733163
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'f5f4763fa380'
down_revision: Union[str, Sequence[str], ... | Sara-Toptamur36/katilim-ai | alembic/versions/f5f4763fa380_kar_payi_tablosu_eklendi.py | .py | cfe9edef897cdad8 | 7.24 | 2 |
"""Kimlik dogrulama.
IKI MOD, TEK BASLIK FORMATI: Authorization basligi her iki modda da
ZORUNLUDUR ve ayni ('Bearer <token>'). Degisen tek sey token'in
dogrulanip dogrulanmadigidir - bu yuzden arayuz kodu modlar arasinda
gecerken hic degismez.
JWT_AKTIF ayarli degil (varsayilan): icerik kontrol edilmez, herhangi
... | Sara-Toptamur36/katilim-ai | api/auth.py | .py | 58bf47621cd4678d | 7.24 | 2 |
"""Gercek veritabanindan (PostgreSQL) kampanya okuma katmani.
api/mock_data.py'nin gercek veri karsiligi. Ayni CampaignRecord seklini
(api/schemas.py) doner, boylece api/main.py hangi kaynagi kullandigini
Havin'in arayuzune hic yansitmadan degistirebilir (bkz. GERCEK_VERI_AKTIF
bayragi, api/main.py).
"""
from datetim... | Sara-Toptamur36/katilim-ai | api/kampanya_repository.py | .py | 6cd992b91e6576ab | 7.24 | 2 |
"""Kullanicilar tablosu icin veritabani erisim katmani.
api/kampanya_repository.py ile ayni ayrim ilkesi: DB sorgulari burada,
sifre dogrulama mantigi api/auth.py'de, HTTP/endpoint mantigi api/main.py'de.
"""
from sqlalchemy.orm import Session
from api.auth import sifre_dogrula, sifre_hashle
from api.models import K... | Sara-Toptamur36/katilim-ai | api/kullanici_repository.py | .py | 699fe9b741cceba4 | 7.24 | 2 |
"""Merkezi loglama yapilandirmasi.
Kurumsal/on-premise bir sistemde print() kullanilmaz: cikti sunucu kapaninca
kaybolur, seviyesi ve zaman damgasi yoktur. Bu modul, hem dosyaya hem konsola
yazan seviyeli bir logger saglar.
GUVENLIK: Log dosyalarina asla token, parola, JWT gizli anahtari veya kisisel
veri yazilmaz. L... | Sara-Toptamur36/katilim-ai | api/logging_config.py | .py | 4edea5a39b83fb3e | 7.24 | 2 |
"""SQLAlchemy veritabani modelleri (Alembic migration'lari bunlari izler).
NEDEN ORM + MIGRATION: Sprint 2'de semaya yeni bir sutun eklemek gerektiginde,
tabloyu elle silip yeniden kurmak Zeynep'in topladigi TUM gercek veriyi yok
eder. Alembic, degisikligi veriyi koruyarak uygular ve surumler.
Sema degistiren kisi mi... | Sara-Toptamur36/katilim-ai | api/models.py | .py | ae24bb6cafd763e5 | 7.24 | 2 |
"""Hesap Makinesi Araci (Calculator Tool).
TASARIM ILKESI (rapor Bolum 5.3 / 8): Hesaplamalar LLM'e BIRAKILMAZ.
LLM aritmetikte hata yapabilir ve yaptigi hatayi fark etmez. Finansal bir
hesapta bu kabul edilemez. Bu yuzden tum hesaplar saf Python fonksiyonlariyla
deterministik olarak yapilir; LLM yalnizca sonucu cumle... | Sara-Toptamur36/katilim-ai | calculator/calculator.py | .py | 715f5c0b18c1de8d | 7.24 | 2 |
"""Sorgu metninden banka adini tanir ve metadata filtresine cevirir.
NEDEN VAR (olculmus gerekce - docs/rag_tasarim_ve_olcum.md, 20/21 Agustos
olcumu): Degerlendirme setinin en zor kategorisi `banka_ve_konu`
(28 soru) Recall@5'te %50,0 ve Recall@1'de %0,0 aldi. Bu sorular tam
olarak su bicimde: "Kuveyt Turk kart", "Va... | Sara-Toptamur36/katilim-ai | chunking/banka_tespit.py | .py | 4318916e893c497a | 7.24 | 2 |
"""Metinleri vektore ceviren embedding katmani (RAG icin ilk adim).
IKI SAGLAYICI (bkz. docs/adr/0002-evren-cikarim-entegrasyonu.md):
- Yerel intfloat/multilingual-e5-base - VARSAYILAN yol, 768 boyutlu
vektor uretir. EVREN_API_KEY tanimli olsa BILE (ornegin yalnizca
llm-fast icin eklenmis olabilir) embedding... | Sara-Toptamur36/katilim-ai | chunking/embedding.py | .py | 873ccb08b6727050 | 7.24 | 2 |
"""RAG indeksinin son kurulum durumu - yaz/oku.
NEDEN AYRI MODUL: Bu durumu YAZAN taraf chunking/indeksleyici.py'dir ve o
modul embedding/Qdrant zincirini import eder. OKUYAN taraf ise api/main.py -
API'nin indeksleme bagimliliklarini yuklemesi icin hicbir sebep yok.
Kucuk ve bagimsiz bir modul, API acilis suresini ge... | Sara-Toptamur36/katilim-ai | chunking/indeks_durumu.py | .py | 7fbd836c394f34ea | 7.24 | 2 |
"""Tam indeksleme boru hatti: ham scraper verisi -> aranabilir Qdrant indeksi.
Zincir:
scraper/raw_data/*/json/*.json
-> chunking/parcalayici.py (semantik parcalama + tekillestirme)
-> chunking/embedding.py (yogun/anlamsal vektor)
-> chunking/seyrek_vektor.py (seyrek/kelime vektoru)
-... | Sara-Toptamur36/katilim-ai | chunking/indeksleyici.py | .py | 1458d41d428bce71 | 7.24 | 2 |
"""Sorgu metninden kampanya turunu tanir - retrieval'da SOFT-BOOST icin.
NEDEN VAR (Mentorluk III raporu 7.5/5.3, banka_ve_konu Recall@5 hala
zayif): chunking/banka_tespit.py bankayi metadata FILTRESINE tasiyarak
banka_ve_konu kategorisinde olculebilir kazanc sagladi (bkz. o dosyanin
docstring'i - k=1/k=3'te net iyile... | Sara-Toptamur36/katilim-ai | chunking/kampanya_turu_tespit.py | .py | 25cd98433d2a70bb | 7.24 | 2 |
"""Reranker: Qdrant'tan donen genis aday listesini Cross-Encoder ile yeniden siralar.
Qdrant (veya genel vektor aramasi) Recall (getirilen adaylar arasinda dogru
cevabin bulunma ihtimali) acisindan basarili olsa da, siralamada (Precision@1)
bazen zayif kalabilir. Cross-Encoder modeli soruyu ve parcayi *birlikte* oku... | Sara-Toptamur36/katilim-ai | chunking/reranker.py | .py | 973be2d9a4b80bb2 | 7.24 | 2 |
"""Seyrek (lexical/BM25) vektor uretimi - hibrit aramanin kelime tarafi.
NEDEN GEREKLI: Spike olcumu (docs/qdrant_spike_raporu.md, Bulgu 2) yalnizca
yogun (dense) embedding kullanildiginda ALAKALI ve TAMAMEN ALAKASIZ sorgu
arasindaki skor farkinin yalnizca 0,0455 oldugunu gosterdi - "uzay
istasyonunda yercekimi" sorus... | Sara-Toptamur36/katilim-ai | chunking/seyrek_vektor.py | .py | 9bb4623b206155fd | 7.24 | 2 |
"""Qdrant + embedding uctan uca dogrulama (spike).
AMAC (PeacewAI Ilerleme Plani, Sprint 2): "en az 1 bankanin metniyle ilk
vektor kaydi denenir, donanim/RAM sorunlari Sprint 3'u beklemeden erken
yakalanir". Bu bir RISK AZALTMA adimidir - RAG'in kendisi degildir.
BU SCRIPT NE YAPAR:
gercek banka metni -> kaba parca... | Sara-Toptamur36/katilim-ai | chunking/spike_qdrant.py | .py | 167bbd6104eb98d7 | 7.24 | 2 |
"""Audio features for the motion model — the contract mirrored by ``web/js/features.js``.
16 kHz mono float32 in → ``[T, 66]`` float32 out on the 30 Hz motion grid:
64 log-mel bands (win 25 ms, hop 10 ms, averaged per 33.3 ms tick) + log energy
+ delta log energy, then per-utterance mean/variance normalisation. Everyt... | Hcoder10/animacy | animacy/features.py | .py | d2b184e1bcc7703c | 7 | 0 |
"""Can the judge actually watch an MP4? A tiny experiment, run before any grading.
A 3 s reel (1 s title card "Clip 7" + the lamp's own 2 s ``nod`` clip) is put
in an otherwise empty workspace and Kimi is asked to report the title-card
text, describe the motion and say how many frames it could see. The result is
saved... | Hcoder10/animacy | animacy/grade/probe.py | .py | 773b579573c94798 | 7 | 0 |
"""Intent conditioning: text -> (arousal, valence, tag), no model at runtime.
Speech-only conditioning cannot know that an exclamation of amazement needs a
burst and a pondering line needs a settle. In talk mode the text is known, so a
small, fully documented lexicon of GENERIC cue families + punctuation rules
turns i... | Hcoder10/animacy | animacy/model/intent.py | .py | e17f4ff442d4dd16 | 7 | 0 |
"""Unified agent ``Config`` resolver shared by every framework adapter.
Single source of truth for how :class:`z4j_core.models.Config` is
constructed from the four input sources operators can use. Replaces
~789 lines of duplicate env-var parsing across z4j-django, z4j-flask,
z4j-fastapi, and z4j-bare's ``install_agent... | z4jdev/z4j-core | src/z4j_core/config/resolver.py | .py | d849e8759dea7b3b | 7 | 0 |
"""Agent domain model.
An ``Agent`` represents one z4j agent runtime that has (or has ever)
connected to this brain. Each agent is project-scoped and authenticates
with a project-scoped bearer token. WebSocket agents advertise runtime
details in ``hello``. Long-poll agents use authenticated requests and
do not perform... | z4jdev/z4j-core | src/z4j_core/models/agent.py | .py | 248747488ef6071d | 7 | 0 |
"""Command domain model.
A :class:`Command` is an action the user wants z4j to execute against
an underlying task engine: retry a task, cancel a task, bulk retry by
filter, purge a queue, restart a worker, create/update/delete a
schedule, and so on.
The lifecycle is:
1. User clicks a button in the dashboard (or call... | z4jdev/z4j-core | src/z4j_core/models/command.py | .py | 333cc2db6b158482 | 7 | 0 |
"""Event domain model.
An :class:`Event` is a single lifecycle notification emitted by the
agent - "this task started," "this task failed with exception X,"
"this worker went offline," and so on. Events are the raw stream
that feeds the brain's ``tasks``, ``workers``, ``queues``, and
``schedules`` tables.
High-volume... | z4jdev/z4j-core | src/z4j_core/models/event.py | .py | dce72d3a1ecce6a3 | 7 | 0 |
"""Project domain model.
A project is a logical grouping - typically "one app in one
environment," e.g. ``acme-web-prod``. It owns agents, tasks, queues,
workers, schedules, commands, and audit entries.
"""
from __future__ import annotations
import re
from datetime import datetime
from uuid import UUID
from pydanti... | z4jdev/z4j-core | src/z4j_core/models/project.py | .py | 34f77fac9e654d6b | 7 | 0 |
"""Schedule domain model.
A :class:`Schedule` is a periodic or one-shot trigger that fires a
task at configured times. In Celery terms: a row in
``django_celery_beat.PeriodicTask`` or an entry in
``celery_app.conf.beat_schedule``.
z4j-owned schedules can be created and controlled through the dashboard.
Externally own... | z4jdev/z4j-core | src/z4j_core/models/schedule.py | .py | 306b20d39f0cc7cb | 7 | 0 |
"""Task domain models.
Two distinct concepts share the word "task":
1. :class:`TaskDefinition` - a task that *exists in the codebase*.
Discovered via the agent's five-layer discovery pipeline. Has a
name, a module path, and (optionally) a signature. No runtime
state. A task definition is a template.
2. :cla... | z4jdev/z4j-core | src/z4j_core/models/task.py | .py | 0032c2ce890736c2 | 7 | 0 |
"""Worker domain model.
A :class:`Worker` represents a running instance of the underlying
task engine - e.g. one ``celery worker`` process. Agents report
worker state to the brain via heartbeats and lifecycle events.
"""
from __future__ import annotations
from datetime import datetime
from enum import StrEnum
from t... | z4jdev/z4j-core | src/z4j_core/models/worker.py | .py | 87b0330fc2042009 | 7 | 0 |
"""Contextvars carrying identity into log records automatically.
When an event is logged from inside the agent's runtime, the log
line should carry the session id, agent id, worker id, and
project id without every call site having to remember to pass
them. ``contextvars.ContextVar`` is the stdlib mechanism for
this; i... | z4jdev/z4j-core | src/z4j_core/observability/context.py | .py | 1087f8baa4d71300 | 7 | 0 |
"""Stdlib-only logging formatters honoring ``Z4J_LOG_FORMAT``.
The agent runtime (z4j-bare) and adapter packages (z4j-celery,
z4j-django, etc.) live inside foreign host processes. They cannot
pull a heavy logging dependency (structlog, loguru) into the host's
dep closure without being a bad citizen. So the agent side ... | z4jdev/z4j-core | src/z4j_core/observability/logging.py | .py | 2d5b891dcb4bf3c2 | 7 | 0 |
"""Canonical state-directory resolution for z4j.
z4j stores per-host state in a single directory used by both the
brain process and the agent runtime. This module is the ONE place
that resolves where that directory lives.
Operators relocate z4j state via the single ``Z4J_HOME``
variable, resolved through :func:`z4j_h... | z4jdev/z4j-core | src/z4j_core/paths.py | .py | 559452455afecc13 | 7 | 0 |
"""Keyed confirmation token for the destructive ``purge_queue`` command.
The token binds a purge command to ``(queue_name, observed_depth)`` under
a **keyed HMAC-SHA256** using the agent's per-project secret -- the same
32 bytes that sign protocol frames (``derive_project_secret`` on the
brain; ``Z4J_HMAC_SECRET`` dec... | z4jdev/z4j-core | src/z4j_core/purge_token.py | .py | f56aadcb654dac2a | 7 | 0 |
"""HMAC signing and verification for protocol v2 frames.
**Protocol v2 (April 2026) - every stateful frame is signed in
BOTH directions.**
A frame envelope is the JSON document that gets signed. It
binds every piece of replay-relevant context into the
signature:
envelope = {
"v": 2,
"type": <fram... | z4jdev/z4j-core | src/z4j_core/transport/hmac.py | .py | f8ec008acbf9e0a1 | 7 | 0 |
"""Replay + freshness guard for protocol v2 frames.
Every authenticated frame on a WebSocket carries a ``(ts, nonce,
seq)`` triple in its signed envelope. The :class:`ReplayGuard`
below enforces the three invariants the signature alone cannot:
1. **Freshness**: ``|local_now - frame.ts|`` must be within the
configu... | z4jdev/z4j-core | src/z4j_core/transport/replay.py | .py | 46cc997e687c7626 | 7 | 0 |
"""B16 (CWE-377): the ``<tmpdir>/z4j-<uid>`` buffer fallback must not adopt
a predictable-name directory a local attacker pre-created. ``_is_own_private_dir``
gates adoption; anything not a real 0700 dir WE own is refused so the caller
falls back to an unguessable ``mkdtemp`` dir instead.
"""
from __future__ import an... | z4jdev/z4j-core | tests/unit/test_buffer_root_fallback_b16.py | .py | 1f9f5ce9084d56ab | 7.5 | 0 |
"""Defense-in-depth: make sure z4j_core imports nothing forbidden.
``import-linter`` is the primary enforcement mechanism (see
``.importlinter`` in the repo root). This test is a SECONDARY check
that walks the compiled bytecode of every z4j_core module and
asserts no forbidden top-level import is present. It catches t... | z4jdev/z4j-core | tests/unit/test_core_purity.py | .py | 5ea4942dbff61042 | 7.5 | 0 |
"""Alembic async environment configuration."""
from __future__ import annotations
import asyncio
from logging.config import fileConfig
from alembic import context
from sqlalchemy import pool
from sqlalchemy.engine import Connection
from sqlalchemy.ext.asyncio import async_engine_from_config
from app.config import s... | fixemer90-stack/Archemap | backend/alembic/env.py | .py | 1bca23641f4335dc | 7 | 0 |
"""add users table
Revision ID: 4b32a2d6a931
Revises: b0f2a3b7fae2
Create Date: 2026-05-29 21:01:40.475330
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "4b32a2d6a931"
down_revision: str | Non... | fixemer90-stack/Archemap | backend/alembic/versions/4b32a2d6a931_add_users_table.py | .py | 3f09717cf2dd8318 | 7 | 0 |
"""add email verification
Revision ID: 563eb156e1f1
Revises: 4b32a2d6a931
Create Date: 2026-05-29 21:36:11.549064
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "563eb156e1f1"
down_revision: st... | fixemer90-stack/Archemap | backend/alembic/versions/563eb156e1f1_add_email_verification.py | .py | 88708e42e54ed366 | 7 | 0 |
"""add password_resets table
Revision ID: 738693432883
Revises: 563eb156e1f1
Create Date: 2026-05-29 23:10:09.020027
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "738693432883"
down_revision:... | fixemer90-stack/Archemap | backend/alembic/versions/738693432883_add_password_resets_table.py | .py | 58a6d3f08693a1ed | 7 | 0 |
"""add identity_links table
Revision ID: 9ad2219a9521
Revises: 738693432883
Create Date: 2026-05-29 23:46:38.517757
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "9ad2219a9521"
down_revision: ... | fixemer90-stack/Archemap | backend/alembic/versions/9ad2219a9521_add_identity_links_table.py | .py | 27185b46609695a6 | 7 | 0 |
"""add person_profiles table
Revision ID: a1b2c3d4e5f6
Revises: 9ad2219a9521
Create Date: 2026-05-30 01:00:00.000000
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "a1b2c3d4e5f6"
down_revision:... | fixemer90-stack/Archemap | backend/alembic/versions/a1b2c3d4e5f6_add_person_profiles_table.py | .py | 9ce7e0a508501fe3 | 7 | 0 |
"""initial schema
Revision ID: b0f2a3b7fae2
Revises:
Create Date: 2026-05-29 19:51:08.336845
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = "b0f2a3b7fae2"
down_revision: str |... | fixemer90-stack/Archemap | backend/alembic/versions/b0f2a3b7fae2_initial_schema.py | .py | c14b3086cf55a061 | 7 | 0 |
"""add birth_date to users
Revision ID: c3d4e5f6a7b8
Revises: b2c3d4e5f6a7
Create Date: 2026-05-31 00:00:00.000000
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
revision: str = "c3d4e5f6a7b8"
down_revision: str | None = "b2c3d4e5f6a7"
branch_labels:... | fixemer90-stack/Archemap | backend/alembic/versions/c3d4e5f6a7b8_add_birth_date_to_users.py | .py | e91e3c79faa9a732 | 7 | 0 |
"""add name to users
Revision ID: f6a7b8c9d0e1
Revises: e5f6a7b8c9d0
Create Date: 2026-06-01 22:00:00.000000
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
revision: str = "f6a7b8c9d0e1"
down_revision: str | None = "e5f6a7b8c9d0"
branch_labels: str |... | fixemer90-stack/Archemap | backend/alembic/versions/f6a7b8c9d0e1_add_name_to_users.py | .py | 967904fa82fa784d | 7 | 0 |
"""Aspect detection — finds aspects between planets with orb checking."""
from __future__ import annotations
from app.chart_engine.ephemeris import ASPECT_ANGLES, DEFAULT_ORBS
from app.chart_engine.types import Aspect, PlanetPosition
def _angular_distance(lon_a: float, lon_b: float) -> float:
"""Shortest angula... | fixemer90-stack/Archemap | backend/app/chart_engine/aspects.py | .py | c2b1c56cb04c7eb0 | 7.5 | 0 |
"""Chart builder — assembles ChartData from birth data."""
from __future__ import annotations
from datetime import datetime
from app.chart_engine.aspects import find_aspects
from app.chart_engine.ephemeris import (
compute_houses,
compute_planet_positions,
datetime_to_julian_day,
init_ephemeris,
)
fr... | fixemer90-stack/Archemap | backend/app/chart_engine/chart.py | .py | a8660e9ede1d1e4b | 7 | 0 |
"""Outbox event publisher placeholder.
Integrates with the Transactional Outbox pattern to reliably publish
domain events to a message broker (Redis Streams / Kafka / RabbitMQ).
"""
from __future__ import annotations
import uuid
from dataclasses import dataclass, field
from datetime import UTC, datetime
from typing ... | fixemer90-stack/Archemap | backend/app/core/events.py | .py | 3d5db6f6cd633990 | 7 | 0 |
"""Redis-backed rate limiting for authentication endpoints."""
from __future__ import annotations
import redis.asyncio as aioredis
class RateLimiter:
"""Token-bucket-style rate limiter using Redis INCR + EXPIRE.
Keys follow the pattern ``rate_limit:{scope}:{identifier}``.
"""
def __init__(self, re... | fixemer90-stack/Archemap | backend/app/core/rate_limit.py | .py | a932d53d370a0757 | 7 | 0 |
"""Secrets validation — checks for insecure defaults and missing secrets."""
from __future__ import annotations
import structlog
logger = structlog.get_logger()
# Secrets that must not use default values in production
INSECURE_DEFAULTS: dict[str, str] = {
"SECRET_KEY": "change-me",
"DATABASE_URL": "postgres... | fixemer90-stack/Archemap | backend/app/core/secrets.py | .py | 891e1237ef6cca07 | 7 | 0 |
"""Email provider abstraction and implementations."""
from __future__ import annotations
import smtplib
import ssl
from abc import ABC, abstractmethod
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import structlog
from app.config import settings
logger = structlog.get_logger()... | fixemer90-stack/Archemap | backend/app/infrastructure/email.py | .py | 941b5667384b8a9d | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""분류 파이프라인 — Stage1(값 기반) → Stage2(맥락 기반) 병합.
- Stage1: 텍스트에서 접두어가 명확한 키를 즉시 식별.
- Stage2: 값만으로 애매한 값(UUID·32hex)을 텍스트 라벨 + URL 구조로 가려낸다.
OCR(CORE-3)은 이후 "이미지 → 텍스트+라벨"을 만들어 이 파이프라인에 먹인다.
"""
from __future__ import annotations
import re
from ... | ttogle918/key-manager | backend/app/classify/pipeline.py | .py | 7f073be08215a485 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""Stage 1 — 값 기반 분류 (SPEC 4.2).
접두사가 명확한 키를 지식베이스의 value_regex 로 즉시 식별한다.
값만으로 애매한 값(UUID·32 hex 등)은 절대 단정하지 않고 unknown 으로 안전 분류해
Stage 2(맥락 기반)로 넘긴다.
"""
from __future__ import annotations
import math
import re
from collections import Counter... | ttogle918/key-manager | backend/app/classify/stage1.py | .py | 5d6422d2ec9d9e54 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""Stage 2 — 맥락 기반 분류 (SPEC 4.3, KeyLens의 차별점).
값만으로 애매한 값(UUID·32 hex)을 **출처 맥락**으로 가려낸다.
- 라벨 신호: 값 주변 텍스트("Database ID", "REST API 키")를 지식베이스 label_patterns 와 대조.
- URL 신호: 입력 URL을 서비스 url_patterns 와 대조해 위치로 종류 도출.
신호가 한 종류를 가리키면 분류하고, 여러 종류로... | ttogle918/key-manager | backend/app/classify/stage2.py | .py | 0bcb2740c7cbfcd3 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""VAULT-1 암호화 코어 — Argon2id 키 유도 + AES-256-GCM (SPEC 6장).
원칙: **마스터 비밀번호도, 유도된 키도 절대 디스크에 저장하지 않는다.**
디스크에는 KDF 솔트·파라미터와 암호문(nonce+태그 포함)만 남는다. 키는 이 프로세스 메모리에만 존재한다.
- 키 유도: Argon2id(메모리-하드) 로 마스터 비밀번호 → 32바이트 대칭키. 솔트는 항목이 아니라 금고 단위.
- 암호화: 항목... | ttogle918/key-manager | backend/app/crypto.py | .py | 0a1f5c7ca06aaccd | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""로컬 발견 캐시(local_discoveries.yaml) — 사용자가 승인한 AI 추정만, 항상 confirmed: false.
backend/knowledge/*.yaml(큐레이션된 진짜 지식베이스)과 절대 같은 파일/신뢰도로 섞지 않는다 —
섞으면 LLM이 한 번 잘못 추측한 게 마치 검증된 지식처럼 굳어질 위험이 있다. 이 파일 안의 confirmed는
이 프로젝트 코드로는 절대 true로 바뀌지 않는다 — 지식베이스로의 ... | ttogle918/key-manager | backend/app/discoveries_repo.py | .py | 4d92a93a239aaca2 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""화면 설명 기능 — OCR 줄들을 지식베이스 대조로 먼저 라벨링하고, 남은 미분류 줄은 로컬 발견
캐시 → 로컬 Ollama → (옵션) Tavily 검색 검증 순으로 처리한다.
설계 근거:
- docs/superpowers/specs/2026-08-27-screenshot-explain-design.md (1단계 원본)
- docs/superpowers/specs/2026-08-27-screenshot-explain-tavily... | ttogle918/key-manager | backend/app/explain.py | .py | e23cb9402974b15c | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""지식베이스 로더 — knowledge/*.yaml 을 읽어 검증하고 컴파일한다."""
from __future__ import annotations
import os
import re
from dataclasses import dataclass, field
from pathlib import Path
import yaml
from .models import Credential, Service
# knowledge/ 디렉토리 ... | ttogle918/key-manager | backend/app/knowledge.py | .py | f759ab3e64e17dc1 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""스크린샷 OCR — RapidOCR(한국어 PP-OCRv5 인식 모델, Apache-2.0)으로 이미지 → 라인 보존 텍스트.
CORE-3 원안(tesseract.js, 브라우저 클라이언트)은 한글 단일 글자 라벨("키"/"앱")을 반복적으로
오독했다(예: Kakao JS/Native 키). RapidOCR 한국어 인식 모델로 교체 실험 결과 같은 케이스를
전부 정확히 인식해 이 백엔드 경로로 옮긴다 — 로컬 백엔드(127.0.0... | ttogle918/key-manager | backend/app/ocr.py | .py | 87fe5685d545e9dc | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""로컬 Ollama HTTP 클라이언트 — 표준 라이브러리 urllib만 사용(새 런타임 의존성 0).
앱은 어떤 LLM 모델도 번들하지 않는다 — 사용자가 이미 설치·실행 중인 Ollama에만 연결한다(옵트인).
설계 근거: docs/superpowers/specs/2026-08-27-screenshot-explain-design.md 판단 3.
"""
from __future__ import annotations
import ... | ttogle918/key-manager | backend/app/ollama_client.py | .py | 11146c8f6b64c13f | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""RUNTIME-1 SDK 접근 관리 — 프로젝트별 허용 디렉토리 + 승인 대기열.
`keylens-env` SDK가 어떤 디렉토리에서 어떤 프로젝트의 키를 가져갈 수 있는지 관리한다.
테이블은 `vault_repo._SCHEMA`에 함께 정의된다(같은 vault.db, 같은 초기화 시점).
여기서 저장하는 건 프로젝트명·경로 문자열뿐 — 시크릿 값은 전혀 다루지 않는다.
"""
from __future__ import annota... | ttogle918/key-manager | backend/app/sdk_repo.py | .py | fe5975b448f0452c | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""Tavily 웹 검색 클라이언트 — 표준 라이브러리 urllib만 사용(새 런타임 의존성 0).
ollama_client.py와 달리 이 모듈은 절대 예외를 던지지 않는다 — 검색 실패(키 없음·네트워크·타임아웃·
이상한 응답)는 전부 빈 리스트로 조용히 낮춰지고, 호출자는 그걸 "검색 결과 없음"과 동일하게 취급해
ai_unverified로 폴백한다(전체 /explain/image 요청은 계속 진행). 도메인 제한(include... | ttogle918/key-manager | backend/app/tavily_client.py | .py | 049e75d3c0ec8543 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""VAULT-1 SQLite 저장소 — **암호문만 저장한다. 평문 값 컬럼은 존재하지 않는다.** (SPEC 6장)
- `meta`: 금고 단위 KDF 파라미터(솔트·강도) + 비밀번호 검증기(verifier). 키는 저장하지 않는다.
- `entries`: 항목 메타데이터 + nonce + 암호문(GCM 태그 포함). 값 평문 컬럼 없음.
`verifier`는 고정 토큰을 키로 암호화한 것 — 잠금 해제 시 이 값 복호화 성공... | ttogle918/key-manager | backend/app/vault_repo.py | .py | 00f0f1419073b23b | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""키 유효성 검증기 (TRUST-1) — 서비스의 read-only 엔드포인트를 1회 호출해 키 생사 확인.
설계 원칙
- **명시적 실행만**: 자동 주기 호출 없음. 사용자가 버튼을 눌렀을 때만 이 코드가 돈다.
- **read-only만**: 지식베이스가 선언한 GET/HEAD 만 허용(부수효과 있는 호출 차단).
- **값 비노출**: 키는 요청 헤더/쿼리에만 실리고, 반환값은 상태(active/invalid/unknown)... | ttogle918/key-manager | backend/app/verify.py | .py | bc89e1a632fb90cb | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""RapidOCR 한국어 인식 모델을 로컬로 벤더링한다 (재현성 — 런타임 다운로드 제거).
- 감지(det)·각도분류(cls) 모델은 `rapidocr` pip 패키지에 이미 번들되어 있어 별도 벤더링이
필요 없다(패키지 버전 고정 = 자산 고정).
- 한국어 인식(rec) 모델만 별도 다운로드 대상이다(RapidOCR 저장소, Apache-2.0).
app/ocr.py 의 predev 격인 역할 — 백엔드 첫 실행 전(또는... | ttogle918/key-manager | backend/scripts/vendor_ocr_models.py | .py | a0293b3f7859e6e8 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""API 엔드포인트 테스트.
TestClient(httpx→certifi/MPL-2.0)를 피하려고 라우트 함수를 직접 호출한다.
FastAPI 래핑 계층은 얇으므로 로직·모델·지식베이스 로딩은 이걸로 충분히 검증된다.
HTTP 통합은 `uvicorn` 기동 후 수동 스모크로 확인한다 (README 참고).
"""
import asyncio
import io
from pathlib import Path
import pytest
f... | ttogle918/key-manager | backend/tests/test_api.py | .py | f50a67ab27868090 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""CORS 프리플라이트 회귀 테스트.
dev 모드는 프론트(5173)와 백엔드(8003)가 서로 다른 오리진이라, 브라우저가 DELETE·PATCH를
보내기 전에 OPTIONS 프리플라이트를 먼저 던진다. 여기서 거부되면 항목 삭제(DELETE)·
메모/만료일 수정(PATCH)·SDK 디렉토리 해제(DELETE)가 전부 "연결할 수 없어요"로 실패한다.
데스크톱 exe 는 same-origin 이라 이 경로를 타지 않아 증상이 드러... | ttogle918/key-manager | backend/tests/test_cors.py | .py | bf5ee069ea7cecf8 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""DEMO-1 회귀 — 데모 스크린샷의 OCR 재구성 결과를 분류해 기대 env 를 확인한다.
파이프라인: docs/demo/*.png → (브라우저 tesseract.js OCR + reconstruct) → *.recon.txt(골든) → Stage1/2 분류.
OCR 단계(프론트)는 결정적이지만 파이썬에서 재현할 수 없어, 그 출력(재구성 텍스트)을 골든 픽스처로 커밋한다.
이 테스트는 그 골든 텍스트에 대한 **분류 계약**... | ttogle918/key-manager | backend/tests/test_demo_fixtures.py | .py | 2ab209c51fcbe73a | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""local_discoveries.yaml 읽기/쓰기 — 항상 confirmed: false로 저장되는지, 정규화 매칭이 값은
무시하고 라벨 문구만 비교하는지가 핵심."""
import threading
from app.discoveries_repo import append_discovery, find_by_pattern, normalize_pattern
def test_normalize_pattern_replaces_long_... | ttogle918/key-manager | backend/tests/test_discoveries_repo.py | .py | 1d08bcdef6c9b7e8 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""엣지케이스 안정화 (OSS-1) — 잘못된 입력에도 크래시 없음. 모든 값 더미."""
import pytest
from app.classify.pipeline import analyze
from app.knowledge import load_knowledge_base
from app.models import AnalyzeRequest
@pytest.fixture(scope="module")
def kb():
retur... | ttogle918/key-manager | backend/tests/test_edge.py | .py | 6b0fc43a8a6f5126 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""지식베이스 로더 테스트."""
import pytest
from app.knowledge import DEFAULT_KNOWLEDGE_DIR, load_knowledge_base
def test_loads_all_services():
kb = load_knowledge_base()
# 새 YAML 추가에 덜 취약하도록 최소 보장 집합으로 검증(초과는 허용).
expected = {"notion", "kak... | ttogle918/key-manager | backend/tests/test_knowledge.py | .py | 968ce40c9f2d9b41 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""신규 지식베이스 4종(GitHub·AWS·Slack·Stripe) 값 기반 분류 테스트.
핵심: 코드 수정 0, YAML 추가만으로 새 서비스가 분류 대상에 포함되는지 검증.
⚠️ 모든 키는 명백한 더미(형식만 유효, 실제 발급 키 아님).
"""
import pytest
from app.classify.stage1 import classify_text
from app.knowledge import load_knowledge_b... | ttogle918/key-manager | backend/tests/test_new_services.py | .py | 16aa34de9a034171 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""OCR 줄 단위 박스 좌표 보존(화면 설명 기능용) — 실제 데모 스크린샷으로 검증.
한국어 인식 모델이 로컬에 벤더링돼 있지 않으면 스킵한다
(test_ocr_demo_screenshots.py 와 동일 관례 — CI는 벤더링 후 실행하므로 실제로 돈다).
"""
from pathlib import Path
import pytest
from app.ocr import _KOREAN_REC_MODEL, run_ocr, run_... | ttogle918/key-manager | backend/tests/test_ocr.py | .py | 685a64ad10fe8314 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""백엔드 OCR(RapidOCR, CORE-3 백엔드 이전) 회귀 — 데모 스크린샷 8종을 직접 읽어 분류한다.
브라우저 tesseract.js 골든 픽스처(test_demo_fixtures.py)와 달리, 이 경로는 이미지→분류를
한 번에 검증한다(RapidOCR는 ONNX 추론이라 결정적 — 스냅샷 텍스트를 따로 커밋할 필요 없음).
한국어 인식 모델이 로컬에 벤더링돼 있지 않으면(scripts/vendor_ocr_models.... | ttogle918/key-manager | backend/tests/test_ocr_demo_screenshots.py | .py | 528093b2f8d83d56 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""Ollama 서비스 분류 테스트 (값 기반). 모든 값은 더미."""
import pytest
from app.classify.pipeline import analyze
from app.knowledge import load_knowledge_base
from app.models import AnalyzeRequest
# 더미 Ollama 키 포맷: 32 hex + '.' + 24 base62 (명백한 가짜 — 실제 키 아님)
... | ttogle918/key-manager | backend/tests/test_ollama.py | .py | a9b2fd1f0aae339e | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""Stage1 값 기반 분류 테스트.
⚠️ 모든 키는 명백한 더미 값 (CLAUDE.md 시크릿 위생).
"""
import pytest
from app.classify.stage1 import classify_text, extract_candidates
from app.knowledge import load_knowledge_base
# 명백히 가짜인 더미 키들 (형식만 유효, 실제 발급 키 아님)
OPENAI_KEY = "s... | ttogle918/key-manager | backend/tests/test_stage1.py | .py | 1845cffc606975c8 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""Stage2 맥락 기반 분류 테스트 (차별점). 모든 값은 더미."""
import pytest
from app.classify.pipeline import analyze
from app.classify.stage2 import classify_context
from app.knowledge import load_knowledge_base
from app.models import AnalyzeRequest
UUID_DASH = ... | ttogle918/key-manager | backend/tests/test_stage2.py | .py | b7170cc0124c2ef3 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""VAULT-2 세션/인증 테스트 (SPEC 6장 AC). clock 주입으로 시간 경과를 시뮬레이트. 값은 더미."""
import pytest
from app import crypto
from app.vault_session import VaultLocked, VaultRateLimited, VaultService
MASTER = "correct horse battery staple"
DUMMY = "sk-proj-DummyT... | ttogle918/key-manager | backend/tests/test_vault_session.py | .py | 7cfa3d4c37466dd8 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""TRUST-1 키 유효성 검증기 테스트 — 실제 네트워크 없이 fetcher 를 주입한다.
모든 키 값은 명백한 더미다. 검증 상태 매핑과 값 비노출을 확인한다.
"""
from __future__ import annotations
import pytest
from app.models import VerifySpec
from app.verify import build_request, check_key, classify_stat... | ttogle918/key-manager | backend/tests/test_verify.py | .py | 4b5c8e2777687f63 | 7.5 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""KeyLens 데스크톱 런처 (A) — 로컬 웹앱을 네이티브 창 하나로 감싼다.
동작:
1. FastAPI 백엔드(app.main:app)에 빌드된 프론트(frontend/dist)를 정적 서빙으로 마운트
→ API와 SPA가 **같은 오리진**에서 제공된다(포트 상관없이 same-origin, CORS 불필요).
2. uvicorn 을 백그라운드 스레드로 127.0.0.1 로컬에만 바인딩해 기동.
3. pyw... | ttogle918/key-manager | desktop/app.py | .py | ba3c5049f9948ce9 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""RUNTIME-1 데스크톱 승인 알림 — 작업표시줄 깜빡임 + OS 토스트 + SPA 화면 전환.
전부 best-effort: 어느 하나가 실패해도 SDK 요청 흐름에 영향을 주지 않는다(그래서
build_notifier()의 결과를 VaultService.set_pending_hook()에 그대로 연결해도 안전하다).
사용자는 최소한 PendingScreen의 화면 안 배너로 뒤늦게라도 확인할 수 있다.
"""
from __fu... | ttogle918/key-manager | desktop/notify.py | .py | 85f8dc2981bf6086 | 7 | 0 |
# SPDX-FileCopyrightText: 2026 [Your Name]
# SPDX-License-Identifier: MIT
"""RUNTIME-1 desktop/notify.py 유닛테스트 — 플랫폼 가드·예외 흡수만 검증.
OS 토스트·작업표시줄 깜빡임 자체는 수동 검증 대상(README 참고).
"""
import builtins
import sys
import threading
import time
import pytest
import notify
class FakeWindow:
def __init__(self, raise_on_evalu... | ttogle918/key-manager | desktop/test_notify.py | .py | cb4fe6d85ee5f5b3 | 7.5 | 0 |
"""Verify project parameter classes and validate frozen parameter values."""
from __future__ import annotations
import hashlib
import importlib.util
import json
import os
import sys
import tempfile
from pathlib import Path
from typing import cast
from pydantic import BaseModel, ConfigDict, JsonValue
from . import p... | pvd232/viper | src/viper/_parameter_validation.py | .py | 24372997ab1c5369 | 7 | 0 |
"""Define shared protocol scalars, validators, and the frozen model base."""
from __future__ import annotations
import re
from typing import Annotated, Literal
from pydantic import AfterValidator, BaseModel, ConfigDict, Field
from .ids import HumanId, InputName
def validate_repo_rel_path(value: str) -> str:
"... | pvd232/viper | src/viper/_schema.py | .py | ec0626d26f6081e3 | 7 | 0 |
"""Define the public values returned by verification operations."""
from __future__ import annotations
from dataclasses import dataclass
from .._schema import DataRole, RepoRelPath
from ..artifacts import ResolvedArtifact
from ..benchmark import BenchmarkResult, BenchmarkSpec
from ..experiments import ExperimentSpec... | pvd232/viper | src/viper/_verification/models.py | .py | 75a611a84ee72a7b | 7 | 0 |
"""Construct canonical paths used by verification operations."""
from .._schema import RepoRelPath
from ..ids import StageId
from ..runs import RunSpec
def run_root(run: RunSpec) -> RepoRelPath:
"""Return the canonical repository root for one run's records and outputs."""
return f"experiments/{run.experiment... | pvd232/viper | src/viper/_verification/paths.py | .py | eca979a9ef65d283 | 7 | 0 |
"""Validate verified artifact representations through project-owned loaders."""
from __future__ import annotations
import hashlib
import importlib.util
import json
import os
import sys
from pathlib import Path
from typing import Literal, cast
from pydantic import BaseModel, ConfigDict, model_validator
from ._schema... | pvd232/viper | src/viper/artifact_loaders.py | .py | 05c5e909d3c74dd3 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.