sunholo Packages
55 packages published by sunholo.
Pure API key validation (SHA-256 hash comparison, constant-time) and bearer token extraction
Load and validate config from environment variables with required/optional/default patterns
Exchange GCP ADC refresh tokens for access tokens, detect default project from gcloud config
Build HTTP requests with auth headers, parse JSON responses, standard error handling
Structured JSON logging (info/warn/err/trace/withFields) via Debug ghost effect. No IO cascade, no effect declarations needed. Zero-cost in release mode. Host filters by --log-level. Cloud Run and log aggregator friendly.
Validate AILANG packages: parse manifest, check exports, compute hashes, generate metadata. Written in AILANG.
Pure assertion helpers for testing: assertEqual, assertContains, assertOk, assertErr
Pure billing policy: plan catalog lookup, entitlement resolution from subscription state, quota checks, usage delta computation. No side effects.
Firestore REST API client for AILANG. CRUD operations (get, set, delete), structured queries, field value encoding/decoding. Uses GCP ADC auth. Designed for Cloud Run services.
Stripe API adapter: create checkout sessions, customer portal sessions, verify webhooks, map events to internal subscription state. Uses Stripe REST API.
Create and manage payment proposals — AI agents propose plan changes, humans approve. Pure state machine for proposal lifecycle.
Firestore CRUD for billing records: customers, subscriptions, entitlements, usage, proposals, events. Built on sunholo/firestore package.
HTTP handlers for billing Cloud Run service. Deploy with 'ailang serve-api'. Checkout, portal, proposals, webhooks, entitlements endpoints.
Minimal test package — used by coordinator integration tests to verify the autonomous publish pipeline
Build A2UI component trees and serialize to flat adjacency-list JSON. Apps define domain-specific mappings; this package provides the primitives and JSON renderer.
WebSocket protocol helpers for Gemini Live API — build setup/text/audio messages, parse responses, configure proactive audio/affective dialog/thinking/VAD. Supports both Vertex AI (2.5) and Google AI Studio (3.1) protocols.
Firebase ID token verification via REST API or local JWT/RSA signature validation
Universal document parsing for Office, PDF, and image formats
Upload large files (PDF, images) for Gemini AI calls. Auto-detects backend: GCS for Vertex AI (ADC), or AI Studio Files API (API key). Returns file URI for use in multimodal AI requests.
Generic GCS operations for AILANG services. Download objects to temp files, initiate resumable uploads (returns pre-authenticated URL for direct client upload), validate and parse gs:// URIs.
Smoke-test dependent of sunholo/test_pkg — exists solely to be bumped by the autonomous cascade in M-PKG-AUTONOMOUS-CASCADE-SAFE smoke tests. Not for production use.
Pure AILANG DuckDB client using std/process. Execute SQL queries against a local .db file, parse JSON results into Json rows (JObjects). No FFI — shells out to the duckdb CLI binary. Includes execScriptFile (ARG_MAX-safe script execution), limitsPrelude (bounded-memory settings), and tryStrptimeChain (deterministic multi-format date parsing that avoids DuckDB's stateful format-list bug).
Stable ABI contract for motoko_agent extensions. Provides ExtensionHooks record, ExtCtx, BudgetPlan, ToolPolicyDecision, ToolHandleDecision, ResponseInterceptDecision, FinalizeDecision, and VerificationConfig types. All motoko-ext-* packages depend on this package. Bumping ExtensionHooks is a major version bump.
Minimal echo extension for motoko_agent. Passes through all hooks with NoOpinion/Delegate/NoIntercept/NoDecision defaults. Used to validate the generate-extension-registry pipeline.
No description
No description
No description
No description
No description
No description
No description
Prompt-patch extension that injects the four-decision ladder (extension-vs-script, modify-vs-create, publish-where, cascade-aware-self-publish) into motoko's system prompt CONDITIONALLY — only when ctx.task references extension authoring / publishing / motoko self-modification. Pure substring keyword check; no FS, no LLM call, no per-step cost beyond a strcmp. Saves ~700 tokens per step on irrelevant tasks. Canonical example of the context-aware extension pattern (hooks fire every step with full ExtCtx; cheap pure checks gate the patch). Companion to planned motoko-ext-precreate-lint and motoko-ext-publish-guard.
Auto-injects AILANG knowledge retrieval into WriteFile tool results when the model writes a .ail file. The model doesn't call any tool — the ext intercepts WriteFile via on_tool_handle, performs the actual write, runs `ailang micro-rag context` on the content, and returns a combined result so the retrieval is in the model's next-turn history. Non-.ail writes are Delegated to motoko's default handler. Eliminates the weak-model failure mode where the model would have to remember to call a microrag_lookup tool.
AI-powered conversation compaction extension. Uses a cheap model to summarize old turns when context fills up. Implements on_pre_step hook to compact message history.
LinkedIn REST API client. Publish text + image posts on a company page (Net @limit=1, requires text length 1..3000). Read threaded comments (per-post @limit=1, sweep @limit=50). Derive stable pseudonymous personas from actor URNs via SHA-256 — initials + 6-hex avatar seed, IFC-Declassify-typed so the raw URN cannot leak. Credentials live in ~/.ailang/linkedin/credentials.json with automatic OAuth2 refresh.
Wraps the public AILANG docs MCP server (mcp.ailang.sunholo.com/mcp/) as 23 motoko tools: stdlib_search/module/modules, docs_search/nav, examples_*, design_doc(s)_*, benchmarks_*, install/onboarding guides, effects/limitations catalogs, prompt_get, ailang_versions, changelog, roadmap, submit_feedback. Workdir-gated on ailang.toml. Conditional prompt patch encourages lookup-on-demand for the common hallucinated-stdlib-name failure modes. Direct successor to motoko_ext_ailang_hints@0.1.2.
Generic wrapper around std/process.exec for JSON-on-stdout backends (PDF parsers, OCR, embedders, classifiers). Returns Result[Json, BackendError] with ExecFailed/NonZeroExit/InvalidJson variants carrying exit code + stderr. Pure formatError and describeProcessError helpers for logging; describeProcessError renders each std/process failure (timeout duration, output-byte limit, kill signal, PATH miss) rather than collapsing them into one string. Confines the Process effect so callers stay effect-thin.
Pure obligation-reasoning engine (obligations, cure windows, waivers, suspension/resume, force majeure, attributed delay, termination cascade) with Z3-provable settlement math including per-diem statutory interest; outstanding principal is reported and survives termination. Days are signed, so obligations falling due before the model epoch work correctly; an obligation priced at 0 has no payment leg, which makes the engine usable for non-financial deadlines such as decisions that must be settled by a date. It has NO permission or prohibition modality — it answers who owes what by when, not what anyone may do
Stream tokens from a local Ollama server line-by-line, surfacing both the answer text and the model's reasoning (for thinking models like gemma4).
Intercepts WriteFile on .ail files via on_tool_handle: performs the real write, then runs `ailang fmt --write` on the file so the model's next turn re-reads canonical code. The mechanism under test in M-EVAL-FMT-WEAKMODEL-AB — does removing syntax drift reduce compile-stuck spirals in a weak local model. Non-.ail writes are Delegated to motoko's default handler. Logs each format to the eval fmt_hook_events sink (<workdir>/.claude/fmt_hook_events.jsonl) for treatment-integrity, matching the Claude-Code format_ail.sh hook so the eval harness banks identical events.
Query layer over a locally indexed email archive (DuckDB + Ollama embeddings). Structured query expressions (from:/to:/subject:/has:attachment/dates), semantic search, thread expansion, attachment-chunk search, seven ready-made MCP tools, and the SQL-first ingest that builds the index from parsed .eml JSON. Offline, no AI effect.
Parse AILANG toolchain output (check/doctor) into structured, code-tagged diagnostics
Run the OAuth2 installed-app flow end to end from AILANG: build a consent URL, exchange a loopback authorization code for a refresh token, store it in ADC authorized_user shape, and exchange refresh for access tokens against any provider
Build an RFC 5322 message with CR/LF header-injection guards, encode it base64url, and create a Gmail draft or send it. Pure composition separated from the effectful call so the security-critical half is testable without a network or a credential.
No description
No description
No description
No description
No description
No description
No description
Typed AG-UI core subset: event lifecycle, text, tools, state snapshots, CUSTOM with JSONL/SSE encoding, strict decoding and run validation; plus RunAgentInput request decoding (sunholo/agui/input). No network transport.
Bot REST client: reads, paginated sync, sends, replies, edits, typing, threads and rich embeds with images/thumbnails by URL (Discord limit validation enforced). Pure validation/codecs plus one-HTTP-call Net operations. IDs are decimal strings; tokens supplied by caller; no storage or UI dependencies.
No description
Ask a System One decision model (TypeSafe Jev, via OpenRouter POST /api/alpha/decisions or TypeSafe direct /v1/systemone) typed questions about a JSON state: Noul (P(yes)), Choice (categorical + distribution + confidence), Score (ordinal + distribution + confidence), each also in a JSON-structured variant (NoulR/ChoiceR/ScoreR — the wire accepts structure in every instruction/criteria field). Answers are a closed ADT, read with probabilityOf/best/ranked/topK/margin/entropy/renormalise (search/ranking over the distribution), gate(answer, minConfidence) for confidence routing (Act | Escalate | Ungateable), detect(answer, presentAt, absentAt) for three-way Noul gating, expectedScore/compositeScore for ordinal and composite judgments, featuresOf for ML feature extraction, noulSpread/choiceVotes for self-consistency across k banked Decisions. The package ships NO default threshold — every cut point is the caller's. Calls are ! {Net, Env}, non-deterministic (bank the distribution, never argmax alone), and outside the AI effect's budget/trace-cost accounting. retryable/retryAfterMs cover the vendor's 429/529; listModelsDirect lists the direct API's models.