@sigrun/sigrun 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +145 -7
  2. package/README.md +333 -13
  3. package/dist/blocks/build-stamp.json +13 -0
  4. package/dist/blocks/builders.d.ts +57 -0
  5. package/dist/blocks/images.d.ts +26 -0
  6. package/dist/blocks/index.d.ts +20 -0
  7. package/dist/blocks/limits.d.ts +25 -0
  8. package/dist/blocks/placements.d.ts +26 -0
  9. package/dist/blocks/schema.d.ts +38 -0
  10. package/dist/blocks/validate.d.ts +73 -0
  11. package/dist/cli.js +117 -19
  12. package/dist/config.js +21 -2
  13. package/dist/extension.d.ts +48 -8
  14. package/dist/harness/ambient.js +2 -0
  15. package/dist/harness/blocks/state.js +1 -0
  16. package/dist/harness/boot.js +92 -6
  17. package/dist/harness/builtins.js +1 -1
  18. package/dist/harness/context.js +25 -0
  19. package/dist/harness/event-bus.js +25 -14
  20. package/dist/harness/identity/accounts.js +3 -2
  21. package/dist/harness/identity/index.js +2 -1
  22. package/dist/harness/identity/invites.js +26 -9
  23. package/dist/harness/identity/link-sweep.js +47 -0
  24. package/dist/harness/identity/typed-username.js +15 -0
  25. package/dist/harness/identity/users.js +10 -7
  26. package/dist/harness/interactions.js +2 -0
  27. package/dist/harness/loader.js +57 -1
  28. package/dist/harness/migration-snapshot.js +97 -0
  29. package/dist/harness/reports.js +100 -0
  30. package/dist/harness/seam-host.js +23 -1
  31. package/dist/harness/sections/context-files.js +1 -1
  32. package/dist/harness/settings.js +52 -4
  33. package/dist/jobs/docs.js +3 -0
  34. package/dist/jobs/fire.js +2 -0
  35. package/dist/jobs/parked.js +38 -0
  36. package/dist/jobs/task.js +37 -8
  37. package/dist/sandbox/availability.js +69 -20
  38. package/dist/sandbox/launch.js +11 -0
  39. package/dist/sandbox/policy.js +24 -3
  40. package/dist/sandbox/worker.js +4 -24
  41. package/dist/serve.js +162 -40
  42. package/dist/server/auth/ip.js +9 -4
  43. package/dist/server/auth/own-host.js +115 -0
  44. package/dist/server/auth/pipeline.js +93 -28
  45. package/dist/server/auth/proxy-diagnostic.js +60 -0
  46. package/dist/server/auth/proxy-identity.js +134 -0
  47. package/dist/server/auth/proxy-only.js +28 -0
  48. package/dist/server/images/cache.js +13 -5
  49. package/dist/server/index.js +10 -2
  50. package/dist/server/login/resolve.js +88 -26
  51. package/dist/server/notifications.js +21 -4
  52. package/dist/server/routes/admin.js +97 -0
  53. package/dist/server/routes/images.js +16 -9
  54. package/dist/server/routes/login.js +8 -0
  55. package/dist/server/routes/me.js +1 -1
  56. package/dist/server/routes/meta.js +4 -0
  57. package/dist/server/routes/metrics.js +18 -2
  58. package/dist/server/routes/onboarding.js +97 -37
  59. package/dist/server/session-meta.js +1 -0
  60. package/dist/server/shutdown.js +93 -16
  61. package/dist/settings/registry.js +6 -0
  62. package/node_modules/@sigrun/shared/CHANGELOG.md +12 -0
  63. package/node_modules/@sigrun/shared/dist/settings.d.ts +14 -0
  64. package/node_modules/@sigrun/shared/dist/usernames.d.ts +8 -0
  65. package/node_modules/@sigrun/shared/dist/usernames.js +39 -0
  66. package/node_modules/@sigrun/shared/dist/views.d.ts +33 -4
  67. package/node_modules/@sigrun/shared/package.json +5 -1
  68. package/package.json +16 -15
  69. package/webui/dist/assets/{index-CxB969qp.js → index-CEOzj1C4.js} +11 -11
  70. package/webui/dist/index.html +1 -1
  71. package/CONTEXT.md +0 -163
  72. package/dist/server/login/usernames.js +0 -15
@@ -28,7 +28,7 @@
28
28
  if (accent) document.documentElement.dataset.accent = accent;
29
29
  } catch {}
30
30
  </script>
31
- <script type="module" crossorigin src="./assets/index-CxB969qp.js"></script>
31
+ <script type="module" crossorigin src="./assets/index-CEOzj1C4.js"></script>
32
32
  <link rel="stylesheet" crossorigin href="./assets/index-yqkL6BSS.css">
