@datalayer/core 0.0.17 → 0.0.18

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 (107) hide show
  1. package/README.md +9 -13
  2. package/lib/client/auth/AuthenticationManager.d.ts +95 -0
  3. package/lib/client/auth/AuthenticationManager.js +214 -0
  4. package/lib/client/auth/index.d.ts +8 -0
  5. package/lib/client/auth/index.js +17 -0
  6. package/lib/client/auth/storage.d.ts +154 -0
  7. package/lib/client/auth/storage.js +447 -0
  8. package/lib/client/auth/strategies.d.ts +54 -0
  9. package/lib/client/auth/strategies.js +238 -0
  10. package/lib/client/auth/types.d.ts +151 -0
  11. package/lib/{examples/index.js → client/auth/types.js} +4 -2
  12. package/lib/client/base.d.ts +3 -0
  13. package/lib/client/base.js +9 -0
  14. package/lib/client/index.d.ts +1 -0
  15. package/lib/client/index.js +2 -0
  16. package/lib/components/auth/Login.d.ts +40 -0
  17. package/lib/components/auth/Login.js +173 -0
  18. package/lib/components/auth/Login.stories.d.ts +54 -0
  19. package/lib/components/auth/Login.stories.js +104 -0
  20. package/lib/components/auth/LoginToken.d.ts +16 -0
  21. package/lib/components/auth/LoginToken.js +63 -0
  22. package/lib/components/auth/index.d.ts +5 -0
  23. package/lib/components/auth/index.js +16 -0
  24. package/lib/components/avatars/BoringAvatar.d.ts +6 -15
  25. package/lib/components/avatars/BoringAvatar.js +30 -34
  26. package/lib/components/avatars/BoringAvatar.stories.d.ts +7 -16
  27. package/lib/components/avatars/UserProfileAvatar.d.ts +1 -6
  28. package/lib/components/avatars/UserProfileAvatar.js +3 -8
  29. package/lib/components/buttons/DownloadCSVButton.d.ts +2 -7
  30. package/lib/components/buttons/DownloadCSVButton.js +1 -5
  31. package/lib/components/buttons/DownloadJsonButton.d.ts +3 -10
  32. package/lib/components/buttons/DownloadJsonButton.js +1 -7
  33. package/lib/components/buttons/UploadButton.d.ts +1 -4
  34. package/lib/components/buttons/UploadButton.js +3 -7
  35. package/lib/components/chat/ChatComponent.js +4 -0
  36. package/lib/components/chat/display/ReasoningPart.js +4 -0
  37. package/lib/components/chat/display/ToolPart.js +4 -0
  38. package/lib/components/chat/display/index.js +4 -0
  39. package/lib/components/chat/handler.js +4 -0
  40. package/lib/components/chat/index.js +4 -0
  41. package/lib/components/display/CenteredSpinner.d.ts +1 -4
  42. package/lib/components/display/CenteredSpinner.js +1 -5
  43. package/lib/components/display/HorizontalCenter.d.ts +1 -4
  44. package/lib/components/display/HorizontalCenter.js +1 -5
  45. package/lib/components/flashes/FlashClosable.d.ts +1 -4
  46. package/lib/components/flashes/FlashClosable.js +1 -5
  47. package/lib/components/flashes/FlashDisclaimer.js +1 -1
  48. package/lib/components/index.d.ts +1 -0
  49. package/lib/components/index.js +1 -0
  50. package/lib/components/notebooks/JupyterNotebook.d.ts +1 -6
  51. package/lib/components/notebooks/JupyterNotebook.js +1 -5
  52. package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -4
  53. package/lib/components/snapshots/RuntimeSnapshotMenu.js +1 -5
  54. package/lib/config/Configuration.js +1 -1
  55. package/lib/examples/CellExample.js +11 -47
  56. package/lib/examples/lexical-theme.css +436 -0
  57. package/lib/examples/notebooks/Matplotlib.ipynb.json +1 -1
  58. package/lib/examples/notebooks/NotebookExample1.ipynb.json +1 -1
  59. package/lib/hooks/useAIJupyterChat.js +4 -0
  60. package/lib/hooks/useBackdrop.d.ts +4 -4
  61. package/lib/hooks/useBackdrop.js +5 -9
  62. package/lib/hooks/useCache.d.ts +5 -1
  63. package/lib/hooks/useCache.js +27 -14
  64. package/lib/hooks/useMobile.js +4 -0
  65. package/lib/hooks/useScreenshot.d.ts +3 -5
  66. package/lib/hooks/useScreenshot.js +1 -8
  67. package/lib/models/Outbound.d.ts +2 -0
  68. package/lib/models/Outbound.js +3 -1
  69. package/lib/state/substates/CoreState.js +1 -1
  70. package/lib/state/substates/IAMState.js +15 -6
  71. package/lib/tools/adapters/agui/AgUIToolAdapter.d.ts +75 -0
  72. package/lib/tools/adapters/agui/AgUIToolAdapter.js +244 -0
  73. package/lib/tools/adapters/agui/index.d.ts +10 -0
  74. package/lib/tools/adapters/agui/index.js +19 -0
  75. package/lib/tools/adapters/agui/lexicalHooks.d.ts +27 -0
  76. package/lib/tools/adapters/agui/lexicalHooks.js +64 -0
  77. package/lib/tools/adapters/agui/notebookHooks.d.ts +27 -0
  78. package/lib/tools/adapters/agui/notebookHooks.js +61 -0
  79. package/lib/tools/index.d.ts +6 -0
  80. package/lib/tools/index.js +18 -0
  81. package/lib/types.js +2 -3
  82. package/lib/utils/cli/index.d.ts +4 -0
  83. package/lib/utils/cli/index.js +13 -0
  84. package/lib/utils/cli/query.d.ts +6 -0
  85. package/lib/utils/cli/query.js +26 -0
  86. package/lib/utils/index.d.ts +1 -0
  87. package/lib/utils/index.js +1 -0
  88. package/package.json +50 -7
  89. package/lib/examples/ChatExample.d.ts +0 -8
  90. package/lib/examples/ChatExample.js +0 -51
  91. package/lib/examples/DatalayerNotebookExample.d.ts +0 -16
  92. package/lib/examples/DatalayerNotebookExample.js +0 -75
  93. package/lib/examples/NativeNavigationExample.d.ts +0 -8
  94. package/lib/examples/NativeNavigationExample.js +0 -97
  95. package/lib/examples/NotebookMutationsKernel.d.ts +0 -2
  96. package/lib/examples/NotebookMutationsKernel.js +0 -115
  97. package/lib/examples/NotebookMutationsServiceManager.d.ts +0 -2
  98. package/lib/examples/NotebookMutationsServiceManager.js +0 -107
  99. package/lib/examples/ReactRouterExample.d.ts +0 -6
  100. package/lib/examples/ReactRouterExample.js +0 -175
  101. package/lib/examples/example-selector.d.ts +0 -22
  102. package/lib/examples/example-selector.js +0 -46
  103. package/lib/examples/index.d.ts +0 -2
  104. package/lib/examples/main.d.ts +0 -1
  105. package/lib/examples/main.js +0 -153
  106. package/lib/examples/notebooks/OutputIPyWidgetsExample.d.ts +0 -145
  107. package/lib/examples/notebooks/OutputIPyWidgetsExample.js +0 -153
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ag-ui/CopilotKit adapter module.
3
+ * Exports: CopilotKit adapters, hooks (useNotebookToolActions, useLexicalToolActions).
4
+ * Note: DefaultExecutor is imported from datalayer-react/tools/core/executor
5
+ *
6
+ * @module tools/adapters/agui
7
+ */
8
+ export * from './AgUIToolAdapter';
9
+ export * from './notebookHooks';
10
+ export * from './lexicalHooks';
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /*
6
+ * Copyright (c) 2021-2025 Datalayer, Inc.
7
+ *
8
+ * MIT License
9
+ */
10
+ /**
11
+ * ag-ui/CopilotKit adapter module.
12
+ * Exports: CopilotKit adapters, hooks (useNotebookToolActions, useLexicalToolActions).
13
+ * Note: DefaultExecutor is imported from datalayer-react/tools/core/executor
14
+ *
15
+ * @module tools/adapters/agui
16
+ */
17
+ export * from './AgUIToolAdapter';
18
+ export * from './notebookHooks';
19
+ export * from './lexicalHooks';
@@ -0,0 +1,27 @@
1
+ import { createAllCopilotKitActions, ActionRegistrar, type UseFrontendToolFn } from './AgUIToolAdapter';
2
+ type ToolExecutionContext = any;
3
+ export { ActionRegistrar, type UseFrontendToolFn };
4
+ /**
5
+ * Hook that creates CopilotKit actions for lexical tools.
6
+ * Returns stable actions array that won't cause re-renders.
7
+ *
8
+ * @param documentId - Document ID (lexical document identifier)
9
+ * @param contextOverrides - Optional context overrides (format, extras, etc.)
10
+ * @returns CopilotKit actions
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Default context (toon format for AI)
15
+ * const actions = useLexicalToolActions("doc-123");
16
+ *
17
+ * // Custom format
18
+ * const actions = useLexicalToolActions("doc-123", { format: 'json' });
19
+ *
20
+ * // With extras
21
+ * const actions = useLexicalToolActions("doc-123", {
22
+ * format: 'toon',
23
+ * extras: { userId: '123', theme: 'dark' }
24
+ * });
25
+ * ```
26
+ */
27
+ export declare function useLexicalToolActions(documentId: string, contextOverrides?: Partial<Omit<ToolExecutionContext, 'executor' | 'documentId'>>): ReturnType<typeof createAllCopilotKitActions>;
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * React hooks and components for ag-ui (CopilotKit) lexical tool registration.
7
+ * Provides: useLexicalToolActions, ActionRegistrar, UseFrontendToolFn.
8
+ *
9
+ * @module tools/adapters/agui/lexicalHooks
10
+ */
11
+ import { useMemo } from 'react';
12
+ // TODO: Re-enable when @datalayer/jupyter-react exports these
13
+ // import type { ToolExecutionContext } from '@datalayer/jupyter-react';
14
+ import { createAllCopilotKitActions, ActionRegistrar, } from './AgUIToolAdapter';
15
+ // TODO: Re-enable when @datalayer/jupyter-react exports these
16
+ // import type { ToolExecutionContext } from '@datalayer/jupyter-react';
17
+ // Import from patched @datalayer/jupyter-lexical package
18
+ import { useLexicalStore, DefaultExecutor as LexicalDefaultExecutor, lexicalToolDefinitions, lexicalToolOperations, } from '@datalayer/jupyter-lexical';
19
+ // Re-export shared types and components for convenience
20
+ export { ActionRegistrar };
21
+ /**
22
+ * Hook that creates CopilotKit actions for lexical tools.
23
+ * Returns stable actions array that won't cause re-renders.
24
+ *
25
+ * @param documentId - Document ID (lexical document identifier)
26
+ * @param contextOverrides - Optional context overrides (format, extras, etc.)
27
+ * @returns CopilotKit actions
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Default context (toon format for AI)
32
+ * const actions = useLexicalToolActions("doc-123");
33
+ *
34
+ * // Custom format
35
+ * const actions = useLexicalToolActions("doc-123", { format: 'json' });
36
+ *
37
+ * // With extras
38
+ * const actions = useLexicalToolActions("doc-123", {
39
+ * format: 'toon',
40
+ * extras: { userId: '123', theme: 'dark' }
41
+ * });
42
+ * ```
43
+ */
44
+ export function useLexicalToolActions(documentId, contextOverrides) {
45
+ // Call useLexicalStore() with no selector to get state object (matches notebook pattern)
46
+ const lexicalStoreState = useLexicalStore();
47
+ // Create LexicalDefaultExecutor (stable reference)
48
+ // Only recreate when documentId changes, not on every state update
49
+ // The executor holds a reference to the store which is always current
50
+ const executor = useMemo(() => new LexicalDefaultExecutor(documentId, lexicalStoreState), [documentId]);
51
+ // Create stable context object with useMemo
52
+ // Defaults: format='toon' for conversational AI responses
53
+ // Can be overridden with contextOverrides parameter
54
+ const context = useMemo(() => ({
55
+ documentId,
56
+ executor,
57
+ format: 'toon', // Default format
58
+ ...contextOverrides, // Override with user-provided values
59
+ }), [documentId, executor, contextOverrides]);
60
+ // Create and return CopilotKit actions (stable reference)
61
+ // Only re-create when context changes (i.e., when documentId or contextOverrides change)
62
+ const actions = useMemo(() => createAllCopilotKitActions(lexicalToolDefinitions, lexicalToolOperations, context), [context]);
63
+ return actions;
64
+ }
@@ -0,0 +1,27 @@
1
+ import { createAllCopilotKitActions, ActionRegistrar, type UseFrontendToolFn } from './AgUIToolAdapter';
2
+ type ToolExecutionContext = any;
3
+ export { ActionRegistrar, type UseFrontendToolFn };
4
+ /**
5
+ * Hook that creates CopilotKit actions for notebook tools.
6
+ * Returns stable actions array that won't cause re-renders.
7
+ *
8
+ * @param documentId - Document ID (notebook identifier)
9
+ * @param contextOverrides - Optional context overrides (format, extras, etc.)
10
+ * @returns CopilotKit actions
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Default context (toon format for AI)
15
+ * const actions = useNotebookToolActions("my-notebook-id");
16
+ *
17
+ * // Custom format
18
+ * const actions = useNotebookToolActions("my-notebook-id", { format: 'json' });
19
+ *
20
+ * // With extras
21
+ * const actions = useNotebookToolActions("my-notebook-id", {
22
+ * format: 'toon',
23
+ * extras: { userId: '123', theme: 'dark' }
24
+ * });
25
+ * ```
26
+ */
27
+ export declare function useNotebookToolActions(documentId: string, contextOverrides?: Partial<Omit<ToolExecutionContext, 'executor' | 'documentId'>>): ReturnType<typeof createAllCopilotKitActions>;
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * React hooks and components for ag-ui (CopilotKit) notebook tool registration.
7
+ * Provides: useNotebookToolActions, ActionRegistrar, UseFrontendToolFn.
8
+ *
9
+ * @module tools/adapters/agui/notebookHooks
10
+ */
11
+ import { useMemo } from 'react';
12
+ // TODO: Re-enable when @datalayer/jupyter-react exports these
13
+ // import type { ToolExecutionContext } from '@datalayer/jupyter-react';
14
+ import { createAllCopilotKitActions, ActionRegistrar, } from './AgUIToolAdapter';
15
+ // Import from patched @datalayer/jupyter-react package
16
+ import { notebookStore2, DefaultExecutor, notebookToolDefinitions, notebookToolOperations, } from '@datalayer/jupyter-react';
17
+ // Hook wrapper to get notebook store state
18
+ const useNotebookStore2 = () => notebookStore2.getState();
19
+ // Re-export shared types and components for convenience
20
+ export { ActionRegistrar };
21
+ /**
22
+ * Hook that creates CopilotKit actions for notebook tools.
23
+ * Returns stable actions array that won't cause re-renders.
24
+ *
25
+ * @param documentId - Document ID (notebook identifier)
26
+ * @param contextOverrides - Optional context overrides (format, extras, etc.)
27
+ * @returns CopilotKit actions
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Default context (toon format for AI)
32
+ * const actions = useNotebookToolActions("my-notebook-id");
33
+ *
34
+ * // Custom format
35
+ * const actions = useNotebookToolActions("my-notebook-id", { format: 'json' });
36
+ *
37
+ * // With extras
38
+ * const actions = useNotebookToolActions("my-notebook-id", {
39
+ * format: 'toon',
40
+ * extras: { userId: '123', theme: 'dark' }
41
+ * });
42
+ * ```
43
+ */
44
+ export function useNotebookToolActions(documentId, contextOverrides) {
45
+ const notebookStore = useNotebookStore2();
46
+ // Create DefaultExecutor (stable reference)
47
+ // Only recreate when documentId changes, not on every state update
48
+ // The executor holds a reference to the store which is always current
49
+ const executor = useMemo(() => new DefaultExecutor(documentId, notebookStore), [documentId]);
50
+ // Create stable context object with useMemo
51
+ // Defaults: format='toon' for conversational AI responses
52
+ // Can be overridden with contextOverrides parameter
53
+ const context = useMemo(() => ({
54
+ documentId,
55
+ executor,
56
+ format: 'toon', // Default format
57
+ ...contextOverrides, // Override with user-provided values
58
+ }), [documentId, executor, contextOverrides]);
59
+ // Create and return CopilotKit actions (stable reference)
60
+ return useMemo(() => createAllCopilotKitActions(notebookToolDefinitions, notebookToolOperations, context), [context]);
61
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Platform-agnostic tools for notebook and lexical integration with AI frameworks
3
+ *
4
+ * @module tools
5
+ */
6
+ export * from './adapters/agui';
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Platform-agnostic tools for notebook and lexical integration with AI frameworks
7
+ *
8
+ * @module tools
9
+ */
10
+ // Export adapters
11
+ export * from './adapters/agui';
12
+ // TODO: Re-export tool types from jupyter-react when available
13
+ // export type {
14
+ // ToolDefinition,
15
+ // ToolConfig,
16
+ // ToolOperation,
17
+ // ToolExecutionContext,
18
+ // } from '@datalayer/jupyter-react';
package/lib/types.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2024-2025 Datalayer, Inc.
3
- *
4
- * BSD 3-Clause License
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
5
4
  */
6
5
  export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * CLI utilities
3
+ */
4
+ export * from './query';
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /*
6
+ * Copyright (c) 2021-2024 Datalayer, Inc.
7
+ *
8
+ * Datalayer License
9
+ */
10
+ /**
11
+ * CLI utilities
12
+ */
13
+ export * from './query';
@@ -0,0 +1,6 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ /**
3
+ * Shared QueryClient instance for TanStack Query
4
+ * Used across the application for consistent cache management
5
+ */
6
+ export declare const queryClient: QueryClient;
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /*
6
+ * Copyright (c) 2021-2024 Datalayer, Inc.
7
+ *
8
+ * Datalayer License
9
+ */
10
+ import { QueryClient } from '@tanstack/react-query';
11
+ /**
12
+ * Shared QueryClient instance for TanStack Query
13
+ * Used across the application for consistent cache management
14
+ */
15
+ export const queryClient = new QueryClient({
16
+ defaultOptions: {
17
+ queries: {
18
+ staleTime: 1000 * 60 * 5, // 5 minutes
19
+ refetchOnMount: false, // Don't refetch on mount if data is still fresh
20
+ refetchOnWindowFocus: false,
21
+ retry: 1,
22
+ // Ensure queries prioritize cache over network when data is fresh
23
+ networkMode: 'online',
24
+ },
25
+ },
26
+ });
@@ -1,6 +1,7 @@
1
1
  export * from './Array';
2
2
  export * from './Avatar';
3
3
  export * from './Browser';
4
+ export * from './cli';
4
5
  export * from './Cookie';
5
6
  export * from './Cells';
6
7
  export * from './Date';
@@ -5,6 +5,7 @@
5
5
  export * from './Array';
6
6
  export * from './Avatar';
7
7
  export * from './Browser';
8
+ export * from './cli';
8
9
  export * from './Cookie';
9
10
  export * from './Cells';
10
11
  export * from './Date';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/core",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",
@@ -48,6 +48,7 @@
48
48
  "clean": "rimraf lib dist build tsconfig.tsbuildinfo",
49
49
  "clean:lib": "rimraf lib tsconfig.tsbuildinfo",
50
50
  "clean:dist": "rimraf dist",
51
+ "clean:cache": "rimraf node_modules/.vite",
51
52
  "build": "npm run clean && gulp resources-to-lib && tsc -b && vite build",
52
53
  "build:lib": "npm run clean:lib && gulp resources-to-lib && tsc -b",
53
54
  "build:types": "npm run clean:lib && tsc -b",
@@ -84,23 +85,50 @@
84
85
  "watch:lib:res": "gulp resources-to-lib-watch",
85
86
  "watch:lib:src": "tsc -b -w",
86
87
  "type-check:watch": "tsc -b -w --noEmit",
87
- "example": "vite --config vite.examples.config.ts",
88
- "example:chat": "run-p jupyter:start example:chat:vite",
89
- "example:chat:vite": "EXAMPLE=ChatExample vite --config vite.examples.config.ts",
90
- "example:nextjs": "npm run dev --workspace=nextjs-notebook-example",
88
+ "examples": "vite --config vite.examples.config.ts",
89
+ "examples:chat": "run-p jupyter:start example:chat:vite",
90
+ "examples:chat:vite": "EXAMPLE=ChatExample vite --config vite.examples.config.ts",
91
+ "examples:nextjs": "npm run dev --workspace=nextjs-notebook-example",
91
92
  "jupyter:start": "./dev/sh/start-jupyter-server.sh",
92
93
  "prepare": "husky",
93
- "kill": "./dev/sh/kill.sh || true"
94
+ "postinstall": "bash scripts/apply-patches.sh",
95
+ "kill": "./dev/sh/kill.sh || true",
96
+ "sync:jupyter": "bash scripts/sync-jupyter.sh",
97
+ "sync:jupyter:watch": "bash scripts/sync-jupyter.sh --watch",
98
+ "create:patches": "bash scripts/create-patches.sh",
99
+ "apply:patches": "bash scripts/apply-patches.sh",
100
+ "examples:fresh": "npm run clean:cache && npm run examples",
101
+ "rebuild:fresh": "npm run create:patches && npm install && npm run build && npm run clean:cache"
94
102
  },
