@acrylblends/blends-frame 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/lib/app-plugins.d.ts +32 -5
  2. package/lib/client.js +31886 -367
  3. package/lib/client.js.map +1 -1
  4. package/lib/contract.d.ts +116 -0
  5. package/lib/github-connect.d.ts +44 -0
  6. package/lib/graph-contract.d.ts +85 -0
  7. package/lib/graph-inspect.d.ts +16 -0
  8. package/lib/index.d.ts +20 -3
  9. package/lib/index.js +1040 -36
  10. package/lib/index.js.map +1 -1
  11. package/lib/plain.d.ts +26 -0
  12. package/lib/plugin-graph.d.ts +38 -0
  13. package/lib/registry.d.ts +71 -0
  14. package/lib/types/client/AppSection.d.ts +10 -0
  15. package/lib/types/client/BlendsFrame.d.ts +7 -1
  16. package/lib/types/client/GraphView.d.ts +22 -0
  17. package/lib/types/client/NameYourApp.d.ts +10 -0
  18. package/lib/types/client/PluginsSection.d.ts +11 -1
  19. package/lib/types/client/RegistryView.d.ts +11 -0
  20. package/lib/types/client/SettingsExpand.d.ts +6 -0
  21. package/lib/types/client/ShareChooser.d.ts +21 -0
  22. package/lib/types/client/desktop-app.d.ts +65 -0
  23. package/lib/types/client/graph-api.d.ts +11 -0
  24. package/lib/types/client/graph-canvas.d.ts +63 -0
  25. package/lib/types/client/graph-link.d.ts +21 -0
  26. package/lib/types/client/graph-model.d.ts +23 -0
  27. package/lib/types/client/graph-styles.d.ts +3 -0
  28. package/lib/types/client/index.d.ts +1 -1
  29. package/lib/types/client/plain-failure.d.ts +10 -0
  30. package/lib/types/client/plugins-navigator.d.ts +37 -7
  31. package/lib/types/client/registry-api.d.ts +21 -0
  32. package/lib/types/client/registry-list.d.ts +14 -0
  33. package/lib/types/client/settings-fullscreen.d.ts +13 -0
  34. package/lib/types/client/theme-switch.d.ts +27 -0
  35. package/lib/types/contract.d.ts +116 -0
  36. package/lib/types/graph-contract.d.ts +85 -0
  37. package/lib/types/graph-inspect.d.ts +16 -0
  38. package/package.json +9 -7
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The top bar's Dark/Light switch. DSH's theme service owns the preference (light, dark or system, saved in the user's settings and following the OS
3
+ * while it is `system`); this reads the colour scheme it resolved and flips it with `setTheme`, so the button, Settings > General > Appearance and the
4
+ * OS all drive the same one value. Nothing here touches the DOM: the theme presenter paints the body, and the frame's styles follow it.
5
+ */
6
+ export type ColorScheme = 'light' | 'dark';
7
+ /** The part of DSH's theme service this reads. */
8
+ export interface ThemeSource {
9
+ getTheme(): {
10
+ readonly active: {
11
+ readonly colorScheme: ColorScheme;
12
+ };
13
+ };
14
+ setTheme(id: string): void;
15
+ }
16
+ export declare class ThemeSwitch {
17
+ private readonly theme;
18
+ private scheme;
19
+ private readonly listeners;
20
+ constructor(theme: ThemeSource);
21
+ getSnapshot: () => ColorScheme;
22
+ subscribe: (listener: () => void) => (() => void);
23
+ /** Reads the scheme again after the theme service said it changed. */
24
+ refresh(): void;
25
+ /** Switches to the other scheme and keeps it (an explicit choice replaces `system`). */
26
+ toggle(): void;
27
+ }
@@ -147,12 +147,35 @@ export declare const FRAME_PLUGINS_SWITCH_PATH = "/api/acryl-blends-frame/plugin
147
147
  export declare const FRAME_PLUGINS_SHARE_PLAN_PATH = "/api/acryl-blends-frame/plugins/share-plan";
148
148
  /** POST `{ name, confirm }`: publish it, only when `confirm` is the plan the person said yes to and it still holds. */
