@declarion/react 0.1.65 → 0.1.68

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 (98) hide show
  1. package/README.md +32 -0
  2. package/dist-lib/api/agents.d.ts +18 -3
  3. package/dist-lib/api/auth-redirect.d.ts +3 -0
  4. package/dist-lib/api/auth.d.ts +14 -0
  5. package/dist-lib/api/client.d.ts +30 -0
  6. package/dist-lib/api/data.d.ts +12 -0
  7. package/dist-lib/api/events.d.ts +17 -0
  8. package/dist-lib/api/params.d.ts +9 -3
  9. package/dist-lib/components/agents/AgentChatPanel.d.ts +2 -1
  10. package/dist-lib/components/fields/EmailField.d.ts +1 -1
  11. package/dist-lib/components/fields/PhoneField.d.ts +2 -0
  12. package/dist-lib/components/fields/RichTextField.d.ts +2 -0
  13. package/dist-lib/components/fields/UrlField.d.ts +1 -1
  14. package/dist-lib/components/fields/cells/factories/badge.d.ts +2 -0
  15. package/dist-lib/components/fields/cells/factories/boolPill.d.ts +2 -0
  16. package/dist-lib/components/fields/cells/factories/code.d.ts +2 -0
  17. package/dist-lib/components/fields/cells/factories/email.d.ts +2 -0
  18. package/dist-lib/components/fields/cells/factories/host-icons.d.ts +9 -0
  19. package/dist-lib/components/fields/cells/factories/link.d.ts +2 -0
  20. package/dist-lib/components/fields/cells/factories/markdown.d.ts +2 -0
  21. package/dist-lib/components/fields/cells/factories/money.d.ts +2 -0
  22. package/dist-lib/components/fields/cells/factories/multilangInline.d.ts +2 -0
  23. package/dist-lib/components/fields/cells/factories/nextRun.d.ts +2 -0
  24. package/dist-lib/components/fields/cells/factories/number.d.ts +2 -0
  25. package/dist-lib/components/fields/cells/factories/passwordMask.d.ts +2 -0
  26. package/dist-lib/components/fields/cells/factories/phone.d.ts +2 -0
  27. package/dist-lib/components/fields/cells/factories/refLink.d.ts +2 -0
  28. package/dist-lib/components/fields/cells/factories/richTextPreview.d.ts +2 -0
  29. package/dist-lib/components/fields/cells/factories/statusPill.d.ts +2 -0
  30. package/dist-lib/components/fields/cells/factories/tagList.d.ts +2 -0
  31. package/dist-lib/components/fields/cells/factories/text.d.ts +2 -0
  32. package/dist-lib/components/fields/cells/factories/timestamp.d.ts +3 -0
  33. package/dist-lib/components/fields/cells/factories/url-helpers.d.ts +12 -0
  34. package/dist-lib/components/fields/cells/factories/url.d.ts +2 -0
  35. package/dist-lib/components/fields/cells/registry.d.ts +18 -0
  36. package/dist-lib/components/fields/index.d.ts +9 -3
  37. package/dist-lib/components/file-widgets/CircleImage.d.ts +2 -0
  38. package/dist-lib/components/file-widgets/DocumentCard.d.ts +2 -0
  39. package/dist-lib/components/file-widgets/FileList.d.ts +2 -0
  40. package/dist-lib/components/file-widgets/Grid.d.ts +2 -0
  41. package/dist-lib/components/file-widgets/ImageWidget.d.ts +12 -0
  42. package/dist-lib/components/file-widgets/LabeledSlots.d.ts +2 -0
  43. package/dist-lib/components/file-widgets/SquareImage.d.ts +2 -0
  44. package/dist-lib/components/file-widgets/WideBanner.d.ts +2 -0
  45. package/dist-lib/components/file-widgets/builtins.d.ts +1 -0
  46. package/dist-lib/components/file-widgets/cropper.d.ts +14 -0
  47. package/dist-lib/components/file-widgets/draft-scope.d.ts +22 -0
  48. package/dist-lib/components/file-widgets/helpers.d.ts +12 -0
  49. package/dist-lib/components/file-widgets/host.d.ts +23 -0
  50. package/dist-lib/components/file-widgets/index.d.ts +16 -0
  51. package/dist-lib/components/file-widgets/payload.d.ts +21 -0
  52. package/dist-lib/components/file-widgets/registry.d.ts +5 -0
  53. package/dist-lib/components/file-widgets/types.d.ts +15 -0
  54. package/dist-lib/components/file-widgets/upload.d.ts +25 -0
  55. package/dist-lib/components/file-widgets/value.d.ts +4 -0
  56. package/dist-lib/components/layout/ImpersonationBanner.d.ts +11 -0
  57. package/dist-lib/components/layout/ImpersonationFrame.d.ts +11 -0
  58. package/dist-lib/components/layout/ImpersonationStartModal.d.ts +22 -0
  59. package/dist-lib/components/layout/TenantChip.d.ts +9 -1
  60. package/dist-lib/components/list/QuickPeek.d.ts +13 -6
  61. package/dist-lib/components/pages/ExportMenu.d.ts +32 -0
  62. package/dist-lib/components/pages/SmartDetailPage.d.ts +1 -1
  63. package/dist-lib/components/pages/SmartListPage.d.ts +1 -1
  64. package/dist-lib/components/pages/auth/AuthShell.d.ts +17 -2
  65. package/dist-lib/components/pages/auth/Reset.d.ts +1 -0
  66. package/dist-lib/components/pages/exportRequest.d.ts +71 -0
  67. package/dist-lib/components/primitives/BrandGlyph.d.ts +8 -0
  68. package/dist-lib/components/primitives/BrandLogo.d.ts +1 -5
  69. package/dist-lib/components/primitives/Fields.d.ts +3 -3
  70. package/dist-lib/components/primitives/MenuItem.d.ts +2 -1
  71. package/dist-lib/components/primitives/index.d.ts +2 -0
  72. package/dist-lib/components/shared/EmptyState.d.ts +1 -1
  73. package/dist-lib/components/shell/CommandPalette.d.ts +2 -1
  74. package/dist-lib/declarion-glyph.svg +17 -0
  75. package/dist-lib/declarion-react.css +1 -1
  76. package/dist-lib/hooks/useAgentConversation.d.ts +9 -1
  77. package/dist-lib/hooks/useImpersonation.d.ts +23 -0
  78. package/dist-lib/hooks/useParams.d.ts +42 -1
  79. package/dist-lib/hooks/useUserLocale.d.ts +1 -0
  80. package/dist-lib/hooks/useVersionWatcher.d.ts +30 -0
  81. package/dist-lib/index.d.ts +8 -1
  82. package/dist-lib/index.js +9011 -4246
  83. package/dist-lib/index.js.map +1 -1
  84. package/dist-lib/lib/rich-text.d.ts +14 -0
  85. package/dist-lib/lib/safe-url.d.ts +1 -0
  86. package/dist-lib/lib/timestamp.d.ts +17 -0
  87. package/dist-lib/lib/versionTracker.d.ts +66 -0
  88. package/dist-lib/stores/appearance.d.ts +3 -0
  89. package/dist-lib/types/api.d.ts +65 -0
  90. package/dist-lib/types/fieldType.d.ts +2 -0
  91. package/dist-lib/types/files.d.ts +76 -0
  92. package/dist-lib/types/schema.d.ts +64 -0
  93. package/dist-lib/vite/declarion-glyph.svg +17 -0
  94. package/dist-lib/vite/fingerprint-plugin.d.ts +45 -0
  95. package/dist-lib/vite/index.d.ts +21 -0
  96. package/dist-lib/vite/index.js +52 -0
  97. package/dist-lib/vite/index.js.map +1 -0
  98. package/package.json +12 -4
