workspai 0.47.0 → 0.49.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 (103) hide show
  1. package/README.md +247 -136
  2. package/contracts/agent-customization-pack.v1.json +5 -0
  3. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +4 -0
  4. package/contracts/extension-cli-compatibility.v1.json +8 -2
  5. package/contracts/published-contract-catalog.v1.json +33 -1
  6. package/contracts/runtime-command-surface.v1.json +163 -3
  7. package/contracts/workspace-intelligence/model-usage-event.v1.json +82 -0
  8. package/contracts/workspace-intelligence/workspace-graph-stream.v1.json +262 -0
  9. package/contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json +53 -0
  10. package/contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json +120 -0
  11. package/contracts/workspace-intelligence-architecture.v1.json +31 -2
  12. package/contracts/workspace-intelligence-chain.v1.json +44 -3
  13. package/dist/analyze-EEEU3MIF.js +1 -0
  14. package/dist/{artifact-remediation-plan-EPALZ2LC.js → artifact-remediation-plan-SPOUHMK5.js} +1 -1
  15. package/dist/autopilot-release-R4XRTWEM.js +1 -0
  16. package/dist/{chunk-2TEDAKP6.js → chunk-32OJDBIG.js} +1 -1
  17. package/dist/{chunk-ZDN7RHXJ.js → chunk-37CVKXBD.js} +1 -1
  18. package/dist/{chunk-YCL3I2JO.js → chunk-3NU32T4A.js} +1 -1
  19. package/dist/chunk-3VFA7D5T.js +1 -0
  20. package/dist/{chunk-CW7PGBIQ.js → chunk-4HDYADHT.js} +1 -1
  21. package/dist/{chunk-PBHP6JNY.js → chunk-54EP5CEV.js} +1 -1
  22. package/dist/{chunk-NOFM7MNA.js → chunk-AFL3ACCR.js} +1 -1
  23. package/dist/{chunk-MEMHNE7Y.js → chunk-BFLJ2R4D.js} +1 -1
  24. package/dist/{chunk-6SWRNA47.js → chunk-BGPXQQNY.js} +1 -1
  25. package/dist/chunk-BMWFQXGW.js +1 -0
  26. package/dist/{chunk-2GHUZDYA.js → chunk-CRHYBQI3.js} +1 -1
  27. package/dist/{chunk-KZZ36CK5.js → chunk-E2KJ5QWY.js} +1 -1
  28. package/dist/{chunk-BSRVO52Y.js → chunk-EKZLUMCS.js} +2 -2
  29. package/dist/{chunk-76YOPAOT.js → chunk-ESLPI3XZ.js} +1 -1
  30. package/dist/{chunk-DV6GJD4K.js → chunk-HDXNIN4N.js} +1 -1
  31. package/dist/{chunk-TNQI5VCW.js → chunk-HZDXO65G.js} +14 -14
  32. package/dist/{chunk-COARSXRC.js → chunk-J5ENLXDF.js} +1 -1
  33. package/dist/{chunk-QDWYIRHR.js → chunk-K4X3DM7R.js} +1 -1
  34. package/dist/chunk-LHOZXC2M.js +2 -0
  35. package/dist/{chunk-RWRLFSKW.js → chunk-NAJCUQ4X.js} +1 -1
  36. package/dist/{chunk-ZM5NQ5Z2.js → chunk-OW42TZFB.js} +1 -1
  37. package/dist/{chunk-SK6XRKGG.js → chunk-P3D5YQB2.js} +1 -1
  38. package/dist/{chunk-TWNFECMN.js → chunk-PHXQR6PX.js} +1 -1
  39. package/dist/{chunk-ITCAMC2E.js → chunk-PRTR2DQ2.js} +1 -1
  40. package/dist/{chunk-7VLCK5JW.js → chunk-RHQW3DTP.js} +1 -1
  41. package/dist/{chunk-22NJ2ZMG.js → chunk-T4YR4RAI.js} +1 -1
  42. package/dist/{chunk-VBSQ7MF6.js → chunk-TIE2XMGH.js} +20 -20
  43. package/dist/{chunk-HSGFUKCN.js → chunk-VU7NZHPM.js} +1 -1
  44. package/dist/{chunk-U5EZHZBX.js → chunk-YJZOMRAS.js} +1 -1
  45. package/dist/{create-7JKJDAQV.js → create-S64IWHAP.js} +1 -1
  46. package/dist/{doctor-PGPNIS76.js → doctor-4NNUDNGZ.js} +1 -1
  47. package/dist/{dotnet-webapi-clean-6TVFBTVI.js → dotnet-webapi-clean-A6MVDYXX.js} +4 -4
  48. package/dist/{gofiber-standard-2BL7GWZB.js → gofiber-standard-I5YPQG5V.js} +1 -1
  49. package/dist/{gogin-standard-XGP3KBXA.js → gogin-standard-VY2L4QT5.js} +1 -1
  50. package/dist/index.d.ts +35 -11
  51. package/dist/index.js +138 -136
  52. package/dist/{pipeline-IB6ILJSV.js → pipeline-LHTPE3DR.js} +1 -1
  53. package/dist/{springboot-standard-JJNUID6M.js → springboot-standard-55XKCBIZ.js} +4 -4
  54. package/dist/{workspace-H3QXBFGB.js → workspace-PJPRBUMQ.js} +1 -1
  55. package/dist/{workspace-agent-sync-C7SG2Z5W.js → workspace-agent-sync-662QHXGF.js} +1 -1
  56. package/dist/{workspace-context-BKQBKA4C.js → workspace-context-23YYCUCP.js} +1 -1
  57. package/dist/{workspace-contract-RPQQBQXR.js → workspace-contract-TU2I7GC2.js} +1 -1
  58. package/dist/{workspace-dependency-graph-23BI2HG7.js → workspace-dependency-graph-BP4EXYQ5.js} +1 -1
  59. package/dist/workspace-explain-MWUEN643.js +1 -0
  60. package/dist/workspace-explain-contract-ZPI3JXJU.js +1 -0
  61. package/dist/{workspace-feedback-WAID3IOE.js → workspace-feedback-SUVH2LUJ.js} +1 -1
  62. package/dist/{workspace-foundation-5OOJEO2D.js → workspace-foundation-WPLD7OEO.js} +1 -1
  63. package/dist/workspace-graph-stream-KAGGQPJT.js +1 -0
  64. package/dist/{workspace-history-C6OP3IAQ.js → workspace-history-BANOJRQ2.js} +1 -1
  65. package/dist/{workspace-intelligence-VKDL3H2J.js → workspace-intelligence-MFJE7W67.js} +1 -1
  66. package/dist/workspace-intelligence-evaluation-IPH7M3WV.js +1 -0
  67. package/dist/{workspace-intelligence-runner-LVALAZY7.js → workspace-intelligence-runner-OTYTHV6B.js} +1 -1
  68. package/dist/{workspace-knowledge-graph-FE2NTZKV.js → workspace-knowledge-graph-ARDC6HHG.js} +1 -1
  69. package/dist/workspace-knowledge-graph-export-UYAYFTWX.js +10 -0
  70. package/dist/workspace-mcp-serve-EZR6O76D.js +3 -0
  71. package/dist/{workspace-model-S33CIB2R.js → workspace-model-7OU2M3LE.js} +1 -1
  72. package/dist/{workspace-registry-summary-A3YDL63D.js → workspace-registry-summary-ORDK7A36.js} +1 -1
  73. package/dist/workspace-run-QND2SIYA.js +1 -0
  74. package/dist/{workspace-verify-ZGH3NXAH.js → workspace-verify-EBVL7FWT.js} +1 -1
  75. package/dist/workspace-watch-7HWGA5TF.js +1 -0
  76. package/docs/GLOSSARY.md +28 -24
  77. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +11 -8
  78. package/docs/README.md +62 -23
  79. package/docs/README_CONTENT_CONTRACT.md +154 -0
  80. package/docs/ci-workflows.md +3 -3
  81. package/docs/commands-reference.md +16 -3
  82. package/docs/contracts/ARTIFACT_CATALOG.md +35 -20
  83. package/docs/contracts/README.md +3 -0
  84. package/docs/creating-workspaces-and-projects.md +16 -12
  85. package/docs/doctor-command.md +30 -28
  86. package/docs/examples/ci-agent-grounding.yml +1 -1
  87. package/docs/from-code-to-shared-understanding.md +2 -2
  88. package/docs/graph-benchmark-methodology.md +2 -2
  89. package/docs/workspace-intelligence-evaluation.md +149 -0
  90. package/docs/workspace-intelligence-runner.md +17 -6
  91. package/docs/workspace-knowledge-graph.md +31 -10
  92. package/docs/workspace-operations.md +13 -5
  93. package/package.json +9 -4
  94. package/templates/kits/fastapi-ddd/README.md.j2 +1 -1
  95. package/dist/analyze-UVXPRGYZ.js +0 -1
  96. package/dist/autopilot-release-5BQ6F5L2.js +0 -1
  97. package/dist/chunk-LNRAB7UY.js +0 -1
  98. package/dist/chunk-NRYS4CLR.js +0 -2
  99. package/dist/workspace-explain-WVN7JH3U.js +0 -1
  100. package/dist/workspace-explain-contract-SEFTVF6J.js +0 -1
  101. package/dist/workspace-mcp-serve-KT2I676Z.js +0 -3
  102. package/dist/workspace-run-M4LNJILC.js +0 -1
  103. package/dist/workspace-watch-EVBJTMV7.js +0 -1
