@pixerate/editor 0.222.3 → 0.223.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/dist/agent/index.cjs +13 -3
- package/dist/agent/index.js +12 -2
- package/dist/bridge/cli.cjs +3 -3
- package/dist/bridge/cli.js +2 -2
- package/dist/bridge/index.cjs +3 -3
- package/dist/bridge/index.js +2 -2
- package/dist/{chunk-I5MRJW7B.js → chunk-67JAEU53.js} +1 -1
- package/dist/{chunk-U4QN36YT.cjs → chunk-BDT2IYXK.cjs} +128 -16
- package/dist/{chunk-S4EIAIEW.cjs → chunk-OJTZKDLJ.cjs} +7 -7
- package/dist/{chunk-XZB3TJ6K.js → chunk-SAN4SBBS.js} +25 -7
- package/dist/{chunk-GI3AVES4.js → chunk-SVHXD2VH.js} +117 -5
- package/dist/{chunk-AMX23CSN.cjs → chunk-Z7BVK32C.cjs} +25 -7
- package/dist/image-editor/index.cjs +12 -11
- package/dist/image-editor/index.js +12 -11
- package/dist/image-editor/layers/panel.d.cts +6 -2
- package/dist/image-editor/layers/panel.d.ts +6 -2
- package/dist/tools/index.cjs +13 -3
- package/dist/tools/index.d.cts +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +12 -2
- package/dist/tools/skill-evals.d.cts +102 -0
- package/dist/tools/skill-evals.d.ts +102 -0
- package/dist/tools/skills.d.cts +12 -1
- package/dist/tools/skills.d.ts +12 -1
- package/package.json +1 -1
- package/skills/README.md +3 -1
- package/skills/pixerate-agent-tools/SKILL.md +5 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The evals that workflow skills ship in `skills/<name>/evals/*.json`, for any harness to run.
|
|
3
|
+
*
|
|
4
|
+
* An eval is a task a model would be given (`prompt`), the document it starts from
|
|
5
|
+
* (`fixture`), the checks that decide whether the job was done (`checks`: a read tool, its
|
|
6
|
+
* arguments and what its result must match) and one known-good answer (`solution`: the tool
|
|
7
|
+
* calls an expert would make). The package's own tests prove each eval with its `solution`; an
|
|
8
|
+
* agent harness builds the fixture, gives its model the `prompt` in place of the solution, then
|
|
9
|
+
* runs `failedEvalChecks`. The format is described in `skills/README.md`.
|
|
10
|
+
*/
|
|
11
|
+
import type { McpToolResult } from './registry.js';
|
|
12
|
+
export interface SkillEvalToolCall {
|
|
13
|
+
tool: string;
|
|
14
|
+
args?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface SkillEvalCheck extends SkillEvalToolCall {
|
|
17
|
+
/** What the check is for, shown when it fails. */
|
|
18
|
+
why: string;
|
|
19
|
+
expect: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface SkillEval {
|
|
22
|
+
prompt: string;
|
|
23
|
+
fixture: SpreadsheetEvalFixture | ImageEvalFixture | VectorEvalFixture | PaintEvalFixture | VideoEvalFixture;
|
|
24
|
+
checks: SkillEvalCheck[];
|
|
25
|
+
solution: SkillEvalToolCall[];
|
|
26
|
+
}
|
|
27
|
+
export interface SpreadsheetEvalFixture {
|
|
28
|
+
editor: 'spreadsheet';
|
|
29
|
+
/** Raw inputs from A1, row by row, typed as a person would (`'` forces text). */
|
|
30
|
+
rows: Array<Array<string | number | boolean | null>>;
|
|
31
|
+
}
|
|
32
|
+
export interface ImageEvalFixture {
|
|
33
|
+
editor: 'image';
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
/** RGB background. */
|
|
37
|
+
background: [number, number, number];
|
|
38
|
+
/** Shapes painted over it in order, with RGB colours. */
|
|
39
|
+
shapes: Array<{
|
|
40
|
+
shape: 'rect' | 'ellipse';
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
color: [number, number, number];
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
export interface VectorEvalFixture {
|
|
49
|
+
editor: 'vector';
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
/** Commands that build the starting artwork, run in order (`"$0.id"` refers to an earlier result). */
|
|
53
|
+
setup?: Array<{
|
|
54
|
+
id: string;
|
|
55
|
+
params?: Record<string, unknown>;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
export interface PaintEvalFixture {
|
|
59
|
+
editor: 'paint';
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
/** Tool calls that prepare the canvas (paper, layers, strokes), run in order. */
|
|
63
|
+
setup?: SkillEvalToolCall[];
|
|
64
|
+
}
|
|
65
|
+
export interface VideoEvalFixture {
|
|
66
|
+
editor: 'video';
|
|
67
|
+
/** Tool calls that build the starting project (settings, assets, clips, markers), run in order. */
|
|
68
|
+
setup?: SkillEvalToolCall[];
|
|
69
|
+
}
|
|
70
|
+
/** One eval file of a skill. */
|
|
71
|
+
export interface SkillEvalFile {
|
|
72
|
+
skill: string;
|
|
73
|
+
/** Path relative to the skills directory, e.g. `pixerate-image-selection-masking/evals/local-adjustment.json`. */
|
|
74
|
+
path: string;
|
|
75
|
+
eval: SkillEval;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The evals in a set of skill files (paths relative to the skills directory, contents as text,
|
|
79
|
+
* like `SkillFiles` but including `evals/*.json`), sorted by path.
|
|
80
|
+
*/
|
|
81
|
+
export declare function listSkillEvals(files: Readonly<Record<string, string>>): SkillEvalFile[];
|
|
82
|
+
/** The RGBA pixels of an image fixture: shapes painted over the background in order. */
|
|
83
|
+
export declare function imageEvalFixturePixels(f: ImageEvalFixture): {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
data: Uint8ClampedArray;
|
|
87
|
+
};
|
|
88
|
+
/** Calls a tool by the bare name an eval uses; the harness maps it to its own names if it must. */
|
|
89
|
+
export type SkillEvalToolCaller = (tool: string, args: Record<string, unknown>) => Promise<McpToolResult>;
|
|
90
|
+
/** Calls one eval tool step (resolving `$read` arguments); throws with the tool's error text. */
|
|
91
|
+
export declare function callEvalTool(callTool: SkillEvalToolCaller, { tool, args }: SkillEvalToolCall): Promise<unknown>;
|
|
92
|
+
/**
|
|
93
|
+
* Whether `actual` matches `expected`. Objects match key by key (other keys are ignored),
|
|
94
|
+
* arrays element by element with the same length, other values exactly. Operators:
|
|
95
|
+
* `$min` / `$max` (numbers), `$type`, `$match` (a regular expression, or `[pattern, flags]`), `$in`, `$not`,
|
|
96
|
+
* `$every` / `$some` (array elements), `$length`, `$unique`, `$distinct` (the distinct
|
|
97
|
+
* values), `$sum`, `$column: [index, matcher]` (one column of a 2D array), `$nonEmpty`
|
|
98
|
+
* (the array without empty cells or rows) and `$expr` (a JavaScript expression over `v`).
|
|
99
|
+
*/
|
|
100
|
+
export declare function matchesEvalExpectation(actual: unknown, expected: unknown): boolean;
|
|
101
|
+
/** The checks that fail, each as its `why` with what the tool returned (or its error). */
|
|
102
|
+
export declare function failedEvalChecks(callTool: SkillEvalToolCaller, checks: readonly SkillEvalCheck[]): Promise<string[]>;
|
package/dist/tools/skills.d.cts
CHANGED
|
@@ -13,11 +13,22 @@ export interface SkillInfo {
|
|
|
13
13
|
description: string;
|
|
14
14
|
/** Other files of the skill relative to its directory, e.g. `references/commands.md`. */
|
|
15
15
|
references: string[];
|
|
16
|
+
/**
|
|
17
|
+
* `workflow` for a skill that covers one job from start to finish on a reference skill's tools
|
|
18
|
+
* (frontmatter `metadata.kind: workflow`); otherwise `reference`.
|
|
19
|
+
*/
|
|
20
|
+
kind: 'reference' | 'workflow';
|
|
21
|
+
/** A workflow skill's reference skill (frontmatter `metadata.reference`), whose tools it uses. */
|
|
22
|
+
reference?: string;
|
|
16
23
|
}
|
|
17
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Reads `name`, `description` and the one-level `metadata` map (`metadata.kind`,
|
|
26
|
+
* `metadata.reference`, …) from a SKILL.md's YAML frontmatter.
|
|
27
|
+
*/
|
|
18
28
|
export declare function parseSkillFrontmatter(markdown: string): {
|
|
19
29
|
name?: string;
|
|
20
30
|
description?: string;
|
|
31
|
+
metadata: Record<string, string>;
|
|
21
32
|
body: string;
|
|
22
33
|
};
|
|
23
34
|
/** The skills in a set of skill files, sorted by name. */
|
package/dist/tools/skills.d.ts
CHANGED
|
@@ -13,11 +13,22 @@ export interface SkillInfo {
|
|
|
13
13
|
description: string;
|
|
14
14
|
/** Other files of the skill relative to its directory, e.g. `references/commands.md`. */
|
|
15
15
|
references: string[];
|
|
16
|
+
/**
|
|
17
|
+
* `workflow` for a skill that covers one job from start to finish on a reference skill's tools
|
|
18
|
+
* (frontmatter `metadata.kind: workflow`); otherwise `reference`.
|
|
19
|
+
*/
|
|
20
|
+
kind: 'reference' | 'workflow';
|
|
21
|
+
/** A workflow skill's reference skill (frontmatter `metadata.reference`), whose tools it uses. */
|
|
22
|
+
reference?: string;
|
|
16
23
|
}
|
|
17
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Reads `name`, `description` and the one-level `metadata` map (`metadata.kind`,
|
|
26
|
+
* `metadata.reference`, …) from a SKILL.md's YAML frontmatter.
|
|
27
|
+
*/
|
|
18
28
|
export declare function parseSkillFrontmatter(markdown: string): {
|
|
19
29
|
name?: string;
|
|
20
30
|
description?: string;
|
|
31
|
+
metadata: Record<string, string>;
|
|
21
32
|
body: string;
|
|
22
33
|
};
|
|
23
34
|
/** The skills in a set of skill files, sorted by name. */
|
package/package.json
CHANGED
package/skills/README.md
CHANGED
|
@@ -121,7 +121,9 @@ same change.
|
|
|
121
121
|
tool, or `run_command` with a read-only command such as `vector.list`, its `args`, what its result must match in `expect`, and `why`) and a `solution` (the
|
|
122
122
|
tool calls an expert would make). The test proves each eval: some check fails on the fixture,
|
|
123
123
|
and all pass after the solution. A model harness runs the same file with the model in place
|
|
124
|
-
of the solution
|
|
124
|
+
of the solution, using `@pixerate/editor/tools`: `listSkillEvals` reads the eval files,
|
|
125
|
+
`imageEvalFixturePixels` paints an image fixture, and `failedEvalChecks` runs the checks
|
|
126
|
+
through the harness's own tool calls (`matchesEvalExpectation` is the matcher on its own). In `expect`, objects match key by key and arrays element by element, with
|
|
125
127
|
operators for ranges and lists (`$min`, `$max`, `$match`, `$every`, `$some`, `$length`,
|
|
126
128
|
`$unique`, `$distinct`, `$sum`, `$column`, `$nonEmpty`, `$not`, `$in`, `$type`); a check's
|
|
127
129
|
argument can read a value the job created with `{ "$read": "list_layers", "path":
|
|
@@ -42,7 +42,9 @@ editor's, or (in discovery mode) only `list_toolsets`, `search_tools`, `enable_t
|
|
|
42
42
|
toolset when you will use many of its tools). The tools then appear in your list. Use
|
|
43
43
|
`disable_tools` to drop a toolset you are done with.
|
|
44
44
|
4. **Read the skill before working in a toolset.** `get_skill` with the skill `list_toolsets`
|
|
45
|
-
names (or the MCP prompt / `skill://` resource of the same name).
|
|
45
|
+
names (or the MCP prompt / `skill://` resource of the same name). When the task is a whole
|
|
46
|
+
job one of the toolset's `workflows` covers (a cutout, a photo correction, an icon set), read
|
|
47
|
+
that workflow skill too: it has the steps in order and the check after each.
|
|
46
48
|
5. **Read the house style when there is one.** A toolset with a `style` field in
|
|
47
49
|
`list_toolsets` (or an `enable_tools` result with a `style` line) has house-style skills:
|
|
48
50
|
call `get_style` with that domain before you make or change work there.
|
|
@@ -149,11 +151,11 @@ Never repeat an identical failing call. Never work around a read-only refusal; t
|
|
|
149
151
|
| Tool | Use it to |
|
|
150
152
|
| --- | --- |
|
|
151
153
|
| `list_editors` | See which editors are open in the browser and connected to the MCP bridge (id, name, kind, tool count, last activity). Call it first when tools come through the bridge; pass an id or part of a name as `editor` to any tool to pick one when several are open, otherwise the most recently active editor with that tool answers. If none is connected, ask the user to open the app and connect it. |
|
|
152
|
-
| `list_toolsets` | See the toolsets open now: name, title, what each covers, its skill, how many tools it has and whether they are in your tool list (`enabled`: all, some, none). Call it first in a discovery view, then `search_tools` or `enable_tools`. |
|
|
154
|
+
| `list_toolsets` | See the toolsets open now: name, title, what each covers, its skill, its workflow skills (`workflows`), how many tools it has and whether they are in your tool list (`enabled`: all, some, none). Call it first in a discovery view, then `search_tools` or `enable_tools`. |
|
|
153
155
|
| `search_tools` | Find the tool for a task: pass `query` in plain words (and `toolset` to search one editor, `limit` for more than 10). Returns the best matches first with name, toolset, title, one-sentence summary, whether it only reads and whether it is listed. Follow with `enable_tools`. |
|
|
154
156
|
| `enable_tools` | Add tools to your tool list by full name (`tools`, from `search_tools`) and/or whole `toolsets` (from `list_toolsets`). Returns the names added and how many are listed. Prefer single tools to large toolsets. Unknown names fail and change nothing. Allowed tools can also be called by name without enabling them. |
|
|
155
157
|
| `disable_tools` | Drop tools or whole toolsets you are done with from your tool list, to keep it short. Returns the names removed. |
|
|
156
|
-
| `get_skill` | Read a toolset's skill (markdown) before working with it; pass `file` for one of its reference files (listed at the top). The note at the top says how names are prefixed here. |
|
|
158
|
+
| `get_skill` | Read a toolset's skill (markdown) before working with it, and the workflow skill for the job when one fits; pass `file` for one of its reference files (listed at the top). The note at the top says how names are prefixed here. |
|
|
157
159
|
| `list_styles` | See the house-style skills here, general layer first: name, description, layer, the domains each applies to, which have a profile, whether each is on, and issues that leave all or part of one out. Pass `domain` to see one domain's. Follow with `get_style`. |
|
|
158
160
|
| `get_style` | Read the house style for a `domain` before you make or change work there: each skill's preferences as a `<style_skill>` block naming its layer, the merged profile (tokens resolved), `sources` (which layer set each field) and `issues`. Then check your work with the domain's `check_<domain>_style`. |
|
|
159
161
|
| `get_style_file` | Read one file of a house-style skill (`name`, `file`), such as a `references/*.md` its preferences point to, or its raw profile (`chart.json`) before tokens are resolved. An unknown file fails with the list of its files. |
|