Skip to content

Commit d226cc9

Browse files
feat(observe): add initial package structure and configuration for @flowiseai/observe (#6270)
* feat(observe): add initial package structure and configuration for @flowiseai/observe - Introduced the @flowiseai/observe package with a modular architecture for observing AI agent executions and evaluations. - Added essential files including ESLint and Prettier configurations, Jest setup, and TypeScript configuration. - Created foundational components and documentation for usage, testing, and architecture. - Updated pnpm-lock.yaml with new dependencies for the observe package. This commit sets the groundwork for further development of the observability features. * fix(observe): enhance documentation and improve execution polling logic - Updated README.md to clarify the permissions required for the API token. - Added cleanup logic in ExecutionDetail component to prevent memory leaks by removing event listeners on unmount. - Improved clipboard copy functionality to check for navigator.clipboard availability. - Adjusted useExecutionPoll hook dependencies to include fetchExecution for better stability. - Enhanced unit tests for useExecutionTree and useObserveApi to ensure proper error handling and functionality.
1 parent 34ab4e0 commit d226cc9

54 files changed

Lines changed: 7170 additions & 275 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/observe/.eslintrc.js

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
const features = ['executions']
2+
const crossFeatureRules = features.map((feature) => ({
3+
target: `./src/features/${feature}`,
4+
from: './src/features',
5+
except: [`./${feature}`],
6+
message: 'Features cannot import from other features. Move shared logic to core.'
7+
}))
8+
9+
module.exports = {
10+
root: true,
11+
extends: [
12+
'eslint:recommended',
13+
'plugin:markdown/recommended',
14+
'plugin:react/recommended',
15+
'plugin:react/jsx-runtime',
16+
'plugin:react-hooks/recommended',
17+
'plugin:jsx-a11y/recommended',
18+
'plugin:@typescript-eslint/recommended',
19+
'plugin:prettier/recommended'
20+
],
21+
parser: '@typescript-eslint/parser',
22+
parserOptions: {
23+
ecmaVersion: 'latest',
24+
sourceType: 'module',
25+
ecmaFeatures: {
26+
jsx: true
27+
}
28+
},
29+
settings: {
30+
react: {
31+
version: 'detect'
32+
},
33+
'import/resolver': {
34+
typescript: {
35+
project: './tsconfig.json'
36+
}
37+
}
38+
},
39+
plugins: ['react', 'react-hooks', '@typescript-eslint', 'unused-imports', 'jsx-a11y', 'simple-import-sort', 'import'],
40+
ignorePatterns: ['dist', 'node_modules', 'build', 'vite.config.ts', 'examples/dist', '**/*.json'],
41+
rules: {
42+
'@typescript-eslint/explicit-module-boundary-types': 'off',
43+
'@typescript-eslint/no-explicit-any': 'warn',
44+
'@typescript-eslint/no-unused-vars': 'off',
45+
'no-unused-vars': 'off',
46+
'unused-imports/no-unused-imports': 'warn',
47+
'unused-imports/no-unused-vars': [
48+
'warn',
49+
{
50+
vars: 'all',
51+
varsIgnorePattern: '^_',
52+
args: 'after-used',
53+
argsIgnorePattern: '^_'
54+
}
55+
],
56+
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
57+
'react/prop-types': 'off',
58+
'react/react-in-jsx-scope': 'off',
59+
'simple-import-sort/imports': [
60+
'error',
61+
{
62+
groups: [
63+
['^\\u0000'],
64+
['^react', '^react-dom'],
65+
['^@?\\w'],
66+
['^@/'],
67+
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
68+
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
69+
['^.+\\.?(css|scss)$']
70+
]
71+
}
72+
],
73+
'simple-import-sort/exports': 'error',
74+
'import/first': 'error',
75+
'import/newline-after-import': 'error',
76+
'import/no-duplicates': 'error',
77+
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
78+
'prettier/prettier': 'error',
79+
'no-restricted-imports': [
80+
'error',
81+
{
82+
patterns: [
83+
{
84+
group: ['@/features', '@/features/*'],
85+
message:
86+
'@/features alias is not allowed. Features use relative imports internally; other layers cannot import from features.'
87+
}
88+
]
89+
}
90+
],
91+
'import/no-restricted-paths': [
92+
'error',
93+
{
94+
zones: [
95+
{
96+
target: './src/atoms',
97+
from: './src/features',
98+
message: 'Atoms cannot import from features. Keep atoms dumb and reusable.'
99+
},
100+
{
101+
target: './src/atoms',
102+
from: './src/infrastructure',
103+
message: 'Atoms cannot import from infrastructure. Use props instead of contexts.'
104+
},
105+
{
106+
target: './src/atoms',
107+
from: './src/core',
108+
except: ['./types', './theme', './primitives'],
109+
message: 'Atoms can only import from core/types, core/theme, and core/primitives.'
110+
},
111+
{
112+
target: './src/core',
113+
from: './src/atoms',
114+
message: 'Core is a leaf node and cannot import from atoms.'
115+
},
116+
{
117+
target: './src/core',
118+
from: './src/features',
119+
message: 'Core is a leaf node and cannot import from features.'
120+
},
121+
{
122+
target: './src/core',
123+
from: './src/infrastructure',
124+
message: 'Core is a leaf node and cannot import from infrastructure.'
125+
},
126+
{
127+
target: './src/infrastructure',
128+
from: './src/atoms',
129+
message: 'Infrastructure cannot import from atoms. Move shared code to core.'
130+
},
131+
{
132+
target: './src/infrastructure',
133+
from: './src/features',
134+
message: 'Infrastructure cannot import from features. Move shared code to core.'
135+
},
136+
...crossFeatureRules
137+
]
138+
}
139+
]
140+
},
141+
env: {
142+
browser: true,
143+
es2021: true,
144+
node: true
145+
},
146+
overrides: [
147+
{
148+
files: ['examples/**/*.{js,jsx,ts,tsx}', '**/*.md/**'],
149+
rules: {
150+
'no-console': 'off',
151+
'@typescript-eslint/no-non-null-assertion': 'off',
152+
// Code blocks in docs are illustrative snippets, not compilable modules
153+
'react/jsx-no-undef': 'off',
154+
'no-undef': 'off',
155+
'simple-import-sort/imports': 'off',
156+
'import/first': 'off',
157+
'prettier/prettier': 'off',
158+
'unused-imports/no-unused-vars': 'off'
159+
}
160+
},
161+
{
162+
files: ['src/__test_utils__/**/*.js'],
163+
rules: {
164+
'@typescript-eslint/no-require-imports': 'off'
165+
}
166+
}
167+
]
168+
}

packages/observe/.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 140,
3+
"singleQuote": true,
4+
"jsxSingleQuote": true,
5+
"trailingComma": "none",
6+
"tabWidth": 4,
7+
"semi": false,
8+
"endOfLine": "auto"
9+
}

0 commit comments

Comments
 (0)