edgegate-mcp 0.10.0 → 0.14.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.
Files changed (54) hide show
  1. package/dist/client.d.ts +40 -2
  2. package/dist/client.js +43 -0
  3. package/dist/client.js.map +1 -1
  4. package/dist/server.js +138 -1
  5. package/dist/server.js.map +1 -1
  6. package/dist/tools/capture_reference.d.ts +49 -0
  7. package/dist/tools/capture_reference.js +102 -0
  8. package/dist/tools/capture_reference.js.map +1 -0
  9. package/dist/tools/check_genie_compile_status.d.ts +15 -0
  10. package/dist/tools/check_genie_compile_status.js +36 -0
  11. package/dist/tools/check_genie_compile_status.js.map +1 -0
  12. package/dist/tools/check_llm_compile_status.d.ts +15 -0
  13. package/dist/tools/check_llm_compile_status.js +49 -0
  14. package/dist/tools/check_llm_compile_status.js.map +1 -0
  15. package/dist/tools/check_reference_capture_status.d.ts +15 -0
  16. package/dist/tools/check_reference_capture_status.js +31 -0
  17. package/dist/tools/check_reference_capture_status.js.map +1 -0
  18. package/dist/tools/compile_genie.d.ts +46 -0
  19. package/dist/tools/compile_genie.js +101 -0
  20. package/dist/tools/compile_genie.js.map +1 -0
  21. package/dist/tools/create_bg_run.d.ts +41 -0
  22. package/dist/tools/create_bg_run.js +109 -0
  23. package/dist/tools/create_bg_run.js.map +1 -0
  24. package/dist/tools/create_eval_set.d.ts +89 -0
  25. package/dist/tools/create_eval_set.js +128 -0
  26. package/dist/tools/create_eval_set.js.map +1 -0
  27. package/dist/tools/create_pipeline.d.ts +139 -17
  28. package/dist/tools/create_pipeline.js +155 -29
  29. package/dist/tools/create_pipeline.js.map +1 -1
  30. package/dist/tools/import_huggingface_model.js +23 -15
  31. package/dist/tools/import_huggingface_model.js.map +1 -1
  32. package/dist/tools/list_eval_packs.d.ts +6 -0
  33. package/dist/tools/list_eval_packs.js +38 -0
  34. package/dist/tools/list_eval_packs.js.map +1 -0
  35. package/dist/tools/list_eval_sets.d.ts +12 -0
  36. package/dist/tools/list_eval_sets.js +38 -0
  37. package/dist/tools/list_eval_sets.js.map +1 -0
  38. package/dist/tools/llm_compile.d.ts +47 -0
  39. package/dist/tools/llm_compile.js +111 -0
  40. package/dist/tools/llm_compile.js.map +1 -0
  41. package/dist/tools/new_eval_set_version.d.ts +18 -0
  42. package/dist/tools/new_eval_set_version.js +47 -0
  43. package/dist/tools/new_eval_set_version.js.map +1 -0
  44. package/dist/tools/publish_eval_set.d.ts +18 -0
  45. package/dist/tools/publish_eval_set.js +74 -0
  46. package/dist/tools/publish_eval_set.js.map +1 -0
  47. package/dist/tools/update_eval_set.d.ts +56 -0
  48. package/dist/tools/update_eval_set.js +60 -0
  49. package/dist/tools/update_eval_set.js.map +1 -0
  50. package/dist/types.d.ts +193 -0
  51. package/dist/version.d.ts +2 -2
  52. package/dist/version.js +1 -1
  53. package/dist/version.js.map +1 -1
  54. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateClient } from "../client.js";
