eleven / ocho Public

Clone
git clone https://amadan.net/eleven/ocho

Plain git — no account needed to clone.

Download

Download this file

1{
2 "description": "Views vectors: bot-created, thread-scoped data surfaces (docs/views.md). A view is schema+data, never code; these vectors pin the fold's clamping — payloads aren't sender-signed, so the fold re-validates every event regardless of what the sidecar checked. Source of truth: web/static/apps/views.js (the views system app).",
3 "app": "views",
4 "source": "web/static/apps/views.js",
5 "state_shape": { "views": [{ "id": "string", "title": "string (≤80)", "glyph": "string (≤4)", "items": [{ "id": "string", "title": "string (≤300)", "subtitle": "string (≤300)", "note": "string (≤500)", "url": "string (https only, ≤600, else \"\")", "accent": "bool" }], "by": "string (creator name)", "ts": "number (epoch ms)" }] },
6 "notes": [
7 "view.create upserts by id; view.update is a full replacement and NEVER creates (an update for an unknown id is a no-op).",
8 "Item ids are assigned positionally (i0, i1, …) when absent, so the schema's keyed list stays stable.",
9 "A non-https url (http:, javascript:, data:) folds to \"\" — the row renders but isn't tappable. The renderer re-checks the scheme at click time.",
10 "Items without a title are dropped; an event whose items all drop is a no-op. Max 50 items, 20 views per thread (oldest evicted), whole view ≤ 32KB.",
11 "Views are chat-silent: no chatMessage projection — the bot's reply (with its open_view chip) is the visible artifact."
12 ],
13 "vectors": [
14 {
15 "name": "view_create",
16 "description": "A bot creates a view of two issues; the second has no url and no explicit id.",
17 "initial_state": { "views": [] },
18 "event": {
19 "type": "view.create",
20 "id": "vw-1",
21 "title": "Top GitHub issues",
22 "glyph": "⬢",
23 "items": [
24 { "id": "412", "title": "Crash on login", "subtitle": "#412 · amy", "note": "Priority: urgent", "url": "https://github.com/o/r/issues/412", "accent": true },
25 { "title": "Dark mode flicker" }
26 ],
27 "name": "Eleven",
28 "ts": 1700000000000
29 },
30 "expected_state_update": {
31 "views": [
32 {
33 "id": "vw-1",
34 "title": "Top GitHub issues",
35 "glyph": "⬢",
36 "items": [
37 { "id": "412", "title": "Crash on login", "subtitle": "#412 · amy", "note": "Priority: urgent", "url": "https://github.com/o/r/issues/412", "accent": true },
38 { "id": "i1", "title": "Dark mode flicker", "subtitle": "", "note": "", "url": "", "accent": false }
39 ],
40 "by": "Eleven",
41 "ts": 1700000000000
42 }
43 ]
44 }
45 },
46 {
47 "name": "view_create_drops_unsafe_url",
48 "description": "A crafted event carrying a javascript: url folds with the url stripped — the row displays but never links.",
49 "initial_state": { "views": [] },
50 "event": {
51 "type": "view.create",
52 "id": "vw-2",
53 "title": "Links",
54 "items": [{ "id": "a", "title": "Click me", "url": "javascript:alert(1)" }],
55 "name": "Mallory",
56 "ts": 1700000001000
57 },
58 "expected_state_update": {
59 "views": [
60 {
61 "id": "vw-2",
62 "title": "Links",
63 "glyph": "",
64 "items": [{ "id": "a", "title": "Click me", "subtitle": "", "note": "", "url": "", "accent": false }],
65 "by": "Mallory",
66 "ts": 1700000001000
67 }
68 ]
69 }
70 },
71 {
72 "name": "view_create_same_id_replaces",
73 "description": "Re-creating an existing id replaces the view in place (a bot refreshing its data).",
74 "initial_state": {
75 "views": [
76 { "id": "vw-1", "title": "Old", "glyph": "", "items": [{ "id": "x", "title": "Stale", "subtitle": "", "note": "", "url": "", "accent": false }], "by": "Eleven", "ts": 1700000000000 }
77 ]
78 },
79 "event": {
80 "type": "view.create",
81 "id": "vw-1",
82 "title": "Fresh",
83 "items": [{ "id": "y", "title": "New row" }],
84 "name": "Eleven",
85 "ts": 1700000002000
86 },
87 "expected_state_update": {
88 "views": [
89 {
90 "id": "vw-1",
91 "title": "Fresh",
92 "glyph": "",
93 "items": [{ "id": "y", "title": "New row", "subtitle": "", "note": "", "url": "", "accent": false }],
94 "by": "Eleven",
95 "ts": 1700000002000
96 }
97 ]
98 }
99 },
100 {
101 "name": "view_update_unknown_is_noop",
102 "description": "view.update never creates: an update for an id not in state leaves state untouched.",
103 "initial_state": { "views": [] },
104 "event": {
105 "type": "view.update",
106 "id": "vw-9",
107 "title": "Ghost",
108 "items": [{ "id": "a", "title": "Nope" }],
109 "name": "Eleven",
110 "ts": 1700000003000
111 },
112 "expected_state_update": { "views": [] }
113 },
114 {
115 "name": "view_create_untitled_is_noop",
116 "description": "An event with no usable title is hopeless and folds to a no-op.",
117 "initial_state": { "views": [] },
118 "event": {
119 "type": "view.create",
120 "id": "vw-3",
121 "title": "",
122 "items": [{ "id": "a", "title": "Row" }],
123 "name": "Eleven",
124 "ts": 1700000004000
125 },
126 "expected_state_update": { "views": [] }
127 },
128 {
129 "name": "view_remove",
130 "description": "view.remove deletes by id.",
131 "initial_state": {
132 "views": [
133 { "id": "vw-1", "title": "Top GitHub issues", "glyph": "", "items": [{ "id": "a", "title": "Row", "subtitle": "", "note": "", "url": "", "accent": false }], "by": "Eleven", "ts": 1700000000000 }
134 ]
135 },
136 "event": { "type": "view.remove", "id": "vw-1" },
137 "expected_state_update": { "views": [] }
138 }
139 ]
140}
141