Skip to content

teng-lin/notebooklm-py

notebooklm

Verified

Install, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook, notebooklm-py, the notebooklm CLI, or its Python API. Do not use for the generic Gemini API or unrelated content creation.

FileKindSize
SKILL.mdskill md16.0 KB
examples/bulk-import.pyscript3.4 KB
examples/chat.pyscript6.9 KB
examples/notes.pyscript9.8 KB
examples/quickstart.pyscript2.3 KB
examples/refresh_browser_cookies.pyscript2.9 KB
examples/research-to-podcast.pyscript3.2 KB
examples/video.pyscript5.9 KB
scripts/__init__.pyscript73 B
scripts/_ci_e2e_notebooks.pyscript19.0 KB
scripts/_ci_progress.pyscript2.5 KB
scripts/_ci_rpc_progress.pyscript7.5 KB
scripts/_live_auth_scenarios/__init__.pyscript2.6 KB
scripts/_live_auth_scenarios/_contract.pyscript1.9 KB
scripts/_live_auth_scenarios/browser_refresh.pyscript3.1 KB
scripts/_live_auth_scenarios/crash_safe_writer.pyscript1.9 KB
scripts/_live_auth_scenarios/master_token_recovery.pyscript3.3 KB
scripts/_live_auth_scenarios/mcp_recovery.pyscript3.0 KB
scripts/_live_auth_scenarios/rest_recovery.pyscript5.9 KB
scripts/_live_auth_scenarios/sibling_concurrent_reload.pyscript3.9 KB
scripts/_live_auth_scenarios/storage_reload.pyscript2.9 KB
scripts/_onetime_rescrub_cookies.pyscript6.6 KB
scripts/_onetime_retarget_cassette_hosts.pyscript8.5 KB
scripts/_strip_audit_refs.pyscript15.9 KB
scripts/_tracked_files.pyscript872 B
scripts/aggregate_ci_e2e_outcomes.pyscript10.8 KB
scripts/android_grpc_canary.pyscript26.6 KB
scripts/api-compat-allowlist.jsonconfig163 B
scripts/audit_auth_import_graph.pyscript7.5 KB
scripts/audit_auth_patch_sites.pyscript83.6 KB
scripts/audit_auth_shared_mutations.pyscript41.7 KB
scripts/audit_backend_coupling.pyscript32.8 KB
scripts/audit_public_api_compat.pyscript47.4 KB
scripts/audit_test_suite.pyscript10.7 KB
scripts/capture_mobile_grpc.jsscript5.1 KB
scripts/capture_rpc_registry.pyscript44.5 KB
scripts/check_action_pinning.pyscript6.7 KB
scripts/check_auth_behavior_scenario_policy.pyscript37.1 KB
scripts/check_auth_coverage_delta.pyscript23.2 KB
scripts/check_auth_lifecycle_cleanup_policy.pyscript11.7 KB
scripts/check_base_wheel.pyscript6.3 KB
scripts/check_ci_install_parity.pyscript8.8 KB
scripts/check_claude_md_freshness.pyscript8.0 KB
scripts/check_coverage_thresholds.pyscript8.4 KB
scripts/check_deprecation_targets.pyscript33.1 KB
scripts/check_docs_module_refs.pyscript14.4 KB
scripts/check_rpc_health.pyscript112.0 KB
scripts/check_workflow_permissions.pyscript5.3 KB
scripts/check_workflow_secret_gates.pyscript40.4 KB
scripts/decode_mobile_grpc.pyscript7.2 KB
scripts/diagnose_get_notebook.pyscript9.1 KB
scripts/extract_blutter_grpc_signatures.pyscript7.6 KB
scripts/live_auth_matrix.pyscript40.2 KB
scripts/manage_ci_e2e_notebooks.pyscript67.4 KB
scripts/materialize_ci_auth.pyscript8.0 KB
scripts/mcp_live_smoke.pyexecutablescript224 B
scripts/parse_pbenums.pyscript8.6 KB
scripts/parse_pbschema.pyscript11.8 KB
scripts/regen_baselines.pyscript2.7 KB
scripts/regenerate_android_protos.pyscript16.3 KB
scripts/rescrub-cassettes.pyscript13.3 KB
scripts/scrub_rpc_har.pyscript9.4 KB
scripts/select_ci_account.pyscript4.8 KB
scripts/stress_fault_server.pyscript20.6 KB
scripts/test_taxonomy_inventory.pyscript16.1 KB
scripts/verify_ci_artifacts.pyscript35.3 KB

scripts/aggregate_ci_e2e_outcomes.py

View on GitHub
#!/usr/bin/env python3
"""Validate and aggregate normalized live-CI phase outcomes."""

from __future__ import annotations

