@dexto/agent-management 1.6.21 → 1.6.24

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.
@@ -133,6 +133,34 @@ const PROJECT_REGISTRY_RELATIVE_PATHS = [
133
133
  import_path.default.join("agents", "registry.json"),
134
134
  import_path.default.join("agents", "agent-registry.json")
135
135
  ];
136
+ function isBundledAgentRegistryShape(parsed) {
137
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
138
+ return false;
139
+ }
140
+ const candidate = parsed;
141
+ return typeof candidate.version === "string" && candidate.agents !== null && typeof candidate.agents === "object" && !Array.isArray(candidate.agents);
142
+ }
143
+ async function shouldIgnoreProjectRegistryCandidate(registryPath) {
144
+ if (import_path.default.basename(registryPath) !== "agent-registry.json") {
145
+ return false;
146
+ }
147
+ try {
148
+ const content = await import_fs2.promises.readFile(registryPath, "utf-8");
149
+ return isBundledAgentRegistryShape(JSON.parse(content));
150
+ } catch {
151
+ return false;
152
+ }
153
+ }
154
+ function shouldIgnoreProjectRegistryCandidateSync(registryPath) {
155
+ if (import_path.default.basename(registryPath) !== "agent-registry.json") {
156
+ return false;
157
+ }
158
+ try {
159
+ return isBundledAgentRegistryShape(JSON.parse((0, import_fs.readFileSync)(registryPath, "utf-8")));
160
+ } catch {
161
+ return false;
162
+ }
163
+ }
136
164
  function getProjectRegistryPath(projectRoot) {
137
165
  return import_path.default.join(projectRoot, "agents", "registry.json");
138
166
  }
