# @lssm-tech/integration.workflow-devkit

Workflow DevKit compiler and runtime bridges for ContractSpec workflows

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `2.0.6`
- Package path: `packages/integrations/workflow-devkit`
- Manifest path: `packages/integrations/workflow-devkit/package.json`
- Manifest Git blob: `80feb7dfbe509b56f739b944bea8f4878727e19e`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/integration.workflow-devkit](https://lssm.co/docs/packages/integration.workflow-devkit/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/integration.workflow-devkit.txt)

## Package metadata

```json
{
  "layer": "integrations",
  "physicalArea": null,
  "primaryArea": "workflows-and-automation",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "integrations",
    "catalogKind": "integration",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "experimental"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [Workflows, jobs and automation](https://lssm.co/docs/areas/workflows-and-automation/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/integrations/workflow-devkit/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/README.md",
  "blobSha": "6e1bb34a1f45c3b28079eb32d59161c39c80875c",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# @lssm-tech/integration.workflow-devkit

Workflow DevKit compiler and runtime bridges for ContractSpec `WorkflowSpec`.

## What it provides

- Compile a `WorkflowSpec` into a deterministic Workflow DevKit manifest.
- Generate Workflow, Next.js, and generic-host scaffolding.
- Run a `WorkflowSpec` through injected Workflow DevKit primitives such as `sleep`, hooks, and webhooks.
- Create a Workflow-backed `AgentRuntimeAdapterBundle` for `@lssm-tech/lib.ai-agent`.
- Expose chat route helpers and re-export `WorkflowChatTransport` for reconnectable chat UIs.

## Entry points

- `@lssm-tech/integration.workflow-devkit`
- `@lssm-tech/integration.workflow-devkit/compiler`
- `@lssm-tech/integration.workflow-devkit/runtime`
- `@lssm-tech/integration.workflow-devkit/chat-routes`
- `@lssm-tech/integration.workflow-devkit/agent-adapter`
- `@lssm-tech/integration.workflow-devkit/next`

## Workflow vs step boundary

Workflow DevKit code runs across two different execution contexts:

- Workflow functions (`"use workflow"`) orchestrate control flow and must stay deterministic.
- Step functions (`"use step"`) perform the actual Node.js work.

This matches the Workflow docs: workflow functions do not have full Node.js access, while step functions do. Keep Node.js core modules, SDK clients, database access, and other side effects inside `use step` helpers. The workflow function itself should only compose Workflow primitives and call step helpers.

For `WorkflowSpec` authoring in Workflow-hosted apps, import the safe authoring API from `@lssm-tech/lib.contracts-spec/workflow/spec`, not the broad `@lssm-tech/lib.contracts-spec/workflow` barrel.

## Next.js example

```ts
import { withContractSpecWorkflow } from "@lssm-tech/integration.workflow-devkit/next";
import { createWorkflowChatRoutes } from "@lssm-tech/module.ai-chat/core/workflow";

export default withContractSpecWorkflow({
  experimental: {},
});

const routes = createWorkflowChatRoutes({
  workflow: async (payload) => payload,
  getFollowUpToken({ runId }) {
    return `chat:${runId}`;
  },
});

export const POST = routes.start;
```


## Generic host example

```ts
import { createHook, createWebhook, sleep } from "workflow";
import {
  runWorkflowSpecWithWorkflowDevkit,
  type WorkflowDevkitRuntimeBridge,
} from "@lssm-tech/integration.workflow-devkit";
import { onboardingWorkflow } from "./onboarding.workflow";

export async function runOnboarding(input: Record<string, unknown>, bridge: WorkflowDevkitRuntimeBridge) {
  "use workflow";

  // Keep this function deterministic. Node.js work belongs in `use step`
  // helpers that your bridge dispatches to.
  return runWorkflowSpecWithWorkflowDevkit({
    spec: onboardingWorkflow,
    initialData: input,
    bridge,
    primitives: {
      sleep,
      createHook,
      createWebhook,
    },
  });
}
```



## Declared capabilities

### Integration Workflow Devkit

Capability ID: `package.lssm.tech.integration.workflow.devkit`

Workflow DevKit compiler and runtime bridges for ContractSpec workflows

Use cases:

- Adopt workflow devkit compiler and runtime bridges for contractspec workflows

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "avoidWhen": [
    "The @lssm-tech/integration.workflow-devkit package constraints do not match the target runtime or platform."
  ],
  "requires": [
    "TypeScript"
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "contractspec",
    "workflow",
    "workflow-devkit",
    "durable",
    "typescript",
    "integration",
    "devkit"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/integration.workflow-devkit",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/agent-adapter",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/chat-routes",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/compiler",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/effect-replay",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/helpers",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/integration",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/next",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/runtime",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.workflow-devkit/types",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "integrations",
  "kind": "integration",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./agent-adapter",
    "./chat-routes",
    "./compiler",
    "./effect-replay",
    "./helpers",
    "./integration",
    "./next",
    "./runtime",
    "./types"
  ],
  "examples": [],
  "replacements": []
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/agent-adapter",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/chat-routes",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/compiler",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/effect-replay",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/helpers",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/integration",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/next",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/runtime",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.workflow.devkit",
    "from": "@lssm-tech/integration.workflow-devkit/types",
    "symbols": []
  }
]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/integration.workflow-devkit` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/index.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/agent-adapter` — subpath `./agent-adapter`
  - `unconditional`: `./src/agent-adapter.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/agent-adapter.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/chat-routes` — subpath `./chat-routes`
  - `unconditional`: `./src/chat-routes.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/chat-routes.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/compiler` — subpath `./compiler`
  - `unconditional`: `./src/compiler.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/compiler.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/effect-replay` — subpath `./effect-replay`
  - `unconditional`: `./src/effect-replay.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/effect-replay.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/helpers` — subpath `./helpers`
  - `unconditional`: `./src/helpers.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/helpers.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/integration` — subpath `./integration`
  - `unconditional`: `./src/integration.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/integration.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/next` — subpath `./next`
  - `unconditional`: `./src/next.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/next.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/runtime` — subpath `./runtime`
  - `unconditional`: `./src/runtime.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/runtime.ts); verified source file.