@@ -75,7 +75,9 @@
75
75
  "skillsIndex": "workspace-skills-index.v1",
76
76
  "agents": null,
77
77
  "explain": "workspace-explain.v1",
78
- "intelligenceRun": "workspace-intelligence-run.v1"
78
+ "intelligenceRun": "workspace-intelligence-run.v1",
79
+ "evaluationLive": "workspace-intelligence-evaluation.v1",
80
+ "evaluationLastRun": "workspace-intelligence-evaluation.v1"
79
81
  },
80
82
  "contractPath": null,
81
83
  "publication": "embedded-type",
@@ -169,6 +171,16 @@
169
171
  "path": ".workspai/reports/workspace-intelligence-run-last-run.json",
170
172
  "schemaVersion": "workspace-intelligence-run.v1",
171
173
  "contractPath": "contracts/workspace-intelligence/workspace-intelligence-run.v1.json"
174
+ },
175
+ "evaluationLive": {
176
+ "path": ".workspai/reports/workspace-intelligence-evaluation-live.json",
177
+ "schemaVersion": "workspace-intelligence-evaluation.v1",
178
+ "contractPath": "contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json"
179
+ },
180
+ "evaluationLastRun": {
181
+ "path": ".workspai/reports/workspace-intelligence-evaluation-last-run.json",
182
+ "schemaVersion": "workspace-intelligence-evaluation.v1",
183
+ "contractPath": "contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json"
172
184
  }
