@mplp/sdk-ts 1.0.2 → 1.0.4

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 (58) hide show
  1. package/CHANGELOG.md +15 -5
  2. package/README.md +61 -11
  3. package/dist/coordination/index.d.ts +8 -0
  4. package/dist/coordination/index.js +11 -0
  5. package/dist/core/index.d.ts +28 -0
  6. package/dist/core/index.js +21 -0
  7. package/dist/core/validators/index.d.ts +12 -0
  8. package/dist/core/validators/index.js +22 -0
  9. package/dist/runtime/index.d.ts +11 -0
  10. package/dist/runtime/index.js +14 -0
  11. package/dist/runtime-minimal/index.d.ts +52 -0
  12. package/dist/runtime-minimal/index.js +28 -0
  13. package/dist/types/index.d.ts +21 -0
  14. package/dist/types/index.js +2 -0
  15. package/package.json +47 -34
  16. package/schemas/common/common-types.schema.json +55 -0
  17. package/schemas/common/events.schema.json +72 -0
  18. package/schemas/common/identifiers.schema.json +19 -0
  19. package/schemas/common/learning-sample.schema.json +200 -0
  20. package/schemas/common/metadata.schema.json +119 -0
  21. package/schemas/common/trace-base.schema.json +49 -0
  22. package/schemas/events/mplp-event-core.schema.json +64 -0
  23. package/schemas/events/mplp-graph-update-event.schema.json +64 -0
  24. package/schemas/events/mplp-map-event.schema.json +153 -0
  25. package/schemas/events/mplp-pipeline-stage-event.schema.json +62 -0
  26. package/schemas/events/mplp-runtime-execution-event.schema.json +64 -0
  27. package/schemas/events/mplp-sa-event.schema.json +115 -0
  28. package/schemas/integration/mplp-ci-event.schema.json +136 -0
  29. package/schemas/integration/mplp-file-update-event.schema.json +76 -0
  30. package/schemas/integration/mplp-git-event.schema.json +104 -0
  31. package/schemas/integration/mplp-tool-event.schema.json +89 -0
  32. package/schemas/invariants/integration-invariants.yaml +147 -0
  33. package/schemas/invariants/learning-invariants.yaml +106 -0
  34. package/schemas/invariants/map-invariants.yaml +73 -0
  35. package/schemas/invariants/observability-invariants.yaml +106 -0
  36. package/schemas/invariants/sa-invariants.yaml +72 -0
  37. package/schemas/learning/mplp-learning-sample-core.schema.json +100 -0
  38. package/schemas/learning/mplp-learning-sample-delta.schema.json +143 -0
  39. package/schemas/learning/mplp-learning-sample-intent.schema.json +125 -0
  40. package/schemas/mplp-collab.schema.json +249 -0
  41. package/schemas/mplp-confirm.schema.json +232 -0
  42. package/schemas/mplp-context.schema.json +252 -0
  43. package/schemas/mplp-core.schema.json +189 -0
  44. package/schemas/mplp-dialog.schema.json +204 -0
  45. package/schemas/mplp-extension.schema.json +185 -0
  46. package/schemas/mplp-network.schema.json +236 -0
  47. package/schemas/mplp-plan.schema.json +199 -0
  48. package/schemas/mplp-role.schema.json +145 -0
  49. package/schemas/mplp-trace.schema.json +222 -0
  50. package/src/builders/confirm-builder.ts +0 -39
  51. package/src/builders/context-builder.ts +0 -51
  52. package/src/builders/plan-builder.ts +0 -51
  53. package/src/builders/trace-builder.ts +0 -50
  54. package/src/client/runtime-client.ts +0 -98
  55. package/src/index.ts +0 -13
  56. package/tests/builders.test.ts +0 -80
  57. package/tests/client-single-agent.test.ts +0 -48
  58. package/tsconfig.json +0 -23