@@ -145,6 +173,9 @@ async function findProjectRegistryPath(projectRoot) {
145
173
  for (const registryPath of getProjectRegistryCandidatePaths(projectRoot)) {
146
174
  try {
147
175
  if ((await import_fs2.promises.stat(registryPath)).isFile()) {
176
+ if (await shouldIgnoreProjectRegistryCandidate(registryPath)) {
177
+ continue;
178
+ }
148
179
  return registryPath;
149
180
  }
150
181
  } catch (error) {
@@ -160,6 +191,9 @@ function findProjectRegistryPathSync(projectRoot) {
160
191
  for (const registryPath of getProjectRegistryCandidatePaths(projectRoot)) {
161
192
  try {
162
193
  if ((0, import_fs.existsSync)(registryPath) && (0, import_fs.statSync)(registryPath).isFile()) {
194
+ if (shouldIgnoreProjectRegistryCandidateSync(registryPath)) {
195
+ continue;
196
+ }
163
197
  return registryPath;
164
198
  }
165
199
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"project-registry.d.ts","sourceRoot":"","sources":["../src/project-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;EAU1B,CAAC;AAEd,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgC5B,CAAC;AAEP,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAC9B,0BAA0B,GAC1B,kCAAkC,GAClC,sCAAsC,CAAC;AAE7C,qBAAa,oBAAqB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE5B,OAAO,EAAE;QACjB,IAAI,EAAE,wBAAwB,CAAC;QAC/B,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,KAAK,CAAC,EAAE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AAC,MAAM,GAAG,IAAI,CAAC,CAYxB"}
@@ -83,6 +83,34 @@ const PROJECT_REGISTRY_RELATIVE_PATHS = [
83
83
  path.join("agents", "registry.json"),
84
84
  path.join("agents", "agent-registry.json")
85
85
  ];
86
+ function isBundledAgentRegistryShape(parsed) {
87
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
88
+ return false;
89
+ }
90
+ const candidate = parsed;
91
+ return typeof candidate.version === "string" && candidate.agents !== null && typeof candidate.agents === "object" && !Array.isArray(candidate.agents);
92
+ }
93
+ async function shouldIgnoreProjectRegistryCandidate(registryPath) {
94
+ if (path.basename(registryPath) !== "agent-registry.json") {
95
+ return false;
96
+ }
97
+ try {
98
+ const content = await fs.readFile(registryPath, "utf-8");
99
+ return isBundledAgentRegistryShape(JSON.parse(content));
100
+ } catch {
101
+ return false;
102
+ }
103
+ }
104
+ function shouldIgnoreProjectRegistryCandidateSync(registryPath) {
105
+ if (path.basename(registryPath) !== "agent-registry.json") {
106
+ return false;
107
+ }
108
+ try {
109
+ return isBundledAgentRegistryShape(JSON.parse(readFileSync(registryPath, "utf-8")));
110
+ } catch {
111
+ return false;
112
+ }
113
+ }
86
114
  function getProjectRegistryPath(projectRoot) {
87
115
  return path.join(projectRoot, "agents", "registry.json");
88
116
  }
@@ -95,6 +123,9 @@ async function findProjectRegistryPath(projectRoot) {
95
123
  for (const registryPath of getProjectRegistryCandidatePaths(projectRoot)) {
96
124
  try {
97
125
  if ((await fs.stat(registryPath)).isFile()) {
126
+ if (await shouldIgnoreProjectRegistryCandidate(registryPath)) {
127
+ continue;
128
+ }
98
129
  return registryPath;
99
130
  }
100
131
  } catch (error) {
@@ -110,6 +141,9 @@ function findProjectRegistryPathSync(projectRoot) {
110
141
  for (const registryPath of getProjectRegistryCandidatePaths(projectRoot)) {
111
142
  try {
112
143
  if (existsSync(registryPath) && statSync(registryPath).isFile()) {
144
+ if (shouldIgnoreProjectRegistryCandidateSync(registryPath)) {
145
+ continue;
146
+ }
113
147
  return registryPath;
114
148
  }
115
149
  } catch (error) {
@@ -28,45 +28,53 @@ var import_zod = require("zod");
28
28
  var import_core = require("@dexto/core");
29
29
  const AUTH_CONFIG_FILE = "auth.json";
30
30
  const AuthConfigSchema = import_zod.z.object({
31
- token: import_zod.z.string().min(1),
31
+ token: import_zod.z.string().min(1).optional(),
32
+ refreshToken: import_zod.z.string().optional(),
32
33
  expiresAt: import_zod.z.number().optional(),
33
- dextoApiKey: import_zod.z.string().optional()
34
+ createdAt: import_zod.z.number().optional(),
35
+ dextoApiKey: import_zod.z.string().optional(),
36
+ dextoKeyId: import_zod.z.string().optional(),
37
+ dextoApiKeySource: import_zod.z.enum(["provisioned", "user-supplied"]).optional()
38
+ }).refine((data) => data.token || data.dextoApiKey, {
39
+ message: "Either token or dextoApiKey is required"
34
40
  });
35
- async function isDextoAuthenticated() {
41
+ async function loadAuthConfig() {
36
42
  const authPath = (0, import_core.getDextoGlobalPath)("", AUTH_CONFIG_FILE);
37
43
  if (!(0, import_fs.existsSync)(authPath)) {
38
- return false;
44
+ return null;
39
45
  }
40
46
  try {
41
47
  const content = await import_fs.promises.readFile(authPath, "utf-8");
42
48
  const config = JSON.parse(content);
43
49
  const validated = AuthConfigSchema.safeParse(config);
44
50
  if (!validated.success) {
45
- return false;
51
+ return null;
46
52
  }
47
- if (validated.data.expiresAt && validated.data.expiresAt < Date.now()) {
48
- return false;
53
+ const auth = validated.data;
54
+ if (auth.expiresAt && auth.expiresAt < Date.now()) {
55
+ if (!auth.refreshToken && !auth.dextoApiKey) {
56
+ return null;
57
+ }
49
58
  }
50
- return true;
59
+ return auth;
51
60
  } catch {
52
- return false;
61
+ return null;
53
62
  }
54
63
  }
64
+ async function isDextoAuthenticated() {
65
+ return await loadAuthConfig() !== null;
66
+ }
55
67
  async function getDextoApiKeyFromAuth() {
56
- if (process.env.DEXTO_API_KEY) {
57
- return process.env.DEXTO_API_KEY;
58
- }
59
- const authPath = (0, import_core.getDextoGlobalPath)("", AUTH_CONFIG_FILE);
60
- if (!(0, import_fs.existsSync)(authPath)) {
61
- return null;
68
+ const auth = await loadAuthConfig();
69
+ if (auth?.dextoApiKey?.trim()) {
70
+ const apiKey = auth.dextoApiKey.trim();
71
+ process.env.DEXTO_API_KEY = apiKey;
72
+ return apiKey;
62
73
  }
63
- try {
64
- const content = await import_fs.promises.readFile(authPath, "utf-8");
65
- const config = JSON.parse(content);
66
- return config.dextoApiKey || null;
67
- } catch {
68
- return null;
74
+ if (process.env.DEXTO_API_KEY?.trim()) {
75
+ return process.env.DEXTO_API_KEY;
69
76
  }
77
+ return null;
70
78
  }
71
79
  async function canUseDextoProvider() {
72
80
  const authenticated = await isDextoAuthenticated();
@@ -6,7 +6,7 @@
6
6
  */
7
7
  /**
8
8
  * Check if user is authenticated with Dexto.
9
- * Returns true if auth.json exists with valid (non-expired) token.
9
+ * Returns true when auth.json contains usable Dexto auth state.
10
10
  */
11
11
  export declare function isDextoAuthenticated(): Promise<boolean>;
12
12
  /**
@@ -16,7 +16,7 @@ export declare function getDextoApiKeyFromAuth(): Promise<string | null>;
16
16
  /**
17
17
  * Check if user can use Dexto provider.
18
18
  * Requires BOTH:
19
- * 1. User is authenticated (valid auth token)
19
+ * 1. User has usable Dexto auth state (token, refresh-backed login, or stored API key)
20
20
  * 2. Has DEXTO_API_KEY (from auth config or environment)
21
21
  */
22
22
  export declare function canUseDextoProvider(): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"dexto-auth.d.ts","sourceRoot":"","sources":["../../src/utils/dexto-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAyB7D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBrE;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAQ5D"}
1
+ {"version":3,"file":"dexto-auth.d.ts","sourceRoot":"","sources":["../../src/utils/dexto-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4DH;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAE7D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAarE;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAQ5D"}
@@ -3,45 +3,53 @@ import { z } from "zod";
3
3
  import { getDextoGlobalPath } from "@dexto/core";
4
4
  const AUTH_CONFIG_FILE = "auth.json";
5
5
  const AuthConfigSchema = z.object({
6
- token: z.string().min(1),
6
+ token: z.string().min(1).optional(),
7
+ refreshToken: z.string().optional(),
7
8
  expiresAt: z.number().optional(),
8
- dextoApiKey: z.string().optional()
9
+ createdAt: z.number().optional(),
10
+ dextoApiKey: z.string().optional(),
11
+ dextoKeyId: z.string().optional(),
12
+ dextoApiKeySource: z.enum(["provisioned", "user-supplied"]).optional()
13
+ }).refine((data) => data.token || data.dextoApiKey, {
14
+ message: "Either token or dextoApiKey is required"
9
15
  });
10
- async function isDextoAuthenticated() {
16
+ async function loadAuthConfig() {
11
17
  const authPath = getDextoGlobalPath("", AUTH_CONFIG_FILE);
12
18
  if (!existsSync(authPath)) {
13
- return false;
19
+ return null;
14
20
  }
15
21
  try {
16
22
  const content = await fs.readFile(authPath, "utf-8");
17
23
  const config = JSON.parse(content);
18
24
  const validated = AuthConfigSchema.safeParse(config);
19
25
  if (!validated.success) {
20
- return false;
26
+ return null;
21
27
  }
22
- if (validated.data.expiresAt && validated.data.expiresAt < Date.now()) {
23
- return false;
28
+ const auth = validated.data;
29
+ if (auth.expiresAt && auth.expiresAt < Date.now()) {
30
+ if (!auth.refreshToken && !auth.dextoApiKey) {
31
+ return null;
32
+ }
24
33
  }
25
- return true;
34
+ return auth;
26
35
  } catch {
27
- return false;
36
+ return null;
28
37
  }
29
38
  }
39
+ async function isDextoAuthenticated() {
40
+ return await loadAuthConfig() !== null;
41
+ }
30
42
  async function getDextoApiKeyFromAuth() {
31
- if (process.env.DEXTO_API_KEY) {
32
- return process.env.DEXTO_API_KEY;
33
- }
34
- const authPath = getDextoGlobalPath("", AUTH_CONFIG_FILE);
35
- if (!existsSync(authPath)) {
36
- return null;
43
+ const auth = await loadAuthConfig();
44
+ if (auth?.dextoApiKey?.trim()) {
45
+ const apiKey = auth.dextoApiKey.trim();
46
+ process.env.DEXTO_API_KEY = apiKey;
47
+ return apiKey;
37
48
  }
38
- try {
39
- const content = await fs.readFile(authPath, "utf-8");
40
- const config = JSON.parse(content);
41
- return config.dextoApiKey || null;
42
- } catch {
43
- return null;
49
+ if (process.env.DEXTO_API_KEY?.trim()) {
50
+ return process.env.DEXTO_API_KEY;
44
51
  }
52
+ return null;
45
53
  }
46
54
  async function canUseDextoProvider() {
47
55
  const authenticated = await isDextoAuthenticated();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/agent-management",
3
- "version": "1.6.21",
3
+ "version": "1.6.24",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,10 +17,10 @@
17
17
  "dependencies": {
18
18
  "yaml": "^2.8.3",
19
19
  "zod": "^3.25.0",
20
- "@dexto/agent-config": "1.6.21",
21
- "@dexto/core": "1.6.21",
22
- "@dexto/orchestration": "1.6.21",
23
- "@dexto/tools-builtins": "1.6.21"
20
+ "@dexto/agent-config": "1.6.24",
21
+ "@dexto/core": "1.6.24",
22
+ "@dexto/orchestration": "1.6.24",
23
+ "@dexto/tools-builtins": "1.6.24"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^22.13.5"