@generacy-ai/generacy 0.0.0-preview-20260304013206
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/LICENSE +191 -0
- package/README.md +207 -0
- package/bin/generacy.js +11 -0
- package/dist/agency/index.d.ts +68 -0
- package/dist/agency/index.d.ts.map +1 -0
- package/dist/agency/index.js +28 -0
- package/dist/agency/index.js.map +1 -0
- package/dist/agency/network.d.ts +41 -0
- package/dist/agency/network.d.ts.map +1 -0
- package/dist/agency/network.js +133 -0
- package/dist/agency/network.js.map +1 -0
- package/dist/agency/subprocess.d.ts +58 -0
- package/dist/agency/subprocess.d.ts.map +1 -0
- package/dist/agency/subprocess.js +216 -0
- package/dist/agency/subprocess.js.map +1 -0
- package/dist/cli/commands/agent.d.ts +10 -0
- package/dist/cli/commands/agent.d.ts.map +1 -0
- package/dist/cli/commands/agent.js +216 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/doctor/checks/agency-mcp.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/agency-mcp.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/agency-mcp.js +51 -0
- package/dist/cli/commands/doctor/checks/agency-mcp.js.map +1 -0
- package/dist/cli/commands/doctor/checks/anthropic-key.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/anthropic-key.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/anthropic-key.js +68 -0
- package/dist/cli/commands/doctor/checks/anthropic-key.js.map +1 -0
- package/dist/cli/commands/doctor/checks/config.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/config.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/config.js +81 -0
- package/dist/cli/commands/doctor/checks/config.js.map +1 -0
- package/dist/cli/commands/doctor/checks/devcontainer.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/devcontainer.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/devcontainer.js +58 -0
- package/dist/cli/commands/doctor/checks/devcontainer.js.map +1 -0
- package/dist/cli/commands/doctor/checks/docker.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/docker.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/docker.js +71 -0
- package/dist/cli/commands/doctor/checks/docker.js.map +1 -0
- package/dist/cli/commands/doctor/checks/env-file.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/env-file.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/env-file.js +56 -0
- package/dist/cli/commands/doctor/checks/env-file.js.map +1 -0
- package/dist/cli/commands/doctor/checks/github-token.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/github-token.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/github-token.js +99 -0
- package/dist/cli/commands/doctor/checks/github-token.js.map +1 -0
- package/dist/cli/commands/doctor/checks/npm-packages.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/npm-packages.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/npm-packages.js +117 -0
- package/dist/cli/commands/doctor/checks/npm-packages.js.map +1 -0
- package/dist/cli/commands/doctor/formatter.d.ts +27 -0
- package/dist/cli/commands/doctor/formatter.d.ts.map +1 -0
- package/dist/cli/commands/doctor/formatter.js +162 -0
- package/dist/cli/commands/doctor/formatter.js.map +1 -0
- package/dist/cli/commands/doctor/index.d.ts +5 -0
- package/dist/cli/commands/doctor/index.d.ts.map +1 -0
- package/dist/cli/commands/doctor/index.js +8 -0
- package/dist/cli/commands/doctor/index.js.map +1 -0
- package/dist/cli/commands/doctor/registry.d.ts +48 -0
- package/dist/cli/commands/doctor/registry.d.ts.map +1 -0
- package/dist/cli/commands/doctor/registry.js +166 -0
- package/dist/cli/commands/doctor/registry.js.map +1 -0
- package/dist/cli/commands/doctor/runner.d.ts +14 -0
- package/dist/cli/commands/doctor/runner.d.ts.map +1 -0
- package/dist/cli/commands/doctor/runner.js +257 -0
- package/dist/cli/commands/doctor/runner.js.map +1 -0
- package/dist/cli/commands/doctor/types.d.ts +87 -0
- package/dist/cli/commands/doctor/types.d.ts.map +1 -0
- package/dist/cli/commands/doctor/types.js +2 -0
- package/dist/cli/commands/doctor/types.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +12 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +97 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init/conflicts.d.ts +36 -0
- package/dist/cli/commands/init/conflicts.d.ts.map +1 -0
- package/dist/cli/commands/init/conflicts.js +165 -0
- package/dist/cli/commands/init/conflicts.js.map +1 -0
- package/dist/cli/commands/init/github.d.ts +32 -0
- package/dist/cli/commands/init/github.d.ts.map +1 -0
- package/dist/cli/commands/init/github.js +161 -0
- package/dist/cli/commands/init/github.js.map +1 -0
- package/dist/cli/commands/init/index.d.ts +21 -0
- package/dist/cli/commands/init/index.d.ts.map +1 -0
- package/dist/cli/commands/init/index.js +175 -0
- package/dist/cli/commands/init/index.js.map +1 -0
- package/dist/cli/commands/init/prompts.d.ts +15 -0
- package/dist/cli/commands/init/prompts.d.ts.map +1 -0
- package/dist/cli/commands/init/prompts.js +281 -0
- package/dist/cli/commands/init/prompts.js.map +1 -0
- package/dist/cli/commands/init/repo-utils.d.ts +32 -0
- package/dist/cli/commands/init/repo-utils.d.ts.map +1 -0
- package/dist/cli/commands/init/repo-utils.js +112 -0
- package/dist/cli/commands/init/repo-utils.js.map +1 -0
- package/dist/cli/commands/init/resolver.d.ts +20 -0
- package/dist/cli/commands/init/resolver.d.ts.map +1 -0
- package/dist/cli/commands/init/resolver.js +273 -0
- package/dist/cli/commands/init/resolver.js.map +1 -0
- package/dist/cli/commands/init/summary.d.ts +21 -0
- package/dist/cli/commands/init/summary.d.ts.map +1 -0
- package/dist/cli/commands/init/summary.js +100 -0
- package/dist/cli/commands/init/summary.js.map +1 -0
- package/dist/cli/commands/init/types.d.ts +53 -0
- package/dist/cli/commands/init/types.d.ts.map +1 -0
- package/dist/cli/commands/init/types.js +2 -0
- package/dist/cli/commands/init/types.js.map +1 -0
- package/dist/cli/commands/init/writer.d.ts +22 -0
- package/dist/cli/commands/init/writer.d.ts.map +1 -0
- package/dist/cli/commands/init/writer.js +96 -0
- package/dist/cli/commands/init/writer.js.map +1 -0
- package/dist/cli/commands/orchestrator.d.ts +11 -0
- package/dist/cli/commands/orchestrator.d.ts.map +1 -0
- package/dist/cli/commands/orchestrator.js +291 -0
- package/dist/cli/commands/orchestrator.js.map +1 -0
- package/dist/cli/commands/run.d.ts +10 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +167 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/setup/auth.d.ts +11 -0
- package/dist/cli/commands/setup/auth.d.ts.map +1 -0
- package/dist/cli/commands/setup/auth.js +108 -0
- package/dist/cli/commands/setup/auth.js.map +1 -0
- package/dist/cli/commands/setup/build.d.ts +11 -0
- package/dist/cli/commands/setup/build.d.ts.map +1 -0
- package/dist/cli/commands/setup/build.js +212 -0
- package/dist/cli/commands/setup/build.js.map +1 -0
- package/dist/cli/commands/setup/services.d.ts +11 -0
- package/dist/cli/commands/setup/services.d.ts.map +1 -0
- package/dist/cli/commands/setup/services.js +294 -0
- package/dist/cli/commands/setup/services.js.map +1 -0
- package/dist/cli/commands/setup/workspace.d.ts +11 -0
- package/dist/cli/commands/setup/workspace.d.ts.map +1 -0
- package/dist/cli/commands/setup/workspace.js +215 -0
- package/dist/cli/commands/setup/workspace.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +7 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +19 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +10 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +164 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/worker.d.ts +10 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/commands/worker.js +224 -0
- package/dist/cli/commands/worker.js.map +1 -0
- package/dist/cli/index.d.ts +14 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +68 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/config.d.ts +49 -0
- package/dist/cli/utils/config.d.ts.map +1 -0
- package/dist/cli/utils/config.js +110 -0
- package/dist/cli/utils/config.js.map +1 -0
- package/dist/cli/utils/exec.d.ts +39 -0
- package/dist/cli/utils/exec.d.ts.map +1 -0
- package/dist/cli/utils/exec.js +68 -0
- package/dist/cli/utils/exec.js.map +1 -0
- package/dist/cli/utils/logger.d.ts +47 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +97 -0
- package/dist/cli/utils/logger.js.map +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +13 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +104 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +266 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +304 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +160 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validator.d.ts +60 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +112 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/health/server.d.ts +47 -0
- package/dist/health/server.d.ts.map +1 -0
- package/dist/health/server.js +92 -0
- package/dist/health/server.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator/async-event-queue.d.ts +28 -0
- package/dist/orchestrator/async-event-queue.d.ts.map +1 -0
- package/dist/orchestrator/async-event-queue.js +57 -0
- package/dist/orchestrator/async-event-queue.js.map +1 -0
- package/dist/orchestrator/client.d.ts +110 -0
- package/dist/orchestrator/client.d.ts.map +1 -0
- package/dist/orchestrator/client.js +288 -0
- package/dist/orchestrator/client.js.map +1 -0
- package/dist/orchestrator/event-bus.d.ts +195 -0
- package/dist/orchestrator/event-bus.d.ts.map +1 -0
- package/dist/orchestrator/event-bus.js +557 -0
- package/dist/orchestrator/event-bus.js.map +1 -0
- package/dist/orchestrator/heartbeat.d.ts +71 -0
- package/dist/orchestrator/heartbeat.d.ts.map +1 -0
- package/dist/orchestrator/heartbeat.js +116 -0
- package/dist/orchestrator/heartbeat.js.map +1 -0
- package/dist/orchestrator/index.d.ts +25 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +15 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/job-handler.d.ts +109 -0
- package/dist/orchestrator/job-handler.d.ts.map +1 -0
- package/dist/orchestrator/job-handler.js +612 -0
- package/dist/orchestrator/job-handler.js.map +1 -0
- package/dist/orchestrator/job-queue.d.ts +81 -0
- package/dist/orchestrator/job-queue.d.ts.map +1 -0
- package/dist/orchestrator/job-queue.js +206 -0
- package/dist/orchestrator/job-queue.js.map +1 -0
- package/dist/orchestrator/label-monitor-bridge.d.ts +25 -0
- package/dist/orchestrator/label-monitor-bridge.d.ts.map +1 -0
- package/dist/orchestrator/label-monitor-bridge.js +57 -0
- package/dist/orchestrator/label-monitor-bridge.js.map +1 -0
- package/dist/orchestrator/log-buffer.d.ts +74 -0
- package/dist/orchestrator/log-buffer.d.ts.map +1 -0
- package/dist/orchestrator/log-buffer.js +104 -0
- package/dist/orchestrator/log-buffer.js.map +1 -0
- package/dist/orchestrator/redis-job-queue.d.ts +44 -0
- package/dist/orchestrator/redis-job-queue.d.ts.map +1 -0
- package/dist/orchestrator/redis-job-queue.js +300 -0
- package/dist/orchestrator/redis-job-queue.js.map +1 -0
- package/dist/orchestrator/router.d.ts +125 -0
- package/dist/orchestrator/router.d.ts.map +1 -0
- package/dist/orchestrator/router.js +143 -0
- package/dist/orchestrator/router.js.map +1 -0
- package/dist/orchestrator/server.d.ts +62 -0
- package/dist/orchestrator/server.d.ts.map +1 -0
- package/dist/orchestrator/server.js +711 -0
- package/dist/orchestrator/server.js.map +1 -0
- package/dist/orchestrator/types.d.ts +184 -0
- package/dist/orchestrator/types.d.ts.map +1 -0
- package/dist/orchestrator/types.js +6 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/orchestrator/worker-registry.d.ts +110 -0
- package/dist/orchestrator/worker-registry.d.ts.map +1 -0
- package/dist/orchestrator/worker-registry.js +191 -0
- package/dist/orchestrator/worker-registry.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health check HTTP server.
|
|
3
|
+
* Provides /health endpoint for container orchestration.
|
|
4
|
+
*/
|
|
5
|
+
import { type Server } from 'node:http';
|
|
6
|
+
/**
|
|
7
|
+
* Health status response
|
|
8
|
+
*/
|
|
9
|
+
export interface HealthStatus {
|
|
10
|
+
/** Overall status */
|
|
11
|
+
status: 'healthy' | 'busy' | 'unhealthy';
|
|
12
|
+
/** Uptime in milliseconds */
|
|
13
|
+
uptime?: number;
|
|
14
|
+
/** Last heartbeat timestamp */
|
|
15
|
+
lastHeartbeat?: string;
|
|
16
|
+
/** Currently executing job ID */
|
|
17
|
+
currentJob?: string;
|
|
18
|
+
/** Additional metadata */
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Health server options
|
|
23
|
+
*/
|
|
24
|
+
export interface HealthServerOptions {
|
|
25
|
+
/** Port to listen on */
|
|
26
|
+
port: number;
|
|
27
|
+
/** Host to bind to */
|
|
28
|
+
host?: string;
|
|
29
|
+
/** Function to get current health status */
|
|
30
|
+
getStatus: () => HealthStatus;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Health check HTTP server
|
|
34
|
+
*/
|
|
35
|
+
export interface HealthServer {
|
|
36
|
+
/** Start listening */
|
|
37
|
+
listen(): void;
|
|
38
|
+
/** Stop the server */
|
|
39
|
+
close(): void;
|
|
40
|
+
/** Get the underlying HTTP server */
|
|
41
|
+
getServer(): Server;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a health check HTTP server
|
|
45
|
+
*/
|
|
46
|
+
export declare function createHealthServer(options: HealthServerOptions): HealthServer;
|
|
47
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/health/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAgB,KAAK,MAAM,EAA6C,MAAM,WAAW,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;IAEzC,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IAEb,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,4CAA4C;IAC5C,SAAS,EAAE,MAAM,YAAY,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sBAAsB;IACtB,MAAM,IAAI,IAAI,CAAC;IAEf,sBAAsB;IACtB,KAAK,IAAI,IAAI,CAAC;IAEd,qCAAqC;IACrC,SAAS,IAAI,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAqF7E"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health check HTTP server.
|
|
3
|
+
* Provides /health endpoint for container orchestration.
|
|
4
|
+
*/
|
|
5
|
+
import { createServer } from 'node:http';
|
|
6
|
+
/**
|
|
7
|
+
* Create a health check HTTP server
|
|
8
|
+
*/
|
|
9
|
+
export function createHealthServer(options) {
|
|
10
|
+
const { port, host = '0.0.0.0', getStatus } = options;
|
|
11
|
+
const server = createServer((req, res) => {
|
|
12
|
+
// Only handle GET /health
|
|
13
|
+
if (req.method === 'GET' && (req.url === '/health' || req.url === '/health/')) {
|
|
14
|
+
try {
|
|
15
|
+
const status = getStatus();
|
|
16
|
+
const statusCode = status.status === 'unhealthy' ? 503 : 200;
|
|
17
|
+
res.writeHead(statusCode, {
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
20
|
+
});
|
|
21
|
+
res.end(JSON.stringify({
|
|
22
|
+
...status,
|
|
23
|
+
timestamp: new Date().toISOString(),
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
28
|
+
res.end(JSON.stringify({
|
|
29
|
+
status: 'unhealthy',
|
|
30
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
31
|
+
timestamp: new Date().toISOString(),
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (req.method === 'GET' && (req.url === '/ready' || req.url === '/ready/')) {
|
|
36
|
+
// Readiness probe - same as health for now
|
|
37
|
+
try {
|
|
38
|
+
const status = getStatus();
|
|
39
|
+
const statusCode = status.status === 'unhealthy' ? 503 : 200;
|
|
40
|
+
res.writeHead(statusCode, {
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
43
|
+
});
|
|
44
|
+
res.end(JSON.stringify({
|
|
45
|
+
ready: status.status !== 'unhealthy',
|
|
46
|
+
timestamp: new Date().toISOString(),
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
res.writeHead(503, { 'Content-Type': 'application/json' });
|
|
51
|
+
res.end(JSON.stringify({
|
|
52
|
+
ready: false,
|
|
53
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
54
|
+
timestamp: new Date().toISOString(),
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (req.method === 'GET' && (req.url === '/live' || req.url === '/live/')) {
|
|
59
|
+
// Liveness probe - always return OK if server is running
|
|
60
|
+
res.writeHead(200, {
|
|
61
|
+
'Content-Type': 'application/json',
|
|
62
|
+
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
63
|
+
});
|
|
64
|
+
res.end(JSON.stringify({
|
|
65
|
+
alive: true,
|
|
66
|
+
timestamp: new Date().toISOString(),
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// Not found
|
|
71
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
72
|
+
res.end(JSON.stringify({
|
|
73
|
+
error: 'Not found',
|
|
74
|
+
path: req.url,
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
listen() {
|
|
80
|
+
server.listen(port, host, () => {
|
|
81
|
+
console.log(`Health server listening on ${host}:${port}`);
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
close() {
|
|
85
|
+
server.close();
|
|
86
|
+
},
|
|
87
|
+
getServer() {
|
|
88
|
+
return server;
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/health/server.ts"],"names":[],"mappings":"AAAA;;;GA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DAAyD;YACzD,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;gBACjB,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,qCAAqC;aACvD,CAAC,CAAC;YACH,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;gBACrB,KAAK,EAAE,IAAI;gBACX,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACpC,CAAC,CAAC,CAAC;QACN,CAAC;aAAM,CAAC;YACN,YAAY;YACZ,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;YAC3D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;gBACrB,KAAK,EAAE,WAAW;gBAClB,IAAI,EAAE,GAAG,CAAC,GAAG;aACd,CAAC,CAAC,CAAC;QACN,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;YACJ,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;gBAC7B,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;QACL,CAAC;QAED,KAAK;YACH,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;QAED,SAAS;YACP,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy
|
|
3
|
+
*
|
|
4
|
+
* Headless CLI and library for running Generacy workflows.
|
|
5
|
+
* Provides orchestrator integration, agency support, and workflow execution.
|
|
6
|
+
*/
|
|
7
|
+
export { OrchestratorClient, OrchestratorClientError, HeartbeatManager, JobHandler, } from './orchestrator/index.js';
|
|
8
|
+
export type { OrchestratorClientOptions, HeartbeatManagerOptions, WorkerStatus, JobHandlerOptions, Job, JobStatus, JobPriority, JobResult, WorkerRegistration, Heartbeat, HeartbeatResponse, PollResponse, OrchestratorError, } from './orchestrator/index.js';
|
|
9
|
+
export { createAgencyConnection, SubprocessAgency, NetworkAgency, } from './agency/index.js';
|
|
10
|
+
export type { AgencyMode, AgencyConnection, AgencyConnectionOptions, ToolCallRequest, ToolCallResponse, SubprocessAgencyOptions, NetworkAgencyOptions, } from './agency/index.js';
|
|
11
|
+
export { createHealthServer } from './health/server.js';
|
|
12
|
+
export type { HealthStatus, HealthServerOptions, HealthServer } from './health/server.js';
|
|
13
|
+
export { createLogger, getLogger, setLogger, createWorkflowLogger, PinoWorkflowLogger } from './cli/utils/logger.js';
|
|
14
|
+
export type { LogLevel, LoggerOptions } from './cli/utils/logger.js';
|
|
15
|
+
export { resolveConfig, validateConfig, createConfig } from './cli/utils/config.js';
|
|
16
|
+
export type { CLIConfig } from './cli/utils/config.js';
|
|
17
|
+
export { createProgram, run } from './cli/index.js';
|
|
18
|
+
export { ProjectConfigSchema, ReposConfigSchema, DefaultsConfigSchema, OrchestratorSettingsSchema, GeneracyConfigSchema, validateConfig as validateGeneracyConfig, ConfigValidationError, validateNoDuplicateRepos, validateSemantics, loadConfig, findConfigFile, parseConfig, ConfigNotFoundError, ConfigParseError, ConfigSchemaError, } from './config/index.js';
|
|
19
|
+
export type { ProjectConfig, ReposConfig, DefaultsConfig, OrchestratorSettings, GeneracyConfig, LoadConfigOptions, } from './config/index.js';
|
|
20
|
+
export * from '@generacy-ai/workflow-engine';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACv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,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy
|
|
3
|
+
*
|
|
4
|
+
* Headless CLI and library for running Generacy workflows.
|
|
5
|
+
* Provides orchestrator integration, agency support, and workflow execution.
|
|
6
|
+
*/
|
|
7
|
+
// Orchestrator client
|
|
8
|
+
export { OrchestratorClient, OrchestratorClientError, HeartbeatManager, JobHandler, } from './orchestrator/index.js';
|
|
9
|
+
// Agency integration
|
|
10
|
+
export { createAgencyConnection, SubprocessAgency, NetworkAgency, } from './agency/index.js';
|
|
11
|
+
// Health server
|
|
12
|
+
export { createHealthServer } from './health/server.js';
|
|
13
|
+
// CLI utilities
|
|
14
|
+
export { createLogger, getLogger, setLogger, createWorkflowLogger, PinoWorkflowLogger } from './cli/utils/logger.js';
|
|
15
|
+
export { resolveConfig, validateConfig, createConfig } from './cli/utils/config.js';
|
|
16
|
+
// CLI entry point (for programmatic use)
|
|
17
|
+
export { createProgram, run } from './cli/index.js';
|
|
18
|
+
// Config schema and validation
|
|
19
|
+
export { ProjectConfigSchema, ReposConfigSchema, DefaultsConfigSchema, OrchestratorSettingsSchema, GeneracyConfigSchema, validateConfig as validateGeneracyConfig, ConfigValidationError, validateNoDuplicateRepos, validateSemantics, loadConfig, findConfigFile, parseConfig, ConfigNotFoundError, ConfigParseError, ConfigSchemaError, } from './config/index.js';
|
|
20
|
+
// Re-export workflow engine
|
|
21
|
+
export * from '@generacy-ai/workflow-engine';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,sBAAsB;AACtB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,GACX,MAAM,yBAAyB,CAAC;AAkBjC,qBAAqB;AACrB,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAY3B,gBAAgB;AAChB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGrH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGpF,yCAAyC;AACzC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAEpD,+BAA+B;AAC/B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,IAAI,sBAAsB,EACxC,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAW3B,4BAA4B;AAC5B,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded async queue that posts events to the orchestrator.
|
|
3
|
+
* Fire-and-forget: drops oldest events on overflow, never blocks the caller.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AsyncEventQueue {
|
|
6
|
+
private queue;
|
|
7
|
+
private processing;
|
|
8
|
+
private readonly maxSize;
|
|
9
|
+
private readonly postFn;
|
|
10
|
+
constructor(postFn: (jobId: string, event: object) => Promise<void>, maxSize?: number);
|
|
11
|
+
/**
|
|
12
|
+
* Enqueue an event for async posting.
|
|
13
|
+
* Drops the oldest event if the queue is at capacity.
|
|
14
|
+
* Triggers async processing without blocking the caller.
|
|
15
|
+
*/
|
|
16
|
+
push(jobId: string, event: object): void;
|
|
17
|
+
/**
|
|
18
|
+
* Process queued items sequentially.
|
|
19
|
+
* Silently drops events that fail to post (non-critical telemetry).
|
|
20
|
+
* Re-entrant guard ensures only one processing loop runs at a time.
|
|
21
|
+
*/
|
|
22
|
+
private processQueue;
|
|
23
|
+
/**
|
|
24
|
+
* Drain all pending events. Use for graceful shutdown.
|
|
25
|
+
*/
|
|
26
|
+
flush(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=async-event-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-event-queue.d.ts","sourceRoot":"","sources":["../../src/orchestrator/async-event-queue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkD;gBAGvE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EACvD,OAAO,SAAM;IAMf;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAQxC;;;;OAIG;YACW,YAAY;IAiB1B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded async queue that posts events to the orchestrator.
|
|
3
|
+
* Fire-and-forget: drops oldest events on overflow, never blocks the caller.
|
|
4
|
+
*/
|
|
5
|
+
export class AsyncEventQueue {
|
|
6
|
+
queue = [];
|
|
7
|
+
processing = false;
|
|
8
|
+
maxSize;
|
|
9
|
+
postFn;
|
|
10
|
+
constructor(postFn, maxSize = 100) {
|
|
11
|
+
this.postFn = postFn;
|
|
12
|
+
this.maxSize = maxSize;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Enqueue an event for async posting.
|
|
16
|
+
* Drops the oldest event if the queue is at capacity.
|
|
17
|
+
* Triggers async processing without blocking the caller.
|
|
18
|
+
*/
|
|
19
|
+
push(jobId, event) {
|
|
20
|
+
if (this.queue.length >= this.maxSize) {
|
|
21
|
+
this.queue.shift();
|
|
22
|
+
}
|
|
23
|
+
this.queue.push({ jobId, event });
|
|
24
|
+
void this.processQueue();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Process queued items sequentially.
|
|
28
|
+
* Silently drops events that fail to post (non-critical telemetry).
|
|
29
|
+
* Re-entrant guard ensures only one processing loop runs at a time.
|
|
30
|
+
*/
|
|
31
|
+
async processQueue() {
|
|
32
|
+
if (this.processing)
|
|
33
|
+
return;
|
|
34
|
+
this.processing = true;
|
|
35
|
+
try {
|
|
36
|
+
while (this.queue.length > 0) {
|
|
37
|
+
const item = this.queue.shift();
|
|
38
|
+
try {
|
|
39
|
+
await this.postFn(item.jobId, item.event);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Silently drop failed events — non-critical telemetry
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
this.processing = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Drain all pending events. Use for graceful shutdown.
|
|
52
|
+
*/
|
|
53
|
+
async flush() {
|
|
54
|
+
await this.processQueue();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=async-event-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-event-queue.js","sourceRoot":"","sources":["../../src/orchestrator/async-event-queue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,eAAe;IAClB,KAAK,GAA4C,EAAE,CAAC;IACpD,UAAU,GAAG,KAAK,CAAC;IACV,OAAO,CAAS;IAChB,MAAM,CAAkD;IAEzE,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Job, JobEvent, JobResult, JobEventType, EventFilters, WorkerRegistration, Heartbeat, HeartbeatResponse, PollResponse } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Client options
|
|
8
|
+
*/
|
|
9
|
+
export interface OrchestratorClientOptions {
|
|
10
|
+
/** Base URL of the orchestrator service */
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
/** Request timeout in milliseconds */
|
|
13
|
+
timeout?: number;
|
|
14
|
+
/** Authentication token */
|
|
15
|
+
authToken?: string;
|
|
16
|
+
/** Custom headers */
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* REST client for orchestrator communication
|
|
21
|
+
*/
|
|
22
|
+
export declare class OrchestratorClient {
|
|
23
|
+
private readonly baseUrl;
|
|
24
|
+
private readonly timeout;
|
|
25
|
+
private readonly authToken?;
|
|
26
|
+
private readonly customHeaders;
|
|
27
|
+
constructor(options: OrchestratorClientOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Make an HTTP request to the orchestrator
|
|
30
|
+
*/
|
|
31
|
+
private request;
|
|
32
|
+
/**
|
|
33
|
+
* Register worker with orchestrator
|
|
34
|
+
*/
|
|
35
|
+
register(registration: WorkerRegistration): Promise<{
|
|
36
|
+
workerId: string;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Unregister worker from orchestrator
|
|
40
|
+
*/
|
|
41
|
+
unregister(workerId: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Send heartbeat to orchestrator
|
|
44
|
+
*/
|
|
45
|
+
heartbeat(data: Heartbeat): Promise<HeartbeatResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Poll for available jobs
|
|
48
|
+
*/
|
|
49
|
+
pollForJob(workerId: string, capabilities?: string[]): Promise<PollResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Update job status
|
|
52
|
+
*/
|
|
53
|
+
updateJobStatus(jobId: string, status: Job['status'], metadata?: Record<string, unknown>): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Report job result
|
|
56
|
+
*/
|
|
57
|
+
reportJobResult(result: JobResult): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Get job details
|
|
60
|
+
*/
|
|
61
|
+
getJob(jobId: string): Promise<Job>;
|
|
62
|
+
/**
|
|
63
|
+
* Cancel a job
|
|
64
|
+
*/
|
|
65
|
+
cancelJob(jobId: string, reason?: string): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Publish an event for a job
|
|
68
|
+
*/
|
|
69
|
+
publishEvent(jobId: string, event: {
|
|
70
|
+
type: JobEventType;
|
|
71
|
+
data: Record<string, unknown>;
|
|
72
|
+
timestamp?: number;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
eventId: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Subscribe to SSE events for a specific job.
|
|
78
|
+
* Returns an AsyncIterable that yields parsed JobEvent objects.
|
|
79
|
+
* The stream can be cancelled via AbortSignal or by breaking out of the for-await loop.
|
|
80
|
+
*/
|
|
81
|
+
subscribeEvents(jobId: string, options?: {
|
|
82
|
+
lastEventId?: string;
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
}): AsyncGenerator<JobEvent, void, undefined>;
|
|
85
|
+
/**
|
|
86
|
+
* Subscribe to SSE events for all jobs, optionally filtered.
|
|
87
|
+
* Returns an AsyncIterable that yields parsed JobEvent objects.
|
|
88
|
+
* The stream can be cancelled via AbortSignal or by breaking out of the for-await loop.
|
|
89
|
+
*/
|
|
90
|
+
subscribeAllEvents(options?: {
|
|
91
|
+
filters?: EventFilters;
|
|
92
|
+
lastEventId?: string;
|
|
93
|
+
signal?: AbortSignal;
|
|
94
|
+
}): AsyncGenerator<JobEvent, void, undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* Parse an SSE response stream into JobEvent objects.
|
|
97
|
+
* Handles `event:`, `id:`, `data:` fields and skips comment lines (heartbeats).
|
|
98
|
+
*/
|
|
99
|
+
private parseSSEStream;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Error class for orchestrator client errors
|
|
103
|
+
*/
|
|
104
|
+
export declare class OrchestratorClientError extends Error {
|
|
105
|
+
readonly code: string;
|
|
106
|
+
readonly statusCode: number;
|
|
107
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
108
|
+
constructor(message: string, code: string, statusCode: number, details?: Record<string, unknown> | undefined);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/orchestrator/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,GAAG,EACH,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EACjB,YAAY,EAEb,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAEhB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;gBAE3C,OAAO,EAAE,yBAAyB;IAO9C;;OAEG;YACW,OAAO;IA+DrB;;OAEG;IACG,QAAQ,CAAC,YAAY,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;K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