@happyvertical/smrt-svelte 0.55.9 → 0.55.10
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/AGENTS.md +1 -1
- package/agents/overview-surfaces.md +122 -17
- package/agents/workspace.md +6 -0
- package/dist/components/activity/ActivityList.svelte +35 -0
- package/dist/components/activity/ActivityList.svelte.d.ts +11 -0
- package/dist/components/activity/ActivityList.svelte.d.ts.map +1 -0
- package/dist/components/activity/index.d.ts +3 -0
- package/dist/components/activity/index.d.ts.map +1 -0
- package/dist/components/activity/index.js +1 -0
- package/dist/components/activity/safe-href.d.ts +3 -0
- package/dist/components/activity/safe-href.d.ts.map +1 -0
- package/dist/components/activity/safe-href.js +12 -0
- package/dist/components/activity/types.d.ts +9 -0
- package/dist/components/activity/types.d.ts.map +1 -0
- package/dist/components/activity/types.js +1 -0
- package/dist/components/notifications/LocalizedNotifications.fixture.svelte +16 -0
- package/dist/components/notifications/LocalizedNotifications.fixture.svelte.d.ts +11 -0
- package/dist/components/notifications/LocalizedNotifications.fixture.svelte.d.ts.map +1 -0
- package/dist/components/notifications/NotificationBell.svelte +136 -0
- package/dist/components/notifications/NotificationBell.svelte.d.ts +13 -0
- package/dist/components/notifications/NotificationBell.svelte.d.ts.map +1 -0
- package/dist/components/notifications/index.d.ts +3 -0
- package/dist/components/notifications/index.d.ts.map +1 -0
- package/dist/components/notifications/index.js +1 -0
- package/dist/components/notifications/types.d.ts +27 -0
- package/dist/components/notifications/types.d.ts.map +1 -0
- package/dist/components/notifications/types.js +1 -0
- package/dist/components/overview/OverviewAssistantUndo.svelte +77 -0
- package/dist/components/overview/OverviewAssistantUndo.svelte.d.ts +13 -0
- package/dist/components/overview/OverviewAssistantUndo.svelte.d.ts.map +1 -0
- package/dist/components/overview/assistant-surface.d.ts +90 -0
- package/dist/components/overview/assistant-surface.d.ts.map +1 -0
- package/dist/components/overview/assistant-surface.js +65 -0
- package/dist/components/overview/assistant.svelte.d.ts +115 -0
- package/dist/components/overview/assistant.svelte.d.ts.map +1 -0
- package/dist/components/overview/assistant.svelte.js +260 -0
- package/dist/components/overview/controller.svelte.d.ts +8 -0
- package/dist/components/overview/controller.svelte.d.ts.map +1 -1
- package/dist/components/overview/controller.svelte.js +76 -13
- package/dist/components/overview/index.d.ts +2 -0
- package/dist/components/overview/index.d.ts.map +1 -1
- package/dist/components/overview/index.js +2 -0
- package/dist/components/overview/operations.d.ts +169 -0
- package/dist/components/overview/operations.d.ts.map +1 -0
- package/dist/components/overview/operations.js +358 -0
- package/dist/components/overview/server.d.ts +2 -0
- package/dist/components/overview/server.d.ts.map +1 -1
- package/dist/components/overview/server.js +2 -0
- package/dist/components/workspace/admin-shell/settings-delta.d.ts +21 -0
- package/dist/components/workspace/admin-shell/settings-delta.d.ts.map +1 -0
- package/dist/components/workspace/admin-shell/settings-delta.js +142 -0
- package/dist/components/workspace/index.d.ts +1 -0
- package/dist/components/workspace/index.d.ts.map +1 -1
- package/dist/components/workspace/index.js +1 -0
- package/dist/components/workspace/server/index.d.ts +6 -2
- package/dist/components/workspace/server/index.d.ts.map +1 -1
- package/dist/components/workspace/server/index.js +5 -2
- package/dist/i18n/server.d.ts +1 -0
- package/dist/i18n/server.d.ts.map +1 -1
- package/dist/i18n/server.js +1 -0
- package/dist/i18n/strings.notifications.d.ts +12 -0
- package/dist/i18n/strings.notifications.d.ts.map +1 -0
- package/dist/i18n/strings.notifications.js +13 -0
- package/dist/i18n/strings.overview.d.ts +6 -0
- package/dist/i18n/strings.overview.d.ts.map +1 -1
- package/dist/i18n/strings.overview.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +20 -14
|
@@ -22,7 +22,20 @@ export class OverviewController {
|
|
|
22
22
|
#local = $state.raw(null);
|
|
23
23
|
#entries = $state.raw({});
|
|
24
24
|
#pending = new Map();
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Overrides handed to `onchange` that a host-owned getter has not fed back
|
|
27
|
+
* yet, oldest first, and what the getter answered before the oldest of
|
|
28
|
+
* them (`prior`). Hosts acknowledge in order.
|
|
29
|
+
*/
|
|
30
|
+
#outstanding = null;
|
|
31
|
+
#resolved = $derived.by(() => {
|
|
32
|
+
const resolved = resolveOverview(this.#options.definition, this.#options.override ? this.#options.override() : this.#local, this.#registry);
|
|
33
|
+
// Every host feed-back passes here (the grid reads `document`), so a
|
|
34
|
+
// pending edit is retired as soon as the getter moves off its prior
|
|
35
|
+
// value, even if nothing reads `committedOverride` in between.
|
|
36
|
+
this.#retire(diffOverview(resolved.base, resolved.document));
|
|
37
|
+
return resolved;
|
|
38
|
+
});
|
|
26
39
|
constructor(options) {
|
|
27
40
|
this.#options = options;
|
|
28
41
|
this.#registry = options.registry ?? defaultWidgetRegistry;
|
|
@@ -60,6 +73,61 @@ export class OverviewController {
|
|
|
60
73
|
get override() {
|
|
61
74
|
return diffOverview(this.#resolved.base, this.#resolved.document);
|
|
62
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The override this controller last committed: {@link override}, or, while
|
|
78
|
+
* a host-owned getter still answers the value from before the last edit
|
|
79
|
+
* (the host has not fed it back yet), the value handed to `onchange`. An
|
|
80
|
+
* Undo compares against this so a pending save is not mistaken for a
|
|
81
|
+
* change made elsewhere.
|
|
82
|
+
*/
|
|
83
|
+
get committedOverride() {
|
|
84
|
+
const current = this.override;
|
|
85
|
+
this.#retire(current);
|
|
86
|
+
const outstanding = this.#outstanding;
|
|
87
|
+
return outstanding
|
|
88
|
+
? outstanding.values.at(-1)
|
|
89
|
+
: current;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Acknowledge what the host getter now answers. Still the value from before
|
|
93
|
+
* the oldest outstanding emission: nothing was fed back yet. Equal to an
|
|
94
|
+
* outstanding emission: that one and every older one are acknowledged (in
|
|
95
|
+
* order), and the getter's value becomes the prior of the rest. Anything
|
|
96
|
+
* else is a change made elsewhere: the queue is dropped, so the mask only
|
|
97
|
+
* ever covers this controller's own unacknowledged saves.
|
|
98
|
+
*/
|
|
99
|
+
#retire(current) {
|
|
100
|
+
const outstanding = this.#outstanding;
|
|
101
|
+
if (!outstanding || sameJson(current, outstanding.prior))
|
|
102
|
+
return;
|
|
103
|
+
const index = outstanding.values.findIndex((value) => sameJson(value, current));
|
|
104
|
+
if (index < 0 || index === outstanding.values.length - 1) {
|
|
105
|
+
this.#outstanding = null;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.#outstanding = {
|
|
109
|
+
prior: current,
|
|
110
|
+
values: outstanding.values.slice(index + 1),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** Hand a canonical override to the host, queueing it until fed back. */
|
|
114
|
+
#emit(override) {
|
|
115
|
+
if (this.#options.override) {
|
|
116
|
+
const current = this.override;
|
|
117
|
+
this.#retire(current);
|
|
118
|
+
const outstanding = this.#outstanding;
|
|
119
|
+
this.#outstanding = outstanding
|
|
120
|
+
? {
|
|
121
|
+
prior: outstanding.prior,
|
|
122
|
+
values: [...outstanding.values, override],
|
|
123
|
+
}
|
|
124
|
+
: { prior: current, values: [override] };
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.#local = override;
|
|
128
|
+
}
|
|
129
|
+
void this.#options.onchange?.(override);
|
|
130
|
+
}
|
|
63
131
|
/** What was dropped or reported while resolving. */
|
|
64
132
|
get issues() {
|
|
65
133
|
return this.#resolved.issues;
|
|
@@ -103,12 +171,10 @@ export class OverviewController {
|
|
|
103
171
|
definition: this.#options.definition,
|
|
104
172
|
});
|
|
105
173
|
const override = diffOverview(this.#resolved.base, sanitized.document);
|
|
106
|
-
if (sameJson(override, this.
|
|
174
|
+
if (sameJson(override, this.committedOverride)) {
|
|
107
175
|
return { ok: false, reason: 'unchanged' };
|
|
108
176
|
}
|
|
109
|
-
|
|
110
|
-
this.#local = override;
|
|
111
|
-
void this.#options.onchange?.(override);
|
|
177
|
+
this.#emit(override);
|
|
112
178
|
// The derived document reflects a host-owned override only after the host
|
|
113
179
|
// feeds it back, so sync against what was just committed.
|
|
114
180
|
this.#syncWidgets(sanitized.document.widgets);
|
|
@@ -227,11 +293,10 @@ export class OverviewController {
|
|
|
227
293
|
const denied = this.#gate();
|
|
228
294
|
if (denied)
|
|
229
295
|
return denied;
|
|
230
|
-
if (
|
|
296
|
+
if (isEmptyOverride(this.committedOverride)) {
|
|
231
297
|
return { ok: false, reason: 'unchanged' };
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
void this.#options.onchange?.(null);
|
|
298
|
+
}
|
|
299
|
+
this.#emit(null);
|
|
235
300
|
this.#syncWidgets(this.#resolved.base.widgets);
|
|
236
301
|
return { ok: true, id: '' };
|
|
237
302
|
}
|
|
@@ -246,12 +311,10 @@ export class OverviewController {
|
|
|
246
311
|
const { override: parsed } = parseOverviewOverride(override);
|
|
247
312
|
const next = resolveOverview(this.#options.definition, parsed, this.#registry);
|
|
248
313
|
const canonical = diffOverview(next.base, next.document);
|
|
249
|
-
if (sameJson(canonical, this.
|
|
314
|
+
if (sameJson(canonical, this.committedOverride)) {
|
|
250
315
|
return { ok: false, reason: 'unchanged' };
|
|
251
316
|
}
|
|
252
|
-
|
|
253
|
-
this.#local = canonical;
|
|
254
|
-
void this.#options.onchange?.(canonical);
|
|
317
|
+
this.#emit(canonical);
|
|
255
318
|
this.#syncWidgets(next.document.widgets);
|
|
256
319
|
return { ok: true, id: '' };
|
|
257
320
|
}
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* editor. The Svelte-free model, registry and server load contract are also
|
|
7
7
|
* published on `@happyvertical/smrt-svelte/overview/server`.
|
|
8
8
|
*/
|
|
9
|
+
export { createOverviewAssistant, OverviewAssistant, type OverviewAssistantApplyResult, type OverviewAssistantBatch, type OverviewAssistantOptions, type OverviewAssistantUndoResult, useOverviewAssistantTools, } from './assistant.svelte.js';
|
|
9
10
|
export { createOverview, OverviewController, type OverviewControllerOptions, type OverviewOpResult, type OverviewWidgetEntry, } from './controller.svelte.js';
|
|
10
11
|
export { type FormatWidgetValueOptions, formatWidgetValue, type WidgetValueFormat, } from './format.js';
|
|
11
12
|
export type { OverviewFormIssue, OverviewGridProps, OverviewModelChoice, WidgetOptionsFormProps, } from './grid-types.js';
|
|
12
13
|
export { type BlockNode, type InlineNode, parseMarkdown, safeHref, } from './markdown.js';
|
|
14
|
+
export { default as OverviewAssistantUndo } from './OverviewAssistantUndo.svelte';
|
|
13
15
|
export { default as OverviewGrid } from './OverviewGrid.svelte';
|
|
14
16
|
export { spanFromKey, spanFromPointer } from './resize.js';
|
|
15
17
|
export * from './server.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/overview/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,aAAa,EACb,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/overview/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,aAAa,EACb,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
* editor. The Svelte-free model, registry and server load contract are also
|
|
7
7
|
* published on `@happyvertical/smrt-svelte/overview/server`.
|
|
8
8
|
*/
|
|
9
|
+
export { createOverviewAssistant, OverviewAssistant, useOverviewAssistantTools, } from './assistant.svelte.js';
|
|
9
10
|
export { createOverview, OverviewController, } from './controller.svelte.js';
|
|
10
11
|
export { formatWidgetValue, } from './format.js';
|
|
11
12
|
export { parseMarkdown, safeHref, } from './markdown.js';
|
|
13
|
+
export { default as OverviewAssistantUndo } from './OverviewAssistantUndo.svelte';
|
|
12
14
|
export { default as OverviewGrid } from './OverviewGrid.svelte';
|
|
13
15
|
export { spanFromKey, spanFromPointer } from './resize.js';
|
|
14
16
|
export * from './server.js';
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured overview operations (#3727 phase 4): the batch an assistant (or
|
|
3
|
+
* any other non-UI caller) applies to an overview, and the description it
|
|
4
|
+
* reads first.
|
|
5
|
+
*
|
|
6
|
+
* An operation is data, never code: `add`, `configure`, `move`, `resize` and
|
|
7
|
+
* `remove`, with the same option vocabulary the grid's own editor uses. A batch
|
|
8
|
+
* is planned against the page's definition and the current override with the
|
|
9
|
+
* phase-1 model and then checked with {@link checkOverviewOverride}, so it can
|
|
10
|
+
* only produce an override the save endpoint would accept. A batch is atomic:
|
|
11
|
+
* one invalid operation rejects the whole batch and nothing is returned to
|
|
12
|
+
* apply. Nothing here loads data or runs a query.
|
|
13
|
+
*
|
|
14
|
+
* Svelte-free; on both `./overview` and `./overview/server`.
|
|
15
|
+
*/
|
|
16
|
+
import type { WidgetRegistry } from './registry.js';
|
|
17
|
+
import { type OverviewDefinition, type OverviewDocument, type OverviewOptions, type OverviewOptionValue, type OverviewOverride, type OverviewWidget, type RegisteredWidget, type WidgetOptionField, type WidgetOptionIssue } from './types.js';
|
|
18
|
+
/** Most operations one batch may carry. */
|
|
19
|
+
export declare const OVERVIEW_MAX_OPERATIONS = 20;
|
|
20
|
+
/** Add a widget at the end (or at `index`). */
|
|
21
|
+
export interface OverviewAddOperation {
|
|
22
|
+
op: 'add';
|
|
23
|
+
type: string;
|
|
24
|
+
span?: number;
|
|
25
|
+
options?: OverviewOptions;
|
|
26
|
+
/** Position once added (default: the end). */
|
|
27
|
+
index?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Change a widget's options. The given keys are merged onto the current
|
|
31
|
+
* options; a `null` value clears that key back to its default.
|
|
32
|
+
*/
|
|
33
|
+
export interface OverviewConfigureOperation {
|
|
34
|
+
op: 'configure';
|
|
35
|
+
id: string;
|
|
36
|
+
options: Record<string, OverviewOptionValue>;
|
|
37
|
+
}
|
|
38
|
+
/** Move a widget so it sits at `index` once it is taken out of the list. */
|
|
39
|
+
export interface OverviewMoveOperation {
|
|
40
|
+
op: 'move';
|
|
41
|
+
id: string;
|
|
42
|
+
index: number;
|
|
43
|
+
}
|
|
44
|
+
/** Set a widget's column span. */
|
|
45
|
+
export interface OverviewResizeOperation {
|
|
46
|
+
op: 'resize';
|
|
47
|
+
id: string;
|
|
48
|
+
span: number;
|
|
49
|
+
}
|
|
50
|
+
/** Remove a widget. */
|
|
51
|
+
export interface OverviewRemoveOperation {
|
|
52
|
+
op: 'remove';
|
|
53
|
+
id: string;
|
|
54
|
+
}
|
|
55
|
+
export type OverviewOperation = OverviewAddOperation | OverviewConfigureOperation | OverviewMoveOperation | OverviewResizeOperation | OverviewRemoveOperation;
|
|
56
|
+
export type OverviewOperationKind = OverviewOperation['op'];
|
|
57
|
+
export declare const OVERVIEW_OPERATION_KINDS: readonly OverviewOperationKind[];
|
|
58
|
+
export type OverviewOperationIssueCode = 'malformed' | 'too_many_operations' | 'unknown_widget' | 'unknown_type' | 'type_not_allowed' | 'invalid_options' | 'invalid_span' | 'invalid_index' | 'limit' | 'rejected';
|
|
59
|
+
/** Why one operation (or the batch) was rejected. */
|
|
60
|
+
export interface OverviewOperationIssue {
|
|
61
|
+
/** Zero-based position of the operation in the batch; `null` for the batch. */
|
|
62
|
+
index: number | null;
|
|
63
|
+
op: string | null;
|
|
64
|
+
widgetId: string | null;
|
|
65
|
+
code: OverviewOperationIssueCode;
|
|
66
|
+
/** Developer- and model-facing detail; not localized. */
|
|
67
|
+
message: string;
|
|
68
|
+
/** Option-level problems when `code` is `invalid_options`. */
|
|
69
|
+
options?: WidgetOptionIssue[];
|
|
70
|
+
}
|
|
71
|
+
/** What one applied operation did. */
|
|
72
|
+
export interface OverviewOperationResult {
|
|
73
|
+
index: number;
|
|
74
|
+
op: OverviewOperationKind;
|
|
75
|
+
/** The widget it touched (the new id for an `add`). */
|
|
76
|
+
id: string;
|
|
77
|
+
}
|
|
78
|
+
export type OverviewPlan = {
|
|
79
|
+
ok: true;
|
|
80
|
+
/** The canonical override to persist (`null` = back to defaults). */
|
|
81
|
+
override: OverviewOverride | null;
|
|
82
|
+
/** The document the override resolves to. */
|
|
83
|
+
document: OverviewDocument;
|
|
84
|
+
results: OverviewOperationResult[];
|
|
85
|
+
/** True when the batch changes nothing. */
|
|
86
|
+
unchanged: boolean;
|
|
87
|
+
} | {
|
|
88
|
+
ok: false;
|
|
89
|
+
issues: OverviewOperationIssue[];
|
|
90
|
+
};
|
|
91
|
+
export interface PlanOverviewOperationsInput {
|
|
92
|
+
definition: OverviewDefinition;
|
|
93
|
+
registry: WidgetRegistry;
|
|
94
|
+
/** The current override (untrusted JSON; `null` for none). */
|
|
95
|
+
override: unknown;
|
|
96
|
+
/** The operations (untrusted JSON from a model). */
|
|
97
|
+
operations: unknown;
|
|
98
|
+
/** Batch cap (default {@link OVERVIEW_MAX_OPERATIONS}). */
|
|
99
|
+
maxOperations?: number;
|
|
100
|
+
}
|
|
101
|
+
/** Widget types an overview allows, in registration order. */
|
|
102
|
+
export declare function allowedWidgetTypes(definition: OverviewDefinition, registry: WidgetRegistry): RegisteredWidget[];
|
|
103
|
+
/**
|
|
104
|
+
* Plan a batch of operations against an overview. Total: never throws, never
|
|
105
|
+
* mutates its input. On success, persist (or `controller.restore`) the
|
|
106
|
+
* returned `override`; on failure nothing may be applied.
|
|
107
|
+
*/
|
|
108
|
+
export declare function planOverviewOperations(input: PlanOverviewOperationsInput): OverviewPlan;
|
|
109
|
+
/** One option field, as a caller that builds operations reads it. */
|
|
110
|
+
export interface OverviewOptionDescription {
|
|
111
|
+
key: string;
|
|
112
|
+
type: WidgetOptionField['type'];
|
|
113
|
+
label: string;
|
|
114
|
+
help?: string;
|
|
115
|
+
required?: boolean;
|
|
116
|
+
default?: OverviewOptionValue;
|
|
117
|
+
min?: number;
|
|
118
|
+
max?: number;
|
|
119
|
+
maxLength?: number;
|
|
120
|
+
/** `enum`: the closed set of values. */
|
|
121
|
+
choices?: string[];
|
|
122
|
+
/** `model`: the models this page allows (absent = any model name). */
|
|
123
|
+
models?: string[];
|
|
124
|
+
}
|
|
125
|
+
/** A widget type the page allows. */
|
|
126
|
+
export interface OverviewWidgetTypeDescription {
|
|
127
|
+
type: string;
|
|
128
|
+
title: string;
|
|
129
|
+
description?: string;
|
|
130
|
+
version: number;
|
|
131
|
+
span: {
|
|
132
|
+
default: number;
|
|
133
|
+
min: number;
|
|
134
|
+
max: number;
|
|
135
|
+
};
|
|
136
|
+
options: OverviewOptionDescription[];
|
|
137
|
+
}
|
|
138
|
+
/** What an overview allows and what it shows now. JSON. */
|
|
139
|
+
export interface OverviewDescription {
|
|
140
|
+
id: string;
|
|
141
|
+
canCustomize: boolean;
|
|
142
|
+
customized: boolean;
|
|
143
|
+
maxWidgets: number;
|
|
144
|
+
maxOperations: number;
|
|
145
|
+
widgetTypes: OverviewWidgetTypeDescription[];
|
|
146
|
+
/** The current arrangement, in display order. */
|
|
147
|
+
widgets: Array<OverviewWidget & {
|
|
148
|
+
index: number;
|
|
149
|
+
title: string;
|
|
150
|
+
}>;
|
|
151
|
+
}
|
|
152
|
+
export interface DescribeOverviewInput {
|
|
153
|
+
definition: OverviewDefinition;
|
|
154
|
+
registry: WidgetRegistry;
|
|
155
|
+
override: unknown;
|
|
156
|
+
canCustomize: boolean;
|
|
157
|
+
/** Turns titles, labels and help that are i18n keys into text. */
|
|
158
|
+
translate?: (key: string) => string;
|
|
159
|
+
maxOperations?: number;
|
|
160
|
+
}
|
|
161
|
+
/** Describe an overview for a caller that builds operations (an assistant). */
|
|
162
|
+
export declare function describeOverview(input: DescribeOverviewInput): OverviewDescription;
|
|
163
|
+
/**
|
|
164
|
+
* JSON schema of one operation, for a tool's `inputSchema` / `parameters`.
|
|
165
|
+
* Option values are JSON primitives; the per-type fields come from
|
|
166
|
+
* {@link describeOverview}.
|
|
167
|
+
*/
|
|
168
|
+
export declare const OVERVIEW_OPERATION_SCHEMA: Record<string, unknown>;
|
|
169
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/components/overview/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAErB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAEpB,2CAA2C;AAC3C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,KAAK,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,WAAW,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC9C;AAED,4EAA4E;AAC5E,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,kCAAkC;AAClC,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,QAAQ,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;C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