@cosmicdrift/kumiko-types 0.240.0 → 0.242.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/package.json +1 -1
- package/src/agent-exposure.ts +8 -0
- package/src/screen.ts +31 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.242.0",
|
|
4
4
|
"description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
package/src/agent-exposure.ts
CHANGED
|
@@ -12,3 +12,11 @@ export function resolveAgentExposure(
|
|
|
12
12
|
risk: def.agent?.risk ?? (kind === "query" ? "low" : "mid"),
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
/** Screens are the inverse of handlers: the manifest lists every role-visible
|
|
17
|
+
* screen regardless of `description`, so only an explicit opt-out hides one.
|
|
18
|
+
* Reusing `resolveAgentExposure`'s fail-closed default here would silently
|
|
19
|
+
* drop every screen without a description from the agent's view. */
|
|
20
|
+
export function isAgentVisibleScreen(screen: { readonly agent?: AgentHandlerHints }): boolean {
|
|
21
|
+
return screen.agent?.expose !== false;
|
|
22
|
+
}
|
package/src/screen.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FieldIconKey } from "./field-icon";
|
|
2
2
|
import type { FieldDefinition } from "./fields";
|
|
3
|
-
import type { AccessRule } from "./handlers";
|
|
3
|
+
import type { AccessRule, AgentHandlerHints } from "./handlers";
|
|
4
4
|
import type { IconKey, NavIconKey } from "./nav-icon";
|
|
5
5
|
|
|
6
6
|
export type { FieldIconKey } from "./field-icon";
|
|
@@ -72,6 +72,8 @@ export interface FieldFormatRegistry {
|
|
|
72
72
|
// Prefer fieldOptionLabelKeyPrefix() from @cosmicdrift/kumiko-headless
|
|
73
73
|
// over hand-typed prefix strings.
|
|
74
74
|
enumOption: { readonly keyPrefix: string };
|
|
75
|
+
/** JSON-safe structured value rendered as indented text. */
|
|
76
|
+
json: { readonly indent?: number };
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
// Discriminated union derived from the registry — one variant per key.
|
|
@@ -338,6 +340,7 @@ export type EntityListScreenDefinition = {
|
|
|
338
340
|
readonly nav?: ScreenNavSugar;
|
|
339
341
|
readonly detailFor?: string;
|
|
340
342
|
readonly description?: string;
|
|
343
|
+
readonly agent?: AgentHandlerHints;
|
|
341
344
|
readonly entity: string;
|
|
342
345
|
readonly columns: readonly ListColumnSpec[];
|
|
343
346
|
// Row renderer (Desktop) — when omitted, renderer draws the default table
|
|
@@ -417,6 +420,7 @@ export type ProjectionListScreenDefinition = {
|
|
|
417
420
|
readonly nav?: ScreenNavSugar;
|
|
418
421
|
readonly detailFor?: string;
|
|
419
422
|
readonly description?: string;
|
|
423
|
+
readonly agent?: AgentHandlerHints;
|
|
420
424
|
readonly query: string;
|
|
421
425
|
readonly columns: readonly ListColumnSpec[];
|
|
422
426
|
readonly rowRenderer?: PlatformComponent;
|
|
@@ -478,9 +482,22 @@ export type ProjectionDetailScreenDefinition = {
|
|
|
478
482
|
readonly nav?: ScreenNavSugar;
|
|
479
483
|
readonly detailFor?: string;
|
|
480
484
|
readonly description?: string;
|
|
485
|
+
readonly agent?: AgentHandlerHints;
|
|
481
486
|
readonly query: string;
|
|
482
487
|
/** Query-payload key for the row-id. Default "id". */
|
|
483
488
|
readonly idParam?: string;
|
|
489
|
+
/** The server determines the shown row from the caller's session/context
|
|
490
|
+
* instead of a row id in the path — a self-service screen ("my profile",
|
|
491
|
+
* "my data") that has no row to link to (unlike `EntityEditScreenDefinition.
|
|
492
|
+
* singleton`, which still resolves via `<entity>:list` limit 1; here the
|
|
493
|
+
* query itself owns the row selection, e.g. `user:query:user:me`). The
|
|
494
|
+
* query is called WITHOUT the `idParam` key — there is no id to send, so
|
|
495
|
+
* the boot-validator rejects declaring `idParam` alongside this flag
|
|
496
|
+
* instead of letting one silently win. Stricter than an id-addressed
|
|
497
|
+
* screen, not looser: the server picks the row, so no client-supplied id
|
|
498
|
+
* can reach the query — a stray id on the path is ignored, never
|
|
499
|
+
* forwarded. */
|
|
500
|
+
readonly singleton?: boolean;
|
|
484
501
|
readonly layout: EditLayout;
|
|
485
502
|
/** Optionaler per-Field-Label-i18n-Key (Field-Name → Key), analog zu
|
|
486
503
|
* entityEdit.fieldLabels. Die Pseudo-Entity `__projection-detail__` hat
|
|
@@ -529,6 +546,10 @@ export type DashboardStatPanel = {
|
|
|
529
546
|
/** Anzeige-Text (i18n-Key). */
|
|
530
547
|
readonly label: string;
|
|
531
548
|
readonly query: string;
|
|
549
|
+
/** Static, author-set query parameters merged on top of the screen's
|
|
550
|
+
* dynamic filterParams — lets a panel pin a value (e.g. a status facet)
|
|
551
|
+
* the screen-wide filter doesn't cover, without needing its own query. */
|
|
552
|
+
readonly params?: Readonly<Record<string, unknown>>;
|
|
532
553
|
readonly valueField: string;
|
|
533
554
|
readonly subField?: string;
|
|
534
555
|
readonly toneField?: string;
|
|
@@ -647,6 +668,7 @@ export type DashboardScreenDefinition = {
|
|
|
647
668
|
readonly nav?: ScreenNavSugar;
|
|
648
669
|
readonly detailFor?: string;
|
|
649
670
|
readonly description?: string;
|
|
671
|
+
readonly agent?: AgentHandlerHints;
|
|
650
672
|
readonly panels: readonly DashboardPanelDefinition[];
|
|
651
673
|
readonly filter?: DashboardFilterDefinition;
|
|
652
674
|
readonly slots?: ScreenSlots;
|
|
@@ -844,6 +866,7 @@ export type EntityEditScreenDefinition = {
|
|
|
844
866
|
readonly nav?: ScreenNavSugar;
|
|
845
867
|
readonly detailFor?: string;
|
|
846
868
|
readonly description?: string;
|
|
869
|
+
readonly agent?: AgentHandlerHints;
|
|
847
870
|
readonly entity: string;
|
|
848
871
|
readonly layout: EditLayout;
|
|
849
872
|
/** Optionaler i18n-Key (oder Roh-String) für den Submit-Button. Default
|
|
@@ -924,6 +947,7 @@ export type ActionFormScreenDefinition = {
|
|
|
924
947
|
readonly nav?: ScreenNavSugar;
|
|
925
948
|
readonly detailFor?: string;
|
|
926
949
|
readonly description?: string;
|
|
950
|
+
readonly agent?: AgentHandlerHints;
|
|
927
951
|
/** Write-Handler-QN der bei Submit gerufen wird. Form-Object landet
|
|
928
952
|
* 1:1 als payload — Handler-Schema (Zod) validiert weiter. */
|
|
929
953
|
readonly handler: string;
|
|
@@ -980,6 +1004,8 @@ export type CustomScreenDefinition = {
|
|
|
980
1004
|
readonly nav?: ScreenNavSugar;
|
|
981
1005
|
readonly detailFor?: string;
|
|
982
1006
|
readonly description?: string;
|
|
1007
|
+
/** Only `expose` is read for screens; `risk` ranks handler tool calls. */
|
|
1008
|
+
readonly agent?: AgentHandlerHints;
|
|
983
1009
|
readonly renderer: PlatformComponent;
|
|
984
1010
|
readonly routes?: readonly CustomScreenRoute[];
|
|
985
1011
|
/** Parent list screen for breadcrumb when this detail is not in nav. */
|
|
@@ -1036,6 +1062,7 @@ export type ConfigEditScreenDefinition = {
|
|
|
1036
1062
|
readonly nav?: ScreenNavSugar;
|
|
1037
1063
|
readonly detailFor?: string;
|
|
1038
1064
|
readonly description?: string;
|
|
1065
|
+
readonly agent?: AgentHandlerHints;
|
|
1039
1066
|
/** scope für config:write:set Calls. Muss zur Scope-Deklaration der
|
|
1040
1067
|
* in `configKeys` referenzierten Keys passen — Boot-Validator
|
|
1041
1068
|
* prüft das gegen die Registry. */
|
|
@@ -1079,6 +1106,7 @@ export type SecretsEditScreenDefinition = {
|
|
|
1079
1106
|
readonly nav?: ScreenNavSugar;
|
|
1080
1107
|
readonly detailFor?: string;
|
|
1081
1108
|
readonly description?: string;
|
|
1109
|
+
readonly agent?: AgentHandlerHints;
|
|
1082
1110
|
/** field id -> qualified secret name (`<feature>:secret:<kebab>`). */
|
|
1083
1111
|
readonly secretKeys: Readonly<Record<string, string>>;
|
|
1084
1112
|
/** field id -> i18n key for the label. */
|
|
@@ -1116,10 +1144,10 @@ export type ScreenNavSugar = {
|
|
|
1116
1144
|
readonly order?: number;
|
|
1117
1145
|
};
|
|
1118
1146
|
|
|
1119
|
-
// `nav`/`detailFor`/`description` live directly on every variant (not only via this
|
|
1147
|
+
// `nav`/`detailFor`/`description`/`agent` live directly on every variant (not only via this
|
|
1120
1148
|
// union) so a screen typed as its own concrete kind — e.g. `const screen:
|
|
1121
1149
|
// CustomScreenDefinition = {...}` in a module split out of `feature.ts` —
|
|
1122
|
-
// still accepts all
|
|
1150
|
+
// still accepts all four; a union-only intersection drops them the
|
|
1123
1151
|
// moment a caller narrows to one member.
|
|
1124
1152
|
//
|
|
1125
1153
|
// `detailFor` applies to any screen kind because any kind can be the
|