173
185
  }
174
186
  },
@@ -222,6 +234,11 @@
222
234
  "contractPath": "contracts/workspace-intelligence/workspace-knowledge-graph.v1.json",
223
235
  "publication": "json-schema"
224
236
  },
237
+ "workspaceGraphStream": {
238
+ "schemaVersion": "workspace-graph-stream.v1",
239
+ "contractPath": "contracts/workspace-intelligence/workspace-graph-stream.v1.json",
240
+ "publication": "json-schema"
241
+ },
225
242
  "workspaceKnowledgeGraphChangeOverlay": {
226
243
  "schemaVersion": "workspace-knowledge-graph-change-overlay.v1",
227
244
  "contractPath": "contracts/workspace-intelligence/workspace-knowledge-graph-change-overlay.v1.json",
@@ -237,6 +254,21 @@
237
254
  "contractPath": "contracts/workspace-intelligence/workspace-graph-token-efficiency.v1.json",
238
255
  "publication": "json-schema"
239
256
  },
257
+ "modelUsageEvent": {
258
+ "schemaVersion": "model-usage-event.v1",
259
+ "contractPath": "contracts/workspace-intelligence/model-usage-event.v1.json",
260
+ "publication": "json-schema"
261
+ },
262
+ "workspaceIntelligenceEvaluation": {
263
+ "schemaVersion": "workspace-intelligence-evaluation.v1",
264
+ "contractPath": "contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",
265
+ "publication": "json-schema"
266
+ },
267
+ "workspaceIntelligenceEvaluationComparison": {
268
+ "schemaVersion": "workspace-intelligence-evaluation-comparison.v1",
269
+ "contractPath": "contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json",
270
+ "publication": "json-schema"
271
+ },
240
272
  "workspaceIntelligenceHistory": {
241
273
  "schemaVersion": "workspace-intelligence-history.v1",
242
274
  "contractPath": "contracts/workspace-intelligence/workspace-intelligence-history.v1.json",
@@ -856,6 +856,82 @@
856
856
  "--json"
857
857
  ]
