@agentshouse/mdruntime-adapter 0.1.0-c8bfc1969f4fe → 0.1.0-c8c9697b9a064

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 (79) hide show
  1. package/README.md +2 -2
  2. package/dist/actions.d.ts +3 -2
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +26 -9
  5. package/dist/adapter.d.ts +0 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +121 -109
  8. package/dist/app-reference.d.ts +0 -1
  9. package/dist/authored-path.d.ts +10 -0
  10. package/dist/authored-path.d.ts.map +1 -0
  11. package/dist/authored-path.js +35 -0
  12. package/dist/chunks.d.ts +37 -0
  13. package/dist/chunks.d.ts.map +1 -0
  14. package/dist/chunks.js +254 -0
  15. package/dist/crockford.d.ts +0 -1
  16. package/dist/digest.d.ts +0 -1
  17. package/dist/discovery.d.ts +11 -6
  18. package/dist/discovery.d.ts.map +1 -1
  19. package/dist/discovery.js +39 -13
  20. package/dist/history.d.ts +1 -7
  21. package/dist/history.d.ts.map +1 -1
  22. package/dist/history.js +24 -30
  23. package/dist/house-model.d.ts +253 -366
  24. package/dist/house-model.d.ts.map +1 -1
  25. package/dist/house-model.js +237 -287
  26. package/dist/index.d.ts +6 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +5 -2
  29. package/dist/map.d.ts +0 -1
  30. package/dist/model.d.ts +5 -8
  31. package/dist/model.d.ts.map +1 -1
  32. package/dist/model.js +30 -18
  33. package/dist/read.d.ts +19 -10
  34. package/dist/read.d.ts.map +1 -1
  35. package/dist/read.js +46 -143
  36. package/dist/refusal.d.ts +3 -2
  37. package/dist/refusal.d.ts.map +1 -1
  38. package/dist/refusal.js +17 -7
  39. package/dist/room-types.d.ts +0 -3
  40. package/dist/room-types.d.ts.map +1 -1
  41. package/dist/room-types.js +53 -43
  42. package/dist/search.d.ts +4 -0
  43. package/dist/search.d.ts.map +1 -0
  44. package/dist/search.js +47 -0
  45. package/dist/session-content/bounds.d.ts +7 -0
  46. package/dist/session-content/check.d.ts +18 -0
  47. package/dist/session-content/index.d.ts +7 -0
  48. package/dist/session-content/parts.d.ts +102 -0
  49. package/dist/session-content/state.d.ts +61 -0
  50. package/dist/session-content/turn.d.ts +328 -0
  51. package/dist/site.d.ts +0 -1
  52. package/dist/site.d.ts.map +1 -1
  53. package/dist/site.js +47 -49
  54. package/dist/space-schema.d.ts +6 -0
  55. package/dist/space-schema.d.ts.map +1 -0
  56. package/dist/space-schema.js +18 -0
  57. package/dist/stream.d.ts +6 -5
  58. package/dist/stream.d.ts.map +1 -1
  59. package/dist/stream.js +133 -38
  60. package/dist/transport.d.ts +26 -23
  61. package/dist/transport.d.ts.map +1 -1
  62. package/dist/transport.js +13 -12
  63. package/dist/uncertain.d.ts +5 -0
  64. package/dist/uncertain.d.ts.map +1 -0
  65. package/dist/uncertain.js +11 -0
  66. package/dist/upload.d.ts +3 -2
  67. package/dist/upload.d.ts.map +1 -1
  68. package/dist/upload.js +8 -6
  69. package/dist/version.d.ts +0 -1
  70. package/dist/write.d.ts +2 -3
  71. package/dist/write.d.ts.map +1 -1
  72. package/dist/write.js +26 -41
  73. package/package.json +2 -2
  74. package/dist/part.d.ts +0 -14
  75. package/dist/part.d.ts.map +0 -1
  76. package/dist/part.js +0 -90
  77. package/dist/room-stream.d.ts +0 -19
  78. package/dist/room-stream.d.ts.map +0 -1
  79. package/dist/room-stream.js +0 -57
