@hasna/workflows 0.1.0

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.
@@ -0,0 +1,232 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+
4
+ // src/service.ts
5
+ import { join } from "path";
6
+ // package.json
7
+ var package_default = {
8
+ name: "@hasna/workflows",
9
+ version: "0.1.0",
10
+ description: "Universal graph workflow app \u2014 scaffold with version/health/readiness on all four surfaces; graph language, store, session WAL, daemon, and lane adapters are roadmap",
11
+ type: "module",
12
+ main: "./dist/index.js",
13
+ types: "./types/index.d.ts",
14
+ bin: {
15
+ workflows: "dist/cli/index.js",
16
+ "workflows-mcp": "dist/mcp/index.js",
17
+ "workflows-serve": "dist/serve/index.js"
18
+ },
19
+ exports: {
20
+ ".": {
21
+ types: "./types/index.d.ts",
22
+ import: "./dist/index.js"
23
+ },
24
+ "./sdk": {
25
+ types: "./types/index.d.ts",
26
+ import: "./dist/index.js"
27
+ },
28
+ "./cli": {
29
+ types: "./types/cli/index.d.ts",
30
+ import: "./dist/cli/index.js"
31
+ }
32
+ },
33
+ files: [
34
+ "dist",
35
+ "types",
36
+ "README.md",
37
+ "LICENSE",
38
+ "hasna.contract.json"
39
+ ],
40
+ scripts: {
41
+ build: "bun run build:runtime && bun run build:types",
42
+ "build:runtime": "rm -rf dist && bun build src/cli/index.ts --outdir dist/cli --target bun --packages external && bun build src/mcp/index.ts --outdir dist/mcp --target bun --packages external && bun build src/serve/index.ts --outdir dist/serve --target bun --packages external && bun build src/index.ts src/service.ts src/handlers.ts src/agent-tools.ts src/types.ts --root src --outdir dist --target bun --packages external",
43
+ "build:types": "rm -rf types && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir types",
44
+ "artifact-scan": "bun scripts/contracts-cli.mjs artifact-scan dist",
45
+ "contract:check": "bun scripts/contracts-cli.mjs repo-conformance .",
46
+ typecheck: "tsc --noEmit",
47
+ test: "bun test",
48
+ "test:pg": 'WORKFLOWS_TEST_DATABASE_URL="${WORKFLOWS_TEST_DATABASE_URL:?point it at a throwaway Postgres; the live-PG gate must not pass without one}" WORKFLOWS_REQUIRE_POSTGRES=1 bun test src/db/pg-live.test.ts',
49
+ prepack: "bun run build && bun run artifact-scan",
50
+ prepublishOnly: "bun run test && bun run build"
51
+ },
52
+ keywords: [
53
+ "workflows",
54
+ "graph",
55
+ "automation",
56
+ "cli",
57
+ "typescript",
58
+ "bun",
59
+ "hasna"
60
+ ],
61
+ publishConfig: {
62
+ registry: "https://registry.npmjs.org",
63
+ access: "public"
64
+ },
65
+ repository: {
66
+ type: "git",
67
+ url: "git+https://github.com/hasna/apps.git"
68
+ },
69
+ homepage: "https://github.com/hasna/apps/tree/main/apps/workflows",
70
+ bugs: {
71
+ url: "https://github.com/hasna/apps/issues"
72
+ },
73
+ engines: {
74
+ bun: ">=1.0.0",
75
+ node: ">=20.0.0"
76
+ },
77
+ author: "Hasna",
78
+ license: "Apache-2.0",
79
+ dependencies: {
80
+ commander: "^13.1.0"
81
+ },
82
+ devDependencies: {
83
+ "@hasna/contracts": "0.14.0",
84
+ "@types/bun": "latest",
85
+ "@types/pg": "^8.15.6",
86
+ pg: "^8.16.3",
87
+ typescript: "^5.7.3"
88
+ }
89
+ };
90
+
91
+ // src/service.ts
92
+ var DEFAULT_PORT = 8790;
93
+ var DEFAULT_HOST = "127.0.0.1";
94
+ function packageVersion() {
95
+ return package_default.version;
96
+ }
97
+ function envString(names) {
98
+ for (const name of names) {
99
+ const value = process.env[name];
100
+ if (value !== undefined && value !== "")
101
+ return value;
102
+ }
103
+ return;
104
+ }
105
+ function envInt(names, fallback) {
106
+ const value = envString(names);
107
+ if (value === undefined)
108
+ return fallback;
109
+ const parsed = Number(value);
110
+ return Number.isFinite(parsed) ? parsed : fallback;
111
+ }
112
+ function resolveWorkflowsConfig(overrides = {}) {
113
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? ".";
114
+ return {
115
+ port: overrides.port ?? envInt(["HASNA_WORKFLOWS_PORT", "WORKFLOWS_PORT"], DEFAULT_PORT),
116
+ host: overrides.host ?? envString(["HASNA_WORKFLOWS_HOST", "WORKFLOWS_HOST"]) ?? DEFAULT_HOST,
117
+ dataDir: overrides.dataDir ?? envString(["HASNA_WORKFLOWS_DATA_DIR", "WORKFLOWS_DATA_DIR"]) ?? join(home, ".hasna", "workflows"),
118
+ apiUrl: overrides.apiUrl ?? envString(["WORKFLOWS_API_URL"]),
119
+ apiKey: overrides.apiKey ?? envString(["WORKFLOWS_API_KEY"])
120
+ };
121
+ }
122
+
123
+ class WorkflowsService {
124
+ name = "workflows";
125
+ version;
126
+ config;
127
+ startedAt = Date.now();
128
+ constructor(config = {}) {
129
+ this.config = resolveWorkflowsConfig(config);
130
+ this.version = packageVersion();
131
+ }
132
+ health() {
133
+ return {
134
+ ok: true,
135
+ service: this.name,
136
+ version: this.version,
137
+ pid: process.pid,
138
+ uptimeMs: Date.now() - this.startedAt
139
+ };
140
+ }
141
+ ready() {
142
+ return {
143
+ ok: true,
144
+ service: this.name,
145
+ version: this.version,
146
+ checks: { version: "ok" }
147
+ };
148
+ }
149
+ }
150
+ function createWorkflowsService(config = {}) {
151
+ return new WorkflowsService(config);
152
+ }
153
+
154
+ // src/handlers.ts
155
+ function jsonResponse(body, status = 200) {
156
+ return new Response(JSON.stringify(body), {
157
+ status,
158
+ headers: { "content-type": "application/json" }
159
+ });
160
+ }
161
+ function openApiDoc(service) {
162
+ return {
163
+ openapi: "3.0.3",
164
+ info: { title: "workflows", version: service.version },
165
+ paths: {
166
+ "/health": { get: { summary: "Service health", responses: { "200": { description: "ok" } } } },
167
+ "/ready": { get: { summary: "Service readiness", responses: { "200": { description: "ok" } } } },
168
+ "/version": { get: { summary: "Service version", responses: { "200": { description: "ok" } } } }
169
+ }
170
+ };
171
+ }
172
+ function createRequestHandler(service) {
173
+ return (req) => {
174
+ const url = new URL(req.url);
175
+ switch (url.pathname) {
176
+ case "/health":
177
+ return jsonResponse(service.health());
178
+ case "/ready":
179
+ return jsonResponse(service.ready());
180
+ case "/version":
181
+ return jsonResponse({ service: service.name, version: service.version });
182
+ case "/openapi.json":
183
+ return jsonResponse(openApiDoc(service));
184
+ default:
185
+ return jsonResponse({ error: "not_found", path: url.pathname }, 404);
186
+ }
187
+ };
188
+ }
189
+
190
+ // src/serve/server.ts
191
+ function createWorkflowsServer(service) {
192
+ const handler = createRequestHandler(service);
193
+ const server = Bun.serve({
194
+ hostname: service.config.host,
195
+ port: service.config.port,
196
+ fetch: handler
197
+ });
198
+ return {
199
+ port: server.port ?? 0,
200
+ stop: () => {
201
+ server.stop();
202
+ }
203
+ };
204
+ }
205
+
206
+ // src/serve/index.ts
207
+ var HELP_TEXT = `workflows-serve \u2014 HTTP server for @hasna/workflows
208
+
209
+ Usage:
210
+ workflows-serve [--version] [--help]
211
+
212
+ Endpoints:
213
+ /health service health
214
+ /ready service readiness
215
+ /version service version
216
+ /openapi.json API document
217
+
218
+ Configuration (env):
219
+ HASNA_WORKFLOWS_PORT port (default 8790)
220
+ HASNA_WORKFLOWS_HOST bind host (default 127.0.0.1)`;
221
+ var argv = process.argv.slice(2);
222
+ if (argv.includes("--version") || argv.includes("-v")) {
223
+ console.log(packageVersion());
224
+ process.exit(0);
225
+ }
226
+ if (argv.includes("--help") || argv.includes("-h")) {
227
+ console.log(HELP_TEXT);
228
+ process.exit(0);
229
+ }
230
+ var service = createWorkflowsService();
231
+ var server = createWorkflowsServer(service);
232
+ console.log(`workflows-serve listening on http://${service.config.host}:${server.port}`);
@@ -0,0 +1,156 @@
1
+ // @bun
2
+ // src/service.ts
3
+ import { join } from "path";
4
+ // package.json
5
+ var package_default = {
6
+ name: "@hasna/workflows",
7
+ version: "0.1.0",
8
+ description: "Universal graph workflow app \u2014 scaffold with version/health/readiness on all four surfaces; graph language, store, session WAL, daemon, and lane adapters are roadmap",
9
+ type: "module",
10
+ main: "./dist/index.js",
11
+ types: "./types/index.d.ts",
12
+ bin: {
13
+ workflows: "dist/cli/index.js",
14
+ "workflows-mcp": "dist/mcp/index.js",
15
+ "workflows-serve": "dist/serve/index.js"
16
+ },
17
+ exports: {
18
+ ".": {
19
+ types: "./types/index.d.ts",
20
+ import: "./dist/index.js"
21
+ },
22
+ "./sdk": {
23
+ types: "./types/index.d.ts",
24
+ import: "./dist/index.js"
25
+ },
26
+ "./cli": {
27
+ types: "./types/cli/index.d.ts",
28
+ import: "./dist/cli/index.js"
29
+ }
30
+ },
31
+ files: [
32
+ "dist",
33
+ "types",
34
+ "README.md",
35
+ "LICENSE",
36
+ "hasna.contract.json"
37
+ ],
38
+ scripts: {
39
+ build: "bun run build:runtime && bun run build:types",
40
+ "build:runtime": "rm -rf dist && bun build src/cli/index.ts --outdir dist/cli --target bun --packages external && bun build src/mcp/index.ts --outdir dist/mcp --target bun --packages external && bun build src/serve/index.ts --outdir dist/serve --target bun --packages external && bun build src/index.ts src/service.ts src/handlers.ts src/agent-tools.ts src/types.ts --root src --outdir dist --target bun --packages external",
41
+ "build:types": "rm -rf types && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir types",
42
+ "artifact-scan": "bun scripts/contracts-cli.mjs artifact-scan dist",
43
+ "contract:check": "bun scripts/contracts-cli.mjs repo-conformance .",
44
+ typecheck: "tsc --noEmit",
45
+ test: "bun test",
46
+ "test:pg": 'WORKFLOWS_TEST_DATABASE_URL="${WORKFLOWS_TEST_DATABASE_URL:?point it at a throwaway Postgres; the live-PG gate must not pass without one}" WORKFLOWS_REQUIRE_POSTGRES=1 bun test src/db/pg-live.test.ts',
47
+ prepack: "bun run build && bun run artifact-scan",
48
+ prepublishOnly: "bun run test && bun run build"
49
+ },
50
+ keywords: [
51
+ "workflows",
52
+ "graph",
53
+ "automation",
54
+ "cli",
55
+ "typescript",
56
+ "bun",
57
+ "hasna"
58
+ ],
59
+ publishConfig: {
60
+ registry: "https://registry.npmjs.org",
61
+ access: "public"
62
+ },
63
+ repository: {
64
+ type: "git",
65
+ url: "git+https://github.com/hasna/apps.git"
66
+ },
67
+ homepage: "https://github.com/hasna/apps/tree/main/apps/workflows",
68
+ bugs: {
69
+ url: "https://github.com/hasna/apps/issues"
70
+ },
71
+ engines: {
72
+ bun: ">=1.0.0",
73
+ node: ">=20.0.0"
74
+ },
75
+ author: "Hasna",
76
+ license: "Apache-2.0",
77
+ dependencies: {
78
+ commander: "^13.1.0"
79
+ },
80
+ devDependencies: {
81
+ "@hasna/contracts": "0.14.0",
82
+ "@types/bun": "latest",
83
+ "@types/pg": "^8.15.6",
84
+ pg: "^8.16.3",
85
+ typescript: "^5.7.3"
86
+ }
87
+ };
88
+
89
+ // src/service.ts
90
+ var DEFAULT_PORT = 8790;
91
+ var DEFAULT_HOST = "127.0.0.1";
92
+ function packageVersion() {
93
+ return package_default.version;
94
+ }
95
+ function envString(names) {
96
+ for (const name of names) {
97
+ const value = process.env[name];
98
+ if (value !== undefined && value !== "")
99
+ return value;
100
+ }
101
+ return;
102
+ }
103
+ function envInt(names, fallback) {
104
+ const value = envString(names);
105
+ if (value === undefined)
106
+ return fallback;
107
+ const parsed = Number(value);
108
+ return Number.isFinite(parsed) ? parsed : fallback;
109
+ }
110
+ function resolveWorkflowsConfig(overrides = {}) {
111
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? ".";
112
+ return {
113
+ port: overrides.port ?? envInt(["HASNA_WORKFLOWS_PORT", "WORKFLOWS_PORT"], DEFAULT_PORT),
114
+ host: overrides.host ?? envString(["HASNA_WORKFLOWS_HOST", "WORKFLOWS_HOST"]) ?? DEFAULT_HOST,
115
+ dataDir: overrides.dataDir ?? envString(["HASNA_WORKFLOWS_DATA_DIR", "WORKFLOWS_DATA_DIR"]) ?? join(home, ".hasna", "workflows"),
116
+ apiUrl: overrides.apiUrl ?? envString(["WORKFLOWS_API_URL"]),
117
+ apiKey: overrides.apiKey ?? envString(["WORKFLOWS_API_KEY"])
118
+ };
119
+ }
120
+
121
+ class WorkflowsService {
122
+ name = "workflows";
123
+ version;
124
+ config;
125
+ startedAt = Date.now();
126
+ constructor(config = {}) {
127
+ this.config = resolveWorkflowsConfig(config);
128
+ this.version = packageVersion();
129
+ }
130
+ health() {
131
+ return {
132
+ ok: true,
133
+ service: this.name,
134
+ version: this.version,
135
+ pid: process.pid,
136
+ uptimeMs: Date.now() - this.startedAt
137
+ };
138
+ }
139
+ ready() {
140
+ return {
141
+ ok: true,
142
+ service: this.name,
143
+ version: this.version,
144
+ checks: { version: "ok" }
145
+ };
146
+ }
147
+ }
148
+ function createWorkflowsService(config = {}) {
149
+ return new WorkflowsService(config);
150
+ }
151
+ export {
152
+ resolveWorkflowsConfig,
153
+ packageVersion,
154
+ createWorkflowsService,
155
+ WorkflowsService
156
+ };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ // @bun
@@ -0,0 +1,94 @@
1
+ {
2
+ "schema": "hasna.service_contract.v1",
3
+ "name": "workflows",
4
+ "class": "service",
5
+ "contractVersion": "v1",
6
+ "kitVersion": "0.14.0",
7
+ "description": "Scaffold of the universal graph workflow app: version/health/readiness on all four surfaces (CLI, MCP, serve, SDK). The graph language, three-table store, session WAL, claims/leases daemon, and lane adapters (claude, codex, cursor, grok) are roadmap slices not shipped in 0.1.0.",
8
+ "bins": [
9
+ "workflows",
10
+ "workflows-mcp",
11
+ "workflows-serve"
12
+ ],
13
+ "hosting": [
14
+ "user-hosted"
15
+ ],
16
+ "serviceSurfaces": [
17
+ {
18
+ "name": "http-api",
19
+ "kind": "api",
20
+ "status": "supported",
21
+ "bin": "workflows-serve",
22
+ "authMode": "local-only",
23
+ "health": {
24
+ "method": "GET",
25
+ "path": "/health",
26
+ "public": true
27
+ },
28
+ "readiness": {
29
+ "method": "GET",
30
+ "path": "/ready",
31
+ "public": true
32
+ },
33
+ "version": {
34
+ "method": "GET",
35
+ "path": "/version",
36
+ "public": true
37
+ },
38
+ "openApiPath": "/openapi.json"
39
+ },
40
+ {
41
+ "name": "typescript-sdk",
42
+ "kind": "sdk",
43
+ "status": "supported",
44
+ "authMode": "local-only",
45
+ "exportSubpath": "./sdk",
46
+ "clientClassName": "WorkflowsService",
47
+ "generatedFrom": "/openapi.json"
48
+ },
49
+ {
50
+ "name": "mcp",
51
+ "kind": "mcp",
52
+ "status": "supported",
53
+ "mcpBin": "workflows-mcp",
54
+ "authMode": "local-only"
55
+ },
56
+ {
57
+ "name": "cli",
58
+ "kind": "cli",
59
+ "status": "supported",
60
+ "bin": "workflows",
61
+ "authMode": "local-only"
62
+ }
63
+ ],
64
+ "metadata": {
65
+ "serve": {
66
+ "healthEndpoints": [
67
+ "/health",
68
+ "/ready",
69
+ "/version"
70
+ ],
71
+ "openapi": "/openapi.json",
72
+ "auth": "local-only"
73
+ },
74
+ "release": {
75
+ "artifactScan": {
76
+ "script": "artifact-scan"
77
+ }
78
+ }
79
+ },
80
+ "storage": {
81
+ "backend": "sqlite",
82
+ "engines": [
83
+ "sqlite",
84
+ "postgresql"
85
+ ],
86
+ "envPrefix": "HASNA_WORKFLOWS_",
87
+ "aliasEnvPrefix": "WORKFLOWS_",
88
+ "sqlitePath": "~/.hasna/workflows/workflows.db",
89
+ "pgTestGate": {
90
+ "envVar": "WORKFLOWS_TEST_DATABASE_URL",
91
+ "command": "bun run test:pg"
92
+ }
93
+ }
94
+ }
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@hasna/workflows",
3
+ "version": "0.1.0",
4
+ "description": "Universal graph workflow app \u2014 scaffold with version/health/readiness on all four surfaces; graph language, store, session WAL, daemon, and lane adapters are roadmap",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./types/index.d.ts",
8
+ "bin": {
9
+ "workflows": "dist/cli/index.js",
10
+ "workflows-mcp": "dist/mcp/index.js",
11
+ "workflows-serve": "dist/serve/index.js"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./types/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ },
18
+ "./sdk": {
19
+ "types": "./types/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./cli": {
23
+ "types": "./types/cli/index.d.ts",
24
+ "import": "./dist/cli/index.js"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "types",
30
+ "README.md",
31
+ "LICENSE",
32
+ "hasna.contract.json"
33
+ ],
34
+ "scripts": {
35
+ "build": "bun run build:runtime && bun run build:types",
36
+ "build:runtime": "rm -rf dist && bun build src/cli/index.ts --outdir dist/cli --target bun --packages external && bun build src/mcp/index.ts --outdir dist/mcp --target bun --packages external && bun build src/serve/index.ts --outdir dist/serve --target bun --packages external && bun build src/index.ts src/service.ts src/handlers.ts src/agent-tools.ts src/types.ts --root src --outdir dist --target bun --packages external",
37
+ "build:types": "rm -rf types && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir types",
38
+ "artifact-scan": "bun scripts/contracts-cli.mjs artifact-scan dist",
39
+ "contract:check": "bun scripts/contracts-cli.mjs repo-conformance .",
40
+ "typecheck": "tsc --noEmit",
41
+ "test": "bun test",
42
+ "test:pg": "WORKFLOWS_TEST_DATABASE_URL=\"${WORKFLOWS_TEST_DATABASE_URL:?point it at a throwaway Postgres; the live-PG gate must not pass without one}\" WORKFLOWS_REQUIRE_POSTGRES=1 bun test src/db/pg-live.test.ts",
43
+ "prepack": "bun run build && bun run artifact-scan",
44
+ "prepublishOnly": "bun run test && bun run build"
45
+ },
46
+ "keywords": [
47
+ "workflows",
48
+ "graph",
49
+ "automation",
50
+ "cli",
51
+ "typescript",
52
+ "bun",
53
+ "hasna"
54
+ ],
55
+ "publishConfig": {
56
+ "registry": "https://registry.npmjs.org",
57
+ "access": "public"
58
+ },
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "git+https://github.com/hasna/apps.git"
62
+ },
63
+ "homepage": "https://github.com/hasna/apps/tree/main/apps/workflows",
64
+ "bugs": {
65
+ "url": "https://github.com/hasna/apps/issues"
66
+ },
67
+ "engines": {
68
+ "bun": ">=1.0.0",
69
+ "node": ">=20.0.0"
70
+ },
71
+ "author": "Hasna",
72
+ "license": "Apache-2.0",
73
+ "dependencies": {
74
+ "commander": "^13.1.0"
75
+ },
76
+ "devDependencies": {
77
+ "@hasna/contracts": "0.14.0",
78
+ "@types/bun": "latest",
79
+ "@types/pg": "^8.15.6",
80
+ "pg": "^8.16.3",
81
+ "typescript": "^5.7.3"
82
+ }
83
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * MCP tool registry for @hasna/workflows — the agent interface layer over
3
+ * WorkflowsService. Slice 1 ships identity/health tools; the graph language,
4
+ * store, and daemon slices add their tools here.
5
+ */
6
+ import type { WorkflowsService } from "./service.js";
7
+ export interface McpTool {
8
+ name: string;
9
+ description: string;
10
+ inputSchema: {
11
+ type: "object";
12
+ properties: Record<string, unknown>;
13
+ };
14
+ }
15
+ export interface ToolCallResult {
16
+ content: {
17
+ type: "text";
18
+ text: string;
19
+ }[];
20
+ isError: boolean;
21
+ }
22
+ export declare function workflowsTools(_service: WorkflowsService): McpTool[];
23
+ export declare function callWorkflowTool(service: WorkflowsService, name: string, _args: Record<string, unknown>): ToolCallResult;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * HTTP request handler for workflows-serve. Interface layer over
3
+ * WorkflowsService; all business logic lives in the service.
4
+ */
5
+ import type { WorkflowsService } from "./service.js";
6
+ export declare function jsonResponse(body: unknown, status?: number): Response;
7
+ export declare function createRequestHandler(service: WorkflowsService): (req: Request) => Response;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @hasna/workflows SDK entry — the importable module surface.
3
+ * Re-exports the domain service, the HTTP handlers, and the MCP tool
4
+ * registry so every surface is reachable programmatically.
5
+ */
6
+ export { WorkflowsService, createWorkflowsService, packageVersion, resolveWorkflowsConfig } from "./service.js";
7
+ export { createRequestHandler, jsonResponse } from "./handlers.js";
8
+ export { workflowsTools, callWorkflowTool } from "./agent-tools.js";
9
+ export type { WorkflowsConfig, HealthReport, ReadinessReport } from "./types.js";
10
+ export type { McpTool, ToolCallResult } from "./agent-tools.js";
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * HTTP server factory for workflows-serve. Interface layer over
3
+ * WorkflowsService; the bin (src/serve/index.ts) wires args + lifecycle.
4
+ */
5
+ import type { WorkflowsService } from "../service.js";
6
+ export interface WorkflowsServer {
7
+ port: number;
8
+ stop: () => void;
9
+ }
10
+ export declare function createWorkflowsServer(service: WorkflowsService): WorkflowsServer;
@@ -0,0 +1,14 @@
1
+ import type { HealthReport, ReadinessReport, WorkflowsConfig } from "./types.js";
2
+ export declare function packageVersion(): string;
3
+ /** Resolve the service configuration from env + explicit overrides. */
4
+ export declare function resolveWorkflowsConfig(overrides?: Partial<WorkflowsConfig>): WorkflowsConfig;
5
+ export declare class WorkflowsService {
6
+ readonly name = "workflows";
7
+ readonly version: string;
8
+ readonly config: WorkflowsConfig;
9
+ private readonly startedAt;
10
+ constructor(config?: Partial<WorkflowsConfig>);
11
+ health(): HealthReport;
12
+ ready(): ReadinessReport;
13
+ }
14
+ export declare function createWorkflowsService(config?: Partial<WorkflowsConfig>): WorkflowsService;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Shared surface types for @hasna/workflows.
3
+ *
4
+ * Slice 1 (scaffold): identity, health, readiness, and config. Later slices
5
+ * extend these with the graph language, store, session, and daemon types.
6
+ */
7
+ /** Resolved service configuration. Values are resolved from the
8
+ * HASNA_WORKFLOWS_ and WORKFLOWS_ environment prefixes with documented
9
+ * defaults. */
10
+ export interface WorkflowsConfig {
11
+ /** HTTP port for workflows-serve. Default 8790. */
12
+ port: number;
13
+ /** Bind host for workflows-serve. Default 127.0.0.1. */
14
+ host: string;
15
+ /** Data directory (store slice lands the db here). Default ~/.hasna/workflows. */
16
+ dataDir: string;
17
+ /** Optional client API URL (WORKFLOWS_API_URL) — consumed by later slices. */
18
+ apiUrl?: string;
19
+ /** Optional client API key (WORKFLOWS_API_KEY) — resolved, never printed. */
20
+ apiKey?: string;
21
+ }
22
+ export interface HealthReport {
23
+ ok: boolean;
24
+ service: string;
25
+ version: string;
26
+ pid: number;
27
+ uptimeMs: number;
28
+ }
29
+ export interface ReadinessReport {
30
+ ok: boolean;
31
+ service: string;
32
+ version: string;
33
+ checks: Record<string, string>;
34
+ }