@sigrun/shared 0.4.1 → 0.5.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 (50) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/access.d.ts +60 -0
  3. package/dist/access.js +87 -0
  4. package/dist/ambient.d.ts +54 -0
  5. package/dist/ambient.js +25 -0
  6. package/dist/blocks/format.d.ts +28 -0
  7. package/dist/blocks/format.js +199 -0
  8. package/dist/blocks/icons.d.ts +12 -0
  9. package/dist/blocks/icons.js +64 -0
  10. package/dist/blocks/index.d.ts +25 -0
  11. package/dist/blocks/index.js +21 -0
  12. package/dist/blocks/instance.d.ts +29 -0
  13. package/dist/blocks/instance.js +51 -0
  14. package/dist/blocks/lttb.d.ts +16 -0
  15. package/dist/blocks/lttb.js +67 -0
  16. package/dist/blocks/ops.d.ts +44 -0
  17. package/dist/blocks/ops.js +294 -0
  18. package/dist/blocks/text.d.ts +43 -0
  19. package/dist/blocks/text.js +804 -0
  20. package/dist/blocks/transport.d.ts +81 -0
  21. package/dist/blocks/transport.js +11 -0
  22. package/dist/blocks/types.d.ts +558 -0
  23. package/dist/blocks/types.js +17 -0
  24. package/dist/commands.d.ts +75 -0
  25. package/dist/commands.js +25 -0
  26. package/dist/conversations.d.ts +31 -0
  27. package/dist/conversations.js +94 -0
  28. package/dist/interactions.d.ts +65 -0
  29. package/dist/interactions.js +23 -0
  30. package/dist/jobs.d.ts +109 -0
  31. package/dist/jobs.js +19 -0
  32. package/dist/json.d.ts +20 -0
  33. package/dist/json.js +13 -0
  34. package/dist/live.d.ts +71 -0
  35. package/dist/live.js +82 -0
  36. package/dist/session-meta.d.ts +130 -0
  37. package/dist/session-meta.js +13 -0
  38. package/dist/settings.d.ts +449 -0
  39. package/dist/settings.js +19 -0
  40. package/dist/themes.d.ts +49 -0
  41. package/dist/themes.js +155 -0
  42. package/dist/turns.d.ts +133 -0
  43. package/dist/turns.js +247 -0
  44. package/dist/usernames.d.ts +8 -0
  45. package/dist/usernames.js +39 -0
  46. package/dist/view-delta.d.ts +54 -0
  47. package/dist/view-delta.js +135 -0
  48. package/dist/views.d.ts +1021 -0
  49. package/dist/views.js +54 -0
  50. package/package.json +3 -2
package/dist/views.js ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * §5 wire types (Tasks 9a–9d) — THE channel contract.
3
+ *
4
+ * Every HTTP/SSE payload shape both clients (webui, tui) consume is
5
+ * declared or re-exported here, and both import it directly (the tui
6
+ * imports from `@sigrun/shared`, never from server source). It is the
7
+ * intended basis for a generated OpenAPI schema later, so the purity
8
+ * rules are enforced by `test/views-purity.test.ts`:
9
+ *
10
+ * - imports and re-exports are `import type`/`export type` from SIBLING
11
+ * shared modules only, and type-only — they erase at compile time and
12
+ * contribute no runtime (the only runtime exports here are local pure
13
+ * constants);
14
+ * - no external package imports, no server/framework types, no route
15
+ * logic (the server's `src/server/views.ts` owns the RUNTIME
16
+ * serializer and re-exports this module);
17
+ * - no `node:` imports (the webui compiles DOM-only against this file).
18
+ *
19
+ * Spec §5: the server serves pi-durable's NATIVE views, not a bespoke
20
+ * endpoint list — so the conversation wire payload IS the view shape
21
+ * (`{ conversation, entries, docs }`; JSON-safe by construction) PLUS
22
+ * the sigrun-side `steer` field. The upstream view's inner shapes are
23
+ * re-declared STRUCTURALLY below (`ViewConversation`, `ViewEntry`,
24
+ * `ViewMessage`, `WireBlock`): deliberately loose where channels only
25
+ * read a subset, and structurally compatible with the upstream types so
26
+ * the server's serializer (which spreads an upstream
27
+ * `ConversationView`) typechecks against this declaration — the
28
+ * captured-schema fixture (`src/server/schema-fixture.ts`,
29
+ * `view-schema.json`) pins the UPSTREAM shape, and
30
+ * `test/schema-drift.test.ts` trips on upstream drift.
31
+ *
32
+ * `serializeConversationView` (src/server/views.ts) is the single
33
+ * chokepoint every §5 endpoint that returns a conversation goes through
34
+ * — including each SSE watch frame (T9d) — so the fixture continues to
35
+ * describe the wire.
36
+ */
37
+ /** The `Content-Type` of the JSONL export/import wire (Task 5b/5c). */
38
+ export const JSONL_CONTENT_TYPE = "application/x-ndjson";
39
+ /**
40
+ * The settings search's filter (UI-blocks U4 Task 4 round-2): the ONE
41
+ * implementation both channels run — the webui panel and the TUI view
42
+ * previously carried byte-identical copies, which drifted apart once
43
+ * (the TUI's lacked the key match). Case-insensitive over label + help
44
+ * + key; an empty query filters to nothing (the picker carries the
45
+ * full list).
46
+ */
47
+ export function filterSettingsIndex(index, query) {
48
+ const q = query.trim().toLowerCase();
49
+ if (q === "")
50
+ return [];
51
+ return index.filter((entry) => entry.label.toLowerCase().includes(q) ||
52
+ (entry.help ?? "").toLowerCase().includes(q) ||
53
+ (entry.key ?? "").toLowerCase().includes(q));
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigrun/shared",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "sigrun shared leaf package \u2014 theme tokens, turn/conversation shaping, and the channel wire types (pure leaf, zero dependencies)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -66,7 +66,8 @@
66
66
  }
67
67
  },
68
68
  "scripts": {
69
- "build": "tsc -p tsconfig.build.json"
69
+ "build": "tsc -p tsconfig.build.json",
70
+ "prepublishOnly": "npm run build"
70
71
  },
71
72
  "devDependencies": {
72
73
  "typescript": "^7.0.2"