858
858
  },
859
+ {
860
+ "invocation": "workspace eval",
861
+ "summary": "Measure model usage, agent activity, cost provenance, and verified task outcomes without storing prompt or response bodies.",
862
+ "canonicalArgv": [
863
+ "workspace",
864
+ "eval",
865
+ "status",
866
+ "--json"
867
+ ],
868
+ "input": {
869
+ "transport": "stdin",
870
+ "mediaType": "application/json",
871
+ "required": false,
872
+ "schemaVersion": "model-usage-event.v1",
873
+ "contractPath": "contracts/workspace-intelligence/model-usage-event.v1.json"
874
+ },
875
+ "output": {
876
+ "defaultFormat": "human-or-json",
877
+ "modes": [
878
+ {
879
+ "selector": "init <task> [strategy] --json",
880
+ "format": "json",
881
+ "mediaType": "application/json"
882
+ },
883
+ {
884
+ "selector": "record --json",
885
+ "format": "json",
886
+ "mediaType": "application/json"
887
+ },
888
+ {
889
+ "selector": "status --json",
890
+ "format": "json",
891
+ "mediaType": "application/json"
892
+ },
893
+ {
894
+ "selector": "report --json",
895
+ "format": "json",
896
+ "mediaType": "application/json"
897
+ },
898
+ {
899
+ "selector": "compare --from <report> --json",
900
+ "format": "json",
901
+ "mediaType": "application/json"
902
+ }
903
+ ]
904
+ }
905
+ },
906
+ {
907
+ "invocation": "workspace eval init",
908
+ "summary": "Initialize one live, versioned Workspace Intelligence evaluation run for a fixed task and retrieval strategy.",
909
+ "canonicalArgv": [
910
+ "workspace",
911
+ "eval",
912
+ "init"
913
+ ]
914
+ },
915
+ {
916
+ "invocation": "workspace eval record --json",
917
+ "summary": "Validate one privacy-bounded usage or outcome event from stdin and append it to the live evaluation artifact.",
918
+ "canonicalArgv": [
919
+ "workspace",
920
+ "eval",
921
+ "record",
922
+ "--json"
923
+ ]
924
+ },
925
+ {
926
+ "invocation": "workspace eval report --json",
927
+ "summary": "Finalize the live evaluation into an authoritative last-run report for IDE, CI, and comparison consumers.",
928
+ "canonicalArgv": [
929
+ "workspace",
930
+ "eval",
931
+ "report",
932
+ "--json"
933
+ ]
934
+ },
859
935
  {
860
936
  "invocation": "workspace explain",
861
937
  "summary": "Explain a workspace relationship, project, or blocker from traceable model and evidence references.",
@@ -930,7 +1006,7 @@
930
1006
  },
931
1007
  {
932
1008
  "invocation": "workspace graph",
933
- "summary": "Render the current workspace dependency graph in a supported representation.",
1009
+ "summary": "Query or export the evidence-backed workspace graph derived from the canonical model.",
934
1010
  "canonicalArgv": [
935
1011
  "workspace",
936
1012
  "graph",
@@ -960,6 +1036,26 @@
960
1036
  "format": "json",
961
1037
  "mediaType": "application/json"
962
1038
  },
1039
+ {
1040
+ "selector": "entities [kind] --json",
1041
+ "format": "json",
1042
+ "mediaType": "application/json"
1043
+ },
1044
+ {
1045
+ "selector": "evidence <id-or-unique-label> --json",
1046
+ "format": "json",
1047
+ "mediaType": "application/json"
1048
+ },
1049
+ {
1050
+ "selector": "path <from> <to> --json",
1051
+ "format": "json",
1052
+ "mediaType": "application/json"
1053
+ },
1054
+ {
1055
+ "selector": "overlay --from <graph> --json",
1056
+ "format": "json",
1057
+ "mediaType": "application/json"
1058
+ },
963
1059
  {
964
1060
  "selector": "dot",
965
1061
  "format": "raw-text",
@@ -969,6 +1065,21 @@
969
1065
  "selector": "mermaid",
970
1066
  "format": "raw-text",
971
1067
  "mediaType": "text/vnd.mermaid"
1068
+ },
1069
+ {
1070
+ "selector": "jsonld",
1071
+ "format": "raw-text",
1072
+ "mediaType": "application/ld+json"
1073
+ },
1074
+ {
1075
+ "selector": "graphml",
1076
+ "format": "raw-text",
1077
+ "mediaType": "application/graphml+xml"
1078
+ },
1079
+ {
1080
+ "selector": "gexf",
1081
+ "format": "raw-text",
1082
+ "mediaType": "application/gexf+xml"
972
1083
  }
973
1084
  ]
