@sigrun/shared 0.0.0-stage → 0.1.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.
package/dist/views.js ADDED
@@ -0,0 +1,38 @@
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";
package/package.json CHANGED
@@ -1,6 +1,83 @@
1
1
  {
2
- "name": "@sigrun/shared",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@sigrun/shared",
3
+ "version": "0.1.0",
4
+ "description": "sigrun shared leaf package — theme tokens, turn/conversation shaping, and the channel wire types (pure leaf, zero dependencies)",
5
+ "type": "module",
6
+ "exports": {
7
+ "./themes": {
8
+ "types": "./dist/themes.d.ts",
9
+ "default": "./dist/themes.js"
10
+ },
11
+ "./conversations": {
12
+ "types": "./dist/conversations.d.ts",
13
+ "default": "./dist/conversations.js"
14
+ },
15
+ "./turns": {
16
+ "types": "./dist/turns.d.ts",
17
+ "default": "./dist/turns.js"
18
+ },
19
+ "./session-meta": {
20
+ "types": "./dist/session-meta.d.ts",
21
+ "default": "./dist/session-meta.js"
22
+ },
23
+ "./commands": {
24
+ "types": "./dist/commands.d.ts",
25
+ "default": "./dist/commands.js"
26
+ },
27
+ "./interactions": {
28
+ "types": "./dist/interactions.d.ts",
29
+ "default": "./dist/interactions.js"
30
+ },
31
+ "./ambient": {
32
+ "types": "./dist/ambient.d.ts",
33
+ "default": "./dist/ambient.js"
34
+ },
35
+ "./access": {
36
+ "types": "./dist/access.d.ts",
37
+ "default": "./dist/access.js"
38
+ },
39
+ "./settings": {
40
+ "types": "./dist/settings.d.ts",
41
+ "default": "./dist/settings.js"
42
+ },
43
+ "./views": {
44
+ "types": "./dist/views.d.ts",
45
+ "default": "./dist/views.js"
46
+ },
47
+ "./view-delta": {
48
+ "types": "./dist/view-delta.d.ts",
49
+ "default": "./dist/view-delta.js"
50
+ },
51
+ "./jobs": {
52
+ "types": "./dist/jobs.d.ts",
53
+ "default": "./dist/jobs.js"
54
+ }
55
+ },
56
+ "scripts": {
57
+ "build": "tsc -p tsconfig.build.json"
58
+ },
59
+ "devDependencies": {
60
+ "typescript": "^7.0.2"
61
+ },
62
+ "engines": {
63
+ "node": ">=22.19.0"
64
+ },
65
+ "files": [
66
+ "dist",
67
+ "CHANGELOG.md"
68
+ ],
69
+ "license": "MIT",
70
+ "repository": {
71
+ "type": "github",
72
+ "url": "git+https://github.com/sigrun-ai/sigrun.git",
73
+ "directory": "shared"
74
+ },
75
+ "bugs": {
76
+ "url": "https://github.com/sigrun-ai/sigrun/issues"
77
+ },
78
+ "homepage": "https://github.com/sigrun-ai/sigrun/tree/main/shared#readme",
79
+ "publishConfig": {
80
+ "access": "public",
81
+ "provenance": true
82
+ }
83
+ }