@@ -1,10 +1,16 @@
1
1
  import { type AgentConversation, type AgentMessage } from "../api/agents";
2
2
  export interface AgentTurnState {
3
- streamingText: string;
4
3
  pendingTools: Array<{
5
4
  id: string;
6
5
  name: string;
7
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>;
8
14
  }>;
9
15
  hints: Array<{
10
16
  kind: string;
@@ -22,6 +28,8 @@ export declare function useAgentConversation(initialConversationId?: string): {
22
28
  send: (text: string, context?: Record<string, unknown>) => Promise<void>;
23
29
  approve: (invocationId: string, edits?: Record<string, unknown>) => Promise<void>;
24
30
  reject: (invocationId: string, note?: string) => Promise<void>;
31
+ submitElicit: (toolUseId: string, data: Record<string, unknown>) => Promise<void>;
32
+ cancelElicit: (toolUseId: string) => Promise<void>;
25
33
  cancel: () => Promise<void>;
26
34
  retry: () => Promise<void>;
27
35
  refreshConversations: () => Promise<void>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * useImpersonation centralizes the three lifecycle calls (start, stop,
3
+ * revoke) and re-hydrates auth state on success so the topbar / banner /
4
+ * viewport frame react in lockstep.
5
+ *
6
+ * isImpersonating is derived from auth.me's impersonation field which the
7
+ * server populates only when the request was issued under an active
8
+ * impersonation session. Direct human action and agent flows (without an
9
+ * impersonation channel) leave it null.
10
+ */
11
+ export declare function useImpersonation(): {
12
+ info: import("../types/api").ImpersonationInfo | null;
13
+ isImpersonating: boolean;
14
+ start: import("@tanstack/react-query").UseMutateFunction<import("../api/auth").ImpersonationStartResponse, Error, {
15
+ targetUserId: string;
16
+ reason: string;
17
+ durationMinutes?: number;
18
+ }, unknown>;
19
+ stop: import("@tanstack/react-query").UseMutateFunction<import("..").LoginResponse, Error, void, unknown>;
20
+ revoke: import("@tanstack/react-query").UseMutateFunction<void, Error, string, unknown>;
21
+ isStarting: boolean;
22
+ isStopping: boolean;
23
+ };
@@ -1,2 +1,43 @@
1
+ import type { ParamLookup } from "../types/api";
1
2
  export declare function usePublicParams(): import("@tanstack/react-query").UseQueryResult<import("../types/api").PublicParamsResponse, Error>;
2
- export declare function useResolvedParam(code: string): import("@tanstack/react-query").UseQueryResult<import("../types/api").ResolvedParam, Error>;
3
+ /**
4
+ * Looks up the platform's record for a parameter without a default.
5
+ * Returns the full ParamLookup envelope (`found`, `value`, `source`).
6
+ * Prefer `useParam` for typical reads where the call site has a default.
7
+ */
8
+ export declare function useResolvedParam(code: string): import("@tanstack/react-query").UseQueryResult<ParamLookup, Error>;
9
+ /**
10
+ * Reads a parameter and substitutes a caller-supplied default when the
11
+ * platform has no value for it. The default never crosses the wire; the
12
+ * server only answers "do you have a value for code X?".
13
+ *
14
+ * Behaviour:
15
+ * - Platform has a value -> `value` is the resolved value.
16
+ * - Platform reports no value -> `value` is `defaultValue`. Not an error.
17
+ * - Network / auth failure -> `error` is set; `value` is `defaultValue`
18
+ * so the UI has something to render during a partial outage.
19
+ *
20
+ * Important: this React hook intentionally diverges from the Go-side
21
+ * contract. In Go (`params.Get[T]`), a transport error propagates and
22
+ * the default is NEVER used for broken infrastructure. In React, the
23
+ * hook returns the default AND surfaces the error so a component can
24
+ * still mount during a brownout. Callers whose parameter controls
25
+ * security-sensitive behaviour (a feature gate that hides admin UI,
26
+ * a permission flag, etc.) MUST check `error` and refuse to render
27
+ * the protected branch when set - do not rely on `value` alone.
28
+ *
29
+ * Devs may call useParam with a code that is not yet declared in YAML;
30
+ * the platform reports not-found and the default applies. That is by
31
+ * design: knobs become declarable later as ops asks for tunability.
32
+ *
33
+ * Type T is enforced by the caller. The hook does not coerce - if the
34
+ * stored value's shape is incompatible with T, that is a programming
35
+ * bug at the call site to be fixed.
36
+ */
37
+ export declare function useParam<T>(code: string, defaultValue: T): {
38
+ value: T;
39
+ found: boolean;
40
+ source: ParamLookup["source"] | undefined;
41
+ loading: boolean;
42
+ error: Error | null;
43
+ };
@@ -0,0 +1 @@
1
+ export declare function useUserLocale(): string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * useVersionWatcher — staleness watchdog for the SPA.
3
+ *
4
+ * Wires three layers of detection (in defense-in-depth order):
5
+ *
6
+ * 1. Header-based detection (in apiFetch via versionTracker.observe)
7
+ * — instant, runs on every API response, no extra round-trip.
8
+ *
9
+ * 2. Periodic /api/version probe — caps drift latency at 60s for
10
+ * idle tabs. Fires on:
11
+ * • window focus (debounced to ≥5s)
12
+ * • online reconnect
13
+ * • document.visibilitychange → visible
14
+ * • 60s interval while visible
15
+ * Backs off exponentially on failure (1s → 5min cap) so a 5xx
16
+ * doesn't error-loop.
17
+ *
18
+ * 3. (future) SSE `version-changed` from the realtime role —
19
+ * handled by useSSE; kicks fetchProbe() on receipt.
20
+ *
21
+ * On drift the tracker classifies the delta:
22
+ * • schema-only → silent React Query invalidation of ["schema"]
23
+ * • asset-or-binary → persistent toast: "Reload now" / "Later"
24
+ * • unknown → same as asset/binary (conservative reload)
25
+ *
26
+ * Safe to call exactly once at the App root. Subsequent calls are
27
+ * harmless (subscribe is idempotent through the tracker's drift-
28
+ * debounce flag), but the probes would compound — keep it to one.
29
+ */
30
+ export declare function useVersionWatcher(): void;
@@ -14,7 +14,7 @@ export { useEntityData } from "./hooks/useEntityData";
14
14
  export { useEntityItem } from "./hooks/useEntityItem";
15
15
  export { useCreateEntity, useUpdateEntity, useDeleteEntity } from "./hooks/useMutations";
16
16
  export { useDebounce } from "./hooks/useDebounce";
17
- export { usePublicParams, useResolvedParam } from "./hooks/useParams";
17
+ export { usePublicParams, useResolvedParam, useParam } from "./hooks/useParams";
18
18
  export { useSetStatus } from "./hooks/useObjectStatus";
19
19
  export { useSetProperty, useDeleteProperty } from "./hooks/useProperties";
20
20
  export { useFilters } from "./hooks/useFilters";
@@ -53,6 +53,7 @@ export type { DetailPageProps as ShellDetailPageProps, DetailMode } from "./comp
53
53
  export { SignIn } from "./components/pages/auth/SignIn";
54
54
  export { SignUp } from "./components/pages/auth/SignUp";
55
55
  export { Forgot } from "./components/pages/auth/Forgot";
56
+ export { Reset } from "./components/pages/auth/Reset";
56
57
  export { TwoFA } from "./components/pages/auth/TwoFA";
57
58
  export { AuthShell } from "./components/pages/auth/AuthShell";
58
59
  export type { AuthShellProps } from "./components/pages/auth/AuthShell";
@@ -65,6 +66,8 @@ export { JobsStub } from "./components/pages/jobs/Jobs";
65
66
  export { ChangePasswordDialog } from "./components/shared/ChangePasswordDialog";
66
67
  export type { ChangePasswordDialogProps } from "./components/shared/ChangePasswordDialog";
67
68
  export * from "./components/primitives";
69
+ export { SquareImage, CircleImage, WideBanner, registerFileWidget, getFileWidget, hasFileWidget, uploadFile, discardFile, validateClientSide, formatBytes, UploadError, setImageCropper, getImageCropper, FileDraftScope, useFileDraftScope, useDraftRegistration, } from "./components/file-widgets";
70
+ export type { FileFieldDef, FileFieldDisplay, FileFieldMode, FileWidget, FileWidgetProps, HydratedFile, UploadProgress, UploadedFile, ImageCropper, CropperOptions, CropperResult, FileDraftScopeApi, DraftEntry, } from "./components/file-widgets";
68
71
  export { Rail } from "./components/layout/Rail";
69
72
  export type { RailProps, RailAreaItem } from "./components/layout/Rail";
70
73
  export { Sidebar, buildSections } from "./components/layout/Sidebar";
@@ -75,6 +78,10 @@ export { TenantChip, envTone } from "./components/layout/TenantChip";
75
78
  export type { TenantChipProps } from "./components/layout/TenantChip";
76
79
  export { TabStrip } from "./components/layout/TabStrip";
77
80
  export type { TabStripProps } from "./components/layout/TabStrip";
81
+ export { ImpersonationBanner } from "./components/layout/ImpersonationBanner";
82
+ export { ImpersonationFrame } from "./components/layout/ImpersonationFrame";
83
+ export { ImpersonationStartModal } from "./components/layout/ImpersonationStartModal";
84
+ export { useImpersonation } from "./hooks/useImpersonation";
78
85
  export { CommandPalette } from "./components/shell/CommandPalette";
79
86
  export type { CommandPaletteProps, CommandAction, CommandActionType, } from "./components/shell/CommandPalette";
80
87
  export { AgentChatPanel } from "./components/agents/AgentChatPanel";