@mastra/factory 0.30.0-alpha.4 → 0.31.0-alpha.0
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 +32 -10
- package/dist/factory.d.ts +12 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +72 -31
- package/dist/factory.js.map +1 -1
- package/dist/integrations/gitlab/api.d.ts +3 -2
- package/dist/integrations/gitlab/api.d.ts.map +1 -1
- package/dist/integrations/gitlab/api.js +12 -9
- package/dist/integrations/gitlab/api.js.map +1 -1
- package/dist/integrations/issue-reconcile-worker.d.ts +5 -0
- package/dist/integrations/issue-reconcile-worker.d.ts.map +1 -1
- package/dist/integrations/issue-reconcile-worker.js +17 -1
- package/dist/integrations/issue-reconcile-worker.js.map +1 -1
- package/dist/integrations/platform/connect/routes.d.ts +22 -13
- package/dist/integrations/platform/connect/routes.d.ts.map +1 -1
- package/dist/integrations/platform/connect/routes.js +63 -64
- package/dist/integrations/platform/connect/routes.js.map +1 -1
- package/dist/integrations/platform/foundation/connect-binding.d.ts +125 -0
- package/dist/integrations/platform/foundation/connect-binding.d.ts.map +1 -0
- package/dist/integrations/platform/foundation/connect-binding.js +252 -0
- package/dist/integrations/platform/foundation/connect-binding.js.map +1 -0
- package/dist/integrations/platform/foundation/connect-event-poller.d.ts +49 -0
- package/dist/integrations/platform/foundation/connect-event-poller.d.ts.map +1 -0
- package/dist/integrations/platform/foundation/connect-event-poller.js +304 -0
- package/dist/integrations/platform/foundation/connect-event-poller.js.map +1 -0
- package/dist/integrations/platform/foundation/connect-events.d.ts +31 -0
- package/dist/integrations/platform/foundation/connect-events.d.ts.map +1 -0
- package/dist/integrations/platform/foundation/connect-events.js +7 -0
- package/dist/integrations/platform/foundation/connect-events.js.map +1 -0
- package/dist/integrations/platform/foundation/index.d.ts +10 -0
- package/dist/integrations/platform/foundation/index.d.ts.map +1 -0
- package/dist/integrations/platform/foundation/index.js +6 -0
- package/dist/integrations/platform/foundation/intake.d.ts +39 -0
- package/dist/integrations/platform/foundation/intake.d.ts.map +1 -0
- package/dist/integrations/platform/foundation/intake.js +45 -0
- package/dist/integrations/platform/foundation/intake.js.map +1 -0
- package/dist/integrations/platform/foundation/integration.d.ts +84 -0
- package/dist/integrations/platform/foundation/integration.d.ts.map +1 -0
- package/dist/integrations/platform/foundation/integration.js +107 -0
- package/dist/integrations/platform/foundation/integration.js.map +1 -0
- package/dist/integrations/platform/github/event-worker.d.ts +2 -2
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -1
- package/dist/integrations/platform/github/event-worker.js +4 -8
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts +3 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +131 -70
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/platform/gitlab/connect-events.d.ts +22 -0
- package/dist/integrations/platform/gitlab/connect-events.d.ts.map +1 -0
- package/dist/integrations/platform/gitlab/connect-events.js +49 -0
- package/dist/integrations/platform/gitlab/connect-events.js.map +1 -0
- package/dist/integrations/platform/gitlab/integration.d.ts +24 -15
- package/dist/integrations/platform/gitlab/integration.d.ts.map +1 -1
- package/dist/integrations/platform/gitlab/integration.js +61 -26
- package/dist/integrations/platform/gitlab/integration.js.map +1 -1
- package/dist/integrations/platform/incidentio/intake.d.ts +33 -0
- package/dist/integrations/platform/incidentio/intake.d.ts.map +1 -0
- package/dist/integrations/platform/incidentio/intake.js +271 -0
- package/dist/integrations/platform/incidentio/intake.js.map +1 -0
- package/dist/integrations/platform/incidentio/integration.d.ts +11 -23
- package/dist/integrations/platform/incidentio/integration.d.ts.map +1 -1
- package/dist/integrations/platform/incidentio/integration.js +27 -297
- package/dist/integrations/platform/incidentio/integration.js.map +1 -1
- package/dist/integrations/platform/jira/intake.d.ts +60 -0
- package/dist/integrations/platform/jira/intake.d.ts.map +1 -0
- package/dist/integrations/platform/jira/intake.js +445 -0
- package/dist/integrations/platform/jira/intake.js.map +1 -0
- package/dist/integrations/platform/jira/integration.d.ts +13 -37
- package/dist/integrations/platform/jira/integration.d.ts.map +1 -1
- package/dist/integrations/platform/jira/integration.js +29 -468
- package/dist/integrations/platform/jira/integration.js.map +1 -1
- package/dist/integrations/platform/linear/event-worker.d.ts +2 -2
- package/dist/integrations/platform/linear/event-worker.d.ts.map +1 -1
- package/dist/integrations/platform/linear/event-worker.js +5 -9
- package/dist/integrations/platform/linear/event-worker.js.map +1 -1
- package/dist/integrations/platform/linear/integration.d.ts +3 -1
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -1
- package/dist/integrations/platform/linear/integration.js +9 -9
- package/dist/integrations/platform/linear/integration.js.map +1 -1
- package/dist/integrations/platform/logging.d.ts +6 -0
- package/dist/integrations/platform/logging.d.ts.map +1 -0
- package/dist/integrations/platform/logging.js +25 -0
- package/dist/integrations/platform/logging.js.map +1 -0
- package/dist/integrations/platform/platform-connect.d.ts +38 -0
- package/dist/integrations/platform/platform-connect.d.ts.map +1 -0
- package/dist/integrations/platform/platform-connect.js +109 -0
- package/dist/integrations/platform/platform-connect.js.map +1 -0
- package/dist/integrations/platform/vanta/integration.d.ts +12 -18
- package/dist/integrations/platform/vanta/integration.d.ts.map +1 -1
- package/dist/integrations/platform/vanta/integration.js +38 -38
- package/dist/integrations/platform/vanta/integration.js.map +1 -1
- package/dist/memory-embedder.d.ts +11 -0
- package/dist/memory-embedder.d.ts.map +1 -0
- package/dist/memory-embedder.js +19 -0
- package/dist/memory-embedder.js.map +1 -0
- package/dist/metrics/config.d.ts +1 -1
- package/dist/metrics/config.d.ts.map +1 -1
- package/dist/metrics/config.js +1 -0
- package/dist/metrics/config.js.map +1 -1
- package/dist/metrics/index.js +2 -2
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics/sandbox.d.ts +3 -3
- package/dist/metrics/sandbox.js +13 -13
- package/dist/metrics/sandbox.js.map +1 -1
- package/dist/metrics/session.d.ts +28 -0
- package/dist/metrics/session.d.ts.map +1 -0
- package/dist/metrics/session.js +76 -0
- package/dist/metrics/session.js.map +1 -0
- package/dist/routes/source-control-sessions.d.ts +5 -0
- package/dist/routes/source-control-sessions.d.ts.map +1 -1
- package/dist/routes/source-control-sessions.js +65 -7
- package/dist/routes/source-control-sessions.js.map +1 -1
- package/dist/routes/surface.d.ts +5 -0
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +1 -0
- package/dist/routes/surface.js.map +1 -1
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/processor.d.ts +29 -1
- package/dist/rules/processor.d.ts.map +1 -1
- package/dist/rules/processor.js +156 -23
- package/dist/rules/processor.js.map +1 -1
- package/dist/rules/public-failure-reason.js +1 -1
- package/dist/rules/public-failure-reason.js.map +1 -1
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +33 -9
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts +2 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +4 -2
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/work-item-branch.d.ts +7 -1
- package/dist/work-item-branch.d.ts.map +1 -1
- package/dist/work-item-branch.js +9 -1
- package/dist/work-item-branch.js.map +1 -1
- package/dist/work-items/card-facts.d.ts.map +1 -1
- package/dist/work-items/card-facts.js +2 -2
- package/dist/work-items/card-facts.js.map +1 -1
- package/package.json +13 -13
- package/dist/integrations/platform/api-client.d.ts +0 -34
- package/dist/integrations/platform/api-client.d.ts.map +0 -1
- package/dist/integrations/platform/api-client.js +0 -186
- package/dist/integrations/platform/api-client.js.map +0 -1
- package/dist/integrations/platform/gitlab/event-worker.d.ts +0 -64
- package/dist/integrations/platform/gitlab/event-worker.d.ts.map +0 -1
- package/dist/integrations/platform/gitlab/event-worker.js +0 -304
- package/dist/integrations/platform/gitlab/event-worker.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-failure-reason.js","names":[],"sources":["../../src/rules/public-failure-reason.ts"],"sourcesContent":["import { classifyProviderError, PROVIDER_CALL_ERROR_NAME } from '@mastra/core/error';\nimport type { ProviderFailureKind } from '@mastra/core/error';\n\nimport type { FactoryDispatchFailureCode } from '../storage/domains/work-items/base.js';\nimport { factoryDispatchFailureMetadata, FactoryRuleRejectedError } from './dispatch-errors.js';\nimport type { FactoryRuleRejectionCode } from './types.js';\n\nexport function causeOf(error: unknown): unknown {\n return error && typeof error === 'object' && 'cause' in error ? error.cause : undefined;\n}\n\nexport function isProviderCallError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n if ('name' in error && typeof error.name === 'string' && PROVIDER_CALL_ERROR_NAME.test(error.name)) return true;\n return 'statusCode' in error || 'responseBody' in error;\n}\n\n// Everything below is fixed wording or a name from Factory's public source:\n// a public pull request must never see provider or internal error text.\n\nconst PROVIDER_FAILURE_DETAIL: Record<Exclude<ProviderFailureKind, 'unknown'>, string> = {\n auth: 'the model provider rejected the credentials',\n quota: 'the model provider quota is exhausted',\n rate_limited: 'the model provider rate-limited the run',\n context_overflow: 'the conversation exceeded the model context window',\n model_rejected: 'the model provider rejected the model',\n tool_history_rejected: 'the model provider rejected the tool-call history',\n timeout: 'the model provider timed out',\n unavailable: 'the model provider was unavailable',\n invalid_request: 'the model provider rejected the request',\n};\n\nconst RULE_REJECTION_DETAIL: Record<FactoryRuleRejectionCode, string> = {\n forbidden: 'the board refused the move',\n invalid_transition: 'the board does not allow that move',\n missing_binding: 'the card has no run binding for that move',\n stale: 'the card changed while it was being moved',\n timeout: 'a board rule timed out',\n rule_error: 'a board rule threw an error',\n causal_depth_exceeded: 'too many automatic moves chained from one change',\n repeated_transition: 'the same automatic move repeated too often',\n approval_required: 'the move needs approval from a person',\n card_busy: 'a run is already in flight on the card',\n};\n\n// Built-in error names say what kind of fault it was without saying anything about where.\nconst BUILT_IN_ERROR_NAMES = new Set([\n 'AbortError',\n 'EvalError',\n 'RangeError',\n 'ReferenceError',\n 'SyntaxError',\n 'TimeoutError',\n 'TypeError',\n 'URIError',\n]);\n\n// Factory's own error classes say where it failed; the names are in its public source.\n// A test fails when a new error class is neither listed here nor excluded in public-failure-reason.test.ts.\nexport const FACTORY_ERROR_NAMES: ReadonlySet<string> = new Set([\n 'BoardDefinitionError',\n 'BoardWriteError',\n 'FactoryProjectNotFoundError',\n 'FactoryRuleValidationError',\n 'FactoryRunBindingSupersededError',\n 'FactorySecretDecryptionError',\n 'FactorySourceControlConflictError',\n 'FactorySourceSessionResolutionError',\n 'FactoryStartTransitionError',\n 'GitLabApiError',\n 'IncidentioApiError',\n 'JiraApiError',\n 'LinearReauthRequiredError',\n 'MastraGatewayError',\n 'MaterializeError',\n '
|
|
1
|
+
{"version":3,"file":"public-failure-reason.js","names":[],"sources":["../../src/rules/public-failure-reason.ts"],"sourcesContent":["import { classifyProviderError, PROVIDER_CALL_ERROR_NAME } from '@mastra/core/error';\nimport type { ProviderFailureKind } from '@mastra/core/error';\n\nimport type { FactoryDispatchFailureCode } from '../storage/domains/work-items/base.js';\nimport { factoryDispatchFailureMetadata, FactoryRuleRejectedError } from './dispatch-errors.js';\nimport type { FactoryRuleRejectionCode } from './types.js';\n\nexport function causeOf(error: unknown): unknown {\n return error && typeof error === 'object' && 'cause' in error ? error.cause : undefined;\n}\n\nexport function isProviderCallError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n if ('name' in error && typeof error.name === 'string' && PROVIDER_CALL_ERROR_NAME.test(error.name)) return true;\n return 'statusCode' in error || 'responseBody' in error;\n}\n\n// Everything below is fixed wording or a name from Factory's public source:\n// a public pull request must never see provider or internal error text.\n\nconst PROVIDER_FAILURE_DETAIL: Record<Exclude<ProviderFailureKind, 'unknown'>, string> = {\n auth: 'the model provider rejected the credentials',\n quota: 'the model provider quota is exhausted',\n rate_limited: 'the model provider rate-limited the run',\n context_overflow: 'the conversation exceeded the model context window',\n model_rejected: 'the model provider rejected the model',\n tool_history_rejected: 'the model provider rejected the tool-call history',\n timeout: 'the model provider timed out',\n unavailable: 'the model provider was unavailable',\n invalid_request: 'the model provider rejected the request',\n};\n\nconst RULE_REJECTION_DETAIL: Record<FactoryRuleRejectionCode, string> = {\n forbidden: 'the board refused the move',\n invalid_transition: 'the board does not allow that move',\n missing_binding: 'the card has no run binding for that move',\n stale: 'the card changed while it was being moved',\n timeout: 'a board rule timed out',\n rule_error: 'a board rule threw an error',\n causal_depth_exceeded: 'too many automatic moves chained from one change',\n repeated_transition: 'the same automatic move repeated too often',\n approval_required: 'the move needs approval from a person',\n card_busy: 'a run is already in flight on the card',\n};\n\n// Built-in error names say what kind of fault it was without saying anything about where.\nconst BUILT_IN_ERROR_NAMES = new Set([\n 'AbortError',\n 'EvalError',\n 'RangeError',\n 'ReferenceError',\n 'SyntaxError',\n 'TimeoutError',\n 'TypeError',\n 'URIError',\n]);\n\n// Factory's own error classes say where it failed; the names are in its public source.\n// A test fails when a new error class is neither listed here nor excluded in public-failure-reason.test.ts.\nexport const FACTORY_ERROR_NAMES: ReadonlySet<string> = new Set([\n 'BoardDefinitionError',\n 'BoardWriteError',\n 'FactoryProjectNotFoundError',\n 'FactoryRuleValidationError',\n 'FactoryRunBindingSupersededError',\n 'FactorySecretDecryptionError',\n 'FactorySourceControlConflictError',\n 'FactorySourceSessionResolutionError',\n 'FactoryStartTransitionError',\n 'GitLabApiError',\n 'IncidentioApiError',\n 'JiraApiError',\n 'LinearReauthRequiredError',\n 'MastraGatewayError',\n 'MaterializeError',\n 'PlatformConnectionNotConnectedError',\n 'PullRequestClosedError',\n 'RealtimeSessionError',\n 'ReviewBoardInUseError',\n 'SessionBranchHeldError',\n 'SessionOwnershipMismatchError',\n 'SetupCommandError',\n 'SkillInvocationError',\n 'SlackSessionStartError',\n 'SourceControlConnectionNotFoundError',\n 'StoredBoardError',\n 'UntrustedSharedSessionError',\n 'WorkItemRelationError',\n 'WorkItemRepositoryError',\n 'WorkItemSourceConflictError',\n 'WorkItemSplitModeError',\n 'WorkItemUpdateConflictError',\n]);\n\nconst MAX_CAUSE_DEPTH = 8;\n\nfunction causeChain(error: unknown): object[] {\n const chain: object[] = [];\n for (let current = error; current && chain.length < MAX_CAUSE_DEPTH; current = causeOf(current)) {\n if (typeof current !== 'object' || chain.includes(current)) break;\n chain.push(current);\n }\n return chain;\n}\n\nfunction field(error: object, key: string): unknown {\n return (error as Record<string, unknown>)[key];\n}\n\n/** The error's name, or its class name when it never set one; bundlers may suffix a renamed class with `$n`. */\nfunction namesOf(error: object): string[] {\n const names: string[] = [];\n const name = field(error, 'name');\n if (typeof name === 'string') names.push(name);\n const constructorName = (error as { constructor?: { name?: unknown } }).constructor?.name;\n if (typeof constructorName === 'string') names.push(constructorName.replace(/\\$\\d+$/, ''));\n return names;\n}\n\nfunction providerDetail(error: object): string | undefined {\n if (!isProviderCallError(error)) return undefined;\n const kind = classifyProviderError(error);\n if (kind === 'unknown') return undefined;\n const status = field(error, 'statusCode');\n const http = typeof status === 'number' && Number.isInteger(status) && status >= 400 && status < 600;\n return http ? `${PROVIDER_FAILURE_DETAIL[kind]}, HTTP ${status}` : PROVIDER_FAILURE_DETAIL[kind];\n}\n\nfunction ruleRejectionDetail(error: object): string | undefined {\n if (!(error instanceof FactoryRuleRejectedError)) return undefined;\n return Object.hasOwn(RULE_REJECTION_DETAIL, error.code) ? RULE_REJECTION_DETAIL[error.code] : undefined;\n}\n\nfunction first<T>(chain: object[], pick: (error: object) => T | undefined): T | undefined {\n for (const error of chain) {\n const picked = pick(error);\n if (picked !== undefined) return picked;\n }\n return undefined;\n}\n\nfunction publicDetail(error: unknown): string | undefined {\n const chain = causeChain(error);\n const where = first(chain, candidate => namesOf(candidate).find(name => FACTORY_ERROR_NAMES.has(name)));\n const what =\n first(chain, providerDetail) ??\n first(chain, ruleRejectionDetail) ??\n first(chain, candidate => namesOf(candidate).find(name => BUILT_IN_ERROR_NAMES.has(name)));\n if (where && what) return `${where}: ${what}`;\n return where ?? what;\n}\n\n/**\n * Why a run failed, safe to show on a public pull request: the failure code's label,\n * plus a detail drawn from a fixed vocabulary when the error can be classified.\n * Error messages are never included; operators read those from the decision's stored error.\n */\nexport function publicFailureReason(code: FactoryDispatchFailureCode, error: unknown): string {\n const label = factoryDispatchFailureMetadata(code).label;\n const detail = publicDetail(error);\n return detail ? `${label} (${detail})` : label;\n}\n"],"mappings":";;;AAOA,SAAgB,QAAQ,OAAyB;CAC/C,OAAO,SAAS,OAAO,UAAU,YAAY,WAAW,QAAQ,MAAM,QAAQ,KAAA;AAChF;AAEA,SAAgB,oBAAoB,OAAyB;CAC3D,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,IAAI,UAAU,SAAS,OAAO,MAAM,SAAS,YAAY,yBAAyB,KAAK,MAAM,IAAI,GAAG,OAAO;CAC3G,OAAO,gBAAgB,SAAS,kBAAkB;AACpD;AAKA,MAAM,0BAAmF;CACvF,MAAM;CACN,OAAO;CACP,cAAc;CACd,kBAAkB;CAClB,gBAAgB;CAChB,uBAAuB;CACvB,SAAS;CACT,aAAa;CACb,iBAAiB;AACnB;AAEA,MAAM,wBAAkE;CACtE,WAAW;CACX,oBAAoB;CACpB,iBAAiB;CACjB,OAAO;CACP,SAAS;CACT,YAAY;CACZ,uBAAuB;CACvB,qBAAqB;CACrB,mBAAmB;CACnB,WAAW;AACb;AAGA,MAAM,uCAAuB,IAAI,IAAI;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAID,MAAa,sCAA2C,IAAI,IAAI;CAC9D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,kBAAkB;AAExB,SAAS,WAAW,OAA0B;CAC5C,MAAM,QAA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c,CAAA;CAAE,CAWpG;AA4BD,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,GAAG,SAAS,CAEpF;AAwGD,qBAAa,wBAAwB;;IAanC,YAAY,OAAO,EAAE,+BAA+B,EAYnD;IAED,IAAI,aAAa,IAAI,MAAM,CAE1B;IAEK,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA0DpF;CA0gBF"}
|
|
@@ -56,14 +56,24 @@ function auditActorOf(actor) {
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
/** The commit lost a race on the card's revision; a board policy's own `stale` is not one. */
|
|
60
|
+
function isRevisionConflict(result) {
|
|
61
|
+
return result.status === "rejected" && result.code === "stale" && result.reason === "The work item changed before this transition committed.";
|
|
61
62
|
}
|
|
62
63
|
/** Tell the caller where the card is now, so a model doesn't read "stale" as "already moved". */
|
|
63
64
|
function staleRejection(result, current) {
|
|
64
65
|
const stage = currentStage(current.stages) ?? current.stages.join(", ");
|
|
65
66
|
return rejection(result.transitionId, result.itemId, "stale", `The card changed (now revision ${current.revision}, in ${stage}). Retry with expectedRevision ${current.revision} if the move still applies.`);
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Whether an agent's stale move asked for the board and phase the card is already in. Only an
|
|
70
|
+
* agent's own move: rules and intake routes re-read and re-plan against the card on `stale`.
|
|
71
|
+
*/
|
|
72
|
+
function reachedTarget(request, current) {
|
|
73
|
+
if (request.actor.type !== "agent" || request.eventRoute || request.initialEntry || request.reenter) return false;
|
|
74
|
+
if (request.toBoard !== void 0 && request.toBoard !== request.board) return false;
|
|
75
|
+
return boardForWorkItem(current) === request.board && currentStage(current.stages) === request.stage;
|
|
76
|
+
}
|
|
67
77
|
function currentStage(stages) {
|
|
68
78
|
return stages.length === 1 ? stages[0] : void 0;
|
|
69
79
|
}
|
|
@@ -182,15 +192,29 @@ var FactoryTransitionService = class {
|
|
|
182
192
|
};
|
|
183
193
|
}
|
|
184
194
|
let result = await this.#evaluateAndCommit(request, transitionId, item);
|
|
185
|
-
|
|
195
|
+
let from = item;
|
|
196
|
+
if (isRevisionConflict(result)) {
|
|
186
197
|
const current = await this.#storage.get({
|
|
187
198
|
orgId: request.orgId,
|
|
188
199
|
id: request.workItemId
|
|
189
200
|
});
|
|
190
|
-
if (current
|
|
201
|
+
if (current && reachedTarget(request, current)) {
|
|
202
|
+
from = current;
|
|
203
|
+
result = await this.#evaluateAndCommit({
|
|
204
|
+
...request,
|
|
205
|
+
expectedRevision: current.revision
|
|
206
|
+
}, transitionId, current, { reachedTarget: true });
|
|
207
|
+
if (isRevisionConflict(result)) {
|
|
208
|
+
const latest = await this.#storage.get({
|
|
209
|
+
orgId: request.orgId,
|
|
210
|
+
id: request.workItemId
|
|
211
|
+
});
|
|
212
|
+
if (latest) result = staleRejection(result, latest);
|
|
213
|
+
}
|
|
214
|
+
} else if (current) result = staleRejection(result, current);
|
|
191
215
|
}
|
|
192
|
-
await this.#recordTransition(request,
|
|
193
|
-
this.#notifyCommitted(request,
|
|
216
|
+
await this.#recordTransition(request, from, result);
|
|
217
|
+
this.#notifyCommitted(request, from, result);
|
|
194
218
|
return result;
|
|
195
219
|
}
|
|
196
220
|
#notifyCommitted(request, item, result) {
|
|
@@ -257,7 +281,7 @@ var FactoryTransitionService = class {
|
|
|
257
281
|
console.warn(`[factory] audit failed for transition ${result.transitionId}:`, error);
|
|
258
282
|
});
|
|
259
283
|
}
|
|
260
|
-
async #evaluateAndCommit(request, transitionId, item) {
|
|
284
|
+
async #evaluateAndCommit(request, transitionId, item, { reachedTarget = false } = {}) {
|
|
261
285
|
const boards = await this.#boards.load(request);
|
|
262
286
|
if (request.causalChain && request.causalChain.length > 8) return this.#commitRejection(request, transitionId, "causal_depth_exceeded", "Factory rule causal depth exceeded.");
|
|
263
287
|
const itemSource = workItemSource(item.externalSource);
|
|
@@ -405,9 +429,9 @@ var FactoryTransitionService = class {
|
|
|
405
429
|
};
|
|
406
430
|
}
|
|
407
431
|
return this.#commit(request, transitionId, evaluation, evaluation.outcome === "accepted" ? {
|
|
408
|
-
...consentEffect(request, entersWorking, humanMove),
|
|
432
|
+
...reachedTarget ? {} : consentEffect(request, entersWorking, humanMove),
|
|
409
433
|
...evaluation.intents
|
|
410
|
-
} : {}, boards, fromStage);
|
|
434
|
+
} : {}, reachedTarget ? void 0 : boards, fromStage);
|
|
411
435
|
}
|
|
412
436
|
/** A run in flight on the card's sessions, or one queued for it: what the board shows as busy. */
|
|
413
437
|
async #cardBusy(request) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-service.js","names":[],"sources":["../../src/rules/transition-service.ts"],"sourcesContent":["import { BUSY_CARD_MOVE_REFUSAL, phaseMayStartRun } from '../boards/busy-card.js';\nimport { DEFAULT_BOARD_ID, REVIEW_CONTEXT } from '../boards/index.js';\nimport type { BoardRegistry, InstalledBoard } from '../boards/index.js';\nimport { autoApprovedExitTool, exitToolSucceeded } from '../boards/phase-automation.js';\nimport { phaseRunDecision } from '../boards/phase-runner.js';\nimport { toBoardSource } from '../boards/project-boards.js';\nimport type { ProjectBoardSource } from '../boards/project-boards.js';\nimport { boardFlow, boardForWorkItem, hasPullRequest, pullRequestCardRejection } from '../boards/semantics.js';\nimport { boardTransitionPolicyResultSchema, immutablePolicySnapshot } from '../boards/transition-policy.js';\nimport type { AuditActorProfileInput, AuditActorType, AuditContext } from '../storage/domains/audit/base.js';\nimport type { AuditRecorder } from '../storage/domains/audit/domain.js';\nimport { isFactoryPrincipalId } from '../storage/domains/projects/base.js';\nimport { isAgentActor } from '../storage/domains/work-items/base.js';\nimport type { Card, WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport { isRunBearingDecision } from './run-bearing.js';\nimport type {\n FactoryCommitDecision,\n FactoryRuleActor,\n FactoryRuleBoard,\n FactoryRuleCausalEntry,\n FactoryRuleRejectionCode,\n FactoryRuleStage,\n FactoryStageRuleContext,\n FactoryTransitionResult,\n FactoryTransitionResultRejected,\n} from './types.js';\nimport { factoryRuleSourceForWorkItem, workItemSource } from './types.js';\nimport {\n MAX_FACTORY_RULE_CAUSAL_DEPTH,\n assertFactoryDecisionTarget,\n validateFactoryRuleDecision,\n validateFactoryRuleDecisions,\n} from './validation.js';\n\nconst RULE_TIMEOUT_MS = 5_000;\nconst MAX_REJECTION_REASON = 512;\n/** Longest a committed transition waits for terminal resource cleanup. Cleanup\n * reattaches remote sandboxes, so a hung provider call must not leave the\n * already-committed transition request pending; past this bound the cleanup\n * keeps running in the background as pure best-effort. */\nconst TERMINAL_CLEANUP_TIMEOUT_MS = 30_000;\n\nexport interface FactoryTransitionRequest {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n /** Installed board id; the service rejects boards that are not installed. */\n board: string;\n stage: FactoryRuleStage;\n expectedRevision: number;\n actor: FactoryRuleActor;\n actorProfile?: AuditActorProfileInput;\n /** Where a browser request came from; rules and agents carry none. */\n context?: AuditContext;\n ingress: { type: 'human' | 'agent' | 'toolResult' | 'github' | 'rule'; identity: string; transitionId?: string };\n cause: string;\n causalChain?: readonly FactoryRuleCausalEntry[];\n /** Internal materialization path: start the destination phase's runner even when already at that stage. */\n initialEntry?: boolean;\n /** Starts the stage's runner again when the item already holds that stage, to restart work the entry invalidated. */\n reenter?: boolean;\n /** Internal proof that this move consumes an approved `submit_plan` result. */\n planApproved?: true;\n /** Internal: the tool whose successful result this move consumes (a tool-result rule's move). */\n completedTool?: string;\n /**\n * Internal: an intake route moves the card on a status event. A route is admin-authored, so it\n * may name any phase on the card's board regardless of the board's next phases, working ones\n * included. The phase's `autoStart` and the dispatcher's approval check decide whether its run starts.\n */\n eventRoute?: {\n routeId: string;\n };\n /**\n * The move answers an outside author's pull request event. The move stands — a rule or a\n * provider's default decided it — but any run the destination phase queues is compute and code\n * execution on that author's say-so: it must wait for a person, however the phase starts.\n */\n untrustedPullRequestEvent?: boolean;\n /**\n * Internal: intake filing moves a fresh card from the board's first phase to the phase its\n * route names. Like `eventRoute` the target is admin-authored, so the first phase's next\n * phases don't restrict it — but only while the card still sits in that first phase; every\n * other check (phase, card shape, consent) still applies.\n */\n routeFiling?: boolean;\n /**\n * Internal, with `eventRoute` only: the installed board the route moves the card to, at `stage`.\n * `board` stays the card's current board. The target board's next phases don't restrict the\n * move; its phase, card shape and policy checks still apply, and its phase's runner starts.\n */\n toBoard?: string;\n}\n\nexport interface FactoryTransitionServiceOptions {\n configVersion: string;\n storage: WorkItemsStorage;\n /** A fixed registry, or the per-project boards; each transition loads its project's boards. */\n boards?: BoardRegistry | ProjectBoardSource;\n /** Every commit, accepted or rejected, lands here as `stage_moved` / `transition_rejected` under the request's actor. */\n audit?: AuditRecorder;\n timeoutMs?: number;\n /**\n * Called after a transition commits into a phase the board declares\n * terminal — the point where the item's sessions stop receiving runs, so\n * resources they hold (e.g. sandboxes) can be released for reuse. Awaited,\n * but failures are swallowed: releasing resources must never break or roll\n * back the committed transition.\n */\n onTerminalStage?: (args: {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n stage: FactoryRuleStage;\n revision: number;\n /** The actor that committed this terminal transition. Lets cleanup leave\n * the seat that drove its own transition (an agent tool call) untouched. */\n actor: FactoryRuleActor;\n }) => Promise<void> | void;\n /**\n * Called after a transition commits a stage change, e.g. to tell the item's\n * followers. Not awaited, and failures are logged: a notification must never\n * fail or delay the committed transition.\n */\n onTransitionCommitted?: (args: {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n fromStage: string | undefined;\n toStage: string;\n fromBoard: string;\n toBoard: string;\n }) => Promise<void> | void;\n /**\n * Called after a transition commits out of the last phase that runs in a\n * context: the new phase runs in another context (or none) and is not\n * terminal, e.g. Triage → Planning. The context's session gets no more\n * runs until the card comes back, so its sandbox can stop. Awaited under\n * the same bound as `onTerminalStage`, and failures are swallowed.\n */\n onContextLeft?: (args: {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n /** The context the card left. */\n context: string;\n /** The context the new phase runs in, if it runs one. */\n toContext: string | undefined;\n revision: number;\n actor: FactoryRuleActor;\n }) => Promise<void> | void;\n /** Upper bound on how long a committed transition waits for\n * `onTerminalStage` or `onContextLeft` before returning (default 30s). The\n * cleanup continues in the background past the bound. */\n terminalCleanupTimeoutMs?: number;\n /**\n * Whether a run is in flight on the card's sessions. With a run queued for the card, it makes the\n * card busy, and a person's move into a phase that may start a run is refused while it is.\n * Without it only a queued run counts.\n */\n runInFlight?: (card: { orgId: string; factoryProjectId: string; workItemId: string }) => Promise<boolean>;\n /**\n * Called after a person moves a Work card from Intake or Triage into Planning or\n * Building, which approves the work. Fire-and-forget: failures are swallowed, the committed transition never\n * depends on it.\n */\n onAccepted?: (args: {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n item: Card;\n }) => Promise<void> | void;\n}\n\nfunction rejection(\n transitionId: string,\n itemId: string,\n code: FactoryRuleRejectionCode,\n reason: string,\n): FactoryTransitionResult {\n return { status: 'rejected', transitionId, itemId, code, reason: reason.slice(0, MAX_REJECTION_REASON) };\n}\n\nfunction actorId(actor: FactoryRuleActor): string {\n switch (actor.type) {\n case 'human':\n case 'system':\n return actor.id;\n case 'agent':\n return `agent:${actor.bindingId}`;\n case 'github':\n return `github:${actor.login}`;\n case 'gitlab':\n return `gitlab:${actor.username}`;\n }\n}\n\n// The dispatcher executes an agent-approved decision as a human actor so its consent carries; the trail still names the agent.\nexport function auditActorOf(actor: FactoryRuleActor): { actorId: string; actorType: AuditActorType } {\n const id = actorId(actor);\n switch (actor.type) {\n case 'github':\n case 'gitlab':\n return { actorId: id, actorType: 'human' };\n case 'human':\n return { actorId: id, actorType: isAgentActor(id) ? 'agent' : isFactoryPrincipalId(id) ? 'system' : 'human' };\n default:\n return { actorId: id, actorType: actor.type };\n }\n}\n\nfunction isStale(result: FactoryTransitionResult): result is FactoryTransitionResultRejected {\n return result.status === 'rejected' && result.code === 'stale';\n}\n\n/** Tell the caller where the card is now, so a model doesn't read \"stale\" as \"already moved\". */\nfunction staleRejection(result: FactoryTransitionResultRejected, current: Card): FactoryTransitionResult {\n const stage = currentStage(current.stages) ?? current.stages.join(', ');\n return rejection(\n result.transitionId,\n result.itemId,\n 'stale',\n `The card changed (now revision ${current.revision}, in ${stage}). Retry with expectedRevision ${current.revision} if the move still applies.`,\n );\n}\n\nexport function currentStage(stages: readonly string[]): FactoryRuleStage | undefined {\n return stages.length === 1 ? stages[0] : undefined;\n}\n\ninterface TransitionConsentOptions {\n autonomy?: 'arm' | 'disarm';\n consentedBy?: string;\n /** A person moved a card into its board's build seat from before it (see {@link acceptsWork}): that move approves the work. */\n accepted?: boolean;\n}\n\n/**\n * Whether moving a card from `from` to `to` hands it to the board's builder for the first time: `to`\n * runs in the seat of the board's build phase ({@link boardFlow}), and `from` is a resting phase or a\n * working phase of another seat that is no review (Work: Intake or Triage into Planning or Building).\n * On a cross-board move `from` is the source board's phase — a same-named destination phase is a\n * different one — while the build seat is always the destination board's. Roles compare across\n * boards because they are names.\n */\nfunction acceptsWork(board: InstalledBoard, fromBoard: InstalledBoard, from: string, to: string): boolean {\n const buildRole = boardFlow(board).buildRole;\n if (!buildRole || board.roleForPhase(to) !== buildRole) return false;\n const fromPhase = fromBoard.phases[from];\n if (!fromPhase || fromPhase.kind === 'terminal') return false;\n if (fromPhase.kind === 'resting') return true;\n const fromRole = fromPhase.runner.context;\n return fromRole !== buildRole && fromRole !== REVIEW_CONTEXT;\n}\n\n// Entering a resting lane disarms whoever rests it; only a person's move into a working lane arms.\nfunction transitionConsent(working: boolean, humanMove: boolean): 'arm' | 'disarm' | undefined {\n if (!working) return 'disarm';\n return humanMove ? 'arm' : undefined;\n}\n\n// An event arriving as data (GitHub, sweeps) never pre-approves the runs its transition queues.\nfunction bearsConsent(actor: FactoryRuleActor): boolean {\n return actor.type === 'human' || actor.type === 'agent';\n}\n\n// Rides the transition's own revision-checked commit, so a stale or rejected commit flips nothing.\nfunction consentEffect(\n request: FactoryTransitionRequest,\n working: boolean,\n humanMove: boolean,\n): TransitionConsentOptions {\n // A provider event (a reopen, a close) is not a person's say-so: whatever a person armed before\n // no longer stands once a route moves the card.\n if (request.eventRoute) return { autonomy: 'disarm' };\n const autonomy = transitionConsent(working, humanMove);\n return bearsConsent(request.actor) ? { autonomy, consentedBy: actorId(request.actor) } : { autonomy };\n}\n\ntype RunStartDecision = Extract<FactoryCommitDecision, { type: 'invokeSkill' | 'sendMessage' }>;\n\nfunction startsRun(decision: FactoryCommitDecision): decision is RunStartDecision {\n return decision.type === 'invokeSkill' || (decision.type === 'sendMessage' && decision.prepareBinding === true);\n}\n\n// Answering a recorded run start, or the role's own mid-run agent, with a run would start a second one.\n// A run that starts after its own agent's move is queued onto that agent's run instead.\nfunction runAlreadyUnderway(request: FactoryTransitionRequest, decision: RunStartDecision): boolean {\n // A run-start cause marks an agent landing the card where its run already is — on its own\n // board. A cross-board request is never that, and its destination runner still queues.\n const sameBoard = request.toBoard === undefined || request.toBoard === request.board;\n if (request.cause === 'run_start' && sameBoard) return true;\n if (decision.type === 'invokeSkill' && decision.startsAfterOwnMove === true) return false;\n return request.actor.type === 'agent' && request.actor.role === decision.role;\n}\n\n// On a board change the phase names alone can read as no move at all (\"from triage to triage\"),\n// so the notice names both boards whenever the card crosses them.\nfunction stageTransitionMessage(\n fromStage: FactoryRuleStage,\n toStage: FactoryRuleStage,\n boards?: { from: string; to: string },\n): string {\n if (boards) {\n return `This work was moved from the ${fromStage} stage on the ${boards.from} board to the ${toStage} stage on the ${boards.to} board.`;\n }\n return `This work was moved from the ${fromStage} stage to the ${toStage} stage.`;\n}\n\nfunction isHumanTransition(request: FactoryTransitionRequest): boolean {\n return request.actor.type === 'human' && request.ingress.type === 'human';\n}\n\nfunction ruleFailure(error: unknown): { code: FactoryRuleRejectionCode; reason: string } {\n return {\n code: 'rule_error',\n reason: error instanceof Error ? `Factory rule failed: ${error.message}` : 'Factory rule failed.',\n };\n}\n\nasync function withRuleTimeout<T>(operation: Promise<T>, timeoutMs: number): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => reject(new Error('FACTORY_RULE_TIMEOUT')), timeoutMs);\n });\n try {\n return await Promise.race([operation, timeout]);\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n\nexport class FactoryTransitionService {\n readonly #configVersion: string;\n readonly #boards: ProjectBoardSource;\n readonly #storage: WorkItemsStorage;\n readonly #timeoutMs: number;\n readonly #onTerminalStage: FactoryTransitionServiceOptions['onTerminalStage'];\n readonly #onContextLeft: FactoryTransitionServiceOptions['onContextLeft'];\n readonly #terminalCleanupTimeoutMs: number;\n readonly #onAccepted: FactoryTransitionServiceOptions['onAccepted'];\n readonly #onTransitionCommitted: FactoryTransitionServiceOptions['onTransitionCommitted'];\n readonly #audit: AuditRecorder | undefined;\n readonly #runInFlight: FactoryTransitionServiceOptions['runInFlight'];\n\n constructor(options: FactoryTransitionServiceOptions) {\n this.#configVersion = options.configVersion;\n this.#boards = toBoardSource(options.boards);\n this.#storage = options.storage;\n this.#audit = options.audit;\n this.#timeoutMs = options.timeoutMs ?? RULE_TIMEOUT_MS;\n this.#onTerminalStage = options.onTerminalStage;\n this.#onContextLeft = options.onContextLeft;\n this.#onAccepted = options.onAccepted;\n this.#onTransitionCommitted = options.onTransitionCommitted;\n this.#runInFlight = options.runInFlight;\n this.#terminalCleanupTimeoutMs = options.terminalCleanupTimeoutMs ?? TERMINAL_CLEANUP_TIMEOUT_MS;\n }\n\n get configVersion(): string {\n return this.#configVersion;\n }\n\n async transition(request: FactoryTransitionRequest): Promise<FactoryTransitionResult> {\n const replay = await this.#storage.getTransitionResultByIngress(\n request.orgId,\n request.factoryProjectId,\n request.ingress.identity,\n );\n if (replay) return replay as unknown as FactoryTransitionResult;\n\n const transitionId = request.ingress.transitionId ?? globalThis.crypto.randomUUID();\n const item = await this.#storage.get({ orgId: request.orgId, id: request.workItemId });\n if (!item) {\n const rejection = await this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n 'Work item not found.',\n );\n await this.#recordTransition(request, undefined, rejection);\n return rejection;\n }\n // A person naming another board moves the card there: the same cross-board commit a\n // card-move rule makes, under the caller's own name. Runs the old board queued for the\n // card are superseded inside the commit itself; what this move queues stays.\n if (isHumanTransition(request) && !request.eventRoute && request.toBoard === undefined) {\n const itemBoard = boardForWorkItem(item);\n if (request.board !== itemBoard) {\n request = { ...request, board: itemBoard, toBoard: request.board };\n }\n }\n let result = await this.#evaluateAndCommit(request, transitionId, item);\n if (isStale(result)) {\n const current = await this.#storage.get({ orgId: request.orgId, id: request.workItemId });\n if (current) result = staleRejection(result, current);\n }\n await this.#recordTransition(request, item, result);\n this.#notifyCommitted(request, item, result);\n return result;\n }\n\n #notifyCommitted(request: FactoryTransitionRequest, item: Card, result: FactoryTransitionResult): void {\n const onTransitionCommitted = this.#onTransitionCommitted;\n if (!onTransitionCommitted || result.status !== 'accepted') return;\n // Board-neutral: `currentStage` only knows the built-in rule stages.\n const fromStage = item.stages.length === 1 ? item.stages[0] : undefined;\n // A board change is a stage change even under the same phase name: on another board that\n // name is a different phase, and the one the card left must end its goal.\n const movedBoards = request.toBoard !== undefined && request.toBoard !== request.board;\n if (result.stage === fromStage && !movedBoards) return;\n // Inside the chain so a synchronous throw is isolated the same way an async rejection is.\n void Promise.resolve()\n .then(() =>\n onTransitionCommitted({\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: item.id,\n fromStage,\n toStage: result.stage,\n fromBoard: request.board,\n toBoard: request.toBoard ?? request.board,\n }),\n )\n .catch(error => {\n console.warn(`[factory] stage notification failed for work item ${item.id}:`, error);\n });\n }\n\n /** A rejection can outlive its work item: the row still names the id the caller asked for. */\n async #recordTransition(\n request: FactoryTransitionRequest,\n item: Card | undefined,\n result: FactoryTransitionResult,\n ): Promise<void> {\n if (!this.#audit) return;\n // Board-neutral, like the stage notification: `currentStage` only knows the\n // built-in rule stages and would drop custom-board phases.\n const from = item && item.stages.length === 1 ? item.stages[0] : undefined;\n // A board-only move keeps the phase name yet moves the card: it is audited like any move.\n const movedBoards = request.toBoard !== undefined && request.toBoard !== request.board;\n if (result.status === 'accepted' && result.stage === from && !request.reenter && !movedBoards) return;\n const outcome =\n result.status === 'accepted'\n ? { action: 'factory.work_item.stage_moved' as const, to: result.stage, revision: result.revision }\n : {\n action: 'factory.work_item.transition_rejected' as const,\n to: request.stage,\n code: result.code,\n reason: result.reason,\n };\n const { action, ...detail } = outcome;\n await this.#audit\n .record({\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n ...auditActorOf(request.actor),\n actorProfile: request.actorProfile,\n ...(request.context ? { context: request.context } : {}),\n action,\n idempotencyKey: result.transitionId,\n targets: [{ type: 'work_item', id: item?.id ?? request.workItemId, ...(item ? { name: item.title } : {}) }],\n metadata: {\n transitionId: result.transitionId,\n ingressType: request.ingress.type,\n cause: request.cause,\n configVersion: this.#configVersion,\n ...(from ? { from } : {}),\n ...(request.toBoard !== undefined && request.toBoard !== request.board\n ? { fromBoard: request.board, toBoard: request.toBoard }\n : {}),\n ...(request.reenter ? { reenter: true } : {}),\n ...detail,\n },\n })\n .catch(error => {\n console.warn(`[factory] audit failed for transition ${result.transitionId}:`, error);\n });\n }\n\n async #evaluateAndCommit(\n request: FactoryTransitionRequest,\n transitionId: string,\n item: Card,\n ): Promise<FactoryTransitionResult> {\n const boards = await this.#boards.load(request);\n if (request.causalChain && request.causalChain.length > MAX_FACTORY_RULE_CAUSAL_DEPTH) {\n return this.#commitRejection(\n request,\n transitionId,\n 'causal_depth_exceeded',\n 'Factory rule causal depth exceeded.',\n );\n }\n const itemSource = workItemSource(item.externalSource);\n const source = factoryRuleSourceForWorkItem(itemSource);\n const isPullRequest = source === 'pullRequest' || source === 'gitlabPullRequest';\n // Rows filed before boards were persisted belong to the default board.\n if (item.board === null && !boards.has(DEFAULT_BOARD_ID)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n 'This legacy work item has no assigned board. Assign an installed board and phase through the work-item PATCH endpoint before transitioning it.',\n );\n }\n const itemBoard = boardForWorkItem(item);\n if (request.board !== itemBoard) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `The work item belongs to board \"${itemBoard}\", not \"${request.board}\".`,\n );\n }\n const fromBoard = boards.get(request.board);\n if (!fromBoard) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `Board \"${request.board}\" is not installed.`,\n );\n }\n if (request.toBoard !== undefined && !request.eventRoute && !isHumanTransition(request)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n 'Only a card-move rule or a person can move a card to another board.',\n );\n }\n const targetBoard = request.toBoard ?? request.board;\n const board = targetBoard === request.board ? fromBoard : boards.get(targetBoard);\n if (!board) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `Board \"${targetBoard}\" is not installed.`,\n );\n }\n const fromStage = item.stages.length === 1 ? item.stages[0] : undefined;\n if (!fromStage || !Object.prototype.hasOwnProperty.call(fromBoard.phases, fromStage)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n 'The work item does not have one canonical phase on the requested board.',\n );\n }\n // The board's own reason comes first: its phase graph alone only says the move is not\n // declared, which leaves an agent moving an issue card to PR review guessing why.\n const cardShapeRejection = pullRequestCardRejection(\n board,\n {\n standalonePullRequest: isPullRequest,\n hasPullRequest: hasPullRequest({ workItem: item.workItem, source: itemSource }),\n },\n request.stage,\n );\n if (cardShapeRejection) {\n return this.#commitRejection(request, transitionId, 'invalid_transition', cardShapeRejection);\n }\n // Filing jumps the first phase's declared edges only from that phase: a card another actor\n // moved in between follows the board's graph again.\n const filesPastEdges = request.routeFiling === true && fromStage === fromBoard.initialPhase;\n if (\n !Object.prototype.hasOwnProperty.call(board.phases, request.stage) ||\n (!request.eventRoute &&\n board === fromBoard &&\n !filesPastEdges &&\n !board.allowsTransition(fromStage, request.stage))\n ) {\n if (board !== fromBoard) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `The ${board.name} board has no phase ${request.stage}.`,\n );\n }\n const nextStages = [...new Set((board.transitions[fromStage] ?? []).map(transition => transition.to))];\n const nextStagesReason =\n nextStages.length > 0\n ? `Next stages declared from ${fromStage}: ${nextStages.join(', ')}.`\n : `No next stage is declared from ${fromStage}.`;\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `The ${board.name} board does not allow moving from ${fromStage} to ${request.stage}. ${nextStagesReason}`,\n );\n }\n\n // A person's cross-board move takes live work, not finished cards, and lands it where work can\n // continue: a finished card stays where it finished, and finishing belongs to the card's own board.\n const crossesBoards = board !== fromBoard;\n if (crossesBoards && !request.eventRoute) {\n if (fromBoard.isTerminal(fromStage)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `The work item is finished on the ${fromBoard.name} board and stays there.`,\n );\n }\n if (board.isTerminal(request.stage)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `A card finishes on its own board; move it to a non-terminal ${board.name} phase instead.`,\n );\n }\n }\n\n if (\n isHumanTransition(request) &&\n !request.initialEntry &&\n // Leaving the board strands whatever run is queued or underway, so every cross-board move of\n // a busy card is refused — whatever cause it names, even into a phase sharing the old one's\n // name or a phase that starts nothing itself.\n (crossesBoards ||\n (request.cause !== 'run_start' &&\n (fromStage !== request.stage || request.reenter === true) &&\n phaseMayStartRun(board.phaseKind(request.stage)))) &&\n (await this.#cardBusy(request))\n ) {\n return this.#commitRejection(request, transitionId, 'card_busy', BUSY_CARD_MOVE_REFUSAL);\n }\n\n // The coordinator's own self-move at run start would otherwise inject a second run's kickoff.\n // Crossing boards is always a move: a same-named phase on another board is a different phase.\n const humanMove =\n request.actor.type === 'human' && (fromStage !== request.stage || crossesBoards) && request.cause !== 'run_start';\n // The board, not the phase name, says whether a seat is engaged on either side of this move.\n const entersWorking = board.isWorking(request.stage);\n const seatRole = board.roleForPhase(request.stage);\n\n const contextBase = {\n tenant: { orgId: request.orgId, projectId: request.factoryProjectId },\n actor: request.actor,\n ingress: { type: request.ingress.type, id: request.ingress.identity },\n cause: request.cause,\n causalChain: request.causalChain ?? [],\n configVersion: this.#configVersion,\n item: {\n id: item.id,\n source: itemSource,\n sourceKey: item.externalSource\n ? `${item.externalSource.integrationId}:${item.externalSource.type}:${item.externalSource.externalId}`\n : null,\n parentWorkItemId: item.parentWorkItemId,\n title: item.title,\n url: item.externalSource?.url ?? null,\n stages: [...item.stages],\n workItem: item.workItem,\n acceptedAt: item.acceptedAt,\n metadata: item.metadata,\n },\n board: board.id,\n itemRevision: item.revision,\n source,\n fromStage,\n toStage: request.stage,\n } satisfies Omit<FactoryStageRuleContext, 'stage'>;\n\n let evaluation:\n | { outcome: 'accepted'; decisions: Record<string, unknown>[]; intents: TransitionConsentOptions }\n | { outcome: 'rejected'; code: string; reason: string };\n try {\n evaluation = await withRuleTimeout(\n (async () => {\n // Plans are approved without a person only where the card's phase auto-approves submit_plan.\n const plansAutoApproved = autoApprovedExitTool(boards, item) === 'submit_plan';\n // A phase with an exit tool holds the card until the tool succeeds (for submit_plan, with\n // an approved plan; autoApprove only decides whether it approves itself). Then the agent,\n // or the board's own rule for the tool, moves the card. A person can move it any time.\n const fromPhase = fromBoard.phases[fromStage];\n const exitTool = fromPhase?.kind === 'working' ? fromPhase.exitTool : undefined;\n if (\n request.actor.type !== 'human' &&\n // A start lands the card where its run already is; it is not the agent leaving a phase.\n request.cause !== 'run_start' &&\n !request.eventRoute &&\n exitTool &&\n fromStage !== request.stage &&\n entersWorking &&\n !(exitTool.id === 'submit_plan' ? request.planApproved === true : request.completedTool === exitTool.id) &&\n !exitToolSucceeded(item, fromStage, exitTool.id)\n ) {\n return {\n outcome: 'rejected' as const,\n code: 'approval_required',\n reason:\n exitTool.id === 'submit_plan'\n ? `${fromPhase!.name} ends when submit_plan comes back with an approved plan; until then the card stays here. Call submit_plan and wait for a person to approve the plan (or for it to be approved automatically), then move the card into ${board.phases[request.stage]?.name ?? request.stage} with factory_transition_work_item.`\n : `${fromPhase!.name} ends when ${exitTool.id} succeeds; until then the card stays here. A person can also move it from the Factory board or a chat they are signed in to.`,\n };\n }\n const policy = boardTransitionPolicyResultSchema.parse(\n await board.transitionPolicy?.(\n immutablePolicySnapshot({\n ...contextBase,\n item: { ...contextBase.item, triageType: item.triageType },\n initialEntry: request.initialEntry ?? false,\n reenter: request.reenter ?? false,\n isHumanTransition: isHumanTransition(request),\n plansAutoApproved,\n planApproved: request.planApproved === true,\n requestedTriageType: undefined,\n }),\n ),\n );\n if (policy?.type === 'reject') {\n return { outcome: 'rejected' as const, code: policy.code, reason: policy.reason };\n }\n const run = phaseRunDecision(board, request.stage, contextBase, {\n initialEntry: request.initialEntry,\n reenter: request.reenter,\n boardEntry: crossesBoards,\n });\n const validated = validateFactoryRuleDecisions(run ? [run] : [], contextBase.causalChain.length).filter(\n decision => {\n assertFactoryDecisionTarget(decision, boards, board.id);\n return !(startsRun(decision) && runAlreadyUnderway(request, decision));\n },\n );\n // An outside author's pull request event may move the card, but the run it queues is\n // compute and code execution on that author's say-so: it waits for a person, even in a\n // phase that starts on its own.\n if (request.untrustedPullRequestEvent) {\n for (const decision of validated) {\n if (\n decision.type === 'invokeSkill' ||\n (decision.type === 'sendMessage' && decision.prepareBinding === true)\n ) {\n decision.untrustedPullRequestEvent = true;\n }\n }\n }\n if (humanMove) {\n const message = stageTransitionMessage(\n fromStage,\n request.stage,\n crossesBoards ? { from: fromBoard.name, to: board.name } : undefined,\n );\n const skill = validated.find(decision => decision.type === 'invokeSkill');\n if (skill) {\n skill.precedingMessage = message;\n } else {\n validated.unshift({\n type: 'sendMessage',\n idempotencyKey: `factory-stage:${transitionId}`,\n message,\n priority: 'urgent',\n idleBehavior: 'wake',\n // Parking a card says stop: no seat is right by construction, so\n // the notice goes to whichever session is live — or nobody.\n ...(entersWorking && seatRole !== undefined ? { role: seatRole, prepareBinding: true } : {}),\n });\n }\n }\n return {\n outcome: 'accepted' as const,\n intents: {\n accepted: isHumanTransition(request) && acceptsWork(board, fromBoard, fromStage, request.stage),\n },\n decisions: validateFactoryRuleDecisions(validated) as unknown as Record<string, unknown>[],\n };\n })(),\n this.#timeoutMs,\n );\n } catch (error) {\n const failed =\n error instanceof Error && error.message === 'FACTORY_RULE_TIMEOUT'\n ? { code: 'timeout' as const, reason: 'Factory rule evaluation timed out.' }\n : ruleFailure(error);\n evaluation = { outcome: 'rejected', ...failed };\n }\n return this.#commit(\n request,\n transitionId,\n evaluation,\n evaluation.outcome === 'accepted'\n ? { ...consentEffect(request, entersWorking, humanMove), ...evaluation.intents }\n : {},\n boards,\n fromStage,\n );\n }\n\n /** A run in flight on the card's sessions, or one queued for it: what the board shows as busy. */\n async #cardBusy(request: FactoryTransitionRequest): Promise<boolean> {\n const queued = await this.#storage.listDeferredDecisions(request.orgId, request.factoryProjectId, {\n statuses: ['pending', 'retry', 'leased'],\n workItemId: request.workItemId,\n });\n if (queued.some(decision => isRunBearingDecision(decision.decision))) return true;\n return (await this.#runInFlight?.(request)) ?? false;\n }\n\n async #commitRejection(\n request: FactoryTransitionRequest,\n transitionId: string,\n code: FactoryRuleRejectionCode,\n reason: string,\n ): Promise<FactoryTransitionResult> {\n return this.#commit(\n request,\n transitionId,\n { outcome: 'rejected', code, reason: reason.slice(0, MAX_REJECTION_REASON) },\n {},\n undefined,\n );\n }\n\n async #commit(\n request: FactoryTransitionRequest,\n transitionId: string,\n evaluation:\n | { outcome: 'accepted'; decisions: Record<string, unknown>[] }\n | { outcome: 'rejected'; code: string; reason: string },\n options: TransitionConsentOptions,\n // The registry the move was evaluated against; rejected moves never release resources.\n boards: BoardRegistry | undefined,\n fromStage?: string,\n ): Promise<FactoryTransitionResult> {\n const committed = await this.#storage.commitTransition({\n autonomy: options.autonomy,\n consentedBy: options.consentedBy,\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: request.workItemId,\n expectedRevision: request.expectedRevision,\n destinationStage: request.stage,\n ...(request.toBoard !== undefined && request.toBoard !== request.board\n ? { destinationBoard: request.toBoard }\n : {}),\n actorId: actorId(request.actor),\n ingress: { identity: request.ingress.identity, transitionId },\n causalChain: [...(request.causalChain ?? [])],\n evaluation,\n });\n if (committed.status === 'missing') {\n return rejection(transitionId, request.workItemId, 'invalid_transition', 'Work item not found.');\n }\n const result = committed.result as unknown as FactoryTransitionResult;\n if (\n this.#onAccepted &&\n options.accepted &&\n committed.status === 'committed' &&\n result.status === 'accepted' &&\n committed.item\n ) {\n const item = committed.item;\n const onAccepted = this.#onAccepted;\n // Invoke inside the chain so a synchronous throw is isolated the same way an async rejection is.\n void Promise.resolve()\n .then(() =>\n onAccepted({\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: request.workItemId,\n item,\n }),\n )\n .catch(error => {\n console.warn(`[factory] acceptance hook failed for work item ${request.workItemId}:`, error);\n });\n }\n // Only an installed board's declaration releases resources; an unknown board or phase never does.\n const board = result.status === 'accepted' ? boards?.get(request.toBoard ?? request.board) : undefined;\n if (board && result.status === 'accepted') {\n const crossesBoards = request.toBoard !== undefined && request.toBoard !== request.board;\n const hooks = {\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: request.workItemId,\n revision: result.revision,\n actor: request.actor,\n };\n if (board.isTerminal(result.stage)) {\n const onTerminalStage = this.#onTerminalStage;\n if (onTerminalStage) await this.#bounded(() => onTerminalStage({ ...hooks, stage: result.stage }));\n } else if (fromStage !== undefined && this.#onContextLeft) {\n const context = boards?.get(request.board)?.roleForPhase(fromStage);\n const toContext = board.roleForPhase(result.stage);\n const onContextLeft = this.#onContextLeft;\n // Leaving the board leaves its context even under the same role name; the hook keeps a\n // session the card's new phase still holds.\n if (context !== undefined && (crossesBoards || context !== toContext)) {\n await this.#bounded(() => onContextLeft({ ...hooks, context, toContext }));\n }\n }\n }\n return result;\n }\n\n /** Run a resource-release hook, waiting at most the cleanup bound; it never fails the committed transition. */\n async #bounded(release: () => Promise<void> | void): Promise<void> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n const cleanup = Promise.resolve().then(release);\n // A late rejection after the timeout wins the race must not surface\n // as an unhandled rejection.\n cleanup.catch(() => {});\n await Promise.race([\n cleanup,\n new Promise<void>(resolve => {\n timer = setTimeout(resolve, this.#terminalCleanupTimeoutMs);\n }),\n ]);\n } catch {\n // Resource release is best-effort — never fail a committed transition.\n } finally {\n clearTimeout(timer);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;;;;;AAK7B,MAAM,8BAA8B;AAsIpC,SAAS,UACP,cACA,QACA,MACA,QACyB;CACzB,OAAO;EAAE,QAAQ;EAAY;EAAc;EAAQ;EAAM,QAAQ,OAAO,MAAM,GAAG,oBAAoB;CAAE;AACzG;AAEA,SAAS,QAAQ,OAAiC;CAChD,QAAQ,MAAM,MAAd;EACE,KAAK;EACL,KAAK,UACH,OAAO,MAAM;EACf,KAAK,SACH,OAAO,SAAS,MAAM;EACxB,KAAK,UACH,OAAO,UAAU,MAAM;EACzB,KAAK,UACH,OAAO,UAAU,MAAM;CAC3B;AACF;AAGA,SAAgB,aAAa,OAAyE;CACpG,MAAM,KAAK,QAAQ,KAAK;CACxB,QAAQ,MAAM,MAAd;EACE,KAAK;EACL,KAAK,UACH,OAAO;GAAE,SAAS;GAAI,WAAW;EAAQ;EAC3C,KAAK,SACH,OAAO;GAAE,SAAS;GAAI,WAAW,aAAa,EAAE,IAAI,UAAU,qBAAqB,EAAE,IAAI,WAAW;EAAQ;EAC9G,SACE,OAAO;GAAE,SAAS;GAAI,WAAW,MAAM;EAAK;CAChD;AACF;AAEA,SAAS,QAAQ,QAA4E;CAC3F,OAAO,OAAO,WAAW,cAAc,OAAO,SAAS;AACzD;;AAGA,SAAS,eAAe,QAAyC,SAAwC;CACvG,MAAM,QAAQ,aAAa,QAAQ,MAAM,KAAK,QAAQ,OAAO,KAAK,IAAI;CACtE,OAAO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S,OAAO,WAAW,YAAY;GACzC,MAAM,gBAAgB,QAAQ,YAAY,KAAA,KAAa,QAAQ,YAAY,QAAQ;GACnF,MAAM,QAAQ;IACZ,OAAO,QAAQ;IACf,kBAAkB,QAAQ;IAC1B,YAAY,QAAQ;IACpB,UAAU,OAAO;IACjB,OAAO,QAAQ;GACjB;GACA,IAAI,MAAM,WAAW,OAAO,KAAK,GAAG;IAClC,MAAM,kBAAkB,KAAK;IAC7B,IAAI,iBAAiB,MAAM,KAAK,eAAe,gBAAgB;KAAE,GAAG;KAAO,OAAO,OAAO;IAAM,CAAC,CAAC;GACnG,OAAO,IAAI,cAAc,KAAA,KAAa,KAAK,gBAAgB;IACzD,MAAM,UAAU,QAAQ,IAAI,QAAQ,KAAK,CAAC,EAAE,aAAa,SAAS;IAClE,MAAM,YAAY,MAAM,aAAa,OAAO,KAAK;IACjD,MAAM,gBAAgB,KAAK;IAG3B,IAAI,YAAY,KAAA,MAAc,iBAAiB,YAAY,YACzD,MAAM,KAAK,eAAe,cAAc;KAAE,GAAG;KAAO;KAAS;IAAU,CAAC,CAAC;GAE7E;EACF;EACA,OAAO;CACT;;CAGA,MAAM,SAAS,SAAoD;EACjE,IAAI;EACJ,IAAI;GACF,MAAM,UAAU,QAAQ,QAAQ,CAAC,CAAC,KAAK,OAAO;GAG9C,QAAQ,YAAY,CAAC,CAAC;GACtB,MAAM,QAAQ,KAAK,CACjB,SACA,IAAI,SAAc,YAAW;IAC3B,QAAQ,WAAW,SAAS,KAAK,yBAAyB;GAC5D,CAAC,CACH,CAAC;EACH,QAAQ,CAER,UAAU;GACR,aAAa,KAAK;EACpB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"transition-service.js","names":[],"sources":["../../src/rules/transition-service.ts"],"sourcesContent":["import { BUSY_CARD_MOVE_REFUSAL, phaseMayStartRun } from '../boards/busy-card.js';\nimport { DEFAULT_BOARD_ID, REVIEW_CONTEXT } from '../boards/index.js';\nimport type { BoardRegistry, InstalledBoard } from '../boards/index.js';\nimport { autoApprovedExitTool, exitToolSucceeded } from '../boards/phase-automation.js';\nimport { phaseRunDecision } from '../boards/phase-runner.js';\nimport { toBoardSource } from '../boards/project-boards.js';\nimport type { ProjectBoardSource } from '../boards/project-boards.js';\nimport { boardFlow, boardForWorkItem, hasPullRequest, pullRequestCardRejection } from '../boards/semantics.js';\nimport { boardTransitionPolicyResultSchema, immutablePolicySnapshot } from '../boards/transition-policy.js';\nimport type { AuditActorProfileInput, AuditActorType, AuditContext } from '../storage/domains/audit/base.js';\nimport type { AuditRecorder } from '../storage/domains/audit/domain.js';\nimport { isFactoryPrincipalId } from '../storage/domains/projects/base.js';\nimport { isAgentActor, REVISION_CONFLICT_REASON } from '../storage/domains/work-items/base.js';\nimport type { Card, WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport { isRunBearingDecision } from './run-bearing.js';\nimport type {\n FactoryCommitDecision,\n FactoryRuleActor,\n FactoryRuleBoard,\n FactoryRuleCausalEntry,\n FactoryRuleRejectionCode,\n FactoryRuleStage,\n FactoryStageRuleContext,\n FactoryTransitionResult,\n FactoryTransitionResultRejected,\n} from './types.js';\nimport { factoryRuleSourceForWorkItem, workItemSource } from './types.js';\nimport {\n MAX_FACTORY_RULE_CAUSAL_DEPTH,\n assertFactoryDecisionTarget,\n validateFactoryRuleDecision,\n validateFactoryRuleDecisions,\n} from './validation.js';\n\nconst RULE_TIMEOUT_MS = 5_000;\nconst MAX_REJECTION_REASON = 512;\n/** Longest a committed transition waits for terminal resource cleanup. Cleanup\n * reattaches remote sandboxes, so a hung provider call must not leave the\n * already-committed transition request pending; past this bound the cleanup\n * keeps running in the background as pure best-effort. */\nconst TERMINAL_CLEANUP_TIMEOUT_MS = 30_000;\n\nexport interface FactoryTransitionRequest {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n /** Installed board id; the service rejects boards that are not installed. */\n board: string;\n stage: FactoryRuleStage;\n expectedRevision: number;\n actor: FactoryRuleActor;\n actorProfile?: AuditActorProfileInput;\n /** Where a browser request came from; rules and agents carry none. */\n context?: AuditContext;\n ingress: { type: 'human' | 'agent' | 'toolResult' | 'github' | 'rule'; identity: string; transitionId?: string };\n cause: string;\n causalChain?: readonly FactoryRuleCausalEntry[];\n /** Internal materialization path: start the destination phase's runner even when already at that stage. */\n initialEntry?: boolean;\n /** Starts the stage's runner again when the item already holds that stage, to restart work the entry invalidated. */\n reenter?: boolean;\n /** Internal proof that this move consumes an approved `submit_plan` result. */\n planApproved?: true;\n /** Internal: the tool whose successful result this move consumes (a tool-result rule's move). */\n completedTool?: string;\n /**\n * Internal: an intake route moves the card on a status event. A route is admin-authored, so it\n * may name any phase on the card's board regardless of the board's next phases, working ones\n * included. The phase's `autoStart` and the dispatcher's approval check decide whether its run starts.\n */\n eventRoute?: {\n routeId: string;\n };\n /**\n * The move answers an outside author's pull request event. The move stands — a rule or a\n * provider's default decided it — but any run the destination phase queues is compute and code\n * execution on that author's say-so: it must wait for a person, however the phase starts.\n */\n untrustedPullRequestEvent?: boolean;\n /**\n * Internal: intake filing moves a fresh card from the board's first phase to the phase its\n * route names. Like `eventRoute` the target is admin-authored, so the first phase's next\n * phases don't restrict it — but only while the card still sits in that first phase; every\n * other check (phase, card shape, consent) still applies.\n */\n routeFiling?: boolean;\n /**\n * Internal, with `eventRoute` only: the installed board the route moves the card to, at `stage`.\n * `board` stays the card's current board. The target board's next phases don't restrict the\n * move; its phase, card shape and policy checks still apply, and its phase's runner starts.\n */\n toBoard?: string;\n}\n\nexport interface FactoryTransitionServiceOptions {\n configVersion: string;\n storage: WorkItemsStorage;\n /** A fixed registry, or the per-project boards; each transition loads its project's boards. */\n boards?: BoardRegistry | ProjectBoardSource;\n /** Every commit, accepted or rejected, lands here as `stage_moved` / `transition_rejected` under the request's actor. */\n audit?: AuditRecorder;\n timeoutMs?: number;\n /**\n * Called after a transition commits into a phase the board declares\n * terminal — the point where the item's sessions stop receiving runs, so\n * resources they hold (e.g. sandboxes) can be released for reuse. Awaited,\n * but failures are swallowed: releasing resources must never break or roll\n * back the committed transition.\n */\n onTerminalStage?: (args: {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n stage: FactoryRuleStage;\n revision: number;\n /** The actor that committed this terminal transition. Lets cleanup leave\n * the seat that drove its own transition (an agent tool call) untouched. */\n actor: FactoryRuleActor;\n }) => Promise<void> | void;\n /**\n * Called after a transition commits a stage change, e.g. to tell the item's\n * followers. Not awaited, and failures are logged: a notification must never\n * fail or delay the committed transition.\n */\n onTransitionCommitted?: (args: {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n fromStage: string | undefined;\n toStage: string;\n fromBoard: string;\n toBoard: string;\n }) => Promise<void> | void;\n /**\n * Called after a transition commits out of the last phase that runs in a\n * context: the new phase runs in another context (or none) and is not\n * terminal, e.g. Triage → Planning. The context's session gets no more\n * runs until the card comes back, so its sandbox can stop. Awaited under\n * the same bound as `onTerminalStage`, and failures are swallowed.\n */\n onContextLeft?: (args: {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n /** The context the card left. */\n context: string;\n /** The context the new phase runs in, if it runs one. */\n toContext: string | undefined;\n revision: number;\n actor: FactoryRuleActor;\n }) => Promise<void> | void;\n /** Upper bound on how long a committed transition waits for\n * `onTerminalStage` or `onContextLeft` before returning (default 30s). The\n * cleanup continues in the background past the bound. */\n terminalCleanupTimeoutMs?: number;\n /**\n * Whether a run is in flight on the card's sessions. With a run queued for the card, it makes the\n * card busy, and a person's move into a phase that may start a run is refused while it is.\n * Without it only a queued run counts.\n */\n runInFlight?: (card: { orgId: string; factoryProjectId: string; workItemId: string }) => Promise<boolean>;\n /**\n * Called after a person moves a Work card from Intake or Triage into Planning or\n * Building, which approves the work. Fire-and-forget: failures are swallowed, the committed transition never\n * depends on it.\n */\n onAccepted?: (args: {\n orgId: string;\n factoryProjectId: string;\n workItemId: string;\n item: Card;\n }) => Promise<void> | void;\n}\n\nfunction rejection(\n transitionId: string,\n itemId: string,\n code: FactoryRuleRejectionCode,\n reason: string,\n): FactoryTransitionResult {\n return { status: 'rejected', transitionId, itemId, code, reason: reason.slice(0, MAX_REJECTION_REASON) };\n}\n\nfunction actorId(actor: FactoryRuleActor): string {\n switch (actor.type) {\n case 'human':\n case 'system':\n return actor.id;\n case 'agent':\n return `agent:${actor.bindingId}`;\n case 'github':\n return `github:${actor.login}`;\n case 'gitlab':\n return `gitlab:${actor.username}`;\n }\n}\n\n// The dispatcher executes an agent-approved decision as a human actor so its consent carries; the trail still names the agent.\nexport function auditActorOf(actor: FactoryRuleActor): { actorId: string; actorType: AuditActorType } {\n const id = actorId(actor);\n switch (actor.type) {\n case 'github':\n case 'gitlab':\n return { actorId: id, actorType: 'human' };\n case 'human':\n return { actorId: id, actorType: isAgentActor(id) ? 'agent' : isFactoryPrincipalId(id) ? 'system' : 'human' };\n default:\n return { actorId: id, actorType: actor.type };\n }\n}\n\n/** The commit lost a race on the card's revision; a board policy's own `stale` is not one. */\nfunction isRevisionConflict(result: FactoryTransitionResult): result is FactoryTransitionResultRejected {\n return result.status === 'rejected' && result.code === 'stale' && result.reason === REVISION_CONFLICT_REASON;\n}\n\n/** Tell the caller where the card is now, so a model doesn't read \"stale\" as \"already moved\". */\nfunction staleRejection(result: FactoryTransitionResultRejected, current: Card): FactoryTransitionResult {\n const stage = currentStage(current.stages) ?? current.stages.join(', ');\n return rejection(\n result.transitionId,\n result.itemId,\n 'stale',\n `The card changed (now revision ${current.revision}, in ${stage}). Retry with expectedRevision ${current.revision} if the move still applies.`,\n );\n}\n\n/**\n * Whether an agent's stale move asked for the board and phase the card is already in. Only an\n * agent's own move: rules and intake routes re-read and re-plan against the card on `stale`.\n */\nfunction reachedTarget(request: FactoryTransitionRequest, current: Card): boolean {\n if (request.actor.type !== 'agent' || request.eventRoute || request.initialEntry || request.reenter) return false;\n if (request.toBoard !== undefined && request.toBoard !== request.board) return false;\n return boardForWorkItem(current) === request.board && currentStage(current.stages) === request.stage;\n}\n\nexport function currentStage(stages: readonly string[]): FactoryRuleStage | undefined {\n return stages.length === 1 ? stages[0] : undefined;\n}\n\ninterface TransitionConsentOptions {\n autonomy?: 'arm' | 'disarm';\n consentedBy?: string;\n /** A person moved a card into its board's build seat from before it (see {@link acceptsWork}): that move approves the work. */\n accepted?: boolean;\n}\n\n/**\n * Whether moving a card from `from` to `to` hands it to the board's builder for the first time: `to`\n * runs in the seat of the board's build phase ({@link boardFlow}), and `from` is a resting phase or a\n * working phase of another seat that is no review (Work: Intake or Triage into Planning or Building).\n * On a cross-board move `from` is the source board's phase — a same-named destination phase is a\n * different one — while the build seat is always the destination board's. Roles compare across\n * boards because they are names.\n */\nfunction acceptsWork(board: InstalledBoard, fromBoard: InstalledBoard, from: string, to: string): boolean {\n const buildRole = boardFlow(board).buildRole;\n if (!buildRole || board.roleForPhase(to) !== buildRole) return false;\n const fromPhase = fromBoard.phases[from];\n if (!fromPhase || fromPhase.kind === 'terminal') return false;\n if (fromPhase.kind === 'resting') return true;\n const fromRole = fromPhase.runner.context;\n return fromRole !== buildRole && fromRole !== REVIEW_CONTEXT;\n}\n\n// Entering a resting lane disarms whoever rests it; only a person's move into a working lane arms.\nfunction transitionConsent(working: boolean, humanMove: boolean): 'arm' | 'disarm' | undefined {\n if (!working) return 'disarm';\n return humanMove ? 'arm' : undefined;\n}\n\n// An event arriving as data (GitHub, sweeps) never pre-approves the runs its transition queues.\nfunction bearsConsent(actor: FactoryRuleActor): boolean {\n return actor.type === 'human' || actor.type === 'agent';\n}\n\n// Rides the transition's own revision-checked commit, so a stale or rejected commit flips nothing.\nfunction consentEffect(\n request: FactoryTransitionRequest,\n working: boolean,\n humanMove: boolean,\n): TransitionConsentOptions {\n // A provider event (a reopen, a close) is not a person's say-so: whatever a person armed before\n // no longer stands once a route moves the card.\n if (request.eventRoute) return { autonomy: 'disarm' };\n const autonomy = transitionConsent(working, humanMove);\n return bearsConsent(request.actor) ? { autonomy, consentedBy: actorId(request.actor) } : { autonomy };\n}\n\ntype RunStartDecision = Extract<FactoryCommitDecision, { type: 'invokeSkill' | 'sendMessage' }>;\n\nfunction startsRun(decision: FactoryCommitDecision): decision is RunStartDecision {\n return decision.type === 'invokeSkill' || (decision.type === 'sendMessage' && decision.prepareBinding === true);\n}\n\n// Answering a recorded run start, or the role's own mid-run agent, with a run would start a second one.\n// A run that starts after its own agent's move is queued onto that agent's run instead.\nfunction runAlreadyUnderway(request: FactoryTransitionRequest, decision: RunStartDecision): boolean {\n // A run-start cause marks an agent landing the card where its run already is — on its own\n // board. A cross-board request is never that, and its destination runner still queues.\n const sameBoard = request.toBoard === undefined || request.toBoard === request.board;\n if (request.cause === 'run_start' && sameBoard) return true;\n if (decision.type === 'invokeSkill' && decision.startsAfterOwnMove === true) return false;\n return request.actor.type === 'agent' && request.actor.role === decision.role;\n}\n\n// On a board change the phase names alone can read as no move at all (\"from triage to triage\"),\n// so the notice names both boards whenever the card crosses them.\nfunction stageTransitionMessage(\n fromStage: FactoryRuleStage,\n toStage: FactoryRuleStage,\n boards?: { from: string; to: string },\n): string {\n if (boards) {\n return `This work was moved from the ${fromStage} stage on the ${boards.from} board to the ${toStage} stage on the ${boards.to} board.`;\n }\n return `This work was moved from the ${fromStage} stage to the ${toStage} stage.`;\n}\n\nfunction isHumanTransition(request: FactoryTransitionRequest): boolean {\n return request.actor.type === 'human' && request.ingress.type === 'human';\n}\n\nfunction ruleFailure(error: unknown): { code: FactoryRuleRejectionCode; reason: string } {\n return {\n code: 'rule_error',\n reason: error instanceof Error ? `Factory rule failed: ${error.message}` : 'Factory rule failed.',\n };\n}\n\nasync function withRuleTimeout<T>(operation: Promise<T>, timeoutMs: number): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => reject(new Error('FACTORY_RULE_TIMEOUT')), timeoutMs);\n });\n try {\n return await Promise.race([operation, timeout]);\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n\nexport class FactoryTransitionService {\n readonly #configVersion: string;\n readonly #boards: ProjectBoardSource;\n readonly #storage: WorkItemsStorage;\n readonly #timeoutMs: number;\n readonly #onTerminalStage: FactoryTransitionServiceOptions['onTerminalStage'];\n readonly #onContextLeft: FactoryTransitionServiceOptions['onContextLeft'];\n readonly #terminalCleanupTimeoutMs: number;\n readonly #onAccepted: FactoryTransitionServiceOptions['onAccepted'];\n readonly #onTransitionCommitted: FactoryTransitionServiceOptions['onTransitionCommitted'];\n readonly #audit: AuditRecorder | undefined;\n readonly #runInFlight: FactoryTransitionServiceOptions['runInFlight'];\n\n constructor(options: FactoryTransitionServiceOptions) {\n this.#configVersion = options.configVersion;\n this.#boards = toBoardSource(options.boards);\n this.#storage = options.storage;\n this.#audit = options.audit;\n this.#timeoutMs = options.timeoutMs ?? RULE_TIMEOUT_MS;\n this.#onTerminalStage = options.onTerminalStage;\n this.#onContextLeft = options.onContextLeft;\n this.#onAccepted = options.onAccepted;\n this.#onTransitionCommitted = options.onTransitionCommitted;\n this.#runInFlight = options.runInFlight;\n this.#terminalCleanupTimeoutMs = options.terminalCleanupTimeoutMs ?? TERMINAL_CLEANUP_TIMEOUT_MS;\n }\n\n get configVersion(): string {\n return this.#configVersion;\n }\n\n async transition(request: FactoryTransitionRequest): Promise<FactoryTransitionResult> {\n const replay = await this.#storage.getTransitionResultByIngress(\n request.orgId,\n request.factoryProjectId,\n request.ingress.identity,\n );\n if (replay) return replay as unknown as FactoryTransitionResult;\n\n const transitionId = request.ingress.transitionId ?? globalThis.crypto.randomUUID();\n const item = await this.#storage.get({ orgId: request.orgId, id: request.workItemId });\n if (!item) {\n const rejection = await this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n 'Work item not found.',\n );\n await this.#recordTransition(request, undefined, rejection);\n return rejection;\n }\n // A person naming another board moves the card there: the same cross-board commit a\n // card-move rule makes, under the caller's own name. Runs the old board queued for the\n // card are superseded inside the commit itself; what this move queues stays.\n if (isHumanTransition(request) && !request.eventRoute && request.toBoard === undefined) {\n const itemBoard = boardForWorkItem(item);\n if (request.board !== itemBoard) {\n request = { ...request, board: itemBoard, toBoard: request.board };\n }\n }\n let result = await this.#evaluateAndCommit(request, transitionId, item);\n let from = item;\n if (isRevisionConflict(result)) {\n const current = await this.#storage.get({ orgId: request.orgId, id: request.workItemId });\n if (current && reachedTarget(request, current)) {\n // Another move already took the card where this one was going (e.g. an approval\n // that waited while a later run moved it on). Retrying at the old revision would\n // only go stale again, so evaluate the move once more against the card as it is:\n // it commits as a same-phase move, or is rejected for a real reason. The card\n // never moves, so whatever consent or cleanup the earlier move applied stands.\n from = current;\n result = await this.#evaluateAndCommit(\n { ...request, expectedRevision: current.revision },\n transitionId,\n current,\n { reachedTarget: true },\n );\n if (isRevisionConflict(result)) {\n // Lost a second race: report where the card is now, not where it was.\n const latest = await this.#storage.get({ orgId: request.orgId, id: request.workItemId });\n if (latest) result = staleRejection(result, latest);\n }\n } else if (current) {\n result = staleRejection(result, current);\n }\n }\n await this.#recordTransition(request, from, result);\n this.#notifyCommitted(request, from, result);\n return result;\n }\n\n #notifyCommitted(request: FactoryTransitionRequest, item: Card, result: FactoryTransitionResult): void {\n const onTransitionCommitted = this.#onTransitionCommitted;\n if (!onTransitionCommitted || result.status !== 'accepted') return;\n // Board-neutral: `currentStage` only knows the built-in rule stages.\n const fromStage = item.stages.length === 1 ? item.stages[0] : undefined;\n // A board change is a stage change even under the same phase name: on another board that\n // name is a different phase, and the one the card left must end its goal.\n const movedBoards = request.toBoard !== undefined && request.toBoard !== request.board;\n if (result.stage === fromStage && !movedBoards) return;\n // Inside the chain so a synchronous throw is isolated the same way an async rejection is.\n void Promise.resolve()\n .then(() =>\n onTransitionCommitted({\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: item.id,\n fromStage,\n toStage: result.stage,\n fromBoard: request.board,\n toBoard: request.toBoard ?? request.board,\n }),\n )\n .catch(error => {\n console.warn(`[factory] stage notification failed for work item ${item.id}:`, error);\n });\n }\n\n /** A rejection can outlive its work item: the row still names the id the caller asked for. */\n async #recordTransition(\n request: FactoryTransitionRequest,\n item: Card | undefined,\n result: FactoryTransitionResult,\n ): Promise<void> {\n if (!this.#audit) return;\n // Board-neutral, like the stage notification: `currentStage` only knows the\n // built-in rule stages and would drop custom-board phases.\n const from = item && item.stages.length === 1 ? item.stages[0] : undefined;\n // A board-only move keeps the phase name yet moves the card: it is audited like any move.\n const movedBoards = request.toBoard !== undefined && request.toBoard !== request.board;\n if (result.status === 'accepted' && result.stage === from && !request.reenter && !movedBoards) return;\n const outcome =\n result.status === 'accepted'\n ? { action: 'factory.work_item.stage_moved' as const, to: result.stage, revision: result.revision }\n : {\n action: 'factory.work_item.transition_rejected' as const,\n to: request.stage,\n code: result.code,\n reason: result.reason,\n };\n const { action, ...detail } = outcome;\n await this.#audit\n .record({\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n ...auditActorOf(request.actor),\n actorProfile: request.actorProfile,\n ...(request.context ? { context: request.context } : {}),\n action,\n idempotencyKey: result.transitionId,\n targets: [{ type: 'work_item', id: item?.id ?? request.workItemId, ...(item ? { name: item.title } : {}) }],\n metadata: {\n transitionId: result.transitionId,\n ingressType: request.ingress.type,\n cause: request.cause,\n configVersion: this.#configVersion,\n ...(from ? { from } : {}),\n ...(request.toBoard !== undefined && request.toBoard !== request.board\n ? { fromBoard: request.board, toBoard: request.toBoard }\n : {}),\n ...(request.reenter ? { reenter: true } : {}),\n ...detail,\n },\n })\n .catch(error => {\n console.warn(`[factory] audit failed for transition ${result.transitionId}:`, error);\n });\n }\n\n async #evaluateAndCommit(\n request: FactoryTransitionRequest,\n transitionId: string,\n item: Card,\n { reachedTarget = false }: { reachedTarget?: boolean } = {},\n ): Promise<FactoryTransitionResult> {\n const boards = await this.#boards.load(request);\n if (request.causalChain && request.causalChain.length > MAX_FACTORY_RULE_CAUSAL_DEPTH) {\n return this.#commitRejection(\n request,\n transitionId,\n 'causal_depth_exceeded',\n 'Factory rule causal depth exceeded.',\n );\n }\n const itemSource = workItemSource(item.externalSource);\n const source = factoryRuleSourceForWorkItem(itemSource);\n const isPullRequest = source === 'pullRequest' || source === 'gitlabPullRequest';\n // Rows filed before boards were persisted belong to the default board.\n if (item.board === null && !boards.has(DEFAULT_BOARD_ID)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n 'This legacy work item has no assigned board. Assign an installed board and phase through the work-item PATCH endpoint before transitioning it.',\n );\n }\n const itemBoard = boardForWorkItem(item);\n if (request.board !== itemBoard) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `The work item belongs to board \"${itemBoard}\", not \"${request.board}\".`,\n );\n }\n const fromBoard = boards.get(request.board);\n if (!fromBoard) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `Board \"${request.board}\" is not installed.`,\n );\n }\n if (request.toBoard !== undefined && !request.eventRoute && !isHumanTransition(request)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n 'Only a card-move rule or a person can move a card to another board.',\n );\n }\n const targetBoard = request.toBoard ?? request.board;\n const board = targetBoard === request.board ? fromBoard : boards.get(targetBoard);\n if (!board) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `Board \"${targetBoard}\" is not installed.`,\n );\n }\n const fromStage = item.stages.length === 1 ? item.stages[0] : undefined;\n if (!fromStage || !Object.prototype.hasOwnProperty.call(fromBoard.phases, fromStage)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n 'The work item does not have one canonical phase on the requested board.',\n );\n }\n // The board's own reason comes first: its phase graph alone only says the move is not\n // declared, which leaves an agent moving an issue card to PR review guessing why.\n const cardShapeRejection = pullRequestCardRejection(\n board,\n {\n standalonePullRequest: isPullRequest,\n hasPullRequest: hasPullRequest({ workItem: item.workItem, source: itemSource }),\n },\n request.stage,\n );\n if (cardShapeRejection) {\n return this.#commitRejection(request, transitionId, 'invalid_transition', cardShapeRejection);\n }\n // Filing jumps the first phase's declared edges only from that phase: a card another actor\n // moved in between follows the board's graph again.\n const filesPastEdges = request.routeFiling === true && fromStage === fromBoard.initialPhase;\n if (\n !Object.prototype.hasOwnProperty.call(board.phases, request.stage) ||\n (!request.eventRoute &&\n board === fromBoard &&\n !filesPastEdges &&\n !board.allowsTransition(fromStage, request.stage))\n ) {\n if (board !== fromBoard) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `The ${board.name} board has no phase ${request.stage}.`,\n );\n }\n const nextStages = [...new Set((board.transitions[fromStage] ?? []).map(transition => transition.to))];\n const nextStagesReason =\n nextStages.length > 0\n ? `Next stages declared from ${fromStage}: ${nextStages.join(', ')}.`\n : `No next stage is declared from ${fromStage}.`;\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `The ${board.name} board does not allow moving from ${fromStage} to ${request.stage}. ${nextStagesReason}`,\n );\n }\n\n // A person's cross-board move takes live work, not finished cards, and lands it where work can\n // continue: a finished card stays where it finished, and finishing belongs to the card's own board.\n const crossesBoards = board !== fromBoard;\n if (crossesBoards && !request.eventRoute) {\n if (fromBoard.isTerminal(fromStage)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `The work item is finished on the ${fromBoard.name} board and stays there.`,\n );\n }\n if (board.isTerminal(request.stage)) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `A card finishes on its own board; move it to a non-terminal ${board.name} phase instead.`,\n );\n }\n }\n\n if (\n isHumanTransition(request) &&\n !request.initialEntry &&\n // Leaving the board strands whatever run is queued or underway, so every cross-board move of\n // a busy card is refused — whatever cause it names, even into a phase sharing the old one's\n // name or a phase that starts nothing itself.\n (crossesBoards ||\n (request.cause !== 'run_start' &&\n (fromStage !== request.stage || request.reenter === true) &&\n phaseMayStartRun(board.phaseKind(request.stage)))) &&\n (await this.#cardBusy(request))\n ) {\n return this.#commitRejection(request, transitionId, 'card_busy', BUSY_CARD_MOVE_REFUSAL);\n }\n\n // The coordinator's own self-move at run start would otherwise inject a second run's kickoff.\n // Crossing boards is always a move: a same-named phase on another board is a different phase.\n const humanMove =\n request.actor.type === 'human' && (fromStage !== request.stage || crossesBoards) && request.cause !== 'run_start';\n // The board, not the phase name, says whether a seat is engaged on either side of this move.\n const entersWorking = board.isWorking(request.stage);\n const seatRole = board.roleForPhase(request.stage);\n\n const contextBase = {\n tenant: { orgId: request.orgId, projectId: request.factoryProjectId },\n actor: request.actor,\n ingress: { type: request.ingress.type, id: request.ingress.identity },\n cause: request.cause,\n causalChain: request.causalChain ?? [],\n configVersion: this.#configVersion,\n item: {\n id: item.id,\n source: itemSource,\n sourceKey: item.externalSource\n ? `${item.externalSource.integrationId}:${item.externalSource.type}:${item.externalSource.externalId}`\n : null,\n parentWorkItemId: item.parentWorkItemId,\n title: item.title,\n url: item.externalSource?.url ?? null,\n stages: [...item.stages],\n workItem: item.workItem,\n acceptedAt: item.acceptedAt,\n metadata: item.metadata,\n },\n board: board.id,\n itemRevision: item.revision,\n source,\n fromStage,\n toStage: request.stage,\n } satisfies Omit<FactoryStageRuleContext, 'stage'>;\n\n let evaluation:\n | { outcome: 'accepted'; decisions: Record<string, unknown>[]; intents: TransitionConsentOptions }\n | { outcome: 'rejected'; code: string; reason: string };\n try {\n evaluation = await withRuleTimeout(\n (async () => {\n // Plans are approved without a person only where the card's phase auto-approves submit_plan.\n const plansAutoApproved = autoApprovedExitTool(boards, item) === 'submit_plan';\n // A phase with an exit tool holds the card until the tool succeeds (for submit_plan, with\n // an approved plan; autoApprove only decides whether it approves itself). Then the agent,\n // or the board's own rule for the tool, moves the card. A person can move it any time.\n const fromPhase = fromBoard.phases[fromStage];\n const exitTool = fromPhase?.kind === 'working' ? fromPhase.exitTool : undefined;\n if (\n request.actor.type !== 'human' &&\n // A start lands the card where its run already is; it is not the agent leaving a phase.\n request.cause !== 'run_start' &&\n !request.eventRoute &&\n exitTool &&\n fromStage !== request.stage &&\n entersWorking &&\n !(exitTool.id === 'submit_plan' ? request.planApproved === true : request.completedTool === exitTool.id) &&\n !exitToolSucceeded(item, fromStage, exitTool.id)\n ) {\n return {\n outcome: 'rejected' as const,\n code: 'approval_required',\n reason:\n exitTool.id === 'submit_plan'\n ? `${fromPhase!.name} ends when submit_plan comes back with an approved plan; until then the card stays here. Call submit_plan and wait for a person to approve the plan (or for it to be approved automatically), then move the card into ${board.phases[request.stage]?.name ?? request.stage} with factory_transition_work_item.`\n : `${fromPhase!.name} ends when ${exitTool.id} succeeds; until then the card stays here. A person can also move it from the Factory board or a chat they are signed in to.`,\n };\n }\n const policy = boardTransitionPolicyResultSchema.parse(\n await board.transitionPolicy?.(\n immutablePolicySnapshot({\n ...contextBase,\n item: { ...contextBase.item, triageType: item.triageType },\n initialEntry: request.initialEntry ?? false,\n reenter: request.reenter ?? false,\n isHumanTransition: isHumanTransition(request),\n plansAutoApproved,\n planApproved: request.planApproved === true,\n requestedTriageType: undefined,\n }),\n ),\n );\n if (policy?.type === 'reject') {\n return { outcome: 'rejected' as const, code: policy.code, reason: policy.reason };\n }\n const run = phaseRunDecision(board, request.stage, contextBase, {\n initialEntry: request.initialEntry,\n reenter: request.reenter,\n boardEntry: crossesBoards,\n });\n const validated = validateFactoryRuleDecisions(run ? [run] : [], contextBase.causalChain.length).filter(\n decision => {\n assertFactoryDecisionTarget(decision, boards, board.id);\n return !(startsRun(decision) && runAlreadyUnderway(request, decision));\n },\n );\n // An outside author's pull request event may move the card, but the run it queues is\n // compute and code execution on that author's say-so: it waits for a person, even in a\n // phase that starts on its own.\n if (request.untrustedPullRequestEvent) {\n for (const decision of validated) {\n if (\n decision.type === 'invokeSkill' ||\n (decision.type === 'sendMessage' && decision.prepareBinding === true)\n ) {\n decision.untrustedPullRequestEvent = true;\n }\n }\n }\n if (humanMove) {\n const message = stageTransitionMessage(\n fromStage,\n request.stage,\n crossesBoards ? { from: fromBoard.name, to: board.name } : undefined,\n );\n const skill = validated.find(decision => decision.type === 'invokeSkill');\n if (skill) {\n skill.precedingMessage = message;\n } else {\n validated.unshift({\n type: 'sendMessage',\n idempotencyKey: `factory-stage:${transitionId}`,\n message,\n priority: 'urgent',\n idleBehavior: 'wake',\n // Parking a card says stop: no seat is right by construction, so\n // the notice goes to whichever session is live — or nobody.\n ...(entersWorking && seatRole !== undefined ? { role: seatRole, prepareBinding: true } : {}),\n });\n }\n }\n return {\n outcome: 'accepted' as const,\n intents: {\n accepted: isHumanTransition(request) && acceptsWork(board, fromBoard, fromStage, request.stage),\n },\n decisions: validateFactoryRuleDecisions(validated) as unknown as Record<string, unknown>[],\n };\n })(),\n this.#timeoutMs,\n );\n } catch (error) {\n const failed =\n error instanceof Error && error.message === 'FACTORY_RULE_TIMEOUT'\n ? { code: 'timeout' as const, reason: 'Factory rule evaluation timed out.' }\n : ruleFailure(error);\n evaluation = { outcome: 'rejected', ...failed };\n }\n return this.#commit(\n request,\n transitionId,\n evaluation,\n evaluation.outcome === 'accepted'\n ? { ...(reachedTarget ? {} : consentEffect(request, entersWorking, humanMove)), ...evaluation.intents }\n : {},\n // The card stays put, so the move it lost to already released what it left.\n reachedTarget ? undefined : boards,\n fromStage,\n );\n }\n\n /** A run in flight on the card's sessions, or one queued for it: what the board shows as busy. */\n async #cardBusy(request: FactoryTransitionRequest): Promise<boolean> {\n const queued = await this.#storage.listDeferredDecisions(request.orgId, request.factoryProjectId, {\n statuses: ['pending', 'retry', 'leased'],\n workItemId: request.workItemId,\n });\n if (queued.some(decision => isRunBearingDecision(decision.decision))) return true;\n return (await this.#runInFlight?.(request)) ?? false;\n }\n\n async #commitRejection(\n request: FactoryTransitionRequest,\n transitionId: string,\n code: FactoryRuleRejectionCode,\n reason: string,\n ): Promise<FactoryTransitionResult> {\n return this.#commit(\n request,\n transitionId,\n { outcome: 'rejected', code, reason: reason.slice(0, MAX_REJECTION_REASON) },\n {},\n undefined,\n );\n }\n\n async #commit(\n request: FactoryTransitionRequest,\n transitionId: string,\n evaluation:\n | { outcome: 'accepted'; decisions: Record<string, unknown>[] }\n | { outcome: 'rejected'; code: string; reason: string },\n options: TransitionConsentOptions,\n // The registry the move was evaluated against; rejected moves never release resources.\n boards: BoardRegistry | undefined,\n fromStage?: string,\n ): Promise<FactoryTransitionResult> {\n const committed = await this.#storage.commitTransition({\n autonomy: options.autonomy,\n consentedBy: options.consentedBy,\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: request.workItemId,\n expectedRevision: request.expectedRevision,\n destinationStage: request.stage,\n ...(request.toBoard !== undefined && request.toBoard !== request.board\n ? { destinationBoard: request.toBoard }\n : {}),\n actorId: actorId(request.actor),\n ingress: { identity: request.ingress.identity, transitionId },\n causalChain: [...(request.causalChain ?? [])],\n evaluation,\n });\n if (committed.status === 'missing') {\n return rejection(transitionId, request.workItemId, 'invalid_transition', 'Work item not found.');\n }\n const result = committed.result as unknown as FactoryTransitionResult;\n if (\n this.#onAccepted &&\n options.accepted &&\n committed.status === 'committed' &&\n result.status === 'accepted' &&\n committed.item\n ) {\n const item = committed.item;\n const onAccepted = this.#onAccepted;\n // Invoke inside the chain so a synchronous throw is isolated the same way an async rejection is.\n void Promise.resolve()\n .then(() =>\n onAccepted({\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: request.workItemId,\n item,\n }),\n )\n .catch(error => {\n console.warn(`[factory] acceptance hook failed for work item ${request.workItemId}:`, error);\n });\n }\n // Only an installed board's declaration releases resources; an unknown board or phase never does.\n const board = result.status === 'accepted' ? boards?.get(request.toBoard ?? request.board) : undefined;\n if (board && result.status === 'accepted') {\n const crossesBoards = request.toBoard !== undefined && request.toBoard !== request.board;\n const hooks = {\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: request.workItemId,\n revision: result.revision,\n actor: request.actor,\n };\n if (board.isTerminal(result.stage)) {\n const onTerminalStage = this.#onTerminalStage;\n if (onTerminalStage) await this.#bounded(() => onTerminalStage({ ...hooks, stage: result.stage }));\n } else if (fromStage !== undefined && this.#onContextLeft) {\n const context = boards?.get(request.board)?.roleForPhase(fromStage);\n const toContext = board.roleForPhase(result.stage);\n const onContextLeft = this.#onContextLeft;\n // Leaving the board leaves its context even under the same role name; the hook keeps a\n // session the card's new phase still holds.\n if (context !== undefined && (crossesBoards || context !== toContext)) {\n await this.#bounded(() => onContextLeft({ ...hooks, context, toContext }));\n }\n }\n }\n return result;\n }\n\n /** Run a resource-release hook, waiting at most the cleanup bound; it never fails the committed transition. */\n async #bounded(release: () => Promise<void> | void): Promise<void> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n const cleanup = Promise.resolve().then(release);\n // A late rejection after the timeout wins the race must not surface\n // as an unhandled rejection.\n cleanup.catch(() => {});\n await Promise.race([\n cleanup,\n new Promise<void>(resolve => {\n timer = setTimeout(resolve, this.#terminalCleanupTimeoutMs);\n }),\n ]);\n } catch {\n // Resource release is best-effort — never fail a committed transition.\n } finally {\n clearTimeout(timer);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;;;;;AAK7B,MAAM,8BAA8B;AAsIpC,SAAS,UACP,cACA,QACA,MACA,QACyB;CACzB,OAAO;EAAE,QAAQ;EAAY;EAAc;EAAQ;EAAM,QAAQ,OAAO,MAAM,GAAG,oBAAoB;CAAE;AACzG;AAEA,SAAS,QAAQ,OAAiC;CAChD,QAAQ,MAAM,MAAd;EACE,KAAK;EACL,KAAK,UACH,OAAO,MAAM;EACf,KAAK,SACH,OAAO,SAAS,MAAM;EACxB,KAAK,UACH,OAAO,UAAU,MAAM;EACzB,KAAK,UACH,OAAO,UAAU,MAAM;CAC3B;AACF;AAGA,SAAgB,aAAa,OAAyE;CACpG,MAAM,KAAK,QAAQ,KAAK;CACxB,QAAQ,MAAM,MAAd;EACE,KAAK;EACL,KAAK,UACH,OAAO;GAAE,SAAS;GAAI,WAAW;EAAQ;EAC3C,KAAK,SACH,OAAO;GAAE,SAAS;GAAI,WAAW,aAAa,EAAE,IAAI,UAAU,qBAAqB,EAAE,IAAI,WAAW;EAAQ;EAC9G,SACE,OAAO;GAAE,SAAS;GAAI,WAA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IAC7B,IAAI,iBAAiB,MAAM,KAAK,eAAe,gBAAgB;KAAE,GAAG;KAAO,OAAO,OAAO;IAAM,CAAC,CAAC;GACnG,OAAO,IAAI,cAAc,KAAA,KAAa,KAAK,gBAAgB;IACzD,MAAM,UAAU,QAAQ,IAAI,QAAQ,KAAK,CAAC,EAAE,aAAa,SAAS;IAClE,MAAM,YAAY,MAAM,aAAa,OAAO,KAAK;IACjD,MAAM,gBAAgB,KAAK;IAG3B,IAAI,YAAY,KAAA,MAAc,iBAAiB,YAAY,YACzD,MAAM,KAAK,eAAe,cAAc;KAAE,GAAG;KAAO;KAAS;IAAU,CAAC,CAAC;GAE7E;EACF;EACA,OAAO;CACT;;CAGA,MAAM,SAAS,SAAoD;EACjE,IAAI;EACJ,IAAI;GACF,MAAM,UAAU,QAAQ,QAAQ,CAAC,CAAC,KAAK,OAAO;GAG9C,QAAQ,YAAY,CAAC,CAAC;GACtB,MAAM,QAAQ,KAAK,CACjB,SACA,IAAI,SAAc,YAAW;IAC3B,QAAQ,WAAW,SAAS,KAAK,yBAAyB;GAC5D,CAAC,CACH,CAAC;EACH,QAAQ,CAER,UAAU;GACR,aAAa,KAAK;EACpB;CACF;AACF"}
|
|
@@ -34,6 +34,8 @@ export interface ExternalWorkItemSource {
|
|
|
34
34
|
/** Dispatcher upsert idempotency token — server bookkeeping, dropped from the read wire. */
|
|
35
35
|
export declare const FACTORY_RULE_MATERIALIZATION_KEY = "factoryRuleMaterializationKey";
|
|
36
36
|
export declare const FACTORY_PULL_REQUEST_RECONCILIATION_KEY = "factoryPullRequestReconciliation";
|
|
37
|
+
/** Reason of the `stale` rejection a transition commit gets when the card's revision moved on. */
|
|
38
|
+
export declare const REVISION_CONFLICT_REASON = "The work item changed before this transition committed.";
|
|
37
39
|
export interface WorkItemStageEntry {
|
|
38
40
|
stage: WorkItemStage;
|
|
39
41
|
enteredAt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","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EACX,KAAK,EACL,EAAE,EACF,cAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,oGAAoG;QACpG,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,yGAAyG;QACzG,iBAAiB,CAAC,EAAE,IAAI,CAAC;KAC1B,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAkCvB;CACF"}
|
|
@@ -44,6 +44,8 @@ function isWorkItemSource(value) {
|
|
|
44
44
|
/** Dispatcher upsert idempotency token — server bookkeeping, dropped from the read wire. */
|
|
45
45
|
const FACTORY_RULE_MATERIALIZATION_KEY = "factoryRuleMaterializationKey";
|
|
46
46
|
const FACTORY_PULL_REQUEST_RECONCILIATION_KEY = "factoryPullRequestReconciliation";
|
|
47
|
+
/** Reason of the `stale` rejection a transition commit gets when the card's revision moved on. */
|
|
48
|
+
const REVISION_CONFLICT_REASON = "The work item changed before this transition committed.";
|
|
47
49
|
/**
|
|
48
50
|
* Whether an actor id marks a move an agent run performed: the binding id the
|
|
49
51
|
* transition tool stamps (`agent:*`), or the rule that fires off a bound run's
|
|
@@ -1716,7 +1718,7 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
|
|
|
1716
1718
|
item = existing;
|
|
1717
1719
|
if (existing.revision !== input.expectedRevision) {
|
|
1718
1720
|
code = "stale";
|
|
1719
|
-
reason =
|
|
1721
|
+
reason = REVISION_CONFLICT_REASON;
|
|
1720
1722
|
return null;
|
|
1721
1723
|
}
|
|
1722
1724
|
if (input.evaluation.outcome === "rejected") {
|
|
@@ -3229,6 +3231,6 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
|
|
|
3229
3231
|
return card;
|
|
3230
3232
|
}
|
|
3231
3233
|
};
|
|
3232
|
-
export { FACTORY_PULL_REQUEST_RECONCILIATION_KEY, FACTORY_RULE_MATERIALIZATION_KEY, FACTORY_WORK_ITEM_SUBSCRIPTIONS_SCHEMA, FactoryRunBindingSupersededError, HELD_CARD_SWEEP_ACTOR, WorkItemRelationError, WorkItemSourceConflictError, WorkItemSplitModeError, WorkItemUpdateConflictError, WorkItemsStorage, applyStageTransition, externalSourceKey, factoryAgentWaitingAttentionIdentity, factoryAttentionKey, factoryDecisionAttentionIdentity, factoryDecisionHash, factoryProposalAttentionIdentity, isAgentActor, stampSessions, validateParentRelation };
|
|
3234
|
+
export { FACTORY_PULL_REQUEST_RECONCILIATION_KEY, FACTORY_RULE_MATERIALIZATION_KEY, FACTORY_WORK_ITEM_SUBSCRIPTIONS_SCHEMA, FactoryRunBindingSupersededError, HELD_CARD_SWEEP_ACTOR, REVISION_CONFLICT_REASON, WorkItemRelationError, WorkItemSourceConflictError, WorkItemSplitModeError, WorkItemUpdateConflictError, WorkItemsStorage, applyStageTransition, externalSourceKey, factoryAgentWaitingAttentionIdentity, factoryAttentionKey, factoryDecisionAttentionIdentity, factoryDecisionHash, factoryProposalAttentionIdentity, isAgentActor, stampSessions, validateParentRelation };
|
|
3233
3235
|
|
|
3234
3236
|
//# sourceMappingURL=base.js.map
|