@rackbops/ac-plugin-contract 2.0.0-alpha.37 → 2.0.0-alpha.39
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/AUTHORING.md +25 -7
- package/dist/host-api.d.ts +13 -0
- package/package.json +1 -1
package/AUTHORING.md
CHANGED
|
@@ -192,6 +192,11 @@ export const createPlugin: CreatePlugin = (host) => ({
|
|
|
192
192
|
agent's text with a storage error of your own.
|
|
193
193
|
- **Setting** — read/write with `host.settings.get(key)` / `host.settings.set(key, value)`. Both are async;
|
|
194
194
|
`get` returns the manifest `default` when unset.
|
|
195
|
+
- **Console settings** (#506) — `host.consoleSettings?.get(key)`, read-only, optional. Unlike `Setting`
|
|
196
|
+
above (per-plugin), this reads the console-WIDE settings an operator edits in Admin's Settings card
|
|
197
|
+
(`repo_owners`, `layout_file`, `tab_order`, `plan_default_machine`, `repo_pins`) -- but only a key on
|
|
198
|
+
that editable-settings whitelist; anything else resolves to `undefined`. `plugins/provider-github`
|
|
199
|
+
is the reference consumer (`repo_owners`/`repo_pins`, its own repo-set resolution).
|
|
195
200
|
|
|
196
201
|
`createPlugin` must import from `@ac/contract` **type-only** (`import type`), so the compiled `dist/server.js`
|
|
197
202
|
has no runtime imports — see §6.
|
|
@@ -371,12 +376,21 @@ it.
|
|
|
371
376
|
until the operator navigates away: it never remounts one to refresh it. (It used to, on any return to the
|
|
372
377
|
window more than a minute after the panel was opened, which reset every filter, selection and half-typed field
|
|
373
378
|
the panel held, every time.) So a panel whose data goes stale while it is open refreshes it itself, in place,
|
|
374
|
-
into the state already on screen: the Board polls every 15 minutes
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
379
|
+
into the state already on screen: the Board polls every 15 minutes, and Issues (`issues-classic`) reads its
|
|
380
|
+
list again when the tab comes back (`focus` on `window`, or `visibilitychange` to visible) 15 minutes or more
|
|
381
|
+
after its last load or refresh; each also has a Refresh now button for a read on demand (#546, #550).
|
|
382
|
+
Navigating to another console tab does unmount a panel, so a panel that should not reload on every tab change
|
|
383
|
+
keeps its data at module scope: a plugin frontend is one ES module loaded once per page, so module-level state
|
|
384
|
+
outlives the unmount, until a full page reload. The Board, Issues and Home's open-issues card all do this
|
|
385
|
+
(#550). Coming back within 15 minutes of the last load shows the data it already had without reading it
|
|
386
|
+
again, and coming back later reads at once. After a read fails, the Board retries the list or the broken
|
|
387
|
+
card on its next remount; Issues re-reads on a remount only what has had no successful read in the last 15
|
|
388
|
+
minutes, and a return or Refresh now click on Issues restarts its 15 minutes whether or not that read
|
|
389
|
+
succeeds. For Issues, "the last load" is the oldest of its repo list's load and each listed repo's issues
|
|
390
|
+
load, so it is only as fresh as its stalest part. A panel that does neither -- Agents, the Admin board's
|
|
391
|
+
cards -- reads when it is opened and after its own actions. Only Home is still refreshed by the shell,
|
|
392
|
+
which remounts it for Refresh, the heartbeat and a return after a minute; Home's open-issues card keeps
|
|
393
|
+
its count across those remounts, so within 15 minutes of its last load none of them re-reads it (#550).
|
|
380
394
|
|
|
381
395
|
### The `@ac/host` browser module
|
|
382
396
|
|
|
@@ -511,7 +525,11 @@ still gets its own `Response` (`.clone()`), so two independent reads of a cache
|
|
|
511
525
|
already-consumed body. Only `GET` may be cached (`cached` throws on any other method); a rejected fetch is
|
|
512
526
|
never cached — the very next call retries. **A card reads through `cached`, never bare `fetch`, so Refresh
|
|
513
527
|
and the Overview heartbeat (both call `invalidate`) actually reach it** — a card that bypasses `cached` keeps
|
|
514
|
-
serving its own stale response until its own next poll, deaf to both
|
|
528
|
+
serving its own stale response until its own next poll, deaf to both. A card that deliberately keeps its own
|
|
529
|
+
data across a remount (Home's open-issues card, #550) is a further exception on the other side: both Refresh
|
|
530
|
+
and the heartbeat arrive at it as a remount, and it ignores a remount within 15 minutes of its last load —
|
|
531
|
+
`invalidate()` clears `cached`'s own TTL cache, but the card's own freshness check skips calling `cached` at
|
|
532
|
+
all before it ever gets there.
|
|
515
533
|
|
|
516
534
|
```ts
|
|
517
535
|
import { cached, invalidate } from "@ac/host"
|
package/dist/host-api.d.ts
CHANGED
|
@@ -14,6 +14,16 @@ export interface SettingsService {
|
|
|
14
14
|
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
15
15
|
set(key: string, value: unknown): Promise<void>;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Read-only view of the console-WIDE settings an operator edits in Admin's Settings card (#506) --
|
|
19
|
+
* distinct from `SettingsService` above, which is per-plugin. Only a key on the editable-settings
|
|
20
|
+
* whitelist (`settings-schema.ts`) is readable here; any other key resolves to `undefined`, so a
|
|
21
|
+
* plugin can never reach an arbitrary host-global key through this surface. The value returned is
|
|
22
|
+
* the EFFECTIVE one (an `AC_<KEY>` env override included), the same value the Settings card shows.
|
|
23
|
+
*/
|
|
24
|
+
export interface ConsoleSettingsService {
|
|
25
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
26
|
+
}
|
|
17
27
|
/** Per-plugin durable storage: a SQLite table scoped to the plugin, with atomic JSON helpers. */
|
|
18
28
|
export interface StorageService {
|
|
19
29
|
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
@@ -203,6 +213,9 @@ export interface HostApi {
|
|
|
203
213
|
plugins?: PluginJobsService;
|
|
204
214
|
/** #84: see `SlotRegistry`. */
|
|
205
215
|
slots: SlotRegistry;
|
|
216
|
+
/** #506: see `ConsoleSettingsService`. Optional so an out-of-repo plugin's own test fake still
|
|
217
|
+
* compiles. */
|
|
218
|
+
consoleSettings?: ConsoleSettingsService;
|
|
206
219
|
}
|
|
207
220
|
/**
|
|
208
221
|
* The context the host passes to `Plugin.runJob` for one job run (#31). `jobId` selects which
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rackbops/ac-plugin-contract",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.39",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "The artifact-console plugin ABI for out-of-repo plugin authors: HostApi, the acPlugin manifest contribution points, the generated manifest JSON Schema, and the @ac/host ambient browser declaration.",
|