@declarion/react 0.44.0 → 0.47.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.
Files changed (40) hide show
  1. package/dist-lib/{DraggableChildrenTable-G4Sw1XAD.js → DraggableChildrenTable-B6KjWkwD.js} +39 -39
  2. package/dist-lib/{DynamicIcon-DeRpAaXm.js → DynamicIcon-Dc2j-rg_.js} +19 -17
  3. package/dist-lib/{Grid-CXn-IK3H.js → Grid-OdquWJNX.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-DX8pFS5A.js → LayoutRenderer-CzAdhjNT.js} +794 -787
  5. package/dist-lib/{MarkdownRenderer-CreI9x2m.js → MarkdownRenderer-C6bhrAIe.js} +10 -10
  6. package/dist-lib/{RefreshControl-DFh0-gCb.js → RefreshControl-F9Ib9asP.js} +179 -179
  7. package/dist-lib/{SmartDetailPage.impl-K6Jj1-9z.js → SmartDetailPage.impl-DdSu3kmW.js} +631 -593
  8. package/dist-lib/{SmartRecordListPage.impl-DQW_uVfL.js → SmartRecordListPage.impl-SkIp0_Rd.js} +220 -209
  9. package/dist-lib/api/agents.d.ts +39 -7
  10. package/dist-lib/components/agents/AgentChatPanel.d.ts +6 -1
  11. package/dist-lib/components/agents/transcript-runs.d.ts +29 -0
  12. package/dist-lib/components/file-widgets/host.d.ts +1 -0
  13. package/dist-lib/components/list/QuickPeek.d.ts +1 -1
  14. package/dist-lib/components/pages/exportRequest.d.ts +3 -3
  15. package/dist-lib/components/pages/list/ListFloatbar.d.ts +4 -2
  16. package/dist-lib/components/pages/list/cardProjection.d.ts +2 -1
  17. package/dist-lib/components/pages/list/filter-meta.d.ts +22 -8
  18. package/dist-lib/components/shared/RowActionsKebab.d.ts +3 -2
  19. package/dist-lib/components/views/ViewSwitcher.d.ts +2 -1
  20. package/dist-lib/hooks/useAgentConversation.d.ts +7 -19
  21. package/dist-lib/hooks/useCursorEntityData.d.ts +3 -2
  22. package/dist-lib/hooks/useFilters.d.ts +1 -0
  23. package/dist-lib/icons.js +1 -1
  24. package/dist-lib/index.d.ts +8 -1
  25. package/dist-lib/index.js +3246 -2984
  26. package/dist-lib/lib/actions.d.ts +1 -1
  27. package/dist-lib/lib/anchor.d.ts +37 -0
  28. package/dist-lib/lib/filter-evaluator.d.ts +16 -0
  29. package/dist-lib/lib/filters.d.ts +10 -4
  30. package/dist-lib/lib/messages.d.ts +1 -0
  31. package/dist-lib/lib/variants.d.ts +7 -0
  32. package/dist-lib/{registry-r4hiflwC.js → registry-C2VD-5MD.js} +1103 -879
  33. package/dist-lib/testing.js +10 -10
  34. package/dist-lib/types/api.d.ts +3 -10
  35. package/dist-lib/types/schema.d.ts +51 -13
  36. package/dist-lib/{useCurrentScreen-CpQjVmrT.js → useCurrentScreen-ow4r-nWa.js} +1130 -1054
  37. package/dist-lib/{useProperties-CULxrNT4.js → useProperties-lEKfzm2X.js} +114 -83
  38. package/dist-lib/{value-fUHxMV4r.js → value-CXohNH6a.js} +1 -1
  39. package/dist-lib/vite/index.js +23 -22
  40. package/package.json +12 -12
@@ -57,13 +57,38 @@ export interface AgentMessage {
57
57
  created_at: string;
58
58
  streaming?: boolean;
59
59
  }
