@treeseed/sdk 0.3.4 → 0.4.1
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 +22 -3
- package/dist/fixture-support.d.ts +24 -0
- package/dist/fixture-support.js +337 -0
- package/dist/index.d.ts +1 -7
- package/dist/index.js +0 -6
- package/dist/operations/runtime.js +1 -1
- package/dist/operations/services/config-runtime.d.ts +5 -5
- package/dist/operations/services/config-runtime.js +1 -1
- package/dist/operations/services/deploy.js +1 -1
- package/dist/operations/services/runtime-paths.d.ts +1 -0
- package/dist/operations/services/runtime-paths.js +3 -1
- package/dist/operations/services/runtime-tools.js +1 -1
- package/dist/operations/services/template-registry.d.ts +3 -3
- package/dist/operations/services/template-registry.js +5 -4
- package/dist/platform/books-data.d.ts +29 -1
- package/dist/platform/books-data.js +82 -1
- package/dist/platform/deploy-config.d.ts +4 -1
- package/dist/platform/deploy-config.js +222 -1
- package/dist/platform/deploy-runtime.js +1 -1
- package/dist/platform/environment.d.ts +1 -1
- package/dist/platform/environment.js +3 -3
- package/dist/platform/plugin.d.ts +51 -2
- package/dist/platform/plugin.js +3 -1
- package/dist/platform/plugins/constants.d.ts +1 -1
- package/dist/platform/plugins/constants.js +1 -1
- package/dist/platform/plugins/runtime.d.ts +1 -1
- package/dist/platform/plugins/runtime.js +5 -5
- package/dist/platform/plugins.d.ts +2 -2
- package/dist/platform/plugins.js +1 -1
- package/dist/platform/tenant/runtime-config.js +1 -1
- package/dist/platform/tenant-config.d.ts +7 -1
- package/dist/platform/tenant-config.js +153 -1
- package/dist/plugin-default.d.ts +25 -0
- package/dist/plugin-default.js +37 -0
- package/dist/scripts/aggregate-book.js +1 -1
- package/dist/scripts/build-tenant-worker.js +2 -2
- package/dist/scripts/tenant-destroy.js +1 -1
- package/dist/scripts/tenant-dev.js +1 -1
- package/dist/treeseed/template-catalog/templates/starter-basic/template/package.json +1 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +1 -1
- package/dist/treeseed/template-catalog/templates/starter-basic/template.config.json +6 -0
- package/package.json +9 -25
- package/dist/platform/deploy/config.d.ts +0 -4
- package/dist/platform/deploy/config.js +0 -222
- package/dist/platform/plugins/plugin.d.ts +0 -51
- package/dist/platform/plugins/plugin.js +0 -6
- package/dist/platform/tenant/config.d.ts +0 -9
- package/dist/platform/tenant/config.js +0 -154
- package/dist/platform/utils/books-data.d.ts +0 -29
- package/dist/platform/utils/books-data.js +0 -82
- package/dist/utils/agents/contracts/messages.d.ts +0 -88
- package/dist/utils/agents/contracts/messages.js +0 -139
- package/dist/utils/agents/contracts/run.d.ts +0 -20
- package/dist/utils/agents/contracts/run.js +0 -0
- package/dist/utils/agents/runtime-types.d.ts +0 -117
- package/dist/utils/agents/runtime-types.js +0 -4
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { TreeseedBookDefinition, TreeseedTenantConfig } from '../contracts.ts';
|
|
2
|
-
interface DocsLibraryDownload {
|
|
3
|
-
downloadFileName: string;
|
|
4
|
-
downloadHref: string;
|
|
5
|
-
downloadTitle: string;
|
|
6
|
-
}
|
|
7
|
-
interface TenantBookRuntime {
|
|
8
|
-
BOOKS: TreeseedBookDefinition[];
|
|
9
|
-
BOOKS_LINK: {
|
|
10
|
-
label: string;
|
|
11
|
-
link: string;
|
|
12
|
-
};
|
|
13
|
-
TREESEED_LINKS: {
|
|
14
|
-
home: string;
|
|
15
|
-
};
|
|
16
|
-
TREESEED_LIBRARY_DOWNLOAD: DocsLibraryDownload;
|
|
17
|
-
}
|
|
18
|
-
export declare function buildTenantBookRuntime(tenantConfig: Pick<TreeseedTenantConfig, 'content'>, options?: {
|
|
19
|
-
projectRoot?: string;
|
|
20
|
-
docsHomePath?: string;
|
|
21
|
-
docsLibraryDownload?: DocsLibraryDownload;
|
|
22
|
-
}): TenantBookRuntime;
|
|
23
|
-
export declare const BOOKS: TreeseedBookDefinition[], BOOKS_LINK: {
|
|
24
|
-
label: string;
|
|
25
|
-
link: string;
|
|
26
|
-
}, TREESEED_LINKS: {
|
|
27
|
-
home: string;
|
|
28
|
-
}, TREESEED_LIBRARY_DOWNLOAD: DocsLibraryDownload;
|
|
29
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { parse as parseYaml } from "yaml";
|
|
4
|
-
import { getTenantContentRoot } from "../tenant/config.js";
|
|
5
|
-
import { RUNTIME_PROJECT_ROOT, RUNTIME_TENANT } from "../tenant/runtime-config.js";
|
|
6
|
-
function sortPaths(paths) {
|
|
7
|
-
return [...paths].sort((left, right) => left.localeCompare(right, void 0, { numeric: true, sensitivity: "base" }));
|
|
8
|
-
}
|
|
9
|
-
function collectMarkdownFiles(rootPath) {
|
|
10
|
-
const stats = statSync(rootPath);
|
|
11
|
-
if (stats.isFile()) {
|
|
12
|
-
return [rootPath];
|
|
13
|
-
}
|
|
14
|
-
return sortPaths(
|
|
15
|
-
readdirSync(rootPath, { withFileTypes: true }).flatMap((entry) => {
|
|
16
|
-
const fullPath = path.join(rootPath, entry.name);
|
|
17
|
-
if (entry.isDirectory()) {
|
|
18
|
-
return collectMarkdownFiles(fullPath);
|
|
19
|
-
}
|
|
20
|
-
if (entry.isFile() && (entry.name.endsWith(".md") || entry.name.endsWith(".mdx"))) {
|
|
21
|
-
return [fullPath];
|
|
22
|
-
}
|
|
23
|
-
return [];
|
|
24
|
-
})
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
function parseFrontmatter(filePath) {
|
|
28
|
-
const raw = readFileSync(filePath, "utf8");
|
|
29
|
-
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
30
|
-
if (!match) {
|
|
31
|
-
throw new Error(`Book content entry is missing frontmatter: ${filePath}`);
|
|
32
|
-
}
|
|
33
|
-
return parseYaml(match[1]);
|
|
34
|
-
}
|
|
35
|
-
function inferDocsLibraryDownload(book) {
|
|
36
|
-
const title = book?.title ? `${book.title} Library` : "Knowledge Library";
|
|
37
|
-
return {
|
|
38
|
-
downloadFileName: "treeseed-knowledge.md",
|
|
39
|
-
downloadHref: "/books/treeseed-knowledge.md",
|
|
40
|
-
downloadTitle: title
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function buildTenantBookRuntime(tenantConfig, options = {}) {
|
|
44
|
-
const projectRoot = options.projectRoot ?? process.cwd();
|
|
45
|
-
const booksContentRoot = path.resolve(projectRoot, getTenantContentRoot(tenantConfig, "books"));
|
|
46
|
-
const books = collectMarkdownFiles(booksContentRoot).map((filePath) => {
|
|
47
|
-
const frontmatter = parseFrontmatter(filePath);
|
|
48
|
-
return {
|
|
49
|
-
...frontmatter,
|
|
50
|
-
id: path.basename(filePath, path.extname(filePath))
|
|
51
|
-
};
|
|
52
|
-
}).sort((left, right) => left.order - right.order);
|
|
53
|
-
const docsHomePath = options.docsHomePath ?? "/knowledge/";
|
|
54
|
-
const docsLibraryDownload = options.docsLibraryDownload ?? inferDocsLibraryDownload(tenantConfig);
|
|
55
|
-
return {
|
|
56
|
-
BOOKS: books,
|
|
57
|
-
BOOKS_LINK: {
|
|
58
|
-
label: "Books",
|
|
59
|
-
link: docsHomePath
|
|
60
|
-
},
|
|
61
|
-
TREESEED_LINKS: {
|
|
62
|
-
home: docsHomePath
|
|
63
|
-
},
|
|
64
|
-
TREESEED_LIBRARY_DOWNLOAD: docsLibraryDownload
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const runtime = buildTenantBookRuntime(RUNTIME_TENANT, {
|
|
68
|
-
projectRoot: RUNTIME_PROJECT_ROOT,
|
|
69
|
-
docsLibraryDownload: {
|
|
70
|
-
downloadFileName: "treeseed-knowledge.md",
|
|
71
|
-
downloadHref: "/books/treeseed-knowledge.md",
|
|
72
|
-
downloadTitle: "TreeSeed Knowledge Library"
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
const { BOOKS, BOOKS_LINK, TREESEED_LINKS, TREESEED_LIBRARY_DOWNLOAD } = runtime;
|
|
76
|
-
export {
|
|
77
|
-
BOOKS,
|
|
78
|
-
BOOKS_LINK,
|
|
79
|
-
TREESEED_LIBRARY_DOWNLOAD,
|
|
80
|
-
TREESEED_LINKS,
|
|
81
|
-
buildTenantBookRuntime
|
|
82
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export interface QuestionPriorityUpdatedMessage {
|
|
2
|
-
questionId: string;
|
|
3
|
-
reason: string;
|
|
4
|
-
plannerRunId: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ObjectivePriorityUpdatedMessage {
|
|
7
|
-
objectiveId: string;
|
|
8
|
-
reason: string;
|
|
9
|
-
plannerRunId: string;
|
|
10
|
-
}
|
|
11
|
-
export interface ArchitectureUpdatedMessage {
|
|
12
|
-
objectiveId: string;
|
|
13
|
-
knowledgeId: string;
|
|
14
|
-
architectRunId: string;
|
|
15
|
-
}
|
|
16
|
-
export interface SubscriberNotifiedMessage {
|
|
17
|
-
email: string;
|
|
18
|
-
itemCount: number;
|
|
19
|
-
notifierRunId: string;
|
|
20
|
-
}
|
|
21
|
-
export interface ResearchStartedMessage {
|
|
22
|
-
questionId: string;
|
|
23
|
-
researcherRunId: string;
|
|
24
|
-
}
|
|
25
|
-
export interface ResearchCompletedMessage {
|
|
26
|
-
questionId: string;
|
|
27
|
-
knowledgeId: string | null;
|
|
28
|
-
researcherRunId: string;
|
|
29
|
-
}
|
|
30
|
-
export interface TaskCompleteMessage {
|
|
31
|
-
branchName: string | null;
|
|
32
|
-
changedTargets: string[];
|
|
33
|
-
engineerRunId: string;
|
|
34
|
-
}
|
|
35
|
-
export interface TaskWaitingMessage {
|
|
36
|
-
blockingReason: string;
|
|
37
|
-
engineerRunId: string;
|
|
38
|
-
}
|
|
39
|
-
export interface TaskFailedMessage {
|
|
40
|
-
failureSummary: string;
|
|
41
|
-
engineerRunId: string;
|
|
42
|
-
}
|
|
43
|
-
export interface TaskVerifiedMessage {
|
|
44
|
-
branchName: string | null;
|
|
45
|
-
reviewerRunId: string;
|
|
46
|
-
}
|
|
47
|
-
export interface ReviewFailedMessage {
|
|
48
|
-
failureSummary: string;
|
|
49
|
-
reviewerRunId: string;
|
|
50
|
-
}
|
|
51
|
-
export interface ReviewWaitingMessage {
|
|
52
|
-
blockingReason: string;
|
|
53
|
-
reviewerRunId: string;
|
|
54
|
-
}
|
|
55
|
-
export interface ReleaseStartedMessage {
|
|
56
|
-
taskRunId: string | null;
|
|
57
|
-
releaserRunId: string;
|
|
58
|
-
}
|
|
59
|
-
export interface ReleaseCompletedMessage {
|
|
60
|
-
releaseSummary: string;
|
|
61
|
-
releaserRunId: string;
|
|
62
|
-
}
|
|
63
|
-
export interface ReleaseFailedMessage {
|
|
64
|
-
failureSummary: string;
|
|
65
|
-
releaserRunId: string;
|
|
66
|
-
}
|
|
67
|
-
export interface AgentMessageContracts {
|
|
68
|
-
question_priority_updated: QuestionPriorityUpdatedMessage;
|
|
69
|
-
objective_priority_updated: ObjectivePriorityUpdatedMessage;
|
|
70
|
-
architecture_updated: ArchitectureUpdatedMessage;
|
|
71
|
-
subscriber_notified: SubscriberNotifiedMessage;
|
|
72
|
-
research_started: ResearchStartedMessage;
|
|
73
|
-
research_completed: ResearchCompletedMessage;
|
|
74
|
-
task_complete: TaskCompleteMessage;
|
|
75
|
-
task_waiting: TaskWaitingMessage;
|
|
76
|
-
task_failed: TaskFailedMessage;
|
|
77
|
-
task_verified: TaskVerifiedMessage;
|
|
78
|
-
review_failed: ReviewFailedMessage;
|
|
79
|
-
review_waiting: ReviewWaitingMessage;
|
|
80
|
-
release_started: ReleaseStartedMessage;
|
|
81
|
-
release_completed: ReleaseCompletedMessage;
|
|
82
|
-
release_failed: ReleaseFailedMessage;
|
|
83
|
-
}
|
|
84
|
-
export type AgentMessageType = keyof AgentMessageContracts;
|
|
85
|
-
export type AgentMessagePayload<TType extends AgentMessageType> = AgentMessageContracts[TType];
|
|
86
|
-
export declare const AGENT_MESSAGE_TYPES: readonly ["question_priority_updated", "objective_priority_updated", "architecture_updated", "subscriber_notified", "research_started", "research_completed", "task_complete", "task_waiting", "task_failed", "task_verified", "review_failed", "review_waiting", "release_started", "release_completed", "release_failed"];
|
|
87
|
-
export declare function parseAgentMessagePayload<TType extends AgentMessageType>(type: TType, payloadJson: string): AgentMessagePayload<TType>;
|
|
88
|
-
export declare function serializeAgentMessagePayload<TType extends AgentMessageType>(type: TType, payload: AgentMessagePayload<TType>): string;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
const AGENT_MESSAGE_TYPES = [
|
|
2
|
-
"question_priority_updated",
|
|
3
|
-
"objective_priority_updated",
|
|
4
|
-
"architecture_updated",
|
|
5
|
-
"subscriber_notified",
|
|
6
|
-
"research_started",
|
|
7
|
-
"research_completed",
|
|
8
|
-
"task_complete",
|
|
9
|
-
"task_waiting",
|
|
10
|
-
"task_failed",
|
|
11
|
-
"task_verified",
|
|
12
|
-
"review_failed",
|
|
13
|
-
"review_waiting",
|
|
14
|
-
"release_started",
|
|
15
|
-
"release_completed",
|
|
16
|
-
"release_failed"
|
|
17
|
-
];
|
|
18
|
-
function ensureString(value, label) {
|
|
19
|
-
if (typeof value !== "string" || value.trim().length === 0) {
|
|
20
|
-
throw new Error(`Invalid ${label}: expected non-empty string.`);
|
|
21
|
-
}
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
function ensureOptionalString(value, label) {
|
|
25
|
-
if (value === null || value === void 0) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return ensureString(value, label);
|
|
29
|
-
}
|
|
30
|
-
function ensureStringArray(value, label) {
|
|
31
|
-
if (!Array.isArray(value)) {
|
|
32
|
-
throw new Error(`Invalid ${label}: expected array.`);
|
|
33
|
-
}
|
|
34
|
-
return value.map((entry, index) => ensureString(entry, `${label}[${index}]`));
|
|
35
|
-
}
|
|
36
|
-
function ensureNumber(value, label) {
|
|
37
|
-
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
38
|
-
throw new Error(`Invalid ${label}: expected number.`);
|
|
39
|
-
}
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
function parseAgentMessagePayload(type, payloadJson) {
|
|
43
|
-
const decoded = JSON.parse(payloadJson);
|
|
44
|
-
const parsed = typeof decoded === "string" ? JSON.parse(decoded) : decoded;
|
|
45
|
-
switch (type) {
|
|
46
|
-
case "question_priority_updated":
|
|
47
|
-
return {
|
|
48
|
-
questionId: ensureString(parsed.questionId, "questionId"),
|
|
49
|
-
reason: ensureString(parsed.reason, "reason"),
|
|
50
|
-
plannerRunId: ensureString(parsed.plannerRunId, "plannerRunId")
|
|
51
|
-
};
|
|
52
|
-
case "objective_priority_updated":
|
|
53
|
-
return {
|
|
54
|
-
objectiveId: ensureString(parsed.objectiveId, "objectiveId"),
|
|
55
|
-
reason: ensureString(parsed.reason, "reason"),
|
|
56
|
-
plannerRunId: ensureString(parsed.plannerRunId, "plannerRunId")
|
|
57
|
-
};
|
|
58
|
-
case "architecture_updated":
|
|
59
|
-
return {
|
|
60
|
-
objectiveId: ensureString(parsed.objectiveId, "objectiveId"),
|
|
61
|
-
knowledgeId: ensureString(parsed.knowledgeId, "knowledgeId"),
|
|
62
|
-
architectRunId: ensureString(parsed.architectRunId, "architectRunId")
|
|
63
|
-
};
|
|
64
|
-
case "subscriber_notified":
|
|
65
|
-
return {
|
|
66
|
-
email: ensureString(parsed.email, "email"),
|
|
67
|
-
itemCount: ensureNumber(parsed.itemCount, "itemCount"),
|
|
68
|
-
notifierRunId: ensureString(parsed.notifierRunId, "notifierRunId")
|
|
69
|
-
};
|
|
70
|
-
case "research_started":
|
|
71
|
-
return {
|
|
72
|
-
questionId: ensureString(parsed.questionId, "questionId"),
|
|
73
|
-
researcherRunId: ensureString(parsed.researcherRunId, "researcherRunId")
|
|
74
|
-
};
|
|
75
|
-
case "research_completed":
|
|
76
|
-
return {
|
|
77
|
-
questionId: ensureString(parsed.questionId, "questionId"),
|
|
78
|
-
knowledgeId: ensureOptionalString(parsed.knowledgeId, "knowledgeId"),
|
|
79
|
-
researcherRunId: ensureString(parsed.researcherRunId, "researcherRunId")
|
|
80
|
-
};
|
|
81
|
-
case "task_complete":
|
|
82
|
-
return {
|
|
83
|
-
branchName: ensureOptionalString(parsed.branchName, "branchName"),
|
|
84
|
-
changedTargets: ensureStringArray(parsed.changedTargets, "changedTargets"),
|
|
85
|
-
engineerRunId: ensureString(parsed.engineerRunId, "engineerRunId")
|
|
86
|
-
};
|
|
87
|
-
case "task_waiting":
|
|
88
|
-
return {
|
|
89
|
-
blockingReason: ensureString(parsed.blockingReason, "blockingReason"),
|
|
90
|
-
engineerRunId: ensureString(parsed.engineerRunId, "engineerRunId")
|
|
91
|
-
};
|
|
92
|
-
case "task_failed":
|
|
93
|
-
return {
|
|
94
|
-
failureSummary: ensureString(parsed.failureSummary, "failureSummary"),
|
|
95
|
-
engineerRunId: ensureString(parsed.engineerRunId, "engineerRunId")
|
|
96
|
-
};
|
|
97
|
-
case "task_verified":
|
|
98
|
-
return {
|
|
99
|
-
branchName: ensureOptionalString(parsed.branchName, "branchName"),
|
|
100
|
-
reviewerRunId: ensureString(parsed.reviewerRunId, "reviewerRunId")
|
|
101
|
-
};
|
|
102
|
-
case "review_failed":
|
|
103
|
-
return {
|
|
104
|
-
failureSummary: ensureString(parsed.failureSummary, "failureSummary"),
|
|
105
|
-
reviewerRunId: ensureString(parsed.reviewerRunId, "reviewerRunId")
|
|
106
|
-
};
|
|
107
|
-
case "review_waiting":
|
|
108
|
-
return {
|
|
109
|
-
blockingReason: ensureString(parsed.blockingReason, "blockingReason"),
|
|
110
|
-
reviewerRunId: ensureString(parsed.reviewerRunId, "reviewerRunId")
|
|
111
|
-
};
|
|
112
|
-
case "release_started":
|
|
113
|
-
return {
|
|
114
|
-
taskRunId: ensureOptionalString(parsed.taskRunId, "taskRunId"),
|
|
115
|
-
releaserRunId: ensureString(parsed.releaserRunId, "releaserRunId")
|
|
116
|
-
};
|
|
117
|
-
case "release_completed":
|
|
118
|
-
return {
|
|
119
|
-
releaseSummary: ensureString(parsed.releaseSummary, "releaseSummary"),
|
|
120
|
-
releaserRunId: ensureString(parsed.releaserRunId, "releaserRunId")
|
|
121
|
-
};
|
|
122
|
-
case "release_failed":
|
|
123
|
-
return {
|
|
124
|
-
failureSummary: ensureString(parsed.failureSummary, "failureSummary"),
|
|
125
|
-
releaserRunId: ensureString(parsed.releaserRunId, "releaserRunId")
|
|
126
|
-
};
|
|
127
|
-
default:
|
|
128
|
-
throw new Error(`Unknown agent message type "${String(type)}".`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function serializeAgentMessagePayload(type, payload) {
|
|
132
|
-
parseAgentMessagePayload(type, JSON.stringify(payload));
|
|
133
|
-
return JSON.stringify(payload);
|
|
134
|
-
}
|
|
135
|
-
export {
|
|
136
|
-
AGENT_MESSAGE_TYPES,
|
|
137
|
-
parseAgentMessagePayload,
|
|
138
|
-
serializeAgentMessagePayload
|
|
139
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type AgentErrorCategory = 'trigger_resolution_error' | 'permission_error' | 'message_claim_error' | 'lease_error' | 'execution_error' | 'mutation_error' | 'sdk_error';
|
|
2
|
-
export interface AgentRunTrace {
|
|
3
|
-
[key: string]: unknown;
|
|
4
|
-
runId: string;
|
|
5
|
-
agentSlug: string;
|
|
6
|
-
handlerKind: string;
|
|
7
|
-
triggerKind: string;
|
|
8
|
-
triggerSource: string;
|
|
9
|
-
claimedMessageId: number | null;
|
|
10
|
-
selectedItemKey: string | null;
|
|
11
|
-
branchName: string | null;
|
|
12
|
-
commitSha: string | null;
|
|
13
|
-
changedPaths: string[];
|
|
14
|
-
summary: string | null;
|
|
15
|
-
error: string | null;
|
|
16
|
-
errorCategory: AgentErrorCategory | null;
|
|
17
|
-
startedAt: string;
|
|
18
|
-
finishedAt: string | null;
|
|
19
|
-
status: string;
|
|
20
|
-
}
|
|
File without changes
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import type { AgentHandlerKind, AgentRuntimeSpec, AgentRunStatus, AgentTriggerConfig } from '../../types/agents.ts';
|
|
2
|
-
import type { AgentErrorCategory } from './contracts/run.ts';
|
|
3
|
-
import type { ScopedAgentSdk, SdkMessageEntity } from '../../sdk.ts';
|
|
4
|
-
export interface AgentTriggerInvocation {
|
|
5
|
-
kind: 'startup' | 'schedule' | 'message' | 'manual' | 'follow';
|
|
6
|
-
source: string;
|
|
7
|
-
trigger: AgentTriggerConfig;
|
|
8
|
-
message?: SdkMessageEntity | null;
|
|
9
|
-
followModels?: string[];
|
|
10
|
-
cursorValue?: string | null;
|
|
11
|
-
}
|
|
12
|
-
export interface AgentExecutionResult {
|
|
13
|
-
status: AgentRunStatus;
|
|
14
|
-
summary: string;
|
|
15
|
-
stdout?: string;
|
|
16
|
-
stderr?: string;
|
|
17
|
-
errorCategory?: AgentErrorCategory | null;
|
|
18
|
-
metadata?: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
export interface AgentMutationResult {
|
|
21
|
-
branchName: string | null;
|
|
22
|
-
commitMessage: string | null;
|
|
23
|
-
worktreePath: string | null;
|
|
24
|
-
commitSha: string | null;
|
|
25
|
-
changedPaths: string[];
|
|
26
|
-
}
|
|
27
|
-
export interface AgentRepositoryInspectionResult {
|
|
28
|
-
branchName: string | null;
|
|
29
|
-
changedPaths: string[];
|
|
30
|
-
commitSha: string | null;
|
|
31
|
-
summary: string;
|
|
32
|
-
}
|
|
33
|
-
export interface AgentVerificationResult {
|
|
34
|
-
status: 'completed' | 'failed' | 'waiting';
|
|
35
|
-
summary: string;
|
|
36
|
-
stdout?: string;
|
|
37
|
-
stderr?: string;
|
|
38
|
-
errorCategory?: AgentErrorCategory | null;
|
|
39
|
-
}
|
|
40
|
-
export interface AgentNotificationResult {
|
|
41
|
-
status: 'completed' | 'failed' | 'waiting';
|
|
42
|
-
summary: string;
|
|
43
|
-
deliveredCount: number;
|
|
44
|
-
}
|
|
45
|
-
export interface AgentResearchResult {
|
|
46
|
-
status: 'completed' | 'failed' | 'waiting';
|
|
47
|
-
summary: string;
|
|
48
|
-
markdown: string;
|
|
49
|
-
sources?: string[];
|
|
50
|
-
errorCategory?: AgentErrorCategory | null;
|
|
51
|
-
}
|
|
52
|
-
export interface AgentExecutionAdapter {
|
|
53
|
-
runTask(input: {
|
|
54
|
-
agent: AgentRuntimeSpec;
|
|
55
|
-
runId: string;
|
|
56
|
-
prompt: string;
|
|
57
|
-
}): Promise<AgentExecutionResult>;
|
|
58
|
-
}
|
|
59
|
-
export interface AgentMutationAdapter {
|
|
60
|
-
writeArtifact(input: {
|
|
61
|
-
runId: string;
|
|
62
|
-
agent: AgentRuntimeSpec;
|
|
63
|
-
relativePath: string;
|
|
64
|
-
content: string;
|
|
65
|
-
commitMessage: string;
|
|
66
|
-
}): Promise<AgentMutationResult>;
|
|
67
|
-
}
|
|
68
|
-
export interface AgentRepositoryInspectionAdapter {
|
|
69
|
-
inspectBranch(input: {
|
|
70
|
-
repoRoot: string;
|
|
71
|
-
branchName: string | null;
|
|
72
|
-
}): Promise<AgentRepositoryInspectionResult>;
|
|
73
|
-
}
|
|
74
|
-
export interface AgentVerificationAdapter {
|
|
75
|
-
runChecks(input: {
|
|
76
|
-
agent: AgentRuntimeSpec;
|
|
77
|
-
runId: string;
|
|
78
|
-
commands: string[];
|
|
79
|
-
}): Promise<AgentVerificationResult>;
|
|
80
|
-
}
|
|
81
|
-
export interface AgentNotificationAdapter {
|
|
82
|
-
deliver(input: {
|
|
83
|
-
agent: AgentRuntimeSpec;
|
|
84
|
-
runId: string;
|
|
85
|
-
recipients: string[];
|
|
86
|
-
subject: string;
|
|
87
|
-
body: string;
|
|
88
|
-
}): Promise<AgentNotificationResult>;
|
|
89
|
-
}
|
|
90
|
-
export interface AgentResearchAdapter {
|
|
91
|
-
research(input: {
|
|
92
|
-
agent: AgentRuntimeSpec;
|
|
93
|
-
runId: string;
|
|
94
|
-
questionId: string;
|
|
95
|
-
reason: string | null;
|
|
96
|
-
}): Promise<AgentResearchResult>;
|
|
97
|
-
}
|
|
98
|
-
export interface AgentContext {
|
|
99
|
-
runId: string;
|
|
100
|
-
repoRoot: string;
|
|
101
|
-
agent: AgentRuntimeSpec;
|
|
102
|
-
sdk: ScopedAgentSdk;
|
|
103
|
-
trigger: AgentTriggerInvocation;
|
|
104
|
-
execution: AgentExecutionAdapter;
|
|
105
|
-
mutations: AgentMutationAdapter;
|
|
106
|
-
repository: AgentRepositoryInspectionAdapter;
|
|
107
|
-
verification: AgentVerificationAdapter;
|
|
108
|
-
notifications: AgentNotificationAdapter;
|
|
109
|
-
research: AgentResearchAdapter;
|
|
110
|
-
}
|
|
111
|
-
export interface AgentHandler<TInputs = unknown, TResult = unknown> {
|
|
112
|
-
kind: AgentHandlerKind;
|
|
113
|
-
resolveInputs(context: AgentContext): Promise<TInputs>;
|
|
114
|
-
execute(context: AgentContext, inputs: TInputs): Promise<TResult>;
|
|
115
|
-
emitOutputs(context: AgentContext, result: TResult): Promise<AgentExecutionResult>;
|
|
116
|
-
}
|
|
117
|
-
export declare const TRESEED_AGENT_RUNTIME_TYPES_MODULE = true;
|