Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix: restore tsc --noEmit clean + cleanup dead refs after nodeDefinitions/ deletion
trohitg598b58bd9d9d
diff --git a/client/src/components/__tests__/CredentialsModal.test.tsx b/client/src/components/__tests__/CredentialsModal.test.tsxindex c46a95b7..52b164ad 100644--- a/client/src/components/__tests__/CredentialsModal.test.tsx+++ b/client/src/components/__tests__/CredentialsModal.test.tsx@@ -14,9 +14,7 @@* so the modal can mount in jsdom without real WS connection / antd transitions.*/-import React from 'react';import { describe, it, expect, vi, beforeEach } from 'vitest';-import { screen } from '@testing-library/react';import userEvent from '@testing-library/user-event';import { renderWithProviders } from '../../test/providers';diff --git a/client/src/components/parameterPanel/__tests__/InputSection.test.tsx b/client/src/components/parameterPanel/__tests__/InputSection.test.tsxindex 52637bbf..4f6fa4d0 100644--- a/client/src/components/parameterPanel/__tests__/InputSection.test.tsx+++ b/client/src/components/parameterPanel/__tests__/InputSection.test.tsx@@ -10,7 +10,6 @@* - Config nodes (memory/tool group) inherit their parent node's main inputs*/-import React from 'react';import { describe, it, expect, vi, beforeEach } from 'vitest';import { render, screen, waitFor } from '@testing-library/react';diff --git a/client/src/components/parameterPanel/__tests__/OutputSection.test.tsx b/client/src/components/parameterPanel/__tests__/OutputSection.test.tsxindex e6e38b21..b720069d 100644--- a/client/src/components/parameterPanel/__tests__/OutputSection.test.tsx+++ b/client/src/components/parameterPanel/__tests__/OutputSection.test.tsx@@ -8,8 +8,7 @@* - visible=false renders nothing*/-import React from 'react';-import { describe, it, expect, vi } from 'vitest';+import { describe, it, expect, vi, beforeEach } from 'vitest';import { screen } from '@testing-library/react';import { renderWithProviders } from '../../../test/providers';diff --git a/client/src/hooks/__tests__/useDragVariable.test.ts b/client/src/hooks/__tests__/useDragVariable.test.tsindex e0f28d28..fda966cd 100644--- a/client/src/hooks/__tests__/useDragVariable.test.ts+++ b/client/src/hooks/__tests__/useDragVariable.test.ts@@ -22,15 +22,11 @@ vi.mock('../../store/useAppStore', () => ({useAppStore: () => storeState,}));-// --- Mock node definitions -----------------------------------------------------vi.mock('../../nodeDefinitions', () => ({- nodeDefinitions: {- cronScheduler: { displayName: 'Cron Scheduler', name: 'cronScheduler' },- httpRequest: { displayName: 'HTTP Request', name: 'httpRequest' },- aiAgent: { displayName: 'AI Agent', name: 'aiAgent' },- },-}));+// nodeDefinitions/ was deleted in commit fc10fd3 — the hook now+// resolves via ``lib/nodeSpec.resolveNodeDescription`` off the+// backend NodeSpec cache. The legacy ``vi.mock("../../nodeDefinitions")``+// used to live here; removed so it can't silently mask a real+// import-path bug.function setWorkflow(nodes: any[]) {diff --git a/client/src/test/nodeDefinitionContract.ts b/client/src/test/nodeDefinitionContract.tsindex 805d8998..de77af89 100644--- a/client/src/test/nodeDefinitionContract.ts+++ b/client/src/test/nodeDefinitionContract.ts@@ -1,9 +1,15 @@/**- * Contract assertions for INodeTypeDescription registry entries.+ * Contract assertions for INodeTypeDescription values.*- * Used by the single sweep test that iterates every node in `nodeDefinitions`- * and verifies its shape - so a refactor that drops `displayName`, mangles- * `displayOptions.show`, or uses the wrong handle naming is caught instantly.+ * Used by the adapter sweep in ``adapters/__tests__/nodeSpecToDescription.test.ts``+ * — each synthetic ``NodeSpec`` is converted via the adapter and the+ * resulting description must satisfy these invariants. A refactor that+ * drops ``displayName``, mangles ``displayOptions.show``, or uses the+ * wrong handle naming fails loudly.+ *+ * The legacy ``validateRegistry`` entry point (which iterated the old+ * ``nodeDefinitions/`` registry) was removed when the frontend registry+ * was deleted in favour of the backend NodeSpec path.*/import type {@@ -19,12 +25,12 @@ export interface ContractIssue {message: string;}-// Wave 10.B: `icon` is now backend-owned (served via NodeSpec from+// Wave 10.B: ``icon`` is backend-owned (served via NodeSpec from// server/models/node_metadata.NODE_METADATA and assembled in// services/node_spec.get_node_spec). The frontend type declares it as-// `icon?: string` and every entry in client/src/nodeDefinitions/*.ts-// has had its icon field stripped. Do NOT add `icon` back to this list ---// the source of truth has moved. See docs-internal/schema_source_of_truth_rfc.md.+// ``icon?: string`` — do NOT add ``icon`` back to this required list;+// the source of truth is the backend. See+// docs-internal/schema_source_of_truth_rfc.md.const REQUIRED_TOP_LEVEL: (keyof INodeTypeDescription)[] = ['displayName','name',@@ -168,16 +174,6 @@ function validateProperty(}}-export function validateRegistry(- registry: Record<string, INodeTypeDescription>,-): ContractIssue[] {- const issues: ContractIssue[] = [];- for (const [key, def] of Object.entries(registry)) {- issues.push(...validateNodeDefinition(key, def));- }- return issues;-}-export function formatIssues(issues: ContractIssue[]): string {if (issues.length === 0) return 'no issues';return issuesdiff --git a/client/src/test/providers.tsx b/client/src/test/providers.tsxindex eabbc79a..e4690f5a 100644--- a/client/src/test/providers.tsx+++ b/client/src/test/providers.tsx@@ -37,17 +37,14 @@ export interface ProvidersOptions {}export function makeTestQueryClient(): QueryClient {+ // TanStack Query v5 dropped the ``logger`` option entirely; global+ // fetch/query errors silently propagate to the nearest error+ // boundary. The old ``logger: {log, warn, error}`` shim is gone.return new QueryClient({defaultOptions: {queries: { retry: false, gcTime: 0, staleTime: 0 },mutations: { retry: false },},- // Silence React Query's default error logging in test runs.- logger: {- log: () => {},- warn: () => {},- error: () => {},- } as any,});}diff --git a/client/src/test/setup.ts b/client/src/test/setup.tsindex 75cfbb9a..afe372e0 100644--- a/client/src/test/setup.ts+++ b/client/src/test/setup.ts@@ -14,7 +14,8 @@ class ResizeObserverStub {}if (typeof globalThis.ResizeObserver === 'undefined') {- // @ts-expect-error - intentional shim+ // TS infers the assignment is fine now (target widened); kept only+ // for the historical note. No @ts-expect-error needed.globalThis.ResizeObserver = ResizeObserverStub;}@@ -46,7 +47,8 @@ if (typeof globalThis.IntersectionObserver === 'undefined') {rootMargin = '';thresholds = [];}- // @ts-expect-error - intentional shim+ // TS infers the assignment is fine now (target widened); kept only+ // for the historical note. No @ts-expect-error needed.globalThis.IntersectionObserver = IntersectionObserverStub;}diff --git a/client/src/types/INodeProperties.ts b/client/src/types/INodeProperties.tsindex 84490833..2362e061 100644--- a/client/src/types/INodeProperties.ts+++ b/client/src/types/INodeProperties.ts@@ -143,7 +143,13 @@ export interface INodeProperties {required?: boolean;noDataExpression?: boolean;- options?: INodePropertyOption[] | INodePropertyCollection[];+ /**+ * Enum choices (``type: "options"`` / ``"multiOptions"``) OR nested+ * child properties for a ``type: "collection"`` container. The+ * collection case lets the adapter nest grouped fields under a+ * collapsible parent (see ``nodeSpecToDescription.groupProperties``).+ */+ options?: INodePropertyOption[] | INodePropertyCollection[] | INodeProperties[];typeOptions?: INodePropertyTypeOptions;displayOptions?: INodePropertyDisplayOptions;validation?: INodePropertyValidation[];diff --git a/scripts/build-node-docs-index.js b/scripts/build-node-docs-index.jsindex e349d49f..c6184e88 100644--- a/scripts/build-node-docs-index.js+++ b/scripts/build-node-docs-index.js@@ -9,7 +9,9 @@* Walks `docs-internal/node-logic-flows/<category>/<node>.md`, scrapes the* first H1 of each doc, and rewrites the AUTO-GENERATED-INDEX block in* README.md. With --check, also cross-references against- * `client/src/nodeDefinitions/` to catch missing docs after a refactor.+ * `server/nodes/` (the plugin tree, post-Wave-11 source of truth) to+ * catch missing docs after a new plugin lands. Pre-Wave-11 this+ * scraped `client/src/nodeDefinitions/`; that folder is gone.*/import fs from 'node:fs';@@ -22,7 +24,10 @@ const __dirname = path.dirname(__filename);const ROOT = path.resolve(__dirname, '..');const DOCS_DIR = path.join(ROOT, 'docs-internal', 'node-logic-flows');const INDEX_FILE = path.join(DOCS_DIR, 'README.md');-const REGISTRY_GLOB = path.join(ROOT, 'client', 'src', 'nodeDefinitions');+// The plugin tree at server/nodes/<category>/<file>.py is the canonical+// list of node types (post-Wave-11). Each plugin class declares+// ``type = "<nodeType>"`` at class scope — we scrape those.+const REGISTRY_GLOB = path.join(ROOT, 'server', 'nodes');const START_MARKER = '<!-- AUTO-GENERATED-INDEX-START -->';const END_MARKER = '<!-- AUTO-GENERATED-INDEX-END -->';@@ -95,22 +100,23 @@ function collectDocumentedKeys() {}function collectRegistryKeys() {- // Scrape the exported *_NODE_TYPES arrays (e.g. SEARCH_NODE_TYPES =- // ['braveSearch', ...]). These are the canonical lists each module- // exports for the registry. Skip parameter `name:` strings and other- // noise by anchoring on `_NODE_TYPES = [...]` / `_NODE_TYPES: [...]`.+ // Scrape the plugin ``type = "<nodeType>"`` class attribute from every+ // Python file under server/nodes/. Skips ``_*.py`` helpers (``_base``,+ // ``_credentials``, ``_inline``) and ``__init__.py``. Each plugin class+ // declares this once at class scope, so a simple line-anchored regex+ // is enough — no full AST parse.const keys = new Set();- const files = walk(REGISTRY_GLOB).filter((f) => f.endsWith('.ts'));- const arrayRe = /[A-Z_]+_NODE_TYPES\s*(?:=|:)\s*\[([^\]]+)\]/g;- const itemRe = /['"]([a-zA-Z_][\w]*)['"]/g;+ const files = walk(REGISTRY_GLOB).filter(+ (f) =>+ f.endsWith('.py') &&+ !path.basename(f).startsWith('_') &&+ path.basename(f) !== '__init__.py',+ );+ const typeRe = /^\s{4}type\s*(?::\s*str\s*)?=\s*['"]([a-zA-Z_][\w]*)['"]/m;for (const f of files) {const text = fs.readFileSync(f, 'utf8');- let m;- while ((m = arrayRe.exec(text))) {- const body = m[1];- let im;- while ((im = itemRe.exec(body))) keys.add(im[1]);- }+ const m = text.match(typeRe);+ if (m) keys.add(m[1]);}return keys;}diff --git a/server/config/node_allowlist.json b/server/config/node_allowlist.jsonindex f9eb5970..43e77a61 100644--- a/server/config/node_allowlist.json+++ b/server/config/node_allowlist.json@@ -1,5 +1,5 @@{- "_comment": "List node types to show in the Component Palette. Empty list or missing file = all nodes shown (default-on). Node type identifiers must match the 'name' field in client/src/nodeDefinitions/*.ts definitions verbatim.",+ "_comment": "List node types to show in the Component Palette. Empty list or missing file = all nodes shown (default-on). Node type identifiers must match the 'type' class attribute on the plugin in server/nodes/<category>/<file>.py verbatim.","enabled_nodes": ["start","chatTrigger",