@tai42/studio-sdk 1.0.1 → 1.2.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 (65) hide show
  1. package/dist/components/fleet-report.d.ts +7 -6
  2. package/dist/components/fleet-report.d.ts.map +1 -1
  3. package/dist/components/fleet-report.js +12 -3
  4. package/dist/components/fleet-report.js.map +1 -1
  5. package/dist/components/icons.d.ts +2 -0
  6. package/dist/components/icons.d.ts.map +1 -1
  7. package/dist/components/icons.js +3 -0
  8. package/dist/components/icons.js.map +1 -1
  9. package/dist/hooks/useApi.d.ts +257 -42
  10. package/dist/hooks/useApi.d.ts.map +1 -1
  11. package/dist/index.d.ts +4 -4
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/navigation/context.d.ts.map +1 -1
  16. package/dist/navigation/context.js +7 -3
  17. package/dist/navigation/context.js.map +1 -1
  18. package/dist/navigation/index.d.ts +1 -1
  19. package/dist/navigation/index.d.ts.map +1 -1
  20. package/dist/navigation/types.d.ts +24 -5
  21. package/dist/navigation/types.d.ts.map +1 -1
  22. package/dist/schema-form/SecretRefField.d.ts +42 -0
  23. package/dist/schema-form/SecretRefField.d.ts.map +1 -0
  24. package/dist/schema-form/SecretRefField.js +94 -0
  25. package/dist/schema-form/SecretRefField.js.map +1 -0
  26. package/dist/schema-form/classify.d.ts +3 -0
  27. package/dist/schema-form/classify.d.ts.map +1 -1
  28. package/dist/schema-form/classify.js +17 -0
  29. package/dist/schema-form/classify.js.map +1 -1
  30. package/dist/schema-form/context.d.ts +24 -0
  31. package/dist/schema-form/context.d.ts.map +1 -1
  32. package/dist/schema-form/context.js +3 -0
  33. package/dist/schema-form/context.js.map +1 -1
  34. package/dist/schema-form/default-value.d.ts.map +1 -1
  35. package/dist/schema-form/default-value.js +2 -0
  36. package/dist/schema-form/default-value.js.map +1 -1
  37. package/dist/schema-form/field-node.d.ts.map +1 -1
  38. package/dist/schema-form/field-node.js +3 -0
  39. package/dist/schema-form/field-node.js.map +1 -1
  40. package/dist/schema-form/index.d.ts +4 -0
  41. package/dist/schema-form/index.d.ts.map +1 -1
  42. package/dist/schema-form/index.js +2 -0
  43. package/dist/schema-form/index.js.map +1 -1
  44. package/dist/schema-form/record-field.d.ts +15 -0
  45. package/dist/schema-form/record-field.d.ts.map +1 -0
  46. package/dist/schema-form/record-field.js +144 -0
  47. package/dist/schema-form/record-field.js.map +1 -0
  48. package/dist/schema-form/validate.d.ts.map +1 -1
  49. package/dist/schema-form/validate.js +10 -0
  50. package/dist/schema-form/validate.js.map +1 -1
  51. package/package.json +2 -2
  52. package/src/components/fleet-report.tsx +20 -10
  53. package/src/components/icons.tsx +11 -0
  54. package/src/index.ts +8 -0
  55. package/src/navigation/context.tsx +7 -3
  56. package/src/navigation/index.ts +1 -0
  57. package/src/navigation/types.ts +29 -5
  58. package/src/schema-form/SecretRefField.tsx +247 -0
  59. package/src/schema-form/classify.ts +25 -0
  60. package/src/schema-form/context.ts +29 -0
  61. package/src/schema-form/default-value.ts +2 -0
  62. package/src/schema-form/field-node.tsx +16 -0
  63. package/src/schema-form/index.ts +4 -0
  64. package/src/schema-form/record-field.tsx +243 -0
  65. package/src/schema-form/validate.ts +10 -0
