@haibun/mcp 1.67.0 → 1.69.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/README.md +66 -137
- package/build/lib/http-prompter-client.d.ts +19 -0
- package/build/lib/http-prompter-client.d.ts.map +1 -0
- package/build/lib/http-prompter-client.js +68 -0
- package/build/lib/http-prompter-client.js.map +1 -0
- package/build/lib/mcp-executor-server.d.ts +13 -5
- package/build/lib/mcp-executor-server.d.ts.map +1 -1
- package/build/lib/mcp-executor-server.js +136 -5
- package/build/lib/mcp-executor-server.js.map +1 -1
- package/build/mcp-client-stepper.d.ts +27 -16
- package/build/mcp-client-stepper.d.ts.map +1 -1
- package/build/mcp-client-stepper.js +256 -63
- package/build/mcp-client-stepper.js.map +1 -1
- package/build/mcp-server-stepper.d.ts +6 -5
- package/build/mcp-server-stepper.d.ts.map +1 -1
- package/build/mcp-server-stepper.js +29 -4
- package/build/mcp-server-stepper.js.map +1 -1
- package/build/mcp-test-utils.d.ts +3 -4
- package/build/mcp-test-utils.d.ts.map +1 -1
- package/build/mcp-test-utils.js +6 -5
- package/build/mcp-test-utils.js.map +1 -1
- package/package.json +4 -3
- package/build/example-usage.d.ts +0 -9
- package/build/example-usage.d.ts.map +0 -1
- package/build/example-usage.js +0 -34
- package/build/example-usage.js.map +0 -1
- package/build/mcp-client-prompter.d.ts +0 -2
- package/build/mcp-client-prompter.d.ts.map +0 -1
- package/build/mcp-client-prompter.js +0 -2
- package/build/mcp-client-prompter.js.map +0 -1
- package/build/mcp-test-stepper.d.ts +0 -9
- package/build/mcp-test-stepper.d.ts.map +0 -1
- package/build/mcp-test-stepper.js +0 -20
- package/build/mcp-test-stepper.js.map +0 -1
- package/build/prompt-handler-stepper.d.ts +0 -2
- package/build/prompt-handler-stepper.d.ts.map +0 -1
- package/build/prompt-handler-stepper.js +0 -2
- package/build/prompt-handler-stepper.js.map +0 -1
- package/build/test-constants.d.ts +0 -2
- package/build/test-constants.d.ts.map +0 -1
- package/build/test-constants.js +0 -2
- package/build/test-constants.js.map +0 -1
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
import { AStepper } from '@haibun/core/
|
|
2
|
-
import { OK } from '@haibun/core/
|
|
3
|
-
import { actionNotOK, getStepperOption, intOrError } from '@haibun/core/
|
|
1
|
+
import { AStepper } from '@haibun/core/lib/astepper.js';
|
|
2
|
+
import { OK } from '@haibun/core/lib/defs.js';
|
|
3
|
+
import { actionNotOK, getStepperOption, intOrError } from '@haibun/core/lib/util/index.js';
|
|
4
4
|
import { MCPExecutorServer } from './lib/mcp-executor-server.js';
|
|
5
|
+
const cycles = (mcpStepper) => ({
|
|
6
|
+
async startFeature({ resolvedFeature, index }) {
|
|
7
|
+
if (mcpStepper.mcpServer && mcpStepper.mcpServer.isRunning) {
|
|
8
|
+
mcpStepper.getWorld().logger.debug(`🔗 Starting MCP sampling for feature ${index}: ${resolvedFeature.path}`);
|
|
9
|
+
await mcpStepper.mcpServer.startPromptSampling();
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
endFeature() {
|
|
13
|
+
if (mcpStepper.mcpServer && mcpStepper.mcpServer.isRunning) {
|
|
14
|
+
mcpStepper.getWorld().logger.debug(`🔗 Stopping MCP sampling for feature`);
|
|
15
|
+
mcpStepper.mcpServer.stopPromptSampling();
|
|
16
|
+
}
|
|
17
|
+
return Promise.resolve();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
5
20
|
class MCPServerStepper extends AStepper {
|
|
6
21
|
steppers;
|
|
7
22
|
mcpServer;
|
|
8
23
|
remotePort;
|
|
9
24
|
accessToken;
|
|
25
|
+
cycles = cycles(this);
|
|
10
26
|
options = {
|
|
11
27
|
REMOTE_PORT: {
|
|
12
28
|
desc: 'Port for remote execution API',
|
|
@@ -25,13 +41,22 @@ class MCPServerStepper extends AStepper {
|
|
|
25
41
|
if (!isNaN(this.remotePort) && !this.accessToken) {
|
|
26
42
|
throw new Error('ACCESS_TOKEN is required when REMOTE_PORT is configured for remote execution');
|
|
27
43
|
}
|
|
44
|
+
// Log the remote configuration
|
|
45
|
+
if (!isNaN(this.remotePort)) {
|
|
46
|
+
this.getWorld().logger.warn(`🔗 MCP Server configured for remote execution on http://localhost:${this.remotePort}`);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.getWorld().logger.info(`🏠 MCP Server configured for local execution`);
|
|
50
|
+
}
|
|
28
51
|
}
|
|
29
52
|
getRemoteConfig() {
|
|
30
53
|
if (!isNaN(this.remotePort)) {
|
|
31
|
-
|
|
54
|
+
const config = {
|
|
32
55
|
url: `http://localhost:${this.remotePort}`,
|
|
33
56
|
accessToken: this.accessToken
|
|
34
57
|
};
|
|
58
|
+
this.world.logger.log(`🔗 MCP Server configured for remote execution on ${config.url} with token: ${config.accessToken ? '[PRESENT]' : '[MISSING]'}`);
|
|
59
|
+
return config;
|
|
35
60
|
}
|
|
36
61
|
return undefined;
|
|
37
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server-stepper.js","sourceRoot":"","sources":["../src/mcp-server-stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"mcp-server-stepper.js","sourceRoot":"","sources":["../src/mcp-server-stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,EAAE,EAAyC,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,MAAM,GAAG,CAAC,UAA4B,EAAkB,EAAE,CAAC,CAAC;IACjE,KAAK,CAAC,YAAY,CAAC,EAAE,eAAe,EAAE,KAAK,EAAiB;QAC3D,IAAI,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,SAAS,CA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AE;gBAClB,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;gBAE5C,IAAI,CAAC,SAAS,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;gBAChF,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;gBAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5B,CAAC;SACD;QACD,YAAY,EAAE;YACb,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,KAAK,IAAI,EAAE;gBAClB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBACpB,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;oBACpC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;oBAC3B,OAAO,EAAE,CAAC;gBACX,CAAC;qBAAM,CAAC;oBACP,OAAO,WAAW,CAAC,2BAA2B,CAAC,CAAC;gBACjD,CAAC;YACF,CAAC;SACD;KACD,CAAA;CACD;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export declare const runtimeStdio: (port?: number) => string;
|
|
2
2
|
export declare const TEST_PORTS: {
|
|
3
|
-
readonly MCP_REMOTE_EXECUTOR: 12300;
|
|
4
|
-
readonly MCP_REMOTE_EXECUTION: 12310;
|
|
5
3
|
readonly MCP_CLIENT_LIST_TOOLS: 12342;
|
|
6
4
|
readonly MCP_CLIENT_PROMPTER: 12341;
|
|
7
5
|
readonly MCP_TOOL_EXECUTION: 12350;
|
|
8
|
-
readonly MCP_TOOL_EXECUTION_ALT: 12351;
|
|
9
|
-
readonly MCP_CLIENT_LIFECYCLE: 12360;
|
|
10
6
|
readonly MCP_HTTP_PROMPTER_TEST: 12370;
|
|
7
|
+
readonly MCP_EXECUTOR_PROMPTER_TEST_EXECUTOR: 12381;
|
|
8
|
+
readonly MCP_EXECUTOR_PROMPTER_TEST_DEBUG: 12383;
|
|
9
|
+
readonly MCP_DEBUG_STEPS_TEST: 12390;
|
|
11
10
|
};
|
|
12
11
|
//# sourceMappingURL=mcp-test-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-test-utils.d.ts","sourceRoot":"","sources":["../src/mcp-test-utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"mcp-test-utils.d.ts","sourceRoot":"","sources":["../src/mcp-test-utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,WAsBzC,CAAA;AAGD,eAAO,MAAM,UAAU;;;;;;;;CAQb,CAAC"}
|
package/build/mcp-test-utils.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
export const runtimeStdio = (port) => {
|
|
3
3
|
const listening = port ? {
|
|
4
4
|
'HAIBUN_O_HTTPEXECUTORSTEPPER_LISTEN_PORT': port.toString(),
|
|
5
|
-
'HAIBUN_O_HTTPEXECUTORSTEPPER_ACCESS_TOKEN': 'test-token-client'
|
|
5
|
+
'HAIBUN_O_HTTPEXECUTORSTEPPER_ACCESS_TOKEN': 'test-token-client',
|
|
6
|
+
'HAIBUN_O_MCPSERVERSTEPPER_REMOTE_PORT': port.toString(),
|
|
7
|
+
'HAIBUN_O_MCPSERVERSTEPPER_ACCESS_TOKEN': 'test-token-client'
|
|
6
8
|
} : {};
|
|
7
9
|
const config = {
|
|
8
10
|
command: process.execPath,
|
|
@@ -21,13 +23,12 @@ export const runtimeStdio = (port) => {
|
|
|
21
23
|
return JSON.stringify(config, null, 2);
|
|
22
24
|
};
|
|
23
25
|
export const TEST_PORTS = {
|
|
24
|
-
MCP_REMOTE_EXECUTOR: 12300,
|
|
25
|
-
MCP_REMOTE_EXECUTION: 12310,
|
|
26
26
|
MCP_CLIENT_LIST_TOOLS: 12342,
|
|
27
27
|
MCP_CLIENT_PROMPTER: 12341,
|
|
28
28
|
MCP_TOOL_EXECUTION: 12350,
|
|
29
|
-
MCP_TOOL_EXECUTION_ALT: 12351,
|
|
30
|
-
MCP_CLIENT_LIFECYCLE: 12360,
|
|
31
29
|
MCP_HTTP_PROMPTER_TEST: 12370,
|
|
30
|
+
MCP_EXECUTOR_PROMPTER_TEST_EXECUTOR: 12381,
|
|
31
|
+
MCP_EXECUTOR_PROMPTER_TEST_DEBUG: 12383,
|
|
32
|
+
MCP_DEBUG_STEPS_TEST: 12390,
|
|
32
33
|
};
|
|
33
34
|
//# sourceMappingURL=mcp-test-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-test-utils.js","sourceRoot":"","sources":["../src/mcp-test-utils.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE;IAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC;QACxB,0CAA0C,EAAE,IAAI,CAAC,QAAQ,EAAE;QAC3D,2CAA2C,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"mcp-test-utils.js","sourceRoot":"","sources":["../src/mcp-test-utils.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE;IAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC;QACxB,0CAA0C,EAAE,IAAI,CAAC,QAAQ,EAAE;QAC3D,2CAA2C,EAAE,mBAAmB;QAChE,uCAAuC,EAAE,IAAI,CAAC,QAAQ,EAAE;QACxD,wCAAwC,EAAE,mBAAmB;KAC7D,CAAC,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,MAAM,GAA0B;QACrC,OAAO,EAAE,OAAO,CAAC,QAAQ;QACzB,GAAG,EAAE;YACJ,gCAAgC,EAAE,YAAY;YAC9C,iCAAiC,EAAE,MAAM;YACzC,GAAG,SAAS;SACZ;QACD,IAAI,EAAE;YACL,0BAA0B;YAC1B,OAAO;YACP,qBAAqB;YACrB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;SACvB;KACD,CAAA;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC,CAAA;AAGD,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,qBAAqB,EAAE,KAAK;IAC5B,mBAAmB,EAAE,KAAK;IAC1B,kBAAkB,EAAE,KAAK;IACzB,sBAAsB,EAAE,KAAK;IAC7B,mCAAmC,EAAE,KAAK;IAC1C,gCAAgC,EAAE,KAAK;IACvC,oBAAoB,EAAE,KAAK;CAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haibun/mcp",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.69.0",
|
|
5
5
|
"description": "haibun mcp server and client steppers",
|
|
6
6
|
"main": "build/mcp-server-stepper.js",
|
|
7
7
|
"files": ["build/**"],
|
|
8
|
+
"exports": { ".": "./build/mcp-server-stepper.js", "./*": "./build/*" },
|
|
8
9
|
"scripts": {
|
|
9
10
|
"prepublishOnly": "tsc -b .",
|
|
10
11
|
"build": "tsc -b .",
|
|
@@ -18,12 +19,12 @@
|
|
|
18
19
|
"author": "",
|
|
19
20
|
"license": "ISC",
|
|
20
21
|
"dependencies": {
|
|
21
|
-
"@haibun/core": "1.
|
|
22
|
+
"@haibun/core": "1.69.0",
|
|
22
23
|
"@modelcontextprotocol/sdk": "^1.13.0",
|
|
23
24
|
"zod": "^3.25.67"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@haibun/storage-mem": "1.
|
|
27
|
+
"@haibun/storage-mem": "1.69.0",
|
|
27
28
|
"@types/node": "^22.14.0",
|
|
28
29
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
29
30
|
"@typescript-eslint/parser": "^7.18.0",
|
package/build/example-usage.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Prompter } from '@haibun/core/build/lib/prompter.js';
|
|
2
|
-
/**
|
|
3
|
-
* Example of how to add an MCP client as a subscriber to handle prompts.
|
|
4
|
-
* This allows external MCP servers to respond to interactive prompts in Haibun.
|
|
5
|
-
*/
|
|
6
|
-
declare const prompter: Prompter;
|
|
7
|
-
declare const mcpPrompter: import("./mcp-client-prompter.js").MCPClientPrompter;
|
|
8
|
-
export { prompter, mcpPrompter };
|
|
9
|
-
//# sourceMappingURL=example-usage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-usage.d.ts","sourceRoot":"","sources":["../src/example-usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAG9D;;;GAGG;AAGH,QAAA,MAAM,QAAQ,UAAiB,CAAC;AAIhC,QAAA,MAAM,WAAW,sDAKhB,CAAC;AAwBF,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
|
package/build/example-usage.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Prompter } from '@haibun/core/build/lib/prompter.js';
|
|
2
|
-
import { createMCPClientPrompter } from './mcp-client-prompter.js';
|
|
3
|
-
/**
|
|
4
|
-
* Example of how to add an MCP client as a subscriber to handle prompts.
|
|
5
|
-
* This allows external MCP servers to respond to interactive prompts in Haibun.
|
|
6
|
-
*/
|
|
7
|
-
// Create a prompter instance
|
|
8
|
-
const prompter = new Prompter();
|
|
9
|
-
// Create an MCP client prompter that connects to an MCP server
|
|
10
|
-
// The MCP server should implement a tool called "PromptHandler-handlePrompt"
|
|
11
|
-
const mcpPrompter = createMCPClientPrompter('node', // Command to run the MCP server
|
|
12
|
-
['path/to/your/mcp-server.js'], // Arguments for the MCP server
|
|
13
|
-
{}, // Environment variables
|
|
14
|
-
'haibun-prompt-client' // Client name
|
|
15
|
-
);
|
|
16
|
-
// Subscribe the MCP client as a prompter
|
|
17
|
-
prompter.subscribe(mcpPrompter);
|
|
18
|
-
// Now when prompter.prompt() is called, it will try the MCP client first,
|
|
19
|
-
// and if that fails or returns undefined, it will fall back to other prompters
|
|
20
|
-
// like the ReadlinePrompter
|
|
21
|
-
// Example usage:
|
|
22
|
-
async function examplePrompt() {
|
|
23
|
-
const response = await prompter.prompt({
|
|
24
|
-
message: "Please select an option",
|
|
25
|
-
options: ["Yes", "No", "Cancel"]
|
|
26
|
-
});
|
|
27
|
-
console.log("User response:", response);
|
|
28
|
-
}
|
|
29
|
-
// Clean up when done
|
|
30
|
-
process.on('exit', () => {
|
|
31
|
-
mcpPrompter.close();
|
|
32
|
-
});
|
|
33
|
-
export { prompter, mcpPrompter };
|
|
34
|
-
//# sourceMappingURL=example-usage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-usage.js","sourceRoot":"","sources":["../src/example-usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;GAGG;AAEH,6BAA6B;AAC7B,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;AAEhC,+DAA+D;AAC/D,6EAA6E;AAC7E,MAAM,WAAW,GAAG,uBAAuB,CAC1C,MAAM,EAAG,gCAAgC;AACzC,CAAC,4BAA4B,CAAC,EAAG,+BAA+B;AAChE,EAAE,EAAG,wBAAwB;AAC7B,sBAAsB,CAAE,cAAc;CACtC,CAAC;AAEF,yCAAyC;AACzC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AAEhC,0EAA0E;AAC1E,+EAA+E;AAC/E,4BAA4B;AAE5B,iBAAiB;AACjB,KAAK,UAAU,aAAa;IAC3B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACtC,OAAO,EAAE,yBAAyB;QAClC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC;KAChC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,qBAAqB;AACrB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;IACvB,WAAW,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-client-prompter.d.ts","sourceRoot":"","sources":["../src/mcp-client-prompter.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-client-prompter.js","sourceRoot":"","sources":["../src/mcp-client-prompter.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AStepper } from '@haibun/core/build/lib/astepper.js';
|
|
2
|
-
import { TStepperStep } from '@haibun/core/build/lib/defs.js';
|
|
3
|
-
declare class TestStepper extends AStepper {
|
|
4
|
-
steps: {
|
|
5
|
-
[name: string]: TStepperStep;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export default TestStepper;
|
|
9
|
-
//# sourceMappingURL=mcp-test-stepper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-test-stepper.d.ts","sourceRoot":"","sources":["../src/mcp-test-stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAM,MAAM,gCAAgC,CAAC;AAElE,cAAM,WAAY,SAAQ,QAAQ;IACjC,KAAK,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;KAAE,CAatC;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AStepper } from '@haibun/core/build/lib/astepper.js';
|
|
2
|
-
import { OK } from '@haibun/core/build/lib/defs.js';
|
|
3
|
-
class TestStepper extends AStepper {
|
|
4
|
-
steps = {
|
|
5
|
-
yourTestPhrasePasses: {
|
|
6
|
-
gwta: 'your test phrase passes',
|
|
7
|
-
action: async () => {
|
|
8
|
-
return Promise.resolve(OK);
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
yourTestPhraseFails: {
|
|
12
|
-
gwta: 'your test phrase fails',
|
|
13
|
-
action: async () => {
|
|
14
|
-
return Promise.resolve(OK);
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export default TestStepper;
|
|
20
|
-
//# sourceMappingURL=mcp-test-stepper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-test-stepper.js","sourceRoot":"","sources":["../src/mcp-test-stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAgB,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,WAAY,SAAQ,QAAQ;IACjC,KAAK,GAAsC;QAC1C,oBAAoB,EAAE;YACrB,IAAI,EAAE,yBAAyB;YAC/B,MAAM,EAAE,KAAK,IAAI,EAAE;gBAClB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5B,CAAC;SACD;QACD,mBAAmB,EAAE;YACpB,IAAI,EAAE,wBAAwB;YAC9B,MAAM,EAAE,KAAK,IAAI,EAAE;gBAClB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5B,CAAC;SACD;KACD,CAAC;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-handler-stepper.d.ts","sourceRoot":"","sources":["../src/prompt-handler-stepper.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-handler-stepper.js","sourceRoot":"","sources":["../src/prompt-handler-stepper.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-constants.d.ts","sourceRoot":"","sources":["../src/test-constants.ts"],"names":[],"mappings":""}
|
package/build/test-constants.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-constants.js","sourceRoot":"","sources":["../src/test-constants.ts"],"names":[],"mappings":""}
|