@openship/protocol 0.0.3 → 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.
@@ -1,118 +1,580 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://openship.dev/schemas/systems.schema.json",
4
- "title": "OpenShip Systems v1",
4
+ "title": "OpenShip Systems 2.0",
5
5
  "type": "object",
6
- "required": ["openship", "capability", "source", "system"],
6
+ "required": [
7
+ "openship",
8
+ "capability",
9
+ "source",
10
+ "system",
11
+ "systemsVersion"
12
+ ],
7
13
  "properties": {
8
- "openship": { "const": "1.0" },
9
- "capability": { "const": "systems" },
14
+ "openship": {
15
+ "const": "1.0"
16
+ },
17
+ "capability": {
18
+ "const": "systems"
19
+ },
10
20
  "source": {
11
21
  "type": "object",
12
- "required": ["manifest", "bundle"],
22
+ "required": [
23
+ "manifest",
24
+ "bundle"
25
+ ],
13
26
  "properties": {
14
- "manifest": { "$ref": "sources-manifest.schema.json" },
15
- "bundle": { "$ref": "sources-bundle.schema.json" }
27
+ "manifest": {
28
+ "$ref": "sources-manifest.schema.json"
29
+ },
30
+ "bundle": {
31
+ "$ref": "sources-bundle.schema.json"
32
+ }
16
33
  },
17
34
  "additionalProperties": true
18
35
  },
19
36
  "system": {
20
37
  "type": "object",
21
- "required": ["id", "name", "rootNodeId", "nodes", "edges"],
38
+ "required": [
39
+ "id",
40
+ "name",
41
+ "layers",
42
+ "refinements"
43
+ ],
22
44
  "properties": {
23
- "id": { "$ref": "#/$defs/id" },
24
- "name": { "type": "string", "minLength": 1 },
25
- "rootNodeId": { "$ref": "#/$defs/id" },
26
- "metadata": { "type": "object", "additionalProperties": true },
27
- "nodes": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/node" } },
28
- "edges": { "type": "array", "items": { "$ref": "#/$defs/edge" } },
29
- "context": { "$ref": "#/$defs/context" }
45
+ "id": {
46
+ "$ref": "#/$defs/id"
47
+ },
48
+ "name": {
49
+ "type": "string",
50
+ "minLength": 1
51
+ },
52
+ "metadata": {
53
+ "type": "object",
54
+ "additionalProperties": true
55
+ },
56
+ "context": {
57
+ "$ref": "#/$defs/context"
58
+ },
59
+ "layers": {
60
+ "type": "array",
61
+ "minItems": 1,
62
+ "items": {
63
+ "$ref": "#/$defs/layer"
64
+ }
65
+ },
66
+ "refinements": {
67
+ "type": "array",
68
+ "items": {
69
+ "$ref": "#/$defs/refinement"
70
+ }
71
+ },
72
+ "instances": {
73
+ "type": "array",
74
+ "items": {
75
+ "$ref": "#/$defs/instance"
76
+ }
77
+ },
78
+ "nodes": false,
79
+ "edges": false,
80
+ "rootNodeId": false
30
81
  },
31
82
  "additionalProperties": true
83
+ },
84
+ "systemsVersion": {
85
+ "const": "2.0"
32
86
  }
33
87
  },
