@mplp/sdk-ts 1.0.2 → 1.0.3
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.
- package/CHANGELOG.md +15 -5
- package/README.md +23 -5
- package/dist/coordination/index.d.ts +8 -0
- package/dist/coordination/index.js +11 -0
- package/dist/core/index.d.ts +28 -0
- package/dist/core/index.js +21 -0
- package/dist/core/validators/index.d.ts +12 -0
- package/dist/core/validators/index.js +22 -0
- package/dist/runtime/index.d.ts +11 -0
- package/dist/runtime/index.js +14 -0
- package/dist/runtime-minimal/index.d.ts +52 -0
- package/dist/runtime-minimal/index.js +28 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.js +2 -0
- package/package.json +47 -35
- package/schemas/common/common-types.schema.json +55 -0
- package/schemas/common/events.schema.json +72 -0
- package/schemas/common/identifiers.schema.json +19 -0
- package/schemas/common/learning-sample.schema.json +200 -0
- package/schemas/common/metadata.schema.json +119 -0
- package/schemas/common/trace-base.schema.json +49 -0
- package/schemas/events/mplp-event-core.schema.json +64 -0
- package/schemas/events/mplp-graph-update-event.schema.json +64 -0
- package/schemas/events/mplp-map-event.schema.json +153 -0
- package/schemas/events/mplp-pipeline-stage-event.schema.json +62 -0
- package/schemas/events/mplp-runtime-execution-event.schema.json +64 -0
- package/schemas/events/mplp-sa-event.schema.json +115 -0
- package/schemas/integration/mplp-ci-event.schema.json +136 -0
- package/schemas/integration/mplp-file-update-event.schema.json +76 -0
- package/schemas/integration/mplp-git-event.schema.json +104 -0
- package/schemas/integration/mplp-tool-event.schema.json +89 -0
- package/schemas/invariants/integration-invariants.yaml +147 -0
- package/schemas/invariants/learning-invariants.yaml +106 -0
- package/schemas/invariants/map-invariants.yaml +73 -0
- package/schemas/invariants/observability-invariants.yaml +106 -0
- package/schemas/invariants/sa-invariants.yaml +72 -0
- package/schemas/learning/mplp-learning-sample-core.schema.json +100 -0
- package/schemas/learning/mplp-learning-sample-delta.schema.json +143 -0
- package/schemas/learning/mplp-learning-sample-intent.schema.json +125 -0
- package/schemas/mplp-collab.schema.json +249 -0
- package/schemas/mplp-confirm.schema.json +232 -0
- package/schemas/mplp-context.schema.json +252 -0
- package/schemas/mplp-core.schema.json +189 -0
- package/schemas/mplp-dialog.schema.json +204 -0
- package/schemas/mplp-extension.schema.json +185 -0
- package/schemas/mplp-network.schema.json +236 -0
- package/schemas/mplp-plan.schema.json +199 -0
- package/schemas/mplp-role.schema.json +145 -0
- package/schemas/mplp-trace.schema.json +222 -0
- package/src/builders/confirm-builder.ts +0 -39
- package/src/builders/context-builder.ts +0 -51
- package/src/builders/plan-builder.ts +0 -51
- package/src/builders/trace-builder.ts +0 -50
- package/src/client/runtime-client.ts +0 -98
- package/src/index.ts +0 -13
- package/tests/builders.test.ts +0 -80
- package/tests/client-single-agent.test.ts +0 -48
- package/tsconfig.json +0 -23
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# MPLP v1.0.0 FROZEN – Invariant Set
|
|
2
|
+
# © 2025 邦士(北京)网络科技有限公司 – Apache-2.0
|
|
3
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
4
|
+
|
|
5
|
+
# MPLP Protocol v1.0.0 — Frozen Specification
|
|
6
|
+
# Freeze Date: 2025-12-03
|
|
7
|
+
# Status: FROZEN (no breaking changes permitted)
|
|
8
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
9
|
+
# © 2025 邦士(北京)网络科技有限公司
|
|
10
|
+
# License: Apache-2.0
|
|
11
|
+
# Any normative change requires a new protocol version.
|
|
12
|
+
|
|
13
|
+
# MPLP Protocol 1.0.0 — Frozen Specification
|
|
14
|
+
# Status: Frozen as of 2025-11-30
|
|
15
|
+
# Copyright: © 2025 邦士(北京)网络科技有限公司
|
|
16
|
+
# License: Apache-2.0 (see LICENSE at repository root)
|
|
17
|
+
# Any normative change requires a new protocol version.
|
|
18
|
+
|
|
19
|
+
invariants:
|
|
20
|
+
# ========================================
|
|
21
|
+
# Tool Event Invariants
|
|
22
|
+
# ========================================
|
|
23
|
+
- id: integration_tool_event_id_non_empty
|
|
24
|
+
scope: tool_event
|
|
25
|
+
path: tool_id
|
|
26
|
+
rule: non-empty-string
|
|
27
|
+
description: "Tool event must have non-empty tool_id"
|
|
28
|
+
|
|
29
|
+
- id: integration_tool_kind_valid
|
|
30
|
+
scope: tool_event
|
|
31
|
+
path: tool_kind
|
|
32
|
+
rule: enum(formatter,linter,test_runner,generator,other)
|
|
33
|
+
description: "Tool kind must be valid enum value"
|
|
34
|
+
|
|
35
|
+
- id: integration_tool_invocation_id_uuid
|
|
36
|
+
scope: tool_event
|
|
37
|
+
path: invocation_id
|
|
38
|
+
rule: uuid-v4
|
|
39
|
+
description: "Tool invocation_id must be UUID v4"
|
|
40
|
+
|
|
41
|
+
- id: integration_tool_status_valid
|
|
42
|
+
scope: tool_event
|
|
43
|
+
path: status
|
|
44
|
+
rule: enum(pending,running,succeeded,failed,cancelled)
|
|
45
|
+
description: "Tool event status must be valid enum value"
|
|
46
|
+
|
|
47
|
+
- id: integration_tool_started_at_iso
|
|
48
|
+
scope: tool_event
|
|
49
|
+
path: started_at
|
|
50
|
+
rule: iso-datetime
|
|
51
|
+
description: "If started_at present, must be ISO 8601 datetime"
|
|
52
|
+
note: "Apply only when started_at field exists"
|
|
53
|
+
|
|
54
|
+
# ========================================
|
|
55
|
+
# File Update Event Invariants
|
|
56
|
+
# ========================================
|
|
57
|
+
- id: integration_file_path_non_empty
|
|
58
|
+
scope: file_update_event
|
|
59
|
+
path: file_path
|
|
60
|
+
rule: non-empty-string
|
|
61
|
+
description: "File update event must have non-empty file_path"
|
|
62
|
+
|
|
63
|
+
- id: integration_file_change_type_valid
|
|
64
|
+
scope: file_update_event
|
|
65
|
+
path: change_type
|
|
66
|
+
rule: enum(created,modified,deleted,renamed)
|
|
67
|
+
description: "File change_type must be valid enum value"
|
|
68
|
+
|
|
69
|
+
- id: integration_file_timestamp_iso
|
|
70
|
+
scope: file_update_event
|
|
71
|
+
path: timestamp
|
|
72
|
+
rule: iso-datetime
|
|
73
|
+
description: "File update timestamp must be ISO 8601 datetime"
|
|
74
|
+
|
|
75
|
+
# ========================================
|
|
76
|
+
# Git Event Invariants
|
|
77
|
+
# ========================================
|
|
78
|
+
- id: integration_git_repo_url_non_empty
|
|
79
|
+
scope: git_event
|
|
80
|
+
path: repo_url
|
|
81
|
+
rule: non-empty-string
|
|
82
|
+
description: "Git event must have non-empty repo_url"
|
|
83
|
+
|
|
84
|
+
- id: integration_git_commit_id_non_empty
|
|
85
|
+
scope: git_event
|
|
86
|
+
path: commit_id
|
|
87
|
+
rule: non-empty-string
|
|
88
|
+
description: "Git event must have non-empty commit_id"
|
|
89
|
+
|
|
90
|
+
- id: integration_git_ref_name_non_empty
|
|
91
|
+
scope: git_event
|
|
92
|
+
path: ref_name
|
|
93
|
+
rule: non-empty-string
|
|
94
|
+
description: "Git event must have non-empty ref_name"
|
|
95
|
+
|
|
96
|
+
- id: integration_git_event_kind_valid
|
|
97
|
+
scope: git_event
|
|
98
|
+
path: event_kind
|
|
99
|
+
rule: enum(commit,push,merge,tag,branch_create,branch_delete)
|
|
100
|
+
description: "Git event_kind must be valid enum value"
|
|
101
|
+
|
|
102
|
+
- id: integration_git_timestamp_iso
|
|
103
|
+
scope: git_event
|
|
104
|
+
path: timestamp
|
|
105
|
+
rule: iso-datetime
|
|
106
|
+
description: "Git event timestamp must be ISO 8601 datetime"
|
|
107
|
+
|
|
108
|
+
# ========================================
|
|
109
|
+
# CI Event Invariants
|
|
110
|
+
# ========================================
|
|
111
|
+
- id: integration_ci_provider_non_empty
|
|
112
|
+
scope: ci_event
|
|
113
|
+
path: ci_provider
|
|
114
|
+
rule: non-empty-string
|
|
115
|
+
description: "CI event must have non-empty ci_provider"
|
|
116
|
+
|
|
117
|
+
- id: integration_ci_pipeline_id_non_empty
|
|
118
|
+
scope: ci_event
|
|
119
|
+
path: pipeline_id
|
|
120
|
+
rule: non-empty-string
|
|
121
|
+
description: "CI event must have non-empty pipeline_id"
|
|
122
|
+
|
|
123
|
+
- id: integration_ci_run_id_non_empty
|
|
124
|
+
scope: ci_event
|
|
125
|
+
path: run_id
|
|
126
|
+
rule: non-empty-string
|
|
127
|
+
description: "CI event must have non-empty run_id"
|
|
128
|
+
|
|
129
|
+
- id: integration_ci_status_valid
|
|
130
|
+
scope: ci_event
|
|
131
|
+
path: status
|
|
132
|
+
rule: enum(pending,running,succeeded,failed,cancelled)
|
|
133
|
+
description: "CI event status must be valid enum value"
|
|
134
|
+
|
|
135
|
+
- id: integration_ci_started_at_iso
|
|
136
|
+
scope: ci_event
|
|
137
|
+
path: started_at
|
|
138
|
+
rule: iso-datetime
|
|
139
|
+
description: "If started_at present, must be ISO 8601 datetime"
|
|
140
|
+
note: "Apply only when started_at field exists"
|
|
141
|
+
|
|
142
|
+
- id: integration_ci_completed_at_iso
|
|
143
|
+
scope: ci_event
|
|
144
|
+
path: completed_at
|
|
145
|
+
rule: iso-datetime
|
|
146
|
+
description: "If completed_at present, must be ISO 8601 datetime"
|
|
147
|
+
note: "Apply only when completed_at field exists"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# MPLP v1.0.0 FROZEN – Invariant Set
|
|
2
|
+
# © 2025 邦士(北京)网络科技有限公司 – Apache-2.0
|
|
3
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
4
|
+
|
|
5
|
+
# MPLP Protocol v1.0.0 — Frozen Specification
|
|
6
|
+
# Freeze Date: 2025-12-03
|
|
7
|
+
# Status: FROZEN (no breaking changes permitted)
|
|
8
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
9
|
+
# © 2025 邦士(北京)网络科技有限公司
|
|
10
|
+
# License: Apache-2.0
|
|
11
|
+
# Any normative change requires a new protocol version.
|
|
12
|
+
|
|
13
|
+
# MPLP Protocol 1.0.0 — Frozen Specification
|
|
14
|
+
# Status: Frozen as of 2025-11-30
|
|
15
|
+
# Copyright: © 2025 邦士(北京)网络科技有限公司
|
|
16
|
+
# License: Apache-2.0 (see LICENSE at repository root)
|
|
17
|
+
# Any normative change requires a new protocol version.
|
|
18
|
+
|
|
19
|
+
invariants:
|
|
20
|
+
# Core LearningSample Structure Invariants
|
|
21
|
+
- id: learning_sample_id_is_uuid
|
|
22
|
+
scope: learning_sample
|
|
23
|
+
path: sample_id
|
|
24
|
+
rule: uuid-v4
|
|
25
|
+
description: "All LearningSamples must have UUID v4 sample_id"
|
|
26
|
+
|
|
27
|
+
- id: learning_sample_family_non_empty
|
|
28
|
+
scope: learning_sample
|
|
29
|
+
path: sample_family
|
|
30
|
+
rule: non-empty-string
|
|
31
|
+
description: "LearningSample must have non-empty sample_family"
|
|
32
|
+
|
|
33
|
+
- id: learning_sample_created_at_iso
|
|
34
|
+
scope: learning_sample
|
|
35
|
+
path: created_at
|
|
36
|
+
rule: iso-datetime
|
|
37
|
+
description: "LearningSample created_at must be ISO 8601 timestamp"
|
|
38
|
+
|
|
39
|
+
# Input/Output Existence (using non-empty-string on a required sub-field if possible)
|
|
40
|
+
- id: learning_sample_has_input_section
|
|
41
|
+
scope: learning_sample
|
|
42
|
+
path: input
|
|
43
|
+
rule: exists
|
|
44
|
+
description: "LearningSample must have input section"
|
|
45
|
+
|
|
46
|
+
- id: learning_sample_has_output_section
|
|
47
|
+
scope: learning_sample
|
|
48
|
+
path: output
|
|
49
|
+
rule: exists
|
|
50
|
+
description: "LearningSample must have output section"
|
|
51
|
+
|
|
52
|
+
# Meta Field Invariants (optional but validate when present)
|
|
53
|
+
- id: learning_sample_feedback_label_valid
|
|
54
|
+
scope: learning_sample
|
|
55
|
+
path: meta.human_feedback_label
|
|
56
|
+
rule: enum(approved,rejected,not_reviewed)
|
|
57
|
+
description: "If human_feedback_label present, must be valid enum"
|
|
58
|
+
note: "Apply only when meta.human_feedback_label exists"
|
|
59
|
+
|
|
60
|
+
- id: learning_sample_source_flow_non_empty
|
|
61
|
+
scope: learning_sample
|
|
62
|
+
path: meta.source_flow_id
|
|
63
|
+
rule: non-empty-string
|
|
64
|
+
description: "If source_flow_id present, must be non-empty"
|
|
65
|
+
note: "Apply only when meta.source_flow_id exists"
|
|
66
|
+
|
|
67
|
+
# Intent Resolution Family Invariants
|
|
68
|
+
- id: learning_intent_has_intent_id
|
|
69
|
+
scope: learning_sample
|
|
70
|
+
path: input.intent_id
|
|
71
|
+
rule: non-empty-string
|
|
72
|
+
description: "Intent resolution samples must have intent_id in input"
|
|
73
|
+
note: "Apply when sample_family == intent_resolution"
|
|
74
|
+
|
|
75
|
+
- id: learning_intent_quality_label_valid
|
|
76
|
+
scope: learning_sample
|
|
77
|
+
path: output.resolution_quality_label
|
|
78
|
+
rule: enum(good,acceptable,bad,unknown)
|
|
79
|
+
description: "Intent resolution quality label must be valid enum if present"
|
|
80
|
+
note: "Apply when sample_family == intent_resolution AND field exists"
|
|
81
|
+
|
|
82
|
+
# Delta Impact Family Invariants
|
|
83
|
+
- id: learning_delta_has_delta_id
|
|
84
|
+
scope: learning_sample
|
|
85
|
+
path: input.delta_id
|
|
86
|
+
rule: non-empty-string
|
|
87
|
+
description: "Delta impact samples must have delta_id in input"
|
|
88
|
+
note: "Apply when sample_family == delta_impact"
|
|
89
|
+
|
|
90
|
+
- id: learning_delta_scope_valid
|
|
91
|
+
scope: learning_sample
|
|
92
|
+
path: output.impact_scope
|
|
93
|
+
rule: enum(local,module,system,global)
|
|
94
|
+
description: "Delta impact scope must be valid enum"
|
|
95
|
+
note: "Apply when sample_family == delta_impact"
|
|
96
|
+
|
|
97
|
+
- id: learning_delta_risk_valid
|
|
98
|
+
scope: learning_sample
|
|
99
|
+
path: state.risk_level
|
|
100
|
+
rule: enum(low,medium,high,critical)
|
|
101
|
+
description: "Delta risk level must be valid enum if present"
|
|
102
|
+
note: "Apply when sample_family == delta_impact AND field exists"
|
|
103
|
+
# Note: Conditional invariants (based on sample_family) are indicated in "note" fields.
|
|
104
|
+
# If the invariant engine does not support conditional application, these should be
|
|
105
|
+
# enforced at the schema level (already done in family-specific schemas) or during
|
|
106
|
+
# runtime validation. These invariants provide an additional validation layer.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# MPLP v1.0.0 FROZEN – Invariant Set
|
|
2
|
+
# © 2025 邦士(北京)网络科技有限公司 – Apache-2.0
|
|
3
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
4
|
+
|
|
5
|
+
# MPLP Protocol v1.0.0 — Frozen Specification
|
|
6
|
+
# Freeze Date: 2025-12-03
|
|
7
|
+
# Status: FROZEN (no breaking changes permitted)
|
|
8
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
9
|
+
# © 2025 邦士(北京)网络科技有限公司
|
|
10
|
+
# License: Apache-2.0
|
|
11
|
+
# Any normative change requires a new protocol version.
|
|
12
|
+
|
|
13
|
+
# MPLP Protocol 1.0.0 — Frozen Specification
|
|
14
|
+
# Status: Frozen as of 2025-11-30
|
|
15
|
+
# Copyright: © 2025 邦士(北京)网络科技有限公司
|
|
16
|
+
# License: Apache-2.0 (see LICENSE at repository root)
|
|
17
|
+
# Any normative change requires a new protocol version.
|
|
18
|
+
|
|
19
|
+
invariants:
|
|
20
|
+
# Session structure invariants
|
|
21
|
+
- id: map_session_requires_multiple_participants
|
|
22
|
+
scope: collab
|
|
23
|
+
path: participants
|
|
24
|
+
rule: min-length(2)
|
|
25
|
+
description: "MAP sessions require at least 2 participants for multi-agent collaboration"
|
|
26
|
+
|
|
27
|
+
- id: map_collab_mode_valid
|
|
28
|
+
scope: collab
|
|
29
|
+
path: mode
|
|
30
|
+
rule: enum(broadcast,round_robin,orchestrated,swarm,pair)
|
|
31
|
+
description: "Collab.mode must be valid collaboration pattern"
|
|
32
|
+
|
|
33
|
+
- id: map_session_id_is_uuid
|
|
34
|
+
scope: collab
|
|
35
|
+
path: collab_id
|
|
36
|
+
rule: uuid-v4
|
|
37
|
+
description: "Session ID (collab_id) must be valid UUID v4"
|
|
38
|
+
|
|
39
|
+
- id: map_participants_have_role_ids
|
|
40
|
+
scope: collab
|
|
41
|
+
path: participants[*].role_id
|
|
42
|
+
rule: non-empty-string
|
|
43
|
+
description: "All participants must have valid role_id binding"
|
|
44
|
+
|
|
45
|
+
# Event consistency invariants (descriptive, not all auto-enforceable)
|
|
46
|
+
- id: map_turn_completion_matches_dispatch
|
|
47
|
+
scope: trace
|
|
48
|
+
description: "Every MAPTurnDispatched event should have a corresponding MAPTurnCompleted event for the same session_id and role_id"
|
|
49
|
+
note: "This is a higher-level invariant that requires trace event analysis. Mark as manual check or implement custom rule."
|
|
50
|
+
|
|
51
|
+
- id: map_broadcast_has_receivers
|
|
52
|
+
scope: trace
|
|
53
|
+
description: "If MAPBroadcastSent exists, at least one MAPBroadcastReceived must exist for the same session_id"
|
|
54
|
+
note: "Requires cross-event validation. Can be checked via trace event count."
|
|
55
|
+
|
|
56
|
+
# Role binding invariants
|
|
57
|
+
- id: map_role_ids_are_uuids
|
|
58
|
+
scope: collab
|
|
59
|
+
path: participants[*].role_id
|
|
60
|
+
rule: uuid-v4
|
|
61
|
+
description: "All role_id values must be valid UUID v4 format"
|
|
62
|
+
|
|
63
|
+
- id: map_participant_ids_are_non_empty
|
|
64
|
+
scope: collab
|
|
65
|
+
path: participants[*].participant_id
|
|
66
|
+
rule: non-empty-string
|
|
67
|
+
description: "All participant_id values must be non-empty strings"
|
|
68
|
+
|
|
69
|
+
- id: map_participant_kind_valid
|
|
70
|
+
scope: collab
|
|
71
|
+
path: participants[*].kind
|
|
72
|
+
rule: enum(agent,human,system,external)
|
|
73
|
+
description: "Participant kind must be valid enum value"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# MPLP v1.0.0 FROZEN – Invariant Set
|
|
2
|
+
# © 2025 邦士(北京)网络科技有限公司 – Apache-2.0
|
|
3
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
4
|
+
|
|
5
|
+
# MPLP Protocol v1.0.0 — Frozen Specification
|
|
6
|
+
# Freeze Date: 2025-12-03
|
|
7
|
+
# Status: FROZEN (no breaking changes permitted)
|
|
8
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
9
|
+
# © 2025 邦士(北京)网络科技有限公司
|
|
10
|
+
# License: Apache-2.0
|
|
11
|
+
# Any normative change requires a new protocol version.
|
|
12
|
+
|
|
13
|
+
# MPLP Protocol 1.0.0 — Frozen Specification
|
|
14
|
+
# Status: Frozen as of 2025-11-30
|
|
15
|
+
# Copyright: © 2025 邦士(北京)网络科技有限公司
|
|
16
|
+
# License: Apache-2.0 (see LICENSE at repository root)
|
|
17
|
+
# Any normative change requires a new protocol version.
|
|
18
|
+
|
|
19
|
+
invariants:
|
|
20
|
+
# Core Event Structure Invariants
|
|
21
|
+
- id: obs_event_id_is_uuid
|
|
22
|
+
scope: event
|
|
23
|
+
path: event_id
|
|
24
|
+
rule: uuid-v4
|
|
25
|
+
description: "All events must have UUID v4 event_id"
|
|
26
|
+
|
|
27
|
+
- id: obs_event_type_non_empty
|
|
28
|
+
scope: event
|
|
29
|
+
path: event_type
|
|
30
|
+
rule: non-empty-string
|
|
31
|
+
description: "All events must have non-empty event_type"
|
|
32
|
+
|
|
33
|
+
- id: obs_event_family_valid
|
|
34
|
+
scope: event
|
|
35
|
+
path: event_family
|
|
36
|
+
rule: enum(import_process,intent,delta_intent,impact_analysis,compensation_plan,methodology,reasoning_graph,pipeline_stage,graph_update,runtime_execution,cost_budget,external_integration)
|
|
37
|
+
description: "Event family must be valid enum value"
|
|
38
|
+
|
|
39
|
+
- id: obs_timestamp_iso_format
|
|
40
|
+
scope: event
|
|
41
|
+
path: timestamp
|
|
42
|
+
rule: iso-datetime
|
|
43
|
+
description: "All events must have ISO 8601 timestamp"
|
|
44
|
+
|
|
45
|
+
# PipelineStageEvent Specific Invariants
|
|
46
|
+
- id: obs_pipeline_event_has_pipeline_id
|
|
47
|
+
scope: event
|
|
48
|
+
path: pipeline_id
|
|
49
|
+
rule: uuid-v4
|
|
50
|
+
description: "PipelineStageEvent must have valid pipeline_id"
|
|
51
|
+
note: "Apply when event_family == pipeline_stage"
|
|
52
|
+
|
|
53
|
+
- id: obs_pipeline_stage_id_non_empty
|
|
54
|
+
scope: event
|
|
55
|
+
path: stage_id
|
|
56
|
+
rule: non-empty-string
|
|
57
|
+
description: "PipelineStageEvent must have non-empty stage_id"
|
|
58
|
+
note: "Apply when event_family == pipeline_stage"
|
|
59
|
+
|
|
60
|
+
- id: obs_pipeline_stage_status_valid
|
|
61
|
+
scope: event
|
|
62
|
+
path: stage_status
|
|
63
|
+
rule: enum(pending,running,completed,failed,skipped)
|
|
64
|
+
description: "PipelineStageEvent stage_status must be valid enum"
|
|
65
|
+
note: "Apply when event_family == pipeline_stage"
|
|
66
|
+
|
|
67
|
+
# GraphUpdateEvent Specific Invariants
|
|
68
|
+
- id: obs_graph_event_has_graph_id
|
|
69
|
+
scope: event
|
|
70
|
+
path: graph_id
|
|
71
|
+
rule: uuid-v4
|
|
72
|
+
description: "GraphUpdateEvent must have valid graph_id"
|
|
73
|
+
note: "Apply when event_family == graph_update"
|
|
74
|
+
|
|
75
|
+
- id: obs_graph_update_kind_valid
|
|
76
|
+
scope: event
|
|
77
|
+
path: update_kind
|
|
78
|
+
rule: enum(node_add,node_update,node_delete,edge_add,edge_update,edge_delete,bulk)
|
|
79
|
+
description: "GraphUpdateEvent update_kind must be valid enum"
|
|
80
|
+
note: "Apply when event_family == graph_update"
|
|
81
|
+
|
|
82
|
+
# RuntimeExecutionEvent Specific Invariants
|
|
83
|
+
- id: obs_runtime_event_has_execution_id
|
|
84
|
+
scope: event
|
|
85
|
+
path: execution_id
|
|
86
|
+
rule: uuid-v4
|
|
87
|
+
description: "RuntimeExecutionEvent must have valid execution_id"
|
|
88
|
+
note: "Apply when event_family == runtime_execution"
|
|
89
|
+
|
|
90
|
+
- id: obs_runtime_executor_kind_valid
|
|
91
|
+
scope: event
|
|
92
|
+
path: executor_kind
|
|
93
|
+
rule: enum(agent,tool,llm,worker,external)
|
|
94
|
+
description: "RuntimeExecutionEvent executor_kind must be valid enum"
|
|
95
|
+
note: "Apply when event_family == runtime_execution"
|
|
96
|
+
|
|
97
|
+
- id: obs_runtime_status_valid
|
|
98
|
+
scope: event
|
|
99
|
+
path: status
|
|
100
|
+
rule: enum(pending,running,completed,failed,cancelled)
|
|
101
|
+
description: "RuntimeExecutionEvent status must be valid enum"
|
|
102
|
+
note: "Apply when event_family == runtime_execution"
|
|
103
|
+
# Note: The "note" fields indicate conditional application based on event_family.
|
|
104
|
+
# If the invariant engine does not support conditional rules, these should be
|
|
105
|
+
# validated at the schema level (which is already done in the event schemas).
|
|
106
|
+
# These invariants provide additional layer of validation for runtime enforcement.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# MPLP v1.0.0 FROZEN – Invariant Set
|
|
2
|
+
# © 2025 邦士(北京)网络科技有限公司 – Apache-2.0
|
|
3
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
4
|
+
|
|
5
|
+
# MPLP Protocol v1.0.0 — Frozen Specification
|
|
6
|
+
# Freeze Date: 2025-12-03
|
|
7
|
+
# Status: FROZEN (no breaking changes permitted)
|
|
8
|
+
# Governance: MPLP Protocol Governance Committee (MPGC)
|
|
9
|
+
# © 2025 邦士(北京)网络科技有限公司
|
|
10
|
+
# License: Apache-2.0
|
|
11
|
+
# Any normative change requires a new protocol version.
|
|
12
|
+
|
|
13
|
+
# MPLP Protocol 1.0.0 — Frozen Specification
|
|
14
|
+
# Status: Frozen as of 2025-11-30
|
|
15
|
+
# Copyright: © 2025 邦士(北京)网络科技有限公司
|
|
16
|
+
# License: Apache-2.0 (see LICENSE at repository root)
|
|
17
|
+
# Any normative change requires a new protocol version.
|
|
18
|
+
|
|
19
|
+
invariants:
|
|
20
|
+
- id: sa_requires_context
|
|
21
|
+
scope: context
|
|
22
|
+
path: context_id
|
|
23
|
+
rule: uuid-v4
|
|
24
|
+
description: "SA execution requires a valid Context with UUID v4 identifier"
|
|
25
|
+
|
|
26
|
+
- id: sa_context_must_be_active
|
|
27
|
+
scope: context
|
|
28
|
+
path: status
|
|
29
|
+
rule: enum(active)
|
|
30
|
+
description: "SA can only execute when Context status is 'active'"
|
|
31
|
+
|
|
32
|
+
- id: sa_plan_context_binding
|
|
33
|
+
scope: plan
|
|
34
|
+
path: context_id
|
|
35
|
+
rule: eq(context.context_id)
|
|
36
|
+
description: "Plan's context_id must match SA's loaded Context"
|
|
37
|
+
|
|
38
|
+
- id: sa_plan_has_steps
|
|
39
|
+
scope: plan
|
|
40
|
+
path: steps
|
|
41
|
+
rule: min-length(1)
|
|
42
|
+
description: "Plan must contain at least one executable step"
|
|
43
|
+
|
|
44
|
+
- id: sa_steps_have_valid_ids
|
|
45
|
+
scope: plan
|
|
46
|
+
path: steps[*].step_id
|
|
47
|
+
rule: uuid-v4
|
|
48
|
+
description: "All plan steps must have valid UUID v4 identifiers"
|
|
49
|
+
|
|
50
|
+
- id: sa_steps_have_agent_role
|
|
51
|
+
scope: plan
|
|
52
|
+
path: steps[*].agent_role
|
|
53
|
+
rule: non-empty-string
|
|
54
|
+
description: "All steps must specify an agent_role for executor selection"
|
|
55
|
+
|
|
56
|
+
- id: sa_trace_not_empty
|
|
57
|
+
scope: trace
|
|
58
|
+
path: events
|
|
59
|
+
rule: min-length(1)
|
|
60
|
+
description: "SA must emit at least one trace event before completion"
|
|
61
|
+
|
|
62
|
+
- id: sa_trace_context_binding
|
|
63
|
+
scope: trace
|
|
64
|
+
path: context_id
|
|
65
|
+
rule: eq(context.context_id)
|
|
66
|
+
description: "Trace context_id must match SA's Context"
|
|
67
|
+
|
|
68
|
+
- id: sa_trace_plan_binding
|
|
69
|
+
scope: trace
|
|
70
|
+
path: plan_id
|
|
71
|
+
rule: eq(plan.plan_id)
|
|
72
|
+
description: "Trace plan_id must match SA's Plan"
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "MPLP v1.0.0 FROZEN – © 2025 邦士(北京)网络科技有限公司 – Apache-2.0 – Governance: MPGC",
|
|
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
|
+
"x-mplp-meta": {
|
|
95
|
+
"protocolVersion": "1.0.0",
|
|
96
|
+
"frozen": true,
|
|
97
|
+
"freezeDate": "2025-12-03",
|
|
98
|
+
"governance": "MPGC"
|
|
99
|
+
}
|
|
100
|
+
}
|