149
149
  export declare const FRAME_PLUGINS_SHARE_PATH = "/api/acryl-blends-frame/plugins/share";
150
+ /** POST `{ name }`: keep a packed copy of this local plugin on this machine (the app's plugin store); nothing leaves the machine. */
151
+ export declare const FRAME_PLUGINS_SAVE_PATH = "/api/acryl-blends-frame/plugins/save";
152
+ /** GET: the public plugin registry (cordisplugins.github.io), each entry marked when this app already has it; read fresh by the Host, never by the page. */
153
+ export declare const FRAME_PLUGINS_REGISTRY_PATH = "/api/acryl-blends-frame/plugins/registry";
154
+ /** GET: whether this computer can share to GitHub (the helper program is installed and signed in), read before the person is asked anything. */
155
+ export declare const FRAME_PLUGINS_GITHUB_PATH = "/api/acryl-blends-frame/plugins/github";
156
+ /** POST: start GitHub's browser sign-in (a one-time code for github.com/login/device); GET: where it is; DELETE: stop one still waiting. */
157
+ export declare const FRAME_PLUGINS_GITHUB_CONNECT_PATH = "/api/acryl-blends-frame/plugins/github/connect";
158
+ /** POST `{ source }`: pull one released plugin (`github:<owner>/<repo>@<version>`) into the running app, through the app's plugin-share checks. */
159
+ export declare const FRAME_PLUGINS_PULL_PATH = "/api/acryl-blends-frame/plugins/pull";
160
+ /** A packed copy of a plugin kept on this machine: its version and where the tarball is. */
161
+ export interface SavedPluginView {
162
+ readonly version: string;
163
+ /** Absolute path of the packed copy (the store's `.tgz`). */
164
+ readonly path: string;
165
+ }
166
+ /** What a save did: the copy, whether it is new, and whether the version was raised because that version was already saved with other content. */
167
+ export interface SavedPluginResult extends SavedPluginView {
168
+ readonly added: boolean;
169
+ readonly bumped: boolean;
170
+ }
150
171
  /** Where a shared plugin went: its GitHub repository and the released version other apps install. */
151
172
  export interface SharedPluginView {
152
173
  readonly url: string;
153
174
  readonly version: string;
154
175
  /** GitHub says the repository no longer exists (deleted or renamed): the row shows it gone and offers a new share. */
155
176
  readonly gone?: boolean;
177
+ /** It was shared to the public registry (the `cordis-plugin` topic is set), not only as a public repository. */
178
+ readonly registry?: boolean;
156
179
  }
157
180
  export type ShareVisibility = 'private' | 'public';
158
181
  /**
@@ -168,9 +191,15 @@ export interface SharePlan {
168
191
  readonly createsRepository: boolean;
169
192
  /** The version already released there; the plan then releases the next patch. */
170
193
  readonly released?: string;
194
+ /** The license a public share is offered under, as an SPDX id (MIT unless the app says otherwise); a private share has none. */
195
+ readonly license?: string;
196
+ /** The public registry (cordisplugins.github.io) lists it: the share sets the `cordis-plugin` topic. Only a public share can be listed. */
197
+ readonly registry?: boolean;
171
198
  }
172
199
  /** @throws when the value is not a share plan. */
173
200
  export declare function parseSharePlan(value: unknown): SharePlan;
201
+ /** @throws when the value is not what a save answers. */
202
+ export declare function parseSavedPlugin(value: unknown): SavedPluginResult;
174
203
  /** The same plan: what the person confirmed is what would be published now. */
175
204
  export declare function samePlan(a: SharePlan, b: SharePlan): boolean;
176
205
  /**
@@ -192,6 +221,12 @@ export interface AppPluginView {
192
221
  readonly version?: string;
193
222
  /** A local plugin this app shared: where it went (a GitHub repository) and the version it released. */
194
223
  readonly shared?: SharedPluginView;
224
+ /** The newest packed copy of it kept on this machine (the app's plugin store). */
225
+ readonly saved?: SavedPluginView;
226
+ /** Absolute path of the plugin's folder, where its code is. */
227
+ readonly folder?: string;
228
+ /** The plugin's main file, relative to the app's folder: absent when that file is outside the app (a package of `node_modules` elsewhere). */
229
+ readonly main?: string;
195
230
  readonly description: string;
