@contractspec/lib.workflow-composer 3.7.6 → 3.7.10

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/README.md CHANGED
@@ -1,57 +1,65 @@
1
1
  # @contractspec/lib.workflow-composer
2
2
 
3
- Website: https://contractspec.io/
3
+ Website: https://contractspec.io
4
4
 
5
- Compose base `WorkflowSpec` definitions with tenant-, role-, and device-scoped extensions.
5
+ **Tenant-aware workflow composition helpers for ContractSpec.**
6
6
 
7
- This package is designed for deterministic workflow personalization without duplicating core specs.
7
+ ## What It Provides
8
8
 
9
- ## Highlights
9
+ - **Layer**: lib.
10
+ - **Consumers**: bundles.
11
+ - Related ContractSpec packages include `@contractspec/lib.ai-providers`, `@contractspec/lib.contracts-spec`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
12
+ - Related ContractSpec packages include `@contractspec/lib.ai-providers`, `@contractspec/lib.contracts-spec`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
10
13
 
11
- - Deterministic extension merge ordering with stable tie-breaking.
12
- - Strict extension validation for anchors, transition endpoints, and duplicate injected step IDs.
13
- - Safe hidden-step handling with entry-step protections.
14
- - Metadata and annotations merge support on composed workflow outputs.
15
- - Post-composition validation using `validateWorkflowSpec` from `@contractspec/lib.contracts-spec/workflow`.
14
+ ## Installation
15
+
16
+ `npm install @contractspec/lib.workflow-composer`
17
+
18
+ or
19
+
20
+ `bun add @contractspec/lib.workflow-composer`
16
21
 
17
22
  ## Usage
18
23
 
19
- ```ts
20
- import { WorkflowComposer, approvalStepTemplate } from '@contractspec/lib.workflow-composer';
21
-
22
- const composer = new WorkflowComposer();
23
-
24
- composer.register({
25
- workflow: 'billing.invoiceApproval',
26
- tenantId: 'acme',
27
- priority: 10,
28
- metadata: {
29
- tenant: 'acme',
30
- },
31
- annotations: {
32
- source: 'tenant-extension',
33
- },
34
- customSteps: [
35
- {
36
- after: 'validate-invoice',
37
- inject: approvalStepTemplate({
38
- id: 'acme-legal-review',
39
- label: 'Legal Review (ACME)',
40
- description: 'Tenant-specific compliance step.',
41
- }),
42
- transitionTo: 'final-approval',
43
- },
44
- ],
45
- });
46
-
47
- const runtimeSpec = composer.compose({
48
- base: BaseInvoiceWorkflow,
49
- tenantId: 'acme',
50
- });
51
- ```
24
+ Import the root entrypoint from `@contractspec/lib.workflow-composer`, or choose a documented subpath when you only need one part of the package surface.
25
+
26
+ ## Architecture
27
+
28
+ - `src/composer.test.ts` is part of the package's public or composition surface.
29
+ - `src/composer.ts` is part of the package's public or composition surface.
30
+ - `src/index.ts` is the root public barrel and package entrypoint.
31
+ - `src/injector.ts` is part of the package's public or composition surface.
32
+ - `src/merger.ts` is part of the package's public or composition surface.
33
+ - `src/templates.ts` is part of the package's public or composition surface.
34
+ - `src/types.ts` is shared public type definitions.
35
+
36
+ ## Public Entry Points
37
+
38
+ - Export `.` resolves through `./src/index.ts`.
39
+
40
+ ## Local Commands
41
+
42
+ - `bun run dev` — contractspec-bun-build dev
43
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
44
+ - `bun run test` — bun test --pass-with-no-tests
45
+ - `bun run lint` — bun lint:fix
46
+ - `bun run lint:check` — biome check .
47
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
48
+ - `bun run typecheck` — tsc --noEmit
49
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
50
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
51
+ - `bun run clean` — rimraf dist .turbo
52
+ - `bun run build:bundle` — contractspec-bun-build transpile
53
+ - `bun run build:types` — contractspec-bun-build types
54
+ - `bun run prebuild` — contractspec-bun-build prebuild
55
+
56
+ ## Recent Updates
57
+
58
+ - Replace eslint+prettier by biomejs to optimize speed.
59
+ - Add AI provider ranking system with ranking-driven model selection.
60
+ - Upgrade dependencies.
52
61
 
