@asterism-app/sdk 2.2.0 → 2.2.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/docs/manual.md CHANGED
@@ -16,6 +16,12 @@ An example is worth discussing when the explanation helps an author adapt it. Ex
16
16
 
17
17
  Write each article with enough context to stand alone. Organize it around an author or user question, not a tour of every available method. A reading sequence should not be necessary to understand a capability's purpose.
18
18
 
19
+ ## Document shortcuts where they work
20
+
21
+ If your plugin provides keyboard shortcuts, publish a **Keyboard shortcuts** topic or section in its own manual. Group shortcuts by view or dialog. Say where focus must be, what the shortcut does, and which keys differ by platform. Include a command or button alternative when it helps users find the action.
22
+
23
+ The application manual covers shortcuts owned by the host. A plugin topic covers the plugin’s shortcuts, including any context that determines when they are available. Declare the containing directory in `asterism.manual` in `package.json` and ship it with the plugin. This publishes the documentation through the Manual resource without changing how shortcuts are handled.
24
+
19
25
  ## Keep runtime guidance with tools
20
26
 
21
27
  Models consult the manual when helping with software use or plugin development. Ordinary tool use should not depend on reading it.
@@ -0,0 +1,57 @@
1
+ # Fit plugin views into the workbench
2
+
3
+ A plugin's views appear beside the host's own and other plugins' views. Users read them as one application when they share its layering, the meaning of its lines and motion, and its controls for each kind of choice. This guide explains that visual language and the choices it implies for plugin authors. The shared controls carry the exact appearance; using them is how a plugin stays consistent as the application's styling evolves.
4
+
5
+ ## Start from the host's containers
6
+
7
+ The host already draws the outer surface of every plugin view. A resource card has its shell and header, a settings page sits on the settings sheet, and an island opened through the SDK's island panel receives the shared title bar, toolbar slot, and content sheet. Put domain content inside these containers rather than drawing another card, header, or close control around it.
8
+
9
+ The island panel's title bar is where operations on the whole subject go: a primary action such as Save, and icon actions such as delete or restore defaults. Operations on one part of the content belong with that part, for example in a section header. A panel has no bottom action bar, because it is a non-modal workspace rather than a dialog.
10
+
11
+ ## Separate regions by tone, not outlines
12
+
13
+ Inside a sheet, a region reads as a region because its tone differs, not because something draws around it. The design language has a small set of layers:
14
+
15
+ - **Shell**: titles, navigation, and toolbars sit on the shell tone.
16
+ - **Sheet**: reading and editing content sits on a raised sheet in the card tone.
17
+ - **Group**: rows, fields, and repeated items that belong together recede into a group in the shell tone, with hairlines between rows.
18
+ - **Floating**: menus, popovers, tooltips, hover cards, and dialogs lift above content and keep their outer edge.
19
+
20
+ A plugin that needs a group fills it with the shell tone token, `--card-shell`, and leaves out the border; the shared settings layout and list controls already follow this rule. Inside something that is already recessed, such as a tool's output in the conversation, a sub-panel rises back to the card tone instead of adding an outline. When two areas are already separated by tone, adding a border makes the view feel heavier and louder than the rest of the application.
21
+
22
+ ## Use lines only when they mean something
23
+
24
+ Users learn that a line in Asterism tells them something: where focus is, what is selected, where a drop will land, or the state of a piece of work. A moving dashed outline means content is still forming, a still dashed outline means it ended incomplete, and a red line means the request that produced it failed. Hairlines between rows are the one structural line.
25
+
26
+ A plugin that draws decorative borders dilutes those meanings. Prefer the host's state presentation: tool views receive their state outline from the shared process block, and status uses the shared status badge, text, and icon components, which always pair color with an icon or label.
27
+
28
+ ## Let motion explain a change
29
+
30
+ Motion in the workbench answers a question for the reader: where did this come from, where did it go, or what changed? Selection indicators travel to the new item, deeper pages enter from the side and leave the way they came, arriving content fades in while leaving content clears quickly, lists fold their height as items join or leave, and values animate only when they change.
31
+
32
+ Plugin views can use the host-provided Motion library for the same purposes, with the shared timing. Shared controls already carry their own motion; a segmented toggle's indicator, for example, slides without any plugin code. Avoid motion that decorates a static state, replays when an item merely scrolls into view, or competes with a list's own scrolling. Respect reduced motion, which the host's Motion configuration and CSS already follow.
33
+
34
+ ## Choose controls by the kind of choice
35
+
36
+ The shared controls encode what a choice is, so the same kind of choice looks the same everywhere:
37
+
38
+ - A single choice among a few short options is a segmented toggle group.
39
+ - An immediate on/off setting is a switch; a choice inside a form or a multi-selection is a checkbox; an explained single choice is a radio group.
40
+ - A choice among many options, or one that needs search, uses the shared command and popover combination.
41
+ - Icon-only actions use the shared icon button, which supplies the accessible label and tooltip.
42
+ - A short name or explanation on hover is a tooltip; a preview read while hovering is a hover card; content the user opens on purpose, scrolls, or acts on is a popover behind a button.
43
+ - Button variants carry roles: one default button for the primary action in a region, outline for supporting actions, ghost for compact and row actions, destructive for irreversible confirmation.
44
+
45
+ Tooltips share the popover tone, so their content uses the same color tokens as any sheet content. The shared tooltip supplies its own delay, placement, and width; passing only a side and the content keeps every hint in the application on one rhythm. Disabled controls still show their tooltips, which is the natural place to say why an action is unavailable.
46
+
47
+ Building a lookalike control loses these meanings and the accessibility the shared one provides. Shared controls also follow the user's appearance settings for color, radius, density, and fonts without extra work.
48
+
49
+ ## Render content through the shared readers
50
+
51
+ Markdown, code, diffs, math, diagrams, JSON, and resource or skill references have shared renderers. Using them means a plugin's output reads like every other plugin's output, including streaming behavior, copyable code, and reference navigation. Tool headers use the shared header with a subject, summary, and metadata, and long inputs use the header excerpt rather than a truncated title.
52
+
53
+ ## Keep custom styling local
54
+
55
+ A plugin can style what is genuinely its own: a domain visualization, a canvas, a media viewer. Build that styling from the semantic color tokens and type roles so it follows the user's theme and both color schemes. CSS Modules keep plugin styles from leaking, while global styles share the document cascade with the host and every other plugin; avoid global selectors that would restyle shared controls or another plugin's views.
56
+
57
+ Check a view in light and dark modes, at each density, and with reduced motion before release. A typecheck cannot tell whether a view belongs in the workbench; looking at it beside the host's own views can.
@@ -14,7 +14,7 @@
14
14
  "zod": "^4.6.5"