@@ -0,0 +1,144 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * The record (string-keyed map) field renderer. Each entry is a key input plus a
4
+ * value editor built from the map's value schema; add appends a blank-key entry,
5
+ * remove drops one by row. Rows carry a synthetic stable id — not their key — so
6
+ * an entry keeps its identity (and focus) while its key is being typed, and so a
7
+ * transiently blank or duplicate key never remounts a row or clobbers another.
8
+ *
9
+ * The emitted value is a plain object of the VALID entries. A blank key and a
10
+ * duplicate key are held in local row state and surfaced (never emitted, never
11
+ * silently merged): the map cannot represent two entries under one key, so the
12
+ * later duplicate is withheld and flagged rather than overwriting the first.
13
+ */
14
+ import { useContext, useRef, useState } from 'react';
15
+ import { CloseIcon } from '../components/icons';
16
+ import { Field } from '../components/field';
17
+ import { TextInput } from '../components/inputs';
18
+ import { Button } from '../components/primitives';
19
+ import { classifySchema } from './classify';
20
+ import { RecordEntryRendererContext } from './context';
21
+ import { defaultValueForSchema } from './default-value';
22
+ import { FieldGroup } from './field-group';
23
+ import { FieldNode } from './field-node';
24
+ function isPlainObject(value) {
25
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
26
+ }
27
+ function analyzeRows(rows) {
28
+ const value = {};
29
+ const seen = new Set();
30
+ const blankRowIds = new Set();
31
+ const duplicateRowIds = new Set();
32
+ for (const row of rows) {
33
+ if (row.key.trim() === '') {
34
+ blankRowIds.add(row.id);
35
+ continue;
36
+ }
37
+ if (seen.has(row.key)) {
38
+ duplicateRowIds.add(row.id);
39
+ continue;
40
+ }
41
+ seen.add(row.key);
42
+ value[row.key] = row.value;
43
+ }
44
+ return { value, blankRowIds, duplicateRowIds };
45
+ }
46
+ export function RecordField({ heading, description, error, values, root, value, onChange, path, errors, idPrefix, }) {
47
+ const nextId = useRef(0);
48
+ const rowsFromValue = (source) => isPlainObject(source)
49
+ ? Object.entries(source).map(([key, entryValue]) => ({
50
+ id: nextId.current++,
51
+ key,
52
+ value: entryValue,
53
+ }))
54
+ : [];
55
+ const [rows, setRows] = useState(() => rowsFromValue(value));
56
+ // The last object THIS field emitted. A parent echoing our own value back
57
+ // passes it identity-equal, so the rows (which may hold a blank/duplicate key
58
+ // the emitted object cannot) survive; a parent that swaps in a different value
59
+ // (a reset, another record loaded) fails the check and resyncs the rows.
60
+ const lastEmitted = useRef(value);
61
+ if (value !== lastEmitted.current) {
62
+ lastEmitted.current = value;
63
+ setRows(rowsFromValue(value));
64
+ }
65
+ const renderEntry = useContext(RecordEntryRendererContext);
66
+ const commit = (nextRows) => {
67
+ setRows(nextRows);
68
+ const emitted = analyzeRows(nextRows).value;
69
+ lastEmitted.current = emitted;
70
+ onChange(emitted);
71
+ };
72
+ const setKey = (id, key) => {
73
+ commit(rows.map((row) => (row.id === id ? { ...row, key } : row)));
74
+ };
75
+ const setValue = (id, next) => {
76
+ commit(rows.map((row) => (row.id === id ? { ...row, value: next } : row)));
77
+ };
78
+ const addRow = () => {
79
+ commit([...rows, { id: nextId.current++, key: '', value: newEntryValue(values, root) }]);
80
+ };
81
+ const removeRow = (id) => {
82
+ commit(rows.filter((row) => row.id !== id));
83
+ };
84
+ const { blankRowIds, duplicateRowIds } = analyzeRows(rows);
85
+ const summary = keyFaultSummary(blankRowIds.size, duplicateRowIds.size);
86
+ return (_jsxs(FieldGroup, { heading: heading, description: description, error: error, atRoot: false, children: [rows.length === 0 ? _jsx("span", { className: "tai-field-hint", children: "No entries" }) : null, summary !== undefined ? (_jsx("span", { role: "alert", className: "tai-field-error", children: summary })) : null, rows.map((row, index) => {
87
+ const position = index + 1;
88
+ const keyFault = rowKeyFault(row.id, blankRowIds, duplicateRowIds);
89
+ const entryPath = path === '' ? row.key : `${path}.${row.key}`;
90
+ const defaultField = (_jsx(FieldNode, { schema: values, root: root, value: row.value, onChange: (next) => {
91
+ setValue(row.id, next);
92
+ }, path: entryPath, label: undefined, required: true, errors: errors, idPrefix: idPrefix }));
93
+ return (_jsxs("div", { className: "tai-row", children: [_jsx(Field, { label: `Key ${String(position)}`, error: keyFault, children: _jsx(TextInput, { value: row.key, onChange: (event) => {
94
+ setKey(row.id, event.target.value);
95
+ } }) }), _jsx("div", { style: { flex: 1 }, children: renderEntry === undefined
96
+ ? defaultField
97
+ : renderEntry({
98
+ keyName: row.key,
99
+ path: entryPath,
100
+ valueSchema: values,
101
+ value: row.value,
102
+ onChange: (next) => {
103
+ setValue(row.id, next);
104
+ },
105
+ defaultField,
106
+ }) }), _jsxs(Button, { type: "button", variant: "secondary", "aria-label": `Remove entry ${String(position)}`, onClick: () => {
107
+ removeRow(row.id);
108
+ }, children: [_jsx(CloseIcon, {}), "Remove"] })] }, row.id));
109
+ }), _jsx("div", { children: _jsx(Button, { type: "button", variant: "secondary", onClick: addRow, children: "Add entry" }) })] }));
110
+ }
111
+ /** The inline key error for one row, or `undefined` when its key is fine. */
112
+ function rowKeyFault(id, blankRowIds, duplicateRowIds) {
113
+ if (blankRowIds.has(id))
114
+ return 'Key is required';
115
+ if (duplicateRowIds.has(id))
116
+ return 'Duplicate key';
117
+ return undefined;
118
+ }
119
+ /** A one-line summary of the map's key faults, or `undefined` when there are none. */
120
+ function keyFaultSummary(blankCount, duplicateCount) {
121
+ const parts = [];
122
+ if (blankCount > 0)
123
+ parts.push(`${String(blankCount)} entry with a blank key`);
124
+ if (duplicateCount > 0)
125
+ parts.push(`${String(duplicateCount)} entry with a duplicate key`);
126
+ if (parts.length === 0)
127
+ return undefined;
128
+ return `${parts.join(' and ')} (not saved until fixed)`;
129
+ }
130
+ function newEntryValue(schema, root) {
131
+ const seeded = defaultValueForSchema(schema, root);
132
+ if (seeded !== undefined)
133
+ return seeded;
134
+ const classified = classifySchema(schema, root);
135
+ switch (classified.model.kind) {
136
+ case 'string':
137
+ return '';
138
+ case 'boolean':
139
+ return false;
140
+ default:
141
+ return undefined;
142
+ }
143
+ }
144
+ //# sourceMappingURL=record-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-field.js","sourceRoot":"","sources":["../../src/schema-form/record-field.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EA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ourceRoot":"","sources":["../../src/schema-form/validate.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE5D,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AA6JD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,eAAe,GACxB,gBAAgB,CAIlB"}
@@ -136,6 +136,16 @@ function walk(schema, value, path, root, errors, maxUploadBytes) {
136
136
  }
