From 3fa4d72eca8ec30a25be3f58efdb260a2bf9240d Mon Sep 17 00:00:00 2001 From: Geoff Seemueller Date: Thu, 14 Nov 2024 15:15:07 -0500 Subject: [PATCH] Add TypeScript definitions and update package configuration Added TypeScript type definitions in `lib.d.ts` to improve developer experience and ensure type safety. Updated `package.json` to include the new "types" field and modified `.gitignore` to exclude additional unwanted files. --- .gitignore | 4 +++- lib.d.ts | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 lib.d.ts diff --git a/.gitignore b/.gitignore index e6d5e90..563dc83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /.idea/ -/node_modules/ \ No newline at end of file +/node_modules/ +/prompt.md +/todo diff --git a/lib.d.ts b/lib.d.ts new file mode 100644 index 0000000..f387bbd --- /dev/null +++ b/lib.d.ts @@ -0,0 +1,50 @@ +export interface QueryResult { + confidence: number; + action: string; +} + +export interface LLMService { + query(prompt: string): Promise; +} + +export interface State { + [key: string]: any; +} + +export class DummyLlmService implements LLMService { + query(prompt: string): Promise; +} + +export class WorkflowOperator { + constructor(name: string, operation: (state: State) => Promise); + name: string; + execute(state: State): Promise; +} + +export class ManifoldRegion { + constructor(name: string, operators?: WorkflowOperator[]); + name: string; + operators: WorkflowOperator[]; + adjacentRegions: Set; + addOperator(operator: WorkflowOperator): void; + connectTo(region: ManifoldRegion): void; + getValidOperators(state: State): Promise; +} + +export class NestedManifoldRegion extends ManifoldRegion { + constructor(name: string, nestedManifold: WorkflowFunctionManifold); + nestedManifold: WorkflowFunctionManifold; + navigate(prompt: string): Promise; + executeWorkflow(prompt: string): Promise; +} + +export class WorkflowFunctionManifold { + constructor(llmService: LLMService); + llmService: LLMService; + regions: Map; + currentRegion: ManifoldRegion | NestedManifoldRegion | null; + state: State; + addRegion(region: ManifoldRegion | NestedManifoldRegion): void; + navigate(prompt: string): Promise; + executeWorkflow(prompt: string): Promise; +} diff --git a/package.json b/package.json index f9fe1c7..4b4d8bb 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "description": "for building dynamic, LLM-driven workflows using a region-based execution model", "main": "lib.js", "module": "lib.js", + "types": "lib.d.ts", "exports": { ".": { "import": "./lib.js",