974
1085
  }
@@ -1155,8 +1266,24 @@
1155
1266
  "summary": "Observe relevant workspace changes and publish versioned watch events.",
1156
1267
  "canonicalArgv": [
1157
1268
  "workspace",
1158
- "watch"
1159
- ]
1269
+ "watch",
1270
+ "--json"
1271
+ ],
1272
+ "output": {
1273
+ "defaultFormat": "human-or-json",
1274
+ "modes": [
1275
+ {
1276
+ "selector": "--json",
1277
+ "format": "json",
1278
+ "mediaType": "application/x-ndjson"
1279
+ },
1280
+ {
1281
+ "selector": "--graph-stream --json",
1282
+ "format": "json",
1283
+ "mediaType": "application/x-ndjson"
1284
+ }
1285
+ ]
1286
+ }
1160
1287
  },
1161
1288
  {
1162
1289
  "invocation": "workspace why",
@@ -1402,6 +1529,37 @@
1402
1529
  ]
1403
1530
  ]
1404
1531
  },
1532
+ {
1533
+ "artifactPath": ".workspai/reports/workspace-intelligence-evaluation-live.json",
1534
+ "schemaVersion": "workspace-intelligence-evaluation.v1",
1535
+ "contractPath": "contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",
1536
+ "producerCommands": [
1537
+ [
1538
+ "workspace",
1539
+ "eval",
1540
+ "init"
1541
+ ],
1542
+ [
1543
+ "workspace",
1544
+ "eval",
1545
+ "record",
1546
+ "--json"
1547
+ ]
1548
+ ]
1549
+ },
1550
+ {
1551
+ "artifactPath": ".workspai/reports/workspace-intelligence-evaluation-last-run.json",
1552
+ "schemaVersion": "workspace-intelligence-evaluation.v1",
1553
+ "contractPath": "contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",
1554
+ "producerCommands": [
1555
+ [
1556
+ "workspace",
1557
+ "eval",
1558
+ "report",
1559
+ "--json"
1560
+ ]
1561
+ ]
1562
+ },
1405
1563
  {
1406
1564
  "artifactPath": ".workspai/workspace.contract.json",
1407
1565
  "schemaVersion": 1,
@@ -1668,6 +1826,7 @@
1668
1826
  "why",
1669
1827
  "trace",
1670
1828
  "feedback",
1829
+ "eval",
1671
1830
  "mcp",
1672
1831
  "policy",
1673
1832
  "contract",
@@ -1696,6 +1855,7 @@
1696
1855
  "why",
1697
1856
  "trace",
1698
1857
  "feedback",
1858
+ "eval",
1699
1859
  "mcp"
1700
1860
  ],