34
88
  "$defs": {
35
- "id": { "type": "string", "pattern": "^[A-Za-z0-9._:-]+$" },
36
- "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
37
- "ownership": { "enum": ["first_party", "third_party"] },
89
+ "id": {
90
+ "type": "string",
91
+ "pattern": "^[A-Za-z0-9._:-]+$"
92
+ },
93
+ "digest": {
94
+ "type": "string",
95
+ "pattern": "^sha256:[0-9a-f]{64}$"
96
+ },
97
+ "ownership": {
98
+ "enum": [
99
+ "first_party",
100
+ "third_party"
101
+ ]
102
+ },
38
103
  "node": {
39
104
  "type": "object",
40
- "required": ["id", "kind", "name", "metadata"],
105
+ "required": [
106
+ "id",
107
+ "kind",
108
+ "name",
109
+ "metadata"
110
+ ],
41
111
  "properties": {
42
- "id": { "$ref": "#/$defs/id" },
43
- "kind": { "enum": ["Root", "Host", "Container", "Process", "Library"] },
44
- "name": { "type": "string", "minLength": 1 },
45
- "parentId": { "$ref": "#/$defs/id" },
46
- "sourceSelectors": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
112
+ "id": {
113
+ "$ref": "#/$defs/id"
114
+ },
115
+ "kind": {
116
+ "enum": [
117
+ "Root",
118
+ "Host",
119
+ "Container",
120
+ "Process",
121
+ "Library",
122
+ "Block",
123
+ "Store"
124
+ ]
125
+ },
126
+ "name": {
127
+ "type": "string",
128
+ "minLength": 1
129
+ },
130
+ "parentId": {
131
+ "$ref": "#/$defs/id"
132
+ },
133
+ "sourceSelectors": {
134
+ "type": "array",
135
+ "items": {
136
+ "type": "string",
137
+ "minLength": 1
138
+ },
139
+ "uniqueItems": true
140
+ },
47
141
  "metadata": {
48
142
  "type": "object",
49
- "required": ["ownership"],
143
+ "required": [
144
+ "ownership"
145
+ ],
50
146
  "properties": {
51
- "ownership": { "$ref": "#/$defs/ownership" }
147
+ "ownership": {
148
+ "$ref": "#/$defs/ownership"
149
+ }
52
150
  },
53
151
  "additionalProperties": true
152
+ },
153
+ "configuration": {
154
+ "$ref": "#/$defs/configuration"
54
155
  }
55
156
  },
56
157
  "additionalProperties": true
57
158
  },
58
159
  "edge": {
59
160
  "type": "object",
60
- "required": ["id", "type", "fromNodeId", "toNodeId"],
161
+ "required": [
162
+ "id",
163
+ "type",
164
+ "fromNodeId",
165
+ "toNodeId"
166
+ ],
61
167
  "properties": {
62
- "id": { "$ref": "#/$defs/id" },
63
- "type": { "enum": ["Runtime", "Dataflow", "Dependency"] },
64
- "fromNodeId": { "$ref": "#/$defs/id" },
65
- "toNodeId": { "$ref": "#/$defs/id" },
66
- "metadata": { "type": "object", "additionalProperties": true }
168
+ "id": {
169
+ "$ref": "#/$defs/id"
170
+ },
171
+ "type": {
172
+ "enum": [
173
+ "Runtime",
174
+ "Dataflow",
175
+ "Dependency"
176
+ ]
177
+ },
178
+ "fromNodeId": {
179
+ "$ref": "#/$defs/id"
180
+ },
181
+ "toNodeId": {
182
+ "$ref": "#/$defs/id"
183
+ },
184
+ "metadata": {
185
+ "type": "object",
186
+ "additionalProperties": true
187
+ }
67
188
  },
68
189
  "additionalProperties": true
69
190
  },
70
191
  "document": {
71
192
  "type": "object",
72
- "required": ["kind", "hash", "title", "language", "text"],
193
+ "required": [
194
+ "kind",
195
+ "hash",
196
+ "title",
197
+ "language",
198
+ "text"
199
+ ],
73
200
  "properties": {
74
- "kind": { "enum": ["Document", "Skill", "Prompt"] },
75
- "hash": { "$ref": "#/$defs/digest" },
76
- "title": { "type": "string", "minLength": 1 },
77
- "language": { "type": "string", "minLength": 1 },
78
- "text": { "type": "string" },
79
- "supersedes": { "$ref": "#/$defs/digest" }
201
+ "kind": {
202
+ "enum": [
203
+ "Document",
204
+ "Skill",
205
+ "Prompt"
206
+ ]
207
+ },
208
+ "hash": {
209
+ "$ref": "#/$defs/digest"
210
+ },
211
+ "title": {
212
+ "type": "string",
213
+ "minLength": 1
214
+ },
215
+ "language": {
216
+ "type": "string",
217
+ "minLength": 1
218
+ },
219
+ "text": {
220
+ "type": "string"
221
+ },
222
+ "supersedes": {
223
+ "$ref": "#/$defs/digest"
224
+ }
80
225
  },
81
226
  "additionalProperties": true
82
227
  },
83
228
  "matrix": {
84
229
  "type": "object",
85
- "required": ["nodeId", "concern"],
230
+ "required": [
231
+ "nodeId",
232
+ "concern"
233
+ ],
86
234
  "properties": {
87
- "nodeId": { "$ref": "#/$defs/id" },
88
- "concern": { "type": "string", "minLength": 1 },
89
- "documentRefs": { "type": "array", "items": { "$ref": "#/$defs/digest" }, "uniqueItems": true },
90
- "skillRefs": { "type": "array", "items": { "$ref": "#/$defs/digest" }, "uniqueItems": true }
235
+ "nodeId": {
236
+ "$ref": "#/$defs/id"
237
+ },
238
+ "concern": {
239
+ "type": "string",
240
+ "minLength": 1
241
+ },
242
+ "documentRefs": {
243
+ "type": "array",
244
+ "items": {
245
+ "$ref": "#/$defs/digest"
246
+ },
247
+ "uniqueItems": true
248
+ },
249
+ "skillRefs": {
250
+ "type": "array",
251
+ "items": {
252
+ "$ref": "#/$defs/digest"
253
+ },
254
+ "uniqueItems": true
255
+ }
91
256
  },
92
257
  "additionalProperties": true
93
258
  },
94
259
  "artifact": {
95
260
  "type": "object",
96
- "required": ["id", "nodeId", "concern", "type"],
261
+ "required": [
262
+ "id",
263
+ "nodeId",
264
+ "concern",
265
+ "type"
266
+ ],
97
267
  "properties": {
98
- "id": { "$ref": "#/$defs/id" },
99
- "nodeId": { "$ref": "#/$defs/id" },
100
- "concern": { "type": "string", "minLength": 1 },
101
- "type": { "enum": ["Summary", "Docs", "Code"] },
102
- "language": { "type": "string" },
103
- "text": { "type": "string" },
104
- "sourcePaths": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }
268
+ "id": {
269
+ "$ref": "#/$defs/id"
270
+ },
271
+ "nodeId": {
272
+ "$ref": "#/$defs/id"
273
+ },
274
+ "concern": {
275
+ "type": "string",
276
+ "minLength": 1
277
+ },
278
+ "type": {
279
+ "enum": [
280
+ "Summary",
281
+ "Docs",
282
+ "Code"
283
+ ]
284
+ },
285
+ "language": {
286
+ "type": "string"
287
+ },
288
+ "text": {
289
+ "type": "string"
290
+ },
291
+ "sourcePaths": {
292
+ "type": "array",
293
+ "items": {
294
+ "type": "string"
295
+ },
296
+ "uniqueItems": true
297
+ }
105
298
  },
106
299
  "additionalProperties": true
107
300
  },