15
15
  },
16
16
  "devDependencies": {
17
- "@asterism-app/sdk": "2.2.0",
17
+ "@asterism-app/sdk": "2.2.1",
18
18
  "typescript": "^7.0.2",
19
19
  "@types/node": "^26.6.1",
20
20
  "@types/react": "^19.3.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asterism-app/sdk",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Public contracts and host capabilities for Asterism plugins",
5
5
  "license": "MIT",
6
6
  "author": "Chien Zhang",
package/src/models.ts CHANGED
@@ -92,7 +92,7 @@ export interface ModelRequestIdentity {
92
92
  userAgent?: string;
93
93
  /** Stable within a session; may be omitted for a one-off call without a session. */
94
94
  sessionId?: string;
95
- /** Optional plugin-defined purpose identifier for host telemetry grouping; independent of model messages and authorization. */
95
+ /** Optional plugin-defined purpose identifier (e.g. `naming`). The host groups usage by plugin and purpose, and shows this value verbatim. */
96
96
  purpose?: string;
97
97
  }
98
98
  /** Transient metadata from the actual HTTP response; contains no request credentials or body and is not automatically written to history. */
@@ -194,7 +194,6 @@ export interface ModuleContribution {
194
194
  tools?: readonly ToolContribution[];
195
195
  observers?: readonly SessionObserver[];
196
196
  preparers?: readonly CommandPreparer[];
197
- modelPurposes?: readonly import("./runtime-telemetry.ts").ModelPurposeDeclaration[];
198
197
  }
199
198
  /** Named module entry point: plugins provide contributions, and the host handles assembly and invocation. */
200
199
  export interface PluginModule { setup(plugin: PluginContext): ModuleContribution }
@@ -1,11 +1,3 @@
1
- import type { UiText } from "./i18n.ts";
2
-
3
- /** Plugin-declared model call purpose; requests pass its id as `purpose`, and usage statistics group and label them by it. */
4
- export interface ModelPurposeDeclaration {
5
- readonly id: string;
6
- readonly label: UiText;
7
- }
8
-
9
1
  export type ExternalUsageOutcome = "succeeded" | "failed" | "cancelled";
10
2
 
11
3
  /**