1701
1861
  "workspaceIntelligenceRootCommands": [
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://getrapidkit.com/schemas/model-usage-event.v1.json",
4
+ "title": "Workspai Model and Agent Usage Event",
5
+ "description": "A privacy-bounded usage observation. Prompt and response bodies are deliberately excluded; consumers may provide hashes instead.",
6
+ "type": "object",
7
+ "required": ["schemaVersion", "eventId", "recordedAt", "kind"],
8
+ "properties": {
9
+ "schemaVersion": { "const": "model-usage-event.v1" },
10
+ "eventId": { "type": "string", "minLength": 1 },
11
+ "recordedAt": { "type": "string", "format": "date-time" },
12
+ "kind": { "enum": ["model-call", "tool-call", "outcome", "milestone"] },
13
+ "stage": { "type": "string", "minLength": 1 },
14
+ "modelCall": {
15
+ "type": "object",
16
+ "required": ["provider", "model", "source", "inputTokens", "outputTokens", "cachedInputTokens", "reasoningTokens", "latencyMs"],
17
+ "properties": {
18
+ "provider": { "type": "string", "minLength": 1 },
19
+ "model": { "type": "string", "minLength": 1 },
20
+ "source": { "enum": ["provider-reported", "tokenizer-counted", "estimated", "unavailable"] },
21
+ "tokenizer": { "type": "string", "minLength": 1 },
22
+ "inputTokens": { "type": ["integer", "null"], "minimum": 0 },
23
+ "outputTokens": { "type": ["integer", "null"], "minimum": 0 },
24
+ "cachedInputTokens": { "type": ["integer", "null"], "minimum": 0 },
25
+ "reasoningTokens": { "type": ["integer", "null"], "minimum": 0 },
26
+ "latencyMs": { "type": ["number", "null"], "minimum": 0 },
27
+ "promptHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
28
+ "responseHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
29
+ "cost": {
30
+ "type": "object",
31
+ "required": ["amount", "currency", "source"],
32
+ "properties": {
33
+ "amount": { "type": "number", "minimum": 0 },
34
+ "currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
35
+ "source": { "enum": ["provider-reported", "catalog-estimated"] }
36
+ },
37
+ "additionalProperties": false
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ },
42
+ "toolCall": {
43
+ "type": "object",
44
+ "required": ["tool", "result", "changedSource", "durationMs"],
45
+ "properties": {
46
+ "tool": { "type": "string", "minLength": 1 },
47
+ "result": { "enum": ["passed", "failed", "blocked", "skipped"] },
48
+ "changedSource": { "type": "boolean" },
49
+ "durationMs": { "type": ["number", "null"], "minimum": 0 },
50
+ "artifact": { "type": "string", "minLength": 1 }
51
+ },
52
+ "additionalProperties": false
53
+ },
54
+ "outcome": {
55
+ "type": "object",
56
+ "required": ["status", "verified", "blockersResolved"],
57
+ "properties": {
58
+ "status": { "enum": ["passed", "failed", "blocked", "unknown"] },
59
+ "verified": { "type": "boolean" },
60
+ "blockersResolved": { "type": "integer", "minimum": 0 },
61
+ "summary": { "type": "string", "minLength": 1 }
62
+ },
63
+ "additionalProperties": false
64
+ },
65
+ "milestone": {
66
+ "type": "object",
67
+ "required": ["name"],
68
+ "properties": {
69
+ "name": { "type": "string", "minLength": 1 },
70
+ "detail": { "type": "string", "minLength": 1 }
71
+ },
72
+ "additionalProperties": false
73
+ }
74
+ },
75
+ "allOf": [
76
+ { "if": { "properties": { "kind": { "const": "model-call" } } }, "then": { "properties": { "modelCall": {} }, "required": ["modelCall"] } },
77
+ { "if": { "properties": { "kind": { "const": "tool-call" } } }, "then": { "properties": { "toolCall": {} }, "required": ["toolCall"] } },
78
+ { "if": { "properties": { "kind": { "const": "outcome" } } }, "then": { "properties": { "outcome": {} }, "required": ["outcome"] } },
79
+ { "if": { "properties": { "kind": { "const": "milestone" } } }, "then": { "properties": { "milestone": {} }, "required": ["milestone"] } }
80
+ ],
81
+ "additionalProperties": false
82
+ }
@@ -0,0 +1,262 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://getrapidkit.com/schemas/workspace-graph-stream.v1.json",
4
+ "title": "Workspai Workspace Graph Stream",
5
+ "description": "Transport-neutral, revision-safe events for hydrating and incrementally updating a Workspace Knowledge Graph consumer.",
6
+ "type": "object",
7
+ "required": [
8
+ "schemaVersion",
9
+ "type",
10
+ "workspaceId",
11
+ "sessionId",
12
+ "generation",
13
+ "revision",
14
+ "modelHash",
15
+ "graphHash",
16
+ "generatedAt",
17
+ "causationId",
18
+ "correlationId",
19
+ "payload"
20
+ ],
21
+ "properties": {
22
+ "schemaVersion": { "const": "workspace-graph-stream.v1" },
23
+ "type": {
24
+ "enum": [
25
+ "graph.snapshot",
26
+ "graph.delta",
27
+ "graph.provider-progress",
28
+ "graph.quality-changed",
29
+ "graph.proof-invalidated",
30
+ "graph.resync-required",
31
+ "graph.paused",
32
+ "graph.complete",
33
+ "graph.heartbeat",
34
+ "graph.error"
35
+ ]
36
+ },
37
+ "workspaceId": { "type": "string", "minLength": 1 },
38
+ "sessionId": { "type": "string", "minLength": 1 },
39
+ "generation": { "type": "integer", "minimum": 0 },
40
+ "baseRevision": { "type": "integer", "minimum": 0 },
41
+ "baseModelHash": { "$ref": "#/$defs/hash" },
42
+ "baseGraphHash": { "$ref": "#/$defs/hash" },
43
+ "revision": { "type": "integer", "minimum": 0 },
44
+ "modelHash": { "$ref": "#/$defs/hash" },
45
+ "graphHash": { "$ref": "#/$defs/hash" },
46
+ "generatedAt": { "type": "string", "format": "date-time" },
47
+ "causationId": { "type": "string", "minLength": 1 },
48
+ "correlationId": { "type": "string", "minLength": 1 },
49
+ "payload": { "type": "object" }
50
+ },
51
+ "allOf": [
52
+ {
53
+ "if": { "properties": { "type": { "const": "graph.snapshot" } } },
54
+ "then": {
55
+ "properties": {
56
+ "payload": { "$ref": "#/$defs/snapshotPayload" },
57
+ "baseRevision": false,
58
+ "baseModelHash": false,
59
+ "baseGraphHash": false
60
+ }
61
+ }
62
+ },
63
+ {
64
+ "if": { "properties": { "type": { "const": "graph.delta" } } },
65
+ "then": {
66
+ "required": ["baseRevision", "baseModelHash", "baseGraphHash"],
67
+ "properties": { "payload": { "$ref": "#/$defs/deltaPayload" } }
68
+ }
69
+ },
70
+ {
71
+ "if": { "properties": { "type": { "const": "graph.provider-progress" } } },
72
+ "then": { "properties": { "payload": { "$ref": "#/$defs/providerProgressPayload" } } }
73
+ },
74
+ {
75
+ "if": { "properties": { "type": { "const": "graph.quality-changed" } } },
76
+ "then": { "properties": { "payload": { "$ref": "#/$defs/qualityPayload" } } }
77
+ },
78
+ {
79
+ "if": { "properties": { "type": { "const": "graph.proof-invalidated" } } },
80
+ "then": { "properties": { "payload": { "$ref": "#/$defs/proofInvalidatedPayload" } } }
81
+ },
82
+ {
83
+ "if": { "properties": { "type": { "const": "graph.resync-required" } } },
84
+ "then": { "properties": { "payload": { "$ref": "#/$defs/resyncPayload" } } }
85
+ },
86
+ {
87
+ "if": {
88
+ "properties": {
89
+ "type": { "enum": ["graph.paused", "graph.complete", "graph.heartbeat"] }
90
+ }
91
+ },
92
+ "then": { "properties": { "payload": { "$ref": "#/$defs/controlPayload" } } }
93
+ },
94
+ {
95
+ "if": { "properties": { "type": { "const": "graph.error" } } },
96
+ "then": { "properties": { "payload": { "$ref": "#/$defs/errorPayload" } } }
97
+ }
98
+ ],
99
+ "$defs": {
100
+ "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
101
+ "id": { "type": "string", "minLength": 1 },
102
+ "snapshotPayload": {
103
+ "type": "object",
104
+ "required": ["graph"],
105
+ "properties": {
106
+ "graph": { "$ref": "workspace-knowledge-graph.v1.json" },
107
+ "reason": { "enum": ["initial", "refresh", "recovery", "schema-transition"] }
108
+ },
109
+ "additionalProperties": false
110
+ },
111
+ "deltaPayload": {
112
+ "type": "object",
113
+ "required": [
114
+ "entitiesAdded",
115
+ "entitiesUpdated",
116
+ "entitiesRemoved",
117
+ "relationsAdded",
118
+ "relationsUpdated",
119
+ "relationsRemoved",
120
+ "proofsAdded",
121
+ "proofsUpdated",
122
+ "proofsRemoved",
123
+ "providersUpdated",
124
+ "diagnostics"
125
+ ],
126
+ "properties": {
127
+ "entitiesAdded": {
128
+ "type": "array",
129
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/entities/items" }
130
+ },
131
+ "entitiesUpdated": {
132
+ "type": "array",
133
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/entities/items" }
134
+ },
135
+ "entitiesRemoved": {
136
+ "type": "array",
137
+ "items": { "$ref": "#/$defs/id" },
138
+ "uniqueItems": true
139
+ },
140
+ "relationsAdded": {
141
+ "type": "array",
142
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/relations/items" }
143
+ },
144
+ "relationsUpdated": {
145
+ "type": "array",
146
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/relations/items" }
147
+ },
148
+ "relationsRemoved": {
149
+ "type": "array",
150
+ "items": { "$ref": "#/$defs/id" },
151
+ "uniqueItems": true
152
+ },
153
+ "proofsAdded": {
154
+ "type": "array",
155
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/proofs/items" }
156
+ },
157
+ "proofsUpdated": {
158
+ "type": "array",
159
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/proofs/items" }
160
+ },
161
+ "proofsRemoved": {
162
+ "type": "array",
163
+ "items": { "$ref": "#/$defs/id" },
164
+ "uniqueItems": true
165
+ },
166
+ "providersUpdated": {
167
+ "type": "array",
168
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/providers/items" }
169
+ },
170
+ "quality": {
171
+ "oneOf": [
172
+ { "type": "null" },
173
+ { "$ref": "workspace-knowledge-graph.v1.json#/properties/quality" }
174
+ ]
175
+ },
176
+ "diagnostics": {
177
+ "type": "array",
178
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/diagnostics/items" }
179
+ }
180
+ },
181
+ "additionalProperties": false
182
+ },
183
+ "providerProgressPayload": {
184
+ "type": "object",
185
+ "required": ["providerId", "status"],
186
+ "properties": {
187
+ "providerId": { "$ref": "#/$defs/id" },
188
+ "status": { "enum": ["queued", "running", "passed", "partial", "skipped", "failed"] },
189
+ "completed": { "type": "integer", "minimum": 0 },
190
+ "total": { "type": "integer", "minimum": 0 },
191
+ "message": { "type": "string" }
192
+ },
193
+ "additionalProperties": false
194
+ },
195
+ "qualityPayload": {
196
+ "type": "object",
197
+ "required": ["quality"],
198
+ "properties": {
199
+ "quality": { "$ref": "workspace-knowledge-graph.v1.json#/properties/quality" },
200
+ "diagnostics": {
201
+ "type": "array",
202
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/diagnostics/items" }
203
+ }
204
+ },
205
+ "additionalProperties": false
206
+ },
207
+ "proofInvalidatedPayload": {
208
+ "type": "object",
209
+ "required": ["proofIds", "reason"],
210
+ "properties": {
211
+ "proofIds": {
212
+ "type": "array",
213
+ "items": { "$ref": "#/$defs/id" },
214
+ "minItems": 1,
215
+ "uniqueItems": true
216
+ },
217
+ "reason": { "type": "string", "minLength": 1 },
218
+ "entityIds": { "type": "array", "items": { "$ref": "#/$defs/id" }, "uniqueItems": true },
219
+ "relationIds": { "type": "array", "items": { "$ref": "#/$defs/id" }, "uniqueItems": true }
220
+ },
221
+ "additionalProperties": false
222
+ },
223
+ "resyncPayload": {
224
+ "type": "object",
225
+ "required": ["reason"],
226
+ "properties": {
227
+ "reason": {
228
+ "enum": [
229
+ "revision-gap",
230
+ "identity-mismatch",
231
+ "generation-regression",
232
+ "schema-unsupported",
233
+ "hash-discontinuity",
234
+ "validation-failed",
235
+ "queue-overflow"
236
+ ]
237
+ },
238
+ "expectedRevision": { "type": "integer", "minimum": 0 },
239
+ "receivedBaseRevision": { "type": "integer", "minimum": 0 },
240
+ "message": { "type": "string" }
241
+ },
242
+ "additionalProperties": false
243
+ },
244
+ "controlPayload": {
245
+ "type": "object",
246
+ "properties": { "reason": { "type": "string" }, "message": { "type": "string" } },
247
+ "additionalProperties": false
248
+ },
249
+ "errorPayload": {
250
+ "type": "object",
251
+ "required": ["code", "message", "recoverable"],
252
+ "properties": {
253
+ "code": { "type": "string", "minLength": 1 },
254
+ "message": { "type": "string", "minLength": 1 },
255
+ "recoverable": { "type": "boolean" },
256
+ "providerId": { "type": "string" }
257
+ },
258
+ "additionalProperties": false
259
+ }
260
+ },
261
+ "additionalProperties": false
262
+ }