137
137
  return;
138
138
  }
139
+ case 'record': {
140
+ if (!isPlainObject(value)) {
141
+ errors[path] = 'must be an object';
142
+ return;
143
+ }
144
+ for (const [key, entryValue] of Object.entries(value)) {
145
+ walk(model.values, entryValue, joinPath(path, key), root, errors, maxUploadBytes);
146
+ }
147
+ return;
148
+ }
139
149
  case 'union': {
140
150
  const index = activeVariantIndex(value, model.variants, model.discriminator, root);
141
151
  const variant = index === -1 ? undefined : model.variants[index];
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/schema-form/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAa7C,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAC9C,MAAM,OAAO,GAAG,qBAAqB,CAAC;AACtC,MAAM,OAAO,GAAG,iEAAiE,CAAC;AAElF,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAA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AAI,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;YAChE,OAAO;QACT,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAkB,EAClB,KAAc,EACd,OAAyB;IAEzB,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tai42/studio-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "The Studio plugin contract, shared UI components, and hooks that every feature builds on.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "tai42 <oss@tai42.ai>",
@@ -89,7 +89,7 @@
89
89
  "@radix-ui/react-select": "^2.3.2",
90
90
  "@radix-ui/react-tabs": "^1.1.16",
91
91
  "@radix-ui/react-tooltip": "^1.2.11",
92
- "@tai42/api-client": "1.0.1"
92
+ "@tai42/api-client": "1.2.0"
93
93
  },
