@treeseed/core 0.8.12 → 0.8.14
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/dist/content.js +40 -3
- package/dist/dev.js +30 -1
- package/package.json +2 -2
package/dist/content.js
CHANGED
|
@@ -27,7 +27,7 @@ const decisionTypeValues = ["approved", "rejected", "deferred", "superseded"];
|
|
|
27
27
|
const timeHorizonValues = ["near-term", "mid-term", "long-term"];
|
|
28
28
|
const runtimeStatusValues = ["active", "experimental", "dormant"];
|
|
29
29
|
const agentTriggerTypeValues = ["schedule", "message", "follow", "startup"];
|
|
30
|
-
const agentPermissionOperationValues = ["get", "search", "follow", "pick", "create", "update"];
|
|
30
|
+
const agentPermissionOperationValues = ["get", "read", "search", "follow", "pick", "create", "update"];
|
|
31
31
|
const treeseedDocsExtensions = ["markdown", "mdown", "mkdn", "mkd", "mdwn", "md", "mdx"];
|
|
32
32
|
function hasMarkdownContent(base) {
|
|
33
33
|
if (!existsSync(base)) {
|
|
@@ -274,13 +274,27 @@ function createTreeseedCollections(tenantConfig, { docsLoader, docsSchema }) {
|
|
|
274
274
|
model: z.string(),
|
|
275
275
|
operations: z.array(z.enum(agentPermissionOperationValues)).min(1)
|
|
276
276
|
});
|
|
277
|
+
const agentWorktreeSchema = z.object({
|
|
278
|
+
enabled: z.boolean().default(true),
|
|
279
|
+
root: z.string().optional(),
|
|
280
|
+
branchPrefix: z.string().optional()
|
|
281
|
+
});
|
|
277
282
|
const agentExecutionSchema = z.object({
|
|
283
|
+
provider: z.string().optional(),
|
|
284
|
+
model: z.string().optional(),
|
|
285
|
+
approvalPolicy: z.string().optional(),
|
|
286
|
+
sandboxMode: z.string().optional(),
|
|
287
|
+
reasoningEffort: z.string().optional(),
|
|
288
|
+
allowedPaths: z.array(z.string()).default([]),
|
|
289
|
+
forbiddenPaths: z.array(z.string()).default([]),
|
|
290
|
+
worktree: agentWorktreeSchema.default({}),
|
|
278
291
|
maxConcurrency: z.number().int().positive().default(1),
|
|
279
292
|
timeoutSeconds: z.number().int().positive().default(900),
|
|
280
293
|
cooldownSeconds: z.number().int().nonnegative().default(30),
|
|
281
294
|
leaseSeconds: z.number().int().positive().default(300),
|
|
282
295
|
retryLimit: z.number().int().nonnegative().default(3),
|
|
283
|
-
branchPrefix: z.string().default("agent")
|
|
296
|
+
branchPrefix: z.string().default("agent"),
|
|
297
|
+
providerProfile: z.record(z.unknown()).optional()
|
|
284
298
|
});
|
|
285
299
|
const agentTriggerPolicySchema = z.object({
|
|
286
300
|
maxRunsPerCycle: z.number().int().positive().optional(),
|
|
@@ -290,6 +304,27 @@ function createTreeseedCollections(tenantConfig, { docsLoader, docsSchema }) {
|
|
|
290
304
|
messageTypes: z.array(z.string()).default([]),
|
|
291
305
|
modelMutations: z.array(z.string()).default([])
|
|
292
306
|
});
|
|
307
|
+
const agentContextQuerySchema = z.object({
|
|
308
|
+
id: z.string(),
|
|
309
|
+
purpose: z.string(),
|
|
310
|
+
query: z.string(),
|
|
311
|
+
scope: z.string().optional(),
|
|
312
|
+
relations: z.array(z.string()).optional(),
|
|
313
|
+
depth: z.number().optional(),
|
|
314
|
+
budget: z.number().optional(),
|
|
315
|
+
format: z.string().optional()
|
|
316
|
+
});
|
|
317
|
+
const agentContextSchema = z.object({
|
|
318
|
+
queries: z.array(agentContextQuerySchema).default([])
|
|
319
|
+
});
|
|
320
|
+
const agentGovernanceSchema = z.object({
|
|
321
|
+
mutationClass: z.string().optional(),
|
|
322
|
+
approvalRequiredForCanonicalContent: z.boolean().optional(),
|
|
323
|
+
approvalRequiredForCode: z.boolean().optional(),
|
|
324
|
+
requireSourceMap: z.boolean().optional(),
|
|
325
|
+
requireHumanApproval: z.boolean().optional(),
|
|
326
|
+
notes: z.array(z.string()).default([])
|
|
327
|
+
}).passthrough();
|
|
293
328
|
const peopleSchema = z.object({
|
|
294
329
|
name: z.string(),
|
|
295
330
|
description: z.string(),
|
|
@@ -322,8 +357,10 @@ function createTreeseedCollections(tenantConfig, { docsLoader, docsSchema }) {
|
|
|
322
357
|
triggers: z.array(agentTriggerSchema).min(1),
|
|
323
358
|
triggerPolicy: agentTriggerPolicySchema.optional(),
|
|
324
359
|
permissions: z.array(agentPermissionSchema).min(1),
|
|
360
|
+
context: agentContextSchema.optional(),
|
|
325
361
|
execution: agentExecutionSchema.default({}),
|
|
326
|
-
outputs: agentOutputSchema.default({})
|
|
362
|
+
outputs: agentOutputSchema.default({}),
|
|
363
|
+
governance: agentGovernanceSchema.optional()
|
|
327
364
|
}));
|
|
328
365
|
const bookSchema = z.preprocess((value) => preprocessAliasedRecord(bookFieldAliases, value), z.object({
|
|
329
366
|
order: z.number().int().nonnegative(),
|
package/dist/dev.js
CHANGED
|
@@ -453,6 +453,7 @@ function createAgentCommand(id, tenantRoot, agentPackageRoot, sharedEnv, apiHost
|
|
|
453
453
|
};
|
|
454
454
|
const config = configs[id];
|
|
455
455
|
const entrypoint = resolveNodeEntrypoint(agentPackageRoot, config.source, config.dist);
|
|
456
|
+
const explicitAgentPersistTo = sharedEnv.TREESEED_AGENT_D1_PERSIST_TO?.trim();
|
|
456
457
|
return {
|
|
457
458
|
id,
|
|
458
459
|
label: config.label,
|
|
@@ -463,7 +464,7 @@ function createAgentCommand(id, tenantRoot, agentPackageRoot, sharedEnv, apiHost
|
|
|
463
464
|
...sharedEnv,
|
|
464
465
|
TREESEED_AGENT_REPO_ROOT: tenantRoot,
|
|
465
466
|
TREESEED_AGENT_D1_DATABASE: sharedEnv.TREESEED_API_D1_DATABASE_NAME ?? "SITE_DATA_DB",
|
|
466
|
-
TREESEED_AGENT_D1_PERSIST_TO:
|
|
467
|
+
...explicitAgentPersistTo ? { TREESEED_AGENT_D1_PERSIST_TO: explicitAgentPersistTo } : {},
|
|
467
468
|
TREESEED_ENVIRONMENT: sharedEnv.TREESEED_ENVIRONMENT ?? "local",
|
|
468
469
|
...config.extraEnv
|
|
469
470
|
},
|
|
@@ -519,6 +520,8 @@ function createTreeseedIntegratedDevPlan(options = {}) {
|
|
|
519
520
|
const sharedEnv = {
|
|
520
521
|
...mergedEnv,
|
|
521
522
|
TREESEED_LOCAL_DEV_MODE: mergedEnv.TREESEED_LOCAL_DEV_MODE ?? "cloudflare",
|
|
523
|
+
TREESEED_SITE_URL: mergedEnv.TREESEED_SITE_URL ?? webUrl,
|
|
524
|
+
BETTER_AUTH_URL: mergedEnv.BETTER_AUTH_URL ?? webUrl,
|
|
522
525
|
TREESEED_API_BASE_URL: apiBaseUrl,
|
|
523
526
|
TREESEED_MARKET_API_BASE_URL: mergedEnv.TREESEED_MARKET_API_BASE_URL ?? apiBaseUrl,
|
|
524
527
|
TREESEED_PROJECT_ID: projectId ?? mergedEnv.TREESEED_PROJECT_ID,
|
|
@@ -949,6 +952,25 @@ function writePlan(plan, options, write) {
|
|
|
949
952
|
}
|
|
950
953
|
}
|
|
951
954
|
function attachPrefixedLogReader(child, surface, options, write) {
|
|
955
|
+
const filterState = {
|
|
956
|
+
stdout: { suppressWorkerdBrokenPipeBlock: false },
|
|
957
|
+
stderr: { suppressWorkerdBrokenPipeBlock: false }
|
|
958
|
+
};
|
|
959
|
+
function shouldSuppressLogLine(line, name) {
|
|
960
|
+
const state = filterState[name];
|
|
961
|
+
if (state.suppressWorkerdBrokenPipeBlock) {
|
|
962
|
+
const trimmed = line.trim();
|
|
963
|
+
if (!trimmed || trimmed.startsWith("stack:") || line.includes("/workerd@")) {
|
|
964
|
+
return true;
|
|
965
|
+
}
|
|
966
|
+
state.suppressWorkerdBrokenPipeBlock = false;
|
|
967
|
+
}
|
|
968
|
+
if (line.includes("kj::getCaughtExceptionAsKj() = kj/async-io-unix.c++:186: disconnected: ::write")) {
|
|
969
|
+
state.suppressWorkerdBrokenPipeBlock = true;
|
|
970
|
+
return true;
|
|
971
|
+
}
|
|
972
|
+
return false;
|
|
973
|
+
}
|
|
952
974
|
function attach(stream, name) {
|
|
953
975
|
if (!stream || typeof stream.on !== "function") {
|
|
954
976
|
return;
|
|
@@ -963,6 +985,9 @@ function attachPrefixedLogReader(child, surface, options, write) {
|
|
|
963
985
|
}
|
|
964
986
|
const line = buffer.slice(0, newlineIndex);
|
|
965
987
|
buffer = buffer.slice(newlineIndex + 1);
|
|
988
|
+
if (shouldSuppressLogLine(line, name)) {
|
|
989
|
+
continue;
|
|
990
|
+
}
|
|
966
991
|
if (options.json) {
|
|
967
992
|
emitEvent(options, write, { type: "log", surface, message: line, detail: { stream: name } }, name);
|
|
968
993
|
} else {
|
|
@@ -973,6 +998,10 @@ function attachPrefixedLogReader(child, surface, options, write) {
|
|
|
973
998
|
});
|
|
974
999
|
stream.on("end", () => {
|
|
975
1000
|
if (buffer.length > 0) {
|
|
1001
|
+
if (shouldSuppressLogLine(buffer, name)) {
|
|
1002
|
+
buffer = "";
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
976
1005
|
if (options.json) {
|
|
977
1006
|
emitEvent(options, write, { type: "log", surface, message: buffer, detail: { stream: name } }, name);
|
|
978
1007
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeseed/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.14",
|
|
4
4
|
"description": "Treeseed web framework package for Astro/Starlight site runtimes.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@astrojs/sitemap": "3.7.0",
|
|
71
71
|
"@astrojs/starlight": "0.37.6",
|
|
72
72
|
"@tailwindcss/vite": "^4.1.4",
|
|
73
|
-
"@treeseed/sdk": "0.8.
|
|
73
|
+
"@treeseed/sdk": "0.8.14",
|
|
74
74
|
"astro": "^5.6.1",
|
|
75
75
|
"esbuild": "^0.28.0",
|
|
76
76
|
"katex": "^0.16.22",
|