@hearsay-tools/squawk 0.18.0-pr4406.8599 → 0.18.0-pr4408.8606
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/dist/automations/tools.d.ts +8 -8
- package/dist/delegation/routes.d.ts +65 -65
- package/dist/features/mcp/cli.d.ts +14 -0
- package/dist/features/mcp/cli.js +87 -0
- package/dist/features/mcp/cli.js.map +1 -0
- package/dist/features/mcp/index.d.ts +9 -0
- package/dist/features/mcp/index.js +13 -0
- package/dist/features/mcp/index.js.map +1 -0
- package/dist/features/mcp/stdio.d.ts +10 -0
- package/dist/features/mcp/stdio.js +41 -0
- package/dist/features/mcp/stdio.js.map +1 -0
- package/dist/features/mcp/tools.d.ts +19 -0
- package/dist/features/mcp/tools.js +476 -0
- package/dist/features/mcp/tools.js.map +1 -0
- package/dist/server/automations-routes.d.ts +150 -150
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +31 -31
- package/dist/server/server.d.ts +68 -68
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/task-cli/cli.js +54 -221
- package/dist/task-cli/cli.js.map +1 -1
- package/dist/task-cli/discovery.d.ts +22 -1
- package/dist/task-cli/discovery.js +69 -17
- package/dist/task-cli/discovery.js.map +1 -1
- package/dist/task-cli/http.d.ts +15 -13
- package/dist/task-cli/http.js +16 -6
- package/dist/task-cli/http.js.map +1 -1
- package/dist/task-cli/operations.d.ts +156 -0
- package/dist/task-cli/operations.js +388 -0
- package/dist/task-cli/operations.js.map +1 -0
- package/dist/task-cli/watch.d.ts +31 -8
- package/dist/task-cli/watch.js +159 -91
- package/dist/task-cli/watch.js.map +1 -1
- package/package.json +4 -4
|
@@ -7,10 +7,6 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
|
|
|
7
7
|
}[];
|
|
8
8
|
isError: boolean;
|
|
9
9
|
details: {
|
|
10
|
-
ok: false;
|
|
11
|
-
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
12
|
-
message: string;
|
|
13
|
-
} | {
|
|
14
10
|
ok: true;
|
|
15
11
|
task: {
|
|
16
12
|
id: string;
|
|
@@ -22,6 +18,10 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
|
|
|
22
18
|
url?: string | undefined;
|
|
23
19
|
};
|
|
24
20
|
note: string;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
24
|
+
message: string;
|
|
25
25
|
};
|
|
26
26
|
}>;
|
|
27
27
|
export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof callScheduleTask>>): {
|
|
@@ -31,10 +31,6 @@ export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof
|
|
|
31
31
|
}[];
|
|
32
32
|
isError: boolean;
|
|
33
33
|
details: {
|
|
34
|
-
ok: false;
|
|
35
|
-
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
36
|
-
message: string;
|
|
37
|
-
} | {
|
|
38
34
|
ok: true;
|
|
39
35
|
task: {
|
|
40
36
|
id: string;
|
|
@@ -46,6 +42,10 @@ export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof
|
|
|
46
42
|
url?: string | undefined;
|
|
47
43
|
};
|
|
48
44
|
note: string;
|
|
45
|
+
} | {
|
|
46
|
+
ok: false;
|
|
47
|
+
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
48
|
+
message: string;
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
51
|
export declare function invokeScheduledTasksTool(input: unknown): Promise<{
|
|
@@ -27,18 +27,6 @@ export declare function delegationFailure(error: unknown): {
|
|
|
27
27
|
export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
|
|
28
28
|
"/list": {
|
|
29
29
|
$get: {
|
|
30
|
-
output: {
|
|
31
|
-
error: string;
|
|
32
|
-
code?: "invalid_input" | undefined;
|
|
33
|
-
};
|
|
34
|
-
outputFormat: "json";
|
|
35
|
-
status: 400;
|
|
36
|
-
input: {
|
|
37
|
-
query: {
|
|
38
|
-
offset?: string | undefined;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
} | {
|
|
42
30
|
output: {
|
|
43
31
|
workers: {
|
|
44
32
|
workerId: string;
|
|
@@ -91,6 +79,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
91
79
|
offset?: string | undefined;
|
|
92
80
|
};
|
|
93
81
|
};
|
|
82
|
+
} | {
|
|
83
|
+
output: {
|
|
84
|
+
error: string;
|
|
85
|
+
code?: "invalid_input" | undefined;
|
|
86
|
+
};
|
|
87
|
+
outputFormat: "json";
|
|
88
|
+
status: 400;
|
|
89
|
+
input: {
|
|
90
|
+
query: {
|
|
91
|
+
offset?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
} & {
|
|
@@ -677,18 +677,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
677
677
|
} & {
|
|
678
678
|
"/:workerId": {
|
|
679
679
|
$get: {
|
|
680
|
-
output: {
|
|
681
|
-
error: string;
|
|
682
|
-
code?: "invalid_input" | undefined;
|
|
683
|
-
};
|
|
684
|
-
outputFormat: "json";
|
|
685
|
-
status: 400;
|
|
686
|
-
input: {
|
|
687
|
-
param: {
|
|
688
|
-
workerId: string;
|
|
689
|
-
};
|
|
690
|
-
};
|
|
691
|
-
} | {
|
|
692
680
|
output: {
|
|
693
681
|
workerId: string;
|
|
694
682
|
settled: boolean;
|
|
@@ -813,11 +801,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
813
801
|
workerId: string;
|
|
814
802
|
};
|
|
815
803
|
};
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
} & {
|
|
819
|
-
"/:workerId/collect": {
|
|
820
|
-
$post: {
|
|
804
|
+
} | {
|
|
821
805
|
output: {
|
|
822
806
|
error: string;
|
|
823
807
|
code?: "invalid_input" | undefined;
|
|
@@ -828,10 +812,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
828
812
|
param: {
|
|
829
813
|
workerId: string;
|
|
830
814
|
};
|
|
831
|
-
} & {
|
|
832
|
-
json: Record<string, never>;
|
|
833
815
|
};
|
|
834
|
-
}
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
} & {
|
|
819
|
+
"/:workerId/collect": {
|
|
820
|
+
$post: {
|
|
835
821
|
output: {
|
|
836
822
|
workerId: string;
|
|
837
823
|
parentRunId: string;
|
|
@@ -954,11 +940,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
954
940
|
} & {
|
|
955
941
|
json: Record<string, never>;
|
|
956
942
|
};
|
|
957
|
-
}
|
|
958
|
-
};
|
|
959
|
-
} & {
|
|
960
|
-
"/:workerId/steer": {
|
|
961
|
-
$post: {
|
|
943
|
+
} | {
|
|
962
944
|
output: {
|
|
963
945
|
error: string;
|
|
964
946
|
code?: "invalid_input" | undefined;
|
|
@@ -970,11 +952,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
970
952
|
workerId: string;
|
|
971
953
|
};
|
|
972
954
|
} & {
|
|
973
|
-
json:
|
|
974
|
-
text: string;
|
|
975
|
-
};
|
|
955
|
+
json: Record<string, never>;
|
|
976
956
|
};
|
|
977
|
-
}
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
} & {
|
|
960
|
+
"/:workerId/steer": {
|
|
961
|
+
$post: {
|
|
978
962
|
output: {
|
|
979
963
|
workerId: string;
|
|
980
964
|
state: "delivered" | "queued";
|
|
@@ -990,11 +974,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
990
974
|
text: string;
|
|
991
975
|
};
|
|
992
976
|
};
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
} & {
|
|
996
|
-
"/:workerId/stop": {
|
|
997
|
-
$post: {
|
|
977
|
+
} | {
|
|
998
978
|
output: {
|
|
999
979
|
error: string;
|
|
1000
980
|
code?: "invalid_input" | undefined;
|
|
@@ -1006,9 +986,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1006
986
|
workerId: string;
|
|
1007
987
|
};
|
|
1008
988
|
} & {
|
|
1009
|
-
json:
|
|
989
|
+
json: {
|
|
990
|
+
text: string;
|
|
991
|
+
};
|
|
1010
992
|
};
|
|
1011
|
-
}
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
} & {
|
|
996
|
+
"/:workerId/stop": {
|
|
997
|
+
$post: {
|
|
1012
998
|
output: {
|
|
1013
999
|
workerId: string;
|
|
1014
1000
|
state: "stopping" | "terminated";
|
|
@@ -1022,11 +1008,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1022
1008
|
} & {
|
|
1023
1009
|
json: Record<string, never>;
|
|
1024
1010
|
};
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
} & {
|
|
1028
|
-
"/:workerId/destroy": {
|
|
1029
|
-
$post: {
|
|
1011
|
+
} | {
|
|
1030
1012
|
output: {
|
|
1031
1013
|
error: string;
|
|
1032
1014
|
code?: "invalid_input" | undefined;
|
|
@@ -1038,11 +1020,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1038
1020
|
workerId: string;
|
|
1039
1021
|
};
|
|
1040
1022
|
} & {
|
|
1041
|
-
json:
|
|
1042
|
-
discardWork?: true | undefined;
|
|
1043
|
-
};
|
|
1023
|
+
json: Record<string, never>;
|
|
1044
1024
|
};
|
|
1045
|
-
}
|
|
1025
|
+
};
|
|
1026
|
+
};
|
|
1027
|
+
} & {
|
|
1028
|
+
"/:workerId/destroy": {
|
|
1029
|
+
$post: {
|
|
1046
1030
|
output: {
|
|
1047
1031
|
workerId: string;
|
|
1048
1032
|
state: "complete" | "incomplete";
|
|
@@ -1071,6 +1055,22 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1071
1055
|
discardWork?: true | undefined;
|
|
1072
1056
|
};
|
|
1073
1057
|
};
|
|
1058
|
+
} | {
|
|
1059
|
+
output: {
|
|
1060
|
+
error: string;
|
|
1061
|
+
code?: "invalid_input" | undefined;
|
|
1062
|
+
};
|
|
1063
|
+
outputFormat: "json";
|
|
1064
|
+
status: 400;
|
|
1065
|
+
input: {
|
|
1066
|
+
param: {
|
|
1067
|
+
workerId: string;
|
|
1068
|
+
};
|
|
1069
|
+
} & {
|
|
1070
|
+
json: {
|
|
1071
|
+
discardWork?: true | undefined;
|
|
1072
|
+
};
|
|
1073
|
+
};
|
|
1074
1074
|
} | {
|
|
1075
1075
|
output: {
|
|
1076
1076
|
workerId: string;
|
|
@@ -1106,11 +1106,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1106
1106
|
"/:workerId/diff": {
|
|
1107
1107
|
$get: {
|
|
1108
1108
|
output: {
|
|
1109
|
-
|
|
1110
|
-
|
|
1109
|
+
workerId: string;
|
|
1110
|
+
baselineSha: string;
|
|
1111
|
+
diff: string;
|
|
1112
|
+
truncated: boolean;
|
|
1111
1113
|
};
|
|
1112
1114
|
outputFormat: "json";
|
|
1113
|
-
status:
|
|
1115
|
+
status: 200;
|
|
1114
1116
|
input: {
|
|
1115
1117
|
param: {
|
|
1116
1118
|
workerId: string;
|
|
@@ -1118,13 +1120,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1118
1120
|
};
|
|
1119
1121
|
} | {
|
|
1120
1122
|
output: {
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
diff: string;
|
|
1124
|
-
truncated: boolean;
|
|
1123
|
+
error: string;
|
|
1124
|
+
code?: "invalid_input" | undefined;
|
|
1125
1125
|
};
|
|
1126
1126
|
outputFormat: "json";
|
|
1127
|
-
status:
|
|
1127
|
+
status: 400;
|
|
1128
1128
|
input: {
|
|
1129
1129
|
param: {
|
|
1130
1130
|
workerId: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type DiscoverOriginOptions } from '../../task-cli/discovery.ts';
|
|
2
|
+
import { type ServeMcpStdioOptions } from './stdio.ts';
|
|
3
|
+
export declare const MCP_HELP: string;
|
|
4
|
+
export interface McpCliDeps {
|
|
5
|
+
cwd?: () => string;
|
|
6
|
+
stdout?: (line: string) => void;
|
|
7
|
+
stderr?: (line: string) => void;
|
|
8
|
+
discover?: (options: DiscoverOriginOptions) => Promise<{
|
|
9
|
+
origin: string;
|
|
10
|
+
}>;
|
|
11
|
+
serve?: (options: ServeMcpStdioOptions) => Promise<void>;
|
|
12
|
+
version?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function runMcpCommand(argv: string[], env: NodeJS.ProcessEnv, deps?: McpCliDeps): Promise<number>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
import { productEnv } from '../../core/product-env.js';
|
|
6
|
+
import { commandText } from '../../home/command.js';
|
|
7
|
+
import { discoverCockpitOrigin } from '../../task-cli/discovery.js';
|
|
8
|
+
import { TaskCliError } from '../../task-cli/http.js';
|
|
9
|
+
import { serveMcpStdio } from './stdio.js';
|
|
10
|
+
export const MCP_HELP = commandText(`Squawk MCP — stdio MCP server over Squawk task operations for outside orchestrators
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
cez mcp [--url <origin>] [--repo <dir>]
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
--url <origin> Connect to this cockpit origin instead of local discovery (also HSQ_URL / CEZ_URL).
|
|
17
|
+
--repo <dir> Match the cockpit serving this repository (default: cwd, falling back to a single local cockpit).
|
|
18
|
+
-h, --help Show this help.
|
|
19
|
+
|
|
20
|
+
Notes:
|
|
21
|
+
- Keeps stdout strictly for MCP JSON-RPC frames; diagnostics go to stderr.
|
|
22
|
+
- Refuses to start inside a Squawk task (when HSQ_TASK_ID or CEZ_TASK_ID is set).`);
|
|
23
|
+
function readPackageVersion() {
|
|
24
|
+
try {
|
|
25
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const pkg = JSON.parse(readFileSync(join(here, '..', '..', '..', 'package.json'), 'utf8'));
|
|
27
|
+
return pkg.version ?? '0.0.0';
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return '0.0.0';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function parseMcpArgs(argv) {
|
|
34
|
+
try {
|
|
35
|
+
return parseArgs({
|
|
36
|
+
args: argv,
|
|
37
|
+
options: {
|
|
38
|
+
url: { type: 'string' },
|
|
39
|
+
repo: { type: 'string' },
|
|
40
|
+
help: { type: 'boolean', short: 'h', default: false },
|
|
41
|
+
},
|
|
42
|
+
allowPositionals: true,
|
|
43
|
+
strict: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw new TaskCliError(64, { code: 'invalid_input', error: error instanceof Error ? error.message : 'invalid arguments' });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function formatCliError(error) {
|
|
51
|
+
if (error instanceof TaskCliError) {
|
|
52
|
+
const msg = typeof error.body.error === 'string' ? error.body.error : error.message;
|
|
53
|
+
const hint = typeof error.body.hint === 'string' ? `\nHint: ${error.body.hint}` : '';
|
|
54
|
+
return { message: `${msg}${hint}`, exitCode: error.exitCode };
|
|
55
|
+
}
|
|
56
|
+
return { message: error instanceof Error ? error.message : String(error), exitCode: 1 };
|
|
57
|
+
}
|
|
58
|
+
export async function runMcpCommand(argv, env, deps = {}) {
|
|
59
|
+
const writeOut = deps.stdout ?? ((line) => console.log(line));
|
|
60
|
+
const writeErr = deps.stderr ?? ((line) => console.error(line));
|
|
61
|
+
try {
|
|
62
|
+
const parsed = parseMcpArgs(argv);
|
|
63
|
+
if (parsed.values.help) {
|
|
64
|
+
writeOut(MCP_HELP);
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
if (parsed.positionals.length > 0) {
|
|
68
|
+
throw new TaskCliError(64, { code: 'invalid_input', error: `unexpected argument '${parsed.positionals[0]}'` });
|
|
69
|
+
}
|
|
70
|
+
if (productEnv('TASK_ID', env)?.trim()) {
|
|
71
|
+
writeErr(commandText('cez mcp is for outside orchestrators and refuses to start inside a Squawk task (HSQ_TASK_ID / CEZ_TASK_ID is set).'));
|
|
72
|
+
return 1;
|
|
73
|
+
}
|
|
74
|
+
const url = parsed.values.url ?? (productEnv('URL', env)?.trim() || undefined);
|
|
75
|
+
const explicitRepo = parsed.values.repo !== undefined;
|
|
76
|
+
const repoDir = resolve(parsed.values.repo ?? (deps.cwd ? deps.cwd() : process.cwd()));
|
|
77
|
+
const { origin } = await (deps.discover ?? discoverCockpitOrigin)({ url, repoDir, explicitRepo });
|
|
78
|
+
await (deps.serve ?? serveMcpStdio)({ origin, version: deps.version ?? readPackageVersion() });
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const formatted = formatCliError(error);
|
|
83
|
+
writeErr(formatted.message);
|
|
84
|
+
return formatted.exitCode;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/features/mcp/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC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OAAO,IAAI,kBAAkB,EAAE,EAAE,CAAC,CAAC;QAC/F,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bundled orchestrator MCP feature (spec 2026-11-27-orchestrator-mcp-server,
|
|
3
|
+
* hearsay-tools/squawk#4401): registers `hsq mcp` through the plugin API only.
|
|
4
|
+
* Nothing outside this folder imports it.
|
|
5
|
+
*/
|
|
6
|
+
import type { CliCommandDefinition, SquawkPluginApi } from '../../plugin/index.ts';
|
|
7
|
+
/** `hsq mcp`: parses its own argv and talks to a running cockpit over loopback HTTP. */
|
|
8
|
+
export declare const mcpCliCommand: CliCommandDefinition;
|
|
9
|
+
export default function setup(api: SquawkPluginApi): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** `hsq mcp`: parses its own argv and talks to a running cockpit over loopback HTTP. */
|
|
2
|
+
export const mcpCliCommand = {
|
|
3
|
+
name: 'mcp',
|
|
4
|
+
usage: [' cez mcp [--url <origin>] [--repo <dir>] serve Squawk task tools over MCP stdio (see: mcp --help)'],
|
|
5
|
+
parseMode: 'subcommand',
|
|
6
|
+
homeMode: 'none',
|
|
7
|
+
runtimeMode: 'none',
|
|
8
|
+
load: async () => (await import('./cli.js')).runMcpCommand,
|
|
9
|
+
};
|
|
10
|
+
export default function setup(api) {
|
|
11
|
+
api.registerCliCommand(mcpCliCommand);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/mcp/index.ts"],"names":[],"mappings":"AAOA,wFAAwF;AACxF,MAAM,CAAC,MAAM,aAAa,GAAyB;IACjD,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,CAAC,qGAAqG,CAAC;IAC9G,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa;CAC3D,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,GAAoB;IAChD,GAAG,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type OrchestratorMcpOptions } from './tools.ts';
|
|
2
|
+
export interface ServeMcpStdioOptions extends OrchestratorMcpOptions {
|
|
3
|
+
stdin?: NodeJS.ReadableStream | undefined;
|
|
4
|
+
stdout?: NodeJS.WritableStream | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Run the orchestrator MCP server over stdio until the transport closes, stdin ends, or a
|
|
8
|
+
* termination signal arrives. Keeps stdout exclusively for MCP JSON-RPC frames.
|
|
9
|
+
*/
|
|
10
|
+
export declare function serveMcpStdio(options: ServeMcpStdioOptions): Promise<void>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
|
+
import { createOrchestratorMcpServer } from './tools.js';
|
|
3
|
+
/**
|
|
4
|
+
* Run the orchestrator MCP server over stdio until the transport closes, stdin ends, or a
|
|
5
|
+
* termination signal arrives. Keeps stdout exclusively for MCP JSON-RPC frames.
|
|
6
|
+
*/
|
|
7
|
+
export async function serveMcpStdio(options) {
|
|
8
|
+
const server = createOrchestratorMcpServer(options);
|
|
9
|
+
const stdin = options.stdin ?? process.stdin;
|
|
10
|
+
const stdout = options.stdout ?? process.stdout;
|
|
11
|
+
const transport = new StdioServerTransport(stdin, stdout);
|
|
12
|
+
let closing = false;
|
|
13
|
+
const closeOnce = () => {
|
|
14
|
+
if (closing)
|
|
15
|
+
return;
|
|
16
|
+
closing = true;
|
|
17
|
+
void server.close().catch(() => { });
|
|
18
|
+
};
|
|
19
|
+
await new Promise((resolve, reject) => {
|
|
20
|
+
const onSignal = () => closeOnce();
|
|
21
|
+
const cleanup = () => {
|
|
22
|
+
stdin.removeListener('end', closeOnce);
|
|
23
|
+
stdin.removeListener('close', closeOnce);
|
|
24
|
+
process.removeListener('SIGINT', onSignal);
|
|
25
|
+
process.removeListener('SIGTERM', onSignal);
|
|
26
|
+
};
|
|
27
|
+
server.onclose = () => {
|
|
28
|
+
cleanup();
|
|
29
|
+
resolve();
|
|
30
|
+
};
|
|
31
|
+
stdin.once('end', closeOnce);
|
|
32
|
+
stdin.once('close', closeOnce);
|
|
33
|
+
process.once('SIGINT', onSignal);
|
|
34
|
+
process.once('SIGTERM', onSignal);
|
|
35
|
+
void server.connect(transport).catch((error) => {
|
|
36
|
+
cleanup();
|
|
37
|
+
reject(error);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/features/mcp/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAA+B,MAAM,YAAY,CAAC;AAOtF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA6B;IAC/D,MAAM,MAAM,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAChD,M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AAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { type FetchFn } from '../../task-cli/http.ts';
|
|
3
|
+
export declare const MCP_SERVER_NAME = "squawk";
|
|
4
|
+
export declare const MCP_SERVER_INSTRUCTIONS: string;
|
|
5
|
+
export interface OrchestratorMcpOptions {
|
|
6
|
+
origin: string;
|
|
7
|
+
version?: string | undefined;
|
|
8
|
+
fetch?: FetchFn | undefined;
|
|
9
|
+
pollMs?: number | undefined;
|
|
10
|
+
heartbeatMs?: number | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare function formatMcpToolError(error: unknown): {
|
|
13
|
+
isError: true;
|
|
14
|
+
content: [{
|
|
15
|
+
type: 'text';
|
|
16
|
+
text: string;
|
|
17
|
+
}];
|
|
18
|
+
};
|
|
19
|
+
export declare function createOrchestratorMcpServer(options: OrchestratorMcpOptions): Server;
|