diff --git a/packages/compliance/src/objects/compliance_assessment.state.ts b/packages/compliance/src/objects/compliance_assessment.state.ts deleted file mode 100644 index 0cad908..0000000 --- a/packages/compliance/src/objects/compliance_assessment.state.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Assessment lifecycle: a control test result. - * planned → in_progress (BEGIN — auditor starts work) - * in_progress → passed (PASS — control operating effectively) - * in_progress → failed (FAIL — gaps found) - * in_progress → partial (PARTIAL — some gaps, mitigations in place) - * passed → in_progress (REOPEN — re-test triggered) - * failed → in_progress (REMEDIATE — fix in flight) - * partial → in_progress (REOPEN) - */ -export const AssessmentStateMachine: StateMachineConfig = { - id: 'assessment_lifecycle', - initial: 'planned', - states: { - planned: { on: { BEGIN: { target: 'in_progress' } } }, - in_progress: { - on: { - PASS: { target: 'passed' }, - FAIL: { target: 'failed' }, - PARTIAL: { target: 'partial' }, - }, - }, - passed: { on: { REOPEN: { target: 'in_progress' } } }, - failed: { on: { REMEDIATE: { target: 'in_progress' } } }, - partial: { on: { REOPEN: { target: 'in_progress' } } }, - }, -}; diff --git a/packages/compliance/src/objects/compliance_evidence.state.ts b/packages/compliance/src/objects/compliance_evidence.state.ts deleted file mode 100644 index 5d023e4..0000000 --- a/packages/compliance/src/objects/compliance_evidence.state.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Evidence lifecycle: - * pending → submitted (SUBMIT — proof uploaded) - * submitted → approved (APPROVE — reviewer accepted) - * submitted → rejected (REJECT — needs rework) - * approved → expired (EXPIRE — auto when expires_on < today) - * rejected → pending (RESET — try again) - * expired → pending (REFRESH — new collection cycle) - * - * "expired" is not terminal — a fresh evidence collection cycle resets it. - */ -export const EvidenceStateMachine: StateMachineConfig = { - id: 'evidence_lifecycle', - initial: 'pending', - states: { - pending: { on: { SUBMIT: { target: 'submitted', description: 'Upload proof' } } }, - submitted: { - on: { - APPROVE: { target: 'approved' }, - REJECT: { target: 'rejected', description: 'Reviewer rejected — needs rework' }, - }, - }, - approved: { - on: { - EXPIRE: { target: 'expired', description: 'expires_on reached' }, - }, - }, - rejected: { on: { RESET: { target: 'pending' } } }, - expired: { on: { REFRESH: { target: 'pending', description: 'Begin new collection cycle' } } }, - }, -}; diff --git a/packages/content/src/objects/content_piece.state.ts b/packages/content/src/objects/content_piece.state.ts deleted file mode 100644 index 51d9d08..0000000 --- a/packages/content/src/objects/content_piece.state.ts +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Content piece lifecycle — eight states from idea to archive. - * - * backlog → drafting → in_review → approved → scheduled → published → archived - * │ - * └── request_changes ─▶ drafting - * any non-terminal ── cancel ──▶ cancelled - * - * Why eight states (vs. four like `todo_task`): the content workflow is - * the demo. Multi-tab views, approval gates, and the publish action all - * lean on the distinction between "approved" (ready to schedule) and - * "scheduled" (date picked, awaiting publish). - * - * Approval gate: `in_review → approved` requires the `publish_approval` - * approval process. Cancelling or sending back is always allowed. - */ -export const PieceStateMachine: StateMachineConfig = { - id: 'content_piece_lifecycle', - initial: 'backlog', - states: { - backlog: { - on: { - PICK_UP: { target: 'drafting', description: 'Assign to a writer and start drafting' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Idea is captured but no one has started. Confirm assignee and target channel before transitioning to drafting.', - }, - }, - drafting: { - on: { - SUBMIT: { target: 'in_review', description: 'Submit draft to editorial lead' }, - SEND_BACK: { target: 'backlog', description: 'Park the draft and free the slot' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Author is writing. Do not auto-transition. Help with outline, hooks, and CTA suggestions only.', - }, - }, - in_review: { - on: { - APPROVE: { target: 'approved', description: 'Editorial lead approves for publishing' }, - REQUEST_CHANGES: { target: 'drafting', description: 'Send back with notes' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Awaiting lead approval. The publish_approval process drives the APPROVE transition; never fire it directly.', - }, - }, - approved: { - on: { - SCHEDULE: { target: 'scheduled', description: 'Pick a publish date' }, - REQUEST_CHANGES: { target: 'drafting' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Approved and ready to ship. Schedule with a concrete publish_at — same-day allowed.', - }, - }, - scheduled: { - on: { - PUBLISH: { target: 'published', description: 'Publish now (or on publish_at)' }, - UNSCHEDULE: { target: 'approved', description: 'Pull off the schedule, keep approval' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Date is locked in. PUBLISH creates a publication row per target channel and stamps published_at.', - }, - }, - published: { - on: { - ARCHIVE: { target: 'archived', description: 'Retire piece from active rotation' }, - }, - meta: { - aiInstructions: - 'Live. Do not edit body content here; corrections happen on the publication record. Metrics roll up automatically.', - }, - }, - archived: { - type: 'final', - meta: { - aiInstructions: - 'Retired. Terminal. Use a new content_piece for follow-ups or refreshes.', - }, - }, - cancelled: { - type: 'final', - meta: { - aiInstructions: 'Killed before publishing. Terminal. Do not edit further.', - }, - }, - }, -}; diff --git a/packages/content/src/objects/content_signal.state.ts b/packages/content/src/objects/content_signal.state.ts deleted file mode 100644 index a4a9f6c..0000000 --- a/packages/content/src/objects/content_signal.state.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Signal lifecycle — three states. Captured from competitor watching or - * inbound trend monitoring, then triaged. - * - * captured → promoted (becomes a content_topic — flow handles the link) - * → ignored (not interesting / off-strategy) - * - * Once promoted or ignored the row is terminal: re-triage by cloning a new - * signal record (cheap; signals are high-N). - */ -export const SignalStateMachine: StateMachineConfig = { - id: 'content_signal_lifecycle', - initial: 'captured', - states: { - captured: { - on: { - PROMOTE: { target: 'promoted', description: 'Convert into a content_topic' }, - IGNORE: { target: 'ignored', description: 'Not worth chasing' }, - }, - meta: { - aiInstructions: - 'New signal. Summarize and recommend whether to PROMOTE or IGNORE. Promotion creates a content_topic via the signal_to_topic_promotion flow.', - }, - }, - promoted: { - type: 'final', - meta: { - aiInstructions: - 'Already promoted to a topic. Terminal. Add follow-up signals as new captured rows.', - }, - }, - ignored: { - type: 'final', - meta: { - aiInstructions: - 'Reviewed and dropped. Terminal. Re-capture as a fresh signal if circumstances change.', - }, - }, - }, -}; diff --git a/packages/contracts/src/objects/contracts_contract.state.ts b/packages/contracts/src/objects/contracts_contract.state.ts deleted file mode 100644 index bc736df..0000000 --- a/packages/contracts/src/objects/contracts_contract.state.ts +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Contract lifecycle: - * draft → in_review (submit for internal approval) - * in_review → signed (counterparty signed, PDF attached) - * in_review → draft (kicked back during approval) - * signed → active (effective date reached; usually auto via flow) - * active → expired (auto when end_date < today) - * active → terminated (early termination) - * any open → cancelled (never signed; killed in negotiation) - * - * AI agents reading this: never jump straight from draft to active. - * Approvals enforce the in_review step. - */ -export const ContractStateMachine: StateMachineConfig = { - id: 'contract_lifecycle', - initial: 'draft', - states: { - draft: { - on: { - SUBMIT: { target: 'in_review', description: 'Submit for internal approval' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Contract metadata is still being entered or extracted. Confirm party, amount, dates, and contract_type are populated before SUBMIT.', - }, - }, - in_review: { - on: { - SIGN: { target: 'signed', description: 'Counterparty signed and PDF attached' }, - REJECT: { target: 'draft', description: 'Kicked back by approver — fix issues then resubmit' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Awaiting internal approval. Do not transition automatically. Wait for the approval workflow to dispatch SIGN or REJECT.', - }, - }, - signed: { - on: { - ACTIVATE: { target: 'active', description: 'Effective date reached' }, - TERMINATE: { target: 'terminated', description: 'Terminated before effective date' }, - }, - meta: { - aiInstructions: - 'Fully executed but not yet in force. ACTIVATE fires automatically on the effective date.', - }, - }, - active: { - on: { - EXPIRE: { target: 'expired', description: 'End date reached without renewal' }, - TERMINATE: { target: 'terminated', description: 'Early termination by either party' }, - RENEW: { target: 'active', description: 'Renewed — rolls dates forward, stays active' }, - }, - meta: { - aiInstructions: - 'Currently in force. RENEW updates dates in place; do not create a new contract for routine auto-renewals.', - }, - }, - expired: { - type: 'final', - meta: { - aiInstructions: - 'Reached end_date without renewal. Terminal. Create a new contract record to re-engage the party.', - }, - }, - terminated: { - type: 'final', - meta: { - aiInstructions: 'Ended early. Terminal. Record termination reason in notes.', - }, - }, - cancelled: { - type: 'final', - meta: { - aiInstructions: 'Never signed. Terminal. Do not edit further.', - }, - }, - }, -}; diff --git a/packages/expense/src/objects/expense_report.state.ts b/packages/expense/src/objects/expense_report.state.ts deleted file mode 100644 index 7929469..0000000 --- a/packages/expense/src/objects/expense_report.state.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Expense-Report lifecycle: - * draft → submitted (SUBMIT — send for approval) - * submitted → approved (APPROVE — manager/finance signs off) - * submitted → rejected (REJECT — denied) - * submitted → draft (KICKBACK — send back for edits) - * approved → reimbursed (REIMBURSE — payment issued) - * rejected → draft (REOPEN — fix and resubmit) - * - * "reimbursed" is terminal: money has gone back to the employee. - */ -export const ExpenseReportStateMachine: StateMachineConfig = { - id: 'expense_report_lifecycle', - initial: 'draft', - states: { - draft: { on: { SUBMIT: { target: 'submitted', description: 'Submit for approval' } } }, - submitted: { - on: { - APPROVE: { target: 'approved' }, - REJECT: { target: 'rejected' }, - KICKBACK: { target: 'draft', description: 'Send back for edits' }, - }, - meta: { - aiInstructions: - 'Awaiting approval. Do not transition automatically; wait for the approval process.', - }, - }, - approved: { on: { REIMBURSE: { target: 'reimbursed', description: 'Issue reimbursement' } } }, - rejected: { on: { REOPEN: { target: 'draft' } } }, - reimbursed: { - type: 'final', - meta: { aiInstructions: 'Paid out. Terminal — open a new report for future expenses.' }, - }, - }, -}; diff --git a/packages/helpdesk/src/data/index.ts b/packages/helpdesk/src/data/index.ts index 4c46ac2..39df083 100644 --- a/packages/helpdesk/src/data/index.ts +++ b/packages/helpdesk/src/data/index.ts @@ -206,7 +206,6 @@ const tickets = defineDataset(Ticket, { priority: 'urgent', customer: 'bob.tanaka@hooli.example.com', team: 'T2', - assignee: 'admin', sla_policy: 'Pro Tier SLA', ai_summary: 'Pro-tier customer hitting unexpected HTTP 429 on all API calls since this morning; production impact.', ai_category: 'outage', @@ -231,7 +230,6 @@ const tickets = defineDataset(Ticket, { priority: 'low', customer: 'sofia.garcia@initech.example.com', team: 'T2', - assignee: 'admin', sla_policy: 'Pro Tier SLA', ai_summary: 'Customer requesting Parquet as an additional bulk-export format alongside CSV.', ai_category: 'feature_request', @@ -256,7 +254,6 @@ const tickets = defineDataset(Ticket, { priority: 'normal', customer: 'daniel.kim@stark.example.com', team: 'T1', - assignee: 'admin', sla_policy: 'Free Tier SLA', ai_summary: 'Customer reports empty CSV export on Safari 17.2; works in Chrome. Matches known issue.', ai_category: 'bug', @@ -304,7 +301,6 @@ const tickets = defineDataset(Ticket, { priority: 'low', customer: 'sofia.garcia@initech.example.com', team: 'T1', - assignee: 'admin', sla_policy: 'Pro Tier SLA', ai_summary: 'Customer praising onboarding experience — no issue to resolve, send appreciation.', ai_category: 'feedback', @@ -332,7 +328,6 @@ const tickets = defineDataset(Ticket, { priority: 'low', customer: 'daniel.kim@stark.example.com', team: 'T1', - assignee: 'admin', sla_policy: 'Free Tier SLA', ai_summary: 'New user asking how to invite a teammate. Standard how-to.', ai_category: 'how_to', @@ -359,7 +354,6 @@ const tickets = defineDataset(Ticket, { priority: 'normal', customer: 'alice.chen@acme.example.com', team: 'T1', - assignee: 'admin', sla_policy: 'Enterprise Tier SLA', ai_summary: 'Historical closed ticket retained for reports.', ai_category: 'other', @@ -393,7 +387,6 @@ const messages = defineDataset(Message, { name: 'TIC-2026-003 / outbound / agent / first reply', ticket: 'TIC-2026-003', direction: 'outbound', - author_user: 'admin', body: 'Hi Bob, we see the impact. Engineering is looking now — incident channel #inc-2026-001. Update within 15 min.', sent_at: cel`daysAgo(0)`, is_ai_drafted: true, @@ -402,7 +395,6 @@ const messages = defineDataset(Message, { name: 'TIC-2026-003 / internal / on-call note', ticket: 'TIC-2026-003', direction: 'internal_note', - author_user: 'admin', body: 'Root cause: upstream limiter regex mismatch after the 6.2 deploy. Rolling back limiter config now.', sent_at: cel`daysAgo(0)`, is_ai_drafted: false, @@ -420,7 +412,6 @@ const messages = defineDataset(Message, { name: 'TIC-2026-005 / outbound / agent / confirm known', ticket: 'TIC-2026-005', direction: 'outbound', - author_user: 'admin', body: 'Hi Daniel — confirmed known Safari issue. Workaround: Chrome / Firefox. Fix shipping next week. Marking this as waiting on you to confirm workaround works.', sent_at: cel`daysAgo(1)`, is_ai_drafted: true, @@ -447,7 +438,6 @@ const messages = defineDataset(Message, { name: 'TIC-2026-007 / outbound / agent / thanks', ticket: 'TIC-2026-007', direction: 'outbound', - author_user: 'admin', body: 'Thanks so much, Sofia! Forwarding this to the product team — made our day.', sent_at: cel`daysAgo(1)`, is_ai_drafted: true, diff --git a/packages/helpdesk/src/objects/helpdesk_kb_article.state.ts b/packages/helpdesk/src/objects/helpdesk_kb_article.state.ts deleted file mode 100644 index 0aa2b9e..0000000 --- a/packages/helpdesk/src/objects/helpdesk_kb_article.state.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * KB Article lifecycle: draft → review → published → archived. - * Only published articles are eligible for AI KB recall. - */ -export const KBArticleStateMachine: StateMachineConfig = { - id: 'kb_article_lifecycle', - initial: 'draft', - states: { - draft: { on: { SUBMIT: { target: 'review' } } }, - review: { on: { PUBLISH: { target: 'published' }, REJECT: { target: 'draft' } } }, - published: { on: { ARCHIVE: { target: 'archived' }, EDIT: { target: 'draft' } } }, - archived: { on: { RESTORE: { target: 'draft' } } }, - }, -}; diff --git a/packages/helpdesk/src/objects/helpdesk_ticket.state.ts b/packages/helpdesk/src/objects/helpdesk_ticket.state.ts deleted file mode 100644 index 408610f..0000000 --- a/packages/helpdesk/src/objects/helpdesk_ticket.state.ts +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Helpdesk Ticket lifecycle: - * new → triaged (TRIAGE — usually fired by ai_triage flow) - * triaged → in_progress (PICK_UP — agent starts working) - * in_progress → waiting_customer (AWAIT_CUSTOMER — pending reply from requester) - * waiting_customer → in_progress (CUSTOMER_REPLIED) - * in_progress → resolved (RESOLVE) - * resolved → closed (CLOSE — usually after grace period, see auto_close flow) - * resolved → in_progress (REOPEN — customer says it's not fixed) - * any active → escalated (ESCALATE — angry sentiment / SLA breach) - * escalated → in_progress (DE_ESCALATE) - */ -export const TicketStateMachine: StateMachineConfig = { - id: 'ticket_lifecycle', - initial: 'new', - states: { - new: { - on: { - TRIAGE: { target: 'triaged' }, - ESCALATE: { target: 'escalated' }, - }, - }, - triaged: { - on: { - PICK_UP: { target: 'in_progress' }, - ESCALATE: { target: 'escalated' }, - }, - }, - in_progress: { - on: { - AWAIT_CUSTOMER: { target: 'waiting_customer' }, - RESOLVE: { target: 'resolved' }, - ESCALATE: { target: 'escalated' }, - }, - }, - waiting_customer: { - on: { - CUSTOMER_REPLIED: { target: 'in_progress' }, - RESOLVE: { target: 'resolved', description: 'Resolve without waiting further' }, - ESCALATE: { target: 'escalated' }, - }, - }, - resolved: { - on: { - CLOSE: { target: 'closed' }, - REOPEN: { target: 'in_progress', description: 'Customer says issue persists' }, - }, - }, - escalated: { - on: { - DE_ESCALATE: { target: 'in_progress' }, - RESOLVE: { target: 'resolved' }, - }, - }, - closed: { type: 'final' }, - }, -}; diff --git a/packages/hr/src/objects/hr_time_off_request.state.ts b/packages/hr/src/objects/hr_time_off_request.state.ts deleted file mode 100644 index 1faa11c..0000000 --- a/packages/hr/src/objects/hr_time_off_request.state.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Time-Off Request lifecycle: - * draft → submitted (SUBMIT — request goes to manager) - * submitted → approved (APPROVE — manager signs off) - * submitted → rejected (REJECT — manager declines) - * submitted → draft (KICKBACK — send back for edits) - * approved → cancelled (CANCEL — employee cancels approved leave) - * draft → cancelled (CANCEL — employee abandons draft) - * rejected → draft (REOPEN — try again) - */ -export const TimeOffRequestStateMachine: StateMachineConfig = { - id: 'time_off_lifecycle', - initial: 'draft', - states: { - draft: { - on: { - SUBMIT: { target: 'submitted', description: 'Send to manager for approval' }, - CANCEL: { target: 'cancelled' }, - }, - }, - submitted: { - on: { - APPROVE: { target: 'approved' }, - REJECT: { target: 'rejected' }, - KICKBACK: { target: 'draft', description: 'Return to requester for edits' }, - }, - meta: { - aiInstructions: - 'Awaiting manager decision. Do not auto-advance; wait for an explicit APPROVE / REJECT / KICKBACK.', - }, - }, - approved: { - on: { - CANCEL: { target: 'cancelled', description: 'Employee cancels approved leave' }, - }, - }, - rejected: { - on: { REOPEN: { target: 'draft' } }, - }, - cancelled: { - type: 'final', - }, - }, -}; diff --git a/packages/procurement/src/objects/procurement_order.state.ts b/packages/procurement/src/objects/procurement_order.state.ts deleted file mode 100644 index bc43f28..0000000 --- a/packages/procurement/src/objects/procurement_order.state.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Purchase-Order lifecycle: - * draft → sent (SEND — issued to vendor) - * sent → partial (PARTIAL_RECEIPT — some goods received) - * sent → received (FULLY_RECEIVED — everything in) - * sent → cancelled (CANCEL — pulled before fulfilment) - * partial → received (FULLY_RECEIVED) - * partial → closed (CLOSE_SHORT — close with shortage) - * received → closed (CLOSE) - * - * "partial" is set automatically by the receipt rollup hook when a - * receipt covers some but not all of the PO value. - */ -export const PurchaseOrderStateMachine: StateMachineConfig = { - id: 'po_lifecycle', - initial: 'draft', - states: { - draft: { on: { SEND: { target: 'sent', description: 'Issue to vendor' } } }, - sent: { - on: { - PARTIAL_RECEIPT: { target: 'partial' }, - FULLY_RECEIVED: { target: 'received' }, - CANCEL: { target: 'cancelled' }, - }, - }, - partial: { - on: { - FULLY_RECEIVED: { target: 'received' }, - CLOSE_SHORT: { target: 'closed', description: 'Close with shortage' }, - }, - }, - received: { on: { CLOSE: { target: 'closed' } } }, - closed: { type: 'final' }, - cancelled: { type: 'final' }, - }, -}; diff --git a/packages/procurement/src/objects/procurement_request.state.ts b/packages/procurement/src/objects/procurement_request.state.ts deleted file mode 100644 index 21b93f3..0000000 --- a/packages/procurement/src/objects/procurement_request.state.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Purchase-Request lifecycle: - * draft → submitted (SUBMIT — kick off approval) - * submitted → approved (APPROVE — finance signs off) - * submitted → rejected (REJECT — denied) - * submitted → draft (KICKBACK — send back for edits) - * approved → converted (CONVERT — PO drafted) - * rejected → draft (REOPEN — try again) - * - * "converted" is terminal: a PO has been spawned. Edits should now - * happen against the PO. - */ -export const PurchaseRequestStateMachine: StateMachineConfig = { - id: 'pr_lifecycle', - initial: 'draft', - states: { - draft: { on: { SUBMIT: { target: 'submitted', description: 'Submit for approval' } } }, - submitted: { - on: { - APPROVE: { target: 'approved' }, - REJECT: { target: 'rejected' }, - KICKBACK: { target: 'draft', description: 'Send back for edits' }, - }, - meta: { - aiInstructions: - 'Awaiting approval. Do not transition automatically; wait for the approval workflow.', - }, - }, - approved: { on: { CONVERT: { target: 'converted', description: 'Convert to PO' } } }, - rejected: { on: { REOPEN: { target: 'draft' } } }, - converted: { - type: 'final', - meta: { aiInstructions: 'PO created. Terminal. Edit the PO from here.' }, - }, - }, -}; diff --git a/packages/project/src/objects/pm_project.state.ts b/packages/project/src/objects/pm_project.state.ts deleted file mode 100644 index b8e1ca4..0000000 --- a/packages/project/src/objects/pm_project.state.ts +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Project status state machine. - * Drives the lifecycle: planning → active → (at_risk / on_hold) → completed/cancelled - */ -export const ProjectStateMachine: StateMachineConfig = { - id: 'project_lifecycle', - initial: 'planning', - states: { - planning: { - on: { - START: { target: 'active', description: 'Scope approved — kick the project off.' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Project is being scoped. Confirm dates and a project manager before transitioning to active.', - }, - }, - active: { - on: { - FLAG_RISK: { target: 'at_risk', description: 'Risks or delays identified.' }, - PAUSE: { target: 'on_hold', description: 'Paused by an external blocker.' }, - COMPLETE: { target: 'completed', description: 'All milestones delivered.' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Project is underway. Move to at_risk if AI risk score is high or a milestone slips.', - }, - }, - at_risk: { - on: { - MITIGATE: { target: 'active', description: 'Risks mitigated — back on track.' }, - PAUSE: { target: 'on_hold', description: 'Paused by an external blocker.' }, - COMPLETE: { target: 'completed', description: 'Delivered despite risks.' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Project has identified risks. Recommend mitigation actions before resuming or completing.', - }, - }, - on_hold: { - on: { - RESUME: { target: 'active', description: 'Blocker cleared — resume work.' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: 'Project paused. Surface the blocker and an expected resume date.', - }, - }, - completed: { - type: 'final', - meta: { - aiInstructions: 'Project delivered and terminal. Do not change status.', - }, - }, - cancelled: { - type: 'final', - meta: { - aiInstructions: 'Project cancelled and terminal. Do not change status.', - }, - }, - }, -}; diff --git a/packages/project/src/objects/pm_risk.state.ts b/packages/project/src/objects/pm_risk.state.ts deleted file mode 100644 index da3c0fe..0000000 --- a/packages/project/src/objects/pm_risk.state.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Risk status state machine. - * Lifecycle: identified → assessing → mitigating → monitoring → closed/realized - */ -export const RiskStateMachine: StateMachineConfig = { - id: 'risk_lifecycle', - initial: 'identified', - states: { - identified: { - on: { - ASSESS: { target: 'assessing', description: 'Begin impact / likelihood assessment.' }, - CLOSE: { target: 'closed', description: 'Not relevant — close it out.' }, - }, - meta: { - aiInstructions: - 'Risk has been logged. Score impact and likelihood before moving to assessing.', - }, - }, - assessing: { - on: { - MITIGATE: { target: 'mitigating', description: 'Begin mitigation work.' }, - MONITOR: { target: 'monitoring', description: 'Accept and watch for triggers.' }, - CLOSE: { target: 'closed', description: 'Close the risk.' }, - }, - meta: { - aiInstructions: - 'Risk is being assessed. Recommend mitigate vs. accept-and-monitor based on score.', - }, - }, - mitigating: { - on: { - MITIGATED: { target: 'monitoring', description: 'Mitigation complete — monitor residual.' }, - REALIZE: { target: 'realized', description: 'Risk has occurred.' }, - }, - meta: { - aiInstructions: 'Mitigation in progress. Track owner and due date on mitigation actions.', - }, - }, - monitoring: { - on: { - REACTIVATE: { target: 'mitigating', description: 'Triggers re-emerged — re-mitigate.' }, - CLOSE: { target: 'closed', description: 'Residual risk acceptable — close.' }, - REALIZE: { target: 'realized', description: 'Risk has occurred.' }, - }, - meta: { - aiInstructions: 'Mitigation in place. Watch for trigger conditions; close when stable.', - }, - }, - closed: { - type: 'final', - meta: { - aiInstructions: 'Risk closed and terminal. Do not change status.', - }, - }, - realized: { - type: 'final', - meta: { - aiInstructions: 'Risk realized and terminal — track follow-up as an issue.', - }, - }, - }, -}; diff --git a/packages/todo/src/objects/todo_task.state.ts b/packages/todo/src/objects/todo_task.state.ts deleted file mode 100644 index ae3bc74..0000000 --- a/packages/todo/src/objects/todo_task.state.ts +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2026 ObjectStack contributors. Apache-2.0 license. - -import { StateMachineConfig } from '@objectstack/spec/automation'; - -/** - * Task lifecycle: - * todo → doing → done - * any → cancelled - * done → todo (REOPEN) - * - * Keeps the canonical "started / completed / aborted" verbs an AI agent - * or external API needs, while preventing accidental jumps like - * `cancelled → done`. - */ -export const TaskStateMachine: StateMachineConfig = { - id: 'task_lifecycle', - initial: 'todo', - states: { - todo: { - on: { - START: { target: 'doing', description: 'Begin work on the task' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Task is queued. Confirm assignee and due date before transitioning to doing.', - }, - }, - doing: { - on: { - COMPLETE: { target: 'done', description: 'All acceptance criteria met' }, - BLOCK: { target: 'todo', description: 'Unblock and re-queue' }, - CANCEL: { target: 'cancelled' }, - }, - meta: { - aiInstructions: - 'Task in progress. If blocked, move back to todo with a comment explaining why.', - }, - }, - done: { - on: { - REOPEN: { target: 'todo', description: 'Reopen if regression detected' }, - }, - meta: { - aiInstructions: - 'Task is complete. Only reopen if a defect surfaces; otherwise do not change status.', - }, - }, - cancelled: { - type: 'final', - meta: { - aiInstructions: 'Task is cancelled and is terminal. Do not edit further.', - }, - }, - }, -};