@mplp/schema 1.0.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 (38) hide show
  1. package/LICENSE.txt +201 -0
  2. package/dist/index.d.ts +45 -0
  3. package/dist/index.js +63 -0
  4. package/package.json +38 -0
  5. package/schemas/common/common-types.schema.json +49 -0
  6. package/schemas/common/events.schema.json +66 -0
  7. package/schemas/common/identifiers.schema.json +13 -0
  8. package/schemas/common/learning-sample.schema.json +194 -0
  9. package/schemas/common/metadata.schema.json +113 -0
  10. package/schemas/common/trace-base.schema.json +43 -0
  11. package/schemas/events/mplp-event-core.schema.json +58 -0
  12. package/schemas/events/mplp-graph-update-event.schema.json +58 -0
  13. package/schemas/events/mplp-map-event.schema.json +147 -0
  14. package/schemas/events/mplp-pipeline-stage-event.schema.json +56 -0
  15. package/schemas/events/mplp-runtime-execution-event.schema.json +58 -0
  16. package/schemas/events/mplp-sa-event.schema.json +109 -0
  17. package/schemas/integration/mplp-ci-event.schema.json +130 -0
  18. package/schemas/integration/mplp-file-update-event.schema.json +70 -0
  19. package/schemas/integration/mplp-git-event.schema.json +98 -0
  20. package/schemas/integration/mplp-tool-event.schema.json +83 -0
  21. package/schemas/invariants/integration-invariants.yaml +143 -0
  22. package/schemas/invariants/learning-invariants.yaml +102 -0
  23. package/schemas/invariants/map-invariants.yaml +69 -0
  24. package/schemas/invariants/observability-invariants.yaml +102 -0
  25. package/schemas/invariants/sa-invariants.yaml +68 -0
  26. package/schemas/learning/mplp-learning-sample-core.schema.json +94 -0
  27. package/schemas/learning/mplp-learning-sample-delta.schema.json +137 -0
  28. package/schemas/learning/mplp-learning-sample-intent.schema.json +119 -0
  29. package/schemas/mplp-collab.schema.json +243 -0
  30. package/schemas/mplp-confirm.schema.json +226 -0
  31. package/schemas/mplp-context.schema.json +246 -0
  32. package/schemas/mplp-core.schema.json +183 -0
  33. package/schemas/mplp-dialog.schema.json +198 -0
  34. package/schemas/mplp-extension.schema.json +179 -0
  35. package/schemas/mplp-network.schema.json +230 -0
  36. package/schemas/mplp-plan.schema.json +193 -0
  37. package/schemas/mplp-role.schema.json +139 -0
  38. package/schemas/mplp-trace.schema.json +216 -0
