@workbench-kit/shell-react 0.0.2-prototype.0.2.6 → 0.0.2-prototype.0.2.8

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 (95) hide show
  1. package/README.md +41 -0
  2. package/package.json +9 -9
  3. package/src/{chat-ai-mock-proposals.ts → chat/ai-mock-proposals.ts} +39 -39
  4. package/src/{chat-command-input.ts → chat/command-input.ts} +52 -52
  5. package/src/{chat-command-policy.ts → chat/command-policy.ts} +54 -54
  6. package/src/{chat-command-surface.tsx → chat/command-surface.tsx} +155 -155
  7. package/src/{use-workbench-chat-command-proposals.ts → chat/use-chat-command-proposals.ts} +194 -194
  8. package/src/{chat-view-data.ts → chat/view-data.ts} +20 -20
  9. package/src/{chat-view.tsx → chat/view.tsx} +220 -220
  10. package/src/{command-inspector-surface.tsx → commands/inspector-surface.tsx} +46 -46
  11. package/src/{use-workbench-command-descriptors.ts → commands/use-command-descriptors.ts} +41 -41
  12. package/src/{use-context-key-revision.ts → commands/use-context-key-revision.ts} +18 -18
  13. package/src/{commands-view-data.ts → commands/view-data.ts} +17 -17
  14. package/src/{commands-view.tsx → commands/view.tsx} +43 -43
  15. package/src/devtools/WorkbenchDevtoolsPanel.tsx +124 -124
  16. package/src/devtools/WorkbenchDevtoolsShell.tsx +17 -17
  17. package/src/devtools/index.ts +11 -11
  18. package/src/devtools/use-workbench-devtools-snapshot.ts +84 -84
  19. package/src/devtools/workbench-devtools-snapshot.ts +140 -140
  20. package/src/devtools/workbench-devtools.css +82 -82
  21. package/src/{editor-area-dnd.ts → editor/area-dnd.ts} +69 -69
  22. package/src/{editor-area-model.ts → editor/area-model.ts} +71 -71
  23. package/src/{editor-area.css → editor/area.css} +454 -454
  24. package/src/{editor-area.tsx → editor/area.tsx} +676 -676
  25. package/src/{editor-host-surface.tsx → editor/host-surface.tsx} +631 -634
  26. package/src/{editor-pane-visibility.ts → editor/pane-visibility.ts} +130 -130
  27. package/src/{editor-resource.ts → editor/resource.ts} +36 -36
  28. package/src/{editor-state-storage.ts → editor/state-storage.ts} +182 -193
  29. package/src/{editor-tab-context-menu.ts → editor/tab-context-menu.ts} +118 -118
  30. package/src/{use-editor.ts → editor/use-editor.ts} +114 -107
  31. package/src/{editor-view-providers.tsx → editor/view-providers.tsx} +552 -552
  32. package/src/{editor-workspace-file-availability.ts → editor/workspace-file-availability.ts} +15 -15
  33. package/src/{editor-workspace-reconcile.tsx → editor/workspace-reconcile.tsx} +31 -28
  34. package/src/{explorer-context-menu.ts → explorer/context-menu.ts} +114 -114
  35. package/src/{createCommandWorkspaceExplorerPort.ts → explorer/create-command-workspace-explorer-port.ts} +86 -86
  36. package/src/{explorer-reveal.ts → explorer/reveal.ts} +112 -112
  37. package/src/{search-view-data.ts → explorer/search-view-data.ts} +15 -15
  38. package/src/{search-view.tsx → explorer/search-view.tsx} +65 -62
  39. package/src/{use-active-workspace-path.ts → explorer/use-active-workspace-path.ts} +15 -15
  40. package/src/{explorer-view-data.ts → explorer/view-data.ts} +58 -58
  41. package/src/{explorer-view.tsx → explorer/view.tsx} +227 -224
  42. package/src/{extension-context-menu.ts → extensions/context-menu.ts} +52 -52
  43. package/src/{extension-management-model.ts → extensions/management-model.ts} +313 -313
  44. package/src/{use-extension-management.ts → extensions/use-extension-management.ts} +241 -193
  45. package/src/{extensions-view-data.ts → extensions/view-data.ts} +19 -19
  46. package/src/{extensions-view.tsx → extensions/view.tsx} +63 -38
  47. package/src/{field-remap-demo.tsx → field-remap/demo.tsx} +18 -18
  48. package/src/{field-remap-editor-surface.tsx → field-remap/editor-surface.tsx} +36 -36
  49. package/src/{field-remap-flow-adapter.ts → field-remap/flow-adapter.ts} +240 -240
  50. package/src/{field-remap-flow.tsx → field-remap/flow.tsx} +369 -369
  51. package/src/{field-remap-graph.tsx → field-remap/graph.tsx} +559 -559
  52. package/src/field-remap/jsonata-transform.ts +166 -0
  53. package/src/{field-remap-panel.tsx → field-remap/panel.tsx} +193 -175
  54. package/src/{field-remap-samples.ts → field-remap/samples.ts} +352 -352
  55. package/src/{table-mapping-adapter.ts → field-remap/table-mapping-adapter.ts} +59 -59
  56. package/src/{field-remap-tree.tsx → field-remap/tree.tsx} +404 -404
  57. package/src/{field-remap-view-data.ts → field-remap/view-data.ts} +16 -16
  58. package/src/{field-remap-view.css → field-remap/view.css} +676 -676
  59. package/src/{field-remap-view.tsx → field-remap/view.tsx} +86 -86
  60. package/src/index.ts +212 -199
  61. package/src/{json-form-source-patch.ts → jdw/json-form-source-patch.ts} +323 -323
  62. package/src/{jdw-lab-view-data.ts → jdw/lab-view-data.ts} +25 -25
  63. package/src/{jdw-lab-view.css → jdw/lab-view.css} +21 -21
  64. package/src/{jdw-lab-view.tsx → jdw/lab-view.tsx} +79 -79
  65. package/src/{jdw-widget-form-view.tsx → jdw/widget-form-view.tsx} +68 -65
  66. package/src/{jdw-widget-preview-view.tsx → jdw/widget-preview-view.tsx} +54 -51
  67. package/src/{keybinding-overrides-storage.ts → management/keybinding-overrides-storage.ts} +49 -57
  68. package/src/{keybinding-management-settings.tsx → management/keybinding-settings.tsx} +16 -16
  69. package/src/{management-palette-commands.ts → management/palette-commands.ts} +38 -38
  70. package/src/{preference-settings-storage.ts → management/preference-settings-storage.ts} +50 -58
  71. package/src/{management-settings-ids.ts → management/settings-ids.ts} +12 -12
  72. package/src/{management-settings.tsx → management/settings.tsx} +96 -75
  73. package/src/{use-command-management.ts → management/use-command-management.ts} +191 -191
  74. package/src/{use-keybinding-management.ts → management/use-keybinding-management.ts} +130 -130
  75. package/src/{shell-model.tsx → shell/model.tsx} +149 -149
  76. package/src/{provider.tsx → shell/provider.tsx} +603 -573
  77. package/src/{shell-secondary-actions.tsx → shell/secondary-actions.tsx} +59 -59
  78. package/src/{shell-settings-constants.ts → shell/settings-constants.ts} +9 -9
  79. package/src/{shell-settings.tsx → shell/settings.tsx} +599 -599
  80. package/src/{shell.tsx → shell/shell.tsx} +680 -649
  81. package/src/{shell-titlebar-layout-controls.tsx → shell/titlebar-layout-controls.tsx} +4 -4
  82. package/src/{shell-view-host.tsx → shell/view-host.tsx} +212 -199
  83. package/src/{workbench-appearance-storage.ts → workbench/appearance-storage.ts} +107 -115
  84. package/src/{workbench-command-host.tsx → workbench/command-host.tsx} +243 -243
  85. package/src/{workbench-command-palette.ts → workbench/command-palette.ts} +208 -208
  86. package/src/{workbench-keybinding-bridge.ts → workbench/keybinding-bridge.ts} +54 -54
  87. package/src/{workbench-layout-storage.ts → workbench/layout-storage.ts} +134 -145
  88. package/src/{workbench-profile-modal.tsx → workbench/profile-modal.tsx} +118 -118
  89. package/src/{workbench-shell-command-registration.ts → workbench/shell-command-registration.ts} +58 -58
  90. package/src/{workbench-startup-gate.tsx → workbench/startup-gate.tsx} +136 -136
  91. package/src/{workbench-status-sections.ts → workbench/status-sections.ts} +43 -43
  92. package/src/{use-persisted-workbench-appearance.ts → workbench/use-persisted-appearance.ts} +33 -33
  93. package/src/{workbench-user-commands.ts → workbench/user-commands.ts} +46 -46
  94. package/src/{workspace-view-state.ts → workbench/workspace-view-state.ts} +35 -35
  95. package/src/jsonata-transform.ts +0 -36
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # `@workbench-kit/shell-react`
2
+
3
+ React shell and host assembly for Workbench Kit: `WorkbenchProvider`,
4
+ `WorkbenchShell`, editor area wiring, layout/appearance persistence helpers, and
5
+ settings/profile/help composition.
6
+
7
+ Published on npm with the **`prototype`** dist tag.
8
+
9
+ ## Install
10
+
11
+ ```powershell
12
+ pnpm add @workbench-kit/shell-react@prototype @workbench-kit/react@prototype @workbench-kit/tokens@prototype
13
+ ```
14
+
15
+ Peer: React 19.
16
+
17
+ ## Quick start
18
+
19
+ ```tsx
20
+ import { WorkbenchProvider, WorkbenchShell } from '@workbench-kit/shell-react';
21
+
22
+ export function App() {
23
+ return (
24
+ <WorkbenchProvider>
25
+ <WorkbenchShell title="Workbench" primarySidebar={<aside />} />
26
+ </WorkbenchProvider>
27
+ );
28
+ }
29
+ ```
30
+
31
+ Prefer this package when the host needs provider + shell orchestration. For
32
+ layout-only chrome without host services, start from
33
+ `@workbench-kit/react/workbench/shell` — see
34
+ [Getting Started](../../docs/guides/getting-started.md).
35
+
36
+ ## Related docs
37
+
38
+ - [Component Map](../../docs/guides/component-map.md)
39
+ - [Sample Screens](../../docs/guides/sample-screens.md)
40
+ - [Consumer Capabilities](../../docs/workbench/consumer-capabilities.md)
41
+ - Sample host: [`examples/workbench-sample`](../../examples/workbench-sample/README.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workbench-kit/shell-react",
3
- "version": "0.0.2-prototype.0.2.6",
3
+ "version": "0.0.2-prototype.0.2.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,15 +17,15 @@
17
17
  "@radix-ui/react-select": "^2.3.4",
18
18
  "@radix-ui/react-slot": "^1.3.0",
19
19
  "@xyflow/react": "^12.11.2",
20
- "jsonata": "^1.8.7",
20
+ "jsonata": "^2.2.0",
21
21
  "react-table-mapping": "^1.0.3",
22
- "@workbench-kit/react": "0.0.2-prototype.0.2.6",
23
- "@workbench-kit/workbench-config": "0.0.2-prototype.0.2.6",
24
- "@workbench-kit/tokens": "0.0.2-prototype.0.2.6",
25
- "@workbench-kit/field-remap": "0.0.2-prototype.0.2.6",
26
- "@workbench-kit/workspace": "0.0.2-prototype.0.2.6",
27
- "@workbench-kit/platform": "0.0.2-prototype.0.2.6",
28
- "@workbench-kit/workbench-core": "0.0.2-prototype.0.2.6"
22
+ "@workbench-kit/react": "0.0.2-prototype.0.2.8",
23
+ "@workbench-kit/field-remap": "0.0.2-prototype.0.2.8",
24
+ "@workbench-kit/tokens": "0.0.2-prototype.0.2.8",
25
+ "@workbench-kit/workbench-config": "0.0.2-prototype.0.2.8",
26
+ "@workbench-kit/workbench-core": "0.0.2-prototype.0.2.8",
27
+ "@workbench-kit/workspace": "0.0.2-prototype.0.2.8",
28
+ "@workbench-kit/platform": "0.0.2-prototype.0.2.8"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "^19.0.0",
@@ -1,39 +1,39 @@
1
- import type { WorkbenchChatCommandProposalInput } from './use-workbench-chat-command-proposals.js';
2
-
3
- const MOCK_AI_COMMAND_PROPOSALS: readonly WorkbenchChatCommandProposalInput[] = [
4
- {
5
- commandId: 'workbench.showActivity.explorer',
6
- description: 'Focus the Explorer activity in the primary sidebar.',
7
- id: 'mock-proposal-show-explorer',
8
- label: 'Show Explorer',
9
- },
10
- {
11
- commandId: 'workbench.togglePrimarySidebar',
12
- description: 'Toggle the primary sidebar visibility.',
13
- id: 'mock-proposal-toggle-sidebar',
14
- label: 'Toggle Primary Sidebar',
15
- },
16
- ];
17
-
18
- export function createMockAiChatCommandProposals(
19
- userMessage: string,
20
- ): readonly WorkbenchChatCommandProposalInput[] {
21
- const normalized = userMessage.trim().toLocaleLowerCase();
22
- if (!normalized || normalized === 'help') {
23
- return [];
24
- }
25
-
26
- return MOCK_AI_COMMAND_PROPOSALS;
27
- }
28
-
29
- export function createMockAiChatResponseContent(userMessage: string) {
30
- const proposals = createMockAiChatCommandProposals(userMessage);
31
- if (!proposals.length) {
32
- return `Received: ${userMessage}`;
33
- }
34
-
35
- return [
36
- `I can help with "${userMessage.trim()}".`,
37
- 'Review the suggested commands below. Safe commands run automatically; workspace changes require approval.',
38
- ].join('\n\n');
39
- }
1
+ import type { WorkbenchChatCommandProposalInput } from './use-chat-command-proposals.js';
2
+
3
+ const MOCK_AI_COMMAND_PROPOSALS: readonly WorkbenchChatCommandProposalInput[] = [
4
+ {
5
+ commandId: 'workbench.showActivity.explorer',
6
+ description: 'Focus the Explorer activity in the primary sidebar.',
7
+ id: 'mock-proposal-show-explorer',
8
+ label: 'Show Explorer',
9
+ },
10
+ {
11
+ commandId: 'workbench.togglePrimarySidebar',
12
+ description: 'Toggle the primary sidebar visibility.',
13
+ id: 'mock-proposal-toggle-sidebar',
14
+ label: 'Toggle Primary Sidebar',
15
+ },
16
+ ];
17
+
18
+ export function createMockAiChatCommandProposals(
19
+ userMessage: string,
20
+ ): readonly WorkbenchChatCommandProposalInput[] {
21
+ const normalized = userMessage.trim().toLocaleLowerCase();
22
+ if (!normalized || normalized === 'help') {
23
+ return [];
24
+ }
25
+
26
+ return MOCK_AI_COMMAND_PROPOSALS;
27
+ }
28
+
29
+ export function createMockAiChatResponseContent(userMessage: string) {
30
+ const proposals = createMockAiChatCommandProposals(userMessage);
31
+ if (!proposals.length) {
32
+ return `Received: ${userMessage}`;
33
+ }
34
+
35
+ return [
36
+ `I can help with "${userMessage.trim()}".`,
37
+ 'Review the suggested commands below. Safe commands run automatically; workspace changes require approval.',
38
+ ].join('\n\n');
39
+ }
@@ -1,52 +1,52 @@
1
- export type WorkbenchChatCommandInputParseResult =
2
- | { type: 'none' }
3
- | { type: 'unknown'; token: string }
4
- | { commandId: string; message: string; type: 'invalid-arguments' }
5
- | { args: readonly unknown[]; commandId: string; type: 'run' };
6
-
7
- export function parseWorkbenchChatCommandInput(
8
- input: string,
9
- isValidCommandId: (id: string) => boolean,
10
- ): WorkbenchChatCommandInputParseResult {
11
- const trimmed = input.trim();
12
- if (!trimmed.startsWith('/')) {
13
- return { type: 'none' };
14
- }
15
-
16
- const [rawToken] = trimmed.slice(1).split(/\s+/, 1);
17
- if (!rawToken) {
18
- return { token: '', type: 'unknown' };
19
- }
20
-
21
- if (!isValidCommandId(rawToken)) {
22
- return { token: rawToken, type: 'unknown' };
23
- }
24
-
25
- const argumentText = getSlashCommandArgumentText(trimmed, rawToken);
26
- if (!argumentText) {
27
- return {
28
- args: [],
29
- commandId: rawToken,
30
- type: 'run',
31
- };
32
- }
33
-
34
- try {
35
- return {
36
- args: [JSON.parse(argumentText) as unknown],
37
- commandId: rawToken,
38
- type: 'run',
39
- };
40
- } catch {
41
- return {
42
- commandId: rawToken,
43
- message:
44
- 'Command arguments must be valid JSON. Use /command.id {"key":"value"} or /command.id "value".',
45
- type: 'invalid-arguments',
46
- };
47
- }
48
- }
49
-
50
- function getSlashCommandArgumentText(trimmedInput: string, commandId: string) {
51
- return trimmedInput.slice(1 + commandId.length).trim();
52
- }
1
+ export type WorkbenchChatCommandInputParseResult =
2
+ | { type: 'none' }
3
+ | { type: 'unknown'; token: string }
4
+ | { commandId: string; message: string; type: 'invalid-arguments' }
5
+ | { args: readonly unknown[]; commandId: string; type: 'run' };
6
+
7
+ export function parseWorkbenchChatCommandInput(
8
+ input: string,
9
+ isValidCommandId: (id: string) => boolean,
10
+ ): WorkbenchChatCommandInputParseResult {
11
+ const trimmed = input.trim();
12
+ if (!trimmed.startsWith('/')) {
13
+ return { type: 'none' };
14
+ }
15
+
16
+ const [rawToken] = trimmed.slice(1).split(/\s+/, 1);
17
+ if (!rawToken) {
18
+ return { token: '', type: 'unknown' };
19
+ }
20
+
21
+ if (!isValidCommandId(rawToken)) {
22
+ return { token: rawToken, type: 'unknown' };
23
+ }
24
+
25
+ const argumentText = getSlashCommandArgumentText(trimmed, rawToken);
26
+ if (!argumentText) {
27
+ return {
28
+ args: [],
29
+ commandId: rawToken,
30
+ type: 'run',
31
+ };
32
+ }
33
+
34
+ try {
35
+ return {
36
+ args: [JSON.parse(argumentText) as unknown],
37
+ commandId: rawToken,
38
+ type: 'run',
39
+ };
40
+ } catch {
41
+ return {
42
+ commandId: rawToken,
43
+ message:
44
+ 'Command arguments must be valid JSON. Use /command.id {"key":"value"} or /command.id "value".',
45
+ type: 'invalid-arguments',
46
+ };
47
+ }
48
+ }
49
+
50
+ function getSlashCommandArgumentText(trimmedInput: string, commandId: string) {
51
+ return trimmedInput.slice(1 + commandId.length).trim();
52
+ }
@@ -1,54 +1,54 @@
1
- import type {
2
- ResolveWorkbenchCommandExecutionPolicyInput,
3
- WorkbenchCommandExecutionPolicy,
4
- } from '@workbench-kit/react/workbench';
5
- import type { WorkbenchStorageReader } from '@workbench-kit/workbench-core';
6
-
7
- import { readPersistedLocalPreferences } from './preference-settings-storage.js';
8
-
9
- export const WORKBENCH_AI_CHAT_COMMAND_DEFAULT_POLICY_KEY = 'workbench.chat.aiCommandDefaultPolicy';
10
-
11
- function isWorkbenchCommandExecutionPolicy(
12
- value: unknown,
13
- ): value is WorkbenchCommandExecutionPolicy {
14
- return value === 'auto-allow' || value === 'approval-required' || value === 'auto-deny';
15
- }
16
-
17
- export function readWorkbenchAiChatCommandPolicyInput(
18
- storageKey?: string,
19
- storage?: WorkbenchStorageReader,
20
- ): ResolveWorkbenchCommandExecutionPolicyInput {
21
- const preferences = readPersistedLocalPreferences(storageKey, storage);
22
- const configuredDefault = preferences[WORKBENCH_AI_CHAT_COMMAND_DEFAULT_POLICY_KEY];
23
-
24
- return {
25
- defaultPolicy: isWorkbenchCommandExecutionPolicy(configuredDefault)
26
- ? configuredDefault
27
- : undefined,
28
- mutatingDefaultPolicy: 'approval-required',
29
- };
30
- }
31
-
32
- export function createWorkbenchAiChatCommandPolicyById(
33
- entries: Readonly<Record<string, WorkbenchCommandExecutionPolicy>>,
34
- ): ResolveWorkbenchCommandExecutionPolicyInput {
35
- return {
36
- policyByCommandId: entries,
37
- };
38
- }
39
-
40
- export function mergeWorkbenchAiChatCommandPolicyInput(
41
- ...inputs: readonly ResolveWorkbenchCommandExecutionPolicyInput[]
42
- ): ResolveWorkbenchCommandExecutionPolicyInput {
43
- return inputs.reduce<ResolveWorkbenchCommandExecutionPolicyInput>(
44
- (merged, input) => ({
45
- defaultPolicy: input.defaultPolicy ?? merged.defaultPolicy,
46
- mutatingDefaultPolicy: input.mutatingDefaultPolicy ?? merged.mutatingDefaultPolicy,
47
- policyByCommandId: {
48
- ...merged.policyByCommandId,
49
- ...input.policyByCommandId,
50
- },
51
- }),
52
- {},
53
- );
54
- }
1
+ import type {
2
+ ResolveWorkbenchCommandExecutionPolicyInput,
3
+ WorkbenchCommandExecutionPolicy,
4
+ } from '@workbench-kit/react/workbench';
5
+ import type { WorkbenchStorageReader } from '@workbench-kit/workbench-core';
6
+
7
+ import { readPersistedLocalPreferences } from '../management/preference-settings-storage.js';
8
+
9
+ export const WORKBENCH_AI_CHAT_COMMAND_DEFAULT_POLICY_KEY = 'workbench.chat.aiCommandDefaultPolicy';
10
+
11
+ function isWorkbenchCommandExecutionPolicy(
12
+ value: unknown,
13
+ ): value is WorkbenchCommandExecutionPolicy {
14
+ return value === 'auto-allow' || value === 'approval-required' || value === 'auto-deny';
15
+ }
16
+
17
+ export function readWorkbenchAiChatCommandPolicyInput(
18
+ storageKey?: string,
19
+ storage?: WorkbenchStorageReader,
20
+ ): ResolveWorkbenchCommandExecutionPolicyInput {
21
+ const preferences = readPersistedLocalPreferences(storageKey, storage);
22
+ const configuredDefault = preferences[WORKBENCH_AI_CHAT_COMMAND_DEFAULT_POLICY_KEY];
23
+
24
+ return {
25
+ defaultPolicy: isWorkbenchCommandExecutionPolicy(configuredDefault)
26
+ ? configuredDefault
27
+ : undefined,
28
+ mutatingDefaultPolicy: 'approval-required',
29
+ };
30
+ }
31
+
32
+ export function createWorkbenchAiChatCommandPolicyById(
33
+ entries: Readonly<Record<string, WorkbenchCommandExecutionPolicy>>,
34
+ ): ResolveWorkbenchCommandExecutionPolicyInput {
35
+ return {
36
+ policyByCommandId: entries,
37
+ };
38
+ }
39
+
40
+ export function mergeWorkbenchAiChatCommandPolicyInput(
41
+ ...inputs: readonly ResolveWorkbenchCommandExecutionPolicyInput[]
42
+ ): ResolveWorkbenchCommandExecutionPolicyInput {
43
+ return inputs.reduce<ResolveWorkbenchCommandExecutionPolicyInput>(
44
+ (merged, input) => ({
45
+ defaultPolicy: input.defaultPolicy ?? merged.defaultPolicy,
46
+ mutatingDefaultPolicy: input.mutatingDefaultPolicy ?? merged.mutatingDefaultPolicy,
47
+ policyByCommandId: {
48
+ ...merged.policyByCommandId,
49
+ ...input.policyByCommandId,
50
+ },
51
+ }),
52
+ {},
53
+ );
54
+ }