import argparse
import sys
from dataclasses import dataclass

from _ci_progress import write_summary

STATES = {"success", "failure", "not_applicable"}


@dataclass(frozen=True)
class LanePolicy:
    mode: str
    applicable: frozenset[str]
    dependencies: dict[str, tuple[str, ...]]


_BASE_COPY_DEPENDENCIES = {
    "sweep": ("auth",),
    "provision": ("sweep",),
    "preflight": ("provision",),
}

POLICIES = {
    "nightly-web-ubuntu": LanePolicy(
        mode="full",
        applicable=frozenset(
            {
                "auth",
                "sweep",
                "provision",
                "preflight",
                "journal_policy",
                "primary",
                "lastfailed",
                "retry",
                "smoke",
                "coverage",
                "verifier",
                "cleanup",
                "purge",
            }
        ),
        dependencies={
            **_BASE_COPY_DEPENDENCIES,
            "journal_policy": ("preflight",),
            "primary": ("journal_policy",),
            "lastfailed": ("primary",),
            "retry": ("primary", "lastfailed"),
            "smoke": ("preflight",),
            "coverage": ("primary",),
            "verifier": ("journal_policy", "primary", "retry"),
        },
    ),
    "nightly-android-macos": LanePolicy(
        mode="full",
        applicable=frozenset(
            {
                "auth",
                "sweep",
                "provision",
                "preflight",
                "journal_policy",
                "primary",
                "lastfailed",
                "retry",
                "coverage",
                "cleanup",
                "purge",
            }
        ),
        dependencies={
            **_BASE_COPY_DEPENDENCIES,
            "journal_policy": ("preflight",),
            "primary": ("journal_policy",),
            "lastfailed": ("primary",),
            "retry": ("primary", "lastfailed"),
            "coverage": ("primary",),
        },
    ),
    "nightly-readonly-windows": LanePolicy(
        mode="readonly",
        applicable=frozenset(
            {
                "auth",
                "sweep",
                "provision",
                "preflight",
                "journal_policy",
                "primary",
                "lastfailed",
                "retry",
                "coverage",
                "cleanup",
                "purge",
            }
        ),
        dependencies={
            **_BASE_COPY_DEPENDENCIES,
            "journal_policy": ("preflight",),
            "primary": ("journal_policy",),
            "lastfailed": ("primary",),
            "retry": ("primary", "lastfailed"),
            "coverage": ("primary",),
        },
    ),
    "rpc-health-web": LanePolicy(
        mode="rpc",
        applicable=frozenset({"auth", "health", "report", "purge"}),
        dependencies={
            "health": ("auth",),
            "report": ("health",),
        },
    ),
    "rpc-health-android": LanePolicy(
        mode="template",
        applicable=frozenset({"auth", "template_validate", "health", "report", "purge"}),
        dependencies={
            "template_validate": ("auth",),
            "health": ("template_validate",),
            "report": ("health",),
        },
    ),
    "verify-package": LanePolicy(
        mode="full",
        applicable=frozenset(
            {
                "auth",
                "sweep",
                "provision",
                "preflight",
                "journal_policy",
                "primary",
                "lastfailed",
                "retry",
                "telemetry",
                "cleanup",
                "purge",
            }
        ),
        dependencies={
            **_BASE_COPY_DEPENDENCIES,
            "journal_policy": ("preflight",),
            "primary": ("journal_policy",),
            "lastfailed": ("primary",),
            "retry": ("primary", "lastfailed"),
            "telemetry": ("primary", "retry"),
        },
    ),
}


class OutcomeError(ValueError):
    pass


def parse_phases(values: list[str]) -> dict[str, str]:
    phases: dict[str, str] = {}
    for value in values:
        name, separator, state = value.partition("=")
        if not separator or not name or state not in STATES:
            raise OutcomeError("each phase must be NAME=success|failure|not_applicable")
        if name in phases:
            raise OutcomeError(f"duplicate phase: {name}")
        phases[name] = state
    return phases


def _dependency_allows(phase: str, dependency: str, states: dict[str, str]) -> bool:
    """Return whether a dependent phase may be applicable.

    Report/coverage/verifier/telemetry phases intentionally diagnose a failed
    producer, while ordinary forward dependencies require success.
    """
    if phase in {"report", "coverage"} and dependency in {"health", "primary"}:
        return states[dependency] in {"success", "failure"}
    if phase in {"verifier", "telemetry"} and dependency == "primary":
        return states[dependency] in {"success", "failure"}
    if phase in {"verifier", "telemetry"} and dependency == "retry":
        # Artifact verification and advisory inventory collection diagnose the
        # final producer state, including an attempted retry that failed.
        return states[dependency] in STATES
    if phase == "lastfailed" and dependency == "primary":
        return states[dependency] == "failure"
    if phase == "retry" and dependency == "primary":
        return states[dependency] == "failure"
    return states[dependency] == "success"


