@snaptrude/plugin-core 0.0.0-dev-20260708130115 → 0.0.0-dev-20260827135706
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/CHANGELOG.md +152 -1
- package/api-manifest.json +3620 -276
- package/dist/api/analysis/daylight.d.ts +603 -0
- package/dist/api/analysis/daylight.d.ts.map +1 -0
- package/dist/api/analysis/heatmaps.d.ts +658 -0
- package/dist/api/analysis/heatmaps.d.ts.map +1 -0
- package/dist/api/analysis/illuminance.d.ts +145 -0
- package/dist/api/analysis/illuminance.d.ts.map +1 -0
- package/dist/api/analysis/index.d.ts +59 -0
- package/dist/api/analysis/index.d.ts.map +1 -0
- package/dist/api/analysis/shadows.d.ts +165 -0
- package/dist/api/analysis/shadows.d.ts.map +1 -0
- package/dist/api/analysis/solar.d.ts +249 -0
- package/dist/api/analysis/solar.d.ts.map +1 -0
- package/dist/api/analysis/sunlightHours.d.ts +208 -0
- package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
- package/dist/api/analysis/sunpath.d.ts +80 -0
- package/dist/api/analysis/sunpath.d.ts.map +1 -0
- package/dist/api/analysis/weather.d.ts +193 -0
- package/dist/api/analysis/weather.d.ts.map +1 -0
- package/dist/api/core/camera/index.d.ts +261 -0
- package/dist/api/core/camera/index.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +105 -2
- package/dist/api/core/comment/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +840 -14
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/delete/index.d.ts +8 -2
- package/dist/api/core/geom/delete/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +5 -5
- package/dist/api/core/geom/query/brep.d.ts +130 -18
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/circle.d.ts +18 -18
- package/dist/api/core/geom/query/contour.d.ts +20 -20
- package/dist/api/core/geom/query/curve.d.ts +49 -49
- package/dist/api/core/geom/query/edge.d.ts +5 -5
- package/dist/api/core/geom/query/face.d.ts +16 -16
- package/dist/api/core/geom/query/halfedge.d.ts +8 -8
- package/dist/api/core/geom/query/profile.d.ts +19 -19
- package/dist/api/core/geom/query/vertex.d.ts +8 -8
- package/dist/api/core/geom/update/contour.d.ts +14 -14
- package/dist/api/core/geom/update/curve.d.ts +7 -7
- package/dist/api/core/geom/update/profile.d.ts +16 -16
- package/dist/api/core/handles/index.d.ts +210 -0
- package/dist/api/core/handles/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +34 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/export/index.d.ts +134 -0
- package/dist/api/core/io/export/index.d.ts.map +1 -0
- package/dist/api/core/io/import/index.d.ts +453 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +40 -0
- package/dist/api/core/io/index.d.ts.map +1 -0
- package/dist/api/core/io/job/index.d.ts +139 -0
- package/dist/api/core/io/job/index.d.ts.map +1 -0
- package/dist/api/core/io/query/index.d.ts +74 -0
- package/dist/api/core/io/query/index.d.ts.map +1 -0
- package/dist/api/core/io/terrain/index.d.ts +341 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +805 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +7 -7
- package/dist/api/core/mode/index.d.ts +99 -0
- package/dist/api/core/mode/index.d.ts.map +1 -0
- package/dist/api/core/project/index.d.ts +68 -1
- package/dist/api/core/project/index.d.ts.map +1 -1
- package/dist/api/core/proposals/index.d.ts +531 -0
- package/dist/api/core/proposals/index.d.ts.map +1 -0
- package/dist/api/core/storeys/index.d.ts +265 -0
- package/dist/api/core/storeys/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +24 -0
- package/dist/api/core/tags.d.ts.map +1 -1
- package/dist/api/core/user.d.ts +44 -0
- package/dist/api/core/user.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +4 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/boolean/index.d.ts +4 -4
- package/dist/api/design/create/index.d.ts +568 -45
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +3 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +195 -0
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/edit/index.d.ts +1 -1
- package/dist/api/design/erase/index.d.ts +2 -2
- package/dist/api/design/family.d.ts +349 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +181 -8
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +98 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/lock.d.ts +26 -0
- package/dist/api/design/lock.d.ts.map +1 -1
- package/dist/api/design/materials/index.d.ts +270 -16
- package/dist/api/design/materials/index.d.ts.map +1 -1
- package/dist/api/design/query/geometry/index.d.ts +112 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +282 -11
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/referenceLines.d.ts +45 -0
- package/dist/api/design/query/referenceLines.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +181 -8
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +144 -0
- package/dist/api/design/selection/index.d.ts.map +1 -1
- package/dist/api/design/transform/index.d.ts +172 -10
- package/dist/api/design/transform/index.d.ts.map +1 -1
- package/dist/api/design/types/index.d.ts +181 -0
- package/dist/api/design/types/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +553 -2
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/visibility.d.ts +126 -0
- package/dist/api/design/visibility.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +113 -2
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/buildableEnvelope.d.ts +4 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +10 -2
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +21 -21
- package/dist/api/entity/story.d.ts +242 -15
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +25 -25
- package/dist/api/presentation/annotate.d.ts +467 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +111 -8
- package/dist/api/presentation/diagrams.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +108 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +55 -4
- package/dist/api/presentation/import.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +58 -1
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +1139 -0
- package/dist/api/presentation/placedViews.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +481 -0
- package/dist/api/presentation/shapes.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +452 -13
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/slideshow.d.ts +125 -0
- package/dist/api/presentation/slideshow.d.ts.map +1 -0
- package/dist/api/presentation/tables.d.ts +81 -0
- package/dist/api/presentation/tables.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +367 -7
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/program/areas.d.ts +102 -12
- package/dist/api/program/areas.d.ts.map +1 -1
- package/dist/api/program/cores.d.ts +3 -99
- package/dist/api/program/cores.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +7 -15
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/layout.d.ts +346 -11
- package/dist/api/program/layout.d.ts.map +1 -1
- package/dist/api/program/site.d.ts +469 -13
- package/dist/api/program/site.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +365 -41
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +505 -0
- package/dist/api/workspace/index.d.ts.map +1 -0
- package/dist/errors/codes.d.ts +34 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/envelope.d.ts +56 -0
- package/dist/errors/envelope.d.ts.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/plugin-error.d.ts +69 -0
- package/dist/errors/plugin-error.d.ts.map +1 -0
- package/dist/handles.d.ts +97 -25
- package/dist/handles.d.ts.map +1 -1
- package/dist/host-utils.d.ts +4 -0
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4582 -1422
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4171 -1411
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/scripts/generate-manifest.mjs +45 -0
- package/scripts/generate-manifest.test.mjs +103 -4
- package/src/api/analysis/daylight.ts +470 -0
- package/src/api/analysis/heatmaps.ts +683 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +61 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/solar.ts +237 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/analysis/weather.ts +179 -0
- package/src/api/core/camera/index.ts +268 -0
- package/src/api/core/comment/index.ts +120 -2
- package/src/api/core/geom/create/index.ts +912 -1
- package/src/api/core/geom/delete/index.ts +6 -0
- package/src/api/core/geom/query/brep.ts +119 -0
- package/src/api/core/handles/index.ts +233 -0
- package/src/api/core/index.ts +34 -0
- package/src/api/core/io/export/index.ts +126 -0
- package/src/api/core/io/import/index.ts +496 -0
- package/src/api/core/io/index.ts +42 -0
- package/src/api/core/io/job/index.ts +140 -0
- package/src/api/core/io/query/index.ts +71 -0
- package/src/api/core/io/terrain/index.ts +360 -0
- package/src/api/core/io/underlay/index.ts +705 -0
- package/src/api/core/mode/index.ts +96 -0
- package/src/api/core/project/index.ts +62 -1
- package/src/api/core/proposals/index.ts +569 -0
- package/src/api/core/storeys/index.ts +294 -0
- package/src/api/core/tags.ts +27 -0
- package/src/api/core/user.ts +46 -0
- package/src/api/core/zoom/index.ts +4 -0
- package/src/api/design/create/index.ts +670 -30
- package/src/api/design/delete/index.ts +3 -0
- package/src/api/design/doors/index.ts +208 -0
- package/src/api/design/erase/index.ts +1 -1
- package/src/api/design/family.ts +388 -0
- package/src/api/design/furniture/index.ts +197 -8
- package/src/api/design/index.ts +102 -0
- package/src/api/design/lock.ts +27 -0
- package/src/api/design/materials/index.ts +334 -27
- package/src/api/design/query/geometry/index.ts +125 -3
- package/src/api/design/query/index.ts +217 -7
- package/src/api/design/query/referenceLines.ts +52 -0
- package/src/api/design/query/spaces.ts +143 -0
- package/src/api/design/selection/index.ts +129 -0
- package/src/api/design/transform/index.ts +170 -9
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +631 -3
- package/src/api/design/visibility.ts +143 -0
- package/src/api/design/windows/index.ts +128 -2
- package/src/api/entity/buildableEnvelope.ts +4 -0
- package/src/api/entity/referenceLine.ts +8 -0
- package/src/api/entity/story.ts +259 -15
- package/src/api/index.ts +10 -0
- package/src/api/presentation/annotate.ts +385 -0
- package/src/api/presentation/diagrams.ts +118 -8
- package/src/api/presentation/export.ts +108 -0
- package/src/api/presentation/import.ts +51 -4
- package/src/api/presentation/index.ts +66 -1
- package/src/api/presentation/placedViews.ts +1120 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +400 -13
- package/src/api/presentation/slideshow.ts +134 -0
- package/src/api/presentation/tables.ts +84 -0
- package/src/api/presentation/views.ts +376 -8
- package/src/api/program/areas.ts +88 -15
- package/src/api/program/cores.ts +3 -91
- package/src/api/program/index.ts +7 -15
- package/src/api/program/layout.ts +365 -11
- package/src/api/program/site.ts +435 -13
- package/src/api/program/spreadsheet.ts +376 -35
- package/src/api/workspace/index.ts +563 -0
- package/src/errors/codes.ts +136 -0
- package/src/errors/envelope.ts +75 -0
- package/src/errors/index.ts +21 -0
- package/src/errors/plugin-error.ts +134 -0
- package/src/handles.ts +123 -13
- package/src/host-utils.ts +4 -0
- package/src/index.ts +1 -0
- package/test/errors.test.mjs +184 -0
- package/tsconfig.json +7 -2
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { PluginApiReturn } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* `snaptrude.workspace.*` — the dashboard surface: projects and teams outside the
|
|
5
|
+
* open canvas.
|
|
6
|
+
*
|
|
7
|
+
* This namespace reads and creates the containers a design lives in — the
|
|
8
|
+
* project itself and the team it belongs to — mirroring the Snaptrude dashboard.
|
|
9
|
+
* Teams are **read-only** here (no create/invite/delete in v1, a deliberate
|
|
10
|
+
* safety decision); there are no folders in v1. A `projectId` is the project's
|
|
11
|
+
* floorkey. Plan limits are enforced by the backend — a limit rejection surfaces
|
|
12
|
+
* as a normal host error. It also carries the workspace-level mode switch for
|
|
13
|
+
* Present mode ({@linkcode PluginWorkspaceApi.openPresentMode} /
|
|
14
|
+
* {@linkcode PluginWorkspaceApi.closePresentMode}).
|
|
15
|
+
*
|
|
16
|
+
* - {@linkcode PluginWorkspaceApi.projects} — Create, copy, list, read & rename projects
|
|
17
|
+
* - {@linkcode PluginWorkspaceApi.teams} — Read teams and their members
|
|
18
|
+
* - {@linkcode PluginWorkspaceApi.openPresentMode} / {@linkcode PluginWorkspaceApi.closePresentMode} — Open/close the Present-mode documentation editor
|
|
19
|
+
*/
|
|
20
|
+
export declare abstract class PluginWorkspaceApi {
|
|
21
|
+
/** Projects — create, copy, list, read & rename. See {@linkcode PluginWorkspaceProjectsApi}. */
|
|
22
|
+
abstract projects: PluginWorkspaceProjectsApi;
|
|
23
|
+
/** Teams — read teams and their members. See {@linkcode PluginWorkspaceTeamsApi}. */
|
|
24
|
+
abstract teams: PluginWorkspaceTeamsApi;
|
|
25
|
+
/**
|
|
26
|
+
* Open Present mode — the documentation editor the `presentation.*`
|
|
27
|
+
* namespaces operate on.
|
|
28
|
+
*
|
|
29
|
+
* Switches the workspace into Present mode and resolves only once the
|
|
30
|
+
* Present canvas has finished mounting (waits up to ~15s; a mount that
|
|
31
|
+
* never completes is refused with a typed `PRECONDITION_FAILED`), so a
|
|
32
|
+
* `presentation.*` call issued right after this resolves finds Present
|
|
33
|
+
* mode open. Idempotent — resolves immediately when Present mode is
|
|
34
|
+
* already open. Write-gated: switching the mode under the user's feet is
|
|
35
|
+
* approval-controlled by design.
|
|
36
|
+
*
|
|
37
|
+
* @throws `PRECONDITION_FAILED` if the Present canvas does not mount within
|
|
38
|
+
* the timeout.
|
|
39
|
+
*
|
|
40
|
+
* @examplePrompt Open present mode
|
|
41
|
+
* @examplePrompt Switch to the presentation editor
|
|
42
|
+
* @examplePrompt Open the sheets so I can lay out views
|
|
43
|
+
*
|
|
44
|
+
* # Example
|
|
45
|
+
* ```ts
|
|
46
|
+
* await snaptrude.workspace.openPresentMode()
|
|
47
|
+
* const { sheets } = await snaptrude.presentation.sheets.list()
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
abstract openPresentMode(): PluginApiReturn<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Close Present mode and return to the modeling canvas.
|
|
53
|
+
*
|
|
54
|
+
* Idempotent — a no-op when Present mode is not open. Write-gated, like
|
|
55
|
+
* {@linkcode PluginWorkspaceApi.openPresentMode}.
|
|
56
|
+
*
|
|
57
|
+
* @examplePrompt Close present mode
|
|
58
|
+
* @examplePrompt Exit the presentation editor
|
|
59
|
+
* @examplePrompt Go back to the modeling canvas
|
|
60
|
+
*
|
|
61
|
+
* # Example
|
|
62
|
+
* ```ts
|
|
63
|
+
* await snaptrude.workspace.closePresentMode()
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
abstract closePresentMode(): PluginApiReturn<void>;
|
|
67
|
+
constructor();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* `workspace.projects.*` — create, copy, list, read & rename projects.
|
|
71
|
+
*
|
|
72
|
+
* A **project** is a single Snaptrude model, identified by its `projectId`
|
|
73
|
+
* (floorkey). Reads never throw for a miss ({@linkcode PluginWorkspaceProjectsApi.get}
|
|
74
|
+
* returns `null`). Create/copy/rename go through the backend, which enforces plan
|
|
75
|
+
* limits — a rejection surfaces as a normal host error.
|
|
76
|
+
*
|
|
77
|
+
* Accessed via `snaptrude.workspace.projects`.
|
|
78
|
+
*/
|
|
79
|
+
export declare abstract class PluginWorkspaceProjectsApi {
|
|
80
|
+
constructor();
|
|
81
|
+
/**
|
|
82
|
+
* Create a new, empty BIM project.
|
|
83
|
+
*
|
|
84
|
+
* Creates the project on the backend and returns its `projectId` (floorkey).
|
|
85
|
+
* Pass `options.teamId` to create it inside a team (otherwise it lands in the
|
|
86
|
+
* user's personal workspace) and `options.unit` to set the default length unit.
|
|
87
|
+
*
|
|
88
|
+
* @param name - Display name of the new project.
|
|
89
|
+
* @param options - Optional `unit` (default length unit) and `teamId` (owning team).
|
|
90
|
+
* @returns The new project's `projectId`.
|
|
91
|
+
* @throws If the backend rejects the create (e.g. a plan project limit).
|
|
92
|
+
*
|
|
93
|
+
* @examplePrompt Create a new project called Tower Study
|
|
94
|
+
* @examplePrompt Start a new project in the Acme team
|
|
95
|
+
* @examplePrompt Make a fresh project using millimeters
|
|
96
|
+
* @examplePrompt Create an empty project for me to work in
|
|
97
|
+
*
|
|
98
|
+
* # Example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const { projectId } = await snaptrude.workspace.projects.create("Tower Study", {
|
|
101
|
+
* teamId: "team_1",
|
|
102
|
+
* unit: "mm",
|
|
103
|
+
* })
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
abstract create(name: string, options?: {
|
|
107
|
+
unit?: string;
|
|
108
|
+
teamId?: string;
|
|
109
|
+
}): PluginApiReturn<PluginWorkspaceProjectsCreateResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Copy the **current** project into a new project — the dashboard's "Save As".
|
|
112
|
+
*
|
|
113
|
+
* Duplicates the project that is currently open into a new project with the
|
|
114
|
+
* given name, and returns the new `projectId`. Pass `options.teamId` to place
|
|
115
|
+
* the copy in a specific team.
|
|
116
|
+
*
|
|
117
|
+
* @param name - Display name for the copy.
|
|
118
|
+
* @param options - Optional `teamId` (team to place the copy in).
|
|
119
|
+
* @returns The new project's `projectId`.
|
|
120
|
+
* @throws If the backend rejects the copy (e.g. a plan project limit).
|
|
121
|
+
*
|
|
122
|
+
* @examplePrompt Save this project as a new copy called Tower Study v2
|
|
123
|
+
* @examplePrompt Duplicate the current project into the Acme team
|
|
124
|
+
* @examplePrompt Make a copy of this project so I can try changes
|
|
125
|
+
*
|
|
126
|
+
* # Example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const { projectId } = await snaptrude.workspace.projects.copy("Tower Study v2")
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
abstract copy(name: string, options?: {
|
|
132
|
+
teamId?: string;
|
|
133
|
+
}): PluginApiReturn<PluginWorkspaceProjectsCopyResult>;
|
|
134
|
+
/**
|
|
135
|
+
* List the projects the user can access.
|
|
136
|
+
*
|
|
137
|
+
* Returns a {@linkcode PluginProjectRef} per project. Pass `options.teamId` to
|
|
138
|
+
* scope the list to a single team; omit it for the user's accessible projects.
|
|
139
|
+
*
|
|
140
|
+
* @param options - Optional `teamId` filter.
|
|
141
|
+
* @returns A {@linkcode PluginWorkspaceProjectsListResult} with a `projects`
|
|
142
|
+
* array (empty when there are none).
|
|
143
|
+
*
|
|
144
|
+
* @examplePrompt List all my projects
|
|
145
|
+
* @examplePrompt Show the projects in the Acme team
|
|
146
|
+
* @examplePrompt How many projects do I have?
|
|
147
|
+
* @examplePrompt What projects can I open?
|
|
148
|
+
*
|
|
149
|
+
* # Example
|
|
150
|
+
* ```ts
|
|
151
|
+
* const { projects } = await snaptrude.workspace.projects.list({ teamId: "team_1" })
|
|
152
|
+
* for (const p of projects) console.log(p.id, p.name)
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
abstract list(options?: {
|
|
156
|
+
teamId?: string;
|
|
157
|
+
}): PluginApiReturn<PluginWorkspaceProjectsListResult>;
|
|
158
|
+
/**
|
|
159
|
+
* Get a single project by id.
|
|
160
|
+
*
|
|
161
|
+
* @param projectId - The project's `projectId` (floorkey).
|
|
162
|
+
* @returns The matching {@linkcode PluginProjectRef}, or `null` if no project
|
|
163
|
+
* has that id / the user cannot access it.
|
|
164
|
+
*
|
|
165
|
+
* @examplePrompt Get the project with this id
|
|
166
|
+
* @examplePrompt Look up a project by its floorkey
|
|
167
|
+
* @examplePrompt What is the name of this project?
|
|
168
|
+
*
|
|
169
|
+
* # Example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const project = await snaptrude.workspace.projects.get("floorkey_123")
|
|
172
|
+
* if (project) console.log(project.name)
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
abstract get(projectId: string): PluginApiReturn<PluginWorkspaceProjectsGetResult>;
|
|
176
|
+
/**
|
|
177
|
+
* Rename a project.
|
|
178
|
+
*
|
|
179
|
+
* @param projectId - The project's `projectId` (floorkey).
|
|
180
|
+
* @param name - The project's new display name.
|
|
181
|
+
* @returns The renamed project's `projectId`.
|
|
182
|
+
* @throws If no project has the given id or the rename is rejected.
|
|
183
|
+
*
|
|
184
|
+
* @examplePrompt Rename this project to Tower Study Final
|
|
185
|
+
* @examplePrompt Change the name of project floorkey_123
|
|
186
|
+
* @examplePrompt Give this project a new name
|
|
187
|
+
*
|
|
188
|
+
* # Example
|
|
189
|
+
* ```ts
|
|
190
|
+
* const { projectId } = await snaptrude.workspace.projects.rename(
|
|
191
|
+
* "floorkey_123",
|
|
192
|
+
* "Tower Study Final",
|
|
193
|
+
* )
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
abstract rename(projectId: string, name: string): PluginApiReturn<PluginWorkspaceProjectsRenameResult>;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* `workspace.teams.*` — read teams and their members.
|
|
200
|
+
*
|
|
201
|
+
* A **team** is a shared workspace that owns projects and members. **Read-only**
|
|
202
|
+
* in v1: there is no create/invite/delete (a deliberate safety decision). Reads
|
|
203
|
+
* never throw for a miss ({@linkcode PluginWorkspaceTeamsApi.get} returns `null`).
|
|
204
|
+
*
|
|
205
|
+
* Accessed via `snaptrude.workspace.teams`.
|
|
206
|
+
*/
|
|
207
|
+
export declare abstract class PluginWorkspaceTeamsApi {
|
|
208
|
+
constructor();
|
|
209
|
+
/**
|
|
210
|
+
* List the teams the user belongs to.
|
|
211
|
+
*
|
|
212
|
+
* @returns A {@linkcode PluginWorkspaceTeamsListResult} with a `teams` array
|
|
213
|
+
* (empty when the user belongs to none).
|
|
214
|
+
*
|
|
215
|
+
* @examplePrompt List all my teams
|
|
216
|
+
* @examplePrompt Which teams am I a member of?
|
|
217
|
+
* @examplePrompt Show every team I can access
|
|
218
|
+
*
|
|
219
|
+
* # Example
|
|
220
|
+
* ```ts
|
|
221
|
+
* const { teams } = await snaptrude.workspace.teams.list()
|
|
222
|
+
* for (const t of teams) console.log(t.id, t.name)
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
abstract list(): PluginApiReturn<PluginWorkspaceTeamsListResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Get a single team by id.
|
|
228
|
+
*
|
|
229
|
+
* @param teamId - The id of the team to read.
|
|
230
|
+
* @returns The matching {@linkcode PluginTeamRef}, or `null` if no team has that
|
|
231
|
+
* id / the user is not a member.
|
|
232
|
+
*
|
|
233
|
+
* @examplePrompt Get the team with id team_1
|
|
234
|
+
* @examplePrompt Look up a team by its id
|
|
235
|
+
* @examplePrompt What is the name of this team?
|
|
236
|
+
*
|
|
237
|
+
* # Example
|
|
238
|
+
* ```ts
|
|
239
|
+
* const team = await snaptrude.workspace.teams.get("team_1")
|
|
240
|
+
* if (team) console.log(team.name)
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
abstract get(teamId: string): PluginApiReturn<PluginWorkspaceTeamsGetResult>;
|
|
244
|
+
/**
|
|
245
|
+
* List the members of a team.
|
|
246
|
+
*
|
|
247
|
+
* @param teamId - The id of the team whose members to list.
|
|
248
|
+
* @returns A {@linkcode PluginWorkspaceTeamsListMembersResult} with a `members`
|
|
249
|
+
* array (empty when the team has none / is missing).
|
|
250
|
+
*
|
|
251
|
+
* @examplePrompt List the members of the Acme team
|
|
252
|
+
* @examplePrompt Who is on team_1?
|
|
253
|
+
* @examplePrompt How many people are in this team?
|
|
254
|
+
*
|
|
255
|
+
* # Example
|
|
256
|
+
* ```ts
|
|
257
|
+
* const { members } = await snaptrude.workspace.teams.listMembers("team_1")
|
|
258
|
+
* for (const m of members) console.log(m.name, m.email)
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
abstract listMembers(teamId: string): PluginApiReturn<PluginWorkspaceTeamsListMembersResult>;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* A project reference — a conservative projection of a project, never the raw
|
|
265
|
+
* backend payload.
|
|
266
|
+
*
|
|
267
|
+
* | Property | Type | Description |
|
|
268
|
+
* |---|---|---|
|
|
269
|
+
* | `id` | `string` | The project's `projectId` (floorkey) |
|
|
270
|
+
* | `name` | `string` | Display name |
|
|
271
|
+
* | `teamId` | `string?` | Owning team id (absent for personal projects) |
|
|
272
|
+
* | `createdAt` | `string?` | Creation timestamp (ISO 8601) when known |
|
|
273
|
+
* | `modifiedAt` | `string?` | Last-modified timestamp (ISO 8601) when known |
|
|
274
|
+
*/
|
|
275
|
+
export declare const PluginProjectRef: z.ZodObject<{
|
|
276
|
+
id: z.ZodString;
|
|
277
|
+
name: z.ZodString;
|
|
278
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
279
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
280
|
+
modifiedAt: z.ZodOptional<z.ZodString>;
|
|
281
|
+
}, z.core.$strip>;
|
|
282
|
+
export type PluginProjectRef = z.infer<typeof PluginProjectRef>;
|
|
283
|
+
/**
|
|
284
|
+
* A team reference — a conservative projection of a team, never the raw backend
|
|
285
|
+
* payload.
|
|
286
|
+
*
|
|
287
|
+
* | Property | Type | Description |
|
|
288
|
+
* |---|---|---|
|
|
289
|
+
* | `id` | `string` | Stable team id |
|
|
290
|
+
* | `name` | `string` | Display name |
|
|
291
|
+
* | `role` | `string?` | The user's role in the team when known |
|
|
292
|
+
*/
|
|
293
|
+
export declare const PluginTeamRef: z.ZodObject<{
|
|
294
|
+
id: z.ZodString;
|
|
295
|
+
name: z.ZodString;
|
|
296
|
+
role: z.ZodOptional<z.ZodString>;
|
|
297
|
+
}, z.core.$strip>;
|
|
298
|
+
export type PluginTeamRef = z.infer<typeof PluginTeamRef>;
|
|
299
|
+
/**
|
|
300
|
+
* A team member reference — a conservative projection of a member, never the raw
|
|
301
|
+
* backend payload.
|
|
302
|
+
*
|
|
303
|
+
* | Property | Type | Description |
|
|
304
|
+
* |---|---|---|
|
|
305
|
+
* | `id` | `string` | Stable user id |
|
|
306
|
+
* | `name` | `string` | Display name |
|
|
307
|
+
* | `email` | `string?` | Email address when known |
|
|
308
|
+
* | `role` | `string?` | The member's role in the team when known |
|
|
309
|
+
*/
|
|
310
|
+
export declare const PluginTeamMemberRef: z.ZodObject<{
|
|
311
|
+
id: z.ZodString;
|
|
312
|
+
name: z.ZodString;
|
|
313
|
+
email: z.ZodOptional<z.ZodString>;
|
|
314
|
+
role: z.ZodOptional<z.ZodString>;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
export type PluginTeamMemberRef = z.infer<typeof PluginTeamMemberRef>;
|
|
317
|
+
/**
|
|
318
|
+
* Arguments for {@linkcode PluginWorkspaceProjectsApi.create} (options flattened).
|
|
319
|
+
*
|
|
320
|
+
* | Property | Type | Description |
|
|
321
|
+
* |---|---|---|
|
|
322
|
+
* | `name` | `string` | Display name of the new project |
|
|
323
|
+
* | `unit` | `string?` | Default length unit |
|
|
324
|
+
* | `teamId` | `string?` | Owning team id (personal workspace if omitted) |
|
|
325
|
+
*/
|
|
326
|
+
export declare const PluginWorkspaceProjectsCreateArgs: z.ZodObject<{
|
|
327
|
+
name: z.ZodString;
|
|
328
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
329
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
330
|
+
}, z.core.$strip>;
|
|
331
|
+
export type PluginWorkspaceProjectsCreateArgs = z.infer<typeof PluginWorkspaceProjectsCreateArgs>;
|
|
332
|
+
/**
|
|
333
|
+
* Result of {@linkcode PluginWorkspaceProjectsApi.create}.
|
|
334
|
+
*
|
|
335
|
+
* | Property | Type | Description |
|
|
336
|
+
* |---|---|---|
|
|
337
|
+
* | `projectId` | `string` | The id (floorkey) of the created project |
|
|
338
|
+
*/
|
|
339
|
+
export declare const PluginWorkspaceProjectsCreateResult: z.ZodObject<{
|
|
340
|
+
projectId: z.ZodString;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
export type PluginWorkspaceProjectsCreateResult = z.infer<typeof PluginWorkspaceProjectsCreateResult>;
|
|
343
|
+
/**
|
|
344
|
+
* Arguments for {@linkcode PluginWorkspaceProjectsApi.copy} (options flattened).
|
|
345
|
+
*
|
|
346
|
+
* | Property | Type | Description |
|
|
347
|
+
* |---|---|---|
|
|
348
|
+
* | `name` | `string` | Display name for the copy |
|
|
349
|
+
* | `teamId` | `string?` | Team to place the copy in |
|
|
350
|
+
*/
|
|
351
|
+
export declare const PluginWorkspaceProjectsCopyArgs: z.ZodObject<{
|
|
352
|
+
name: z.ZodString;
|
|
353
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
354
|
+
}, z.core.$strip>;
|
|
355
|
+
export type PluginWorkspaceProjectsCopyArgs = z.infer<typeof PluginWorkspaceProjectsCopyArgs>;
|
|
356
|
+
/**
|
|
357
|
+
* Result of {@linkcode PluginWorkspaceProjectsApi.copy}.
|
|
358
|
+
*
|
|
359
|
+
* | Property | Type | Description |
|
|
360
|
+
* |---|---|---|
|
|
361
|
+
* | `projectId` | `string` | The id (floorkey) of the copied project |
|
|
362
|
+
*/
|
|
363
|
+
export declare const PluginWorkspaceProjectsCopyResult: z.ZodObject<{
|
|
364
|
+
projectId: z.ZodString;
|
|
365
|
+
}, z.core.$strip>;
|
|
366
|
+
export type PluginWorkspaceProjectsCopyResult = z.infer<typeof PluginWorkspaceProjectsCopyResult>;
|
|
367
|
+
/**
|
|
368
|
+
* Arguments for {@linkcode PluginWorkspaceProjectsApi.list} (options flattened).
|
|
369
|
+
*
|
|
370
|
+
* | Property | Type | Description |
|
|
371
|
+
* |---|---|---|
|
|
372
|
+
* | `teamId` | `string?` | Scope the list to this team; omit for all accessible projects |
|
|
373
|
+
*/
|
|
374
|
+
export declare const PluginWorkspaceProjectsListArgs: z.ZodObject<{
|
|
375
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
376
|
+
}, z.core.$strip>;
|
|
377
|
+
export type PluginWorkspaceProjectsListArgs = z.infer<typeof PluginWorkspaceProjectsListArgs>;
|
|
378
|
+
/**
|
|
379
|
+
* Result of {@linkcode PluginWorkspaceProjectsApi.list}.
|
|
380
|
+
*
|
|
381
|
+
* | Property | Type | Description |
|
|
382
|
+
* |---|---|---|
|
|
383
|
+
* | `projects` | {@linkcode PluginProjectRef}`[]` | Accessible projects (empty when none) |
|
|
384
|
+
*/
|
|
385
|
+
export declare const PluginWorkspaceProjectsListResult: z.ZodObject<{
|
|
386
|
+
projects: z.ZodArray<z.ZodObject<{
|
|
387
|
+
id: z.ZodString;
|
|
388
|
+
name: z.ZodString;
|
|
389
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
390
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
391
|
+
modifiedAt: z.ZodOptional<z.ZodString>;
|
|
392
|
+
}, z.core.$strip>>;
|
|
393
|
+
}, z.core.$strip>;
|
|
394
|
+
export type PluginWorkspaceProjectsListResult = z.infer<typeof PluginWorkspaceProjectsListResult>;
|
|
395
|
+
/**
|
|
396
|
+
* Arguments for {@linkcode PluginWorkspaceProjectsApi.get}.
|
|
397
|
+
*
|
|
398
|
+
* | Property | Type | Description |
|
|
399
|
+
* |---|---|---|
|
|
400
|
+
* | `projectId` | `string` | The project's `projectId` (floorkey) |
|
|
401
|
+
*/
|
|
402
|
+
export declare const PluginWorkspaceProjectsGetArgs: z.ZodObject<{
|
|
403
|
+
projectId: z.ZodString;
|
|
404
|
+
}, z.core.$strip>;
|
|
405
|
+
export type PluginWorkspaceProjectsGetArgs = z.infer<typeof PluginWorkspaceProjectsGetArgs>;
|
|
406
|
+
/**
|
|
407
|
+
* Result of {@linkcode PluginWorkspaceProjectsApi.get} — the project, or `null`
|
|
408
|
+
* when no project has the given id.
|
|
409
|
+
*/
|
|
410
|
+
export declare const PluginWorkspaceProjectsGetResult: z.ZodNullable<z.ZodObject<{
|
|
411
|
+
id: z.ZodString;
|
|
412
|
+
name: z.ZodString;
|
|
413
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
414
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
415
|
+
modifiedAt: z.ZodOptional<z.ZodString>;
|
|
416
|
+
}, z.core.$strip>>;
|
|
417
|
+
export type PluginWorkspaceProjectsGetResult = z.infer<typeof PluginWorkspaceProjectsGetResult>;
|
|
418
|
+
/**
|
|
419
|
+
* Arguments for {@linkcode PluginWorkspaceProjectsApi.rename}.
|
|
420
|
+
*
|
|
421
|
+
* | Property | Type | Description |
|
|
422
|
+
* |---|---|---|
|
|
423
|
+
* | `projectId` | `string` | The project's `projectId` (floorkey) |
|
|
424
|
+
* | `name` | `string` | The project's new display name |
|
|
425
|
+
*/
|
|
426
|
+
export declare const PluginWorkspaceProjectsRenameArgs: z.ZodObject<{
|
|
427
|
+
projectId: z.ZodString;
|
|
428
|
+
name: z.ZodString;
|
|
429
|
+
}, z.core.$strip>;
|
|
430
|
+
export type PluginWorkspaceProjectsRenameArgs = z.infer<typeof PluginWorkspaceProjectsRenameArgs>;
|
|
431
|
+
/**
|
|
432
|
+
* Result of {@linkcode PluginWorkspaceProjectsApi.rename}.
|
|
433
|
+
*
|
|
434
|
+
* | Property | Type | Description |
|
|
435
|
+
* |---|---|---|
|
|
436
|
+
* | `projectId` | `string` | The id (floorkey) of the renamed project |
|
|
437
|
+
*/
|
|
438
|
+
export declare const PluginWorkspaceProjectsRenameResult: z.ZodObject<{
|
|
439
|
+
projectId: z.ZodString;
|
|
440
|
+
}, z.core.$strip>;
|
|
441
|
+
export type PluginWorkspaceProjectsRenameResult = z.infer<typeof PluginWorkspaceProjectsRenameResult>;
|
|
442
|
+
/**
|
|
443
|
+
* Result of {@linkcode PluginWorkspaceTeamsApi.list}.
|
|
444
|
+
*
|
|
445
|
+
* | Property | Type | Description |
|
|
446
|
+
* |---|---|---|
|
|
447
|
+
* | `teams` | {@linkcode PluginTeamRef}`[]` | The user's teams (empty when none) |
|
|
448
|
+
*/
|
|
449
|
+
export declare const PluginWorkspaceTeamsListResult: z.ZodObject<{
|
|
450
|
+
teams: z.ZodArray<z.ZodObject<{
|
|
451
|
+
id: z.ZodString;
|
|
452
|
+
name: z.ZodString;
|
|
453
|
+
role: z.ZodOptional<z.ZodString>;
|
|
454
|
+
}, z.core.$strip>>;
|
|
455
|
+
}, z.core.$strip>;
|
|
456
|
+
export type PluginWorkspaceTeamsListResult = z.infer<typeof PluginWorkspaceTeamsListResult>;
|
|
457
|
+
/**
|
|
458
|
+
* Arguments for {@linkcode PluginWorkspaceTeamsApi.get}.
|
|
459
|
+
*
|
|
460
|
+
* | Property | Type | Description |
|
|
461
|
+
* |---|---|---|
|
|
462
|
+
* | `teamId` | `string` | The id of the team to read |
|
|
463
|
+
*/
|
|
464
|
+
export declare const PluginWorkspaceTeamsGetArgs: z.ZodObject<{
|
|
465
|
+
teamId: z.ZodString;
|
|
466
|
+
}, z.core.$strip>;
|
|
467
|
+
export type PluginWorkspaceTeamsGetArgs = z.infer<typeof PluginWorkspaceTeamsGetArgs>;
|
|
468
|
+
/**
|
|
469
|
+
* Result of {@linkcode PluginWorkspaceTeamsApi.get} — the team, or `null` when no
|
|
470
|
+
* team has the given id.
|
|
471
|
+
*/
|
|
472
|
+
export declare const PluginWorkspaceTeamsGetResult: z.ZodNullable<z.ZodObject<{
|
|
473
|
+
id: z.ZodString;
|
|
474
|
+
name: z.ZodString;
|
|
475
|
+
role: z.ZodOptional<z.ZodString>;
|
|
476
|
+
}, z.core.$strip>>;
|
|
477
|
+
export type PluginWorkspaceTeamsGetResult = z.infer<typeof PluginWorkspaceTeamsGetResult>;
|
|
478
|
+
/**
|
|
479
|
+
* Arguments for {@linkcode PluginWorkspaceTeamsApi.listMembers}.
|
|
480
|
+
*
|
|
481
|
+
* | Property | Type | Description |
|
|
482
|
+
* |---|---|---|
|
|
483
|
+
* | `teamId` | `string` | The id of the team whose members to list |
|
|
484
|
+
*/
|
|
485
|
+
export declare const PluginWorkspaceTeamsListMembersArgs: z.ZodObject<{
|
|
486
|
+
teamId: z.ZodString;
|
|
487
|
+
}, z.core.$strip>;
|
|
488
|
+
export type PluginWorkspaceTeamsListMembersArgs = z.infer<typeof PluginWorkspaceTeamsListMembersArgs>;
|
|
489
|
+
/**
|
|
490
|
+
* Result of {@linkcode PluginWorkspaceTeamsApi.listMembers}.
|
|
491
|
+
*
|
|
492
|
+
* | Property | Type | Description |
|
|
493
|
+
* |---|---|---|
|
|
494
|
+
* | `members` | {@linkcode PluginTeamMemberRef}`[]` | The team's members (empty when none) |
|
|
495
|
+
*/
|
|
496
|
+
export declare const PluginWorkspaceTeamsListMembersResult: z.ZodObject<{
|
|
497
|
+
members: z.ZodArray<z.ZodObject<{
|
|
498
|
+
id: z.ZodString;
|
|
499
|
+
name: z.ZodString;
|
|
500
|
+
email: z.ZodOptional<z.ZodString>;
|
|
501
|
+
role: z.ZodOptional<z.ZodString>;
|
|
502
|
+
}, z.core.$strip>>;
|
|
503
|
+
}, z.core.$strip>;
|
|
504
|
+
export type PluginWorkspaceTeamsListMembersResult = z.infer<typeof PluginWorkspaceTeamsListMembersResult>;
|
|
505
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/workspace/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closed error-code registry — the single source of truth for every error
|
|
3
|
+
* that crosses the plugin wire (host → worker) or is minted client-side.
|
|
4
|
+
*
|
|
5
|
+
* APPEND-ONLY: codes are a published contract; never rename or remove one.
|
|
6
|
+
* Handle-resolution failures deliberately collapse to ONE code
|
|
7
|
+
* (`HANDLE_INVALID`) so error responses cannot be used as an existence /
|
|
8
|
+
* ownership oracle (PLUGIN_HANDLE_MIGRATION_HLD §6). `HANDLE_KIND_MISMATCH`
|
|
9
|
+
* stays distinct because the kind is information the caller already holds.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PLUGIN_ERROR_CODES: readonly ["VALIDATION", "INVALID_RPC_FORMAT", "METHOD_NOT_FOUND", "METHOD_NOT_PERMITTED", "HANDLE_INVALID", "HANDLE_KIND_MISMATCH", "RESOURCE_QUOTA_EXCEEDED", "RATE_LIMITED", "PRECONDITION_FAILED", "OPERATION_FAILED", "TIMEOUT", "CALL_TIMEOUT", "TRANSPORT_LOST", "PLUGIN_NOT_READY", "PLUGIN_TERMINATED", "RESULT_NOT_SERIALIZABLE", "RESULT_TOO_LARGE", "BATCH_PARTIAL", "STORY_UPDATE_FAILED", "STORY_HEIGHT_REJECTED", "NO_ACTIVE_STRUCTURE", "NO_ELIGIBLE_ELEMENTS", "PROPOSAL_SWITCH_BLOCKED", "INTERNAL", "UNKNOWN"];
|
|
12
|
+
export type PluginErrorCode = (typeof PLUGIN_ERROR_CODES)[number];
|
|
13
|
+
/**
|
|
14
|
+
* A known code, or a string outside the union — a plugin built against an
|
|
15
|
+
* older SDK may receive codes a newer host appended. Keeps autocomplete for
|
|
16
|
+
* known codes while staying open on the wire (forward compatibility).
|
|
17
|
+
*/
|
|
18
|
+
export type WirePluginErrorCode = PluginErrorCode | (string & {});
|
|
19
|
+
export type PluginErrorCategory = "validation" | "not_found" | "permission" | "handle" | "quota" | "timeout" | "transport" | "lifecycle" | "execution" | "internal";
|
|
20
|
+
/**
|
|
21
|
+
* Client-side metadata for a code. NOT carried on the wire — every field is a
|
|
22
|
+
* pure function of the code, and this table ships inside plugin-core, so both
|
|
23
|
+
* endpoints derive it locally.
|
|
24
|
+
*/
|
|
25
|
+
export interface CodeMeta {
|
|
26
|
+
/** Family of the code; picks the `PluginError` sugar subclass. */
|
|
27
|
+
category: PluginErrorCategory;
|
|
28
|
+
/** Fallback `hint` when the throw site provides none. */
|
|
29
|
+
hintTemplate?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const CODE_META: Record<PluginErrorCode, CodeMeta>;
|
|
32
|
+
/** Narrow an arbitrary string to a member of the closed code union. */
|
|
33
|
+
export declare function isPluginErrorCode(value: string): value is PluginErrorCode;
|
|
34
|
+
//# sourceMappingURL=codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,kgBA0BrB,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjE;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEjE,MAAM,MAAM,mBAAmB,GAC3B,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,OAAO,GACP,SAAS,GACT,WAAW,GACX,WAAW,GACX,WAAW,GACX,UAAU,CAAA;AAEd;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,kEAAkE;IAClE,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,eAAe,EAAE,QAAQ,CA2DvD,CAAA;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { WirePluginErrorCode } from "./codes";
|
|
2
|
+
/**
|
|
3
|
+
* Structured error payload carried on the `{success: false}` branch of the RPC
|
|
4
|
+
* wire result, next to the legacy `error: string` field (additive — old
|
|
5
|
+
* clients ignore it, old hosts never set it).
|
|
6
|
+
*
|
|
7
|
+
* Errors cross the worker boundary as THIS plain object, never as a thrown
|
|
8
|
+
* class: Comlink's throw transfer strips subclasses and custom fields and
|
|
9
|
+
* leaks host stacks. plugin-client reconstructs a typed `PluginError` from it
|
|
10
|
+
* (`fromEnvelope`).
|
|
11
|
+
*/
|
|
12
|
+
export declare const ERROR_ENVELOPE_VERSION: 1;
|
|
13
|
+
export interface ErrorEnvelope {
|
|
14
|
+
envelopeVersion: typeof ERROR_ENVELOPE_VERSION;
|
|
15
|
+
code: WirePluginErrorCode;
|
|
16
|
+
/**
|
|
17
|
+
* Human-readable failure description. For INTERNAL/UNKNOWN this is a GENERIC
|
|
18
|
+
* message — the real message and stack stay host-side, logged under
|
|
19
|
+
* `errorId` (the worker is untrusted; internals must not leak).
|
|
20
|
+
*/
|
|
21
|
+
message: string;
|
|
22
|
+
/**
|
|
23
|
+
* Per-occurrence id. For INTERNAL the host logs the real message and stack
|
|
24
|
+
* under this id (the sanitized message would otherwise be an undebuggable
|
|
25
|
+
* dead end). Other codes carry the id only to identify the occurrence in
|
|
26
|
+
* bug reports — the host does not log them. Client-minted ids carry a `c-`
|
|
27
|
+
* prefix.
|
|
28
|
+
*/
|
|
29
|
+
errorId: string;
|
|
30
|
+
/** Structured, JSON-safe, code-specific data (issues / retryAfterMs / didYouMean / handles…). */
|
|
31
|
+
details?: Record<string, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* Wire id of the single primary offending handle, when the failure is
|
|
34
|
+
* handle-scoped. Multiple offenders go in `details.handles: string[]`.
|
|
35
|
+
* May echo ONLY ids the caller itself supplied (anti-oracle rule).
|
|
36
|
+
*/
|
|
37
|
+
handle?: string;
|
|
38
|
+
/** Dotted method path of the failed call (e.g. "design.boolean.union"). */
|
|
39
|
+
methodPath?: string;
|
|
40
|
+
/** Machine-actionable fix suggestion (written for LLM plugin authors). */
|
|
41
|
+
hint?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Structural guard for a wire value claiming to be an `ErrorEnvelope`.
|
|
45
|
+
*
|
|
46
|
+
* Checks shape only — deliberately does NOT reject codes outside the known
|
|
47
|
+
* union, so envelopes from a newer host still pass (forward compatibility).
|
|
48
|
+
*/
|
|
49
|
+
export declare function isErrorEnvelope(value: unknown): value is ErrorEnvelope;
|
|
50
|
+
/**
|
|
51
|
+
* Mint a per-occurrence error id. Uses `crypto.randomUUID` when available
|
|
52
|
+
* (browser main thread and workers both have it); falls back to a
|
|
53
|
+
* counter+random suffix — uniqueness within a session is all that is needed.
|
|
54
|
+
*/
|
|
55
|
+
export declare function newErrorId(prefix?: string): string;
|
|
56
|
+
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/errors/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAG,CAAU,CAAA;AAEhD,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,OAAO,sBAAsB,CAAA;IAC9C,IAAI,EAAE,mBAAmB,CAAA;IACzB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAStE;AAID;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,SAAK,GAAG,MAAM,CAK9C"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { PLUGIN_ERROR_CODES, CODE_META, isPluginErrorCode } from "./codes";
|
|
2
|
+
export type { PluginErrorCode, WirePluginErrorCode, PluginErrorCategory, CodeMeta } from "./codes";
|
|
3
|
+
export { ERROR_ENVELOPE_VERSION, isErrorEnvelope, newErrorId } from "./envelope";
|
|
4
|
+
export type { ErrorEnvelope } from "./envelope";
|
|
5
|
+
export { PluginError, PluginValidationError, PluginNotFoundError, PluginPermissionError, PluginHandleError, PluginQuotaError, PluginTimeoutError, PluginTransportError, PluginLifecycleError, PluginExecutionError, PluginInternalError, fromEnvelope, makeClientEnvelope, } from "./plugin-error";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC1E,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElG,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAChF,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,GACnB,MAAM,gBAAgB,CAAA"}
|