@hearsay-tools/squawk 0.18.0-dev.8591 → 0.18.0-dev.8610
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/activity-routes.d.ts +23 -23
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/projects-routes.d.ts +45 -45
- package/dist/server/providers-routes.d.ts +57 -57
- package/dist/server/repo-routes.d.ts +34 -34
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +47 -47
- package/dist/server/server.d.ts +1596 -1596
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/server/workspace-routes.d.ts +84 -84
- 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,6 +27,18 @@ 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
|
+
} | {
|
|
30
42
|
output: {
|
|
31
43
|
workers: {
|
|
32
44
|
workerId: string;
|
|
@@ -79,18 +91,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
79
91
|
offset?: string | undefined;
|
|
80
92
|
};
|
|
81
93
|
};
|
|
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,6 +677,18 @@ 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
|
+
} | {
|
|
680
692
|
output: {
|
|
681
693
|
workerId: string;
|
|
682
694
|
settled: boolean;
|
|
@@ -801,7 +813,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
801
813
|
workerId: string;
|
|
802
814
|
};
|
|
803
815
|
};
|
|
804
|
-
}
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
} & {
|
|
819
|
+
"/:workerId/collect": {
|
|
820
|
+
$post: {
|
|
805
821
|
output: {
|
|
806
822
|
error: string;
|
|
807
823
|
code?: "invalid_input" | undefined;
|
|
@@ -812,12 +828,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
812
828
|
param: {
|
|
813
829
|
workerId: string;
|
|
814
830
|
};
|
|
831
|
+
} & {
|
|
832
|
+
json: Record<string, never>;
|
|
815
833
|
};
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
} & {
|
|
819
|
-
"/:workerId/collect": {
|
|
820
|
-
$post: {
|
|
834
|
+
} | {
|
|
821
835
|
output: {
|
|
822
836
|
workerId: string;
|
|
823
837
|
parentRunId: string;
|
|
@@ -940,7 +954,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
940
954
|
} & {
|
|
941
955
|
json: Record<string, never>;
|
|
942
956
|
};
|
|
943
|
-
}
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
} & {
|
|
960
|
+
"/:workerId/steer": {
|
|
961
|
+
$post: {
|
|
944
962
|
output: {
|
|
945
963
|
error: string;
|
|
946
964
|
code?: "invalid_input" | undefined;
|
|
@@ -952,13 +970,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
952
970
|
workerId: string;
|
|
953
971
|
};
|
|
954
972
|
} & {
|
|
955
|
-
json:
|
|
973
|
+
json: {
|
|
974
|
+
text: string;
|
|
975
|
+
};
|
|
956
976
|
};
|
|
957
|
-
}
|
|
958
|
-
};
|
|
959
|
-
} & {
|
|
960
|
-
"/:workerId/steer": {
|
|
961
|
-
$post: {
|
|
977
|
+
} | {
|
|
962
978
|
output: {
|
|
963
979
|
workerId: string;
|
|
964
980
|
state: "delivered" | "queued";
|
|
@@ -974,7 +990,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
974
990
|
text: string;
|
|
975
991
|
};
|
|
976
992
|
};
|
|
977
|
-
}
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
} & {
|
|
996
|
+
"/:workerId/stop": {
|
|
997
|
+
$post: {
|
|
978
998
|
output: {
|
|
979
999
|
error: string;
|
|
980
1000
|
code?: "invalid_input" | undefined;
|
|
@@ -986,15 +1006,9 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
986
1006
|
workerId: string;
|
|
987
1007
|
};
|
|
988
1008
|
} & {
|
|
989
|
-
json:
|
|
990
|
-
text: string;
|
|
991
|
-
};
|
|
1009
|
+
json: Record<string, never>;
|
|
992
1010
|
};
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
} & {
|
|
996
|
-
"/:workerId/stop": {
|
|
997
|
-
$post: {
|
|
1011
|
+
} | {
|
|
998
1012
|
output: {
|
|
999
1013
|
workerId: string;
|
|
1000
1014
|
state: "stopping" | "terminated";
|
|
@@ -1008,7 +1022,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1008
1022
|
} & {
|
|
1009
1023
|
json: Record<string, never>;
|
|
1010
1024
|
};
|
|
1011
|
-
}
|
|
1025
|
+
};
|
|
1026
|
+
};
|
|
1027
|
+
} & {
|
|
1028
|
+
"/:workerId/destroy": {
|
|
1029
|
+
$post: {
|
|
1012
1030
|
output: {
|
|
1013
1031
|
error: string;
|
|
1014
1032
|
code?: "invalid_input" | undefined;
|
|
@@ -1020,13 +1038,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1020
1038
|
workerId: string;
|
|
1021
1039
|
};
|
|
1022
1040
|
} & {
|
|
1023
|
-
json:
|
|
1041
|
+
json: {
|
|
1042
|
+
discardWork?: true | undefined;
|
|
1043
|
+
};
|
|
1024
1044
|
};
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
} & {
|
|
1028
|
-
"/:workerId/destroy": {
|
|
1029
|
-
$post: {
|
|
1045
|
+
} | {
|
|
1030
1046
|
output: {
|
|
1031
1047
|
workerId: string;
|
|
1032
1048
|
state: "complete" | "incomplete";
|
|
@@ -1055,22 +1071,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1055
1071
|
discardWork?: true | undefined;
|
|
1056
1072
|
};
|
|
1057
1073
|
};
|
|
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,13 +1106,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1106
1106
|
"/:workerId/diff": {
|
|
1107
1107
|
$get: {
|
|
1108
1108
|
output: {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
diff: string;
|
|
1112
|
-
truncated: boolean;
|
|
1109
|
+
error: string;
|
|
1110
|
+
code?: "invalid_input" | undefined;
|
|
1113
1111
|
};
|
|
1114
1112
|
outputFormat: "json";
|
|
1115
|
-
status:
|
|
1113
|
+
status: 400;
|
|
1116
1114
|
input: {
|
|
1117
1115
|
param: {
|
|
1118
1116
|
workerId: string;
|
|
@@ -1120,11 +1118,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1120
1118
|
};
|
|
1121
1119
|
} | {
|
|
1122
1120
|
output: {
|
|
1123
|
-
|
|
1124
|
-
|
|
1121
|
+
workerId: string;
|
|
1122
|
+
baselineSha: string;
|
|
1123
|
+
diff: string;
|
|
1124
|
+
truncated: boolean;
|
|
1125
1125
|
};
|
|
1126
1126
|
outputFormat: "json";
|
|
1127
|
-
status:
|
|
1127
|
+
status: 200;
|
|
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,EAA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,YAAY,EAAE,CAAC,CAAC;QAClG,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,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,O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MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7C,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,KAAK,CAAC,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;
|