108
301
  "context": {
109
302
  "type": "object",
110
303
  "properties": {
111
- "concerns": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
112
- "documents": { "type": "array", "items": { "$ref": "#/$defs/document" } },
113
- "matrix": { "type": "array", "items": { "$ref": "#/$defs/matrix" } },
114
- "systemPromptRefs": { "type": "array", "items": { "$ref": "#/$defs/digest" }, "uniqueItems": true },
115
- "artifacts": { "type": "array", "items": { "$ref": "#/$defs/artifact" } }
304
+ "concerns": {
305
+ "type": "array",
306
+ "items": {
307
+ "type": "string",
308
+ "minLength": 1
309
+ },
310
+ "uniqueItems": true
311
+ },
312
+ "documents": {
313
+ "type": "array",
314
+ "items": {
315
+ "$ref": "#/$defs/document"
316
+ }
317
+ },
318
+ "matrix": {
319
+ "type": "array",
320
+ "items": {
321
+ "$ref": "#/$defs/matrix"
322
+ }
323
+ },
324
+ "systemPromptRefs": {
325
+ "type": "array",
326
+ "items": {
327
+ "$ref": "#/$defs/digest"
328
+ },
329
+ "uniqueItems": true
330
+ },
331
+ "artifacts": {
332
+ "type": "array",
333
+ "items": {
334
+ "$ref": "#/$defs/artifact"
335
+ }
336
+ }
337
+ },
338
+ "additionalProperties": true
339
+ },
340
+ "layer": {
341
+ "type": "object",
342
+ "required": [
343
+ "rootNodeId",
344
+ "nodes",
345
+ "edges",
346
+ "id",
347
+ "name",
348
+ "role"
349
+ ],
350
+ "properties": {
351
+ "rootNodeId": {
352
+ "$ref": "#/$defs/id"
353
+ },
354
+ "nodes": {
355
+ "type": "array",
356
+ "minItems": 1,
357
+ "items": {
358
+ "$ref": "#/$defs/node"
359
+ }
360
+ },
361
+ "edges": {
362
+ "type": "array",
363
+ "items": {
364
+ "$ref": "#/$defs/edge"
365
+ }
366
+ },
367
+ "id": {
368
+ "$ref": "#/$defs/id"
369
+ },
370
+ "name": {
371
+ "type": "string",
372
+ "minLength": 1
373
+ },
374
+ "role": {
375
+ "enum": [
376
+ "logical",
377
+ "technical",
378
+ "provider",
379
+ "custom"
380
+ ]
381
+ }
382
+ },
383
+ "additionalProperties": true
384
+ },
385
+ "configuration": {
386
+ "type": "array",
387
+ "items": {
388
+ "type": "object",
389
+ "required": [
390
+ "name",
391
+ "description",
392
+ "required"
393
+ ],
394
+ "properties": {
395
+ "name": {
396
+ "type": "string",
397
+ "minLength": 1
398
+ },
399
+ "description": {
400
+ "type": "string",
401
+ "minLength": 1
402
+ },
403
+ "required": {
404
+ "type": "boolean"
405
+ },
406
+ "sensitive": {
407
+ "type": "boolean"
408
+ },
409
+ "value": {},
410
+ "secretRef": {
411
+ "type": "object",
412
+ "required": [
413
+ "nodeId",
414
+ "key"
415
+ ],
416
+ "properties": {
417
+ "nodeId": {
418
+ "$ref": "#/$defs/id"
419
+ },
420
+ "key": {
421
+ "type": "string",
422
+ "minLength": 1
423
+ }
424
+ },
425
+ "additionalProperties": true
426
+ }
427
+ },
428
+ "allOf": [
429
+ {
430
+ "if": {
431
+ "required": [
432
+ "sensitive"
433
+ ],
434
+ "properties": {
435
+ "sensitive": {
436
+ "const": true
437
+ }
438
+ }
439
+ },
440
+ "then": {
441
+ "not": {
442
+ "required": [
443
+ "value"
444
+ ],
445
+ "properties": {
446
+ "value": {}
447
+ }
448
+ }
449
+ }
450
+ },
451
+ {
452
+ "if": {
453
+ "required": [
454
+ "secretRef"
455
+ ],
456
+ "properties": {
457
+ "secretRef": {}
458
+ }
459
+ },
460
+ "then": {
461
+ "not": {
462
+ "required": [
463
+ "value"
464
+ ],
465
+ "properties": {
466
+ "value": {}
467
+ }
468
+ }
469
+ }
470
+ }
471
+ ],
472
+ "additionalProperties": true
473
+ }
474
+ },
475
+ "refinement": {
476
+ "type": "object",
477
+ "required": [
478
+ "id",
479
+ "fromNodeId",
480
+ "toNodeId"
481
+ ],
482
+ "properties": {
483
+ "id": {
484
+ "$ref": "#/$defs/id"
485
+ },
486
+ "fromNodeId": {
487
+ "$ref": "#/$defs/id"
488
+ },
489
+ "toNodeId": {
490
+ "$ref": "#/$defs/id"
491
+ }
492
+ },
493
+ "additionalProperties": true
494
+ },
495
+ "state": {
496
+ "type": "object",
497
+ "properties": {
498
+ "appliedMigration": {
499
+ "type": "string",
500
+ "minLength": 1
501
+ },
502
+ "snapshot": {
503
+ "type": "object",
504
+ "required": [
505
+ "ref",
506
+ "capturedAt"
507
+ ],
508
+ "properties": {
509
+ "ref": {
510
+ "type": "string",
511
+ "minLength": 1
512
+ },
513
+ "capturedAt": {
514
+ "type": "string",
515
+ "format": "date-time"
516
+ },
517
+ "digest": {
518
+ "$ref": "#/$defs/digest"
519
+ }
520
+ },
521
+ "additionalProperties": true
522
+ }
523
+ },
524
+ "additionalProperties": true
525
+ },
526
+ "binding": {
527
+ "type": "object",
528
+ "required": [
529
+ "nodeId"
530
+ ],
531
+ "properties": {
532
+ "nodeId": {
533
+ "$ref": "#/$defs/id"
534
+ },
535
+ "resourceId": {
536
+ "type": "string",
537
+ "minLength": 1
538
+ },
539
+ "configuration": {
540
+ "$ref": "#/$defs/configuration"
541
+ },
542
+ "state": {
543
+ "$ref": "#/$defs/state"
544
+ }
545
+ },
546
+ "additionalProperties": true
547
+ },
548
+ "instance": {
549
+ "type": "object",
550
+ "required": [
551
+ "id",
552
+ "name",
553
+ "environment",
554
+ "layerId",
555
+ "bindings"
556
+ ],
557
+ "properties": {
558
+ "id": {
559
+ "$ref": "#/$defs/id"
560
+ },
561
+ "name": {
562
+ "type": "string",
563
+ "minLength": 1
564
+ },
565
+ "environment": {
566
+ "type": "string",
567
+ "minLength": 1
568
+ },
569
+ "layerId": {
570
+ "$ref": "#/$defs/id"
571
+ },
572
+ "bindings": {
573
+ "type": "array",
574
+ "items": {
575
+ "$ref": "#/$defs/binding"
576
+ }
577
+ }
116
578
  },
117
579
  "additionalProperties": true
118
580
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openship/protocol",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "description": "Canonical OpenShip 1.0 types, validators, consumer helpers, schemas, and skill assets.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.d.ts CHANGED
@@ -10,12 +10,19 @@ export interface SourcesManifest { openship: "1.0"; capability: "sources"; diges
10
10
  export interface SourcesBundle { openship: "1.0"; capability: "sources"; digest: string; files: Record<string, { encoding: OpenShipEncoding; content: string; [key: string]: unknown }>; [key: string]: unknown }
11
11
  export interface DiscoveryAgent { summary: string; instructions: string; skill: string; [key: string]: unknown }
12
12
  export interface DiscoveryDocument { openship: "1.0"; capability: "discovery"; project: { name: string; description: string; [key: string]: unknown }; agent: DiscoveryAgent; page?: string; capabilities: { sources: { description: string; manifest: string; bundle: string; mcp?: string; [key: string]: unknown }; systems?: { description: string; document: string; [key: string]: unknown }; changes?: { description: string; policy: string; submit: string; status: string; [key: string]: unknown }; [key: string]: unknown }; [key: string]: unknown }
13
- export type SystemsNodeKind = "Root" | "Host" | "Container" | "Process" | "Library";
13
+ export type SystemsNodeKind = "Root" | "Block" | "Store" | "Host" | "Container" | "Process" | "Library";
14
14
  export type SystemsNodeOwnership = "first_party" | "third_party";
15
+ export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };
16
+ export interface SystemsConfiguration { name: string; description: string; required: boolean; sensitive?: boolean; value?: JsonValue; secretRef?: { nodeId: string; key: string }; }
15
17
  export interface SystemsNodeMetadata { ownership: SystemsNodeOwnership; [key: string]: unknown }
16
- export interface SystemsNode { id: string; kind: SystemsNodeKind; name: string; parentId?: string; sourceSelectors?: string[]; metadata: SystemsNodeMetadata; [key: string]: unknown }
17
- export interface SystemsGraph { id: string; name: string; rootNodeId: string; nodes: SystemsNode[]; edges: Array<Record<string, unknown>>; metadata?: Record<string, unknown>; context?: Record<string, unknown>; [key: string]: unknown }
18
- export interface SystemsDocument { openship: "1.0"; capability: "systems"; source: { manifest: SourcesManifest; bundle: SourcesBundle; [key: string]: unknown }; system: SystemsGraph; [key: string]: unknown }
18
+ export interface SystemsNode { id: string; kind: SystemsNodeKind; name: string; parentId?: string; sourceSelectors?: string[]; metadata: SystemsNodeMetadata; configuration?: SystemsConfiguration[]; [key: string]: unknown }
19
+ export interface SystemsEdge { id: string; type: "Runtime" | "Dataflow" | "Dependency"; fromNodeId: string; toNodeId: string; metadata?: Record<string, unknown>; [key: string]: unknown }
20
+ export interface SystemsLayer { id: string; name: string; role: "logical" | "technical" | "provider" | "custom"; rootNodeId: string; nodes: SystemsNode[]; edges: SystemsEdge[]; [key: string]: unknown }
21
+ export interface SystemsRefinement { id: string; fromNodeId: string; toNodeId: string; [key: string]: unknown }
22
+ export interface SystemsBinding { nodeId: string; resourceId?: string; configuration?: SystemsConfiguration[]; state?: { appliedMigration?: string; snapshot?: { ref: string; capturedAt: string; digest?: string } }; [key: string]: unknown }
23
+ export interface SystemsInstance { id: string; name: string; environment: string; layerId: string; bindings: SystemsBinding[]; [key: string]: unknown }
24
+ export interface SystemsGraph { id: string; name: string; layers: SystemsLayer[]; refinements: SystemsRefinement[]; instances?: SystemsInstance[]; metadata?: Record<string, unknown>; context?: Record<string, unknown>; [key: string]: unknown }
25
+ export interface SystemsDocument { openship: "1.0"; capability: "systems"; systemsVersion: "2.0"; source: { manifest: SourcesManifest; bundle: SourcesBundle; [key: string]: unknown }; system: SystemsGraph; [key: string]: unknown }
19
26
  export interface VerifiedSourceFile { metadata: SourceFileMetadata; bytes: Uint8Array }
20
27
  export interface VerifiedSources { manifest: SourcesManifest; bundle: SourcesBundle; files: VerifiedSourceFile[]; decodedBytes: number }
21
28
  export interface FetchedOpenShip { origin: string; discovery: DiscoveryDocument; snapshot: { kind: "systems"; document: SystemsDocument } | { kind: "sources"; manifest: SourcesManifest; bundle: SourcesBundle }; verified: VerifiedSources }