@treeseed/core 0.3.2 → 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 +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 +3 -37
- 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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeseed/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Treeseed
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Treeseed Research Hub package for Astro, Starlight, knowledge-factory content, and forms.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"release:publish": "node ./scripts/run-ts.mjs ./scripts/publish-package.ts"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@treeseed/sdk": "^0.
|
|
61
|
+
"@treeseed/sdk": "^0.4.0",
|
|
62
62
|
"@astrojs/check": "^0.9.8",
|
|
63
63
|
"@astrojs/cloudflare": "^12.6.13",
|
|
64
64
|
"@astrojs/sitemap": "3.7.0",
|
|
@@ -98,13 +98,6 @@
|
|
|
98
98
|
"types": "./dist/config.d.ts",
|
|
99
99
|
"default": "./dist/config.js"
|
|
100
100
|
},
|
|
101
|
-
"./deploy/config": {
|
|
102
|
-
"types": "./dist/deploy/config.d.ts",
|
|
103
|
-
"default": "./dist/deploy/config.js"
|
|
104
|
-
},
|
|
105
|
-
"./deploy/runtime": {
|
|
106
|
-
"default": "./dist/deploy/runtime.js"
|
|
107
|
-
},
|
|
108
101
|
"./content": {
|
|
109
102
|
"types": "./dist/content.d.ts",
|
|
110
103
|
"default": "./dist/content.js"
|
|
@@ -114,41 +107,14 @@
|
|
|
114
107
|
"default": "./dist/content-config.js"
|
|
115
108
|
},
|
|
116
109
|
"./tenant": "./dist/tenant/bridge.js",
|
|
117
|
-
"./tenant-config": {
|
|
118
|
-
"types": "./dist/tenant/config.d.ts",
|
|
119
|
-
"default": "./dist/tenant/config.js"
|
|
120
|
-
},
|
|
121
|
-
"./contracts": "./dist/contracts.js",
|
|
122
|
-
"./plugin-default": {
|
|
123
|
-
"types": "./dist/plugin-default.d.ts",
|
|
124
|
-
"default": "./dist/plugin-default.js"
|
|
125
|
-
},
|
|
126
|
-
"./plugins/plugin": {
|
|
127
|
-
"types": "./dist/plugins/plugin.d.ts",
|
|
128
|
-
"default": "./dist/plugins/plugin.js"
|
|
129
|
-
},
|
|
130
|
-
"./plugins/runtime": {
|
|
131
|
-
"types": "./dist/plugins/runtime.d.ts",
|
|
132
|
-
"default": "./dist/plugins/runtime.js"
|
|
133
|
-
},
|
|
134
|
-
"./environment": {
|
|
135
|
-
"types": "./dist/environment.d.ts",
|
|
136
|
-
"default": "./dist/environment.js"
|
|
137
|
-
},
|
|
138
110
|
"./scripts/workspace-bootstrap": "./dist/scripts/workspace-bootstrap.js",
|
|
139
111
|
"./site-resources": {
|
|
140
112
|
"types": "./dist/site-resources.d.ts",
|
|
141
113
|
"default": "./dist/site-resources.js"
|
|
142
114
|
},
|
|
143
|
-
"./types/agents": "./dist/types/agents.js",
|
|
144
115
|
"./types/cloudflare": "./dist/types/cloudflare.js",
|
|
145
|
-
"./agents/registry-helper": "./dist/agents/registry-helper.js",
|
|
146
116
|
"./utils/seo": "./dist/utils/seo.js",
|
|
147
117
|
"./utils/site-config-schema": "./dist/utils/site-config-schema.js",
|
|
148
|
-
"./utils/books-data": "./dist/utils/books-data.js",
|
|
149
|
-
"./utils/agents/runtime-types": "./dist/utils/agents/runtime-types.js",
|
|
150
|
-
"./utils/agents/contracts/messages": "./dist/utils/agents/contracts/messages.js",
|
|
151
|
-
"./utils/agents/contracts/run": "./dist/utils/agents/contracts/run.js",
|
|
152
118
|
"./components/site/CTASection.astro": "./dist/components/site/CTASection.astro",
|
|
153
119
|
"./components/site/SectionIntro.astro": "./dist/components/site/SectionIntro.astro",
|
|
154
120
|
"./components/site/PathCard.astro": "./dist/components/site/PathCard.astro",
|
package/dist/agents/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function defineAgentHandlerRegistry(registry) {
|
|
2
|
-
return registry;
|
|
3
|
-
}
|
|
4
|
-
function resolveAgentHandlerFromRegistry(registry, kind) {
|
|
5
|
-
const handler = registry[kind];
|
|
6
|
-
if (!handler) {
|
|
7
|
-
throw new Error(`No runtime handler is registered for agent handler "${kind}".`);
|
|
8
|
-
}
|
|
9
|
-
return handler;
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
defineAgentHandlerRegistry,
|
|
13
|
-
resolveAgentHandlerFromRegistry
|
|
14
|
-
};
|
package/dist/agents/registry.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
import { resolveTreeseedTenantRoot } from "../tenant/config.js";
|
|
5
|
-
import { resolveAgentRuntimeProviders } from "../utils/plugin-runtime.js";
|
|
6
|
-
import { getTreeseedAgentProviderSelections } from "../deploy/runtime.js";
|
|
7
|
-
const BUILTIN_HANDLER_KINDS = [
|
|
8
|
-
"planner",
|
|
9
|
-
"architect",
|
|
10
|
-
"engineer",
|
|
11
|
-
"notifier",
|
|
12
|
-
"researcher",
|
|
13
|
-
"reviewer",
|
|
14
|
-
"releaser"
|
|
15
|
-
];
|
|
16
|
-
const HANDLER_EXPORT_NAMES = {
|
|
17
|
-
planner: "plannerHandler",
|
|
18
|
-
architect: "architectHandler",
|
|
19
|
-
engineer: "engineerHandler",
|
|
20
|
-
notifier: "notifierHandler",
|
|
21
|
-
researcher: "researcherHandler",
|
|
22
|
-
reviewer: "reviewerHandler",
|
|
23
|
-
releaser: "releaserHandler"
|
|
24
|
-
};
|
|
25
|
-
function getTenantAgentHandlerModulePath(kind, tenantRoot = resolveTreeseedTenantRoot()) {
|
|
26
|
-
return resolve(tenantRoot, "src/agents", `${kind}.ts`);
|
|
27
|
-
}
|
|
28
|
-
async function loadTenantAgentHandlerRegistry(tenantRoot = resolveTreeseedTenantRoot()) {
|
|
29
|
-
const registry = {};
|
|
30
|
-
for (const kind of BUILTIN_HANDLER_KINDS) {
|
|
31
|
-
const modulePath = getTenantAgentHandlerModulePath(kind, tenantRoot);
|
|
32
|
-
if (!existsSync(modulePath)) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
let moduleExports;
|
|
36
|
-
try {
|
|
37
|
-
moduleExports = await import(
|
|
38
|
-
/* @vite-ignore */
|
|
39
|
-
pathToFileURL(modulePath).href
|
|
40
|
-
);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
43
|
-
throw new Error(`Failed to import tenant agent handler "${kind}" from ${modulePath}: ${reason}`);
|
|
44
|
-
}
|
|
45
|
-
const exportName = HANDLER_EXPORT_NAMES[kind];
|
|
46
|
-
const handler = moduleExports[exportName];
|
|
47
|
-
if (!handler) {
|
|
48
|
-
throw new Error(
|
|
49
|
-
`Tenant agent handler module "${modulePath}" must export "${exportName}" for handler kind "${kind}".`
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
const normalizedHandler = handler;
|
|
53
|
-
if (normalizedHandler.kind !== kind) {
|
|
54
|
-
throw new Error(
|
|
55
|
-
`Tenant agent handler "${exportName}" from "${modulePath}" declares kind "${normalizedHandler.kind}", but "${kind}" was expected.`
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
registry[kind] = normalizedHandler;
|
|
59
|
-
}
|
|
60
|
-
return registry;
|
|
61
|
-
}
|
|
62
|
-
const AGENT_HANDLER_REGISTRY = await loadTenantAgentHandlerRegistry();
|
|
63
|
-
function listRegisteredAgentHandlers() {
|
|
64
|
-
const runtimeProviders = resolveAgentRuntimeProviders(resolveTreeseedTenantRoot(), getTreeseedAgentProviderSelections());
|
|
65
|
-
return [.../* @__PURE__ */ new Set([...Object.keys(AGENT_HANDLER_REGISTRY), ...runtimeProviders.handlers.keys()])];
|
|
66
|
-
}
|
|
67
|
-
function resolveAgentHandler(kind) {
|
|
68
|
-
const runtimeProviders = resolveAgentRuntimeProviders(resolveTreeseedTenantRoot(), getTreeseedAgentProviderSelections());
|
|
69
|
-
const handler = AGENT_HANDLER_REGISTRY[kind] ?? runtimeProviders.handlers.get(kind);
|
|
70
|
-
if (!handler) {
|
|
71
|
-
if (BUILTIN_HANDLER_KINDS.includes(kind)) {
|
|
72
|
-
const expectedPath = getTenantAgentHandlerModulePath(kind);
|
|
73
|
-
const expectedExport = HANDLER_EXPORT_NAMES[kind];
|
|
74
|
-
throw new Error(
|
|
75
|
-
`No runtime handler is registered for agent handler "${kind}". Expected tenant file "${expectedPath}" exporting "${expectedExport}" or a plugin contribution.`
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
throw new Error(`No runtime handler is registered for agent handler "${kind}".`);
|
|
79
|
-
}
|
|
80
|
-
return handler;
|
|
81
|
-
}
|
|
82
|
-
export {
|
|
83
|
-
AGENT_HANDLER_REGISTRY,
|
|
84
|
-
getTenantAgentHandlerModulePath,
|
|
85
|
-
listRegisteredAgentHandlers,
|
|
86
|
-
loadTenantAgentHandlerRegistry,
|
|
87
|
-
resolveAgentHandler
|
|
88
|
-
};
|
package/dist/contracts.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { TreeseedBookDefinition, TreeseedContentCollection, TreeseedContentMap, TreeseedDeployConfig, TreeseedFeatureModules, TreeseedFeatureName, TreeseedManagedServiceConfig, TreeseedManagedServiceEnvironmentConfig, TreeseedManagedServiceRailwayConfig, TreeseedManagedServicesConfig, TreeseedPluginReference, TreeseedProviderSelections, TreeseedTenantConfig, TreeseedThemeConfig, } from '@treeseed/sdk/platform/contracts';
|
package/dist/contracts.js
DELETED
|
File without changes
|
package/dist/deploy/config.js
DELETED
package/dist/deploy/runtime.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
13
|
-
export {
|
|
14
|
-
getTreeseedAgentProviderSelections,
|
|
15
|
-
getTreeseedDeployConfig,
|
|
16
|
-
getTreeseedDeployProvider,
|
|
17
|
-
getTreeseedDocsProvider,
|
|
18
|
-
getTreeseedFormsProvider,
|
|
19
|
-
getTreeseedOperationsProvider,
|
|
20
|
-
getTreeseedSiteProvider,
|
|
21
|
-
isTreeseedSmtpEnabled,
|
|
22
|
-
isTreeseedTurnstileEnabled,
|
|
23
|
-
resetTreeseedDeployConfigForTests
|
|
24
|
-
};
|
package/dist/environment.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { getTreeseedEnvironmentSuggestedValues, isTreeseedEnvironmentEntryRelevant, loadTreeseedEnvironmentOverlay, resolveTreeseedEnvironmentContext, resolveTreeseedEnvironmentRegistry, TREESEED_ENVIRONMENT_PURPOSES, TREESEED_ENVIRONMENT_REQUIREMENTS, TREESEED_ENVIRONMENT_SCOPES, TREESEED_ENVIRONMENT_SENSITIVITY, TREESEED_ENVIRONMENT_TARGETS, validateTreeseedEnvironmentValues, } from '@treeseed/sdk/platform/environment';
|
|
2
|
-
export type * from '@treeseed/sdk/platform/environment';
|
package/dist/environment.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getTreeseedEnvironmentSuggestedValues,
|
|
3
|
-
isTreeseedEnvironmentEntryRelevant,
|
|
4
|
-
loadTreeseedEnvironmentOverlay,
|
|
5
|
-
resolveTreeseedEnvironmentContext,
|
|
6
|
-
resolveTreeseedEnvironmentRegistry,
|
|
7
|
-
TREESEED_ENVIRONMENT_PURPOSES,
|
|
8
|
-
TREESEED_ENVIRONMENT_REQUIREMENTS,
|
|
9
|
-
TREESEED_ENVIRONMENT_SCOPES,
|
|
10
|
-
TREESEED_ENVIRONMENT_SENSITIVITY,
|
|
11
|
-
TREESEED_ENVIRONMENT_TARGETS,
|
|
12
|
-
validateTreeseedEnvironmentValues
|
|
13
|
-
} from "@treeseed/sdk/platform/environment";
|
|
14
|
-
export {
|
|
15
|
-
TREESEED_ENVIRONMENT_PURPOSES,
|
|
16
|
-
TREESEED_ENVIRONMENT_REQUIREMENTS,
|
|
17
|
-
TREESEED_ENVIRONMENT_SCOPES,
|
|
18
|
-
TREESEED_ENVIRONMENT_SENSITIVITY,
|
|
19
|
-
TREESEED_ENVIRONMENT_TARGETS,
|
|
20
|
-
getTreeseedEnvironmentSuggestedValues,
|
|
21
|
-
isTreeseedEnvironmentEntryRelevant,
|
|
22
|
-
loadTreeseedEnvironmentOverlay,
|
|
23
|
-
resolveTreeseedEnvironmentContext,
|
|
24
|
-
resolveTreeseedEnvironmentRegistry,
|
|
25
|
-
validateTreeseedEnvironmentValues
|
|
26
|
-
};
|
package/dist/plugin-default.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { createDefaultGraphRankingProvider } from "@treeseed/sdk";
|
|
2
|
-
import { defineTreeseedPlugin } from "../plugin.js";
|
|
3
|
-
var default_plugin_default = defineTreeseedPlugin({
|
|
4
|
-
id: "treeseed-core-default",
|
|
5
|
-
provides: {
|
|
6
|
-
forms: ["store_only", "notify_admin", "full_email"],
|
|
7
|
-
operations: ["default"],
|
|
8
|
-
agents: {
|
|
9
|
-
execution: ["stub", "manual", "copilot"],
|
|
10
|
-
mutation: ["local_branch"],
|
|
11
|
-
repository: ["stub", "git"],
|
|
12
|
-
verification: ["stub", "local"],
|
|
13
|
-
notification: ["stub"],
|
|
14
|
-
research: ["stub"],
|
|
15
|
-
handlers: [
|
|
16
|
-
"planner",
|
|
17
|
-
"architect",
|
|
18
|
-
"engineer",
|
|
19
|
-
"notifier",
|
|
20
|
-
"researcher",
|
|
21
|
-
"reviewer",
|
|
22
|
-
"releaser"
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
deploy: ["cloudflare"],
|
|
26
|
-
content: {
|
|
27
|
-
docs: ["default"]
|
|
28
|
-
},
|
|
29
|
-
site: ["default"]
|
|
30
|
-
},
|
|
31
|
-
graphRankingProviders: {
|
|
32
|
-
default: createDefaultGraphRankingProvider()
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
export {
|
|
36
|
-
default_plugin_default as default
|
|
37
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TREESEED_DEFAULT_PLUGIN_PACKAGE,
|
|
3
|
-
TREESEED_DEFAULT_PLUGIN_REFERENCES,
|
|
4
|
-
TREESEED_DEFAULT_PROVIDER_SELECTIONS
|
|
5
|
-
} from "@treeseed/sdk/platform/plugins";
|
|
6
|
-
export {
|
|
7
|
-
TREESEED_DEFAULT_PLUGIN_PACKAGE,
|
|
8
|
-
TREESEED_DEFAULT_PLUGIN_REFERENCES,
|
|
9
|
-
TREESEED_DEFAULT_PROVIDER_SELECTIONS
|
|
10
|
-
};
|
package/dist/plugins/plugin.d.ts
DELETED
package/dist/plugins/plugin.js
DELETED
package/dist/plugins/runtime.js
DELETED
package/dist/tenant/config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineTreeseedTenant,
|
|
3
|
-
getTenantContentRoot,
|
|
4
|
-
loadTreeseedManifest,
|
|
5
|
-
loadTreeseedTenantManifest,
|
|
6
|
-
resolveTreeseedTenantRoot,
|
|
7
|
-
tenantFeatureEnabled
|
|
8
|
-
} from "@treeseed/sdk/platform/tenant-config";
|
|
9
|
-
export {
|
|
10
|
-
defineTreeseedTenant,
|
|
11
|
-
getTenantContentRoot,
|
|
12
|
-
loadTreeseedManifest,
|
|
13
|
-
loadTreeseedTenantManifest,
|
|
14
|
-
resolveTreeseedTenantRoot,
|
|
15
|
-
tenantFeatureEnabled
|
|
16
|
-
};
|
package/dist/types/agents.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@treeseed/sdk/types/agents';
|
package/dist/types/agents.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@treeseed/sdk/types/agents";
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
import { promisify } from "node:util";
|
|
3
|
-
import { normalizeAgentCliOptions, buildCopilotAllowToolArgs } from "../cli-tools.js";
|
|
4
|
-
import { getTreeseedAgentProviderSelections } from "../../../deploy/runtime.js";
|
|
5
|
-
const execFileAsync = promisify(execFile);
|
|
6
|
-
class StubExecutionAdapter {
|
|
7
|
-
async runTask(input) {
|
|
8
|
-
return {
|
|
9
|
-
status: "completed",
|
|
10
|
-
summary: `Stubbed Copilot execution for ${input.runId}.`,
|
|
11
|
-
stdout: [
|
|
12
|
-
"# Planned Task",
|
|
13
|
-
"",
|
|
14
|
-
"1. Inspect the requested architecture context.",
|
|
15
|
-
"2. Produce a safe local change artifact.",
|
|
16
|
-
"3. Summarize the implementation intent.",
|
|
17
|
-
"",
|
|
18
|
-
`Prompt digest: ${input.prompt.slice(0, 240)}`
|
|
19
|
-
].join("\n"),
|
|
20
|
-
stderr: ""
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
class CopilotExecutionAdapter {
|
|
25
|
-
async runTask(input) {
|
|
26
|
-
const cli = normalizeAgentCliOptions(input.agent.cli);
|
|
27
|
-
const args = ["copilot", "-p", input.prompt];
|
|
28
|
-
if (cli.model) {
|
|
29
|
-
args.push("--model", cli.model);
|
|
30
|
-
}
|
|
31
|
-
args.push(...buildCopilotAllowToolArgs(cli.allowTools));
|
|
32
|
-
args.push(...cli.additionalArgs ?? []);
|
|
33
|
-
try {
|
|
34
|
-
const { stdout, stderr } = await execFileAsync("gh", args, {
|
|
35
|
-
cwd: process.cwd(),
|
|
36
|
-
env: process.env,
|
|
37
|
-
maxBuffer: 10 * 1024 * 1024
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
status: "completed",
|
|
41
|
-
summary: "Copilot task completed.",
|
|
42
|
-
stdout,
|
|
43
|
-
stderr
|
|
44
|
-
};
|
|
45
|
-
} catch (error) {
|
|
46
|
-
const stderr = error && typeof error === "object" && "stderr" in error ? String(error.stderr ?? "") : error instanceof Error ? error.message : String(error);
|
|
47
|
-
return {
|
|
48
|
-
status: "failed",
|
|
49
|
-
summary: "Copilot task failed.",
|
|
50
|
-
stdout: "",
|
|
51
|
-
stderr
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
class ManualExecutionAdapter {
|
|
57
|
-
async runTask(input) {
|
|
58
|
-
return {
|
|
59
|
-
status: "completed",
|
|
60
|
-
summary: `Manual execution mode is enabled for ${input.runId}.`,
|
|
61
|
-
stdout: [
|
|
62
|
-
"# Manual Execution Required",
|
|
63
|
-
"",
|
|
64
|
-
"This agent run is configured for manual execution.",
|
|
65
|
-
"Review the prompt below and complete the work outside the automated adapter.",
|
|
66
|
-
"",
|
|
67
|
-
input.prompt
|
|
68
|
-
].join("\n"),
|
|
69
|
-
stderr: ""
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function createExecutionAdapter() {
|
|
74
|
-
const configuredMode = String(
|
|
75
|
-
process.env.TREESEED_AGENT_EXECUTION_PROVIDER ?? getTreeseedAgentProviderSelections().execution
|
|
76
|
-
).toLowerCase();
|
|
77
|
-
if (configuredMode === "manual") {
|
|
78
|
-
return new ManualExecutionAdapter();
|
|
79
|
-
}
|
|
80
|
-
if (configuredMode !== "copilot") {
|
|
81
|
-
return new StubExecutionAdapter();
|
|
82
|
-
}
|
|
83
|
-
return new CopilotExecutionAdapter();
|
|
84
|
-
}
|
|
85
|
-
export {
|
|
86
|
-
CopilotExecutionAdapter,
|
|
87
|
-
ManualExecutionAdapter,
|
|
88
|
-
StubExecutionAdapter,
|
|
89
|
-
createExecutionAdapter
|
|
90
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { GitRuntime } from "@treeseed/sdk/git-runtime";
|
|
4
|
-
class LocalBranchMutationAdapter {
|
|
5
|
-
git;
|
|
6
|
-
constructor(repoRoot) {
|
|
7
|
-
this.git = new GitRuntime(
|
|
8
|
-
repoRoot,
|
|
9
|
-
process.env.TREESEED_AGENT_DISABLE_GIT === "true"
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
async writeArtifact(input) {
|
|
13
|
-
const branchName = `${input.agent.execution.branchPrefix}/${input.runId}`;
|
|
14
|
-
const worktreePath = await this.git.ensureWorktree(branchName);
|
|
15
|
-
const filePath = path.join(worktreePath, input.relativePath);
|
|
16
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
17
|
-
await writeFile(filePath, input.content, "utf8");
|
|
18
|
-
const git = await this.git.commitFileChange(filePath, branchName, input.commitMessage);
|
|
19
|
-
return {
|
|
20
|
-
branchName: git.branchName,
|
|
21
|
-
commitMessage: git.commitMessage,
|
|
22
|
-
worktreePath: git.worktreePath,
|
|
23
|
-
commitSha: git.commitSha,
|
|
24
|
-
changedPaths: git.changedPaths
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
LocalBranchMutationAdapter
|
|
30
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class StubNotificationAdapter {
|
|
2
|
-
async deliver(input) {
|
|
3
|
-
return {
|
|
4
|
-
status: input.recipients.length ? "completed" : "waiting",
|
|
5
|
-
summary: input.recipients.length ? `Prepared ${input.recipients.length} notification(s).` : "No recipients available for notification.",
|
|
6
|
-
deliveredCount: input.recipients.length
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function createNotificationAdapter() {
|
|
11
|
-
return new StubNotificationAdapter();
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
StubNotificationAdapter,
|
|
15
|
-
createNotificationAdapter
|
|
16
|
-
};
|
|
@@ -1,61 +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 StubRepositoryInspectionAdapter {
|
|
6
|
-
async inspectBranch(input) {
|
|
7
|
-
return {
|
|
8
|
-
branchName: input.branchName,
|
|
9
|
-
changedPaths: [],
|
|
10
|
-
commitSha: null,
|
|
11
|
-
summary: input.branchName ? `Stub repository inspection for ${input.branchName}.` : "No branch to inspect."
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
class GitRepositoryInspectionAdapter {
|
|
16
|
-
async inspectBranch(input) {
|
|
17
|
-
if (!input.branchName) {
|
|
18
|
-
return {
|
|
19
|
-
branchName: null,
|
|
20
|
-
changedPaths: [],
|
|
21
|
-
commitSha: null,
|
|
22
|
-
summary: "No branch to inspect."
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
const { stdout: changedStdout } = await execFileAsync(
|
|
27
|
-
"git",
|
|
28
|
-
["diff", "--name-only", "HEAD~1..HEAD"],
|
|
29
|
-
{ cwd: input.repoRoot, env: process.env }
|
|
30
|
-
);
|
|
31
|
-
const { stdout: shaStdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
32
|
-
cwd: input.repoRoot,
|
|
33
|
-
env: process.env
|
|
34
|
-
});
|
|
35
|
-
const changedPaths = changedStdout.split("\n").map((entry) => entry.trim()).filter(Boolean);
|
|
36
|
-
return {
|
|
37
|
-
branchName: input.branchName,
|
|
38
|
-
changedPaths,
|
|
39
|
-
commitSha: shaStdout.trim() || null,
|
|
40
|
-
summary: `Inspected ${changedPaths.length} changed path(s) on ${input.branchName}.`
|
|
41
|
-
};
|
|
42
|
-
} catch {
|
|
43
|
-
return {
|
|
44
|
-
branchName: input.branchName,
|
|
45
|
-
changedPaths: [],
|
|
46
|
-
commitSha: null,
|
|
47
|
-
summary: `Unable to inspect branch ${input.branchName}.`
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function createRepositoryInspectionAdapter() {
|
|
53
|
-
return String(
|
|
54
|
-
process.env.TREESEED_AGENT_REPOSITORY_PROVIDER ?? getTreeseedAgentProviderSelections().repository
|
|
55
|
-
).toLowerCase() !== "git" ? new StubRepositoryInspectionAdapter() : new GitRepositoryInspectionAdapter();
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
GitRepositoryInspectionAdapter,
|
|
59
|
-
StubRepositoryInspectionAdapter,
|
|
60
|
-
createRepositoryInspectionAdapter
|
|
61
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
class StubResearchAdapter {
|
|
2
|
-
async research(input) {
|
|
3
|
-
return {
|
|
4
|
-
status: "completed",
|
|
5
|
-
summary: `Research prepared for ${input.questionId}.`,
|
|
6
|
-
markdown: [
|
|
7
|
-
"# Research Summary",
|
|
8
|
-
"",
|
|
9
|
-
`Question: ${input.questionId}`,
|
|
10
|
-
`Reason: ${input.reason ?? "not provided"}`,
|
|
11
|
-
`Run: ${input.runId}`,
|
|
12
|
-
"",
|
|
13
|
-
"This is a stub research summary produced by the runtime adapter."
|
|
14
|
-
].join("\n"),
|
|
15
|
-
sources: []
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function createResearchAdapter() {
|
|
20
|
-
return new StubResearchAdapter();
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
StubResearchAdapter,
|
|
24
|
-
createResearchAdapter
|
|
25
|
-
};
|
|
@@ -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";
|