react-semaphor 0.1.551 → 0.1.553

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 (73) hide show
  1. package/dist/analytics-protocol/index.js +8 -8
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +64 -57
  4. package/dist/brand-studio/index.js +3 -3
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{assistant-chat-B8kslmny.js → assistant-chat-DaIdRbbd.js} +3152 -2817
  7. package/dist/chunks/{bookmark-state-Cu-a5ie_.js → bookmark-state-aGO7_ryE.js} +3 -3
  8. package/dist/chunks/{comparison-window-caption-C2xF-eWw.js → comparison-window-caption-BugAu7zS.js} +7 -7
  9. package/dist/chunks/{custom-visual-inputs-CwAcigQS.js → custom-visual-inputs-D7ez5sab.js} +1 -1
  10. package/dist/chunks/{dashboard-briefing-launcher-DnnvLeAs.js → dashboard-briefing-launcher-DBJ0xrfF.js} +62 -62
  11. package/dist/chunks/{dashboard-controls-BYDt0QZL.js → dashboard-controls-CDX74NTl.js} +46 -46
  12. package/dist/chunks/{dashboard-json-BligXqcU.js → dashboard-json-Cf5dpYTr.js} +4 -4
  13. package/dist/chunks/{dashboard-BcAQSgm-.js → dashboard-z3GYw7xR.js} +1 -1
  14. package/dist/chunks/{document-dashboard-inputs-DPQ_wUGD.js → document-dashboard-inputs-LMMWPOwU.js} +119 -119
  15. package/dist/chunks/{edit-dashboard-visual-8-Fd4EcE.js → edit-dashboard-visual-hCGiyxgm.js} +18 -18
  16. package/dist/chunks/{filter-reach-copy-8vnDYToV.js → filter-reach-copy-BG5qVZKS.js} +48 -48
  17. package/dist/chunks/{filter-value-text-Ddf55Ku1.js → filter-value-text-DwP5dN9m.js} +2 -2
  18. package/dist/chunks/{global-date-filter-utils-CnumW4j2.js → global-date-filter-utils-Ce6Ydv2W.js} +5934 -5723
  19. package/dist/chunks/{index-DzsdV1o4.js → index-C_UIqop8.js} +9 -9
  20. package/dist/chunks/{matrix-analytical-definition-B9vW-osb.js → matrix-analytical-definition-cvzKdxPE.js} +2 -2
  21. package/dist/chunks/{matrix-card-LiMEipvq.js → matrix-card-VFE-yDlr.js} +2 -2
  22. package/dist/chunks/{matrix-formatter-DWEeC0_c.js → matrix-formatter-B27bz08Y.js} +3 -3
  23. package/dist/chunks/{matrix-member-presentation-DqzG-UhQ.js → matrix-member-presentation-DyC-e9pD.js} +1 -1
  24. package/dist/chunks/{matrix-operation-contract-D6vYkZK4.js → matrix-operation-contract-L_SiObB7.js} +1 -1
  25. package/dist/chunks/{metric-comparison-zpGw4lD6.js → metric-comparison-B5gyyW9k.js} +1 -1
  26. package/dist/chunks/model-change-B0rAK-5w.js +230 -0
  27. package/dist/chunks/{pivot-header-presentation-CQnIDtUv.js → pivot-header-presentation-BQFfowp1.js} +1 -1
  28. package/dist/chunks/{pivot-result-identity-C-Q1j1Wb.js → pivot-result-identity-dZIYsMrY.js} +1 -1
  29. package/dist/chunks/{pivot-result-lifecycle-pwq3b7LC.js → pivot-result-lifecycle-D0kSz5QX.js} +6 -6
  30. package/dist/chunks/{raw-temporal-presentation-CBKeEPYA.js → raw-temporal-presentation-BWRH754b.js} +6 -6
  31. package/dist/chunks/{report-preferences-dialog-DAQEooIW.js → report-preferences-dialog-DvabpYcC.js} +49 -49
  32. package/dist/chunks/{report-runtime-context-hWiTCzFV.js → report-runtime-context-CKiIubIu.js} +1 -1
  33. package/dist/chunks/{resolve-dashboard-input-context-DVWF7p5C.js → resolve-dashboard-input-context-Ctq1YCDV.js} +2049 -1975
  34. package/dist/chunks/{saved-dashboard-context-BMqMzNAo.js → saved-dashboard-context-Bt1E9d1l.js} +8 -8
  35. package/dist/chunks/{selection-reducer-CJzkTZio.js → selection-reducer-DdPwKDDQ.js} +1 -1
  36. package/dist/chunks/{semaphor-ready-indicator-Dq1ElALH.js → semaphor-ready-indicator-Cc1TG_gw.js} +10388 -10390
  37. package/dist/chunks/{shelf-drop-preview-context-CHm8lqfo.js → shelf-drop-preview-context-Ch9XqytU.js} +119 -119
  38. package/dist/chunks/{source-entity-resolution-D195CrYS.js → source-entity-resolution-DkW3Iek5.js} +1 -1
  39. package/dist/chunks/{switch-wJP6O7ZT.js → switch-gm7RW-PW.js} +2 -2
  40. package/dist/chunks/{table-export-sheet-4X9mAG3V.js → table-export-sheet-C7bDdC8r.js} +1 -1
  41. package/dist/chunks/{table-settings-WysCBj62.js → table-settings-CBm7G0yx.js} +224 -201
  42. package/dist/chunks/{temporal-bucket-CQOSbv9-.js → temporal-bucket-BikY3FFR.js} +1 -1
  43. package/dist/chunks/{token-types-BMqRmT-C.js → token-types-B1p9F_wS.js} +1 -1
  44. package/dist/chunks/{use-create-flow-overlay-state-b_fGSj_5.js → use-create-flow-overlay-state-CZdDRUpc.js} +6 -6
  45. package/dist/chunks/{validators-C-aOQlTB.js → validators-BdBzm_EV.js} +17 -16
  46. package/dist/dashboard/index.js +2 -2
  47. package/dist/dashboard-authoring/index.js +273 -264
  48. package/dist/data-app-sdk/index.js +5 -5
  49. package/dist/data-app-sdk-adapters/index.js +2 -2
  50. package/dist/data-app-sdk-validation/index.js +5 -5
  51. package/dist/format-utils/index.js +15 -15
  52. package/dist/index.js +21 -21
  53. package/dist/report-runtime-context/index.js +1 -1
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/index.js +6 -6
  57. package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +3 -0
  58. package/dist/types/lib/utils/card-config-utils.d.ts +61 -0
  59. package/dist/types/lib/utils/card-type-change.d.ts +5 -1
  60. package/dist/types/shared/analytics-protocol/explorer-input-schemas.d.ts +2 -0
  61. package/dist/types/shared/assistant-protocol/answer-text.d.ts +23 -0
  62. package/dist/types/shared/assistant-protocol/conversation-text.d.ts +29 -0
  63. package/dist/types/shared/assistant-protocol/conversation.d.ts +24 -3
  64. package/dist/types/shared/assistant-protocol/index.d.ts +2 -0
  65. package/dist/types/shared/assistant-protocol/model-change.d.ts +19 -0
  66. package/dist/types/shared/assistant-protocol/parts.d.ts +45 -1
  67. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +8 -3
  68. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +7 -1
  69. package/dist/types/shared/dashboard-authoring/document-section-cards.d.ts +6 -0
  70. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  71. package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +64 -0
  72. package/package.json +2 -2
  73. package/dist/chunks/add-to-dashboard-BQRAAnc3.js +0 -102