60
- export type AgentInvocationStatus = "proposed" | "pending_approval" | "approved" | "rejected" | "running" | "succeeded" | "failed" | "canceled" | "interrupted";
61
- export interface AgentToolInvocation {
60
+ export type AgentTurnStatus = "queued" | "running" | "waiting" | "completed" | "failed" | "canceled";
61
+ export interface AgentTurn {
62
62
  id: string;
63
63
  conversation_id: string;
64
+ trigger_message_id: string;
65
+ runnable_message_seq: number;
66
+ status: AgentTurnStatus;
67
+ model_step: number;
68
+ reserved_assistant_message_id?: string | null;
69
+ error_code?: string | null;
70
+ error_details?: unknown;
71
+ }
72
+ export type AgentInvocationStatus = "proposed" | "pending_input" | "pending_approval" | "approved" | "rejected" | "running" | "succeeded" | "failed" | "canceled" | "interrupted" | "outcome_unknown";
73
+ export type AgentInvocationKind = "action" | "input_request" | "tool";
74
+ export interface AgentToolInvocation {
75
+ id: string;
76
+ conversation_id: string | null;
64
77
  message_id: string | null;
78
+ kind: AgentInvocationKind;
79
+ turn_id: string | null;
80
+ assistant_message_id: string | null;
81
+ response_message_id: string | null;
82
+ provider_call_id: string | null;
83
+ call_ordinal: number | null;
84
+ server_code: string;
65
85
  tool_code: string;
66
86
  params: Record<string, unknown>;
87
+ question?: {
88
+ key?: string;
89
+ message?: string;
90
+ schema?: Record<string, unknown>;
91
+ };
67
92
  status: AgentInvocationStatus;
68
93
  approval?: {
69
94
  decided_by?: string;
@@ -71,6 +96,7 @@ export interface AgentToolInvocation {
71
96
  reason?: string;
72
97
  edits?: Record<string, unknown>;
73
98
  };
99
+ confirmation_mode?: "never" | "once_per_conversation" | "always";
74
100
  result?: unknown;
75
101
  audit_operation_id?: string;
76
102
  reason?: string;
@@ -101,12 +127,18 @@ export declare function createConversation(input: {
101
127
  agent_id?: string;
102
128
  context?: Record<string, unknown>;
103
129
  }): Promise<AgentConversation>;
104
- export declare function sendMessage(text: string, conversationId: string, _seq?: number): Promise<AgentMessage>;
105
- export declare function sendElicitResponse(conversationId: string, _seq: number | undefined, toolUseId: string, data: Record<string, unknown>): Promise<AgentMessage>;
106
- export declare function approveInvocation(id: string, edits?: Record<string, unknown>): Promise<void>;
130
+ export declare function sendMessage(text: string, conversationId: string): Promise<AgentMessage>;
131
+ export declare function answerQuestion(invocationId: string, answer: Record<string, unknown>): Promise<void>;
132
+ export declare function sendElicitResponse(_conversationId: string, invocationId: string, data: Record<string, unknown>): Promise<void>;
133
+ /** What a person permitted: this call alone, or the action for the rest of
134
+ * the conversation. Absent means this call alone - the safe reading, and
135
+ * what every row written before the choice existed means. */
136
+ export type ApprovalScope = "call" | "conversation";
137
+ export declare function approveInvocation(id: string, scope?: ApprovalScope): Promise<void>;
107
138
  export declare function rejectInvocation(id: string, note?: string): Promise<void>;
139
+ export declare function cancelInvocation(id: string): Promise<void>;
108
140
  export declare function cancelConversation(id: string): Promise<void>;
109
141
  export declare function listConversations(): Promise<AgentConversation[]>;
110
- export declare function rerunMessageTurn(conversationId: string): Promise<void>;
111
- export declare function listPendingInvocations(conversationId: string): Promise<AgentToolInvocation[]>;
142
+ export declare function loadConversationTurns(conversationId: string): Promise<AgentTurn[]>;
143
+ export declare function loadConversationInvocations(conversationId: string): Promise<AgentToolInvocation[]>;
112
144
  export declare function loadHistory(conversationId: string): Promise<AgentMessage[]>;
@@ -3,5 +3,10 @@ export interface AgentChatPanelProps {
3
3
  onClose: () => void;
4
4
  context?: string;
5
5
  title?: string;
6
+ /** A question typed somewhere else - the command palette - to send once
7
+ * the panel opens. The palette promises "Press Enter to ask"; without
8
+ * this it opened the panel and threw the question away. */
9
+ askOnOpen?: string;
6
10
  }
7
- export declare function AgentChatPanel({ open, onClose, context, title }: AgentChatPanelProps): import("react").JSX.Element | null;
11
+ export declare function AgentChatPanel({ open, onClose, context, title, askOnOpen }: AgentChatPanelProps): import("react").JSX.Element | null;
12
+ export declare function proposalFallback(code: string): string;
@@ -0,0 +1,29 @@
1
+ import type { AgentMessage, AgentToolInvocation } from "../../api/agents";
2
+ export type TranscriptItem = {
3
+ kind: "message";
4
+ message: AgentMessage;
5
+ } | {
6
+ kind: "run";
7
+ id: string;
8
+ calls: TranscriptCall[];
9
+ };
10
+ /** One call, with its result folded in when it has arrived. */
11
+ export type TranscriptCall = {
12
+ /** The durable invocation id, when this call was persisted by the harness. */
13
+ id: string;
14
+ name: string;
15
+ input: unknown;
16
+ /** Absent until the platform answers. Absence means still running. */
17
+ output?: unknown;
18
+ isError?: boolean;
19
+ messageId: string;
20
+ status?: AgentToolInvocation["status"];
21
+ };
22
+ /**
23
+ * fold turns a message list into what the transcript renders.
24
+ *
25
+ * Calls come from transcript blocks, while their state and result come from
26
+ * the exact durable invocation row. A run keeps the id of its FIRST message
27
+ * so expansion state survives later calls joining it.
28
+ */
29
+ export declare function fold(messages: AgentMessage[], invocations?: AgentToolInvocation[]): TranscriptItem[];
@@ -22,4 +22,5 @@ export declare function renderSchemaField(props: {
22
22
  locale: string;
23
23
  fieldId?: string;
24
24
  labelId?: string;
25
+ structure?: string;
25
26
  }): ReactNode;
@@ -17,7 +17,7 @@ export interface QuickPeekFileFieldSpec {
17
17
  }
18
18
  export type QuickPeekFieldSpec = QuickPeekRegularFieldSpec | QuickPeekFileFieldSpec;
19
19
  export interface QuickPeekProps<R extends Record<string, unknown> = Record<string, unknown>> {
20
- entity: Pick<Entity, "fields" | "files">;
20
+ entity: Pick<Entity, "fields" | "files" | "variants">;
21
21
  entityCode?: string;
22
22
  record: R;
23
23
  title: string;
@@ -1,9 +1,9 @@
1
- import type { FilterNodeParam } from "../../types/api";
1
+ import type { FilterNode } from "../../lib/filters";
2
2
  /** ExportQuery mirrors the Go ExportQuery struct (server/handlers/data_export.go).
3
3
  * Field order matches; semantics match parseListParams 1:1. */
4
4
  export interface ExportQuery {
5
5
  screen?: string;
6
- filters?: FilterNodeParam[];
6
+ filters?: FilterNode[];
7
7
  search?: string;
8
8
  sort?: string;
9
9
  include_deleted?: boolean;
@@ -34,7 +34,7 @@ export interface ListViewState {
34
34
  /** Active screen code, when the list is rendered through a screen. */
35
35
  screenCode?: string;
36
36
  /** JSON filter tree (the same shape sent in the `filters` URL param). */
37
- jsonFilters?: FilterNodeParam[];
37
+ jsonFilters?: FilterNode[];
38
38
  /** Debounced search value from the toolbar. */
39
39
  search?: string;
40
40
  /** "field:asc" / "field:desc" sort spec. */
@@ -1,6 +1,6 @@
1
1
  import { type ResolvedActionLayoutNode } from "../../../lib/actions";
2
2
  import { type WidgetContext } from "../../../components/shared/ResponsiveActionBar";
3
- import type { Action } from "../../../types/schema";
3
+ import type { Action, Entity, Screen } from "../../../types/schema";
4
4
  export interface ListFloatbarProps {
5
5
  selectedIds: string[];
6
6
  /** Actions whose visibility includes `list_floatbar` - the floatbar slot.
@@ -19,9 +19,11 @@ export interface ListFloatbarProps {
19
19
  data: Record<string, unknown>[];
20
20
  rowKey: (row: Record<string, unknown>) => string;
21
21
  entityCode?: string;
22
+ entity?: Entity;
23
+ screen?: Screen;
22
24
  onClear: () => void;
23
25
  onActionSuccess: () => void;
24
26
  /** Dispatch surface threaded into ResponsiveActionBar (plan §8 Task 10). */
25
27
  widgetContext: WidgetContext;
26
28
  }
27
- export declare function ListFloatbar({ selectedIds, floatbarActions, screenActionLayout, entityActionLayout, data, rowKey, entityCode, onClear, onActionSuccess, widgetContext, }: ListFloatbarProps): import("react").JSX.Element | null;
29
+ export declare function ListFloatbar({ selectedIds, floatbarActions, screenActionLayout, entityActionLayout, data, rowKey, entityCode, entity, screen, onClear, onActionSuccess, widgetContext, }: ListFloatbarProps): import("react").JSX.Element | null;
@@ -28,7 +28,7 @@ export interface ResolveCardArgs {
28
28
  screen: Screen | undefined;
29
29
  savedViewColumns?: readonly string[];
30
30
  }
31
- export type ProjectionReason = "render" | "display" | "display_template" | "condition" | "identity" | "sort" | "detail_handoff" | "quick_peek" | "ref_expand" | "status_expand" | "property_expand" | "evidence_expand" | "file_metadata";
31
+ export type ProjectionReason = "render" | "display" | "display_template" | "condition" | "variant" | "identity" | "sort" | "detail_handoff" | "quick_peek" | "ref_expand" | "status_expand" | "property_expand" | "evidence_expand" | "file_metadata";
32
32
  export interface ProjectionReasons {
33
33
  fields: Record<string, ProjectionReason[]>;
34
34
  expand: Record<string, ProjectionReason[]>;
@@ -62,5 +62,6 @@ export interface ResolveListProjectionArgs {
62
62
  }
63
63
  export declare function resolveCard(args: ResolveCardArgs): ResolvedCard;
64
64
  export declare function resolveListProjection(args: ResolveListProjectionArgs): ResolvedListProjection;
65
+ export declare function resolveVariantRenderFields(entity: Entity | undefined, screen: Screen | undefined, savedViewColumns?: readonly string[]): string[];
65
66
  export declare function resolveQuickPeekFieldNames(entity: Entity | undefined, screen: Screen | undefined, screens: Schema["screens"] | undefined): string[];
66
67
  export declare function extractDisplayTemplateFields(template: string | undefined): string[];
@@ -1,10 +1,24 @@
1
- import type { Entity, ScreenFilterSpecialValues } from "../../../types/schema";
1
+ import type { Entity, Screen, ScreenFilterSpecialValues } from "../../../types/schema";
2
2
  import type { FilterFieldMeta } from "../../../components/filters/FilterDrawer";
3
- import type { FilterOp } from "../../../lib/filters";
4
- /** Build FilterFieldMeta array from screen + entity for the FilterDrawer. */
5
- export declare function buildFilterFieldMeta(screen: {
6
- filters?: string[];
3
+ /**
4
+ * Build FilterFieldMeta array from screen + entity for the FilterDrawer.
5
+ *
6
+ * The per-type operator lists come from the server (`screen.filter_operators`),
7
+ * never from a table here. The client used to keep its own map and it had
8
+ * already diverged: array, multilang, json and bytes fields fell through to
9
+ * `["eq","not_eq","is_empty","is_not_empty"]`, offering two operators the query
10
+ * builder rejects and hiding `contains`, the one that works. The server owns
11
+ * the field-type -> operator mapping because the server is what enforces it.
12
+ *
13
+ * A field the server published no operators for is OMITTED rather than given a
14
+ * guessed list: an operator the builder rejects is worse than an absent field,
15
+ * because the user only finds out after building the filter.
16
+ *
17
+ * Which fields appear at all is SCREEN-SCOPED - `screen.filters` when declared,
18
+ * every entity field otherwise. That is a UI affordance, not an access control:
19
+ * the server applies no screen scoping to caller filters.
20
+ */
21
+ export declare function buildFilterFieldMeta(screen: (Pick<Screen, "filters"> & {
7
22
  filter_special_values?: Record<string, ScreenFilterSpecialValues>;
8
- } | undefined, entity: Pick<Entity, "fields" | "status_groups" | "properties"> | undefined, entities?: Record<string, Entity>): FilterFieldMeta[];
9
- /** Map field type to available filter operators. */
10
- export declare function fieldTypeToOperators(type: string): FilterOp[];
23
+ filter_operators?: Record<string, string[]>;
24
+ }) | undefined, entity: Pick<Entity, "fields" | "status_groups" | "properties"> | undefined, entities?: Record<string, Entity>): FilterFieldMeta[];
@@ -1,4 +1,4 @@
1
- import { type Action } from "../../types/schema";
1
+ import { type Action, type Entity } from "../../types/schema";
2
2
  interface RowActionsKebabProps {
3
3
  actions: Array<{
4
4
  code: string;
@@ -6,6 +6,7 @@ interface RowActionsKebabProps {
6
6
  }>;
7
7
  objectIds: string[];
8
8
  row?: Record<string, unknown>;
9
+ entity?: Entity;
9
10
  onSuccess?: () => void;
10
11
  /** Pre-menu slot for host-specific items (Edit, Delete, etc). */
11
12
  preMenu?: React.ReactNode;
@@ -15,5 +16,5 @@ interface RowActionsKebabProps {
15
16
  size?: number;
16
17
  align?: "start" | "end";
17
18
  }
18
- export declare function RowActionsKebab({ actions, objectIds, row, onSuccess, preMenu, divider, size, align, }: RowActionsKebabProps): import("react").JSX.Element | null;
19
+ export declare function RowActionsKebab({ actions, objectIds, row, entity, onSuccess, preMenu, divider, size, align, }: RowActionsKebabProps): import("react").JSX.Element | null;
19
20
  export {};
@@ -1,10 +1,11 @@
1
+ import type { FilterNode } from "../../lib/filters";
1
2
  export interface ViewItem {
2
3
  id: string;
3
4
  name: Record<string, string>;
4
5
  icon?: string;
5
6
  source: "system" | "personal" | "shared";
6
7
  is_default?: boolean;
7
- filters?: unknown[];
8
+ filters?: FilterNode[];
8
9
  columns?: string[];
9
10
  sort?: string;
10
11
  }
@@ -1,37 +1,25 @@
1
- import { type AgentConversation, type AgentMessage } from "../api/agents";
1
+ import { type ApprovalScope, type AgentConversation, type AgentMessage, type AgentToolInvocation, type AgentTurn } from "../api/agents";
2
2
  export interface AgentTurnState {
3
- pendingTools: Array<{
4
- id: string;
5
- name: string;
6
- params: Record<string, unknown>;
7
- reason?: string;
8
- confidence?: number;
9
- }>;
10
- elicits: Array<{
11
- id: string;
12
- message: string;
13
- schema: Record<string, unknown>;
14
- }>;
3
+ streaming: boolean;
15
4
  hints: Array<{
16
5
  kind: string;
17
6
  target?: unknown;
18
7
  ttlMs?: number;
19
8
  }>;
20
- streaming: boolean;
21
- error?: string;
22
9
  }
23
10
  export declare function useAgentConversation(initialConversationId?: string): {
24
11
  conversationId: string | undefined;
25
12
  messages: AgentMessage[];
26
13
  turn: AgentTurnState;
14
+ turns: AgentTurn[];
15
+ invocations: AgentToolInvocation[];
27
16
  conversations: AgentConversation[];
28
17
  send: (text: string, context?: Record<string, unknown>) => Promise<void>;
29
- approve: (invocationId: string, edits?: Record<string, unknown>) => Promise<void>;
18
+ approve: (invocationId: string, scope?: ApprovalScope) => Promise<void>;
30
19
  reject: (invocationId: string, note?: string) => Promise<void>;
31
- submitElicit: (toolUseId: string, data: Record<string, unknown>) => Promise<void>;
32
- cancelElicit: (toolUseId: string) => Promise<void>;
20
+ submitInput: (invocationId: string, data: Record<string, unknown>) => Promise<void>;
21
+ cancelInput: (invocationId: string) => Promise<void>;
33
22
  cancel: () => Promise<void>;
34
- retry: () => Promise<void>;
35
23
  refreshConversations: () => Promise<void>;
36
24
  startNew: () => void;
37
25
  setConversationId: (id: string | undefined) => void;
@@ -1,5 +1,6 @@
1
1
  import { type QueryKey } from "@tanstack/react-query";
2
- import type { FilterNodeParam, Refs, V2Meta } from "../types/api";
2
+ import type { Refs, V2Meta } from "../types/api";
3
+ import type { FilterNode } from "../lib/filters";
3
4
  /**
4
5
  * Query-key root for the cursor (infinite) entity list. Distinct from the
5
6
  * offset list's `"entity-data"` so the SSE handler can RESET it (drop pages,
@@ -22,7 +23,7 @@ export declare function cursorEntityStableKey(params: CursorEntityDataParams): s
22
23
  export declare function cursorEntityDataQueryKey(entity: string | undefined, params: CursorEntityDataParams): QueryKey;
23
24
  export interface CursorEntityDataParams {
24
25
  sort?: string;
25
- filters?: FilterNodeParam[];
26
+ filters?: FilterNode[];
26
27
  search?: string;
27
28
  select?: string[];
28
29
  expand?: string[];
@@ -5,6 +5,7 @@ import { type FilterNode } from "../lib/filters";
5
5
  */
6
6
  export declare function useFilters(): {
7
7
  filters: FilterNode[];
8
+ filterError: string | null;
8
9
  activeCount: number;
9
10
  setFilters: (newFilters: FilterNode[]) => void;
10
11
  clearFilters: () => void;
package/dist-lib/icons.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./DynamicIcon-DeRpAaXm.js";
1
+ import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./DynamicIcon-Dc2j-rg_.js";
2
2
  export { o as DynamicIcon, a as Icon, n as LucideIcon, i as getIcon, t as getIconRegistryVersion, e as setIconRegistry, r as subscribeIconRegistry };
@@ -43,6 +43,7 @@ export type { CustomScreenProps } from "./stores/screen-registry";
43
43
  export { setIconRegistry, getIcon } from "./stores/icon-registry";
44
44
  export type { IconDef } from "./stores/icon-registry";
45
45
  export { registerLayoutWidget, getLayoutWidget, hasLayoutWidget, type LayoutWidget, type LayoutWidgetProps, } from "./components/detail-layout/widgets/registry";
46
+ export { useUserLocale } from "./hooks/useUserLocale";
46
47
  export { useTabStore, type TabItem, type ReturnTarget } from "./stores/tabs";
47
48
  export { useTabNavigate } from "./hooks/useTabNavigate";
48
49
  export { useScreenBack } from "./hooks/useScreenBack";
@@ -129,7 +130,13 @@ export * from "./api/agents";
129
130
  export { Breadcrumbs } from "./components/shared/Breadcrumbs";
130
131
  export type { BreadcrumbsProps, Crumb } from "./components/shared/Breadcrumbs";
131
132
  export type { FilterNode, FilterOp } from "./lib/filters";
132
- export { parseFiltersFromURL, setFiltersInURL, hasOrGroups, countActiveFilters, OP_LABELS, NO_VALUE_OPS, } from "./lib/filters";
133
+ export type { FilterURLState } from "./lib/filters";
134
+ export type { FilterRecord, FilterRecordField, FilterRecordFields } from "./lib/filter-evaluator";
135
+ export { parseFiltersFromURL, parseFilterURLState, setFiltersInURL, hasOrGroups, countActiveFilters, OP_LABELS, NO_VALUE_OPS, } from "./lib/filters";
136
+ export { evaluateFilterTree } from "./lib/filter-evaluator";
137
+ export { resolveEntityVariantCode } from "./lib/variants";
138
+ export { variantActionCodesForRecord, commonVariantActionCodes } from "./lib/variants";
139
+ export { resolveScreenVariantCode, effectiveScreenForRecord } from "./lib/variants";
133
140
  export { formatCount, formatExactCount, formatEstimatedCount } from "./lib/format-count";
134
141
  export type { MassEditTarget, MassEditTargetKind } from "./lib/mass-edit";
135
142
  export { buildMassEditTargets, parseTargetFilter } from "./lib/mass-edit";