95
103
  "dependencies": {
96
104
  "@ai-sdk/react": "^2.0.34",
105
+ "@copilotkit/react-core": "^1.10.6",
106
+ "@copilotkit/react-ui": "^1.10.6",
97
107
  "@datalayer/icons-react": "^1.0.6",
98
- "@datalayer/jupyter-react": "^1.1.0",
108
+ "@datalayer/jupyter-lexical": "^1.0.6",
109
+ "@datalayer/jupyter-react": "^1.1.8",
99
110
  "@datalayer/primer-addons": "^1.0.4",
100
111
  "@datalayer/primer-rjsf": "^1.0.1",
112
+ "@jupyter-widgets/base-manager": "^1.0.12",
113
+ "@jupyter-widgets/schema": "^0.5.6",
114
+ "@jupyterlab/apputils": "^4.6.0",
115
+ "@jupyterlab/cells": "^4.5.0",
116
+ "@jupyterlab/codeeditor": "^4.5.0",
101
117
  "@jupyterlab/coreutils": "^6.0.0",
118
+ "@jupyterlab/documentsearch": "^4.5.0",
119
+ "@jupyterlab/rendermime": "^4.5.0",
102
120
  "@jupyterlab/services": "^7.0.0",
121
+ "@jupyterlab/translation": "^4.5.0",
122
+ "@jupyterlab/ui-components": "^4.5.0",
103
123
  "@jupyterlite/javascript-kernel-extension": "^0.3.0",
124
+ "@lumino/commands": "^2.3.3",
125
+ "@lumino/coreutils": "^2.2.2",
126
+ "@lumino/datagrid": "^2.5.3",
127
+ "@lumino/disposable": "^2.1.5",
128
+ "@lumino/polling": "^2.1.5",
129
+ "@lumino/signaling": "^2.1.5",
130
+ "@lumino/widgets": "^2.7.2",
131
+ "@primer/behaviors": "^1.8.4",
104
132
  "@primer/brand-primitives": "^0.51.0",
105
133
  "@primer/css": "^21.5.1",
106
134
  "@primer/octicons-react": "^19.15.1",
@@ -108,13 +136,18 @@
108
136
  "@primer/react": "^37.19.0",
109
137
  "@primer/react-brand": "^0.58.0",
110
138
  "@stripe/react-stripe-js": "^2.7.1",
139
+ "@stripe/stripe-js": "^4.0.0",
140
+ "@styled-system/css": "^5.1.5",
111
141
  "@tailwindcss/vite": "^4.1.13",
112
142
  "@tanstack/react-query": "^5.90.6",
143
+ "@toon-format/toon": "^1.3.0",
113
144
  "ai": "^5.0.78",
145
+ "ansi-to-html": "^0.7.2",
114
146
  "axios": "^1.7.7",
115
147
  "boring-avatars": "^2.0.1",
116
148
  "buffer": "^6.0.3",
117
149
  "date-fns": "^2.29.3",
150
+ "deepmerge": "^4.3.1",
118
151
  "echarts": "^5.5.0",
119
152
  "echarts-for-react": "^3.0.2",
120
153
  "fuse.js": "^7.0.0",
@@ -127,10 +160,13 @@
127
160
  "react": "18.3.1",
128
161
  "react-confetti": "^6.4.0",
129
162
  "react-dom": "18.3.1",
163
+ "react-is": "^19.2.0",
130
164
  "react-toastify": "^11.0.5",
131
165
  "streamdown": "^1.6.6",
166
+ "styled-system": "^5.1.5",
132
167
  "tailwind-merge": "^3.3.1",
133
168
  "tailwindcss": "^4.1.13",
169
+ "tslib": "^2.8.1",
134
170
  "tus-js-client": "^4.2.3",
135
171
  "tw-animate-css": "^1.4.0",
136
172
  "ulid": "^2.3.0",
@@ -138,6 +174,7 @@
138
174
  "usehooks-ts": "^2.9.1",
139
175
  "uuid": "^13.0.0",
140
176
  "validator": "^13.7.0",
177
+ "zod": "^4.1.13",
141
178
  "zustand": "^4.4.1"
142
179
  },
