@standardagents/code-plugin-sdk 1.0.0-alpha.1 → 1.0.0-alpha.11-headers.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -6
- package/REFERENCE.md +543 -0
- package/package.json +2 -2
- package/src/index.d.ts +206 -16
- package/src/index.mjs +3 -2
- package/src/internal.d.ts +2 -1
- package/src/manifest.mjs +22 -3
- package/src/protocol.mjs +8 -4
- package/src/row-layout.mjs +29 -0
- package/src/runtime.mjs +85 -6
- package/src/testing.d.ts +3 -1
- package/src/testing.mjs +17 -6
- package/src/view.mjs +257 -0
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ Its `package.json` includes a static `standardPlugin` manifest.
|
|
|
11
11
|
{
|
|
12
12
|
"name": "example-status",
|
|
13
13
|
"type": "module",
|
|
14
|
-
"peerDependencies": { "@standardagents/code-plugin-sdk": "^1.0.0-alpha.0" },
|
|
15
|
-
"devDependencies": { "@standardagents/code-plugin-sdk": "^1.0.0-alpha.0" },
|
|
14
|
+
"peerDependencies": { "@standardagents/code-plugin-sdk": "^1.0.0-alpha.10-rows.0" },
|
|
15
|
+
"devDependencies": { "@standardagents/code-plugin-sdk": "^1.0.0-alpha.10-rows.0" },
|
|
16
16
|
"standardPlugin": {
|
|
17
17
|
"apiVersion": 1,
|
|
18
18
|
"id": "example-status",
|
|
@@ -44,6 +44,20 @@ package, such as `@standardagents/code-plugin-sdk/testing`, are refused when
|
|
|
44
44
|
the plugin runs inside Standard Code. The `testing` export serves the
|
|
45
45
|
plugin's own test suite.
|
|
46
46
|
|
|
47
|
+
The complete rendering contract is in [REFERENCE.md](./REFERENCE.md). It
|
|
48
|
+
covers rows, styled text, badges, cards, slots, panels, overlays, host-rendered
|
|
49
|
+
views, ANSI canvases, styled canvas hover text, input focus,
|
|
50
|
+
popover/column/pane presentations, remote read-only behavior, and the frontend
|
|
51
|
+
surfaces that are still planned.
|
|
52
|
+
|
|
53
|
+
Plugin source imports the default package entry. Plugin tests may import
|
|
54
|
+
`@standardagents/code-plugin-sdk/testing` for `createHarness`. Runner internals,
|
|
55
|
+
raw host request envelopes, and internal module paths are outside the public
|
|
56
|
+
package exports. First-party plugins use these same public entries and receive
|
|
57
|
+
the same manifest validation, capability checks, request bounds, and remote
|
|
58
|
+
ownership rules as third-party plugins. A plugin ID does not grant a host
|
|
59
|
+
operation or fetch exception.
|
|
60
|
+
|
|
47
61
|
The runtime disposes publishers, subscriptions, schedules and pending requests.
|
|
48
62
|
Plugins register additional cleanup through `ctx.onDispose` or an activation return value.
|
|
49
63
|
Handlers receive an abort signal.
|
|
@@ -148,7 +162,7 @@ The harness starts no subprocesses.
|
|
|
148
162
|
|
|
149
163
|
## Supported interface
|
|
150
164
|
|
|
151
|
-
The public interface is the package
|
|
165
|
+
The public interface is the package root export, its `testing` export,
|
|
152
166
|
the declarations in `src/index.d.ts` and `src/testing.d.ts`, and the
|
|
153
167
|
`standard-plugin` command's `check` and `pack` behavior.
|
|
154
168
|
|
|
@@ -161,15 +175,103 @@ without notice. Plugin code and plugin tests should treat recorded frames as
|
|
|
161
175
|
opaque values and drive the plugin through `PluginContext` and the harness
|
|
162
176
|
methods.
|
|
163
177
|
|
|
164
|
-
|
|
178
|
+
`ctx.state` is per-plugin key and value storage. Standard Code stores these
|
|
179
|
+
values in the user's account, so every machine the user has reads and writes
|
|
180
|
+
the same keys. `ctx.state.keys()` returns the sorted key names for this
|
|
181
|
+
plugin's account namespace. It returns an empty array when the plugin has no
|
|
182
|
+
keys and accepts only `RequestOptions`; it has no prefix or pagination
|
|
183
|
+
arguments. Another plugin cannot read these keys, even when it uses the same
|
|
184
|
+
account. Key names are 1 to 128 bytes. The first character is ASCII
|
|
185
|
+
alphanumeric or `_`; later characters are ASCII alphanumeric, `_`, `.`, `:`,
|
|
186
|
+
or `-`. A plugin holds at most 256 keys, and one value is at most 64 KiB of
|
|
187
|
+
JSON. The host applies the same account authority and revocation checks to
|
|
188
|
+
`keys()` as it applies to `get()` and `set()`.
|
|
165
189
|
The public context declarations are in `src/index.d.ts`.
|
|
166
190
|
|
|
167
191
|
## Releases
|
|
168
192
|
|
|
169
193
|
The Standard Code build workflow publishes this package when the version in
|
|
170
|
-
`package.json` changes.
|
|
171
|
-
|
|
194
|
+
`package.json` changes. Main prereleases publish under `next` and main releases
|
|
195
|
+
under `latest`. Feature branches publish under their product branch tag. Authors
|
|
196
|
+
can install a published prerelease by its exact version.
|
|
197
|
+
|
|
198
|
+
## Sidebar card titles
|
|
199
|
+
|
|
200
|
+
Sidebar card titles use muted, regular-weight text. A card declaration may
|
|
201
|
+
supply an `icon` containing one Nerd Font private-use glyph, for example
|
|
202
|
+
`"icon": "\uDB81\uDCC5"` (a gauge). The author chooses the card's topic icon.
|
|
203
|
+
The host shows it only on the viewer's Nerd Font tier. Other tiers omit the
|
|
204
|
+
icon and its spacing. Omitted icons have no fallback. This applies to bordered
|
|
205
|
+
and borderless cards. Empty titles remain empty.
|
|
206
|
+
|
|
207
|
+
A card view may replace its declared title through
|
|
208
|
+
`ui.view(root, { title: [{ text: 'Builds ' }, { text: '●', foreground: 'green' }] })`.
|
|
209
|
+
The optional `title` uses native `TextSpan` fields, including `#RRGGBB` and the terminal colors `black`, `red`, `green`,
|
|
210
|
+
`yellow`, `blue`, `magenta`, `cyan`, and `white`;
|
|
211
|
+
`ui.span()` is a body-view builder with a different shape. Titles accept 1–32
|
|
212
|
+
passive spans and at most 512 UTF-8 bytes of combined, nonblank single-line text.
|
|
213
|
+
Actions, control characters, and bidi formatting are rejected. Each replacement
|
|
214
|
+
updates the body and title together. Omitting `title` restores the manifest title.
|
|
215
|
+
This option belongs to card views. Plugins own the meaning and color of any
|
|
216
|
+
status light; the SDK adds no health indicator. Host title styling and supported
|
|
217
|
+
author-selected Nerd Font icons apply around the author-supplied spans.
|
|
172
218
|
|
|
173
219
|
## License
|
|
174
220
|
|
|
175
221
|
MIT. See `LICENSE`.
|
|
222
|
+
|
|
223
|
+
## Responsive pane rows
|
|
224
|
+
|
|
225
|
+
A pane header or footer slot can publish `rows` containing a `layout` and empty
|
|
226
|
+
`spans`. `layout.fields` is an ordered list of passive text fields. The host
|
|
227
|
+
resolves its geometry separately for every viewer, including pane resizes.
|
|
228
|
+
No resize event or producer repaint is needed.
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
slot.replace({ kind: 'rows', rows: [{ id: 'status', spans: [], layout: {
|
|
232
|
+
projectTint: true,
|
|
233
|
+
fields: [
|
|
234
|
+
{ text: 'org/repo', bold: true },
|
|
235
|
+
{ text: '~/src/repo', gap: 2, flex: true, tone: 'muted',
|
|
236
|
+
shrink: { priority: 1, min: 8, mode: 'middle' } },
|
|
237
|
+
{ text: ' +24 ', gap: 2, flex: true, tone: 'ok', surface: true },
|
|
238
|
+
{ text: ' −6 ', tone: 'error', surface: true },
|
|
239
|
+
],
|
|
240
|
+
} }] })
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`gap` reserves 0–8 cells before a field. `flex` distributes spare width across
|
|
244
|
+
marked gaps; related fields without flexible gaps stay together. The first
|
|
245
|
+
field starts at the left edge and the final field reaches the right edge when
|
|
246
|
+
at least one visible flexible gap exists. `projectTint` fills the whole row
|
|
247
|
+
with the pane project's identity tint. `tone` accepts `muted`, `ok`, `error`,
|
|
248
|
+
`info`, `warning`, or `project`; semantic colors resolve against the viewer's
|
|
249
|
+
terminal palette. `surface` shades that field's background and `bold` emphasizes
|
|
250
|
+
its text. Include spaces in a field for padded color blocks.
|
|
251
|
+
|
|
252
|
+
`icon` is one Nerd Font private-use glyph. `fallback` is an optional ASCII
|
|
253
|
+
replacement (up to 16 bytes); viewers without Nerd Font support use the fallback.
|
|
254
|
+
The host supplies one space after an icon or fallback.
|
|
255
|
+
|
|
256
|
+
`shrink` policies run by increasing `priority` (0–255), then field order.
|
|
257
|
+
`min` is the retained text width in cells. `start`, `middle`, and `end` select
|
|
258
|
+
where an ellipsis replaces removed text. `hide` removes a field including its
|
|
259
|
+
icon and gap; all hide policies with equal priority are removed together.
|
|
260
|
+
Trimming preserves grapheme boundaries. If the declared minimum widths still
|
|
261
|
+
exceed the pane, remaining content clips at the right edge.
|
|
262
|
+
|
|
263
|
+
Layouts allow 1–32 fields, 2,048 UTF-8 bytes per text field and 8,192 total text
|
|
264
|
+
bytes. Controls and bidi formatting characters are rejected. Layouts are
|
|
265
|
+
supported only in pane header/footer slots. Ordinary rows and full/half slot
|
|
266
|
+
stacking retain their existing behavior.
|
|
267
|
+
|
|
268
|
+
Set a card declaration’s `title` to `""` to omit its heading and icon. With
|
|
269
|
+
`border: false`, that also removes the heading row. An omitted title uses the
|
|
270
|
+
plugin name.
|
|
271
|
+
|
|
272
|
+
Canvas cards can set `CanvasSpec.titleRight` to a passive, right-aligned header label.
|
|
273
|
+
It accepts a nonempty single-line string of up to 512 UTF-8 bytes; controls and
|
|
274
|
+
bidirectional formatting characters are rejected. The host reserves the main
|
|
275
|
+
title and icon, truncates the right label to fit, and preserves the pane-open
|
|
276
|
+
indicator. Other canvas surface kinds reject this option. Update it through
|
|
277
|
+
`canvas.replace({ kind: "canvas", canvas: { ...spec, titleRight: "sidebar-plugins" } })`.
|