@ha-bits/cortex 1.1.14 → 1.5.86

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.
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@ha-bits/cortex",
3
- "version": "1.1.14",
3
+ "version": "1.5.86",
4
4
  "description": "Cortex - Habits Workflow Executor CLI",
5
- "main": "./pack/index.cjs",
5
+ "main": "./server/main.cjs",
6
6
  "bin": {
7
- "cortex": "./pack/index.cjs",
8
- "ha-bits-cortex": "./pack/index.cjs"
7
+ "cortex": "./server/main.cjs",
8
+ "ha-bits-cortex": "./server/main.cjs"
9
9
  },
10
10
  "files": [
11
- "pack",
11
+ "server",
12
12
  "ui",
13
13
  "package.json",
14
14
  "README.md"
15
15
  ],
16
16
  "scripts": {
17
- "start": "node pack/index.cjs"
17
+ "start": "node server/main.cjs"
18
18
  },
19
19
  "keywords": [
20
20
  "habits",
@@ -34,13 +34,12 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "axios": "^1.6.2",
37
+ "@ha-bits/bindings": "workspace:*",
38
+ "@ha-bits/core": "workspace:*",
39
+ "@ha-bits/cortex-core": "workspace:*",
38
40
  "dotenv": "^16.3.1",
39
41
  "express": "^4.18.2",
40
- "form-data": "^4.0.5",
41
- "qs": "^6.14.0",
42
- "uuid": "^9.0.1",
43
- "winston": "^3.19.0",
42
+ "jszip": "^3.10.1",
44
43
  "yaml": "^2.3.4",
45
44
  "yargs": "^17.7.2"
46
45
  },
package/README.md DELETED
@@ -1,119 +0,0 @@
1
- # @ha-bits/cortex
2
-
3
- Cortex - Habits Workflow Executor Server and CLI
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install -g @ha-bits/cortex
9
- # or
10
- npx @ha-bits/cortex
11
- ```
12
-
13
- ## Usage
14
-
15
- ```bash
16
- npx cortex <command> [options]
17
- # or
18
- npx @ha-bits/cortex <command> [options]
19
- ```
20
-
21
- ### Commands
22
-
23
- #### Start Server
24
-
25
- Start the workflow execution server:
26
-
27
- ```bash
28
- npx cortex server --config ./stack.yaml
29
- npx cortex server -c ./config.json -p 8080
30
- ```
31
-
32
- Options:
33
- - `--config, -c` - Path to config file (looks for config.json in cwd if not specified)
34
- - `--port, -p` - Server port (priority: args > config.json > .env > 3000)
35
- - `--host, -h` - Server host (default: 0.0.0.0)
36
-
37
- #### Execute Workflow
38
-
39
- Execute a workflow directly without starting a server:
40
-
41
- ```bash
42
- # Execute from workflow file
43
- cortex execute ./workflow.json
44
-
45
- # Execute by ID from config
46
- cortex execute --config ./stack.yaml --id my-workflow
47
-
48
- # Execute all workflows
49
- cortex execute --config ./stack.yaml --all
50
-
51
- # Execute with input data
52
- cortex execute --config ./stack.yaml --id my-workflow --input '{"prompt": "Hello"}'
53
- ```
54
-
55
- #### Convert Workflow
56
-
57
- Convert n8n, Activepieces, or Script workflows to Habits format:
58
-
59
- ```bash
60
- cortex convert --input ./n8n-workflow.json --output ./habits.yaml
61
- cortex convert -i ./workflow.json -o ./habits.yaml --env # Generate .env template
62
- ```
63
-
64
- ### Local Development
65
-
66
- ```bash
67
- pnpm nx dev @ha-bits/cortex --config examples/mixed/stack.yaml
68
- ```
69
-
70
- ## API Endpoints
71
-
72
- ### Workflow Management
73
- - `GET /misc/workflows` - List all loaded workflows
74
- - `GET /misc/workflow/:workflowId` - Get workflow details
75
-
76
- ### Workflow Execution
77
- - `POST /api/:workflowId` - Execute a workflow
78
- - Query params: `?stream=true` for streaming response (NDJSON)
79
- - `GET /misc/execution/:id` - Get execution status
80
- - `GET /misc/executions` - List all executions
81
- - `DELETE /misc/execution/:id` - Cancel execution
82
-
83
- ### Webhooks
84
- - `GET /webhook/health` - Webhook subsystem health
85
- - `GET /webhook/list` - List registered webhook endpoints
86
- - `ALL /webhook/:workflowId/:nodeId` - Webhook trigger endpoints
87
-
88
- ### Health
89
- - `GET /health` - Server health check
90
- - `GET /misc/health` - Alternative health endpoint
91
-
92
- ## Technical Notes
93
-
94
- ### Dynamic Module Loading
95
-
96
- Cortex uses `createRequire` from Node.js's `module` API instead of standard `require()` for loading modules at runtime. This is necessary because:
97
-
98
- 1. **Bundler Compatibility**: When bundled with esbuild/webpack/ncc, the bundler transforms `require()` calls and creates a static context that can't resolve runtime paths.
99
-
100
- 2. **Dynamic Path Resolution**: Modules are downloaded to `/tmp/habits-nodes/` (or `HABITS_NODES_PATH`) at runtime, and their paths aren't known at build time.
101
-
102
- 3. **Production Environment**: In bundled production code, regular `require()` would throw "Cannot find module" errors.
103
-
104
- ```typescript
105
- // Instead of: require(dynamicPath) // ❌ Fails in bundled code
106
- // Use:
107
- import { createRequire } from 'module';
108
- const dynamicRequire = createRequire(__filename);
109
- const loadedModule = dynamicRequire(dynamicPath); // ✅ Works in bundled code
110
- ```
111
-
112
- ## License
113
-
114
- Apache-2.0
115
-
116
- ## Repository
117
-
118
- https://github.com/codenteam/habits
119
-