@cosmicdrift/kumiko-types 0.241.0 → 0.243.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.241.0",
3
+ "version": "0.243.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>",
@@ -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";
@@ -340,6 +340,7 @@ export type EntityListScreenDefinition = {
340
340
  readonly nav?: ScreenNavSugar;
341
341
  readonly detailFor?: string;
342
342
  readonly description?: string;
343
+ readonly agent?: AgentHandlerHints;
343
344
  readonly entity: string;
344
345
  readonly columns: readonly ListColumnSpec[];
345
346
  // Row renderer (Desktop) — when omitted, renderer draws the default table
@@ -419,6 +420,7 @@ export type ProjectionListScreenDefinition = {
419
420
  readonly nav?: ScreenNavSugar;
420
421
  readonly detailFor?: string;
421
422
  readonly description?: string;
423
+ readonly agent?: AgentHandlerHints;
422
424
  readonly query: string;
423
425
  readonly columns: readonly ListColumnSpec[];
424
426
  readonly rowRenderer?: PlatformComponent;
@@ -480,6 +482,7 @@ export type ProjectionDetailScreenDefinition = {
480
482
  readonly nav?: ScreenNavSugar;
481
483
  readonly detailFor?: string;
482
484
  readonly description?: string;
485
+ readonly agent?: AgentHandlerHints;
483
486
  readonly query: string;
484
487
  /** Query-payload key for the row-id. Default "id". */
485
488
  readonly idParam?: string;
@@ -665,6 +668,7 @@ export type DashboardScreenDefinition = {
665
668
  readonly nav?: ScreenNavSugar;
666
669
  readonly detailFor?: string;
667
670
  readonly description?: string;
671
+ readonly agent?: AgentHandlerHints;
668
672
  readonly panels: readonly DashboardPanelDefinition[];
669
673
  readonly filter?: DashboardFilterDefinition;
670
674
  readonly slots?: ScreenSlots;
@@ -862,6 +866,7 @@ export type EntityEditScreenDefinition = {
862
866
  readonly nav?: ScreenNavSugar;
863
867
  readonly detailFor?: string;
864
868
  readonly description?: string;
869
+ readonly agent?: AgentHandlerHints;
865
870
  readonly entity: string;
866
871
  readonly layout: EditLayout;
867
872
  /** Optionaler i18n-Key (oder Roh-String) für den Submit-Button. Default
@@ -942,6 +947,7 @@ export type ActionFormScreenDefinition = {
942
947
  readonly nav?: ScreenNavSugar;
943
948
  readonly detailFor?: string;
944
949
  readonly description?: string;
950
+ readonly agent?: AgentHandlerHints;
945
951
  /** Write-Handler-QN der bei Submit gerufen wird. Form-Object landet
946
952
  * 1:1 als payload — Handler-Schema (Zod) validiert weiter. */
947
953
  readonly handler: string;
@@ -964,8 +970,13 @@ export type ActionFormScreenDefinition = {
964
970
  * the target at boot time — an app that doesn't mount the target
965
971
  * feature fails the boot-validator; only use this form in a reusable
966
972
  * feature when the target feature is guaranteed to be mounted
967
- * alongside it. */
968
- readonly redirect?: string;
973
+ * alongside it.
974
+ *
975
+ * The object form additionally names the success-payload field the
976
+ * navigation id comes from (`ActionFormRedirect.idFrom`) — needed when
977
+ * the handler creates a child record but the target screen is the
978
+ * parent's detail screen (fw#2670). */
979
+ readonly redirect?: string | ActionFormRedirect;
969
980
  /** Target of the Cancel button. Default: `redirect` (historical
970
981
  * behavior — Cancel and the submit-redirect then land in the same
971
982
  * place). `false` = no Cancel button; correct for single-action
@@ -982,6 +993,22 @@ export type ActionFormScreenDefinition = {
982
993
  readonly access?: AccessRule;
983
994
  };
984
995
 
996
+ /** Redirect target plus the success-payload field carrying the navigation
997
+ * id. The write-handler reports the id of what it wrote (`data.id`); when
998
+ * that record is a child and the target screen shows its parent, the
999
+ * parent id has to be read from a different field instead of forcing the
1000
+ * handler to misreport its own result (fw#2670). */
1001
+ export type ActionFormRedirect = {
1002
+ /** Same target forms as the string `redirect`: short screen ID
1003
+ * (same-feature) or a fully-qualified cross-feature screen QN. */
1004
+ readonly screen: string;
1005
+ /** Flat field name in the handler's success payload, e.g. "leaseId".
1006
+ * Only used when the target screen type carries an id (`entityEdit`,
1007
+ * `projectionDetail`); a non-string or missing value navigates without
1008
+ * an id, same as a payload without `id` does today. */
1009
+ readonly idFrom: string;
1010
+ };
1011
+
985
1012
  // --- custom ---
986
1013
 
987
1014
  // Sub-route declared by a custom screen (Expo Router / URL-routing use).
@@ -998,6 +1025,8 @@ export type CustomScreenDefinition = {
998
1025
  readonly nav?: ScreenNavSugar;
999
1026
  readonly detailFor?: string;
1000
1027
  readonly description?: string;
1028
+ /** Only `expose` is read for screens; `risk` ranks handler tool calls. */
1029
+ readonly agent?: AgentHandlerHints;
1001
1030
  readonly renderer: PlatformComponent;
1002
1031
  readonly routes?: readonly CustomScreenRoute[];
1003
1032
  /** Parent list screen for breadcrumb when this detail is not in nav. */
@@ -1054,6 +1083,7 @@ export type ConfigEditScreenDefinition = {
1054
1083
  readonly nav?: ScreenNavSugar;
1055
1084
  readonly detailFor?: string;
1056
1085
  readonly description?: string;
1086
+ readonly agent?: AgentHandlerHints;
1057
1087
  /** scope für config:write:set Calls. Muss zur Scope-Deklaration der
1058
1088
  * in `configKeys` referenzierten Keys passen — Boot-Validator
1059
1089
  * prüft das gegen die Registry. */
@@ -1097,6 +1127,7 @@ export type SecretsEditScreenDefinition = {
1097
1127
  readonly nav?: ScreenNavSugar;
1098
1128
  readonly detailFor?: string;
1099
1129
  readonly description?: string;
1130
+ readonly agent?: AgentHandlerHints;
1100
1131
  /** field id -> qualified secret name (`<feature>:secret:<kebab>`). */
1101
1132
  readonly secretKeys: Readonly<Record<string, string>>;
1102
1133
  /** field id -> i18n key for the label. */
@@ -1134,10 +1165,10 @@ export type ScreenNavSugar = {
1134
1165
  readonly order?: number;
1135
1166
  };
1136
1167
 
1137
- // `nav`/`detailFor`/`description` live directly on every variant (not only via this
1168
+ // `nav`/`detailFor`/`description`/`agent` live directly on every variant (not only via this
1138
1169
  // union) so a screen typed as its own concrete kind — e.g. `const screen:
1139
1170
  // CustomScreenDefinition = {...}` in a module split out of `feature.ts` —
1140
- // still accepts all three; a union-only intersection drops them the
1171
+ // still accepts all four; a union-only intersection drops them the
1141
1172
  // moment a caller narrows to one member.
1142
1173
  //
1143
1174
  // `detailFor` applies to any screen kind because any kind can be the