@treeseed/sdk 0.3.3 → 0.4.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 +3 -3
- 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 +5 -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,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;
|