@sigrun/sigrun 0.1.6 → 0.2.1

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 (137) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +445 -42
  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/schema.js +9 -2
  11. package/dist/blocks/validate.d.ts +73 -0
  12. package/dist/blocks/validate.js +57 -8
  13. package/dist/cli.js +26 -2
  14. package/dist/config.js +67 -1
  15. package/dist/extension.d.ts +230 -22
  16. package/dist/harness/ambient.js +39 -185
  17. package/dist/harness/blocks/entries.js +47 -0
  18. package/dist/harness/blocks/state.js +58 -0
  19. package/dist/harness/blocks/tools.js +274 -0
  20. package/dist/harness/boot.js +259 -20
  21. package/dist/harness/builtins.js +15 -11
  22. package/dist/harness/event-bus.js +105 -10
  23. package/dist/harness/identity/accounts.js +186 -0
  24. package/dist/harness/identity/groups.js +14 -0
  25. package/dist/harness/identity/index.js +13 -6
  26. package/dist/harness/identity/json-store.js +15 -4
  27. package/dist/harness/identity/setup-code-check.js +9 -0
  28. package/dist/harness/identity/tokens.js +28 -5
  29. package/dist/harness/identity/users.js +111 -12
  30. package/dist/harness/interactions.js +292 -136
  31. package/dist/harness/loader.js +271 -17
  32. package/dist/harness/packages.js +1 -1
  33. package/dist/harness/reserved-sections.js +21 -0
  34. package/dist/harness/seam-host.js +92 -6
  35. package/dist/harness/sections/context-files.js +1 -1
  36. package/dist/harness/settings.js +63 -2
  37. package/dist/harness/stores.js +241 -4
  38. package/dist/harness/user-services.js +391 -0
  39. package/dist/harness/user-tools.js +187 -0
  40. package/dist/harness/workspace.js +61 -57
  41. package/dist/jobs/fire.js +10 -16
  42. package/dist/sandbox/availability.js +211 -0
  43. package/dist/sandbox/command-observer.js +59 -0
  44. package/dist/sandbox/grants.js +159 -0
  45. package/dist/sandbox/helper.js +29 -0
  46. package/dist/sandbox/isolation.js +29 -0
  47. package/dist/sandbox/launch.js +31 -0
  48. package/dist/sandbox/os-account.js +49 -0
  49. package/dist/sandbox/policy.js +274 -0
  50. package/dist/sandbox/pool.js +548 -0
  51. package/dist/sandbox/protocol.js +167 -0
  52. package/dist/sandbox/sandboxed-env.js +245 -0
  53. package/dist/sandbox/unavailable-env.js +49 -0
  54. package/dist/sandbox/worker.js +261 -0
  55. package/dist/serve.js +213 -25
  56. package/dist/server/auth/access-principal.js +16 -0
  57. package/dist/server/auth/pipeline.js +99 -36
  58. package/dist/server/blocks/answers.js +94 -0
  59. package/dist/server/blocks/chat-surfaces.js +393 -0
  60. package/dist/server/blocks/notes.js +216 -0
  61. package/dist/server/blocks/summaries.js +328 -0
  62. package/dist/server/commands.js +5 -0
  63. package/dist/server/content-parts-lazy.js +13 -0
  64. package/dist/server/conversation-handler.js +2 -5
  65. package/dist/server/conversation-ops.js +138 -37
  66. package/dist/server/helpers.js +18 -6
  67. package/dist/server/host-bridge.js +40 -20
  68. package/dist/server/images/cache.js +213 -0
  69. package/dist/server/images/convert.js +13 -0
  70. package/dist/server/images/fetch.js +302 -0
  71. package/dist/server/images/ranges.js +42 -0
  72. package/dist/server/images/rewrite.js +94 -0
  73. package/dist/server/images/sign.js +84 -0
  74. package/dist/server/images/sniff.js +62 -0
  75. package/dist/server/index.js +152 -4
  76. package/dist/server/login/flows.js +126 -0
  77. package/dist/server/login/http.js +31 -0
  78. package/dist/server/login/resolve.js +133 -0
  79. package/dist/server/login/setup-claim.js +55 -0
  80. package/dist/server/login/usernames.js +15 -0
  81. package/dist/server/notifications.js +21 -4
  82. package/dist/server/ownership.js +13 -0
  83. package/dist/server/routes/admin.js +58 -0
  84. package/dist/server/routes/auth.js +88 -2
  85. package/dist/server/routes/conversations.js +3 -6
  86. package/dist/server/routes/events.js +28 -3
  87. package/dist/server/routes/extensions.js +37 -5
  88. package/dist/server/routes/images.js +274 -0
  89. package/dist/server/routes/interactions.js +57 -68
  90. package/dist/server/routes/jobs.js +2 -8
  91. package/dist/server/routes/login.js +223 -0
  92. package/dist/server/routes/me.js +90 -0
  93. package/dist/server/routes/meta.js +19 -0
  94. package/dist/server/routes/onboarding.js +94 -84
  95. package/dist/server/routes/settings-sections.js +190 -0
  96. package/dist/server/routes/settings.js +16 -4
  97. package/dist/server/routes/submissions.js +1 -1
  98. package/dist/server/routes/surfaces.js +175 -23
  99. package/dist/server/routes/users.js +116 -20
  100. package/dist/server/schema-fixture.js +213 -0
  101. package/dist/server/session-meta.js +3 -0
  102. package/dist/server/shutdown.js +11 -4
  103. package/dist/server/static.js +18 -0
  104. package/dist/server/surfaces/dedup.js +9 -2
  105. package/dist/server/surfaces/service.js +181 -13
  106. package/dist/server/surfaces/settings-surfaces.js +597 -0
  107. package/dist/server/turns/submit-turn.js +26 -0
  108. package/dist/server/views.js +16 -0
  109. package/dist/settings/core-sections.js +532 -0
  110. package/dist/settings/pending.js +181 -0
  111. package/dist/settings/registry.js +453 -0
  112. package/dist/skills/index.js +6 -0
  113. package/node_modules/@sigrun/shared/CHANGELOG.md +11 -0
  114. package/node_modules/@sigrun/shared/dist/access.d.ts +4 -2
  115. package/node_modules/@sigrun/shared/dist/access.js +11 -4
  116. package/node_modules/@sigrun/shared/dist/ambient.d.ts +17 -74
  117. package/node_modules/@sigrun/shared/dist/ambient.js +8 -6
  118. package/node_modules/@sigrun/shared/dist/blocks/text.js +16 -2
  119. package/node_modules/@sigrun/shared/dist/blocks/transport.d.ts +4 -0
  120. package/node_modules/@sigrun/shared/dist/blocks/types.d.ts +21 -4
  121. package/node_modules/@sigrun/shared/dist/interactions.d.ts +22 -48
  122. package/node_modules/@sigrun/shared/dist/interactions.js +9 -7
  123. package/node_modules/@sigrun/shared/dist/settings.d.ts +27 -2
  124. package/node_modules/@sigrun/shared/dist/themes.d.ts +2 -3
  125. package/node_modules/@sigrun/shared/dist/themes.js +2 -3
  126. package/node_modules/@sigrun/shared/dist/turns.d.ts +14 -0
  127. package/node_modules/@sigrun/shared/dist/turns.js +53 -3
  128. package/node_modules/@sigrun/shared/dist/views.d.ts +202 -12
  129. package/node_modules/@sigrun/shared/dist/views.js +16 -0
  130. package/node_modules/@sigrun/shared/package.json +1 -1
  131. package/package.json +13 -9
  132. package/webui/dist/assets/index-SO2W4jjk.js +55 -0
  133. package/webui/dist/assets/index-yqkL6BSS.css +1 -0
  134. package/webui/dist/index.html +2 -2
  135. package/CONTEXT.md +0 -163
  136. package/webui/dist/assets/index-CiYInlLx.css +0 -1
  137. package/webui/dist/assets/index-JDfOQV9z.js +0 -52