196
231
  readonly on: boolean;
197
232
  }
@@ -204,6 +239,10 @@ export interface FramePluginView {
204
239
  readonly version?: string;
205
240
  readonly description: string;
206
241
  readonly state: FramePluginState;
242
+ /** Absolute path of the package folder, where its code is. */
243
+ readonly folder?: string;
244
+ /** The package's main file relative to the app's folder; absent when it is outside the app. */
245
+ readonly main?: string;
207
246
  }
208
247
  export interface AppPluginsView {
209
248
  readonly plugins: readonly AppPluginView[];
@@ -291,3 +330,80 @@ export interface AppReloadView {
291
330
  }
292
331
  /** @throws an Error naming the field when the answer is not an app reload view. */
293
332
  export declare function parseAppReloadView(value: unknown): AppReloadView;
333
+ /** What a plugin of the registry offers, as the registry's index lists it (`https://cordisplugins.github.io/registry/index.json`, formatVersion 1). */
334
+ export interface RegistryEntryView {
335
+ /** The plugin's name; a scoped name keeps its scope. */
336
+ readonly name: string;
337
+ readonly description: string;
338
+ /** The GitHub account or organization that released it. */
339
+ readonly owner: string;
340
+ /** The repository's address. */
341
+ readonly url: string;
342
+ readonly version: string;
343
+ /** The day of the release (`YYYY-MM-DD`), when the index says. */
344
+ readonly published?: string;
345
+ /** Where it runs: `ACRYL` (needs an ACRYL service), `Both`, or `DSH stock` (a Harness plugin, which an app of this kind cannot run). */
346
+ readonly compatibility: string;
347
+ /** The source a pull takes: `github:<owner>/<repo>@<version>`. */
348
+ readonly source: string;
349
+ /** This app already has a plugin of this name or pulled from this source. */
350
+ readonly installed: boolean;
351
+ /** The account the person is signed in to GitHub with (or shares to) released it. */
352
+ readonly mine: boolean;
353
+ }
354
+ /** The registry as the Host read it: its entries, or why they could not be read (offline, rate limited, the site changed). */
355
+ export type RegistryView = {
356
+ readonly status: 'ready';
357
+ readonly entries: readonly RegistryEntryView[];
358
+ readonly readAt: string;
359
+ } | {
360
+ readonly status: 'unavailable';
361
+ readonly message: string;
362
+ };
363
+ /** @throws when the value is not a registry view. */
364
+ export declare function parseRegistryView(value: unknown): RegistryView;
365
+ /** What a pull did: the plugin now running, or why it was refused (nothing changed then). */
366
+ export interface PulledPluginView {
367
+ readonly name: string;
368
+ readonly version: string;
369
+ readonly action: 'installed' | 'updated' | 'unchanged';
370
+ readonly state: string;
371
+ }
372
+ /** @throws when the value is not what a pull answers. */
373
+ export declare function parsePulledPlugin(value: unknown): PulledPluginView;
374
+ /** Whether the person can share to GitHub now, and when not, the single thing to do about it. */
375
+ export type GithubReadiness = {
376
+ readonly status: 'ready';
377
+ readonly account: string;
378
+ } | {
379
+ readonly status: 'signed-out';
380
+ readonly say: string;
381
+ readonly command: string;
382
+ } | {
383
+ readonly status: 'missing';
384
+ readonly say: string;
385
+ readonly link: string;
386
+ } | {
387
+ readonly status: 'unavailable';
388
+ readonly say: string;
389
+ };
390
+ /** Where connecting GitHub from the app is (`./github-connect.ts`). */
391
+ export type GithubConnectState = {
392
+ readonly status: 'idle';
393
+ } | {
394
+ readonly status: 'starting';
395
+ } | {
396
+ readonly status: 'code';
397
+ readonly code: string;
398
+ readonly url: string;
399
+ } | {
400
+ readonly status: 'connected';
401
+ } | {
402
+ readonly status: 'failed';
403
+ readonly say: string;
404
+ readonly details?: string;
405
+ };
406
+ /** @throws when the value is not a connect state. */
407
+ export declare function parseGithubConnectState(value: unknown): GithubConnectState;
408
+ /** @throws when the value is not a GitHub readiness. */
409
+ export declare function parseGithubReadiness(value: unknown): GithubReadiness;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The plugin graph's wire types: what the frame's Host answers and what the browser draws (Settings > Plugins > Graph). Ported from cordis-plugin-graph
3
+ * (MIT, github.com/cordisplugins/cordis-plugin-graph, commit e9bf6b5, `src/inspect.ts`), with two additions the original did not have: a node says where its
4
+ * code is (`source`), and the Host keeps a numbered list of fiber lifecycle events (`GraphEvent`) so the browser hears a change instead of asking again.
5
+ * No Node or browser import: both sides read this file.
6
+ */
7
+ /** The whole graph of the Host's Cordis context, now. */
8
+ export declare const FRAME_GRAPH_PATH = "/api/acryl-blends-frame/graph";
9
+ /** The fiber events after `?after=<seq>`: answered at once when there are some, else when the next one happens (or after about 20 s with none). */
10
+ export declare const FRAME_GRAPH_EVENTS_PATH = "/api/acryl-blends-frame/graph/events";
11
+ /** Fiber lifecycle phase, or `disabled` for a Loader row turned off. */
12
+ export type NodePhase = 'pending' | 'loading' | 'active' | 'failed' | 'unloading' | 'disposed' | 'disabled';
13
+ /** Edge kinds, all directed consumer -> dependency / child -> parent. */
14
+ export type EdgeKind = 'inject' | 'provider' | 'nesting';
15
+ /** Where a plugin's code is: the file to open, whether it is inside the app's folder (the Files tab opens only those), and the folder the plugin lives in. */
16
+ export interface GraphSource {
17
+ /** Absolute path of the plugin's main file. */
18
+ readonly file: string;
19
+ /** Absolute path of its folder (the package folder for an installed package). */
20
+ readonly folder: string;
21
+ /** The file relative to the app's folder, when it is inside it: the path the Files tab opens. */
22
+ readonly inApp?: string;
23
+ }
24
+ /** One plugin fiber (or a disabled Loader row) in the graph. */
25
+ export interface GraphNode {
26
+ /** Registry-unique fiber id (0 = root); a synthetic negative id for a disabled row with no fiber. */
27
+ readonly uid: number;
28
+ /** Display name (nearest named ancestor, else `root`). */
29
+ readonly name: string;
30
+ readonly phase: NodePhase;
31
+ /** Whether the owning Loader row is enabled. */
32
+ readonly enabled: boolean;
33
+ /** Exact module specifier the Loader entry imports, when this fiber/row owns one. */
34
+ readonly moduleName: string | null;
35
+ /** Stable Loader entry id owning this fiber, when it maps to one. */
36
+ readonly loaderEntryId: string | null;
37
+ /** Service names this fiber currently provides into the shared store. */
38
+ readonly provides: readonly string[];
39
+ /** Labels of this fiber's top-level live effects (registrations, listeners, timers...). */
40
+ readonly effects: readonly string[];
41
+ /** Where its code is, when the Host could find it. */
42
+ readonly source?: GraphSource;
43
+ }
44
+ /** One relation between two fibers. */
45
+ export interface GraphEdge {
46
+ readonly kind: EdgeKind;
47
+ readonly from: number;
48
+ readonly to: number;
49
+ /** For `inject` / `provider`: the service name. */
50
+ readonly service?: string;
51
+ /** For `inject`: whether the required service resolved to an active provider. */
52
+ readonly resolved?: boolean;
53
+ }
54
+ /** Point-in-time relation graph of one Cordis context. */
55
+ export interface GraphSnapshot {
56
+ readonly capturedAt: string;
57
+ /** `host` for the frame's Host (the app's plugins run there), `client` for the browser's. */
58
+ readonly plane: string;
59
+ readonly nodes: readonly GraphNode[];
60
+ readonly edges: readonly GraphEdge[];
61
+ }
62
+ /** The change a fiber went through, as the Host saw it: created, removed, or moved from one phase to another. */
63
+ export interface GraphEvent {
64
+ /** 1, 2, 3...: the order the Host saw them in; a browser asks for those after the last number it has. */
65
+ readonly seq: number;
66
+ /** Epoch ms. */
67
+ readonly at: number;
68
+ readonly uid: number;
69
+ readonly name: string;
70
+ readonly kind: 'created' | 'removed' | 'status';
71
+ readonly from?: NodePhase;
72
+ readonly to?: NodePhase;
73
+ }
74
+ export interface GraphView {
75
+ readonly snapshot: GraphSnapshot;
76
+ /** The newest event number when the snapshot was taken: the browser asks for events after it. */
77
+ readonly seq: number;
78
+ }
79
+ export interface GraphEventsAnswer {
80
+ /** The newest event number now. */
81
+ readonly seq: number;
82
+ readonly events: readonly GraphEvent[];
83
+ }
84
+ export declare function parseGraphView(value: unknown): GraphView;
85
+ export declare function parseGraphEvents(value: unknown): GraphEventsAnswer;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Reading a live Cordis context into a plugin graph: every fiber, the disabled Loader rows, and the relations between them (requires, provides to, nested in).
3
+ * Ported from cordis-plugin-graph (MIT, github.com/cordisplugins/cordis-plugin-graph, commit e9bf6b5, `src/inspect.ts`): the same walk of the public Cordis and
4
+ * Loader API, with a `source` on each node added. It imports nothing from Node, so the Host reads its own context with it and the browser reads the
5
+ * client's (the two planes).
6
+ */
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ import type { EdgeKind, GraphSnapshot, GraphSource, NodePhase } from './graph-contract.ts';
9
+ export declare const PHASE: Record<number, NodePhase>;
10
+ /** Where a node's code is, found from what the Loader entry names; undefined when it cannot be found. */
11
+ export type SourceOf = (moduleName: string | null, name: string) => GraphSource | undefined;
12
+ export declare const clamp: (value: string) => string;
13
+ /** The current Cordis graph of `ctx`: every fiber, the disabled Loader rows, and the three kinds of relation. */
14
+ export declare function inspectCordisContext(ctx: Context, plane: string, sourceOf?: SourceOf): GraphSnapshot;
15
+ /** The relation kinds, for the browser's toggles. */
16
+ export declare const EDGE_KINDS: readonly EdgeKind[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acrylblends/blends-frame",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "ACRYL Blends frame: the workbench around an app being built - a top bar, the branches and versions on the left, the app alone in the centre, and the agents on the right - as one Cordis plugin with a Host and a client half",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -63,18 +63,18 @@
63
63
  "@webboxes/plugin-hub": "0.2.0",
64
64
  "@acrylblends/app-shell": "^0.1.0",
65
65
  "@acrylblends/loopback-http": "^0.1.0",
66
- "@acrylblends/versions": "^0.1.0",
66
+ "@acrylblends/versions": "^0.1.1",
67
67
  "@acrylblends/workspace": "^0.1.0",
68
68
  "yaml": "2.9.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
72
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
73
71
  "@deepseek-ai/cordis": "^4.0.4",
72
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
74
73
  "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
74
+ "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
75
+ "acrylblends": "^1.0.0",
75
76
  "react": "18.3.1",
76
- "react-dom": "18.3.1",
77
- "acrylblends": "^1.0.0"
77
+ "react-dom": "18.3.1"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@acrylblends/ui": "^0.3.0",
@@ -89,10 +89,12 @@
89
89
  "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
90
90
  "@testing-library/dom": "^10.4.1",
91
91
  "@testing-library/react": "^16.3.2",
92
+ "@types/cytoscape": "3.31.0",
92
93
  "@types/node": "^24.0.0",
93
94
  "@types/react": "^18",
94
95
  "@types/react-dom": "^18",
95
- "acrylblends": "^0.1.1",
96
+ "acrylblends": "^0.1.3",
97
+ "cytoscape": "3.34.3",
96
98
  "jsdom": "29.1.1",
97
99
  "react": "18.3.1",
98
100
  "react-dom": "18.3.1",