143
180
  "peerDependencies": {
@@ -166,6 +203,8 @@
166
203
  "@vitest/browser": "^3.2.4",
167
204
  "@vitest/coverage-v8": "^3.2.4",
168
205
  "abort-controller": "^3.0.0",
206
+ "autoprefixer": "^10.4.21",
207
+ "buffer": "^6.0.3",
169
208
  "crypto-browserify": "^3.12.1",
170
209
  "dotenv": "^17.2.2",
171
210
  "eslint": "^9.29.0",
@@ -184,6 +223,7 @@
184
223
  "jsdom": "^26.0.0",
185
224
  "lint-staged": "^16.1.5",
186
225
  "npm-run-all": "^4.1.5",
226
+ "patch-package": "^8.0.0",
187
227
  "playwright": "^1.53.2",
188
228
  "prettier": "^3.6.2",
189
229
  "react-router-dom": "^6.22.3",
@@ -219,5 +259,8 @@
219
259
  "src/**/*.{css,json,md}": [
220
260
  "prettier --write"
221
261
  ]
262
+ },
263
+ "optionalDependencies": {
264
+ "keytar": "^7.9.0"
222
265
  }
223
266
  }
@@ -1,8 +0,0 @@
1
- /**
2
- * Chat Example Component
3
- *
4
- * Demonstrates the ChatComponent with all necessary providers:
5
- * - QueryClientProvider for data fetching
6
- */
7
- declare const ChatExample: React.FC;
8
- export default ChatExample;
@@ -1,51 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /*
3
- * Copyright (c) 2024-2025 Datalayer, Inc.
4
- *
5
- * BSD 3-Clause License
6
- */
7
- import { Text } from '@primer/react';
8
- import { Box } from '@datalayer/primer-addons';
9
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
10
- import { ChatComponent } from '../components/chat/ChatComponent';
11
- import { datalayerTheme, DatalayerThemeProvider } from '@/theme';
12
- // Create a query client for React Query
13
- const queryClient = new QueryClient({
14
- defaultOptions: {
15
- queries: {
16
- staleTime: 1000 * 60 * 5, // 5 minutes
17
- gcTime: 1000 * 60 * 10, // 10 minutes
18
- retry: 1,
19
- refetchOnWindowFocus: false,
20
- },
21
- },
22
- });
23
- /**
24
- * Chat Example Component
25
- *
26
- * Demonstrates the ChatComponent with all necessary providers:
27
- * - QueryClientProvider for data fetching
28
- */
29
- const ChatExample = () => {
30
- return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(DatalayerThemeProvider, { theme: datalayerTheme, children: _jsxs(Box, { sx: {
31
- display: 'flex',
32
- flexDirection: 'column',
33
- height: '100vh',
34
- backgroundColor: 'canvas.default',
35
- }, children: [_jsxs(Box, { as: "header", sx: {
36
- borderBottom: '1px solid',
37
- borderColor: 'border.default',
38
- padding: 3,
39
- }, children: [_jsx(Text, { sx: {
40
- fontSize: 3,
41
- fontWeight: 'bold',
42
- display: 'block',
43
- marginBottom: 1,
44
- }, children: "Chat Example" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Interactive chat interface with AI assistance" })] }), _jsx(Box, { as: "main", sx: {
45
- flex: 1,
46
- overflow: 'hidden',
47
- display: 'flex',
48
- flexDirection: 'column',
49
- }, children: _jsx(ChatComponent, {}) })] }) }) }));
50
- };
51
- export default ChatExample;
@@ -1,16 +0,0 @@
1
- import { ServiceManager } from '@jupyterlab/services';
2
- /**
3
- * Example demonstrating how to use Datalayer services with Notebook
4
- *
5
- * This example shows:
6
- * 1. How to create and use DatalayerServiceManager for kernel management
7
- * 2. How to create and use DatalayerCollaborationProvider for real-time collaboration
8
- * 3. How to enable/disable Datalayer collaboration
9
- * 4. How to pass these to the base Notebook component
10
- * 5. Graceful fallback when Datalayer credentials are not available
11
- */
12
- type IDatalayerNotebookExampleProps = {
13
- serviceManager?: ServiceManager.IManager;
14
- };
15
- declare const DatalayerNotebookExample: (props: IDatalayerNotebookExampleProps) => import("react/jsx-runtime").JSX.Element;
16
- export default DatalayerNotebookExample;
@@ -1,75 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /*
3
- * Copyright (c) 2023-2025 Datalayer, Inc.
4
- * Distributed under the terms of the Modified BSD License.
5
- */
6
- import { useState, useEffect, useMemo } from 'react';
7
- import { Box, Checkbox, FormControl, Heading } from '@primer/react';
8
- import { loadJupyterConfig, JupyterReactTheme, Notebook2, } from '@datalayer/jupyter-react';
9
- import { DatalayerCollaborationProvider } from '../collaboration/DatalayerCollaborationProvider';
10
- import { createDatalayerServiceManager } from '../services/DatalayerServiceManager';
11
- import { useCoreStore } from '../state/substates/CoreState';
12
- import nbformatExample from './notebooks/NotebookExample1.ipynb.json';
13
- // This corresponds to the notebook ID in the URL when you open an existing notbook in your library
14
- const NOTEBOOK_ID = '01JZQRQ35GG871QQCZW9TB1A8J';
15
- const DatalayerNotebookExample = (props) => {
16
- // Load config on component mount
17
- loadJupyterConfig();
18
- const [nbformat] = useState(nbformatExample);
19
- const [enableCollaboration, setEnableCollaboration] = useState(false);
20
- const [readonly] = useState(false);
21
- const [serviceManager, setServiceManager] = useState(props.serviceManager);
22
- const { configuration } = useCoreStore();
23
- useEffect(() => {
24
- // Create DatalayerServiceManager if not provided
25
- const createManager = async () => {
26
- if (props.serviceManager) {
27
- // Use provided service manager (should be DatalayerServiceManager from main.tsx)
28
- // Wait for it to be ready
29
- await props.serviceManager.ready;
30
- return;
31
- }
32
- // Create DatalayerServiceManager if we have credentials
33
- if (configuration?.token && configuration?.runUrl) {
34
- try {
35
- console.log('Creating DatalayerServiceManager for Datalayer infrastructure');
36
- // Now we can pass undefined to use config/defaults
37
- const manager = await createDatalayerServiceManager(configuration?.cpuEnvironment, configuration?.credits);
38
- await manager.ready;
39
- setServiceManager(manager);
40
- }
41
- catch (error) {
42
- console.error('Failed to create DatalayerServiceManager:', error);
43
- }
44
- }
45
- else {
46
- console.warn('Datalayer credentials not configured. Please set runUrl and token.');
47
- }
48
- };
49
- createManager();
50
- }, [props.serviceManager, configuration]);
51
- // Create the collaboration provider when enabled
52
- const collaborationProvider = useMemo(() => {
53
- if (!enableCollaboration) {
54
- return undefined;
55
- }
56
- const runUrl = configuration?.runUrl;
57
- const token = configuration?.token;
58
- if (!runUrl || !token) {
59
- console.warn('Datalayer collaboration enabled but runUrl or token not configured. ' +
60
- 'Please configure them in the Datalayer store or environment.');
61
- return undefined;
62
- }
63
- // Create and return the Datalayer collaboration provider
64
- return new DatalayerCollaborationProvider({
65
- runUrl,
66
- token,
67
- });
68
- }, [enableCollaboration, configuration]);
69
- return (_jsx(JupyterReactTheme, { children: _jsxs(Box, { p: 3, children: [_jsx(Heading, { as: "h2", sx: { mb: 3 }, children: "DatalayerNotebook Collaboration Example" }), _jsx(Box, { sx: { mb: 3 }, children: _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: enableCollaboration, onChange: e => setEnableCollaboration(e.target.checked) }), _jsx(FormControl.Label, { children: "Enable Datalayer Collaboration" })] }) }), (!configuration?.runUrl || !configuration?.token) && (_jsx(Box, { sx: { mb: 2, p: 2, bg: 'danger.subtle' }, children: "Warning: Datalayer configuration is missing. Please configure runUrl and token to use DatalayerServiceManager and collaboration features." })), !serviceManager && (_jsx(Box, { sx: { mb: 2, p: 2, bg: 'attention.subtle' }, children: "Note: DatalayerServiceManager is not available. Notebook functionality will be limited." })), _jsx(Box, { sx: {
70
- border: '1px solid',
71
- borderColor: 'border.default',
72
- borderRadius: 2,
73
- }, children: serviceManager ? (_jsx(Notebook2, { id: NOTEBOOK_ID, height: "calc(100vh - 200px)", nbformat: nbformat, readonly: readonly, serviceManager: serviceManager, startDefaultKernel: true, collaborationProvider: collaborationProvider })) : (_jsx(Box, { sx: { p: 4, textAlign: 'center' }, children: "Loading ServiceManager..." })) }), _jsxs(Box, { sx: { mt: 2, fontSize: 1, color: 'fg.subtle' }, children: [_jsx("p", { children: "This example demonstrates how to use Datalayer services with Notebook:" }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "DatalayerServiceManager:" }), " Connects to Datalayer infrastructure for kernel management"] }), _jsxs("li", { children: [_jsx("strong", { children: "DatalayerCollaborationProvider:" }), " Enables real-time collaboration"] }), _jsx("li", { children: "Both require Datalayer credentials (runUrl and token)" }), _jsx("li", { children: "Pass them directly to the base Notebook component" }), _jsx("li", { children: "No wrapper components needed - just create the services and pass them as props" }), _jsx("li", { children: "This shows the explicit, composable pattern for Datalayer integration" })] })] })] }) }));
74
- };
75
- export default DatalayerNotebookExample;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * Native Navigation Example
4
- * This example demonstrates the navigation hooks WITHOUT React Router.
5
- * The hooks should automatically detect the absence of React Router and fall back to native browser navigation.
6
- */
7
- export declare const NativeNavigationExample: React.FC;
8
- export default NativeNavigationExample;