package/CHANGELOG.md CHANGED
@@ -7,6 +7,198 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.1] - 2026-10-28
11
+
12
+ ### Added
13
+ - `GET /v1/meta` now reports the effective listener: `listener.host`,
14
+ `listener.port`, and `listener.families` — the address families the
15
+ live listener accepts, measured once at listen (the `::` wildcard
16
+ probes both loopbacks and reports exactly the families that connect;
17
+ a hostname bind reports the bound socket's family, never a concrete
18
+ peer address). Additive wire field: pre-upgrade servers omit
19
+ `listener`; clients consuming it must tolerate its absence.
20
+ - `SIGRUN_LISTEN_HOST` is now honored as the environment equivalent of
21
+ the programmatic `serve({host})` option. One host value is resolved
22
+ at the serving boundary (`options.host` → `SIGRUN_LISTEN_HOST` → `::`)
23
+ and drives the bind AND both auth derivations — the previously split
24
+ defaults (the boot auth derivation's independent env read, and the
25
+ harness-side `0.0.0.0` fallback) are gone.
26
+ - Proxy-auth rejections (401) now log one sanitized `warn` per rejected
27
+ request: the socket peer, the method, a short reason (`untrusted
28
+ proxy`, `missing or wrong shared secret`, `missing identity header`,
29
+ `untrusted identity source`), and the resolved route template — never
30
+ tokens, cookies, identity-header values, query strings, or the full
31
+ URL. Token-auth failures and successful proxy authentications stay
32
+ silent.
33
+ - The normal core build now emits real `dist/blocks/**/*.d.ts`
34
+ declarations, including the `dist/blocks/index.d.ts` named by the
35
+ `@sigrun/sigrun/blocks` export. Pack/type-resolution coverage compiles
36
+ an external consumer against those declarations; extension consumers
37
+ no longer need an ambient block-module shim.
38
+
39
+ ### Fixed
40
+ - Successful `PUT /v1/me/extensions/:slug/settings` writes now publish
41
+ through the same post-commit settings-change seam as section saves:
42
+ one per-user failure-fence clear, one observing-extension reconciliation,
43
+ and the extension slug plus changed body keys. Invalid, unknown, and
44
+ otherwise rejected writes publish nothing; repeated successful writes
45
+ retain the existing notification semantics.
46
+ - `host.peekInteraction(conversationId, callId, context)`: a
47
+ non-consuming interaction inspection read beside
48
+ `snapshotInteraction`. It returns the same stored record projection
49
+ (secret values stay masked) but NEVER touches the one-shot raw-secret
50
+ delivery — safe to repeat for notifiers, outcome edits, and answer
51
+ correlation. `snapshotInteraction` remains the ONLY read that merges
52
+ and consumes an unread delivery, reserved for the interaction's
53
+ owning extension; its first-read/second-read semantics are unchanged.
54
+ - `NotificationEvent` is now a discriminated union (shared base plus
55
+ `interaction.pending` / `job.failed` / `run.settled` variants), and
56
+ the `run.settled` variant carries a structured
57
+ `outcome: { status: "answered" } | { status: "unanswered"; reason: string }`
58
+ translated directly from the host event's existing `outcome`/`reason`
59
+ (no second answer read, no inferred status). The other variants do
60
+ not gain the field; exhaustive narrowing on `type` now typechecks.
61
+
62
+ ### Fixed (continued)
63
+ - Restored per-user worker startup by placing the selected device paths
64
+ under read-only Landlock rules. Their ordinary I/O works, while
65
+ `/dev/shm` and writes outside workspace/home/tmp remain denied.
66
+ - Preserved composer text and attachments when a slow conversation-meta
67
+ restore resolves after a local edit or clear. The interaction visual
68
+ drain now covers required secrets and multi-step forms, and the visual
69
+ e2e gate passes all 163 cases.
70
+
71
+ ### Changed
72
+ - Settled-run notifications are truthful: an answered run keeps the
73
+ `"Reply ready"` title, while an unanswered run (model error, abort,
74
+ or a missing answer) is titled `"Run ended without a reply"` with the
75
+ settle reason appended to the body — a failed run no longer
76
+ masquerades as a ready reply. Recipient, dedup, and
77
+ `notifications.runSettled` gating are unchanged.
78
+
79
+ ## [0.2.0] - 2026-10-27
80
+ ### Added
81
+ - Per-user extension surface (multi-user M2): lifecycle events carry the
82
+ conversation owner; `stores.user(user)` provides per-user secrets,
83
+ settings, and data/state/cache paths; `/v1/me` exposes self-service
84
+ settings, secret-key management, and service status.
85
+ - Per-user tool publications (`perUserTools` and
86
+ `host.tools.setUserTools`) with `<slug>@<user>` registry entries,
87
+ owner-driven selection on create/fork/transfer and boot reconciliation.
88
+ Every tool is wrapped with a committed-owner execution check: selection
89
+ is convenience, not the authorization boundary.
90
+ - Per-user service processes (`userServices` and `services.connect`),
91
+ launched under the user's own sibling jail policy with idle stopping,
92
+ crash fencing, and lifecycle cleanup on deletion, quarantine, and
93
+ shutdown. Settings sections can use `scope: "user"` for personal
94
+ configuration.
95
+ - The §10.6 deletion sequence: transfer ownership and remove external
96
+ identity access, stop per-user execution and tool entries, emit
97
+ `userDeleted` while credential revocation remains possible, remove the
98
+ record, then delete per-user credentials, settings, and cache. Data and
99
+ state remain extension-owned.
100
+ - Multi-user login (M3b): extension-contributed `loginProviders` with
101
+ core-owned, single-use state and callback routes; first-login setup and
102
+ invite resolution with optional policy-gated auto-provisioning; webui
103
+ provider sign-in; and self-service account links that are never silently
104
+ re-pointed to another user.
105
+ - Gateway built-in: `@sigrun/ext-gateway` supervises channel adapters,
106
+ with pairing and self-linking, group conversations, live responses,
107
+ durable outbound delivery, agent tools, home notifications, and job
108
+ delivery. Enabled by default; operators can disable it with
109
+ `builtinExtensions.gateway: false`.
110
+ - Expiring, revocable browser sessions (`server.auth.sessionDays`, default
111
+ 30 days). A session can mint the user's API tokens; revoking it leaves
112
+ those tokens independent.
113
+ - Stored groups per authenticating source, effective group-derived admin,
114
+ and people-scoped group sharing. Groups refresh at the next login or
115
+ validated proxy request. The separately shipped `@sigrun/oauth`
116
+ package provides OIDC, GitHub, and Discord login providers.
117
+ - `@sigrun/oauth` is the fourth built-in extension. It loads by default,
118
+ resolves from core's dependencies, and supports the same disable,
119
+ replacement, and quarantine behavior as the other built-ins. The
120
+ `builtinExtensions.oauth` toggle defaults to true and is restart-required.
121
+ - Chat blocks (U5): an entry and state family plus `show`/`update` tools,
122
+ surface routes with authored change records, change notes before every
123
+ turn admission, block answers as `InputEntry` turns, transcript
124
+ rendering, and the webui and TUI transports.
125
+ - Interactions and ambient surfaces on block trees (U6): `{values}` answers
126
+ with write-only secrets, channel renderers, and the ambient
127
+ literal-content ruling.
128
+ - Images (U7): an HMAC-signed proxy, a rebinding-safe fetcher, an LRU cache
129
+ with `sharp` conversion, and CSP headers.
130
+
131
+ ### Changed
132
+ - Family versions move together to 0.2.0: `@sigrun/shared` 0.2.0
133
+ (surface, block, interaction, ambient, and settings-section wire types)
134
+ and `@sigrun/tui` 0.2.0 (chat-block transcripts, interaction and ambient
135
+ rendering, settings forms).
136
+ - Retired persisted `groupAdmin` in favor of stored groups; its user-wire
137
+ compatibility field is now derived and retained for one release.
138
+ - The execution jail (multi-user M1): per-user workers are Landlock-confined
139
+ and multi-user fails closed when the boundary is unavailable.
140
+
141
+ ### Fixed
142
+ - Kept the extension inventory available to non-admin clients while limiting
143
+ service status projections to admins; quarantine now removes per-user
144
+ tools as well as services.
145
+ - Preserved service crash fences across explicit stops and skipped the
146
+ per-user selection sweep when no per-user extensions are configured.
147
+
148
+ ### Security
149
+ - Added the opt-in Landlock kernel boundary suite for two-user execution
150
+ isolation, with a hard ABI 6+ CI gate and explicit local skip reasons.
151
+ Documented the isolation boundary, trusted-extension and resource limits,
152
+ kernel requirements, OS-account setup, and proxy trust posture.
153
+ The suite also covers abstract sockets, ptrace, worker lifecycle, IPC
154
+ descriptors, and privileged-runner osUser switching; outside-jail controls
155
+ distinguish Landlock denials from Yama or missing-capability conditions.
156
+
157
+ ## [0.1.7] - 2026-10-24
158
+
159
+ *Correction (2026-10-28): the original entry omitted substantial scope
160
+ that shipped in this release — the U4 settings rebuild, the M3a
161
+ account-link store and routes, and the accompanying `@sigrun/shared` /
162
+ `@sigrun/tui` settings-surface work. Those entries are restored below;
163
+ the Service-migration claim is also corrected (adding a secondary
164
+ family while retaining the primary is an in-place patch, not a
165
+ recreate).*
166
+
167
+ ### Added
168
+ - Core settings sections rebuilt on blocks (U4): one settings renderer
169
+ for webui and TUI, extension-declared sections, a `/v1/settings`
170
+ sections route, `pendingRestart` with an admin restart route,
171
+ live/restart metadata for every core key, label search, and
172
+ `settings.changed`/`onSettingsChanged`. The shared and TUI packages
173
+ carry the matching settings-surface and settings-form work (live
174
+ surface revs, default-on toggle handling, roster-driven tool
175
+ defaults, walk-based search).
176
+ - Account links (multi-user M3a): the core account-link store plus
177
+ routes to list and remove an account's linked external identities.
178
+
179
+ ### Fixed
180
+ - The deploy entry binds the dual-stack wildcard (`::`) instead of the
181
+ IPv4-only `0.0.0.0`. On a dual-stack pod whose Service is IPv6-only
182
+ (`ipFamilies: ["IPv6"]` — the default shape on a cluster with an
183
+ `fd00::/8` ClusterIP range) the EndpointSlice advertises only the
184
+ pod's IPv6 address; the gateway dialed it, got connection-refused,
185
+ and answered `upstream connect error or disconnect/reset before
186
+ headers. reset reason: remote connection failure` while the
187
+ IPv4-loopback probes kept the pod Ready. `::` accepts both families
188
+ (`net.ipv6.bindv6only` is 0 on Linux), matching every other workload
189
+ in a dual-stack cluster. The reported listen line brackets the host
190
+ (`http://[::]:3000`).
191
+
192
+ ### Changed
193
+ - The chart's main Service is `PreferDualStack` over `[IPv6, IPv4]`,
194
+ so it advertises both pod addresses regardless of the cluster's
195
+ default family. Adding a secondary family while retaining the
196
+ primary is an in-place patch (`spec.ipFamilies` gains the new
197
+ family); only changing the PRIMARY family requires recreation
198
+ (`spec.clusterIPs` is immutable). *Corrected 2026-10-28: the
199
+ original entry claimed every conversion is a recreate.*
200
+ - `sigrun run` (workstation mode) still binds `127.0.0.1` only.
201
+
10
202
  ## [0.1.6] - 2026-10-24
11
203
  ### Added
12
204
  - Extension surfaces: typed block rendering, actions and uploads, live