@@ -1,3 +1,4 @@
1
+ import { APP_PREFERENCES_HOME } from './authored-path.js';
1
2
  export const HOUSE_MODEL_DECLARATION = {
2
3
  $defs: {
3
4
  room: {
@@ -10,274 +11,262 @@ export const HOUSE_MODEL_DECLARATION = {
10
11
  type: 'string',
11
12
  pattern: '^a_([0123456789abcdefghjkmnpqrstvwxyz]+)\\.([0123456789abcdefghjkmnpqrstvwxyz])$',
12
13
  },
13
- document: {
14
- description: 'A document of a Room, by its file reference, under the key `document`.',
14
+ space: {
15
+ description: 'A Space, by its Space reference, under the key `space`.',
15
16
  type: 'string',
16
- pattern: '^af_([123456789abcdefghjkmnpqrstvwxyz][0123456789abcdefghjkmnpqrstvwxyz]*)\\.([0123456789abcdefghjkmnpqrstvwxyz])$',
17
+ pattern: '^sp_([0123456789abcdefghjkmnpqrstvwxyz]+)\\.([0123456789abcdefghjkmnpqrstvwxyz])$',
17
18
  },
18
19
  id: {
19
20
  description: 'Any other entity, by its identifier, under the key of its kind. An entity a type says more about is an object holding it under that key beside its facts.',
20
21
  type: 'string',
21
22
  format: 'uuid',
22
23
  },
23
- namespace: {
24
- description: 'The Namespace a grant entry covers, an App or a Room by its reference with the area of it.',
25
- type: 'string',
26
- maxLength: 512,
27
- pattern: '^(?:a_[A-Za-z0-9._-]+(?:\\/source)?|r_[A-Za-z0-9._-]+(?:\\/(?:settings|settings\\/schema|settings\\/model|settings\\/indexing|content))?)$',
28
- },
29
- trigger_test: {
30
- description: 'One test of a Trigger condition as the Trigger reference page writes one, a value compared at a `path` or `all`, `any` or `not` of tests.',
31
- type: 'object',
32
- additionalProperties: true,
33
- },
34
- trigger_values: {
35
- type: 'array',
36
- items: { anyOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }] },
37
- },
38
- trigger_scope: {
39
- description: 'The documents a Trigger condition watches, by `type`, by `folder` or one document at its `path`, which `create_trigger` takes as `document`.',
40
- type: 'object',
41
- additionalProperties: false,
42
- properties: {
43
- type: { type: 'string' },
44
- folder: { type: 'string' },
45
- path: { type: 'string' },
46
- },
47
- minProperties: 1,
48
- maxProperties: 1,
49
- },
50
24
  },
51
25
  'house-app-preferences': {
52
26
  description: "An App's preferences. Its own vocabulary is in the body.",
53
- properties: { app: { $ref: '#/$defs/app' } },
27
+ properties: { app: { title: 'App', $ref: '#/$defs/app' } },
54
28
  required: ['app'],
55
29
  },
56
30
  'house-notification': {
57
- description: "One kept Human Notification for this User: its kind, when it was sent as `created`, its way in, its email's subject and each fact of its value that is not sealed, named in snake_case. An entity a fact names is an object holding its identifier under the key of its kind, when the notification carries it, and its `name`, `email` and other facts beside it; a fact holding null is absent. `way_in` is either the House `path` it opens or the entity it is about, by its identifier under the key of its kind, a Trigger with its `room`. Its body is its email's words in Markdown. Both were worded once, in the User's language when it was delivered; an App may show them or word it itself from its kind and value. Read state belongs to each browser.",
31
+ description: "One kept Notification for this User: its kind, when it was sent as `created`, its way in, its email's subject and each fact of its value that is not sealed, named in snake_case. An entity a fact names is an object holding its identifier under the key of its kind, when the notification carries it, and its `name`, `email` and other facts beside it; a fact holding null is absent. `way_in` is either the House `path` it opens or the entity it is about, by its identifier under the key of its kind, a Trigger with its `room`. Its body is its email's words in Markdown. Both were worded once, in the User's language when it was delivered; an App may show them or word it itself from its kind and value. `read` is when the User opened it or marked it read, on any device: the one field House adds after delivery.",
58
32
  properties: {
59
- notification: { $ref: '#/$defs/id' },
33
+ notification: { title: 'Notification', $ref: '#/$defs/id' },
60
34
  kind: {
35
+ title: 'Kind',
61
36
  type: 'string',
62
37
  enum: [
63
38
  'share-offer',
64
39
  'join-request',
65
40
  'join-request-approved',
66
- 'app-room-binding-incompatible',
67
- 'app-deleted',
68
- 'app-call',
69
41
  'room-ownership-offer',
70
42
  'managed-environment-retention-opened',
71
- 'managed-environment-placement-intervention',
72
43
  'storage-full',
73
44
  'sandbox-budget-spent',
45
+ 'trigger-failed',
46
+ 'room-telegram-chat-paused',
74
47
  'break-glass-owner-disclosure',
75
- 'routine-start-approval-request',
76
- 'routine-request-declined',
77
- 'routine-request-started',
78
- 'routine-request-finished',
79
- 'routine-request-not-started',
80
48
  'export-ready',
81
49
  'export-failed',
82
- 'site-disabled',
83
- 'site-binding-incompatible',
84
- 'site-room-left',
85
- 'site-images-full',
86
50
  'custom',
87
- 'trigger-did-nothing',
88
- 'function-failed',
51
+ 'agent-function-request-finished',
89
52
  ],
90
53
  },
91
- created: { type: 'string', format: 'date-time' },
54
+ created: { title: 'Created', type: 'string', format: 'date-time' },
55
+ read: { title: 'Read', type: 'string', format: 'date-time' },
92
56
  way_in: {
57
+ title: 'Way in',
93
58
  type: 'object',
94
59
  additionalProperties: false,
95
60
  properties: {
96
- path: { type: 'string', pattern: '^\\/' },
97
- room: { $ref: '#/$defs/room' },
98
- app: { $ref: '#/$defs/app' },
99
- agent: { $ref: '#/$defs/id' },
100
- environment: { $ref: '#/$defs/id' },
101
- routine: { $ref: '#/$defs/id' },
102
- routine_request: { $ref: '#/$defs/id' },
103
- trigger: { $ref: '#/$defs/id' },
104
- site: { $ref: '#/$defs/id' },
61
+ path: { title: 'Path', type: 'string', pattern: '^\\/' },
62
+ room: { title: 'Room', $ref: '#/$defs/room' },
63
+ environment: { title: 'Environment', $ref: '#/$defs/id' },
64
+ trigger: { title: 'Trigger', $ref: '#/$defs/id' },
105
65
  },
106
66
  minProperties: 1,
107
67
  },
108
- subject: { type: 'string' },
109
- share: { $ref: '#/$defs/id' },
68
+ subject: { title: 'Subject', type: 'string' },
69
+ share: { title: 'Share', $ref: '#/$defs/id' },
110
70
  issuer: {
71
+ title: 'Issuer',
111
72
  type: 'object',
112
73
  additionalProperties: false,
113
- properties: { name: { type: 'string' }, email: { type: 'string', format: 'email' } },
74
+ properties: {
75
+ name: { title: 'Name', type: 'string' },
76
+ email: { title: 'Email', type: 'string', format: 'email' },
77
+ },
114
78
  required: ['name', 'email'],
115
79
  },
116
80
  rooms: {
81
+ title: 'Rooms',
117
82
  type: 'array',
118
83
  items: {
119
84
  type: 'object',
120
85
  additionalProperties: false,
121
- properties: { name: { type: 'string' } },
86
+ properties: { name: { title: 'Name', type: 'string' } },
122
87
  required: ['name'],
123
88
  },
124
89
  },
125
90
  apps: {
126
- maxItems: 20,
91
+ title: 'Apps',
127
92
  type: 'array',
128
93
  items: {
129
94
  type: 'object',
130
95
  additionalProperties: false,
131
96
  properties: {
132
- name: { type: 'string', minLength: 1, maxLength: 200 },
133
- reaches: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 512 } },
97
+ name: { title: 'Name', type: 'string', minLength: 1, maxLength: 200 },
98
+ reaches: {
99
+ title: 'Reaches',
100
+ type: 'array',
101
+ items: { type: 'string', minLength: 1, maxLength: 512 },
102
+ },
134
103
  },
135
104
  required: ['name', 'reaches'],
136
105
  },
137
106
  },
138
- expires_at: { type: 'string', format: 'date-time' },
139
- join_request: { $ref: '#/$defs/id' },
107
+ spaces: {
108
+ title: 'Spaces',
109
+ type: 'array',
110
+ items: {
111
+ type: 'object',
112
+ additionalProperties: false,
113
+ properties: { name: { title: 'Name', type: 'string' } },
114
+ required: ['name'],
115
+ },
116
+ },
117
+ expires_at: { title: 'Expires at', type: 'string', format: 'date-time' },
118
+ join_request: { title: 'Join request', $ref: '#/$defs/id' },
140
119
  user: {
120
+ title: 'User',
141
121
  type: 'object',
142
122
  additionalProperties: false,
143
- properties: { name: { type: 'string' }, email: { type: 'string', format: 'email' } },
144
- required: ['name', 'email'],
123
+ properties: {
124
+ name: { title: 'Name', type: 'string' },
125
+ email: { title: 'Email', type: 'string', format: 'email' },
126
+ },
127
+ required: ['name'],
145
128
  },
146
129
  room: {
130
+ title: 'Room',
147
131
  type: 'object',
148
132
  additionalProperties: false,
149
- properties: { room: { $ref: '#/$defs/room' }, name: { type: 'string' } },
133
+ properties: {
134
+ room: { title: 'Room', $ref: '#/$defs/room' },
135
+ name: { title: 'Name', type: 'string' },
136
+ },
150
137
  minProperties: 1,
151
138
  },
152
139
  app: {
140
+ title: 'App',
153
141
  type: 'object',
154
142
  additionalProperties: false,
155
- properties: { app: { $ref: '#/$defs/app' }, name: { type: 'string' } },
156
- minProperties: 1,
143
+ properties: { app: { title: 'App', $ref: '#/$defs/app' } },
144
+ required: ['app'],
157
145
  },
158
- binding: { $ref: '#/$defs/id' },
159
- slot: { type: 'string' },
160
- findings: { type: 'array', items: { type: 'string' } },
161
- owner: {
146
+ space: {
147
+ title: 'Space',
162
148
  type: 'object',
163
149
  additionalProperties: false,
164
- properties: { name: { type: 'string' } },
165
- required: ['name'],
150
+ properties: { space: { title: 'Space', $ref: '#/$defs/space' } },
151
+ required: ['space'],
166
152
  },
167
- caller: {
168
- type: 'object',
169
- additionalProperties: false,
170
- properties: { user: { $ref: '#/$defs/id' }, name: { type: 'string' } },
171
- required: ['user', 'name'],
172
- },
173
- ownership_offer: { $ref: '#/$defs/id' },
153
+ ownership_offer: { title: 'Ownership offer', $ref: '#/$defs/id' },
174
154
  offerer: {
155
+ title: 'Offerer',
175
156
  type: 'object',
176
157
  additionalProperties: false,
177
- properties: { name: { type: 'string' }, email: { type: 'string', format: 'email' } },
158
+ properties: {
159
+ name: { title: 'Name', type: 'string' },
160
+ email: { title: 'Email', type: 'string', format: 'email' },
161
+ },
178
162
  required: ['name', 'email'],
179
163
  },
180
164
  environment: {
165
+ title: 'Environment',
181
166
  type: 'object',
182
167
  additionalProperties: false,
183
168
  properties: {
184
- environment: { $ref: '#/$defs/id' },
185
- name: { type: 'string' },
186
- kind: { enum: ['vps', 'sandbox'] },
169
+ environment: { title: 'Environment', $ref: '#/$defs/id' },
170
+ name: { title: 'Name', type: 'string' },
171
+ kind: { title: 'Kind', enum: ['vps', 'sandbox'] },
187
172
  },
188
173
  required: ['environment', 'name'],
189
174
  },
190
- reason: { type: 'string' },
191
- deadline: { type: 'string', format: 'date-time' },
192
- operation_kind: { type: 'string' },
175
+ reason: { title: 'Reason', type: 'string' },
176
+ deadline: { title: 'Deadline', type: 'string', format: 'date-time' },
193
177
  free: {
178
+ title: 'Free',
194
179
  type: 'object',
195
180
  additionalProperties: false,
196
181
  properties: {
197
- held: { type: 'string', pattern: '^\\d+$' },
198
- limit: { type: 'string', pattern: '^[1-9]\\d*$' },
199
- measure: { type: 'string', enum: ['content', 'retained'] },
182
+ held: { title: 'Held', type: 'string', pattern: '^\\d+$' },
183
+ limit: { title: 'Limit', type: 'string', pattern: '^[1-9]\\d*$' },
184
+ measure: { title: 'Measure', type: 'string', enum: ['content', 'retained'] },
200
185
  },
201
186
  required: ['held', 'limit', 'measure'],
202
187
  },
203
- budget: { type: 'string', pattern: '^\\d+(?:\\.\\d+)?$' },
204
- resets_at: { type: 'string', format: 'date-time' },
205
- grant: { $ref: '#/$defs/id' },
206
- category: { type: 'string' },
207
- access_started_at: { type: 'string', format: 'date-time' },
208
- access_ended_at: { type: 'string', format: 'date-time' },
209
- systems: { type: 'array', items: { type: 'string' } },
210
- case_reference: { type: 'string' },
211
- routine_request: { $ref: '#/$defs/id' },
212
- requester: {
213
- type: 'object',
214
- additionalProperties: false,
215
- properties: { name: { type: 'string' } },
216
- required: ['name'],
217
- },
218
- agent: {
219
- type: 'object',
220
- additionalProperties: false,
221
- properties: { agent: { $ref: '#/$defs/id' }, name: { type: 'string' } },
222
- required: ['name'],
188
+ chat: { title: 'Chat', type: 'string' },
189
+ missing: {
190
+ title: 'Missing',
191
+ type: 'array',
192
+ items: {
193
+ type: 'string',
194
+ enum: [
195
+ 'private',
196
+ 'topics',
197
+ 'ban_users',
198
+ 'invite_users',
199
+ 'manage_topics',
200
+ 'post_messages',
201
+ 'edit_messages',
202
+ 'inbox_manage_topics',
203
+ 'inbox_delete_messages',
204
+ ],
205
+ },
223
206
  },
224
- conversation: { $ref: '#/$defs/id' },
225
- routine: {
207
+ budget: { title: 'Budget', type: 'string', pattern: '^\\d+(?:\\.\\d+)?$' },
208
+ resets_at: { title: 'Resets at', type: 'string', format: 'date-time' },
209
+ grant: { title: 'Grant', $ref: '#/$defs/id' },
210
+ category: { title: 'Category', type: 'string' },
211
+ access_started_at: { title: 'Access started at', type: 'string', format: 'date-time' },
212
+ access_ended_at: { title: 'Access ended at', type: 'string', format: 'date-time' },
213
+ systems: { title: 'Systems', type: 'array', items: { type: 'string' } },
214
+ case_reference: { title: 'Case reference', type: 'string' },
215
+ export: { title: 'Export', $ref: '#/$defs/id' },
216
+ size_bytes: { title: 'Size in bytes', type: 'integer', minimum: 0 },
217
+ title: { title: 'Title', type: 'string' },
218
+ body: { title: 'Body', type: 'string' },
219
+ authorship: {
220
+ title: 'Authorship',
226
221
  type: 'object',
227
222
  additionalProperties: false,
228
223
  properties: {
229
- routine: { $ref: '#/$defs/id' },
230
- name: { type: 'string' },
231
- version: { type: 'integer', minimum: 1 },
224
+ kind: { title: 'Kind', type: 'string', const: 'trigger-action' },
225
+ trigger: { title: 'Trigger', $ref: '#/$defs/id' },
226
+ position: { title: 'Position', type: 'integer', minimum: 0 },
232
227
  },
233
- required: ['name'],
228
+ required: ['kind', 'trigger', 'position'],
234
229
  },
235
- decliner: {
230
+ path: { title: 'Path', type: 'string', maxLength: 4096, pattern: '^\\/.*' },
231
+ trigger: {
232
+ title: 'Trigger',
236
233
  type: 'object',
237
234
  additionalProperties: false,
238
- properties: { name: { type: 'string' } },
239
- required: ['name'],
235
+ properties: {
236
+ trigger: { title: 'Trigger', $ref: '#/$defs/id' },
237
+ description: { title: 'Description', type: 'string' },
238
+ },
239
+ required: ['trigger', 'description'],
240
240
  },
241
- input: { type: 'string' },
242
- export: { $ref: '#/$defs/id' },
243
- size_bytes: { type: 'integer', minimum: 0 },
244
- site: {
245
- type: 'object',
246
- additionalProperties: false,
247
- properties: { site: { $ref: '#/$defs/id' }, name: { type: 'string' } },
248
- required: ['site', 'name'],
241
+ code: {
242
+ title: 'Code',
243
+ type: 'string',
244
+ enum: [
245
+ 'failed',
246
+ 'function_failed',
247
+ 'function_not_started',
248
+ 'agent_function_request_not_started',
249
+ ],
249
250
  },
250
- address: { type: 'string', maxLength: 300, format: 'uri' },
251
- to: {
251
+ action: { title: 'Action', type: 'integer', minimum: 0 },
252
+ moment: { title: 'Moment', type: 'string', format: 'date-time' },
253
+ error: { title: 'Error', type: 'string' },
254
+ agent_function: {
255
+ title: 'Agent function',
252
256
  type: 'object',
253
257
  additionalProperties: false,
254
- properties: { name: { type: 'string' } },
258
+ properties: { name: { title: 'Name', type: 'string' } },
255
259
  required: ['name'],
256
260
  },
257
- copies: { type: 'integer', minimum: 0 },
258
- bound: { type: 'integer', minimum: 0 },
259
- title: { type: 'string' },
260
- body: { type: 'string' },
261
- authorship: {
262
- type: 'object',
263
- additionalProperties: false,
264
- properties: {
265
- kind: { type: 'string', const: 'trigger-action' },
266
- trigger: { $ref: '#/$defs/id' },
267
- position: { type: 'integer', minimum: 0 },
268
- },
269
- required: ['kind', 'trigger', 'position'],
270
- },
271
- path: { type: 'string', maxLength: 4096, pattern: '^\\/.*' },
272
- trigger: {
261
+ agent: {
262
+ title: 'Agent',
273
263
  type: 'object',
274
264
  additionalProperties: false,
275
- properties: { trigger: { $ref: '#/$defs/id' }, name: { type: 'string' } },
276
- required: ['trigger', 'name'],
265
+ properties: { name: { title: 'Name', type: 'string' } },
266
+ required: ['name'],
277
267
  },
278
- cause: { type: 'string' },
279
- function: { type: 'string' },
280
- error: { type: 'string' },
268
+ ended: { title: 'Ended', type: 'string', enum: ['finished', 'failed'] },
269
+ duration: { title: 'Duration', type: 'integer', minimum: 1 },
281
270
  },
282
271
  required: ['notification', 'kind', 'created', 'way_in', 'subject'],
283
272
  },
@@ -285,121 +274,50 @@ export const HOUSE_MODEL_DECLARATION = {
285
274
  description: "The panel's preferences at /rooms/private/settings/panel.md. Its own vocabulary is in the body.",
286
275
  properties: {},
287
276
  },
288
- 'house-routine': {
289
- description: "One Routine that serves this Room, which House alone writes from its owner's document in their Private Room: the `routine` by identifier, its `description`, the `input` a caller sends, empty when it takes nothing, and the `agent` it starts, by `agent` and the `name` that Agent had when this card was last written. The Routine's instruction is never written here.",
277
+ 'house-agent-function': {
278
+ description: "One Agent function that serves this Room, which House alone writes from its owner's document in their Private Room: the `agent_function` by identifier, its `description`, the `input` a caller sends, empty when it takes nothing, and the `agent` it starts, by `agent` and the `name` that Agent had when this card was last written. The Agent function's instruction is never written here.",
290
279
  properties: {
291
- reflected: { type: 'string', format: 'date-time' },
292
- routine: { $ref: '#/$defs/id' },
293
- description: { type: 'string' },
294
- input: { type: 'string' },
280
+ reflected: { title: 'Reflected', type: 'string', format: 'date-time' },
281
+ agent_function: { title: 'Agent function', $ref: '#/$defs/id' },
282
+ description: { title: 'Description', type: 'string' },
283
+ input: { title: 'Input', type: 'string' },
295
284
  agent: {
285
+ title: 'Agent',
296
286
  type: 'object',
297
287
  additionalProperties: false,
298
- properties: { agent: { $ref: '#/$defs/id' }, name: { type: 'string' } },
288
+ properties: {
289
+ agent: { title: 'Agent', $ref: '#/$defs/id' },
290
+ name: { title: 'Name', type: 'string' },
291
+ },
299
292
  required: ['agent', 'name'],
300
293
  },
301
294
  },
302
- required: ['reflected', 'routine', 'description', 'input', 'agent'],
295
+ required: ['reflected', 'agent_function', 'description', 'input', 'agent'],
296
+ },
297
+ 'house-agent-function-document': {
298
+ description: 'One Agent function as its owner writes it in their Private Room at rooms/<room-handle>/agent-functions/<name>.md, a path that binds this type and a document that names no type: what it does as `description`, what a caller sends as `input`, empty when it takes nothing, the `agent` it starts, by identifier, and `afk`, true for a run nobody watches, off when absent. Its body is the instruction that Agent follows.',
299
+ properties: {
300
+ description: { title: 'Description', type: 'string', maxLength: 2000, pattern: '\\S' },
301
+ input: { title: 'Input', type: 'string' },
302
+ agent: { title: 'Agent', $ref: '#/$defs/id' },
303
+ afk: { title: 'AFK', type: 'boolean' },
304
+ },
305
+ required: ['description', 'input', 'agent'],
303
306
  },
304
307
  'house-trigger': {
305
- description: "One Trigger of this Room as its acts wrote it, which House alone writes: its `description`, the `condition` it fires on, its `actions` in order, whether each action and the Trigger are `enabled`, `paused_by` `types` while a change of the Room's types paused it, its `creator` by `user` and the `name` they had then, and when it was `created`. A `notify` action reaches the `users` its `to` names, the members its `fields` name in the matched document and the holders of its `roles`; a `routine` action sends its `payload` to the Routine whose card under this Room's `house/routines/` its `card` names, absent while this Room holds no card of that Routine; a `message` action puts its `text` into the active conversation that Routine started for what the Event is about, or starts that Routine when none is active; a `function` action runs the `function` its `app`'s latest release declares, on House's servers, or, naming no `app`, the Room owner's Environment function of that name on its Environment, which only a Trigger of their Private Room holds. Whether an action's target holds is not written: it follows from the Room's members, the Routine's card, the App's latest release and the owner's functions.",
308
+ description: "One Trigger of this Room as its acts wrote it, which House alone writes: its `description`, the `condition` it fires on, its `actions` in order, whether each action and the Trigger are `enabled`, `paused_by` `types` while a change of the Room's types paused it, its `creator` by `user` and the `name` they had then, and when it was `created`. A `notify` action reaches the `users` its `to` names, the members its `fields` name in the matched document and the holders of its `roles`; an `agent_function` action sends its `payload` to the Agent function whose card under this Room's `house/agent-functions/` its `card` names, absent while this Room holds no card of that Agent function; a `message` action puts its `text` into the active conversation that Agent function started for what the Event is about, or starts that Agent function when none is active; a `done` action marks Done every active conversation an Agent function request of this Room started for the Event's document; a `function` action runs the `function` its `app`'s latest release declares, on House's servers, or, naming no `app`, the Room owner's Environment function of that name on its Environment, which only a Trigger of their Private Room holds. Whether an action's target holds is not written: it follows from the Room's members, the Agent function's card, the App's latest release and the owner's functions.",
306
309
  properties: {
307
- reflected: { type: 'string', format: 'date-time' },
308
- trigger: { $ref: '#/$defs/id' },
309
- description: { type: 'string' },
310
+ reflected: { title: 'Reflected', type: 'string', format: 'date-time' },
311
+ trigger: { title: 'Trigger', $ref: '#/$defs/id' },
312
+ description: { title: 'Description', type: 'string' },
310
313
  condition: {
311
- anyOf: [
312
- {
313
- type: 'object',
314
- additionalProperties: false,
315
- properties: {
316
- on: { const: 'documents' },
317
- scope: { $ref: '#/$defs/trigger_scope' },
318
- mode: { const: 'starts_matching' },
319
- new_documents: { type: 'boolean' },
320
- match: { $ref: '#/$defs/trigger_test' },
321
- by: { $ref: '#/$defs/trigger_test' },
322
- moved_between_rooms: { type: 'boolean' },
323
- },
324
- required: ['on', 'scope', 'mode', 'new_documents', 'match'],
325
- },
326
- {
327
- type: 'object',
328
- additionalProperties: false,
329
- properties: {
330
- on: { const: 'documents' },
331
- scope: { $ref: '#/$defs/trigger_scope' },
332
- mode: { const: 'field_changes' },
333
- field: { type: 'string' },
334
- from: { anyOf: [{ $ref: '#/$defs/trigger_values' }, { const: 'new' }] },
335
- to: { anyOf: [{ $ref: '#/$defs/trigger_values' }, { const: 'deleted' }] },
336
- match: { $ref: '#/$defs/trigger_test' },
337
- by: { $ref: '#/$defs/trigger_test' },
338
- moved_between_rooms: { type: 'boolean' },
339
- },
340
- required: ['on', 'scope', 'mode', 'field'],
341
- },
342
- {
343
- type: 'object',
344
- additionalProperties: false,
345
- properties: {
346
- on: { const: 'items' },
347
- source: { type: 'string' },
348
- address: { type: 'string' },
349
- match: { $ref: '#/$defs/trigger_test' },
350
- },
351
- required: ['on'],
352
- },
353
- {
354
- type: 'object',
355
- additionalProperties: false,
356
- properties: {
357
- on: { const: 'notifications' },
358
- match: { $ref: '#/$defs/trigger_test' },
359
- },
360
- required: ['on'],
361
- },
362
- {
363
- type: 'object',
364
- additionalProperties: false,
365
- properties: {
366
- on: { const: 'messages' },
367
- match: { $ref: '#/$defs/trigger_test' },
368
- },
369
- required: ['on'],
370
- },
371
- {
372
- type: 'object',
373
- additionalProperties: false,
374
- properties: {
375
- on: { const: 'clock' },
376
- cron: { type: 'string' },
377
- time_zone: { type: 'string' },
378
- },
379
- required: ['on', 'cron', 'time_zone'],
380
- },
381
- {
382
- type: 'object',
383
- additionalProperties: false,
384
- properties: {
385
- on: { const: 'clock' },
386
- scope: {
387
- type: 'object',
388
- additionalProperties: false,
389
- properties: { type: { type: 'string' } },
390
- required: ['type'],
391
- },
392
- date: { type: 'string' },
393
- days: { type: 'integer' },
394
- at: { type: 'string' },
395
- time_zone: { type: 'string' },
396
- match: { $ref: '#/$defs/trigger_test' },
397
- },
398
- required: ['on', 'scope', 'date', 'days', 'at', 'time_zone'],
399
- },
400
- ],
314
+ title: 'Condition',
315
+ description: 'When it fires, as the Trigger reference page writes it, a document it names at its current path.',
316
+ type: 'object',
317
+ additionalProperties: true,
401
318
  },
402
319
  actions: {
320
+ title: 'Actions',
403
321
  type: 'array',
404
322
  items: {
405
323
  anyOf: [
@@ -407,25 +325,27 @@ export const HOUSE_MODEL_DECLARATION = {
407
325
  type: 'object',
408
326
  additionalProperties: false,
409
327
  properties: {
410
- kind: { const: 'notify' },
411
- enabled: { type: 'boolean' },
412
- title: { type: 'string' },
413
- text: { type: 'string' },
328
+ kind: { title: 'Kind', const: 'notify' },
329
+ enabled: { title: 'Enabled', type: 'boolean' },
330
+ title: { title: 'Title', type: 'string' },
331
+ text: { title: 'Text', type: 'string' },
414
332
  to: {
333
+ title: 'To',
415
334
  type: 'object',
416
335
  additionalProperties: false,
417
336
  properties: {
418
337
  users: {
338
+ title: 'Users',
419
339
  type: 'array',
420
340
  items: {
421
341
  type: 'object',
422
342
  additionalProperties: false,
423
- properties: { user: { $ref: '#/$defs/id' } },
343
+ properties: { user: { title: 'User', $ref: '#/$defs/id' } },
424
344
  required: ['user'],
425
345
  },
426
346
  },
427
- fields: { type: 'array', items: { type: 'string' } },
428
- roles: { type: 'array', items: { type: 'string' } },
347
+ fields: { title: 'Fields', type: 'array', items: { type: 'string' } },
348
+ roles: { title: 'Roles', type: 'array', items: { type: 'string' } },
429
349
  },
430
350
  required: ['users', 'fields', 'roles'],
431
351
  },
@@ -436,10 +356,10 @@ export const HOUSE_MODEL_DECLARATION = {
436
356
  type: 'object',
437
357
  additionalProperties: false,
438
358
  properties: {
439
- kind: { const: 'routine' },
440
- enabled: { type: 'boolean' },
441
- card: { type: 'string', minLength: 1 },
442
- payload: { type: 'string' },
359
+ kind: { title: 'Kind', const: 'agent_function' },
360
+ enabled: { title: 'Enabled', type: 'boolean' },
361
+ card: { title: 'Card', type: 'string', minLength: 1 },
362
+ payload: { title: 'Payload', type: 'string' },
443
363
  },
444
364
  required: ['kind', 'enabled', 'payload'],
445
365
  },
@@ -447,10 +367,10 @@ export const HOUSE_MODEL_DECLARATION = {
447
367
  type: 'object',
448
368
  additionalProperties: false,
449
369
  properties: {
450
- kind: { const: 'message' },
451
- enabled: { type: 'boolean' },
452
- card: { type: 'string', minLength: 1 },
453
- text: { type: 'string' },
370
+ kind: { title: 'Kind', const: 'message' },
371
+ enabled: { title: 'Enabled', type: 'boolean' },
372
+ card: { title: 'Card', type: 'string', minLength: 1 },
373
+ text: { title: 'Text', type: 'string' },
454
374
  },
455
375
  required: ['kind', 'enabled', 'text'],
456
376
  },
@@ -458,25 +378,38 @@ export const HOUSE_MODEL_DECLARATION = {
458
378
  type: 'object',
459
379
  additionalProperties: false,
460
380
  properties: {
461
- kind: { const: 'function' },
462
- enabled: { type: 'boolean' },
463
- app: { $ref: '#/$defs/app' },
464
- function: { type: 'string' },
381
+ kind: { title: 'Kind', const: 'done' },
382
+ enabled: { title: 'Enabled', type: 'boolean' },
383
+ },
384
+ required: ['kind', 'enabled'],
385
+ },
386
+ {
387
+ type: 'object',
388
+ additionalProperties: false,
389
+ properties: {
390
+ kind: { title: 'Kind', const: 'function' },
391
+ enabled: { title: 'Enabled', type: 'boolean' },
392
+ app: { title: 'App', $ref: '#/$defs/app' },
393
+ function: { title: 'Function', type: 'string' },
465
394
  },
466
395
  required: ['kind', 'enabled', 'function'],
467
396
  },
468
397
  ],
469
398
  },
470
399
  },
471
- enabled: { type: 'boolean' },
472
- paused_by: { enum: ['types'] },
400
+ enabled: { title: 'Enabled', type: 'boolean' },
401
+ paused_by: { title: 'Paused by', enum: ['types'] },
473
402
  creator: {
403
+ title: 'Creator',
474
404
  type: 'object',
475
405
  additionalProperties: false,
476
- properties: { user: { $ref: '#/$defs/id' }, name: { type: 'string' } },
406
+ properties: {
407
+ user: { title: 'User', $ref: '#/$defs/id' },
408
+ name: { title: 'Name', type: 'string' },
409
+ },
477
410
  required: ['user', 'name'],
478
411
  },
479
- created: { type: 'string', format: 'date-time' },
412
+ created: { title: 'Created', type: 'string', format: 'date-time' },
480
413
  },
481
414
  required: [
482
415
  'reflected',
@@ -492,17 +425,24 @@ export const HOUSE_MODEL_DECLARATION = {
492
425
  'house-web-wizard': {
493
426
  description: "One Web Wizard an agent made for this User: the `environment` it runs on, with the `name` that Environment had when the Web Wizard was made, and its `state`, `waiting` until its owner presses Run or Keep, `running`, `finished` with the script's `exit_code`, `failed`, `cancelled` when its page closed before the script ended, `lapsed` when nobody ran it in its time, or `kept` when its owner kept the script, without running it, as their Environment function named `function`. Its body is the script, whole, in one fenced code block. The terminal's output is never kept.",
494
427
  properties: {
495
- reflected: { type: 'string', format: 'date-time' },
496
- web_wizard: { $ref: '#/$defs/id' },
428
+ reflected: { title: 'Reflected', type: 'string', format: 'date-time' },
429
+ web_wizard: { title: 'Web Wizard', $ref: '#/$defs/id' },
497
430
  environment: {
431
+ title: 'Environment',
498
432
  type: 'object',
499
433
  additionalProperties: false,
500
- properties: { environment: { $ref: '#/$defs/id' }, name: { type: 'string' } },
434
+ properties: {
435
+ environment: { title: 'Environment', $ref: '#/$defs/id' },
436
+ name: { title: 'Name', type: 'string' },
437
+ },
501
438
  required: ['environment', 'name'],
502
439
  },
503
- state: { enum: ['waiting', 'running', 'finished', 'failed', 'cancelled', 'lapsed', 'kept'] },
504
- exit_code: { type: 'integer' },
505
- function: { type: 'string' },
440
+ state: {
441
+ title: 'State',
442
+ enum: ['waiting', 'running', 'finished', 'failed', 'cancelled', 'lapsed', 'kept'],
443
+ },
444
+ exit_code: { title: 'Exit code', type: 'integer' },
445
+ function: { title: 'Function', type: 'string' },
506
446
  },
507
447
  required: ['reflected', 'web_wizard', 'environment', 'state'],
508
448
  },
@@ -513,3 +453,13 @@ function modelText(model) {
513
453
  .join('\n')}\n`;
514
454
  }
515
455
  export const HOUSE_MODEL_TYPES = modelText(HOUSE_MODEL_DECLARATION);
456
+ export const HOUSE_TYPED_PATHS = [
457
+ { path: 'settings/panel.md', type: 'house-panel-preferences', named: true, body: false },
458
+ { path: `${APP_PREFERENCES_HOME}/*.md`, type: 'house-app-preferences', named: true, body: false },
459
+ {
460
+ path: 'rooms/*/agent-functions/*.md',
461
+ type: 'house-agent-function-document',
462
+ named: false,
463
+ body: true,
464
+ },
465
+ ];