@mastra/factory 0.24.0 → 0.25.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -9
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +18 -4
- package/dist/auth.js.map +1 -1
- package/dist/boards/review.d.ts.map +1 -1
- package/dist/boards/review.js +3 -2
- package/dist/boards/review.js.map +1 -1
- package/dist/factory.d.ts +3 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +61 -69
- package/dist/factory.js.map +1 -1
- package/dist/integrations/base.d.ts +14 -1
- package/dist/integrations/base.d.ts.map +1 -1
- package/dist/{session → integrations/slack}/channel-reply-processor.d.ts +4 -3
- package/dist/integrations/slack/channel-reply-processor.d.ts.map +1 -0
- package/dist/integrations/slack/channel-reply-processor.js +61 -0
- package/dist/integrations/slack/channel-reply-processor.js.map +1 -0
- package/dist/integrations/slack/channel-session-link-processor.d.ts.map +1 -0
- package/dist/{session → integrations/slack}/channel-session-link-processor.js +13 -4
- package/dist/integrations/slack/channel-session-link-processor.js.map +1 -0
- package/dist/integrations/slack/integration.d.ts +25 -1
- package/dist/integrations/slack/integration.d.ts.map +1 -1
- package/dist/integrations/slack/integration.js +55 -5
- package/dist/integrations/slack/integration.js.map +1 -1
- package/dist/integrations/slack/reply-reminder-processor.d.ts +23 -0
- package/dist/integrations/slack/reply-reminder-processor.d.ts.map +1 -0
- package/dist/integrations/slack/reply-reminder-processor.js +58 -0
- package/dist/integrations/slack/reply-reminder-processor.js.map +1 -0
- package/dist/integrations/slack/reply-tool.d.ts +31 -0
- package/dist/integrations/slack/reply-tool.d.ts.map +1 -0
- package/dist/integrations/slack/reply-tool.js +203 -0
- package/dist/integrations/slack/reply-tool.js.map +1 -0
- package/dist/integrations/slack/share-file-tool.d.ts +45 -0
- package/dist/integrations/slack/share-file-tool.d.ts.map +1 -0
- package/dist/integrations/slack/share-file-tool.js +106 -0
- package/dist/integrations/slack/share-file-tool.js.map +1 -0
- package/dist/integrations/slack/slack.d.ts.map +1 -1
- package/dist/integrations/slack/slack.js +54 -6
- package/dist/integrations/slack/slack.js.map +1 -1
- package/dist/mcp/events.d.ts +73 -0
- package/dist/mcp/events.d.ts.map +1 -0
- package/dist/mcp/events.js +158 -0
- package/dist/mcp/events.js.map +1 -0
- package/dist/mcp/routes.d.ts +0 -1
- package/dist/mcp/routes.d.ts.map +1 -1
- package/dist/mcp/routes.js +30 -3
- package/dist/mcp/routes.js.map +1 -1
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
- package/dist/platform-auth-host.d.ts.map +1 -1
- package/dist/platform-auth-host.js +1 -1
- package/dist/platform-auth-host.js.map +1 -1
- package/dist/routes/config.d.ts +2 -0
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +50 -9
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.d.ts +2 -0
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +1 -1
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/session-access.d.ts +7 -2
- package/dist/routes/session-access.d.ts.map +1 -1
- package/dist/routes/session-access.js +41 -4
- package/dist/routes/session-access.js.map +1 -1
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +4 -3
- package/dist/routes/skills.js.map +1 -1
- package/dist/routes/source-control-sessions.d.ts +2 -0
- package/dist/routes/source-control-sessions.d.ts.map +1 -1
- package/dist/routes/source-control-sessions.js +161 -24
- package/dist/routes/source-control-sessions.js.map +1 -1
- package/dist/routes/surface.d.ts +2 -0
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +10 -4
- package/dist/routes/surface.js.map +1 -1
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +11 -3
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/processor.d.ts +2 -2
- package/dist/rules/processor.d.ts.map +1 -1
- package/dist/rules/processor.js +3 -3
- package/dist/rules/processor.js.map +1 -1
- package/dist/sandbox/session-retirement.d.ts +11 -0
- package/dist/sandbox/session-retirement.d.ts.map +1 -1
- package/dist/sandbox/session-retirement.js +38 -1
- package/dist/sandbox/session-retirement.js.map +1 -1
- package/dist/sandbox/session-sandbox.d.ts +2 -0
- package/dist/sandbox/session-sandbox.d.ts.map +1 -1
- package/dist/sandbox/session-sandbox.js +5 -1
- package/dist/sandbox/session-sandbox.js.map +1 -1
- package/dist/session/credential-policy.d.ts +4 -2
- package/dist/session/credential-policy.d.ts.map +1 -1
- package/dist/session/credential-policy.js +11 -1
- package/dist/session/credential-policy.js.map +1 -1
- package/dist/session/factory-session.d.ts.map +1 -1
- package/dist/session/factory-session.js +14 -1
- package/dist/session/factory-session.js.map +1 -1
- package/dist/session/run-audit.d.ts +1 -0
- package/dist/session/run-audit.d.ts.map +1 -1
- package/dist/session/run-audit.js +7 -2
- package/dist/session/run-audit.js.map +1 -1
- package/dist/session/session-threads.d.ts +5 -0
- package/dist/session/session-threads.d.ts.map +1 -1
- package/dist/session/session-threads.js +8 -1
- package/dist/session/session-threads.js.map +1 -1
- package/dist/session/thinking-default.d.ts +6 -13
- package/dist/session/thinking-default.d.ts.map +1 -1
- package/dist/session/thinking-default.js +18 -22
- package/dist/session/thinking-default.js.map +1 -1
- package/dist/session-owner-signal.d.ts +2 -0
- package/dist/session-owner-signal.d.ts.map +1 -0
- package/dist/session-owner-signal.js +6 -0
- package/dist/session-owner-signal.js.map +1 -0
- package/dist/skills/service.d.ts +6 -7
- package/dist/skills/service.d.ts.map +1 -1
- package/dist/skills/service.js +9 -19
- package/dist/skills/service.js.map +1 -1
- package/dist/storage/domains/audit/actions.d.ts +1 -0
- package/dist/storage/domains/audit/actions.d.ts.map +1 -1
- package/dist/storage/domains/audit/actions.js +2 -1
- package/dist/storage/domains/audit/actions.js.map +1 -1
- package/dist/storage/domains/audit/base.d.ts +18 -2
- package/dist/storage/domains/audit/base.d.ts.map +1 -1
- package/dist/storage/domains/audit/base.js +22 -4
- package/dist/storage/domains/audit/base.js.map +1 -1
- package/dist/storage/domains/model-defaults/base.d.ts +8 -0
- package/dist/storage/domains/model-defaults/base.d.ts.map +1 -1
- package/dist/storage/domains/model-defaults/base.js +18 -0
- package/dist/storage/domains/model-defaults/base.js.map +1 -1
- package/dist/storage/domains/source-control/base.d.ts +26 -1
- package/dist/storage/domains/source-control/base.d.ts.map +1 -1
- package/dist/storage/domains/source-control/base.js +69 -5
- package/dist/storage/domains/source-control/base.js.map +1 -1
- package/dist/storage/domains/source-control/inmemory.d.ts +19 -1
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/source-control/inmemory.js +30 -2
- package/dist/storage/domains/source-control/inmemory.js.map +1 -1
- package/dist/tools/permissions.d.ts.map +1 -1
- package/dist/tools/permissions.js +2 -1
- package/dist/tools/permissions.js.map +1 -1
- package/dist/tools/sandbox-tools.d.ts +12 -0
- package/dist/tools/sandbox-tools.d.ts.map +1 -0
- package/dist/tools/sandbox-tools.js +40 -0
- package/dist/tools/sandbox-tools.js.map +1 -0
- package/dist/tools/scope.d.ts.map +1 -1
- package/dist/tools/scope.js +2 -5
- package/dist/tools/scope.js.map +1 -1
- package/dist/tools/session-tools.d.ts.map +1 -1
- package/dist/tools/session-tools.js +6 -2
- package/dist/tools/session-tools.js.map +1 -1
- package/dist/work-item-branch.d.ts +11 -3
- package/dist/work-item-branch.d.ts.map +1 -1
- package/dist/work-item-branch.js +34 -9
- package/dist/work-item-branch.js.map +1 -1
- package/dist/workspace.d.ts +2 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +4 -2
- package/dist/workspace.js.map +1 -1
- package/factory-skills/configure-factory-rules/SKILL.md +2 -2
- package/package.json +14 -13
- package/dist/session/channel-reply-processor.d.ts.map +0 -1
- package/dist/session/channel-reply-processor.js +0 -46
- package/dist/session/channel-reply-processor.js.map +0 -1
- package/dist/session/channel-session-link-processor.d.ts.map +0 -1
- package/dist/session/channel-session-link-processor.js.map +0 -1
- /package/dist/{session → integrations/slack}/channel-session-link-processor.d.ts +0 -0
|
@@ -22,11 +22,19 @@ export declare function workItemThreadTitle(item: Pick<WorkItemBranchInput, 'sou
|
|
|
22
22
|
* The git branch an item's runs and sessions share, one grammar for both sides
|
|
23
23
|
* of the wire: the dispatcher names autonomous run branches with it and the
|
|
24
24
|
* board opens card sessions on it, so both converge on one checkout per item.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Provider numbers are only unique within a repository, so GitHub and GitLab
|
|
26
|
+
* branches carry the item suffix as well. Cards without a provider identity
|
|
27
|
+
* (manual, Slack) and cards whose metadata lost their identifier fall back to
|
|
28
|
+
* the id-derived branch.
|
|
27
29
|
*/
|
|
28
30
|
export declare function workItemBranch(item: WorkItemBranchInput): string;
|
|
29
|
-
/** The
|
|
31
|
+
/** The pre-suffix GitHub branch, for reusing sessions opened before card names were unique. */
|
|
32
|
+
export declare function legacyGithubWorkItemBranch(branch: string): string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The pull request a `factory/pr-<number>-<item suffix>` branch was named after, the
|
|
35
|
+
* inverse of {@link workItemBranch}. Branches from before the suffix (`factory/pr-<number>`)
|
|
36
|
+
* still parse so existing checkouts can resolve their PR.
|
|
37
|
+
*/
|
|
30
38
|
export declare function pullRequestNumberFromBranch(branch: string): number | undefined;
|
|
31
39
|
/** The GitLab MR IID encoded in Factory's collision-resistant review branch. */
|
|
32
40
|
export declare function mergeRequestNumberFromBranch(branch: string): number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-item-branch.d.ts","sourceRoot":"","sources":["../src/work-item-branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAC5B,cAAc,GACd,WAAW,GACX,cAAc,GACd,WAAW,GACX,cAAc,GACd,YAAY,GACZ,sBA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cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,GAAG,SAAS,CAOzG;AAED,yHAAyH;AACzH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzE,MAAM,CAKR;AAgBD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CA+BhE;AAED,+FAA+F;AAC/F,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI9E;AAED,gFAAgF;AAChF,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI/E"}
|
package/dist/work-item-branch.js
CHANGED
|
@@ -28,35 +28,60 @@ function workItemThreadTitle(item) {
|
|
|
28
28
|
return `${item.source === "github-pr" ? "PR" : item.source === "gitlab-pr" ? "MR" : "Issue"} #${number}: ${item.title}`;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
+
* The last twelve alphanumerics of a work item id: the per-item suffix that keeps
|
|
32
|
+
* provider numbers from colliding across the repositories of one factory. Issue
|
|
33
|
+
* #13 exists in every repository, and a factory's sessions are unique per
|
|
34
|
+
* user and branch across all of its repositories, so a branch named by the
|
|
35
|
+
* number alone can only be held once per factory.
|
|
36
|
+
*/
|
|
37
|
+
function itemSuffix(id) {
|
|
38
|
+
return id.toLowerCase().replace(/[^a-z0-9]+/g, "").slice(-12);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
31
41
|
* The git branch an item's runs and sessions share, one grammar for both sides
|
|
32
42
|
* of the wire: the dispatcher names autonomous run branches with it and the
|
|
33
43
|
* board opens card sessions on it, so both converge on one checkout per item.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
44
|
+
* Provider numbers are only unique within a repository, so GitHub and GitLab
|
|
45
|
+
* branches carry the item suffix as well. Cards without a provider identity
|
|
46
|
+
* (manual, Slack) and cards whose metadata lost their identifier fall back to
|
|
47
|
+
* the id-derived branch.
|
|
36
48
|
*/
|
|
37
49
|
function workItemBranch(item) {
|
|
38
50
|
const metadata = item.metadata ?? {};
|
|
39
51
|
const providerNumber = workItemNumber(item);
|
|
40
|
-
if (providerNumber !== void 0 && (item.source === "github-issue" || item.source === "github-pr"))
|
|
52
|
+
if (providerNumber !== void 0 && (item.source === "github-issue" || item.source === "github-pr")) {
|
|
53
|
+
const suffix = itemSuffix(item.id);
|
|
54
|
+
const kind = item.source === "github-issue" ? "issue" : "pr";
|
|
55
|
+
return suffix ? `factory/${kind}-${providerNumber}-${suffix}` : `factory/${kind}-${providerNumber}`;
|
|
56
|
+
}
|
|
41
57
|
if ((item.source === "linear-issue" || item.source === "jira-issue" || item.source === "incidentio-follow-up") && typeof metadata.identifier === "string") {
|
|
42
58
|
const identifier = metadata.identifier.trim();
|
|
43
59
|
if (identifier) return `factory/${item.source === "linear-issue" ? "linear" : item.source === "jira-issue" ? "jira" : "incidentio"}-${identifier.toLowerCase()}`;
|
|
44
60
|
}
|
|
45
61
|
if (item.source === "gitlab-pr" && providerNumber !== void 0) {
|
|
46
|
-
const uniqueSuffix = item.id
|
|
62
|
+
const uniqueSuffix = itemSuffix(item.id);
|
|
47
63
|
if (uniqueSuffix) return `factory/gitlab-mr-${providerNumber}-${uniqueSuffix}`;
|
|
48
64
|
}
|
|
49
65
|
if (item.source === "gitlab-issue" && typeof metadata.identifier === "string") {
|
|
50
66
|
const identifier = metadata.identifier.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-");
|
|
51
|
-
const uniqueSuffix = item.id
|
|
67
|
+
const uniqueSuffix = itemSuffix(item.id);
|
|
52
68
|
if (identifier && uniqueSuffix) return `factory/gitlab-${identifier.slice(0, 60)}-${uniqueSuffix}`;
|
|
53
69
|
}
|
|
54
70
|
return `factory/item-${item.id}`;
|
|
55
71
|
}
|
|
56
|
-
/** The
|
|
72
|
+
/** The pre-suffix GitHub branch, for reusing sessions opened before card names were unique. */
|
|
73
|
+
function legacyGithubWorkItemBranch(branch) {
|
|
74
|
+
return /^(factory\/(?:issue|pr)-[1-9]\d*)-[a-z0-9]{1,12}$/.exec(branch)?.[1];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The pull request a `factory/pr-<number>-<item suffix>` branch was named after, the
|
|
78
|
+
* inverse of {@link workItemBranch}. Branches from before the suffix (`factory/pr-<number>`)
|
|
79
|
+
* still parse so existing checkouts can resolve their PR.
|
|
80
|
+
*/
|
|
57
81
|
function pullRequestNumberFromBranch(branch) {
|
|
58
|
-
const match = /^factory\/pr-([1-9]\d*)
|
|
59
|
-
|
|
82
|
+
const match = /^factory\/pr-([1-9]\d*)(?:-[a-z0-9]{1,12})?$/.exec(branch);
|
|
83
|
+
const number = match ? Number(match[1]) : void 0;
|
|
84
|
+
return number !== void 0 && Number.isSafeInteger(number) ? number : void 0;
|
|
60
85
|
}
|
|
61
86
|
/** The GitLab MR IID encoded in Factory's collision-resistant review branch. */
|
|
62
87
|
function mergeRequestNumberFromBranch(branch) {
|
|
@@ -65,6 +90,6 @@ function mergeRequestNumberFromBranch(branch) {
|
|
|
65
90
|
return number !== void 0 && Number.isSafeInteger(number) ? number : void 0;
|
|
66
91
|
}
|
|
67
92
|
//#endregion
|
|
68
|
-
export { mergeRequestNumberFromBranch, pullRequestNumberFromBranch, workItemBranch, workItemBranchSource, workItemNumber, workItemThreadTitle };
|
|
93
|
+
export { legacyGithubWorkItemBranch, mergeRequestNumberFromBranch, pullRequestNumberFromBranch, workItemBranch, workItemBranchSource, workItemNumber, workItemThreadTitle };
|
|
69
94
|
|
|
70
95
|
//# sourceMappingURL=work-item-branch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-item-branch.js","names":[],"sources":["../src/work-item-branch.ts"],"sourcesContent":["import type { ExternalWorkItemSource } from './storage/domains/work-items/base.js';\n\n/**\n * Where a card came from, in the vocabulary branch naming reads. Server rows\n * map their `externalSource` into this with {@link workItemBranchSource}; the\n * board's own `WorkItem['source']` is already this union.\n */\nexport type WorkItemBranchSource =\n | 'github-issue'\n | 'github-pr'\n | 'gitlab-issue'\n | 'gitlab-pr'\n | 'linear-issue'\n | 'jira-issue'\n | 'incidentio-follow-up'\n | 'slack-thread'\n | 'manual';\n\nexport interface WorkItemBranchInput {\n id: string;\n source: WorkItemBranchSource;\n metadata?: Record<string, unknown> | null;\n}\n\n/** Map a stored item's provenance onto the source vocabulary branch naming reads. */\nexport function workItemBranchSource(externalSource: ExternalWorkItemSource | null | undefined): WorkItemBranchSource {\n if (!externalSource) return 'manual';\n if (externalSource.integrationId === 'linear') return 'linear-issue';\n if (externalSource.integrationId === 'gitlab') {\n return externalSource.type === 'pull-request' ? 'gitlab-pr' : 'gitlab-issue';\n }\n if (externalSource.integrationId === 'jira') return 'jira-issue';\n if (externalSource.integrationId === 'incidentio') return 'incidentio-follow-up';\n // Only GitHub, GitLab, Linear, Jira, and incident.io carry provider identities; anything\n // else (a Slack thread, say) is a plain work item rather than a mislabeled GitHub issue.\n if (externalSource.integrationId !== 'github') return 'manual';\n return externalSource.type === 'pull-request' ? 'github-pr' : 'github-issue';\n}\n\nfunction branchNumber(metadata: Record<string, unknown>, key: string): number | undefined {\n const value = metadata[key] ?? metadata.number;\n return typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : undefined;\n}\n\n/** The provider number a GitHub card carries — the `#12` its runs and thread titles name it by. */\nexport function workItemNumber(item: Pick<WorkItemBranchInput, 'source' | 'metadata'>): number | undefined {\n const metadata = item.metadata ?? {};\n if (item.source === 'github-issue') return branchNumber(metadata, 'githubIssueNumber');\n if (item.source === 'github-pr') return branchNumber(metadata, 'githubPullRequestNumber');\n if (item.source === 'gitlab-issue') return branchNumber(metadata, 'gitlabIssueIid');\n if (item.source === 'gitlab-pr') return branchNumber(metadata, 'gitlabMergeRequestIid');\n return;\n}\n\n/** How a card names its thread: a Linear title already opens with its identifier, a GitHub card gets its number here. */\nexport function workItemThreadTitle(\n item: Pick<WorkItemBranchInput, 'source' | 'metadata'> & { title: string },\n): string {\n const number = workItemNumber(item);\n if (number === undefined) return item.title;\n const kind = item.source === 'github-pr' ? 'PR' : item.source === 'gitlab-pr' ? 'MR' : 'Issue';\n return `${kind} #${number}: ${item.title}`;\n}\n\n/**\n * The git branch an item's runs and sessions share, one grammar for both sides\n * of the wire: the dispatcher names autonomous run branches with it and the\n * board opens card sessions on it, so both converge on one checkout per item.\n * Cards without a provider identity (manual, Slack) and cards whose metadata
|
|
1
|
+
{"version":3,"file":"work-item-branch.js","names":[],"sources":["../src/work-item-branch.ts"],"sourcesContent":["import type { ExternalWorkItemSource } from './storage/domains/work-items/base.js';\n\n/**\n * Where a card came from, in the vocabulary branch naming reads. Server rows\n * map their `externalSource` into this with {@link workItemBranchSource}; the\n * board's own `WorkItem['source']` is already this union.\n */\nexport type WorkItemBranchSource =\n | 'github-issue'\n | 'github-pr'\n | 'gitlab-issue'\n | 'gitlab-pr'\n | 'linear-issue'\n | 'jira-issue'\n | 'incidentio-follow-up'\n | 'slack-thread'\n | 'manual';\n\nexport interface WorkItemBranchInput {\n id: string;\n source: WorkItemBranchSource;\n metadata?: Record<string, unknown> | null;\n}\n\n/** Map a stored item's provenance onto the source vocabulary branch naming reads. */\nexport function workItemBranchSource(externalSource: ExternalWorkItemSource | null | undefined): WorkItemBranchSource {\n if (!externalSource) return 'manual';\n if (externalSource.integrationId === 'linear') return 'linear-issue';\n if (externalSource.integrationId === 'gitlab') {\n return externalSource.type === 'pull-request' ? 'gitlab-pr' : 'gitlab-issue';\n }\n if (externalSource.integrationId === 'jira') return 'jira-issue';\n if (externalSource.integrationId === 'incidentio') return 'incidentio-follow-up';\n // Only GitHub, GitLab, Linear, Jira, and incident.io carry provider identities; anything\n // else (a Slack thread, say) is a plain work item rather than a mislabeled GitHub issue.\n if (externalSource.integrationId !== 'github') return 'manual';\n return externalSource.type === 'pull-request' ? 'github-pr' : 'github-issue';\n}\n\nfunction branchNumber(metadata: Record<string, unknown>, key: string): number | undefined {\n const value = metadata[key] ?? metadata.number;\n return typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : undefined;\n}\n\n/** The provider number a GitHub card carries — the `#12` its runs and thread titles name it by. */\nexport function workItemNumber(item: Pick<WorkItemBranchInput, 'source' | 'metadata'>): number | undefined {\n const metadata = item.metadata ?? {};\n if (item.source === 'github-issue') return branchNumber(metadata, 'githubIssueNumber');\n if (item.source === 'github-pr') return branchNumber(metadata, 'githubPullRequestNumber');\n if (item.source === 'gitlab-issue') return branchNumber(metadata, 'gitlabIssueIid');\n if (item.source === 'gitlab-pr') return branchNumber(metadata, 'gitlabMergeRequestIid');\n return;\n}\n\n/** How a card names its thread: a Linear title already opens with its identifier, a GitHub card gets its number here. */\nexport function workItemThreadTitle(\n item: Pick<WorkItemBranchInput, 'source' | 'metadata'> & { title: string },\n): string {\n const number = workItemNumber(item);\n if (number === undefined) return item.title;\n const kind = item.source === 'github-pr' ? 'PR' : item.source === 'gitlab-pr' ? 'MR' : 'Issue';\n return `${kind} #${number}: ${item.title}`;\n}\n\n/**\n * The last twelve alphanumerics of a work item id: the per-item suffix that keeps\n * provider numbers from colliding across the repositories of one factory. Issue\n * #13 exists in every repository, and a factory's sessions are unique per\n * user and branch across all of its repositories, so a branch named by the\n * number alone can only be held once per factory.\n */\nfunction itemSuffix(id: string): string {\n return id\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '')\n .slice(-12);\n}\n\n/**\n * The git branch an item's runs and sessions share, one grammar for both sides\n * of the wire: the dispatcher names autonomous run branches with it and the\n * board opens card sessions on it, so both converge on one checkout per item.\n * Provider numbers are only unique within a repository, so GitHub and GitLab\n * branches carry the item suffix as well. Cards without a provider identity\n * (manual, Slack) and cards whose metadata lost their identifier fall back to\n * the id-derived branch.\n */\nexport function workItemBranch(item: WorkItemBranchInput): string {\n const metadata = item.metadata ?? {};\n const providerNumber = workItemNumber(item);\n if (providerNumber !== undefined && (item.source === 'github-issue' || item.source === 'github-pr')) {\n const suffix = itemSuffix(item.id);\n const kind = item.source === 'github-issue' ? 'issue' : 'pr';\n return suffix ? `factory/${kind}-${providerNumber}-${suffix}` : `factory/${kind}-${providerNumber}`;\n }\n if (\n (item.source === 'linear-issue' || item.source === 'jira-issue' || item.source === 'incidentio-follow-up') &&\n typeof metadata.identifier === 'string'\n ) {\n const identifier = metadata.identifier.trim();\n if (identifier) {\n const provider = item.source === 'linear-issue' ? 'linear' : item.source === 'jira-issue' ? 'jira' : 'incidentio';\n return `factory/${provider}-${identifier.toLowerCase()}`;\n }\n }\n if (item.source === 'gitlab-pr' && providerNumber !== undefined) {\n const uniqueSuffix = itemSuffix(item.id);\n if (uniqueSuffix) return `factory/gitlab-mr-${providerNumber}-${uniqueSuffix}`;\n }\n if (item.source === 'gitlab-issue' && typeof metadata.identifier === 'string') {\n const identifier = metadata.identifier\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, '-');\n const uniqueSuffix = itemSuffix(item.id);\n if (identifier && uniqueSuffix) return `factory/gitlab-${identifier.slice(0, 60)}-${uniqueSuffix}`;\n }\n return `factory/item-${item.id}`;\n}\n\n/** The pre-suffix GitHub branch, for reusing sessions opened before card names were unique. */\nexport function legacyGithubWorkItemBranch(branch: string): string | undefined {\n const match = /^(factory\\/(?:issue|pr)-[1-9]\\d*)-[a-z0-9]{1,12}$/.exec(branch);\n return match?.[1];\n}\n\n/**\n * The pull request a `factory/pr-<number>-<item suffix>` branch was named after, the\n * inverse of {@link workItemBranch}. Branches from before the suffix (`factory/pr-<number>`)\n * still parse so existing checkouts can resolve their PR.\n */\nexport function pullRequestNumberFromBranch(branch: string): number | undefined {\n const match = /^factory\\/pr-([1-9]\\d*)(?:-[a-z0-9]{1,12})?$/.exec(branch);\n const number = match ? Number(match[1]) : undefined;\n return number !== undefined && Number.isSafeInteger(number) ? number : undefined;\n}\n\n/** The GitLab MR IID encoded in Factory's collision-resistant review branch. */\nexport function mergeRequestNumberFromBranch(branch: string): number | undefined {\n const match = /^factory\\/gitlab-mr-([1-9]\\d*)-[a-z0-9]{1,12}$/.exec(branch);\n const number = match ? Number(match[1]) : undefined;\n return number !== undefined && Number.isSafeInteger(number) ? number : undefined;\n}\n"],"mappings":";;AAyBA,SAAgB,qBAAqB,gBAAiF;CACpH,IAAI,CAAC,gBAAgB,OAAO;CAC5B,IAAI,eAAe,kBAAkB,UAAU,OAAO;CACtD,IAAI,eAAe,kBAAkB,UACnC,OAAO,eAAe,SAAS,iBAAiB,cAAc;CAEhE,IAAI,eAAe,kBAAkB,QAAQ,OAAO;CACpD,IAAI,eAAe,kBAAkB,cAAc,OAAO;CAG1D,IAAI,eAAe,kBAAkB,UAAU,OAAO;CACtD,OAAO,eAAe,SAAS,iBAAiB,cAAc;AAChE;AAEA,SAAS,aAAa,UAAmC,KAAiC;CACxF,MAAM,QAAQ,SAAS,QAAQ,SAAS;CACxC,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,QAAQ,IAAI,QAAQ,KAAA;AACrF;;AAGA,SAAgB,eAAe,MAA4E;CACzG,MAAM,WAAW,KAAK,YAAY,CAAC;CACnC,IAAI,KAAK,WAAW,gBAAgB,OAAO,aAAa,UAAU,mBAAmB;CACrF,IAAI,KAAK,WAAW,aAAa,OAAO,aAAa,UAAU,yBAAyB;CACxF,IAAI,KAAK,WAAW,gBAAgB,OAAO,aAAa,UAAU,gBAAgB;CAClF,IAAI,KAAK,WAAW,aAAa,OAAO,aAAa,UAAU,uBAAuB;AAExF;;AAGA,SAAgB,oBACd,MACQ;CACR,MAAM,SAAS,eAAe,IAAI;CAClC,IAAI,WAAW,KAAA,GAAW,OAAO,KAAK;CAEtC,OAAO,GADM,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QAAoC;CAE7E,OADc,oDAAoD,KAAK,MAC5D,CAAC,GAAG;AACjB;;;;;;AAOA,SAAgB,4BAA4B,QAAoC;CAC9E,MAAM,QAAQ,+CAA+C,KAAK,MAAM;CACxE,MAAM,SAAS,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAA;CAC1C,OAAO,WAAW,KAAA,KAAa,OAAO,cAAc,MAAM,IAAI,SAAS,KAAA;AACzE;;AAGA,SAAgB,6BAA6B,QAAoC;CAC/E,MAAM,QAAQ,iDAAiD,KAAK,MAAM;CAC1E,MAAM,SAAS,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAA;CAC1C,OAAO,WAAW,KAAA,KAAa,OAAO,cAAc,MAAM,IAAI,SAAS,KAAA;AACzE"}
|
package/dist/workspace.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export declare const BUNDLED_FACTORY_SKILLS_PATH: string;
|
|
|
14
14
|
* addition to the bundled skills so projects can add (or override) Factory
|
|
15
15
|
* skills without patching the installed package. Candidates cover the cwd
|
|
16
16
|
* variants the dev server runs with (`repo root`, `--dir src/mastra` which
|
|
17
|
-
* runs with cwd `src/mastra/public`)
|
|
17
|
+
* runs with cwd `src/mastra/public`), then the platform build output when
|
|
18
|
+
* the server runs from its parent directory.
|
|
18
19
|
*/
|
|
19
20
|
export declare function resolveLocalFactorySkillsPath(cwd?: string): string | undefined;
|
|
20
21
|
export declare const FACTORY_SKILL_NAMES: Set<string>;
|
package/dist/workspace.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAA2B,MAAM,mCAAmC,CAAC;AAItG,OAAO,EAAoB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EACV,cAAc,EAEd,WAAW,EACX,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
26
26
|
* addition to the bundled skills so projects can add (or override) Factory
|
|
27
27
|
* skills without patching the installed package. Candidates cover the cwd
|
|
28
28
|
* variants the dev server runs with (`repo root`, `--dir src/mastra` which
|
|
29
|
-
* runs with cwd `src/mastra/public`)
|
|
29
|
+
* runs with cwd `src/mastra/public`), then the platform build output when
|
|
30
|
+
* the server runs from its parent directory.
|
|
30
31
|
*/
|
|
31
32
|
function resolveLocalFactorySkillsPath(cwd = process.cwd()) {
|
|
32
33
|
return [
|
|
33
34
|
join(cwd, "src", "mastra", "public", "factory-skills"),
|
|
34
35
|
join(cwd, "public", "factory-skills"),
|
|
35
|
-
join(cwd, "factory-skills")
|
|
36
|
+
join(cwd, "factory-skills"),
|
|
37
|
+
join(cwd, "output", "factory-skills")
|
|
36
38
|
].find((candidate) => path.normalize(candidate) !== path.normalize(BUNDLED_FACTORY_SKILLS_PATH) && existsSync(candidate));
|
|
37
39
|
}
|
|
38
40
|
const FACTORY_SKILLS_MOUNT = path.resolve(path.parse(process.cwd()).root, "__mastracode_factory_skills__");
|