@@ -0,0 +1,62 @@
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/events/mplp-pipeline-stage-event.schema.json",
5
+ "title": "MPLP PipelineStageEvent v1.0",
6
+ "description": "**REQUIRED** - Pipeline stage transition events (MANDATORY for v1.0 compliance)",
7
+ "allOf": [
8
+ {
9
+ "$ref": "mplp-event-core.schema.json"
10
+ },
11
+ {
12
+ "type": "object",
13
+ "properties": {
14
+ "event_family": {
15
+ "const": "pipeline_stage",
16
+ "description": "Must be 'pipeline_stage' for this event type"
17
+ },
18
+ "pipeline_id": {
19
+ "type": "string",
20
+ "format": "uuid",
21
+ "description": "Pipeline instance identifier"
22
+ },
23
+ "stage_id": {
24
+ "type": "string",
25
+ "description": "Stage identifier (e.g., 'import', 'analyze', 'execute')"
26
+ },
27
+ "stage_name": {
28
+ "type": "string",
29
+ "description": "Human-readable stage name"
30
+ },
31
+ "stage_status": {
32
+ "type": "string",
33
+ "enum": [
34
+ "pending",
35
+ "running",
36
+ "completed",
37
+ "failed",
38
+ "skipped"
39
+ ],
40
+ "description": "Current status of the pipeline stage"
41
+ },
42
+ "stage_order": {
43
+ "type": "integer",
44
+ "minimum": 0,
45
+ "description": "Sequential order of this stage in pipeline"
46
+ }
47
+ },
48
+ "required": [
49
+ "event_family",
50
+ "pipeline_id",
51
+ "stage_id",
52
+ "stage_status"
53
+ ]
54
+ }
55
+ ],
56
+ "x-mplp-meta": {
57
+ "protocolVersion": "1.0.0",
58
+ "frozen": true,
59
+ "freezeDate": "2025-12-03",
60
+ "governance": "MPGC"
61
+ }
62
+ }
@@ -0,0 +1,64 @@
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/events/mplp-runtime-execution-event.schema.json",
5
+ "title": "MPLP RuntimeExecutionEvent v1.0",
6
+ "description": "Runtime execution lifecycle events (agents, tools, LLMs, workers)",
7
+ "allOf": [
8
+ {
9
+ "$ref": "mplp-event-core.schema.json"
10
+ },
11
+ {
12
+ "type": "object",
13
+ "properties": {
14
+ "event_family": {
15
+ "const": "runtime_execution",
16
+ "description": "Must be 'runtime_execution' for this event type"
17
+ },
18
+ "execution_id": {
19
+ "type": "string",
20
+ "format": "uuid",
21
+ "description": "Execution instance identifier"
22
+ },
23
+ "executor_kind": {
24
+ "type": "string",
25
+ "enum": [
26
+ "agent",
27
+ "tool",
28
+ "llm",
29
+ "worker",
30
+ "external"
31
+ ],
32
+ "description": "Type of executor performing this execution"
33
+ },
34
+ "executor_role": {
35
+ "type": "string",
36
+ "description": "Role identifier (e.g., 'planner', 'reviewer', 'curl_executor')"
37
+ },
38
+ "status": {
39
+ "type": "string",
40
+ "enum": [
41
+ "pending",
42
+ "running",
43
+ "completed",
44
+ "failed",
45
+ "cancelled"
46
+ ],
47
+ "description": "Current execution status"
48
+ }
49
+ },
50
+ "required": [
51
+ "event_family",
52
+ "execution_id",
53
+ "executor_kind",
54
+ "status"
55
+ ]
56
+ }
57
+ ],
58
+ "x-mplp-meta": {
59
+ "protocolVersion": "1.0.0",
60
+ "frozen": true,
61
+ "freezeDate": "2025-12-03",
62
+ "governance": "MPGC"
63
+ }
64
+ }
@@ -0,0 +1,115 @@
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/events/mplp-sa-event.schema.json",
5
+ "title": "MPLP SA Event v1.0",
6
+ "description": "Events emitted by a Single Agent (SA) execution in MPLP v1.0 protocol",
7
+ "type": "object",
8
+ "properties": {
9
+ "event_id": {
10
+ "type": "string",
11
+ "format": "uuid",
12
+ "description": "Unique identifier for this event"
13
+ },
14
+ "event_type": {
15
+ "type": "string",
16
+ "enum": [
17
+ "SAInitialized",
18
+ "SAContextLoaded",
19
+ "SAPlanEvaluated",
20
+ "SAStepStarted",
21
+ "SAStepCompleted",
22
+ "SAStepFailed",
23
+ "SATraceEmitted",
24
+ "SACompleted"
25
+ ],
26
+ "description": "Type of SA lifecycle event"
27
+ },
28
+ "timestamp": {
29
+ "type": "string",
30
+ "format": "date-time",
31
+ "description": "ISO 8601 timestamp when event occurred"
32
+ },
33
+ "sa_id": {
34
+ "type": "string",
35
+ "format": "uuid",
36
+ "description": "Identifier of the SA instance emitting this event"
37
+ },
38
+ "context_id": {
39
+ "type": "string",
40
+ "format": "uuid",
41
+ "description": "Context ID bound to this SA execution"
42
+ },
43
+ "plan_id": {
44
+ "type": "string",
45
+ "format": "uuid",
46
+ "description": "Plan ID being executed by this SA"
47
+ },
48
+ "trace_id": {
49
+ "type": "string",
50
+ "format": "uuid",
51
+ "description": "Trace ID where this event is recorded"
52
+ },
53
+ "payload": {
54
+ "type": "object",
55
+ "description": "Event-specific data payload",
56
+ "additionalProperties": true
57
+ }
58
+ },
59
+ "required": [
60
+ "event_id",
61
+ "event_type",
62
+ "timestamp",
63
+ "sa_id"
64
+ ],
65
+ "additionalProperties": false,
66
+ "$defs": {
67
+ "step_started_payload": {
68
+ "type": "object",
69
+ "properties": {
70
+ "step_id": {
71
+ "type": "string",
72
+ "format": "uuid"
73
+ },
74
+ "agent_role": {
75
+ "type": "string"
76
+ },
77
+ "description": {
78
+ "type": "string"
79
+ }
80
+ },
81
+ "required": [
82
+ "step_id"
83
+ ]
84
+ },
85
+ "step_completed_payload": {
86
+ "type": "object",
87
+ "properties": {
88
+ "step_id": {
89
+ "type": "string",
90
+ "format": "uuid"
91
+ },
92
+ "status": {
93
+ "type": "string",
94
+ "enum": [
95
+ "completed",
96
+ "failed"
97
+ ]
98
+ },
99
+ "result": {
100
+ "type": "object"
101
+ }
102
+ },
103
+ "required": [
104
+ "step_id",
105
+ "status"
106
+ ]
107
+ }
108
+ },
109
+ "x-mplp-meta": {
110
+ "protocolVersion": "1.0.0",
111
+ "frozen": true,
112
+ "freezeDate": "2025-12-03",
113
+ "governance": "MPGC"
114
+ }
115
+ }
@@ -0,0 +1,136 @@
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/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
+ "x-mplp-meta": {
131
+ "protocolVersion": "1.0.0",
132
+ "frozen": true,
133
+ "freezeDate": "2025-12-03",
134
+ "governance": "MPGC"
135
+ }
136
+ }
@@ -0,0 +1,76 @@
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/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
+ "x-mplp-meta": {
71
+ "protocolVersion": "1.0.0",
72
+ "frozen": true,
73
+ "freezeDate": "2025-12-03",
74
+ "governance": "MPGC"
75
+ }
76
+ }
@@ -0,0 +1,104 @@
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/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
+ "x-mplp-meta": {
99
+ "protocolVersion": "1.0.0",
100
+ "frozen": true,
101
+ "freezeDate": "2025-12-03",
102
+ "governance": "MPGC"
103
+ }
104
+ }
@@ -0,0 +1,89 @@
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/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
+ "x-mplp-meta": {
84
+ "protocolVersion": "1.0.0",
85
+ "frozen": true,
86
+ "freezeDate": "2025-12-03",
87
+ "governance": "MPGC"
88
+ }
89
+ }