3
+ import type { ToolResult } from "./setup_workspace.js";
4
+ export declare const llmCompileInputSchema: z.ZodObject<{
5
+ workspace_id: z.ZodString;
6
+ /**
7
+ * Pre-uploaded source artifacts (1 per component). Typical Llama-class:
8
+ * 3 artifacts (prompt + token + kv_cache). For other architectures pass
9
+ * M artifacts matching the number of components.
10
+ */
11
+ source_artifact_ids: z.ZodArray<z.ZodString, "many">;
12
+ /** AI Hub device id (e.g. "x_elite", "x2_elite", "sa8295p"). */
13
+ device_id: z.ZodString;
14
+ /**
15
+ * Label only — backend always compiles to QNN_DLC under the hood. The
16
+ * label is used downstream for profile dispatch hints.
17
+ */
18
+ target_runtime: z.ZodDefault<z.ZodString>;
19
+ /** Default [128, 1] — typical prompt/token split for Llama-class. */
20
+ sequence_lengths: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
21
+ /** Default [4096]. */
22
+ context_lengths: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
23
+ /**
24
+ * Per-component role labels (e.g. ["prompt", "token", "kv_cache"]).
25
+ * Required when source_artifact_ids has >1 entry — the AI Hub SDK
26
+ * mandates graph_names for multi-component compiles.
27
+ */
28
+ roles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ workspace_id: string;
31
+ source_artifact_ids: string[];
32
+ sequence_lengths: number[];
33
+ context_lengths: number[];
34
+ target_runtime: string;
35
+ device_id: string;
36
+ roles?: string[] | undefined;
37
+ }, {
38
+ workspace_id: string;
39
+ source_artifact_ids: string[];
40
+ device_id: string;
41
+ sequence_lengths?: number[] | undefined;
42
+ context_lengths?: number[] | undefined;
43
+ roles?: string[] | undefined;
44
+ target_runtime?: string | undefined;
45
+ }>;
46
+ export type LLMCompileInput = z.infer<typeof llmCompileInputSchema>;
47
+ export declare function llmCompileHandler(client: EdgeGateClient, input: LLMCompileInput): Promise<ToolResult>;
@@ -0,0 +1,111 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateError } from "../client.js";
3
+ export const llmCompileInputSchema = z.object({
4
+ workspace_id: z.string().uuid(),
5
+ /**
6
+ * Pre-uploaded source artifacts (1 per component). Typical Llama-class:
7
+ * 3 artifacts (prompt + token + kv_cache). For other architectures pass
8
+ * M artifacts matching the number of components.
9
+ */
10
+ source_artifact_ids: z.array(z.string().uuid()).min(1).max(8),
11
+ /** AI Hub device id (e.g. "x_elite", "x2_elite", "sa8295p"). */
12
+ device_id: z.string().min(1),
13
+ /**
14
+ * Label only — backend always compiles to QNN_DLC under the hood. The
15
+ * label is used downstream for profile dispatch hints.
16
+ */
17
+ target_runtime: z.string().min(1).default("genie"),
18
+ /** Default [128, 1] — typical prompt/token split for Llama-class. */
19
+ sequence_lengths: z.array(z.number().int().positive()).default([128, 1]),
20
+ /** Default [4096]. */
21
+ context_lengths: z.array(z.number().int().positive()).default([4096]),
22
+ /**
23
+ * Per-component role labels (e.g. ["prompt", "token", "kv_cache"]).
24
+ * Required when source_artifact_ids has >1 entry — the AI Hub SDK
25
+ * mandates graph_names for multi-component compiles.
26
+ */
27
+ roles: z.array(z.string().min(1)).optional(),
28
+ });
29
+ export async function llmCompileHandler(client, input) {
30
+ // Client-side guard: roles required when multi-component. Surface the
31
+ // same constraint the backend enforces so the agent gets a clean error
32
+ // without a network round-trip.
33
+ if (input.source_artifact_ids.length > 1 && (!input.roles || input.roles.length === 0)) {
34
+ return {
35
+ isError: true,
36
+ content: [
37
+ {
38
+ type: "text",
39
+ text: `'roles' is required when source_artifact_ids has more than 1 entry ` +
40
+ `(the AI Hub SDK requires graph_names for multi-component compiles). ` +
41
+ `Typical Llama-class: roles=["prompt", "token", "kv_cache"].`,
42
+ },
43
+ ],
44
+ };
45
+ }
46
+ if (input.roles && input.roles.length !== input.source_artifact_ids.length) {
47
+ return {
48
+ isError: true,
49
+ content: [
50
+ {
51
+ type: "text",
52
+ text: `'roles' length (${input.roles.length}) must match source_artifact_ids ` +
53
+ `length (${input.source_artifact_ids.length}).`,
54
+ },
55
+ ],
56
+ };
57
+ }
58
+ try {
59
+ const job = await client.submitLLMCompile(input.workspace_id, {
60
+ source_artifact_ids: input.source_artifact_ids,
61
+ device_id: input.device_id,
62
+ target_runtime: input.target_runtime,
63
+ sequence_lengths: input.sequence_lengths,
64
+ context_lengths: input.context_lengths,
65
+ ...(input.roles !== undefined ? { roles: input.roles } : {}),
66
+ });
67
+ return {
68
+ content: [
69
+ {
70
+ type: "text",
71
+ text: [
72
+ `LLM compile job submitted.`,
73
+ ``,
74
+ `- compile_job_id: ${job.compile_job_id}`,
75
+ `- status: ${job.status}`,
76
+ `- components: ${input.source_artifact_ids.length}`,
77
+ `- device: ${input.device_id}`,
78
+ `- target_runtime: ${input.target_runtime} (compiled to QNN_DLC under the hood)`,
79
+ ``,
80
+ `Poll status with:`,
81
+ ` edgegate_check_llm_compile_status({ workspace_id: "${input.workspace_id}", compile_job_id: "${job.compile_job_id}" })`,
82
+ ``,
83
+ `When status=completed, composite_artifact_id is the QNN_DLC linked model ready to use in a pipeline.`,
84
+ ].join("\n"),
85
+ },
86
+ ],
87
+ };
88
+ }
89
+ catch (err) {
90
+ if (err instanceof EdgeGateError) {
91
+ return {
92
+ isError: true,
93
+ content: [
94
+ {
95
+ type: "text",
96
+ text: err.status === 402
97
+ ? `Your workspace has hit its monthly LLM compile cap (default 100/mo on Pro). ` +
98
+ `Upgrade at https://edgegate.frozo.ai/pricing or wait until next billing cycle.\n\n` +
99
+ `Detail: ${err.detail}`
100
+ : err.status === 401
101
+ ? "EDGEGATE_API_KEY is missing, expired, or revoked. Generate a fresh key at " +
102
+ "https://edgegate.frozo.ai/workspace/<id>/settings#api-keys and retry."
103
+ : `EdgeGate returned ${err.status}: ${err.detail}`,
104
+ },
105
+ ],
106
+ };
107
+ }
108
+ throw err;
109
+ }
110
+ }
111
+ //# sourceMappingURL=llm_compile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm_compile.js","sourceRoot":"","sources":["../../src/tools/llm_compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,gEAAgE;IAChE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B;;;OAGG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClD,qEA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C,8EAA8E;gCAC9E,oFAAoF;gCACpF,WAAW,GAAG,CAAC,MAAM,EAAE;4BACzB,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG;gCAClB,CAAC,CAAC,4EAA4E;oCAC5E,uEAAuE;gCACzE,CAAC,CAAC,qBAAqB,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE;qBACzD;iBACF;aACF,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateClient } from "../client.js";
3
+ import type { ToolResult } from "./setup_workspace.js";
4
+ export declare const newEvalSetVersionInputSchema: z.ZodObject<{
5
+ workspace_id: z.ZodString;
6
+ eval_set_id: z.ZodString;
7
+ from_version: z.ZodString;
8
+ }, "strict", z.ZodTypeAny, {
9
+ workspace_id: string;
10
+ eval_set_id: string;
11
+ from_version: string;
12
+ }, {
13
+ workspace_id: string;
14
+ eval_set_id: string;
15
+ from_version: string;
16
+ }>;
17
+ export type NewEvalSetVersionInput = z.infer<typeof newEvalSetVersionInputSchema>;
18
+ export declare function newEvalSetVersionHandler(client: EdgeGateClient, input: NewEvalSetVersionInput): Promise<ToolResult>;
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateError } from "../client.js";
3
+ import { formatVersion, surfaceEvalError } from "./create_eval_set.js";
4
+ export const newEvalSetVersionInputSchema = z
5
+ .object({
6
+ workspace_id: z.string().uuid(),
7
+ eval_set_id: z.string().uuid(),
8
+ from_version: z
9
+ .string()
10
+ .uuid()
11
+ .describe("The version_id of a PUBLISHED version to seed the new draft from."),
12
+ })
13
+ .strict();
14
+ export async function newEvalSetVersionHandler(client, input) {
15
+ try {
16
+ const version = await client.newEvalSetVersion(input.workspace_id, input.eval_set_id, input.from_version);
17
+ return {
18
+ content: [
19
+ {
20
+ type: "text",
21
+ text: formatVersion(version, `Forked a new draft version seeded from the published cases:`) +
22
+ `\n\nEdit it with \`edgegate_update_eval_set\`, then \`edgegate_publish_eval_set\` to re-publish. ` +
23
+ `The original published version (and any references / runs bound to its sha) is untouched.`,
24
+ },
25
+ ],
26
+ };
27
+ }
28
+ catch (err) {
29
+ if (err instanceof EdgeGateError) {
30
+ if (err.status === 404) {
31
+ return {
32
+ isError: true,
33
+ content: [
34
+ {
35
+ type: "text",
36
+ text: `Unknown eval set or from_version="${input.from_version}". ` +
37
+ `Check the ids with \`edgegate_list_eval_sets\`.`,
38
+ },
39
+ ],
40
+ };
41
+ }
42
+ return surfaceEvalError(err);
43
+ }
44
+ throw err;
45
+ }
46
+ }
47
+ //# sourceMappingURL=new_eval_set_version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new_eval_set_version.js","sourceRoot":"","sources":["../../src/tools/new_eval_set_version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEvE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC9B,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,IAAI,EAAE;SACN,QAAQ,CAAC,mEAAmE,CAAC;CACjF,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsB,EACtB,KAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAC5C,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,CACnB,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EACF,aAAa,CACX,OAAO,EACP,6DAA6D,CAC9D;wBACD,mGAAmG;wBACnG,2FAA2F;iBAC9F;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,aAAa,EAAE,CAAC;YACjC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvB,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EACF,qCAAqC,KAAK,CAAC,YAAY,KAAK;gCAC5D,iDAAiD;yBACpD;qBACF;iBACF,CAAC;YACJ,CAAC;YACD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateClient } from "../client.js";
3
+ import type { ToolResult } from "./setup_workspace.js";
4
+ export declare const publishEvalSetInputSchema: z.ZodObject<{
5
+ workspace_id: z.ZodString;
6
+ eval_set_id: z.ZodString;
7
+ version_id: z.ZodString;
8
+ }, "strict", z.ZodTypeAny, {
9
+ workspace_id: string;
10
+ eval_set_id: string;
11
+ version_id: string;
12
+ }, {
13
+ workspace_id: string;
14
+ eval_set_id: string;
15
+ version_id: string;
16
+ }>;
17
+ export type PublishEvalSetInput = z.infer<typeof publishEvalSetInputSchema>;
18
+ export declare function publishEvalSetHandler(client: EdgeGateClient, input: PublishEvalSetInput): Promise<ToolResult>;
@@ -0,0 +1,74 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateError } from "../client.js";
3
+ import { formatVersion, surfaceEvalError } from "./create_eval_set.js";
4
+ export const publishEvalSetInputSchema = z
5
+ .object({
6
+ workspace_id: z.string().uuid(),
7
+ eval_set_id: z.string().uuid(),
8
+ version_id: z.string().uuid(),
9
+ })
10
+ .strict();
11
+ export async function publishEvalSetHandler(client, input) {
12
+ try {
13
+ const version = await client.publishEvalSet(input.workspace_id, input.eval_set_id, input.version_id);
14
+ const next = `\n\nFeed \`artifact_id\` and \`eval_set_sha256\` into a Behavioral-Gate run ` +
15
+ `(3b create-bg-run) as the eval-set inputs. The runner recomputes the sha after ` +
16
+ `download and confirms it matches.`;
17
+ return {
18
+ content: [
19
+ {
20
+ type: "text",
21
+ text: formatVersion(version, `Published eval set version — validated, hashed, signed, and frozen:`) + next,
22
+ },
23
+ ],
24
+ };
25
+ }
26
+ catch (err) {
27
+ if (err instanceof EdgeGateError) {
28
+ if (err.status === 422) {
29
+ const violations = extractViolations(err.detail);
30
+ const body = violations.length > 0
31
+ ? `Validation failed with ${violations.length} violation(s) — the version stays a draft:\n` +
32
+ violations.map((v) => ` - ${v}`).join("\n")
33
+ : `Validation failed (422) — the version stays a draft:\n${err.detail}`;
34
+ return { isError: true, content: [{ type: "text", text: body }] };
35
+ }
36
+ if (err.status === 404) {
37
+ return {
38
+ isError: true,
39
+ content: [
40
+ {
41
+ type: "text",
42
+ text: "Unknown eval set or version. Check the eval_set_id / version_id " +
43
+ "with `edgegate_list_eval_sets`.",
44
+ },
45
+ ],
46
+ };
47
+ }
48
+ return surfaceEvalError(err);
49
+ }
50
+ throw err;
51
+ }
52
+ }
53
+ /**
54
+ * Pull the `violations` array out of a 422 `detail`. The backend returns
55
+ * `422 {detail: {violations: [...]}}`; the client stringifies `detail`, so
56
+ * `err.detail` is the JSON-stringified `{violations: [...]}` object (or a
57
+ * plain string fallback).
58
+ */
59
+ function extractViolations(detail) {
60
+ try {
61
+ const parsed = JSON.parse(detail);
62
+ if (parsed &&
63
+ typeof parsed === "object" &&
64
+ "violations" in parsed &&
65
+ Array.isArray(parsed.violations)) {
66
+ return parsed.violations.map((v) => String(v));
67
+ }
68
+ }
69
+ catch {
70
+ // detail was plain text — fall through
71
+ }
72
+ return [];
73
+ }
74
+ //# sourceMappingURL=publish_eval_set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish_eval_set.js","sourceRoot":"","sources":["../../src/tools/publish_eval_set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,CAAC;IACN,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;CAC9B,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAsB,EACtB,KAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,CACzC,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,UAAU,CACjB,CAAC;QAEF,MAAM,IAAI,GACR,8EAA8E;YAC9E,iFAAiF;YACjF,mCAAmC,CAAC;QAEtC,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EACF,aAAa,CACX,OAAO,EACP,qEAAqE,CACtE,GAAG,IAAI;iBACX;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,aAAa,EAAE,CAAC;YACjC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvB,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACjD,MA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@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateClient } from "../client.js";
3
+ import type { ToolResult } from "./setup_workspace.js";
4
+ export declare const updateEvalSetInputSchema: z.ZodObject<{
5
+ workspace_id: z.ZodString;
6
+ eval_set_id: z.ZodString;
7
+ version_id: z.ZodString;
8
+ cases: z.ZodArray<z.ZodObject<{
9
+ case_id: z.ZodString;
10
+ prompt: z.ZodString;
11
+ category: z.ZodEnum<["jailbreak", "forbidden_action", "task", "format"]>;
12
+ forbidden_actions: z.ZodArray<z.ZodString, "many">;
13
+ must_refuse: z.ZodBoolean;
14
+ expected_task_answer: z.ZodNullable<z.ZodString>;
15
+ }, "strict", z.ZodTypeAny, {
16
+ prompt: string;
17
+ case_id: string;
18
+ category: "jailbreak" | "forbidden_action" | "task" | "format";
19
+ forbidden_actions: string[];
20
+ must_refuse: boolean;
21
+ expected_task_answer: string | null;
22
+ }, {
23
+ prompt: string;
24
+ case_id: string;
25
+ category: "jailbreak" | "forbidden_action" | "task" | "format";
26
+ forbidden_actions: string[];
27
+ must_refuse: boolean;
28
+ expected_task_answer: string | null;
29
+ }>, "many">;
30
+ }, "strict", z.ZodTypeAny, {
31
+ workspace_id: string;
32
+ cases: {
33
+ prompt: string;
34
+ case_id: string;
35
+ category: "jailbreak" | "forbidden_action" | "task" | "format";
36
+ forbidden_actions: string[];
37
+ must_refuse: boolean;
38
+ expected_task_answer: string | null;
39
+ }[];
40
+ eval_set_id: string;
41
+ version_id: string;
42
+ }, {
43
+ workspace_id: string;
44
+ cases: {
45
+ prompt: string;
46
+ case_id: string;
47
+ category: "jailbreak" | "forbidden_action" | "task" | "format";
48
+ forbidden_actions: string[];
49
+ must_refuse: boolean;
50
+ expected_task_answer: string | null;
51
+ }[];
52
+ eval_set_id: string;
53
+ version_id: string;
54
+ }>;
55
+ export type UpdateEvalSetInput = z.infer<typeof updateEvalSetInputSchema>;
56
+ export declare function updateEvalSetHandler(client: EdgeGateClient, input: UpdateEvalSetInput): Promise<ToolResult>;
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateError } from "../client.js";
3
+ import { evalCaseSchema, formatVersion, surfaceEvalError, } from "./create_eval_set.js";
4
+ export const updateEvalSetInputSchema = z
5
+ .object({
6
+ workspace_id: z.string().uuid(),
7
+ eval_set_id: z.string().uuid(),
8
+ version_id: z.string().uuid(),
9
+ cases: z
10
+ .array(evalCaseSchema)
11
+ .describe("The FULL replacement list of case dicts for this draft version."),
12
+ })
13
+ .strict();
14
+ export async function updateEvalSetHandler(client, input) {
15
+ try {
16
+ const version = await client.updateEvalSet(input.workspace_id, input.eval_set_id, input.version_id, input.cases);
17
+ return {
18
+ content: [
19
+ {
20
+ type: "text",
21
+ text: formatVersion(version, `Updated draft version (cases fully replaced):`) +
22
+ `\n\nStill a draft — call \`edgegate_publish_eval_set\` to validate, hash, sign, and freeze it.`,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ catch (err) {
28
+ if (err instanceof EdgeGateError) {
29
+ if (err.status === 409) {
30
+ return {
31
+ isError: true,
32
+ content: [
33
+ {
34
+ type: "text",
35
+ text: "This version is already published and is immutable. To change a " +
36
+ "published set, fork a fresh draft with " +
37
+ `\`edgegate_new_eval_set_version({ workspace_id, eval_set_id, from_version: "${input.version_id}" })\`, ` +
38
+ "edit that draft, then publish it.",
39
+ },
40
+ ],
41
+ };
42
+ }
43
+ if (err.status === 404) {
44
+ return {
45
+ isError: true,
46
+ content: [
47
+ {
48
+ type: "text",
49
+ text: "Unknown eval set or version. Check the eval_set_id / version_id " +
50
+ "with `edgegate_list_eval_sets`.",
51
+ },
52
+ ],
53
+ };
54
+ }
55
+ return surfaceEvalError(err);
56
+ }
57
+ throw err;
58
+ }
59
+ }
60
+ //# sourceMappingURL=update_eval_set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update_eval_set.js","sourceRoot":"","sources":["../../src/tools/update_eval_set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAA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tC;qBACF;iBACF,CAAC;YACJ,CAAC;YACD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvB,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EACF,kEAAkE;gCAClE,iCAAiC;yBACpC;qBACF;iBACF,CAAC;YACJ,CAAC;YACD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
package/dist/types.d.ts CHANGED
@@ -187,6 +187,22 @@ export interface AuditReport {
187
187
  generated_at?: string;
188
188
  }
189
189
  export type HFImportStatus = "queued" | "downloading" | "uploading_to_hub" | "done" | "failed";
190
+ /**
191
+ * One entry in a multi-part HF import. F-T6.2 (commit 3636c20) added
192
+ * multi-part `.bin` auto-discovery: a Volko76-style repo with 3 parts
193
+ * (prompt / token / kv_cache) now unpacks into 3 ArtifactRefs, in addition
194
+ * to the legacy single `artifact_id` field (which still points at part 1
195
+ * for backward compat with older MCP clients).
196
+ */
197
+ export interface ArtifactRef {
198
+ id: UUID;
199
+ filename: string;
200
+ size_bytes: number;
201
+ /** "prompt" | "token" | "kv_cache" for M=3 multi-part imports; "part_N" otherwise. */
202
+ role: string;
203
+ /** 1-based. */
204
+ part_index: number;
205
+ }
190
206
  export interface HFImportJob {
191
207
  import_job_id: string;
192
208
  status: HFImportStatus;
@@ -196,6 +212,36 @@ export interface HFImportJob {
196
212
  size_bytes: number | null;
197
213
  filename: string | null;
198
214
  error_detail: string | null;
215
+ /**
216
+ * Plan B / F-T6.2 — when the HF repo contains multiple .bin parts, this
217
+ * array surfaces every part (size > 1 for multi-part imports). Omitted
218
+ * or single-element for legacy single-file imports.
219
+ */
220
+ artifacts?: ArtifactRef[];
221
+ }
222
+ export type LLMCompileStatus = "queued" | "running" | "completed" | "failed";
223
+ export interface LLMCompileProgress {
224
+ compile_jobs_done: number;
225
+ compile_jobs_total: number;
226
+ }
227
+ /**
228
+ * Returned by POST /v1/workspaces/{ws}/llm-compile and GET
229
+ * /v1/workspaces/{ws}/llm-compile/{compile_job_id}. POST returns the
230
+ * initial queued state; GET reflects current state. On success,
231
+ * `composite_artifact_id` is the QNN_DLC linked composite ready to be
232
+ * referenced from a pipeline. On failure, `error_detail` is set.
233
+ */
234
+ export interface LLMCompileJob {
235
+ compile_job_id: UUID;
236
+ status: LLMCompileStatus;
237
+ composite_artifact_id: UUID | null;
238
+ error_detail: string | null;
239
+ progress: LLMCompileProgress;
240
+ /** Echoed for caller convenience. */
241
+ device_id?: string;
242
+ target_runtime?: string;
243
+ created_at?: string;
244
+ updated_at?: string;
199
245
  }
200
246
  export interface MetricDelta {
201
247
  current: number | null;
@@ -370,6 +416,153 @@ export interface ByoAuditPage {
370
416
  entries: ByoAuditEntry[];
371
417
  next_cursor: number | null;
372
418
  }
419
+ /**
420
+ * Balance counts returned at publish and in pack summaries. See the eval-set
421
+ * authoring contract §4 — the floor is ≥5 must_refuse_with_forbidden cases and
422
+ * ≥1 task case.
423
+ */
424
+ export interface EvalBalance {
425
+ must_refuse: number;
426
+ must_refuse_with_forbidden: number;
427
+ task: number;
428
+ benign: number;
429
+ total: number;
430
+ }
431
+ /**
432
+ * One behavioral eval case. Byte-faithful to edgegate/bg/eval_set.py — exactly
433
+ * six fields. See the eval-set authoring contract §3.
434
+ */
435
+ export interface EvalCase {
436
+ case_id: string;
437
+ prompt: string;
438
+ category: "jailbreak" | "forbidden_action" | "task" | "format";
439
+ forbidden_actions: string[];
440
+ must_refuse: boolean;
441
+ expected_task_answer: string | null;
442
+ }
443
+ /**
444
+ * A bundled starter pack a customer can clone from. Returned by
445
+ * GET /v1/eval-packs.
446
+ */
447
+ export interface EvalPack {
448
+ id: string;
449
+ name: string;
450
+ case_count: number;
451
+ balance: EvalBalance;
452
+ }
453
+ /**
454
+ * An eval-set version. Returned by create / update / publish / new_version.
455
+ * `eval_set_sha256`, `artifact_id`, `balance`, and `published_at` are null
456
+ * until the version is published. See the contract §8.
457
+ */
458
+ export interface EvalSetVersion {
459
+ id: UUID;
460
+ eval_set_id: UUID;
461
+ version: number;
462
+ status: "draft" | "published";
463
+ eval_set_sha256: string | null;
464
+ artifact_id: UUID | null;
465
+ balance: EvalBalance | null;
466
+ cases: EvalCase[];
467
+ created_at: string;
468
+ published_at: string | null;
469
+ }
470
+ /**
471
+ * Summary row from GET /v1/workspaces/{ws}/eval-sets. See the contract §7.3.
472
+ */
473
+ export interface EvalSetSummary {
474
+ id: UUID;
475
+ name: string;
476
+ created_at: string;
477
+ latest_version: number;
478
+ }
479
+ /**
480
+ * Body for POST /v1/workspaces/{ws}/reference-captures. Mirrors the backend
481
+ * `ReferenceCaptureRequest` model (edgegate/api/routes/reference_capture.py).
482
+ * Exactly one flavor selector — `hf_repo` (auto-FP16) XOR
483
+ * `reference_upload_artifact_id` (golden) — must be set; else 422.
484
+ */
485
+ export interface ReferenceCaptureBody {
486
+ eval_set_artifact_id: UUID;
487
+ system_prompt: string;
488
+ decode_config?: Record<string, unknown>;
489
+ hf_repo?: string;
490
+ reference_upload_artifact_id?: UUID;
491
+ }
492
+ /**
493
+ * Response (202) from POST /v1/workspaces/{ws}/reference-captures.
494
+ */
495
+ export interface ReferenceCaptureJob {
496
+ job_id: UUID;
497
+ flavor: string;
498
+ status: string;
499
+ }
500
+ /**
501
+ * Response from GET /v1/workspaces/{ws}/reference-captures/{job_id}. The
502
+ * `reference_artifact_id` (an `ArtifactKind.REFERENCE` artifact) is populated
503
+ * only when `status` is "done"; feed it into edgegate_create_bg_run.
504
+ */
505
+ export interface ReferenceCaptureStatus {
506
+ job_id: UUID;
507
+ status: string;
508
+ reference_artifact_id: UUID | null;
509
+ }
510
+ /**
511
+ * Body for POST /v1/workspaces/{ws}/genie-compile. Mirrors the backend
512
+ * `GenieCompileRequest` (edgegate/api/routes/compile_genie.py). Exactly one
513
+ * lane selector — `hf_repo` (Lane A) XOR `onnx_artifact_ids` (Lane B,
514
+ * genie-ready multi-part) XOR `bundle_artifact_id` (Lane C, precompiled) —
515
+ * decides the lane; empty/multi-selector → 422.
516
+ */
517
+ export interface GenieCompileBody {
518
+ device_label: string;
519
+ hf_repo?: string;
520
+ onnx_artifact_ids?: UUID[];
521
+ bundle_artifact_id?: UUID;
522
+ }
523
+ /**
524
+ * Response (202) from POST /v1/workspaces/{ws}/genie-compile. Mirrors the
525
+ * backend `GenieCompileAccepted` schema.
526
+ */
527
+ export interface GenieCompileJob {
528
+ job_id: UUID;
529
+ lane: string;
530
+ status: string;
531
+ }
532
+ /**
533
+ * Response from GET /v1/workspaces/{ws}/genie-compile/{job_id}. Mirrors the
534
+ * backend `GenieCompileStatus` schema. The `bundle_artifact_id` is populated
535
+ * only when `status` is "done"; feed it into edgegate_create_bg_run.
536
+ */
537
+ export interface GenieCompileStatus {
538
+ job_id: UUID;
539
+ lane: string;
540
+ status: string;
541
+ bundle_artifact_id: UUID | null;
542
+ }
543
+ /**
544
+ * Body for POST /v1/workspaces/{ws}/bg-runs. Mirrors the backend
545
+ * `BgRunCreateRequest` (edgegate/api/routes/compile_genie.py). Wires a
546
+ * compiled bundle + eval set + reference into a Run (populates
547
+ * `Run.runner_config_json`).
548
+ */
549
+ export interface BgRunCreateBody {
550
+ bundle_artifact_id: UUID;
551
+ eval_set_artifact_id: UUID;
552
+ reference_artifact_id: UUID;
553
+ vendor?: string;
554
+ system_prompt?: string;
555
+ decode_config?: Record<string, unknown>;
556
+ device_label?: string;
557
+ }
558
+ /**
559
+ * Response (201) from POST /v1/workspaces/{ws}/bg-runs. Mirrors the backend
560
+ * `BgRunResponse` schema.
561
+ */
562
+ export interface BgRunResponse {
563
+ run_id: UUID;
564
+ status: string;
565
+ }
373
566
  /**
374
567
  * Returned by POST /artifacts and POST /artifacts/byo. Mirrors the
375
568
  * backend `ArtifactResponse` schema. `storage_url` for BYO artifacts is