33
33
  </head>
34
34
  <body>
package/CONTEXT.md DELETED
@@ -1,163 +0,0 @@
1
- # Context: why sigrun exists
2
-
3
- > Companion to the sigrun specs in `docs/superpowers/specs/` (the *what*):
4
- > `2026-10-04-sigrun-core.md` (core, zero external dependencies),
5
- > `2026-10-04-sigrun-hermes-replacement.md` (parity extensions + cutover),
6
- > `2026-10-04-sigrun-improvements.md` (post-hermes capabilities). The original
7
- > `2026-10-02-sigrun.md` is superseded and retained as decision history (the numbered
8
- > decision record, App B 1–23, lives there; its deployment §6 was carried into the core
9
- > spec, so the three active specs stand alone).
10
- > This document is the *why* — what the assistant is for, what it replaces, and
11
- > the constraints that shaped it. Written 2026-10-02.
12
-
13
- ---
14
-
15
- ## 1. What sigrun replaces, and why
16
-
17
- The user has run `hermes-agent` (in-cluster, via the `hermes-pantheon`
18
- chart) plus `hermes-webui` as a personal assistant. The assistant is genuinely
19
- useful — the memory system especially — but the software has become a bad fit:
20
-
21
- - **It is heavy.** The local config is ~800 lines. After the 2026-09-25
22
- gateway-only cleanup, the overwhelming majority of it is dead: bedrock
23
- discovery, docker sandbox variants, personalities, Mixture-of-Agents presets,
24
- per-provider fallback plumbing, image-generation providers. The features that
25
- actually get used are a handful of tools, cron, memory, and the webui.
26
- - **The webui runs a second agent loop.** hermes-webui imports the hermes code
27
- and re-implements the agent loop independently of the primary CLI agent. Two
28
- loops, two state paths, one codebase that has to keep them in sync.
29
- - **The workspace went away.** When hermes ran locally in the same WSL instance
30
- as pi and opencode, everything shared a filesystem, and code written by pi was
31
- immediately visible to hermes. Moving hermes into the cluster bought
32
- always-on availability and lost that adjacency.
33
- - **It is not a good coding agent.** Attempts to use it as one produced poor
34
- results. Coding stays in pi.
35
-
36
- Sigrun keeps the parts that earn their place (memory, scheduled jobs,
37
- agentic maintenance tools, web research, the webui as the primary surface)
38
- and discards the rest by construction.
39
-
40
- ---
41
-
42
- ## 2. What the assistant is actually for
43
-
44
- Stated by the user, in their words:
45
-
46
- - **Research.** The most common use. "Go find out about X." Which naturally
47
- escalates:
48
- - **Research that turns into work.** If finding out about X reveals a tool to
49
- build or software to update, the assistant should open a ticket in Forgejo and
50
- hand the actual work to pi — not attempt the coding itself.
51
- - **Steering coding work from away from the desk.** Not doing the work, but
52
- being able to answer a pi session's questions or prompt it to continue while
53
- on a phone or laptop. Heavy lifting stays in pi inside herdr.
54
- - **Routine maintenance.** Existing cron jobs performing household and
55
- self-hosted-service maintenance. The user wants *more* of this and keeps
56
- not getting to it — calendar access, household context, and similar
57
- assistant-ish chores.
58
- - **Ambient awareness.** Ingesting data sources such as Discord logs so the user
59
- can catch up on what they missed, gauge community impressions of new models,
60
- and track events. Read-only to start.
61
- - **Memory.** Honcho is described as "incredibly valuable." Parity with the
62
- current honcho behavior is a v1 requirement, not an enhancement.
63
- - **Household multi-user, eventually.** "An agent that can assist my entire
64
- household has clear value," with guardrails around data sharing. Authelia is
65
- already the IdP, so this is an SP problem, not an identity problem.
66
-
67
- ---
68
-
69
- ## 3. Constraints that shaped the design
70
-
71
- ### 3.1 The workspace problem
72
-
73
- The single most concrete complaint. A shared workspace between agents was
74
- valuable and the cluster migration broke it. But running a whole-home assistant
75
- from a personal workstation is not a good answer either — the workstation sleeps,
76
- and the assistant should not.
77
-
78
- Resolution: the assistant's *core* lives in-cluster (always on, durable), and the
79
- *workspace* is resolved rather than fixed. Day one uses a static workspace
80
- configuration; the swap to dynamic resolution is a wrapper change, not a
81
- rewrite. The interaction surfaces (webui now, TUI and
82
- audio later) attach to the in-cluster core from anywhere over the tailnet.
83
-
84
- Precedent the user liked and lost: `opencode serve` on the workstation with
85
- `opencode attach` from any of three machines, working over the tailnet. That
86
- serve/attach model is exactly what a durable harness gives back — one long-lived
87
- process owning state, thin clients attaching.
88
-
89
- ### 3.2 pi-durable is the substrate
90
-
91
- Chosen because it is the only option that makes the "second agent loop" problem
92
- structurally impossible: the loop lives in the harness, and every surface
93
- (webui, TUI, cron trigger, future channels) is a client submitting to and
94
- watching conversations. It also brings crash survival and idempotent
95
- submissions (requestId dedup — exactly-once-across-crash semantics are
96
- pending M1 verification), which the current stack lacks.
97
-
98
- Known constraints accepted at choice time:
99
-
100
- - Experimental; the API changes between releases (`1.0.2` at spec time;
101
- pinned exactly, with a captured-schema drift fixture and an upgrade drill
102
- in the core spec).
103
- - One process owns a storage file at a time; no cross-process locking. Matches
104
- the single-harness design anyway.
105
-
106
- Resolved since the choice (2026-10-04 probes against the pinned package):
107
- image input **works** (base64 inline in submissions — verified live), and the
108
- async-approval mechanism works across crash+restart (`beforeTool` + durable
109
- memo — verified live). These were open questions at choice time; they are now
110
- verified facts recorded in the core spec's Appendix C.
111
-
112
- ### 3.3 Keep pi's philosophy
113
-
114
- The user's stated preference: **minimal core, well-defined interfaces for
115
- extensibility, and an ecosystem.** Their pi install is the proof it works — 19
116
- packages, each doing one thing, composed into a workflow.
117
-
118
- So sigrun is: a small harness, a webui, and a set of extensions that are
119
- individually replaceable. Not a platform.
120
-
121
- ### 3.4 The webui is the primary surface
122
-
123
- Called out twice in the design conversation. The plan is to take hermes-webui's
124
- UX shamelessly (three-panel layout, composer footer, tool cards, context ring)
125
- while replacing everything beneath it with thin client calls to the harness API
126
- — which is why the stack decision in the spec is *port the frontend, gated on a
127
- 60% reuse measurement*, with a rebuild as the documented fallback.
128
-
129
- ### 3.5 Cross-agent tools belong in the fabric, not the agent
130
-
131
- Hard-won: the assistant needs a work ledger that spans repositories and
132
- outlives any particular agent. If the kanban is a hermes plugin, moving to a
133
- different assistant means re-doing the integration. So cards live in the
134
- fabric's card system (skuld), and sigrun is just a client — as pi will be, as
135
- anything else will be.
136
-
137
- ---
138
-
139
- ## 4. What sigrun deliberately does not do
140
-
141
- - **Coding.** pi + herdr own that. Sigrun creates the ticket and the card.
142
- - **Provider management.** Bifrost already routes models with virtual keys,
143
- budgets, and failover chains. Sigrun points at one VK.
144
- - **Multi-user UI in v1.** The `owner` field exists; the auth flow does not.
145
- - **Write-side Discord, voice, generalized object memory.** Deferred, each with
146
- a documented seam so it can be added without redesign.
147
-
148
- ---
149
-
150
- ## 5. Names
151
-
152
- **sigrun** — a Norse valkyrie; a messenger/attendant figure. Chosen over:
153
-
154
- - **iris** — reads as the lesser-known female counterpart to hermes; the user
155
- disliked the implicit gender-flip construction.
156
- - **argus** — the watcher; also the guy hermes slew, which is an odd name for
157
- hermes's replacement.
158
- - Various scribe/messenger deities (thoth, seshat, ogma, muninn) — all already
159
- taken in the agent/AI space, several by direct competitors.
160
- - Norse fits: the bifrost gateway already lives in that mythology.
161
-
162
- **skuld** — held in reserve for the work-item side of the fabric ("that which
163
- shall become").
@@ -1,15 +0,0 @@
1
- /** Assign a new directory username; this never selects an existing user. */
2
- export function assignUsername(profile, subject, taken) {
3
- const candidate = profile.username ?? profile.email?.split("@", 1)[0] ?? subject;
4
- const base = candidate
5
- .toLowerCase()
6
- .replace(/[^a-z0-9._-]/g, "-")
7
- .replace(/^[^a-z0-9]+/, "") || "user";
8
- if (!taken(base))
9
- return base;
10
- for (let suffix = 2;; suffix++) {
11
- const candidateWithSuffix = `${base}-${suffix}`;
12
- if (!taken(candidateWithSuffix))
13
- return candidateWithSuffix;
14
- }
15
- }