loki-mode 8.0.3 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env bash
2
+ # opencode Provider Configuration
3
+ # Shell-sourceable config for loki-mode multi-provider support.
4
+ #
5
+ # WHY THIS PROVIDER EXISTS
6
+ # opencode is the model-agnostic route. It reaches 75+ providers through the
7
+ # AI SDK + Models.dev registry, supports ANY OpenAI-compatible endpoint via
8
+ # `@ai-sdk/openai-compatible`, and runs local models (Ollama, LM Studio,
9
+ # llama.cpp). Users can add providers that are NOT in its built-in list -- it
10
+ # is a registry, not a hardcoded table.
11
+ #
12
+ # That matters because our own catalog is a fixed four-key file. Driving
13
+ # opencode gives users every cheap open model without us maintaining a model
14
+ # list per vendor.
15
+ #
16
+ # Verified 2026-07-29/30:
17
+ # - opencode.ai/docs/providers documents 75+ providers and custom
18
+ # OpenAI-compatible endpoints.
19
+ # - anomalyco/opencode: 190,871 stars, release v1.18.9 (2026-07-28), pushed
20
+ # same week. Actively developed. (By contrast aider's last release is
21
+ # v0.86.0 from 2025-08-09, and Roo Code is archived, Continue read-only --
22
+ # so opencode, not aider, is the durable cheap-model route.)
23
+ #
24
+ # Cost context (SWE-bench uniform scaffold, mini-swe-agent v2.0.0, 2026-02-17):
25
+ # MiniMax M2.5 resolved 75.8 at $36.64 total vs Claude Opus 4.6 at 75.6 for
26
+ # $275.76 -- an open model matching frontier accuracy at ~7.5x lower cost.
27
+ #
28
+ # CLI SURFACE (verified against the installed binary, v1.17.9, not assumed):
29
+ # opencode run [message..] non-interactive run
30
+ # -m, --model provider/model model selection
31
+ # --agent NAME agent selection
32
+ # --print-logs logs to stderr
33
+ # opencode models [provider] list available models
34
+ # opencode providers manage providers/credentials
35
+ #
36
+ # Usage:
37
+ # source providers/opencode.sh
38
+ # if provider_detect; then provider_invoke "Your prompt here"; fi
39
+ # =====================================
40
+
41
+ # Provider Identity
42
+ PROVIDER_NAME="opencode"
43
+ PROVIDER_DISPLAY_NAME="opencode (75+ providers, model-agnostic)"
44
+ PROVIDER_CLI="opencode"
45
+
46
+ # CLI Invocation
47
+ # `run` takes the prompt POSITIONALLY; there is no -p/--prompt flag.
48
+ PROVIDER_SUBCOMMAND="run"
49
+ PROVIDER_AUTONOMOUS_FLAG=""
50
+ PROVIDER_PROMPT_FLAG=""
51
+ PROVIDER_PROMPT_POSITIONAL=true
52
+
53
+ # Skill System
54
+ PROVIDER_SKILL_DIR="${HOME}/.config/opencode"
55
+ PROVIDER_SKILL_FORMAT="markdown"
56
+
57
+ # Capability Flags
58
+ # Ranked by MODELS UNLOCKED, not by how Claude-like the CLI is. opencode has no
59
+ # Task tool, but it reaches every cheap model, which is the axis that matters
60
+ # for cost. It is not "degraded" -- it is differently capable.
61
+ PROVIDER_HAS_SUBAGENTS=false
62
+ PROVIDER_HAS_PARALLEL=false
63
+ PROVIDER_HAS_TASK_TOOL=false
64
+ PROVIDER_HAS_MCP=true # `opencode mcp` manages MCP servers
65
+ PROVIDER_MAX_PARALLEL=1
66
+ PROVIDER_DEGRADED=false
67
+ PROVIDER_MAX_OUTPUT_TOKENS=128000
68
+
69
+ # Model defaults. opencode names models "provider/model"; the catalog supplies
70
+ # the value and the standard LOKI_<PROVIDER>_MODEL_<TIER> chain overrides it.
71
+ _opencode_default_from_catalog() {
72
+ if type loki_latest_model >/dev/null 2>&1; then
73
+ loki_latest_model opencode development 2>/dev/null && return 0
74
+ fi
75
+ printf 'openrouter/deepseek/deepseek-v3.2'
76
+ }
77
+ OPENCODE_DEFAULT_MODEL="${LOKI_OPENCODE_MODEL:-${LOKI_MODEL_DEVELOPMENT:-$(_opencode_default_from_catalog)}}"
78
+ PROVIDER_MODEL_PLANNING="$OPENCODE_DEFAULT_MODEL"
79
+ PROVIDER_MODEL_DEVELOPMENT="$OPENCODE_DEFAULT_MODEL"
80
+ PROVIDER_MODEL_FAST="$OPENCODE_DEFAULT_MODEL"
81
+
82
+ # provider_detect -- is the CLI installed?
83
+ provider_detect() {
84
+ command -v opencode >/dev/null 2>&1
85
+ }
86
+
87
+ # provider_version -- CLI version string (empty when absent).
88
+ provider_version() {
89
+ command -v opencode >/dev/null 2>&1 || return 1
90
+ opencode --version 2>/dev/null | head -1
91
+ }
92
+
93
+ # provider_get_tier_param -- map a loki tier to an opencode model id.
94
+ # opencode has no opus/sonnet/haiku tier concept, so all three tiers resolve to
95
+ # one model unless the operator overrides per tier. This mirrors the codex
96
+ # provider, where tier flattening is already an accepted shape.
97
+ provider_get_tier_param() {
98
+ local tier="${1:-development}"
99
+ case "$tier" in
100
+ planning) printf '%s' "$PROVIDER_MODEL_PLANNING" ;;
101
+ fast) printf '%s' "$PROVIDER_MODEL_FAST" ;;
102
+ *) printf '%s' "$PROVIDER_MODEL_DEVELOPMENT" ;;
103
+ esac
104
+ }
105
+
106
+ # provider_invoke <prompt> -- run one non-interactive turn.
107
+ provider_invoke() {
108
+ # CONTRACT: prompt is $1, and EXTRA ARGS MUST PASS THROUGH. The first cut of
109
+ # this provider used `local prompt="${1:-}"` with no `shift`, which silently
110
+ # DROPPED every caller-supplied flag -- callers pass model overrides and
111
+ # per-invocation flags positionally after the prompt. Dropping them fails
112
+ # quietly: opencode still runs, just not with what the caller asked for,
113
+ # which is the worst shape for a provider-agnostic route to fail in.
114
+ # tests/test-provider-invocation.sh asserts this signature for EVERY
115
+ # provider precisely so a new one cannot skip it.
116
+ local prompt="$1"
117
+ shift
118
+ [ -n "$prompt" ] || return 1
119
+ command -v opencode >/dev/null 2>&1 || return 127
120
+ opencode run --model "$PROVIDER_MODEL_DEVELOPMENT" "$prompt" "$@"
121
+ }
122
+
123
+ # provider_invoke_with_tier <tier> <prompt>
124
+ provider_invoke_with_tier() {
125
+ # Same contract as provider_invoke, with the tier ahead of the prompt:
126
+ # tier=$1, prompt=$2, `shift 2`, remainder forwarded verbatim.
127
+ local tier="$1"
128
+ local prompt="$2"
129
+ shift 2
130
+ [ -n "$tier" ] || tier="development"
131
+ [ -n "$prompt" ] || return 1
132
+ command -v opencode >/dev/null 2>&1 || return 127
133
+ local model
134
+ model="$(provider_get_tier_param "$tier")"
135
+ opencode run --model "$model" "$prompt" "$@"
136
+ }
137
+
138
+ # provider_invoke_argv <tier> <prompt> -- see providers/claude.sh for rationale.
139
+ provider_invoke_argv() {
140
+ local tier="${1:-development}"
141
+ local prompt="${2:-}"
142
+ local model
143
+ model="$(provider_get_tier_param "$tier")"
144
+ _LOKI_INVOKE_ARGV=(opencode run --model "$model" "$prompt")
145
+ }
@@ -0,0 +1,85 @@
1
+ # DESIGN ARCHETYPES (pick exactly ONE)
2
+
3
+ Do not average these together and do not invent a fourth palette hue. Choose the
4
+ single archetype whose mood matches the product domain, then hold it on every
5
+ surface: palette, type pairing, spacing rhythm, and layout skeleton. A build that
6
+ commits fully to the "wrong" archetype still looks designed; a build that blends
7
+ two looks generated.
8
+
9
+ Every hex below is a real Radix Colors step. Every font below is real and served
10
+ by Google Fonts, so `@import` / `next/font` resolves at build time. Steps map to
11
+ roles: 2 = page background, 3 = raised surface, 6 = border, 9 = solid accent,
12
+ 11 = accent text on light, 12 = body text.
13
+
14
+ ## 1. EDITORIAL (publishing, long-form, research, journalism, docs)
15
+ - Palette: bg #f9f9f8, surface #f1f0ef, border #dad9d6, accent #d13415, text #21201c
16
+ - Type: Newsreader (display, 600) + Public Sans (body, 400). Headline 3.5rem, leading 1.05, tracking -0.02em.
17
+ - Layout: single measured column, 68ch max. Asymmetric: text left, wide margin right for notes and pull quotes. Rules (1px, border color) separate sections, not cards.
18
+ - Signature move: an oversized drop-cap or a hanging marginal note. Body text at 1.125rem with 1.7 leading.
19
+
20
+ ## 2. BRUTALIST (developer tools, infra, dashboards, technical products)
21
+ - Palette: bg #f0f0f0, surface #f9f9f9, border #202020, accent #e54d2e, text #202020
22
+ - Type: Space Grotesk (display, 700) + JetBrains Mono (body/UI, 400). Headline 4rem, leading 0.95, tracking -0.03em.
23
+ - Layout: hard 2px black borders, zero border-radius, zero shadows. Visible grid lines. Elements butt directly against each other with no gap.
24
+ - Signature move: monospace labels in UPPERCASE with 0.1em tracking. Offset/stacked blocks instead of centered ones.
25
+
26
+ ## 3. LUXURY (hospitality, jewelry, real estate, private services, fine dining)
27
+ - Palette: bg #faf9f2, surface #f2f0e7, border #d8d0bf, accent #71624b, text #3b352b
28
+ - Type: Playfair Display (display, 400) + Lora (body, 400). Headline 4.5rem, leading 1.1, tracking 0.01em.
29
+ - Layout: enormous whitespace, generous 8rem+ section padding. Full-bleed imagery. Content sits low and left, never centered in a card.
30
+ - Signature move: letterspaced small-caps eyebrow text above headings. Thin 1px gold rules. No shadows at all.
31
+
32
+ ## 4. RETRO-FUTURE (music, gaming, crypto, creative tools, events)
33
+ - Palette: bg #1c2024, surface #21201c, border #43302b, accent #ffc53d, text #f1f0ef
34
+ - Type: Syne (display, 800) + Chivo (body, 400). Headline 4rem, leading 1.0, tracking -0.02em.
35
+ - Layout: deliberate dark ground (this is the one archetype where dark is the point, not a reflex). Amber accent used sparingly on one element per viewport.
36
+ - Signature move: thin amber outline on interactive elements. Slight text glow via text-shadow on the hero only.
37
+
38
+ ## 5. SOFT / PASTEL (wellness, education, kids, community, journaling)
39
+ - Palette: bg #f2fbf9, surface #ddf9f2, border #9ce0d0, accent #027864, text #16433c
40
+ - Type: Fraunces (display, 600, opsz soft) + DM Sans (body, 400). Headline 3.25rem, leading 1.15.
41
+ - Layout: large border-radius (24px+) used consistently, never mixed with sharp corners. Rounded blob or arc shapes in the background.
42
+ - Signature move: overlapping soft shapes behind content. Illustrative, generous line-height (1.75) body text.
43
+
44
+ ## 6. INDUSTRIAL (logistics, manufacturing, field ops, B2B operations)
45
+ - Palette: bg #f8faf8, surface #eff1ef, border #d7dad7, accent #cc4e00, text #1d211c
46
+ - Type: Archivo (display, 700, condensed-leaning) + IBM Plex Sans (body, 400). Headline 3rem, leading 1.05.
47
+ - Layout: dense information grid, tight 4px/8px spacing scale. Tables are first-class, not an afterthought. Status uses the orange accent only for exceptions.
48
+ - Signature move: numeric data in tabular-nums. Thin dividers over cards. High information density is the aesthetic.
49
+
50
+ ## 7. CLINICAL (health, finance, legal, compliance, insurance)
51
+ - Palette: bg #f9f9fb, surface #f0f0f3, border #d9d9e0, accent #208368, text #1c2024
52
+ - Type: Source Serif 4 (display, 600) + Work Sans (body, 400). Headline 2.75rem, leading 1.2.
53
+ - Layout: calm, restrained, strictly aligned to a 12-column grid. Nothing decorative. Whitespace does all the separation work.
54
+ - Signature move: serif headings over sans body signals authority without ornament. One accent hue, used only for confirm/positive state.
55
+
56
+ ## 8. ARTISANAL (food, craft, retail, local business, marketplace)
57
+ - Palette: bg #fcf9f6, surface #f6eee7, border #e4cdb7, accent #815e46, text #3e332e
58
+ - Type: Instrument Serif (display, 400) + Manrope (body, 400). Headline 4rem, leading 1.05.
59
+ - Layout: warm paper ground, photography-forward, imagery bleeds past its container. Text overlaps images slightly.
60
+ - Signature move: a hand-drawn-feeling asymmetry. Sections alternate image-left / image-right rather than stacking identical cards.
61
+
62
+ ## SPACING AND SHAPE (Open Props scale; pick one row, hold it)
63
+ - Tight: 4 8 12 16 24 32 48 -- pairs with BRUTALIST, INDUSTRIAL, CLINICAL
64
+ - Standard: 8 16 24 32 48 64 96 -- pairs with EDITORIAL, ARTISANAL, RETRO-FUTURE
65
+ - Generous: 16 32 48 64 96 128 192 -- pairs with LUXURY, SOFT
66
+
67
+ Radius is an archetype property, not a per-component choice: BRUTALIST 0px,
68
+ INDUSTRIAL/CLINICAL 4px, EDITORIAL/LUXURY 2px, ARTISANAL 8px, RETRO-FUTURE 6px,
69
+ SOFT 24px. Use that ONE value everywhere.
70
+
71
+ ## LAYOUT SKELETONS (choose one; not all three-card rows)
72
+ - Split hero: 55/45 asymmetric, content left, single large visual right, no centering.
73
+ - Editorial stack: full-width measured column with alternating margin notes.
74
+ - Data-first: compact header, then the real table or list immediately, no marketing block.
75
+ - Staggered: sections alternate left/right emphasis with unequal widths (60/40, then 40/60).
76
+ - Gallery: one dominant item plus a differently-sized supporting grid, never uniform tiles.
77
+
78
+ ## LICENSE ATTRIBUTION
79
+ Palette values are steps from Radix Colors, MIT License, Copyright (c) 2021-2022
80
+ Modulz, Copyright (c) 2022-Present WorkOS.
81
+ Spacing scale is derived from Open Props, MIT License, Copyright (c) 2021 Adam Argyle.
82
+ Theme structure and role naming follow daisyUI, MIT License, Copyright (c) 2020
83
+ Pouya Saadeghi.
84
+ All named fonts are served by Google Fonts under the SIL Open Font License and
85
+ are free to embed and redistribute.