@stigmer/mcp-server 3.3.0 → 3.4.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 +60 -13
- package/cli/mcp-server-stigmer.js +5 -1
- package/domains/agentexecutions/approve.d.ts +9 -0
- package/domains/agentexecutions/approve.d.ts.map +1 -0
- package/domains/agentexecutions/approve.js +46 -0
- package/domains/agentexecutions/approve.js.map +1 -0
- package/domains/agentexecutions/fetch.d.ts +28 -0
- package/domains/agentexecutions/fetch.d.ts.map +1 -0
- package/domains/agentexecutions/fetch.js +82 -0
- package/domains/agentexecutions/fetch.js.map +1 -0
- package/domains/agentexecutions/run.d.ts +27 -0
- package/domains/agentexecutions/run.d.ts.map +1 -0
- package/domains/agentexecutions/run.js +87 -0
- package/domains/agentexecutions/run.js.map +1 -0
- package/domains/agentexecutions/tools.d.ts +5 -0
- package/domains/agentexecutions/tools.d.ts.map +1 -0
- package/domains/agentexecutions/tools.js +97 -0
- package/domains/agentexecutions/tools.js.map +1 -0
- package/domains/datastores/apply.d.ts +4 -0
- package/domains/datastores/apply.d.ts.map +1 -0
- package/domains/datastores/apply.js +28 -0
- package/domains/datastores/apply.js.map +1 -0
- package/domains/datastores/delete.d.ts +3 -0
- package/domains/datastores/delete.d.ts.map +1 -0
- package/domains/datastores/delete.js +38 -0
- package/domains/datastores/delete.js.map +1 -0
- package/domains/datastores/fetch.d.ts +3 -0
- package/domains/datastores/fetch.d.ts.map +1 -0
- package/domains/datastores/fetch.js +23 -0
- package/domains/datastores/fetch.js.map +1 -0
- package/domains/datastores/resources.d.ts +5 -0
- package/domains/datastores/resources.d.ts.map +1 -0
- package/domains/datastores/resources.js +16 -0
- package/domains/datastores/resources.js.map +1 -0
- package/domains/datastores/tools.d.ts +5 -0
- package/domains/datastores/tools.d.ts.map +1 -0
- package/domains/datastores/tools.js +46 -0
- package/domains/datastores/tools.js.map +1 -0
- package/domains/environments/apply.d.ts +4 -0
- package/domains/environments/apply.d.ts.map +1 -0
- package/domains/environments/apply.js +30 -0
- package/domains/environments/apply.js.map +1 -0
- package/domains/environments/delete.d.ts +3 -0
- package/domains/environments/delete.d.ts.map +1 -0
- package/domains/environments/delete.js +36 -0
- package/domains/environments/delete.js.map +1 -0
- package/domains/environments/fetch.d.ts +6 -0
- package/domains/environments/fetch.d.ts.map +1 -0
- package/domains/environments/fetch.js +30 -0
- package/domains/environments/fetch.js.map +1 -0
- package/domains/environments/resources.d.ts +5 -0
- package/domains/environments/resources.d.ts.map +1 -0
- package/domains/environments/resources.js +16 -0
- package/domains/environments/resources.js.map +1 -0
- package/domains/environments/tools.d.ts +5 -0
- package/domains/environments/tools.d.ts.map +1 -0
- package/domains/environments/tools.js +51 -0
- package/domains/environments/tools.js.map +1 -0
- package/domains/executions/cancel.d.ts +9 -0
- package/domains/executions/cancel.d.ts.map +1 -0
- package/domains/executions/cancel.js +114 -0
- package/domains/executions/cancel.js.map +1 -0
- package/domains/executions/tools.d.ts +5 -0
- package/domains/executions/tools.d.ts.map +1 -0
- package/domains/executions/tools.js +28 -0
- package/domains/executions/tools.js.map +1 -0
- package/domains/records/tools.d.ts.map +1 -1
- package/domains/records/tools.js +7 -3
- package/domains/records/tools.js.map +1 -1
- package/domains/resourceuri.d.ts.map +1 -1
- package/domains/resourceuri.js +2 -0
- package/domains/resourceuri.js.map +1 -1
- package/domains/search/tools.d.ts.map +1 -1
- package/domains/search/tools.js +10 -7
- package/domains/search/tools.js.map +1 -1
- package/domains/skills/tools.d.ts.map +1 -1
- package/domains/skills/tools.js +25 -1
- package/domains/skills/tools.js.map +1 -1
- package/domains/skills/versions.d.ts +9 -0
- package/domains/skills/versions.d.ts.map +1 -0
- package/domains/skills/versions.js +31 -0
- package/domains/skills/versions.js.map +1 -0
- package/domains/workflowexecutions/approvals.d.ts +17 -0
- package/domains/workflowexecutions/approvals.d.ts.map +1 -0
- package/domains/workflowexecutions/approvals.js +61 -0
- package/domains/workflowexecutions/approvals.js.map +1 -0
- package/domains/workflowexecutions/run.d.ts +12 -0
- package/domains/workflowexecutions/run.d.ts.map +1 -0
- package/domains/workflowexecutions/run.js +69 -0
- package/domains/workflowexecutions/run.js.map +1 -0
- package/domains/workflowexecutions/tools.d.ts.map +1 -1
- package/domains/workflowexecutions/tools.js +89 -6
- package/domains/workflowexecutions/tools.js.map +1 -1
- package/domains/workflows/tools.d.ts.map +1 -1
- package/domains/workflows/tools.js +69 -5
- package/domains/workflows/tools.js.map +1 -1
- package/domains/workflows/versions.d.ts +29 -0
- package/domains/workflows/versions.d.ts.map +1 -0
- package/domains/workflows/versions.js +99 -0
- package/domains/workflows/versions.js.map +1 -0
- package/gen/datastore.d.ts +861 -0
- package/gen/datastore.d.ts.map +1 -0
- package/gen/datastore.js +267 -0
- package/gen/datastore.js.map +1 -0
- package/gen/environment.d.ts +77 -0
- package/gen/environment.d.ts.map +1 -0
- package/gen/environment.js +62 -0
- package/gen/environment.js.map +1 -0
- package/package.json +3 -3
- package/server.d.ts.map +1 -1
- package/server.js +12 -0
- package/server.js.map +1 -1
- package/src/domains/agentexecutions/approve.ts +67 -0
- package/src/domains/agentexecutions/fetch.ts +112 -0
- package/src/domains/agentexecutions/run.ts +112 -0
- package/src/domains/agentexecutions/tools.ts +139 -0
- package/src/domains/apply.integration.test.ts +82 -6
- package/src/domains/datastores/apply.ts +33 -0
- package/src/domains/datastores/delete.ts +47 -0
- package/src/domains/datastores/fetch.ts +32 -0
- package/src/domains/datastores/resources.ts +21 -0
- package/src/domains/datastores/tools.ts +76 -0
- package/src/domains/deletes.integration.test.ts +49 -2
- package/src/domains/environments/apply.ts +40 -0
- package/src/domains/environments/delete.ts +45 -0
- package/src/domains/environments/fetch.ts +39 -0
- package/src/domains/environments/resources.ts +21 -0
- package/src/domains/environments/tools.ts +81 -0
- package/src/domains/executions/cancel.ts +148 -0
- package/src/domains/executions/tools.ts +45 -0
- package/src/domains/executions.integration.test.ts +376 -0
- package/src/domains/reads.integration.test.ts +51 -5
- package/src/domains/records/tools.ts +7 -3
- package/src/domains/resources.integration.test.ts +38 -2
- package/src/domains/resourceuri.test.ts +11 -2
- package/src/domains/resourceuri.ts +2 -0
- package/src/domains/search/search.integration.test.ts +18 -2
- package/src/domains/search/tools.ts +12 -7
- package/src/domains/skills/tools.ts +34 -1
- package/src/domains/skills/versions.ts +47 -0
- package/src/domains/versions.integration.test.ts +212 -0
- package/src/domains/workflowexecutions/approvals.ts +102 -0
- package/src/domains/workflowexecutions/run.ts +87 -0
- package/src/domains/workflowexecutions/tools.ts +120 -6
- package/src/domains/workflows/tools.ts +90 -7
- package/src/domains/workflows/versions.ts +147 -0
- package/src/gen/datastore.ts +264 -0
- package/src/gen/environment.ts +66 -0
- package/src/server.ts +12 -0
package/domains/search/tools.js
CHANGED
|
@@ -16,12 +16,15 @@ import { buildResourceURI } from "../resourceuri.js";
|
|
|
16
16
|
import { rpcError } from "../rpcerr.js";
|
|
17
17
|
import { textOrError } from "../toolresult.js";
|
|
18
18
|
/**
|
|
19
|
-
* The searchable kinds and their proto enum values.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* The searchable kinds and their proto enum values. Deliberately a curated
|
|
20
|
+
* subset (not every ApiResourceKind): the kinds an MCP client can also read
|
|
21
|
+
* and manage through tools. The backend's extractor registry supports more
|
|
22
|
+
* (sessions, executions, ...) — add here only alongside a tool surface.
|
|
22
23
|
*/
|
|
23
24
|
const knownKinds = {
|
|
24
25
|
agent: ApiResourceKind.agent,
|
|
26
|
+
datastore: ApiResourceKind.datastore,
|
|
27
|
+
environment: ApiResourceKind.environment,
|
|
25
28
|
skill: ApiResourceKind.skill,
|
|
26
29
|
mcp_server: ApiResourceKind.mcp_server,
|
|
27
30
|
workflow: ApiResourceKind.workflow,
|
|
@@ -29,14 +32,14 @@ const knownKinds = {
|
|
|
29
32
|
/** Register the search tool; returns the registered tool names. */
|
|
30
33
|
export function registerSearchTools(server, target) {
|
|
31
34
|
server.registerTool("search", {
|
|
32
|
-
description: "Search and list Stigmer resources (agents, skills, MCP servers, workflows
|
|
33
|
-
"Set 'kinds' to filter by resource type. Set 'query' for full-text search. " +
|
|
35
|
+
description: "Search and list Stigmer resources (agents, skills, MCP servers, workflows, environments, " +
|
|
36
|
+
"datastores). Set 'kinds' to filter by resource type. Set 'query' for full-text search. " +
|
|
34
37
|
"Set 'org' to scope to an organization. Omit 'query' to list all accessible resources.",
|
|
35
38
|
inputSchema: {
|
|
36
39
|
kinds: z
|
|
37
40
|
.array(z.string())
|
|
38
41
|
.optional()
|
|
39
|
-
.describe("Resource kinds to search. Valid: agent, skill, mcp_server, workflow. Empty searches all."),
|
|
42
|
+
.describe("Resource kinds to search. Valid: agent, skill, mcp_server, workflow, environment, datastore. Empty searches all."),
|
|
40
43
|
query: z
|
|
41
44
|
.string()
|
|
42
45
|
.optional()
|
|
@@ -95,7 +98,7 @@ function parseKinds(raw) {
|
|
|
95
98
|
return raw.map((s) => {
|
|
96
99
|
const kind = knownKinds[s];
|
|
97
100
|
if (kind === undefined) {
|
|
98
|
-
throw new Error(`unknown resource kind "${s}"; valid kinds: agent, skill, mcp_server, workflow`);
|
|
101
|
+
throw new Error(`unknown resource kind "${s}"; valid kinds: agent, skill, mcp_server, workflow, environment, datastore`);
|
|
99
102
|
}
|
|
100
103
|
return kind;
|
|
101
104
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/domains/search/tools.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,0DAA0D;AAC1D,EAAE;AACF,iFAAiF;AACjF,8EAA8E;AAC9E,0EAA0E;AAC1E,0DAA0D;AAE1D,OAAO,EAAE,MAAM,EAAyB,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,EAGL,oBAAoB,GACrB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,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AC,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;YACf,OAAO,CAAC,CAAC,CAAE,CAAC,YAAY,GAAG,GAAG,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/domains/skills/tools.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/domains/skills/tools.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAMhE,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAkFrF"}
|
package/domains/skills/tools.js
CHANGED
|
@@ -9,6 +9,7 @@ import { resolveToken } from "../client.js";
|
|
|
9
9
|
import { textOrError } from "../toolresult.js";
|
|
10
10
|
import { deleteSkill } from "./delete.js";
|
|
11
11
|
import { fetchSkill } from "./fetch.js";
|
|
12
|
+
import { listSkillVersions } from "./versions.js";
|
|
12
13
|
/** Register every Skill-domain tool; returns the registered tool names. */
|
|
13
14
|
export function registerSkillTools(server, target) {
|
|
14
15
|
server.registerTool("get_skill", {
|
|
@@ -34,6 +35,29 @@ export function registerSkillTools(server, target) {
|
|
|
34
35
|
.describe("Skill slug — the unique identifier within the org (e.g. code-review-best-practices). Deletes the skill and all its versions."),
|
|
35
36
|
},
|
|
36
37
|
}, (args, extra) => textOrError(() => deleteSkill(target.serverAddress, resolveToken(extra, target.apiKey), args.org, args.slug)));
|
|
37
|
-
|
|
38
|
+
server.registerTool("list_skill_versions", {
|
|
39
|
+
description: "List a skill's version history (newest first): version hash, tag, who pushed it and " +
|
|
40
|
+
"when, and which version is current. Fetch one version's full content with get_skill and " +
|
|
41
|
+
"its hash or tag.",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
org: z.string().describe("Organization slug that owns the skill."),
|
|
44
|
+
slug: z.string().describe("Skill slug — unique identifier within the org."),
|
|
45
|
+
page_size: z
|
|
46
|
+
.number()
|
|
47
|
+
.int()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Maximum versions per page (default 50)."),
|
|
50
|
+
page_token: z
|
|
51
|
+
.string()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("Pagination token from a previous response's next_page_token."),
|
|
54
|
+
},
|
|
55
|
+
}, (args, extra) => textOrError(() => listSkillVersions(target.serverAddress, resolveToken(extra, target.apiKey), {
|
|
56
|
+
org: args.org,
|
|
57
|
+
slug: args.slug,
|
|
58
|
+
pageSize: args.page_size,
|
|
59
|
+
pageToken: args.page_token,
|
|
60
|
+
})));
|
|
61
|
+
return ["get_skill", "delete_skill", "list_skill_versions"];
|
|
38
62
|
}
|
|
39
63
|
//# sourceMappingURL=tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/domains/skills/tools.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,0DAA0D;AAC1D,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,6CAA6C;AAG7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAsB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAA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B,SAAS,EAAE,IAAI,CAAC,UAAU;KAC3B,CAAC,CACH,CACJ,CAAC;IAEF,OAAO,CAAC,WAAW,EAAE,cAAc,EAAE,qBAAqB,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ListSkillVersionsArgs {
|
|
2
|
+
readonly org: string;
|
|
3
|
+
readonly slug: string;
|
|
4
|
+
readonly pageSize?: number;
|
|
5
|
+
readonly pageToken?: string;
|
|
6
|
+
}
|
|
7
|
+
/** List a skill's version history (newest first) as protojson. */
|
|
8
|
+
export declare function listSkillVersions(serverAddress: string, token: string, args: ListSkillVersionsArgs): Promise<string>;
|
|
9
|
+
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../src/domains/skills/versions.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,kEAAkE;AAClE,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAkBjB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Skill version-timeline path (SkillQueryController.listVersions). Each push
|
|
2
|
+
// creates an immutable version identified by the artifact's SHA-256 hash;
|
|
3
|
+
// entries carry hash, tag, push audit, and provenance (no artifact content, so
|
|
4
|
+
// no projection is needed — unlike the workflow timeline).
|
|
5
|
+
import { ListSkillVersionsResponseSchema, } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/io_pb";
|
|
6
|
+
import { SkillQueryController } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/query_pb";
|
|
7
|
+
import { withClient } from "../client.js";
|
|
8
|
+
import { toProtoJson } from "../marshal.js";
|
|
9
|
+
import { rpcError } from "../rpcerr.js";
|
|
10
|
+
/** List a skill's version history (newest first) as protojson. */
|
|
11
|
+
export async function listSkillVersions(serverAddress, token, args) {
|
|
12
|
+
return withClient(SkillQueryController, serverAddress, token, async (client, callOptions) => {
|
|
13
|
+
const req = {
|
|
14
|
+
org: args.org,
|
|
15
|
+
slug: args.slug,
|
|
16
|
+
pageToken: args.pageToken ?? "",
|
|
17
|
+
};
|
|
18
|
+
// Forward page_size only when set, letting the server apply its default.
|
|
19
|
+
if ((args.pageSize ?? 0) > 0) {
|
|
20
|
+
req.pageSize = args.pageSize;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const resp = await client.listVersions(req, callOptions);
|
|
24
|
+
return toProtoJson(ListSkillVersionsResponseSchema, resp);
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
throw rpcError(err, `versions of skill "${args.slug}" in org "${args.org}"`);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../src/domains/skills/versions.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,+EAA+E;AAC/E,2DAA2D;AAG3D,OAAO,EAEL,+BAA+B,GAChC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AASxC,kEAAkE;AAClE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,aAAqB,EACrB,KAAa,EACb,IAA2B;IAE3B,OAAO,UAAU,CAAC,oBAAoB,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE;QAC1F,MAAM,GAAG,GAA0D;YACjE,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;SAChC,CAAC;QACF,yEAAyE;QACzE,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YACzD,OAAO,WAAW,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,QAAQ,CAAC,GAAG,EAAE,sBAAsB,IAAI,CAAC,IAAI,aAAa,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ListPendingApprovalsArgs {
|
|
2
|
+
readonly org: string;
|
|
3
|
+
readonly pageSize?: number;
|
|
4
|
+
readonly pageToken?: string;
|
|
5
|
+
}
|
|
6
|
+
/** List human_input tasks awaiting a reviewer decision across an org. */
|
|
7
|
+
export declare function listPendingApprovals(serverAddress: string, token: string, args: ListPendingApprovalsArgs): Promise<string>;
|
|
8
|
+
export interface SubmitWorkflowTaskApprovalArgs {
|
|
9
|
+
readonly executionId: string;
|
|
10
|
+
readonly taskName: string;
|
|
11
|
+
readonly outcome: string;
|
|
12
|
+
readonly comment?: string;
|
|
13
|
+
readonly formData?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
/** Submit a reviewer decision for a waiting human_input task. */
|
|
16
|
+
export declare function submitWorkflowTaskApproval(serverAddress: string, token: string, args: SubmitWorkflowTaskApprovalArgs): Promise<string>;
|
|
17
|
+
//# sourceMappingURL=approvals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../../src/domains/workflowexecutions/approvals.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,yEAAyE;AACzE,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAsBjB;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C;AAED,iEAAiE;AACjE,wBAAsB,0BAA0B,CAC9C,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,8BAA8B,GACnC,OAAO,CAAC,MAAM,CAAC,CA2BjB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Workflow-execution approval paths: the org-wide pending-approvals inbox
|
|
2
|
+
// (listPendingApprovals) and the reviewer decision for a human_input task
|
|
3
|
+
// (submitWorkflowTaskApproval).
|
|
4
|
+
//
|
|
5
|
+
// listPendingApprovals is org-scoped by contract (io.proto), not
|
|
6
|
+
// execution-scoped — it answers "what is waiting on a human right now"
|
|
7
|
+
// across the org. Each entry carries everything a decision needs: the
|
|
8
|
+
// execution ID, task name, requester, timeout, and the form schema when the
|
|
9
|
+
// task defines one. Agent-execution approvals are a different surface
|
|
10
|
+
// entirely (embedded in get_agent_execution status; see
|
|
11
|
+
// agentexecutions/approve.ts).
|
|
12
|
+
import { WorkflowExecutionSchema } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
|
|
13
|
+
import { WorkflowExecutionCommandController } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/command_pb";
|
|
14
|
+
import { PendingApprovalsListSchema, } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/io_pb";
|
|
15
|
+
import { WorkflowExecutionQueryController } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/query_pb";
|
|
16
|
+
import { withClient } from "../client.js";
|
|
17
|
+
import { toProtoJson } from "../marshal.js";
|
|
18
|
+
import { rpcError } from "../rpcerr.js";
|
|
19
|
+
/** List human_input tasks awaiting a reviewer decision across an org. */
|
|
20
|
+
export async function listPendingApprovals(serverAddress, token, args) {
|
|
21
|
+
return withClient(WorkflowExecutionQueryController, serverAddress, token, async (client, callOptions) => {
|
|
22
|
+
const req = {
|
|
23
|
+
org: args.org,
|
|
24
|
+
pageToken: args.pageToken ?? "",
|
|
25
|
+
};
|
|
26
|
+
// Forward page_size only when set, letting the server apply its default.
|
|
27
|
+
if ((args.pageSize ?? 0) > 0) {
|
|
28
|
+
req.pageSize = args.pageSize;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const resp = await client.listPendingApprovals(req, callOptions);
|
|
32
|
+
return toProtoJson(PendingApprovalsListSchema, resp);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
throw rpcError(err, `pending approvals in org "${args.org}"`);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** Submit a reviewer decision for a waiting human_input task. */
|
|
40
|
+
export async function submitWorkflowTaskApproval(serverAddress, token, args) {
|
|
41
|
+
return withClient(WorkflowExecutionCommandController, serverAddress, token, async (client, callOptions) => {
|
|
42
|
+
const req = {
|
|
43
|
+
executionId: args.executionId,
|
|
44
|
+
taskName: args.taskName,
|
|
45
|
+
outcome: args.outcome,
|
|
46
|
+
comment: args.comment ?? "",
|
|
47
|
+
};
|
|
48
|
+
if (args.formData !== undefined) {
|
|
49
|
+
// google.protobuf.Struct fields are plain JSON objects in protobuf-es v2.
|
|
50
|
+
req.formData = args.formData;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const execution = await client.submitWorkflowTaskApproval(req, callOptions);
|
|
54
|
+
return toProtoJson(WorkflowExecutionSchema, execution);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
throw rpcError(err, `approval for task "${args.taskName}" in workflow execution "${args.executionId}"`);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=approvals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvals.js","sourceRoot":"","sources":["../../../src/domains/workflowexecutions/approvals.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0EAA0E;AAC1E,gCAAgC;AAChC,EAAE;AACF,iEAAiE;AACjE,uEAAuE;AACvE,sEAAsE;AACtE,4EAA4E;AAC5E,sEAAsE;AACtE,wDAAwD;AACxD,+BAA+B;AAG/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gEAAgE,CAAC;AACzG,OAAO,EAAE,kCAAkC,EAAE,MAAM,oEAAoE,CAAC;AACxH,OAAO,EAEL,0BAA0B,GAE3B,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kEAAkE,CAAC;AAEpH,OAAO,EAAE,U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YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;SAC5B,CAAC;QACF,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,0EAA0E;YAC1E,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAsB,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YAC5E,OAAO,WAAW,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,QAAQ,CACZ,GAAG,EACH,sBAAsB,IAAI,CAAC,QAAQ,4BAA4B,IAAI,CAAC,WAAW,GAAG,CACnF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface RunWorkflowArgs {
|
|
2
|
+
readonly org: string;
|
|
3
|
+
readonly workflow: string;
|
|
4
|
+
readonly message?: string;
|
|
5
|
+
readonly runtimeEnv?: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Start a workflow execution: resolve org/slug → workflow ID, then create the
|
|
9
|
+
* execution. Returns the created execution as protojson.
|
|
10
|
+
*/
|
|
11
|
+
export declare function runWorkflow(serverAddress: string, token: string, args: RunWorkflowArgs): Promise<string>;
|
|
12
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/domains/workflowexecutions/run.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,MAAM,CAAC,CA6CjB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Workflow-execution start path for the run_workflow tool.
|
|
2
|
+
//
|
|
3
|
+
// Mirrors the CLI's workflow run branch (client-apps/cli/src/commands/run.ts +
|
|
4
|
+
// resources/run/create.ts): resolve the org/slug reference to the workflow ID,
|
|
5
|
+
// then create the execution. Asynchronous like run_agent — the tool returns
|
|
6
|
+
// the created execution (wex_* ID) and observation happens through the
|
|
7
|
+
// existing get_workflow_execution / get_workflow_execution_events tools.
|
|
8
|
+
import { createClient } from "@connectrpc/connect";
|
|
9
|
+
import { create as createMessage } from "@bufbuild/protobuf";
|
|
10
|
+
import { WorkflowQueryController } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/query_pb";
|
|
11
|
+
import { WorkflowExecutionSchema } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
|
|
12
|
+
import { WorkflowExecutionCommandController } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/command_pb";
|
|
13
|
+
import { WorkflowExecutionSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/spec_pb";
|
|
14
|
+
import { ExecutionValueSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
|
|
15
|
+
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
16
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
17
|
+
import { executionName, toExecutionValues } from "../agentexecutions/run.js";
|
|
18
|
+
import { withTransport } from "../client.js";
|
|
19
|
+
import { toProtoJson } from "../marshal.js";
|
|
20
|
+
import { rpcError } from "../rpcerr.js";
|
|
21
|
+
/** apiVersion stamped on created executions; mirrors the CLI's run stack. */
|
|
22
|
+
const API_VERSION = "agentic.stigmer.ai/v1";
|
|
23
|
+
/**
|
|
24
|
+
* Start a workflow execution: resolve org/slug → workflow ID, then create the
|
|
25
|
+
* execution. Returns the created execution as protojson.
|
|
26
|
+
*/
|
|
27
|
+
export async function runWorkflow(serverAddress, token, args) {
|
|
28
|
+
const desc = `workflow "${args.workflow}" in org "${args.org}"`;
|
|
29
|
+
return withTransport(serverAddress, token, async (transport, callOptions) => {
|
|
30
|
+
const query = createClient(WorkflowQueryController, transport);
|
|
31
|
+
let workflowId;
|
|
32
|
+
try {
|
|
33
|
+
const workflow = await query.getByReference({ org: args.org, kind: ApiResourceKind.workflow, slug: args.workflow }, callOptions);
|
|
34
|
+
workflowId = workflow.metadata?.id ?? "";
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
throw rpcError(err, desc);
|
|
38
|
+
}
|
|
39
|
+
// Workflow tasks resolve their org through the runtime env; the CLI
|
|
40
|
+
// injects STIGMER_ORG_ID the same way, so a caller-supplied value wins.
|
|
41
|
+
const runtimeEnv = toExecutionValues(args.runtimeEnv);
|
|
42
|
+
if (runtimeEnv.STIGMER_ORG_ID === undefined) {
|
|
43
|
+
runtimeEnv.STIGMER_ORG_ID = createMessage(ExecutionValueSchema, {
|
|
44
|
+
value: args.org,
|
|
45
|
+
isSecret: false,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const execution = createMessage(WorkflowExecutionSchema, {
|
|
49
|
+
apiVersion: API_VERSION,
|
|
50
|
+
kind: "WorkflowExecution",
|
|
51
|
+
metadata: createMessage(ApiResourceMetadataSchema, { name: executionName(), org: args.org }),
|
|
52
|
+
spec: createMessage(WorkflowExecutionSpecSchema, {
|
|
53
|
+
workflowId,
|
|
54
|
+
// Empty message means "just run" — the CLI applies the same default.
|
|
55
|
+
triggerMessage: (args.message ?? "") === "" ? "execute" : args.message,
|
|
56
|
+
runtimeEnv,
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
const command = createClient(WorkflowExecutionCommandController, transport);
|
|
60
|
+
try {
|
|
61
|
+
const created = await command.create(execution, callOptions);
|
|
62
|
+
return toProtoJson(WorkflowExecutionSchema, created);
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
throw rpcError(err, `execution of ${desc}`);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/domains/workflowexecutions/run.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,uEAAuE;AACvE,yEAAyE;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,gEAAgE,CAAC;AACzG,OAAO,EAAE,kCAAkC,EAAE,MAAM,oEAAoE,CAAC;AACxH,OAAO,EAAE,2BAA2B,EAAE,MAAM,iEAAiE,CAAC;AAC9G,OAAO,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAC;AACtG,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAEtH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,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AuB,EAAE;YACvD,UAAU,EAAE,WAAW;YACvB,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,aAAa,CAAC,yBAAyB,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;YAC5F,IAAI,EAAE,aAAa,CAAC,2BAA2B,EAAE;gBAC/C,UAAU;gBACV,qEAAqE;gBACrE,cAAc,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO;gBACtE,UAAU;aACX,CAAC;SACH,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,YAAY,CAAC,kCAAkC,EAAE,SAAS,CAAC,CAAC;QAC5E,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YAC7D,OAAO,WAAW,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,QAAQ,CAAC,GAAG,EAAE,gBAAgB,IAAI,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/domains/workflowexecutions/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/domains/workflowexecutions/tools.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASzE,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAO5E,gFAAgF;AAChF,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CA8JjG"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
// MCP tools for
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// MCP tools for the WorkflowExecution domain: start a run (run_workflow),
|
|
2
|
+
// observe it (get_workflow_execution, get_workflow_execution_events — backed
|
|
3
|
+
// by WorkflowExecutionQueryController.get/getEventLog), and answer its
|
|
4
|
+
// human_input tasks (list_pending_approvals, submit_workflow_task_approval).
|
|
5
|
+
// The observation tools predate the rest and their names/descriptions are
|
|
6
|
+
// part of the original Go-parity contract
|
|
7
|
+
// (mcp-server/internal/domains/workflowexecutions/tools.go).
|
|
6
8
|
import { WorkflowExecutionSchema } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
|
|
7
9
|
import { GetEventLogResponseSchema, } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/io_pb";
|
|
8
10
|
import { WorkflowExecutionQueryController } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/query_pb";
|
|
@@ -11,8 +13,35 @@ import { resolveToken, withClient } from "../client.js";
|
|
|
11
13
|
import { toProtoJson } from "../marshal.js";
|
|
12
14
|
import { rpcError } from "../rpcerr.js";
|
|
13
15
|
import { textOrError } from "../toolresult.js";
|
|
16
|
+
import { listPendingApprovals, submitWorkflowTaskApproval } from "./approvals.js";
|
|
17
|
+
import { runWorkflow } from "./run.js";
|
|
14
18
|
/** Register the workflow-execution tools; returns the registered tool names. */
|
|
15
19
|
export function registerWorkflowExecutionTools(server, target) {
|
|
20
|
+
server.registerTool("run_workflow", {
|
|
21
|
+
description: "Start a workflow execution (asynchronous). Returns immediately with the created execution " +
|
|
22
|
+
"(wex_* ID) while the run continues in the background — poll get_workflow_execution and " +
|
|
23
|
+
"get_workflow_execution_events to observe progress and diagnose failures.",
|
|
24
|
+
inputSchema: {
|
|
25
|
+
org: z.string().describe("Organization slug that owns the workflow (e.g. stigmer)."),
|
|
26
|
+
workflow: z
|
|
27
|
+
.string()
|
|
28
|
+
.describe("Workflow slug — the unique identifier within the org (e.g. release-notes)."),
|
|
29
|
+
message: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Trigger message passed to the workflow. Omit to run with the default trigger."),
|
|
33
|
+
runtime_env: z
|
|
34
|
+
.record(z.string())
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Non-secret runtime environment values (name → value) injected into the run. " +
|
|
37
|
+
"Secrets must come from Environments referenced by the workflow, never through this tool."),
|
|
38
|
+
},
|
|
39
|
+
}, (args, extra) => textOrError(() => runWorkflow(target.serverAddress, resolveToken(extra, target.apiKey), {
|
|
40
|
+
org: args.org,
|
|
41
|
+
workflow: args.workflow,
|
|
42
|
+
message: args.message,
|
|
43
|
+
runtimeEnv: args.runtime_env,
|
|
44
|
+
})));
|
|
16
45
|
server.registerTool("get_workflow_execution", {
|
|
17
46
|
description: "Get a workflow execution's full status including phase, tasks, errors, cost, and timing. Use for diagnosing failed or running executions.",
|
|
18
47
|
inputSchema: {
|
|
@@ -37,7 +66,61 @@ export function registerWorkflowExecutionTools(server, target) {
|
|
|
37
66
|
taskName: args.task_name,
|
|
38
67
|
pageSize: args.page_size,
|
|
39
68
|
})));
|
|
40
|
-
|
|
69
|
+
server.registerTool("list_pending_approvals", {
|
|
70
|
+
description: "List workflow tasks waiting for a human decision across an organization — an approvals " +
|
|
71
|
+
"inbox. Each entry carries the execution ID, task name, requester, timeout, and the form " +
|
|
72
|
+
"schema when the task defines one; respond with submit_workflow_task_approval. " +
|
|
73
|
+
"(Agent-execution approvals are not listed here — they surface in get_agent_execution's " +
|
|
74
|
+
"status.pending_approvals.)",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
org: z.string().describe("Organization slug to scope the query (e.g. stigmer)."),
|
|
77
|
+
page_size: z
|
|
78
|
+
.number()
|
|
79
|
+
.int()
|
|
80
|
+
.optional()
|
|
81
|
+
.describe("Maximum entries per page (default 20, max 100)."),
|
|
82
|
+
page_token: z
|
|
83
|
+
.string()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe("Pagination token from a previous response's next_page_token."),
|
|
86
|
+
},
|
|
87
|
+
}, (args, extra) => textOrError(() => listPendingApprovals(target.serverAddress, resolveToken(extra, target.apiKey), {
|
|
88
|
+
org: args.org,
|
|
89
|
+
pageSize: args.page_size,
|
|
90
|
+
pageToken: args.page_token,
|
|
91
|
+
})));
|
|
92
|
+
server.registerTool("submit_workflow_task_approval", {
|
|
93
|
+
description: "Submit a reviewer decision for a workflow human_input task that is waiting for a signal. " +
|
|
94
|
+
"outcome must match one of the task's configured outcome names (default: approve or deny). " +
|
|
95
|
+
"When the task defines a form_schema (see list_pending_approvals), provide matching " +
|
|
96
|
+
"form_data. Returns the updated workflow execution.",
|
|
97
|
+
inputSchema: {
|
|
98
|
+
execution_id: z.string().describe("Workflow execution ID (wex_* format)."),
|
|
99
|
+
task_name: z.string().describe("Name of the waiting human_input task."),
|
|
100
|
+
outcome: z
|
|
101
|
+
.string()
|
|
102
|
+
.describe("Decision outcome. Must match a configured outcome name of the task " +
|
|
103
|
+
"(e.g. approve, deny, needs_revision); approve/deny when none are configured."),
|
|
104
|
+
comment: z.string().optional().describe("Reviewer comment, stored in the audit trail."),
|
|
105
|
+
form_data: z
|
|
106
|
+
.record(z.unknown())
|
|
107
|
+
.optional()
|
|
108
|
+
.describe("Response form data conforming to the task's form_schema, when it defines one."),
|
|
109
|
+
},
|
|
110
|
+
}, (args, extra) => textOrError(() => submitWorkflowTaskApproval(target.serverAddress, resolveToken(extra, target.apiKey), {
|
|
111
|
+
executionId: args.execution_id,
|
|
112
|
+
taskName: args.task_name,
|
|
113
|
+
outcome: args.outcome,
|
|
114
|
+
comment: args.comment,
|
|
115
|
+
formData: args.form_data,
|
|
116
|
+
})));
|
|
117
|
+
return [
|
|
118
|
+
"run_workflow",
|
|
119
|
+
"get_workflow_execution",
|
|
120
|
+
"get_workflow_execution_events",
|
|
121
|
+
"list_pending_approvals",
|
|
122
|
+
"submit_workflow_task_approval",
|
|
123
|
+
];
|
|
41
124
|
}
|
|
42
125
|
/** Fetch a single workflow execution by id. */
|
|
43
126
|
async function getWorkflowExecution(serverAddress, token, executionId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/domains/workflowexecutions/tools.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/domains/workflowexecutions/tools.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,0EAA0E;AAC1E,0CAA0C;AAC1C,6DAA6D;AAI7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gEAAgE,CAAC;AACzG,OAAO,EAEL,yBAAyB,GAC1B,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kEAAkE,CAAC;AACpH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,gFAAgF;AAChF,MAAM,UAAU,8BAA8B,CAAC,MAAiB,EAAE,MAAqB;IACrF,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,WAAW,EACT,4FAA4F;YAC5F,yFAAyF;YACzF,0EAA0E;QAC5E,WAAW,EAAE;YACX,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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,EAAE,WAAW,CAAC,CAAC;YACxD,OAAO,WAAW,CAAC,yBAAyB,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,QAAQ,CAAC,GAAG,EAAE,4BAA4B,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACvE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/domains/workflows/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/domains/workflows/tools.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAOhE,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAkIxF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
// MCP tools for the Workflow domain (CRUD: get, apply, delete)
|
|
2
|
-
//
|
|
1
|
+
// MCP tools for the Workflow domain (CRUD: get, apply, delete) plus the
|
|
2
|
+
// versioning surface (version param on get, list_workflow_versions,
|
|
3
|
+
// tag_workflow_version). The CRUD names/descriptions are part of the original
|
|
4
|
+
// Go-parity contract (mcp-server/internal/domains/workflows/tools.go).
|
|
3
5
|
//
|
|
4
6
|
// The workflow-specific tools (validate_workflow_yaml, task-kind registry) live
|
|
5
7
|
// in sibling files.
|
|
@@ -10,15 +12,28 @@ import { textOrError } from "../toolresult.js";
|
|
|
10
12
|
import { applyWorkflow } from "./apply.js";
|
|
11
13
|
import { deleteWorkflow } from "./delete.js";
|
|
12
14
|
import { fetchWorkflow } from "./fetch.js";
|
|
15
|
+
import { fetchWorkflowVersion, listWorkflowVersions, tagWorkflowVersion } from "./versions.js";
|
|
13
16
|
/** Register the Workflow CRUD tools; returns the registered tool names. */
|
|
14
17
|
export function registerWorkflowTools(server, target) {
|
|
15
18
|
server.registerTool("get_workflow", {
|
|
16
|
-
description: "Get full details of a Stigmer workflow by its org and slug."
|
|
19
|
+
description: "Get full details of a Stigmer workflow by its org and slug. Pass 'version' (a full " +
|
|
20
|
+
"SHA-256 version hash from list_workflow_versions) to fetch a historical version instead — " +
|
|
21
|
+
"that returns the version entry with its validated YAML rather than the live workflow. " +
|
|
22
|
+
"Tags are not accepted here; resolve a tag to its hash via list_workflow_versions first.",
|
|
17
23
|
inputSchema: {
|
|
18
24
|
org: z.string().describe("Organization slug that owns the workflow."),
|
|
19
25
|
slug: z.string().describe("Workflow slug — unique identifier within the org."),
|
|
26
|
+
version: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Full 64-character SHA-256 version hash of a historical version. Omit for the live workflow."),
|
|
20
30
|
},
|
|
21
|
-
}, (args, extra) => textOrError(() =>
|
|
31
|
+
}, (args, extra) => textOrError(() => {
|
|
32
|
+
const token = resolveToken(extra, target.apiKey);
|
|
33
|
+
return args.version !== undefined && args.version !== ""
|
|
34
|
+
? fetchWorkflowVersion(target.serverAddress, token, args.org, args.slug, args.version)
|
|
35
|
+
: fetchWorkflow(target.serverAddress, token, args.org, args.slug);
|
|
36
|
+
}));
|
|
22
37
|
server.registerTool("apply_workflow", {
|
|
23
38
|
description: "Create or update a Stigmer workflow (idempotent). Provide identity fields (name, org) and workflow configuration (document, tasks, env, etc.).",
|
|
24
39
|
inputSchema: WorkflowInputShape,
|
|
@@ -30,6 +45,55 @@ export function registerWorkflowTools(server, target) {
|
|
|
30
45
|
slug: z.string().describe("Workflow slug — unique identifier within the org."),
|
|
31
46
|
},
|
|
32
47
|
}, (args, extra) => textOrError(() => deleteWorkflow(target.serverAddress, resolveToken(extra, target.apiKey), args.org, args.slug)));
|
|
33
|
-
|
|
48
|
+
server.registerTool("list_workflow_versions", {
|
|
49
|
+
description: "List a workflow's version history (newest first): version hash, tag, who applied it and " +
|
|
50
|
+
"when, and which version is current. Every apply that changes the workflow creates a new " +
|
|
51
|
+
"immutable version identified by its content hash. Entries omit the version YAML — fetch " +
|
|
52
|
+
"one version's full content with get_workflow and its hash.",
|
|
53
|
+
inputSchema: {
|
|
54
|
+
org: z.string().describe("Organization slug that owns the workflow."),
|
|
55
|
+
slug: z.string().describe("Workflow slug — unique identifier within the org."),
|
|
56
|
+
page_size: z
|
|
57
|
+
.number()
|
|
58
|
+
.int()
|
|
59
|
+
.optional()
|
|
60
|
+
.describe("Maximum versions per page (default 50, max 100)."),
|
|
61
|
+
page_token: z
|
|
62
|
+
.string()
|
|
63
|
+
.optional()
|
|
64
|
+
.describe("Pagination token from a previous response's next_page_token."),
|
|
65
|
+
},
|
|
66
|
+
}, (args, extra) => textOrError(() => listWorkflowVersions(target.serverAddress, resolveToken(extra, target.apiKey), {
|
|
67
|
+
org: args.org,
|
|
68
|
+
slug: args.slug,
|
|
69
|
+
pageSize: args.page_size,
|
|
70
|
+
pageToken: args.page_token,
|
|
71
|
+
})));
|
|
72
|
+
server.registerTool("tag_workflow_version", {
|
|
73
|
+
description: "Assign a tag (e.g. stable, production) to a specific workflow version. Tags are mutable " +
|
|
74
|
+
"pointers: re-tagging with an existing name moves it from its previous version, and a " +
|
|
75
|
+
"version holds at most one tag. Get version hashes from list_workflow_versions. Returns " +
|
|
76
|
+
"the updated workflow.",
|
|
77
|
+
inputSchema: {
|
|
78
|
+
org: z.string().describe("Organization slug that owns the workflow."),
|
|
79
|
+
slug: z.string().describe("Workflow slug — unique identifier within the org."),
|
|
80
|
+
version: z.string().describe("Full 64-character SHA-256 hash of the version to tag."),
|
|
81
|
+
tag: z
|
|
82
|
+
.string()
|
|
83
|
+
.describe("Tag to assign: alphanumeric with dots, hyphens, or underscores (e.g. stable, v1.0)."),
|
|
84
|
+
},
|
|
85
|
+
}, (args, extra) => textOrError(() => tagWorkflowVersion(target.serverAddress, resolveToken(extra, target.apiKey), {
|
|
86
|
+
org: args.org,
|
|
87
|
+
slug: args.slug,
|
|
88
|
+
versionHash: args.version,
|
|
89
|
+
tag: args.tag,
|
|
90
|
+
})));
|
|
91
|
+
return [
|
|
92
|
+
"get_workflow",
|
|
93
|
+
"apply_workflow",
|
|
94
|
+
"delete_workflow",
|
|
95
|
+
"list_workflow_versions",
|
|
96
|
+
"tag_workflow_version",
|
|
97
|
+
];
|
|
34
98
|
}
|
|
35
99
|
//# sourceMappingURL=tools.js.map
|