@mplp/runtime-minimal 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.
- package/LICENSE.txt +201 -0
- package/dist/ael/index.d.ts +41 -0
- package/dist/ael/index.js +30 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +33 -0
- package/dist/orchestrator/error-recovery.d.ts +12 -0
- package/dist/orchestrator/error-recovery.js +18 -0
- package/dist/orchestrator/index.d.ts +15 -0
- package/dist/orchestrator/index.js +32 -0
- package/dist/orchestrator/multi-agent.d.ts +12 -0
- package/dist/orchestrator/multi-agent.js +18 -0
- package/dist/orchestrator/risk-confirmation.d.ts +12 -0
- package/dist/orchestrator/risk-confirmation.js +18 -0
- package/dist/orchestrator/single-agent.d.ts +25 -0
- package/dist/orchestrator/single-agent.js +116 -0
- package/dist/registry/modules-registry.d.ts +25 -0
- package/dist/registry/modules-registry.js +40 -0
- package/dist/types/runtime-context.d.ts +28 -0
- package/dist/types/runtime-context.js +13 -0
- package/dist/types/runtime-result.d.ts +22 -0
- package/dist/types/runtime-result.js +13 -0
- package/dist/vsl/index.d.ts +32 -0
- package/dist/vsl/index.js +39 -0
- package/package.json +23 -0
- package/src/ael/index.d.ts +42 -0
- package/src/ael/index.js +31 -0
- package/src/ael/index.ts +47 -0
- package/src/index.d.ts +18 -0
- package/src/index.js +34 -0
- package/src/index.ts +18 -0
- package/src/orchestrator/error-recovery.d.ts +13 -0
- package/src/orchestrator/error-recovery.js +19 -0
- package/src/orchestrator/error-recovery.ts +16 -0
- package/src/orchestrator/index.d.ts +16 -0
- package/src/orchestrator/index.js +33 -0
- package/src/orchestrator/index.ts +17 -0
- package/src/orchestrator/multi-agent.d.ts +13 -0
- package/src/orchestrator/multi-agent.js +19 -0
- package/src/orchestrator/multi-agent.ts +16 -0
- package/src/orchestrator/risk-confirmation.d.ts +13 -0
- package/src/orchestrator/risk-confirmation.js +19 -0
- package/src/orchestrator/risk-confirmation.ts +16 -0
- package/src/orchestrator/single-agent.d.ts +26 -0
- package/src/orchestrator/single-agent.js +117 -0
- package/src/orchestrator/single-agent.ts +139 -0
- package/src/registry/modules-registry.d.ts +26 -0
- package/src/registry/modules-registry.js +41 -0
- package/src/registry/modules-registry.ts +67 -0
- package/src/types/runtime-context.d.ts +29 -0
- package/src/types/runtime-context.js +14 -0
- package/src/types/runtime-context.ts +32 -0
- package/src/types/runtime-result.d.ts +23 -0
- package/src/types/runtime-result.js +14 -0
- package/src/types/runtime-result.ts +25 -0
- package/src/vsl/index.d.ts +33 -0
- package/src/vsl/index.js +40 -0
- package/src/vsl/index.ts +48 -0
- package/tests/single-agent.runtime.test.ts +131 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MPLP Protocol v1.0.0 — Frozen Specification
|
|
3
|
+
* Freeze Date: 2025-12-03
|
|
4
|
+
* Status: FROZEN (no breaking changes permitted)
|
|
5
|
+
* Governance: MPLP Protocol Governance Committee (MPGC)
|
|
6
|
+
*
|
|
7
|
+
* © 2025 邦士(北京)网络科技有限公司. All rights reserved.
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { describe, it, expect } from "vitest";
|
|
14
|
+
|
|
15
|
+
import { SingleAgentFlowContract } from "@mplp/coordination";
|
|
16
|
+
import {
|
|
17
|
+
runSingleAgentFlow
|
|
18
|
+
} from "../src/orchestrator/single-agent";
|
|
19
|
+
import { InMemoryVSL } from "../src/vsl";
|
|
20
|
+
import type { RuntimeContext } from "../src/types/runtime-context";
|
|
21
|
+
import type {
|
|
22
|
+
ContextModuleHandler,
|
|
23
|
+
PlanModuleHandler,
|
|
24
|
+
ConfirmModuleHandler,
|
|
25
|
+
TraceModuleHandler
|
|
26
|
+
} from "@mplp/coordination";
|
|
27
|
+
|
|
28
|
+
const contextHandler: ContextModuleHandler = async ({ ctx }) => ({
|
|
29
|
+
output: {
|
|
30
|
+
context: {
|
|
31
|
+
meta: {
|
|
32
|
+
protocol_version: "1.0.0",
|
|
33
|
+
schema_version: "1.0.0",
|
|
34
|
+
created_at: new Date().toISOString()
|
|
35
|
+
},
|
|
36
|
+
context_id: "00000000-0000-0000-0000-000000000001",
|
|
37
|
+
root: { domain: "test", environment: "test" },
|
|
38
|
+
title: "Test Context",
|
|
39
|
+
status: "active"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
events: []
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const planHandler: PlanModuleHandler = async ({ ctx }) => ({
|
|
46
|
+
output: {
|
|
47
|
+
plan: {
|
|
48
|
+
meta: {
|
|
49
|
+
protocol_version: "1.0.0",
|
|
50
|
+
schema_version: "1.0.0",
|
|
51
|
+
created_at: new Date().toISOString()
|
|
52
|
+
},
|
|
53
|
+
plan_id: "00000000-0000-0000-0000-000000000002",
|
|
54
|
+
context_id: ctx.context?.context_id ?? "",
|
|
55
|
+
steps: []
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
events: []
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const confirmHandler: ConfirmModuleHandler = async ({ ctx }) => ({
|
|
62
|
+
output: {
|
|
63
|
+
confirm: {
|
|
64
|
+
meta: {
|
|
65
|
+
protocol_version: "1.0.0",
|
|
66
|
+
schema_version: "1.0.0",
|
|
67
|
+
created_at: new Date().toISOString()
|
|
68
|
+
},
|
|
69
|
+
confirm_id: "00000000-0000-0000-0000-000000000003",
|
|
70
|
+
plan_id: ctx.plan?.plan_id ?? "",
|
|
71
|
+
status: "approved"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
events: []
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const traceHandler: TraceModuleHandler = async ({ ctx }) => ({
|
|
78
|
+
output: {
|
|
79
|
+
trace: {
|
|
80
|
+
meta: {
|
|
81
|
+
protocol_version: "1.0.0",
|
|
82
|
+
schema_version: "1.0.0",
|
|
83
|
+
created_at: new Date().toISOString()
|
|
84
|
+
},
|
|
85
|
+
trace_id: "00000000-0000-0000-0000-000000000004",
|
|
86
|
+
context_id: ctx.context?.context_id ?? "",
|
|
87
|
+
plan_id: ctx.plan?.plan_id ?? "",
|
|
88
|
+
confirm_id: ctx.confirm?.confirm_id ?? "",
|
|
89
|
+
entries: []
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
events: []
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe("Reference Runtime �?Single Agent Flow", () => {
|
|
96
|
+
it("should execute SingleAgentFlowContract successfully", async () => {
|
|
97
|
+
const vsl = new InMemoryVSL();
|
|
98
|
+
|
|
99
|
+
const runtimeContext: RuntimeContext = {
|
|
100
|
+
ids: { runId: "run-1" },
|
|
101
|
+
coordination: {
|
|
102
|
+
ids: { runId: "run-1" },
|
|
103
|
+
metadata: {}
|
|
104
|
+
},
|
|
105
|
+
events: []
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const modules = {
|
|
109
|
+
context: contextHandler,
|
|
110
|
+
plan: planHandler,
|
|
111
|
+
confirm: confirmHandler,
|
|
112
|
+
trace: traceHandler
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const result = await runSingleAgentFlow({
|
|
116
|
+
flow: SingleAgentFlowContract,
|
|
117
|
+
runtimeContext,
|
|
118
|
+
modules,
|
|
119
|
+
vsl
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
expect(result.success).toBe(true);
|
|
123
|
+
expect(result.output?.context).toBeDefined();
|
|
124
|
+
expect(result.output?.plan).toBeDefined();
|
|
125
|
+
expect(result.output?.confirm).toBeDefined();
|
|
126
|
+
expect(result.output?.trace).toBeDefined();
|
|
127
|
+
|
|
128
|
+
const events = await vsl.getEvents("run-1");
|
|
129
|
+
expect(Array.isArray(events)).toBe(true);
|
|
130
|
+
});
|
|
131
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2020",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2020"
|
|
8
|
+
],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"downlevelIteration": true,
|
|
17
|
+
"outDir": "dist",
|
|
18
|
+
"rootDir": "src"
|
|
19
|
+
},
|
|
20
|
+
"include": [
|
|
21
|
+
"src"
|
|
22
|
+
]
|
|
23
|
+
}
|