53
62
  ## Notes
54
63
 
55
- - Extensions are additive and validated before application.
56
- - Composition throws with explicit error codes/messages when extension constraints are violated.
57
- - Runtime behavior remains controlled by `@contractspec/lib.contracts-spec/workflow` runner and validation.
64
+ - Workflow composition must stay tenant-isolated no cross-tenant data leakage.
65
+ - Depends on contracts-spec keep aligned with contract definitions.
@@ -1,17 +1,6 @@
1
- // src/templates.ts
2
- function approvalStepTemplate(options) {
3
- return {
4
- id: options.id,
5
- label: options.label,
6
- type: options.type ?? "human",
7
- description: options.description ?? "Tenant-specific approval",
8
- action: options.action,
9
- guard: options.guardExpression ? {
10
- type: "expression",
11
- value: options.guardExpression
12
- } : undefined
13
- };
14
- }
1
+ // src/composer.ts
2
+ import { satisfies } from "compare-versions";
3
+
15
4
  // src/injector.ts
16
5
  import {
17
6
  validateWorkflowSpec
@@ -206,8 +195,6 @@ function mergeRecords(base, patch) {
206
195
  ...patch ?? {}
207
196
  };
208
197
  }
209
- // src/composer.ts
210
- import { satisfies } from "compare-versions";
211
198
 
212
199
  // src/merger.ts
213
200
  function mergeExtensions(extensions) {
@@ -266,6 +253,20 @@ function matches(params, extension) {
266
253
  }
267
254
  return true;
268
255
  }
