@kb-labs/steward-contracts 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/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @kb-labs/steward-contracts
2
+
3
+ > Part of [KB Labs](https://github.com/kb-labs-team/kb-labs) ecosystem.
4
+
5
+ Domain types and input schemas for the steward personal PM/CRM plugin.
@@ -0,0 +1,469 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * System fields every stored document carries. Structurally compatible with
5
+ * the platform's `BaseDocument` (`@kb-labs/core-platform`) without importing
6
+ * it — contracts stays dependency-free beyond zod.
7
+ */
8
+ interface Timestamped {
9
+ id: string;
10
+ createdAt: number;
11
+ updatedAt: number;
12
+ }
13
+ /** The set of entities an `Event` can be attached to. */
14
+ type EventSubjectType = 'project' | 'person' | 'commitment' | 'company' | 'resource';
15
+
16
+ type ProjectStatus = 'active' | 'paused' | 'archived';
17
+ interface Project extends Timestamped {
18
+ name: string;
19
+ status: ProjectStatus;
20
+ description?: string;
21
+ }
22
+ /**
23
+ * Universal attachment on a project — repo, dev/prod stand, dashboard, doc...
24
+ * `type` is a free string on purpose (see ADR-0001 §Resource).
25
+ * `url` and `content` may both be set, or either alone.
26
+ */
27
+ interface Resource extends Timestamped {
28
+ projectId: string;
29
+ type: string;
30
+ label: string;
31
+ url?: string;
32
+ content?: string;
33
+ }
34
+
35
+ type ContactChannel = 'telegram' | 'email' | 'phone' | 'other';
36
+ interface Contact {
37
+ channel: ContactChannel;
38
+ value: string;
39
+ /** Lower = preferred. Used to pick the primary channel when several exist. */
40
+ priority: number;
41
+ }
42
+ /** Global contact — not owned by any single project. */
43
+ interface Person extends Timestamped {
44
+ name: string;
45
+ contacts: Contact[];
46
+ companyId?: string;
47
+ /** Competencies reachable from any project — see ADR-0001 §Routing. */
48
+ globalTopics: string[];
49
+ }
50
+ /**
51
+ * Thin entity: `{id, name}` only in MVP. The link (`Person.companyId`) is
52
+ * fixed now precisely so company-level features can grow later without a
53
+ * migration — see ADR-0001 §"Миграционная политика".
54
+ */
55
+ interface Company extends Timestamped {
56
+ name: string;
57
+ }
58
+ /** Person ↔ Project link. `priority` doubles as the whoToContact fallback order. */
59
+ interface ProjectMember extends Timestamped {
60
+ personId: string;
61
+ projectId: string;
62
+ role: string;
63
+ /** Competencies in the context of this project — augments `globalTopics`. */
64
+ topics?: string[];
65
+ /** Lower = contacted first when multiple members match a topic. */
66
+ priority: number;
67
+ }
68
+
69
+ type CommitmentStatus = 'open' | 'done' | 'dropped';
70
+ /**
71
+ * A promise to a person with a soft deadline — distinct from a formal task.
72
+ * See ADR-0001 §Commitment.
73
+ */
74
+ interface Commitment extends Timestamped {
75
+ text: string;
76
+ personId?: string;
77
+ projectId?: string;
78
+ status: CommitmentStatus;
79
+ remindAt?: number;
80
+ /** Set when snoozed; review ignores the commitment until this passes. */
81
+ snoozedUntil?: number;
82
+ /** Days without update after which an open commitment is considered stale. */
83
+ staleAfterDays: number;
84
+ }
85
+
86
+ type EventKind = 'note' | 'project.created' | 'project.status_changed' | 'commitment.created' | 'commitment.done' | 'commitment.dropped' | 'commitment.rescheduled' | 'person.merged' | 'review.generated' | 'integrity.checked' | 'export.completed' | 'backfill.imported';
87
+ declare const SEMANTIC_EVENT_KINDS: readonly EventKind[];
88
+ declare const DERIVED_EVENT_KINDS: readonly EventKind[];
89
+ declare const TRACE_EVENT_KINDS: readonly EventKind[];
90
+ /**
91
+ * Append-only history log — the thing that makes the memory "infinite".
92
+ * `subjectType`/`subjectId` are a polymorphic reference on purpose (flat,
93
+ * not nested — `DocumentFilter` only supports top-level keys) so new
94
+ * entities never require a schema change here. See ADR-0001 §Event.
95
+ */
96
+ interface Event extends Timestamped {
97
+ at: number;
98
+ kind: EventKind;
99
+ subjectType: EventSubjectType;
100
+ subjectId: string;
101
+ reason?: string;
102
+ text?: string;
103
+ meta?: Record<string, unknown>;
104
+ }
105
+
106
+ /**
107
+ * Topic dictionary with aliases. Normalized on write, not on read — a
108
+ * deterministic lookup over an uncontrolled vocabulary is worse than a
109
+ * fuzzy one (ADR-0001 §Routing). Entries are created deliberately.
110
+ */
111
+ interface Topic extends Timestamped {
112
+ name: string;
113
+ aliases: string[];
114
+ }
115
+
116
+ /**
117
+ * Typed but not implemented in MVP — deferred as a whole new collection,
118
+ * nothing to migrate later. See ADR-0001 §"Миграционная политика".
119
+ */
120
+ type TaskStatus = 'open' | 'done';
121
+ interface Task extends Timestamped {
122
+ title: string;
123
+ projectId?: string;
124
+ status: TaskStatus;
125
+ dueDate?: number;
126
+ }
127
+
128
+ /**
129
+ * Collection names — must match what `core` passes to `ensureCollection`.
130
+ * Actual storage names are namespaced by the platform as `steward__<name>`.
131
+ */
132
+ declare const COLLECTIONS: {
133
+ readonly projects: "projects";
134
+ readonly resources: "resources";
135
+ readonly people: "people";
136
+ readonly companies: "companies";
137
+ readonly projectMembers: "project_members";
138
+ readonly commitments: "commitments";
139
+ readonly events: "events";
140
+ readonly topics: "topics";
141
+ };
142
+ /** Default commitment staleness threshold — see ADR-0001 §Commitment. */
143
+ declare const DEFAULT_STALE_AFTER_DAYS = 14;
144
+ /** Event retention classes — see ADR-0001 §"Ретеншен событий". `semantic` is never deleted. */
145
+ declare const EVENT_RETENTION_MAX_AGE_MS: Record<'derived' | 'trace', number>;
146
+
147
+ /**
148
+ * Zod schemas for everything that crosses the CLI/MCP boundary — command
149
+ * inputs and the results agents read back. Domain models in `types/` stay
150
+ * plain interfaces (see ADR-0001 §"Разделение core/entry").
151
+ */
152
+
153
+ declare const AddProjectInputSchema: z.ZodObject<{
154
+ name: z.ZodString;
155
+ status: z.ZodDefault<z.ZodEnum<["active", "paused", "archived"]>>;
156
+ description: z.ZodOptional<z.ZodString>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ name: string;
159
+ status: "active" | "paused" | "archived";
160
+ description?: string | undefined;
161
+ }, {
162
+ name: string;
163
+ status?: "active" | "paused" | "archived" | undefined;
164
+ description?: string | undefined;
165
+ }>;
166
+ type AddProjectInput = z.infer<typeof AddProjectInputSchema>;
167
+ declare const UpdateProjectInputSchema: z.ZodObject<{
168
+ id: z.ZodString;
169
+ status: z.ZodOptional<z.ZodEnum<["active", "paused", "archived"]>>;
170
+ description: z.ZodOptional<z.ZodString>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ id: string;
173
+ status?: "active" | "paused" | "archived" | undefined;
174
+ description?: string | undefined;
175
+ }, {
176
+ id: string;
177
+ status?: "active" | "paused" | "archived" | undefined;
178
+ description?: string | undefined;
179
+ }>;
180
+ type UpdateProjectInput = z.infer<typeof UpdateProjectInputSchema>;
181
+ declare const ListProjectsInputSchema: z.ZodObject<{
182
+ status: z.ZodOptional<z.ZodEnum<["active", "paused", "archived"]>>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ status?: "active" | "paused" | "archived" | undefined;
185
+ }, {
186
+ status?: "active" | "paused" | "archived" | undefined;
187
+ }>;
188
+ type ListProjectsInput = z.infer<typeof ListProjectsInputSchema>;
189
+ declare const AddResourceInputSchema: z.ZodEffects<z.ZodObject<{
190
+ projectId: z.ZodString;
191
+ type: z.ZodString;
192
+ label: z.ZodString;
193
+ url: z.ZodOptional<z.ZodString>;
194
+ content: z.ZodOptional<z.ZodString>;
195
+ }, "strip", z.ZodTypeAny, {
196
+ type: string;
197
+ projectId: string;
198
+ label: string;
199
+ url?: string | undefined;
200
+ content?: string | undefined;
201
+ }, {
202
+ type: string;
203
+ projectId: string;
204
+ label: string;
205
+ url?: string | undefined;
206
+ content?: string | undefined;
207
+ }>, {
208
+ type: string;
209
+ projectId: string;
210
+ label: string;
211
+ url?: string | undefined;
212
+ content?: string | undefined;
213
+ }, {
214
+ type: string;
215
+ projectId: string;
216
+ label: string;
217
+ url?: string | undefined;
218
+ content?: string | undefined;
219
+ }>;
220
+ type AddResourceInput = z.infer<typeof AddResourceInputSchema>;
221
+ declare const ContactInputSchema: z.ZodObject<{
222
+ channel: z.ZodEnum<["telegram", "email", "phone", "other"]>;
223
+ value: z.ZodString;
224
+ priority: z.ZodDefault<z.ZodNumber>;
225
+ }, "strip", z.ZodTypeAny, {
226
+ value: string;
227
+ channel: "telegram" | "email" | "phone" | "other";
228
+ priority: number;
229
+ }, {
230
+ value: string;
231
+ channel: "telegram" | "email" | "phone" | "other";
232
+ priority?: number | undefined;
233
+ }>;
234
+ declare const AddPersonInputSchema: z.ZodObject<{
235
+ name: z.ZodString;
236
+ contacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
237
+ channel: z.ZodEnum<["telegram", "email", "phone", "other"]>;
238
+ value: z.ZodString;
239
+ priority: z.ZodDefault<z.ZodNumber>;
240
+ }, "strip", z.ZodTypeAny, {
241
+ value: string;
242
+ channel: "telegram" | "email" | "phone" | "other";
243
+ priority: number;
244
+ }, {
245
+ value: string;
246
+ channel: "telegram" | "email" | "phone" | "other";
247
+ priority?: number | undefined;
248
+ }>, "many">>;
249
+ companyId: z.ZodOptional<z.ZodString>;
250
+ globalTopics: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
251
+ }, "strip", z.ZodTypeAny, {
252
+ name: string;
253
+ contacts: {
254
+ value: string;
255
+ channel: "telegram" | "email" | "phone" | "other";
256
+ priority: number;
257
+ }[];
258
+ globalTopics: string[];
259
+ companyId?: string | undefined;
260
+ }, {
261
+ name: string;
262
+ contacts?: {
263
+ value: string;
264
+ channel: "telegram" | "email" | "phone" | "other";
265
+ priority?: number | undefined;
266
+ }[] | undefined;
267
+ companyId?: string | undefined;
268
+ globalTopics?: string[] | undefined;
269
+ }>;
270
+ type AddPersonInput = z.infer<typeof AddPersonInputSchema>;
271
+ declare const UpdatePersonInputSchema: z.ZodObject<{
272
+ id: z.ZodString;
273
+ name: z.ZodOptional<z.ZodString>;
274
+ contacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
275
+ channel: z.ZodEnum<["telegram", "email", "phone", "other"]>;
276
+ value: z.ZodString;
277
+ priority: z.ZodDefault<z.ZodNumber>;
278
+ }, "strip", z.ZodTypeAny, {
279
+ value: string;
280
+ channel: "telegram" | "email" | "phone" | "other";
281
+ priority: number;
282
+ }, {
283
+ value: string;
284
+ channel: "telegram" | "email" | "phone" | "other";
285
+ priority?: number | undefined;
286
+ }>, "many">>;
287
+ companyId: z.ZodOptional<z.ZodString>;
288
+ globalTopics: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
289
+ }, "strip", z.ZodTypeAny, {
290
+ id: string;
291
+ name?: string | undefined;
292
+ contacts?: {
293
+ value: string;
294
+ channel: "telegram" | "email" | "phone" | "other";
295
+ priority: number;
296
+ }[] | undefined;
297
+ companyId?: string | undefined;
298
+ globalTopics?: string[] | undefined;
299
+ }, {
300
+ id: string;
301
+ name?: string | undefined;
302
+ contacts?: {
303
+ value: string;
304
+ channel: "telegram" | "email" | "phone" | "other";
305
+ priority?: number | undefined;
306
+ }[] | undefined;
307
+ companyId?: string | undefined;
308
+ globalTopics?: string[] | undefined;
309
+ }>;
310
+ type UpdatePersonInput = z.infer<typeof UpdatePersonInputSchema>;
311
+ declare const AddCompanyInputSchema: z.ZodObject<{
312
+ name: z.ZodString;
313
+ }, "strip", z.ZodTypeAny, {
314
+ name: string;
315
+ }, {
316
+ name: string;
317
+ }>;
318
+ type AddCompanyInput = z.infer<typeof AddCompanyInputSchema>;
319
+ declare const AddMemberInputSchema: z.ZodObject<{
320
+ personId: z.ZodString;
321
+ projectId: z.ZodString;
322
+ role: z.ZodString;
323
+ topics: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
324
+ priority: z.ZodDefault<z.ZodNumber>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ projectId: string;
327
+ priority: number;
328
+ personId: string;
329
+ role: string;
330
+ topics?: string[] | undefined;
331
+ }, {
332
+ projectId: string;
333
+ personId: string;
334
+ role: string;
335
+ topics?: string[] | undefined;
336
+ priority?: number | undefined;
337
+ }>;
338
+ type AddMemberInput = z.infer<typeof AddMemberInputSchema>;
339
+ declare const WhoToContactInputSchema: z.ZodObject<{
340
+ topic: z.ZodString;
341
+ projectId: z.ZodOptional<z.ZodString>;
342
+ }, "strip", z.ZodTypeAny, {
343
+ topic: string;
344
+ projectId?: string | undefined;
345
+ }, {
346
+ topic: string;
347
+ projectId?: string | undefined;
348
+ }>;
349
+ type WhoToContactInput = z.infer<typeof WhoToContactInputSchema>;
350
+ declare const AddCommitmentInputSchema: z.ZodObject<{
351
+ text: z.ZodString;
352
+ personId: z.ZodOptional<z.ZodString>;
353
+ projectId: z.ZodOptional<z.ZodString>;
354
+ remindAt: z.ZodOptional<z.ZodNumber>;
355
+ staleAfterDays: z.ZodDefault<z.ZodNumber>;
356
+ }, "strip", z.ZodTypeAny, {
357
+ text: string;
358
+ staleAfterDays: number;
359
+ projectId?: string | undefined;
360
+ personId?: string | undefined;
361
+ remindAt?: number | undefined;
362
+ }, {
363
+ text: string;
364
+ projectId?: string | undefined;
365
+ personId?: string | undefined;
366
+ remindAt?: number | undefined;
367
+ staleAfterDays?: number | undefined;
368
+ }>;
369
+ type AddCommitmentInput = z.infer<typeof AddCommitmentInputSchema>;
370
+ declare const ListCommitmentsInputSchema: z.ZodObject<{
371
+ status: z.ZodOptional<z.ZodEnum<["open", "done", "dropped"]>>;
372
+ projectId: z.ZodOptional<z.ZodString>;
373
+ staleOnly: z.ZodDefault<z.ZodBoolean>;
374
+ }, "strip", z.ZodTypeAny, {
375
+ staleOnly: boolean;
376
+ status?: "open" | "done" | "dropped" | undefined;
377
+ projectId?: string | undefined;
378
+ }, {
379
+ status?: "open" | "done" | "dropped" | undefined;
380
+ projectId?: string | undefined;
381
+ staleOnly?: boolean | undefined;
382
+ }>;
383
+ type ListCommitmentsInput = z.infer<typeof ListCommitmentsInputSchema>;
384
+ declare const CommitmentDoneInputSchema: z.ZodObject<{
385
+ id: z.ZodString;
386
+ }, "strip", z.ZodTypeAny, {
387
+ id: string;
388
+ }, {
389
+ id: string;
390
+ }>;
391
+ type CommitmentDoneInput = z.infer<typeof CommitmentDoneInputSchema>;
392
+ declare const CommitmentDropInputSchema: z.ZodObject<{
393
+ id: z.ZodString;
394
+ reason: z.ZodString;
395
+ }, "strip", z.ZodTypeAny, {
396
+ id: string;
397
+ reason: string;
398
+ }, {
399
+ id: string;
400
+ reason: string;
401
+ }>;
402
+ type CommitmentDropInput = z.infer<typeof CommitmentDropInputSchema>;
403
+ declare const CommitmentSnoozeInputSchema: z.ZodObject<{
404
+ id: z.ZodString;
405
+ until: z.ZodNumber;
406
+ reason: z.ZodOptional<z.ZodString>;
407
+ }, "strip", z.ZodTypeAny, {
408
+ id: string;
409
+ until: number;
410
+ reason?: string | undefined;
411
+ }, {
412
+ id: string;
413
+ until: number;
414
+ reason?: string | undefined;
415
+ }>;
416
+ type CommitmentSnoozeInput = z.infer<typeof CommitmentSnoozeInputSchema>;
417
+ declare const AddEventInputSchema: z.ZodObject<{
418
+ subjectType: z.ZodEnum<["project", "person", "commitment", "company", "resource"]>;
419
+ subjectId: z.ZodString;
420
+ kind: z.ZodDefault<z.ZodString>;
421
+ text: z.ZodOptional<z.ZodString>;
422
+ reason: z.ZodOptional<z.ZodString>;
423
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
424
+ }, "strip", z.ZodTypeAny, {
425
+ subjectType: "project" | "person" | "commitment" | "company" | "resource";
426
+ subjectId: string;
427
+ kind: string;
428
+ text?: string | undefined;
429
+ reason?: string | undefined;
430
+ meta?: Record<string, unknown> | undefined;
431
+ }, {
432
+ subjectType: "project" | "person" | "commitment" | "company" | "resource";
433
+ subjectId: string;
434
+ text?: string | undefined;
435
+ reason?: string | undefined;
436
+ kind?: string | undefined;
437
+ meta?: Record<string, unknown> | undefined;
438
+ }>;
439
+ type AddEventInput = z.infer<typeof AddEventInputSchema>;
440
+ declare const ListEventsInputSchema: z.ZodObject<{
441
+ subjectType: z.ZodOptional<z.ZodEnum<["project", "person", "commitment", "company", "resource"]>>;
442
+ subjectId: z.ZodOptional<z.ZodString>;
443
+ kind: z.ZodOptional<z.ZodString>;
444
+ since: z.ZodOptional<z.ZodNumber>;
445
+ }, "strip", z.ZodTypeAny, {
446
+ subjectType?: "project" | "person" | "commitment" | "company" | "resource" | undefined;
447
+ subjectId?: string | undefined;
448
+ kind?: string | undefined;
449
+ since?: number | undefined;
450
+ }, {
451
+ subjectType?: "project" | "person" | "commitment" | "company" | "resource" | undefined;
452
+ subjectId?: string | undefined;
453
+ kind?: string | undefined;
454
+ since?: number | undefined;
455
+ }>;
456
+ type ListEventsInput = z.infer<typeof ListEventsInputSchema>;
457
+ declare const AddTopicInputSchema: z.ZodObject<{
458
+ name: z.ZodString;
459
+ aliases: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
460
+ }, "strip", z.ZodTypeAny, {
461
+ name: string;
462
+ aliases: string[];
463
+ }, {
464
+ name: string;
465
+ aliases?: string[] | undefined;
466
+ }>;
467
+ type AddTopicInput = z.infer<typeof AddTopicInputSchema>;
468
+
469
+ export { type AddCommitmentInput, AddCommitmentInputSchema, type AddCompanyInput, AddCompanyInputSchema, type AddEventInput, AddEventInputSchema, type AddMemberInput, AddMemberInputSchema, type AddPersonInput, AddPersonInputSchema, type AddProjectInput, AddProjectInputSchema, type AddResourceInput, AddResourceInputSchema, type AddTopicInput, AddTopicInputSchema, COLLECTIONS, type Commitment, type CommitmentDoneInput, CommitmentDoneInputSchema, type CommitmentDropInput, CommitmentDropInputSchema, type CommitmentSnoozeInput, CommitmentSnoozeInputSchema, type CommitmentStatus, type Company, type Contact, type ContactChannel, ContactInputSchema, DEFAULT_STALE_AFTER_DAYS, DERIVED_EVENT_KINDS, EVENT_RETENTION_MAX_AGE_MS, type Event, type EventKind, type EventSubjectType, type ListCommitmentsInput, ListCommitmentsInputSchema, type ListEventsInput, ListEventsInputSchema, type ListProjectsInput, ListProjectsInputSchema, type Person, type Project, type ProjectMember, type ProjectStatus, type Resource, SEMANTIC_EVENT_KINDS, TRACE_EVENT_KINDS, type Task, type TaskStatus, type Timestamped, type Topic, type UpdatePersonInput, UpdatePersonInputSchema, type UpdateProjectInput, UpdateProjectInputSchema, type WhoToContactInput, WhoToContactInputSchema };
package/dist/index.js ADDED
@@ -0,0 +1,134 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/types/event.ts
4
+ var SEMANTIC_EVENT_KINDS = [
5
+ "note",
6
+ "project.created",
7
+ "project.status_changed",
8
+ "commitment.created",
9
+ "commitment.done",
10
+ "commitment.dropped",
11
+ "commitment.rescheduled",
12
+ "person.merged"
13
+ ];
14
+ var DERIVED_EVENT_KINDS = [
15
+ "review.generated",
16
+ "integrity.checked",
17
+ "export.completed"
18
+ ];
19
+ var TRACE_EVENT_KINDS = ["backfill.imported"];
20
+
21
+ // src/constants.ts
22
+ var COLLECTIONS = {
23
+ projects: "projects",
24
+ resources: "resources",
25
+ people: "people",
26
+ companies: "companies",
27
+ projectMembers: "project_members",
28
+ commitments: "commitments",
29
+ events: "events",
30
+ topics: "topics"
31
+ };
32
+ var DEFAULT_STALE_AFTER_DAYS = 14;
33
+ var EVENT_RETENTION_MAX_AGE_MS = {
34
+ derived: 90 * 24 * 60 * 60 * 1e3,
35
+ trace: 14 * 24 * 60 * 60 * 1e3
36
+ };
37
+ var AddProjectInputSchema = z.object({
38
+ name: z.string().min(1),
39
+ status: z.enum(["active", "paused", "archived"]).default("active"),
40
+ description: z.string().optional()
41
+ });
42
+ var UpdateProjectInputSchema = z.object({
43
+ id: z.string().min(1),
44
+ status: z.enum(["active", "paused", "archived"]).optional(),
45
+ description: z.string().optional()
46
+ });
47
+ var ListProjectsInputSchema = z.object({
48
+ status: z.enum(["active", "paused", "archived"]).optional()
49
+ });
50
+ var AddResourceInputSchema = z.object({
51
+ projectId: z.string().min(1),
52
+ type: z.string().min(1),
53
+ label: z.string().min(1),
54
+ url: z.string().url().optional(),
55
+ content: z.string().optional()
56
+ }).refine((v) => v.url !== void 0 || v.content !== void 0, {
57
+ message: "at least one of url/content must be set"
58
+ });
59
+ var ContactInputSchema = z.object({
60
+ channel: z.enum(["telegram", "email", "phone", "other"]),
61
+ value: z.string().min(1),
62
+ priority: z.number().int().min(0).default(0)
63
+ });
64
+ var AddPersonInputSchema = z.object({
65
+ name: z.string().min(1),
66
+ contacts: z.array(ContactInputSchema).default([]),
67
+ companyId: z.string().optional(),
68
+ globalTopics: z.array(z.string()).default([])
69
+ });
70
+ var UpdatePersonInputSchema = z.object({
71
+ id: z.string().min(1),
72
+ name: z.string().optional(),
73
+ contacts: z.array(ContactInputSchema).optional(),
74
+ companyId: z.string().optional(),
75
+ globalTopics: z.array(z.string()).optional()
76
+ });
77
+ var AddCompanyInputSchema = z.object({
78
+ name: z.string().min(1)
79
+ });
80
+ var AddMemberInputSchema = z.object({
81
+ personId: z.string().min(1),
82
+ projectId: z.string().min(1),
83
+ role: z.string().min(1),
84
+ topics: z.array(z.string()).optional(),
85
+ priority: z.number().int().min(0).default(0)
86
+ });
87
+ var WhoToContactInputSchema = z.object({
88
+ topic: z.string().min(1),
89
+ projectId: z.string().optional()
90
+ });
91
+ var AddCommitmentInputSchema = z.object({
92
+ text: z.string().min(1),
93
+ personId: z.string().optional(),
94
+ projectId: z.string().optional(),
95
+ remindAt: z.number().optional(),
96
+ staleAfterDays: z.number().int().positive().default(DEFAULT_STALE_AFTER_DAYS)
97
+ });
98
+ var ListCommitmentsInputSchema = z.object({
99
+ status: z.enum(["open", "done", "dropped"]).optional(),
100
+ projectId: z.string().optional(),
101
+ staleOnly: z.boolean().default(false)
102
+ });
103
+ var CommitmentDoneInputSchema = z.object({ id: z.string().min(1) });
104
+ var CommitmentDropInputSchema = z.object({
105
+ id: z.string().min(1),
106
+ reason: z.string().min(1)
107
+ });
108
+ var CommitmentSnoozeInputSchema = z.object({
109
+ id: z.string().min(1),
110
+ until: z.number(),
111
+ reason: z.string().optional()
112
+ });
113
+ var AddEventInputSchema = z.object({
114
+ subjectType: z.enum(["project", "person", "commitment", "company", "resource"]),
115
+ subjectId: z.string().min(1),
116
+ kind: z.string().min(1).default("note"),
117
+ text: z.string().optional(),
118
+ reason: z.string().optional(),
119
+ meta: z.record(z.string(), z.unknown()).optional()
120
+ });
121
+ var ListEventsInputSchema = z.object({
122
+ subjectType: z.enum(["project", "person", "commitment", "company", "resource"]).optional(),
123
+ subjectId: z.string().optional(),
124
+ kind: z.string().optional(),
125
+ since: z.number().optional()
126
+ });
127
+ var AddTopicInputSchema = z.object({
128
+ name: z.string().min(1),
129
+ aliases: z.array(z.string()).default([])
130
+ });
131
+
132
+ export { AddCommitmentInputSchema, AddCompanyInputSchema, AddEventInputSchema, AddMemberInputSchema, AddPersonInputSchema, AddProjectInputSchema, AddResourceInputSchema, AddTopicInputSchema, COLLECTIONS, CommitmentDoneInputSchema, CommitmentDropInputSchema, CommitmentSnoozeInputSchema, ContactInputSchema, DEFAULT_STALE_AFTER_DAYS, DERIVED_EVENT_KINDS, EVENT_RETENTION_MAX_AGE_MS, ListCommitmentsInputSchema, ListEventsInputSchema, ListProjectsInputSchema, SEMANTIC_EVENT_KINDS, TRACE_EVENT_KINDS, UpdatePersonInputSchema, UpdateProjectInputSchema, WhoToContactInputSchema };
133
+ //# sourceMappingURL=index.js.map
134
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/event.ts","../src/constants.ts","../src/inputs.ts"],"names":[],"mappings":";;;AAmBO,IAAM,oBAAA,GAA6C;AAAA,EACxD,MAAA;AAAA,EACA,iBAAA;AAAA,EACA,wBAAA;AAAA,EACA,oBAAA;AAAA,EACA,iBAAA;AAAA,EACA,oBAAA;AAAA,EACA,wBAAA;AAAA,EACA;AACF;AAEO,IAAM,mBAAA,GAA4C;AAAA,EACvD,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF;AAEO,IAAM,iBAAA,GAA0C,CAAC,mBAAmB;;;AChCpE,IAAM,WAAA,GAAc;AAAA,EACzB,QAAA,EAAU,UAAA;AAAA,EACV,SAAA,EAAW,WAAA;AAAA,EACX,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EA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WAAA,EAAa,EAAE,IAAA,CAAK,CAAC,WAAW,QAAA,EAAU,YAAA,EAAc,SAAA,EAAW,UAAU,CAAC,CAAA;AAAA,EAC9E,SAAA,EAAW,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC3B,IAAA,EAAM,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,QAAQ,MAAM,CAAA;AAAA,EACtC,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC1B,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC5B,IAAA,EAAM,CAAA,CAAE,MAAA,CAAO,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,OAAA,EAAS,CAAA,CAAE,QAAA;AAC1C,CAAC;AAGM,IAAM,qBAAA,GAAwB,EAAE,MAAA,CAAO;AAAA,EAC5C,WAAA,EAAa,CAAA,CAAE,IAAA,CAAK,CAAC,SAAA,EAAW,QAAA,EAAU,YAAA,EAAc,SAAA,EAAW,UAAU,CAAC,CAAA,CAAE,QAAA,EAAS;AAAA,EACzF,SAAA,EAAW,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC/B,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC1B,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AACpB,CAAC;AAKM,IAAM,mBAAA,GAAsB,EAAE,MAAA,CAAO;AAAA,EAC1C,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACtB,OAAA,EAAS,EAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE;AACzC,CAAC","file":"index.js","sourcesContent":["import type { Timestamped, EventSubjectType } from './common.js';\n\nexport type EventKind =\n // semantic — never retained-out, see ADR-0001 §\"Ретеншен событий\"\n | 'note'\n | 'project.created'\n | 'project.status_changed'\n | 'commitment.created'\n | 'commitment.done'\n | 'commitment.dropped'\n | 'commitment.rescheduled'\n | 'person.merged'\n // derived — 90 day retention\n | 'review.generated'\n | 'integrity.checked'\n | 'export.completed'\n // trace — 14 day retention\n | 'backfill.imported';\n\nexport const SEMANTIC_EVENT_KINDS: readonly EventKind[] = [\n 'note',\n 'project.created',\n 'project.status_changed',\n 'commitment.created',\n 'commitment.done',\n 'commitment.dropped',\n 'commitment.rescheduled',\n 'person.merged',\n];\n\nexport const DERIVED_EVENT_KINDS: readonly EventKind[] = [\n 'review.generated',\n 'integrity.checked',\n 'export.completed',\n];\n\nexport const TRACE_EVENT_KINDS: readonly EventKind[] = ['backfill.imported'];\n\n/**\n * Append-only history log — the thing that makes the memory \"infinite\".\n * `subjectType`/`subjectId` are a polymorphic reference on purpose (flat,\n * not nested — `DocumentFilter` only supports top-level keys) so new\n * entities never require a schema change here. See ADR-0001 §Event.\n */\nexport interface Event extends Timestamped {\n at: number;\n kind: EventKind;\n subjectType: EventSubjectType;\n subjectId: string;\n reason?: string;\n text?: string;\n meta?: Record<string, unknown>;\n}\n","/**\n * Collection names — must match what `core` passes to `ensureCollection`.\n * Actual storage names are namespaced by the platform as `steward__<name>`.\n */\nexport const COLLECTIONS = {\n projects: 'projects',\n resources: 'resources',\n people: 'people',\n companies: 'companies',\n projectMembers: 'project_members',\n commitments: 'commitments',\n events: 'events',\n topics: 'topics',\n} as const;\n\n/** Default commitment staleness threshold — see ADR-0001 §Commitment. */\nexport const DEFAULT_STALE_AFTER_DAYS = 14;\n\n/** Event retention classes — see ADR-0001 §\"Ретеншен событий\". `semantic` is never deleted. */\nexport const EVENT_RETENTION_MAX_AGE_MS: Record<'derived' | 'trace', number> = {\n derived: 90 * 24 * 60 * 60 * 1000,\n trace: 14 * 24 * 60 * 60 * 1000,\n};\n","/**\n * Zod schemas for everything that crosses the CLI/MCP boundary — command\n * inputs and the results agents read back. Domain models in `types/` stay\n * plain interfaces (see ADR-0001 §\"Разделение core/entry\").\n */\nimport { z } from 'zod';\nimport { DEFAULT_STALE_AFTER_DAYS } from './constants.js';\n\n// ── Project ──────────────────────────────────────────────────────────────\n\nexport const AddProjectInputSchema = z.object({\n name: z.string().min(1),\n status: z.enum(['active', 'paused', 'archived']).default('active'),\n description: z.string().optional(),\n});\nexport type AddProjectInput = z.infer<typeof AddProjectInputSchema>;\n\nexport const UpdateProjectInputSchema = z.object({\n id: z.string().min(1),\n status: z.enum(['active', 'paused', 'archived']).optional(),\n description: z.string().optional(),\n});\nexport type UpdateProjectInput = z.infer<typeof UpdateProjectInputSchema>;\n\nexport const ListProjectsInputSchema = z.object({\n status: z.enum(['active', 'paused', 'archived']).optional(),\n});\nexport type ListProjectsInput = z.infer<typeof ListProjectsInputSchema>;\n\n// ── Resource ─────────────────────────────────────────────────────────────\n\nexport const AddResourceInputSchema = z\n .object({\n projectId: z.string().min(1),\n type: z.string().min(1),\n label: z.string().min(1),\n url: z.string().url().optional(),\n content: z.string().optional(),\n })\n .refine((v) => v.url !== undefined || v.content !== undefined, {\n message: 'at least one of url/content must be set',\n });\nexport type AddResourceInput = z.infer<typeof AddResourceInputSchema>;\n\n// ── Person / Company / ProjectMember ────────────────────────────────────\n\nexport const ContactInputSchema = z.object({\n channel: z.enum(['telegram', 'email', 'phone', 'other']),\n value: z.string().min(1),\n priority: z.number().int().min(0).default(0),\n});\n\nexport const AddPersonInputSchema = z.object({\n name: z.string().min(1),\n contacts: z.array(ContactInputSchema).default([]),\n companyId: z.string().optional(),\n globalTopics: z.array(z.string()).default([]),\n});\nexport type AddPersonInput = z.infer<typeof AddPersonInputSchema>;\n\nexport const UpdatePersonInputSchema = z.object({\n id: z.string().min(1),\n name: z.string().optional(),\n contacts: z.array(ContactInputSchema).optional(),\n companyId: z.string().optional(),\n globalTopics: z.array(z.string()).optional(),\n});\nexport type UpdatePersonInput = z.infer<typeof UpdatePersonInputSchema>;\n\nexport const AddCompanyInputSchema = z.object({\n name: z.string().min(1),\n});\nexport type AddCompanyInput = z.infer<typeof AddCompanyInputSchema>;\n\nexport const AddMemberInputSchema = z.object({\n personId: z.string().min(1),\n projectId: z.string().min(1),\n role: z.string().min(1),\n topics: z.array(z.string()).optional(),\n priority: z.number().int().min(0).default(0),\n});\nexport type AddMemberInput = z.infer<typeof AddMemberInputSchema>;\n\n// ── Routing ──────────────────────────────────────────────────────────────\n\nexport const WhoToContactInputSchema = z.object({\n topic: z.string().min(1),\n projectId: z.string().optional(),\n});\nexport type WhoToContactInput = z.infer<typeof WhoToContactInputSchema>;\n\n// ── Commitment ───────────────────────────────────────────────────────────\n\nexport const AddCommitmentInputSchema = z.object({\n text: z.string().min(1),\n personId: z.string().optional(),\n projectId: z.string().optional(),\n remindAt: z.number().optional(),\n staleAfterDays: z.number().int().positive().default(DEFAULT_STALE_AFTER_DAYS),\n});\nexport type AddCommitmentInput = z.infer<typeof AddCommitmentInputSchema>;\n\nexport const ListCommitmentsInputSchema = z.object({\n status: z.enum(['open', 'done', 'dropped']).optional(),\n projectId: z.string().optional(),\n staleOnly: z.boolean().default(false),\n});\nexport type ListCommitmentsInput = z.infer<typeof ListCommitmentsInputSchema>;\n\nexport const CommitmentDoneInputSchema = z.object({ id: z.string().min(1) });\nexport type CommitmentDoneInput = z.infer<typeof CommitmentDoneInputSchema>;\n\nexport const CommitmentDropInputSchema = z.object({\n id: z.string().min(1),\n reason: z.string().min(1),\n});\nexport type CommitmentDropInput = z.infer<typeof CommitmentDropInputSchema>;\n\nexport const CommitmentSnoozeInputSchema = z.object({\n id: z.string().min(1),\n until: z.number(),\n reason: z.string().optional(),\n});\nexport type CommitmentSnoozeInput = z.infer<typeof CommitmentSnoozeInputSchema>;\n\n// ── Event ────────────────────────────────────────────────────────────────\n\nexport const AddEventInputSchema = z.object({\n subjectType: z.enum(['project', 'person', 'commitment', 'company', 'resource']),\n subjectId: z.string().min(1),\n kind: z.string().min(1).default('note'),\n text: z.string().optional(),\n reason: z.string().optional(),\n meta: z.record(z.string(), z.unknown()).optional(),\n});\nexport type AddEventInput = z.infer<typeof AddEventInputSchema>;\n\nexport const ListEventsInputSchema = z.object({\n subjectType: z.enum(['project', 'person', 'commitment', 'company', 'resource']).optional(),\n subjectId: z.string().optional(),\n kind: z.string().optional(),\n since: z.number().optional(),\n});\nexport type ListEventsInput = z.infer<typeof ListEventsInputSchema>;\n\n// ── Topic ────────────────────────────────────────────────────────────────\n\nexport const AddTopicInputSchema = z.object({\n name: z.string().min(1),\n aliases: z.array(z.string()).default([]),\n});\nexport type AddTopicInput = z.infer<typeof AddTopicInputSchema>;\n"]}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@kb-labs/steward-contracts",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Domain types and input schemas for the steward personal PM/CRM plugin",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "sideEffects": false,
18
+ "dependencies": {
19
+ "zod": "^3.25.76"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^24.0.0",
23
+ "rimraf": "^6.0.1",
24
+ "tsup": "^8.5.0",
25
+ "typescript": "^5.6.3",
26
+ "vitest": "^3.2.4",
27
+ "@kb-labs/devkit": "2.118.2"
28
+ },
29
+ "engines": {
30
+ "node": ">=20.0.0",
31
+ "pnpm": ">=9.0.0"
32
+ },
33
+ "scripts": {
34
+ "clean": "rimraf dist",
35
+ "build": "tsup",
36
+ "dev": "tsup --watch",
37
+ "lint": "eslint src --ext .ts",
38
+ "lint:fix": "eslint . --fix",
39
+ "type-check": "tsc --noEmit",
40
+ "test": "vitest run --passWithNoTests"
41
+ }
42
+ }