Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openclaw/src/security/   (KI Agentensystem Version 22©)  Datei vom 26.3.2026 mit Größe 2 kB image not shown  

Quelle  context-visibility.test.ts

  Sprache: JAVA
 

Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

import { describe, expect, it } from "vitest";
import {
  evaluateSupplementalContextVisibility,
  filterSupplementalContextItems,
  shouldIncludeSupplementalContext,
} from "./context-visibility.js";

describe("evaluateSupplementalContextVisibility", () => {
  it("reports why all mode keeps context", () => {
    expect(
      evaluateSupplementalContextVisibility({
        mode: "all",
        kind: "history",
        senderAllowed: false,
      }),
    ).toEqual({
      include: true,
      reason: "mode_all",
    });
  });

  it("reports quote override decisions", () => {
    expect(
      evaluateSupplementalContextVisibility({
        mode: "allowlist_quote",
        kind: "quote",
        senderAllowed: false,
      }),
    ).toEqual({
      include: true,
      reason: "quote_override",
    });
  });
});

describe("shouldIncludeSupplementalContext", () => {
  it("keeps all context in all mode", () => {
    expect(
      shouldIncludeSupplementalContext({
        mode: "all",
        kind: "history",
        senderAllowed: false,
      }),
    ).toBe(true);
  });

  it("enforces allowlist mode for non-allowlisted senders", () => {
    expect(
      shouldIncludeSupplementalContext({
        mode: "allowlist",
        kind: "thread",
        senderAllowed: false,
      }),
    ).toBe(false);
  });

  it("keeps explicit quotes in allowlist_quote mode", () => {
    expect(
      shouldIncludeSupplementalContext({
        mode: "allowlist_quote",
        kind: "quote",
        senderAllowed: false,
      }),
    ).toBe(true);
  });

  it("still drops non-quote context in allowlist_quote mode", () => {
    expect(
      shouldIncludeSupplementalContext({
        mode: "allowlist_quote",
        kind: "history",
        senderAllowed: false,
      }),
    ).toBe(false);
  });
});

describe("filterSupplementalContextItems", () => {
  it("filters blocked items and reports omission count", () => {
    const result = filterSupplementalContextItems({
      items: [
        { id: "allowed", senderAllowed: true },
        { id: "blocked", senderAllowed: false },
      ],
      mode: "allowlist",
      kind: "thread",
      isSenderAllowed: (item) => item.senderAllowed,
    });

    expect(result).toEqual({
      items: [{ id: "allowed", senderAllowed: true }],
      omitted: 1,
    });
  });
});

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.