Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
955995fe2b
|
No files matched your search
@@ -1,20 +1,24 @@
|
||||
# Live reload for the single archie binary during development.
|
||||
# Live reload for archied during dashboard work.
|
||||
#
|
||||
# The frontend has its own loop -- `task dev:ui` runs Vite with HMR and proxies
|
||||
# /api here -- so this watcher deliberately ignores ui/. Watching it would
|
||||
# rebuild the Go binary on every keystroke in a CSS file, and rebuilding on
|
||||
# ui/dist changes would loop against `task ui`.
|
||||
# The frontend has its own loop -- `task ui:dev` runs Vite with HMR and proxies
|
||||
# /api and /events here -- so this watcher deliberately ignores ui/. Watching
|
||||
# it would rebuild the Go binary on every keystroke in a CSS file, and
|
||||
# rebuilding on ui/dist changes would loop against `task ui`.
|
||||
#
|
||||
# Built with `-tags no_ui`: during development Vite serves the frontend
|
||||
# directly with HMR, so embedding ui/dist would only slow down reloads.
|
||||
# ui/dist is NOT rebuilt here. During development the Vite server serves the
|
||||
# frontend directly with HMR, so dist is not what you are looking at; it only
|
||||
# matters for the embedded build, and `task ui` produces it before a commit.
|
||||
# An earlier rule here claimed to keep dist current and never ran: air
|
||||
# requires a file to satisfy include_dir AND include_file together, and ui/ is
|
||||
# excluded from the walk anyway.
|
||||
root = "."
|
||||
tmp_dir = ".air"
|
||||
|
||||
[build]
|
||||
cmd = "go build -tags no_ui -o ./.air/archie ./cmd/archie"
|
||||
cmd = "go build -o ./.air/archied ./cmd/archied"
|
||||
# `bin` is deprecated in air; entrypoint is the current key.
|
||||
entrypoint = "./.air/archie"
|
||||
include_ext = ["go", "toml", "sql", "yaml", "cedar", "tmpl", "md"]
|
||||
entrypoint = "./.air/archied"
|
||||
include_ext = ["go", "toml"]
|
||||
exclude_dir = ["ui", "bin", "docs", ".git", ".task", ".air", "tmp"]
|
||||
exclude_regex = ["_test\\.go"]
|
||||
stop_on_error = true
|
||||
|
||||
-10
@@ -52,13 +52,3 @@ __pycache__/
|
||||
/.pnpm-store/
|
||||
deployments/archie/.build/
|
||||
.codebase-memory/
|
||||
|
||||
# Vale synced packages, dictionaries, and grammars (recreated by `vale sync`).
|
||||
# Local house rules (.vale/styles/Archie/) and vocabulary stay tracked.
|
||||
/.vale/styles/*
|
||||
!/.vale/styles/Archie/
|
||||
!/.vale/styles/config/
|
||||
/.vale/styles/config/*
|
||||
!/.vale/styles/config/vocabularies/
|
||||
/.vale/styles/config/vocabularies/*
|
||||
!/.vale/styles/config/vocabularies/Archie/
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"buildPath": "code",
|
||||
"hook": {
|
||||
"enabled": true,
|
||||
"limits": {
|
||||
"maxFindings": 5,
|
||||
"maxChars": 8000
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 2,
|
||||
"generatedAt": "2026-11-24T00:00:00+11:00",
|
||||
"title": "Design System: Archie",
|
||||
"extensions": {
|
||||
"colorMeta": {
|
||||
"signal-sage": { "role": "primary", "displayName": "Signal Sage", "canonical": "#51a580", "tonalRamp": ["#0f2a1e", "#17402e", "#1f5740", "#2e795a", "#51a580", "#7dbf9f", "#acd8c2", "#dcefe5"] },
|
||||
"signal-sage-deep": { "role": "primary", "displayName": "Signal Sage Deep", "canonical": "#2e795a" },
|
||||
"signal-sage-ink": { "role": "primary", "displayName": "Signal Sage Ink", "canonical": "#0c6f4d" },
|
||||
"graphite-card": { "role": "neutral", "displayName": "Graphite Card", "canonical": "#1c1d21", "tonalRamp": ["#0e0f10", "#16171a", "#1c1d21", "#26282c", "#3c3f45", "#70727a", "#a6a39b", "#e8e6e1"] },
|
||||
"paper-canvas": { "role": "neutral", "displayName": "Paper Canvas", "canonical": "#e9e7e2", "tonalRamp": ["#1f1f1d", "#5c5a55", "#8a877f", "#c7c4bd", "#dcdad4", "#e9e7e2", "#f5f4f1", "#ffffff"] },
|
||||
"amber-warn": { "role": "tertiary", "displayName": "Amber Warn", "canonical": "#d9a45b", "tonalRamp": ["#3a2a10", "#5c4116", "#8a5a12", "#b5833a", "#d9a45b", "#e5bf87", "#efd7b3", "#f8eddc"] },
|
||||
"clay-danger": { "role": "tertiary", "displayName": "Clay Danger", "canonical": "#d9776b", "tonalRamp": ["#3d1714", "#5e2420", "#b3413a", "#c75d53", "#d9776b", "#e49d94", "#eec3bd", "#f8e6e3"] },
|
||||
"slate-info": { "role": "tertiary", "displayName": "Slate Info", "canonical": "#8aa4c2", "tonalRamp": ["#17222f", "#24364b", "#3d5f86", "#6283a8", "#8aa4c2", "#adc0d5", "#cfdae6", "#ecf1f6"] },
|
||||
"stone-idle": { "role": "neutral", "displayName": "Stone Idle", "canonical": "#9a978f" }
|
||||
},
|
||||
"typographyMeta": {
|
||||
"page-title": { "displayName": "Page title", "purpose": "One per page, in PageHeader beside the page's actions." },
|
||||
"title": { "displayName": "Title", "purpose": "Card and panel titles." },
|
||||
"label": { "displayName": "Label", "purpose": "Body copy, rows, navigation, buttons and fields." },
|
||||
"caption": { "displayName": "Caption", "purpose": "Metadata, column labels, step-type labels and badges." },
|
||||
"section-label": { "displayName": "Section label", "purpose": "Uppercase group headings in sidebars and settings navigation." },
|
||||
"micro": { "displayName": "Micro", "purpose": "The smallest annotations, used sparingly." },
|
||||
"mono": { "displayName": "Mono", "purpose": "IDs, short hashes, durations, log fields and code." }
|
||||
},
|
||||
"shadows": [
|
||||
{ "name": "rest", "value": "0 1px 2px rgba(0, 0, 0, 0.4)", "purpose": "Top bar and canvas nodes at rest (dark). Light: 0 1px 2px rgba(31, 31, 29, 0.06)." },
|
||||
{ "name": "float", "value": "0 8px 28px rgba(0, 0, 0, 0.4)", "purpose": "Popovers, menus, dialogs and the expanded step node (dark). Light: 0 8px 28px rgba(31, 31, 29, 0.1)." }
|
||||
],
|
||||
"motion": [
|
||||
{ "name": "transition", "value": "140ms cubic-bezier(0.4, 0, 0.2, 1)", "purpose": "Default colour and state transitions." },
|
||||
{ "name": "node-expand", "value": "200ms", "purpose": "Step node width and shadow when it expands in place." },
|
||||
{ "name": "reduced-motion", "value": "0.01ms", "purpose": "All animation and transition durations under prefers-reduced-motion or the reduced-motion setting." }
|
||||
],
|
||||
"breakpoints": [
|
||||
{ "name": "sm", "value": "640px" },
|
||||
{ "name": "md", "value": "768px" },
|
||||
{ "name": "lg", "value": "1024px" }
|
||||
]
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"name": "Primary Button",
|
||||
"kind": "button",
|
||||
"refersTo": "button-primary",
|
||||
"description": "The one filled action per view.",
|
||||
"html": "<button class=\"ds-btn-primary\">Run workflow</button>",
|
||||
"css": ".ds-btn-primary { height: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: var(--primary, #2e795a); color: var(--primary-foreground, #fff); font: 500 0.8125rem 'IBM Plex Sans Variable', system-ui, sans-serif; cursor: pointer; transition: all 140ms cubic-bezier(0.4, 0, 0.2, 1); } .ds-btn-primary:hover { background: color-mix(in srgb, var(--primary, #2e795a) 80%, transparent); } .ds-btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring, #51a580); } .ds-btn-primary:active { transform: translateY(1px); }"
|
||||
},
|
||||
{
|
||||
"name": "Ghost Button",
|
||||
"kind": "button",
|
||||
"refersTo": "button-ghost",
|
||||
"description": "Default for secondary and contextual actions.",
|
||||
"html": "<button class=\"ds-btn-ghost\">Cancel</button>",
|
||||
"css": ".ds-btn-ghost { height: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--foreground, #e8e6e1); font: 500 0.8125rem 'IBM Plex Sans Variable', system-ui, sans-serif; cursor: pointer; transition: all 140ms cubic-bezier(0.4, 0, 0.2, 1); } .ds-btn-ghost:hover { background: var(--muted, #26282c); } .ds-btn-ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring, #51a580); } .ds-btn-ghost:active { transform: translateY(1px); }"
|
||||
},
|
||||
{
|
||||
"name": "Attention Button",
|
||||
"kind": "button",
|
||||
"refersTo": "button-attention",
|
||||
"description": "An action that exists because something is waiting.",
|
||||
"html": "<button class=\"ds-btn-attention\">Review approval</button>",
|
||||
"css": ".ds-btn-attention { height: 36px; padding: 0 10px; border: 1px solid var(--warn, #d9a45b); border-radius: 8px; background: var(--warn-soft, rgba(217,164,91,0.08)); color: var(--warn, #d9a45b); font: 500 0.8125rem 'IBM Plex Sans Variable', system-ui, sans-serif; cursor: pointer; transition: all 140ms cubic-bezier(0.4, 0, 0.2, 1); } .ds-btn-attention:hover { background: rgba(217,164,91,0.16); } .ds-btn-attention:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring, #51a580); }"
|
||||
},
|
||||
{
|
||||
"name": "Text Input",
|
||||
"kind": "input",
|
||||
"refersTo": "input",
|
||||
"description": "Single-line field on the card surface.",
|
||||
"html": "<input class=\"ds-input\" placeholder=\"Workflow name\" />",
|
||||
"css": ".ds-input { height: 36px; width: 240px; padding: 4px 10px; border: 1px solid var(--input, #70727a); border-radius: 8px; background: var(--card, #1c1d21); color: var(--foreground, #e8e6e1); font: 400 0.8125rem 'IBM Plex Sans Variable', system-ui, sans-serif; outline: none; transition: border-color 140ms, box-shadow 140ms; } .ds-input::placeholder { color: var(--fg-muted, #a6a39b); } .ds-input:focus-visible { border-color: var(--ring, #51a580); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring, #51a580) 50%, transparent); }"
|
||||
},
|
||||
{
|
||||
"name": "Status Badges",
|
||||
"kind": "chip",
|
||||
"refersTo": "badge-ok",
|
||||
"description": "Solid tone on its soft background; the only place status colour is decided.",
|
||||
"html": "<span class=\"ds-badge ds-ok\">Succeeded</span> <span class=\"ds-badge ds-warn\">Waiting</span> <span class=\"ds-badge ds-danger\">Failed</span> <span class=\"ds-badge ds-info\">Working</span> <span class=\"ds-badge ds-idle\">Idle</span>",
|
||||
"css": ".ds-badge { display: inline-flex; align-items: center; height: 20px; padding: 2px 8px; border-radius: 4px; font: 500 0.6875rem 'IBM Plex Sans Variable', system-ui, sans-serif; white-space: nowrap; } .ds-ok { background: var(--ok-soft, rgba(81,165,128,0.12)); color: var(--ok, #51a580); } .ds-warn { background: var(--warn-soft, rgba(217,164,91,0.08)); color: var(--warn, #d9a45b); } .ds-danger { background: var(--danger-soft, rgba(217,119,107,0.08)); color: var(--danger, #d9776b); } .ds-info { background: var(--info-soft, rgba(138,164,194,0.1)); color: var(--info, #8aa4c2); } .ds-idle { background: var(--idle-soft, rgba(143,140,133,0.1)); color: var(--idle, #9a978f); }"
|
||||
},
|
||||
{
|
||||
"name": "Section Card",
|
||||
"kind": "card",
|
||||
"refersTo": "card",
|
||||
"description": "Titled card on the workspace; ring, no shadow.",
|
||||
"html": "<section class=\"ds-card\"><h3 class=\"ds-card-title\">Event sources</h3><p class=\"ds-card-body\">prometheus <span class=\"ds-mono\">a41f9c2e</span></p></section>",
|
||||
"css": ".ds-card { width: 320px; padding: 16px; border-radius: 12px; background: var(--card, #1c1d21); color: var(--card-foreground, #e8e6e1); box-shadow: 0 0 0 1px color-mix(in srgb, var(--foreground, #e8e6e1) 10%, transparent); font-family: 'IBM Plex Sans Variable', system-ui, sans-serif; } .ds-card-title { margin: 0 0 8px; font-size: 0.9375rem; font-weight: 500; line-height: 1.375; } .ds-card-body { margin: 0; font-size: 0.8125rem; color: var(--fg-muted, #a6a39b); } .ds-mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 0.6875rem; color: var(--fg-subtle, #99968f); }"
|
||||
},
|
||||
{
|
||||
"name": "Top Bar",
|
||||
"kind": "nav",
|
||||
"refersTo": "top-bar",
|
||||
"description": "Sticky 56px bar with breadcrumb and account controls.",
|
||||
"html": "<header class=\"ds-topbar\"><nav class=\"ds-crumbs\"><a href=\"#\">Workflows</a><span>/</span><span class=\"ds-current\">disk-pressure</span></nav><span class=\"ds-pill\"><i></i>Connected</span></header>",
|
||||
"css": ".ds-topbar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px; background: var(--card, #1c1d21); border-bottom: 1px solid var(--border-strong, #3c3f45); box-shadow: 0 1px 2px rgba(0,0,0,0.4); font: 400 0.8125rem 'IBM Plex Sans Variable', system-ui, sans-serif; } .ds-crumbs { display: flex; gap: 6px; color: var(--fg-muted, #a6a39b); } .ds-crumbs a { color: inherit; text-decoration: none; } .ds-crumbs a:hover { color: var(--foreground, #e8e6e1); } .ds-crumbs a:focus-visible { outline: 2px solid var(--ring, #51a580); outline-offset: 2px; } .ds-current { color: var(--foreground, #e8e6e1); } .ds-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.6875rem; color: var(--fg-muted, #a6a39b); } .ds-pill i { width: 6px; height: 6px; border-radius: 9999px; background: var(--ok, #51a580); }"
|
||||
},
|
||||
{
|
||||
"name": "Step Node",
|
||||
"kind": "custom",
|
||||
"refersTo": "step-node",
|
||||
"description": "The workflow canvas card; the same card shows edit state and live run state.",
|
||||
"html": "<div class=\"ds-node\" tabindex=\"0\"><div class=\"ds-node-meta\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 8V4H8\"/><rect width=\"16\" height=\"12\" x=\"4\" y=\"8\" rx=\"2\"/></svg><span>Agent</span><span class=\"ds-node-dur\">4.2s</span><i class=\"ds-node-dot\"></i></div><div class=\"ds-node-title\">2 Investigate disk usage</div></div>",
|
||||
"css": ".ds-node { width: 240px; padding: 10px 12px; border: 1px solid var(--border, #313338); border-radius: 8px; background: var(--card, #1c1d21); box-shadow: 0 1px 2px rgba(0,0,0,0.4); font-family: 'IBM Plex Sans Variable', system-ui, sans-serif; color: var(--foreground, #e8e6e1); cursor: pointer; transition: width 200ms, box-shadow 200ms, border-color 140ms; } .ds-node:hover { border-color: var(--muted-foreground, #a6a39b); } .ds-node:focus-visible { outline: none; width: 416px; box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 0 0 2px var(--ring, #51a580); } .ds-node-meta { display: flex; align-items: center; gap: 6px; font-size: 0.6875rem; color: var(--fg-muted, #a6a39b); } .ds-node-meta svg { color: var(--link, #51a580); } .ds-node-dur { margin-left: auto; font-family: 'IBM Plex Mono', ui-monospace, monospace; color: var(--fg-subtle, #99968f); } .ds-node-dot { width: 6px; height: 6px; border-radius: 9999px; background: var(--info, #8aa4c2); } .ds-node-title { margin-top: 6px; font-size: 0.8125rem; font-weight: 500; }"
|
||||
}
|
||||
],
|
||||
"narrative": {
|
||||
"northStar": "The Operations Console",
|
||||
"overview": "Archie's dashboard is a calm instrument panel for someone responsible for a live estate. It is dense and legible, and it stays quiet until something needs the operator. The mood is calm, precise and trustworthy: restraint is how the interface shows it is in control, and nothing raises its voice unless state demands it.\n\nThe palette is Graphite: warm neutral greys with no hue cast and a single accent, Signal Sage. Hierarchy comes from surface steps, hairlines and type weight, never from tinted backgrounds. Colour is a signal, not decoration. Sage marks what is live, healthy or actionable, and the four status hues (amber, clay, slate, stone) each keep one meaning everywhere they appear. Dark and light themes carry the same variable set and the same rules; the operator's OS chooses unless they pick one.\n\nDensity is a first-class setting. The default is already compact, and compact mode tightens the whole spacing scale without shrinking text or hit targets. Controls are compact and contextual: they appear where the work is, on hover or focus, rather than as permanent chrome. The interface never looks like a toy and never borrows generic SaaS gloss.",
|
||||
"keyCharacteristics": [
|
||||
"Warm graphite neutrals, one sage accent, four fixed status hues.",
|
||||
"IBM Plex Sans with Plex Mono for IDs, durations and payloads, on a compact type scale (11 to 15px).",
|
||||
"Flat tonal layers; shadows only for things that float.",
|
||||
"Compact density by default, with a tighter compact mode.",
|
||||
"Both themes, reduced motion and keyboard focus are invariants, not options."
|
||||
],
|
||||
"rules": [
|
||||
{ "name": "The Semantic Names Rule", "body": "Components reference `--primary`, `--ok`, `--warn` and the rest, never a raw hex or a hue name such as `--violet`. A palette change is one file.", "section": "colors" },
|
||||
{ "name": "The One Meaning Rule", "body": "A status colour means the same thing wherever it appears: a task state, a gate result, a log level and a trend all draw from the same five tones.", "section": "colors" },
|
||||
{ "name": "The Measured Contrast Rule", "body": "Every foreground is checked against every surface it lands on, hover states included, at 4.5:1. Nothing dimmer than Text Subtle is allowed as text.", "section": "colors" },
|
||||
{ "name": "The Type Scale Rule", "body": "Use the named steps (`text-micro`, `text-caption`, `text-label`, `text-title`), never pixel sizes. Headings are separated by weight and placement, not by size jumps.", "section": "typography" },
|
||||
{ "name": "The Data Is Mono Rule", "body": "Anything the operator might copy or compare (an ID, a version, a duration, a payload) is set in Plex Mono.", "section": "typography" },
|
||||
{ "name": "The Flat By Default Rule", "body": "Cards sit on the page with a 1px ring, not a shadow. A larger shadow means the element floats above the page.", "section": "elevation" }
|
||||
],
|
||||
"dos": [
|
||||
"Do use semantic tokens (`bg-card`, `text-fg-muted`, `bg-ok-soft`) and the named type steps, so both themes and compact density work without extra code.",
|
||||
"Do keep one filled primary button per view; everything else is ghost, outline or secondary.",
|
||||
"Do set IDs, versions, durations and payloads in Plex Mono.",
|
||||
"Do show actions on hover or focus where the work is, and make every hover action reachable by keyboard.",
|
||||
"Do honour reduced motion: nothing animates when the operator asks it not to."
|
||||
],
|
||||
"donts": [
|
||||
"Don't use generic SaaS gloss: no purple or multicolour gradients, no glow shadows, no glassmorphism cards, no gradient text.",
|
||||
"Don't make it toy-like on phones: no blanket 44px minimum sizes on buttons, links and fields. Widen the tap area invisibly with `touch-hit` instead.",
|
||||
"Don't tint backgrounds for hierarchy; use surface steps and borders.",
|
||||
"Don't introduce a new hue or reuse a status colour for decoration.",
|
||||
"Don't put white text on a status fill; use the soft background and the solid tone.",
|
||||
"Don't add a shadow to a resting card."
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
StylesPath = .vale/styles
|
||||
MinAlertLevel = warning
|
||||
Vocab = Archie
|
||||
|
||||
# Run `vale sync` to install external packages and the Go comment grammar.
|
||||
Packages = Google, Microsoft, Voices, TechTerms, Comments, Prompts
|
||||
Grammars = go
|
||||
|
||||
[formats]
|
||||
tmpl = md
|
||||
|
||||
[*.{md,tmpl}]
|
||||
# Ignore Go/workflow template expressions such as {{ steps.plan.summary }}.
|
||||
TokenIgnores = (\{\{[^}]*\}\})
|
||||
|
||||
BasedOnStyles = Vale, Voices, Direct, Google, Archie
|
||||
|
||||
# Australian English and Archie's technical prose conventions:
|
||||
Google.Spelling = NO
|
||||
Google.Quotes = NO
|
||||
Google.DateFormat = NO
|
||||
Google.OxfordComma = NO
|
||||
Google.EmDash = NO
|
||||
Google.Contractions = NO
|
||||
Google.Parens = NO
|
||||
Google.Semicolons = NO
|
||||
Google.Colons = NO
|
||||
Google.Units = NO
|
||||
Google.Acronyms = NO
|
||||
Google.WordList = NO
|
||||
Google.WordListCase = NO
|
||||
|
||||
# Keep style nudges advisory (visible with --minAlertLevel=suggestion).
|
||||
Google.Headings = suggestion
|
||||
Google.Latin = suggestion
|
||||
Google.Exclamation = warning
|
||||
Google.FirstPerson = suggestion
|
||||
Google.We = suggestion
|
||||
Google.Will = suggestion
|
||||
|
||||
# Selective Microsoft rules (UI verbs, inclusive terminology, hyphens) without
|
||||
# pulling in Microsoft-specific product jargon (e.g. agent -> personal digital assistant).
|
||||
Microsoft.UIVerbs = warning
|
||||
Microsoft.BiasFree = warning
|
||||
Microsoft.Auto = warning
|
||||
Microsoft.Suspended = warning
|
||||
Microsoft.Accessibility = suggestion
|
||||
Microsoft.Uppercase = suggestion
|
||||
|
||||
# "Term: explanation" is idiomatic throughout Archie's docs and comments.
|
||||
Voices.ColonReveal = NO
|
||||
|
||||
# Replaced by Archie.Readability and Archie.SentenceLength, calibrated for technical docs.
|
||||
Direct.Ease = NO
|
||||
Direct.Length = NO
|
||||
Direct.Hedging = warning
|
||||
Direct.Preamble = warning
|
||||
|
||||
# Agent instruction and skill files get additional prompt-quality checks.
|
||||
[{AGENTS,CLAUDE,SKILL}.md]
|
||||
BasedOnStyles = Vale, Voices, Direct, Google, Archie, Prompts
|
||||
# A rule file states each rule once, and many of those rules are absolutes.
|
||||
# The prompt heuristic against repeated absolutes does not apply here.
|
||||
Prompts.Absolutes = NO
|
||||
|
||||
# Model prompts are plain text (no Markdown bold) and reference tool names inline.
|
||||
[internal/prompts/*.{md,tmpl}]
|
||||
Vale.Spelling = suggestion
|
||||
Archie.UILabelFormat = NO
|
||||
|
||||
# Go source comments: doc conventions, spelling, clarity, and no migration narration.
|
||||
[*.go]
|
||||
BasedOnStyles = Vale, Voices, Comments, GoDoc, Archie
|
||||
|
||||
# Go comments often mention camelCase/snake_case identifiers without backticks,
|
||||
# so keep spelling advisory here.
|
||||
Vale.Spelling = suggestion
|
||||
|
||||
# Upstream GoDoc.Sentence regex backtracks heavily on long comment blocks.
|
||||
GoDoc.Sentence = NO
|
||||
Voices.ColonReveal = NO
|
||||
Archie.Readability = NO
|
||||
Archie.SentenceLength = NO
|
||||
Archie.UIElementType = NO
|
||||
Archie.UILabelFormat = NO
|
||||
|
||||
# Never lint generated Go files (protobuf, sqlc).
|
||||
[*.{pb,sql}.go]
|
||||
BasedOnStyles =
|
||||
@@ -1,154 +0,0 @@
|
||||
# Enforce Australian English spelling in prose.
|
||||
# Intentionally omits computing standards that use US forms in Australia
|
||||
# (program, disk, artifact) and verb/noun pairs (licence/license, practise/practice).
|
||||
extends: substitution
|
||||
message: "Use Australian English '%s' instead of '%s'."
|
||||
level: warning
|
||||
ignorecase: true
|
||||
action:
|
||||
name: replace
|
||||
# Exact-case exceptions for HTTP headers and Go method names.
|
||||
exceptions:
|
||||
- Authorize
|
||||
- Authorization
|
||||
swap:
|
||||
analyze: analyse
|
||||
analyzed: analysed
|
||||
analyzes: analyses
|
||||
analyzing: analysing
|
||||
authorization: authorisation
|
||||
authorizations: authorisations
|
||||
authorize: authorise
|
||||
authorized: authorised
|
||||
authorizes: authorises
|
||||
authorizing: authorising
|
||||
behavior: behaviour
|
||||
behavioral: behavioural
|
||||
behaviors: behaviours
|
||||
canceled: cancelled
|
||||
canceling: cancelling
|
||||
canonicalize: canonicalise
|
||||
canonicalized: canonicalised
|
||||
canonicalizes: canonicalises
|
||||
canonicalizing: canonicalising
|
||||
catalog: catalogue
|
||||
cataloged: catalogued
|
||||
cataloging: cataloguing
|
||||
catalogs: catalogues
|
||||
categorization: categorisation
|
||||
categorize: categorise
|
||||
categorized: categorised
|
||||
categorizes: categorises
|
||||
categorizing: categorising
|
||||
center: centre
|
||||
centered: centred
|
||||
centering: centring
|
||||
centers: centres
|
||||
color: colour
|
||||
colored: coloured
|
||||
coloring: colouring
|
||||
colors: colours
|
||||
customization: customisation
|
||||
customize: customise
|
||||
customized: customised
|
||||
customizes: customises
|
||||
customizing: customising
|
||||
favor: favour
|
||||
favored: favoured
|
||||
favoring: favouring
|
||||
favorite: favourite
|
||||
favorites: favourites
|
||||
favors: favours
|
||||
finalize: finalise
|
||||
finalized: finalised
|
||||
finalizes: finalises
|
||||
finalizing: finalising
|
||||
fulfill: fulfil
|
||||
fulfillment: fulfilment
|
||||
fulfills: fulfils
|
||||
initialization: initialisation
|
||||
initialize: initialise
|
||||
initialized: initialised
|
||||
initializes: initialises
|
||||
initializing: initialising
|
||||
judgment: judgement
|
||||
judgments: judgements
|
||||
labeled: labelled
|
||||
labeling: labelling
|
||||
maximize: maximise
|
||||
maximized: maximised
|
||||
maximizes: maximises
|
||||
maximizing: maximising
|
||||
minimize: minimise
|
||||
minimized: minimised
|
||||
minimizes: minimises
|
||||
minimizing: minimising
|
||||
modeled: modelled
|
||||
modeling: modelling
|
||||
normalization: normalisation
|
||||
normalize: normalise
|
||||
normalized: normalised
|
||||
normalizes: normalises
|
||||
normalizing: normalising
|
||||
optimization: optimisation
|
||||
optimizations: optimisations
|
||||
optimize: optimise
|
||||
optimized: optimised
|
||||
optimizes: optimises
|
||||
optimizing: optimising
|
||||
organization: organisation
|
||||
organizational: organisational
|
||||
organizations: organisations
|
||||
organize: organise
|
||||
organized: organised
|
||||
organizes: organises
|
||||
organizing: organising
|
||||
parameterize: parameterise
|
||||
parameterized: parameterised
|
||||
parameterizes: parameterises
|
||||
parameterizing: parameterising
|
||||
prioritize: prioritise
|
||||
prioritized: prioritised
|
||||
prioritizes: prioritises
|
||||
prioritizing: prioritising
|
||||
recognize: recognise
|
||||
recognized: recognised
|
||||
recognizes: recognises
|
||||
recognizing: recognising
|
||||
sanitization: sanitisation
|
||||
sanitize: sanitise
|
||||
sanitized: sanitised
|
||||
sanitizes: sanitises
|
||||
sanitizing: sanitising
|
||||
serialization: serialisation
|
||||
serialize: serialise
|
||||
serialized: serialised
|
||||
serializes: serialises
|
||||
serializing: serialising
|
||||
stabilize: stabilise
|
||||
stabilized: stabilised
|
||||
stabilizes: stabilises
|
||||
stabilizing: stabilising
|
||||
summarize: summarise
|
||||
summarized: summarised
|
||||
summarizes: summarises
|
||||
summarizing: summarising
|
||||
synchronization: synchronisation
|
||||
synchronize: synchronise
|
||||
synchronized: synchronised
|
||||
synchronizes: synchronises
|
||||
synchronizing: synchronising
|
||||
unauthorized: unauthorised
|
||||
|
||||
tests:
|
||||
- name: flags US spelling
|
||||
input: |
|
||||
The organization enforces authorization behavior.
|
||||
want: |
|
||||
1:5:Archie.AustralianEnglish:Use Australian English 'organisation' instead of 'organization'.
|
||||
1:27:Archie.AustralianEnglish:Use Australian English 'authorisation' instead of 'authorization'.
|
||||
1:41:Archie.AustralianEnglish:Use Australian English 'behaviour' instead of 'behavior'.
|
||||
- name: accepts Australian spelling and inline code
|
||||
input: |
|
||||
The organisation enforces authorisation behaviour via `behavior_flag`.
|
||||
want: ""
|
||||
@@ -1,29 +0,0 @@
|
||||
# AGENTS.md: "Comments explain why, not what the code already says.
|
||||
# No migration history, phase names or issue narration in code."
|
||||
extends: existence
|
||||
message: "Avoid migration or plan narration ('%s') in code comments. Explain what the code does or why."
|
||||
level: warning
|
||||
scope: comment.go
|
||||
ignorecase: true
|
||||
nonword: true
|
||||
tokens:
|
||||
- '\b(?:phase|wave|slice|sprint)\s+\d+\b'
|
||||
- '\bepic\s+#\d+\b'
|
||||
- '\b(?:formerly|previously)\s+(?:called|named|known as)\b'
|
||||
- '\b(?:migrated|moved|extracted|ported)\s+from\b'
|
||||
|
||||
tests:
|
||||
- name: flags migration narration in Go comments
|
||||
format: go
|
||||
input: |
|
||||
// Phase 2 moved from internal/legacy.
|
||||
package demo
|
||||
want: |
|
||||
1:4:Archie.NoMigrationNarration:Avoid migration or plan narration ('Phase 2') in code comments. Explain what the code does or why.
|
||||
1:12:Archie.NoMigrationNarration:Avoid migration or plan narration ('moved from') in code comments. Explain what the code does or why.
|
||||
- name: allows normal rationale comments
|
||||
format: go
|
||||
input: |
|
||||
// Verify the HMAC before parsing so malformed payloads cannot trigger work.
|
||||
package demo
|
||||
want: ""
|
||||
@@ -1,21 +0,0 @@
|
||||
# Calibrated for developer documentation: crisp technical docs with domain
|
||||
# terminology typically score 8-11 on Flesch-Kincaid; higher scores usually
|
||||
# signal dense paragraphs that benefit from simpler structure.
|
||||
extends: metric
|
||||
message: "Try to keep the Flesch-Kincaid grade level (%s) at or below 11."
|
||||
link: https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests
|
||||
level: warning
|
||||
formula: |
|
||||
(0.39 * (words / sentences)) + (11.8 * (syllables / words)) - 15.59
|
||||
condition: "> 11"
|
||||
|
||||
tests:
|
||||
- name: flags dense technical prose
|
||||
input: |
|
||||
Notwithstanding architectural encapsulation prerequisites, interdepartmental orchestration mechanisms necessitate comprehensive deterministic authentication verification across heterogeneous distributed administrative infrastructures.
|
||||
want: |
|
||||
1:1:Archie.Readability:Try to keep the Flesch-Kincaid grade level (42.40) at or below 11.
|
||||
- name: accepts clear technical prose
|
||||
input: |
|
||||
A source receives events and checks their HMAC signature. A mapping extracts named fields from the payload. A binding selects the workflow to run.
|
||||
want: ""
|
||||
@@ -1,17 +0,0 @@
|
||||
# Flag overly long sentences in documentation. Set to 35 words so precise
|
||||
# technical constraints fit comfortably while runaway sentences are caught.
|
||||
extends: Std.Readability.SentenceLength
|
||||
message: "This sentence has %d words. Consider splitting it for readability."
|
||||
level: warning
|
||||
max: 35
|
||||
|
||||
tests:
|
||||
- name: flags long sentence
|
||||
input: |
|
||||
When the daemon starts a new workflow run for an incoming event that matched a signed binding, it loads the published workflow definition from storage, allocates an isolated container workspace, prepares task-scoped credentials, and dispatches the first step immediately without waiting.
|
||||
want: |
|
||||
1:1:Archie.SentenceLength:This sentence has 42 words. Consider splitting it for readability.
|
||||
- name: accepts concise technical sentences
|
||||
input: |
|
||||
The daemon loads the published workflow definition and allocates an isolated container workspace. It prepares task-scoped credentials before dispatching the first step.
|
||||
want: ""
|
||||
@@ -1,22 +0,0 @@
|
||||
# Microsoft Writing Style Guide: "Don't include the type of UI element, such as
|
||||
# button or checkbox, unless including it adds needed clarity."
|
||||
extends: existence
|
||||
message: "Omit the UI element type after a bold label ('%s') unless it adds clarity."
|
||||
link: https://learn.microsoft.com/en-us/style-guide/procedures-instructions/describing-interactions-with-ui
|
||||
level: warning
|
||||
scope: raw
|
||||
nonword: true
|
||||
tokens:
|
||||
- '\*\*[^*\n]{1,40}\*\*\s+(?:button|checkbox|check box|dropdown|drop-down|field|icon|link|menu|option|switch|tab|toggle)\b'
|
||||
|
||||
tests:
|
||||
- name: flags bold label followed by UI element type
|
||||
input: |
|
||||
Select the **Save** button and leave the **Shared secret** field blank.
|
||||
want: |
|
||||
1:12:Archie.UIElementType:Omit the UI element type after a bold label ('**Save** button') unless it adds clarity.
|
||||
1:42:Archie.UIElementType:Omit the UI element type after a bold label ('**Shared secret** field') unless it adds clarity.
|
||||
- name: allows bold UI label without element type
|
||||
input: |
|
||||
Select **Save** and leave **Shared secret** blank.
|
||||
want: ""
|
||||
@@ -1,46 +0,0 @@
|
||||
# Input-neutral UI interaction verbs complementing Microsoft.UIVerbs.
|
||||
# Based on Microsoft Writing Style Guide: Describing interactions with UI.
|
||||
extends: substitution
|
||||
message: "Use the input-neutral UI verb '%s' instead of '%s'."
|
||||
link: https://learn.microsoft.com/en-us/style-guide/procedures-instructions/describing-interactions-with-ui
|
||||
level: warning
|
||||
ignorecase: true
|
||||
action:
|
||||
name: replace
|
||||
swap:
|
||||
deselect: clear
|
||||
deselected: cleared
|
||||
deselecting: clearing
|
||||
deselects: clears
|
||||
drag and drop: drag
|
||||
drag-and-drop: drag
|
||||
key in: enter
|
||||
keyed in: entered
|
||||
keying in: entering
|
||||
mouse over: hover over
|
||||
moused over: hovered over
|
||||
mousing over: hovering over
|
||||
navigate to: go to
|
||||
navigated to: went to
|
||||
navigating to: going to
|
||||
press and hold: select and hold
|
||||
tap and hold: select and hold
|
||||
tap on: select
|
||||
tapped on: selected
|
||||
tapping on: selecting
|
||||
uncheck: clear
|
||||
unchecking: clearing
|
||||
unchecks: clears
|
||||
|
||||
tests:
|
||||
- name: flags input-specific UI verbs
|
||||
input: |
|
||||
Navigate to Settings, uncheck Auto-save, and mouse over the badge.
|
||||
want: |
|
||||
1:1:Archie.UIInteractions:Use the input-neutral UI verb 'go to' instead of 'Navigate to'.
|
||||
1:23:Archie.UIInteractions:Use the input-neutral UI verb 'clear' instead of 'uncheck'.
|
||||
1:46:Archie.UIInteractions:Use the input-neutral UI verb 'hover over' instead of 'mouse over'.
|
||||
- name: accepts input-neutral UI verbs
|
||||
input: |
|
||||
Go to Settings, clear Auto-save, and hover over the badge.
|
||||
want: ""
|
||||
@@ -1,26 +0,0 @@
|
||||
# Microsoft Writing Style Guide:
|
||||
# - Use bold formatting for UI element names, not quotation marks.
|
||||
# - Omit trailing colons or ellipses from UI labels in instructions.
|
||||
extends: existence
|
||||
message: "Format UI labels in bold without quotes or trailing punctuation ('%s')."
|
||||
link: https://learn.microsoft.com/en-us/style-guide/procedures-instructions/describing-interactions-with-ui
|
||||
level: warning
|
||||
scope: raw
|
||||
ignorecase: true
|
||||
nonword: true
|
||||
tokens:
|
||||
- '\b(?:select|choose|open|clear|go to|hover over)\s+"[^"\n]{1,40}"'
|
||||
- '\b(?:select|choose|open|clear|go to|hover over)\s+\*\*[^*\n]{1,40}(?::|\.{3}|…)\*\*'
|
||||
|
||||
tests:
|
||||
- name: flags quoted UI labels and trailing punctuation
|
||||
input: |
|
||||
Select "Save" or choose **Export...** and open **Settings:**.
|
||||
want: |
|
||||
1:1:Archie.UILabelFormat:Format UI labels in bold without quotes or trailing punctuation ('Select "Save"').
|
||||
1:18:Archie.UILabelFormat:Format UI labels in bold without quotes or trailing punctuation ('choose **Export...**').
|
||||
1:43:Archie.UILabelFormat:Format UI labels in bold without quotes or trailing punctuation ('open **Settings:**').
|
||||
- name: accepts clean bold UI labels
|
||||
input: |
|
||||
Select **Save**, choose **Export**, and open **Settings**.
|
||||
want: ""
|
||||
@@ -1,44 +0,0 @@
|
||||
# Prefer concise wording over wordy phrases.
|
||||
extends: substitution
|
||||
message: "Use '%s' instead of '%s'."
|
||||
level: warning
|
||||
ignorecase: true
|
||||
action:
|
||||
name: replace
|
||||
swap:
|
||||
a large number of: many
|
||||
a majority of: most
|
||||
a sufficient number of: enough
|
||||
as a means of: to
|
||||
at this point in time: now
|
||||
due to the fact that: because
|
||||
for the purpose of: to
|
||||
has the capability to: can
|
||||
in close proximity to: near
|
||||
in excess of: more than
|
||||
in spite of the fact that: although
|
||||
in the event that: if
|
||||
in the near future: soon
|
||||
make use of: use
|
||||
on a daily basis: daily
|
||||
on a monthly basis: monthly
|
||||
on a weekly basis: weekly
|
||||
prior to: before
|
||||
subsequent to: after
|
||||
take advantage of: use
|
||||
until such time as: until
|
||||
whether or not: whether
|
||||
with regard to: about
|
||||
with respect to: about
|
||||
|
||||
tests:
|
||||
- name: flags wordy phrases
|
||||
input: |
|
||||
Check the signature prior to parsing due to the fact that payloads are untrusted.
|
||||
want: |
|
||||
1:21:Archie.Wordiness:Use 'before' instead of 'prior to'.
|
||||
1:38:Archie.Wordiness:Use 'because' instead of 'due to the fact that'.
|
||||
- name: accepts concise wording
|
||||
input: |
|
||||
Check the signature before parsing because payloads are untrusted.
|
||||
want: ""
|
||||
@@ -1,30 +0,0 @@
|
||||
# Case-insensitive common terms (matched in any capitalisation)
|
||||
(?i)approvers?
|
||||
(?i)archipelago
|
||||
(?i)canonicalis(?:e[ds]?|ing)
|
||||
(?i)carina
|
||||
(?i)confirmers?
|
||||
(?i)fulfilment
|
||||
(?i)passkeys?
|
||||
(?i)reapprovals?
|
||||
(?i)redemptions?
|
||||
(?i)retags?
|
||||
(?i)undispatched
|
||||
(?i)unpushed
|
||||
(?i)worktrees?
|
||||
|
||||
# Proper nouns, tools, and exact-case technical terms
|
||||
archied
|
||||
Catlow
|
||||
depguard
|
||||
gosec
|
||||
govulncheck
|
||||
hclog
|
||||
Huma
|
||||
Miessler
|
||||
Pdeathsig
|
||||
prbench
|
||||
Reka
|
||||
releaseupdate
|
||||
secretengine
|
||||
sqlc
|
||||
@@ -5,9 +5,9 @@ here changes a decision. If a rule stops changing decisions, delete it.
|
||||
|
||||
## What this is
|
||||
|
||||
**archie-core** is event-driven agentic automation. It matches an event (an
|
||||
alert, a webhook, a schedule, a chat message, an issue) to a workflow. The
|
||||
workflow runs an agent, and archie-core judges every action before it runs. The
|
||||
**archie-core** is event-driven agentic automation. An event (an alert, a
|
||||
webhook, a schedule, a chat message, an issue) is matched to a workflow, the
|
||||
workflow runs an agent whose every action is judged before it runs, and the
|
||||
result lands somewhere for review or action. A repository is an optional input
|
||||
to a workflow, not the point of the product. A forge is one of many inputs or
|
||||
outputs; core code never assumes one.
|
||||
@@ -33,9 +33,9 @@ there:
|
||||
needs the maintainer's verdict on its row. Before building anything an old
|
||||
package already does, read that package and carry its behaviour.
|
||||
|
||||
### The services the binary replaces
|
||||
### The services being replaced
|
||||
|
||||
Delete the six services below slice by slice as the binary replaces them,
|
||||
The six services below are deleted slice by slice as the binary replaces them,
|
||||
each only once MIGRATION.md has a verdict for every package it holds. Don't
|
||||
add features to them; fix them only when a bug blocks work.
|
||||
|
||||
@@ -79,14 +79,13 @@ When sources disagree, the higher one wins:
|
||||
the plan, offer options, or ask "shall I proceed?". Stop only for destructive
|
||||
or outward-facing actions (deleting data, pushing, touching a live host).
|
||||
- **Push back when it matters.** If a request competes with something clearly
|
||||
more urgent, or looks like the wrong call, say so once in a sentence or two.
|
||||
A bug that loses work, a failure that shows nothing, a security gap and a
|
||||
broken setup path are all more urgent. Suggest whether it belongs in the
|
||||
backlog. Then do what the maintainer asked: don't repeat the point or hold
|
||||
work back on your own judgement.
|
||||
more urgent (a bug that loses work, a failure that shows nothing, a security
|
||||
gap, a broken setup path), or looks like the wrong call, say so once in a
|
||||
sentence or two and suggest whether it belongs in the backlog. Then do what
|
||||
was asked: don't repeat the point or hold work back on your own judgement.
|
||||
- **Post outside the repo only when told.** Chat, tickets and any external
|
||||
service get a message only on the maintainer's instruction.
|
||||
- **Report, don't narrate.** Final replies say what changed, what you verified,
|
||||
- **Report, don't narrate.** Final replies say what changed, what was verified,
|
||||
and anything blocked, in a few lines. No preamble, no recap of the request, no
|
||||
closing offers of more help. Leave out what the maintainer can see or infer:
|
||||
a clean tree, unpushed commits, a passing gate (commits imply it), and steps
|
||||
@@ -114,12 +113,11 @@ When sources disagree, the higher one wins:
|
||||
- **No compensating tools.** Do not write a linter, checker or generator to
|
||||
enforce something a simpler design would make unnecessary. Fix the design.
|
||||
- **A setting must work end to end.** A config field that parses but has no
|
||||
consumer is a bug. Operators edit settings through the control plane (API and
|
||||
dashboard), never through a server login.
|
||||
consumer is a bug. Settings are edited through the control plane (API and
|
||||
dashboard), never by requiring a server login.
|
||||
- **Ask only for real decisions.** Product direction and trade-offs the
|
||||
maintainer owns are questions. Anything with a conventional engineering
|
||||
answer or an existing pattern in the codebase is not: decide, do it, say
|
||||
what you chose.
|
||||
maintainer owns are questions. Everything with a conventional answer is not:
|
||||
decide, do it, say what you chose.
|
||||
|
||||
## Code
|
||||
|
||||
@@ -129,8 +127,7 @@ When sources disagree, the higher one wins:
|
||||
- Dependencies point inward: `cmd → app → {domain, infrastructure}`,
|
||||
`infrastructure` implements `domain` interfaces, `domain` imports neither.
|
||||
`cmd/` parses flags and calls `app`, nothing else.
|
||||
- Fix invalid state where the code produces it, not with checks where the
|
||||
code consumes it.
|
||||
- Fix invalid state where it is produced, not with checks where it is consumed.
|
||||
- Log through the service's injected `*slog.Logger` with the `...Context`
|
||||
methods, so lines carry the OpenTelemetry trace id. Never the global `slog`.
|
||||
- If a fix fails twice, throw the block away and rewrite it simply.
|
||||
@@ -141,12 +138,8 @@ When sources disagree, the higher one wins:
|
||||
terminology and normal word order. Avoid invented metaphors, awkward
|
||||
possessives, inverted sentences and clever paraphrases. Prefer repeating
|
||||
an established term over inventing a synonym.
|
||||
- Regenerate generated files (protobuf, sqlc) and commit them with the change
|
||||
that caused them; never hand-edit them.
|
||||
- Foreign keys and attribution always reference immutable primary IDs, never
|
||||
mutable or non-unique attributes (display names, slugs, emails). Store
|
||||
display labels alongside an ID only when you need point-in-time snapshot
|
||||
fidelity.
|
||||
- Generated files (protobuf, sqlc) are regenerated and committed
|
||||
with the change that caused them, never hand-edited.
|
||||
|
||||
## Tests
|
||||
|
||||
@@ -162,14 +155,14 @@ The default for a change is no new test. Write one only when:
|
||||
A test that exists must catch a real regression, survive refactoring, run fast,
|
||||
and be cheap to keep. Never test wiring, constants, defaults, struct shapes,
|
||||
fakes, or call order. Prefer making an invalid state unrepresentable to testing
|
||||
that the code rejects it.
|
||||
that it is rejected.
|
||||
|
||||
How to write one:
|
||||
|
||||
- **Prove it.** Run the new test against the code before the fix and see it
|
||||
fail. A test that passes either way proves nothing: delete it. When you
|
||||
can't reproduce a bug deterministically (a race, say), fix it with an API
|
||||
that rules it out and don't add a test.
|
||||
fail. A test that passes either way proves nothing: delete it. When a bug
|
||||
can't be reproduced deterministically (a race, say), fix it with an API that
|
||||
rules it out and don't add a test.
|
||||
- **One table per behaviour.** Extend the table instead of adding a second test.
|
||||
Name the test after the behaviour, and say in its comment what regression it
|
||||
guards.
|
||||
@@ -181,7 +174,7 @@ How to write one:
|
||||
- **Isolated.** Use `t.TempDir()` and `t.Setenv`, never host state. A test that
|
||||
commits with git sets `GIT_CONFIG_GLOBAL` to `os.DevNull`. No test opens a
|
||||
real database or needs Docker: test SQL semantics at the interceptor or domain
|
||||
level with fakes. Tests write files `0o600`, or `0o700` for a script.
|
||||
level with fakes. Files are written `0o600`, or `0o700` for a script.
|
||||
- **Shared setup in helpers.** When several tests repeat the same setup, put it
|
||||
in a helper in a `_test.go` file, never in production code.
|
||||
|
||||
@@ -189,19 +182,18 @@ How to write one:
|
||||
|
||||
These protect users. Do not weaken them without the maintainer's say-so.
|
||||
|
||||
- A crash loses no accepted work, and a restart resumes every run. The service
|
||||
that accepts the work acknowledges it only once it is durable. A service
|
||||
reports a missing dependency as unhealthy and retries it; that is never a
|
||||
reason to exit.
|
||||
- A crash loses no accepted work, and a restart resumes every run. Work is
|
||||
acknowledged only once it is durable. A missing dependency is reported
|
||||
unhealthy and retried, never a reason to exit.
|
||||
- The model never runs git. Commits and pushes go through the daemon.
|
||||
- The daemon's own credentials never enter an agent container. Containers get
|
||||
task-scoped grants that the daemon revokes when the task ends.
|
||||
- The events module verifies webhook HMAC before it parses the payload.
|
||||
task-scoped grants that are revoked when the task ends.
|
||||
- Webhook HMAC is verified before the payload is parsed.
|
||||
- Task briefs go in `<worktree>/.git/task.json`, never the worktree root.
|
||||
- NATS: task and RPC replies use `msg.Respond`; flush after registering a
|
||||
responder; `ARCHIE_TASKS` is a work queue, so never bind overlapping
|
||||
consumers.
|
||||
- Drain `ai-sdk` `FullStream` completely.
|
||||
- `ai-sdk` `FullStream` must be drained completely.
|
||||
|
||||
## Build and gate
|
||||
|
||||
@@ -229,16 +221,16 @@ Requires Go 1.27, Task, golangci-lint, Node, pnpm and Docker. Adopt `task fmt` a
|
||||
run, say what you did verify.
|
||||
- Commit finished work without asking. Stage only your own paths and commit in
|
||||
the same command. Conventional Commits scoped by package, short messages. Push
|
||||
every commit as soon as you make it; a local-only commit is not acceptable.
|
||||
every commit as soon as it is made; a local-only commit is not acceptable.
|
||||
- Never commit binaries, build output, scratch files or `.references/`. Scratch
|
||||
goes in `/tmp`.
|
||||
- Runtime config lives at `${XDG_CONFIG_HOME:-~/.config}/archie/config.toml`.
|
||||
The runtime reads nothing in the working tree. Systemd is optional.
|
||||
Nothing in the working tree is read at runtime. Systemd is optional.
|
||||
- Releases: `RELEASING.md`.
|
||||
|
||||
## Issues (Gitea)
|
||||
|
||||
Track work as issues on the primary remote, never in Markdown TODO files.
|
||||
Work is tracked as issues on the primary remote, never in Markdown TODO files.
|
||||
GitHub is a read-only mirror; do not open, close or comment there.
|
||||
|
||||
```bash
|
||||
@@ -249,12 +241,12 @@ tea comment 497 "what changed, and what was run"
|
||||
tea issues close 497
|
||||
```
|
||||
|
||||
- An issue is the plan: what is wrong or wanted, and how you know the work is
|
||||
complete. Keep it to that.
|
||||
- An issue is the plan: what is wrong or wanted, and how you know it is done.
|
||||
Keep it to that.
|
||||
- Labels carry state: a type (`bug`, `feature`, `task`, `chore`, `epic`,
|
||||
`decision`, `discovery`), a priority (`critical`, `high`, `medium`, `low`), `in-progress`
|
||||
and `deferred`. Open/closed is the issue state, not a label.
|
||||
- An epic's children are its dependencies: link each one as you file it (Gitea
|
||||
- An epic's children are its dependencies: link each one as it is filed (Gitea
|
||||
MCP `issue_write` `add_dependency`, the epic `blocked_by` the child), plus any
|
||||
real blocker between children. No `epic/<slug>` label; the dependencies are
|
||||
the link, and the only place the web UI shows an epic's children.
|
||||
@@ -271,6 +263,6 @@ tea issues close 497
|
||||
|
||||
## Changing this file
|
||||
|
||||
Add a rule only after a real failure it would have prevented, and it must
|
||||
A rule is added only after a real failure it would have prevented, and it must
|
||||
say which decision it changes. Remove rules that no longer change decisions.
|
||||
Keep it short enough to read in full every session.
|
||||
@@ -1,411 +0,0 @@
|
||||
---
|
||||
name: Archie
|
||||
description: Event-driven Agentic Automation
|
||||
colors:
|
||||
signal-sage: "#51a580"
|
||||
signal-sage-deep: "#2e795a"
|
||||
signal-sage-ink: "#0c6f4d"
|
||||
graphite-canvas: "#0e0f10"
|
||||
graphite-workspace: "#16171a"
|
||||
graphite-card: "#1c1d21"
|
||||
graphite-popover: "#202226"
|
||||
graphite-hover: "#26282c"
|
||||
graphite-hairline: "#2a2c30"
|
||||
graphite-border: "#313338"
|
||||
graphite-border-strong: "#3c3f45"
|
||||
graphite-input: "#70727a"
|
||||
graphite-text: "#e8e6e1"
|
||||
graphite-text-muted: "#a6a39b"
|
||||
graphite-text-subtle: "#99968f"
|
||||
paper-canvas: "#e9eaec"
|
||||
paper-workspace: "#f3f4f5"
|
||||
paper-card: "#ffffff"
|
||||
paper-hover: "#e7e9ec"
|
||||
paper-hairline: "#d2d5da"
|
||||
paper-border: "#d5d8dc"
|
||||
paper-border-strong: "#bec3c9"
|
||||
paper-input: "#838890"
|
||||
paper-text: "#202327"
|
||||
paper-text-muted: "#585d64"
|
||||
paper-text-subtle: "#656a72"
|
||||
amber-warn: "#d9a45b"
|
||||
amber-warn-ink: "#8a5a12"
|
||||
clay-danger: "#d9776b"
|
||||
clay-danger-ink: "#b3413a"
|
||||
slate-info: "#8aa4c2"
|
||||
slate-info-ink: "#3d5f86"
|
||||
stone-idle: "#9a978f"
|
||||
stone-idle-ink: "#5b6068"
|
||||
typography:
|
||||
title:
|
||||
fontFamily: "IBM Plex Sans Variable, system-ui, sans-serif"
|
||||
fontSize: "0.9375rem"
|
||||
fontWeight: 500
|
||||
lineHeight: 1.375
|
||||
page-title:
|
||||
fontFamily: "IBM Plex Sans Variable, system-ui, sans-serif"
|
||||
fontSize: "0.9375rem"
|
||||
fontWeight: 600
|
||||
lineHeight: 1.25
|
||||
letterSpacing: "-0.025em"
|
||||
label:
|
||||
fontFamily: "IBM Plex Sans Variable, system-ui, sans-serif"
|
||||
fontSize: "0.8125rem"
|
||||
fontWeight: 400
|
||||
caption:
|
||||
fontFamily: "IBM Plex Sans Variable, system-ui, sans-serif"
|
||||
fontSize: "0.6875rem"
|
||||
fontWeight: 500
|
||||
section-label:
|
||||
fontFamily: "IBM Plex Sans Variable, system-ui, sans-serif"
|
||||
fontSize: "0.6875rem"
|
||||
fontWeight: 500
|
||||
letterSpacing: "0.06em"
|
||||
micro:
|
||||
fontFamily: "IBM Plex Sans Variable, system-ui, sans-serif"
|
||||
fontSize: "0.625rem"
|
||||
mono:
|
||||
fontFamily: "IBM Plex Mono, ui-monospace, monospace"
|
||||
fontSize: "0.6875rem"
|
||||
fontWeight: 400
|
||||
rounded:
|
||||
sm: "4px"
|
||||
md: "6px"
|
||||
lg: "8px"
|
||||
xl: "12px"
|
||||
full: "9999px"
|
||||
spacing:
|
||||
unit: "0.25rem"
|
||||
unit-compact: "0.225rem"
|
||||
control-gap: "0.375rem"
|
||||
card-x: "1rem"
|
||||
card-y: "1rem"
|
||||
page-x: "1.5rem"
|
||||
page-y: "1.25rem"
|
||||
components:
|
||||
button-primary:
|
||||
backgroundColor: "{colors.signal-sage-deep}"
|
||||
textColor: "#ffffff"
|
||||
typography: "{typography.label}"
|
||||
rounded: "{rounded.lg}"
|
||||
padding: "0 10px"
|
||||
height: "36px"
|
||||
button-ghost:
|
||||
backgroundColor: "transparent"
|
||||
textColor: "{colors.graphite-text}"
|
||||
typography: "{typography.label}"
|
||||
rounded: "{rounded.lg}"
|
||||
padding: "0 10px"
|
||||
height: "36px"
|
||||
button-ghost-hover:
|
||||
backgroundColor: "{colors.graphite-hover}"
|
||||
button-attention:
|
||||
backgroundColor: "rgba(217, 164, 91, 0.08)"
|
||||
textColor: "{colors.amber-warn}"
|
||||
typography: "{typography.label}"
|
||||
rounded: "{rounded.lg}"
|
||||
padding: "0 10px"
|
||||
height: "36px"
|
||||
button-destructive:
|
||||
backgroundColor: "rgba(217, 119, 107, 0.2)"
|
||||
textColor: "{colors.clay-danger}"
|
||||
typography: "{typography.label}"
|
||||
rounded: "{rounded.lg}"
|
||||
padding: "0 10px"
|
||||
height: "36px"
|
||||
input:
|
||||
backgroundColor: "{colors.graphite-card}"
|
||||
textColor: "{colors.graphite-text}"
|
||||
typography: "{typography.label}"
|
||||
rounded: "{rounded.lg}"
|
||||
padding: "4px 10px"
|
||||
height: "36px"
|
||||
card:
|
||||
backgroundColor: "{colors.graphite-card}"
|
||||
textColor: "{colors.graphite-text}"
|
||||
rounded: "{rounded.xl}"
|
||||
padding: "16px"
|
||||
badge-ok:
|
||||
backgroundColor: "rgba(81, 165, 128, 0.12)"
|
||||
textColor: "{colors.signal-sage}"
|
||||
typography: "{typography.caption}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: "2px 8px"
|
||||
height: "20px"
|
||||
badge-warn:
|
||||
backgroundColor: "rgba(217, 164, 91, 0.08)"
|
||||
textColor: "{colors.amber-warn}"
|
||||
typography: "{typography.caption}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: "2px 8px"
|
||||
height: "20px"
|
||||
badge-danger:
|
||||
backgroundColor: "rgba(217, 119, 107, 0.08)"
|
||||
textColor: "{colors.clay-danger}"
|
||||
typography: "{typography.caption}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: "2px 8px"
|
||||
height: "20px"
|
||||
status-dot:
|
||||
rounded: "{rounded.full}"
|
||||
size: "6px"
|
||||
top-bar:
|
||||
backgroundColor: "{colors.graphite-card}"
|
||||
height: "56px"
|
||||
padding: "0 16px"
|
||||
step-node:
|
||||
backgroundColor: "{colors.graphite-card}"
|
||||
rounded: "{rounded.lg}"
|
||||
padding: "10px 12px"
|
||||
width: "240px"
|
||||
step-node-expanded:
|
||||
width: "416px"
|
||||
---
|
||||
|
||||
# Design System: Archie
|
||||
|
||||
## Overview
|
||||
|
||||
**Creative North Star: "The Operations Console"**
|
||||
|
||||
Archie's dashboard is a calm instrument panel for someone responsible for a live
|
||||
estate. It is dense and legible, and it stays quiet until something needs the
|
||||
operator. The mood is calm, precise and trustworthy: restraint is how the
|
||||
interface shows it is in control, and nothing raises its voice unless state
|
||||
demands it.
|
||||
|
||||
Graphite dark and Neutral light share one accent, Signal Sage. Neutral surfaces,
|
||||
hairlines and type weight set the hierarchy. Solid sage marks the primary action;
|
||||
a sage line or outline marks selection and focus. Labelled badges carry status.
|
||||
Both themes use the same tokens, and the operator's OS chooses the theme unless
|
||||
they pick one.
|
||||
|
||||
Density is a first-class setting. The default is already compact, and compact mode
|
||||
tightens the whole spacing scale without shrinking text or hit targets. Controls
|
||||
are compact and contextual: they appear where the work is, on hover or focus,
|
||||
rather than as permanent chrome. The interface never looks like a toy and never
|
||||
borrows generic SaaS gloss.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Neutral light and Graphite dark, with one sage accent.
|
||||
- IBM Plex Sans with Plex Mono for IDs, durations and payloads, on a compact type
|
||||
scale (11 to 15px).
|
||||
- Flat tonal layers; shadows only for things that float.
|
||||
- Compact density by default, with a tighter compact mode.
|
||||
- Both themes, reduced motion and keyboard focus are invariants, not options.
|
||||
|
||||
## Colors
|
||||
|
||||
Neutral greys carry the structure. Signal Sage marks actions and selection;
|
||||
status colours retain their meaning across both themes.
|
||||
|
||||
### Primary
|
||||
- **Signal Sage** (#51a580): the mark, accents, focus rings and links in dark mode,
|
||||
and the `ok` state there. On a dark card it is 5.7:1 as text.
|
||||
- **Signal Sage Deep** (#2e795a): the primary button fill in both themes (white on
|
||||
it is 5.3:1) and the focus ring on paper, where bright sage falls under 3:1.
|
||||
- **Signal Sage Ink** (#0c6f4d): links and `ok` text in the light theme, 5.0:1 on
|
||||
the paper canvas.
|
||||
|
||||
### Neutral
|
||||
- **Graphite Canvas** (#0e0f10) / **Paper Canvas** (#e9eaec): the page behind
|
||||
everything.
|
||||
- **Graphite Workspace** (#16171a) / **Paper Workspace** (#f3f4f5): the main
|
||||
content area inside the sidebar shell.
|
||||
- **Graphite Card** (#1c1d21) / **Paper Card** (#ffffff): cards, the top bar,
|
||||
inputs and canvas nodes. **Graphite Popover** (#202226) lifts menus one step
|
||||
above cards in dark mode.
|
||||
- **Graphite Hover** (#26282c) / **Paper Hover** (#e7e9ec): hover, secondary and
|
||||
muted surfaces (shadcn's `accent`, `muted` and `secondary` all share it).
|
||||
- **Hairline, Border, Border Strong** (#2a2c30, #313338, #3c3f45 dark; #d2d5da,
|
||||
#d5d8dc, #bec3c9 light): dividers, card edges and the top bar's bottom edge.
|
||||
- **Input stroke** (#70727a dark, #838890 light): field borders.
|
||||
- **Text, Text Muted, Text Subtle** (#e8e6e1, #a6a39b, #99968f dark; #202327,
|
||||
#585d64, #656a72 light): primary copy, secondary copy, and the dimmest text
|
||||
allowed, for hints and captions only.
|
||||
|
||||
### Status
|
||||
- **Amber Warn** (#d9a45b dark, #8a5a12 light): waiting, needs attention, the
|
||||
`attention` button.
|
||||
- **Clay Danger** (#d9776b dark, #b3413a light): failures and destructive
|
||||
actions.
|
||||
- **Slate Info** (#8aa4c2 dark, #3d5f86 light): an agent that is working.
|
||||
- **Stone Idle** (#9a978f dark, #5b6068 light): idle, inactive or unknown.
|
||||
|
||||
Each status hue has a soft background at 8 to 12% alpha of its own tone. Status
|
||||
badges put the solid tone on the soft background, never white text on a fill.
|
||||
|
||||
### Named Rules
|
||||
**The Semantic Names Rule.** Components reference `--primary`, `--ok`, `--warn`
|
||||
and the rest, never a raw hex or a hue name such as `--violet`. A palette change is
|
||||
one file.
|
||||
|
||||
**The One Meaning Rule.** A status colour means the same thing wherever it
|
||||
appears: a task state, a gate result, a log level and a trend all draw from the
|
||||
same five tones.
|
||||
|
||||
**The Measured Contrast Rule.** Every foreground is checked against every surface
|
||||
it lands on, hover states included, at 4.5:1. Nothing dimmer than Text Subtle is
|
||||
allowed as text.
|
||||
|
||||
## Typography
|
||||
|
||||
**Body Font:** IBM Plex Sans Variable (with system-ui, sans-serif)
|
||||
**Label/Mono Font:** IBM Plex Mono (with ui-monospace, monospace)
|
||||
|
||||
**Character:** A sober, engineered grotesque paired with its own monospace, so
|
||||
identifiers, durations and payloads read as data without changing voice.
|
||||
|
||||
### Hierarchy
|
||||
- **Page title** (600, 0.9375rem, 1.25, -0.025em): one per page, in PageHeader
|
||||
beside the page's actions.
|
||||
- **Title** (500, 0.9375rem, 1.375): card and panel titles.
|
||||
- **Label** (400 to 500, 0.8125rem): body copy, rows, navigation, buttons and
|
||||
fields. The default text size of the dashboard.
|
||||
- **Caption** (500, 0.6875rem): metadata, column labels, step-type labels and
|
||||
badges.
|
||||
- **Section label** (500, 0.6875rem, 0.06em, uppercase): group headings in
|
||||
sidebars and settings navigation only.
|
||||
- **Micro** (0.625rem): the smallest annotations, used sparingly.
|
||||
- **Mono** (400, caption size): IDs, short hashes, durations, log fields and code.
|
||||
|
||||
### Named Rules
|
||||
**The Type Scale Rule.** Use the named steps (`text-micro`, `text-caption`,
|
||||
`text-label`, `text-title`), never pixel sizes. Headings are separated by weight
|
||||
and placement, not by size jumps.
|
||||
|
||||
**The Data Is Mono Rule.** Anything the operator might copy or compare (an ID, a
|
||||
version, a duration, a payload) is set in Plex Mono.
|
||||
|
||||
## Layout
|
||||
|
||||
The app shell is a collapsible sidebar plus a sticky 56px top bar holding the
|
||||
breadcrumb and account controls. Page content sits in the workspace surface with
|
||||
1.5rem by 1.25rem padding, dropping to 1rem below the large breakpoint, and a
|
||||
bottom clearance for the docked chat composer. The chat can pin to either side,
|
||||
and the workspace shifts to make room for it.
|
||||
|
||||
Spacing is Tailwind's 0.25rem scale; compact density sets the unit to 0.225rem,
|
||||
so every gap and padding tightens together and components keep their relative
|
||||
rhythm. Pages use container queries (`@container`) so panels respond to the space
|
||||
they actually have, not the viewport.
|
||||
|
||||
Phone width is a real target. Desktop layouts collapse to dropdowns instead of
|
||||
side lists and to stacked panes, and nothing overlaps the canvas. Controls keep
|
||||
their desktop size on touch screens; a `touch-hit` utility widens the tap area to
|
||||
44px invisibly, and only rows in floating menus grow to 2.75rem.
|
||||
|
||||
The workflow canvas is the one full-bleed surface: on phones it takes the full
|
||||
viewport height, and steps expand in place rather than opening side panels.
|
||||
|
||||
## Elevation & Depth
|
||||
|
||||
The system is flat, with tonal layers. Depth comes from surface steps (canvas,
|
||||
workspace, card, popover) and from hairlines and 1px rings. Shadows are reserved
|
||||
for things that float above the page: menus, popovers, dialogs and an expanded
|
||||
canvas node.
|
||||
|
||||
### Shadow Vocabulary
|
||||
- **Rest** (`box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4)` dark, `0 1px 2px
|
||||
rgba(31, 31, 29, 0.06)` light): the top bar and canvas nodes at rest; barely
|
||||
there.
|
||||
- **Float** (`box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4)` dark, `0 8px 28px
|
||||
rgba(31, 31, 29, 0.1)` light): popovers, menus, dialogs and the expanded step
|
||||
node.
|
||||
|
||||
### Named Rules
|
||||
**The Flat By Default Rule.** Cards sit on the page with a 1px ring, not a
|
||||
shadow. A larger shadow means the element floats above the page.
|
||||
|
||||
## Shapes
|
||||
|
||||
Gently rounded and consistent. Controls, inputs and canvas nodes use 8px corners
|
||||
(`rounded.lg`); cards use 12px (`rounded.xl`); badges use 4px (`rounded.sm`), and
|
||||
small buttons step down to 6px. Status dots and avatars are the only full circles.
|
||||
Borders are 1px and quiet; a strong border marks structural edges such as the top
|
||||
bar. Focus is always a visible 2px ring offset by 2px, in sage.
|
||||
|
||||
## Components
|
||||
|
||||
Compact and contextual: small controls that appear where the work is.
|
||||
|
||||
### Buttons
|
||||
- **Shape:** gently rounded (8px), 36px tall by default, with 32px and 24px sizes
|
||||
and square icon variants.
|
||||
- **Primary:** Signal Sage Deep fill with white label text. At most one per view.
|
||||
- **Ghost / Outline / Secondary:** transparent or hover-surface fills that pick
|
||||
up the hover surface on hover; the default for everything that is not the main
|
||||
action.
|
||||
- **Attention:** amber stroke and soft amber fill, for an action that exists
|
||||
because something is waiting. Not destructive.
|
||||
- **Destructive:** soft clay fill with clay text, never a solid red block.
|
||||
- **Hover / Focus:** 140ms colour transitions, a 3px sage focus ring, and a 1px
|
||||
downward press on active.
|
||||
|
||||
### Chips (Badges)
|
||||
- **Style:** 20px tall, 4px corners, caption type. Status badges (`ok`, `warn`,
|
||||
`danger`, `info`, `idle`) set the solid tone on its soft background.
|
||||
- **State:** the badge and the StatusDot are the only places status colour is
|
||||
decided.
|
||||
|
||||
### Cards / Containers
|
||||
- **Corner Style:** 12px.
|
||||
- **Background:** the card surface on the workspace.
|
||||
- **Edges:** a 1px border ring, without a shadow.
|
||||
- **Internal Padding:** 16px, or 12px for the small size. Section wraps a card
|
||||
with a title; an edited section shows a sage ring.
|
||||
- **Data tables:** card surface, muted header and a border, without card padding
|
||||
or a shadow.
|
||||
- **Alerts:** use the semantic soft fill and a matching border so they don't
|
||||
look like regular cards.
|
||||
|
||||
### Inputs / Fields
|
||||
- **Style:** card background, 1px input stroke, 8px corners, 36px tall, label
|
||||
size (title size on touch screens so phones do not zoom).
|
||||
- **Focus:** the border turns sage with a 3px sage ring.
|
||||
- **Error / Disabled:** a clay border and ring; disabled fields drop to 50%
|
||||
opacity.
|
||||
|
||||
### Navigation
|
||||
- **Sidebar:** card surface, label-size rows, uppercase section labels in Text
|
||||
Subtle, the hover surface on hover and active. Collapses on phones.
|
||||
- **Top bar:** card surface, 56px, strong bottom border with the rest shadow,
|
||||
breadcrumb on the left and a connection pill and account menu on the right.
|
||||
- **Selection:** the active tab uses a sage underline. Pressed toggles use a
|
||||
sage outline and a soft fill.
|
||||
|
||||
### Status Dot
|
||||
A 6px circle in one of the five status tones. It pulses (motion-safe only) while
|
||||
the thing it marks is live.
|
||||
|
||||
### Step Node (Signature Component)
|
||||
The workflow canvas card. 240px wide at rest, with an 8px corner, the rest shadow
|
||||
and a caption row naming the step type with a sage icon. The run duration sits on
|
||||
the right in mono, beside a status icon. The title below is label size and medium
|
||||
weight. Selecting it expands it in place to 416px with the float shadow and a 2px
|
||||
sage ring, main field first. The same card shows the step's live run state:
|
||||
editor and observer are one surface. Added, removed and changed steps are marked
|
||||
in the sage, clay and amber tones.
|
||||
|
||||
## Do's and Don'ts
|
||||
|
||||
### Do:
|
||||
- **Do** use semantic tokens (`bg-card`, `text-fg-muted`, `bg-ok-soft`) and the
|
||||
named type steps, so both themes and compact density work without extra code.
|
||||
- **Do** keep one filled primary button per view; everything else is ghost,
|
||||
outline or secondary.
|
||||
- **Do** set IDs, versions, durations and payloads in Plex Mono.
|
||||
- **Do** show actions on hover or focus where the work is, and make every hover
|
||||
action reachable by keyboard.
|
||||
- **Do** honour reduced motion: nothing animates when the operator asks it not to.
|
||||
|
||||
### Don't:
|
||||
- **Don't** use generic SaaS gloss: no purple or multicolour gradients, no glow
|
||||
shadows, no glassmorphism cards, no gradient text.
|
||||
- **Don't** make it toy-like on phones: no blanket 44px minimum sizes on buttons,
|
||||
links and fields. Widen the tap area invisibly with `touch-hit` instead.
|
||||
- **Don't** tint backgrounds for hierarchy; use surface steps and borders.
|
||||
- **Don't** introduce a new hue or reuse a status colour for decoration.
|
||||
- **Don't** put white text on a status fill; use the soft background and the
|
||||
solid tone.
|
||||
- **Don't** add a shadow to a resting card.
|
||||
-119
@@ -1,119 +0,0 @@
|
||||
# Product
|
||||
|
||||
<!-- impeccable:product-schema 1 -->
|
||||
|
||||
## Platform
|
||||
|
||||
web
|
||||
|
||||
## Users
|
||||
|
||||
Archie's audience comes in two stages.
|
||||
|
||||
1. **Now: the solo operator.** An infrastructure or IT operations engineer who
|
||||
runs their own estate of VMs, containers and on-prem hosts, self-hosts
|
||||
Archie, and wants day-2 operations handled without babysitting: disks filling
|
||||
up, alerts firing, routine maintenance. They use the dashboard on desktop and
|
||||
phone, and talk to Archie through chat channels.
|
||||
2. **Next: the IT operations team.** A team inside an organisation where an
|
||||
application owner (recorded in the CMDB) approves production changes on the
|
||||
servers that belong to their application. Governance, audit and risk
|
||||
controls decide whether the team adopts it.
|
||||
|
||||
## Product Purpose
|
||||
|
||||
Archie is event-driven agentic automation. It hears an event (an alert, a
|
||||
webhook, a schedule, a chat message, an issue), works out what it means, decides
|
||||
what to do, and does the work through an agent. It judges every action before
|
||||
the action runs, and delivers the result wherever it needs review or action.
|
||||
|
||||
Success: an operator connects a source and Archie notices events, acts without
|
||||
being asked when it is allowed to, and calls the operator in only when policy or
|
||||
risk requires it, with an explanation of what it found and did.
|
||||
|
||||
The loop is Hears, Understands, Decides, Defines, Does, Delivers. The platform
|
||||
around it Governs, Reports, Assesses, Manages Risk and Invokes Policy.
|
||||
|
||||
## Positioning
|
||||
|
||||
In order of importance:
|
||||
|
||||
1. **Earned, explained autonomy.** Guards (policy, risk and others, each an
|
||||
extension) score every action before it runs, and those scores set how much
|
||||
the agent may do alone. Autonomy is graded per action, earned from approval
|
||||
history, and always explained. Loosening a ceiling always needs approval from
|
||||
someone with authority; it never happens automatically.
|
||||
2. **Proposals from unhandled events.** The operator states intent rather than
|
||||
wiring steps. Events that nothing handles become proposals, and workflows
|
||||
learn from outcomes. Archie writes, runs and changes its own workflows; the
|
||||
operator can view or edit them but should not need to.
|
||||
3. **Self-hosted operations on VM and on-prem estates.** Archie runs in the
|
||||
operator's own environment and acts directly, or through the automation a
|
||||
team already has (AAP, Semaphore, ServiceNow).
|
||||
|
||||
Archie executes agentic work itself. It is not only a judgement layer, and not
|
||||
another visual workflow builder in the n8n, Zapier or Make mould.
|
||||
|
||||
## Operating Context
|
||||
|
||||
- Events arrive from monitoring (for example Alertmanager on Prometheus),
|
||||
webhooks, schedules, chat channels and forges. A forge is one source among
|
||||
many; a repository is an optional input to a workflow, never the point.
|
||||
- Results and approval requests go out as events to any channel (Telegram,
|
||||
Slack, Discord, email, webhooks, the dashboard chat composer) and come back in.
|
||||
- An approver can be an operator, a rule, a classifier or an automatic decision.
|
||||
Never assume a human approver.
|
||||
- Channels, forges, connectors, secret engines and guards ship as extensions,
|
||||
not in-tree.
|
||||
- The leading demonstration is proactive day-2 operations: a disk-filling alert
|
||||
from Prometheus, investigated and remediated, with the operator told on both a
|
||||
chat channel and the dashboard.
|
||||
|
||||
## Capabilities and Constraints
|
||||
|
||||
- One self-contained binary, `archie`, backed by PostgreSQL. Docker is never
|
||||
the only mechanism for isolation or enforcement.
|
||||
- The dashboard is a Vue single-page app embedded in the binary, used on
|
||||
desktop and phone.
|
||||
- The dashboard is the complete control plane: every configuration and mutable
|
||||
setting is editable there. A setting reachable only through a file, flag or
|
||||
API is a defect. Secrets are write-only.
|
||||
- Every request and response of every judge, guard, action, model call,
|
||||
delivery and evaluation is recorded for audit, never including credentials.
|
||||
- Terminology: source, event, workflow, run, step, guard, approval, proposal,
|
||||
connector, delivery. "Bindings" is a known-obscure name awaiting a
|
||||
replacement.
|
||||
- Undecided: the replacement for bindings and issue routing in the Decide step;
|
||||
how guard scores combine into an autonomy mode; how Deliver works without
|
||||
hard-coded outputs.
|
||||
|
||||
## Brand Commitments
|
||||
|
||||
- Name: Archie. Tagline: "Event-driven Agentic Automation".
|
||||
- Assets in `assets/brand/`: wordmark (light, dark, mono), mark, app icon,
|
||||
social card.
|
||||
- Interface copy states the problem and the action only. It never explains the
|
||||
interface, restates a title, or describes the mechanism behind it.
|
||||
- Never frame the product around coding or a repository.
|
||||
|
||||
## Evidence on Hand
|
||||
|
||||
- Live staging deployment of the single binary, with real Prometheus alerts,
|
||||
Telegram, Semaphore and host connectors.
|
||||
- No customers, testimonials, benchmarks, pricing or press exist. Do not
|
||||
fabricate any.
|
||||
|
||||
## Product Principles
|
||||
|
||||
1. **Governance is the product.** Judgement before every action, a full audit
|
||||
record, and autonomy that is earned and explained are what make Archie worth
|
||||
adopting. Keep them visible, not buried.
|
||||
2. **Intent, not wiring.** The operator says what they want; Archie defines the
|
||||
workflow. Editing is available, never required.
|
||||
3. **Editor and observer are one live surface.** Workflows are defined,
|
||||
connected and watched on the same interactive canvas, updating live as
|
||||
events and runs flow through it. Nodes show what they do.
|
||||
4. **Interrupt only when it matters.** Archie calls the operator in when policy
|
||||
or risk requires it, with what it found and what it did, not to report
|
||||
routine success.
|
||||
5. **Everything operable from the dashboard.** No setting needs a server login.
|
||||
@@ -17,8 +17,8 @@ network operations, service management, and software delivery. You define the
|
||||
process and the access it requires; agents work through its stages, using the
|
||||
context of each event to decide how to accomplish the task.
|
||||
|
||||
Archie is under active development and some capabilities below remain
|
||||
unfinished.
|
||||
Archie is under active development and not every capability below is
|
||||
finished.
|
||||
|
||||
## From an event to an outcome
|
||||
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
|
||||
One `v*` tag names a release. One version covers every process in the host
|
||||
bundle (`archied`, `archie-gateway`, `archie-state-store`, `archie-ui`,
|
||||
`archie-messaging`) and the `archie-agent` image. No release comes from a
|
||||
`archie-messaging`) and the `archie-agent` image. Nothing is released from a
|
||||
laptop.
|
||||
|
||||
## Cutting a release
|
||||
@@ -19,12 +19,12 @@ the deploy.
|
||||
The tag push runs `deploy.yml`:
|
||||
|
||||
- **Gate.** `task check dist TEST_FLAGS=-count=1` and `govulncheck`. The
|
||||
same run builds the binaries the zip ships, so it compiles nothing again
|
||||
after the gate.
|
||||
binaries the zip ships are built in the same run, so nothing is compiled
|
||||
again after the gate.
|
||||
- **Images.** `archied:v<version>` and `archie-agent:v<version>`, plus
|
||||
`sha-<commit>` tags. `:latest` moves only on promotion.
|
||||
- **The signed release.** `archied release publish` signs a statement
|
||||
(version, `issued_at`, zip digest, agent image by digest) with
|
||||
(version, issued_at, zip digest, agent image by digest) with
|
||||
`RELEASE_SIGNING_KEY` and pushes it with the distribution zip to
|
||||
`git.catlow.cloud/sam/archie` as `v<version>` and `next`. It never moves
|
||||
`stable`.
|
||||
|
||||
+27
-74
@@ -136,11 +136,7 @@ tasks:
|
||||
- go run ./cmd/archied prbench {{.CLI_ARGS}}
|
||||
|
||||
dev:
|
||||
desc: Run archie (with live reload) and Vite at http://localhost:5173
|
||||
deps: [dev:archie, dev:ui]
|
||||
|
||||
dev:legacy:
|
||||
desc: Run the legacy multi-service stack and Vite at http://localhost:5173
|
||||
desc: Run development services and Vite at http://localhost:5173
|
||||
deps: [dev:daemon, dev:gateway, dev:messaging, dev:state-store, dev:dashboard, dev:ui]
|
||||
|
||||
dev:tls:
|
||||
@@ -179,36 +175,13 @@ tasks:
|
||||
exit 1
|
||||
- |
|
||||
# docker-compose.yml creates the dev database with a superuser named
|
||||
# archie; provision the least-privilege runtime and migrator roles
|
||||
# idempotently without depending on the legacy state-store binary.
|
||||
# Single-binary archie uses its own database (archie_dev) so its goose
|
||||
# migration history does not collide with the legacy archie database.
|
||||
docker compose exec -T postgres psql -v ON_ERROR_STOP=1 -U archie -d postgres <<'SQL'
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'archie_migrator') THEN
|
||||
CREATE ROLE archie_migrator LOGIN PASSWORD 'archie';
|
||||
ELSE
|
||||
ALTER ROLE archie_migrator WITH LOGIN PASSWORD 'archie';
|
||||
END IF;
|
||||
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'archie_runtime') THEN
|
||||
CREATE ROLE archie_runtime LOGIN PASSWORD 'archie';
|
||||
ELSE
|
||||
ALTER ROLE archie_runtime WITH LOGIN PASSWORD 'archie';
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
SELECT 'CREATE DATABASE archie_dev OWNER archie_migrator'
|
||||
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'archie_dev')\gexec
|
||||
GRANT CREATE, CONNECT ON DATABASE archie TO archie_migrator;
|
||||
GRANT CONNECT ON DATABASE archie TO archie_runtime;
|
||||
GRANT CREATE, CONNECT ON DATABASE archie_dev TO archie_migrator;
|
||||
GRANT CONNECT ON DATABASE archie_dev TO archie_runtime;
|
||||
SQL
|
||||
docker compose exec -T postgres psql -v ON_ERROR_STOP=1 -U archie -d archie \
|
||||
-c "GRANT CREATE, USAGE ON SCHEMA public TO archie_migrator; GRANT USAGE ON SCHEMA public TO archie_runtime;"
|
||||
docker compose exec -T postgres psql -v ON_ERROR_STOP=1 -U archie -d archie_dev \
|
||||
-c "GRANT CREATE, USAGE ON SCHEMA public TO archie_migrator; GRANT USAGE ON SCHEMA public TO archie_runtime;"
|
||||
# archie; provision the least-privilege roles deployments/dev.toml
|
||||
# points at. Idempotent, so this also upgrades a volume created before
|
||||
# the role split.
|
||||
go run ./cmd/archie-state-store provision \
|
||||
-admin-url "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable" \
|
||||
-runtime-url "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable" \
|
||||
-migration-url "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
|
||||
dev:wait-state:
|
||||
internal: true
|
||||
@@ -222,93 +195,78 @@ tasks:
|
||||
exit 1
|
||||
|
||||
dev:daemon:
|
||||
desc: Run legacy archied
|
||||
desc: Run archied with live reload
|
||||
cmds:
|
||||
- task: dev:wait-state
|
||||
- go run ./cmd/archied -config-overlay deployments/dev.toml
|
||||
- air -build.args_bin="-config-overlay,deployments/dev.toml"
|
||||
|
||||
dev:dashboard:
|
||||
desc: Run the legacy dashboard backend
|
||||
desc: Run the dashboard backend
|
||||
cmds:
|
||||
- go run ./cmd/archie-ui -config-overlay deployments/dev.toml
|
||||
|
||||
dev:state-store:
|
||||
desc: Run the legacy State Store with development PostgreSQL
|
||||
desc: Run the State Store with development PostgreSQL
|
||||
deps: [dev:postgres, dev:tls]
|
||||
cmds:
|
||||
- go run ./cmd/archie-state-store -config-overlay deployments/dev.toml
|
||||
|
||||
dev:gateway:
|
||||
desc: Run the legacy development Gateway
|
||||
desc: Run the development Gateway
|
||||
cmds:
|
||||
- task: dev:wait-state
|
||||
- go run ./cmd/archie-gateway -config-overlay deployments/dev.toml
|
||||
|
||||
dev:messaging:
|
||||
desc: Run the legacy development Messaging Service
|
||||
desc: Run the development Messaging Service
|
||||
cmds:
|
||||
- task: dev:wait-state
|
||||
- go run ./cmd/archie-messaging -config-overlay deployments/dev.toml
|
||||
|
||||
dev:archie:
|
||||
desc: Run the single archie binary against the development PostgreSQL (admin token "dev", live reload via air if installed)
|
||||
desc: Run the single archie binary against the development PostgreSQL (admin token "dev")
|
||||
deps: [dev:postgres]
|
||||
vars:
|
||||
DIR: tmp/dev-archie
|
||||
cmds:
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p {{.DIR}}/state
|
||||
mkdir -p {{.DIR}}
|
||||
# Generated once: the age identity seals the dev credentials, so keep
|
||||
# it across runs. Roles come from dev:postgres.
|
||||
if [ ! -f {{.DIR}}/config.toml ]; then
|
||||
install -m 0600 /dev/null {{.DIR}}/config.toml
|
||||
umask 077
|
||||
{
|
||||
echo 'listen = "127.0.0.1:8484"'
|
||||
echo 'state_dir = "{{.ROOT_DIR}}/{{.DIR}}/state"'
|
||||
echo 'listen = "127.0.0.1:8080"'
|
||||
echo "admin_token_sha256 = \"$(printf dev | sha256sum | cut -d' ' -f1)\""
|
||||
echo "age_identity = \"$(go run -tags no_ui ./cmd/archie -new-age-identity)\""
|
||||
echo "age_identity = \"$(go run ./cmd/archie -new-age-identity)\""
|
||||
echo '[database]'
|
||||
echo 'url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie_dev?sslmode=disable"'
|
||||
echo 'owner_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie_dev?sslmode=disable"'
|
||||
echo 'url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable"'
|
||||
echo 'owner_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"'
|
||||
} > {{.DIR}}/config.toml
|
||||
elif ! grep -q '^state_dir' {{.DIR}}/config.toml; then
|
||||
sed -i '1i state_dir = "{{.ROOT_DIR}}/{{.DIR}}/state"' {{.DIR}}/config.toml
|
||||
fi
|
||||
- |
|
||||
if command -v air >/dev/null 2>&1; then
|
||||
exec air -build.args_bin="-config,{{.DIR}}/config.toml"
|
||||
fi
|
||||
exec go run -tags no_ui ./cmd/archie -config {{.DIR}}/config.toml
|
||||
- go run ./cmd/archie -config {{.DIR}}/config.toml
|
||||
|
||||
dev:ui:
|
||||
desc: Run Vite (proxies API requests to 127.0.0.1:8484 by default; override with ARCHIE_DEV_API)
|
||||
desc: Run Vite (requires the dashboard backend)
|
||||
dir: ui
|
||||
deps: [ui:deps]
|
||||
cmds:
|
||||
- pnpm install
|
||||
- pnpm run dev
|
||||
|
||||
e2e:smoke:
|
||||
desc: Run the single-binary smoke check against a disposable archie instance (defaults to dev:archie on 127.0.0.1:8484)
|
||||
cmds:
|
||||
- |
|
||||
ARCHIE_SMOKE_URL="${ARCHIE_SMOKE_URL:-http://127.0.0.1:8484}" \
|
||||
ARCHIE_SMOKE_TOKEN="${ARCHIE_SMOKE_TOKEN:-dev}" \
|
||||
node e2e/archie-smoke.cjs
|
||||
|
||||
e2e:up:
|
||||
desc: Start the legacy local multi-service stack without Docker (PostgreSQL 18, services, Vite) and seed it
|
||||
desc: Start the local stack without Docker (PostgreSQL 18, services, Vite) and seed it
|
||||
cmds:
|
||||
- bash e2e/stack.sh start
|
||||
- bash e2e/seed.sh
|
||||
|
||||
e2e:down:
|
||||
desc: Stop the legacy local e2e stack
|
||||
desc: Stop the local e2e stack
|
||||
cmds:
|
||||
- bash e2e/stack.sh stop
|
||||
|
||||
e2e:check:
|
||||
desc: List legacy browser checks; use -- all or -- CHECK to run, add --headed to watch
|
||||
desc: List browser checks; use -- all or -- CHECK to run, add --headed to watch
|
||||
cmds:
|
||||
- node e2e/run.cjs {{.CLI_ARGS}}
|
||||
|
||||
@@ -330,19 +288,14 @@ tasks:
|
||||
- Taskfile.yml
|
||||
- "**/*.go"
|
||||
# Files the binaries embed.
|
||||
- config.example.toml
|
||||
- "internal/**/*.sql"
|
||||
- "internal/**/*.yaml"
|
||||
- "internal/**/*.json"
|
||||
- "internal/**/*.tpl"
|
||||
- "internal/**/*.tmpl"
|
||||
- "internal/**/*.md"
|
||||
- "modules/**/*.cedar"
|
||||
- "modules/**/*.yaml"
|
||||
- go.mod
|
||||
- go.sum
|
||||
- "ui/dist/**"
|
||||
- ui/pages/pages.json
|
||||
generates:
|
||||
- "{{.BIN_DIR}}/archied"
|
||||
- "{{.BIN_DIR}}/archie-gateway"
|
||||
|
||||
+36
-35
@@ -1,15 +1,15 @@
|
||||
# Workflow definitions
|
||||
|
||||
A workflow is a YAML document: an id, what it declares to whatever starts it,
|
||||
and an ordered list of steps. Definitions live in the control plane's
|
||||
`workflow-definitions` resource, and operators edit them on the dashboard's
|
||||
Workflows page (the Canvas and YAML tabs edit the same document). The shipped
|
||||
workflows are in `internal/domain/workflow/shipped/`.
|
||||
and an ordered list of steps. Definitions are stored in the control plane's
|
||||
`workflow-definitions` resource and edited on the dashboard's Workflows page
|
||||
(the Canvas and YAML tabs edit the same document). The shipped workflows are in
|
||||
`internal/domain/workflow/shipped/`.
|
||||
|
||||
The server is the authority. It serves the step vocabulary, including each step
|
||||
type's settings schema, in the `workflow-definitions` catalogue entry
|
||||
(`x-step-types`), and validates every definition on save. This file
|
||||
describes that vocabulary; when they disagree, the catalogue wins.
|
||||
type's settings schema, in the `workflow-definitions` catalog entry
|
||||
(`x-step-types`), and validates every definition when it is saved. This file
|
||||
describes that vocabulary; when they disagree, the catalog wins.
|
||||
|
||||
```yaml
|
||||
id: implement
|
||||
@@ -41,10 +41,10 @@ steps:
|
||||
|---|---|---|
|
||||
| `id` | text | The workflow's name. Required, unique. |
|
||||
| `steps` | list | The steps, run in order. At least one. |
|
||||
| `repository` | `required` \| `optional` \| `none` | `required` (the default) clones the task's repository into a worktree. `optional` clones one when the run names a repository and uses a scratch workspace otherwise. `none` never clones; the workflow may use only steps that run without a repository. |
|
||||
| `repository` | `required` \| `optional` \| `none` | `required` (the default) clones the task's repository into a worktree. `optional` clones one when the run names a repository and uses a scratch workspace otherwise. `none` never clones; only steps that run without a repository may be used. |
|
||||
| `inputs` | mapping | Named, typed values whatever starts the run must supply: `{type, required}`, where type is `string`, `number`, `bool`, `object`, `array` or `any`. Steps read them as `{{ inputs.<name> }}`. |
|
||||
| `outputs` | mapping | Named, typed results the run writes once each (same shape as inputs). A required output the run never writes parks it. A calling workflow reads them. |
|
||||
| `profile` | text | The container profile (`[containers.profiles]`) the run's agents use. Resolution happens at dispatch. |
|
||||
| `profile` | text | The container profile (`[containers.profiles]`) the run's agents use. Resolved when the task is dispatched. |
|
||||
| `identity` | text | The identity every run acts as, whatever started it. Empty runs as the starter. |
|
||||
|
||||
## A step
|
||||
@@ -72,13 +72,13 @@ Any string setting may contain `{{ path }}`, replaced when the step runs:
|
||||
| `task.issue`, `task.pr` | Issue and pull request numbers. |
|
||||
| `task.plan` | The plan a `workflow.approve` step handed over (an approved PRD). |
|
||||
| `task.review` | The review comments a remediation round addresses. |
|
||||
| `inputs.<name>` | A declared input; the server refuses an undeclared one at save. |
|
||||
| `inputs.<name>` | A declared input; an undeclared one is refused at save. |
|
||||
| `steps.<id>.summary` | What an earlier step reported, e.g. an agent's finish summary or a gate's output. |
|
||||
| `steps.<id>.result.<field>` | A field of an earlier agent's structured result, or an output of an earlier `workflow.call` that waits. At save, the server refuses a field that the agent's `result` schema or the callee's `outputs` does not declare. |
|
||||
| `steps.<id>.result.<field>` | A field of an earlier agent's structured result, or an output of an earlier `workflow.call` that waits. A field the agent's `result` schema or the callee's `outputs` does not declare is refused at save. |
|
||||
|
||||
Reference only earlier steps; the server refuses a reference to a later or
|
||||
unknown step on save. A value that does not exist at run time (for instance, a
|
||||
step the run skipped) renders empty.
|
||||
Only earlier steps may be referenced; a reference to a later or unknown step is
|
||||
refused when the definition is saved. A value that does not exist at run time
|
||||
(for instance, a step that was skipped) renders empty.
|
||||
|
||||
### Conditions
|
||||
|
||||
@@ -112,11 +112,12 @@ A run ends at the first step that sets an outcome: `workflow.finish`,
|
||||
completes, with the last step's summary as its detail. A step that fails parks
|
||||
the run unless it continues on failure.
|
||||
|
||||
An operator can retry a parked run from a top-level step instead of from the
|
||||
start. The run skips the steps before it and keeps their results available to
|
||||
references. The step's id (else its type) names the resume point, so give an id
|
||||
to any step whose type appears twice. A run with a repository resumes only on
|
||||
its pushed branch: work an earlier step did not push is not there.
|
||||
A parked run can be retried from a top-level step instead of from the start.
|
||||
The steps before it are skipped and their results stay available to
|
||||
references. The resume point is named by the step's id (else its type), so
|
||||
give an id to any step whose type appears twice. A run with a repository
|
||||
resumes only on its pushed branch: work an earlier step did not push is not
|
||||
there.
|
||||
|
||||
## Step types
|
||||
|
||||
@@ -128,7 +129,7 @@ _runs without a repository._
|
||||
|---|---|---|
|
||||
| `extra_rules` | text | Appended to the agent system prompt. |
|
||||
| `gate` | `repository` \| `test-failure` | Hold the agent to the repository gate before it may finish; test-failure requires the tests to fail. |
|
||||
| `mission` | text | What the step asks the agent to do. May reference {{ task.* }}, {{ inputs.* }} and {{ steps.<id>.* }}. |
|
||||
| `mission` | text | What the agent is asked to do. May reference {{ task.* }}, {{ inputs.* }} and {{ steps.<id>.* }}. |
|
||||
| `protect_tests` | bool | Write-block the repository test files. |
|
||||
| `read_only` | bool | Restrict the agent to read-only tools. |
|
||||
| `result` | mapping | A JSON Schema object the agent must return; later steps read it as steps.<id>.result. |
|
||||
@@ -154,12 +155,12 @@ _needs a repository._
|
||||
| `push` | bool | Push the branch after committing. |
|
||||
| `reference` | `Fixes` \| `Implements` \| `Refs` | How the commit links to the task issue. |
|
||||
|
||||
Hooks never run. go-git creates the commit, and it ignores `.git/hooks` and
|
||||
`core.hooksPath`; the agent never runs git, so `pre-commit`, `commit-msg` and
|
||||
`prepare-commit-msg` in the checkout are inert files. A
|
||||
repository whose rules live only in a hook (a formatter, a secret scanner,
|
||||
commitlint, a DCO trailer) gets a commit that does not satisfy them. The run
|
||||
reports success, but the pull request fails the check afterwards. Put the same
|
||||
Hooks never run. The commit is created by go-git, which ignores `.git/hooks`
|
||||
and `core.hooksPath`, and the agent never runs git, so `pre-commit`,
|
||||
`commit-msg` and `prepare-commit-msg` in the checkout are inert files. A
|
||||
repository whose rules live only in a hook — a formatter, a secret scanner,
|
||||
commitlint, a DCO trailer — gets a commit that does not satisfy them: the run
|
||||
reports success and the pull request fails the check afterwards. Put the same
|
||||
commands in `command.run` or the repository gate, which both run in the task
|
||||
container before this step.
|
||||
|
||||
@@ -188,7 +189,7 @@ No settings. It runs the repository policy's `tooling` commands, in order, in
|
||||
the task worktree — the installs a gate needs and the container does not ship
|
||||
(protoc plugins, linters, generators). A repository that declares none installs
|
||||
nothing and the step succeeds. Place it after `repo.prepare` and before any
|
||||
`gate.*` step. A failing install fails the step with the command and its output,
|
||||
`gate.*` step: a failing install fails the step with the command and its output
|
||||
and says the gate did not run, so a missing toolchain is not read as a red
|
||||
repository.
|
||||
|
||||
@@ -236,7 +237,7 @@ of sending it.
|
||||
|---|---|---|
|
||||
| `channel` | text | The messaging channel to send through. |
|
||||
| `chat_id` | text | The channel's identifier for the chat. |
|
||||
| `text` | text | The message. The run fills in references. |
|
||||
| `text` | text | The message. References are filled in. |
|
||||
|
||||
A scheduled message is a schedule bound to a workflow whose only step is
|
||||
`message.send`.
|
||||
@@ -300,16 +301,16 @@ _runs without a repository._
|
||||
|
||||
| Setting | Type | Meaning |
|
||||
|---|---|---|
|
||||
| `detail` | text | Why the workflow handed off the task. |
|
||||
| `workflow` | text | The workflow the handoff requeues the task under. |
|
||||
| `detail` | text | Why the task was handed off. |
|
||||
| `workflow` | text | The workflow the task is requeued under. |
|
||||
|
||||
`command.run` commands are `{name, argv, expect_failure}`: `argv` is the
|
||||
program and its arguments, and `expect_failure` requires a non-zero exit.
|
||||
|
||||
`gate.diff-rules` rules are `{id, level, pattern, path, exclude_path, message}`:
|
||||
the step requires `level` (`error` blocks, `warn` reports) and `pattern` (an RE2
|
||||
expression the gate matches against each added line); `path` and `exclude_path`
|
||||
are RE2 expressions that limit which files the rule applies to.
|
||||
`level` (`error` blocks, `warn` reports) and `pattern` (an RE2 expression matched
|
||||
against each added line) are required; `path` and `exclude_path` are RE2
|
||||
expressions that limit which files the rule applies to.
|
||||
|
||||
## What starts a workflow
|
||||
|
||||
@@ -319,8 +320,8 @@ are RE2 expressions that limit which files the rule applies to.
|
||||
classifies it and hands off.
|
||||
- **Event bindings**: a webhook source mapped onto a workflow and its inputs
|
||||
(Events page).
|
||||
- **Schedules**: the scheduler captures each firing on the reserved `schedule`
|
||||
source as a `Schedule fired` event (`schedule_id`, `name`, `scheduled_for`,
|
||||
- **Schedules**: each firing is captured on the reserved `schedule` source as
|
||||
a `Schedule fired` event (`schedule_id`, `name`, `scheduled_for`,
|
||||
`fired_at`). A schedule trigger is a binding on that source using the
|
||||
`schedule-fired` mapping, filtered to one `schedule_id`. A firing starts at
|
||||
most one task per binding.
|
||||
|
||||
+837
-1951
File diff suppressed because it is too large.
Load diff
+15
-16
@@ -47,8 +47,8 @@ login -- see
|
||||
|
||||
3. Start the five processes. Order does not matter: a service whose peer is
|
||||
not up yet waits for it and reports it as degraded on its health surface
|
||||
meanwhile. The Gateway waits for the daemon's NATS endpoint when the daemon
|
||||
runs the embedded broker.
|
||||
meanwhile. The Gateway waits for the daemon's NATS endpoint when the broker
|
||||
is embedded.
|
||||
|
||||
```bash
|
||||
./archie-state-store -config ~/.config/archie/config.toml -listen 127.0.0.1:9090 &
|
||||
@@ -68,16 +68,16 @@ login -- see
|
||||
|
||||
## Version
|
||||
|
||||
The release pipeline builds this archive's binaries from the `archied` release
|
||||
tag in its filename. `archie-ui`, `archie-gateway`, `archie-state-store` and
|
||||
This archive's binaries are built from the `archied` release tag in its
|
||||
filename; `archie-ui`, `archie-gateway`, `archie-state-store` and
|
||||
`archie-messaging` ship at that same version rather than
|
||||
being independently tagged (see `RELEASING.md` in the source repository for why
|
||||
only `archied` and `archie-agent` are independently versioned).
|
||||
|
||||
`archie-state-store`, `archie-gateway`, `archie-messaging`, `archie-ui` and
|
||||
`archied` are services that must be running and addressable. `archie-messaging`
|
||||
`archied` are services that must be running and addressable; `archie-messaging`
|
||||
carries the Telegram, email and webhook channels since the v1.30.0 extraction, so
|
||||
an install (or an upgrade across v1.30.0) needs its unit as well. See
|
||||
an install (or an upgrade across v1.30.0) needs its unit as well -- see
|
||||
`deployments/systemd-user-service.md`.
|
||||
|
||||
### Native self-update
|
||||
@@ -86,8 +86,8 @@ Install on Settings → Status runs `archied update install -version X` against
|
||||
the release source in the update settings. It fetches release `vX`, refuses it
|
||||
unless the source's key signed its statement, and downloads the Linux/amd64 zip
|
||||
only if it hashes to the digest that statement names. Every host binary in the
|
||||
zip must report `X`. It then pulls the agent image the statement pins by digest and backs up the database to
|
||||
`db.pre-update.dump` in the state directory. It stages the new binaries beside the
|
||||
zip must report `X`. It then pulls the agent image the statement pins by digest, backs up the database to
|
||||
`db.pre-update.dump` in the state directory, stages the new binaries beside the
|
||||
live ones and hands the transaction to `archied update watchdog` in a process of
|
||||
its own (a transient systemd user unit). Nothing that runs changes until the
|
||||
watchdog takes over.
|
||||
@@ -108,10 +108,9 @@ staged executables by rename, switches the control-plane image policy (only the
|
||||
image field, with conflict detection), and restarts the units in order through
|
||||
`systemctl --user`. archied must report the new version and stay healthy for
|
||||
120 seconds. Otherwise the watchdog restores the previous binaries and image
|
||||
policy. Data is not rolled back unless the new release migrated the database.
|
||||
Then the previous binaries cannot serve it, so the watchdog restores the
|
||||
pre-update backup, and the outcome report says that the restore discarded every
|
||||
write since the update began.
|
||||
policy. Data is not rolled back unless the new release migrated the database:
|
||||
then the previous binaries cannot serve it, so the pre-update backup is restored
|
||||
and the outcome report says that every write since the update began is gone.
|
||||
Without a systemd user manager the watchdog switches binaries and image policy
|
||||
but restarts nothing, and the install reports that the services need a manual
|
||||
restart.
|
||||
@@ -119,10 +118,10 @@ restart.
|
||||
Transactions live in `${XDG_STATE_HOME:-~/.local/state}/archie/update`, outside
|
||||
the binary directory: `transaction/journal.json`, `transaction/previous/`, and
|
||||
`transaction/archied`, the frozen copy of the archied that wrote the journal. On
|
||||
daemon boot, archied hands an interrupted transaction to that frozen watchdog
|
||||
with `-recover` before normal startup. The watchdog discards a transaction that
|
||||
never started, rolls back one that was switching or observing, and finishes a
|
||||
decided one. To recover manually, run
|
||||
daemon boot, an interrupted transaction is
|
||||
handed to that frozen watchdog with `-recover` before normal startup: a
|
||||
transaction that never started is discarded, one that was switching or observing
|
||||
is rolled back, and a decided one is finished. To recover manually, run
|
||||
`transaction/archied update watchdog -recover -bin-dir ~/.local/bin` from that
|
||||
state directory. A failed recovery keeps the journal for another attempt.
|
||||
|
||||
|
||||
+14
-13
@@ -42,9 +42,9 @@ systemctl --user start archied
|
||||
|
||||
Start order does not matter: a service waits for its peers and reports them as
|
||||
degraded meanwhile. Every template needs PostgreSQL 18 at `database_url`;
|
||||
`docker compose up -d postgres` provides the default server.
|
||||
`archie-state-store provision` creates its two login roles once per database --
|
||||
see [Database roles](#database-roles).
|
||||
`docker compose up -d postgres` provides the default server. Its two login
|
||||
roles are created once per database by `archie-state-store provision` -- see
|
||||
[Database roles](#database-roles).
|
||||
|
||||
The State Store service (`archie-state-store`) owns the task data in the
|
||||
PostgreSQL database `database_url` names and serves the `StateStore` gRPC
|
||||
@@ -69,7 +69,7 @@ database and hands the schema to one of them:
|
||||
change the schema.
|
||||
|
||||
Run it once per database with a role allowed to create roles and take ownership
|
||||
of the schema (the database owner or a superuser). Then point the templates at
|
||||
of the schema (the database owner or a superuser), then point the templates at
|
||||
the two roles: `database_url` is the runtime URL and `migration_database_url`
|
||||
the migration one. The command is idempotent, so re-running it after an upgrade
|
||||
reconciles objects a migration added.
|
||||
@@ -87,7 +87,7 @@ schema and serves, which is what an install that has not split the roles does.
|
||||
|
||||
## Running the dashboard
|
||||
|
||||
The standalone UI Service (`archie-ui`) serves the dashboard, not
|
||||
The dashboard is served by the standalone UI Service (`archie-ui`), not by
|
||||
`archied`.
|
||||
It reads the same `config.toml`, dials the Gateway and State Store targets
|
||||
already configured there, and binds `[web].listen` (`127.0.0.1:8484` by
|
||||
@@ -99,16 +99,17 @@ archie-ui -config ~/.config/archie/config.toml
|
||||
|
||||
Open the dashboard to configure the organisation, workspace and first administrator account.
|
||||
Use HTTPS through a reverse proxy for remote access, and complete setup before exposing it publicly.
|
||||
`archied` runs no dashboard listener at all, so archie-ui receives webhook
|
||||
capture (`POST /webhooks/capture/{source}`) and the binding-dispatch loop in
|
||||
`archied` consumes what arrives from the shared State Store.
|
||||
`archied` runs no dashboard listener at all, so webhook capture
|
||||
(`POST /webhooks/capture/{source}`) is received by archie-ui and the
|
||||
binding-dispatch loop in `archied` consumes what arrives from the shared
|
||||
State Store.
|
||||
|
||||
The dashboard speaks plain HTTP. A non-loopback bind therefore carries the
|
||||
session cookie and the provider token in clear over the network, and
|
||||
archie-ui warns about exactly that at startup. Terminate TLS in front of it
|
||||
(a reverse proxy or the tunnel itself) and set
|
||||
`[web].trust_forwarded_headers = true` to declare the proxy and silence the
|
||||
warning. Leaving it off while exposing the port directly is the case the
|
||||
warning; leaving it off while exposing the port directly is the case the
|
||||
warning names.
|
||||
|
||||
Auth note: archie-ui authenticates to its dependencies with its `[tls]`
|
||||
@@ -149,10 +150,10 @@ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:9091/healthz #
|
||||
curl -s http://127.0.0.1:9091/health/detailed # state_db component -> 200, or 503 when degraded
|
||||
```
|
||||
|
||||
A running State Store holds the `state-store` ownership lock on its database.
|
||||
A running State Store holds the `state-store` ownership lock on its database;
|
||||
`archied` and `archie-gateway` never open the task tables directly, so a second
|
||||
store process on the same `database_url` refuses to start. A consumer that
|
||||
store process on the same `database_url` refuses to start, and a consumer that
|
||||
opens the task tables indicates dual-store ownership.
|
||||
The readiness probe is the single-writer check the runbook has against a
|
||||
degraded store: a `503` from `/health/detailed` means the operator should
|
||||
start `archied` only after the store is healthy.
|
||||
degraded store: a `503` from `/health/detailed` means `archied` should be
|
||||
started only after the store is healthy.
|
||||
@@ -31,8 +31,6 @@ services:
|
||||
- ./bin/archie:/archie/archie:ro
|
||||
- ./config.toml:/archie/config.toml:ro
|
||||
- ./extensions:/archie/extensions:ro
|
||||
- ./state:/archie/state
|
||||
- ./catalogue:/archie/catalogue:ro
|
||||
ports:
|
||||
- "${ARCHIE_BIND:?}:8080"
|
||||
networks: [internal]
|
||||
|
||||
@@ -14,7 +14,7 @@ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -C "$repo" -trimpath \
|
||||
-ldflags "-X github.com/samcharles93/archie-core/internal/buildinfo.Version=$version" \
|
||||
-o "$here/.build/archie" ./cmd/archie
|
||||
|
||||
ssh "$target" "mkdir -p $dir/bin $dir/initdb $dir/extensions $dir/catalogue $dir/state && chown 65532:65532 $dir/state"
|
||||
ssh "$target" "mkdir -p $dir/bin $dir/initdb $dir/extensions"
|
||||
scp -q "$here/compose.yml" "$target:$dir/compose.yml"
|
||||
scp -q "$here/seccomp.json" "$target:$dir/seccomp.json"
|
||||
scp -q "$here/initdb/01-roles.sh" "$target:$dir/initdb/01-roles.sh"
|
||||
@@ -51,11 +51,6 @@ if ! grep -q '^admin_token_sha256' config.toml; then
|
||||
sed -i "1i admin_token_sha256 = \"$hash\"" config.toml
|
||||
chown 65532:65532 config.toml
|
||||
fi
|
||||
# Fetched extension binaries and other state outside the database live in
|
||||
# the mounted state directory, so they survive the container being recreated.
|
||||
if ! grep -q '^state_dir' config.toml; then
|
||||
sed -i '1i state_dir = "/archie/state"' config.toml
|
||||
fi
|
||||
# The age identity seals the credentials Archie keeps. It is made here and
|
||||
# never leaves the host; back it up, or credentials die with it.
|
||||
if ! grep -q '^age_identity' config.toml; then
|
||||
|
||||
@@ -11,7 +11,7 @@ This runbook describes how to manage `archied` as a background user service on L
|
||||
with the contents it
|
||||
ships. This page describes what runs and why; the installer owns the contents,
|
||||
so inspect a unit with `systemctl --user cat <unit>` rather than copying it from
|
||||
here, where it would drift from what `install.sh` writes.
|
||||
here, where it would drift from what is written.
|
||||
|
||||
The Gateway unit is `archie-gateway.service`, written by `install.sh` beside
|
||||
`archied.service`.
|
||||
@@ -30,14 +30,14 @@ Docker bridge gateway address, and a non-loopback bind needs `[tls]` (see
|
||||
|
||||
### Messaging Service Unit (`~/.config/systemd/user/archie-messaging.service`)
|
||||
|
||||
`archie-messaging` serves the Telegram, email and webhook channels, not
|
||||
`archied`, since the v1.30.0 extraction. `archied` starts no gateway for them
|
||||
and logs nothing when one is absent. A host that updates across v1.30.0
|
||||
The Telegram, email and webhook channels are served by `archie-messaging`, not
|
||||
by `archied`, since the v1.30.0 extraction. `archied` starts no gateway for them
|
||||
and logs nothing when one is absent, so a host that updates across v1.30.0
|
||||
without this unit runs on with dead channels and a daemon that looks perfectly
|
||||
healthy. `install.sh` writes this unit on a fresh install.
|
||||
`archied update install` refuses an update when a host is missing a unit and
|
||||
names what is missing. That now fires for a host that drifted or predates this
|
||||
release rather than the normal path.
|
||||
healthy. `install.sh` writes this unit on a fresh install;
|
||||
`archied update install` refuses an
|
||||
update when a host is missing a unit and names what is missing, which now fires
|
||||
for a host that drifted or predates this release rather than the normal path.
|
||||
|
||||
It dials the Gateway for the chat contract and the State Store for the stored
|
||||
channel settings, and reads the same `config.toml`, including `[tls]`.
|
||||
@@ -48,7 +48,7 @@ each service waits for the peers it needs.
|
||||
|
||||
## 2. UI Service Unit (`~/.config/systemd/user/archie-ui.service`)
|
||||
|
||||
The standalone UI Service serves the dashboard, not `archied`. It reads the same `config.toml`, dials
|
||||
The dashboard is served by the standalone UI Service, not by `archied`. It reads the same `config.toml`, dials
|
||||
the Gateway and State Store targets already in it, and binds `[web].listen`.
|
||||
Open the dashboard to configure the organisation, workspace and first administrator account.
|
||||
Complete setup before exposing it publicly; remote access requires an HTTPS reverse proxy.
|
||||
@@ -61,10 +61,10 @@ probe (token-free by design); the authenticated readiness surface lives at
|
||||
the dashboard's health endpoint behind account authentication. A watchdog can curl
|
||||
`/healthz` without credentials.
|
||||
|
||||
`install.sh` writes `archie-ui.service`. Operators configure browser accounts through the dashboard.
|
||||
`install.sh` writes `archie-ui.service`. Browser accounts are configured through the dashboard.
|
||||
|
||||
`After=` orders the start, it does not wait for the store to bind. The UI
|
||||
process closes that gap itself. Its event pump retries priming with backoff
|
||||
process closes that gap itself: its event pump retries priming with backoff
|
||||
until the State Store answers, so the activity feed goes live once the store
|
||||
is up rather than staying history-only until the next restart.
|
||||
|
||||
@@ -129,13 +129,12 @@ systemctl --user stop archied
|
||||
|
||||
Embedded NATS is the default. The systemd service runs `archied` natively, so
|
||||
interactive chat keeps the host access the operator configured, while every
|
||||
autonomous repository workflow runs in a task-scoped Docker container. The
|
||||
deployment needs no Compose service or host `archie-agent` binary.
|
||||
autonomous repository workflow runs in a task-scoped Docker container. No
|
||||
Compose service or host `archie-agent` binary is required.
|
||||
|
||||
The operator must install Docker and make it reachable to the service user.
|
||||
`containers.image` has no default: with it unset the daemon refuses to start and
|
||||
names the key, so a fresh install learns about it at startup, not at the first
|
||||
failed pull.
|
||||
Docker must be installed and reachable by the service user. `containers.image`
|
||||
has no default: with it unset the daemon refuses to start and names the key,
|
||||
so a fresh install learns about it at startup, not at the first failed pull.
|
||||
`single-forge-github.toml` and `docker-nats-stack.toml` set a pinned
|
||||
reference; `standalone.toml` and `dev.toml` leave it for the operator to set
|
||||
-- see
|
||||
@@ -157,9 +156,9 @@ and passes the resulting endpoint to each worker. There is no port to publish
|
||||
and no broker URL to maintain.
|
||||
|
||||
The State Store is a separate process and, with a container-mode agent, must
|
||||
be reachable from the container. Bind it to the same bridge gateway with a
|
||||
be reachable from the container, so bind it to the same bridge gateway with a
|
||||
token and point `[services.state].target` at it (start
|
||||
`archie-state-store` with `-listen <bridge>:9090 -token <token>`). Without a
|
||||
`archie-state-store` with `-listen <bridge>:9090 -token <token>`); without a
|
||||
token a non-loopback bind fails closed. For a host-only agent, `127.0.0.1:9090`
|
||||
with no token is correct.
|
||||
|
||||
@@ -174,8 +173,8 @@ fall back to a host model loop.
|
||||
The release pipeline publishes
|
||||
`git.catlow.cloud/sam/archie-agent` as `:v<version>` and `:sha-<commit>` when
|
||||
the commit carries a release tag; an ordinary push to `main` publishes nothing
|
||||
for the agent image, and `:latest` moves only when the release pipeline promotes
|
||||
a release. A distribution zip pins the image its own release
|
||||
for the agent image, and `:latest` moves only when a release is promoted. A
|
||||
distribution zip pins the image its own release
|
||||
published, by digest, in `release.json`, and `archied update install` pulls
|
||||
exactly that.
|
||||
|
||||
@@ -205,9 +204,8 @@ personal access token that can read the package as the password --
|
||||
`{"username":"<user>","password":"<token>"}`. Put it in
|
||||
`~/.config/archie/env` as `ARCHIE_REGISTRY_AUTH` so it stays out of
|
||||
`config.toml`. The field is file-owned and settled at boot, so a change takes
|
||||
effect on restart. When the daemon cannot read a value, it logs a warning
|
||||
and pulls anonymously, which is the failure the task reports as a capability
|
||||
error.
|
||||
effect on restart; a value that cannot be read logs a warning and pulls
|
||||
anonymously, which is the failure the task reports as a capability error.
|
||||
|
||||
The bundled update adapter snapshots the configured `[containers].image` before
|
||||
rebuilding it and restores that image if the restarted daemon fails its health
|
||||
@@ -237,7 +235,7 @@ network = "archie-core_default"
|
||||
|
||||
The broker defers every login to archied (NATS auth callout), so a worker logs
|
||||
in with its run credential and reaches only its own task's subjects. Generate
|
||||
an account nKey (`nk -gen account -pubout`), export its seed as
|
||||
an account nkey (`nk -gen account -pubout`), export its seed as
|
||||
`NATS_CALLOUT_SEED` for archied and its public key as `NATS_CALLOUT_ISSUER` for
|
||||
Compose, and set `NATS_TOKEN` to the same value in both.
|
||||
|
||||
|
||||
+2
-3
@@ -44,7 +44,6 @@ services:
|
||||
|
||||
# ── NATS JetStream ────────────────────────────────────────────────
|
||||
nats:
|
||||
profiles: ["nats"]
|
||||
image: nats:2.14-alpine3.22
|
||||
# The client port is published on every interface (agent containers reach
|
||||
# it over the bridge), so it defers every login to archied. Set NATS_TOKEN
|
||||
@@ -52,8 +51,8 @@ services:
|
||||
# the account nkey seed named in [nats] callout_issuer_seed_env.
|
||||
command: ["-c", "/etc/nats/nats.conf"]
|
||||
environment:
|
||||
- NATS_TOKEN
|
||||
- NATS_CALLOUT_ISSUER
|
||||
NATS_TOKEN: ${NATS_TOKEN:?NATS_TOKEN is required}
|
||||
NATS_CALLOUT_ISSUER: ${NATS_CALLOUT_ISSUER:?NATS_CALLOUT_ISSUER is required}
|
||||
ports:
|
||||
- "4222:4222" # client
|
||||
- "127.0.0.1:8222:8222" # monitoring (http://localhost:8222)
|
||||
|
||||
@@ -24,9 +24,9 @@ Archie Core uses the GitHub API to:
|
||||
|
||||
## Step-by-Step Instructions: Creating a Classic Token
|
||||
|
||||
1. Go to
|
||||
1. Navigate to
|
||||
[GitHub Settings → Developer Settings → Tokens (classic)](https://github.com/settings/tokens).
|
||||
2. Select **Generate new token** → **Generate new token (classic)**.
|
||||
2. Click **Generate new token** → **Generate new token (classic)**.
|
||||
3. Set the **Note**: `Archie Core` (or your bot's name).
|
||||
4. Choose an **Expiration** (e.g. 90 days, 1 year, or No expiration for
|
||||
dedicated bot accounts).
|
||||
@@ -35,9 +35,9 @@ Archie Core uses the GitHub API to:
|
||||
commenting, pushing branches, and opening PRs).
|
||||
- **`workflow`** (Optional — required if Archie needs to update GitHub
|
||||
Actions workflows).
|
||||
6. Scroll to the bottom and select **Generate token**.
|
||||
6. Scroll to the bottom and click **Generate token**.
|
||||
7. **Copy your token immediately** (starts with `ghp_...`). You won't be able to
|
||||
see it again.
|
||||
see it again!
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# Building your first playbook binding
|
||||
|
||||
This walks through the whole no-code path the event-capture epic promises. Point
|
||||
an external app's webhook at archie and see the real payload it sends. Map the
|
||||
This walks through the whole no-code path the event-capture epic promises: point
|
||||
an external app's webhook at archie, see the real payload it sends, map the
|
||||
fields you care about, bind them to a workflow, and watch the next matching
|
||||
event turn into a task. No code, no redeploy, no restart.
|
||||
event turn into a task -- no code, no redeploy, no restart.
|
||||
|
||||
## 1. Create a source and send a test event
|
||||
|
||||
Open **Events → Inspector** and select **New source**. Archie shows the source's
|
||||
Open **Events → Inspector** and click **New source**. Archie shows the source's
|
||||
URL and signing secret once; copy both. Point the external app's webhook at that
|
||||
URL. Send one real event however is easiest for a first test, e.g.:
|
||||
|
||||
@@ -30,8 +30,8 @@ actual payload from the actual sender, not guessing at a schema in advance.
|
||||
## 3. Map the fields you care about
|
||||
|
||||
Open **Field mappings** (`/mappings`) → **New mapping**. Pick your captured
|
||||
event from the dropdown, then select items in its payload tree on the right.
|
||||
Every key and value is selectable, and selecting one binds it as a field (name,
|
||||
event from the dropdown, then click through its payload tree on the right --
|
||||
every key and value is clickable. Clicking a value binds it as a field (name,
|
||||
JSON path, and an inferred type you can change). Add whichever fields your
|
||||
workflow needs (e.g. the issue title), mark the ones that must be present as
|
||||
**Required**, hit **Preview** to confirm they resolve correctly against the real
|
||||
@@ -56,9 +56,9 @@ Save. The binding starts in **draft** -- nothing fires yet.
|
||||
## 5. Approve it
|
||||
|
||||
A **draft** or freshly-**edited** binding needs explicit approval before it can
|
||||
ever match a live event. This is deliberate, not a missing step: an operator
|
||||
ever match a live event -- this is deliberate, not a missing step: an operator
|
||||
authoring a binding is a considered act, an event arriving is not, and nothing
|
||||
should self-arm. Select **Approve**. Status becomes **armed**.
|
||||
should self-arm. Click **Approve**. Status becomes **armed**.
|
||||
|
||||
## 6. Fire it for real
|
||||
|
||||
@@ -76,15 +76,14 @@ curl -X POST http://localhost:8484/webhooks/capture/sentry \
|
||||
-d "$BODY"
|
||||
```
|
||||
|
||||
Archie captures this event as **authenticated**, matches it against your armed
|
||||
binding, and dispatches it into a new task through the exact same
|
||||
gate/worktree/sandbox pipeline every other task goes through. Check the
|
||||
**Tasks** page; a new task should appear, its body built from the fields your
|
||||
mapping resolved.
|
||||
This event is captured as **authenticated**, matched against your armed binding,
|
||||
and dispatched into a new task through the exact same gate/worktree/sandbox
|
||||
pipeline every other task goes through. Check the **Tasks** page; a new task
|
||||
should appear, its body built from the fields your mapping resolved.
|
||||
|
||||
## Editing a live binding
|
||||
|
||||
Any edit to an armed binding, even a typo fix, drops it back to
|
||||
**`pending_approval`** automatically. You can't bypass this by editing; you have
|
||||
to re-approve it. When editing, leave **Shared secret** blank to keep
|
||||
Any edit to an armed binding -- even a typo fix -- drops it back to
|
||||
**pending_approval** automatically. This can't be bypassed by editing; it has to
|
||||
be re-approved. When editing, leave the **Shared secret** field blank to keep
|
||||
the existing secret; only fill it in if you're deliberately rotating it.
|
||||
@@ -1,26 +1,24 @@
|
||||
# Self-development loop: archie develops its own codebase
|
||||
|
||||
**Status:** Decided, not yet built (2026-11-03, sam) **Scope:** how archie
|
||||
keeps developing archie-core itself. This file records a
|
||||
desired state, not an implementation or a product. Nothing below exists unless
|
||||
the "Built today" section says so. Epic #1769 tracks the plan, with child
|
||||
persistently takes on development of archie-core itself. This file records a
|
||||
desired state, not an implementation or a product: nothing below exists unless
|
||||
the "Built today" section says so. The plan is tracked as epic #1769 with child
|
||||
issues #1770–#1775. This file is a record, not a mechanism: agents only see what
|
||||
is in their context, so verify every claim here against the code before acting
|
||||
on it. Where they disagree, the code wins. The boundary below is load-bearing
|
||||
only where the code enforces it (the gate, access control, the daemon's git
|
||||
monopoly) and only where `AGENTS.md` states it. Everywhere else this file is a
|
||||
pointer.
|
||||
on it — where they disagree, the code wins. The boundary below is load-bearing
|
||||
only where it is enforced (the gate, access control, the daemon's git monopoly)
|
||||
and stated in `AGENTS.md`; everywhere else this file is a pointer.
|
||||
|
||||
## Built today
|
||||
|
||||
The machinery the loop will reuse exists. It includes the shipped
|
||||
triage/implement/pr-review workflows and the adversarial self-review stage before
|
||||
a PR opens (epic #1348, closed). It also includes the prbench judge for review
|
||||
quality with its acceptance bar, canary releases judged on the installed release
|
||||
(releaseupdate), and the curator engine. What does not exist is the loop itself:
|
||||
no self-intake curator, no automatic run for approved issues, no judge for
|
||||
diffs, no outcome distillation, no canary routing specific to self-directed
|
||||
changes.
|
||||
The machinery the loop will reuse exists: shipped triage/implement/pr-review
|
||||
workflows, the adversarial self-review stage before a PR opens (epic #1348,
|
||||
closed), the prbench judge for review quality with its acceptance bar, canary
|
||||
releases judged on the installed release (releaseupdate), and the curator
|
||||
engine. What does not exist is the loop itself: no self-intake curator, no
|
||||
approved-issue auto-run, no judge for diffs, no outcome distillation, no canary
|
||||
routing specific to self-directed changes.
|
||||
|
||||
## Decision
|
||||
|
||||
@@ -30,42 +28,41 @@ Archie improves its own codebase through a closed loop, built in stages:
|
||||
gate failures and alerts, dedupes against open issues, and files new issues.
|
||||
Archie files its own work; the maintainer approves priority.
|
||||
2. **Approved-issue loop** (#1771): an approved issue runs the shipped
|
||||
triage/implement workflows end to end. The workflow makes a read-only plan
|
||||
and a gated build, then runs the adversarial self-review; the daemon commits
|
||||
and opens a green PR. The maintainer still merges at this stage.
|
||||
triage/implement workflows end to end — read-only plan, gated build,
|
||||
adversarial self-review, daemon commits and opens a green PR. The maintainer
|
||||
still merges at this stage.
|
||||
3. **Implementation judge** (#1772): the prbench judge pattern scores diffs,
|
||||
calibrated against the maintainer's merge decisions. Automatic merge applies
|
||||
only when the gate is green, the review stage is clean, and the judge is above
|
||||
the calibrated bar.
|
||||
calibrated against the maintainer's merge decisions; auto-merge applies only
|
||||
when the gate is green, the review stage is clean, and the judge is above the
|
||||
calibrated bar.
|
||||
4. **Outcome distillation** (#1773): a curator turns merged-run postmortems into
|
||||
proposals for the repo's agent instructions. The maintainer adds each
|
||||
proposal only because it changes a decision, and removes rules that stop
|
||||
changing decisions.
|
||||
proposals for the repo's agent instructions, each added only because it
|
||||
changes a decision; rules that stop changing decisions are removed.
|
||||
5. **Canary** (#1774): self-directed changes ship through the canary release
|
||||
window, and the canary verdict on the installed release gates their
|
||||
promotion. Rollback is a plain revert, because every self-directed change is
|
||||
one gated commit.
|
||||
window and are judged on the installed release before promotion. Rollback is
|
||||
a plain revert, because every self-directed change is one gated commit.
|
||||
|
||||
## Boundary
|
||||
|
||||
Enforcement lives in the code, never in the prompt (#1775). Archie may propose
|
||||
changes to the commit gate, the invariants in `AGENTS.md`, access control and
|
||||
grant scoping, the daemon-only git path, and webhook HMAC verification. It never
|
||||
merges them; those changes require a maintainer merge. Everything else
|
||||
(workflows, curators, memory, docs, the dashboard) is fair game for the loop.
|
||||
Enforcement lives in the harness, never in the prompt (#1775). Changes to the
|
||||
commit gate, the invariants in `AGENTS.md`, access control and grant scoping,
|
||||
the daemon-only git path, and webhook HMAC verification may be proposed by
|
||||
archie but are never merged by archie — they require a maintainer merge.
|
||||
Everything else (workflows, curators, memory, docs, the dashboard) is fair game
|
||||
for the loop.
|
||||
|
||||
## Why
|
||||
|
||||
Self-improvement degrades when it relies on the model choosing to follow rules.
|
||||
The model can argue with a prompt, not with gates, scoped grants or the daemon's
|
||||
monopoly on git. Keeping quality measurable is what lets the loop widen without
|
||||
turning the codebase to garbage: a judge bar and a canary verdict as numbers,
|
||||
and tests guarding the protected seams.
|
||||
Gates, scoped grants and the daemon's monopoly on git cannot be argued with; a
|
||||
prompt can. Keeping quality measurable — a judge bar and a canary verdict as
|
||||
numbers, tests guarding the protected seams — is what lets the loop widen
|
||||
without turning the codebase to garbage.
|
||||
|
||||
## Consequences
|
||||
|
||||
- One issue to one small PR applies doubly to self-directed work. Past about 100
|
||||
- One issue → one small PR applies doubly to self-directed work: past about 100
|
||||
lines or any new mechanism, the change stops and reassesses.
|
||||
- Every self-directed commit cites the issue that authorised it.
|
||||
- Every self-directed commit cites the issue that authorized it.
|
||||
- Rule proposals from the distillation curator must name the run that triggered
|
||||
them, and `AGENTS.md` stays short enough to read in full every session.
|
||||
@@ -1,31 +1,31 @@
|
||||
# User authorisation boundaries
|
||||
# User authorization boundaries
|
||||
|
||||
Archie separates authentication (which person or service is calling) from
|
||||
permission to act on a resource. This inventory follows the
|
||||
[OWASP Authentication Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html)
|
||||
and
|
||||
[Authorization Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html).
|
||||
It includes the guidance on attributes and relationships from the Authorization
|
||||
Cheat Sheet. It describes concrete enforcement points and their regression
|
||||
tests. It is not a compliance certification.
|
||||
[Authorization Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html),
|
||||
including its guidance on attributes and relationships. It describes concrete
|
||||
enforcement points and their regression tests; it is not a compliance
|
||||
certification.
|
||||
|
||||
## Transport and authority
|
||||
|
||||
The browser uses HTTP/JSON and SSE to the UI service. The UI service calls State
|
||||
Store, Gateway, Messaging and the daemon through their gRPC contracts. Only the
|
||||
State Store opens the task/control-plane/account database. Gateway owns
|
||||
State Store opens the task/control-plane/account database; Gateway owns
|
||||
conversation storage. Browser HTTP handlers never open either database.
|
||||
|
||||
Instance service credentials are administrative authority. They are not user
|
||||
sessions and must never reach a browser, model, or agent container. A service
|
||||
forwarding a principal preserves attribution and tenant scope. Forwarding alone
|
||||
forwarding a principal preserves attribution and tenant scope; forwarding alone
|
||||
does not mean every internal RPC evaluates Cedar. Most internal RPCs trust the
|
||||
authenticated service and enforce their own resource scope. The public HTTP
|
||||
boundary evaluates Cedar before invoking them. Task credentials have a separate,
|
||||
explicit RPC allowlist and cannot call account or identity administration.
|
||||
|
||||
The services treat local service listeners as trusted process boundaries.
|
||||
Loopback does not replace authentication on a remotely reachable listener. OIDC
|
||||
Local service listeners are trusted process boundaries. Loopback is not a
|
||||
substitute for authentication on a remotely reachable listener. OIDC
|
||||
credentials, local browser sessions, personal API tokens, service credentials,
|
||||
and task grants must remain distinct.
|
||||
|
||||
@@ -33,52 +33,52 @@ and task grants must remain distinct.
|
||||
|
||||
`internal/domain/access` defines actions, resources, principals and memberships.
|
||||
`internal/infrastructure/access` assembles Cedar entities and evaluates the
|
||||
instance → organisation → workspace → object chain. A forbid wins. Each
|
||||
instance → organization → workspace → object chain. A forbid wins; each
|
||||
applicable level must permit the operation. Missing or invalid policy chains
|
||||
fail closed.
|
||||
|
||||
The default policies grant actions through scoped roles. Policies can also
|
||||
restrict a named identity, workspace environment, owner, state, source address,
|
||||
signature, run or step. HTTP task decisions now include the stored initiating
|
||||
identity and task state. Binding decisions include the stored binding state. The
|
||||
identity and task state; binding decisions include the stored binding state. The
|
||||
HTTP source address is the actual connection peer, not an unverified forwarded
|
||||
header. Membership and resource attributes must come from stored records or
|
||||
authenticated context. They never come from a request's assertion about itself.
|
||||
authenticated context, never a request's assertion about itself.
|
||||
|
||||
Cedar permission is not ownership of another person's private data. The services
|
||||
bind conversation history, passkeys, recovery codes and personal tokens to the
|
||||
person. An organisation or instance admin role does not override those
|
||||
relationships. Account creation uses `manage_members` policy rather than a fixed
|
||||
admin role. An OIDC login does not automatically grant membership, link
|
||||
Cedar permission is not ownership of another person's private data. Conversation
|
||||
history, passkeys, recovery codes and personal tokens are bound to the person.
|
||||
An organization or instance admin role does not override those relationships.
|
||||
Account creation uses `manage_members` policy rather than a hard-coded admin
|
||||
role. Authenticating through OIDC does not automatically grant membership, link
|
||||
accounts by unverified email, or create an administrator.
|
||||
|
||||
## Enforcement inventory
|
||||
|
||||
| Location | Enforcement | Regression evidence |
|
||||
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Browser credential gate: `webui/auth.go`, `accounts.go` | Account session or verified provider identity; shared dashboard token is not a person once setup creates an account. No API data before authentication. | `TestAccountBoundary`, `TestAccountSessionFailureIsClosed` |
|
||||
| Browser credential gate: `webui/auth.go`, `accounts.go` | Account session or verified provider identity; shared dashboard token is not a person when accounts are enabled. No API data before authentication. | `TestAccountBoundary`, `TestAccountSessionFailureIsClosed` |
|
||||
| Browser policy gate: `webui/authorize.go` | Resolve principal from stored identity; evaluate action against stored org/workspace and resource kind before handler. Missing chain refuses. | `TestHTTPPolicyCannotBeBypassed`, `TestAuthorizeRefusesWithoutAChain`, `TestAuthorizeRecord`, `TestTaskAuthorizationUsesStoredAttributes`, `TestAuthorizeCreateIn` |
|
||||
| Instance-only HTTP surfaces: `webui/instance_only.go`, server route registration | Hide instance-owned configuration and diagnostics from another org; policy still applies first. | `TestInstanceOnlyHidesTheInstanceFromOtherOrgs`, `TestInstanceAdminOrgs` |
|
||||
| First setup: `webui/accounts.go`, `postgres/accounts.go` | Initial organisation, workspace, instance URL, admin identity and password commit together. Transaction lock closes bootstrap after first account; later requests require `manage_members`. | Disposable PostgreSQL smoke verification for bootstrap race and rollback; account policy tests below |
|
||||
| Account creation: `webui/accounts.go`, `staterpc/accounts.go`, `postgres/accounts.go` | Cedar `manage_members` at HTTP and RPC; derive the target org from the authenticated context. New local accounts cannot request owner role. | `TestAccountManagementUsesPolicy`, `TestAccountBoundary` |
|
||||
| First setup: `webui/accounts.go`, `postgres/accounts.go` | Initial organization, workspace, instance URL, admin identity and password commit together. Transaction lock closes bootstrap after first account; later requests require `manage_members`. | Disposable PostgreSQL smoke verification for bootstrap race and rollback; account policy tests below |
|
||||
| Account creation: `webui/accounts.go`, `staterpc/accounts.go`, `postgres/accounts.go` | Cedar `manage_members` at HTTP and RPC; target org is authenticated context. New local accounts cannot request owner role. | `TestAccountManagementUsesPolicy`, `TestAccountBoundary` |
|
||||
| Local passwords and sessions: `identity/password.go`, `postgres/accounts.go` | Argon2id, independent salts, length/common-password checks, generic login refusal, account throttling, session hashes and expiry, revocation on logout/password change/suspension. | `TestPasswordVerification`, `TestAccountBoundary`; disposable PostgreSQL session verification |
|
||||
| Transport and CSRF: `webui/accounts.go`, `api_tasks.go` | Password/account mutations require HTTPS or localhost development, JSON, custom CSRF header and same-origin requests. Forwarded headers require explicit trusted-proxy configuration. | `TestAuthenticationTransport`, existing mutation security tests |
|
||||
| Personal account routes: `webui/accounts.go` | Active signed-in person; principal supplied by server. Password change verifies current password. Sensitive authenticator changes require recent sign-in. No caller-supplied target identity. | `TestAccountBoundary` |
|
||||
| Recovery: `postgres/account_security.go`, `webui/accounts.go` | Fresh authenticated owner generates a hashed, one-use recovery secret. Redemption replaces password and revokes all sessions atomically. No email-existence disclosure. | Disposable PostgreSQL recovery verification |
|
||||
| Passkeys: `postgres/passkeys.go`, `webui/passkeys.go` | Configured RP origin, browser-bound one-use expiring challenge, verified credential signature and user verification. Enrollment/management belong to caller. Credential counters persist under a row lock. | Disposable browser virtual-authenticator verification; task-grant denial tests |
|
||||
| OIDC: `infrastructure/oidc`, `archieui/account_oidc.go`, `webui/auth.go` | Discovery and signed ID token with issuer/client audience/expiry, PKCE, state and nonce. Verified subject resolves to active identity. Browser-local session cannot outlive provider token, and provider credential remains checked. | `TestBrowserFlowVerifiesIDToken`, `TestProviderOutageIsUnavailableThenRecovers`, subject-claim tests; no external provider acceptance implied |
|
||||
| OIDC settings: `webui/accounts.go`, `postgres/authentication.go` | Instance ownership plus policy; recent sign-in for changes. The instance refuses a public URL change that would orphan enrolled passkeys. | `TestAccountBoundary`, `TestAuthenticationSettingsRejectUntrustedOrigins` |
|
||||
| OIDC settings: `webui/accounts.go`, `postgres/authentication.go` | Instance ownership plus policy; recent sign-in for changes. Public URL cannot change while enrolled passkeys would be orphaned. | `TestAccountBoundary`, `TestAuthenticationSettingsRejectUntrustedOrigins` |
|
||||
| Org membership/workspaces/agent assignment: `webui/api_orgs.go`, `staterpc/orgs.go`, `postgres/orgs.go` | Own org or instance-owner relationship, allowed role vocabulary, membership escalation/last-owner guards, tenant-scoped SQL. | `TestOrgRPCsActInTheCallersOrg`, `TestSetMembershipRefusesUnknownRole`, org HTTP tests |
|
||||
| Personal API tokens: `webui/api_personal_tokens.go`, `staterpc/personal_tokens.go`, `postgres/personal_tokens.go` | Token owner comes from principal; store only token hash; revoke only caller's binding. | `TestPersonalTokensWithoutPerson`, `TestPersonalTokenOwner` |
|
||||
| gRPC caller attribution: `rpcidentity/identity.go` | Authenticated service may forward a principal; State Store resolves memberships/org itself. State Store strips task grant metadata. | `TestCallerAttribution` |
|
||||
| gRPC caller attribution: `rpcidentity/identity.go` | Authenticated service may forward a principal; State Store resolves memberships/org itself. Task grant metadata is stripped. | `TestCallerAttribution` |
|
||||
| Agent/task gRPC: `staterpc/task_grants.go` | Durable task-scoped grant, explicit allowed RPC and target task, no definition-pin replacement, no account RPCs. | `TestTaskCredentialsCannotManageAccounts`, `TestTaskCredentialCannotReplaceItsPin`, `TestRecordUsageAuthority`, `TestWorkerPresenceAuthority` |
|
||||
| Chat HTTP: `webui/api_chat.go` | Server stamps sender and person thread; lists/read/turns/cancel/persona verify session ownership. Browser cannot submit another sender identity. | `TestWebChatOwnership`, `TestWebChatSenderCannotBeSuppliedByBrowser`; HTTP deny matrix |
|
||||
| Chat history, slash commands and model session tools: `gateway/session_store_postgres.go` | Store filters `Get`, `List`, `GetByChannel`; shared read/write guards check person ownership as well as org. A saved session cannot change its conversation source to claim another person's history. Service curation runs without a person principal. | `TestSessionVisibility`; PostgreSQL smoke for history isolation |
|
||||
| Chat questions/approvals: `webui/api_chat_ask.go` | The UI service binds the waiting question to the initiating person, in addition to its unguessable ID. | `TestChatQuestionBelongsToInitiatingPerson` |
|
||||
| Chat downloads: `webui/api_chat_files.go` | The UI service binds the offered file token to the initiating person, and the token expires; requests cannot supply a filesystem path. | `TestChatFileDownload` |
|
||||
| Chat questions/approvals: `webui/api_chat_ask.go` | Waiting question is bound to the initiating person, in addition to its unguessable ID. | `TestChatQuestionBelongsToInitiatingPerson` |
|
||||
| Chat downloads: `webui/api_chat_files.go` | Offered file token expires and is bound to the initiating person; requests cannot supply a filesystem path. | `TestChatFileDownload` |
|
||||
| Per-person memory: `archiegateway/chat_identity.go`, gateway memory tools, `sessioncurator` | Verified web sender identity scopes reads/writes. Curator refuses unidentified or mixed participants instead of guessing a person. | Gateway memory and session-curator tests |
|
||||
| Workflow/task actions: `webui/api_tasks.go`, `domain/taskactions`, `staterpc` | Policy and stored workspace before action; domain transition, authority and durable dispatch guards remain in force. | HTTP deny matrix, task action/domain tests, task grant tests |
|
||||
| Incoming webhooks: `captureintake`, access delivery engine | Verify HMAC before parsing; derive source/org from stored source; evaluate source delivery policies and egress rules. The capture intake never infers a browser-user credential. | Capture tests, `TestAuthorizeDelivery` |
|
||||
| Incoming webhooks: `captureintake`, access delivery engine | Verify HMAC before parsing; derive source/org from stored source; evaluate source delivery policies and egress rules. No browser-user credential is inferred. | Capture tests, `TestAuthorizeDelivery` |
|
||||
| Control-plane configuration, secrets and extensions | Browser policy and instance-only restrictions where registered; service contracts carry principal/org; task grants cannot invoke administrative RPCs. | HTTP deny matrix, `TestAdministrationRoutes`, `TestChannelReloadRoute` |
|
||||
| Audit feed: `webui/api_audit.go`, `domain/audit` | `read_audit` on the `audit` resource; org scope and the instance-wide exception come from the authenticated principal, never the query string. Export carries the same grant, needs an explicit range of at most a year, and is rate-limited per identity, one at a time. Redaction runs in the State Store adapter before an entry crosses gRPC. | `TestReadAuditRoleBoundary`, `TestAuditRoutesFollowTheReadAuditRole`, `TestHTTPPolicyCannotBeBypassed`, `TestAuditErrorMapping`, `TestAuditCSVCellNeutralisesFormulas` |
|
||||
| Live HTTP/SSE and diagnostics | Authenticated policy gate applies before stream creation; org-scoped event reads; instance logs require administrative visibility. | HTTP deny matrix, instance-only tests, `TestServiceLogsRequireInstanceCredential` |
|
||||
@@ -86,31 +86,29 @@ accounts by unverified email, or create an administrator.
|
||||
|
||||
The policy HTTP matrix enumerates each registered protected route. It checks
|
||||
both anonymous refusal and refusal by an explicit Cedar forbid, using the real
|
||||
handler stack. Separate tests exercise allowed requests and personal ownership.
|
||||
A denied-request matrix alone is not proof that a workflow works end to end.
|
||||
handler stack. Separate tests exercise allowed requests and personal ownership;
|
||||
a denied-request matrix alone is not proof that a workflow works end to end.
|
||||
|
||||
## Public and personal routes
|
||||
|
||||
Public protocol entry points are `GET /api/auth/status`, `POST /api/auth/setup`,
|
||||
`POST /api/auth/login`, `POST /api/auth/logout`, `POST /api/auth/recover`,
|
||||
`POST /api/auth/passkey/begin` and `POST /api/auth/passkey/finish`. The
|
||||
remaining entry points are `GET /oauth2/login`, `GET /oauth2/callback`, health
|
||||
probes and signed webhook intake. Each has its own protocol checks. Static
|
||||
embedded app assets are public. They do not contain user data.
|
||||
`/health/detailed` remains protected.
|
||||
`POST /api/auth/passkey/begin`, `POST /api/auth/passkey/finish`,
|
||||
`GET /oauth2/login`, `GET /oauth2/callback`, health probes and signed webhook
|
||||
intake. Each has its own protocol checks. Static embedded app assets are public;
|
||||
they do not contain user data. `/health/detailed` remains protected.
|
||||
|
||||
Personal routes under `/api/account/` require an active signed-in person and
|
||||
server-derived ownership. They cover password change, recovery-secret
|
||||
generation, and passkey begin/finish/list/delete. They do not require an
|
||||
organisation administrator role. `POST /api/accounts` and `/api/authentication`
|
||||
are administrative policy routes.
|
||||
server-derived ownership: password change, recovery-secret generation, passkey
|
||||
begin/finish/list/delete. They do not require an organization administrator
|
||||
role. `POST /api/accounts` and `/api/authentication` are administrative policy
|
||||
routes.
|
||||
|
||||
## HTTP route inventory
|
||||
|
||||
The test `TestHTTPPolicyCannotBeBypassed` covers the following routes. It lives
|
||||
in `internal/webui/authorization_surfaces_test.go`. `authorize.go` maps each to
|
||||
its action/resource. The handler may impose a stricter record or instance
|
||||
boundary.
|
||||
The following routes are covered by `TestHTTPPolicyCannotBeBypassed` in
|
||||
`internal/webui/authorization_surfaces_test.go`. `authorize.go` maps each to its
|
||||
action/resource; the handler may impose a stricter record or instance boundary.
|
||||
|
||||
| Method | Route example |
|
||||
| ------ | ----------------------------------------------------- |
|
||||
@@ -228,23 +226,21 @@ boundary.
|
||||
|
||||
## Verification limits
|
||||
|
||||
A synthetic browser authenticator checks protocol behaviour. It does not test a
|
||||
physical security key or every operating system. An OIDC unit test is not
|
||||
acceptance against a deployed provider. Disposable PostgreSQL smoke checks
|
||||
verify real SQL. They keep database tests out of the fast unit suite.
|
||||
A synthetic browser authenticator verifies protocol behavior, not a physical
|
||||
security key or every operating system. An OIDC unit test is not acceptance
|
||||
against a deployed provider. Disposable PostgreSQL smoke checks verify real SQL
|
||||
without putting database-dependent tests in the fast unit suite.
|
||||
|
||||
The Gateway retains existing anonymous conversations but does not silently
|
||||
assign them to a new person. Existing service credentials remain privileged.
|
||||
This inventory does not claim that all internal gRPC methods have independent
|
||||
Cedar gates.
|
||||
Existing anonymous conversations are retained but are not silently assigned to a
|
||||
new person. Existing service credentials remain privileged; this inventory does
|
||||
not claim that all internal gRPC methods have independent Cedar gates.
|
||||
|
||||
When changing a user-facing operation, update its inventory entry and its
|
||||
allow/deny behaviour cases. Include another user in the same organisation, a
|
||||
caller in another organisation, a missing principal, unavailable policy storage,
|
||||
allow/deny behavior cases. Include another user in the same organization, a
|
||||
caller in another organization, a missing principal, unavailable policy storage,
|
||||
and the applicable owner/workspace/instance restrictions.
|
||||
|
||||
Bootstrap runs without authentication until the operator creates the first
|
||||
administrator account. Complete setup before exposing a new installation to
|
||||
untrusted users. A separate issue, `archie-core-d7avc`, tracks
|
||||
last-active-owner protection for identity suspension/retirement.
|
||||
Membership-policy guards are not that lifecycle guard.
|
||||
Bootstrap is unauthenticated until the first administrator is created. Complete
|
||||
setup before exposing a new installation to untrusted users. Last-active-owner
|
||||
protection for identity suspension/retirement is tracked separately as
|
||||
`archie-core-d7avc`; membership-policy guards are not that lifecycle guard.
|
||||
+20
-20
@@ -45,7 +45,7 @@ and `ARCHIE_E2E_PASSWORD` for both seeding and browser checks. Seeding never
|
||||
resets an existing account or deletes test data.
|
||||
|
||||
The first run needs `pnpm install --dir e2e` and `pnpm --dir e2e exec playwright
|
||||
install chromium`. The cloud environment ships Chromium and Playwright
|
||||
install chromium`. In the cloud environment, Chromium and Playwright are
|
||||
preinstalled; run with `NODE_PATH=$(pnpm root -g)`.
|
||||
|
||||
## Single-binary smoke check
|
||||
@@ -62,8 +62,8 @@ node e2e/archie-smoke.cjs
|
||||
|
||||
The check saves a workflow and a one-minute schedule, then verifies that its
|
||||
run links back to the schedule event and appears in the composer. It disables
|
||||
the schedule after the check but leaves records for inspection. The check needs
|
||||
no model or forge. The legacy `task e2e:up` stack is not the target of this check.
|
||||
the schedule after the check but leaves records for inspection. No model or
|
||||
forge is needed. The legacy `task e2e:up` stack is not the target of this check.
|
||||
If Archie is running in WSL and its loopback URL is not reachable from
|
||||
Windows, run the check with Node in the same Linux environment as Archie.
|
||||
If the schedule starts but the run does not finish, check the `events` and
|
||||
@@ -85,53 +85,53 @@ A module in `checks/` exports `async ({ page, go, shot, fail, skip, settled, att
|
||||
- `go(path)` loads a dashboard route: `waitUntil: 'load'` plus 1200ms.
|
||||
Wait for elements, never for `networkidle`: the event stream never goes idle.
|
||||
- `shot(label)` saves `<check>-<kebab>[-<w>x<h>].png` after a short settle,
|
||||
and records `{file, w, h, check}` in the manifest. The label becomes a slug,
|
||||
and records `{file, w, h, check}` in the manifest. The label is slugified,
|
||||
so `shot('/')` becomes `routes-home.png`; a viewport other than the
|
||||
1440x900 default adds a suffix (`-390x844`). Repeated labels get `-2`,
|
||||
`-3`, so the test runner keeps every capture.
|
||||
`-3`, so every capture is kept.
|
||||
- `fail(msg)` records a problem without stopping.
|
||||
- `skip(reason)` stops the check and records a skip: a missing
|
||||
precondition, never a failure.
|
||||
- `tolerate(re)` ignores console errors matching `re`, for a response the page survives by design.
|
||||
- `tolerate(re)` ignores console errors matching `re`, for a response the page is designed to survive.
|
||||
- `attach(name, data)` saves a non-image artifact as `<check>-<name>`.
|
||||
- `settled(sel?)` waits for a selector or URL, then settles briefly.
|
||||
It is the test runner's wait; checks need no capture wrapper or
|
||||
It is the harness-owned wait; checks need no capture wrapper or
|
||||
ad-hoc sleeps around screenshots.
|
||||
|
||||
Each check gets a fresh page at 1440x900 with the login `storageState`;
|
||||
a check that needs a phone viewport resizes it itself to 390x844.
|
||||
Those are the only two viewports in use. A throw, a `fail`, or any
|
||||
console or page error fails the check. One module covers one behaviour.
|
||||
Families share a prefix: `audit-*` for the audit page (redirect,
|
||||
filters, revert, runtime, views-export, retention-live, phone), and
|
||||
`workflow-*` for the canvas (loading, validation, phone-layout, logic).
|
||||
`chat-composer` covers chat input, and `chat-dock-*` covers the chat dock (pin,
|
||||
drag-cancel, layout, resize, drafts, picker, phone).
|
||||
console or page error fails the check. One module covers one behaviour;
|
||||
families share a prefix: `audit-*` for the audit page (redirect,
|
||||
filters, revert, runtime, views-export, retention-live, phone),
|
||||
`workflow-*` for the canvas (loading, validation, phone-layout, logic),
|
||||
`chat-composer` for chat input, `chat-dock-*` for the chat dock (pin, drag-cancel,
|
||||
layout, resize, drafts, picker, phone).
|
||||
|
||||
`routes` loads every static route and flags text with stray leading,
|
||||
trailing or doubled spaces. `seeded` checks the seed is visible.
|
||||
`routes` visits `/logs` but the whitespace lint skips it: log lines are
|
||||
`/logs` is visited but skipped by the whitespace lint: log lines are
|
||||
data, not copy.
|
||||
|
||||
## Output
|
||||
|
||||
Every run writes `out/<stamp>/` with the screenshots,
|
||||
`results.json` (the manifest: `{check, ok, ms, problems, artifacts[]}`,
|
||||
plus `skipped`/`skipReason` for skips) and `report.html`. The report is a
|
||||
self-contained test record with the commit, totals and one row per check (status,
|
||||
time, message and that check's artifacts, screenshots inline). `attach(name, data)`
|
||||
plus `skipped`/`skipReason` for skips) and `report.html`: a self-contained
|
||||
test record with the commit, totals and one row per check (status, time,
|
||||
message and that check's artifacts, screenshots inline). `attach(name, data)`
|
||||
adds a non-image artifact to the current check; a failed check also gets a
|
||||
`failure` screenshot.
|
||||
|
||||
Exits: 0 when every check passes or skips, 1 when any check fails,
|
||||
2 when the test runner itself errors. `ARCHIE_E2E_URL` points the run at
|
||||
2 when the harness itself errors. `ARCHIE_E2E_URL` points the run at
|
||||
a dashboard other than `http://localhost:5173`.
|
||||
|
||||
## Pitfalls
|
||||
|
||||
| Symptom | Cause | Fix |
|
||||
| --- | --- | --- |
|
||||
| State Store exits: server is older than PostgreSQL 18 | another server answered | `stack.sh` uses port 55432; set `ARCHIE_DEV_PGPORT` if another process holds that port |
|
||||
| State Store exits: server is older than PostgreSQL 18 | another server answered | `stack.sh` uses port 55432; set `ARCHIE_DEV_PGPORT` if that is taken |
|
||||
| Startup says a port is in use | a stack or another process already owns it | Run `task e2e:down`, then `task e2e:up`; inspect any remaining listener with `ss -ltnp` |
|
||||
| `pkill -f` kills your own shell (exit 144) | `pkill -f` matched its own command line | `stack.sh stop` or `restart`, which kill by PID |
|
||||
| Your own shell is killed (exit 144) | `pkill -f` matched its own command line | `stack.sh stop` or `restart`, which kill by PID |
|
||||
| Postgres aborts in the cloud | `/tmp/claude-0` is reset to mode 700 | `stack.sh` keeps the root cluster in `/var/lib/archie-dev` |
|
||||
+9
-10
@@ -32,28 +32,27 @@ async function main() {
|
||||
await request("/api/workflows", { authenticated: false, status: 401 });
|
||||
|
||||
const name = `smoke-${randomUUID()}`;
|
||||
const saved = await request("/api/workflows", {
|
||||
method: "POST",
|
||||
status: 201,
|
||||
body: { name, body: `repository: none\nsteps:\n - id: notify\n type: run.notify\n settings: {title: ${name}}\n` },
|
||||
const saved = await request(`/api/workflows/${name}`, {
|
||||
method: "PUT",
|
||||
body: { body: `repository: none\nsteps:\n - id: notify\n type: run.notify\n settings: {title: ${name}}\n` },
|
||||
});
|
||||
const trigger = { name, workflow_id: saved.id, every: "1m" };
|
||||
const created = await request("/api/triggers", { method: "POST", body: trigger, status: 201 });
|
||||
const trigger = { workflow: name, every: "1m" };
|
||||
try {
|
||||
await request(`/api/triggers/${name}`, { method: "PUT", body: trigger });
|
||||
const deadline = Date.now() + 90_000;
|
||||
let last = "no scheduled run";
|
||||
while (Date.now() < deadline) {
|
||||
const recent = await request("/api/runs");
|
||||
const run = recent.find((row) => row.workflow_id === saved.id);
|
||||
const run = recent.find((row) => row.workflow === name);
|
||||
if (run) {
|
||||
last = `run ${run.id}: ${run.state}`;
|
||||
assert.ok(!["failed", "cancelled"].includes(run.state), `${last}: ${run.error || "no error returned"}`);
|
||||
if (run.state === "succeeded") {
|
||||
const trail = await request(`/api/runs/${run.id}`);
|
||||
assert.equal(trail.run.workflow_version, saved.version, "Run used the wrong workflow version");
|
||||
assert.equal(trail.origin?.trigger_id, created.id, "Run trail is missing the schedule trigger");
|
||||
assert.equal(trail.origin?.trigger, name, "Run trail is missing the schedule trigger");
|
||||
assert.ok(trail.origin?.event_id, "Run trail is missing the originating event");
|
||||
assert.equal(trail.origin.declared_event_type, "schedule.tick");
|
||||
assert.equal(trail.origin.type, "schedule.tick");
|
||||
const messages = await request("/api/composer/messages");
|
||||
assert.equal(messages.filter((m) => m.run_id === run.id && m.title === name).length, 1,
|
||||
"Expected one composer notification linked to the run");
|
||||
@@ -65,7 +64,7 @@ async function main() {
|
||||
}
|
||||
throw new Error(`Timed out waiting for ${name}: ${last}`);
|
||||
} finally {
|
||||
await request(`/api/triggers/${created.id}`, { method: "PUT", body: { ...trigger, disabled: true } });
|
||||
await request(`/api/triggers/${name}`, { method: "PUT", body: { ...trigger, disabled: true } });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ func SamplingMessages(req protocol.SamplingRequest) ([]chat.Message, error) {
|
||||
|
||||
// SamplingMaxTokens returns the request's maxTokens or the default, capped at
|
||||
// the model's ceiling. The ai-sdk runtime picks max_completion_tokens or
|
||||
// max_tokens from the model's catalogue metadata, so there is no reasoning
|
||||
// max_tokens from the model's catalog metadata, so there is no reasoning
|
||||
// branch here.
|
||||
func SamplingMaxTokens(requested, modelCeiling int) int {
|
||||
maxTokens := requested
|
||||
|
||||
@@ -104,7 +104,7 @@ func TestEveryOperationIsAuthorized(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestUnwiredAuthorizerRefuses guards the boot order: until the policy chain
|
||||
// is wired, an authorised operation is refused rather than let through.
|
||||
// is wired, an authorized operation is refused rather than let through.
|
||||
func TestUnwiredAuthorizerRefuses(t *testing.T) {
|
||||
settings := &governance.Module{}
|
||||
if err := settings.Allow(governance.WithPrincipal(t.Context(), governance.SharedTokenOwner()), "read", "run"); !errors.Is(err, httpapi.ErrUnavailable) {
|
||||
|
||||
+19
-19
@@ -13,31 +13,31 @@ import (
|
||||
"github.com/samcharles93/archie-core/modules/connectors"
|
||||
"github.com/samcharles93/archie-core/modules/dashboard"
|
||||
"github.com/samcharles93/archie-core/modules/deliveries"
|
||||
"github.com/samcharles93/archie-core/modules/drafts"
|
||||
"github.com/samcharles93/archie-core/modules/events"
|
||||
"github.com/samcharles93/archie-core/modules/governance"
|
||||
"github.com/samcharles93/archie-core/modules/judgement"
|
||||
"github.com/samcharles93/archie-core/modules/memory"
|
||||
"github.com/samcharles93/archie-core/modules/proposals"
|
||||
"github.com/samcharles93/archie-core/modules/runs"
|
||||
"github.com/samcharles93/archie-core/modules/system"
|
||||
)
|
||||
|
||||
// apiModules are the modules that serve the HTTP API.
|
||||
type apiModules struct {
|
||||
settings *governance.Module
|
||||
conns *connectors.Module
|
||||
system *system.Module
|
||||
tell *deliveries.Module
|
||||
allow *approvals.Module
|
||||
actionTypes *judgement.ActionTypes
|
||||
policies *judgement.Policies
|
||||
hear *events.Module
|
||||
judge *judgement.Module
|
||||
engine *runs.Engine
|
||||
chat *chat.Module
|
||||
proposals *proposals.Module
|
||||
notes *memory.Module
|
||||
live *hub.Hub
|
||||
settings *governance.Module
|
||||
conns *connectors.Module
|
||||
system *system.Module
|
||||
tell *deliveries.Module
|
||||
allow *approvals.Module
|
||||
classes *judgement.Classes
|
||||
policies *judgement.Policies
|
||||
hear *events.Module
|
||||
judge *judgement.Module
|
||||
engine *runs.Engine
|
||||
chat *chat.Module
|
||||
drafts *drafts.Module
|
||||
notes *memory.Module
|
||||
live *hub.Hub
|
||||
}
|
||||
|
||||
func (m apiModules) register(api huma.API) {
|
||||
@@ -49,12 +49,12 @@ func (m apiModules) register(api huma.API) {
|
||||
m.system.Register(api)
|
||||
m.tell.Register(api)
|
||||
m.allow.Register(api)
|
||||
m.actionTypes.Register(api, m.allow)
|
||||
m.classes.Register(api, m.allow)
|
||||
m.policies.Register(api)
|
||||
m.hear.Register(api)
|
||||
m.judge.Register(api)
|
||||
m.engine.Register(api, orgID, m.hear, m.judge, m.allow)
|
||||
m.proposals.Register(api)
|
||||
m.drafts.Register(api)
|
||||
m.chat.Register(api)
|
||||
// The memory routes are served once the root wires the module, which it
|
||||
// does after the modules that read it are built.
|
||||
@@ -80,9 +80,9 @@ func emptyAPI(auth httpapi.Authenticator, authz httpapi.Authorizer) (*http.Serve
|
||||
api := httpapi.New(mux, buildinfo.Version, auth, authz)
|
||||
apiModules{
|
||||
settings: settings, conns: &connectors.Module{}, system: &system.Module{},
|
||||
tell: &deliveries.Module{}, allow: &approvals.Module{}, actionTypes: &judgement.ActionTypes{},
|
||||
tell: &deliveries.Module{}, allow: &approvals.Module{}, classes: &judgement.Classes{},
|
||||
policies: &judgement.Policies{}, hear: &events.Module{}, judge: &judgement.Module{},
|
||||
engine: &runs.Engine{}, chat: &chat.Module{}, proposals: &proposals.Module{},
|
||||
engine: &runs.Engine{}, chat: &chat.Module{}, drafts: &drafts.Module{},
|
||||
notes: &memory.Module{}, live: hub.New(),
|
||||
}.register(api)
|
||||
return mux, api
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/modules/governance"
|
||||
"github.com/samcharles93/archie-core/modules/judgement"
|
||||
"github.com/samcharles93/archie-core/modules/memory"
|
||||
"github.com/samcharles93/archie-core/modules/proposals"
|
||||
"github.com/samcharles93/archie-core/modules/runs"
|
||||
)
|
||||
|
||||
@@ -40,7 +39,6 @@ type operations struct {
|
||||
judge *judgement.Module
|
||||
allow *approvals.Module
|
||||
remember *memory.Module
|
||||
proposed *proposals.Module
|
||||
// completeRecord finishes the record of a committed deletion whose entry could
|
||||
// not be written.
|
||||
completeRecord func(context.Context) (int, error)
|
||||
@@ -61,14 +59,14 @@ func (o *operations) Start(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Every entry point uses the same chain, and every decision, allowed or
|
||||
// refused, is stored.
|
||||
// Every entry point asks the same chain, and each refusal is stored as a
|
||||
// denial.
|
||||
checked := governance.Recording(access, o.settings, o.log.With("module", "governance"))
|
||||
// A workflow takes its context from the run handle, as a handler takes it
|
||||
// from the request.
|
||||
o.engine.Use(runs.Deps{
|
||||
Settings: o.settings, Toolbox: o.conns, Judge: o.judge, Approver: o.allow,
|
||||
Proposals: o.proposed, Notifier: o.tell, Messenger: o.tell, Memory: o.remember, Capabilities: o.conns,
|
||||
Notifier: o.tell, Messenger: o.tell, Memory: o.remember, Capabilities: o.conns,
|
||||
Access: checked,
|
||||
})
|
||||
if err := installStarter(ctx, o.engine); err != nil {
|
||||
@@ -94,15 +92,13 @@ func (o *operations) Start(ctx context.Context) error {
|
||||
// each source's delivery policy from it.
|
||||
o.settings.UseAuthorizer(checked)
|
||||
o.allow.UseAuthorizer(checked)
|
||||
o.proposed.UseAuthorizer(checked)
|
||||
o.tell.UseAccess(checked)
|
||||
o.hear.UseDeliveryPolicy(governance.RecordingDelivery(access, o.settings, o.log.With("module", "governance")))
|
||||
o.hear.UseTrustedProxies(o.settings.TrustedProxies)
|
||||
o.talk.Use(chat.Deps{
|
||||
People: o.settings, Access: checked, Settings: o.settings, Toolbox: o.conns, Judge: o.judge,
|
||||
People: o.settings, Access: access, Settings: o.settings, Toolbox: o.conns, Judge: o.judge,
|
||||
Approver: o.allow, Memory: o.remember, Runs: o.engine, Notifier: o.tell,
|
||||
})
|
||||
for _, loop := range []func(context.Context){o.engine.Work, o.hear.Work, o.tell.Work, o.proposed.Work, o.talk.Work, o.retryDeletionRecord} {
|
||||
for _, loop := range []func(context.Context){o.engine.Work, o.hear.Work, o.tell.Work, o.talk.Work, o.retryDeletionRecord} {
|
||||
o.workers.Go(func() { loop(ctx) })
|
||||
}
|
||||
return nil
|
||||
@@ -144,12 +140,9 @@ func (o *operations) Wait() {
|
||||
// installStarter puts the workflow that ships with the binary in place. It
|
||||
// belongs to the organisation, so it waits until setup has created one.
|
||||
func installStarter(ctx context.Context, engine *runs.Engine) error {
|
||||
if _, err := engine.InstallShipped(ctx, orgID, "investigate", runs.InvestigateDocument(), string(governance.SystemID)); err != nil {
|
||||
if _, err := engine.Install(ctx, orgID, "investigate", runs.InvestigateDocument(), "starter"); err != nil {
|
||||
return fmt.Errorf("install the investigate workflow: %w", err)
|
||||
}
|
||||
if _, err := engine.InstallShipped(ctx, orgID, runs.ProposalWorkflow, runs.ProposalDocument(), string(governance.SystemID)); err != nil {
|
||||
return fmt.Errorf("install the proposal workflow: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+15
-43
@@ -32,11 +32,11 @@ import (
|
||||
"github.com/samcharles93/archie-core/modules/connectors"
|
||||
"github.com/samcharles93/archie-core/modules/dashboard"
|
||||
"github.com/samcharles93/archie-core/modules/deliveries"
|
||||
"github.com/samcharles93/archie-core/modules/drafts"
|
||||
"github.com/samcharles93/archie-core/modules/events"
|
||||
"github.com/samcharles93/archie-core/modules/governance"
|
||||
"github.com/samcharles93/archie-core/modules/judgement"
|
||||
"github.com/samcharles93/archie-core/modules/memory"
|
||||
"github.com/samcharles93/archie-core/modules/proposals"
|
||||
"github.com/samcharles93/archie-core/modules/runs"
|
||||
"github.com/samcharles93/archie-core/modules/system"
|
||||
"github.com/samcharles93/archie-core/ui"
|
||||
@@ -154,20 +154,16 @@ func wire(log *slog.Logger, configPath string, cfg Config, db *sqlx.DB) (*binary
|
||||
mux := http.NewServeMux()
|
||||
api := httpapi.New(mux, buildinfo.Version, settings.Authenticator(cfg.AdminTokenSHA256), settings)
|
||||
|
||||
conns, err := connectors.NewModule(db, log.With("module", "connectors"), connectors.Sealing{
|
||||
conns, err := connectors.NewModule(db, log.With("module", "connectors"), orgID, connectors.Sealing{
|
||||
Identity: cfg.AgeIdentity, Backups: cfg.AgeBackupRecipients,
|
||||
}, filepath.Join(cfg.StateDir, "extensions"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// A model's key is a credential id resolved through the sealed store in
|
||||
// organisation scope with no person attached.
|
||||
settings.UseCredentials(orgCredentials{conns: conns, orgID: string(governance.DefaultOrgID)})
|
||||
// A model's key is a credential name resolved through the sealed store.
|
||||
settings.UseCredentials(conns)
|
||||
// An account links a channel account on the connectors that can link.
|
||||
settings.UseChannels(conns)
|
||||
// A model's window comes from the published catalogue, cached under the
|
||||
// state directory so a restart reads it from disk.
|
||||
settings.UseModelCatalogue(filepath.Join(cfg.StateDir, "model-catalogue.json"))
|
||||
|
||||
sys := system.New(system.Bootstrap{
|
||||
Listen: cfg.Listen, Database: DatabaseHost(cfg.Database.URL), Schemas: len(schemas),
|
||||
@@ -184,10 +180,10 @@ func wire(log *slog.Logger, configPath string, cfg Config, db *sqlx.DB) (*binary
|
||||
talk := chat.NewModule(db, log.With("module", "chat"), orgID, live)
|
||||
// A workflow takes its context from the run handle, as a handler takes it
|
||||
// from the request.
|
||||
actionTypes := judgement.NewActionTypes(db, log.With("module", "judgement"), orgID)
|
||||
classes := judgement.NewClasses(db, log.With("module", "judgement"), orgID)
|
||||
// An approval request is carried by deliveries, and its answer wakes the run
|
||||
// that is waiting on it.
|
||||
allow := approvals.NewModule(db, log.With("module", "approvals"), orgID, tell, answers{chat: talk, runs: engine}, actionTypes, settings, settings)
|
||||
allow := approvals.NewModule(db, log.With("module", "approvals"), orgID, tell, answers{chat: talk, runs: engine}, classes, settings, settings)
|
||||
// Approving an action that can't be undone needs a fresh passkey assertion.
|
||||
allow.UseConfirmer(settings)
|
||||
policies := judgement.NewPolicies(db, log.With("module", "judgement"), orgID)
|
||||
@@ -199,7 +195,7 @@ func wire(log *slog.Logger, configPath string, cfg Config, db *sqlx.DB) (*binary
|
||||
hear := events.NewModule(db, log.With("module", "events"), orgID, sealer, conns, engine, allow, settings, tell)
|
||||
hear.Routes(mux)
|
||||
engine.UseReferrers(hear)
|
||||
judge := newJudgement(db, log, conns, actionTypes, policies, settings, hear)
|
||||
judge := newJudgement(db, log, conns, classes, policies, settings, hear)
|
||||
// The record of deletions outlives this process and its database, so the
|
||||
// log exists before anything can be deleted: an instance that has run this
|
||||
// release and lost its log is a different case from one that never deleted.
|
||||
@@ -214,15 +210,10 @@ func wire(log *slog.Logger, configPath string, cfg Config, db *sqlx.DB) (*binary
|
||||
}
|
||||
return nil
|
||||
})
|
||||
proposed := proposals.NewModule(db, log.With("module", "proposals"), orgID, hear, engine, policies, judge)
|
||||
// A cause that keeps recurring becomes a root-cause proposal.
|
||||
remember.UseProposals(proposed)
|
||||
// Approving an action that can't be undone needs a fresh passkey assertion.
|
||||
proposed.UseConfirmer(settings)
|
||||
sys.UseHealth(healthSources(checks, conns, engine, allow))
|
||||
apiModules{
|
||||
settings: settings, conns: conns, system: sys, tell: tell, allow: allow, actionTypes: actionTypes, policies: policies,
|
||||
hear: hear, judge: judge, engine: engine, chat: talk, proposals: proposed,
|
||||
settings: settings, conns: conns, system: sys, tell: tell, allow: allow, classes: classes, policies: policies,
|
||||
hear: hear, judge: judge, engine: engine, chat: talk, drafts: drafts.NewModule(db, log.With("module", "drafts"), orgID, hear, engine, policies),
|
||||
notes: remember, live: live,
|
||||
}.register(api)
|
||||
dashboard.Routes(mux, ui.DistDirFS)
|
||||
@@ -232,7 +223,7 @@ func wire(log *slog.Logger, configPath string, cfg Config, db *sqlx.DB) (*binary
|
||||
db: db, conns: conns, gate: g, served: serveSurface(checks, g), settings: settings,
|
||||
ops: &operations{
|
||||
log: log, checks: checks, settings: settings, conns: conns, engine: engine, hear: hear,
|
||||
tell: tell, talk: talk, judge: judge, allow: allow, remember: remember, proposed: proposed,
|
||||
tell: tell, talk: talk, judge: judge, allow: allow, remember: remember,
|
||||
completeRecord: func(ctx context.Context) (int, error) {
|
||||
return memory.Reconcile(ctx, db, cfg.StateDir)
|
||||
},
|
||||
@@ -246,25 +237,6 @@ func (b *binary) close() {
|
||||
_ = b.db.Close()
|
||||
}
|
||||
|
||||
// orgCredentials confines every model-provider credential lookup to orgID with
|
||||
// no person attached, so a caller's personal credentials are never reachable.
|
||||
type orgCredentials struct {
|
||||
conns *connectors.Module
|
||||
orgID string
|
||||
}
|
||||
|
||||
func (c orgCredentials) BearerTokenByID(ctx context.Context, id uuid.UUID) (string, error) {
|
||||
return c.conns.BearerTokenByID(connectors.WithScope(ctx, connectors.Scope{OrgID: c.orgID}), id)
|
||||
}
|
||||
|
||||
func (c orgCredentials) BearerCredentialName(ctx context.Context, id uuid.UUID) (string, bool, error) {
|
||||
return c.conns.BearerCredentialName(connectors.WithScope(ctx, connectors.Scope{OrgID: c.orgID}), id)
|
||||
}
|
||||
|
||||
func (c orgCredentials) BearerCredentialNames(ctx context.Context) (map[uuid.UUID]string, error) {
|
||||
return c.conns.BearerCredentialNames(connectors.WithScope(ctx, connectors.Scope{OrgID: c.orgID}))
|
||||
}
|
||||
|
||||
// answers wakes whatever asked for an approval: a chat turn, or else the run
|
||||
// waiting on it.
|
||||
type answers struct {
|
||||
@@ -280,18 +252,18 @@ func (a answers) Signal(ctx context.Context, id uuid.UUID, key string, payload j
|
||||
}
|
||||
|
||||
// newJudgement returns the judgement module with its hard rules, data guards
|
||||
// and change-request rules. A failed action tightens its action type.
|
||||
func newJudgement(db *sqlx.DB, log *slog.Logger, conns *connectors.Module, actionTypes *judgement.ActionTypes, policies *judgement.Policies, settings *governance.Module, heard judgement.Events) *judgement.Module {
|
||||
// and change-request rules. A failed action tightens its class.
|
||||
func newJudgement(db *sqlx.DB, log *slog.Logger, conns *connectors.Module, classes *judgement.Classes, policies *judgement.Policies, settings *governance.Module, heard judgement.Events) *judgement.Module {
|
||||
guards := []judgement.Guard{
|
||||
judgement.Impact{Lookup: judgement.RecordedFacts{Source: conns, Accounts: settings}, Defaults: settings},
|
||||
judgement.Reversibility{},
|
||||
judgement.Precedent{ActionTypes: actionTypes},
|
||||
judgement.Precedent{Classes: classes},
|
||||
judgement.Provenance{Events: heard},
|
||||
judgement.Timing{Calendar: settings},
|
||||
judgement.Cost{Budgets: settings, Counts: judgement.NewSpend(db, orgID)},
|
||||
judgement.Freeze{Freezes: settings},
|
||||
}
|
||||
judge := judgement.NewModule(db, log.With("module", "judgement"), orgID, conns, []judgement.HardRule{policies}, guards, actionTypes)
|
||||
judge := judgement.NewModule(db, log.With("module", "judgement"), orgID, conns, []judgement.HardRule{policies}, guards, classes)
|
||||
judge.UseExtensions(conns)
|
||||
judge.UseChangeRules(policies)
|
||||
return judge
|
||||
@@ -301,7 +273,7 @@ func newJudgement(db *sqlx.DB, log *slog.Logger, conns *connectors.Module, actio
|
||||
const orgID = "default"
|
||||
|
||||
// schemas are the module schemas the runtime role is granted DML on.
|
||||
var schemas = []string{"runs", "connectors", "events", "governance", "deliveries", "judgement", "approvals", "memory", "alerts", "proposals", "chat"}
|
||||
var schemas = []string{"runs", "connectors", "events", "governance", "deliveries", "judgement", "approvals", "memory", "drafts", "chat"}
|
||||
|
||||
// owner names this process in run leases.
|
||||
func owner() string {
|
||||
|
||||
@@ -837,7 +837,7 @@ func (b *boot) addCleanup(fn func()) {
|
||||
|
||||
func (b *boot) catalogState() modelcatalog.Snapshot { return b.catalog.State() }
|
||||
|
||||
// loadCatalog layers the model catalogue under the file config. A catalogue that
|
||||
// loadCatalog layers the model catalog under the file config. A catalog that
|
||||
// cannot be read leaves the configured providers and models in effect.
|
||||
func (b *boot) loadCatalog(ctx context.Context) {
|
||||
snapshot, err := b.catalog.Fetch(ctx, b.secrets.Getenv, b.cfgHolder.Get().Providers)
|
||||
@@ -846,7 +846,7 @@ func (b *boot) loadCatalog(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
models := modelcatalog.Apply(&b.cfg, snapshot)
|
||||
// Layer the catalogue over the live config, not b.cfg: b.cfg predates the
|
||||
// Layer the catalog over the live config, not b.cfg: b.cfg predates the
|
||||
// execution-settings watch, so publishing it would put the file's budgets
|
||||
// back over the control plane's.
|
||||
live := b.cfgHolder.Get().Clone()
|
||||
|
||||
@@ -47,10 +47,10 @@ func (b *boot) loadRuntimeConfig(ctx context.Context) error {
|
||||
// cannot answer aborts the reload: the running config already holds those
|
||||
// values, so publishing the file's over them is the worse outcome.
|
||||
func (b *boot) reloadConfig(ctx context.Context, doc *configuration.Document) error {
|
||||
// Boot merges catalogue-discovered providers into cfg before the
|
||||
// Boot merges catalog-discovered providers into cfg before the
|
||||
// Holders are seeded; publishing the raw reloaded document would
|
||||
// drop them from the running config even though the file is
|
||||
// unchanged. Re-apply the same merge (idempotent: a catalogue that
|
||||
// unchanged. Re-apply the same merge (idempotent: a catalog that
|
||||
// failed to load merges to identity).
|
||||
catalog := b.catalogState()
|
||||
modelcatalog.Apply(&doc.Config, catalog)
|
||||
@@ -376,8 +376,8 @@ func (b *boot) applyRuntimeResourceUpdate(ctx context.Context, kind string, upda
|
||||
}
|
||||
}
|
||||
base := b.cfgHolder.Get()
|
||||
// Boot publishes before the model catalogue is merged in, so the snapshot
|
||||
// this read returns can lack the catalogue's model limits and discovered
|
||||
// Boot publishes before the model catalog is merged in, so the snapshot
|
||||
// this read returns can lack the catalog's model limits and discovered
|
||||
// providers. The merge is idempotent, and reloadConfig re-applies it
|
||||
// before layering for the same reason.
|
||||
catalog := b.catalogState()
|
||||
|
||||
@@ -194,7 +194,7 @@ func Run() int { //nolint:cyclop,funlen // the composition root's setup sequence
|
||||
go presence.Run(ctx, b.processName, servicekit.Build(), ps, b.healthRegistry, b.log)
|
||||
b.reportBrokerPresence(ctx, ps)
|
||||
}
|
||||
// The daemon publishes the configuration view, which carries the catalogue's
|
||||
// The daemon publishes the configuration view, which carries the catalog's
|
||||
// model limits.
|
||||
b.startModelCatalogRefresh(ctx)
|
||||
b.buildWorktreeManager()
|
||||
|
||||
@@ -65,7 +65,7 @@ func TestOpenShellModelEgressHoldsKeysOnTheGateway(t *testing.T) {
|
||||
wantKeys map[string]string // key env -> real key held on the gateway
|
||||
wantHosts []string
|
||||
wantPorts []int // defaults to 443 for each host
|
||||
wantHeader string // header that carries the key; empty means a bearer token
|
||||
wantHeader string // header the profile places the key in; empty means a bearer token
|
||||
}{
|
||||
{
|
||||
name: "secret reference",
|
||||
|
||||
@@ -31,7 +31,7 @@ func stepVocabulary() (*workflow.Manager, error) { return workflowsteps.NewManag
|
||||
// (main.go's Run) before buildDaemon captures the client.
|
||||
//
|
||||
// It is deliberately not part of openStateStoreAdapter, which the gateway root
|
||||
// shares: the gateway reads catalogue, runtime settings and SOUL, never a
|
||||
// shares: the gateway reads catalog, runtime settings and SOUL, never a
|
||||
// workflow definition, so registering a vocabulary there would be the dead
|
||||
// vocabulary this shape removed from internal/app/archiemessaging -- a root that
|
||||
// cannot consume it must not be failed by it.
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// chatModelManager owns the model selection for interactive chat. Named
|
||||
// aliases remain defaults; choosing a catalogue model does not rewrite them
|
||||
// aliases remain defaults; choosing a catalog model does not rewrite them
|
||||
// or affect workflow steps.
|
||||
type chatModelManager struct {
|
||||
mu sync.RWMutex
|
||||
@@ -43,7 +43,7 @@ func (m *chatModelManager) SetConfigured(aliases map[string]string) {
|
||||
}
|
||||
|
||||
// SetModelCatalog replaces the provider display names and per-model details
|
||||
// the catalogue publishes.
|
||||
// the catalog publishes.
|
||||
func (m *chatModelManager) SetModelCatalog(snapshot modelcatalog.Snapshot) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
@@ -174,7 +174,7 @@ func (m *chatModelManager) ModelFor(ctx context.Context) (string, error) {
|
||||
}
|
||||
|
||||
// refsLocked keeps tenant choices within their assigned aliases; the system
|
||||
// org can also select from its credential-filtered provider catalogue.
|
||||
// org can also select from its credential-filtered provider catalog.
|
||||
func (m *chatModelManager) refsLocked(id org.OrgID, aliases map[string]string) []string {
|
||||
if id != org.DefaultOrgID {
|
||||
return chatModelRefs(aliases, nil)
|
||||
|
||||
@@ -200,7 +200,7 @@ func (m *preparedChatTurnModel) Generate(
|
||||
// This is one provider response's output allowance, not a turn-
|
||||
// continuation budget. Tool loops remain free to continue. The ai-sdk
|
||||
// runtime picks max_completion_tokens or max_tokens from the model's
|
||||
// catalogue metadata.
|
||||
// catalog metadata.
|
||||
options.MaxTokens = request.MaxOutputTokens
|
||||
// A runtime swapped to nil -- a live update that left no usable provider
|
||||
// configured -- is a refused turn, not a panic.
|
||||
|
||||
@@ -93,7 +93,7 @@ func (s curatorEventSink) Emit(kind, detail string, data map[string]any) {
|
||||
|
||||
// actingPrincipal resolves the identity the instance acts as for automated
|
||||
// work (the default chat identity, falling back to the bot user), so curator
|
||||
// passes authorise guarded tools exactly as that identity would.
|
||||
// passes authorize guarded tools exactly as that identity would.
|
||||
func (b *server) actingPrincipal(ctx context.Context) (access.Principal, error) {
|
||||
name := b.defaultChatIdentity
|
||||
if name == "" {
|
||||
|
||||
@@ -260,7 +260,7 @@ func (b *server) waitForNATSEndpoint(ctx context.Context) (servicekit.NATSEndpoi
|
||||
|
||||
func (b *server) catalogState() modelcatalog.Snapshot { return b.catalog.State() }
|
||||
|
||||
// loadCatalog layers the model catalogue under the running config. A catalogue
|
||||
// loadCatalog layers the model catalog under the running config. A catalog
|
||||
// that cannot be read leaves the configured providers and models in effect.
|
||||
func (b *server) loadCatalog(ctx context.Context) {
|
||||
snapshot, err := b.catalog.Fetch(ctx, b.secrets.Getenv, b.cfg.Providers)
|
||||
|
||||
@@ -70,7 +70,7 @@ func (b *server) refreshSkills(ctx context.Context, applied *string) {
|
||||
}
|
||||
|
||||
// storedSkills reads the skills resource, leaving out any name already in
|
||||
// have. An unreadable resource leaves the running catalogue in place.
|
||||
// have. An unreadable resource leaves the running catalog in place.
|
||||
func (b *server) storedSkills(ctx context.Context, have []skill.CatalogEntry) ([]skill.CatalogEntry, int64, error) {
|
||||
var out []skill.CatalogEntry
|
||||
version, _, err := b.controlPlane.Query(ctx, controlplanestore.SkillsKind, func(value []byte) error {
|
||||
|
||||
@@ -27,7 +27,7 @@ type ServiceTarget struct {
|
||||
|
||||
// Options is the UI-owned input DTO. It carries process-local settings and
|
||||
// endpoint references only -- there is deliberately no config.Config,
|
||||
// config.Holder, forge credential, model catalogue or workflow routing field
|
||||
// config.Holder, forge credential, model catalog or workflow routing field
|
||||
// for daemon configuration to arrive through.
|
||||
type Options struct {
|
||||
// Config and Overlay name the configuration source the process reads a
|
||||
|
||||
@@ -63,7 +63,7 @@ const controlPlaneWatchHealthyMultiple = 2
|
||||
// deliberately: that version is unusable to this build, and resuming before it
|
||||
// would re-offer it on every reconnect for the life of the process. Only a
|
||||
// cancellation stops the loop, and the loop watches for it itself, so shutdown
|
||||
// is prompt however long the current backoff is and whether the stream
|
||||
// is prompt however long the current backoff is and whether or not the stream
|
||||
// is still open.
|
||||
//
|
||||
// The reconnect delay is decided by the attempt that just ended, and only by
|
||||
|
||||
@@ -35,8 +35,7 @@ type Sender interface {
|
||||
|
||||
// Reloader is a channel that can re-read its configuration in place. The
|
||||
// capability a status report declares and the reload action both derive from
|
||||
// the Reloader interface, so a channel cannot advertise one and answer
|
||||
// nothing.
|
||||
// this interface, so a channel cannot advertise one and answer nothing.
|
||||
type Reloader interface {
|
||||
Reload() error
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ type Budgets struct {
|
||||
TaskWallClock Duration `toml:"task_wall_clock" json:"task_wall_clock" yaml:"task_wall_clock"`
|
||||
}
|
||||
|
||||
// Provider configures one LLM provider for the runtime catalogue.
|
||||
// Provider configures one LLM provider for the runtime catalog.
|
||||
type Provider struct {
|
||||
Class string `toml:"class" yaml:"class" json:"class"`
|
||||
APIKeyEnv string `toml:"api_key_env" yaml:"api_key_env" json:"api_key_env"`
|
||||
@@ -228,7 +228,7 @@ type Provider struct {
|
||||
// Disabled marks a configured provider whose api_key could not be
|
||||
// resolved at boot. It is runtime state, not a setting: without it a
|
||||
// disabled provider is indistinguishable from one the operator never
|
||||
// configured, and the model catalogue would serve it from an ambient
|
||||
// configured, and the model catalog would serve it from an ambient
|
||||
// environment variable.
|
||||
Disabled bool `toml:"-" yaml:"-" json:"-"`
|
||||
}
|
||||
@@ -246,7 +246,7 @@ type Dispatch struct {
|
||||
// issues), "label" (poll labelled issues), or "either" (both).
|
||||
Trigger string `toml:"trigger" json:"trigger" yaml:"trigger"`
|
||||
// AckReaction is the emoji reaction posted on issue pickup. Set
|
||||
// ack_reaction = "off" in TOML to disable it; Load normalises that
|
||||
// ack_reaction = "off" in TOML to disable it; Load normalizes that
|
||||
// sentinel to an empty string for callers.
|
||||
AckReaction string `toml:"ack_reaction" json:"ack_reaction" yaml:"ack_reaction"`
|
||||
}
|
||||
@@ -468,7 +468,7 @@ type ModelLimits struct {
|
||||
ContextWindow int `json:"context_window"`
|
||||
MaxOutputTokens int `json:"max_output_tokens"`
|
||||
// Reasoning marks a reasoning-class model. It is derived from the model
|
||||
// catalogue (never operator-authored) and carried to the agent worker so a
|
||||
// catalog (never operator-authored) and carried to the agent worker so a
|
||||
// task-scoped MCP sampling request omits the max-token bound those models
|
||||
// reject, exactly as the daemon's chat path does.
|
||||
Reasoning bool `json:"reasoning,omitempty"`
|
||||
@@ -517,7 +517,7 @@ func (c Config) ForTask() TaskConfig {
|
||||
|
||||
// aliasedModelLimits keeps the limits of the models an alias can resolve to.
|
||||
// Workflows reach a model only through Models, so the rest of the provider
|
||||
// catalogue would only bloat every attempt's captured configuration.
|
||||
// catalog would only bloat every attempt's captured configuration.
|
||||
func (c Config) aliasedModelLimits() map[string]ModelLimits {
|
||||
var out map[string]ModelLimits
|
||||
for _, ref := range c.Models {
|
||||
@@ -739,7 +739,7 @@ type ContainerConfig struct {
|
||||
// at startup rather than at the first failed pull.
|
||||
Image string `toml:"image" yaml:"image"`
|
||||
// MaxConcurrency limits simultaneous daemon tasks and containers.
|
||||
// Tasks from the same repository remain serialised. 0 = no limit.
|
||||
// Tasks from the same repository remain serialized. 0 = no limit.
|
||||
MaxConcurrency int `toml:"max_concurrency" yaml:"max_concurrency"`
|
||||
// MaxUptime caps a container's lifetime before recycling.
|
||||
MaxUptime Duration `toml:"max_uptime" yaml:"max_uptime"`
|
||||
|
||||
@@ -852,7 +852,7 @@ func (x *Effect) GetSecretAccess() bool {
|
||||
}
|
||||
|
||||
// Target is what an action acts on. Connector, action, kind and environment
|
||||
// together are the action type.
|
||||
// together are the action class.
|
||||
type Target struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
@@ -1274,7 +1274,7 @@ type InvokeResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Output []byte `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"`
|
||||
// executed_digest is the connector's digest of what it ran. A mismatch is a
|
||||
// finding and tightens the action type.
|
||||
// finding and tightens the action class.
|
||||
ExecutedDigest string `protobuf:"bytes,2,opt,name=executed_digest,json=executedDigest,proto3" json:"executed_digest,omitempty"`
|
||||
// outcome_unknown says the connector can't confirm what its effect did.
|
||||
OutcomeUnknown bool `protobuf:"varint,3,opt,name=outcome_unknown,json=outcomeUnknown,proto3" json:"outcome_unknown,omitempty"`
|
||||
|
||||
@@ -35,7 +35,7 @@ type TaskTransport interface {
|
||||
}
|
||||
|
||||
// RunCredentialIssuer issues the one credential a task's container holds: it
|
||||
// authorises the task's own State Store calls and the push of its branch.
|
||||
// authorizes the task's own State Store calls and the push of its branch.
|
||||
// It lapses at the task's time limit plus a margin if never revoked.
|
||||
type RunCredentialIssuer interface {
|
||||
Issue(ctx context.Context, task *workflow.Task, limit time.Duration) (token string, revoke func(), err error)
|
||||
|
||||
@@ -58,7 +58,7 @@ func (d *Daemon) adoptWorkflowIdentity(ctx context.Context, task *workflow.Task)
|
||||
}
|
||||
|
||||
// declaredIdentity resolves a workflow's declared identity to the ID it is
|
||||
// authorised as and the name the task carries while it runs.
|
||||
// authorized as and the name the task carries while it runs.
|
||||
func (g *IdentityGate) declaredIdentity(ctx context.Context, task *workflow.Task, ref string) (identity.IdentityID, string, error) {
|
||||
value, err := g.databaseExecutionIdentity(ctx, task, identity.IdentityID(ref))
|
||||
if err != nil {
|
||||
|
||||
@@ -132,7 +132,7 @@ type Usage struct {
|
||||
}
|
||||
|
||||
// Provider describes how the worker resolves a model provider. API keys are
|
||||
// referenced by environment variable name and never serialised.
|
||||
// referenced by environment variable name and never serialized.
|
||||
type Provider struct {
|
||||
Class string `json:"class"`
|
||||
APIKeyEnv string `json:"api_key_env,omitempty"`
|
||||
|
||||
@@ -109,7 +109,7 @@ func NormalizeLimit(limit int) int {
|
||||
return limit
|
||||
}
|
||||
|
||||
// Hash is the fingerprint of the normalised filter a cursor is bound to. A
|
||||
// Hash is the fingerprint of the normalized filter a cursor is bound to. A
|
||||
// cursor replayed with a different filter would resume at a position that no
|
||||
// longer means the same page, so the reader refuses it.
|
||||
func (f *Filter) Hash() string {
|
||||
|
||||
@@ -51,7 +51,7 @@ func (t *activityTracker) record(name string, at time.Time, actions []Action) {
|
||||
// A curator engine may not stamp its own actions (no clock
|
||||
// dependency wired in); the pass's own "at" is the authoritative
|
||||
// time for every action it produced, so backfill rather than let
|
||||
// a zero timestamp reach the wire as "105694 wks ago".
|
||||
// a zero time.Time reach the wire as "105694 wks ago".
|
||||
if action.At.IsZero() {
|
||||
action.At = at
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ type ToolBuilder interface {
|
||||
}
|
||||
|
||||
// SkillStore is the skill-maintenance capability. The implementation owns
|
||||
// the on-disk format and catalogue reload rules.
|
||||
// the on-disk format and catalog reload rules.
|
||||
type SkillStore interface {
|
||||
List(ctx context.Context) ([]SkillRef, error)
|
||||
Read(ctx context.Context, name string) (Skill, error)
|
||||
|
||||
@@ -30,7 +30,7 @@ type RuntimeConfig struct {
|
||||
// defaultPassTimeout (10m).
|
||||
PassTimeout time.Duration
|
||||
// MaxConcurrentPasses caps simultaneous passes across all curators.
|
||||
// Zero uses 1: passes serialise behind a shared slot so a pass burst
|
||||
// Zero uses 1: passes serialize behind a shared slot so a pass burst
|
||||
// can never saturate the model runtime against chat turns.
|
||||
MaxConcurrentPasses int
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ type SubjectBinding interface {
|
||||
BindSubject(context.Context, IdentityID, Subject, Audit) error
|
||||
}
|
||||
|
||||
// LoginFlow is the browser authorisation flow an identity provider requires, as
|
||||
// LoginFlow is the browser authorization flow an identity provider requires, as
|
||||
// a dashboard driving it needs it: the URL to send a browser to, then the
|
||||
// completion of the flow when the browser returns. It is a contract here rather
|
||||
// than in the transport because what it yields is an identity.
|
||||
@@ -83,7 +83,7 @@ type SubjectResolver interface {
|
||||
ClaimSubject(ctx context.Context, placeholder, subject Subject) (Identity, error)
|
||||
}
|
||||
|
||||
// ProviderSession is what a completed authorisation flow yields: the credential
|
||||
// ProviderSession is what a completed authorization flow yields: the credential
|
||||
// the provider proved, and the provider's own token to present on later requests.
|
||||
// Archie holds no session of its own -- the token belongs to the provider and is
|
||||
// re-verified on every later request, so nothing archie stores can outlive it.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package messaging
|
||||
|
||||
// ModelDetails carries read-only catalogue metadata for one model reference.
|
||||
// ModelDetails carries read-only catalog metadata for one model reference.
|
||||
type ModelDetails struct {
|
||||
Ref string `json:"ref"`
|
||||
Name string `json:"name,omitempty"`
|
||||
@@ -14,7 +14,7 @@ type ModelDetails struct {
|
||||
}
|
||||
|
||||
// DetailedModelManager optionally enriches model selection confirmation with
|
||||
// catalogue metadata such as context window and modalities.
|
||||
// catalog metadata such as context window and modalities.
|
||||
type DetailedModelManager interface {
|
||||
ModelDetails(ref string) (ModelDetails, bool)
|
||||
}
|
||||
@@ -46,7 +46,7 @@ const (
|
||||
// TimingCron fires at each cron match in the instance time zone.
|
||||
// Day-of-month and day-of-week are ANDed.
|
||||
TimingCron = "cron"
|
||||
// TimingOnce fires once when the At time arrives.
|
||||
// TimingOnce fires once at At.
|
||||
TimingOnce = "once"
|
||||
)
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ const cursorSeparator = "|"
|
||||
// and string comparison of two cursors is the total order (key, id).
|
||||
const cursorIDWidth = 20
|
||||
|
||||
// EventCursor returns the opaque resume cursor for an event whose time is at
|
||||
// and whose row id is id. The cursor is a string so EventSource can carry it
|
||||
// EventCursor returns the opaque resume cursor for an event that happened at
|
||||
// at with row id id. The cursor is a string so EventSource can carry it
|
||||
// verbatim in its id: field and echo it back as the Last-Event-ID header; it
|
||||
// is opaque to every consumer except EventsSince.
|
||||
func EventCursor(at time.Time, id int64) string {
|
||||
|
||||
@@ -25,7 +25,7 @@ var (
|
||||
ErrUnavailable = errors.New("runtime task control is unavailable")
|
||||
)
|
||||
|
||||
// Task is the state needed to authorise and apply an operator action.
|
||||
// Task is the state needed to authorize and apply an operator action.
|
||||
type Task struct {
|
||||
Org org.OrgID
|
||||
ID int64
|
||||
|
||||
@@ -57,9 +57,9 @@ func NormalizeDays(days int) int {
|
||||
return days
|
||||
}
|
||||
|
||||
// ReportWindow is the UTC window a report of the given number of days covers,
|
||||
// ending at now: whole days, today included. Rows are bucketed by UTC day, so
|
||||
// the window starts at a UTC midnight.
|
||||
// ReportWindow is the UTC window a report of days days covers, ending at now:
|
||||
// whole days, today included. Rows are bucketed by UTC day, so the window
|
||||
// starts at a UTC midnight.
|
||||
func ReportWindow(days int, now time.Time) (from, to time.Time) {
|
||||
now = now.UTC()
|
||||
start := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC)
|
||||
@@ -68,7 +68,7 @@ func ReportWindow(days int, now time.Time) (from, to time.Time) {
|
||||
|
||||
// TotalRow is one cell of a usage report: the day, source and model an org's
|
||||
// calls used and the tokens they spent. Cost is not carried; the reader
|
||||
// prices the tokens against the model catalogue.
|
||||
// prices the tokens against the model catalog.
|
||||
type TotalRow struct {
|
||||
Day string
|
||||
Source Source
|
||||
|
||||
@@ -44,10 +44,10 @@ type StepStart struct {
|
||||
CalledExecutionID int64
|
||||
}
|
||||
|
||||
// StepFinish moves one step out of the From status into its outcome.
|
||||
// ExecutionID names the run the step belongs to: the task-scoped grant check
|
||||
// verifies it, and the store verifies the step really is that execution's, so
|
||||
// a caller cannot move another run's step by naming it.
|
||||
// StepFinish moves one step from From to its outcome. ExecutionID names the
|
||||
// run the step belongs to: the task-scoped grant check verifies it, and the
|
||||
// store verifies the step really is that execution's, so a caller cannot move
|
||||
// another run's step by naming it.
|
||||
type StepFinish struct {
|
||||
StepID int64
|
||||
ExecutionID int64
|
||||
|
||||
@@ -90,7 +90,7 @@ type Task struct {
|
||||
// Identity is the identity that created this task: a chat user, the
|
||||
// polling identity, a calling workflow's declared identity, or System for
|
||||
// instance-level work. Never empty. Used to scope /approve and
|
||||
// /cancel authorisation so one identity cannot control another's
|
||||
// /cancel authorization so one identity cannot control another's
|
||||
// chat-spawned tasks. While the daemon processes the task it holds the
|
||||
// identity the workflow declares, which is never stored here.
|
||||
Identity string `json:"identity"`
|
||||
|
||||
@@ -24,11 +24,10 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/tools"
|
||||
)
|
||||
|
||||
// Forger is the subset of the Forge interface in the forge package that
|
||||
// workflow stages call mid-run. Production reaches it through forgerpc.Client,
|
||||
// which proxies each call to the daemon over NATS -- the worker holds no forge
|
||||
// credentials, so the daemon stays the only caller of that interface. Test
|
||||
// fakes implement it directly.
|
||||
// Forger is the subset of forge.Forge that workflow stages call mid-run.
|
||||
// Production reaches it through forgerpc.Client, which proxies each call to the
|
||||
// daemon over NATS -- the worker holds no forge credentials, so the daemon stays
|
||||
// the only caller of forge.Forge. Test fakes implement it directly.
|
||||
type Forger interface {
|
||||
CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error
|
||||
CreatePR(ctx context.Context, owner, repo, title, head, base, body string) (int, error)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
workflowtask "github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
)
|
||||
|
||||
// ReviewTaskLookup is the authorisation query review reactions require.
|
||||
// ReviewTaskLookup is the authorization query review reactions require.
|
||||
type ReviewTaskLookup interface {
|
||||
OpenTaskByPR(ctx context.Context, owner, repo string, number int) (*workflowtask.Task, error)
|
||||
}
|
||||
@@ -60,7 +60,7 @@ func SubjectFor(identity, base string) string {
|
||||
return "archie.forge." + string(domainidentity.StableID(identity)) + "." + strings.TrimPrefix(base, "archie.forge.")
|
||||
}
|
||||
|
||||
// Target is what every request acts on and the credential that authorises
|
||||
// Target is what every request acts on and the credential that authorizes
|
||||
// it: the run credential of the task asking, which only reaches that task's
|
||||
// own repository.
|
||||
type Target struct {
|
||||
@@ -162,8 +162,7 @@ type Authorities interface {
|
||||
AcceptedAuthority(ctx context.Context, name string) (storepkg.Authority, error)
|
||||
}
|
||||
|
||||
// Server proxies forgerpc requests to a real implementation of the Forge
|
||||
// interface.
|
||||
// Server proxies forgerpc requests to a real forge.Forge implementation.
|
||||
type Server struct {
|
||||
Resolve func(context.Context, *workflow.Task) (forge.Forge, error)
|
||||
Runs Runs
|
||||
@@ -391,7 +390,7 @@ func (s *Server) respond(msg *nats.Msg, v any) {
|
||||
}
|
||||
|
||||
// Client calls the forgerpc Server from archie-agent's process. It
|
||||
// implements the four proxied methods of the Forge interface with matching
|
||||
// implements the four proxied forge.Forge methods with matching
|
||||
// signatures so it can be used as a drop-in for workflow stages.
|
||||
type Client struct {
|
||||
Conn *nats.Conn
|
||||
|
||||
@@ -27,7 +27,7 @@ func (r runsByToken) TaskForCredential(_ context.Context, token string) (*workfl
|
||||
return nil, errors.New("unknown")
|
||||
}
|
||||
|
||||
// TestForgeCallStaysInItsRunsAuthority pins that a forge call is authorised
|
||||
// TestForgeCallStaysInItsRunsAuthority pins that a forge call is authorized
|
||||
// only by a live run credential, on its identity's server, for its own
|
||||
// repository, and for a package's workflow only within the forge permissions
|
||||
// accepted for that package.
|
||||
|
||||
@@ -63,7 +63,7 @@ func CompressionConfigForModel(details ModelDetails, promptReserve int) (Compres
|
||||
cfg := DefaultCompressionConfig()
|
||||
if details.ContextWindow <= 0 {
|
||||
// ModelDetails is an optional extension on ModelManager. Preserve
|
||||
// compatibility for minimal adapters, while production catalogue-backed
|
||||
// compatibility for minimal adapters, while production catalog-backed
|
||||
// managers still take the model-specific path below.
|
||||
cfg.MaxPromptTokens = max(cfg.ContextWindow-max(promptReserve, 0), 1)
|
||||
return cfg, nil
|
||||
|
||||
@@ -52,7 +52,7 @@ type LLMStreamResponder func(ctx context.Context, in Inbound, stream TurnStream)
|
||||
|
||||
// ModelManager provides access to available models and allows switching the
|
||||
// active LLM model. The daemon supplies an implementation backed by its
|
||||
// runtime provider catalogue. When nil on a Router, /model returns a
|
||||
// runtime provider catalog. When nil on a Router, /model returns a
|
||||
// "not configured" message.
|
||||
type ModelManager interface {
|
||||
ModelsFor(ctx context.Context) ([]string, error)
|
||||
@@ -61,11 +61,11 @@ type ModelManager interface {
|
||||
SetActiveModel(ctx context.Context, selection string) error
|
||||
}
|
||||
|
||||
// ModelDetails is the catalogue metadata rendered after an interactive model
|
||||
// selection. Limits are zero when the upstream catalogue does not publish them.
|
||||
// ModelDetails is the catalog metadata rendered after an interactive model
|
||||
// selection. Limits are zero when the upstream catalog does not publish them.
|
||||
type ModelDetails = messaging.ModelDetails
|
||||
|
||||
// DetailedModelManager is the optional catalogue-aware extension used by rich
|
||||
// DetailedModelManager is the optional catalog-aware extension used by rich
|
||||
// model selectors. Runtime routing remains on ModelManager.
|
||||
type DetailedModelManager interface {
|
||||
ModelManager
|
||||
@@ -300,8 +300,8 @@ func (r *Router) route(ctx context.Context, in Inbound) (string, error) {
|
||||
return reply, err
|
||||
}
|
||||
|
||||
// dispatchLocal handles recognised local commands. Returns (reply,
|
||||
// true) when the command was recognised and handled.
|
||||
// dispatchLocal handles recognized local commands. Returns (reply,
|
||||
// true) when the command was recognized and handled.
|
||||
func (r *Router) dispatchLocal(ctx context.Context, msg messaging.Message, platform, text, cmd string) (string, bool, error) {
|
||||
rest := restAfter(text, cmd, r.gatewayName)
|
||||
|
||||
@@ -344,7 +344,7 @@ func (r *Router) dispatchLocal(ctx context.Context, msg messaging.Message, platf
|
||||
return r.dispatchLocalMisc(ctx, msg, platform, cmd, rest)
|
||||
}
|
||||
|
||||
// dispatchLocalMisc handles the remaining recognised local commands not
|
||||
// dispatchLocalMisc handles the remaining recognized local commands not
|
||||
// covered by dispatchLocal's first switch. Split out to keep cyclomatic
|
||||
// complexity down.
|
||||
func (r *Router) dispatchLocalMisc(ctx context.Context, msg messaging.Message, platform, cmd, rest string) (string, bool, error) {
|
||||
@@ -861,7 +861,7 @@ func formatStatus(ctx context.Context, counts map[string]int, report HealthRepor
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// formatQueueDepth summarises in-flight work as one line: how many tasks
|
||||
// formatQueueDepth summarizes in-flight work as one line: how many tasks
|
||||
// are running, waiting on a human reply, or parked. Queued and terminal
|
||||
// states are excluded -- neither is a health concern an operator needs
|
||||
// /status to surface.
|
||||
|
||||
@@ -18,7 +18,7 @@ const (
|
||||
defaultSessionListLimit = 20
|
||||
|
||||
// maxSessionListLimit bounds what the model can ask for. A chat that has
|
||||
// churned for months could otherwise land its whole session catalogue in the
|
||||
// churned for months could otherwise land its whole session catalog in the
|
||||
// context window whole.
|
||||
maxSessionListLimit = 100
|
||||
|
||||
@@ -120,7 +120,7 @@ func sessionListTool(store SessionStore, platform, channelID string) tools.ToolE
|
||||
if len(all) > limit {
|
||||
all = all[:limit]
|
||||
}
|
||||
// Non-nil even when empty: an empty catalogue is an answer, and a
|
||||
// Non-nil even when empty: an empty catalog is an answer, and a
|
||||
// null would read to the model as a failed call worth retrying.
|
||||
sessions := make([]ChatSessionEntry, 0, len(all))
|
||||
for _, s := range all {
|
||||
@@ -361,7 +361,7 @@ func sessionTranscriptTool(store SessionStore, platform, channelID string) tools
|
||||
return nil, fmt.Errorf("session_transcript: %w", err)
|
||||
}
|
||||
|
||||
// Serialise to JSON
|
||||
// Serialize to JSON
|
||||
data, err := json.MarshalIndent(messages, "", " ")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("session_transcript: %w", err)
|
||||
|
||||
@@ -95,7 +95,7 @@ func splitOwnerRepo(s string) (owner, repo string, ok bool) {
|
||||
}
|
||||
|
||||
// ChatTaskStatus is the minimal task state StoreTaskController needs to
|
||||
// authorise and validate /approve and /cancel.
|
||||
// authorize and validate /approve and /cancel.
|
||||
type ChatTaskStatus struct {
|
||||
Status string
|
||||
Identity string
|
||||
|
||||
@@ -20,7 +20,7 @@ type TurnPrepareContext struct {
|
||||
Model string
|
||||
Extra []tools.ToolEntry
|
||||
ContextWindow int
|
||||
// Reasoning reports the catalogue's class for the active model. It rides
|
||||
// Reasoning reports the catalog's class for the active model. It rides
|
||||
// the prepare context because the seam that translates a provider-neutral
|
||||
// request into provider options is the only place that knows the wire
|
||||
// parameter differs by class.
|
||||
@@ -115,10 +115,10 @@ type TurnRunnerConfig struct {
|
||||
// in prepareTurn. Nil disables the <memory> block entirely (renderMemory
|
||||
// treats a nil store the same as a failed read).
|
||||
MemoryEngine MemoryStore
|
||||
// MemoryWriter is the write surface the per-turn memory tools use to
|
||||
// build memory_create/memory_update/memory_delete/memory_list. Nil omits
|
||||
// those tools entirely (MemoryTools treats a nil store the same as a
|
||||
// subject with no writable scope: no tools registered).
|
||||
// MemoryWriter is the write surface the per-turn memory tool (slice 4)
|
||||
// uses to build memory_create/memory_update/memory_delete/memory_list.
|
||||
// Nil omits those tools entirely (MemoryTools treats a nil store the
|
||||
// same as a subject with no writable scope: no tools registered).
|
||||
MemoryWriter MemoryWriteStore
|
||||
// UserIdentity resolves the sending user's identity for an inbound message.
|
||||
// False or nil means no per-user memory scope.
|
||||
|
||||
@@ -22,9 +22,9 @@ const memoryRecordsPerScope = 20
|
||||
const memoryBlockByteCap = 8192
|
||||
|
||||
// MemoryStore is the read surface prepareTurn needs from a memory engine: a
|
||||
// scope-only Query, nothing else. It is narrowed from domainmemory.Store, which
|
||||
// also carries the write operations, so this package's read path cannot
|
||||
// accidentally reach for Create/Update/Forget.
|
||||
// scope-only Query, nothing else. Narrowed from domainmemory.Store (which
|
||||
// also carries the write operations slice 4 uses) so this package's read
|
||||
// path cannot accidentally reach for Create/Update/Forget.
|
||||
type MemoryStore interface {
|
||||
Query(ctx context.Context, q domainmemory.Query) ([]domainmemory.Record, error)
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func (rc *Receiver) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Resolved before the delivery check so the check runs against the
|
||||
// source's owning org, not always the default org. An unknown source
|
||||
// authorises as the default org.
|
||||
// authorizes as the default org.
|
||||
src := rc.resolveSource(r, path)
|
||||
|
||||
if code := rc.refusal(r, path, orgOf(src)); code != 0 {
|
||||
@@ -191,7 +191,7 @@ func (rc *Receiver) refusal(r *http.Request, path string, owner org.OrgID) int {
|
||||
}
|
||||
|
||||
// orgOf reports the org that owns src, or the default org when the source
|
||||
// is unknown: an unknown source has no owner to authorise against.
|
||||
// is unknown: an unknown source has no owner to authorize against.
|
||||
func orgOf(src *source.Source) org.OrgID {
|
||||
if src == nil || src.OrgID == "" {
|
||||
return org.DefaultOrgID
|
||||
|
||||
@@ -91,7 +91,7 @@ func foldOverrides(cfg reflect.Value, doc map[string]any) (map[string]any, error
|
||||
}
|
||||
|
||||
// foldMapEntries returns one map field's override with each entry the overlay
|
||||
// names carried forward from the cfg entry with the same key.
|
||||
// names carried forward from the entry of the same key in cfg.
|
||||
func foldMapEntries(field reflect.Value, doc map[string]any) (map[string]any, error) {
|
||||
if field.IsNil() || field.Type().Key().Kind() != reflect.String {
|
||||
return doc, nil
|
||||
|
||||
@@ -255,7 +255,7 @@ func unregisteredServiceKeys(services config.Services) []string {
|
||||
|
||||
// sortedUnique returns keys sorted and de-duplicated, so Document.UnknownKeys
|
||||
// is deterministic across a base+overlay load that happens to name the same
|
||||
// stray key across both files.
|
||||
// stray key in both files.
|
||||
func sortedUnique(keys []string) []string {
|
||||
if len(keys) == 0 {
|
||||
return nil
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Edit sets one key within a TOML table. Table is a dotted path ("" for the
|
||||
// Edit sets one key in a TOML table. Table is a dotted path ("" for the
|
||||
// root). Value is a literal TOML value; see String and Ref.
|
||||
type Edit struct {
|
||||
Table string
|
||||
@@ -214,7 +214,7 @@ func (a *applier) uncommentKeys(table string, remaining map[string]bool) int {
|
||||
return headerLine
|
||||
}
|
||||
|
||||
// appendMissingKeys adds every key from remaining that no line in table
|
||||
// appendMissingKeys adds every key in remaining that no line in table
|
||||
// satisfied: after the table's last active line, after its header if it
|
||||
// only exists commented-out, or as a brand-new table block.
|
||||
func (a *applier) appendMissingKeys(table string, keys []string, remaining map[string]bool, headerLine int) {
|
||||
|
||||
@@ -100,7 +100,7 @@ func TestPutDraftAttributesTheCaller(t *testing.T) {
|
||||
|
||||
// TestStepTypesReadsTheServedVocabulary pins the catalogue's production
|
||||
// reader: StepTypes returns the x-step-types extension of the
|
||||
// workflow-definitions descriptor the control plane's catalogue serves, the
|
||||
// workflow-definitions descriptor the control plane's catalog serves, the
|
||||
// payload the dashboard workflow editor and the workflow_step_types tool
|
||||
// consume, and it reports an absent catalogue or an unavailable control
|
||||
// plane rather than inventing an empty one.
|
||||
|
||||
@@ -47,8 +47,9 @@ func seedForgeConnections(cfg config.Config) any {
|
||||
return out
|
||||
}
|
||||
|
||||
// connectionDisplayName is the label an operator sees: the host it points at,
|
||||
// because the host tells one connection from another. The file never named the
|
||||
// connectionDisplayName is the label an operator sees, so it names the thing
|
||||
// that tells one connection from another -- the host it points at -- rather
|
||||
// than the archie concept it was migrated from. The file never named the
|
||||
// forge, so there is nothing better to carry over.
|
||||
func connectionDisplayName(cfg config.Forge) string {
|
||||
host := strings.TrimSpace(cfg.Host)
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestInstanceOnlyKindsRefuseOtherOrgs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestCatalogHidesInstanceOnlyKinds pins what the catalogue advertises: the
|
||||
// TestCatalogHidesInstanceOnlyKinds pins what the catalog advertises: the
|
||||
// system org sees an instance setting, another org does not (its write would
|
||||
// be refused), and an org-scoped kind stays visible to both.
|
||||
func TestCatalogHidesInstanceOnlyKinds(t *testing.T) {
|
||||
|
||||
@@ -44,7 +44,7 @@ func operationalDefinitions() []Definition {
|
||||
// Restart-required: the Messaging Service, which owns the channel
|
||||
// transports, reconciles them live and archied re-layers each update, but
|
||||
// the Gateway's chat surfaces (workspace tools, rate limit, model
|
||||
// catalogues) are boot-built, so a change cannot promise live apply
|
||||
// catalogs) are boot-built, so a change cannot promise live apply
|
||||
// everywhere the record reports it.
|
||||
{Kind: ChannelSettingsKind, Title: "Channel settings", ApplyMode: "restart-required", Document: channelSettings{}, Seed: seedChannels, Validate: validateChannels, Normalize: normalizeChannels},
|
||||
{Kind: SchedulingPolicyKind, Title: "Scheduling policy", ApplyMode: "live", Document: schedulingPolicy{}, Seed: func(cfg config.Config) any {
|
||||
|
||||
@@ -35,7 +35,7 @@ type CalloutOptions struct {
|
||||
Tasks TaskAuthority
|
||||
}
|
||||
|
||||
// Callout is the authorisation service of an external broker.
|
||||
// Callout is the authorization service of an external broker.
|
||||
type Callout struct {
|
||||
svc *callout.AuthorizationService
|
||||
nc *natsio.Conn
|
||||
|
||||
@@ -61,7 +61,7 @@ func StartEmbedded(ctx context.Context, opts EmbeddedOptions, log *slog.Logger)
|
||||
Port: opts.Port,
|
||||
JetStream: true,
|
||||
StoreDir: opts.StoreDir,
|
||||
// Replaces token authorisation: the instance token and task users
|
||||
// Replaces token authorization: the instance token and task users
|
||||
// are both checked here.
|
||||
CustomClientAuthentication: authenticator{token: token, tasks: opts.Tasks},
|
||||
NoSigs: true, // the daemon owns signals, not the embedded server
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Package forgeext adapts a forge extension, served over the forge.v1 gRPC
|
||||
// surface, to the host's Forge interface. One extension process serves one
|
||||
// surface, to the host's forge.Forge. One extension process serves one
|
||||
// configured forge instance.
|
||||
package forgeext
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ func (p *pendingAsks) answer(id, answer string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// remoteAsker poses a turn's questions on its stream. send is serialised with
|
||||
// remoteAsker poses a turn's questions on its stream. send is serialized with
|
||||
// the turn's own frames by the caller.
|
||||
type remoteAsker struct {
|
||||
pending *pendingAsks
|
||||
|
||||
@@ -43,7 +43,7 @@ type CuratorAction struct {
|
||||
}
|
||||
|
||||
// Catalog supplies the process-owned runtime surfaces the dashboard reads over
|
||||
// ChatService. A zero Catalogue answers empty lists and an Unavailable reload,
|
||||
// ChatService. A zero Catalog answers empty lists and an Unavailable reload,
|
||||
// which is the honest answer from a process that hosts none of them.
|
||||
type Catalog struct {
|
||||
// CheckSecret reports whether ref resolves; an error means the engine
|
||||
@@ -55,7 +55,7 @@ type Catalog struct {
|
||||
ReloadChannel func(context.Context, string) error
|
||||
}
|
||||
|
||||
// CatalogClient is the subset of the Gateway client the dashboard's catalogue
|
||||
// CatalogClient is the subset of the Gateway client the dashboard's catalog
|
||||
// surfaces consume.
|
||||
type CatalogClient interface {
|
||||
CheckSecret(context.Context, secret.SecretRef) (bool, error)
|
||||
|
||||
@@ -30,9 +30,9 @@ type server struct {
|
||||
fetch *http.Client
|
||||
}
|
||||
|
||||
// RegisterServer serves the Gateway chat contract. catalogue supplies the
|
||||
// RegisterServer serves the Gateway chat contract. catalog supplies the
|
||||
// process-owned runtime surfaces (skill catalogue, curator registry, channel
|
||||
// reload) the dashboard reads over the same contract; a zero Catalogue answers
|
||||
// reload) the dashboard reads over the same contract; a zero Catalog answers
|
||||
// empty lists and an Unavailable reload.
|
||||
func RegisterServer(registrar grpc.ServiceRegistrar, chat messaging.ChatContract, sessions messaging.SessionStore, catalog Catalog) {
|
||||
pb.RegisterChatServiceServer(registrar, &server{chat: chat, sessions: sessions, catalog: catalog, fetch: publicnet.Client(10*time.Second, 15*time.Second)})
|
||||
|
||||
@@ -107,14 +107,14 @@ func (s *Store) MaxBytes() int {
|
||||
return s.maxBytes
|
||||
}
|
||||
|
||||
// Render returns the current serialised document. Safe for concurrent use.
|
||||
// Render returns the current serialized document. Safe for concurrent use.
|
||||
func (s *Store) Render() string {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
return renderSections(s.preamble, s.sections)
|
||||
}
|
||||
|
||||
// Size returns the current serialised document length in bytes.
|
||||
// Size returns the current serialized document length in bytes.
|
||||
func (s *Store) Size() int {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
@@ -267,7 +267,7 @@ func (s *Store) Remove(sectionName, substring string, caseSensitive bool) (Remov
|
||||
rendered := renderSections(s.preamble, candidate)
|
||||
// Removal only ever shrinks the file, but a bound check is kept for
|
||||
// consistency with Add/Replace and to guard against pathological
|
||||
// preamble/header growth from re-serialisation.
|
||||
// preamble/header growth from re-serialization.
|
||||
if len(rendered) > s.maxBytes {
|
||||
return RemoveResult{}, fmt.Errorf("builtin: remove from section %q would exceed max file size (%d > %d bytes)", sectionName, len(rendered), s.maxBytes)
|
||||
}
|
||||
@@ -350,7 +350,7 @@ func splitBlocks(lines []string) []string {
|
||||
return blocks
|
||||
}
|
||||
|
||||
// renderSections serialises a preamble and ordered sections back into the
|
||||
// renderSections serializes a preamble and ordered sections back into the
|
||||
// on-disk markdown format.
|
||||
func renderSections(preamble string, sections []*section) string {
|
||||
var sb strings.Builder
|
||||
@@ -383,7 +383,7 @@ func renderSections(preamble string, sections []*section) string {
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
// sectionChars returns the serialised character count of a single section's
|
||||
// sectionChars returns the serialized character count of a single section's
|
||||
// body (blocks only, joined as they would appear on disk).
|
||||
func sectionChars(sec *section) int {
|
||||
return len(strings.Join(sec.blocks, "\n\n"))
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/secret"
|
||||
)
|
||||
|
||||
// RefreshInterval is how often a running service re-reads the catalogue.
|
||||
// RefreshInterval is how often a running service re-reads the catalog.
|
||||
const RefreshInterval = time.Hour
|
||||
|
||||
// Catalog holds the last model catalogue a service loaded.
|
||||
// Catalog holds the last model catalog a service loaded.
|
||||
type Catalog struct {
|
||||
cachePath string
|
||||
|
||||
@@ -23,7 +23,7 @@ type Catalog struct {
|
||||
snapshot Snapshot
|
||||
}
|
||||
|
||||
// NewCatalog caches the catalogue beside the config file at cfgPath.
|
||||
// NewCatalog caches the catalog beside the config file at cfgPath.
|
||||
func NewCatalog(cfgPath string) *Catalog {
|
||||
return &Catalog{cachePath: filepath.Join(filepath.Dir(cfgPath), "models.json")}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ func (c *Catalog) Set(snapshot Snapshot) {
|
||||
c.snapshot = snapshot
|
||||
}
|
||||
|
||||
// Fetch reads the catalogue, resolving provider keys through getenv.
|
||||
// Fetch reads the catalog, resolving provider keys through getenv.
|
||||
func (c *Catalog) Fetch(ctx context.Context, getenv func(string) string, configured map[string]config.Provider) (Snapshot, error) {
|
||||
return Load(ctx, Options{CachePath: c.cachePath, Getenv: getenv, Configured: configured})
|
||||
}
|
||||
@@ -63,8 +63,8 @@ func Every(ctx context.Context, interval time.Duration, fn func()) {
|
||||
}()
|
||||
}
|
||||
|
||||
// Apply layers the catalogue's providers and model limits under cfg's
|
||||
// own and returns the catalogue's model references, sorted.
|
||||
// Apply layers the catalog's providers and model limits under cfg's
|
||||
// own and returns the catalog's model references, sorted.
|
||||
func Apply(cfg *config.Config, snapshot Snapshot) []string {
|
||||
discovered := make(map[string]config.Provider, len(snapshot.Providers))
|
||||
limits := make(map[string]config.ModelLimits)
|
||||
|
||||
@@ -51,8 +51,8 @@ type Model struct {
|
||||
Cost Cost
|
||||
}
|
||||
|
||||
// Cost is a model's list price in USD per million tokens, as the catalogue
|
||||
// publishes it. A zero field means the catalogue published no price.
|
||||
// Cost is a model's list price in USD per million tokens, as the catalog
|
||||
// publishes it. A zero field means the catalog published no price.
|
||||
type Cost struct {
|
||||
Input float64 `json:"input,omitempty"`
|
||||
Output float64 `json:"output,omitempty"`
|
||||
@@ -78,7 +78,7 @@ func Load(ctx context.Context, opts Options) (Snapshot, error) {
|
||||
snapshot, parseErr := parse(raw, opts)
|
||||
if parseErr == nil {
|
||||
if opts.CachePath != "" {
|
||||
// The downloaded catalogue is already usable. A cache persistence
|
||||
// The downloaded catalog is already usable. A cache persistence
|
||||
// failure must not prevent startup with valid in-memory data.
|
||||
_ = writeCache(opts.CachePath, raw)
|
||||
}
|
||||
@@ -182,8 +182,8 @@ func usableProvider(key string, source catalogProvider, opts Options) (Provider,
|
||||
// providerCredentialEnv returns the environment variable whose value is the
|
||||
// provider's key, and whether the provider may be served at all. A configured
|
||||
// provider is disabled when its key failed to resolve and must never fall
|
||||
// back to the catalogue's ambient environment, which would send a turn with a
|
||||
// key the operator did not choose: the catalogue names the environment
|
||||
// back to the catalog's ambient environment, which would send a turn with a
|
||||
// key the operator did not choose: the catalog names the environment
|
||||
// variables it would use, and a configured provider overrides that with the
|
||||
// variable its own resolution exported.
|
||||
func providerCredentialEnv(configured bool, override config.Provider, source catalogProvider, getenv func(string) string) (string, bool) {
|
||||
|
||||
@@ -12,7 +12,7 @@ func envFrom(values map[string]string) func(string) string {
|
||||
return func(name string) string { return values[name] }
|
||||
}
|
||||
|
||||
// modelProvider is one catalogue entry shaped so usableProvider keeps it: it
|
||||
// modelProvider is one catalog entry shaped so usableProvider keeps it: it
|
||||
// drops any provider with no tool-calling model.
|
||||
func modelProvider(env []string) catalogProvider {
|
||||
return catalogProvider{
|
||||
@@ -96,7 +96,7 @@ func TestUsableProviderCredentials(t *testing.T) {
|
||||
|
||||
// TestMergeProvidersKeepsDisabled covers the other half of a disabled
|
||||
// provider's lifetime: Apply rewrites cfg.Providers through mergeProviders,
|
||||
// and a dropped flag would let the next catalogue refresh serve the ambient key
|
||||
// and a dropped flag would let the next catalog refresh serve the ambient key
|
||||
// again.
|
||||
func TestMergeProvidersKeepsDisabled(t *testing.T) {
|
||||
merged := mergeProviders(
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/identity"
|
||||
)
|
||||
|
||||
// Flow runs the authorisation code flow with PKCE, so a person signs in at the
|
||||
// Flow runs the authorization code flow with PKCE, so a person signs in at the
|
||||
// provider and the dashboard learns who they are without archie ever seeing a
|
||||
// password, holding a session, or writing any of the protocol itself: discovery,
|
||||
// the code exchange, PKCE and token verification are the libraries'.
|
||||
|
||||
@@ -122,7 +122,7 @@ func (s *Store) ResolveLegacyName(ctx context.Context, name string) (identity.Id
|
||||
// Create inserts a new identity, its display-name alias and its create audit
|
||||
// event in one transaction. An agent is assigned in the same transaction to
|
||||
// the org the request acts in, with the shipped developer role, so it is
|
||||
// authorised as soon as it exists.
|
||||
// authorized as soon as it exists.
|
||||
func (s *Store) Create(ctx context.Context, value identity.Identity, audit identity.Audit) (identity.Identity, error) {
|
||||
return s.create(ctx, value, audit, value.Kind.Agent())
|
||||
}
|
||||
|
||||
@@ -154,8 +154,8 @@ func TestSchemaStatements(t *testing.T) {
|
||||
}
|
||||
|
||||
// Every statement that mentions the runtime role must be a row-level grant
|
||||
// or a default privilege: nothing may let it create, own, truncate or raise
|
||||
// its privileges.
|
||||
// or a default privilege: nothing may let it create, own, truncate or
|
||||
// elevate.
|
||||
forbiddenForRuntime := []string{" CREATE ", " SUPERUSER", " CREATEDB", " CREATEROLE", " OWNER TO ", "TRUNCATE", "ALL PRIVILEGES"}
|
||||
for _, statement := range statements {
|
||||
if !strings.Contains(statement, runtime) {
|
||||
|
||||
Loaded 100 of 553 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user