- `@lssm-tech/integration.workflow-devkit/types` — subpath `./types`
  - `unconditional`: `./src/types.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/workflow-devkit/src/types.ts); verified source file.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.ts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": {
      "types": "./dist/index.d.ts",
      "browser": "./dist/browser/index.js",
      "bun": "./dist/index.js",
      "node": "./dist/node/index.js",
      "default": "./dist/index.js"
    },
    "./agent-adapter": {
      "types": "./dist/agent-adapter.d.ts",
      "browser": "./dist/browser/agent-adapter.js",
      "bun": "./dist/agent-adapter.js",
      "node": "./dist/node/agent-adapter.js",
      "default": "./dist/agent-adapter.js"
    },
    "./chat-routes": {
      "types": "./dist/chat-routes.d.ts",
      "browser": "./dist/browser/chat-routes.js",
      "bun": "./dist/chat-routes.js",
      "node": "./dist/node/chat-routes.js",
      "default": "./dist/chat-routes.js"
    },
    "./compiler": {
      "types": "./dist/compiler.d.ts",
      "browser": "./dist/browser/compiler.js",
      "bun": "./dist/compiler.js",
      "node": "./dist/node/compiler.js",
      "default": "./dist/compiler.js"
    },
    "./effect-replay": {
      "types": "./dist/effect-replay.d.ts",
      "browser": "./dist/browser/effect-replay.js",
      "bun": "./dist/effect-replay.js",
      "node": "./dist/node/effect-replay.js",
      "default": "./dist/effect-replay.js"
    },
    "./helpers": {
      "types": "./dist/helpers.d.ts",
      "browser": "./dist/browser/helpers.js",
      "bun": "./dist/helpers.js",
      "node": "./dist/node/helpers.js",
      "default": "./dist/helpers.js"
    },
    "./integration": {
      "types": "./dist/integration.d.ts",
      "browser": "./dist/browser/integration.js",
      "bun": "./dist/integration.js",
      "node": "./dist/node/integration.js",
      "default": "./dist/integration.js"
    },
    "./next": {
      "types": "./dist/next.d.ts",
      "browser": "./dist/browser/next.js",
      "bun": "./dist/next.js",
      "node": "./dist/node/next.js",
      "default": "./dist/next.js"
    },
    "./runtime": {
      "types": "./dist/runtime.d.ts",
      "browser": "./dist/browser/runtime.js",
      "bun": "./dist/runtime.js",
      "node": "./dist/node/runtime.js",
      "default": "./dist/runtime.js"
    },
    "./types": {
      "types": "./dist/types.d.ts",
      "browser": "./dist/browser/types.js",
      "bun": "./dist/types.js",
      "node": "./dist/node/types.js",
      "default": "./dist/types.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.ai-agent](https://lssm.co/docs/packages/lib.ai-agent/): `workspace:^`
- [@lssm-tech/lib.contracts-integrations](https://lssm.co/docs/packages/lib.contracts-integrations/): `workspace:^`
- [@lssm-tech/lib.orchestration-spec](https://lssm.co/docs/packages/lib.orchestration-spec/): `workspace:^`
- [@lssm-tech/lib.schema](https://lssm.co/docs/packages/lib.schema/): `workspace:^`
- [@lssm-tech/lib.workflow-composer](https://lssm.co/docs/packages/lib.workflow-composer/): `workspace:^`
- `@workflow/ai`: `^4.2.1`
- `ai`: `^6.0.286`
- `workflow`: `^4.8.9`

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@lssm-tech/tool.bun](https://lssm.co/docs/packages/tool.bun/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`
- `typescript`: `catalog:`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
  "publish:pkg:canary": "bun publish:pkg --tag canary",
  "build": "contractspec-bun-build build",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "dev": "contractspec-bun-build dev",
  "clean": "rimraf dist .turbo",
  "lint": "bun lint:fix",
  "lint:fix": "node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .",
  "lint:check": "node ../../../scripts/biome.cjs check .",
  "test": "bun test",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Integration Workflow Devkit documentation](https://www.npmjs.com/package/%40lssm-tech%2Fintegration.workflow-devkit) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Fintegration.workflow-devkit",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/integration.workflow-devkit.txt",
  "route": "/llms/integration.workflow-devkit",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/integration.workflow-devkit.txt",
  "blobSha": "6e1bb34a1f45c3b28079eb32d59161c39c80875c",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