94
94
  "scripts": {
95
95
  "build": "tsc -b tsconfig.build.json && node scripts/copy-assets.mjs",
@@ -11,15 +11,16 @@
11
11
  * System page's own fleet-reload action) drops the "Change saved" framing — nothing
12
12
  * was saved, a reload was dispatched — and the self-referential System-page pointer.
13
13
  *
14
- * A `converged` summary (every origin applied, or a lone-worker local-only change)
14
+ * A `converged` summary (every worker applied, or a lone-worker local-only change)
15
15
  * renders NOTHING — the calling surface shows its own success. A `degraded` summary
16
16
  * (the bus was reached but a sibling did not confirm) or an `unreachable` summary (the
17
- * bus itself failed) renders a loud `role="alert"` panel naming the honest per-origin
18
- * outcomes: `failed` / `missing` / `departed` / `timed_out`, or the bus error. It
19
- * never fakes success on a stranded origin. Every server-supplied string (an origin
20
- * name, an error/detail message) renders as escaped React text, never an HTML sink.
17
+ * bus itself failed) renders a loud `role="alert"` panel naming the honest per-worker
18
+ * outcomes: `failed` / `missing` / `departed` / `timed_out` / `resyncing` / `recycling` /
19
+ * `stale`, or the bus error. It never fakes success on a stranded worker. Every
20
+ * server-supplied string (a worker name, an error/detail message) renders as escaped
21
+ * React text, never an HTML sink.
21
22
  *
22
- * Every state — the headline and each origin's outcome — is a `tai-status` line: an
23
+ * Every state — the headline and each worker's outcome — is a `tai-status` line: an
23
24
  * icon MARK plus a word LABEL, with the tone color only reinforcing them, so the
24
25
  * report is readable without color perception.
25
26
  */
@@ -28,12 +29,15 @@ import type { FleetReportSummary, FleetFailureOutcome } from '@tai42/api-client'
28
29
 
29
30
  import { AlertTriangleIcon, PendingIcon, XCircleIcon, type IconComponent } from './icons';
30
31
 
31
- /** Human labels for the per-origin non-applied outcomes. */
32
+ /** Human labels for the per-worker non-applied outcomes. */
32
33
  const OUTCOME_LABEL: Record<FleetFailureOutcome, string> = {
33
34
  failed: 'apply failed',
34
35
  missing: 'alive but did not acknowledge in time',
35
36
  departed: 'left mid-broadcast',
36
37
  timed_out: 'acknowledged but did not finish applying',
38
+ resyncing: 'resyncing — will converge on resync',
39
+ recycling: 'restarting',
40
+ stale: 'quiet — reconnecting or dead',
37
41
  };
38
42
 
