@dexto/agent-management 1.6.13 → 1.6.15

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.
Files changed (49) hide show
  1. package/dist/config/config-enrichment.cjs +24 -7
  2. package/dist/config/config-enrichment.d.ts +5 -0
  3. package/dist/config/config-enrichment.d.ts.map +1 -1
  4. package/dist/config/config-enrichment.js +24 -7
  5. package/dist/config/discover-prompts.cjs +7 -7
  6. package/dist/config/discover-prompts.d.ts +5 -3
  7. package/dist/config/discover-prompts.d.ts.map +1 -1
  8. package/dist/config/discover-prompts.js +7 -7
  9. package/dist/config/error-codes.cjs +1 -0
  10. package/dist/config/error-codes.d.ts +1 -0
  11. package/dist/config/error-codes.d.ts.map +1 -1
  12. package/dist/config/error-codes.js +1 -0
  13. package/dist/config/errors.cjs +12 -2
  14. package/dist/config/errors.d.ts +5 -0
  15. package/dist/config/errors.d.ts.map +1 -1
  16. package/dist/config/errors.js +12 -2
  17. package/dist/index.cjs +37 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +38 -0
  21. package/dist/plugins/discover-skills.cjs +2 -0
  22. package/dist/plugins/discover-skills.d.ts +7 -5
  23. package/dist/plugins/discover-skills.d.ts.map +1 -1
  24. package/dist/plugins/discover-skills.js +2 -0
  25. package/dist/project-registry.cjs +380 -0
  26. package/dist/project-registry.d.ts +153 -0
  27. package/dist/project-registry.d.ts.map +1 -0
  28. package/dist/project-registry.js +329 -0
  29. package/dist/resolver.cjs +23 -2
  30. package/dist/resolver.d.ts.map +1 -1
  31. package/dist/resolver.js +26 -2
  32. package/dist/tool-factories/agent-spawner/factory.cjs +12 -0
  33. package/dist/tool-factories/agent-spawner/factory.d.ts.map +1 -1
  34. package/dist/tool-factories/agent-spawner/factory.js +12 -0
  35. package/dist/tool-factories/agent-spawner/runtime.cjs +189 -27
  36. package/dist/tool-factories/agent-spawner/runtime.d.ts +7 -1
  37. package/dist/tool-factories/agent-spawner/runtime.d.ts.map +1 -1
  38. package/dist/tool-factories/agent-spawner/runtime.js +189 -27
  39. package/dist/tool-factories/agent-spawner/schemas.cjs +6 -3
  40. package/dist/tool-factories/agent-spawner/schemas.d.ts +3 -2
  41. package/dist/tool-factories/agent-spawner/schemas.d.ts.map +1 -1
  42. package/dist/tool-factories/agent-spawner/schemas.js +6 -3
  43. package/dist/tool-factories/agent-spawner/spawn-agent-tool.cjs +4 -3
  44. package/dist/tool-factories/agent-spawner/spawn-agent-tool.d.ts.map +1 -1
  45. package/dist/tool-factories/agent-spawner/spawn-agent-tool.js +4 -3
  46. package/dist/utils/execution-context.cjs +61 -16
  47. package/dist/utils/execution-context.d.ts.map +1 -1
  48. package/dist/utils/execution-context.js +62 -17
  49. package/package.json +5 -5
@@ -1,7 +1,7 @@
1
1
  import { createLocalToolCallHeader, truncateForHeader } from "@dexto/core";
2
2
  import { SpawnAgentInputSchema } from "./schemas.js";