256
+ // src/templates.ts
257
+ function approvalStepTemplate(options) {
258
+ return {
259
+ id: options.id,
260
+ label: options.label,
261
+ type: options.type ?? "human",
262
+ description: options.description ?? "Tenant-specific approval",
263
+ action: options.action,
264
+ guard: options.guardExpression ? {
265
+ type: "expression",
266
+ value: options.guardExpression
267
+ } : undefined
268
+ };
269
+ }
269
270
  export {
270
271
  validateExtension,
271
272
  mergeExtensions,
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from './types';
2
- export * from './templates';
3
- export * from './injector';
4
1
  export * from './composer';
5
- export * from './validator';
2
+ export * from './injector';
6
3
  export * from './merger';
4
+ export * from './templates';
5
+ export * from './types';
6
+ export * from './validator';
package/dist/index.js CHANGED
@@ -1,18 +1,7 @@
1
1
  // @bun
2
- // src/templates.ts
3
- function approvalStepTemplate(options) {
4
- return {
5
- id: options.id,
6
- label: options.label,
7
- type: options.type ?? "human",
8
- description: options.description ?? "Tenant-specific approval",
9
- action: options.action,
10
- guard: options.guardExpression ? {
11
- type: "expression",
12
- value: options.guardExpression
13
- } : undefined
14
- };
15
- }
2
+ // src/composer.ts
3
+ import { satisfies } from "compare-versions";
4
+
16
5
  // src/injector.ts
17
6
  import {
18
7
  validateWorkflowSpec
@@ -207,8 +196,6 @@ function mergeRecords(base, patch) {
207
196
  ...patch ?? {}
208
197
  };
209
198
  }
210
- // src/composer.ts
211
- import { satisfies } from "compare-versions";
212
199
 
213
200
  // src/merger.ts
214
201
  function mergeExtensions(extensions) {
@@ -267,6 +254,20 @@ function matches(params, extension) {
267
254
  }
268
255
  return true;
269
256
  }
257
+ // src/templates.ts
258
+ function approvalStepTemplate(options) {
259
+ return {
260
+ id: options.id,
261
+ label: options.label,
262
+ type: options.type ?? "human",
263
+ description: options.description ?? "Tenant-specific approval",
264
+ action: options.action,
265
+ guard: options.guardExpression ? {
266
+ type: "expression",
267
+ value: options.guardExpression
268
+ } : undefined
269
+ };
270
+ }
270
271
  export {
271
272
  validateExtension,
272
273
  mergeExtensions,
@@ -1,17 +1,6 @@
1
- // src/templates.ts
2
- function approvalStepTemplate(options) {
3
- return {
4
- id: options.id,
5
- label: options.label,
6
- type: options.type ?? "human",
7
- description: options.description ?? "Tenant-specific approval",
8
- action: options.action,
9
- guard: options.guardExpression ? {
10
- type: "expression",
11
- value: options.guardExpression
12
- } : undefined
13
- };
14
- }
1
+ // src/composer.ts
2
+ import { satisfies } from "compare-versions";
3
+
15
4
  // src/injector.ts
16
5
  import {
17
6
  validateWorkflowSpec
@@ -206,8 +195,6 @@ function mergeRecords(base, patch) {
206
195
  ...patch ?? {}
207
196
  };
208
197
  }
209
- // src/composer.ts
210
- import { satisfies } from "compare-versions";
211
198
 
212
199
  // src/merger.ts
213
200
  function mergeExtensions(extensions) {
@@ -266,6 +253,20 @@ function matches(params, extension) {
266
253
  }
267
254
  return true;
268
255
  }
256
+ // src/templates.ts
257
+ function approvalStepTemplate(options) {
258
+ return {
259
+ id: options.id,
260
+ label: options.label,
261
+ type: options.type ?? "human",
262
+ description: options.description ?? "Tenant-specific approval",
263
+ action: options.action,
264
+ guard: options.guardExpression ? {
265
+ type: "expression",
266
+ value: options.guardExpression
267
+ } : undefined
268
+ };
269
+ }
269
270
  export {
270
271
  validateExtension,
271
272
  mergeExtensions,
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Step, StepModelHints, WorkflowSpec } from '@contractspec/lib.contracts-spec/workflow';
2
1
  import type { ModelSelector } from '@contractspec/lib.ai-providers/selector-types';
2
+ import type { Step, StepModelHints, WorkflowSpec } from '@contractspec/lib.contracts-spec/workflow';
3
3
  /**
4
4
  * Context provided to operation executors during workflow step execution.
5
5
  * Includes an optional ranking-driven model selector for AI-powered steps.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/lib.workflow-composer",
3
- "version": "3.7.6",
3
+ "version": "3.7.10",
4
4
  "description": "Tenant-aware workflow composition helpers for ContractSpec.",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -24,21 +24,21 @@
24
24
  "dev": "contractspec-bun-build dev",
25
25
  "clean": "rimraf dist .turbo",
26
26
  "lint": "bun lint:fix",
27
- "lint:fix": "eslint src --fix",
28
- "lint:check": "eslint src",
27
+ "lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
28
+ "lint:check": "biome check .",
29
29
  "test": "bun test --pass-with-no-tests",
30
30
  "prebuild": "contractspec-bun-build prebuild",
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@contractspec/lib.contracts-spec": "3.7.6",
35
- "@contractspec/lib.ai-providers": "3.7.6",
34
+ "@contractspec/lib.contracts-spec": "4.1.2",
35
+ "@contractspec/lib.ai-providers": "3.7.8",
36
36
  "compare-versions": "^6.1.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@contractspec/tool.typescript": "3.7.6",
39
+ "@contractspec/tool.typescript": "3.7.8",
40
40
  "typescript": "^5.9.3",
41
- "@contractspec/tool.bun": "3.7.6"
41
+ "@contractspec/tool.bun": "3.7.8"
42
42
  },
43
43
  "exports": {
44
44
  ".": {