@treeseed/core 0.3.0 → 0.3.2
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 +10 -1
- package/dist/deploy/runtime.js +11 -68
- package/dist/plugins/runtime.d.ts +2 -32
- package/dist/plugins/runtime.js +7 -135
- package/dist/scripts/run-fixture-astro-command.js +16 -0
- package/dist/utils/agents/contracts/messages.d.ts +1 -88
- package/dist/utils/agents/contracts/messages.js +1 -138
- package/dist/utils/agents/contracts/run.d.ts +1 -20
- package/dist/utils/agents/contracts/run.js +1 -0
- package/dist/utils/agents/runtime-types.d.ts +1 -117
- package/dist/utils/agents/runtime-types.js +1 -4
- package/package.json +4 -2
- package/dist/deploy/config.d.ts +0 -1
- package/dist/plugins/constants.d.ts +0 -1
package/README.md
CHANGED
|
@@ -63,9 +63,18 @@ What they do:
|
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
npm run verify
|
|
66
|
+
npm run verify:local
|
|
67
|
+
npm run verify:action
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
`npm run verify`
|
|
70
|
+
`npm run verify` uses the shared Treeseed SDK verify driver in auto mode.
|
|
71
|
+
|
|
72
|
+
- `npm run verify` auto-selects between local direct verification and the `gh act` workflow path
|
|
73
|
+
- `npm run verify:local` forces local direct verification against the current repo state
|
|
74
|
+
- `npm run verify:action` forces the isolated workflow path through `gh act`
|
|
75
|
+
- `npm run verify:direct` is the raw package verification chain used by the driver
|
|
76
|
+
|
|
77
|
+
The direct verification chain is:
|
|
69
78
|
|
|
70
79
|
1. `npm run build:dist`
|
|
71
80
|
2. `npm run test:unit`
|
package/dist/deploy/runtime.js
CHANGED
|
@@ -1,72 +1,15 @@
|
|
|
1
|
-
import { loadTreeseedDeployConfig } from "./config.js";
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
accountId: "",
|
|
15
|
-
workerName: "treeseed-site"
|
|
16
|
-
},
|
|
17
|
-
plugins: [...TREESEED_DEFAULT_PLUGIN_REFERENCES],
|
|
18
|
-
providers: structuredClone(TREESEED_DEFAULT_PROVIDER_SELECTIONS),
|
|
19
|
-
smtp: {
|
|
20
|
-
enabled: false
|
|
21
|
-
},
|
|
22
|
-
turnstile: {
|
|
23
|
-
enabled: true
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function getTreeseedDeployConfig() {
|
|
28
|
-
if (cachedDeployConfig) {
|
|
29
|
-
return cachedDeployConfig;
|
|
30
|
-
}
|
|
31
|
-
if (typeof __TREESEED_DEPLOY_CONFIG__ !== "undefined" && __TREESEED_DEPLOY_CONFIG__) {
|
|
32
|
-
cachedDeployConfig = __TREESEED_DEPLOY_CONFIG__;
|
|
33
|
-
return cachedDeployConfig;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
cachedDeployConfig = loadTreeseedDeployConfig();
|
|
37
|
-
return cachedDeployConfig;
|
|
38
|
-
} catch {
|
|
39
|
-
cachedDeployConfig = defaultDeployConfig();
|
|
40
|
-
return cachedDeployConfig;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function resetTreeseedDeployConfigForTests() {
|
|
44
|
-
cachedDeployConfig = null;
|
|
45
|
-
}
|
|
46
|
-
function getTreeseedFormsProvider() {
|
|
47
|
-
return getTreeseedDeployConfig().providers?.forms ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.forms;
|
|
48
|
-
}
|
|
49
|
-
function getTreeseedOperationsProvider() {
|
|
50
|
-
return getTreeseedDeployConfig().providers?.operations ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.operations;
|
|
51
|
-
}
|
|
52
|
-
function getTreeseedAgentProviderSelections() {
|
|
53
|
-
return getTreeseedDeployConfig().providers?.agents ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.agents;
|
|
54
|
-
}
|
|
55
|
-
function getTreeseedDeployProvider() {
|
|
56
|
-
return getTreeseedDeployConfig().providers?.deploy ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.deploy;
|
|
57
|
-
}
|
|
58
|
-
function getTreeseedDocsProvider() {
|
|
59
|
-
return getTreeseedDeployConfig().providers?.content?.docs ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.content.docs;
|
|
60
|
-
}
|
|
61
|
-
function getTreeseedSiteProvider() {
|
|
62
|
-
return getTreeseedDeployConfig().providers?.site ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.site;
|
|
63
|
-
}
|
|
64
|
-
function isTreeseedSmtpEnabled() {
|
|
65
|
-
return getTreeseedDeployConfig().smtp?.enabled ?? false;
|
|
66
|
-
}
|
|
67
|
-
function isTreeseedTurnstileEnabled() {
|
|
68
|
-
return getTreeseedDeployConfig().turnstile?.enabled ?? true;
|
|
69
|
-
}
|
|
2
|
+
getTreeseedAgentProviderSelections,
|
|
3
|
+
getTreeseedDeployConfig,
|
|
4
|
+
getTreeseedDeployProvider,
|
|
5
|
+
getTreeseedDocsProvider,
|
|
6
|
+
getTreeseedFormsProvider,
|
|
7
|
+
getTreeseedOperationsProvider,
|
|
8
|
+
getTreeseedSiteProvider,
|
|
9
|
+
isTreeseedSmtpEnabled,
|
|
10
|
+
isTreeseedTurnstileEnabled,
|
|
11
|
+
resetTreeseedDeployConfigForTests
|
|
12
|
+
} from "@treeseed/sdk/platform/deploy-runtime";
|
|
70
13
|
export {
|
|
71
14
|
getTreeseedAgentProviderSelections,
|
|
72
15
|
getTreeseedDeployConfig,
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
type
|
|
3
|
-
package: string;
|
|
4
|
-
config: Record<string, unknown>;
|
|
5
|
-
baseDir: string;
|
|
6
|
-
plugin: Record<string, any>;
|
|
7
|
-
};
|
|
8
|
-
export type LoadedTreeseedPluginEntry = LoadedPluginEntry;
|
|
9
|
-
export declare function loadTreeseedPlugins(config?: TreeseedDeployConfig): LoadedPluginEntry[];
|
|
10
|
-
export declare function loadTreeseedPluginRuntime(config?: TreeseedDeployConfig): {
|
|
11
|
-
config: TreeseedDeployConfig;
|
|
12
|
-
plugins: LoadedPluginEntry[];
|
|
13
|
-
provided: {
|
|
14
|
-
forms: Set<string>;
|
|
15
|
-
operations: Set<string>;
|
|
16
|
-
agents: {
|
|
17
|
-
execution: Set<string>;
|
|
18
|
-
mutation: Set<string>;
|
|
19
|
-
repository: Set<string>;
|
|
20
|
-
verification: Set<string>;
|
|
21
|
-
notification: Set<string>;
|
|
22
|
-
research: Set<string>;
|
|
23
|
-
handlers: Set<string>;
|
|
24
|
-
};
|
|
25
|
-
deploy: Set<string>;
|
|
26
|
-
content: {
|
|
27
|
-
docs: Set<string>;
|
|
28
|
-
};
|
|
29
|
-
site: Set<string>;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export {};
|
|
1
|
+
export { loadTreeseedPluginRuntime, loadTreeseedPlugins, resolveTreeseedGraphRankingProvider, } from '@treeseed/sdk/platform/plugins';
|
|
2
|
+
export type { LoadedTreeseedPluginEntry } from '@treeseed/sdk/platform/plugins';
|
package/dist/plugins/runtime.js
CHANGED
|
@@ -1,138 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { TREESEED_DEFAULT_PLUGIN_PACKAGE } from "./constants.js";
|
|
7
|
-
const require2 = createRequire(import.meta.url);
|
|
8
|
-
const runtimeDir = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
function normalizeLoadedPlugin(moduleExports, packageName) {
|
|
10
|
-
const plugin = moduleExports?.default ?? moduleExports;
|
|
11
|
-
if (!plugin || typeof plugin !== "object") {
|
|
12
|
-
throw new Error(`Treeseed plugin "${packageName}" did not export a plugin object.`);
|
|
13
|
-
}
|
|
14
|
-
return plugin;
|
|
15
|
-
}
|
|
16
|
-
function isPathLikePluginReference(packageName) {
|
|
17
|
-
return packageName.startsWith(".") || packageName.startsWith("/") || packageName.startsWith("file:");
|
|
18
|
-
}
|
|
19
|
-
function resolveLocalDefaultPluginPath() {
|
|
20
|
-
const candidates = [
|
|
21
|
-
path.resolve(runtimeDir, "../plugin-default.js"),
|
|
22
|
-
path.resolve(runtimeDir, "../../dist/plugin-default.js")
|
|
23
|
-
];
|
|
24
|
-
for (const candidate of candidates) {
|
|
25
|
-
if (existsSync(candidate)) {
|
|
26
|
-
return candidate;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
function loadPluginModule(packageName, tenantRoot) {
|
|
32
|
-
if (packageName === TREESEED_DEFAULT_PLUGIN_PACKAGE) {
|
|
33
|
-
const localDefaultPluginPath = resolveLocalDefaultPluginPath();
|
|
34
|
-
const resolvedPath2 = localDefaultPluginPath ?? require2.resolve(packageName);
|
|
35
|
-
return {
|
|
36
|
-
moduleExports: require2(resolvedPath2),
|
|
37
|
-
baseDir: path.dirname(resolvedPath2)
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
if (isPathLikePluginReference(packageName)) {
|
|
41
|
-
const resolvedPath2 = packageName.startsWith("file:") ? fileURLToPath(packageName) : path.resolve(tenantRoot, packageName);
|
|
42
|
-
return {
|
|
43
|
-
moduleExports: require2(resolvedPath2),
|
|
44
|
-
baseDir: path.dirname(resolvedPath2)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const resolvedPath = require2.resolve(packageName);
|
|
48
|
-
return {
|
|
49
|
-
moduleExports: require2(resolvedPath),
|
|
50
|
-
baseDir: path.dirname(resolvedPath)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function loadTreeseedPlugins(config = loadTreeseedDeployConfig()) {
|
|
54
|
-
const tenantRoot = config.__tenantRoot ?? process.cwd();
|
|
55
|
-
const plugins = [];
|
|
56
|
-
for (const pluginRef of config.plugins ?? []) {
|
|
57
|
-
if (pluginRef?.enabled === false) {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
const loaded = loadPluginModule(pluginRef.package, tenantRoot);
|
|
61
|
-
const plugin = normalizeLoadedPlugin(loaded.moduleExports, pluginRef.package);
|
|
62
|
-
plugins.push({
|
|
63
|
-
package: pluginRef.package,
|
|
64
|
-
config: pluginRef.config ?? {},
|
|
65
|
-
baseDir: loaded.baseDir,
|
|
66
|
-
plugin
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return plugins;
|
|
70
|
-
}
|
|
71
|
-
function collectProvidedIds(plugins) {
|
|
72
|
-
const provided = {
|
|
73
|
-
forms: /* @__PURE__ */ new Set(),
|
|
74
|
-
operations: /* @__PURE__ */ new Set(),
|
|
75
|
-
agents: {
|
|
76
|
-
execution: /* @__PURE__ */ new Set(),
|
|
77
|
-
mutation: /* @__PURE__ */ new Set(),
|
|
78
|
-
repository: /* @__PURE__ */ new Set(),
|
|
79
|
-
verification: /* @__PURE__ */ new Set(),
|
|
80
|
-
notification: /* @__PURE__ */ new Set(),
|
|
81
|
-
research: /* @__PURE__ */ new Set(),
|
|
82
|
-
handlers: /* @__PURE__ */ new Set()
|
|
83
|
-
},
|
|
84
|
-
deploy: /* @__PURE__ */ new Set(),
|
|
85
|
-
content: {
|
|
86
|
-
docs: /* @__PURE__ */ new Set()
|
|
87
|
-
},
|
|
88
|
-
site: /* @__PURE__ */ new Set()
|
|
89
|
-
};
|
|
90
|
-
for (const { plugin } of plugins) {
|
|
91
|
-
for (const id of plugin.provides?.forms ?? []) provided.forms.add(id);
|
|
92
|
-
for (const id of plugin.provides?.operations ?? []) provided.operations.add(id);
|
|
93
|
-
for (const id of plugin.provides?.agents?.execution ?? []) provided.agents.execution.add(id);
|
|
94
|
-
for (const id of plugin.provides?.agents?.mutation ?? []) provided.agents.mutation.add(id);
|
|
95
|
-
for (const id of plugin.provides?.agents?.repository ?? []) provided.agents.repository.add(id);
|
|
96
|
-
for (const id of plugin.provides?.agents?.verification ?? []) provided.agents.verification.add(id);
|
|
97
|
-
for (const id of plugin.provides?.agents?.notification ?? []) provided.agents.notification.add(id);
|
|
98
|
-
for (const id of plugin.provides?.agents?.research ?? []) provided.agents.research.add(id);
|
|
99
|
-
for (const id of plugin.provides?.agents?.handlers ?? []) provided.agents.handlers.add(id);
|
|
100
|
-
for (const id of plugin.provides?.deploy ?? []) provided.deploy.add(id);
|
|
101
|
-
for (const id of plugin.provides?.content?.docs ?? []) provided.content.docs.add(id);
|
|
102
|
-
for (const id of plugin.provides?.site ?? []) provided.site.add(id);
|
|
103
|
-
}
|
|
104
|
-
return provided;
|
|
105
|
-
}
|
|
106
|
-
function assertSelectedProvider(provided, label, id) {
|
|
107
|
-
if (!id) {
|
|
108
|
-
throw new Error(`Treeseed plugin runtime is missing selected provider id for ${label}.`);
|
|
109
|
-
}
|
|
110
|
-
if (!provided.has(id)) {
|
|
111
|
-
throw new Error(`Treeseed plugin runtime could not resolve ${label} provider "${id}".`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function loadTreeseedPluginRuntime(config = loadTreeseedDeployConfig()) {
|
|
115
|
-
const plugins = loadTreeseedPlugins(config);
|
|
116
|
-
const provided = collectProvidedIds(plugins);
|
|
117
|
-
const providers = config.providers;
|
|
118
|
-
assertSelectedProvider(provided.forms, "forms", providers.forms);
|
|
119
|
-
assertSelectedProvider(provided.operations, "operations", providers.operations);
|
|
120
|
-
assertSelectedProvider(provided.agents.execution, "agents.execution", providers.agents.execution);
|
|
121
|
-
assertSelectedProvider(provided.agents.mutation, "agents.mutation", providers.agents.mutation);
|
|
122
|
-
assertSelectedProvider(provided.agents.repository, "agents.repository", providers.agents.repository);
|
|
123
|
-
assertSelectedProvider(provided.agents.verification, "agents.verification", providers.agents.verification);
|
|
124
|
-
assertSelectedProvider(provided.agents.notification, "agents.notification", providers.agents.notification);
|
|
125
|
-
assertSelectedProvider(provided.agents.research, "agents.research", providers.agents.research);
|
|
126
|
-
assertSelectedProvider(provided.deploy, "deploy", providers.deploy);
|
|
127
|
-
assertSelectedProvider(provided.content.docs, "content.docs", providers.content?.docs);
|
|
128
|
-
assertSelectedProvider(provided.site, "site", providers.site);
|
|
129
|
-
return {
|
|
130
|
-
config,
|
|
131
|
-
plugins,
|
|
132
|
-
provided
|
|
133
|
-
};
|
|
134
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
loadTreeseedPluginRuntime,
|
|
3
|
+
loadTreeseedPlugins,
|
|
4
|
+
resolveTreeseedGraphRankingProvider
|
|
5
|
+
} from "@treeseed/sdk/platform/plugins";
|
|
135
6
|
export {
|
|
136
7
|
loadTreeseedPluginRuntime,
|
|
137
|
-
loadTreeseedPlugins
|
|
8
|
+
loadTreeseedPlugins,
|
|
9
|
+
resolveTreeseedGraphRankingProvider
|
|
138
10
|
};
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
1
2
|
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
2
4
|
import { fixtureRoot, packageRoot } from './paths.js';
|
|
3
5
|
const [command, ...rest] = process.argv.slice(2);
|
|
4
6
|
if (!command) {
|
|
5
7
|
console.error('Usage: node ./scripts/run-fixture-astro-command.mjs <check|build|preview|dev> [...args]');
|
|
6
8
|
process.exit(1);
|
|
7
9
|
}
|
|
10
|
+
function ensureFixtureDefaultPluginPackage() {
|
|
11
|
+
const packageDir = resolve(fixtureRoot, 'node_modules', '@treeseed', 'core');
|
|
12
|
+
const pluginEntryPath = resolve(packageRoot, 'dist', 'plugin-default.js');
|
|
13
|
+
mkdirSync(packageDir, { recursive: true });
|
|
14
|
+
writeFileSync(join(packageDir, 'package.json'), `${JSON.stringify({
|
|
15
|
+
name: '@treeseed/core',
|
|
16
|
+
type: 'commonjs',
|
|
17
|
+
exports: {
|
|
18
|
+
'./plugin-default': './plugin-default.cjs',
|
|
19
|
+
},
|
|
20
|
+
}, null, 2)}\n`, 'utf8');
|
|
21
|
+
writeFileSync(join(packageDir, 'plugin-default.cjs'), `module.exports = require(${JSON.stringify(pluginEntryPath)});\n`, 'utf8');
|
|
22
|
+
}
|
|
23
|
+
ensureFixtureDefaultPluginPackage();
|
|
8
24
|
const result = spawnSync('npx', ['astro', command, '--root', fixtureRoot, ...rest], {
|
|
9
25
|
cwd: packageRoot,
|
|
10
26
|
stdio: 'inherit',
|
|
@@ -1,88 +1 @@
|
|
|
1
|
-
export
|
|
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>): Record<string, unknown>;
|
|
1
|
+
export * from '@treeseed/sdk/utils/agents/contracts/messages';
|
|
@@ -1,138 +1 @@
|
|
|
1
|
-
|
|
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 parsed = JSON.parse(payloadJson);
|
|
44
|
-
switch (type) {
|
|
45
|
-
case "question_priority_updated":
|
|
46
|
-
return {
|
|
47
|
-
questionId: ensureString(parsed.questionId, "questionId"),
|
|
48
|
-
reason: ensureString(parsed.reason, "reason"),
|
|
49
|
-
plannerRunId: ensureString(parsed.plannerRunId, "plannerRunId")
|
|
50
|
-
};
|
|
51
|
-
case "objective_priority_updated":
|
|
52
|
-
return {
|
|
53
|
-
objectiveId: ensureString(parsed.objectiveId, "objectiveId"),
|
|
54
|
-
reason: ensureString(parsed.reason, "reason"),
|
|
55
|
-
plannerRunId: ensureString(parsed.plannerRunId, "plannerRunId")
|
|
56
|
-
};
|
|
57
|
-
case "architecture_updated":
|
|
58
|
-
return {
|
|
59
|
-
objectiveId: ensureString(parsed.objectiveId, "objectiveId"),
|
|
60
|
-
knowledgeId: ensureString(parsed.knowledgeId, "knowledgeId"),
|
|
61
|
-
architectRunId: ensureString(parsed.architectRunId, "architectRunId")
|
|
62
|
-
};
|
|
63
|
-
case "subscriber_notified":
|
|
64
|
-
return {
|
|
65
|
-
email: ensureString(parsed.email, "email"),
|
|
66
|
-
itemCount: ensureNumber(parsed.itemCount, "itemCount"),
|
|
67
|
-
notifierRunId: ensureString(parsed.notifierRunId, "notifierRunId")
|
|
68
|
-
};
|
|
69
|
-
case "research_started":
|
|
70
|
-
return {
|
|
71
|
-
questionId: ensureString(parsed.questionId, "questionId"),
|
|
72
|
-
researcherRunId: ensureString(parsed.researcherRunId, "researcherRunId")
|
|
73
|
-
};
|
|
74
|
-
case "research_completed":
|
|
75
|
-
return {
|
|
76
|
-
questionId: ensureString(parsed.questionId, "questionId"),
|
|
77
|
-
knowledgeId: ensureOptionalString(parsed.knowledgeId, "knowledgeId"),
|
|
78
|
-
researcherRunId: ensureString(parsed.researcherRunId, "researcherRunId")
|
|
79
|
-
};
|
|
80
|
-
case "task_complete":
|
|
81
|
-
return {
|
|
82
|
-
branchName: ensureOptionalString(parsed.branchName, "branchName"),
|
|
83
|
-
changedTargets: ensureStringArray(parsed.changedTargets, "changedTargets"),
|
|
84
|
-
engineerRunId: ensureString(parsed.engineerRunId, "engineerRunId")
|
|
85
|
-
};
|
|
86
|
-
case "task_waiting":
|
|
87
|
-
return {
|
|
88
|
-
blockingReason: ensureString(parsed.blockingReason, "blockingReason"),
|
|
89
|
-
engineerRunId: ensureString(parsed.engineerRunId, "engineerRunId")
|
|
90
|
-
};
|
|
91
|
-
case "task_failed":
|
|
92
|
-
return {
|
|
93
|
-
failureSummary: ensureString(parsed.failureSummary, "failureSummary"),
|
|
94
|
-
engineerRunId: ensureString(parsed.engineerRunId, "engineerRunId")
|
|
95
|
-
};
|
|
96
|
-
case "task_verified":
|
|
97
|
-
return {
|
|
98
|
-
branchName: ensureOptionalString(parsed.branchName, "branchName"),
|
|
99
|
-
reviewerRunId: ensureString(parsed.reviewerRunId, "reviewerRunId")
|
|
100
|
-
};
|
|
101
|
-
case "review_failed":
|
|
102
|
-
return {
|
|
103
|
-
failureSummary: ensureString(parsed.failureSummary, "failureSummary"),
|
|
104
|
-
reviewerRunId: ensureString(parsed.reviewerRunId, "reviewerRunId")
|
|
105
|
-
};
|
|
106
|
-
case "review_waiting":
|
|
107
|
-
return {
|
|
108
|
-
blockingReason: ensureString(parsed.blockingReason, "blockingReason"),
|
|
109
|
-
reviewerRunId: ensureString(parsed.reviewerRunId, "reviewerRunId")
|
|
110
|
-
};
|
|
111
|
-
case "release_started":
|
|
112
|
-
return {
|
|
113
|
-
taskRunId: ensureOptionalString(parsed.taskRunId, "taskRunId"),
|
|
114
|
-
releaserRunId: ensureString(parsed.releaserRunId, "releaserRunId")
|
|
115
|
-
};
|
|
116
|
-
case "release_completed":
|
|
117
|
-
return {
|
|
118
|
-
releaseSummary: ensureString(parsed.releaseSummary, "releaseSummary"),
|
|
119
|
-
releaserRunId: ensureString(parsed.releaserRunId, "releaserRunId")
|
|
120
|
-
};
|
|
121
|
-
case "release_failed":
|
|
122
|
-
return {
|
|
123
|
-
failureSummary: ensureString(parsed.failureSummary, "failureSummary"),
|
|
124
|
-
releaserRunId: ensureString(parsed.releaserRunId, "releaserRunId")
|
|
125
|
-
};
|
|
126
|
-
default:
|
|
127
|
-
throw new Error(`Unsupported message type "${type}".`);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function serializeAgentMessagePayload(type, payload) {
|
|
131
|
-
parseAgentMessagePayload(type, JSON.stringify(payload));
|
|
132
|
-
return payload;
|
|
133
|
-
}
|
|
134
|
-
export {
|
|
135
|
-
AGENT_MESSAGE_TYPES,
|
|
136
|
-
parseAgentMessagePayload,
|
|
137
|
-
serializeAgentMessagePayload
|
|
138
|
-
};
|
|
1
|
+
export * from "@treeseed/sdk/utils/agents/contracts/messages";
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
export
|
|
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
|
-
}
|
|
1
|
+
export * from '@treeseed/sdk/utils/agents/contracts/run';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@treeseed/sdk/utils/agents/contracts/run";
|
|
@@ -1,117 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { AgentErrorCategory } from './contracts/run.ts';
|
|
3
|
-
import type { ScopedAgentSdk, SdkMessageEntity } from '@treeseed/sdk';
|
|
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;
|
|
1
|
+
export * from '@treeseed/sdk/utils/agents/runtime-types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeseed/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Treeseed platform runtime package for Astro, Starlight, forms, books, plugins, and shared platform behavior.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
"test": "npm run test:unit",
|
|
47
47
|
"lint": "npm run fixtures:check && npm run starlight:patch && npm run build:dist",
|
|
48
48
|
"verify:direct": "npm run release:verify",
|
|
49
|
+
"verify:local": "node --input-type=module -e \"process.env.TREESEED_VERIFY_DRIVER='direct'; await import('@treeseed/sdk/scripts/verify-driver')\"",
|
|
50
|
+
"verify:action": "node --input-type=module -e \"process.env.TREESEED_VERIFY_DRIVER='act'; await import('@treeseed/sdk/scripts/verify-driver')\"",
|
|
49
51
|
"verify": "node --input-type=module -e \"await import('@treeseed/sdk/scripts/verify-driver')\"",
|
|
50
52
|
"test:smoke": "node ./scripts/run-ts.mjs ./scripts/test-smoke.ts",
|
|
51
53
|
"fixtures:resolve": "node ./scripts/run-ts.mjs ./scripts/fixture-tools.ts resolve",
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
"release:publish": "node ./scripts/run-ts.mjs ./scripts/publish-package.ts"
|
|
57
59
|
},
|
|
58
60
|
"dependencies": {
|
|
59
|
-
"@treeseed/sdk": "^0.3.
|
|
61
|
+
"@treeseed/sdk": "^0.3.4",
|
|
60
62
|
"@astrojs/check": "^0.9.8",
|
|
61
63
|
"@astrojs/cloudflare": "^12.6.13",
|
|
62
64
|
"@astrojs/sitemap": "3.7.0",
|
package/dist/deploy/config.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { deriveCloudflareWorkerName, loadTreeseedDeployConfig, resolveTreeseedDeployConfigPath, } from '@treeseed/sdk/platform/deploy-config';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TREESEED_DEFAULT_PLUGIN_PACKAGE, TREESEED_DEFAULT_PLUGIN_REFERENCES, TREESEED_DEFAULT_PROVIDER_SELECTIONS, } from '@treeseed/sdk/platform/plugins';
|