@ricajs/contracts 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/LICENSE +661 -0
- package/README.md +153 -2
- package/action-review.d.ts +120 -0
- package/action-review.js +40 -0
- package/auto-review.d.ts +32 -0
- package/auto-review.js +14 -0
- package/commitments.d.ts +87 -0
- package/commitments.js +33 -0
- package/deployment-plugins.d.ts +7 -0
- package/deployment-plugins.js +2 -0
- package/health.d.ts +7 -0
- package/health.js +1 -0
- package/local-users.d.ts +17 -0
- package/local-users.js +6 -0
- package/management.d.ts +640 -0
- package/management.js +235 -0
- package/memory.d.ts +14 -0
- package/memory.js +1 -0
- package/model-provider.d.ts +40 -0
- package/model-provider.js +10 -0
- package/package.json +93 -3
- package/plans.d.ts +50 -0
- package/plans.js +20 -0
- package/platform-reader.d.ts +26 -0
- package/platform-reader.js +9 -0
- package/platform-reply-executor.d.ts +13 -0
- package/platform-reply-executor.js +3 -0
- package/plugin-status.d.ts +277 -0
- package/plugin-status.js +54 -0
- package/run-continuity.d.ts +84 -0
- package/run-continuity.js +1 -0
- package/schedules.d.ts +46 -0
- package/schedules.js +18 -0
- package/simulation-follow-up.d.ts +35 -0
- package/simulation-follow-up.js +29 -0
- package/simulation-observability.d.ts +223 -0
- package/simulation-observability.js +85 -0
- package/simulation-platform.d.ts +33 -0
- package/simulation-platform.js +7 -0
- package/source/action-review.ts +45 -0
- package/source/auto-review.ts +22 -0
- package/source/commitments.ts +39 -0
- package/source/deployment-plugins.ts +4 -0
- package/source/health.ts +4 -0
- package/source/local-users.ts +8 -0
- package/source/management.ts +246 -0
- package/source/memory.ts +15 -0
- package/source/model-provider.ts +29 -0
- package/source/package.json +43 -0
- package/source/plans.ts +22 -0
- package/source/platform-reader.ts +27 -0
- package/source/platform-reply-executor.ts +10 -0
- package/source/plugin-status.ts +67 -0
- package/source/run-continuity.ts +60 -0
- package/source/schedules.ts +22 -0
- package/source/simulation-follow-up.ts +35 -0
- package/source/simulation-observability.ts +94 -0
- package/source/simulation-platform.ts +39 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { z } from '@hono/zod-openapi';
|
|
2
|
+
declare const pluginService: z.ZodString;
|
|
3
|
+
export type PluginService = z.infer<typeof pluginService>;
|
|
4
|
+
declare const pluginIdentity: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
version: z.ZodString;
|
|
7
|
+
contractVersion: z.ZodNumber;
|
|
8
|
+
kind: z.ZodEnum<{
|
|
9
|
+
platform: "platform";
|
|
10
|
+
model: "model";
|
|
11
|
+
"platform-reader": "platform-reader";
|
|
12
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
13
|
+
}>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type PluginMetadata = z.infer<typeof pluginIdentity>;
|
|
16
|
+
export declare const pluginReleaseManifest: z.ZodObject<{
|
|
17
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
18
|
+
ricaVersion: z.ZodString;
|
|
19
|
+
releaseUrl: z.ZodURL;
|
|
20
|
+
components: z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
contractVersion: z.ZodNumber;
|
|
23
|
+
kind: z.ZodEnum<{
|
|
24
|
+
platform: "platform";
|
|
25
|
+
model: "model";
|
|
26
|
+
"platform-reader": "platform-reader";
|
|
27
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
28
|
+
}>;
|
|
29
|
+
version: z.ZodString;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export declare const pluginReleaseView: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
+
status: z.ZodEnum<{
|
|
34
|
+
UNCONFIGURED: "UNCONFIGURED";
|
|
35
|
+
UNAVAILABLE: "UNAVAILABLE";
|
|
36
|
+
}>;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
status: z.ZodLiteral<"AVAILABLE">;
|
|
39
|
+
ricaVersion: z.ZodString;
|
|
40
|
+
releaseUrl: z.ZodURL;
|
|
41
|
+
upgrades: z.ZodArray<z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
components: z.ZodArray<z.ZodObject<{
|
|
44
|
+
service: z.ZodString;
|
|
45
|
+
current: z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
version: z.ZodString;
|
|
48
|
+
contractVersion: z.ZodNumber;
|
|
49
|
+
kind: z.ZodEnum<{
|
|
50
|
+
platform: "platform";
|
|
51
|
+
model: "model";
|
|
52
|
+
"platform-reader": "platform-reader";
|
|
53
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
54
|
+
}>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
target: z.ZodNullable<z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
contractVersion: z.ZodNumber;
|
|
59
|
+
kind: z.ZodEnum<{
|
|
60
|
+
platform: "platform";
|
|
61
|
+
model: "model";
|
|
62
|
+
"platform-reader": "platform-reader";
|
|
63
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
64
|
+
}>;
|
|
65
|
+
version: z.ZodString;
|
|
66
|
+
}, z.core.$strict>>;
|
|
67
|
+
problem: z.ZodNullable<z.ZodEnum<{
|
|
68
|
+
MISSING_COMPONENT: "MISSING_COMPONENT";
|
|
69
|
+
INCOMPATIBLE_CONTRACT: "INCOMPATIBLE_CONTRACT";
|
|
70
|
+
DOWNGRADE: "DOWNGRADE";
|
|
71
|
+
}>>;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
aligned: z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
components: z.ZodArray<z.ZodObject<{
|
|
77
|
+
service: z.ZodString;
|
|
78
|
+
current: z.ZodObject<{
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
version: z.ZodString;
|
|
81
|
+
contractVersion: z.ZodNumber;
|
|
82
|
+
kind: z.ZodEnum<{
|
|
83
|
+
platform: "platform";
|
|
84
|
+
model: "model";
|
|
85
|
+
"platform-reader": "platform-reader";
|
|
86
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
87
|
+
}>;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
target: z.ZodNullable<z.ZodObject<{
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
contractVersion: z.ZodNumber;
|
|
92
|
+
kind: z.ZodEnum<{
|
|
93
|
+
platform: "platform";
|
|
94
|
+
model: "model";
|
|
95
|
+
"platform-reader": "platform-reader";
|
|
96
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
97
|
+
}>;
|
|
98
|
+
version: z.ZodString;
|
|
99
|
+
}, z.core.$strict>>;
|
|
100
|
+
problem: z.ZodNullable<z.ZodEnum<{
|
|
101
|
+
MISSING_COMPONENT: "MISSING_COMPONENT";
|
|
102
|
+
INCOMPATIBLE_CONTRACT: "INCOMPATIBLE_CONTRACT";
|
|
103
|
+
DOWNGRADE: "DOWNGRADE";
|
|
104
|
+
}>>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
}, z.core.$strip>], "status">;
|
|
108
|
+
export type PluginReleaseView = z.infer<typeof pluginReleaseView>;
|
|
109
|
+
export declare const pluginDiagnostic: z.ZodEnum<{
|
|
110
|
+
INCOMPATIBLE_CONTRACT: "INCOMPATIBLE_CONTRACT";
|
|
111
|
+
UNKNOWN_PLUGIN: "UNKNOWN_PLUGIN";
|
|
112
|
+
DUPLICATE_SELECTION: "DUPLICATE_SELECTION";
|
|
113
|
+
INVALID_CONFIG: "INVALID_CONFIG";
|
|
114
|
+
MISSING_SERVICE: "MISSING_SERVICE";
|
|
115
|
+
START_FAILED: "START_FAILED";
|
|
116
|
+
DUPLICATE_PLUGIN: "DUPLICATE_PLUGIN";
|
|
117
|
+
INVALID_MANIFEST: "INVALID_MANIFEST";
|
|
118
|
+
DEPENDENCY_UNAVAILABLE: "DEPENDENCY_UNAVAILABLE";
|
|
119
|
+
OPERATION_FAILED: "OPERATION_FAILED";
|
|
120
|
+
}>;
|
|
121
|
+
export type PluginDiagnostic = z.infer<typeof pluginDiagnostic>;
|
|
122
|
+
export declare const pluginReport: z.ZodObject<{
|
|
123
|
+
status: z.ZodEnum<{
|
|
124
|
+
READY: "READY";
|
|
125
|
+
COMPLETED: "COMPLETED";
|
|
126
|
+
FAILED: "FAILED";
|
|
127
|
+
}>;
|
|
128
|
+
observedAt: z.ZodISODateTime;
|
|
129
|
+
plugins: z.ZodArray<z.ZodObject<{
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
version: z.ZodString;
|
|
132
|
+
contractVersion: z.ZodNumber;
|
|
133
|
+
kind: z.ZodEnum<{
|
|
134
|
+
platform: "platform";
|
|
135
|
+
model: "model";
|
|
136
|
+
"platform-reader": "platform-reader";
|
|
137
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
138
|
+
}>;
|
|
139
|
+
}, z.core.$strict>>;
|
|
140
|
+
diagnostic: z.ZodOptional<z.ZodEnum<{
|
|
141
|
+
INCOMPATIBLE_CONTRACT: "INCOMPATIBLE_CONTRACT";
|
|
142
|
+
UNKNOWN_PLUGIN: "UNKNOWN_PLUGIN";
|
|
143
|
+
DUPLICATE_SELECTION: "DUPLICATE_SELECTION";
|
|
144
|
+
INVALID_CONFIG: "INVALID_CONFIG";
|
|
145
|
+
MISSING_SERVICE: "MISSING_SERVICE";
|
|
146
|
+
START_FAILED: "START_FAILED";
|
|
147
|
+
DUPLICATE_PLUGIN: "DUPLICATE_PLUGIN";
|
|
148
|
+
INVALID_MANIFEST: "INVALID_MANIFEST";
|
|
149
|
+
DEPENDENCY_UNAVAILABLE: "DEPENDENCY_UNAVAILABLE";
|
|
150
|
+
OPERATION_FAILED: "OPERATION_FAILED";
|
|
151
|
+
}>>;
|
|
152
|
+
}, z.core.$strict>;
|
|
153
|
+
export type PluginReport = z.infer<typeof pluginReport>;
|
|
154
|
+
export declare const pluginStatusView: z.ZodObject<{
|
|
155
|
+
release: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
156
|
+
status: z.ZodEnum<{
|
|
157
|
+
UNCONFIGURED: "UNCONFIGURED";
|
|
158
|
+
UNAVAILABLE: "UNAVAILABLE";
|
|
159
|
+
}>;
|
|
160
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
status: z.ZodLiteral<"AVAILABLE">;
|
|
162
|
+
ricaVersion: z.ZodString;
|
|
163
|
+
releaseUrl: z.ZodURL;
|
|
164
|
+
upgrades: z.ZodArray<z.ZodObject<{
|
|
165
|
+
id: z.ZodString;
|
|
166
|
+
components: z.ZodArray<z.ZodObject<{
|
|
167
|
+
service: z.ZodString;
|
|
168
|
+
current: z.ZodObject<{
|
|
169
|
+
id: z.ZodString;
|
|
170
|
+
version: z.ZodString;
|
|
171
|
+
contractVersion: z.ZodNumber;
|
|
172
|
+
kind: z.ZodEnum<{
|
|
173
|
+
platform: "platform";
|
|
174
|
+
model: "model";
|
|
175
|
+
"platform-reader": "platform-reader";
|
|
176
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
177
|
+
}>;
|
|
178
|
+
}, z.core.$strict>;
|
|
179
|
+
target: z.ZodNullable<z.ZodObject<{
|
|
180
|
+
id: z.ZodString;
|
|
181
|
+
contractVersion: z.ZodNumber;
|
|
182
|
+
kind: z.ZodEnum<{
|
|
183
|
+
platform: "platform";
|
|
184
|
+
model: "model";
|
|
185
|
+
"platform-reader": "platform-reader";
|
|
186
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
187
|
+
}>;
|
|
188
|
+
version: z.ZodString;
|
|
189
|
+
}, z.core.$strict>>;
|
|
190
|
+
problem: z.ZodNullable<z.ZodEnum<{
|
|
191
|
+
MISSING_COMPONENT: "MISSING_COMPONENT";
|
|
192
|
+
INCOMPATIBLE_CONTRACT: "INCOMPATIBLE_CONTRACT";
|
|
193
|
+
DOWNGRADE: "DOWNGRADE";
|
|
194
|
+
}>>;
|
|
195
|
+
}, z.core.$strip>>;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
aligned: z.ZodArray<z.ZodObject<{
|
|
198
|
+
id: z.ZodString;
|
|
199
|
+
components: z.ZodArray<z.ZodObject<{
|
|
200
|
+
service: z.ZodString;
|
|
201
|
+
current: z.ZodObject<{
|
|
202
|
+
id: z.ZodString;
|
|
203
|
+
version: z.ZodString;
|
|
204
|
+
contractVersion: z.ZodNumber;
|
|
205
|
+
kind: z.ZodEnum<{
|
|
206
|
+
platform: "platform";
|
|
207
|
+
model: "model";
|
|
208
|
+
"platform-reader": "platform-reader";
|
|
209
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
210
|
+
}>;
|
|
211
|
+
}, z.core.$strict>;
|
|
212
|
+
target: z.ZodNullable<z.ZodObject<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
contractVersion: z.ZodNumber;
|
|
215
|
+
kind: z.ZodEnum<{
|
|
216
|
+
platform: "platform";
|
|
217
|
+
model: "model";
|
|
218
|
+
"platform-reader": "platform-reader";
|
|
219
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
220
|
+
}>;
|
|
221
|
+
version: z.ZodString;
|
|
222
|
+
}, z.core.$strict>>;
|
|
223
|
+
problem: z.ZodNullable<z.ZodEnum<{
|
|
224
|
+
MISSING_COMPONENT: "MISSING_COMPONENT";
|
|
225
|
+
INCOMPATIBLE_CONTRACT: "INCOMPATIBLE_CONTRACT";
|
|
226
|
+
DOWNGRADE: "DOWNGRADE";
|
|
227
|
+
}>>;
|
|
228
|
+
}, z.core.$strip>>;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
}, z.core.$strip>], "status">>;
|
|
231
|
+
services: z.ZodArray<z.ZodObject<{
|
|
232
|
+
service: z.ZodString;
|
|
233
|
+
catalog: z.ZodArray<z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
version: z.ZodString;
|
|
236
|
+
contractVersion: z.ZodNumber;
|
|
237
|
+
kind: z.ZodEnum<{
|
|
238
|
+
platform: "platform";
|
|
239
|
+
model: "model";
|
|
240
|
+
"platform-reader": "platform-reader";
|
|
241
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
242
|
+
}>;
|
|
243
|
+
}, z.core.$strict>>;
|
|
244
|
+
report: z.ZodNullable<z.ZodObject<{
|
|
245
|
+
status: z.ZodEnum<{
|
|
246
|
+
READY: "READY";
|
|
247
|
+
COMPLETED: "COMPLETED";
|
|
248
|
+
FAILED: "FAILED";
|
|
249
|
+
}>;
|
|
250
|
+
observedAt: z.ZodISODateTime;
|
|
251
|
+
plugins: z.ZodArray<z.ZodObject<{
|
|
252
|
+
id: z.ZodString;
|
|
253
|
+
version: z.ZodString;
|
|
254
|
+
contractVersion: z.ZodNumber;
|
|
255
|
+
kind: z.ZodEnum<{
|
|
256
|
+
platform: "platform";
|
|
257
|
+
model: "model";
|
|
258
|
+
"platform-reader": "platform-reader";
|
|
259
|
+
"platform-reply-executor": "platform-reply-executor";
|
|
260
|
+
}>;
|
|
261
|
+
}, z.core.$strict>>;
|
|
262
|
+
diagnostic: z.ZodOptional<z.ZodEnum<{
|
|
263
|
+
INCOMPATIBLE_CONTRACT: "INCOMPATIBLE_CONTRACT";
|
|
264
|
+
UNKNOWN_PLUGIN: "UNKNOWN_PLUGIN";
|
|
265
|
+
DUPLICATE_SELECTION: "DUPLICATE_SELECTION";
|
|
266
|
+
INVALID_CONFIG: "INVALID_CONFIG";
|
|
267
|
+
MISSING_SERVICE: "MISSING_SERVICE";
|
|
268
|
+
START_FAILED: "START_FAILED";
|
|
269
|
+
DUPLICATE_PLUGIN: "DUPLICATE_PLUGIN";
|
|
270
|
+
INVALID_MANIFEST: "INVALID_MANIFEST";
|
|
271
|
+
DEPENDENCY_UNAVAILABLE: "DEPENDENCY_UNAVAILABLE";
|
|
272
|
+
OPERATION_FAILED: "OPERATION_FAILED";
|
|
273
|
+
}>>;
|
|
274
|
+
}, z.core.$strict>>;
|
|
275
|
+
}, z.core.$strip>>;
|
|
276
|
+
}, z.core.$strip>;
|
|
277
|
+
export {};
|
package/plugin-status.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from '@hono/zod-openapi';
|
|
2
|
+
const pluginService = z.string().regex(/^[a-z0-9-]{1,80}$/);
|
|
3
|
+
const pluginIdentity = z.strictObject({
|
|
4
|
+
id: z.string().regex(/^[a-z0-9-]{1,80}$/),
|
|
5
|
+
version: z.string().regex(/^\d+\.\d+\.\d+$/),
|
|
6
|
+
contractVersion: z.number().int().positive(),
|
|
7
|
+
kind: z.enum(['platform', 'model', 'platform-reader', 'platform-reply-executor']),
|
|
8
|
+
});
|
|
9
|
+
const releaseVersion = z.string().regex(/^(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})$/u);
|
|
10
|
+
const releaseUrl = z.url({ protocol: /^https$/ }).max(2048).refine((value) => {
|
|
11
|
+
const url = new URL(value);
|
|
12
|
+
return !url.username && !url.password && !url.search && !url.hash;
|
|
13
|
+
});
|
|
14
|
+
const releaseComponent = pluginIdentity.extend({ version: releaseVersion });
|
|
15
|
+
export const pluginReleaseManifest = z.strictObject({
|
|
16
|
+
schemaVersion: z.literal(1),
|
|
17
|
+
ricaVersion: releaseVersion,
|
|
18
|
+
releaseUrl,
|
|
19
|
+
components: z.array(releaseComponent).min(1).max(100).refine((entries) => new Set(entries.map(({ kind, id }) => kind + '/' + id)).size === entries.length),
|
|
20
|
+
});
|
|
21
|
+
const pluginUpgrade = z.object({
|
|
22
|
+
id: pluginIdentity.shape.id,
|
|
23
|
+
components: z.array(z.object({
|
|
24
|
+
service: pluginService,
|
|
25
|
+
current: pluginIdentity,
|
|
26
|
+
target: releaseComponent.nullable(),
|
|
27
|
+
problem: z.enum(['MISSING_COMPONENT', 'INCOMPATIBLE_CONTRACT', 'DOWNGRADE']).nullable(),
|
|
28
|
+
})),
|
|
29
|
+
});
|
|
30
|
+
export const pluginReleaseView = z.discriminatedUnion('status', [
|
|
31
|
+
z.object({ status: z.enum(['UNCONFIGURED', 'UNAVAILABLE']) }),
|
|
32
|
+
z.object({
|
|
33
|
+
status: z.literal('AVAILABLE'), ricaVersion: releaseVersion, releaseUrl,
|
|
34
|
+
upgrades: z.array(pluginUpgrade), aligned: z.array(pluginUpgrade),
|
|
35
|
+
}),
|
|
36
|
+
]);
|
|
37
|
+
export const pluginDiagnostic = z.enum([
|
|
38
|
+
'UNKNOWN_PLUGIN', 'DUPLICATE_SELECTION', 'INVALID_CONFIG', 'MISSING_SERVICE', 'START_FAILED',
|
|
39
|
+
'INCOMPATIBLE_CONTRACT', 'DUPLICATE_PLUGIN', 'INVALID_MANIFEST', 'DEPENDENCY_UNAVAILABLE', 'OPERATION_FAILED',
|
|
40
|
+
]);
|
|
41
|
+
export const pluginReport = z.strictObject({
|
|
42
|
+
status: z.enum(['READY', 'COMPLETED', 'FAILED']),
|
|
43
|
+
observedAt: z.iso.datetime(),
|
|
44
|
+
plugins: z.array(pluginIdentity).max(20),
|
|
45
|
+
diagnostic: pluginDiagnostic.optional(),
|
|
46
|
+
});
|
|
47
|
+
export const pluginStatusView = z.object({
|
|
48
|
+
release: pluginReleaseView.optional(),
|
|
49
|
+
services: z.array(z.object({
|
|
50
|
+
service: pluginService,
|
|
51
|
+
catalog: z.array(pluginIdentity),
|
|
52
|
+
report: pluginReport.nullable(),
|
|
53
|
+
})),
|
|
54
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type RunTime = Readonly<{
|
|
2
|
+
occurredAt: string;
|
|
3
|
+
now: string;
|
|
4
|
+
timezone: string;
|
|
5
|
+
localDate: string;
|
|
6
|
+
eventLocalDate: string;
|
|
7
|
+
localHour: number;
|
|
8
|
+
}>;
|
|
9
|
+
export type IdentityState = Readonly<{
|
|
10
|
+
revision: number | null;
|
|
11
|
+
ruleVersion: number;
|
|
12
|
+
configurationVersion: number | null;
|
|
13
|
+
sharedEnergy: 'LOW' | 'NORMAL' | 'HIGH';
|
|
14
|
+
motivation: {
|
|
15
|
+
exploration: number;
|
|
16
|
+
expression: number;
|
|
17
|
+
social: number;
|
|
18
|
+
rest: number;
|
|
19
|
+
};
|
|
20
|
+
affect: {
|
|
21
|
+
pleasure: number;
|
|
22
|
+
arousal: number;
|
|
23
|
+
energy: number;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
export type SubjectiveBelief = Readonly<{
|
|
27
|
+
id: string;
|
|
28
|
+
version: number;
|
|
29
|
+
kind: 'OPINION' | 'PREFERENCE';
|
|
30
|
+
statement: string;
|
|
31
|
+
confidence: number;
|
|
32
|
+
subjective: true;
|
|
33
|
+
}>;
|
|
34
|
+
export type Continuity = {
|
|
35
|
+
runId: string;
|
|
36
|
+
characterId: string;
|
|
37
|
+
identityId: string;
|
|
38
|
+
accountId: string;
|
|
39
|
+
triggerId: string;
|
|
40
|
+
bindingVersion: number;
|
|
41
|
+
mode: 'SIMULATION';
|
|
42
|
+
platform: string;
|
|
43
|
+
instanceKey: string;
|
|
44
|
+
conversationId: string | null;
|
|
45
|
+
contactId: string | null;
|
|
46
|
+
occurredAt: string;
|
|
47
|
+
now: string;
|
|
48
|
+
timezone: string;
|
|
49
|
+
recent: readonly {
|
|
50
|
+
kind: string;
|
|
51
|
+
occurredAt: string;
|
|
52
|
+
}[];
|
|
53
|
+
nextCommitmentAt: string | null;
|
|
54
|
+
nextScheduleAt: string | null;
|
|
55
|
+
relationship: {
|
|
56
|
+
confirmedInteractions: number;
|
|
57
|
+
lastConfirmedAt: string | null;
|
|
58
|
+
} | null;
|
|
59
|
+
goals: readonly {
|
|
60
|
+
id: string;
|
|
61
|
+
version: number;
|
|
62
|
+
origin: 'ADMIN' | 'SELF';
|
|
63
|
+
title: string;
|
|
64
|
+
budget: number;
|
|
65
|
+
priority: number;
|
|
66
|
+
dueAt: string;
|
|
67
|
+
nextStep: string | null;
|
|
68
|
+
}[];
|
|
69
|
+
self: {
|
|
70
|
+
coreVersion: number;
|
|
71
|
+
name: string | null;
|
|
72
|
+
fictionalBackground: string | null;
|
|
73
|
+
facts: readonly {
|
|
74
|
+
id: string;
|
|
75
|
+
revision: number;
|
|
76
|
+
content: string;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export type RunContinuity = Omit<Continuity, 'occurredAt' | 'now' | 'timezone'> & {
|
|
81
|
+
time: RunTime;
|
|
82
|
+
identityState: IdentityState;
|
|
83
|
+
beliefs: readonly SubjectiveBelief[];
|
|
84
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/schedules.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from '@hono/zod-openapi';
|
|
2
|
+
export declare const scheduleUpdate: z.ZodObject<{
|
|
3
|
+
zone: z.ZodString;
|
|
4
|
+
enabled: z.ZodBoolean;
|
|
5
|
+
rule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
|
+
kind: z.ZodLiteral<"DAILY">;
|
|
7
|
+
localTime: z.ZodString;
|
|
8
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
9
|
+
kind: z.ZodLiteral<"REMINDER">;
|
|
10
|
+
dueAt: z.ZodISODateTime;
|
|
11
|
+
}, z.core.$strict>], "kind">;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
export declare const scheduleInput: z.ZodObject<{
|
|
14
|
+
zone: z.ZodString;
|
|
15
|
+
enabled: z.ZodBoolean;
|
|
16
|
+
rule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"DAILY">;
|
|
18
|
+
localTime: z.ZodString;
|
|
19
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
20
|
+
kind: z.ZodLiteral<"REMINDER">;
|
|
21
|
+
dueAt: z.ZodISODateTime;
|
|
22
|
+
}, z.core.$strict>], "kind">;
|
|
23
|
+
scheduleKey: z.ZodString;
|
|
24
|
+
accountId: z.ZodPipe<z.ZodUUID, z.ZodTransform<string, string>>;
|
|
25
|
+
conversationId: z.ZodPipe<z.ZodUUID, z.ZodTransform<string, string>>;
|
|
26
|
+
contactId: z.ZodOptional<z.ZodPipe<z.ZodUUID, z.ZodTransform<string, string>>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export declare const scheduleView: z.ZodObject<{
|
|
29
|
+
zone: z.ZodString;
|
|
30
|
+
enabled: z.ZodBoolean;
|
|
31
|
+
rule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<"DAILY">;
|
|
33
|
+
localTime: z.ZodString;
|
|
34
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<"REMINDER">;
|
|
36
|
+
dueAt: z.ZodISODateTime;
|
|
37
|
+
}, z.core.$strict>], "kind">;
|
|
38
|
+
id: z.ZodPipe<z.ZodUUID, z.ZodTransform<string, string>>;
|
|
39
|
+
scheduleKey: z.ZodString;
|
|
40
|
+
accountId: z.ZodPipe<z.ZodUUID, z.ZodTransform<string, string>>;
|
|
41
|
+
conversationId: z.ZodPipe<z.ZodUUID, z.ZodTransform<string, string>>;
|
|
42
|
+
contactId: z.ZodNullable<z.ZodPipe<z.ZodUUID, z.ZodTransform<string, string>>>;
|
|
43
|
+
version: z.ZodNumber;
|
|
44
|
+
commitmentId: z.ZodNullable<z.ZodPipe<z.ZodUUID, z.ZodTransform<string, string>>>;
|
|
45
|
+
nextAt: z.ZodNullable<z.ZodISODateTime>;
|
|
46
|
+
}, z.core.$strict>;
|
package/schedules.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from '@hono/zod-openapi';
|
|
2
|
+
import { characterInput, resourceId } from './management.js';
|
|
3
|
+
const scheduleRule = z.discriminatedUnion('kind', [
|
|
4
|
+
z.strictObject({ kind: z.literal('DAILY'), localTime: z.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/) }),
|
|
5
|
+
z.strictObject({ kind: z.literal('REMINDER'), dueAt: z.iso.datetime() }),
|
|
6
|
+
]);
|
|
7
|
+
export const scheduleUpdate = z.strictObject({
|
|
8
|
+
zone: characterInput.shape.timezone, enabled: z.boolean(), rule: scheduleRule,
|
|
9
|
+
});
|
|
10
|
+
export const scheduleInput = scheduleUpdate.extend({
|
|
11
|
+
scheduleKey: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/),
|
|
12
|
+
accountId: resourceId, conversationId: resourceId, contactId: resourceId.optional(),
|
|
13
|
+
});
|
|
14
|
+
export const scheduleView = scheduleUpdate.extend({
|
|
15
|
+
id: resourceId, scheduleKey: z.string(), accountId: resourceId,
|
|
16
|
+
conversationId: resourceId, contactId: resourceId.nullable(),
|
|
17
|
+
version: z.number().int(), commitmentId: resourceId.nullable(), nextAt: z.iso.datetime().nullable(),
|
|
18
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from '@hono/zod-openapi';
|
|
2
|
+
export declare const modelFollowUp: z.ZodObject<{
|
|
3
|
+
additionalTasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4
|
+
platform: z.ZodString;
|
|
5
|
+
task: z.ZodString;
|
|
6
|
+
}, z.core.$strict>>>;
|
|
7
|
+
collaboratorPlatforms: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
|
+
kind: z.ZodEnum<{
|
|
9
|
+
PLAN: "PLAN";
|
|
10
|
+
COMMITMENT: "COMMITMENT";
|
|
11
|
+
}>;
|
|
12
|
+
title: z.ZodString;
|
|
13
|
+
task: z.ZodString;
|
|
14
|
+
dueAt: z.ZodOptional<z.ZodISODateTime>;
|
|
15
|
+
dailyAt: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export declare const simulationFollowUp: z.ZodObject<{
|
|
18
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
19
|
+
platform: z.ZodString;
|
|
20
|
+
task: z.ZodOptional<z.ZodString>;
|
|
21
|
+
identityId: z.ZodUUID;
|
|
22
|
+
accountId: z.ZodUUID;
|
|
23
|
+
identity: z.ZodString;
|
|
24
|
+
account: z.ZodString;
|
|
25
|
+
}, z.core.$strict>>>;
|
|
26
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
27
|
+
kind: z.ZodEnum<{
|
|
28
|
+
PLAN: "PLAN";
|
|
29
|
+
COMMITMENT: "COMMITMENT";
|
|
30
|
+
}>;
|
|
31
|
+
title: z.ZodString;
|
|
32
|
+
task: z.ZodString;
|
|
33
|
+
dueAt: z.ZodOptional<z.ZodISODateTime>;
|
|
34
|
+
dailyAt: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from '@hono/zod-openapi';
|
|
2
|
+
import { planningTask } from './plans.js';
|
|
3
|
+
const fields = {
|
|
4
|
+
kind: z.enum(['PLAN', 'COMMITMENT']),
|
|
5
|
+
title: z.string().trim().min(1).max(72).regex(/^[^\p{Cc}]+$/u),
|
|
6
|
+
task: planningTask,
|
|
7
|
+
dueAt: z.iso.datetime().optional(),
|
|
8
|
+
dailyAt: z.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/).optional(),
|
|
9
|
+
};
|
|
10
|
+
const timing = ({ kind, dueAt, dailyAt }) => dailyAt ? kind === 'PLAN' && !dueAt : !!dueAt;
|
|
11
|
+
const platform = z.string().regex(/^[a-z0-9-]{1,80}$/u);
|
|
12
|
+
const participantTask = z.strictObject({ platform, task: planningTask });
|
|
13
|
+
export const modelFollowUp = z.strictObject({
|
|
14
|
+
...fields,
|
|
15
|
+
additionalTasks: z.array(participantTask).max(2).optional(),
|
|
16
|
+
collaboratorPlatforms: z.array(platform).max(2).optional(),
|
|
17
|
+
}).refine(timing).refine(({ kind, additionalTasks, collaboratorPlatforms }) => kind === 'PLAN' ? !collaboratorPlatforms?.length : !additionalTasks?.length);
|
|
18
|
+
export const simulationFollowUp = z.strictObject({
|
|
19
|
+
...fields,
|
|
20
|
+
participants: z.array(z.strictObject({
|
|
21
|
+
platform,
|
|
22
|
+
task: planningTask.optional(),
|
|
23
|
+
identityId: z.uuid(),
|
|
24
|
+
accountId: z.uuid(),
|
|
25
|
+
identity: z.string(),
|
|
26
|
+
account: z.string(),
|
|
27
|
+
})).max(2).optional(),
|
|
28
|
+
zone: z.string().optional(),
|
|
29
|
+
}).refine(timing).refine(({ dailyAt, zone }) => !dailyAt || !!zone);
|