OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

workflow.instance.start

Start a new workflow instance.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.workflow-system
  • Tags: workflow, instance, start
  • File: packages/examples/workflow-system/src/instance/instance.operations.ts
  • field.key.label
    workflow.instance.start
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    workflow.instance.start
    field.description.label

    Start a new workflow instance.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.workflow-system
  • Tags: workflow, instance, start
  • File: packages/examples/workflow-system/src/instance/instance.operations.ts
  • field.tags.label
    workflow,instance,start
    field.owners.label
    @example.workflow-system
    field.stability.label
    stable

    Start a new workflow instance.

    Goal

    Initiate a workflow for a business process.

    Context

    Order creation, request submission, etc.

    Emitted Events

    `workflow.instance.started` (v1.0.0)

    `workflow.step.entered` (v1.0.0)

    Source Definition

    import {
    	defineCommand,
    	defineQuery,
    } from '@lssm-tech/lib.contracts-spec/operations';
    import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
    import { InstanceStatusEnum } from './instance.enum';
    import {
    	StartWorkflowInputModel,
    	TransitionInputModel,
    	TransitionResultModel,
    	WorkflowInstanceModel,
    } from './instance.schema';
    
    export const StartWorkflowContract = defineCommand({
    	meta: {
    		key: 'workflow.instance.start',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@example.workflow-system'],
    		tags: ['workflow', 'instance', 'start'],
    		description: 'Start a new workflow instance.',
    		goal: 'Initiate a workflow for a business process.',
    		context: 'Order creation, request submission, etc.',
    	},
    	io: {
    		input: StartWorkflowInputModel,
    		output: WorkflowInstanceModel,
    	},
    	policy: { auth: 'user' },
    	sideEffects: {
    		emits: [
    			{
    				key: 'workflow.instance.started',
    				version: '1.0.0',
    				when: 'Workflow starts',
    				payload: WorkflowInstanceModel,
    			},
    			{
    				key: 'workflow.step.entered',
    				version: '1.0.0',
    				when: 'First step entered',
    				payload: WorkflowInstanceModel,
    			},
    		],
    		audit: ['workflow.instance.started'],
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'start-workflow-happy-path',
    				given: ['Workflow definition exists'],
    				when: ['User starts workflow'],
    				then: ['Instance is created and started'],
    			},
    		],
    		examples: [
    			{
    				key: 'start-onboarding',
    				input: {
    					workflowKey: 'onboarding-v1',
    					context: { employeeId: 'emp-123' },
    				},
    				output: { id: 'inst-456', status: 'running' },
    			},
    		],
    	},
    });