@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,130 @@
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/integration/mplp-ci-event.json",
5
+ "title": "MPLP CI Event v1.0",
6
+ "description": "CI pipeline execution status",
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "ci_provider": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "description": "CI platform identifier",
14
+ "examples": [
15
+ "github-actions",
16
+ "gitlab-ci",
17
+ "jenkins",
18
+ "circleci",
19
+ "travis-ci"
20
+ ]
21
+ },
22
+ "pipeline_id": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "description": "Pipeline or workflow identifier",
26
+ "examples": [
27
+ "build-and-test",
28
+ "deploy-production"
29
+ ]
30
+ },
31
+ "run_id": {
32
+ "type": "string",
33
+ "minLength": 1,
34
+ "description": "Unique identifier for this pipeline run",
35
+ "examples": [
36
+ "123456789",
37
+ "run-2025-11-30-001"
38
+ ]
39
+ },
40
+ "status": {
41
+ "type": "string",
42
+ "enum": [
43
+ "pending",
44
+ "running",
45
+ "succeeded",
46
+ "failed",
47
+ "cancelled"
48
+ ],
49
+ "description": "Current pipeline status"
50
+ },
51
+ "started_at": {
52
+ "type": "string",
53
+ "format": "date-time",
54
+ "description": "Pipeline start timestamp (ISO 8601)"
55
+ },
56
+ "completed_at": {
57
+ "type": "string",
58
+ "format": "date-time",
59
+ "description": "Pipeline completion timestamp (ISO 8601)"
60
+ },
61
+ "branch_name": {
62
+ "type": "string",
63
+ "description": "Git branch that triggered the pipeline"
64
+ },
65
+ "commit_id": {
66
+ "type": "string",
67
+ "description": "Commit SHA that triggered the pipeline"
68
+ },
69
+ "run_url": {
70
+ "type": "string",
71
+ "format": "uri",
72
+ "description": "URL to view pipeline run details"
73
+ },
74
+ "duration_ms": {
75
+ "type": "integer",
76
+ "minimum": 0,
77
+ "description": "Pipeline execution duration in milliseconds"
78
+ },
79
+ "stages": {
80
+ "type": "array",
81
+ "items": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "properties": {
85
+ "stage_name": {
86
+ "type": "string"
87
+ },
88
+ "status": {
89
+ "type": "string",
90
+ "enum": [
91
+ "pending",
92
+ "running",
93
+ "succeeded",
94
+ "failed",
95
+ "cancelled",
96
+ "skipped"
97
+ ]
98
+ },
99
+ "duration_ms": {
100
+ "type": "integer",
101
+ "minimum": 0
102
+ }
103
+ },
104
+ "required": [
105
+ "stage_name",
106
+ "status"
107
+ ]
108
+ },
109
+ "description": "Pipeline stages and their statuses (optional)"
110
+ },
111
+ "trigger_kind": {
112
+ "type": "string",
113
+ "enum": [
114
+ "push",
115
+ "pull_request",
116
+ "schedule",
117
+ "manual",
118
+ "tag",
119
+ "other"
120
+ ],
121
+ "description": "What triggered the pipeline"
122
+ }
123
+ },
124
+ "required": [
125
+ "ci_provider",
126
+ "pipeline_id",
127
+ "run_id",
128
+ "status"
129
+ ]
130
+ }
@@ -0,0 +1,70 @@
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/integration/mplp-file-update-event.json",
5
+ "title": "MPLP File Update Event v1.0",
6
+ "description": "IDE file changes (save, refactor, batch modify)",
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "file_path": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "description": "Path to the file (absolute or workspace-relative)",
14
+ "examples": [
15
+ "src/components/App.tsx",
16
+ "/Users/dev/project/main.py"
17
+ ]
18
+ },
19
+ "change_type": {
20
+ "type": "string",
21
+ "enum": [
22
+ "created",
23
+ "modified",
24
+ "deleted",
25
+ "renamed"
26
+ ],
27
+ "description": "Type of file change"
28
+ },
29
+ "workspace_root": {
30
+ "type": "string",
31
+ "description": "Workspace root directory (for resolving relative paths)"
32
+ },
33
+ "change_summary": {
34
+ "type": "string",
35
+ "description": "Brief description of changes (e.g., 'Added error handling')"
36
+ },
37
+ "timestamp": {
38
+ "type": "string",
39
+ "format": "date-time",
40
+ "description": "When the change occurred (ISO 8601)"
41
+ },
42
+ "lines_added": {
43
+ "type": "integer",
44
+ "minimum": 0,
45
+ "description": "Number of lines added (if applicable)"
46
+ },
47
+ "lines_removed": {
48
+ "type": "integer",
49
+ "minimum": 0,
50
+ "description": "Number of lines removed (if applicable)"
51
+ },
52
+ "previous_path": {
53
+ "type": "string",
54
+ "description": "Previous path (for renamed files)"
55
+ },
56
+ "encoding": {
57
+ "type": "string",
58
+ "description": "File encoding (e.g., 'utf-8')"
59
+ },
60
+ "language": {
61
+ "type": "string",
62
+ "description": "Programming language or file type (e.g., 'typescript', 'python')"
63
+ }
64
+ },
65
+ "required": [
66
+ "file_path",
67
+ "change_type",
68
+ "timestamp"
69
+ ]
70
+ }
@@ -0,0 +1,98 @@
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/integration/mplp-git-event.json",
5
+ "title": "MPLP Git Event v1.0",
6
+ "description": "Git operations (commit, push, branch/merge/tag)",
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "repo_url": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "description": "Repository URL or identifier",
14
+ "examples": [
15
+ "https://github.com/org/repo.git",
16
+ "git@github.com:org/repo.git"
17
+ ]
18
+ },
19
+ "commit_id": {
20
+ "type": "string",
21
+ "minLength": 1,
22
+ "description": "Commit SHA or identifier",
23
+ "examples": [
24
+ "abc123def456",
25
+ "1a2b3c4d5e6f7g8h9i0j"
26
+ ]
27
+ },
28
+ "ref_name": {
29
+ "type": "string",
30
+ "minLength": 1,
31
+ "description": "Branch, tag, or ref name",
32
+ "examples": [
33
+ "refs/heads/main",
34
+ "refs/tags/v1.0.0",
35
+ "main"
36
+ ]
37
+ },
38
+ "event_kind": {
39
+ "type": "string",
40
+ "enum": [
41
+ "commit",
42
+ "push",
43
+ "merge",
44
+ "tag",
45
+ "branch_create",
46
+ "branch_delete"
47
+ ],
48
+ "description": "Type of Git operation"
49
+ },
50
+ "author_name": {
51
+ "type": "string",
52
+ "description": "Commit author name"
53
+ },
54
+ "author_email": {
55
+ "type": "string",
56
+ "format": "email",
57
+ "description": "Commit author email"
58
+ },
59
+ "commit_message": {
60
+ "type": "string",
61
+ "description": "Commit message (first line or summary)"
62
+ },
63
+ "timestamp": {
64
+ "type": "string",
65
+ "format": "date-time",
66
+ "description": "When the Git operation occurred (ISO 8601)"
67
+ },
68
+ "files_changed": {
69
+ "type": "integer",
70
+ "minimum": 0,
71
+ "description": "Number of files changed in commit"
72
+ },
73
+ "insertions": {
74
+ "type": "integer",
75
+ "minimum": 0,
76
+ "description": "Total lines inserted"
77
+ },
78
+ "deletions": {
79
+ "type": "integer",
80
+ "minimum": 0,
81
+ "description": "Total lines deleted"
82
+ },
83
+ "parent_commits": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string"
87
+ },
88
+ "description": "Parent commit SHA(s) - multiple for merges"
89
+ }
90
+ },
91
+ "required": [
92
+ "repo_url",
93
+ "commit_id",
94
+ "ref_name",
95
+ "event_kind",
96
+ "timestamp"
97
+ ]
98
+ }
@@ -0,0 +1,83 @@
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/integration/mplp-tool-event.json",
5
+ "title": "MPLP Tool Event v1.0",
6
+ "description": "External tool invocation and results (formatters, linters, test runners, generators)",
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "tool_id": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "description": "Unique identifier for the tool",
14
+ "examples": [
15
+ "eslint-v8.50.0",
16
+ "prettier-v3.0.0",
17
+ "black-v23.10.0"
18
+ ]
19
+ },
20
+ "tool_kind": {
21
+ "type": "string",
22
+ "enum": [
23
+ "formatter",
24
+ "linter",
25
+ "test_runner",
26
+ "generator",
27
+ "other"
28
+ ],
29
+ "description": "Category of tool"
30
+ },
31
+ "invocation_id": {
32
+ "type": "string",
33
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
34
+ "description": "UUID v4 identifier for this specific invocation"
35
+ },
36
+ "status": {
37
+ "type": "string",
38
+ "enum": [
39
+ "pending",
40
+ "running",
41
+ "succeeded",
42
+ "failed",
43
+ "cancelled"
44
+ ],
45
+ "description": "Current execution status"
46
+ },
47
+ "started_at": {
48
+ "type": "string",
49
+ "format": "date-time",
50
+ "description": "Invocation start timestamp (ISO 8601)"
51
+ },
52
+ "completed_at": {
53
+ "type": "string",
54
+ "format": "date-time",
55
+ "description": "Invocation completion timestamp (ISO 8601)"
56
+ },
57
+ "exit_code": {
58
+ "type": "integer",
59
+ "description": "Tool process exit code (if applicable)"
60
+ },
61
+ "output_summary": {
62
+ "type": "string",
63
+ "description": "Brief summary of tool output or errors"
64
+ },
65
+ "args": {
66
+ "type": "array",
67
+ "items": {
68
+ "type": "string"
69
+ },
70
+ "description": "Command-line arguments passed to tool (optional)"
71
+ },
72
+ "working_directory": {
73
+ "type": "string",
74
+ "description": "Working directory where tool was executed (optional)"
75
+ }
76
+ },
77
+ "required": [
78
+ "tool_id",
79
+ "tool_kind",
80
+ "invocation_id",
81
+ "status"
82
+ ]
83
+ }
@@ -0,0 +1,143 @@
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
+ # ========================================
17
+ # Tool Event Invariants
18
+ # ========================================
19
+ - id: integration_tool_event_id_non_empty
20
+ scope: tool_event
21
+ path: tool_id
22
+ rule: non-empty-string
23
+ description: "Tool event must have non-empty tool_id"
24
+
25
+ - id: integration_tool_kind_valid
26
+ scope: tool_event
27
+ path: tool_kind
28
+ rule: enum(formatter,linter,test_runner,generator,other)
29
+ description: "Tool kind must be valid enum value"
30
+
31
+ - id: integration_tool_invocation_id_uuid
32
+ scope: tool_event
33
+ path: invocation_id
34
+ rule: uuid-v4
35
+ description: "Tool invocation_id must be UUID v4"
36
+
37
+ - id: integration_tool_status_valid
38
+ scope: tool_event
39
+ path: status
40
+ rule: enum(pending,running,succeeded,failed,cancelled)
41
+ description: "Tool event status must be valid enum value"
42
+
43
+ - id: integration_tool_started_at_iso
44
+ scope: tool_event
45
+ path: started_at
46
+ rule: iso-datetime
47
+ description: "If started_at present, must be ISO 8601 datetime"
48
+ note: "Apply only when started_at field exists"
49
+
50
+ # ========================================
51
+ # File Update Event Invariants
52
+ # ========================================
53
+ - id: integration_file_path_non_empty
54
+ scope: file_update_event
55
+ path: file_path
56
+ rule: non-empty-string
57
+ description: "File update event must have non-empty file_path"
58
+
59
+ - id: integration_file_change_type_valid
60
+ scope: file_update_event
61
+ path: change_type
62
+ rule: enum(created,modified,deleted,renamed)
63
+ description: "File change_type must be valid enum value"
64
+
65
+ - id: integration_file_timestamp_iso
66
+ scope: file_update_event
67
+ path: timestamp
68
+ rule: iso-datetime
69
+ description: "File update timestamp must be ISO 8601 datetime"
70
+
71
+ # ========================================
72
+ # Git Event Invariants
73
+ # ========================================
74
+ - id: integration_git_repo_url_non_empty
75
+ scope: git_event
76
+ path: repo_url
77
+ rule: non-empty-string
78
+ description: "Git event must have non-empty repo_url"
79
+
80
+ - id: integration_git_commit_id_non_empty
81
+ scope: git_event
82
+ path: commit_id
83
+ rule: non-empty-string
84
+ description: "Git event must have non-empty commit_id"
85
+
86
+ - id: integration_git_ref_name_non_empty
87
+ scope: git_event
88
+ path: ref_name
89
+ rule: non-empty-string
90
+ description: "Git event must have non-empty ref_name"
91
+
92
+ - id: integration_git_event_kind_valid
93
+ scope: git_event
94
+ path: event_kind
95
+ rule: enum(commit,push,merge,tag,branch_create,branch_delete)
96
+ description: "Git event_kind must be valid enum value"
97
+
98
+ - id: integration_git_timestamp_iso
99
+ scope: git_event
100
+ path: timestamp
101
+ rule: iso-datetime
102
+ description: "Git event timestamp must be ISO 8601 datetime"
103
+
104
+ # ========================================
105
+ # CI Event Invariants
106
+ # ========================================
107
+ - id: integration_ci_provider_non_empty
108
+ scope: ci_event
109
+ path: ci_provider
110
+ rule: non-empty-string
111
+ description: "CI event must have non-empty ci_provider"
112
+
113
+ - id: integration_ci_pipeline_id_non_empty
114
+ scope: ci_event
115
+ path: pipeline_id
116
+ rule: non-empty-string
117
+ description: "CI event must have non-empty pipeline_id"
118
+
119
+ - id: integration_ci_run_id_non_empty
120
+ scope: ci_event
121
+ path: run_id
122
+ rule: non-empty-string
123
+ description: "CI event must have non-empty run_id"
124
+
125
+ - id: integration_ci_status_valid
126
+ scope: ci_event
127
+ path: status
128
+ rule: enum(pending,running,succeeded,failed,cancelled)
129
+ description: "CI event status must be valid enum value"
130
+
131
+ - id: integration_ci_started_at_iso
132
+ scope: ci_event
133
+ path: started_at
134
+ rule: iso-datetime
135
+ description: "If started_at present, must be ISO 8601 datetime"
136
+ note: "Apply only when started_at field exists"
137
+
138
+ - id: integration_ci_completed_at_iso
139
+ scope: ci_event
140
+ path: completed_at
141
+ rule: iso-datetime
142
+ description: "If completed_at present, must be ISO 8601 datetime"
143
+ note: "Apply only when completed_at field exists"
@@ -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 LearningSample Structure Invariants
17
+ - id: learning_sample_id_is_uuid
18
+ scope: learning_sample
19
+ path: sample_id
20
+ rule: uuid-v4
21
+ description: "All LearningSamples must have UUID v4 sample_id"
22
+
23
+ - id: learning_sample_family_non_empty
24
+ scope: learning_sample
25
+ path: sample_family
26
+ rule: non-empty-string
27
+ description: "LearningSample must have non-empty sample_family"
28
+
29
+ - id: learning_sample_created_at_iso
30
+ scope: learning_sample
31
+ path: created_at
32
+ rule: iso-datetime
33
+ description: "LearningSample created_at must be ISO 8601 timestamp"
34
+
35
+ # Input/Output Existence (using non-empty-string on a required sub-field if possible)
36
+ - id: learning_sample_has_input_section
37
+ scope: learning_sample
38
+ path: input
39
+ rule: exists
40
+ description: "LearningSample must have input section"
41
+
42
+ - id: learning_sample_has_output_section
43
+ scope: learning_sample
44
+ path: output
45
+ rule: exists
46
+ description: "LearningSample must have output section"
47
+
48
+ # Meta Field Invariants (optional but validate when present)
49
+ - id: learning_sample_feedback_label_valid
50
+ scope: learning_sample
51
+ path: meta.human_feedback_label
52
+ rule: enum(approved,rejected,not_reviewed)
53
+ description: "If human_feedback_label present, must be valid enum"
54
+ note: "Apply only when meta.human_feedback_label exists"
55
+
56
+ - id: learning_sample_source_flow_non_empty
57
+ scope: learning_sample
58
+ path: meta.source_flow_id
59
+ rule: non-empty-string
60
+ description: "If source_flow_id present, must be non-empty"
61
+ note: "Apply only when meta.source_flow_id exists"
62
+
63
+ # Intent Resolution Family Invariants
64
+ - id: learning_intent_has_intent_id
65
+ scope: learning_sample
66
+ path: input.intent_id
67
+ rule: non-empty-string
68
+ description: "Intent resolution samples must have intent_id in input"
69
+ note: "Apply when sample_family == intent_resolution"
70
+
71
+ - id: learning_intent_quality_label_valid
72
+ scope: learning_sample
73
+ path: output.resolution_quality_label
74
+ rule: enum(good,acceptable,bad,unknown)
75
+ description: "Intent resolution quality label must be valid enum if present"
76
+ note: "Apply when sample_family == intent_resolution AND field exists"
77
+
78
+ # Delta Impact Family Invariants
79
+ - id: learning_delta_has_delta_id
80
+ scope: learning_sample
81
+ path: input.delta_id
82
+ rule: non-empty-string
83
+ description: "Delta impact samples must have delta_id in input"
84
+ note: "Apply when sample_family == delta_impact"
85
+
86
+ - id: learning_delta_scope_valid
87
+ scope: learning_sample
88
+ path: output.impact_scope
89
+ rule: enum(local,module,system,global)
90
+ description: "Delta impact scope must be valid enum"
91
+ note: "Apply when sample_family == delta_impact"
92
+
93
+ - id: learning_delta_risk_valid
94
+ scope: learning_sample
95
+ path: state.risk_level
96
+ rule: enum(low,medium,high,critical)
97
+ description: "Delta risk level must be valid enum if present"
98
+ note: "Apply when sample_family == delta_impact AND field exists"
99
+ # Note: Conditional invariants (based on sample_family) are indicated in "note" fields.
100
+ # If the invariant engine does not support conditional application, these should be
101
+ # enforced at the schema level (already done in family-specific schemas) or during
102
+ # runtime validation. These invariants provide an additional validation layer.
@@ -0,0 +1,69 @@
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
+ # Session structure invariants
17
+ - id: map_session_requires_multiple_participants
18
+ scope: collab
19
+ path: participants
20
+ rule: min-length(2)
21
+ description: "MAP sessions require at least 2 participants for multi-agent collaboration"
22
+
23
+ - id: map_collab_mode_valid
24
+ scope: collab
25
+ path: mode
26
+ rule: enum(broadcast,round_robin,orchestrated,swarm,pair)
27
+ description: "Collab.mode must be valid collaboration pattern"
28
+
29
+ - id: map_session_id_is_uuid
30
+ scope: collab
31
+ path: collab_id
32
+ rule: uuid-v4
33
+ description: "Session ID (collab_id) must be valid UUID v4"
34
+
35
+ - id: map_participants_have_role_ids
36
+ scope: collab
37
+ path: participants[*].role_id
38
+ rule: non-empty-string
39
+ description: "All participants must have valid role_id binding"
40
+
41
+ # Event consistency invariants (descriptive, not all auto-enforceable)
42
+ - id: map_turn_completion_matches_dispatch
43
+ scope: trace
44
+ description: "Every MAPTurnDispatched event should have a corresponding MAPTurnCompleted event for the same session_id and role_id"
45
+ note: "This is a higher-level invariant that requires trace event analysis. Mark as manual check or implement custom rule."
46
+
47
+ - id: map_broadcast_has_receivers
48
+ scope: trace
49
+ description: "If MAPBroadcastSent exists, at least one MAPBroadcastReceived must exist for the same session_id"
50
+ note: "Requires cross-event validation. Can be checked via trace event count."
51
+
52
+ # Role binding invariants
53
+ - id: map_role_ids_are_uuids
54
+ scope: collab
55
+ path: participants[*].role_id
56
+ rule: uuid-v4
57
+ description: "All role_id values must be valid UUID v4 format"
58
+
59
+ - id: map_participant_ids_are_non_empty
60
+ scope: collab
61
+ path: participants[*].participant_id
62
+ rule: non-empty-string
63
+ description: "All participant_id values must be non-empty strings"
64
+
65
+ - id: map_participant_kind_valid
66
+ scope: collab
67
+ path: participants[*].kind
68
+ rule: enum(agent,human,system,external)
69
+ description: "Participant kind must be valid enum value"