3
- function buildDescription(service) {
4
- const availableAgents = service.getAvailableAgents();
3
+ async function buildDescription(service) {
4
+ const availableAgents = await service.getAvailableAgents();
5
5
  if (availableAgents.length === 0) {
6
6
  return `Spawn a sub-agent to handle a specific task. The sub-agent executes the task and returns the result.
7
7
 
@@ -36,7 +36,8 @@ function createSpawnAgentTool(service) {
36
36
  return {
37
37
  id: "spawn_agent",
38
38
  aliases: ["task"],
39
- description: buildDescription(service),
39
+ description: "Spawn a sub-agent to handle a task and return its result.",
40
+ getDescription: () => buildDescription(service),
40
41
  presentation: {
41
42
  describeHeader: (input) => {
42
43
  const agentLabel = input.agentId ? input.agentId.replace(/-agent$/, "") : null;
@@ -36,11 +36,12 @@ module.exports = __toCommonJS(execution_context_exports);
36
36
  var import_fs_walk = require("./fs-walk.js");
37
37
  var import_fs = require("fs");
38
38
  var path = __toESM(require("path"), 1);
39
- const FORCED_PROJECT_ROOT_MARKERS = [
39
+ const DIRECT_PROJECT_ROOT_MARKERS = [
40
40
  path.join(".dexto", "deploy.json"),
41
41
  path.join(".dexto", "cloud", "bootstrap.json"),
42
42
  "coding-agent.yml",
43
43
  "coding-agent.yaml",
44
+ path.join("agents", "registry.json"),
44
45
  path.join("agents", "agent-registry.json"),
45
46
  path.join("agents", "coding-agent.yml"),
46
47
  path.join("agents", "coding-agent.yaml"),
@@ -49,8 +50,53 @@ const FORCED_PROJECT_ROOT_MARKERS = [
49
50
  path.join("src", "dexto", "agents", "coding-agent.yml"),
50
51
  path.join("src", "dexto", "agents", "coding-agent.yaml")
51
52
  ];
52
- function hasForcedProjectRootMarker(dirPath) {
53
- return FORCED_PROJECT_ROOT_MARKERS.some(
53
+ function getCaseInsensitiveRootFilename(dirPath, filename) {
54
+ try {
55
+ return (0, import_fs.readdirSync)(dirPath).find((entry) => entry.toLowerCase() === filename.toLowerCase()) ?? null;
56
+ } catch {
57
+ return null;
58
+ }
59
+ }
60
+ function hasWorkspaceAuthoringDirectory(dirPath, name) {
61
+ try {
62
+ return (0, import_fs.statSync)(path.join(dirPath, name)).isDirectory();
63
+ } catch {
64
+ return false;
65
+ }
66
+ }
67
+ function hasDextoWorkspaceAgentsFile(dirPath) {
68
+ const agentsFilename = getCaseInsensitiveRootFilename(dirPath, "agents.md");
69
+ if (!agentsFilename) {
70
+ return false;
71
+ }
72
+ try {
73
+ const content = (0, import_fs.readFileSync)(path.join(dirPath, agentsFilename), "utf-8").toLowerCase();
74
+ return content.includes("dexto workspace") || content.includes("dexto-workspace");
75
+ } catch {
76
+ return false;
77
+ }
78
+ }
79
+ function hasWorkspaceScaffoldMarker(dirPath) {
80
+ return hasDextoWorkspaceAgentsFile(dirPath) && (hasWorkspaceAuthoringDirectory(dirPath, "agents") || hasWorkspaceAuthoringDirectory(dirPath, "skills"));
81
+ }
82
+ function readPackageName(dirPath) {
83
+ const packageJsonPath = path.join(dirPath, "package.json");
84
+ try {
85
+ const pkg = JSON.parse((0, import_fs.readFileSync)(packageJsonPath, "utf-8"));
86
+ return typeof pkg.name === "string" ? pkg.name : null;
87
+ } catch {
88
+ return null;
89
+ }
90
+ }
91
+ function isInternalDextoPackage(dirPath) {
92
+ const packageName = readPackageName(dirPath);
93
+ return packageName === "dexto" || packageName?.startsWith("@dexto/") === true;
94
+ }
95
+ function hasProjectRootMarker(dirPath) {
96
+ if (hasWorkspaceScaffoldMarker(dirPath)) {
97
+ return true;
98
+ }
99
+ return DIRECT_PROJECT_ROOT_MARKERS.some(
54
100
  (relativePath) => (0, import_fs.existsSync)(path.join(dirPath, relativePath))
55
101
  );
56
102
  }
@@ -65,7 +111,7 @@ function getForcedProjectRoot() {
65
111
  return null;
66
112
  }
67
113
  const root = (0, import_fs.realpathSync)(resolved);
68
- if (isDextoProjectDirectory(root) || isDextoSourceDirectory(root) || hasForcedProjectRootMarker(root)) {
114
+ if (isDextoProjectDirectory(root) || isDextoSourceDirectory(root) || hasProjectRootMarker(root)) {
69
115
  return root;
70
116
  }
71
117
  return null;
@@ -74,21 +120,20 @@ function getForcedProjectRoot() {
74
120
  }
75
121
  }
76
122
  function isDextoSourceDirectory(dirPath) {
77
- const packageJsonPath = path.join(dirPath, "package.json");
78
- try {
79
- const pkg = JSON.parse((0, import_fs.readFileSync)(packageJsonPath, "utf-8"));
80
- return pkg.name === "dexto-monorepo";
81
- } catch {
82
- return false;
83
- }
123
+ return readPackageName(dirPath) === "dexto-monorepo";
84
124
  }
85
125
  function isDextoProjectDirectory(dirPath) {
86
- const packageJsonPath = path.join(dirPath, "package.json");
126
+ if (isDextoSourceDirectory(dirPath)) {
127
+ return false;
128
+ }
129
+ if (isInternalDextoPackage(dirPath)) {
130
+ return false;
131
+ }
132
+ if (hasProjectRootMarker(dirPath)) {
133
+ return true;
134
+ }
87
135
  try {
88
- const pkg = JSON.parse((0, import_fs.readFileSync)(packageJsonPath, "utf-8"));
89
- if (pkg.name === "dexto" || pkg.name === "@dexto/core" || pkg.name === "@dexto/webui") {
90
- return false;
91
- }
136
+ const pkg = JSON.parse((0, import_fs.readFileSync)(path.join(dirPath, "package.json"), "utf-8"));
92
137
  const allDeps = {
93
138
  ...pkg.dependencies ?? {},
94
139
  ...pkg.devDependencies ?? {},
@@ -1 +1 @@
1
- {"version":3,"file":"execution-context.d.ts","sourceRoot":"","sources":["../../src/utils/execution-context.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,YAAY,CAAC;AA+F/E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAEpF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAMrF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,MAAsB,GAAG,gBAAgB,CAiBvF"}
1
+ {"version":3,"file":"execution-context.d.ts","sourceRoot":"","sources":["../../src/utils/execution-context.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,YAAY,CAAC;AAwJ/E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAEpF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAMrF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,MAAsB,GAAG,gBAAgB,CAiBvF"}
@@ -1,11 +1,12 @@
1
1
  import { walkUpDirectories } from "./fs-walk.js";
2
- import { existsSync, readFileSync, realpathSync, statSync } from "fs";
2
+ import { existsSync, readFileSync, realpathSync, readdirSync, statSync } from "fs";
3
3
  import * as path from "path";
4
- const FORCED_PROJECT_ROOT_MARKERS = [
4
+ const DIRECT_PROJECT_ROOT_MARKERS = [
5
5
  path.join(".dexto", "deploy.json"),
6
6
  path.join(".dexto", "cloud", "bootstrap.json"),
7
7
  "coding-agent.yml",
8
8
  "coding-agent.yaml",
9
+ path.join("agents", "registry.json"),
9
10
  path.join("agents", "agent-registry.json"),
10
11
  path.join("agents", "coding-agent.yml"),
11
12
  path.join("agents", "coding-agent.yaml"),
@@ -14,8 +15,53 @@ const FORCED_PROJECT_ROOT_MARKERS = [
14
15
  path.join("src", "dexto", "agents", "coding-agent.yml"),
15
16
  path.join("src", "dexto", "agents", "coding-agent.yaml")
16
17
  ];
17
- function hasForcedProjectRootMarker(dirPath) {
18
- return FORCED_PROJECT_ROOT_MARKERS.some(
18
+ function getCaseInsensitiveRootFilename(dirPath, filename) {
19
+ try {
20
+ return readdirSync(dirPath).find((entry) => entry.toLowerCase() === filename.toLowerCase()) ?? null;
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+ function hasWorkspaceAuthoringDirectory(dirPath, name) {
26
+ try {
27
+ return statSync(path.join(dirPath, name)).isDirectory();
28
+ } catch {
29
+ return false;
30
+ }
31
+ }
32
+ function hasDextoWorkspaceAgentsFile(dirPath) {
33
+ const agentsFilename = getCaseInsensitiveRootFilename(dirPath, "agents.md");
34
+ if (!agentsFilename) {
35
+ return false;
36
+ }
37
+ try {
38
+ const content = readFileSync(path.join(dirPath, agentsFilename), "utf-8").toLowerCase();
39
+ return content.includes("dexto workspace") || content.includes("dexto-workspace");
40
+ } catch {
41
+ return false;
42
+ }
43
+ }
44
+ function hasWorkspaceScaffoldMarker(dirPath) {
45
+ return hasDextoWorkspaceAgentsFile(dirPath) && (hasWorkspaceAuthoringDirectory(dirPath, "agents") || hasWorkspaceAuthoringDirectory(dirPath, "skills"));
46
+ }
47
+ function readPackageName(dirPath) {
48
+ const packageJsonPath = path.join(dirPath, "package.json");
49
+ try {
50
+ const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
51
+ return typeof pkg.name === "string" ? pkg.name : null;
52
+ } catch {
53
+ return null;
54
+ }
55
+ }
56
+ function isInternalDextoPackage(dirPath) {
57
+ const packageName = readPackageName(dirPath);
58
+ return packageName === "dexto" || packageName?.startsWith("@dexto/") === true;
59
+ }
60
+ function hasProjectRootMarker(dirPath) {
61
+ if (hasWorkspaceScaffoldMarker(dirPath)) {
62
+ return true;
63
+ }
64
+ return DIRECT_PROJECT_ROOT_MARKERS.some(
19
65
  (relativePath) => existsSync(path.join(dirPath, relativePath))
20
66
  );
21
67
  }
@@ -30,7 +76,7 @@ function getForcedProjectRoot() {
30
76
  return null;
31
77
  }
32
78
  const root = realpathSync(resolved);
33
- if (isDextoProjectDirectory(root) || isDextoSourceDirectory(root) || hasForcedProjectRootMarker(root)) {
79
+ if (isDextoProjectDirectory(root) || isDextoSourceDirectory(root) || hasProjectRootMarker(root)) {
34
80
  return root;
35
81
  }
36
82
  return null;
@@ -39,21 +85,20 @@ function getForcedProjectRoot() {
39
85
  }
40
86
  }
41
87
  function isDextoSourceDirectory(dirPath) {
42
- const packageJsonPath = path.join(dirPath, "package.json");
43
- try {
44
- const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
45
- return pkg.name === "dexto-monorepo";
46
- } catch {
47
- return false;
48
- }
88
+ return readPackageName(dirPath) === "dexto-monorepo";
49
89
  }
50
90
  function isDextoProjectDirectory(dirPath) {
51
- const packageJsonPath = path.join(dirPath, "package.json");
91
+ if (isDextoSourceDirectory(dirPath)) {
92
+ return false;
93
+ }
94
+ if (isInternalDextoPackage(dirPath)) {
95
+ return false;
96
+ }
97
+ if (hasProjectRootMarker(dirPath)) {
98
+ return true;
99
+ }
52
100
  try {
53
- const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
54
- if (pkg.name === "dexto" || pkg.name === "@dexto/core" || pkg.name === "@dexto/webui") {
55
- return false;
56
- }
101
+ const pkg = JSON.parse(readFileSync(path.join(dirPath, "package.json"), "utf-8"));
57
102
  const allDeps = {
58
103
  ...pkg.dependencies ?? {},
59
104
  ...pkg.devDependencies ?? {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/agent-management",
3
- "version": "1.6.13",
3
+ "version": "1.6.15",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,10 +16,10 @@
16
16
  "dependencies": {
17
17
  "yaml": "^2.7.1",
18
18
  "zod": "^3.25.0",
19
- "@dexto/agent-config": "1.6.13",
20
- "@dexto/core": "1.6.13",
21
- "@dexto/orchestration": "1.6.13",
22
- "@dexto/tools-builtins": "1.6.13"
19
+ "@dexto/agent-config": "1.6.15",
20
+ "@dexto/core": "1.6.15",
21
+ "@dexto/orchestration": "1.6.15",
22
+ "@dexto/tools-builtins": "1.6.15"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^22.13.5"