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 |
|---|---|---|---|---|---|---|
import { expect, test } from "@playwright/test";
// Chat can dock at the bottom now (not just the side rails). Its slot mounts unconditionally
// on whichever dock holds it, so an in-flight conversation survives switching the bottom dock
// to another surface and back — the #613 streaming-continuity contract, on the b... | protoLabsAI/protoAgent | apps/web/e2e/chat-bottom-dock.spec.ts | .ts | a459db1010316c09 | 7 | 9 |
import { expect, test } from "@playwright/test";
// Chat continuity (the protoMaker pattern): navigating to another surface and
// back must NOT tear down the chat — ChatSurface stays mounted (hidden), so an
// in-flight turn keeps streaming and the conversation is intact on return.
async function rail(page, name: st... | protoLabsAI/protoAgent | apps/web/e2e/chat-continuity.spec.ts | .ts | b9372d8b6215ef88 | 7 | 9 |
import { expect, test } from "@playwright/test";
// Terminal-style input history (#1496): ↑ recalls previously-submitted messages into the
// composer, ↓ walks back toward the live draft. Fresh browser context per test → clean
// localStorage-backed history.
test("↑/↓ recalls and walks submitted-message history", asy... | protoLabsAI/protoAgent | apps/web/e2e/chat-input-history.spec.ts | .ts | 9b6a8d6591cc7c37 | 7 | 9 |
import { expect, test } from "@playwright/test";
// Reattach vs a PAUSED turn (#3082): after a fleet agent switch / reload, a turn
// parked on operator input (input-required — a pending HITL form or approval
// gate) must come back USABLE. The old reattach poller treated paused states as
// in-flight and spun its ful... | protoLabsAI/protoAgent | apps/web/e2e/chat-reattach-paused.spec.ts | .ts | 3c54242ecaf5e3eb | 7 | 9 |
import { expect, test } from "@playwright/test";
// Stuck-stream self-heal (reconcile): a chat message left in `streaming` after an
// interrupted stream (reload / network / a stale tab) must reconcile against the
// server's durable task on load — A2A tasks/get — and finalize, instead of
// spinning forever. We seed ... | protoLabsAI/protoAgent | apps/web/e2e/chat-reconcile.spec.ts | .ts | 07b982aa96210ed5 | 7 | 9 |
import { expect, test } from "@playwright/test";
// The chat surface is a SLOT (ADR 0045): a plugin view declaring `slot: "chat"`
// replaces the built-in chat panel — rendered under the core "chat" rail id, kept
// mounted for the app's lifetime (#613 streaming continuity), and given no extra
// rail icon. These spec... | protoLabsAI/protoAgent | apps/web/e2e/chat-slot.spec.ts | .ts | 73a7ef5bdf35343c | 7 | 9 |
import { expect, test } from "@playwright/test";
// Mid-turn steering ✕-cancel (#1103, shipped in #1104). While a turn streams, a
// message the user submits is QUEUED as a steer (folds into the agent's work at its
// next model call) and shown as a dimmed pending bubble with a ✕. Clicking the ✕
// must dequeue it ser... | protoLabsAI/protoAgent | apps/web/e2e/chat-steer-cancel.spec.ts | .ts | e6f3dd8d496f3125 | 7 | 9 |
import { expect, test } from "@playwright/test";
// The already-drained steer (#3214). Cancelling a queued message races the agent reading it:
// `DELETE …/steer/{id}` answers `removed: false` when the agent got there first. The console
// must then RESTORE the pending bubble rather than drop it — dropping it would cl... | protoLabsAI/protoAgent | apps/web/e2e/chat-steer-drained.spec.ts | .ts | 761d2c6fd2f40423 | 7 | 9 |
import { expect, test } from "@playwright/test";
// ↑-to-edit a queued steer (#2837 follow-up). The composer promises "Press ↑ to edit queued
// message"; ↑ must PULL that message out of the running turn — dequeue it server-side
// (DELETE /api/chat/sessions/{id}/steer/{msgId}, the same call the bubble's ✕ makes), dro... | protoLabsAI/protoAgent | apps/web/e2e/chat-steer-edit.spec.ts | .ts | 07863230b834eb0b | 7 | 9 |
import { expect, test } from "@playwright/test";
// Composer Stop (#1617). While a turn streams, the Stop control must actually
// halt it: a server-side A2A CancelTask on the wire — the only thing that stops
// the turn when the local stream can't be aborted (the desktop relay ignores the
// abort signal; a re-attach... | protoLabsAI/protoAgent | apps/web/e2e/chat-stop.spec.ts | .ts | 79d12ad12c985590 | 7 | 9 |
import { expect, test } from "@playwright/test";
import { expandToolCard } from "./toolcard";
import { seedCurrentChat } from "./chat-helpers";
// Drives the chat surface against the mock A2A stream and asserts the
// tool-call card contract: stable collapsed-by-default rows, pretty-printed
// JSON on expand, clean ... | protoLabsAI/protoAgent | apps/web/e2e/chat.spec.ts | .ts | aca2206c83f006f4 | 7 | 9 |
import { expect, test } from "@playwright/test";
import { SLASH_COMMANDS } from "./fixtures.mjs";
// The chat composer fetches the server's registered slash commands
// (GET /api/chat/commands) and autocompletes them as you type "/name".
// Deterministic client-side commands (ADR 0057) surface FIRST, then the server... | protoLabsAI/protoAgent | apps/web/e2e/commands.spec.ts | .ts | 07369a78d00c9352 | 7 | 9 |
import { expect, test } from "@playwright/test";
// Inline chat components (ADR 0051 / #1323): show_component emits a component-v1 DataPart
// that the console's extensible registry renders inline — below the answer, in order, with
// the show_component tool card suppressed (it's a render directive, not work to fold).... | protoLabsAI/protoAgent | apps/web/e2e/component.spec.ts | .ts | a18407317db99c7a | 7 | 9 |
import { expect, test } from "@playwright/test";
import { expandToolCard } from "./toolcard";
// Each expanded tool section has a copy button that writes the raw value to the
// clipboard. Grant clipboard permissions so we can read it back and verify.
test.use({ permissions: ["clipboard-read", "clipboard-write"] });
... | protoLabsAI/protoAgent | apps/web/e2e/copy.spec.ts | .ts | c8f68e8ffdc9ad26 | 7 | 9 |
import { expect, test } from "@playwright/test";
// The Delegates panel (ADR 0025) is a built-in core surface with its own top-level
// Settings ▸ Workspace ▸ Delegates section (ADR 0048): it lists the configured delegates
// (GET /api/delegates), and an Add form with a type picker driven by GET
// /api/delegate-types... | protoLabsAI/protoAgent | apps/web/e2e/delegates.spec.ts | .ts | e20e54a987182add | 7 | 9 |
import { expect, test } from "@playwright/test";
// Developer flags panel (ADR 0068). The mock serves channel "dev", so the Developer section
// appears under Settings ▸ This console; toggling a flag persists a device-local override that
// a Reset clears.
test("Developer panel lists flags and a toggle persists as an... | protoLabsAI/protoAgent | apps/web/e2e/developer-flags.spec.ts | .ts | 62723a4b4c2fee9d | 7 | 9 |
import { expect, test, type Page } from "@playwright/test";
// #1938 — a completed long tool-call turn rendered its reply TWICE in the console
// while the server had it once. The live repro shape: two console boots ~1s apart
// (tab + PWA / a fast reload) sharing one localStorage key, then a 20–60s image-tool
// turn... | protoLabsAI/protoAgent | apps/web/e2e/double-render.spec.ts | .ts | 8e1908f060a83d2f | 7 | 9 |
import { expect, test } from "@playwright/test";
// The console opens a server→client SSE channel (GET /api/events, ADR 0003) for the
// app's lifetime. The dedicated topbar "live" indicator was removed with the status
// light; the goal.achieved toast below still exercises the channel end-to-end — the
// event only a... | protoLabsAI/protoAgent | apps/web/e2e/events.spec.ts | .ts | fbe21639dbc45742 | 7 | 9 |
import { expect, test } from "@playwright/test";
// bd-1n7: a message can be sent with an attachment and NO typed text (e.g.
// attach a doc/image and hit send with an empty field). The DS PromptInput
// (@protolabsai/ui ≥ 0.34) enables submit when attachments are present, and the
// composer's send gate matches.
test... | protoLabsAI/protoAgent | apps/web/e2e/file-only-send.spec.ts | .ts | 9185b35304d2fc29 | 7 | 9 |
import { expect, test } from "@playwright/test";
// #1973: a HITL interrupt (ask_human free-text / request_user_input wizard) must
// FLOAT above the chat — a card pinned over the composer — instead of rendering
// in-flow and reflowing the conversation. These specs pin the geometry contract:
// the conversation scrol... | protoLabsAI/protoAgent | apps/web/e2e/hitl-float.spec.ts | .ts | 1dd7e29caa58388d | 7 | 9 |
import { expect, test } from "@playwright/test";
// #1978: HitlForm defaults + keyboard contract for AGENT-driven interrupts (the /model
// slash-picker side lives in model-command.spec.ts). The floating card takes focus on
// appear (the default-selected choice card when one exists, else the first control),
// schema... | protoLabsAI/protoAgent | apps/web/e2e/hitl-keyboard.spec.ts | .ts | 84bbf51f9092ea5f | 7 | 9 |
import { expect, test } from "@playwright/test";
// Images always attach natively as multimodal parts (#1969): a vision model sees
// them, and on a text-only model the server bridges them into the media store so
// image tools can act on them by id — the old #1374 hard error is gone. A configured
// describe model (#... | protoLabsAI/protoAgent | apps/web/e2e/image-attach.spec.ts | .ts | 56d79850f2cee96c | 7 | 9 |
import { expect, test } from "@playwright/test";
// Incognito threads (ADR 0069 D3b): while a tab's toggle is ON, EVERY message it
// sends carries metadata.incognito — the backend flag is per-message, so a single
// missed send would leak that turn into memory. Asserted at the WIRE level by
// capturing the /a2a requ... | protoLabsAI/protoAgent | apps/web/e2e/incognito.spec.ts | .ts | 3b4a40bd76379f02 | 7 | 9 |
import { expect, test } from "@playwright/test";
import { seedCurrentChat } from "./chat-helpers";
// The keybinding system (ADR 0063): a scoped, user-rebindable global keyboard layer. In
// headless Chromium there's no browser chrome, so even browser-reserved combos (⌘T, ⌘1)
// reach the page. `ControlOrMeta` matche... | protoLabsAI/protoAgent | apps/web/e2e/keybindings.spec.ts | .ts | 95c39f88f1a36620 | 7 | 9 |
import { expect, test } from "@playwright/test";
// Knowledge: a searchable window onto the agent's knowledge base (findings,
// notes, daily-log). A single panel — Skills moved to the Agent section.
// The promote/unshare spec MUTATES the shared mock (a chunk flips private→commons,
// then a commons chunk is dropped... | protoLabsAI/protoAgent | apps/web/e2e/knowledge.spec.ts | .ts | 6f83dff5b16335b7 | 7 | 9 |
import { expect, test } from "@playwright/test";
// The right panel (DS AppShell right column) is collapsible (bottom utility-bar
// toggle) and resizable (drag its left edge / arrow keys); state persists to
// localStorage. Double-clicking the handle collapses it (DS behavior).
test("right panel collapses + restores... | protoLabsAI/protoAgent | apps/web/e2e/layout.spec.ts | .ts | e2fc815694a9ba03 | 7 | 9 |
"""RoboTwin deploy-policy entry point for Streaming-WAM.
RoboTwin imports ``deploy_policy.py`` from ``RoboTwin/policy/<policy_name>`` and
calls get_model / eval / reset_model. This file stays lightweight so it can be
imported in a SAPIEN-only environment. The heavy Torch/Streaming-WAM stack is imported
only when ``pol... | SJTU-DENG-Lab/StreamWAM | examples/robotwin/deploy_policy.py | .py | aff7b84c3e8e8ff1 | 7.42 | 6 |
"""In-process RoboTwin 2.0 policy adapter for Streaming-WAM.
This plugs a Streaming-WAM checkpoint directly into the official RoboTwin evaluation
harness (``RoboTwin/script/eval_policy.py``). Use it when SAPIEN and the
Torch/Streaming-WAM stack live in the same Python environment.
RoboTwin harness entry points: get_m... | SJTU-DENG-Lab/StreamWAM | examples/robotwin/local_policy.py | .py | 3649d3951018681c | 7.42 | 6 |
"""Inference-mode and backend contracts for RoboTwin evaluation."""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class InferenceRuntime:
inference_mode: str
backend: str
@property
def accelerated(self) -> bool:
return self.backend == "accelera... | SJTU-DENG-Lab/StreamWAM | examples/robotwin/runtime.py | .py | 4207779c4347d5bc | 7.42 | 6 |
"""Base backbone abstract class and BackboneInfo dataclass."""
from abc import ABC, abstractmethod
from dataclasses import dataclass
import torch
import torch.nn as nn
from typing import Optional
@dataclass
class BackboneInfo:
"""Architecture parameters auto-inferred from checkpoint. Never manually set by user."... | SJTU-DENG-Lab/StreamWAM | streamingwam/backbone/base.py | .py | b3babc29d861fdc3 | 7.42 | 6 |
"""Public inference checkpoint dispatch by source format."""
from pathlib import Path
from typing import Any
import torch
from streamingwam.checkpointing.fastwam_format import (
load_fastwam_checkpoint,
load_fastwam_stats,
prepare_fastwam_config,
)
from streamingwam.checkpointing.streamingwam_format impo... | SJTU-DENG-Lab/StreamWAM | streamingwam/checkpointing/loader.py | .py | 1217a8634319dd9e | 7.42 | 6 |
"""Consistency-distillation boundary functions.
These functions contain no scheduler or model state so the same equations can
be shared by direct CD and AC-Stream sampling.
"""
import torch
from torch import Tensor
def sample_joint_consistency_noise(
video_shape: tuple[int, ...],
action_shape: tuple[int, ..... | SJTU-DENG-Lab/StreamWAM | streamingwam/inference/consistency.py | .py | fbe9c9cdf8fc5f33 | 7.42 | 6 |
"""Mixture-of-Transformers (MoT) layer for Streaming-WAM.
MoT is backbone-agnostic at the algorithm level. It does not require Wan2.2
specifically; it requires each expert returned by a backbone/action module to
implement the MoT expert contract:
- ``expert.blocks``: ordered transformer blocks with the same layer cou... | SJTU-DENG-Lab/StreamWAM | streamingwam/modules/mot.py | .py | c37afe8697691e6f | 7.42 | 6 |
"""Which charter this plane tracks, and which charter is actually installed.
Two questions that look like one and are not, which is why they live side by side here
rather than being folded into each other:
* **The channel** — ``[update] channel`` in the plane's ``charter.toml``. What the
operator asked for. Read th... | diazoxide/charter | charter/channel.py | .py | bc84ea357703c993 | 7.59 | 14 |
"""`charter harness` — which agent runtimes charter knows, and arming the opt-in one.
Most harness wiring is `init`'s job and happens inside the plane. Codex is the exception,
and the reason it needs a command of its own is scope rather than complexity: it keeps
hooks only in `~/.codex/config.toml`, so arming them rea... | diazoxide/charter | charter/commands_harness.py | .py | 072768d032258898 | 7.59 | 14 |
"""`charter report` — handlers for drafting a report about charter itself.
Two commands, because the second one **is** the consent (docs/adr/0003). These are the
first: they draft, scrub, store and *show*. Nothing here touches the network — that is
what lets detection default to on without charter reading as telemetry... | diazoxide/charter | charter/commands_report.py | .py | 555ae2f6d009ce5f | 7.59 | 14 |
"""Deterministic memory-curation engine — the analysis + safe-auto half of memory
optimization. It finds curation candidates (exact/near duplicates, stale entries,
index drift, charter-worthy rules) and applies only the **tier-1 safe & reversible**
ops; the lossy / human-owned ops (near-dup merges, stale archives, char... | diazoxide/charter | charter/curate.py | .py | 1f8cb5e2be3c5a4f | 7.59 | 14 |
"""charter's own documentation pages, resolved for the CLI to print.
A control plane has no reason to vendor a copy of these pages, and every reason not to:
a copy drifts from the binary that implements what it describes, in both directions and
invisibly. The page a user reads should come from the same install as the ... | diazoxide/charter | charter/docsrc.py | .py | f40cde4f67c1578d | 7.59 | 14 |
"""Which forge does this control plane — or this repo — use?
A control plane declares one or more ``[[forge]]`` blocks in ``charter.toml``. Each repo
record carries a ``forge`` stamp so a merged, multi-forge inventory stays unambiguous.
"""
from __future__ import annotations
import re
from .base import Forge
from .g... | diazoxide/charter | charter/forge/registry.py | .py | f20b23d0e1012c17 | 7.59 | 14 |
"""Charter's own actions — the rows the menu used to hold, expressed as the public seam.
`builtins.py` is this module one contract over: charter's own panels go through the
component seam a provider gets, and charter's own commands go through the action seam a
provider gets. There is no private table of rows beside th... | diazoxide/charter | charter/frame/builtin_actions.py | .py | 20b41d12c1e97cd8 | 7.59 | 14 |
"""The pickers: choosing a workspace or a persona from inside a running frame.
**This is `frame/overlay.py` over a list of NAMES, and that is the whole of it** — the
seam `frame/palette.py` named when it wrote `rows(offers)` beside `Palette(catalogue=…)`:
Task 6's workspace and persona pickers are the same :class... | diazoxide/charter | charter/frame/choose.py | .py | c9aa4d1d8a3a068e | 7.59 | 14 |
"""What a component is: identity, edge, size policy, declared cost, accepted events.
A slot is a string in a list whose POSITION is secretly geometry. A component is the
thing that replaces it — a named part of the frame that knows its own edge, how big it
wants to be, what it reads and which events it accepts (spec §... | diazoxide/charter | charter/frame/component.py | .py | cd53f4a1744e033c | 7.59 | 14 |
"""What a component is handed when it draws: geometry, identity, chrome, and its
declared slices.
**Constructed FROM ``needs``** (§4e). A component receives an object holding exactly what
it declared plus what every component is served (:data:`ALWAYS`), and asking for
anything else raises with the name of
the thing to... | diazoxide/charter | charter/frame/ctx.py | .py | b324558a42a46955 | 7.59 | 14 |
"""The palette: every action, narrowed by typing, run by Enter.
**`F2` is the palette, and the menu no longer exists** (§4h). Not a new key beside the
old one — the menu was always trying to be a palette, and keeping both would leave two
answers to "how do I do a thing", which is how the single menu became weird in th... | diazoxide/charter | charter/frame/palette.py | .py | dd5fa9da2d98ff97 | 7.59 | 14 |
"""The pane this process was given.
**A panel's pane IS `sys.stdout`.** The descriptor it paints into is the same one it
measures its rectangle from, so that name is not an output stream here — it is the
rectangle. Which makes it exactly the wrong thing to ask, because what is bound to it is a
mutable global that any ... | diazoxide/charter | charter/frame/pane.py | .py | 0f64f8390193115c | 7.59 | 14 |
"""Choosing a workspace before the harness starts — #518.
`charter <harness>` resolved one silently and went straight into the frame; choosing
where to work meant quitting, running `charter workspace use <name>`, and launching
again. This is the prompt that replaces that round trip.
**Where it lives, and why it is no... | diazoxide/charter | charter/frame/picker.py | .py | d0736a3a39450c8c | 7.59 | 14 |
"""Moving a running frame to another workspace or persona — #517, and the half of #518
that happens once a name has been chosen.
One mechanism, four steps, and every surface that switches goes through it: **list the
names, contain them, perform the switch, repaint the panels.** The palette
(`frame/builtin_actions._reg... | diazoxide/charter | charter/frame/switch.py | .py | 90d308d023c5a29c | 7.59 | 14 |
"""Control-plane *freshness*: is a running Claude session behind the committed control-plane
config? A session bakes ``CLAUDE.md`` + the system prompt into its context at start and
only a *fresh* (non-resumed) session re-reads them, so when new features/prompts land the
best we can do is *append* an awareness signal to... | diazoxide/charter | charter/freshness.py | .py | 65b0f79e58ff3f2b | 7.59 | 14 |
"""**Golden rule 0: one credential — PER FORGE.** Every git operation in a control plane —
and in every repo clone under it — authenticates with *that repo's own forge's* token over
HTTPS. No SSH keys, no 1Password agent, no commit signing. One credential per forge (not one
credential, full stop — a GitLab clone uses `... | diazoxide/charter | charter/gitpolicy.py | .py | 1e877ea4d473df5c | 7.59 | 14 |
#!/usr/bin/env python3
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""Install benchmark dependencies.
Usage:
uv run benchmark/install_benchmark.py proced_mem_bench [--force] [--commit-hash <hash>]
uv run benchmark/install_benchmark.py wikihow_procedure_silver [--raw-dir <dir>]
uv ... | skhynix/MemFlow | benchmark/install_benchmark.py | .py | 71ef360a93df5975 | 7.52 | 10 |
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import json
from dataclasses import dataclass
from typing import Any
from procedural_memory_benchmark import RetrievalSystem, RetrievedTrajectory
from procedural_memory_benchmark.agentinstruct import AgentInstruct... | skhynix/MemFlow | benchmark/proced_mem_bench/adapter.py | .py | 44c9dac84243f529 | 7.52 | 10 |
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import json
import math
from dataclasses import dataclass
from pathlib import Path
from statistics import mean
from typing import Any
from procedural_memory_benchmark.utils.paths import get_query_bank_path
# Rele... | skhynix/MemFlow | benchmark/proced_mem_bench/evaluation.py | .py | 14db5d253c3e6a3d | 7.52 | 10 |
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""Adapter for SkillRet benchmark corpus and retrieval."""
from __future__ import annotations
import json
import os
from collections import Counter
from dataclasses import asdict, dataclass, field, replace
from pathlib import Path
from typing impor... | skhynix/MemFlow | benchmark/skill_ret_bench/adapter.py | .py | 21d2e12227f823c0 | 7.52 | 10 |
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""Evaluation module for SkillRet benchmark."""
from __future__ import annotations
import math
from dataclasses import dataclass
from pathlib import Path
from statistics import mean
from typing import Any
from .adapter import iter_jsonl_records
... | skhynix/MemFlow | benchmark/skill_ret_bench/evaluation.py | .py | f6542dbdf69860e8 | 7.52 | 10 |
#!/usr/bin/env python3
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""Seed WikiHow Procedure Silver corpus into MemFlow.
This script loads pre-processed WikiHow procedures from a JSONL file
and seeds them into MemFlow storage.
Usage:
# Basic usage (uses all defaults, async parallel mode)... | skhynix/MemFlow | benchmark/wikihow_procedure_silver/run_seeding.py | .py | b7c052800a661ed4 | 7.52 | 10 |
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""ANSI color utilities for terminal output."""
class Colors:
"""ANSI color codes for terminal output."""
BOLD = "\033[1m"
CYAN = "\033[96m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
RED = "\033[91m"
MAGENTA = "\033[95m"
... | skhynix/MemFlow | examples/utils.py | .py | 00aa63cfe84a0e01 | 7.52 | 10 |
#!/usr/bin/env python3
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""
Run the experimental MemFlow interactive console.
"""
from __future__ import annotations
import importlib.util
import sys
import types
from pathlib import Path
def _load_cli_main():
root = Path(__file__).resolve().p... | skhynix/MemFlow | memflow.py | .py | 4d3e8db40736da25 | 7.52 | 10 |
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""
Learner for MemFlow Phase 3.
After run() completes, Learner analyses the successful executed steps and asks
the LLM to extract a reusable Procedure (SOP). If a procedure is extracted
it is returned to the caller for storage (Learn → Retrieve ba... | skhynix/MemFlow | memflow/learner.py | .py | b7bd33f446fd3516 | 7.52 | 10 |
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""
LLM abstraction for MemFlow.
Supported providers:
- ollama: Local Ollama server (default)
- openai-compatible: Any OpenAI-compatible API endpoint (vLLM, LM Studio, etc.)
Example — vLLM:
LLMFactory.create("openai-compatible", mo... | skhynix/MemFlow | memflow/llm.py | .py | 4e73c485dec3ad52 | 7.52 | 10 |
# Copyright 2026 SK hynix Inc.
# SPDX-License-Identifier: Apache-2.0
"""User-facing commands for managing indexed MemFlow skills."""
from __future__ import annotations
import argparse
import json
import os
from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING, Any, TextIO
fr... | skhynix/MemFlow | memflow/skill_cli.py | .py | 520a96e77f579c6b | 7.52 | 10 |
from fastapi.openapi.utils import get_openapi
from app.common.middleware import middlewares
from app.core.constants import SwaggerConfig
from app.core.errors import exception_handlers
from app.internal.api import routers
from fastapi import FastAPI
from .lifespan import lifespan
def create_app() -> FastAPI:
"""... | hongch666/mix-web-demo | fastapi/app/app.py | .py | 610dbeb3bf394331 | 7.52 | 10 |
import inspect
from functools import wraps
from typing import Any, Callable, Dict, Optional, TypeVar
from app.common.middleware import get_current_internal_token
from app.core.auth import InternalTokenUtil
from app.core.base import Logger
from app.core.constants import HttpCode, Messages
from app.core.errors import Bu... | hongch666/mix-web-demo | fastapi/app/common/decorators/requireInternalToken.py | .py | 1863a07d8724ccf8 | 7.52 | 10 |
from datetime import datetime, timedelta
from typing import Any, Dict, Optional
import jwt
from app.core.constants import HttpCode, Messages
from ..config.config import load_config
from ..errors.exceptions import BusinessException
class InternalTokenUtil:
"""内部服务令牌工具类,用于生成和验证内部服务之间通信的JWT令牌"""
_instance: Op... | hongch666/mix-web-demo | fastapi/app/core/auth/internalToken.py | .py | c0e871bc75a2a5f8 | 7.52 | 10 |
from typing import Any, Optional
from app.core.constants import HttpCode
from pydantic import BaseModel
class ApiResponse(BaseModel):
"""统一响应模型
Attributes:
code: 响应码, 与 HTTP 状态码一致
data: 返回数据, 默认为 None
msg: 响应消息
"""
code: int
data: Optional[Any] = None
msg: str = "suc... | hongch666/mix-web-demo | fastapi/app/core/base/response.py | .py | e3993382cbe8b257 | 7.52 | 10 |
import time
from typing import Any, Dict, Optional
import httpx
from app.common.middleware import (
get_current_session_id,
get_current_token,
get_current_user_id,
get_current_username,
)
from app.core.auth import InternalTokenUtil
from app.core.base import Logger
from app.core.config import load_confi... | hongch666/mix-web-demo | fastapi/app/core/client/client.py | .py | ccc97870fe4ca5bb | 7.52 | 10 |
import socket
import threading
import time
from typing import Any, Dict, List
import nacos
from app.core.base import Logger
from app.core.constants import HttpCode, Messages
from app.core.errors import BusinessException
from ..config.config import load_config
# Nacos 配置
nacos_config: Dict[str, Any] = load_config("na... | hongch666/mix-web-demo | fastapi/app/core/client/nacos.py | .py | 51ab86215c80d3a4 | 7.52 | 10 |
import os
import re
from io import StringIO
from pathlib import Path
from typing import Any, Dict, Optional
import yaml
from app.core.constants import Messages
from dotenv import load_dotenv
# 在应用启动时加载 .env 文件
load_dotenv()
def resolve_env_vars_in_string(text: str) -> str:
"""
替换字符串中的环境变量占位符
支持格式:${VAR_... | hongch666/mix-web-demo | fastapi/app/core/config/config.py | .py | a318773a171af2f5 | 7.52 | 10 |
class Prompts:
"""
LLM 提示词模板类 — Agent 的 System Prompt、工具描述、Cypher 查询映射
"""
# ===== Agent 提示词模板 =====
@staticmethod
def AGENT_PROMPT() -> str:
return f"""你是一个中文 AI 助手,负责查询数据库信息、搜索文章内容、分析系统日志和使用知识图谱分析实体关系。
你可以直接调用绑定好的工具,不需要手写 Thought/Action/Observation 这种文本格式。
规则:
... | hongch666/mix-web-demo | fastapi/app/core/constants/prompts.py | .py | e5efe9d79dbcc47e | 7.52 | 10 |
class RedisKeys:
"""
Redis key 常量类 — 集中定义项目内所有 Redis key / 前缀 / 模式,作为唯一来源。
此前这些 key 散落在各缓存子类、任务模块以及 messages.py / defaults.py 两处,
其中分布式锁 key 还在两个常量文件里重复定义、引用也不一致。
统一收口到本类后:
- 修改前缀只需改这一处;
- 消除 lock:task:* 的重复定义与引用不一致问题。
"""
# ===== 缓存 key =====
@staticmethod
def article_co... | hongch666/mix-web-demo | fastapi/app/core/constants/redisKeys.py | .py | 8b4d6750d8170747 | 7.52 | 10 |
from typing import Dict, List, Tuple
class Scripts:
"""
脚本类 — SQL 语句、Cypher 语句、安全规则(SQL / 数据脱敏)
"""
@staticmethod
def NEO4J_SQL_INCREMENTAL_SUFFIX_FORMAT(
base_sql: str, timestamp_column: str, sync_time_text: str
) -> str:
return f"{base_sql} WHERE {timestamp_column} >= '{sync... | hongch666/mix-web-demo | fastapi/app/core/constants/scripts.py | .py | c106b217953a3cac | 7.52 | 10 |
import asyncio
import time
from threading import Condition, Lock
from typing import Any, Dict, List, Optional
from app.core.base import Logger
from app.core.config import load_config
from app.core.constants import Messages
from clickhouse_driver import Client
class ClickhouseConnectionPool:
"""ClickHouse 连接池 - 单... | hongch666/mix-web-demo | fastapi/app/core/db/clickhouse.py | .py | 003f878101dedebc | 7.52 | 10 |
import asyncio
from functools import lru_cache
from typing import Any, Dict, List, Optional
from app.core.base import Logger
from app.core.config import load_config
from app.core.constants import Messages
from neo4j import AsyncGraphDatabase, AsyncSession
class Neo4jClient:
"""Neo4j 异步客户端封装"""
def __init__(... | hongch666/mix-web-demo | fastapi/app/core/db/neo4j.py | .py | c5f16a314cbfbb24 | 7.52 | 10 |
from functools import lru_cache
from typing import Any, Dict
from app.core.base import Logger
from app.core.config import load_config
from app.core.constants import Messages
def get_postgres_config() -> Dict[str, Any]:
"""获取 PostgreSQL 配置"""
return load_config("database")["postgres"]
@lru_cache
def get_pgv... | hongch666/mix-web-demo | fastapi/app/core/db/postgresql.py | .py | eba39b993321be17 | 7.52 | 10 |
import asyncio
import json
from typing import Any, Dict, Optional
import aio_pika
from app.core.base import Logger
from app.core.config import load_config
from app.core.constants import Messages
class RabbitMQClient:
"""RabbitMQ 客户端"""
def __init__(self) -> None:
self.connection: Optional[aio_pika.R... | hongch666/mix-web-demo | fastapi/app/core/db/rabbitmq.py | .py | 430ef8794655b260 | 7.52 | 10 |
import asyncio
import json
import uuid
from datetime import date, datetime
from decimal import Decimal
from threading import Lock
from typing import Any, Dict, Optional
import redis.asyncio as redis
from app.core.base import Logger
from app.core.config import load_config
from app.core.constants import Messages
class... | hongch666/mix-web-demo | fastapi/app/core/db/redis.py | .py | 2a9d7dd0dfdc2e37 | 7.52 | 10 |
from app.core.constants import HttpCode
class BusinessException(Exception):
"""业务异常 - 用于返回可向客户端显示的错误信息
Attributes:
message: 返回给客户端的错误信息
status_code: HTTP 状态码
error: 错误标识,用于区分同一状态码下的不同错误场景
"""
def __init__(
self,
message: str,
status_code: int = HttpCod... | hongch666/mix-web-demo | fastapi/app/core/errors/exceptions.py | .py | 0062cc0d21896012 | 7.52 | 10 |
import os
import re
from functools import lru_cache
from typing import Awaitable, Callable, List, Optional
import httpx
from app.core.base import Logger
from app.core.client import get_shared_http_client
from app.core.constants import Defaults, Messages
from langchain_community.document_loaders import PyPDFLoader
from... | hongch666/mix-web-demo | fastapi/app/internal/agents/extractor.py | .py | 929f08121a7abdb6 | 7.52 | 10 |
from typing import Any, Literal, Optional, Tuple
from app.core.base import Logger
from app.core.constants import Messages, Prompts
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from pydantic import BaseModel, Field
from sqlalchemy.orm import Session
fr... | hongch666/mix-web-demo | fastapi/app/internal/agents/intentRouter.py | .py | f215006a934723ee | 7.52 | 10 |
from dataclasses import dataclass
from typing import Any, Dict, Optional
from app.core.config import load_config
from app.core.constants import Scripts
@dataclass
class LangSmithConfig:
"""LangSmith 可观测性配置
所有配置项通过 application.yaml + 环境变量加载,遵循项目统一配置规范。
"""
enabled: bool
api_key: str
project:... | hongch666/mix-web-demo | fastapi/app/internal/agents/langsmith/config.py | .py | 7c151c82a85bddac | 7.52 | 10 |
import hashlib
import hmac
import os
import re
from typing import Any, Dict, List, Optional
from uuid import uuid4
from app.core.constants import Messages, Scripts
# 通过 HMAC 对用户 ID 进行不可逆哈希
_user_hash_hmac_key: Optional[bytes] = None
def _get_hmac_key() -> bytes:
"""获取或生成用户 ID 哈希密钥"""
global _user_hash_hmac_... | hongch666/mix-web-demo | fastapi/app/internal/agents/langsmith/sanitizer.py | .py | 87fbcb5a220b5ed3 | 7.52 | 10 |
import json
import re
from functools import lru_cache
from typing import Any, Dict, List, Optional
from app.core.base import Logger
from app.core.constants import Messages, Prompts
from app.core.db import get_db
from langchain_core.tools import StructuredTool
from pydantic import BaseModel, Field
from sqlalchemy impor... | hongch666/mix-web-demo | fastapi/app/internal/agents/tools/fastapiSqlTool.py | .py | 537274d745812e29 | 7.52 | 10 |
import json
from functools import lru_cache
from typing import Any, Dict, List, Optional
from app.core.base import Logger
from app.core.constants import Messages, Prompts
from app.internal.clients import GozeroClient
from langchain_core.tools import StructuredTool
from pydantic import BaseModel, Field
class GozeroSq... | hongch666/mix-web-demo | fastapi/app/internal/agents/tools/gozeroSqlTool.py | .py | a5d039abdb11ad39 | 7.52 | 10 |
#!/usr/bin/env python3
"""Which ASM adapter the emitted compiler actually calls (K-A7 phase 2).
scripts/adapter-callsites.py DIR [DIR ...]
Switching the 114 call sites from `dawn.tool.AdtClassWriter` to `dawn.rt.Asm`
is invisible to every other gate. Both classes carry the same five statics and
produce byte-ident... | dawnop/dawn-lang | scripts/adapter-callsites.py | .py | 16db1b36464e5578 | 7.59 | 14 |
#!/usr/bin/env python3
"""Hold every CI job's timeout to the budget rule its comment claims.
The rule the workflow already states in prose: a job's `timeout-minutes` is at
least three times its worst observed run, so a slow runner is a slow run and
not a killed one. Seconds-scale jobs take a floor instead, because 3x ... | dawnop/dawn-lang | scripts/check-gate-budgets.py | .py | 2f91272a9b89ff8e | 7.59 | 14 |
#!/usr/bin/env python3
"""Guard: commit messages must not carry Claude attribution.
The convention (CLAUDE.md, 重要约定) is that neither `Co-Authored-By: Claude`
nor `Claude-Session: <url>` trailers belong in this open-source repo. Claude Code
suppresses them at the settings source (attribution.commit=""), but that is
per... | dawnop/dawn-lang | scripts/check-no-claude-trailer.py | .py | a068b437f52aba74 | 7.59 | 14 |
#!/usr/bin/env python3
"""Guard: this public repo must not carry the deploy server's identity.
dawn-lang deploys to the same host as dawnop-site (dawnop.com). The redeploy
scripts once hardcoded the ssh login as `user@dawnop.com`; it lived in history
(and in the v0.1.0 tag) until a 2026-07-18 cleanup. The convention i... | dawnop/dawn-lang | scripts/check-no-server-identity.py | .py | 88e6f98e62f6f87c | 7.59 | 14 |
#!/usr/bin/env python3
"""Break one Display layering rule in a compiler tree copy.
Two mutations, one per rule the batch added to `to_str`:
drop-display-question the Display question is not asked at all, so every
value renders through the Show it did before.
ask-display-once the q... | dawnop/dawn-lang | scripts/display-layering-contract/mutate.py | .py | f08d44388bb5015b | 7.59 | 14 |
#!/usr/bin/env python3
"""Partition the Display probe's output into the three named assertions.
The probe prints one `<label>\tvalue` line per observation and `probe.expect`
holds the hand-written answers. This script is the only place that says which
label belongs to which assertion, so a mutant's red set names a rul... | dawnop/dawn-lang | scripts/display-layering-contract/probe_check.py | .py | 9cf2e62e02232878 | 7.59 | 14 |
#!/usr/bin/env python3
"""Apply one SEM-07 mutation to a copy of the compiler tree.
Each mutation removes or inverts exactly one rule of the public surface
validator, and the harness then asserts that exactly one contract goes red.
A mutant must still compile and run: "the mutant did not build" proves nothing
about th... | dawnop/dawn-lang | scripts/export-surface-contract/mutate.py | .py | 602889d4ac6b5e6c | 7.59 | 14 |
#!/usr/bin/env python3
"""Both backends implement the same set of inline primitives.
./scripts/intrinsic-parity.py
`lower.inline_intrinsics()` names the primitives no runtime module owns and
lowering does not remove -- the ones each backend writes instructions for
itself -- and `lower.jvm_only_intrinsics()` names... | dawnop/dawn-lang | scripts/intrinsic-parity.py | .py | 601bc80aae91b7cf | 7.59 | 14 |
#!/usr/bin/env python3
"""
ClaudeSec — Audit Points scan: detect products relevant to the project and
output checklist items from querypie/audit-points for dashboard/scanner integration.
"""
import glob
import json
import os
import sys
# Reuse cache path and load logic; avoid fetching here (dashboard or first run doe... | Twodragon0/claudesec | scanner/lib/audit-points-scan.py | .py | ceb7a21c89d0601e | 7.62 | 16 |
"""CSP nonce utility for build-time injection."""
import base64
import secrets
def generate_nonce() -> str:
"""Generate a cryptographically random 16-byte base64-encoded nonce."""
return base64.b64encode(secrets.token_bytes(16)).decode()
def inject_csp_nonce(html: str, nonce: str) -> str:
"""Replace {{... | Twodragon0/claudesec | scanner/lib/csp_utils.py | .py | b4911dc5d456a77c | 7.12 | 16 |
#!/usr/bin/env python3
"""
ClaudeSec Dashboard — Compliance HTML builder.
Extracted from dashboard_html_sections.py via the Option B split documented in
.omc/plans/dashboard-standards-split.md. Owns rendering of the ISO/ISMS-P/
PCI-DSS framework tables with cross-links to the architecture domains.
"""
import os
impo... | Twodragon0/claudesec | scanner/lib/dashboard_html_compliance.py | .py | 636521f0c0e51632 | 7.62 | 16 |
#!/usr/bin/env python3
"""
ClaudeSec Dashboard HTML Network
Builders for the Network tab configuration cockpit card and the tooling
readiness / install-guidance card, extracted from dashboard_html_sections.py.
"""
import os
import sys
# Ensure sibling modules are importable when loaded via importlib
_LIB_DIR = os.pat... | Twodragon0/claudesec | scanner/lib/dashboard_html_network.py | .py | baea65dfcdc7c349 | 7.62 | 16 |
#!/usr/bin/env python3
"""
ClaudeSec Dashboard HTML Sections
Analytical section builder functions extracted from dashboard-gen.py.
"""
import os
import sys
# Ensure sibling modules are importable when loaded via importlib
_LIB_DIR = os.path.dirname(os.path.abspath(__file__))
if _LIB_DIR not in sys.path:
sys.path.... | Twodragon0/claudesec | scanner/lib/dashboard_html_sections.py | .py | ce6595d4964a2778 | 7.62 | 16 |
#!/usr/bin/env python3
"""
diagram_drawio.py — low-level draw.io (mxGraph) XML primitives.
Extracted from diagram-gen.py: these are the leaf builders (no dependency on the
scanner's aggregate data, categories, or the higher-level page/diagram
generators) that assemble mxfile / mxGraphModel / mxCell / mxGeometry elemen... | Twodragon0/claudesec | scanner/lib/diagram_drawio.py | .py | f2913ebd004b4473 | 7.62 | 16 |
#!/usr/bin/env python3
"""
ClaudeSec diagram SVG builders — architecture and overview SVGs.
Renders the same layouts as the draw.io diagrams as standalone SVG for viewing
in a browser or embedding into claudesec-dashboard.html. Pure string builders:
no draw.io/mxGraph XML, no untrusted parsing.
"""
import os
import sy... | Twodragon0/claudesec | scanner/lib/diagram_svg.py | .py | edb54c68a2d294d0 | 7.62 | 16 |
#!/usr/bin/env python3
"""
ClaudeSec — findings-JSON builder for the dashboard's scan-report.json.
Extracted from the inline bash string-concatenation previously embedded in
scanner/lib/output.sh's ``_emit_finding_json`` (see that file's
``generate_html_dashboard``). The bash version only escaped double-quotes,
so a f... | Twodragon0/claudesec | scanner/lib/findings_json.py | .py | 1f346e981243cef9 | 7.62 | 16 |
"""
ClaudeSec — Prowler OCSF compliance-summary builder.
Extracted from the inline ``python3 -c "..."`` heredoc previously embedded in
``output_prowler.sh``'s ``_prowler_compliance_summary_json`` (see
scanner/lib/output_prowler.sh). The extraction exists purely for coverage
measurability: kcov instruments bash heredoc... | Twodragon0/claudesec | scanner/lib/prowler_compliance_summary.py | .py | 88060576649d62cf | 7.62 | 16 |
#!/usr/bin/env python3
"""
ClaudeSec — Zscaler ZIA API helper.
Authenticates to the ZIA API and returns **sanitized** security posture
statistics. No PII (emails, names, department names) is ever printed —
only aggregate counts and boolean flags.
Usage (called from zscaler.sh):
python3 zscaler-api.py
Environmen... | Twodragon0/claudesec | scanner/lib/zscaler-api.py | .py | a63a0f873c2d9b84 | 7.62 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.