@agentuity/migrate 3.0.0-alpha.6 → 3.0.0-alpha.7
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/detect-v3.d.ts.map +1 -1
- package/dist/detect-v3.js +4 -3
- package/dist/detect-v3.js.map +1 -1
- package/dist/migrate-v3.d.ts.map +1 -1
- package/dist/migrate-v3.js +188 -5
- package/dist/migrate-v3.js.map +1 -1
- package/dist/transforms/v3/agents.d.ts +10 -3
- package/dist/transforms/v3/agents.d.ts.map +1 -1
- package/dist/transforms/v3/agents.js +256 -7
- package/dist/transforms/v3/agents.js.map +1 -1
- package/dist/transforms/v3/package-json.d.ts +2 -0
- package/dist/transforms/v3/package-json.d.ts.map +1 -1
- package/dist/transforms/v3/package-json.js +48 -2
- package/dist/transforms/v3/package-json.js.map +1 -1
- package/dist/transforms/v3/routes.d.ts +63 -4
- package/dist/transforms/v3/routes.d.ts.map +1 -1
- package/dist/transforms/v3/routes.js +131 -15
- package/dist/transforms/v3/routes.js.map +1 -1
- package/dist/transforms/v3/schema-to-zod.d.ts +18 -0
- package/dist/transforms/v3/schema-to-zod.d.ts.map +1 -0
- package/dist/transforms/v3/schema-to-zod.js +140 -0
- package/dist/transforms/v3/schema-to-zod.js.map +1 -0
- package/package.json +2 -3
- package/src/detect-v3.ts +5 -3
- package/src/migrate-v3.ts +208 -4
- package/src/transforms/v3/agents.ts +289 -7
- package/src/transforms/v3/package-json.ts +52 -2
- package/src/transforms/v3/routes.ts +195 -7
- package/src/transforms/v3/schema-to-zod.ts +162 -0
|
@@ -9,21 +9,27 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import ts from 'typescript';
|
|
11
11
|
import { relative, dirname } from 'node:path';
|
|
12
|
-
/**
|
|
13
|
-
* Rewrite c.var.* service access patterns to direct imports.
|
|
14
|
-
*
|
|
15
|
-
* @param source - File source text
|
|
16
|
-
* @param usage - Detected service usage info
|
|
17
|
-
* @param servicesRelativePath - Relative import path to services module (e.g., '../services')
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Remove all imports from @agentuity/runtime.
|
|
21
|
-
* In v3, this package is a deprecation stub — nothing should be imported from it.
|
|
22
|
-
*/
|
|
23
12
|
export function removeRuntimeImports(source) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
let needsEnvType = false;
|
|
14
|
+
let hadAgentuityValidator = false;
|
|
15
|
+
let removed = false;
|
|
16
|
+
// Match both `import { ... } from '@agentuity/runtime'` and
|
|
17
|
+
// `import type { ... } from '@agentuity/runtime'` (incl. multiline).
|
|
18
|
+
const pattern = /import\s+(?:type\s+)?\{([^}]*)\}\s*from\s*['"]@agentuity\/runtime['"]\s*;?\s*\n?/g;
|
|
19
|
+
const output = source.replace(pattern, (_match, inner) => {
|
|
20
|
+
removed = true;
|
|
21
|
+
const names = inner
|
|
22
|
+
.split(',')
|
|
23
|
+
.map((s) => s.trim())
|
|
24
|
+
.map((s) => s.replace(/^type\s+/, ''))
|
|
25
|
+
.filter(Boolean);
|
|
26
|
+
if (names.includes('Env'))
|
|
27
|
+
needsEnvType = true;
|
|
28
|
+
if (names.includes('validator'))
|
|
29
|
+
hadAgentuityValidator = true;
|
|
30
|
+
return '';
|
|
31
|
+
});
|
|
32
|
+
return { source: output, removed, needsEnvType, hadAgentuityValidator };
|
|
27
33
|
}
|
|
28
34
|
export function transformRouteServices(source, usage, servicesRelativePath) {
|
|
29
35
|
let output = source;
|
|
@@ -34,6 +40,29 @@ export function transformRouteServices(source, usage, servicesRelativePath) {
|
|
|
34
40
|
if (runtimeCleanup.removed) {
|
|
35
41
|
output = runtimeCleanup.source;
|
|
36
42
|
changes.push('Removed @agentuity/runtime imports');
|
|
43
|
+
// Re-route Env to the generated types file
|
|
44
|
+
if (runtimeCleanup.needsEnvType) {
|
|
45
|
+
output = insertAfterImports(output, "import type { Env } from '../types/hono-env';");
|
|
46
|
+
changes.push("Added: import type { Env } from '../types/hono-env'");
|
|
47
|
+
}
|
|
48
|
+
// Strip v2-era validator middleware calls that have no v3 equivalent.
|
|
49
|
+
const stripped = stripAgentuityValidators(output);
|
|
50
|
+
if (stripped.changed) {
|
|
51
|
+
output = stripped.source;
|
|
52
|
+
changes.push(...stripped.changes);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Rewrite v2-era agent method calls in route files.
|
|
56
|
+
const agentRewrite = rewriteV2AgentMethods(output);
|
|
57
|
+
if (agentRewrite.changed) {
|
|
58
|
+
output = agentRewrite.source;
|
|
59
|
+
changes.push(...agentRewrite.changes);
|
|
60
|
+
}
|
|
61
|
+
// Stub out c.var.thread / c.var.sessionId — v2 concepts with no v3 replacement.
|
|
62
|
+
const stubRewrite = stubV2HonoContext(output);
|
|
63
|
+
if (stubRewrite.changed) {
|
|
64
|
+
output = stubRewrite.source;
|
|
65
|
+
changes.push(...stubRewrite.changes);
|
|
37
66
|
}
|
|
38
67
|
if (usage.accessPattern === 'c.var') {
|
|
39
68
|
// Replace c.var.serviceName patterns
|
|
@@ -127,7 +156,94 @@ export function computeServicesRelativePath(projectDir, sourceFilePath) {
|
|
|
127
156
|
// ---------------------------------------------------------------------------
|
|
128
157
|
// Helpers
|
|
129
158
|
// ---------------------------------------------------------------------------
|
|
130
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Rewrite v2-era agent method invocations to plain function calls in route
|
|
161
|
+
* files.
|
|
162
|
+
*
|
|
163
|
+
* translate.run(data) → translate(data)
|
|
164
|
+
* translate.validator() → /* stripped above * /
|
|
165
|
+
*
|
|
166
|
+
* We also rewrite `c.req.valid('json')` → `await c.req.json()` — the former
|
|
167
|
+
* was the output of the v2 validator middleware that we stripped.
|
|
168
|
+
*/
|
|
169
|
+
export function rewriteV2AgentMethods(source) {
|
|
170
|
+
let output = source;
|
|
171
|
+
const changes = [];
|
|
172
|
+
// <agent>.run(x) → <agent>(x)
|
|
173
|
+
const before1 = output;
|
|
174
|
+
output = output.replace(/\b([A-Za-z_$][A-Za-z0-9_$]*)\.run\(/g, (_m, name) => `${name}(`);
|
|
175
|
+
if (output !== before1) {
|
|
176
|
+
changes.push('Rewrote <agent>.run(…) → <agent>(…)');
|
|
177
|
+
}
|
|
178
|
+
// c.req.valid('json') → (await c.req.json())
|
|
179
|
+
const before2 = output;
|
|
180
|
+
output = output.replace(/\bc\.req\.valid\(\s*['"]json['"]\s*\)/g, '(await c.req.json())');
|
|
181
|
+
if (output !== before2) {
|
|
182
|
+
changes.push("Rewrote c.req.valid('json') → await c.req.json()");
|
|
183
|
+
}
|
|
184
|
+
return { source: output, changed: changes.length > 0, changes };
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Stub out v2-era Hono context variables that no longer exist in v3.
|
|
188
|
+
*
|
|
189
|
+
* v3's Services interface only includes storage clients (kv, vector, stream,
|
|
190
|
+
* etc.). Thread state, sessionId, and app-level state were removed when v3
|
|
191
|
+
* dropped the createApp() abstraction.
|
|
192
|
+
*/
|
|
193
|
+
export function stubV2HonoContext(source) {
|
|
194
|
+
let output = source;
|
|
195
|
+
const changes = new Set();
|
|
196
|
+
// c.var.thread.* — stub out the whole chain as `(undefined as any)`.
|
|
197
|
+
//
|
|
198
|
+
// The chain can include:
|
|
199
|
+
// • Dotted property access: c.var.thread.state
|
|
200
|
+
// • Generic type arguments: .get<HistoryEntry[]>
|
|
201
|
+
// • Call sites: .get<T>('key')
|
|
202
|
+
// • Multiple chained calls: .state.push(…).something()
|
|
203
|
+
//
|
|
204
|
+
// We do this greedily by chaining an alternation until we hit a terminator.
|
|
205
|
+
const before1 = output;
|
|
206
|
+
output = output.replace(/c\.var\.thread(?:\.[A-Za-z0-9_$]+|<[^>]*>|\([^()]*\))*/g, '(undefined as any) /* v3: c.var.thread removed */');
|
|
207
|
+
if (output !== before1) {
|
|
208
|
+
changes.add('Stubbed c.var.thread.* (removed in v3)');
|
|
209
|
+
}
|
|
210
|
+
const before2 = output;
|
|
211
|
+
output = output.replace(/c\.var\.sessionId\b/g, "('v3-no-session-id' as string) /* v3: c.var.sessionId removed */");
|
|
212
|
+
if (output !== before2) {
|
|
213
|
+
changes.add('Stubbed c.var.sessionId (removed in v3)');
|
|
214
|
+
}
|
|
215
|
+
return { source: output, changed: changes.size > 0, changes: [...changes] };
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Strip v2 validator middleware from a source string.
|
|
219
|
+
*
|
|
220
|
+
* Removes two shapes:
|
|
221
|
+
* - `validator({ input: ... })` / `validator({ output: ... })` imported
|
|
222
|
+
* from @agentuity/runtime (used as Hono middleware)
|
|
223
|
+
* - `<agent>.validator()` — the auto-generated method on v2 agents used as
|
|
224
|
+
* middleware on routes that forward to the agent
|
|
225
|
+
*
|
|
226
|
+
* Both become comments so the file parses but the user can see where to wire
|
|
227
|
+
* up manual validation (typically via `zod.parse(await c.req.json())`).
|
|
228
|
+
*/
|
|
229
|
+
export function stripAgentuityValidators(source) {
|
|
230
|
+
let output = source;
|
|
231
|
+
const changes = [];
|
|
232
|
+
// validator({ ... }), — tolerate whitespace/newlines
|
|
233
|
+
const before1 = output;
|
|
234
|
+
output = output.replace(/\s*validator\(\s*\{[\s\S]*?\}\s*\)\s*,?/g, ' /* v3: validator() removed — validate inline with zod */ ');
|
|
235
|
+
if (output !== before1) {
|
|
236
|
+
changes.push('Stripped Agentuity validator() middleware calls');
|
|
237
|
+
}
|
|
238
|
+
// <agent>.validator(),
|
|
239
|
+
const before2 = output;
|
|
240
|
+
output = output.replace(/\s*[A-Za-z_$][A-Za-z0-9_$]*\.validator\(\s*\)\s*,?/g, ' /* v3: agent.validator() removed — parse input with zod */ ');
|
|
241
|
+
if (output !== before2) {
|
|
242
|
+
changes.push('Stripped <agent>.validator() middleware calls');
|
|
243
|
+
}
|
|
244
|
+
return { source: output, changed: changes.length > 0, changes };
|
|
245
|
+
}
|
|
246
|
+
export function insertAfterImports(source, importLine) {
|
|
131
247
|
const sf = ts.createSourceFile('temp.ts', source, ts.ScriptTarget.ESNext, true);
|
|
132
248
|
let lastImportEnd = -1;
|
|
133
249
|
for (const stmt of sf.statements) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/transforms/v3/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/transforms/v3/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsC9C,MAAM,UAAU,oBAAoB,CAAC,MAAc;IAClD,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,qBAAqB,GAAG,KAAK,CAAC;IAClC,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,4DAA4D;IAC5D,qEAAqE;IACrE,MAAM,OAAO,GACZ,mFAAmF,CAAC;IACrF,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,KAAa,EAAE,EAAE;QAChE,OAAO,GAAG,IAAI,CAAC;QACf,MAAM,KAAK,GAAG,KAAK;aACjB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;aACrC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,YAAY,GAAG,IAAI,CAAC;QAC/C,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;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for user-owned
|
|
5
|
+
* schemas is zod. The migrate tool replaces the import and the `s.*`
|
|
6
|
+
* namespace calls so downstream code parses with zod at runtime.
|
|
7
|
+
*
|
|
8
|
+
* Conservative mapping — we do not try to handle every edge case. Advanced
|
|
9
|
+
* shapes (e.g. s.toJSONSchema) are flagged with a TODO comment for manual
|
|
10
|
+
* review rather than silently mistranslated.
|
|
11
|
+
*/
|
|
12
|
+
export interface SchemaToZodResult {
|
|
13
|
+
source: string;
|
|
14
|
+
changed: boolean;
|
|
15
|
+
changes: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare function schemaToZod(source: string): SchemaToZodResult;
|
|
18
|
+
//# sourceMappingURL=schema-to-zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-to-zod.d.ts","sourceRoot":"","sources":["../../../src/transforms/v3/schema-to-zod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAwBD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAkF7D"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform: port `@agentuity/schema` usage to `zod`.
|
|
3
|
+
*
|
|
4
|
+
* v3 still ships @agentuity/schema but the idiomatic path for user-owned
|
|
5
|
+
* schemas is zod. The migrate tool replaces the import and the `s.*`
|
|
6
|
+
* namespace calls so downstream code parses with zod at runtime.
|
|
7
|
+
*
|
|
8
|
+
* Conservative mapping — we do not try to handle every edge case. Advanced
|
|
9
|
+
* shapes (e.g. s.toJSONSchema) are flagged with a TODO comment for manual
|
|
10
|
+
* review rather than silently mistranslated.
|
|
11
|
+
*/
|
|
12
|
+
const BUILDERS = [
|
|
13
|
+
'object',
|
|
14
|
+
'string',
|
|
15
|
+
'number',
|
|
16
|
+
'boolean',
|
|
17
|
+
'null_',
|
|
18
|
+
'undefined_',
|
|
19
|
+
'unknown',
|
|
20
|
+
'any',
|
|
21
|
+
'array',
|
|
22
|
+
'record',
|
|
23
|
+
'literal',
|
|
24
|
+
'optional',
|
|
25
|
+
'nullable',
|
|
26
|
+
'enum',
|
|
27
|
+
'union',
|
|
28
|
+
'coerceString',
|
|
29
|
+
'coerceNumber',
|
|
30
|
+
'coerceBoolean',
|
|
31
|
+
'coerceDate',
|
|
32
|
+
];
|
|
33
|
+
export function schemaToZod(source) {
|
|
34
|
+
let output = source;
|
|
35
|
+
const changes = [];
|
|
36
|
+
// 1. Import swap: `import { s } from '@agentuity/schema'` → `import { z } from 'zod'`.
|
|
37
|
+
const importBefore = output;
|
|
38
|
+
output = output.replace(/import\s*\{\s*s\s*\}\s*from\s*['"]@agentuity\/schema['"]\s*;?/g, "import { z } from 'zod';");
|
|
39
|
+
if (output !== importBefore) {
|
|
40
|
+
changes.push("Replaced `import { s } from '@agentuity/schema'` with `import { z } from 'zod'`");
|
|
41
|
+
}
|
|
42
|
+
// Also handle `import type { Schema } from '@agentuity/schema'` which is
|
|
43
|
+
// vestigial — the type isn't used anywhere we care about in the scaffold.
|
|
44
|
+
// Drop it rather than try to translate.
|
|
45
|
+
const typeImportBefore = output;
|
|
46
|
+
output = output.replace(/import\s+type\s*\{[^}]*\}\s*from\s*['"]@agentuity\/schema['"]\s*;?\s*\n?/g, '');
|
|
47
|
+
if (output !== typeImportBefore) {
|
|
48
|
+
changes.push('Removed type imports from @agentuity/schema');
|
|
49
|
+
}
|
|
50
|
+
// If this file didn't use schema at all, bail early.
|
|
51
|
+
if (changes.length === 0 && !/\bs\s*\./.test(output)) {
|
|
52
|
+
return { source: output, changed: false, changes: [] };
|
|
53
|
+
}
|
|
54
|
+
// 2. s.<builder>(…) → z.<builder>(…).
|
|
55
|
+
let replacedBuilders = 0;
|
|
56
|
+
for (const name of BUILDERS) {
|
|
57
|
+
const pattern = new RegExp(`(^|[^A-Za-z0-9_$.])s\\.${name}(?=\\b)`, 'g');
|
|
58
|
+
output = output.replace(pattern, (_m, pre) => {
|
|
59
|
+
replacedBuilders++;
|
|
60
|
+
if (name.startsWith('coerce')) {
|
|
61
|
+
const prim = name.slice('coerce'.length).toLowerCase();
|
|
62
|
+
return `${pre}z.coerce.${prim}`;
|
|
63
|
+
}
|
|
64
|
+
// The @agentuity/schema names `null_` and `undefined_` map to zod's
|
|
65
|
+
// keyword-named functions `null`/`undefined` but those are reserved,
|
|
66
|
+
// so zod exposes them as methods on the `z` object just fine.
|
|
67
|
+
let mapped = name;
|
|
68
|
+
if (name === 'null_')
|
|
69
|
+
mapped = 'null';
|
|
70
|
+
if (name === 'undefined_')
|
|
71
|
+
mapped = 'undefined';
|
|
72
|
+
return `${pre}z.${mapped}`;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (replacedBuilders > 0) {
|
|
76
|
+
changes.push(`Replaced ${replacedBuilders} s.<builder>() call(s) with z.<builder>()`);
|
|
77
|
+
}
|
|
78
|
+
// 3. Type helpers.
|
|
79
|
+
const typeBefore = output;
|
|
80
|
+
output = output.replace(/\bs\.infer\b/g, 'z.infer');
|
|
81
|
+
if (output !== typeBefore) {
|
|
82
|
+
changes.push('Replaced s.infer<…> with z.infer<…>');
|
|
83
|
+
}
|
|
84
|
+
// 4. Advanced APIs we can't safely auto-translate: s.toJSONSchema.
|
|
85
|
+
const jsonSchemaBefore = output;
|
|
86
|
+
output = output.replace(/\bs\.toJSONSchema\b/g, '/* TODO: replace with zodToJsonSchema() from `zod-to-json-schema`, or use `.toJSON()` on zod v4 */ (null as any)');
|
|
87
|
+
if (output !== jsonSchemaBefore) {
|
|
88
|
+
changes.push('Stubbed s.toJSONSchema — requires manual swap to a zod equivalent');
|
|
89
|
+
}
|
|
90
|
+
// 5. @agentuity/schema's s.union(a, b, c) is variadic; zod's z.union takes
|
|
91
|
+
// an array. Rewrite call sites with 2+ args to z.union([a, b, c]).
|
|
92
|
+
const unionBefore = output;
|
|
93
|
+
output = rewriteZUnionCalls(output);
|
|
94
|
+
if (output !== unionBefore) {
|
|
95
|
+
changes.push('Rewrote z.union(a, b, c) → z.union([a, b, c])');
|
|
96
|
+
}
|
|
97
|
+
return { source: output, changed: changes.length > 0, changes };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Walk `z.union(…)` call sites and wrap the args in an array literal unless
|
|
101
|
+
* they already are one. We scan with a brace-depth counter so nested parens
|
|
102
|
+
* and generic type arguments don't confuse us.
|
|
103
|
+
*/
|
|
104
|
+
function rewriteZUnionCalls(source) {
|
|
105
|
+
const needle = 'z.union(';
|
|
106
|
+
let output = '';
|
|
107
|
+
let i = 0;
|
|
108
|
+
while (i < source.length) {
|
|
109
|
+
const idx = source.indexOf(needle, i);
|
|
110
|
+
if (idx < 0) {
|
|
111
|
+
output += source.slice(i);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
output += source.slice(i, idx) + needle;
|
|
115
|
+
let depth = 1;
|
|
116
|
+
let j = idx + needle.length;
|
|
117
|
+
const start = j;
|
|
118
|
+
while (j < source.length && depth > 0) {
|
|
119
|
+
const ch = source[j];
|
|
120
|
+
if (ch === '(')
|
|
121
|
+
depth++;
|
|
122
|
+
else if (ch === ')') {
|
|
123
|
+
depth--;
|
|
124
|
+
if (depth === 0)
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
j++;
|
|
128
|
+
}
|
|
129
|
+
const argsStr = source.slice(start, j);
|
|
130
|
+
if (argsStr.trimStart().startsWith('[')) {
|
|
131
|
+
output += argsStr + ')';
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
output += '[' + argsStr + '])';
|
|
135
|
+
}
|
|
136
|
+
i = j + 1;
|
|
137
|
+
}
|
|
138
|
+
return output;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=schema-to-zod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AE,KAAK,GAAG;gBAAE,KAAK,EAAE,CAAC;iBACnB,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;gBACrB,KAAK,EAAE,CAAC;gBACR,IAAI,KAAK,KAAK,CAAC;oBAAE,MAAM;YACxB,CAAC;YACD,CAAC,EAAE,CAAC;QACL,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACvC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,OAAO,GAAG,GAAG,CAAC;QACzB,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,GAAG,GAAG,OAAO,GAAG,IAAI,CAAC;QAChC,CAAC;QACD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACX,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/migrate",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.7",
|
|
4
4
|
"description": "Migration tool for Agentuity SDK (v1→v2 and v2→v3)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Agentuity employees and contributors",
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
"prepublishOnly": "bun run clean && bun run build"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@agentuity/core": "3.0.0-alpha.6",
|
|
34
33
|
"typescript": "^5.9.0"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
37
|
-
"@agentuity/test-utils": "3.0.0-alpha.
|
|
36
|
+
"@agentuity/test-utils": "3.0.0-alpha.7",
|
|
38
37
|
"@types/bun": "latest",
|
|
39
38
|
"bun-types": "latest"
|
|
40
39
|
},
|
package/src/detect-v3.ts
CHANGED
|
@@ -628,9 +628,11 @@ export async function detectV3(projectDir: string): Promise<V3DetectionResult> {
|
|
|
628
628
|
const agentDir = join(absDir, 'src', 'agent');
|
|
629
629
|
if (existsSync(agentDir)) {
|
|
630
630
|
for (const file of walkFiles(agentDir, ['.ts', '.tsx'])) {
|
|
631
|
-
|
|
632
|
-
//
|
|
633
|
-
if (
|
|
631
|
+
// Skip ONLY the top-level src/agent/index.ts barrel. Inside subdirectories,
|
|
632
|
+
// index.ts is the agent itself, e.g. src/agent/translate/index.ts.
|
|
633
|
+
if (file === join(agentDir, 'index.ts') || file === join(agentDir, 'index.tsx')) {
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
634
636
|
|
|
635
637
|
const sourceFile = await parseTs(file);
|
|
636
638
|
const src = await Bun.file(file).text();
|