@mulmoclaude/shapescript-plugin 1.0.1 → 1.1.1
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 +27 -4
- package/dist/core/contract.d.ts +42 -0
- package/dist/core/contract.d.ts.map +1 -0
- package/dist/core/definition.d.ts +4 -0
- package/dist/core/definition.d.ts.map +1 -1
- package/dist/core/dispatch.d.ts +38 -0
- package/dist/core/dispatch.d.ts.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/paths.d.ts +40 -0
- package/dist/core/paths.d.ts.map +1 -0
- package/dist/core/plugin.d.ts +20 -3
- package/dist/core/plugin.d.ts.map +1 -1
- package/dist/core/types.d.ts +13 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/lang/de.d.ts.map +1 -1
- package/dist/lang/en.d.ts.map +1 -1
- package/dist/lang/es.d.ts.map +1 -1
- package/dist/lang/fr.d.ts.map +1 -1
- package/dist/lang/ja.d.ts.map +1 -1
- package/dist/lang/ko.d.ts.map +1 -1
- package/dist/lang/messages.d.ts +1 -0
- package/dist/lang/messages.d.ts.map +1 -1
- package/dist/lang/ptBR.d.ts.map +1 -1
- package/dist/lang/zh.d.ts.map +1 -1
- package/dist/{samples-BwRpwZSm.js → samples-6f1sYMm7.js} +2117 -1988
- package/dist/samples-B3VO3Mnc.cjs +195 -0
- package/dist/shapescript/parser.d.ts +1 -0
- package/dist/shapescript/parser.d.ts.map +1 -1
- package/dist/shapescript/toThreeJS.d.ts +3 -3
- package/dist/shapescript/toThreeJS.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/vue/View.vue.d.ts.map +1 -1
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue.cjs +7 -7
- package/dist/vue.js +1492 -1438
- package/package.json +3 -1
- package/dist/samples-D6hOBqbS.cjs +0 -195
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ name, and the `Present3D*` type names, are renamed throughout.
|
|
|
12
12
|
|
|
13
13
|
| Entry | Contents |
|
|
14
14
|
| ------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
15
|
-
| `.` | `TOOL_NAME`, `TOOL_DEFINITION`, `executePresentShapeScript`, `pluginCore`, `samples`, `parseShapeScript`, `astToThreeJS` |
|
|
15
|
+
| `.` | `TOOL_NAME`, `TOOL_DEFINITION`, `executePresentShapeScript`, `pluginCore`, `samples`, `parseShapeScript`, `astToThreeJS`, `executeShapeScriptDispatch` + the `artifacts/shapes` path rules |
|
|
16
16
|
| `./vue` | the `ToolPlugin` (View + Preview + `SYSTEM_PROMPT`), plus everything on `.` |
|
|
17
17
|
| `./style.css` | the compiled component styles (Vite lib mode does not auto-inject them) |
|
|
18
18
|
|
|
@@ -51,6 +51,21 @@ for i in 1 to count {
|
|
|
51
51
|
|
|
52
52
|
A function call takes **no space** before its parenthesis: `sin(x)` is a call, `sin (x)` is not.
|
|
53
53
|
|
|
54
|
+
## Storage
|
|
55
|
+
|
|
56
|
+
A new `script` is saved to `artifacts/shapes/<slug>-<epoch-ms>.shape` and the
|
|
57
|
+
result names it as `data.filePath`; pass `path` instead of `script` to present a
|
|
58
|
+
source that already exists — a `.shape` this tool wrote, or any other on disk —
|
|
59
|
+
and it is rendered in place rather than copied. The two are mutually exclusive.
|
|
60
|
+
The View's source editor writes edits back to that same file (dispatch kinds
|
|
61
|
+
`loadShape` / `saveShape`), and refreshes from disk on open, so a model the agent
|
|
62
|
+
rewrote is what the user sees.
|
|
63
|
+
|
|
64
|
+
All file access goes through the host's generic gui-chat-protocol capability:
|
|
65
|
+
`files.artifacts` for `artifacts/shapes/**`, `files.byPath` for anything else.
|
|
66
|
+
A host that supplies neither keeps the pre-1.1 behaviour — the script travels
|
|
67
|
+
inside the tool result and nothing is written — rather than failing.
|
|
68
|
+
|
|
54
69
|
## Validation and errors
|
|
55
70
|
|
|
56
71
|
`executePresentShapeScript` checks arguments, parses the source, evaluates expressions,
|
|
@@ -133,9 +148,17 @@ self-intersecting inputs may fail.
|
|
|
133
148
|
on the server, which validates it, and again in the browser, which renders it — and an
|
|
134
149
|
unseeded generator lets those two runs take different branches.
|
|
135
150
|
|
|
136
|
-
Conversion limits cover nodes, loop/path work,
|
|
137
|
-
intermediates), and a coarse wall-clock
|
|
138
|
-
the next node once the budget is spent, but
|
|
151
|
+
Conversion limits cover nodes (100,000), loop/path work (100,000 iterations), detail (3–256),
|
|
152
|
+
aggregate vertices (5,000,000, including CSG intermediates), and a coarse 30-second wall-clock
|
|
153
|
+
budget checked between nodes — it refuses to start the next node once the budget is spent, but
|
|
154
|
+
cannot interrupt one long boolean. Every one is overridable through `ConversionOptions`.
|
|
155
|
+
|
|
156
|
+
Measured, those ceilings bind in different places: a grid of 22,500 cubes is ~540k vertices and
|
|
157
|
+
converts in under 200 ms, 930 spheres at `detail 64` reach the vertex budget, and the wall clock
|
|
158
|
+
is in practice the CSG budget alone — 240k vertices of plain geometry take ~95 ms, while 100
|
|
159
|
+
boolean subtractions take 5.3 s. Remember the script is built TWICE, once on the server to
|
|
160
|
+
validate it and once in the browser to draw it, and that the browser's copy is what the user's
|
|
161
|
+
tab has to keep rendering.
|
|
139
162
|
|
|
140
163
|
## Scripts
|
|
141
164
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** True for a non-null, non-array object. Local rather than imported from
|
|
2
|
+
* `@mulmoclaude/common`: this package's only other dependency is
|
|
3
|
+
* `@mulmoclaude/core/artifacts` (browser-safe path rules), and one two-line
|
|
4
|
+
* predicate does not justify a second. */
|
|
5
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
6
|
+
/** Read the current source of an existing ShapeScript artifact — the View
|
|
7
|
+
* refreshes from disk so an edit made elsewhere (the agent, an editor) is
|
|
8
|
+
* what gets rendered, not the copy frozen into the tool result. */
|
|
9
|
+
export interface LoadShapeArgs {
|
|
10
|
+
kind: "loadShape";
|
|
11
|
+
/** Workspace-relative path under `artifacts/shapes/…`. */
|
|
12
|
+
path: string;
|
|
13
|
+
}
|
|
14
|
+
/** Overwrite an existing ShapeScript artifact in place (the source editor's
|
|
15
|
+
* "Apply Changes"). */
|
|
16
|
+
export interface SaveShapeArgs {
|
|
17
|
+
kind: "saveShape";
|
|
18
|
+
/** Workspace-relative path under `artifacts/shapes/…`. */
|
|
19
|
+
path: string;
|
|
20
|
+
script: string;
|
|
21
|
+
}
|
|
22
|
+
/** Discriminated union of every action the View's package router serves. */
|
|
23
|
+
export type ShapeScriptDispatchArgs = LoadShapeArgs | SaveShapeArgs;
|
|
24
|
+
/** Maps a dispatch `kind` to its result shape. Read back with the readers
|
|
25
|
+
* below — protocol 2.0.0 makes `dispatch` return `unknown` without one,
|
|
26
|
+
* because naming the type at the call site never checked anything. */
|
|
27
|
+
export interface ShapeScriptDispatchResult {
|
|
28
|
+
loadShape: {
|
|
29
|
+
script: string;
|
|
30
|
+
};
|
|
31
|
+
saveShape: {
|
|
32
|
+
path: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** True when `value` is a well-formed payload for the package router.
|
|
36
|
+
*
|
|
37
|
+
* `saveShape` additionally requires `script` to be a string — without that,
|
|
38
|
+
* `undefined` would reach `files.artifacts.write` and blank the artifact. */
|
|
39
|
+
export declare function isShapeScriptDispatchArgs(value: unknown): value is ShapeScriptDispatchArgs;
|
|
40
|
+
export declare function readLoadShapeResult(value: unknown): ShapeScriptDispatchResult["loadShape"];
|
|
41
|
+
export declare function readSaveShapeResult(value: unknown): ShapeScriptDispatchResult["saveShape"];
|
|
42
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/core/contract.ts"],"names":[],"mappings":"AAOA;;;2CAG2C;AAC3C,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED;;oEAEoE;AACpE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;CACd;AAED;wBACwB;AACxB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,4EAA4E;AAC5E,MAAM,MAAM,uBAAuB,GAAG,aAAa,GAAG,aAAa,CAAC;AAEpE;;uEAEuE;AACvE,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B;AASD;;;8EAG8E;AAC9E,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,uBAAuB,CAI1F;AAYD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAG1F;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAG1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/core/definition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,uBAAuB,CAAC;AAE9C,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/core/definition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,uBAAuB,CAAC;AAE9C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;CA4K3B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FileOps } from "gui-chat-protocol";
|
|
2
|
+
import type { ShapeScriptDispatchArgs } from "./contract";
|
|
3
|
+
/** Capabilities the dispatch router needs: the generic, shared
|
|
4
|
+
* `files.artifacts` FileOps, plus — for hosts that let presentShapeScript
|
|
5
|
+
* open sources outside `artifacts/shapes/` — `files.byPath`. */
|
|
6
|
+
export interface ShapeScriptDispatchContext {
|
|
7
|
+
files: {
|
|
8
|
+
artifacts: FileOps;
|
|
9
|
+
byPath?: FileOps;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** The FileOps that owns a given source, plus the path in that FileOps' terms.
|
|
13
|
+
* An `artifacts/shapes/**` source goes through `files.artifacts` — the only
|
|
14
|
+
* capability an older host provides, and what writes there — while anything
|
|
15
|
+
* else needs the host's `files.byPath`. */
|
|
16
|
+
export declare function locateShape(context: ShapeScriptDispatchContext, filePath: string): {
|
|
17
|
+
files: FileOps;
|
|
18
|
+
rel: string;
|
|
19
|
+
} | null;
|
|
20
|
+
/**
|
|
21
|
+
* Server-side router for the View's `useRuntime().dispatch({ kind, … })` calls.
|
|
22
|
+
* `loadShape` returns the source's current bytes (the View refreshes from disk
|
|
23
|
+
* rather than trusting the copy in the tool result); `saveShape` overwrites one
|
|
24
|
+
* that already exists, and refuses to create. Both validate containment with
|
|
25
|
+
* the same guards as the tool-call path before touching FileOps.
|
|
26
|
+
*
|
|
27
|
+
* Throws on an invalid path / missing file — the host's dispatch route maps a
|
|
28
|
+
* throw to a non-2xx, which the View's `dispatch` rejects on. Geometry is NOT
|
|
29
|
+
* validated here: the View validates before it dispatches (it has the same
|
|
30
|
+
* parser), and a save that refused to persist a work-in-progress source would
|
|
31
|
+
* make the editor unusable.
|
|
32
|
+
*/
|
|
33
|
+
export declare function executeShapeScriptDispatch(context: ShapeScriptDispatchContext, args: ShapeScriptDispatchArgs): Promise<{
|
|
34
|
+
script: string;
|
|
35
|
+
} | {
|
|
36
|
+
path: string;
|
|
37
|
+
}>;
|
|
38
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/core/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;iEAEiE;AACjE,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACjD;AAED;;;4CAG4C;AAC5C,wBAAgB,WAAW,CAAC,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAKzH;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,0BAA0B,EACnC,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAqChD"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export type { PresentShapeScriptData, PresentShapeScriptArgs, PresentShapeScriptResult, PresentShapeScriptRenderedResult, PresentShapeScriptErrorResult, PresentShapeScriptExecutionResult, ShapeScriptDiagnostic, } from "./types";
|
|
2
2
|
export { TOOL_NAME, TOOL_DEFINITION } from "./definition";
|
|
3
3
|
export { pluginCore, presentShapeScript, executePresentShapeScript } from "./plugin";
|
|
4
|
+
export type { ShapeScriptExecuteContext } from "./plugin";
|
|
5
|
+
export { executeShapeScriptDispatch, locateShape } from "./dispatch";
|
|
6
|
+
export type { ShapeScriptDispatchContext } from "./dispatch";
|
|
7
|
+
export { isShapeScriptDispatchArgs, readLoadShapeResult, readSaveShapeResult } from "./contract";
|
|
8
|
+
export type { LoadShapeArgs, SaveShapeArgs, ShapeScriptDispatchArgs, ShapeScriptDispatchResult } from "./contract";
|
|
9
|
+
export { isPresentableShapePath, isShapeArtifactPath, shapeArtifactPath, toArtifactsRelative, SHAPE_EXTENSIONS } from "./paths";
|
|
4
10
|
export { samples } from "./samples";
|
|
5
11
|
export { parseShapeScript } from "../shapescript/parser";
|
|
6
12
|
export { astToThreeJS } from "../shapescript/toThreeJS";
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrF,YAAY,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjG,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACnH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChI,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** The extension a ShapeScript source carries — upstream ShapeScript's own. */
|
|
2
|
+
export declare const SHAPE_EXTENSIONS: readonly [".shape"];
|
|
3
|
+
/** Lowercase-hyphen slug, capped, leading/trailing hyphens stripped; falls back
|
|
4
|
+
* to `fallback` for empty/undefined/non-ASCII input. */
|
|
5
|
+
export declare function slugify(title: string | undefined, fallback?: string): string;
|
|
6
|
+
export interface ShapePath {
|
|
7
|
+
/** Path relative to the artifacts root — what `files.artifacts.write` takes
|
|
8
|
+
* (e.g. `shapes/a-lamp-1718765432101.shape`). */
|
|
9
|
+
relPath: string;
|
|
10
|
+
/** Workspace-relative path for display / tool-result data
|
|
11
|
+
* (e.g. `artifacts/shapes/a-lamp-1718765432101.shape`). */
|
|
12
|
+
filePath: string;
|
|
13
|
+
}
|
|
14
|
+
/** Build a fresh, collision-safe artifact path for a new ShapeScript source.
|
|
15
|
+
* Flat rather than `YYYY/MM`-partitioned (the `artifacts/stories` shape): a
|
|
16
|
+
* model is something the user opens by name, and one directory keeps that
|
|
17
|
+
* browsable.
|
|
18
|
+
*
|
|
19
|
+
* The random token matters because the timestamp alone does not: two calls
|
|
20
|
+
* sharing a title inside one millisecond mint the SAME name, and the second
|
|
21
|
+
* `write` replaces the first model with no error anywhere (codex on #3056).
|
|
22
|
+
* `token` is injectable so a test can assert the whole filename. */
|
|
23
|
+
export declare function shapeArtifactPath(title: string | undefined, now?: Date, token?: string): ShapePath;
|
|
24
|
+
/**
|
|
25
|
+
* Strict guard for a workspace-relative path the caller claims is an existing
|
|
26
|
+
* ShapeScript artifact. Rejects anything outside `artifacts/shapes/`,
|
|
27
|
+
* non-`.shape`, or with traversal / non-canonical segments — the primary
|
|
28
|
+
* defence before a `files.artifacts` read/write.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isShapeArtifactPath(value: string): boolean;
|
|
31
|
+
/** Convert a workspace-relative artifacts path (`artifacts/shapes/…`) to the
|
|
32
|
+
* `files.artifacts`-relative form (`shapes/…`) that FileOps expects. Assumes
|
|
33
|
+
* the input already passed `isShapeArtifactPath`. */
|
|
34
|
+
export declare function toArtifactsRelative(workspaceRelPath: string): string;
|
|
35
|
+
/** The `path` argument's gate: ANY ShapeScript source, not just the ones this
|
|
36
|
+
* tool wrote — a workspace-relative path (`models/lamp.shape`) or, where the
|
|
37
|
+
* host permits it, an absolute one. Lexical only; the host's `files.byPath`
|
|
38
|
+
* capability decides which of those it will actually open. */
|
|
39
|
+
export declare function isPresentableShapePath(value: string): boolean;
|
|
40
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAoBA,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,qBAAsB,CAAC;AAEpD;yDACyD;AACzD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,SAAsB,GAAG,MAAM,CAEzF;AAED,MAAM,WAAW,SAAS;IACxB;sDACkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB;gEAC4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAeD;;;;;;;;qEAQqE;AACrE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,GAAE,IAAiB,EAAE,KAAK,GAAE,MAAsB,GAAG,SAAS,CAW7H;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED;;sDAEsD;AACtD,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;+DAG+D;AAC/D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D"}
|
package/dist/core/plugin.d.ts
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import type { ToolContext, ToolPluginCore } from "gui-chat-protocol";
|
|
1
|
+
import type { FileOps, ToolContext, ToolPluginCore } from "gui-chat-protocol";
|
|
2
2
|
import type { PresentShapeScriptArgs, PresentShapeScriptData, PresentShapeScriptExecutionResult } from "./types";
|
|
3
3
|
import { TOOL_NAME, TOOL_DEFINITION } from "./definition";
|
|
4
|
-
|
|
4
|
+
/** Host capabilities the ShapeScript core needs, delivered through the GENERIC
|
|
5
|
+
* gui-chat-protocol runtime — `files.artifacts` (the shared, user-browsable
|
|
6
|
+
* output area) for new sources, and `files.byPath` for a `path` outside
|
|
7
|
+
* `artifacts/shapes/`.
|
|
8
|
+
*
|
|
9
|
+
* Both are OPTIONAL, and a plain `ToolContext` satisfies this type: a host
|
|
10
|
+
* with no file layer keeps the pre-1.1 behaviour — the script round-trips
|
|
11
|
+
* inside the tool result and nothing is written — rather than failing. */
|
|
12
|
+
export interface ShapeScriptExecuteContext extends ToolContext {
|
|
13
|
+
files?: {
|
|
14
|
+
/** Rooted at `<workspace>/artifacts` — where NEW sources are written. */
|
|
15
|
+
artifacts: FileOps;
|
|
16
|
+
/** Reads a source the caller named by path: workspace-relative or, where
|
|
17
|
+
* the host allows it, absolute. */
|
|
18
|
+
byPath?: FileOps;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare const presentShapeScript: (context: ShapeScriptExecuteContext, args: PresentShapeScriptArgs) => Promise<PresentShapeScriptExecutionResult>;
|
|
5
22
|
export declare const pluginCore: ToolPluginCore<PresentShapeScriptData, unknown, PresentShapeScriptArgs>;
|
|
6
23
|
export { TOOL_NAME, TOOL_DEFINITION };
|
|
7
|
-
export declare const executePresentShapeScript: (
|
|
24
|
+
export declare const executePresentShapeScript: (context: ShapeScriptExecuteContext, args: PresentShapeScriptArgs) => Promise<PresentShapeScriptExecutionResult>;
|
|
8
25
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/core/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/core/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,iCAAiC,EAAyB,MAAM,SAAS,CAAC;AACxI,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAU1D;;;;;;;2EAO2E;AAC3E,MAAM,WAAW,yBAA0B,SAAQ,WAAW;IAC5D,KAAK,CAAC,EAAE;QACN,yEAAyE;QACzE,SAAS,EAAE,OAAO,CAAC;QACnB;4CACoC;QACpC,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AA+DD,eAAO,MAAM,kBAAkB,GAAU,SAAS,yBAAyB,EAAE,MAAM,sBAAsB,KAAG,OAAO,CAAC,iCAAiC,CAoCpJ,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,sBAAsB,EAAE,OAAO,EAAE,sBAAsB,CAM9F,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AACtC,eAAO,MAAM,yBAAyB,YA/CY,yBAAyB,QAAQ,sBAAsB,KAAG,OAAO,CAAC,iCAAiC,CA+C1F,CAAC"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import type { ToolResult } from "gui-chat-protocol";
|
|
2
2
|
export interface PresentShapeScriptData {
|
|
3
3
|
script: string;
|
|
4
|
+
/** The `.shape` file this result renders, when it is backed by one. Set for
|
|
5
|
+
* every result a host with the `files.artifacts` capability produces; absent
|
|
6
|
+
* for a host that has no file layer, where `script` is the only copy. The
|
|
7
|
+
* View saves edits back to THIS path — without it, "Apply Changes" only
|
|
8
|
+
* updates the conversation's copy. */
|
|
9
|
+
filePath?: string | undefined;
|
|
4
10
|
}
|
|
11
|
+
/** Args the LLM passes when invoking the tool. Two shapes share this type: the
|
|
12
|
+
* create path (`script`, saved to a fresh `artifacts/shapes/**` path) and the
|
|
13
|
+
* present-existing path (`path`, rendered in place). Only `title` is
|
|
14
|
+
* `required` in TOOL_DEFINITION.parameters because JSON Schema can't express
|
|
15
|
+
* that either-or; the executor enforces the mutual exclusion. */
|
|
5
16
|
export interface PresentShapeScriptArgs {
|
|
6
17
|
title: string;
|
|
7
|
-
script
|
|
18
|
+
script?: string;
|
|
19
|
+
path?: string;
|
|
8
20
|
}
|
|
9
21
|
export type PresentShapeScriptResult = ToolResult<PresentShapeScriptData>;
|
|
10
22
|
/** The success shape of `presentShapeScript`.
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf;;;;2CAIuC;IACvC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;;kEAIkE;AAClE,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,MAAM,gCAAgC,GAAG,wBAAwB,GAAG;IACxE,IAAI,EAAE,sBAAsB,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,kBAAkB,GAAG,aAAa,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,kFAAkF;AAClF,MAAM,MAAM,6BAA6B,GAAG,UAAU,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,qBAAqB,CAAA;CAAE,CAAC,GAAG;IAChG,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,qBAAqB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,gCAAgC,GAAG,6BAA6B,CAAC"}
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-B3VO3Mnc.cjs");exports.SHAPE_EXTENSIONS=e.Bn,exports.TOOL_DEFINITION=e.Jn,exports.TOOL_NAME=e.Yn,exports.astToThreeJS=e.a,exports.executePresentShapeScript=e.n,exports.executeShapeScriptDispatch=e.Rn,exports.isPresentableShapePath=e.Vn,exports.isShapeArtifactPath=e.Hn,exports.isShapeScriptDispatchArgs=e.Gn,exports.locateShape=e.zn,exports.parseShapeScript=e.Ln,exports.pluginCore=e.r,exports.presentShapeScript=e.i,exports.readLoadShapeResult=e.Kn,exports.readSaveShapeResult=e.qn,exports.samples=e.t,exports.shapeArtifactPath=e.Un,exports.toArtifactsRelative=e.Wn;
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { Bn as e, Gn as t, Hn as n, Jn as r, Kn as i, Ln as a, Rn as o, Un as s, Vn as c, Wn as l, Yn as u, a as d, i as f, n as p, qn as m, r as h, t as g, zn as _ } from "./samples-6f1sYMm7.js";
|
|
2
|
+
export { e as SHAPE_EXTENSIONS, r as TOOL_DEFINITION, u as TOOL_NAME, d as astToThreeJS, p as executePresentShapeScript, o as executeShapeScriptDispatch, c as isPresentableShapePath, n as isShapeArtifactPath, t as isShapeScriptDispatchArgs, _ as locateShape, a as parseShapeScript, h as pluginCore, f as presentShapeScript, i as readLoadShapeResult, m as readSaveShapeResult, g as samples, s as shapeArtifactPath, l as toArtifactsRelative };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-B3VO3Mnc.cjs");require("./core.cjs"),exports.SHAPE_EXTENSIONS=e.Bn,exports.TOOL_DEFINITION=e.Jn,exports.TOOL_NAME=e.Yn,exports.astToThreeJS=e.a,exports.executePresentShapeScript=e.n,exports.executeShapeScriptDispatch=e.Rn,exports.isPresentableShapePath=e.Vn,exports.isShapeArtifactPath=e.Hn,exports.isShapeScriptDispatchArgs=e.Gn,exports.locateShape=e.zn,exports.parseShapeScript=e.Ln,exports.pluginCore=e.r,exports.presentShapeScript=e.i,exports.readLoadShapeResult=e.Kn,exports.readSaveShapeResult=e.qn,exports.samples=e.t,exports.shapeArtifactPath=e.Un,exports.toArtifactsRelative=e.Wn;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bn as e, Gn as t, Hn as n, Jn as r, Kn as i, Ln as a, Rn as o, Un as s, Vn as c, Wn as l, Yn as u, a as d, i as f, n as p, qn as m, r as h, t as g, zn as _ } from "./samples-6f1sYMm7.js";
|
|
2
2
|
import "./core.js";
|
|
3
|
-
export {
|
|
3
|
+
export { e as SHAPE_EXTENSIONS, r as TOOL_DEFINITION, u as TOOL_NAME, d as astToThreeJS, p as executePresentShapeScript, o as executeShapeScriptDispatch, c as isPresentableShapePath, n as isShapeArtifactPath, t as isShapeScriptDispatchArgs, _ as locateShape, a as parseShapeScript, h as pluginCore, f as presentShapeScript, i as readLoadShapeResult, m as readSaveShapeResult, g as samples, s as shapeArtifactPath, l as toArtifactsRelative };
|
package/dist/lang/de.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../src/lang/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../src/lang/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAUT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/en.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/lang/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/lang/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAUT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/es.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/lang/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/lang/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAUT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/fr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/lang/fr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/lang/fr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAUT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/ja.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ja.d.ts","sourceRoot":"","sources":["../../src/lang/ja.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ja.d.ts","sourceRoot":"","sources":["../../src/lang/ja.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAUT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/ko.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ko.d.ts","sourceRoot":"","sources":["../../src/lang/ko.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ko.d.ts","sourceRoot":"","sources":["../../src/lang/ko.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAUT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/messages.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/lang/messages.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/lang/messages.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/lang/ptBR.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ptBR.d.ts","sourceRoot":"","sources":["../../src/lang/ptBR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"ptBR.d.ts","sourceRoot":"","sources":["../../src/lang/ptBR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,IAAI,EAAE,QAUX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/lang/zh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh.d.ts","sourceRoot":"","sources":["../../src/lang/zh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"zh.d.ts","sourceRoot":"","sources":["../../src/lang/zh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAUT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|