def aggregate(*, lane: str, mode: str, states: dict[str, str], producer: bool = True) -> list[str]:
    """Validate a complete lane record and return all failure categories."""
    policy = POLICIES.get(lane)
    if policy is None or policy.mode != mode:
        raise OutcomeError("lane/mode pair is not allowlisted")
    missing = policy.applicable - states.keys()
    extra = states.keys() - policy.applicable
    if missing or extra:
        detail = []
        if missing:
            detail.append("missing=" + ",".join(sorted(missing)))
        if extra:
            detail.append("unknown=" + ",".join(sorted(extra)))
        raise OutcomeError("phase set mismatch (" + "; ".join(detail) + ")")

    errors: list[str] = []
    root_required = policy.applicable - policy.dependencies.keys()
    for phase in root_required:
        if states[phase] == "not_applicable":
            errors.append(f"required_phase_skipped:{phase}")
    for phase, dependencies in policy.dependencies.items():
        if phase == "verifier" and not producer:
            if states[phase] != "not_applicable":
                errors.append("dependency_violation:verifier")
            continue
        if phase == "telemetry":
            # Verify Package inventory is best-effort/non-gating once its
            # producer path was actually reached. It must still be skipped when
            # setup blocked primary, otherwise outcome capture could conceal a
            # workflow dependency bug.
            allowed = all(
                _dependency_allows(phase, dependency, states) for dependency in dependencies
            )
            if not allowed and states[phase] != "not_applicable":
                errors.append("dependency_violation:telemetry")
            continue
        allowed = all(_dependency_allows(phase, dependency, states) for dependency in dependencies)
        if allowed and states[phase] == "not_applicable":
            errors.append(f"required_phase_skipped:{phase}")
        elif not allowed and states[phase] != "not_applicable":
            errors.append(f"dependency_violation:{phase}")

    primary = states.get("primary")
    retry = states.get("retry")
    lastfailed = states.get("lastfailed")
    retry_recovered = primary == "failure" and lastfailed == "success" and retry == "success"
    for phase in sorted(policy.applicable):
        if states[phase] != "failure":
            continue
        if phase == "telemetry":
            continue
        if phase == "primary" and retry_recovered:
            continue
        errors.append(f"phase_failed:{phase}")

    if primary == "failure" and lastfailed == "failure":
        errors.append("retry_unavailable:lastfailed")
    return sorted(set(errors))


def build_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--lane", required=True, choices=tuple(POLICIES))
    parser.add_argument("--mode", required=True, choices=("full", "readonly", "rpc", "template"))
    parser.add_argument("--phase", action="append", default=[], metavar="NAME=STATE")
    parser.add_argument(
        "--producer",
        choices=("required", "off"),
        default="required",
        help="whether this lane/filter requires journal settlement",
    )
    parser.add_argument(
        "--lastfailed-present",
        choices=("true", "false", "not_applicable"),
        help="compatibility shorthand for the normalized lastfailed phase",
    )
    return parser


def main(argv: list[str] | None = None) -> int:
    args = build_parser().parse_args(argv)
    try:
        states = parse_phases(args.phase)
        if args.lastfailed_present is not None:
            if "lastfailed" in states:
                raise OutcomeError("lastfailed was supplied twice")
            states["lastfailed"] = {
                "true": "success",
                "false": "failure",
                "not_applicable": "not_applicable",
            }[args.lastfailed_present]
        if args.producer == "off" and args.lane != "nightly-web-ubuntu":
            raise OutcomeError("producer=off is allowlisted only for filtered Web nightly")
        errors = aggregate(
            lane=args.lane,
            mode=args.mode,
            states=states,
            producer=args.producer == "required",
        )
    except OutcomeError as exc:
        print(f"CONFIGURATION: {exc}", file=sys.stderr)
        return 2
    write_summary(f"\n### CI phases: {args.lane}\n\n| Phase | Outcome |\n| --- | --- |")
    for phase, state in states.items():
        if phase in POLICIES[args.lane].applicable and state in STATES:
            label = "E2E execution floor" if phase == "coverage" else phase
            write_summary(f"| {label} | {state.replace('not_applicable', 'not run')} |")
    execution_phase = "primary" if "primary" in POLICIES[args.lane].applicable else "health"
    if states.get(execution_phase) == "not_applicable":
        write_summary("\nTests/probes did not run. See the failed prerequisite above.")
    if errors:
        print("CI E2E outcome failed: " + ", ".join(errors), file=sys.stderr)
        return 1
    print(f"CI E2E outcome succeeded for lane {args.lane}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall