sysprom 1.14.0 → 1.16.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.
Files changed (61) hide show
  1. package/README.md +19 -2
  2. package/dist/schema.json +18 -1
  3. package/dist/src/cli/commands/infer.d.ts +2 -0
  4. package/dist/src/cli/commands/infer.js +235 -0
  5. package/dist/src/cli/program.js +2 -0
  6. package/dist/src/endpoint-types.js +23 -0
  7. package/dist/src/index.d.ts +2 -2
  8. package/dist/src/index.js +2 -2
  9. package/dist/src/mcp/server.js +112 -1
  10. package/dist/src/operations/add-node.d.ts +51 -9
  11. package/dist/src/operations/add-plan-task.d.ts +34 -6
  12. package/dist/src/operations/add-relationship.d.ts +48 -8
  13. package/dist/src/operations/check.d.ts +17 -3
  14. package/dist/src/operations/graph.d.ts +17 -3
  15. package/dist/src/operations/index.d.ts +4 -0
  16. package/dist/src/operations/index.js +5 -0
  17. package/dist/src/operations/infer-completeness.d.ts +428 -0
  18. package/dist/src/operations/infer-completeness.js +131 -0
  19. package/dist/src/operations/infer-derived.d.ts +389 -0
  20. package/dist/src/operations/infer-derived.js +158 -0
  21. package/dist/src/operations/infer-impact.d.ts +2299 -0
  22. package/dist/src/operations/infer-impact.js +262 -0
  23. package/dist/src/operations/infer-lifecycle.d.ts +435 -0
  24. package/dist/src/operations/infer-lifecycle.js +119 -0
  25. package/dist/src/operations/init-document.d.ts +17 -3
  26. package/dist/src/operations/json-to-markdown.d.ts +17 -3
  27. package/dist/src/operations/mark-task-done.d.ts +34 -6
  28. package/dist/src/operations/mark-task-undone.d.ts +34 -6
  29. package/dist/src/operations/markdown-to-json.d.ts +17 -3
  30. package/dist/src/operations/next-id.d.ts +17 -3
  31. package/dist/src/operations/node-history.d.ts +17 -3
  32. package/dist/src/operations/plan-add-task.d.ts +34 -6
  33. package/dist/src/operations/plan-gate.d.ts +17 -3
  34. package/dist/src/operations/plan-init.d.ts +17 -3
  35. package/dist/src/operations/plan-progress.d.ts +17 -3
  36. package/dist/src/operations/plan-status.d.ts +17 -3
  37. package/dist/src/operations/query-node.d.ts +107 -17
  38. package/dist/src/operations/query-nodes.d.ts +34 -6
  39. package/dist/src/operations/query-relationships.d.ts +31 -5
  40. package/dist/src/operations/remove-node.d.ts +51 -9
  41. package/dist/src/operations/remove-relationship.d.ts +36 -7
  42. package/dist/src/operations/rename.d.ts +34 -6
  43. package/dist/src/operations/search.d.ts +34 -6
  44. package/dist/src/operations/speckit-diff.d.ts +17 -3
  45. package/dist/src/operations/speckit-export.d.ts +17 -3
  46. package/dist/src/operations/speckit-import.d.ts +17 -3
  47. package/dist/src/operations/speckit-sync.d.ts +51 -9
  48. package/dist/src/operations/state-at.d.ts +17 -3
  49. package/dist/src/operations/stats.d.ts +17 -3
  50. package/dist/src/operations/sync.d.ts +51 -9
  51. package/dist/src/operations/task-list.d.ts +17 -3
  52. package/dist/src/operations/timeline.d.ts +17 -3
  53. package/dist/src/operations/trace-from-node.d.ts +51 -9
  54. package/dist/src/operations/update-metadata.d.ts +34 -6
  55. package/dist/src/operations/update-node.d.ts +48 -8
  56. package/dist/src/operations/update-plan-task.d.ts +34 -6
  57. package/dist/src/operations/validate.d.ts +17 -3
  58. package/dist/src/schema.d.ts +70 -10
  59. package/dist/src/schema.js +21 -0
  60. package/package.json +1 -1
  61. package/schema.json +18 -1
@@ -0,0 +1,435 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Lifecycle inference result for a single node.
4
+ */
5
+ declare const LifecycleResult: z.ZodObject<{
6
+ id: z.ZodString;
7
+ type: z.ZodString;
8
+ name: z.ZodString;
9
+ status: z.ZodOptional<z.ZodEnum<{
10
+ deprecated: "deprecated";
11
+ proposed: "proposed";
12
+ accepted: "accepted";
13
+ active: "active";
14
+ implemented: "implemented";
15
+ adopted: "adopted";
16
+ defined: "defined";
17
+ introduced: "introduced";
18
+ in_progress: "in_progress";
19
+ complete: "complete";
20
+ consolidated: "consolidated";
21
+ experimental: "experimental";
22
+ retired: "retired";
23
+ superseded: "superseded";
24
+ abandoned: "abandoned";
25
+ deferred: "deferred";
26
+ }> & {
27
+ is(value: unknown): value is "deprecated" | "proposed" | "accepted" | "active" | "implemented" | "adopted" | "defined" | "introduced" | "in_progress" | "complete" | "consolidated" | "experimental" | "retired" | "superseded" | "abandoned" | "deferred";
28
+ }>;
29
+ lifecycle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
30
+ inferredState: z.ZodString;
31
+ inferredPhase: z.ZodEnum<{
32
+ unknown: "unknown";
33
+ early: "early";
34
+ middle: "middle";
35
+ late: "late";
36
+ terminal: "terminal";
37
+ }>;
38
+ }, z.core.$strip>;
39
+ /** Lifecycle inference result for a single node. */
40
+ export type LifecycleResult = z.infer<typeof LifecycleResult>;
41
+ /**
42
+ * Output schema for inferLifecycleOp.
43
+ */
44
+ declare const LifecycleOutput: z.ZodObject<{
45
+ nodes: z.ZodArray<z.ZodObject<{
46
+ id: z.ZodString;
47
+ type: z.ZodString;
48
+ name: z.ZodString;
49
+ status: z.ZodOptional<z.ZodEnum<{
50
+ deprecated: "deprecated";
51
+ proposed: "proposed";
52
+ accepted: "accepted";
53
+ active: "active";
54
+ implemented: "implemented";
55
+ adopted: "adopted";
56
+ defined: "defined";
57
+ introduced: "introduced";
58
+ in_progress: "in_progress";
59
+ complete: "complete";
60
+ consolidated: "consolidated";
61
+ experimental: "experimental";
62
+ retired: "retired";
63
+ superseded: "superseded";
64
+ abandoned: "abandoned";
65
+ deferred: "deferred";
66
+ }> & {
67
+ is(value: unknown): value is "deprecated" | "proposed" | "accepted" | "active" | "implemented" | "adopted" | "defined" | "introduced" | "in_progress" | "complete" | "consolidated" | "experimental" | "retired" | "superseded" | "abandoned" | "deferred";
68
+ }>;
69
+ lifecycle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
70
+ inferredState: z.ZodString;
71
+ inferredPhase: z.ZodEnum<{
72
+ unknown: "unknown";
73
+ early: "early";
74
+ middle: "middle";
75
+ late: "late";
76
+ terminal: "terminal";
77
+ }>;
78
+ }, z.core.$strip>>;
79
+ summary: z.ZodRecord<z.ZodString, z.ZodNumber>;
80
+ }, z.core.$strip>;
81
+ /** Output of lifecycle inference operation. */
82
+ export type LifecycleOutput = z.infer<typeof LifecycleOutput>;
83
+ /**
84
+ * Infer lifecycle state for all nodes based on status and lifecycle fields.
85
+ *
86
+ * Returns inferred state, phase classification, and summary statistics.
87
+ */
88
+ export declare const inferLifecycleOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
89
+ doc: z.ZodObject<{
90
+ $schema: z.ZodOptional<z.ZodString>;
91
+ metadata: z.ZodOptional<z.ZodObject<{
92
+ title: z.ZodOptional<z.ZodString>;
93
+ doc_type: z.ZodOptional<z.ZodString>;
94
+ scope: z.ZodOptional<z.ZodString>;
95
+ status: z.ZodOptional<z.ZodString>;
96
+ version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
97
+ }, z.core.$loose> & {
98
+ is(value: unknown): value is {
99
+ [x: string]: unknown;
100
+ title?: string | undefined;
101
+ doc_type?: string | undefined;
102
+ scope?: string | undefined;
103
+ status?: string | undefined;
104
+ version?: string | number | undefined;
105
+ };
106
+ }>;
107
+ nodes: z.ZodArray<z.ZodObject<{
108
+ id: z.ZodString;
109
+ type: z.ZodEnum<{
110
+ intent: "intent";
111
+ concept: "concept";
112
+ capability: "capability";
113
+ element: "element";
114
+ realisation: "realisation";
115
+ invariant: "invariant";
116
+ principle: "principle";
117
+ policy: "policy";
118
+ protocol: "protocol";
119
+ stage: "stage";
120
+ role: "role";
121
+ gate: "gate";
122
+ mode: "mode";
123
+ artefact: "artefact";
124
+ artefact_flow: "artefact_flow";
125
+ decision: "decision";
126
+ change: "change";
127
+ view: "view";
128
+ milestone: "milestone";
129
+ version: "version";
130
+ }> & {
131
+ is(value: unknown): value is "intent" | "concept" | "capability" | "element" | "realisation" | "invariant" | "principle" | "policy" | "protocol" | "stage" | "role" | "gate" | "mode" | "artefact" | "artefact_flow" | "decision" | "change" | "view" | "milestone" | "version";
132
+ };
133
+ name: z.ZodString;
134
+ description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
135
+ is(value: unknown): value is string | string[];
136
+ }>;
137
+ status: z.ZodOptional<z.ZodEnum<{
138
+ deprecated: "deprecated";
139
+ proposed: "proposed";
140
+ accepted: "accepted";
141
+ active: "active";
142
+ implemented: "implemented";
143
+ adopted: "adopted";
144
+ defined: "defined";
145
+ introduced: "introduced";
146
+ in_progress: "in_progress";
147
+ complete: "complete";
148
+ consolidated: "consolidated";
149
+ experimental: "experimental";
150
+ retired: "retired";
151
+ superseded: "superseded";
152
+ abandoned: "abandoned";
153
+ deferred: "deferred";
154
+ }> & {
155
+ is(value: unknown): value is "deprecated" | "proposed" | "accepted" | "active" | "implemented" | "adopted" | "defined" | "introduced" | "in_progress" | "complete" | "consolidated" | "experimental" | "retired" | "superseded" | "abandoned" | "deferred";
156
+ }>;
157
+ lifecycle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
158
+ context: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
159
+ is(value: unknown): value is string | string[];
160
+ }>;
161
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
162
+ id: z.ZodString;
163
+ description: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
164
+ is(value: unknown): value is string | string[];
165
+ };
166
+ }, z.core.$loose> & {
167
+ is(value: unknown): value is {
168
+ [x: string]: unknown;
169
+ id: string;
170
+ description: string | string[];
171
+ };
172
+ }>>;
173
+ selected: z.ZodOptional<z.ZodString>;
174
+ rationale: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
175
+ is(value: unknown): value is string | string[];
176
+ }>;
177
+ scope: z.ZodOptional<z.ZodArray<z.ZodString>>;
178
+ operations: z.ZodOptional<z.ZodArray<z.ZodObject<{
179
+ type: z.ZodEnum<{
180
+ link: "link";
181
+ add: "add";
182
+ update: "update";
183
+ remove: "remove";
184
+ }>;
185
+ target: z.ZodOptional<z.ZodString>;
186
+ description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
187
+ is(value: unknown): value is string | string[];
188
+ }>;
189
+ }, z.core.$loose> & {
190
+ is(value: unknown): value is {
191
+ [x: string]: unknown;
192
+ type: "link" | "add" | "update" | "remove";
193
+ target?: string | undefined;
194
+ description?: string | string[] | undefined;
195
+ };
196
+ }>>;
197
+ plan: z.ZodOptional<z.ZodArray<z.ZodObject<{
198
+ description: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
199
+ is(value: unknown): value is string | string[];
200
+ };
201
+ done: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
202
+ }, z.core.$loose> & {
203
+ is(value: unknown): value is {
204
+ [x: string]: unknown;
205
+ description: string | string[];
206
+ done?: boolean | undefined;
207
+ };
208
+ }>>;
209
+ propagation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
210
+ includes: z.ZodOptional<z.ZodArray<z.ZodString>>;
211
+ input: z.ZodOptional<z.ZodString>;
212
+ output: z.ZodOptional<z.ZodString>;
213
+ external_references: z.ZodOptional<z.ZodArray<z.ZodObject<{
214
+ role: z.ZodEnum<{
215
+ output: "output";
216
+ input: "input";
217
+ context: "context";
218
+ evidence: "evidence";
219
+ source: "source";
220
+ standard: "standard";
221
+ prior_art: "prior_art";
222
+ }> & {
223
+ is(value: unknown): value is "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
224
+ };
225
+ identifier: z.ZodString;
226
+ description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
227
+ is(value: unknown): value is string | string[];
228
+ }>;
229
+ node_id: z.ZodOptional<z.ZodString>;
230
+ internalised: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
231
+ is(value: unknown): value is string | string[];
232
+ }>;
233
+ }, z.core.$strip> & {
234
+ is(value: unknown): value is {
235
+ role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
236
+ identifier: string;
237
+ description?: string | string[] | undefined;
238
+ node_id?: string | undefined;
239
+ internalised?: string | string[] | undefined;
240
+ };
241
+ }>>;
242
+ readonly subsystem: z.ZodOptional<z.ZodObject</*elided*/ any, z.core.$strip>>;
243
+ }, z.core.$loose>>;
244
+ relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
245
+ from: z.ZodString;
246
+ to: z.ZodString;
247
+ type: z.ZodEnum<{
248
+ refines: "refines";
249
+ realises: "realises";
250
+ implements: "implements";
251
+ depends_on: "depends_on";
252
+ constrained_by: "constrained_by";
253
+ affects: "affects";
254
+ supersedes: "supersedes";
255
+ must_preserve: "must_preserve";
256
+ performs: "performs";
257
+ part_of: "part_of";
258
+ precedes: "precedes";
259
+ must_follow: "must_follow";
260
+ blocks: "blocks";
261
+ routes_to: "routes_to";
262
+ governed_by: "governed_by";
263
+ modifies: "modifies";
264
+ triggered_by: "triggered_by";
265
+ applies_to: "applies_to";
266
+ produces: "produces";
267
+ consumes: "consumes";
268
+ transforms_into: "transforms_into";
269
+ selects: "selects";
270
+ requires: "requires";
271
+ disables: "disables";
272
+ influence: "influence";
273
+ }> & {
274
+ is(value: unknown): value is "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
275
+ };
276
+ description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
277
+ is(value: unknown): value is string | string[];
278
+ }>;
279
+ polarity: z.ZodOptional<z.ZodEnum<{
280
+ positive: "positive";
281
+ negative: "negative";
282
+ neutral: "neutral";
283
+ uncertain: "uncertain";
284
+ }> & {
285
+ is(value: unknown): value is "positive" | "negative" | "neutral" | "uncertain";
286
+ }>;
287
+ strength: z.ZodOptional<z.ZodNumber>;
288
+ }, z.core.$loose> & {
289
+ is(value: unknown): value is {
290
+ [x: string]: unknown;
291
+ from: string;
292
+ to: string;
293
+ type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
294
+ description?: string | string[] | undefined;
295
+ polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
296
+ strength?: number | undefined;
297
+ };
298
+ }>>;
299
+ external_references: z.ZodOptional<z.ZodArray<z.ZodObject<{
300
+ role: z.ZodEnum<{
301
+ output: "output";
302
+ input: "input";
303
+ context: "context";
304
+ evidence: "evidence";
305
+ source: "source";
306
+ standard: "standard";
307
+ prior_art: "prior_art";
308
+ }> & {
309
+ is(value: unknown): value is "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
310
+ };
311
+ identifier: z.ZodString;
312
+ description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
313
+ is(value: unknown): value is string | string[];
314
+ }>;
315
+ node_id: z.ZodOptional<z.ZodString>;
316
+ internalised: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
317
+ is(value: unknown): value is string | string[];
318
+ }>;
319
+ }, z.core.$strip> & {
320
+ is(value: unknown): value is {
321
+ role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
322
+ identifier: string;
323
+ description?: string | string[] | undefined;
324
+ node_id?: string | undefined;
325
+ internalised?: string | string[] | undefined;
326
+ };
327
+ }>>;
328
+ }, z.core.$strip> & {
329
+ is(value: unknown): value is {
330
+ nodes: {
331
+ [x: string]: unknown;
332
+ id: string;
333
+ type: "intent" | "concept" | "capability" | "element" | "realisation" | "invariant" | "principle" | "policy" | "protocol" | "stage" | "role" | "gate" | "mode" | "artefact" | "artefact_flow" | "decision" | "change" | "view" | "milestone" | "version";
334
+ name: string;
335
+ description?: string | string[] | undefined;
336
+ status?: "deprecated" | "proposed" | "accepted" | "active" | "implemented" | "adopted" | "defined" | "introduced" | "in_progress" | "complete" | "consolidated" | "experimental" | "retired" | "superseded" | "abandoned" | "deferred" | undefined;
337
+ lifecycle?: Record<string, string | boolean> | undefined;
338
+ context?: string | string[] | undefined;
339
+ options?: {
340
+ [x: string]: unknown;
341
+ id: string;
342
+ description: string | string[];
343
+ }[] | undefined;
344
+ selected?: string | undefined;
345
+ rationale?: string | string[] | undefined;
346
+ scope?: string[] | undefined;
347
+ operations?: {
348
+ [x: string]: unknown;
349
+ type: "link" | "add" | "update" | "remove";
350
+ target?: string | undefined;
351
+ description?: string | string[] | undefined;
352
+ }[] | undefined;
353
+ plan?: {
354
+ [x: string]: unknown;
355
+ description: string | string[];
356
+ done?: boolean | undefined;
357
+ }[] | undefined;
358
+ propagation?: Record<string, boolean> | undefined;
359
+ includes?: string[] | undefined;
360
+ input?: string | undefined;
361
+ output?: string | undefined;
362
+ external_references?: {
363
+ role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
364
+ identifier: string;
365
+ description?: string | string[] | undefined;
366
+ node_id?: string | undefined;
367
+ internalised?: string | string[] | undefined;
368
+ }[] | undefined;
369
+ subsystem?: /*elided*/ any | undefined;
370
+ }[];
371
+ $schema?: string | undefined;
372
+ metadata?: {
373
+ [x: string]: unknown;
374
+ title?: string | undefined;
375
+ doc_type?: string | undefined;
376
+ scope?: string | undefined;
377
+ status?: string | undefined;
378
+ version?: string | number | undefined;
379
+ } | undefined;
380
+ relationships?: {
381
+ [x: string]: unknown;
382
+ from: string;
383
+ to: string;
384
+ type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
385
+ description?: string | string[] | undefined;
386
+ polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
387
+ strength?: number | undefined;
388
+ }[] | undefined;
389
+ external_references?: {
390
+ role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
391
+ identifier: string;
392
+ description?: string | string[] | undefined;
393
+ node_id?: string | undefined;
394
+ internalised?: string | string[] | undefined;
395
+ }[] | undefined;
396
+ };
397
+ };
398
+ }, z.core.$strip>, z.ZodObject<{
399
+ nodes: z.ZodArray<z.ZodObject<{
400
+ id: z.ZodString;
401
+ type: z.ZodString;
402
+ name: z.ZodString;
403
+ status: z.ZodOptional<z.ZodEnum<{
404
+ deprecated: "deprecated";
405
+ proposed: "proposed";
406
+ accepted: "accepted";
407
+ active: "active";
408
+ implemented: "implemented";
409
+ adopted: "adopted";
410
+ defined: "defined";
411
+ introduced: "introduced";
412
+ in_progress: "in_progress";
413
+ complete: "complete";
414
+ consolidated: "consolidated";
415
+ experimental: "experimental";
416
+ retired: "retired";
417
+ superseded: "superseded";
418
+ abandoned: "abandoned";
419
+ deferred: "deferred";
420
+ }> & {
421
+ is(value: unknown): value is "deprecated" | "proposed" | "accepted" | "active" | "implemented" | "adopted" | "defined" | "introduced" | "in_progress" | "complete" | "consolidated" | "experimental" | "retired" | "superseded" | "abandoned" | "deferred";
422
+ }>;
423
+ lifecycle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
424
+ inferredState: z.ZodString;
425
+ inferredPhase: z.ZodEnum<{
426
+ unknown: "unknown";
427
+ early: "early";
428
+ middle: "middle";
429
+ late: "late";
430
+ terminal: "terminal";
431
+ }>;
432
+ }, z.core.$strip>>;
433
+ summary: z.ZodRecord<z.ZodString, z.ZodNumber>;
434
+ }, z.core.$strip>>;
435
+ export {};
@@ -0,0 +1,119 @@
1
+ import * as z from "zod";
2
+ import { defineOperation } from "./define-operation.js";
3
+ import { SysProMDocument, NodeStatus } from "../schema.js";
4
+ /**
5
+ * Lifecycle inference result for a single node.
6
+ */
7
+ const LifecycleResult = z.object({
8
+ id: z.string(),
9
+ type: z.string(),
10
+ name: z.string(),
11
+ status: NodeStatus.optional(),
12
+ lifecycle: z
13
+ .record(z.string(), z.union([z.boolean(), z.string()]))
14
+ .optional(),
15
+ inferredState: z.string(),
16
+ inferredPhase: z.enum(["early", "middle", "late", "terminal", "unknown"]),
17
+ });
18
+ /**
19
+ * Output schema for inferLifecycleOp.
20
+ */
21
+ const LifecycleOutput = z.object({
22
+ nodes: z.array(LifecycleResult),
23
+ summary: z.record(z.string(), z.number()),
24
+ });
25
+ /**
26
+ * Lifecycle phases based on typical progression.
27
+ */
28
+ const PHASE_MAP = {
29
+ proposed: "early",
30
+ accepted: "early",
31
+ defined: "early",
32
+ in_progress: "middle",
33
+ active: "middle",
34
+ experimental: "middle",
35
+ implemented: "late",
36
+ adopted: "late",
37
+ introduced: "late",
38
+ complete: "late",
39
+ consolidated: "late",
40
+ deprecated: "terminal",
41
+ retired: "terminal",
42
+ superseded: "terminal",
43
+ abandoned: "terminal",
44
+ deferred: "terminal",
45
+ };
46
+ /**
47
+ * Determine the most advanced lifecycle state from lifecycle record.
48
+ * @param lifecycle - The lifecycle record to analyse.
49
+ * @returns The most advanced state name, or null if no active states.
50
+ * @example
51
+ * ```ts
52
+ * getMostAdvancedState({ proposed: true, accepted: "2024-01-15" });
53
+ * // Returns "accepted"
54
+ * ```
55
+ */
56
+ function getMostAdvancedState(lifecycle) {
57
+ if (!lifecycle)
58
+ return null;
59
+ // Find states that are true or have a date string
60
+ const activeStates = Object.entries(lifecycle)
61
+ .filter(([, value]) => value === true || typeof value === "string")
62
+ .map(([state]) => state);
63
+ if (activeStates.length === 0)
64
+ return null;
65
+ // Return the last active state (assumes ordered by progression)
66
+ return activeStates[activeStates.length - 1];
67
+ }
68
+ /**
69
+ * Infer lifecycle state for all nodes based on status and lifecycle fields.
70
+ *
71
+ * Returns inferred state, phase classification, and summary statistics.
72
+ */
73
+ export const inferLifecycleOp = defineOperation({
74
+ name: "infer-lifecycle",
75
+ description: "Infer lifecycle state for nodes based on status and lifecycle fields",
76
+ input: z.object({
77
+ doc: SysProMDocument,
78
+ }),
79
+ output: LifecycleOutput,
80
+ fn: (input) => {
81
+ const results = [];
82
+ const summary = {
83
+ early: 0,
84
+ middle: 0,
85
+ late: 0,
86
+ terminal: 0,
87
+ unknown: 0,
88
+ };
89
+ for (const node of input.doc.nodes) {
90
+ // Determine inferred state from lifecycle or status
91
+ let inferredState;
92
+ let inferredPhase;
93
+ const lifecycleState = getMostAdvancedState(node.lifecycle);
94
+ if (lifecycleState) {
95
+ inferredState = lifecycleState;
96
+ inferredPhase = PHASE_MAP[lifecycleState] ?? "unknown";
97
+ }
98
+ else if (node.status) {
99
+ inferredState = node.status;
100
+ inferredPhase = PHASE_MAP[node.status] ?? "unknown";
101
+ }
102
+ else {
103
+ inferredState = "undefined";
104
+ inferredPhase = "unknown";
105
+ }
106
+ summary[inferredPhase]++;
107
+ results.push({
108
+ id: node.id,
109
+ type: node.type,
110
+ name: node.name,
111
+ status: node.status,
112
+ lifecycle: node.lifecycle,
113
+ inferredState,
114
+ inferredPhase,
115
+ });
116
+ }
117
+ return { nodes: results, summary };
118
+ },
119
+ });
@@ -186,19 +186,31 @@ export declare const initDocumentOp: import("./define-operation.js").DefinedOper
186
186
  selects: "selects";
187
187
  requires: "requires";
188
188
  disables: "disables";
189
+ influence: "influence";
189
190
  }> & {
190
- is(value: unknown): value is "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables";
191
+ is(value: unknown): value is "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
191
192
  };
192
193
  description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
193
194
  is(value: unknown): value is string | string[];
194
195
  }>;
196
+ polarity: z.ZodOptional<z.ZodEnum<{
197
+ positive: "positive";
198
+ negative: "negative";
199
+ neutral: "neutral";
200
+ uncertain: "uncertain";
201
+ }> & {
202
+ is(value: unknown): value is "positive" | "negative" | "neutral" | "uncertain";
203
+ }>;
204
+ strength: z.ZodOptional<z.ZodNumber>;
195
205
  }, z.core.$loose> & {
196
206
  is(value: unknown): value is {
197
207
  [x: string]: unknown;
198
208
  from: string;
199
209
  to: string;
200
- type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables";
210
+ type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
201
211
  description?: string | string[] | undefined;
212
+ polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
213
+ strength?: number | undefined;
202
214
  };
203
215
  }>>;
204
216
  external_references: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -286,8 +298,10 @@ export declare const initDocumentOp: import("./define-operation.js").DefinedOper
286
298
  [x: string]: unknown;
287
299
  from: string;
288
300
  to: string;
289
- type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables";
301
+ type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
290
302
  description?: string | string[] | undefined;
303
+ polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
304
+ strength?: number | undefined;
291
305
  }[] | undefined;
292
306
  external_references?: {
293
307
  role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
@@ -184,19 +184,31 @@ export declare const jsonToMarkdownOp: import("./define-operation.js").DefinedOp
184
184
  selects: "selects";
185
185
  requires: "requires";
186
186
  disables: "disables";
187
+ influence: "influence";
187
188
  }> & {
188
- is(value: unknown): value is "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables";
189
+ is(value: unknown): value is "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
189
190
  };
190
191
  description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
191
192
  is(value: unknown): value is string | string[];
192
193
  }>;
194
+ polarity: z.ZodOptional<z.ZodEnum<{
195
+ positive: "positive";
196
+ negative: "negative";
197
+ neutral: "neutral";
198
+ uncertain: "uncertain";
199
+ }> & {
200
+ is(value: unknown): value is "positive" | "negative" | "neutral" | "uncertain";
201
+ }>;
202
+ strength: z.ZodOptional<z.ZodNumber>;
193
203
  }, z.core.$loose> & {
194
204
  is(value: unknown): value is {
195
205
  [x: string]: unknown;
196
206
  from: string;
197
207
  to: string;
198
- type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables";
208
+ type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
199
209
  description?: string | string[] | undefined;
210
+ polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
211
+ strength?: number | undefined;
200
212
  };
201
213
  }>>;
202
214
  external_references: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -284,8 +296,10 @@ export declare const jsonToMarkdownOp: import("./define-operation.js").DefinedOp
284
296
  [x: string]: unknown;
285
297
  from: string;
286
298
  to: string;
287
- type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables";
299
+ type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "performs" | "part_of" | "precedes" | "must_follow" | "blocks" | "routes_to" | "governed_by" | "modifies" | "triggered_by" | "applies_to" | "produces" | "consumes" | "transforms_into" | "selects" | "requires" | "disables" | "influence";
288
300
  description?: string | string[] | undefined;
301
+ polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
302
+ strength?: number | undefined;
289
303
  }[] | undefined;
290
304
  external_references?: {
291
305
  role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";