@treeseed/core 0.3.2 → 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 +16 -2
- package/dist/config.js +1 -1
- package/dist/content-config.js +1 -1
- package/dist/content.js +3 -3
- package/dist/index.js +1 -68
- package/dist/scripts/aggregate-book.js +1 -1
- package/dist/scripts/build-dist.js +3 -14
- package/dist/scripts/build-tenant-worker.js +2 -2
- package/dist/scripts/run-fixture-astro-command.js +216 -13
- package/dist/site-resources.d.ts +2 -2
- package/dist/site.js +3 -3
- package/dist/tenant/bridge.js +1 -1
- package/dist/tenant/runtime-config.js +1 -1
- package/dist/utils/forms/config.js +5 -1
- package/dist/utils/forms/provider-runtime.js +42 -0
- package/dist/utils/forms/service.js +2 -2
- package/dist/utils/starlight-nav.js +6 -1
- package/package.json +21 -55
- package/dist/agents/index.js +0 -5
- package/dist/agents/registry-helper.js +0 -14
- package/dist/agents/registry.js +0 -88
- package/dist/contracts.d.ts +0 -1
- package/dist/contracts.js +0 -0
- package/dist/deploy/config.js +0 -10
- package/dist/deploy/runtime.js +0 -24
- package/dist/environment.d.ts +0 -2
- package/dist/environment.js +0 -26
- package/dist/plugin-default.js +0 -4
- package/dist/plugins/builtin/default-plugin.js +0 -37
- package/dist/plugins/constants.js +0 -10
- package/dist/plugins/plugin.d.ts +0 -2
- package/dist/plugins/plugin.js +0 -4
- package/dist/plugins/runtime.d.ts +0 -2
- package/dist/plugins/runtime.js +0 -10
- package/dist/tenant/config.js +0 -16
- package/dist/types/agents.d.ts +0 -1
- package/dist/types/agents.js +0 -1
- package/dist/utils/agents/adapters/execution.js +0 -90
- package/dist/utils/agents/adapters/mutations.js +0 -30
- package/dist/utils/agents/adapters/notification.js +0 -16
- package/dist/utils/agents/adapters/repository.js +0 -61
- package/dist/utils/agents/adapters/research.js +0 -25
- package/dist/utils/agents/adapters/verification.js +0 -62
- package/dist/utils/agents/cli-tools.js +0 -5
- package/dist/utils/agents/contracts/messages.d.ts +0 -1
- package/dist/utils/agents/contracts/messages.js +0 -1
- package/dist/utils/agents/contracts/run.d.ts +0 -1
- package/dist/utils/agents/contracts/run.js +0 -1
- package/dist/utils/agents/runtime-types.d.ts +0 -1
- package/dist/utils/agents/runtime-types.js +0 -1
- package/dist/utils/books-data.js +0 -14
- package/dist/utils/plugin-runtime.js +0 -158
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
import { promisify } from "node:util";
|
|
3
|
-
import { getTreeseedAgentProviderSelections } from "../../../deploy/runtime.js";
|
|
4
|
-
const execFileAsync = promisify(execFile);
|
|
5
|
-
class StubVerificationAdapter {
|
|
6
|
-
async runChecks(input) {
|
|
7
|
-
return {
|
|
8
|
-
status: "completed",
|
|
9
|
-
summary: input.commands.length ? `Stub verification completed for ${input.runId}.` : "No verification commands configured.",
|
|
10
|
-
stdout: input.commands.join("\n"),
|
|
11
|
-
stderr: ""
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
class LocalVerificationAdapter {
|
|
16
|
-
async runChecks(input) {
|
|
17
|
-
if (!input.commands.length) {
|
|
18
|
-
return {
|
|
19
|
-
status: "waiting",
|
|
20
|
-
summary: "No verification commands configured.",
|
|
21
|
-
stdout: "",
|
|
22
|
-
stderr: ""
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const stdoutChunks = [];
|
|
26
|
-
const stderrChunks = [];
|
|
27
|
-
for (const command of input.commands) {
|
|
28
|
-
try {
|
|
29
|
-
const { stdout, stderr } = await execFileAsync("/bin/bash", ["-lc", command], {
|
|
30
|
-
env: process.env,
|
|
31
|
-
maxBuffer: 10 * 1024 * 1024
|
|
32
|
-
});
|
|
33
|
-
stdoutChunks.push(stdout);
|
|
34
|
-
stderrChunks.push(stderr);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
return {
|
|
37
|
-
status: "failed",
|
|
38
|
-
summary: `Verification command failed: ${command}`,
|
|
39
|
-
stdout: stdoutChunks.join("\n"),
|
|
40
|
-
stderr: error && typeof error === "object" && "stderr" in error ? String(error.stderr ?? "") : String(error),
|
|
41
|
-
errorCategory: "execution_error"
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
status: "completed",
|
|
47
|
-
summary: `Verification completed for ${input.commands.length} command(s).`,
|
|
48
|
-
stdout: stdoutChunks.join("\n"),
|
|
49
|
-
stderr: stderrChunks.join("\n")
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function createVerificationAdapter() {
|
|
54
|
-
return String(
|
|
55
|
-
process.env.TREESEED_AGENT_VERIFICATION_PROVIDER ?? getTreeseedAgentProviderSelections().verification
|
|
56
|
-
).toLowerCase() !== "local" ? new StubVerificationAdapter() : new LocalVerificationAdapter();
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
LocalVerificationAdapter,
|
|
60
|
-
StubVerificationAdapter,
|
|
61
|
-
createVerificationAdapter
|
|
62
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@treeseed/sdk/utils/agents/contracts/messages';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@treeseed/sdk/utils/agents/contracts/messages";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@treeseed/sdk/utils/agents/contracts/run';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@treeseed/sdk/utils/agents/contracts/run";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@treeseed/sdk/utils/agents/runtime-types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@treeseed/sdk/utils/agents/runtime-types";
|
package/dist/utils/books-data.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BOOKS,
|
|
3
|
-
BOOKS_LINK,
|
|
4
|
-
TREESEED_LIBRARY_DOWNLOAD,
|
|
5
|
-
TREESEED_LINKS,
|
|
6
|
-
buildTenantBookRuntime
|
|
7
|
-
} from "@treeseed/sdk/platform/books-data";
|
|
8
|
-
export {
|
|
9
|
-
BOOKS,
|
|
10
|
-
BOOKS_LINK,
|
|
11
|
-
TREESEED_LIBRARY_DOWNLOAD,
|
|
12
|
-
TREESEED_LINKS,
|
|
13
|
-
buildTenantBookRuntime
|
|
14
|
-
};
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { loadTreeseedPluginRuntime } from "../plugins/runtime.js";
|
|
2
|
-
import { BUILTIN_FORMS_PROVIDERS, finalizeFormsProvider } from "./forms/provider-core.js";
|
|
3
|
-
import { StubExecutionAdapter, ManualExecutionAdapter, CopilotExecutionAdapter } from "./agents/adapters/execution.js";
|
|
4
|
-
import { LocalBranchMutationAdapter } from "./agents/adapters/mutations.js";
|
|
5
|
-
import { StubNotificationAdapter } from "./agents/adapters/notification.js";
|
|
6
|
-
import { GitRepositoryInspectionAdapter, StubRepositoryInspectionAdapter } from "./agents/adapters/repository.js";
|
|
7
|
-
import { StubResearchAdapter } from "./agents/adapters/research.js";
|
|
8
|
-
import { LocalVerificationAdapter, StubVerificationAdapter } from "./agents/adapters/verification.js";
|
|
9
|
-
let cachedAgentRuntime = null;
|
|
10
|
-
let cachedFormsRuntime = null;
|
|
11
|
-
function readPluginRecord(pluginEntry, key) {
|
|
12
|
-
const value = pluginEntry.plugin[key];
|
|
13
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
14
|
-
}
|
|
15
|
-
function assertUniqueProvider(registry, id, owner) {
|
|
16
|
-
if (registry.has(id)) {
|
|
17
|
-
throw new Error(`Treeseed plugin runtime found duplicate provider "${id}" from ${owner}.`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function resetTreeseedPluginRuntimeForTests() {
|
|
21
|
-
cachedAgentRuntime = null;
|
|
22
|
-
cachedFormsRuntime = null;
|
|
23
|
-
}
|
|
24
|
-
function resolveFormsProvider(providerId) {
|
|
25
|
-
if (!cachedFormsRuntime) {
|
|
26
|
-
const runtime = loadTreeseedPluginRuntime();
|
|
27
|
-
const providers = /* @__PURE__ */ new Map();
|
|
28
|
-
for (const provider2 of Object.values(BUILTIN_FORMS_PROVIDERS)) {
|
|
29
|
-
providers.set(provider2.id, provider2);
|
|
30
|
-
}
|
|
31
|
-
for (const pluginEntry of runtime.plugins) {
|
|
32
|
-
const contributedProviders = readPluginRecord(pluginEntry, "formsProviders");
|
|
33
|
-
for (const [id, provider2] of Object.entries(contributedProviders)) {
|
|
34
|
-
assertUniqueProvider(providers, id, pluginEntry.package);
|
|
35
|
-
providers.set(id, provider2);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
cachedFormsRuntime = { providers };
|
|
39
|
-
}
|
|
40
|
-
const provider = cachedFormsRuntime.providers.get(providerId);
|
|
41
|
-
if (!provider) {
|
|
42
|
-
throw new Error(`Treeseed forms provider "${providerId}" is not registered.`);
|
|
43
|
-
}
|
|
44
|
-
return finalizeFormsProvider(provider);
|
|
45
|
-
}
|
|
46
|
-
function collectAgentHandlersFromPlugin(pluginEntry, registry) {
|
|
47
|
-
const contributedHandlers = readPluginRecord(pluginEntry, "agentHandlers");
|
|
48
|
-
for (const [id, handler] of Object.entries(contributedHandlers)) {
|
|
49
|
-
assertUniqueProvider(registry, id, pluginEntry.package);
|
|
50
|
-
registry.set(id, handler);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function buildAgentRuntime() {
|
|
54
|
-
const runtime = loadTreeseedPluginRuntime();
|
|
55
|
-
const execution = /* @__PURE__ */ new Map([
|
|
56
|
-
["stub", () => new StubExecutionAdapter()],
|
|
57
|
-
["manual", () => new ManualExecutionAdapter()],
|
|
58
|
-
["copilot", () => new CopilotExecutionAdapter()]
|
|
59
|
-
]);
|
|
60
|
-
const mutation = /* @__PURE__ */ new Map([
|
|
61
|
-
["local_branch", (repoRoot) => new LocalBranchMutationAdapter(repoRoot)]
|
|
62
|
-
]);
|
|
63
|
-
const repository = /* @__PURE__ */ new Map([
|
|
64
|
-
["stub", () => new StubRepositoryInspectionAdapter()],
|
|
65
|
-
["git", () => new GitRepositoryInspectionAdapter()]
|
|
66
|
-
]);
|
|
67
|
-
const verification = /* @__PURE__ */ new Map([
|
|
68
|
-
["stub", () => new StubVerificationAdapter()],
|
|
69
|
-
["local", () => new LocalVerificationAdapter()]
|
|
70
|
-
]);
|
|
71
|
-
const notification = /* @__PURE__ */ new Map([
|
|
72
|
-
["stub", () => new StubNotificationAdapter()]
|
|
73
|
-
]);
|
|
74
|
-
const research = /* @__PURE__ */ new Map([
|
|
75
|
-
["stub", () => new StubResearchAdapter()]
|
|
76
|
-
]);
|
|
77
|
-
const handlers = /* @__PURE__ */ new Map();
|
|
78
|
-
for (const pluginEntry of runtime.plugins) {
|
|
79
|
-
const agentProviders = readPluginRecord(pluginEntry, "agentProviders");
|
|
80
|
-
for (const [id, factory] of Object.entries(agentProviders.execution ?? {})) {
|
|
81
|
-
assertUniqueProvider(execution, id, pluginEntry.package);
|
|
82
|
-
execution.set(id, factory);
|
|
83
|
-
}
|
|
84
|
-
for (const [id, factory] of Object.entries(
|
|
85
|
-
agentProviders.mutation ?? {}
|
|
86
|
-
)) {
|
|
87
|
-
assertUniqueProvider(mutation, id, pluginEntry.package);
|
|
88
|
-
mutation.set(id, factory);
|
|
89
|
-
}
|
|
90
|
-
for (const [id, factory] of Object.entries(
|
|
91
|
-
agentProviders.repository ?? {}
|
|
92
|
-
)) {
|
|
93
|
-
assertUniqueProvider(repository, id, pluginEntry.package);
|
|
94
|
-
repository.set(id, factory);
|
|
95
|
-
}
|
|
96
|
-
for (const [id, factory] of Object.entries(
|
|
97
|
-
agentProviders.verification ?? {}
|
|
98
|
-
)) {
|
|
99
|
-
assertUniqueProvider(verification, id, pluginEntry.package);
|
|
100
|
-
verification.set(id, factory);
|
|
101
|
-
}
|
|
102
|
-
for (const [id, factory] of Object.entries(
|
|
103
|
-
agentProviders.notification ?? {}
|
|
104
|
-
)) {
|
|
105
|
-
assertUniqueProvider(notification, id, pluginEntry.package);
|
|
106
|
-
notification.set(id, factory);
|
|
107
|
-
}
|
|
108
|
-
for (const [id, factory] of Object.entries(
|
|
109
|
-
agentProviders.research ?? {}
|
|
110
|
-
)) {
|
|
111
|
-
assertUniqueProvider(research, id, pluginEntry.package);
|
|
112
|
-
research.set(id, factory);
|
|
113
|
-
}
|
|
114
|
-
collectAgentHandlersFromPlugin(pluginEntry, handlers);
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
providers: {
|
|
118
|
-
execution,
|
|
119
|
-
mutation,
|
|
120
|
-
repository,
|
|
121
|
-
verification,
|
|
122
|
-
notification,
|
|
123
|
-
research
|
|
124
|
-
},
|
|
125
|
-
handlers
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
function resolveAgentRuntimeProviders(repoRoot, selections) {
|
|
129
|
-
if (!cachedAgentRuntime) {
|
|
130
|
-
cachedAgentRuntime = buildAgentRuntime();
|
|
131
|
-
}
|
|
132
|
-
const executionFactory = cachedAgentRuntime.providers.execution.get(selections.execution);
|
|
133
|
-
const mutationFactory = cachedAgentRuntime.providers.mutation.get(selections.mutation);
|
|
134
|
-
const repositoryFactory = cachedAgentRuntime.providers.repository.get(selections.repository);
|
|
135
|
-
const verificationFactory = cachedAgentRuntime.providers.verification.get(selections.verification);
|
|
136
|
-
const notificationFactory = cachedAgentRuntime.providers.notification.get(selections.notification);
|
|
137
|
-
const researchFactory = cachedAgentRuntime.providers.research.get(selections.research);
|
|
138
|
-
if (!executionFactory) throw new Error(`Treeseed agent execution provider "${selections.execution}" is not registered.`);
|
|
139
|
-
if (!mutationFactory) throw new Error(`Treeseed agent mutation provider "${selections.mutation}" is not registered.`);
|
|
140
|
-
if (!repositoryFactory) throw new Error(`Treeseed agent repository provider "${selections.repository}" is not registered.`);
|
|
141
|
-
if (!verificationFactory) throw new Error(`Treeseed agent verification provider "${selections.verification}" is not registered.`);
|
|
142
|
-
if (!notificationFactory) throw new Error(`Treeseed agent notification provider "${selections.notification}" is not registered.`);
|
|
143
|
-
if (!researchFactory) throw new Error(`Treeseed agent research provider "${selections.research}" is not registered.`);
|
|
144
|
-
return {
|
|
145
|
-
execution: executionFactory(),
|
|
146
|
-
mutations: mutationFactory(repoRoot),
|
|
147
|
-
repository: repositoryFactory(),
|
|
148
|
-
verification: verificationFactory(),
|
|
149
|
-
notifications: notificationFactory(),
|
|
150
|
-
research: researchFactory(),
|
|
151
|
-
handlers: cachedAgentRuntime.handlers
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
export {
|
|
155
|
-
resetTreeseedPluginRuntimeForTests,
|
|
156
|
-
resolveAgentRuntimeProviders,
|
|
157
|
-
resolveFormsProvider
|
|
158
|
-
};
|