@@ -0,0 +1,102 @@
1
+ # MPLP Protocol v1.0.0 — Frozen Specification
2
+ # Freeze Date: 2025-12-03
3
+ # Status: FROZEN (no breaking changes permitted)
4
+ # Governance: MPLP Protocol Governance Committee (MPGC)
5
+ # © 2025 邦士(北京)网络科技有限公司
6
+ # License: Apache-2.0
7
+ # Any normative change requires a new protocol version.
8
+
9
+ # MPLP Protocol 1.0.0 — Frozen Specification
10
+ # Status: Frozen as of 2025-11-30
11
+ # Copyright: © 2025 邦士(北京)网络科技有限公司
12
+ # License: Apache-2.0 (see LICENSE at repository root)
13
+ # Any normative change requires a new protocol version.
14
+
15
+ invariants:
16
+ # Core Event Structure Invariants
17
+ - id: obs_event_id_is_uuid
18
+ scope: event
19
+ path: event_id
20
+ rule: uuid-v4
21
+ description: "All events must have UUID v4 event_id"
22
+
23
+ - id: obs_event_type_non_empty
24
+ scope: event
25
+ path: event_type
26
+ rule: non-empty-string
27
+ description: "All events must have non-empty event_type"
28
+
29
+ - id: obs_event_family_valid
30
+ scope: event
31
+ path: event_family
32
+ rule: enum(import_process,intent,delta_intent,impact_analysis,compensation_plan,methodology,reasoning_graph,pipeline_stage,graph_update,runtime_execution,cost_budget,external_integration)
33
+ description: "Event family must be valid enum value"
34
+
35
+ - id: obs_timestamp_iso_format
36
+ scope: event
37
+ path: timestamp
38
+ rule: iso-datetime
39
+ description: "All events must have ISO 8601 timestamp"
40
+
41
+ # PipelineStageEvent Specific Invariants
42
+ - id: obs_pipeline_event_has_pipeline_id
43
+ scope: event
44
+ path: pipeline_id
45
+ rule: uuid-v4
46
+ description: "PipelineStageEvent must have valid pipeline_id"
47
+ note: "Apply when event_family == pipeline_stage"
48
+
49
+ - id: obs_pipeline_stage_id_non_empty
50
+ scope: event
51
+ path: stage_id
52
+ rule: non-empty-string
53
+ description: "PipelineStageEvent must have non-empty stage_id"
54
+ note: "Apply when event_family == pipeline_stage"
55
+
56
+ - id: obs_pipeline_stage_status_valid
57
+ scope: event
58
+ path: stage_status
59
+ rule: enum(pending,running,completed,failed,skipped)
60
+ description: "PipelineStageEvent stage_status must be valid enum"
61
+ note: "Apply when event_family == pipeline_stage"
62
+
63
+ # GraphUpdateEvent Specific Invariants
64
+ - id: obs_graph_event_has_graph_id
65
+ scope: event
66
+ path: graph_id
67
+ rule: uuid-v4
68
+ description: "GraphUpdateEvent must have valid graph_id"
69
+ note: "Apply when event_family == graph_update"
70
+
71
+ - id: obs_graph_update_kind_valid
72
+ scope: event
73
+ path: update_kind
74
+ rule: enum(node_add,node_update,node_delete,edge_add,edge_update,edge_delete,bulk)
75
+ description: "GraphUpdateEvent update_kind must be valid enum"
76
+ note: "Apply when event_family == graph_update"
77
+
78
+ # RuntimeExecutionEvent Specific Invariants
79
+ - id: obs_runtime_event_has_execution_id
80
+ scope: event
81
+ path: execution_id
82
+ rule: uuid-v4
83
+ description: "RuntimeExecutionEvent must have valid execution_id"
84
+ note: "Apply when event_family == runtime_execution"
85
+
86
+ - id: obs_runtime_executor_kind_valid
87
+ scope: event
88
+ path: executor_kind
89
+ rule: enum(agent,tool,llm,worker,external)
90
+ description: "RuntimeExecutionEvent executor_kind must be valid enum"
91
+ note: "Apply when event_family == runtime_execution"
92
+
93
+ - id: obs_runtime_status_valid
94
+ scope: event
95
+ path: status
96
+ rule: enum(pending,running,completed,failed,cancelled)
97
+ description: "RuntimeExecutionEvent status must be valid enum"
98
+ note: "Apply when event_family == runtime_execution"
99
+ # Note: The "note" fields indicate conditional application based on event_family.
100
+ # If the invariant engine does not support conditional rules, these should be
101
+ # validated at the schema level (which is already done in the event schemas).
102
+ # These invariants provide additional layer of validation for runtime enforcement.
@@ -0,0 +1,68 @@
1
+ # MPLP Protocol v1.0.0 — Frozen Specification
2
+ # Freeze Date: 2025-12-03
3
+ # Status: FROZEN (no breaking changes permitted)
4
+ # Governance: MPLP Protocol Governance Committee (MPGC)
5
+ # © 2025 邦士(北京)网络科技有限公司
6
+ # License: Apache-2.0
7
+ # Any normative change requires a new protocol version.
8
+
9
+ # MPLP Protocol 1.0.0 — Frozen Specification
10
+ # Status: Frozen as of 2025-11-30
11
+ # Copyright: © 2025 邦士(北京)网络科技有限公司
12
+ # License: Apache-2.0 (see LICENSE at repository root)
13
+ # Any normative change requires a new protocol version.
14
+
15
+ invariants:
16
+ - id: sa_requires_context
17
+ scope: context
18
+ path: context_id
19
+ rule: uuid-v4
20
+ description: "SA execution requires a valid Context with UUID v4 identifier"
21
+
22
+ - id: sa_context_must_be_active
23
+ scope: context
24
+ path: status
25
+ rule: enum(active)
26
+ description: "SA can only execute when Context status is 'active'"
27
+
28
+ - id: sa_plan_context_binding
29
+ scope: plan
30
+ path: context_id
31
+ rule: eq(context.context_id)
32
+ description: "Plan's context_id must match SA's loaded Context"
33
+
34
+ - id: sa_plan_has_steps
35
+ scope: plan
36
+ path: steps
37
+ rule: min-length(1)
38
+ description: "Plan must contain at least one executable step"
39
+
40
+ - id: sa_steps_have_valid_ids
41
+ scope: plan
42
+ path: steps[*].step_id
43
+ rule: uuid-v4
44
+ description: "All plan steps must have valid UUID v4 identifiers"
45
+
46
+ - id: sa_steps_have_agent_role
47
+ scope: plan
48
+ path: steps[*].agent_role
49
+ rule: non-empty-string
50
+ description: "All steps must specify an agent_role for executor selection"
51
+
52
+ - id: sa_trace_not_empty
53
+ scope: trace
54
+ path: events
55
+ rule: min-length(1)
56
+ description: "SA must emit at least one trace event before completion"
57
+
58
+ - id: sa_trace_context_binding
59
+ scope: trace
60
+ path: context_id
61
+ rule: eq(context.context_id)
62
+ description: "Trace context_id must match SA's Context"
63
+
64
+ - id: sa_trace_plan_binding
65
+ scope: trace
66
+ path: plan_id
67
+ rule: eq(plan.plan_id)
68
+ description: "Trace plan_id must match SA's Plan"
@@ -0,0 +1,94 @@
1
+ {
2
+ "$comment": "MPLP Protocol v1.0.0 — Frozen Specification\nFreeze Date: 2025-12-03\nStatus: FROZEN (no breaking changes permitted)\nGovernance: MPLP Protocol Governance Committee (MPGC)\nCopyright: © 2025 邦士(北京)网络科技有限公司\nLicense: Apache-2.0\nAny normative change requires a new protocol version.",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "$id": "https://mplp.dev/schemas/v1.0/learning/mplp-learning-sample-core.schema.json",
5
+ "title": "MPLP LearningSample Core v1.0",
6
+ "description": "Core structure for MPLP LearningSample entities - defines the universal format for learning samples generated from execution history",
7
+ "type": "object",
8
+ "properties": {
9
+ "sample_id": {
10
+ "type": "string",
11
+ "format": "uuid",
12
+ "description": "Unique identifier of the learning sample (UUID v4)"
13
+ },
14
+ "sample_family": {
15
+ "type": "string",
16
+ "description": "LearningSample family identifier - determines expected input/output structure",
17
+ "examples": [
18
+ "intent_resolution",
19
+ "delta_impact",
20
+ "pipeline_outcome",
21
+ "confirm_decision",
22
+ "graph_evolution",
23
+ "multi_agent_coordination"
24
+ ]
25
+ },
26
+ "created_at": {
27
+ "type": "string",
28
+ "format": "date-time",
29
+ "description": "ISO 8601 timestamp when sample was generated"
30
+ },
31
+ "input": {
32
+ "type": "object",
33
+ "description": "Abstracted representation of input conditions, intent, context at sample creation time",
34
+ "additionalProperties": true
35
+ },
36
+ "state": {
37
+ "type": "object",
38
+ "description": "Snapshot of relevant system state before execution (PSG summary, config, roles, etc.)",
39
+ "additionalProperties": true
40
+ },
41
+ "output": {
42
+ "type": "object",
43
+ "description": "Abstracted representation of actual outcomes, decisions, changes, results",
44
+ "additionalProperties": true
45
+ },
46
+ "meta": {
47
+ "type": "object",
48
+ "description": "Metadata, labels, quality signals, provenance IDs, human feedback annotations",
49
+ "properties": {
50
+ "source_flow_id": {
51
+ "type": "string",
52
+ "description": "Optional: Flow ID that generated this sample (e.g., FLOW-01, SA-01, MAP-01)"
53
+ },
54
+ "source_event_ids": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "string",
58
+ "format": "uuid"
59
+ },
60
+ "description": "Optional: Observability event IDs referenced by this sample"
61
+ },
62
+ "project_id": {
63
+ "type": "string",
64
+ "format": "uuid",
65
+ "description": "Optional: Project context identifier"
66
+ },
67
+ "human_feedback_label": {
68
+ "type": "string",
69
+ "enum": [
70
+ "approved",
71
+ "rejected",
72
+ "not_reviewed"
73
+ ],
74
+ "description": "Optional: Human quality assessment"
75
+ },
76
+ "quality_score": {
77
+ "type": "number",
78
+ "minimum": 0,
79
+ "maximum": 1,
80
+ "description": "Optional: Automated quality score (0.0-1.0)"
81
+ }
82
+ },
83
+ "additionalProperties": true
84
+ }
85
+ },
86
+ "required": [
87
+ "sample_id",
88
+ "sample_family",
89
+ "created_at",
90
+ "input",
91
+ "output"
92
+ ],
93
+ "additionalProperties": true
94
+ }
@@ -0,0 +1,137 @@
1
+ {
2
+ "$comment": "MPLP Protocol v1.0.0 — Frozen Specification\nFreeze Date: 2025-12-03\nStatus: FROZEN (no breaking changes permitted)\nGovernance: MPLP Protocol Governance Committee (MPGC)\nCopyright: © 2025 邦士(北京)网络科技有限公司\nLicense: Apache-2.0\nAny normative change requires a new protocol version.",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "$id": "https://mplp.dev/schemas/v1.0/learning/mplp-learning-sample-delta.schema.json",
5
+ "title": "MPLP LearningSample – Delta Impact v1.0",
6
+ "description": "Specialized schema for delta_impact samples capturing change effect analysis and compensation planning",
7
+ "allOf": [
8
+ {
9
+ "$ref": "mplp-learning-sample-core.schema.json"
10
+ },
11
+ {
12
+ "type": "object",
13
+ "properties": {
14
+ "sample_family": {
15
+ "const": "delta_impact",
16
+ "description": "Must be 'delta_impact' for this sample type"
17
+ },
18
+ "input": {
19
+ "type": "object",
20
+ "properties": {
21
+ "delta_id": {
22
+ "type": "string",
23
+ "description": "Delta Intent identifier"
24
+ },
25
+ "intent_id": {
26
+ "type": "string",
27
+ "description": "Original intent being modified"
28
+ },
29
+ "delta_type": {
30
+ "type": "string",
31
+ "enum": [
32
+ "refinement",
33
+ "correction",
34
+ "expansion",
35
+ "reduction",
36
+ "pivot"
37
+ ],
38
+ "description": "Type of delta change"
39
+ },
40
+ "change_summary": {
41
+ "type": "string",
42
+ "description": "Abstracted summary of requested change"
43
+ }
44
+ },
45
+ "required": [
46
+ "delta_id",
47
+ "intent_id",
48
+ "change_summary"
49
+ ],
50
+ "additionalProperties": true
51
+ },
52
+ "state": {
53
+ "type": "object",
54
+ "properties": {
55
+ "affected_artifact_count": {
56
+ "type": "integer",
57
+ "minimum": 0,
58
+ "description": "Optional: Number of artifacts potentially affected"
59
+ },
60
+ "risk_level": {
61
+ "type": "string",
62
+ "enum": [
63
+ "low",
64
+ "medium",
65
+ "high",
66
+ "critical"
67
+ ],
68
+ "description": "Assessed risk level before change"
69
+ },
70
+ "psg_complexity_score": {
71
+ "type": "number",
72
+ "minimum": 0,
73
+ "description": "Optional: PSG complexity metric before change"
74
+ }
75
+ },
76
+ "additionalProperties": true
77
+ },
78
+ "output": {
79
+ "type": "object",
80
+ "properties": {
81
+ "actual_impact_summary": {
82
+ "type": "string",
83
+ "description": "Summary of actual impact after analysis"
84
+ },
85
+ "impact_scope": {
86
+ "type": "string",
87
+ "enum": [
88
+ "local",
89
+ "module",
90
+ "system",
91
+ "global"
92
+ ],
93
+ "description": "Scope of detected impact"
94
+ },
95
+ "comp_plan_required": {
96
+ "type": "boolean",
97
+ "description": "Whether compensation plan was needed"
98
+ },
99
+ "comp_plan_applied": {
100
+ "type": "boolean",
101
+ "description": "Optional: Whether compensation was actually applied"
102
+ },
103
+ "rollback_used": {
104
+ "type": "boolean",
105
+ "description": "Optional: Whether rollback mechanism was triggered"
106
+ }
107
+ },
108
+ "required": [
109
+ "actual_impact_summary",
110
+ "impact_scope"
111
+ ],
112
+ "additionalProperties": true
113
+ },
114
+ "meta": {
115
+ "type": "object",
116
+ "properties": {
117
+ "impact_analysis_duration_ms": {
118
+ "type": "integer",
119
+ "minimum": 0,
120
+ "description": "Optional: Time spent on impact analysis"
121
+ },
122
+ "predicted_vs_actual_accuracy": {
123
+ "type": "string",
124
+ "enum": [
125
+ "accurate",
126
+ "underestimated",
127
+ "overestimated"
128
+ ],
129
+ "description": "Optional: Accuracy of impact prediction"
130
+ }
131
+ },
132
+ "additionalProperties": true
133
+ }
134
+ }
135
+ }
136
+ ]
137
+ }
@@ -0,0 +1,119 @@
1
+ {
2
+ "$comment": "MPLP Protocol v1.0.0 — Frozen Specification\nFreeze Date: 2025-12-03\nStatus: FROZEN (no breaking changes permitted)\nGovernance: MPLP Protocol Governance Committee (MPGC)\nCopyright: © 2025 邦士(北京)网络科技有限公司\nLicense: Apache-2.0\nAny normative change requires a new protocol version.",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "$id": "https://mplp.dev/schemas/v1.0/learning/mplp-learning-sample-intent.schema.json",
5
+ "title": "MPLP LearningSample – Intent Resolution v1.0",
6
+ "description": "Specialized schema for intent_resolution samples capturing user intent clarification and plan generation",
7
+ "allOf": [
8
+ {
9
+ "$ref": "mplp-learning-sample-core.schema.json"
10
+ },
11
+ {
12
+ "type": "object",
13
+ "properties": {
14
+ "sample_family": {
15
+ "const": "intent_resolution",
16
+ "description": "Must be 'intent_resolution' for this sample type"
17
+ },
18
+ "input": {
19
+ "type": "object",
20
+ "properties": {
21
+ "intent_id": {
22
+ "type": "string",
23
+ "description": "Intent identifier from IntentEvent or Plan.intent_model"
24
+ },
25
+ "raw_request_summary": {
26
+ "type": "string",
27
+ "description": "Abstracted summary of original user request (PII-scrubbed if needed)"
28
+ },
29
+ "constraints_summary": {
30
+ "type": "string",
31
+ "description": "Optional: Key constraints mentioned (timeline, budget, resources, etc.)"
32
+ },
33
+ "dialog_turns_count": {
34
+ "type": "integer",
35
+ "minimum": 0,
36
+ "description": "Optional: Number of dialog exchanges before intent resolution"
37
+ }
38
+ },
39
+ "required": [
40
+ "intent_id",
41
+ "raw_request_summary"
42
+ ],
43
+ "additionalProperties": true
44
+ },
45
+ "state": {
46
+ "type": "object",
47
+ "properties": {
48
+ "project_phase": {
49
+ "type": "string",
50
+ "description": "Optional: Project state (greenfield, brownfield, maintenance, etc.)"
51
+ },
52
+ "psg_node_count": {
53
+ "type": "integer",
54
+ "minimum": 0,
55
+ "description": "Optional: PSG size before intent application"
56
+ },
57
+ "existing_plan_count": {
58
+ "type": "integer",
59
+ "minimum": 0,
60
+ "description": "Optional: Number of existing plans in context"
61
+ }
62
+ },
63
+ "additionalProperties": true
64
+ },
65
+ "output": {
66
+ "type": "object",
67
+ "properties": {
68
+ "final_intent_summary": {
69
+ "type": "string",
70
+ "description": "Refined/clarified intent after resolution process"
71
+ },
72
+ "plan_id": {
73
+ "type": "string",
74
+ "format": "uuid",
75
+ "description": "Optional: Generated Plan identifier (if plan created)"
76
+ },
77
+ "plan_step_count": {
78
+ "type": "integer",
79
+ "minimum": 0,
80
+ "description": "Optional: Number of steps in generated plan"
81
+ },
82
+ "resolution_quality_label": {
83
+ "type": "string",
84
+ "enum": [
85
+ "good",
86
+ "acceptable",
87
+ "bad",
88
+ "unknown"
89
+ ],
90
+ "description": "Assessment of intent resolution quality"
91
+ }
92
+ },
93
+ "required": [
94
+ "final_intent_summary"
95
+ ],
96
+ "additionalProperties": true
97
+ },
98
+ "meta": {
99
+ "type": "object",
100
+ "properties": {
101
+ "clarification_rounds": {
102
+ "type": "integer",
103
+ "minimum": 0,
104
+ "description": "Optional: Clarification rounds needed before resolution"
105
+ },
106
+ "ambiguity_flags": {
107
+ "type": "array",
108
+ "items": {
109
+ "type": "string"
110
+ },
111
+ "description": "Optional: Detected ambiguity types (vague_scope, missing_constraints, etc.)"
112
+ }
113
+ },
114
+ "additionalProperties": true
115
+ }
116
+ }
117
+ }
118
+ ]
119
+ }