diff --git a/workbench/hono/LICENSE.md b/packages/hono/LICENSE.md similarity index 100% rename from workbench/hono/LICENSE.md rename to packages/hono/LICENSE.md diff --git a/packages/hono/README.md b/packages/hono/README.md new file mode 100644 index 000000000..628b3f194 --- /dev/null +++ b/packages/hono/README.md @@ -0,0 +1,3 @@ +# workflow/hono + +The docs have moved! Refer to them [here](https://useworkflow.dev/) diff --git a/packages/hono/package.json b/packages/hono/package.json new file mode 100644 index 000000000..215bd3056 --- /dev/null +++ b/packages/hono/package.json @@ -0,0 +1,39 @@ +{ + "name": "@workflow/hono", + "version": "4.0.0-beta.1", + "description": "Hono integration for Workflow DevKit", + "type": "module", + "main": "dist/index.js", + "files": [ + "dist" + ], + "publishConfig": { + "access": "public" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/vercel/workflow.git", + "directory": "packages/hono" + }, + "exports": { + ".": "./dist/index.js" + }, + "scripts": { + "build": "tsc", + "dev": "tsc --watch", + "clean": "tsc --build --clean && rm -rf dist" + }, + "dependencies": { + "@swc/core": "1.11.24", + "@workflow/cli": "workspace:*", + "@workflow/core": "workspace:*", + "@workflow/swc-plugin": "workspace:*", + "hono": "^4.9.10", + "workflow": "4.0.1-beta.4" + }, + "devDependencies": { + "@types/node": "catalog:", + "@workflow/tsconfig": "workspace:*" + } +} diff --git a/packages/hono/src/builder.ts b/packages/hono/src/builder.ts new file mode 100644 index 000000000..1772e0f1c --- /dev/null +++ b/packages/hono/src/builder.ts @@ -0,0 +1,58 @@ +import { mkdir } from 'node:fs/promises'; +import { join } from 'node:path'; +import { BaseBuilder } from '@workflow/cli/dist/lib/builders/base-builder.js'; +import { VercelBuildOutputAPIBuilder } from '@workflow/cli/dist/lib/builders/vercel-build-output-api.js'; +import type { WorkflowConfig } from '@workflow/cli/dist/lib/config/types.js'; + +const CommonBuildOptions = { + dirs: ['workflows'], + buildTarget: 'next' as const, // unused in base + stepsBundlePath: '', // unused in base + workflowsBundlePath: '', // unused in base + webhookBundlePath: '', // unused in base +}; + +export class LocalBuilder extends BaseBuilder { + #outDir: string; + + constructor(config: Partial) { + const workingDir = process.cwd(); + const outDir = join(workingDir, '.workflow'); + super({ + ...CommonBuildOptions, + ...config, + workingDir, + clientBundlePath: join(workingDir, '_workflows.js'), + }); + this.#outDir = outDir; + } + + override async build(): Promise { + const inputFiles = await this.getInputFiles(); + await mkdir(this.#outDir, { recursive: true }); + + await this.createWorkflowsBundle({ + outfile: join(this.#outDir, 'workflows.mjs'), + bundleFinalOutput: false, + format: 'esm', + inputFiles, + }); + + await this.createStepsBundle({ + outfile: join(this.#outDir, 'steps.mjs'), + externalizeNonSteps: true, + format: 'esm', + inputFiles, + }); + + await this.createWebhookBundle({ + outfile: join(this.#outDir, 'webhook.mjs'), + bundle: false, + }); + + this.buildClientLibrary(); + } +} + +// TODO: Implement Vercel builder +export class VercelBuilder extends VercelBuildOutputAPIBuilder {} diff --git a/packages/hono/src/index.ts b/packages/hono/src/index.ts new file mode 100644 index 000000000..1c1e5e8e9 --- /dev/null +++ b/packages/hono/src/index.ts @@ -0,0 +1,50 @@ +import { join } from 'node:path'; +import { pathToFileURL } from 'node:url'; +import type { WorkflowConfig } from '@workflow/cli/dist/lib/config/types'; +import { Hono } from 'hono'; +import { LocalBuilder } from './builder'; + +async function loadBundle(outdir: string, filename: string) { + const path = join(process.cwd(), outdir, filename); + const module = await import(pathToFileURL(path).href); + const handler = module.POST; + return { handler }; +} + +export async function createWorkflowRoutes( + options?: Partial +): Promise { + options ??= {}; + const app = new Hono(); + const outDir = '.workflow'; + + const isVercelDeploy = process.env.VERCEL === '1'; + + if (isVercelDeploy) { + // TODO: Implement Vercel builder + } else { + await new LocalBuilder(options).build(); + + // Load bundles + const stepsModule = await loadBundle(outDir, 'steps.mjs'); + const workflowsModule = await loadBundle(outDir, 'workflows.mjs'); + const webhookModule = await loadBundle(outDir, 'webhook.mjs'); + + // Register routes directly on one app + app.post('/v1/step', async (c) => { + return await stepsModule.handler(c.req.raw); + }); + + app.post('/v1/flow', async (c) => { + return await workflowsModule.handler(c.req.raw); + }); + + app.all('/v1/webhook/:token', async (c) => { + const handler = webhookModule.handler; + if (!handler) return c.text('Method not supported', 405); + return await handler(c.req.raw); + }); + } + + return app; +} diff --git a/packages/hono/tsconfig.json b/packages/hono/tsconfig.json new file mode 100644 index 000000000..ba5d9aec0 --- /dev/null +++ b/packages/hono/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "@workflow/tsconfig/base.json", + "compilerOptions": { + "outDir": "dist", + "target": "es2022", + "module": "preserve", + "baseUrl": ".", + "moduleResolution": "bundler" + }, + "include": ["src"], + "exclude": ["node_modules", "**/*.test.ts"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 31101e688..60e32a3b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -446,6 +446,34 @@ importers: specifier: workspace:* version: link:../tsconfig + packages/hono: + dependencies: + '@swc/core': + specifier: 1.11.24 + version: 1.11.24 + '@workflow/cli': + specifier: workspace:* + version: link:../cli + '@workflow/core': + specifier: workspace:* + version: link:../core + '@workflow/swc-plugin': + specifier: workspace:* + version: link:../swc-plugin-workflow + hono: + specifier: ^4.9.10 + version: 4.9.10 + workflow: + specifier: 4.0.1-beta.4 + version: 4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(next@15.5.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0))(react-dom@19.2.0(react@19.2.0))(react@19.2.0)(typescript@5.9.3) + devDependencies: + '@types/node': + specifier: 'catalog:' + version: 24.6.2 + '@workflow/tsconfig': + specifier: workspace:* + version: link:../tsconfig + packages/next: dependencies: '@swc/core': @@ -858,13 +886,41 @@ importers: version: 0.25.11 workbench/hono: + dependencies: + '@hono/node-server': + specifier: ^1.19.5 + version: 1.19.5(hono@4.10.3) + '@workflow/core': + specifier: workspace:* + version: link:../../packages/core + '@workflow/hono': + specifier: workspace:* + version: link:../../packages/hono + hono: + specifier: ^4.10.3 + version: 4.10.3 + workflow: + specifier: workspace:* + version: link:../../packages/workflow + devDependencies: + '@types/node': + specifier: ^20.11.17 + version: 20.19.23 + tsx: + specifier: ^4.7.1 + version: 4.20.6 + typescript: + specifier: ^5.8.3 + version: 5.9.3 + + workbench/hono-nitro: devDependencies: ai: specifier: 'catalog:' version: 5.0.76(zod@4.1.11) hono: specifier: ^4.9.10 - version: 4.9.10 + version: 4.10.3 lodash.chunk: specifier: ^4.2.0 version: 4.2.0 @@ -4527,6 +4583,9 @@ packages: '@types/node@18.19.130': resolution: {integrity: sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==} + '@types/node@20.19.23': + resolution: {integrity: sha512-yIdlVVVHXpmqRhtyovZAcSy0MiPcYWGkoO4CGe/+jpP0hmNuihm4XhHbADpK++MsiLHP5MVlv+bcgdF99kSiFQ==} + '@types/node@24.6.2': resolution: {integrity: sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang==} @@ -4792,6 +4851,61 @@ packages: '@vue/shared@3.5.22': resolution: {integrity: sha512-F4yc6palwq3TT0u+FYf0Ns4Tfl9GRFURDN2gWG7L1ecIaS/4fCIuFOjMTnCyjsu/OK6vaDKLCrGAa+KvvH+h4w==} + '@workflow/cli@4.0.1-beta.4': + resolution: {integrity: sha512-WTEYr3SUftJq2qrt9aVx6iYa8hyZ4vpJ5SLmyPQtg6jc1CLnTQcEwYp2auATG3jtet7t8OOSWsYA8YdQuIaa6g==} + hasBin: true + + '@workflow/core@4.0.1-beta.3': + resolution: {integrity: sha512-uPhQq9H+nMRGNO1RGow5zJxZbkbcCeUlLNEWxEePV6n9/48/G6J6/vipvZzXZMwVV4gFaJeKt9gAkTuWCBqxpw==} + peerDependencies: + '@opentelemetry/api': '1' + peerDependenciesMeta: + '@opentelemetry/api': + optional: true + + '@workflow/errors@4.0.1-beta.1': + resolution: {integrity: sha512-Nupp15EkgPCBhtBSOPYNu2a6ORGLqKHReJ0OPDoF16qjlvb01a2boIVU+A5RFEG/UdTVX4lvxSWrWmNU7zFFMw==} + + '@workflow/next@4.0.1-beta.4': + resolution: {integrity: sha512-hR2/ZnKCCnKq2jj4f5tNZ/NdLFui7RC1YNYV0K/ZFlI0IzPMIdHyhFNzomjyhBhuq37yoUTiCov/D0njlDMS5Q==} + peerDependencies: + next: '>13' + peerDependenciesMeta: + next: + optional: true + + '@workflow/nitro@4.0.1-beta.4': + resolution: {integrity: sha512-ZOZmOTYbBJu1mdMlO0mGh1Xr9ZnF8PMBroys/370yOPrJ3Fnj+Otxsl8I7MKl/DrBCpxHK+ux9E7UpNUEB6N5Q==} + + '@workflow/swc-plugin@4.0.1-beta.1': + resolution: {integrity: sha512-nnMyyq7mIcuaI4/sLaDQX7XLUB9Wtf9x3YCUkbL++a4tsvnV7b/uoL/0VQFU/b51/zhsLFTOwIWPLtrM/t3ZFA==} + peerDependencies: + '@swc/core': 1.11.24 + + '@workflow/typescript-plugin@4.0.1-beta.2': + resolution: {integrity: sha512-JFypqLC5vLmO6+QMYQSxqOPHL/8vm5/NCg4Bjj9u8yPzV2tFvezoxGAG1Gx3CEntST7IHX9RU8Hg4Q37/QTLiw==} + peerDependencies: + typescript: '>=5.0.0' + + '@workflow/web@4.0.1-beta.4': + resolution: {integrity: sha512-/KRkQYwgyAywM+lmkqSgXX3ViDsjhhML8+cTuPryUETPIcYA3uNn+kS1bbx0l/fSpcY2PGqHp8tuqLDnOZg2Dw==} + + '@workflow/world-local@4.0.1-beta.2': + resolution: {integrity: sha512-zM74SwsxaUih9JfomLb/xToOvyx1quIkmyT6MucTAVN4EDC1wMeVtQZmWi/DOruD7vpaIX/HaYYjqNAxahD35w==} + peerDependencies: + '@opentelemetry/api': '1' + peerDependenciesMeta: + '@opentelemetry/api': + optional: true + + '@workflow/world-vercel@4.0.1-beta.2': + resolution: {integrity: sha512-tu1cREdjqcZSEKsUNRS8L96LVUymDfn73f7yuJkmOdXfRTZp0joM4C/Y+fgDFDqM4zXeYhnmUQcmdUYt9Ql5Yw==} + + '@workflow/world@4.0.1-beta.2': + resolution: {integrity: sha512-RskrbFXEAFfIkmXpYNoIw+RooxxDp7W0l7A4999z1egVYpJPEhE21JOLffsFq+K1EgwuM+N6GWk7fDHNlVXgaw==} + peerDependencies: + zod: 4.1.11 + abbrev@3.0.1: resolution: {integrity: sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg==} engines: {node: ^18.17.0 || >=20.5.0} @@ -6453,6 +6567,10 @@ packages: hast-util-whitespace@3.0.0: resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} + hono@4.10.3: + resolution: {integrity: sha512-2LOYWUbnhdxdL8MNbNg9XZig6k+cZXm5IjHn2Aviv7honhBMOHb+jxrKIeJRZJRmn+htUCKhaicxwXuUDlchRA==} + engines: {node: '>=16.9.0'} + hono@4.9.10: resolution: {integrity: sha512-AlI15ijFyKTXR7eHo7QK7OR4RoKIedZvBuRjO8iy4zrxvlY5oFCdiRG/V/lFJHCNXJ0k72ATgnyzx8Yqa5arug==} engines: {node: '>=16.9.0'} @@ -9016,6 +9134,9 @@ packages: undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + undici-types@7.13.0: resolution: {integrity: sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ==} @@ -9521,6 +9642,15 @@ packages: wordwrap@1.0.0: resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + workflow@4.0.1-beta.4: + resolution: {integrity: sha512-wZdi2anoXI4c0O4lmiy/TSwtoHSe6OoR15IHQpHs0RGDaflqGeN0ojcXz80WVLjFOpzwjtq81DgLdmnuzjW19Q==} + hasBin: true + peerDependencies: + '@opentelemetry/api': '1' + peerDependenciesMeta: + '@opentelemetry/api': + optional: true + wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -10742,6 +10872,10 @@ snapshots: protobufjs: 7.5.4 yargs: 17.7.2 + '@hono/node-server@1.19.5(hono@4.10.3)': + dependencies: + hono: 4.10.3 + '@hono/node-server@1.19.5(hono@4.9.10)': dependencies: hono: 4.9.10 @@ -13547,13 +13681,13 @@ snapshots: '@types/docker-modem@3.0.6': dependencies: - '@types/node': 24.6.2 + '@types/node': 20.19.23 '@types/ssh2': 1.15.5 '@types/dockerode@3.3.44': dependencies: '@types/docker-modem': 3.0.6 - '@types/node': 24.6.2 + '@types/node': 20.19.23 '@types/ssh2': 1.15.5 '@types/estree-jsx@1.0.5': @@ -13566,7 +13700,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 24.6.2 + '@types/node': 20.19.23 '@types/hast@3.0.4': dependencies: @@ -13601,6 +13735,10 @@ snapshots: dependencies: undici-types: 5.26.5 + '@types/node@20.19.23': + dependencies: + undici-types: 6.21.0 + '@types/node@24.6.2': dependencies: undici-types: 7.13.0 @@ -13625,11 +13763,11 @@ snapshots: '@types/ssh2-streams@0.1.12': dependencies: - '@types/node': 24.6.2 + '@types/node': 20.19.23 '@types/ssh2@0.5.52': dependencies: - '@types/node': 24.6.2 + '@types/node': 20.19.23 '@types/ssh2-streams': 0.1.12 '@types/ssh2@1.15.5': @@ -13941,6 +14079,160 @@ snapshots: '@vue/shared@3.5.22': {} + '@workflow/cli@4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)': + dependencies: + '@oclif/core': 4.5.1 + '@oclif/plugin-help': 6.2.31 + '@swc/core': 1.11.24 + '@workflow/core': 4.0.1-beta.3(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0) + '@workflow/errors': 4.0.1-beta.1 + '@workflow/swc-plugin': 4.0.1-beta.1(@swc/core@1.11.24) + '@workflow/web': 4.0.1-beta.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + '@workflow/world': 4.0.1-beta.2(zod@4.1.11) + '@workflow/world-local': 4.0.1-beta.2(@opentelemetry/api@1.9.0) + '@workflow/world-vercel': 4.0.1-beta.2 + boxen: 8.0.1 + builtin-modules: 5.0.0 + chalk: 5.6.2 + chokidar: 4.0.3 + comment-json: 4.2.5 + date-fns: 4.1.0 + easy-table: 1.2.0 + enhanced-resolve: 5.18.2 + esbuild: 0.25.11 + find-up: 7.0.0 + mixpart: 0.0.4 + open: 10.2.0 + ora: 8.2.0 + terminal-link: 5.0.0 + tinyglobby: 0.2.15 + watchpack: 2.4.4 + xdg-app-paths: 5.5.1 + zod: 4.1.11 + transitivePeerDependencies: + - '@aws-sdk/client-sts' + - '@babel/core' + - '@opentelemetry/api' + - '@playwright/test' + - '@swc/helpers' + - babel-plugin-macros + - babel-plugin-react-compiler + - react + - react-dom + - sass + - supports-color + + '@workflow/core@4.0.1-beta.3(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)': + dependencies: + '@aws-sdk/credential-provider-web-identity': 3.609.0(@aws-sdk/client-sts@3.844.0) + '@types/ms': 2.1.0 + '@vercel/functions': 3.1.4(@aws-sdk/credential-provider-web-identity@3.609.0(@aws-sdk/client-sts@3.844.0)) + '@workflow/errors': 4.0.1-beta.1 + '@workflow/world': 4.0.1-beta.2(zod@4.1.11) + '@workflow/world-local': 4.0.1-beta.2(@opentelemetry/api@1.9.0) + '@workflow/world-vercel': 4.0.1-beta.2 + debug: 4.4.3(supports-color@8.1.1) + devalue: 5.4.1 + ms: 2.1.3 + nanoid: 5.1.6 + pid-port: 2.0.0 + seedrandom: 3.0.5 + ulid: 3.0.1 + zod: 4.1.11 + optionalDependencies: + '@opentelemetry/api': 1.9.0 + transitivePeerDependencies: + - '@aws-sdk/client-sts' + - supports-color + + '@workflow/errors@4.0.1-beta.1': + dependencies: + ms: 2.1.3 + + '@workflow/next@4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(next@15.5.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0))(react-dom@19.2.0(react@19.2.0))(react@19.2.0)': + dependencies: + '@swc/core': 1.11.24 + '@workflow/cli': 4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + '@workflow/core': 4.0.1-beta.3(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0) + '@workflow/swc-plugin': 4.0.1-beta.1(@swc/core@1.11.24) + optionalDependencies: + next: 15.5.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + transitivePeerDependencies: + - '@aws-sdk/client-sts' + - '@babel/core' + - '@opentelemetry/api' + - '@playwright/test' + - '@swc/helpers' + - babel-plugin-macros + - babel-plugin-react-compiler + - react + - react-dom + - sass + - supports-color + + '@workflow/nitro@4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)': + dependencies: + '@swc/core': 1.11.24 + '@workflow/cli': 4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + '@workflow/core': 4.0.1-beta.3(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0) + '@workflow/swc-plugin': 4.0.1-beta.1(@swc/core@1.11.24) + exsolve: 1.0.7 + transitivePeerDependencies: + - '@aws-sdk/client-sts' + - '@babel/core' + - '@opentelemetry/api' + - '@playwright/test' + - '@swc/helpers' + - babel-plugin-macros + - babel-plugin-react-compiler + - react + - react-dom + - sass + - supports-color + + '@workflow/swc-plugin@4.0.1-beta.1(@swc/core@1.11.24)': + dependencies: + '@swc/core': 1.11.24 + + '@workflow/typescript-plugin@4.0.1-beta.2(typescript@5.9.3)': + dependencies: + builtin-modules: 5.0.0 + typescript: 5.9.3 + + '@workflow/web@4.0.1-beta.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)': + dependencies: + next: 15.5.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + transitivePeerDependencies: + - '@babel/core' + - '@opentelemetry/api' + - '@playwright/test' + - babel-plugin-macros + - babel-plugin-react-compiler + - react + - react-dom + - sass + + '@workflow/world-local@4.0.1-beta.2(@opentelemetry/api@1.9.0)': + dependencies: + '@vercel/queue': 0.0.0-alpha.23 + '@workflow/world': 4.0.1-beta.2(zod@4.1.11) + ulid: 3.0.1 + zod: 4.1.11 + optionalDependencies: + '@opentelemetry/api': 1.9.0 + + '@workflow/world-vercel@4.0.1-beta.2': + dependencies: + '@vercel/oidc': 3.0.3 + '@vercel/queue': 0.0.0-alpha.24 + '@workflow/errors': 4.0.1-beta.1 + '@workflow/world': 4.0.1-beta.2(zod@4.1.11) + zod: 4.1.11 + + '@workflow/world@4.0.1-beta.2(zod@4.1.11)': + dependencies: + zod: 4.1.11 + abbrev@3.0.1: {} abort-controller@3.0.0: @@ -15725,6 +16017,8 @@ snapshots: dependencies: '@types/hast': 3.0.4 + hono@4.10.3: {} + hono@4.9.10: {} hookable@5.5.3: {} @@ -16935,6 +17229,30 @@ snapshots: - '@babel/core' - babel-plugin-macros + next@15.5.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0): + dependencies: + '@next/env': 15.5.4 + '@swc/helpers': 0.5.15 + caniuse-lite: 1.0.30001727 + postcss: 8.4.31 + react: 19.2.0 + react-dom: 19.2.0(react@19.2.0) + styled-jsx: 5.1.6(react@19.2.0) + optionalDependencies: + '@next/swc-darwin-arm64': 15.5.4 + '@next/swc-darwin-x64': 15.5.4 + '@next/swc-linux-arm64-gnu': 15.5.4 + '@next/swc-linux-arm64-musl': 15.5.4 + '@next/swc-linux-x64-gnu': 15.5.4 + '@next/swc-linux-x64-musl': 15.5.4 + '@next/swc-win32-arm64-msvc': 15.5.4 + '@next/swc-win32-x64-msvc': 15.5.4 + '@opentelemetry/api': 1.9.0 + sharp: 0.34.4 + transitivePeerDependencies: + - '@babel/core' + - babel-plugin-macros + next@15.6.0-canary.13(@opentelemetry/api@1.9.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1): dependencies: '@next/env': 15.6.0-canary.13 @@ -17918,7 +18236,7 @@ snapshots: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 24.6.2 + '@types/node': 20.19.23 long: 5.3.2 protocols@2.0.2: {} @@ -18957,7 +19275,6 @@ snapshots: get-tsconfig: 4.12.0 optionalDependencies: fsevents: 2.3.3 - optional: true tunnel-agent@0.6.0: dependencies: @@ -19031,6 +19348,8 @@ snapshots: undici-types@5.26.5: {} + undici-types@6.21.0: {} + undici-types@7.13.0: {} undici@7.16.0: {} @@ -19508,6 +19827,31 @@ snapshots: wordwrap@1.0.0: {} + workflow@4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(next@15.5.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0))(react-dom@19.2.0(react@19.2.0))(react@19.2.0)(typescript@5.9.3): + dependencies: + '@workflow/cli': 4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + '@workflow/core': 4.0.1-beta.3(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0) + '@workflow/errors': 4.0.1-beta.1 + '@workflow/next': 4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(next@15.5.4(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0))(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + '@workflow/nitro': 4.0.1-beta.4(@aws-sdk/client-sts@3.844.0)(@opentelemetry/api@1.9.0)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + '@workflow/typescript-plugin': 4.0.1-beta.2(typescript@5.9.3) + ms: 2.1.3 + optionalDependencies: + '@opentelemetry/api': 1.9.0 + transitivePeerDependencies: + - '@aws-sdk/client-sts' + - '@babel/core' + - '@playwright/test' + - '@swc/helpers' + - babel-plugin-macros + - babel-plugin-react-compiler + - next + - react + - react-dom + - sass + - supports-color + - typescript + wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 diff --git a/workbench/hono-nitro/.gitignore b/workbench/hono-nitro/.gitignore new file mode 100644 index 000000000..178daca81 --- /dev/null +++ b/workbench/hono-nitro/.gitignore @@ -0,0 +1,6 @@ +manifest.js +.well-known/ +.nitro +.output +.data +.vercel diff --git a/workbench/hono-nitro/LICENSE.md b/workbench/hono-nitro/LICENSE.md new file mode 120000 index 000000000..f0608a63a --- /dev/null +++ b/workbench/hono-nitro/LICENSE.md @@ -0,0 +1 @@ +../../LICENSE.md \ No newline at end of file diff --git a/workbench/hono-nitro/README.md b/workbench/hono-nitro/README.md new file mode 100644 index 000000000..f6c979e42 --- /dev/null +++ b/workbench/hono-nitro/README.md @@ -0,0 +1,26 @@ +# Workflows with Hono (Nitro v3) + +- Learn more about Hono: https://hono.dev +- Learn more about Nitro: https://v3.nitro.build/ + +## Commands + +**Local development:** + +```sh +npm run dev +``` + +**Production build (Vercel):** + +```sh +NITRO_PRESET=vercel npm run build +npx vercel --prebuilt +``` + +**Production build (Node.js):** + +```sh +npm run build +node .output/server/index.mjs +``` diff --git a/workbench/hono/_workflows.ts b/workbench/hono-nitro/_workflows.ts similarity index 100% rename from workbench/hono/_workflows.ts rename to workbench/hono-nitro/_workflows.ts diff --git a/workbench/hono/index.html b/workbench/hono-nitro/index.html similarity index 100% rename from workbench/hono/index.html rename to workbench/hono-nitro/index.html diff --git a/workbench/hono/nitro.config.ts b/workbench/hono-nitro/nitro.config.ts similarity index 100% rename from workbench/hono/nitro.config.ts rename to workbench/hono-nitro/nitro.config.ts diff --git a/workbench/hono-nitro/package.json b/workbench/hono-nitro/package.json new file mode 100644 index 000000000..b320c4054 --- /dev/null +++ b/workbench/hono-nitro/package.json @@ -0,0 +1,19 @@ +{ + "name": "@workflow/example-hono-nitro", + "private": true, + "type": "module", + "version": "0.0.0", + "scripts": { + "dev": "nitro dev", + "build": "nitro build" + }, + "devDependencies": { + "workflow": "workspace:*", + "ai": "catalog:", + "hono": "^4.9.10", + "lodash.chunk": "^4.2.0", + "nitro": "npm:nitro-nightly@3.0.1-20251019-172914-d1eea57b", + "openai": "^6.6.0", + "zod": "catalog:" + } +} diff --git a/workbench/hono/server.ts b/workbench/hono-nitro/server.ts similarity index 100% rename from workbench/hono/server.ts rename to workbench/hono-nitro/server.ts diff --git a/workbench/hono-nitro/tsconfig.json b/workbench/hono-nitro/tsconfig.json new file mode 120000 index 000000000..8146800ad --- /dev/null +++ b/workbench/hono-nitro/tsconfig.json @@ -0,0 +1 @@ +../nitro-v3/tsconfig.json \ No newline at end of file diff --git a/workbench/hono/turbo.json b/workbench/hono-nitro/turbo.json similarity index 100% rename from workbench/hono/turbo.json rename to workbench/hono-nitro/turbo.json diff --git a/workbench/hono/workflows b/workbench/hono-nitro/workflows similarity index 100% rename from workbench/hono/workflows rename to workbench/hono-nitro/workflows diff --git a/workbench/hono/.gitignore b/workbench/hono/.gitignore index 178daca81..5f9a73eb8 100644 --- a/workbench/hono/.gitignore +++ b/workbench/hono/.gitignore @@ -1,6 +1,31 @@ -manifest.js -.well-known/ -.nitro -.output -.data -.vercel +# dev +.yarn/ +!.yarn/releases +.vscode/* +!.vscode/launch.json +!.vscode/*.code-snippets +.idea/workspace.xml +.idea/usage.statistics.xml +.idea/shelf + +# deps +node_modules/ + +# env +.env +.env.production + +# logs +logs/ +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +# misc +.DS_Store + +# workflow +.workflow \ No newline at end of file diff --git a/workbench/hono/README.md b/workbench/hono/README.md index f6c979e42..e12b31db7 100644 --- a/workbench/hono/README.md +++ b/workbench/hono/README.md @@ -1,26 +1,8 @@ -# Workflows with Hono (Nitro v3) - -- Learn more about Hono: https://hono.dev -- Learn more about Nitro: https://v3.nitro.build/ - -## Commands - -**Local development:** - -```sh +``` +npm install npm run dev ``` -**Production build (Vercel):** - -```sh -NITRO_PRESET=vercel npm run build -npx vercel --prebuilt ``` - -**Production build (Node.js):** - -```sh -npm run build -node .output/server/index.mjs +open http://localhost:3000 ``` diff --git a/workbench/hono/package.json b/workbench/hono/package.json index 6bb837dad..278d4c222 100644 --- a/workbench/hono/package.json +++ b/workbench/hono/package.json @@ -1,19 +1,21 @@ { - "name": "@workflow/example-hono", - "private": true, + "name": "hono", "type": "module", - "version": "0.0.0", "scripts": { - "dev": "nitro dev", - "build": "nitro build" + "dev": "tsx watch src/index.ts", + "build": "tsc", + "start": "node dist/index.js" }, - "devDependencies": { + "dependencies": { + "@hono/node-server": "^1.19.5", "workflow": "workspace:*", - "ai": "catalog:", - "hono": "^4.9.10", - "lodash.chunk": "^4.2.0", - "nitro": "npm:nitro-nightly@3.0.1-20251019-172914-d1eea57b", - "openai": "^6.6.0", - "zod": "catalog:" + "@workflow/core": "workspace:*", + "@workflow/hono": "workspace:*", + "hono": "^4.10.3" + }, + "devDependencies": { + "@types/node": "^20.11.17", + "tsx": "^4.7.1", + "typescript": "^5.8.3" } } diff --git a/workbench/hono/src/index.ts b/workbench/hono/src/index.ts new file mode 100644 index 000000000..a85627a05 --- /dev/null +++ b/workbench/hono/src/index.ts @@ -0,0 +1,26 @@ +import { serve } from '@hono/node-server'; +import { createWorkflowRoutes } from '@workflow/hono'; +import { Hono } from 'hono'; +import { start } from 'workflow/api'; +import { simple } from '../workflows/1_simple.js'; + +const app = new Hono(); + +const workflowRoutes = await createWorkflowRoutes(); + +app.route('/.well-known/workflow', workflowRoutes as any); + +app.get('/', async (c) => { + const run = await start(simple, [1]); + return c.json(run.runId); +}); + +serve( + { + fetch: app.fetch, + port: 3000, + }, + (info) => { + console.log(`Server is running on http://localhost:${info.port}`); + } +); diff --git a/workbench/hono/tsconfig.json b/workbench/hono/tsconfig.json deleted file mode 120000 index 8146800ad..000000000 --- a/workbench/hono/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../nitro-v3/tsconfig.json \ No newline at end of file diff --git a/workbench/hono/tsconfig.json b/workbench/hono/tsconfig.json new file mode 100644 index 000000000..b55223e0d --- /dev/null +++ b/workbench/hono/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "NodeNext", + "strict": true, + "verbatimModuleSyntax": true, + "skipLibCheck": true, + "types": [ + "node" + ], + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx", + "outDir": "./dist" + }, + "exclude": ["node_modules"] +}