39
43
  interface StatusTone {
@@ -48,12 +52,18 @@ interface StatusTone {
48
52
  * raised. `departed` is a warning — the worker is gone, so nothing will converge it.
49
53
  * `missing` and `timed_out` are both UNRESOLVED (never acknowledged / acknowledged
50
54
  * but never finished), so they read as pending rather than as an outright failure.
55
+ * `resyncing` and `recycling` are transient restart-in-progress states, and `stale` is
56
+ * a quiet row past the freshness bound (reconnecting or dead, carrying no convergence
57
+ * promise) — all three read as warnings the operator should watch.
51
58
  */
52
59
  const OUTCOME_STATUS: Record<FleetFailureOutcome, StatusTone> = {
53
60
  failed: { tone: 'tai-status-err', Icon: XCircleIcon },
54
61
  missing: { tone: 'tai-status-pending', Icon: PendingIcon },
55
62
  departed: { tone: 'tai-status-warn', Icon: AlertTriangleIcon },
56
63
  timed_out: { tone: 'tai-status-pending', Icon: PendingIcon },
64
+ resyncing: { tone: 'tai-status-warn', Icon: AlertTriangleIcon },
65
+ recycling: { tone: 'tai-status-warn', Icon: AlertTriangleIcon },
66
+ stale: { tone: 'tai-status-warn', Icon: AlertTriangleIcon },
57
67
  };
58
68
 
59
69
  /**
@@ -92,7 +102,7 @@ export function FleetReport({ summary, action = 'save' }: FleetReportProps): Rea
92
102
  );
93
103
  }
94
104
 
95
- // degraded — the bus was reached but named origins did not converge. That is a
105
+ // degraded — the bus was reached but named workers did not converge. That is a
96
106
  // warning, not a failure, so it takes the warning surface: a warn-toned
97
107
  // headline inside an error-toned panel would state two different severities.
98
108
  //
@@ -118,8 +128,8 @@ export function FleetReport({ summary, action = 'save' }: FleetReportProps): Rea
118
128
  {summary.failures.map((failure) => {
119
129
  const { tone, Icon } = OUTCOME_STATUS[failure.outcome];
120
130
  return (
121
- <li key={failure.origin} className="tai-row">
122
- <span className="tai-mono">{failure.origin}</span>
131
+ <li key={failure.name} className="tai-row">
132
+ <span className="tai-mono">{failure.name}</span>
123
133
  <span className={`tai-status ${tone}`}>
124
134
  <Icon />
125
135
  {OUTCOME_LABEL[failure.outcome]}
@@ -203,6 +203,16 @@ export const NotificationsIcon: IconComponent = (props) => (
203
203
  </Icon>
204
204
  );
205
205
 
206
+ /** Conversations: one speech bubble holding transcript lines. */
207
+ export const ConversationsIcon: IconComponent = (props) => (
208
+ <Icon {...props}>
209
+ <path d="M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 3.5V16h-1A2.5 2.5 0 0 1 4 13.5z" />
210
+ <path d="M8 7.5h8" />
211
+ <path d="M8 10.5h8" />
212
+ <path d="M8 13.5h4" />
213
+ </Icon>
214
+ );
215
+
206
216
  /** Marketplace: a shopping bag. */
207
217
  export const MarketplaceIcon: IconComponent = (props) => (
208
218
  <Icon {...props}>
@@ -514,6 +524,7 @@ export const NAV_ICONS: Readonly<Record<Exclude<RouteToken, 'login'>, IconCompon
514
524
  scheduling: SchedulingIcon,
515
525
  interactions: InteractionsIcon,
516
526
  notifications: NotificationsIcon,
527
+ conversations: ConversationsIcon,
517
528
  marketplace: MarketplaceIcon,
518
529
  manifest: ManifestIcon,
519
530
  settings: SettingsIcon,
package/src/index.ts CHANGED
@@ -95,6 +95,7 @@ export type {
95
95
  RouteSearchByToken,
96
96
  PageProps,
97
97
  NavigationContextValue,
98
+ NavigateOptions,
98
99
  PluginSearch,
99
100
  NavigationGuardHandler,
100
101
  } from './navigation';
@@ -284,6 +285,7 @@ export {
284
285
  SchedulingIcon,
285
286
  InteractionsIcon,
286
287
  NotificationsIcon,
288
+ ConversationsIcon,
287
289
  MarketplaceIcon,
288
290
  ManifestIcon,
289
291
  SettingsIcon,
@@ -321,6 +323,8 @@ export type { IconProps, IconComponent } from './components/icons';
321
323
  // -- Schema-driven forms -----------------------------------------------------
322
324
  export {
323
325
  SchemaForm,
326
+ RecordEntryRendererContext,
327
+ SecretRefField,
324
328
  defaultValueForSchema,
325
329
  validateAgainstSchema,
326
330
  resolveRef,
@@ -328,6 +332,10 @@ export {
328
332
  export type {
329
333
  SchemaFormProps,
330
334
  CompletionProvider,
335
+ RecordEntryRenderer,
336
+ RecordEntryContext,
337
+ SecretRefFieldProps,
338
+ SecretRef,
331
339
  JsonSchema,
332
340
  JsonSchemaType,
333
341
  Discriminator,
@@ -199,14 +199,18 @@ export function NavigationProvider({
199
199
  // Wrap the shell's transitions so an armed guard is consulted before they commit.
200
200
  // With no guard armed the call stays synchronous — identical to the raw shell value.
201
201
  const guarded = useMemo<NavigationContextValue>(() => {
202
- const navigate: NavigationContextValue['navigate'] = (token, search) => {
202
+ // Forwarded as a REST tuple, so the shell's `navigate` is called with exactly
203
+ // the arguments the caller passed — a caller that wants the default history
204
+ // behaviour never turns into one that passed an explicit `undefined` for it.
205
+ const navigate: NavigationContextValue['navigate'] = (...args) => {
206
+ const [token, search] = args;
203
207
  if (!registry.hasArmedGuards()) {
204
- value.navigate(token, search);
208
+ value.navigate(...args);
205
209
  return;
206
210
  }
207
211
  void registry.run().then((allowed) => {
208
212
  if (!allowed) return;
209
- value.navigate(token, search);
213
+ value.navigate(...args);
210
214
  // Advance the committed entry to the resolved destination (the router may commit
211
215
  // async, so `window.location` would be stale). Its router state is unobservable
212
216
  // here, hence `state: null`.
@@ -14,6 +14,7 @@ export type {
14
14
  RouteSearchByToken,
15
15
  PageProps,
16
16
  NavigationContextValue,
17
+ NavigateOptions,
17
18
  PluginSearch,
18
19
  NavigationGuardHandler,
19
20
  } from './types';
@@ -27,6 +27,10 @@ export interface RouteSearchByToken {
27
27
  extensions: Record<string, never>;
28
28
  interactions: Record<string, never>;
29
29
  notifications: Record<string, never>;
30
+ // The conversation monitor's drill state: `route` picks a conversation route,
31
+ // `thread` opens one of its transcripts. A `thread` with no `route` names
32
+ // nothing readable, and the page repairs it away.
33
+ conversations: { route?: string; thread?: string };
30
34
  connectors: { connection?: string };
31
35
  hooks: Record<string, never>;
32
36
  templates: { template?: string };
@@ -85,12 +89,28 @@ export interface PageProps<T extends RouteToken> {
85
89
  */
86
90
  export type PluginSearch = Record<string, unknown>;
87
91
 
92
+ /**
93
+ * How a token navigation enters session history.
94
+ *
95
+ * The default is a PUSH: a move the reader made, which Back must be able to undo.
96
+ * `replace` overwrites the current entry instead, and is for a transition the
97
+ * reader did NOT make — a page rewriting an unrenderable URL of its own accord.
98
+ * Pushing such a rewrite leaves the URL it rewrote sitting behind Back, where
99
+ * pressing Back rewrites it again and pushes again: a page no Back can leave.
100
+ */
101
+ export interface NavigateOptions {
102
+ /** Overwrite the current history entry instead of pushing a new one. */
103
+ readonly replace?: boolean;
104
+ }
105
+
88
106
  /**
89
107
  * The runtime navigation surface the shell provides through
90
- * {@link NavigationProvider}. `navigate` performs a client-side transition;
91
- * `resolvePath` produces the href a link should point at (so an AppLink is a real
92
- * anchor — middle-click / open-in-new-tab work — while still driving a
93
- * client-side transition on plain click).
108
+ * {@link NavigationProvider}. `navigate` performs a client-side transition, by
109
+ * default pushing a history entry — see {@link NavigateOptions} for the third
110
+ * argument that replaces one instead. `resolvePath` produces the href a link
111
+ * should point at (so an AppLink is a real anchor — middle-click /
112
+ * open-in-new-tab work — while still driving a client-side transition on plain
113
+ * click).
94
114
  *
95
115
  * `navigatePlugin`/`resolvePluginPath` are the plugin-page twins: they target a
96
116
  * runtime plugin path (`/plugins/{pluginId}/{pagePath}` plus an optional validated
@@ -98,7 +118,11 @@ export type PluginSearch = Record<string, unknown>;
98
118
  * plugin paths. Plugins reach these two via the {@link usePluginNavigation} hook.
99
119
  */
100
120
  export interface NavigationContextValue {
101
- navigate: <T extends RouteToken>(token: T, search?: RouteSearch<T>) => void;
121
+ navigate: <T extends RouteToken>(
122
+ token: T,
123
+ search?: RouteSearch<T>,
124
+ options?: NavigateOptions,
125
+ ) => void;
102
126
  resolvePath: <T extends RouteToken>(token: T, search?: RouteSearch<T>) => string;
103
127
  navigatePlugin: (
104
128
  pluginId: string,