@composable-os/pack-dailychecks 0.0.0-stage → 0.1.0-beta.12
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/LICENSE +109 -0
- package/dist/blocks/dailychecks-history/history.d.ts +8 -0
- package/dist/blocks/dailychecks-history/history.js +38 -0
- package/dist/blocks/dailychecks-native-today/today-screen.d.ts +6 -0
- package/dist/blocks/dailychecks-native-today/today-screen.js +92 -0
- package/dist/blocks/dailychecks-today/today.d.ts +6 -0
- package/dist/blocks/dailychecks-today/today.js +113 -0
- package/dist/client/index.d.ts +734 -0
- package/dist/client/index.js +185 -0
- package/dist/index.d.ts +350 -0
- package/dist/index.js +64 -0
- package/dist/tools.d.ts +314 -0
- package/dist/tools.js +199 -0
- package/package.json +36 -4
- package/README.md +0 -3
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { z } from "@composable-os/sdk";
|
|
2
|
+
export declare const today: import("@composable-os/sdk").ToolSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
3
|
+
zone: z.ZodString;
|
|
4
|
+
date: z.ZodString;
|
|
5
|
+
items: z.ZodArray<z.ZodObject<{
|
|
6
|
+
template: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
purpose: z.ZodNullable<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
date: z.ZodString;
|
|
12
|
+
who: z.ZodObject<{
|
|
13
|
+
kind: z.ZodEnum<{
|
|
14
|
+
staff: "staff";
|
|
15
|
+
role: "role";
|
|
16
|
+
grant: "grant";
|
|
17
|
+
}>;
|
|
18
|
+
value: z.ZodNullable<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
dueBy: z.ZodNullable<z.ZodString>;
|
|
21
|
+
dueAt: z.ZodNullable<z.ZodString>;
|
|
22
|
+
opens: z.ZodString;
|
|
23
|
+
closes: z.ZodString;
|
|
24
|
+
state: z.ZodEnum<{
|
|
25
|
+
not_started: "not_started";
|
|
26
|
+
open: "open";
|
|
27
|
+
done: "done";
|
|
28
|
+
missed: "missed";
|
|
29
|
+
}>;
|
|
30
|
+
late: z.ZodBoolean;
|
|
31
|
+
run: z.ZodNullable<z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
object: z.ZodString;
|
|
34
|
+
record: z.ZodString;
|
|
35
|
+
template: z.ZodObject<{
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
version: z.ZodNumber;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
state: z.ZodEnum<{
|
|
41
|
+
open: "open";
|
|
42
|
+
done: "done";
|
|
43
|
+
missed: "missed";
|
|
44
|
+
cancelled: "cancelled";
|
|
45
|
+
}>;
|
|
46
|
+
account: z.ZodNullable<z.ZodString>;
|
|
47
|
+
name: z.ZodNullable<z.ZodString>;
|
|
48
|
+
opens: z.ZodString;
|
|
49
|
+
closes: z.ZodString;
|
|
50
|
+
tickUntil: z.ZodString;
|
|
51
|
+
madeAt: z.ZodString;
|
|
52
|
+
closedAt: z.ZodNullable<z.ZodString>;
|
|
53
|
+
closedBy: z.ZodNullable<z.ZodString>;
|
|
54
|
+
closedByName: z.ZodNullable<z.ZodString>;
|
|
55
|
+
closedWhy: z.ZodNullable<z.ZodString>;
|
|
56
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
57
|
+
position: z.ZodNumber;
|
|
58
|
+
text: z.ZodString;
|
|
59
|
+
required: z.ZodBoolean;
|
|
60
|
+
asksNote: z.ZodBoolean;
|
|
61
|
+
tick: z.ZodNullable<z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
state: z.ZodEnum<{
|
|
64
|
+
done: "done";
|
|
65
|
+
not_done: "not_done";
|
|
66
|
+
cleared: "cleared";
|
|
67
|
+
}>;
|
|
68
|
+
done: z.ZodBoolean;
|
|
69
|
+
why: z.ZodNullable<z.ZodString>;
|
|
70
|
+
note: z.ZodNullable<z.ZodString>;
|
|
71
|
+
onBehalfWhy: z.ZodNullable<z.ZodString>;
|
|
72
|
+
withheld: z.ZodBoolean;
|
|
73
|
+
by: z.ZodString;
|
|
74
|
+
byName: z.ZodString;
|
|
75
|
+
for: z.ZodString;
|
|
76
|
+
forName: z.ZodString;
|
|
77
|
+
onBehalf: z.ZodBoolean;
|
|
78
|
+
at: z.ZodString;
|
|
79
|
+
label: z.ZodString;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
history: z.ZodArray<z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
state: z.ZodEnum<{
|
|
84
|
+
done: "done";
|
|
85
|
+
not_done: "not_done";
|
|
86
|
+
cleared: "cleared";
|
|
87
|
+
}>;
|
|
88
|
+
done: z.ZodBoolean;
|
|
89
|
+
why: z.ZodNullable<z.ZodString>;
|
|
90
|
+
note: z.ZodNullable<z.ZodString>;
|
|
91
|
+
onBehalfWhy: z.ZodNullable<z.ZodString>;
|
|
92
|
+
withheld: z.ZodBoolean;
|
|
93
|
+
by: z.ZodString;
|
|
94
|
+
byName: z.ZodString;
|
|
95
|
+
for: z.ZodString;
|
|
96
|
+
forName: z.ZodString;
|
|
97
|
+
onBehalf: z.ZodBoolean;
|
|
98
|
+
at: z.ZodString;
|
|
99
|
+
label: z.ZodString;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
historyTruncated: z.ZodBoolean;
|
|
102
|
+
missed: z.ZodBoolean;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
corrections: z.ZodArray<z.ZodObject<{
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
text: z.ZodString;
|
|
107
|
+
by: z.ZodString;
|
|
108
|
+
byName: z.ZodString;
|
|
109
|
+
at: z.ZodString;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
preview: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
113
|
+
text: z.ZodString;
|
|
114
|
+
required: z.ZodBoolean;
|
|
115
|
+
asksNote: z.ZodBoolean;
|
|
116
|
+
}, z.core.$strip>>>;
|
|
117
|
+
mayDo: z.ZodBoolean;
|
|
118
|
+
canTick: z.ZodBoolean;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
you: z.ZodString;
|
|
121
|
+
youManage: z.ZodBoolean;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
export declare const checklistDay: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
|
|
124
|
+
template: z.ZodString;
|
|
125
|
+
date: z.ZodString;
|
|
126
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
127
|
+
item: z.ZodObject<{
|
|
128
|
+
template: z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
name: z.ZodString;
|
|
131
|
+
purpose: z.ZodNullable<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
date: z.ZodString;
|
|
134
|
+
who: z.ZodObject<{
|
|
135
|
+
kind: z.ZodEnum<{
|
|
136
|
+
staff: "staff";
|
|
137
|
+
role: "role";
|
|
138
|
+
grant: "grant";
|
|
139
|
+
}>;
|
|
140
|
+
value: z.ZodNullable<z.ZodString>;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
dueBy: z.ZodNullable<z.ZodString>;
|
|
143
|
+
dueAt: z.ZodNullable<z.ZodString>;
|
|
144
|
+
opens: z.ZodString;
|
|
145
|
+
closes: z.ZodString;
|
|
146
|
+
state: z.ZodEnum<{
|
|
147
|
+
not_started: "not_started";
|
|
148
|
+
open: "open";
|
|
149
|
+
done: "done";
|
|
150
|
+
missed: "missed";
|
|
151
|
+
}>;
|
|
152
|
+
late: z.ZodBoolean;
|
|
153
|
+
run: z.ZodNullable<z.ZodObject<{
|
|
154
|
+
id: z.ZodString;
|
|
155
|
+
object: z.ZodString;
|
|
156
|
+
record: z.ZodString;
|
|
157
|
+
template: z.ZodObject<{
|
|
158
|
+
id: z.ZodString;
|
|
159
|
+
name: z.ZodString;
|
|
160
|
+
version: z.ZodNumber;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
state: z.ZodEnum<{
|
|
163
|
+
open: "open";
|
|
164
|
+
done: "done";
|
|
165
|
+
missed: "missed";
|
|
166
|
+
cancelled: "cancelled";
|
|
167
|
+
}>;
|
|
168
|
+
account: z.ZodNullable<z.ZodString>;
|
|
169
|
+
name: z.ZodNullable<z.ZodString>;
|
|
170
|
+
opens: z.ZodString;
|
|
171
|
+
closes: z.ZodString;
|
|
172
|
+
tickUntil: z.ZodString;
|
|
173
|
+
madeAt: z.ZodString;
|
|
174
|
+
closedAt: z.ZodNullable<z.ZodString>;
|
|
175
|
+
closedBy: z.ZodNullable<z.ZodString>;
|
|
176
|
+
closedByName: z.ZodNullable<z.ZodString>;
|
|
177
|
+
closedWhy: z.ZodNullable<z.ZodString>;
|
|
178
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
179
|
+
position: z.ZodNumber;
|
|
180
|
+
text: z.ZodString;
|
|
181
|
+
required: z.ZodBoolean;
|
|
182
|
+
asksNote: z.ZodBoolean;
|
|
183
|
+
tick: z.ZodNullable<z.ZodObject<{
|
|
184
|
+
id: z.ZodString;
|
|
185
|
+
state: z.ZodEnum<{
|
|
186
|
+
done: "done";
|
|
187
|
+
not_done: "not_done";
|
|
188
|
+
cleared: "cleared";
|
|
189
|
+
}>;
|
|
190
|
+
done: z.ZodBoolean;
|
|
191
|
+
why: z.ZodNullable<z.ZodString>;
|
|
192
|
+
note: z.ZodNullable<z.ZodString>;
|
|
193
|
+
onBehalfWhy: z.ZodNullable<z.ZodString>;
|
|
194
|
+
withheld: z.ZodBoolean;
|
|
195
|
+
by: z.ZodString;
|
|
196
|
+
byName: z.ZodString;
|
|
197
|
+
for: z.ZodString;
|
|
198
|
+
forName: z.ZodString;
|
|
199
|
+
onBehalf: z.ZodBoolean;
|
|
200
|
+
at: z.ZodString;
|
|
201
|
+
label: z.ZodString;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
history: z.ZodArray<z.ZodObject<{
|
|
204
|
+
id: z.ZodString;
|
|
205
|
+
state: z.ZodEnum<{
|
|
206
|
+
done: "done";
|
|
207
|
+
not_done: "not_done";
|
|
208
|
+
cleared: "cleared";
|
|
209
|
+
}>;
|
|
210
|
+
done: z.ZodBoolean;
|
|
211
|
+
why: z.ZodNullable<z.ZodString>;
|
|
212
|
+
note: z.ZodNullable<z.ZodString>;
|
|
213
|
+
onBehalfWhy: z.ZodNullable<z.ZodString>;
|
|
214
|
+
withheld: z.ZodBoolean;
|
|
215
|
+
by: z.ZodString;
|
|
216
|
+
byName: z.ZodString;
|
|
217
|
+
for: z.ZodString;
|
|
218
|
+
forName: z.ZodString;
|
|
219
|
+
onBehalf: z.ZodBoolean;
|
|
220
|
+
at: z.ZodString;
|
|
221
|
+
label: z.ZodString;
|
|
222
|
+
}, z.core.$strip>>;
|
|
223
|
+
historyTruncated: z.ZodBoolean;
|
|
224
|
+
missed: z.ZodBoolean;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
corrections: z.ZodArray<z.ZodObject<{
|
|
227
|
+
id: z.ZodString;
|
|
228
|
+
text: z.ZodString;
|
|
229
|
+
by: z.ZodString;
|
|
230
|
+
byName: z.ZodString;
|
|
231
|
+
at: z.ZodString;
|
|
232
|
+
}, z.core.$strip>>;
|
|
233
|
+
}, z.core.$strip>>;
|
|
234
|
+
preview: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
235
|
+
text: z.ZodString;
|
|
236
|
+
required: z.ZodBoolean;
|
|
237
|
+
asksNote: z.ZodBoolean;
|
|
238
|
+
}, z.core.$strip>>>;
|
|
239
|
+
mayDo: z.ZodBoolean;
|
|
240
|
+
canTick: z.ZodBoolean;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
zone: z.ZodString;
|
|
243
|
+
doers: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
244
|
+
id: z.ZodString;
|
|
245
|
+
name: z.ZodString;
|
|
246
|
+
}, z.core.$strip>>>;
|
|
247
|
+
you: z.ZodString;
|
|
248
|
+
youManage: z.ZodBoolean;
|
|
249
|
+
}, z.core.$strip>>;
|
|
250
|
+
export declare const tickStep: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
|
|
251
|
+
for: z.ZodOptional<z.ZodString>;
|
|
252
|
+
forWhy: z.ZodOptional<z.ZodString>;
|
|
253
|
+
step: z.ZodNumber;
|
|
254
|
+
state: z.ZodEnum<{
|
|
255
|
+
done: "done";
|
|
256
|
+
not_done: "not_done";
|
|
257
|
+
clear: "clear";
|
|
258
|
+
}>;
|
|
259
|
+
note: z.ZodOptional<z.ZodString>;
|
|
260
|
+
why: z.ZodOptional<z.ZodString>;
|
|
261
|
+
template: z.ZodString;
|
|
262
|
+
date: z.ZodString;
|
|
263
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
264
|
+
run: z.ZodString;
|
|
265
|
+
step: z.ZodNumber;
|
|
266
|
+
state: z.ZodEnum<{
|
|
267
|
+
done: "done";
|
|
268
|
+
not_done: "not_done";
|
|
269
|
+
clear: "clear";
|
|
270
|
+
}>;
|
|
271
|
+
ticked: z.ZodNumber;
|
|
272
|
+
of: z.ZodNumber;
|
|
273
|
+
finished: z.ZodBoolean;
|
|
274
|
+
}, z.core.$strip>>;
|
|
275
|
+
export declare const done: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
|
|
276
|
+
for: z.ZodOptional<z.ZodString>;
|
|
277
|
+
forWhy: z.ZodOptional<z.ZodString>;
|
|
278
|
+
template: z.ZodString;
|
|
279
|
+
date: z.ZodString;
|
|
280
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
281
|
+
run: z.ZodString;
|
|
282
|
+
state: z.ZodLiteral<"done">;
|
|
283
|
+
}, z.core.$strip>>;
|
|
284
|
+
export declare const history: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
|
|
285
|
+
from: z.ZodString;
|
|
286
|
+
to: z.ZodString;
|
|
287
|
+
template: z.ZodOptional<z.ZodString>;
|
|
288
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
289
|
+
zone: z.ZodString;
|
|
290
|
+
days: z.ZodArray<z.ZodObject<{
|
|
291
|
+
run: z.ZodString;
|
|
292
|
+
template: z.ZodObject<{
|
|
293
|
+
id: z.ZodString;
|
|
294
|
+
name: z.ZodString;
|
|
295
|
+
}, z.core.$strip>;
|
|
296
|
+
date: z.ZodString;
|
|
297
|
+
state: z.ZodEnum<{
|
|
298
|
+
open: "open";
|
|
299
|
+
done: "done";
|
|
300
|
+
missed: "missed";
|
|
301
|
+
}>;
|
|
302
|
+
dueAt: z.ZodNullable<z.ZodString>;
|
|
303
|
+
late: z.ZodBoolean;
|
|
304
|
+
finishedAt: z.ZodNullable<z.ZodString>;
|
|
305
|
+
finishedBy: z.ZodNullable<z.ZodString>;
|
|
306
|
+
finishedFor: z.ZodNullable<z.ZodString>;
|
|
307
|
+
steps: z.ZodNumber;
|
|
308
|
+
ticked: z.ZodNumber;
|
|
309
|
+
notDone: z.ZodNumber;
|
|
310
|
+
onBehalf: z.ZodNumber;
|
|
311
|
+
missed: z.ZodArray<z.ZodString>;
|
|
312
|
+
}, z.core.$strip>>;
|
|
313
|
+
truncated: z.ZodBoolean;
|
|
314
|
+
}, z.core.$strip>>;
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// The Daily checklists tools (ADR 0651). They become operations x.dailychecks.<tool>, run in the
|
|
2
|
+
// sandbox, and reach the host only through ctx.ops. None of them holds a rule: which checklists are
|
|
3
|
+
// due today, who may do one, who may tick for whom, that the last tick finishes it, that a finished
|
|
4
|
+
// or missed day never changes, and who reads how a day went are the host's (its tool-only
|
|
5
|
+
// `checklist.today`, `checklist.day`, `checklist.dayTick`, `checklist.dayDone` and
|
|
6
|
+
// `checklist.days`, and the database's triggers). Each operation acts for the staff account the
|
|
7
|
+
// host verified as this tool's caller, never for anything in the input.
|
|
8
|
+
//
|
|
9
|
+
// Who may call which (ADR 0652):
|
|
10
|
+
// - `today`, `day`, `tick`, `done`: every staff account (`anyStaff`), pack roles included, so a
|
|
11
|
+
// cleaner's or a coach's account reaches them with no grant; the host answers each caller with
|
|
12
|
+
// only the checklists they may do (and, for someone who manages checklists, every one);
|
|
13
|
+
// - `history`: those who manage checklists, the core permission checklists:write (admins, and
|
|
14
|
+
// anyone an admin grants it), never a pack role (`corePermission`).
|
|
15
|
+
// Every tool is a person's own, at the screen (`humanOnly`): a tick says a person did the step, and
|
|
16
|
+
// how a checklist went is read by people, never by an assistant.
|
|
17
|
+
import { defineTool, z } from "@composable-os/sdk";
|
|
18
|
+
const localDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "a date, YYYY-MM-DD");
|
|
19
|
+
const tick = z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
state: z.enum(["done", "not_done", "cleared"]),
|
|
22
|
+
done: z.boolean(),
|
|
23
|
+
why: z.string().nullable(),
|
|
24
|
+
note: z.string().nullable(),
|
|
25
|
+
onBehalfWhy: z.string().nullable(),
|
|
26
|
+
withheld: z.boolean().describe("Has words only its author and those who manage checklists read"),
|
|
27
|
+
by: z.string(),
|
|
28
|
+
byName: z.string(),
|
|
29
|
+
for: z.string(),
|
|
30
|
+
forName: z.string(),
|
|
31
|
+
onBehalf: z.boolean(),
|
|
32
|
+
at: z.string(),
|
|
33
|
+
label: z.string().describe('"Ticked by X", or "Ticked by X for Y"'),
|
|
34
|
+
});
|
|
35
|
+
const run = z.object({
|
|
36
|
+
id: z.string(),
|
|
37
|
+
object: z.string(),
|
|
38
|
+
record: z.string(),
|
|
39
|
+
template: z.object({ id: z.string(), name: z.string(), version: z.number() }),
|
|
40
|
+
state: z.enum(["open", "done", "missed", "cancelled"]),
|
|
41
|
+
account: z.string().nullable(),
|
|
42
|
+
name: z.string().nullable(),
|
|
43
|
+
opens: z.string(),
|
|
44
|
+
closes: z.string(),
|
|
45
|
+
tickUntil: z.string(),
|
|
46
|
+
madeAt: z.string(),
|
|
47
|
+
closedAt: z.string().nullable(),
|
|
48
|
+
closedBy: z.string().nullable(),
|
|
49
|
+
closedByName: z.string().nullable(),
|
|
50
|
+
closedWhy: z.string().nullable(),
|
|
51
|
+
steps: z.array(z.object({
|
|
52
|
+
position: z.number(),
|
|
53
|
+
text: z.string(),
|
|
54
|
+
required: z.boolean(),
|
|
55
|
+
asksNote: z.boolean(),
|
|
56
|
+
tick: tick.nullable().describe("The latest tick"),
|
|
57
|
+
history: z.array(tick).describe("Earlier ticks, the latest 20"),
|
|
58
|
+
historyTruncated: z.boolean(),
|
|
59
|
+
missed: z.boolean(),
|
|
60
|
+
})),
|
|
61
|
+
corrections: z.array(z.object({
|
|
62
|
+
id: z.string(),
|
|
63
|
+
text: z.string(),
|
|
64
|
+
by: z.string(),
|
|
65
|
+
byName: z.string(),
|
|
66
|
+
at: z.string(),
|
|
67
|
+
})),
|
|
68
|
+
});
|
|
69
|
+
const item = z.object({
|
|
70
|
+
template: z.object({ id: z.string(), name: z.string(), purpose: z.string().nullable() }),
|
|
71
|
+
date: z.string(),
|
|
72
|
+
who: z.object({ kind: z.enum(["staff", "role", "grant"]), value: z.string().nullable() }),
|
|
73
|
+
dueBy: z.string().nullable().describe("The local time it is due by"),
|
|
74
|
+
dueAt: z.string().nullable(),
|
|
75
|
+
opens: z.string(),
|
|
76
|
+
closes: z.string().describe("The end of its day: not finished by then, it is missed"),
|
|
77
|
+
state: z.enum(["not_started", "open", "done", "missed"]),
|
|
78
|
+
late: z.boolean(),
|
|
79
|
+
run: run.nullable(),
|
|
80
|
+
preview: z
|
|
81
|
+
.array(z.object({ text: z.string(), required: z.boolean(), asksNote: z.boolean() }))
|
|
82
|
+
.nullable(),
|
|
83
|
+
mayDo: z.boolean().describe("You may do it yourself"),
|
|
84
|
+
canTick: z.boolean().describe("You may tick it now (yourself, or for someone)"),
|
|
85
|
+
});
|
|
86
|
+
const day = { template: z.string().min(1).max(64), date: localDate };
|
|
87
|
+
const forSomeone = {
|
|
88
|
+
for: z.string().min(1).max(64).optional().describe("Ticking for someone who may do it"),
|
|
89
|
+
forWhy: z.string().trim().max(500).optional().describe("Ticking for someone else: why"),
|
|
90
|
+
};
|
|
91
|
+
export const today = defineTool({
|
|
92
|
+
description: "Today's checklists (the ones done on their own, not a shift's): each one you may do, and " +
|
|
93
|
+
"every one if you manage checklists, with when it is due by, its steps and who ticked each " +
|
|
94
|
+
"and when, and whether you may tick it now. A person's own read.",
|
|
95
|
+
input: z.object({}),
|
|
96
|
+
output: z.object({
|
|
97
|
+
zone: z.string(),
|
|
98
|
+
date: z.string(),
|
|
99
|
+
items: z.array(item),
|
|
100
|
+
you: z.string(),
|
|
101
|
+
youManage: z.boolean(),
|
|
102
|
+
}),
|
|
103
|
+
risk: "read",
|
|
104
|
+
anyStaff: true,
|
|
105
|
+
humanOnly: true,
|
|
106
|
+
handler: async (input, ctx) => (await ctx.ops.call("checklist.today", input)),
|
|
107
|
+
});
|
|
108
|
+
export const checklistDay = defineTool({
|
|
109
|
+
description: "One checklist on one day: its steps and ticks, whether it is done (by whom, when) or " +
|
|
110
|
+
"missed. Today's for whoever may do it; any day's, with who may do it, for someone who " +
|
|
111
|
+
"manages checklists. A person's own read.",
|
|
112
|
+
input: z.object(day),
|
|
113
|
+
output: z.object({
|
|
114
|
+
item,
|
|
115
|
+
zone: z.string(),
|
|
116
|
+
doers: z.array(z.object({ id: z.string(), name: z.string() })).nullable(),
|
|
117
|
+
you: z.string(),
|
|
118
|
+
youManage: z.boolean(),
|
|
119
|
+
}),
|
|
120
|
+
risk: "read",
|
|
121
|
+
anyStaff: true,
|
|
122
|
+
humanOnly: true,
|
|
123
|
+
handler: async (input, ctx) => (await ctx.ops.call("checklist.day", input)),
|
|
124
|
+
});
|
|
125
|
+
export const tickStep = defineTool({
|
|
126
|
+
description: "Tick one step of today's checklist: done (with a note where the step asks for one), not " +
|
|
127
|
+
"done (with why), or clear your tick. Whoever ticks the last step finishes it, and a " +
|
|
128
|
+
"finished checklist never changes. Someone who manages checklists may tick for someone who " +
|
|
129
|
+
"may do it (`for`), saying why (`forWhy`). A person's own act.",
|
|
130
|
+
input: z.object({
|
|
131
|
+
...day,
|
|
132
|
+
step: z.number().int().min(0).max(49),
|
|
133
|
+
state: z.enum(["done", "not_done", "clear"]),
|
|
134
|
+
note: z.string().trim().max(1000).optional(),
|
|
135
|
+
why: z.string().trim().max(500).optional(),
|
|
136
|
+
...forSomeone,
|
|
137
|
+
}),
|
|
138
|
+
output: z.object({
|
|
139
|
+
run: z.string(),
|
|
140
|
+
step: z.number(),
|
|
141
|
+
state: z.enum(["done", "not_done", "clear"]),
|
|
142
|
+
ticked: z.number(),
|
|
143
|
+
of: z.number(),
|
|
144
|
+
finished: z.boolean(),
|
|
145
|
+
}),
|
|
146
|
+
risk: "write",
|
|
147
|
+
anyStaff: true,
|
|
148
|
+
humanOnly: true,
|
|
149
|
+
// What someone writes on a step, why it was not done, why it was ticked for them, and how it
|
|
150
|
+
// went: never in the audit log.
|
|
151
|
+
redact: ["note", "why", "forWhy", "state"],
|
|
152
|
+
handler: async (input, ctx) => (await ctx.ops.call("checklist.dayTick", input)),
|
|
153
|
+
});
|
|
154
|
+
export const done = defineTool({
|
|
155
|
+
description: "Finish today's checklist with optional steps left, once every required step is ticked. " +
|
|
156
|
+
"Finished is final. Someone who manages checklists may finish it for someone who may do " +
|
|
157
|
+
"it, saying why. A person's own act.",
|
|
158
|
+
input: z.object({ ...day, ...forSomeone }),
|
|
159
|
+
output: z.object({ run: z.string(), state: z.literal("done") }),
|
|
160
|
+
risk: "write",
|
|
161
|
+
anyStaff: true,
|
|
162
|
+
humanOnly: true,
|
|
163
|
+
redact: ["forWhy"],
|
|
164
|
+
handler: async (input, ctx) => (await ctx.ops.call("checklist.dayDone", input)),
|
|
165
|
+
});
|
|
166
|
+
export const history = defineTool({
|
|
167
|
+
description: "How each day went, from `from` to `to` (local dates, at most 62 days): every checklist " +
|
|
168
|
+
"done on its own, whether it was done (by whom, for whom, when, late or not, and how many " +
|
|
169
|
+
"steps were ticked not done) or missed (with the steps nobody ticked). Those who manage checklists, a person only.",
|
|
170
|
+
input: z.object({
|
|
171
|
+
from: localDate,
|
|
172
|
+
to: localDate,
|
|
173
|
+
template: z.string().min(1).max(64).optional(),
|
|
174
|
+
}),
|
|
175
|
+
output: z.object({
|
|
176
|
+
zone: z.string(),
|
|
177
|
+
days: z.array(z.object({
|
|
178
|
+
run: z.string(),
|
|
179
|
+
template: z.object({ id: z.string(), name: z.string() }),
|
|
180
|
+
date: z.string(),
|
|
181
|
+
state: z.enum(["open", "done", "missed"]),
|
|
182
|
+
dueAt: z.string().nullable(),
|
|
183
|
+
late: z.boolean(),
|
|
184
|
+
finishedAt: z.string().nullable(),
|
|
185
|
+
finishedBy: z.string().nullable(),
|
|
186
|
+
finishedFor: z.string().nullable(),
|
|
187
|
+
steps: z.number(),
|
|
188
|
+
ticked: z.number(),
|
|
189
|
+
notDone: z.number(),
|
|
190
|
+
onBehalf: z.number(),
|
|
191
|
+
missed: z.array(z.string()),
|
|
192
|
+
})),
|
|
193
|
+
truncated: z.boolean(),
|
|
194
|
+
}),
|
|
195
|
+
risk: "read",
|
|
196
|
+
corePermission: "checklists:write",
|
|
197
|
+
humanOnly: true,
|
|
198
|
+
handler: async (input, ctx) => (await ctx.ops.call("checklist.days", input)),
|
|
199
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composable-os/pack-dailychecks",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-beta.12",
|
|
4
|
+
"license": "FSL-1.1-ALv2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/timoconnellaus/composable-os.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://composableos.dev",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"provenance": true
|
|
14
|
+
},
|
|
15
|
+
"description": "Daily checklists: checklists done on their own, without a roster (opening, closing, cleaning; ADR 0651). The screens over the host's checklist operations: today's checklists for whoever may do one (web and the app) and how each day went for those who manage checklists. Requires nothing. Bundled as source into cos-runner.",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./client": {
|
|
22
|
+
"types": "./dist/client/index.d.ts",
|
|
23
|
+
"default": "./dist/client/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"composableOs": {
|
|
30
|
+
"optional": true,
|
|
31
|
+
"label": "Daily checklists",
|
|
32
|
+
"description": "Checklists on their own: opening, closing and cleaning, due on set days by a set time, ticked off by whoever may do them, with how each day went."
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@composable-os/client": "0.1.0-beta.12",
|
|
36
|
+
"@composable-os/sdk": "0.1.0-beta.12"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/README.md
DELETED