@mastra/factory 0.28.0-alpha.3 → 0.28.0-alpha.4
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 +110 -56
- package/dist/boards/board-events.d.ts +1 -1
- package/dist/boards/board-events.d.ts.map +1 -1
- package/dist/boards/card-facts.d.ts +3 -1
- package/dist/boards/card-facts.d.ts.map +1 -1
- package/dist/boards/card-facts.js +26 -4
- package/dist/boards/card-facts.js.map +1 -1
- package/dist/boards/default-board.d.ts +2 -2
- package/dist/boards/default-board.js +2 -2
- package/dist/boards/default-board.js.map +1 -1
- package/dist/boards/define-board.d.ts +1 -1
- package/dist/boards/define-board.d.ts.map +1 -1
- package/dist/boards/define-board.js.map +1 -1
- package/dist/boards/intake-routing.d.ts +3 -5
- package/dist/boards/intake-routing.d.ts.map +1 -1
- package/dist/boards/intake-routing.js +3 -4
- package/dist/boards/intake-routing.js.map +1 -1
- package/dist/boards/project-boards.d.ts +18 -1
- package/dist/boards/project-boards.d.ts.map +1 -1
- package/dist/boards/project-boards.js +40 -3
- package/dist/boards/project-boards.js.map +1 -1
- package/dist/boards/semantics.d.ts +4 -4
- package/dist/boards/semantics.d.ts.map +1 -1
- package/dist/boards/semantics.js +8 -10
- package/dist/boards/semantics.js.map +1 -1
- package/dist/boards/work-migrations.d.ts +24 -1
- package/dist/boards/work-migrations.d.ts.map +1 -1
- package/dist/boards/work-migrations.js +97 -2
- package/dist/boards/work-migrations.js.map +1 -1
- package/dist/boards/work-routes.d.ts +6 -1
- package/dist/boards/work-routes.d.ts.map +1 -1
- package/dist/boards/work-routes.js +20 -6
- package/dist/boards/work-routes.js.map +1 -1
- package/dist/factory.d.ts +23 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +58 -43
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/integrations/github/default-rules.d.ts.map +1 -1
- package/dist/integrations/github/default-rules.js +3 -5
- package/dist/integrations/github/default-rules.js.map +1 -1
- package/dist/integrations/github/rules.d.ts +0 -6
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +23 -70
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/gitlab/routes.d.ts.map +1 -1
- package/dist/integrations/gitlab/routes.js +1 -3
- package/dist/integrations/gitlab/routes.js.map +1 -1
- package/dist/integrations/gitlab/rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/rules.js +4 -9
- package/dist/integrations/gitlab/rules.js.map +1 -1
- package/dist/integrations/incidentio/agent-tools.js +5 -5
- package/dist/integrations/incidentio/agent-tools.js.map +1 -1
- package/dist/integrations/incidentio/default-rules.d.ts.map +1 -1
- package/dist/integrations/incidentio/default-rules.js.map +1 -1
- package/dist/integrations/incidentio/routes.d.ts +2 -2
- package/dist/integrations/incidentio/routes.d.ts.map +1 -1
- package/dist/integrations/incidentio/routes.js +10 -13
- package/dist/integrations/incidentio/routes.js.map +1 -1
- package/dist/integrations/incidentio/rules.d.ts +1 -3
- package/dist/integrations/incidentio/rules.d.ts.map +1 -1
- package/dist/integrations/incidentio/rules.js +1 -3
- package/dist/integrations/incidentio/rules.js.map +1 -1
- package/dist/integrations/jira/binding-scope.d.ts +5 -6
- package/dist/integrations/jira/binding-scope.d.ts.map +1 -1
- package/dist/integrations/jira/binding-scope.js +9 -11
- package/dist/integrations/jira/binding-scope.js.map +1 -1
- package/dist/integrations/jira/default-rules.d.ts.map +1 -1
- package/dist/integrations/jira/default-rules.js.map +1 -1
- package/dist/integrations/jira/routes.d.ts.map +1 -1
- package/dist/integrations/jira/routes.js +3 -5
- package/dist/integrations/jira/routes.js.map +1 -1
- package/dist/integrations/jira/rules.d.ts +1 -3
- package/dist/integrations/jira/rules.d.ts.map +1 -1
- package/dist/integrations/jira/rules.js +1 -3
- package/dist/integrations/jira/rules.js.map +1 -1
- package/dist/integrations/linear/default-rules.d.ts.map +1 -1
- package/dist/integrations/linear/default-rules.js.map +1 -1
- package/dist/integrations/linear/routes.d.ts.map +1 -1
- package/dist/integrations/linear/routes.js +11 -14
- package/dist/integrations/linear/routes.js.map +1 -1
- package/dist/integrations/linear/rules.d.ts +1 -3
- package/dist/integrations/linear/rules.d.ts.map +1 -1
- package/dist/integrations/linear/rules.js +1 -3
- package/dist/integrations/linear/rules.js.map +1 -1
- package/dist/integrations/platform/connect/session-tools.d.ts +5 -0
- package/dist/integrations/platform/connect/session-tools.d.ts.map +1 -1
- package/dist/integrations/platform/connect/session-tools.js +5 -0
- package/dist/integrations/platform/connect/session-tools.js.map +1 -1
- package/dist/integrations/platform/jira/routes.d.ts.map +1 -1
- package/dist/integrations/platform/jira/routes.js +3 -5
- package/dist/integrations/platform/jira/routes.js.map +1 -1
- package/dist/routes/automation-runs.d.ts +1 -1
- package/dist/routes/automation-runs.js.map +1 -1
- package/dist/routes/contracts.d.ts +3 -10
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +11 -9
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/intake-routes.d.ts.map +1 -1
- package/dist/routes/intake-routes.js +6 -1
- package/dist/routes/intake-routes.js.map +1 -1
- package/dist/routes/intake.d.ts +0 -23
- package/dist/routes/intake.d.ts.map +1 -1
- package/dist/routes/intake.js +13 -310
- package/dist/routes/intake.js.map +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +1 -1
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +0 -2
- package/dist/routes/surface.js.map +1 -1
- package/dist/rules/dispatcher.d.ts +0 -5
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +18 -22
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/rule-group.d.ts +1 -1
- package/dist/rules/rule-group.d.ts.map +1 -1
- package/dist/rules/rule-group.js +13 -5
- package/dist/rules/rule-group.js.map +1 -1
- package/dist/rules/transition-service.d.ts +2 -3
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +0 -1
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/rules/types.d.ts +7 -11
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js.map +1 -1
- package/dist/session/self-review-gate.d.ts +0 -2
- package/dist/session/self-review-gate.d.ts.map +1 -1
- package/dist/session/self-review-gate.js +1 -8
- package/dist/session/self-review-gate.js.map +1 -1
- package/dist/session/source-control-tools.d.ts +39 -13
- package/dist/session/source-control-tools.d.ts.map +1 -1
- package/dist/session/source-control-tools.js +54 -60
- package/dist/session/source-control-tools.js.map +1 -1
- package/dist/session/work-item-state-processor.d.ts +1 -4
- package/dist/session/work-item-state-processor.d.ts.map +1 -1
- package/dist/session/work-item-state-processor.js +5 -18
- package/dist/session/work-item-state-processor.js.map +1 -1
- package/dist/storage/domains/boards/base.d.ts +30 -8
- package/dist/storage/domains/boards/base.d.ts.map +1 -1
- package/dist/storage/domains/boards/base.js +43 -25
- package/dist/storage/domains/boards/base.js.map +1 -1
- package/dist/storage/domains/boards/schemas.js.map +1 -1
- package/dist/storage/domains/intake/base.d.ts +5 -45
- package/dist/storage/domains/intake/base.d.ts.map +1 -1
- package/dist/storage/domains/intake/base.js +11 -89
- package/dist/storage/domains/intake/base.js.map +1 -1
- package/dist/storage/domains/projects/base.d.ts +17 -9
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +15 -7
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts +7 -2
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +4 -0
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/work-items/providers/base.d.ts +4 -1
- package/dist/work-items/providers/base.d.ts.map +1 -1
- package/dist/work-items/providers/base.js +6 -1
- package/dist/work-items/providers/base.js.map +1 -1
- package/dist/work-items/providers/github.d.ts.map +1 -1
- package/dist/work-items/providers/github.js +2 -1
- package/dist/work-items/providers/github.js.map +1 -1
- package/dist/work-items/providers/gitlab.d.ts.map +1 -1
- package/dist/work-items/providers/gitlab.js +2 -1
- package/dist/work-items/providers/gitlab.js.map +1 -1
- package/dist/work-items/providers/jira.d.ts.map +1 -1
- package/dist/work-items/providers/jira.js +3 -2
- package/dist/work-items/providers/jira.js.map +1 -1
- package/dist/work-items/providers/linear.d.ts.map +1 -1
- package/dist/work-items/providers/linear.js +3 -2
- package/dist/work-items/providers/linear.js.map +1 -1
- package/dist/work-items/providers/types.d.ts +6 -0
- package/dist/work-items/providers/types.d.ts.map +1 -1
- package/factory-skills/configure-factory-rules/SKILL.md +2 -2
- package/factory-skills/factory-build/SKILL.md +5 -5
- package/factory-skills/factory-gitlab-rereview/SKILL.md +1 -1
- package/factory-skills/factory-gitlab-review/SKILL.md +1 -1
- package/factory-skills/factory-rereview/SKILL.md +2 -2
- package/factory-skills/factory-review/SKILL.md +2 -2
- package/package.json +6 -6
|
@@ -9,7 +9,7 @@ export declare const RULE_OPERATORS: readonly ['equals', 'not_equals', 'contains
|
|
|
9
9
|
export type RuleOperator = (typeof RULE_OPERATORS)[number];
|
|
10
10
|
export declare const MAX_RULE_GROUP_DEPTH = 3;
|
|
11
11
|
/** Facts a phase condition can test about a card (see `cardRuleFacts`). */
|
|
12
|
-
export declare const CARD_RULE_FIELDS: readonly ['item.labels', 'item.title', 'item.author', 'author.trusted', 'source.kind', 'source.integration', 'item.pullRequest'];
|
|
12
|
+
export declare const CARD_RULE_FIELDS: readonly ['item.labels', 'item.title', 'item.author', 'item.key', 'item.state', 'item.assignees', 'author.trusted', 'source.kind', 'source.integration', 'source.provider', 'source.repository', 'item.pullRequest'];
|
|
13
13
|
export type RuleValue = string | number | boolean | Array<string | number | boolean>;
|
|
14
14
|
export interface RuleCondition {
|
|
15
15
|
field: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAa5F;AAED,eAAO,MAAM,mBAAmB,6EAAoC,CAAC;AAgErE,4GAA4G;AAC5G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAMhG"}
|
package/dist/rules/rule-group.js
CHANGED
|
@@ -28,9 +28,14 @@ const CARD_RULE_FIELDS = [
|
|
|
28
28
|
"item.labels",
|
|
29
29
|
"item.title",
|
|
30
30
|
"item.author",
|
|
31
|
+
"item.key",
|
|
32
|
+
"item.state",
|
|
33
|
+
"item.assignees",
|
|
31
34
|
"author.trusted",
|
|
32
35
|
"source.kind",
|
|
33
36
|
"source.integration",
|
|
37
|
+
"source.provider",
|
|
38
|
+
"source.repository",
|
|
34
39
|
"item.pullRequest"
|
|
35
40
|
];
|
|
36
41
|
const scalarSchema = z.union([
|
|
@@ -107,25 +112,28 @@ function contains(actual, expected) {
|
|
|
107
112
|
function compare(actual, expected, test) {
|
|
108
113
|
return typeof actual === "number" && typeof expected === "number" && test(actual, expected);
|
|
109
114
|
}
|
|
115
|
+
/** Whether `actual` is `expected`; a list fact (labels, assignees) is when one of its members is. */
|
|
116
|
+
const matches = (actual, expected) => Array.isArray(actual) ? actual.some((entry) => same(entry, expected)) : same(actual, expected);
|
|
110
117
|
/**
|
|
111
118
|
* Evaluate one condition. Strings compare case-insensitively (labels and
|
|
112
119
|
* repository slugs are case-insensitive on every provider Factory reads). A
|
|
120
|
+
* list fact is tested by its members, and an empty list counts as missing. A
|
|
113
121
|
* missing fact fails every operator except `not_exists`, `not_equals`,
|
|
114
122
|
* `not_contains` and `not_in`.
|
|
115
123
|
*/
|
|
116
124
|
function evaluateCondition(condition, facts) {
|
|
117
125
|
const actual = facts[condition.field];
|
|
118
|
-
const present = actual !== void 0 && actual !== null;
|
|
126
|
+
const present = actual !== void 0 && actual !== null && !(Array.isArray(actual) && actual.length === 0);
|
|
119
127
|
const expected = condition.value;
|
|
120
128
|
switch (condition.operator) {
|
|
121
129
|
case "exists": return present;
|
|
122
130
|
case "not_exists": return !present;
|
|
123
|
-
case "equals": return present &&
|
|
124
|
-
case "not_equals": return !present || !
|
|
131
|
+
case "equals": return present && matches(actual, expected);
|
|
132
|
+
case "not_equals": return !present || !matches(actual, expected);
|
|
125
133
|
case "contains": return present && contains(actual, expected);
|
|
126
134
|
case "not_contains": return !present || !contains(actual, expected);
|
|
127
|
-
case "in": return present && Array.isArray(expected) && expected.some((candidate) =>
|
|
128
|
-
case "not_in": return !present || !Array.isArray(expected) || !expected.some((candidate) =>
|
|
135
|
+
case "in": return present && Array.isArray(expected) && expected.some((candidate) => matches(actual, candidate));
|
|
136
|
+
case "not_in": return !present || !Array.isArray(expected) || !expected.some((candidate) => matches(actual, candidate));
|
|
129
137
|
case "greater_than": return compare(actual, expected, (left, right) => left > right);
|
|
130
138
|
case "less_than": return compare(actual, expected, (left, right) => left < right);
|
|
131
139
|
case "greater_than_or_equal": return compare(actual, expected, (left, right) => left >= right);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-group.js","names":[],"sources":["../../src/rules/rule-group.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Conditions a board phase tests against a card, such as when it starts on its own or\n * when its exit tool is approved without a person. The shape mirrors the editor's rule\n * groups (`{field, operator, value}` leaves inside AND/OR groups), but Factory owns\n * the types and evaluator; nothing is shared with `@mastra/editor` or `@mastra/server`.\n */\nexport const RULE_OPERATORS = [\n 'equals',\n 'not_equals',\n 'contains',\n 'not_contains',\n 'in',\n 'not_in',\n 'exists',\n 'not_exists',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal',\n] as const;\nexport type RuleOperator = (typeof RULE_OPERATORS)[number];\n\nexport const MAX_RULE_GROUP_DEPTH = 3;\nconst MAX_CONDITIONS_PER_GROUP = 20;\nconst MAX_STRING_VALUE_LENGTH = 500;\n\n/** Facts a phase condition can test about a card (see `cardRuleFacts`). */\nexport const CARD_RULE_FIELDS = [\n 'item.labels',\n 'item.title',\n 'item.author',\n 'author.trusted',\n 'source.kind',\n 'source.integration',\n 'item.pullRequest',\n] as const;\n\nexport type RuleValue = string | number | boolean | Array<string | number | boolean>;\n\nexport interface RuleCondition {\n field: string;\n operator: RuleOperator;\n value?: RuleValue;\n}\n\nexport interface RuleGroup {\n operator: 'AND' | 'OR';\n conditions: Array<RuleCondition | RuleGroup>;\n}\n\nexport type RuleFacts = Readonly<Record<string, unknown>>;\n\nconst scalarSchema = z.union([z.string().max(MAX_STRING_VALUE_LENGTH), z.number().finite(), z.boolean()]);\nconst valueSchema = z.union([scalarSchema, z.array(scalarSchema).max(100)]);\n\nconst VALUELESS: ReadonlySet<RuleOperator> = new Set(['exists', 'not_exists']);\nconst LIST_VALUE: ReadonlySet<RuleOperator> = new Set(['in', 'not_in']);\nconst ORDERED: ReadonlySet<RuleOperator> = new Set([\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal',\n]);\n\nfunction conditionSchema(fields: readonly [string, ...string[]]) {\n return z\n .object({ field: z.enum(fields), operator: z.enum(RULE_OPERATORS), value: valueSchema.optional() })\n .strict()\n .superRefine((condition, ctx) => {\n if (VALUELESS.has(condition.operator)) {\n if (condition.value !== undefined) {\n ctx.addIssue({ code: 'custom', path: ['value'], message: `'${condition.operator}' takes no value.` });\n }\n return;\n }\n if (condition.value === undefined) {\n ctx.addIssue({ code: 'custom', path: ['value'], message: `'${condition.operator}' needs a value.` });\n return;\n }\n if (LIST_VALUE.has(condition.operator) !== Array.isArray(condition.value)) {\n ctx.addIssue({\n code: 'custom',\n path: ['value'],\n message: LIST_VALUE.has(condition.operator)\n ? `'${condition.operator}' needs a list value.`\n : `'${condition.operator}' needs a single value.`,\n });\n }\n if (ORDERED.has(condition.operator) && typeof condition.value !== 'number') {\n ctx.addIssue({ code: 'custom', path: ['value'], message: `'${condition.operator}' needs a number.` });\n }\n });\n}\n\n/** Zod schema for a rule group whose leaves may only name `fields`. Depth is capped at {@link MAX_RULE_GROUP_DEPTH}. */\nexport function ruleGroupSchema(fields: readonly [string, ...string[]]): z.ZodType<RuleGroup> {\n const leaf = conditionSchema(fields);\n const groupAt = (depth: number): z.ZodType<RuleGroup> => {\n const member: z.ZodType<RuleCondition | RuleGroup> =\n depth < MAX_RULE_GROUP_DEPTH ? z.union([leaf, z.lazy(() => groupAt(depth + 1))]) : leaf;\n return z\n .object({\n operator: z.enum(['AND', 'OR']),\n conditions: z.array(member).min(1).max(MAX_CONDITIONS_PER_GROUP),\n })\n .strict() as z.ZodType<RuleGroup>;\n };\n return groupAt(1);\n}\n\nexport const cardRuleGroupSchema = ruleGroupSchema(CARD_RULE_FIELDS);\n\nfunction isGroup(member: RuleCondition | RuleGroup): member is RuleGroup {\n return 'conditions' in member;\n}\n\nconst normalize = (value: unknown) => (typeof value === 'string' ? value.trim().toLowerCase() : value);\nconst same = (left: unknown, right: unknown) => normalize(left) === normalize(right);\n\nfunction contains(actual: unknown, expected: unknown): boolean {\n if (Array.isArray(actual)) return actual.some(entry => same(entry, expected));\n if (typeof actual === 'string' && typeof expected === 'string') {\n return actual.toLowerCase().includes(expected.toLowerCase());\n }\n return false;\n}\n\nfunction compare(actual: unknown, expected: unknown, test: (left: number, right: number) => boolean): boolean {\n return typeof actual === 'number' && typeof expected === 'number' && test(actual, expected);\n}\n\n/**\n * Evaluate one condition. Strings compare case-insensitively (labels and\n * repository slugs are case-insensitive on every provider Factory reads). A\n * missing fact fails every operator except `not_exists`, `not_equals`,\n * `not_contains` and `not_in`.\n */\nfunction evaluateCondition(condition: RuleCondition, facts: RuleFacts): boolean {\n const actual = facts[condition.field];\n const present = actual !== undefined && actual !== null;\n const expected = condition.value;\n switch (condition.operator) {\n case 'exists':\n return present;\n case 'not_exists':\n return !present;\n case 'equals':\n return present && same(actual, expected);\n case 'not_equals':\n return !present || !same(actual, expected);\n case 'contains':\n return present && contains(actual, expected);\n case 'not_contains':\n return !present || !contains(actual, expected);\n case 'in':\n return present && Array.isArray(expected) && expected.some(candidate => same(actual, candidate));\n case 'not_in':\n return !present || !Array.isArray(expected) || !expected.some(candidate => same(actual, candidate));\n case 'greater_than':\n return compare(actual, expected, (left, right) => left > right);\n case 'less_than':\n return compare(actual, expected, (left, right) => left < right);\n case 'greater_than_or_equal':\n return compare(actual, expected, (left, right) => left >= right);\n case 'less_than_or_equal':\n return compare(actual, expected, (left, right) => left <= right);\n }\n}\n\n/** True when `facts` satisfy `group`. A `null`/absent group matches everything (an unconditional phase). */\nexport function evaluateRuleGroup(group: RuleGroup | null | undefined, facts: RuleFacts): boolean {\n if (!group) return true;\n const results = group.conditions.map(member =>\n isGroup(member) ? evaluateRuleGroup(member, facts) : evaluateCondition(member, facts),\n );\n return group.operator === 'AND' ? results.every(Boolean) : results.some(Boolean);\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,uBAAuB;AACpC,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;;AAGhC,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAiBA,MAAM,eAAe,EAAE,MAAM;CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,uBAAuB;CAAG,EAAE,OAAO,CAAC,CAAC,OAAO;CAAG,EAAE,QAAQ;AAAC,CAAC;AACxG,MAAM,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,YAAY,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;AAE1E,MAAM,4BAAuC,IAAI,IAAI,CAAC,UAAU,YAAY,CAAC;AAC7E,MAAM,6BAAwC,IAAI,IAAI,CAAC,MAAM,QAAQ,CAAC;AACtE,MAAM,0BAAqC,IAAI,IAAI;CACjD;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,gBAAgB,QAAwC;CAC/D,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AC,WAAW,CAAC,MAAM,QAAQ,QAAQ,KAAK,CAAC,SAAS,MAAK,cAAa,KAAK,QAAQ,SAAS,CAAC;EACpG,KAAK,gBACH,OAAO,QAAQ,QAAQ,WAAW,MAAM,UAAU,OAAO,KAAK;EAChE,KAAK,aACH,OAAO,QAAQ,QAAQ,WAAW,MAAM,UAAU,OAAO,KAAK;EAChE,KAAK,yBACH,OAAO,QAAQ,QAAQ,WAAW,MAAM,UAAU,QAAQ,KAAK;EACjE,KAAK,sBACH,OAAO,QAAQ,QAAQ,WAAW,MAAM,UAAU,QAAQ,KAAK;CACnE;AACF;;AAGA,SAAgB,kBAAkB,OAAqC,OAA2B;CAChG,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,UAAU,MAAM,WAAW,KAAI,WACnC,QAAQ,MAAM,IAAI,kBAAkB,QAAQ,KAAK,IAAI,kBAAkB,QAAQ,KAAK,CACtF;CACA,OAAO,MAAM,aAAa,QAAQ,QAAQ,MAAM,OAAO,IAAI,QAAQ,KAAK,OAAO;AACjF"}
|
|
1
|
+
{"version":3,"file":"rule-group.js","names":[],"sources":["../../src/rules/rule-group.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Conditions a board phase tests against a card, such as when it starts on its own or\n * when its exit tool is approved without a person. The shape mirrors the editor's rule\n * groups (`{field, operator, value}` leaves inside AND/OR groups), but Factory owns\n * the types and evaluator; nothing is shared with `@mastra/editor` or `@mastra/server`.\n */\nexport const RULE_OPERATORS = [\n 'equals',\n 'not_equals',\n 'contains',\n 'not_contains',\n 'in',\n 'not_in',\n 'exists',\n 'not_exists',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal',\n] as const;\nexport type RuleOperator = (typeof RULE_OPERATORS)[number];\n\nexport const MAX_RULE_GROUP_DEPTH = 3;\nconst MAX_CONDITIONS_PER_GROUP = 20;\nconst MAX_STRING_VALUE_LENGTH = 500;\n\n/** Facts a phase condition can test about a card (see `cardRuleFacts`). */\nexport const CARD_RULE_FIELDS = [\n 'item.labels',\n 'item.title',\n 'item.author',\n 'item.key',\n 'item.state',\n 'item.assignees',\n 'author.trusted',\n 'source.kind',\n 'source.integration',\n 'source.provider',\n 'source.repository',\n 'item.pullRequest',\n] as const;\n\nexport type RuleValue = string | number | boolean | Array<string | number | boolean>;\n\nexport interface RuleCondition {\n field: string;\n operator: RuleOperator;\n value?: RuleValue;\n}\n\nexport interface RuleGroup {\n operator: 'AND' | 'OR';\n conditions: Array<RuleCondition | RuleGroup>;\n}\n\nexport type RuleFacts = Readonly<Record<string, unknown>>;\n\nconst scalarSchema = z.union([z.string().max(MAX_STRING_VALUE_LENGTH), z.number().finite(), z.boolean()]);\nconst valueSchema = z.union([scalarSchema, z.array(scalarSchema).max(100)]);\n\nconst VALUELESS: ReadonlySet<RuleOperator> = new Set(['exists', 'not_exists']);\nconst LIST_VALUE: ReadonlySet<RuleOperator> = new Set(['in', 'not_in']);\nconst ORDERED: ReadonlySet<RuleOperator> = new Set([\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal',\n]);\n\nfunction conditionSchema(fields: readonly [string, ...string[]]) {\n return z\n .object({ field: z.enum(fields), operator: z.enum(RULE_OPERATORS), value: valueSchema.optional() })\n .strict()\n .superRefine((condition, ctx) => {\n if (VALUELESS.has(condition.operator)) {\n if (condition.value !== undefined) {\n ctx.addIssue({ code: 'custom', path: ['value'], message: `'${condition.operator}' takes no value.` });\n }\n return;\n }\n if (condition.value === undefined) {\n ctx.addIssue({ code: 'custom', path: ['value'], message: `'${condition.operator}' needs a value.` });\n return;\n }\n if (LIST_VALUE.has(condition.operator) !== Array.isArray(condition.value)) {\n ctx.addIssue({\n code: 'custom',\n path: ['value'],\n message: LIST_VALUE.has(condition.operator)\n ? `'${condition.operator}' needs a list value.`\n : `'${condition.operator}' needs a single value.`,\n });\n }\n if (ORDERED.has(condition.operator) && typeof condition.value !== 'number') {\n ctx.addIssue({ code: 'custom', path: ['value'], message: `'${condition.operator}' needs a number.` });\n }\n });\n}\n\n/** Zod schema for a rule group whose leaves may only name `fields`. Depth is capped at {@link MAX_RULE_GROUP_DEPTH}. */\nexport function ruleGroupSchema(fields: readonly [string, ...string[]]): z.ZodType<RuleGroup> {\n const leaf = conditionSchema(fields);\n const groupAt = (depth: number): z.ZodType<RuleGroup> => {\n const member: z.ZodType<RuleCondition | RuleGroup> =\n depth < MAX_RULE_GROUP_DEPTH ? z.union([leaf, z.lazy(() => groupAt(depth + 1))]) : leaf;\n return z\n .object({\n operator: z.enum(['AND', 'OR']),\n conditions: z.array(member).min(1).max(MAX_CONDITIONS_PER_GROUP),\n })\n .strict() as z.ZodType<RuleGroup>;\n };\n return groupAt(1);\n}\n\nexport const cardRuleGroupSchema = ruleGroupSchema(CARD_RULE_FIELDS);\n\nfunction isGroup(member: RuleCondition | RuleGroup): member is RuleGroup {\n return 'conditions' in member;\n}\n\nconst normalize = (value: unknown) => (typeof value === 'string' ? value.trim().toLowerCase() : value);\nconst same = (left: unknown, right: unknown) => normalize(left) === normalize(right);\n\nfunction contains(actual: unknown, expected: unknown): boolean {\n if (Array.isArray(actual)) return actual.some(entry => same(entry, expected));\n if (typeof actual === 'string' && typeof expected === 'string') {\n return actual.toLowerCase().includes(expected.toLowerCase());\n }\n return false;\n}\n\nfunction compare(actual: unknown, expected: unknown, test: (left: number, right: number) => boolean): boolean {\n return typeof actual === 'number' && typeof expected === 'number' && test(actual, expected);\n}\n\n/** Whether `actual` is `expected`; a list fact (labels, assignees) is when one of its members is. */\nconst matches = (actual: unknown, expected: unknown) =>\n Array.isArray(actual) ? actual.some(entry => same(entry, expected)) : same(actual, expected);\n\n/**\n * Evaluate one condition. Strings compare case-insensitively (labels and\n * repository slugs are case-insensitive on every provider Factory reads). A\n * list fact is tested by its members, and an empty list counts as missing. A\n * missing fact fails every operator except `not_exists`, `not_equals`,\n * `not_contains` and `not_in`.\n */\nfunction evaluateCondition(condition: RuleCondition, facts: RuleFacts): boolean {\n const actual = facts[condition.field];\n const present = actual !== undefined && actual !== null && !(Array.isArray(actual) && actual.length === 0);\n const expected = condition.value;\n switch (condition.operator) {\n case 'exists':\n return present;\n case 'not_exists':\n return !present;\n case 'equals':\n return present && matches(actual, expected);\n case 'not_equals':\n return !present || !matches(actual, expected);\n case 'contains':\n return present && contains(actual, expected);\n case 'not_contains':\n return !present || !contains(actual, expected);\n case 'in':\n return present && Array.isArray(expected) && expected.some(candidate => matches(actual, candidate));\n case 'not_in':\n return !present || !Array.isArray(expected) || !expected.some(candidate => matches(actual, candidate));\n case 'greater_than':\n return compare(actual, expected, (left, right) => left > right);\n case 'less_than':\n return compare(actual, expected, (left, right) => left < right);\n case 'greater_than_or_equal':\n return compare(actual, expected, (left, right) => left >= right);\n case 'less_than_or_equal':\n return compare(actual, expected, (left, right) => left <= right);\n }\n}\n\n/** True when `facts` satisfy `group`. A `null`/absent group matches everything (an unconditional phase). */\nexport function evaluateRuleGroup(group: RuleGroup | null | undefined, facts: RuleFacts): boolean {\n if (!group) return true;\n const results = group.conditions.map(member =>\n isGroup(member) ? evaluateRuleGroup(member, facts) : evaluateCondition(member, facts),\n );\n return group.operator === 'AND' ? results.every(Boolean) : results.some(Boolean);\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,uBAAuB;AACpC,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;;AAGhC,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAiBA,MAAM,eAAe,EAAE,MAAM;CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,uBAAuB;CAAG,EAAE,OAAO,CAAC,CAAC,OAAO;CAAG,EAAE,QAAQ;AAAC,CAAC;AACxG,MAAM,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,YAAY,CAAC,CAAC,IAAI,GAAG,CAAC,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B;EACE,KAAK,UACH,OAAO;EACT,KAAK,cACH,OAAO,CAAC;EACV,KAAK,UACH,OAAO,WAAW,QAAQ,QAAQ,QAAQ;EAC5C,KAAK,cACH,OAAO,CAAC,WAAW,CAAC,QAAQ,QAAQ,QAAQ;EAC9C,KAAK,YACH,OAAO,WAAW,SAAS,QAAQ,QAAQ;EAC7C,KAAK,gBACH,OAAO,CAAC,WAAW,CAAC,SAAS,QAAQ,QAAQ;EAC/C,KAAK,MACH,OAAO,WAAW,MAAM,QAAQ,QAAQ,KAAK,SAAS,MAAK,cAAa,QAAQ,QAAQ,SAAS,CAAC;EACpG,KAAK,UACH,OAAO,CAAC,WAAW,CAAC,MAAM,QAAQ,QAAQ,KAAK,CAAC,SAAS,MAAK,cAAa,QAAQ,QAAQ,SAAS,CAAC;EACvG,KAAK,gBACH,OAAO,QAAQ,QAAQ,WAAW,MAAM,UAAU,OAAO,KAAK;EAChE,KAAK,aACH,OAAO,QAAQ,QAAQ,WAAW,MAAM,UAAU,OAAO,KAAK;EAChE,KAAK,yBACH,OAAO,QAAQ,QAAQ,WAAW,MAAM,UAAU,QAAQ,KAAK;EACjE,KAAK,sBACH,OAAO,QAAQ,QAAQ,WAAW,MAAM,UAAU,QAAQ,KAAK;CACnE;AACF;;AAGA,SAAgB,kBAAkB,OAAqC,OAA2B;CAChG,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,UAAU,MAAM,WAAW,KAAI,WACnC,QAAQ,MAAM,IAAI,kBAAkB,QAAQ,KAAK,IAAI,kBAAkB,QAAQ,KAAK,CACtF;CACA,OAAO,MAAM,aAAa,QAAQ,QAAQ,MAAM,OAAO,IAAI,QAAQ,KAAK,OAAO;AACjF"}
|
|
@@ -33,12 +33,11 @@ export interface FactoryTransitionRequest {
|
|
|
33
33
|
completedTool?: string;
|
|
34
34
|
/**
|
|
35
35
|
* Internal: an intake route moves the card on a status event. A route is admin-authored, so it
|
|
36
|
-
* may name any phase on the card's board regardless of the board's next phases
|
|
37
|
-
*
|
|
36
|
+
* may name any phase on the card's board regardless of the board's next phases, working ones
|
|
37
|
+
* included. The phase's `autoStart` and the dispatcher's approval check decide whether its run starts.
|
|
38
38
|
*/
|
|
39
39
|
eventRoute?: {
|
|
40
40
|
routeId: string;
|
|
41
|
-
allowWorkingPhase: boolean;
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
export interface FactoryTransitionServiceOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-service.d.ts","sourceRoot":"","sources":["../../src/rules/transition-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAIxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC7G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAEV,gBAAgB,EAEhB,sBAAsB,EAEtB,gBAAgB,EAEhB,uBAAuB,EAExB,MAAM,YAAY,CAAC;AAiBpB,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,gBAAgB,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,gBAAgB,CAAC;IACxB,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,sEAAsE;IACtE,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,MA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AI,EAAE;QAC7B,KAAK,EAAE,MAAM,CAAC;QACd,gBAAgB,EAAE,MAAM,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;KACjB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3B;;2CAEuC;IACvC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,gBAAgB,EAAE,MAAM,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,IAAI,CAAC;KACZ,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC5B;AA0BD,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,CAWpG;AAiBD,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,GAAG,SAAS,CAEpF;AAyFD,qBAAa,wBAAwB;;IAWnC,YAAY,OAAO,EAAE,+BAA+B,EAUnD;IAED,IAAI,aAAa,IAAI,MAAM,CAE1B;IAEK,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA4BpF;CAwYF"}
|
|
@@ -255,7 +255,6 @@ var FactoryTransitionService = class {
|
|
|
255
255
|
const nextStagesReason = nextStages.length > 0 ? `Next stages declared from ${fromStage}: ${nextStages.join(", ")}.` : `No next stage is declared from ${fromStage}.`;
|
|
256
256
|
return this.#commitRejection(request, transitionId, "invalid_transition", `The ${board.name} board does not allow moving from ${fromStage} to ${request.stage}. ${nextStagesReason}`);
|
|
257
257
|
}
|
|
258
|
-
if (request.eventRoute && !request.eventRoute.allowWorkingPhase && fromStage !== request.stage && board.isWorking(request.stage)) return this.#commitRejection(request, transitionId, "approval_required", `Intake route ${request.eventRoute.routeId} moves cards into ${board.phases[request.stage]?.name ?? request.stage}, a working phase, only when the route allows working phases.`);
|
|
259
258
|
const humanMove = request.actor.type === "human" && fromStage !== request.stage && request.cause !== "run_start";
|
|
260
259
|
const entersWorking = board.isWorking(request.stage);
|
|
261
260
|
const seatRole = board.roleForPhase(request.stage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-service.js","names":[],"sources":["../../src/rules/transition-service.ts"],"sourcesContent":["import { 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 { isAgentActor } from '../storage/domains/work-items/base.js';\nimport type { Card, WorkItemsStorage } from '../storage/domains/work-items/base.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; it enters a\n * working phase only when the route allows it.\n */\n eventRoute?: { routeId: string; allowWorkingPhase: boolean };\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 }) => Promise<void> | void;\n /** Upper bound on how long a committed transition waits for\n * `onTerminalStage` before returning (default 30s). The cleanup continues\n * in the background past the bound. */\n terminalCleanupTimeoutMs?: number;\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' : '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 */\nfunction acceptsWork(board: InstalledBoard, from: string, to: string): boolean {\n const buildRole = boardFlow(board).buildRole;\n if (!buildRole || board.roleForPhase(to) !== buildRole) return false;\n const fromPhase = board.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 if (request.cause === 'run_start') 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\nfunction stageTransitionMessage(fromStage: FactoryRuleStage, toStage: FactoryRuleStage): string {\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 #terminalCleanupTimeoutMs: number;\n readonly #onAccepted: FactoryTransitionServiceOptions['onAccepted'];\n readonly #onTransitionCommitted: FactoryTransitionServiceOptions['onTransitionCommitted'];\n readonly #audit: AuditRecorder | undefined;\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.#onAccepted = options.onAccepted;\n this.#onTransitionCommitted = options.onTransitionCommitted;\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 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 if (result.stage === fromStage) 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 }),\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 if (result.status === 'accepted' && result.stage === from && !request.reenter) 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.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 board = boards.get(request.board);\n if (!board) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `Board \"${request.board}\" is not installed.`,\n );\n }\n const fromStage = item.stages.length === 1 ? item.stages[0] : undefined;\n if (!fromStage || !Object.prototype.hasOwnProperty.call(board.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 if (\n !Object.prototype.hasOwnProperty.call(board.phases, request.stage) ||\n (!request.eventRoute && !board.allowsTransition(fromStage, request.stage))\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 if (\n request.eventRoute &&\n !request.eventRoute.allowWorkingPhase &&\n fromStage !== request.stage &&\n board.isWorking(request.stage)\n ) {\n return this.#commitRejection(\n request,\n transitionId,\n 'approval_required',\n `Intake route ${request.eventRoute.routeId} moves cards into ${board.phases[request.stage]?.name ?? request.stage}, a working phase, only when the route allows working phases.`,\n );\n }\n\n // The coordinator's own self-move at run start would otherwise inject a second run's kickoff.\n const humanMove = request.actor.type === 'human' && fromStage !== request.stage && 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: request.board,\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 = board.phases[fromStage];\n const exitTool = fromPhase?.kind === 'working' ? fromPhase.exitTool : undefined;\n if (\n request.actor.type !== 'human' &&\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 });\n const validated = validateFactoryRuleDecisions(run ? [run] : [], contextBase.causalChain.length).filter(\n decision => {\n assertFactoryDecisionTarget(decision, boards, itemBoard);\n return !(startsRun(decision) && runAlreadyUnderway(request, decision));\n },\n );\n if (humanMove) {\n const message = stageTransitionMessage(fromStage, request.stage);\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, 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 );\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 ): 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 actorId: actorId(request.actor),\n ingress: { identity: request.ingress.identity, triggerType: request.ingress.type, transitionId },\n configVersion: this.#configVersion,\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 if (\n this.#onTerminalStage &&\n result.status === 'accepted' &&\n boards?.get(request.board)?.isTerminal(result.stage) === true\n ) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n const cleanup = Promise.resolve(\n this.#onTerminalStage({\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: request.workItemId,\n stage: result.stage,\n revision: result.revision,\n actor: request.actor,\n }),\n );\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 return result;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;;;;;AAK7B,MAAM,8BAA8B;AAuFpC,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,UAC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,QAAQ,CAER,UAAU;IACR,aAAa,KAAK;GACpB;EACF;EACA,OAAO;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"transition-service.js","names":[],"sources":["../../src/rules/transition-service.ts"],"sourcesContent":["import { 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 { isAgentActor } from '../storage/domains/work-items/base.js';\nimport type { Card, WorkItemsStorage } from '../storage/domains/work-items/base.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?: { routeId: 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 }) => Promise<void> | void;\n /** Upper bound on how long a committed transition waits for\n * `onTerminalStage` before returning (default 30s). The cleanup continues\n * in the background past the bound. */\n terminalCleanupTimeoutMs?: number;\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' : '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 */\nfunction acceptsWork(board: InstalledBoard, from: string, to: string): boolean {\n const buildRole = boardFlow(board).buildRole;\n if (!buildRole || board.roleForPhase(to) !== buildRole) return false;\n const fromPhase = board.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 if (request.cause === 'run_start') 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\nfunction stageTransitionMessage(fromStage: FactoryRuleStage, toStage: FactoryRuleStage): string {\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 #terminalCleanupTimeoutMs: number;\n readonly #onAccepted: FactoryTransitionServiceOptions['onAccepted'];\n readonly #onTransitionCommitted: FactoryTransitionServiceOptions['onTransitionCommitted'];\n readonly #audit: AuditRecorder | undefined;\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.#onAccepted = options.onAccepted;\n this.#onTransitionCommitted = options.onTransitionCommitted;\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 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 if (result.stage === fromStage) 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 }),\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 if (result.status === 'accepted' && result.stage === from && !request.reenter) 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.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 board = boards.get(request.board);\n if (!board) {\n return this.#commitRejection(\n request,\n transitionId,\n 'invalid_transition',\n `Board \"${request.board}\" is not installed.`,\n );\n }\n const fromStage = item.stages.length === 1 ? item.stages[0] : undefined;\n if (!fromStage || !Object.prototype.hasOwnProperty.call(board.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 if (\n !Object.prototype.hasOwnProperty.call(board.phases, request.stage) ||\n (!request.eventRoute && !board.allowsTransition(fromStage, request.stage))\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 // The coordinator's own self-move at run start would otherwise inject a second run's kickoff.\n const humanMove = request.actor.type === 'human' && fromStage !== request.stage && 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: request.board,\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 = board.phases[fromStage];\n const exitTool = fromPhase?.kind === 'working' ? fromPhase.exitTool : undefined;\n if (\n request.actor.type !== 'human' &&\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 });\n const validated = validateFactoryRuleDecisions(run ? [run] : [], contextBase.causalChain.length).filter(\n decision => {\n assertFactoryDecisionTarget(decision, boards, itemBoard);\n return !(startsRun(decision) && runAlreadyUnderway(request, decision));\n },\n );\n if (humanMove) {\n const message = stageTransitionMessage(fromStage, request.stage);\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, 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 );\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 ): 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 actorId: actorId(request.actor),\n ingress: { identity: request.ingress.identity, triggerType: request.ingress.type, transitionId },\n configVersion: this.#configVersion,\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 if (\n this.#onTerminalStage &&\n result.status === 'accepted' &&\n boards?.get(request.board)?.isTerminal(result.stage) === true\n ) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n const cleanup = Promise.resolve(\n this.#onTerminalStage({\n orgId: request.orgId,\n factoryProjectId: request.factoryProjectId,\n workItemId: request.workItemId,\n stage: result.stage,\n revision: result.revision,\n actor: request.actor,\n }),\n );\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 return result;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;;;;;AAK7B,MAAM,8BAA8B;AAuFpC,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;EAAQ;EACxE,SACE,OAAO;GAAE,SAAS;GAAI,WAAW,MAAM;EAAK;CAChD;AACF;AAEA,SAAS,QAAQ,QAA4E;CAC3F,OAAO,OAAO,WAAW,cAAc,OAAO,SAAS;AAC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;GACF,CAAC,CACH,CAAC,CACA,OAAM,UAAS;IACd,QAAQ,KAAK,kDAAkD,QAAQ,WAAW,IAAI,KAAK;GAC7F,CAAC;EACL;EAEA,IACE,KAAK,oBACL,OAAO,WAAW,cAClB,QAAQ,IAAI,QAAQ,KAAK,CAAC,EAAE,WAAW,OAAO,KAAK,MAAM,MACzD;GACA,IAAI;GACJ,IAAI;IACF,MAAM,UAAU,QAAQ,QACtB,KAAK,iBAAiB;KACpB,OAAO,QAAQ;KACf,kBAAkB,QAAQ;KAC1B,YAAY,QAAQ;KACpB,OAAO,OAAO;KACd,UAAU,OAAO;KACjB,OAAO,QAAQ;IACjB,CAAC,CACH;IAGA,QAAQ,YAAY,CAAC,CAAC;IACtB,MAAM,QAAQ,KAAK,CACjB,SACA,IAAI,SAAc,YAAW;KAC3B,QAAQ,WAAW,SAAS,KAAK,yBAAyB;IAC5D,CAAC,CACH,CAAC;GACH,QAAQ,CAER,UAAU;IACR,aAAa,KAAK;GACpB;EACF;EACA,OAAO;CACT;AACF"}
|
package/dist/rules/types.d.ts
CHANGED
|
@@ -146,10 +146,7 @@ export interface FactoryGithubRuleContext extends FactoryRuleContextBase {
|
|
|
146
146
|
flow?: FactoryRuleBoardFlow;
|
|
147
147
|
/** What the card's current phase means on its board; absent without a card or when the board does not declare the phase. */
|
|
148
148
|
phase?: FactoryRulePhaseContext;
|
|
149
|
-
/**
|
|
150
|
-
* Board an issue's labels route it to, when the project has a matching label route and that board
|
|
151
|
-
* is installed. Absent for pull requests and for issues whose labels select nothing.
|
|
152
|
-
*/
|
|
149
|
+
/** Where a new card is filed before the project's intake routes place it. */
|
|
153
150
|
intake?: FactoryRuleIntakeTarget;
|
|
154
151
|
/**
|
|
155
152
|
* Set on the one evaluation per pull request delivery that files the pull
|
|
@@ -246,14 +243,13 @@ export interface FactoryGithubRuleContext extends FactoryRuleContextBase {
|
|
|
246
243
|
};
|
|
247
244
|
}
|
|
248
245
|
/**
|
|
249
|
-
* Where
|
|
250
|
-
*
|
|
246
|
+
* Where an integration files a new card: the default board's initial phase. The project's intake
|
|
247
|
+
* routes then decide where the card goes; the board and phase a rule names don't. Absent when the
|
|
248
|
+
* default board is not installed.
|
|
251
249
|
*/
|
|
252
250
|
export interface FactoryRuleIntakeTarget {
|
|
253
251
|
board: string;
|
|
254
252
|
initialPhase: string;
|
|
255
|
-
/** The board's pull request review phase, where a pull request asked to be reviewed lands. */
|
|
256
|
-
pullRequestReview?: string;
|
|
257
253
|
}
|
|
258
254
|
/**
|
|
259
255
|
* Where a source-closed rule moves the card, from the `sourceClosed` mapping its installed board
|
|
@@ -374,7 +370,7 @@ export interface FactoryLinearRuleContext extends FactoryRuleContextBase {
|
|
|
374
370
|
flow?: FactoryRuleBoardFlow;
|
|
375
371
|
/** What the card's current phase means on its board; absent without a card or when the board does not declare the phase. */
|
|
376
372
|
phase?: FactoryRulePhaseContext;
|
|
377
|
-
/**
|
|
373
|
+
/** Where a new card is filed before the project's intake routes place it. */
|
|
378
374
|
intake?: FactoryRuleIntakeTarget;
|
|
379
375
|
event: FactoryLinearEventName;
|
|
380
376
|
issue: {
|
|
@@ -407,7 +403,7 @@ export interface FactoryJiraRuleContext extends FactoryRuleContextBase {
|
|
|
407
403
|
flow?: FactoryRuleBoardFlow;
|
|
408
404
|
/** What the card's current phase means on its board; absent without a card or when the board does not declare the phase. */
|
|
409
405
|
phase?: FactoryRulePhaseContext;
|
|
410
|
-
/**
|
|
406
|
+
/** Where a new card is filed before the project's intake routes place it. */
|
|
411
407
|
intake?: FactoryRuleIntakeTarget;
|
|
412
408
|
event: FactoryJiraEventName;
|
|
413
409
|
issue: {
|
|
@@ -440,7 +436,7 @@ export interface FactoryIncidentioRuleContext extends FactoryRuleContextBase {
|
|
|
440
436
|
flow?: FactoryRuleBoardFlow;
|
|
441
437
|
/** What the card's current phase means on its board; absent without a card or when the board does not declare the phase. */
|
|
442
438
|
phase?: FactoryRulePhaseContext;
|
|
443
|
-
/**
|
|
439
|
+
/** Where a new card is filed before the project's intake routes place it. */
|
|
444
440
|
intake?: FactoryRuleIntakeTarget;
|
|
445
441
|
event: FactoryIncidentioEventName;
|
|
446
442
|
issue: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/rules/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAErF,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,WAAW,GACX,cAAc,GACd,WAAW,GACX,cAAc,GACd,YAAY,GACZ,sBAAsB,GACtB,QAAQ,CAAC;AAEb,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,EACjB,GAAG,CAAC,EAAE,MAAM,GACX,sBAAsB,CAkBxB;AAED,oGAAoG;AACpG,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,4FAA4F;AAC5F,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAKzD,wBAAgB,aAAa,CAC3B,IAAI,EAAE;IAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAC3E,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAC3C,OAAO,CAOT;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,GAAG,cAAc,CAWpF;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE3F;AA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