@@ -1,5 +1,5 @@
1
- import { a, R as s, D as o } from "../chunks/report-preferences-dialog-DAQEooIW.js";
2
- import { C as f, E as D } from "../chunks/table-settings-WysCBj62.js";
1
+ import { a, R as s, D as o } from "../chunks/report-preferences-dialog-DvabpYcC.js";
2
+ import { C as f, E as D } from "../chunks/table-settings-CBm7G0yx.js";
3
3
  export {
4
4
  f as CONTROL_CARD_DEFAULT_VALUE,
5
5
  a as DisplayFormatPreferencesFields,
@@ -1,9 +1,9 @@
1
- import { C as s, E as r, V as l, i as o, c as i, g as n, f as d, b as m, e as u, d as E, a as c, u as p, s as C, h as T, j as D, q as A, o as I, m as _, n as F, p as S, k as b, l as L, r as f, t as N } from "../chunks/table-settings-WysCBj62.js";
2
- import { C as y, D as M, L as g, P as h, e as x, g as O, j as V, h as k, k as w, d as U, b as B, i as K, c as z, n as v, f as P } from "../chunks/validators-C-aOQlTB.js";
3
- import { D as q } from "../chunks/token-types-BMqRmT-C.js";
4
- import { B as Q, a as j, p as W, r as J } from "../chunks/bookmark-state-Cu-a5ie_.js";
5
- import { r as H, a as Z } from "../chunks/pivot-result-identity-C-Q1j1Wb.js";
6
- import { D as ee } from "../chunks/report-runtime-context-hWiTCzFV.js";
1
+ import { C as s, E as r, V as l, i as o, c as i, g as n, f as d, b as m, e as u, d as E, a as c, u as p, s as C, h as T, j as D, q as A, o as I, m as _, n as F, p as S, k as b, l as L, r as f, t as N } from "../chunks/table-settings-CBm7G0yx.js";
2
+ import { C as y, D as M, L as g, P as h, e as x, g as O, j as V, h as k, k as w, d as U, b as B, i as K, c as z, n as v, f as P } from "../chunks/validators-BdBzm_EV.js";
3
+ import { D as q } from "../chunks/token-types-B1p9F_wS.js";
4
+ import { B as Q, a as j, p as W, r as J } from "../chunks/bookmark-state-aGO7_ryE.js";
5
+ import { r as H, a as Z } from "../chunks/pivot-result-identity-dZIYsMrY.js";
6
+ import { D as ee } from "../chunks/report-runtime-context-CKiIubIu.js";
7
7
  const e = [
8
8
  "concatenate",
9
9
  "conditional-category",
@@ -11,5 +11,8 @@ import { TDashboard } from '../types/common-types.js';
11
11
  * and the server's saved-dashboard reader, so they all hold the same shape.
12
12
  * The same object when nothing changes. Alias-based text is bound to stable
13
13
  * input ids before the upgrade (`upgradeToStoredDashboard`, ledger P5-11).
14
+ * Last, every Pivot and Hierarchical card the converter can carry exactly
15
+ * loads as a Matrix card (pivot-aggregate-to-matrix PM-D1, PM-D3): in memory
16
+ * only, stored as Matrix when someone saves.
14
17
  */
15
18
  export declare function prepareLoadedDashboard<TDashboardShape extends TDashboard>(dashboard: TDashboardShape): TDashboardShape;
@@ -0,0 +1,61 @@
1
+ import { CardConfig, DataSource, Field, FilterGroup, JoinPlan } from '../types/explorer-types.js';
2
+ import { TCard } from '../types/common-types.js';
3
+ /** Matrix acquisition requires its structured definition, never an authored SQL query. */
4
+ export declare function supportsSqlEditor(cardType: TCard['type']): boolean;
5
+ export declare function hasEditorResultsView(cardType: TCard['type']): boolean;
6
+ export declare function hasEditorInfoView(cardType: TCard['type']): boolean;
7
+ /** The deprecated table types every saved card of which loads as Matrix (pivot-aggregate-to-matrix). */
8
+ export declare const LEGACY_TABLE_CARD_TYPES: readonly ["pivotTable", "aggregateTable"];
9
+ export type LegacyTableCardType = (typeof LEGACY_TABLE_CARD_TYPES)[number];
10
+ export declare function isLegacyTableCard(card: Pick<TCard, 'type'>): card is Pick<TCard, 'type'> & {
11
+ type: LegacyTableCardType;
12
+ };
13
+ /**
14
+ * Why one data part did not carry exactly (pivot-aggregate-to-matrix PM-D12).
15
+ * The problem-area codes (PA-n) are the shapes a later rule will translate;
16
+ * display differences are never gaps (PM-D15).
17
+ */
18
+ export type CardTypeChangeGapCode = 'calculated_metric_per_row' | 'calculated_metric_without_stage' | 'calculated_field_card_scope' | 'calculated_field_dashboard_scope' | 'source_field_renamed' | 'join_not_carried' | 'metric_parameters' | 'aggregate_not_supported' | 'unknown_field_property' | 'calculated_level_without_inputs' | 'field_not_resolvable' | 'filter_not_accepted' | 'control_binding' | 'no_shelf_fields' | 'matrix_definition_incomplete' | 'detail_columns' | 'matrix_field_not_on_shelves' | 'not_in_detail_table';
19
+ export type CardTypeChangeGap = {
20
+ code: CardTypeChangeGapCode;
21
+ label: string;
22
+ };
23
+ export type MatrixRepresentationChange = {
24
+ card: Partial<TCard>;
25
+ /** Authored data parts the next representation does not accept, in shelf order. */
26
+ gaps: readonly CardTypeChangeGap[];
27
+ };
28
+ /**
29
+ * Crossing the Matrix boundary carries the card's authored definition (MS-D12):
30
+ * rows, pivot columns, metrics, the join and filters are read once through
31
+ * `getCardDefinition` and written into the next representation by each part's
32
+ * own writer. A data part the next representation refuses is a gap. Into
33
+ * Matrix, number formats carry, and from a Pivot or Hierarchical card the
34
+ * expansion and the visible totals too (PM-D5); every other display setting
35
+ * takes the Matrix defaults. SQL, Python and control bindings start fresh.
36
+ * Needs the loaded column catalog to complete join keys and resolve Matrix
37
+ * fields; without it, keys saved with their identity still carry.
38
+ */
39
+ export declare function convertMatrixRepresentation(card: TCard, nextType: TCard['type'], catalog?: readonly Field[],
40
+ /** Mints each carried Matrix field's instance id; a replayed conversion passes stored ids (DE-D54). */
41
+ createId?: () => string): MatrixRepresentationChange;
42
+ /** The switch reads the catalog only when it has something to carry. */
43
+ export declare function matrixSwitchNeedsCatalog(card: TCard, nextType: TCard['type']): boolean;
44
+ /** Replacing the base dataset starts a new definition; metadata refresh does not. */
45
+ export declare function withAuthoredCardDataSource(card: TCard, dataSource: DataSource): Partial<TCard>;
46
+ export declare function getAuthoredCardJoinPlan(card: Pick<TCard, 'type' | 'config'>): JoinPlan | undefined;
47
+ /** The normal join editor writes the canonical definition, including empty drafts. */
48
+ export declare function withAuthoredCardJoinPlan(card: Pick<TCard, 'type' | 'config' | 'dataSource'>, joinPlan: JoinPlan | undefined): CardConfig;
49
+ /** Authored predicates from the card's canonical representation. */
50
+ export declare function getAuthoredCardFilters(card: Pick<TCard, 'type' | 'config'> | undefined): FilterGroup | undefined;
51
+ export declare function withAuthoredCardFilters(card: Pick<TCard, 'type' | 'config' | 'dataSource'>, filters: FilterGroup | undefined): CardConfig;
52
+ /**
53
+ * Checks if a card config object has actual configuration data
54
+ * An empty config object {} should be treated as no config
55
+ */
56
+ export declare function hasValidCardConfig(config: CardConfig | undefined, cardType?: TCard['type']): boolean;
57
+ type CardSetupCheckOptions = {
58
+ skipSetupCheck?: boolean;
59
+ };
60
+ export declare function isCardUnconfigured(card: Pick<TCard, 'type' | 'sql' | 'config' | 'connectionId' | 'dataSource' | 'customCardPreferences'>, options?: CardSetupCheckOptions): boolean;
61
+ export {};
@@ -1,5 +1,7 @@
1
1
  import { TCard, TCardPreferences, TCustomCardPreferences } from '../types/common-types.js';
2
2
  import { Field } from '../types/explorer-types.js';
3
+ import { CardTypeChangeGap } from './card-config-utils.js';
4
+ export type { CardTypeChangeGap, CardTypeChangeGapCode } from './card-config-utils.js';
3
5
  export declare function sharedCardPreferences(preferences: TCardPreferences | undefined): TCardPreferences;
4
6
  export type CardTypeChangeOptions = {
5
7
  /** The loaded column catalog; the Matrix carry resolves fields against it. */
@@ -22,7 +24,9 @@ export type CardTypeChange = {
22
24
  } | {
23
25
  status: 'changed';
24
26
  card: TCard;
25
- /** Labels of authored parts the new type could not keep. */
27
+ /** Authored data parts the new type could not keep, with why (pivot-aggregate-to-matrix PM-D12). */
28
+ gaps: readonly CardTypeChangeGap[];
29
+ /** The gaps' labels, in the same order, for readers that only name them. */
26
30
  leftOut: readonly string[];
27
31
  /** Chart-scoped preference keys the new type drops (DE-D43). */
28
32
  droppedPreferences: readonly (keyof TCardPreferences)[];
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { Field, FilterGroup, JoinPlan } from '../../lib/types/explorer-types.js';
3
+ /** The roles a field may carry; the Matrix carry drops any other (pivot-aggregate-to-matrix PA-19). */
4
+ export declare const explorerFieldRoleSchema: z.ZodEnum<["groupby", "metric", "sortby", "pivotby", "detail"]>;
3
5
  export declare const explorerFieldSchema: z.ZodType<Field>;
4
6
  export declare const filterGroupSchema: z.ZodType<FilterGroup>;
5
7
  export declare const joinPlanSchema: z.ZodType<JoinPlan>;
@@ -14,6 +14,29 @@ import { AssistantPart } from './parts.js';
14
14
  export type AnswerPartKind = 'text' | 'step' | 'other';
15
15
  /** The parts that are working notes: text before the last step that comes before the answer's last text. */
16
16
  export declare function workingNotesOf<T>(parts: readonly T[], kindOf: (part: T) => AnswerPartKind): ReadonlySet<T>;
17
+ /**
18
+ * Where each part kind shows in an answer (assistant joins and panel H-1): in
19
+ * its body, in order (the words that aren't working notes, the blocks); in its
20
+ * details (steps, what it used, the trace); or nowhere (the conversation's id,
21
+ * a proposal's operations). The transcript and the copied text both read it,
22
+ * and a new part kind doesn't compile until it has a place here.
23
+ */
24
+ export declare const ANSWER_PART_PLACEMENT: {
25
+ readonly conversation: "nowhere";
26
+ readonly text: "body";
27
+ readonly stage: "details";
28
+ readonly using: "details";
29
+ readonly clarify: "body";
30
+ readonly artifact: "body";
31
+ readonly refusal: "body";
32
+ readonly trace: "details";
33
+ readonly proposal: "body";
34
+ readonly proposal_operations: "nowhere";
35
+ readonly proposal_refused: "body";
36
+ readonly model_change: "body";
37
+ };
38
+ /** Whether a part kind shows in an answer's body; a kind this build doesn't know (a newer server's) doesn't. */
39
+ export declare function showsInAnswerBody(kind: string): boolean;
17
40
  /** A stored part's kind for `workingNotesOf`. */
18
41
  export declare function storedPartKind(part: AssistantPart): AnswerPartKind;
19
42
  /** A stored answer's text: its text parts after the last step, a paragraph each. */
@@ -0,0 +1,29 @@
1
+ import { AssistantConversationDetail } from './conversation.js';
2
+ /**
3
+ * What the copy does with every field of a conversation and of a turn
4
+ * (assistant joins and panel H-1, P3-08): a field added to either type
5
+ * doesn't compile until it is shown or left out here on purpose.
6
+ */
7
+ export declare const COPIED_CONVERSATION_FIELDS: {
8
+ readonly conversationId: "with tool calls";
9
+ readonly addedSources: "left out";
10
+ readonly allows: "left out";
11
+ readonly turns: "shown";
12
+ };
13
+ export declare const COPIED_TURN_FIELDS: {
14
+ readonly turnId: "left out";
15
+ readonly startedAt: "shown";
16
+ readonly message: "shown";
17
+ readonly taggedFields: "shown";
18
+ readonly parts: "shown";
19
+ readonly outcome: "shown";
20
+ readonly toolCalls: "with tool calls";
21
+ readonly model: "with tool calls";
22
+ readonly instructionsVersion: "with tool calls";
23
+ };
24
+ export declare function conversationText(detail: AssistantConversationDetail, options: {
25
+ assistantName: string;
26
+ toolCalls?: boolean;
27
+ }): string;
28
+ /** A tool's name without the product prefix (AJ-INV-8). */
29
+ export declare function toolName(tool: string): string;
@@ -1,5 +1,5 @@
1
1
  import { SemaphorSourceRef } from '../analytics-protocol/contracts.js';
2
- import { AssistantPart } from './parts.js';
2
+ import { AssistantCallerAllows, AssistantPart } from './parts.js';
3
3
  import { AssistantCardField } from './context.js';
4
4
  /** How a stored turn ended; `running` while it is answering, `interrupted` when its process died. */
5
5
  export type TurnOutcome = 'running' | 'completed' | 'stopped' | 'failed' | 'refused' | 'interrupted';
@@ -15,12 +15,15 @@ export type AssistantConversationSummary = {
15
15
  };
16
16
  /**
17
17
  * What opening a conversation returns (Phase 3c, D3c-5): the turns as the
18
- * transcript shows them. Never the context, tool calls, card request,
19
- * executed queries or provider replay (AG-INV-5).
18
+ * transcript shows them. Never the context, card request, executed queries
19
+ * or provider replay (AG-INV-5); tool calls only when an organization user
20
+ * asks for them to copy (AJ-D11).
20
21
  */
21
22
  export type AssistantConversationDetail = {
22
23
  conversationId: string;
23
24
  addedSources: SemaphorSourceRef[];
25
+ /** What the caller may do (AJ-D14). Absent from a server before it. */
26
+ allows?: AssistantCallerAllows;
24
27
  turns: Array<{
25
28
  turnId: string;
26
29
  startedAt: string;
@@ -30,8 +33,26 @@ export type AssistantConversationDetail = {
30
33
  /** Shown through the one stored-part mapping the stream uses (D3c-6, `transcript.ts`). */
31
34
  parts: AssistantPart[];
32
35
  outcome: TurnOutcome;
36
+ /**
37
+ * Only when asked for and only for an organization user (AJ-D11,
38
+ * AJ-INV-4): each tool call's name, input, row count, time and outcome, never its
39
+ * result, and the model and instructions that answered.
40
+ */
41
+ toolCalls?: AssistantToolCallRecord[];
42
+ model?: string;
43
+ instructionsVersion?: string;
33
44
  }>;
34
45
  };
46
+ /** One tool call as a stored turn keeps it: never its result (it can hold customer rows). */
47
+ export type AssistantToolCallRecord = {
48
+ tool: string;
49
+ input: unknown;
50
+ ok: boolean;
51
+ /** How many rows a query call returned, from its own result (never the rows). */
52
+ rowCount?: number;
53
+ durationMs?: number;
54
+ error?: string;
55
+ };
35
56
  export declare const ASSISTANT_LAYOUTS: readonly ["docked-right", "docked-left", "centered", "full-page"];
36
57
  /** Where the assistant opens. Token config `assistant.layout` sets the embed default (AG-D21). */
37
58
  export type AssistantLayout = (typeof ASSISTANT_LAYOUTS)[number];
@@ -11,8 +11,10 @@ export * from './availability.js';
11
11
  export * from './parts.js';
12
12
  export * from './conversation.js';
13
13
  export * from './transcript.js';
14
+ export * from './conversation-text.js';
14
15
  export * from './answer-text.js';
15
16
  export * from './sources.js';
16
17
  export * from './token-config.js';
17
18
  export * from './artifact.js';
18
19
  export * from './add-to-dashboard.js';
20
+ export * from './model-change.js';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Adding a relationship the assistant proposed (assistant joins and panel
3
+ * AJ-D17): what the apply route answers, and the panel's words for each way
4
+ * it can refuse. The route sends the change store's own codes; the person
5
+ * reads these words, never the store's messages (written for agents) and
6
+ * never the product's name (AJ-INV-8).
7
+ */
8
+ /** `POST /api/v1/assistant/proposals/{proposalId}/apply`, answered 200: the relationship is in the domain (or already was). */
9
+ export type AssistantModelChangeApplied = {
10
+ applied: true;
11
+ replayed: boolean;
12
+ };
13
+ /** The route's refusal body: a change store code and the store's message (for logs, not for the person). */
14
+ export type AssistantModelChangeRefusal = {
15
+ code: string;
16
+ message: string;
17
+ };
18
+ /** The panel's words for a refusal code; any other code (a validation failure, a server error) is "couldn't be added". */
19
+ export declare function modelChangeRefusalMessage(code: unknown): string;
@@ -10,10 +10,20 @@ import { CreatedEntity, DashboardOperation, OperationContext } from '../dashboar
10
10
  * Artifacts from Phase 4; proposals in Phase 7.
11
11
  */
12
12
  export declare const ASSISTANT_PARTS_VERSION: 1;
13
+ /**
14
+ * What the person asking may do here, from the server's own caller (assistant
15
+ * joins and panel AJ-D14): whether a copy may include the tool calls
16
+ * (organization users). Fixed for a conversation; the browser decides nothing
17
+ * from the token itself.
18
+ */
19
+ export type AssistantCallerAllows = {
20
+ toolCalls: boolean;
21
+ };
13
22
  export type AssistantPart = {
14
23
  kind: 'conversation';
15
24
  conversationId: string;
16
25
  expiresAt: string;
26
+ allows?: AssistantCallerAllows;
17
27
  } | {
18
28
  kind: 'text';
19
29
  text: string;
@@ -28,7 +38,7 @@ export type AssistantPart = {
28
38
  kind: 'refusal';
29
39
  code: AssistantRefusalCode;
30
40
  message: string;
31
- } | AssistantTracePart | AssistantProposalPart | AssistantProposalOperationsPart;
41
+ } | AssistantTracePart | AssistantProposalPart | AssistantProposalOperationsPart | AssistantProposalRefusedPart | AssistantModelChangePart;
32
42
  /**
33
43
  * A change the assistant made to the dashboard on screen (Phase 7, spec 8.1,
34
44
  * D7-16): what it does in plain sentences, stored with the turn. Its
@@ -61,6 +71,34 @@ export type AssistantProposalOperationsPart = {
61
71
  operations: DashboardOperation[];
62
72
  context: OperationContext;
63
73
  };
74
+ /**
75
+ * A change the assistant asked for and nothing landed, for a reason the
76
+ * person should see (assistant joins and panel AJ-D8): today only a card
77
+ * whose datasets the domain doesn't relate. Stored with the turn; the model
78
+ * gets the refusal as before. `message` is the change problem's own
79
+ * sentence, safe to show an end user.
80
+ */
81
+ export type AssistantProposalRefusedPart = {
82
+ kind: 'proposal_refused';
83
+ code: 'relationship_missing';
84
+ message: string;
85
+ };
86
+ /**
87
+ * A relationship the assistant proposes adding to a domain (assistant joins
88
+ * and panel AJ-D16): what it does in plain sentences, stored with the turn.
89
+ * The assistant never adds it; the person does, by click, through the apply
90
+ * route (AJ-D17, AJ-INV-6).
91
+ */
92
+ export type AssistantModelChangePart = {
93
+ kind: 'model_change';
94
+ proposalId: string;
95
+ domainId: string;
96
+ /** The domain's label: "Every dashboard on the {domainLabel} domain can use it." */
97
+ domainLabel: string;
98
+ /** One per change (`relationship.add`) and its sentence, as propose returned them. */
99
+ changes: AssistantProposalChange[];
100
+ warnings: ChangeDiagnostic[];
101
+ };
64
102
  /**
65
103
  * A question the person answers with a click, ending the answer (ledger
66
104
  * D3d-1): the model's alternatives as data, never parsed from its text. Each
@@ -76,6 +114,12 @@ export type AssistantClarifyPart = {
76
114
  label: string;
77
115
  description?: string;
78
116
  }>;
117
+ /**
118
+ * The choices can be carried out together (assistant joins and panel
119
+ * AJ-D20, AJ-D21): the person ticks any of them and sends them at once.
120
+ * Absent for one answer; a client before it shows the rows as one answer.
121
+ */
122
+ multiple?: true;
79
123
  };
80
124
  export type AssistantStagePart = {
81
125
  kind: 'stage';
@@ -7815,7 +7815,11 @@ export declare const MAX_PROPOSED_CHANGES = 20;
7815
7815
  export type ProposeChangeCaller = {
7816
7816
  /** Dashboard changes (card.*, filter.*). False for a tenant VIEWER: the tool isn't listed at all. */
7817
7817
  dashboards: boolean;
7818
- /** relationship.add: org interactive callers only. */
7818
+ /**
7819
+ * relationship.add: an org Author or higher, on any credential (assistant
7820
+ * joins and panel AJ-D15, AJ-D19). On screen, only for the in-product
7821
+ * assistant, whose person adds it by click (AJ-D16).
7822
+ */
7819
7823
  domains: boolean;
7820
7824
  /** dashboard.generate: callers who may create dashboards. */
7821
7825
  generate: boolean;
@@ -7824,8 +7828,9 @@ export type ProposeChangeCaller = {
7824
7828
  /**
7825
7829
  * A session that changes the dashboard on the user's screen (a live token,
7826
7830
  * Semaphor's own assistant): it changes only the open dashboard, in place,
7827
- * so `saveAs`, `preview` and `domainId` are not offered and, since the schema
7828
- * is strict, are refused if sent (embedded live changes LC-D17).
7831
+ * so `saveAs` and `preview` are not offered and, since the schema is
7832
+ * strict, are refused if sent (embedded live changes LC-D17). `domainId`
7833
+ * is offered only with `domains`, for `relationship.add` (AJ-D16).
7829
7834
  */
7830
7835
  onScreen: boolean;
7831
7836
  };
@@ -4,7 +4,13 @@
4
4
  * warnings. Messages are one sentence a person can read and never name the
5
5
  * product; `fix` tells the agent what to do next.
6
6
  */
7
- export type ChangeProblemCode = 'invalid_change' | 'invalid_change_target' | 'copy_required' | 'not_permitted' | 'change_not_allowed_for_credential' | 'dashboard_not_found' | 'card_not_found' | 'filter_not_found' | 'sheet_not_found' | 'sheet_required' | 'sheet_not_a_grid' | 'field_not_found' | 'card_not_editable' | 'type_not_supported' | 'query_form_mismatch' | 'capability_required' | 'handle_unknown' | 'too_many_changes'
7
+ export type ChangeProblemCode = 'invalid_change' | 'invalid_change_target' | 'copy_required' | 'not_permitted' | 'dashboard_not_found' | 'card_not_found' | 'filter_not_found' | 'sheet_not_found' | 'sheet_required' | 'sheet_not_a_grid' | 'field_not_found'
8
+ /**
9
+ * The card's datasets aren't joined by the domain's relationships, so the
10
+ * card can't run (assistant joins and panel AJ-D4). Details name the base
11
+ * dataset and the ones it can't reach.
12
+ */
13
+ | 'relationship_missing' | 'card_not_editable' | 'type_not_supported' | 'query_form_mismatch' | 'capability_required' | 'handle_unknown' | 'too_many_changes'
8
14
  /** filter.update or filter.bind on a filter the outline marks read only. */
9
15
  | 'filter_not_editable'
10
16
  /** The changed dashboard fails the save's own validation (propose or apply). */
@@ -44,6 +44,12 @@ export type DashboardCardLocation = {
44
44
  * then frame cards, then document section cards (every KPI card included).
45
45
  */
46
46
  export declare function listDashboardCardLocations(dashboard: Pick<TDashboard, 'sheets'>): readonly DashboardCardLocation[];
47
+ /**
48
+ * The dashboard with each card mapped, in `listDashboardCardLocations` order.
49
+ * Returns the input object when no card changed, and likewise each sheet,
50
+ * frame and section, so callers can compare by reference.
51
+ */
52
+ export declare function mapDashboardCards<T extends Pick<TDashboard, 'sheets'>>(dashboard: T, map: (card: TCard, location: DashboardCardLocation) => TCard): T;
47
53
  export type DocumentSectionShapeIssue = {
48
54
  /** Path relative to the section, for example `cards[2].type`. Empty for the section itself. */
49
55
  path: string;
@@ -9,6 +9,7 @@ export * from './temporal-bucket-authoring.js';
9
9
  export * from './canonical-result-keys.js';
10
10
  export * from './dashboard-card-source-index.js';
11
11
  export * from './document-section-cards.js';
12
+ export * from './legacy-table-routing.js';
12
13
  export * from './dashboard-filter-mapping-types.js';
13
14
  export * from './dashboard-filter-automatic-target.js';
14
15
  export * from './dashboard-filter-sql-subscription.js';
@@ -0,0 +1,64 @@
1
+ import { TCard, TDashboard, TFrame } from '../../lib/types/common-types.js';
2
+ import { CardTypeChangeGap } from '../../lib/utils/card-type-change.js';
3
+ import { DashboardCardLocation } from './document-section-cards.js';
4
+ export { LEGACY_TABLE_CARD_TYPES, isLegacyTableCard, type LegacyTableCardType, } from '../../lib/utils/card-config-utils.js';
5
+ /**
6
+ * Load routing of Pivot and Hierarchical cards
7
+ * (semaphor-app docs/implementation-plans/pivot-aggregate-to-matrix). A saved
8
+ * `pivotTable` or `aggregateTable` card is converted in memory by the one
9
+ * converter and replaced only when the conversion is exact: no gap, and a
10
+ * ready definition (PM-D3). A Pivot that only groups rows becomes the regular
11
+ * Table; every other card becomes Matrix (`legacyTableRoutingTarget`).
12
+ * Nothing is written back; a save stores the new card like any other edit
13
+ * (PM-D1). This module never builds a definition itself (PM-D2).
14
+ */
15
+ /** PM-D7: the namespace of the ids routing mints. Fixed forever: changing it changes every routed card. */
16
+ export declare const LEGACY_TABLE_ROUTING_ID_NAMESPACE = "9677efdd-86ec-4afb-b9bb-5ead8b5442af";
17
+ /**
18
+ * The ids a routed card's Matrix levels and measures get: the n-th call
19
+ * returns the UUID v5 of `${cardId}#${n}`. The same saved card therefore
20
+ * converts to the same Matrix definition on every load, in the browser and
21
+ * on the server (PM-D7).
22
+ */
23
+ export declare function legacyTableRoutingIds(cardId: string): () => string;
24
+ export type LegacyTableCardRouting =
25
+ /** Not a Pivot or Hierarchical card: the input object. */
26
+ {
27
+ status: 'not_legacy';
28
+ card: TCard;
29
+ }
30
+ /** The converter's Matrix or Table card, same card id. */
31
+ | {
32
+ status: 'routed';
33
+ card: TCard;
34
+ }
35
+ /** The input object, kept as stored, with what blocked the conversion. */
36
+ | {
37
+ status: 'unrouted';
38
+ card: TCard;
39
+ gaps: readonly CardTypeChangeGap[];
40
+ };
41
+ /**
42
+ * PM-D3 target: a Pivot driven by its shelves (no SQL text, at least one row
43
+ * level or metric) with no pivot columns and no
44
+ * row or column totals is a flat grouped table, so it becomes the regular
45
+ * Table (the editor's table-kind switch keeps its config unchanged, and the
46
+ * query builder compiles the same SQL for both types). Every other Pivot and
47
+ * every Hierarchical card becomes Matrix.
48
+ */
49
+ export declare function legacyTableRoutingTarget(card: TCard): 'table' | 'matrixTable';
50
+ /** One card: route it when the conversion is exact (PM-D3). */
51
+ export declare function routeLegacyTableCard(card: TCard): LegacyTableCardRouting;
52
+ /** Each card of a library frame. Returns the input object when nothing routed. */
53
+ export declare function routeLegacyTableFrame<T extends Pick<TFrame, 'cards'>>(frame: T): T;
54
+ export type UnroutedLegacyTableCard = {
55
+ location: DashboardCardLocation;
56
+ gaps: readonly CardTypeChangeGap[];
57
+ };
58
+ export type LegacyTableDashboardRouting<T> = {
59
+ /** The input object when nothing routed. */
60
+ dashboard: T;
61
+ unrouted: readonly UnroutedLegacyTableCard[];
62
+ };
63
+ /** Every sheet, frame and document section card of a dashboard. */
64
+ export declare function routeLegacyTableCards<T extends Pick<TDashboard, 'sheets'>>(dashboard: T): LegacyTableDashboardRouting<T>;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.551",
8
+ "version": "0.1.553",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -127,7 +127,7 @@
127
127
  "build": "node scripts/build.mjs",
128
128
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
129
129
  "lint:regressions": "node scripts/lint-regressions.mjs",
130
- "check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/layout-engine.mjs",
130
+ "check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/layout-engine.mjs",
131
131
  "preview": "vite preview",
132
132
  "test": "vitest run",
133
133
  "test:changed": "vitest run --changed",
@@ -1,102 +0,0 @@
1
- import { A as s, h as u, m as d } from "./context-BerEBuFR.js";
2
- function o(e, t) {
3
- return e.role === t.role && e.name === t.name && e.aggregate === t.aggregate && e.granularity === t.granularity;
4
- }
5
- function l(e) {
6
- var n, a;
7
- const t = (n = e.selectedCard) == null ? void 0 : n.description;
8
- return (t == null ? void 0 : t.status) !== "described" || t.sql || ((a = e.editing) == null ? void 0 : a.mode) === "sql" ? [] : t.fields;
9
- }
10
- function S(e, t) {
11
- if (t.length === 0) return [];
12
- if (t.length > s.taggedFields)
13
- return [`taggedFields: at most ${s.taggedFields}`];
14
- const n = l(e);
15
- return t.flatMap((a, i) => n.some((r) => o(r, a)) ? t.slice(0, i).some((r) => o(r, a)) ? [`taggedFields.${i}: tagged twice`] : [] : [`taggedFields.${i}: not a field of the card the context asks about`]);
16
- }
17
- function k(e, t) {
18
- return t != null && t.length ? `Fields of the asked-about card the user tagged in this question: ${t.map(u).join("; ")}.
19
-
20
- ${e}` : e;
21
- }
22
- function f(e) {
23
- if (e.kind === "text") return { type: "text", text: e.text };
24
- const { kind: t, ...n } = e;
25
- return {
26
- type: `data-${t}`,
27
- ...e.kind === "stage" ? { id: e.stageId } : {},
28
- data: n
29
- };
30
- }
31
- function b(e, t) {
32
- return e.kind !== "text" ? [f(e)] : [
33
- { type: "text-start", id: t },
34
- { type: "text-delta", id: t, delta: e.text },
35
- { type: "text-end", id: t }
36
- ];
37
- }
38
- function h(e) {
39
- if (e === "failed" || e === "interrupted")
40
- return { kind: "refusal", code: "model_unavailable", message: d.model_unavailable };
41
- if (e === "running")
42
- return { kind: "refusal", code: "turn_in_progress", message: d.turn_in_progress };
43
- }
44
- function c(e, t) {
45
- let n = -1;
46
- e.forEach((i, r) => {
47
- t(i) === "text" && (n = r);
48
- });
49
- let a = -1;
50
- return e.forEach((i, r) => {
51
- r < n && t(i) === "step" && (a = r);
52
- }), new Set(e.filter((i, r) => r < a && t(i) === "text"));
53
- }
54
- function g(e) {
55
- return e.kind === "text" ? "text" : e.kind === "stage" && !e.change ? "step" : "other";
56
- }
57
- function x(e) {
58
- const t = c(e, g);
59
- return e.flatMap((n) => n.kind === "text" && !t.has(n) ? [n.text] : []).filter((n) => n.trim().length > 0).join(`
60
-
61
- `);
62
- }
63
- function T(e) {
64
- if (e.kind === "semantic") return JSON.stringify(["semantic", e.domainId, e.datasetName]);
65
- if (e.kind === "sql") return JSON.stringify(["sql", e.connectionId]);
66
- }
67
- function F(e) {
68
- return e.label ?? (e.kind === "semantic" ? e.datasetName : e.kind === "physical" ? e.tableName : "SQL");
69
- }
70
- function y(e) {
71
- return {
72
- columns: e.columns,
73
- records: e.records,
74
- rowCount: e.rowCount,
75
- governed: e.status.governed,
76
- complete: e.status.complete,
77
- truncated: e.status.truncated
78
- };
79
- }
80
- const A = {
81
- number: "kpi",
82
- line: "line",
83
- bar: "bar",
84
- stackedBar: "stackedBar",
85
- table: "table"
86
- };
87
- export {
88
- A,
89
- l as a,
90
- f as b,
91
- b as c,
92
- h as d,
93
- g as e,
94
- x as f,
95
- T as g,
96
- F as h,
97
- k as q,
98
- o as s,
99
- S as t,
100
- y as v,
101
- c as w
102
- };