@autobe/agent 0.29.0 → 0.29.2
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/lib/AutoBeAgent.d.ts +2 -1
- package/lib/AutoBeAgent.js +17 -8
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeAgentBase.d.ts +2 -3
- package/lib/AutoBeAgentBase.js +1 -8
- package/lib/AutoBeAgentBase.js.map +1 -1
- package/lib/AutoBeMockAgent.js +13 -4
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +8 -10
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getAutoBeGenerated.d.ts +7 -1
- package/lib/factory/getAutoBeGenerated.js +138 -33
- package/lib/factory/getAutoBeGenerated.js.map +1 -1
- package/lib/factory/getAutoBeRealizeGenerated.js +2 -2
- package/lib/factory/getAutoBeRealizeGenerated.js.map +1 -1
- package/lib/factory/getCriticalCompiler.js +2 -4
- package/lib/factory/getCriticalCompiler.js.map +1 -1
- package/lib/index.mjs +139 -222
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js +2 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +1 -1
- package/lib/utils/executeCachedBatch.js +1 -1
- package/lib/utils/executeCachedBatch.js.map +1 -1
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +16 -5
- package/src/AutoBeAgentBase.ts +3 -12
- package/src/AutoBeMockAgent.ts +15 -4
- package/src/factory/createAutoBeContext.ts +5 -3
- package/src/factory/getAutoBeGenerated.ts +203 -42
- package/src/factory/getAutoBeRealizeGenerated.ts +0 -1
- package/src/factory/getCriticalCompiler.ts +3 -5
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -4
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationWrite.ts +2 -1
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -2
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
- package/src/orchestrate/test/orchestrateTestCorrect.ts +1 -1
- package/src/utils/executeCachedBatch.ts +1 -1
- package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +0 -7
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js +0 -35
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +0 -1
- package/lib/factory/AutoBeProcessAggregateFactory.d.ts +0 -13
- package/lib/factory/AutoBeProcessAggregateFactory.js +0 -100
- package/lib/factory/AutoBeProcessAggregateFactory.js.map +0 -1
- package/lib/utils/TokenUsageComputer.d.ts +0 -5
- package/lib/utils/TokenUsageComputer.js +0 -29
- package/lib/utils/TokenUsageComputer.js.map +0 -1
- package/src/factory/AutoBeFunctionCallingMetricFactory.ts +0 -44
- package/src/factory/AutoBeProcessAggregateFactory.ts +0 -141
- package/src/utils/TokenUsageComputer.ts +0 -35
|
@@ -11,13 +11,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getAutoBeRealizeGenerated = void 0;
|
|
13
13
|
const getAutoBeRealizeGenerated = (props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
return (Object.assign(Object.assign(Object.assign(
|
|
14
|
+
return (Object.assign(Object.assign(Object.assign({}, Object.fromEntries(props.functions.map((f) => [f.location, f.content]))), Object.fromEntries(props.authorizations
|
|
15
15
|
.map((auth) => [
|
|
16
16
|
[auth.decorator.location, auth.decorator.content],
|
|
17
17
|
[auth.provider.location, auth.provider.content],
|
|
18
18
|
[auth.payload.location, auth.payload.content],
|
|
19
19
|
])
|
|
20
|
-
.flat())), (yield props.compiler.realize.
|
|
20
|
+
.flat())), (yield props.compiler.realize.controller({
|
|
21
21
|
document: props.document,
|
|
22
22
|
functions: props.functions,
|
|
23
23
|
authorizations: props.authorizations,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAutoBeRealizeGenerated.js","sourceRoot":"","sources":["../../src/factory/getAutoBeRealizeGenerated.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQO,MAAM,yBAAyB,GAAG,CAAO,KAM/C,EAAmC,EAAE;IAAC,OAAA,
|
|
1
|
+
{"version":3,"file":"getAutoBeRealizeGenerated.js","sourceRoot":"","sources":["../../src/factory/getAutoBeRealizeGenerated.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQO,MAAM,yBAAyB,GAAG,CAAO,KAM/C,EAAmC,EAAE;IAAC,OAAA,+CAClC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GACvE,MAAM,CAAC,WAAW,CACnB,KAAK,CAAC,cAAc;SACjB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACb,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QACjD,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC/C,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;KAC9C,CAAC;SACD,IAAI,EAAE,CACV,GACE,CAAC,MAAM,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC;QAC1C,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,cAAc,EAAE,KAAK,CAAC,cAAc;KACrC,CAAC,CAAC,EACH,CAAA;EAAA,CAAC;AAtBU,QAAA,yBAAyB,6BAsBnC"}
|
|
@@ -27,10 +27,9 @@ const getCriticalCompiler = (critical, compiler) => {
|
|
|
27
27
|
write: (app, dmbs) => lock(() => compiler.prisma.write(app, dmbs)),
|
|
28
28
|
},
|
|
29
29
|
interface: {
|
|
30
|
-
write: (doc) => lock(() => compiler.interface.write(doc)),
|
|
30
|
+
write: (doc, exclude) => lock(() => compiler.interface.write(doc, exclude)),
|
|
31
31
|
transform: (doc) => lock(() => compiler.interface.transform(doc)),
|
|
32
32
|
invert: (doc) => lock(() => compiler.interface.invert(doc)),
|
|
33
|
-
getTemplate: () => lock(() => compiler.interface.getTemplate()),
|
|
34
33
|
},
|
|
35
34
|
typescript: {
|
|
36
35
|
compile: (props) => lock(() => compiler.typescript.compile(props)),
|
|
@@ -42,13 +41,12 @@ const getCriticalCompiler = (critical, compiler) => {
|
|
|
42
41
|
validate: (props) => lock(() => compiler.test.validate(props)),
|
|
43
42
|
write: (props) => lock(() => compiler.test.write(props)),
|
|
44
43
|
getExternal: () => lock(() => compiler.test.getExternal()),
|
|
45
|
-
getTemplate: () => lock(() => compiler.test.getTemplate()),
|
|
46
44
|
},
|
|
47
45
|
realize: {
|
|
48
46
|
controller: (props) => lock(() => compiler.realize.controller(props)),
|
|
49
47
|
test: (props) => lock(() => compiler.realize.test(props)),
|
|
50
|
-
getTemplate: (options) => lock(() => compiler.realize.getTemplate(options)),
|
|
51
48
|
},
|
|
49
|
+
getTemplate: (options) => lock(() => compiler.getTemplate(options)),
|
|
52
50
|
};
|
|
53
51
|
};
|
|
54
52
|
exports.getCriticalCompiler = getCriticalCompiler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCriticalCompiler.js","sourceRoot":"","sources":["../../src/factory/getCriticalCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGO,MAAM,mBAAmB,GAAG,CACjC,QAAmB,EACnB,QAAyB,EACR,EAAE;IACnB,MAAM,IAAI,GAAG,CAAO,IAAwB,EAAE,EAAE;QAC9C,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,EAAE,CAAC;QACtB,CAAC;gBAAS,CAAC;YACT,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC,CAAA,CAAC;IACF,OAAO;QACL,MAAM,EAAE;YACN,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC9D,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC5D,KAAK,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;SACnE;QACD,SAAS,EAAE;YACT,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"getCriticalCompiler.js","sourceRoot":"","sources":["../../src/factory/getCriticalCompiler.ts"],"names":[],"mappings":"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"}
|
package/lib/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MicroAgentica } from "@agentica/core";
|
|
2
2
|
|
|
3
|
+
import { AutoBeProcessAggregateFactory, StringUtil, TokenUsageComputer, writePrismaApplication, AutoBeOpenApiEndpointComparator, AutoBeOpenApiTypeChecker, MapUtil, missedOpenApiSchemas, revertOpenApiAccessor, transformOpenApiDocument } from "@autobe/utils";
|
|
4
|
+
|
|
3
5
|
import { ConditionVariable, Singleton, sleep_for, is_node, Semaphore, Pair, HashSet, HashMap, randint } from "tstl";
|
|
4
6
|
|
|
5
7
|
import { v7 } from "uuid";
|
|
6
8
|
|
|
7
|
-
import { StringUtil, writePrismaApplication, AutoBeOpenApiEndpointComparator, AutoBeOpenApiTypeChecker, MapUtil, missedOpenApiSchemas, revertOpenApiAccessor, transformOpenApiDocument } from "@autobe/utils";
|
|
8
|
-
|
|
9
9
|
import "typia";
|
|
10
10
|
|
|
11
11
|
import * as __typia_transform__validateReport from "typia/lib/internal/_validateReport.js";
|
|
@@ -30,55 +30,6 @@ import * as __typia_transform__isUniqueItems from "typia/lib/internal/_isUniqueI
|
|
|
30
30
|
|
|
31
31
|
import * as __typia_transform__createStandardSchema from "typia/lib/internal/_createStandardSchema.js";
|
|
32
32
|
|
|
33
|
-
const getAutoBeRealizeGenerated = async props => ({
|
|
34
|
-
...Object.fromEntries(props.functions.map(f => [ f.location, f.content ])),
|
|
35
|
-
...Object.fromEntries(props.authorizations.map(auth => [ [ auth.decorator.location, auth.decorator.content ], [ auth.provider.location, auth.provider.content ], [ auth.payload.location, auth.payload.content ] ]).flat()),
|
|
36
|
-
...await props.compiler.realize.getTemplate(props.options),
|
|
37
|
-
...await props.compiler.realize.controller({
|
|
38
|
-
document: props.document,
|
|
39
|
-
functions: props.functions,
|
|
40
|
-
authorizations: props.authorizations
|
|
41
|
-
})
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
async function getAutoBeGenerated(compiler, state, histories, tokenUsage, options) {
|
|
45
|
-
const ret = {};
|
|
46
|
-
if (state.analyze === null) return {};
|
|
47
|
-
Object.assign(ret, Object.fromEntries(state.analyze.files.map(file => [ `docs/analysis/${file.filename.split("/").at(-1)}`, file.content ])));
|
|
48
|
-
if (options?.stage === "analyze") return ret;
|
|
49
|
-
if (state.prisma?.step === state.analyze.step) {
|
|
50
|
-
const schemaFiles = (options?.dbms ?? "postgres") === "postgres" ? state.prisma.schemas : await compiler.prisma.write(state.prisma.result.data, options.dbms);
|
|
51
|
-
Object.assign(ret, Object.fromEntries(Object.entries(schemaFiles).map(([key, value]) => [ `prisma/schema/${key.split("/").at(-1)}`, value ])), {
|
|
52
|
-
"autobe/prisma.json": JSON.stringify(state.prisma.result.data)
|
|
53
|
-
});
|
|
54
|
-
if (state.prisma.compiled.type === "success") ret["docs/ERD.md"] = state.prisma.compiled.document; else if (state.prisma.compiled.type === "failure") ret["prisma/compile-error-reason.log"] = state.prisma.compiled.reason;
|
|
55
|
-
}
|
|
56
|
-
if (options?.stage === "prisma") return ret;
|
|
57
|
-
if (state.interface?.step === state.analyze.step) {
|
|
58
|
-
const files = await compiler.interface.write(state.interface.document);
|
|
59
|
-
Object.assign(ret, state.test?.step === state.interface.step ? Object.fromEntries(Object.entries(files).filter(([key]) => key.startsWith("test/features/") === false)) : files, {
|
|
60
|
-
"autobe/document.json": JSON.stringify(state.interface.document)
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (options?.stage === "interface") return ret;
|
|
64
|
-
if (state.test?.step === state.analyze.step) Object.assign(ret, Object.fromEntries(state.test.files.map(f => [ f.location, f.content ])), await compiler.test.getTemplate());
|
|
65
|
-
if (state.realize?.step === state.analyze.step) Object.assign(ret, await getAutoBeRealizeGenerated({
|
|
66
|
-
compiler,
|
|
67
|
-
document: state.interface.document,
|
|
68
|
-
authorizations: state.realize.authorizations,
|
|
69
|
-
functions: state.realize.functions,
|
|
70
|
-
options: {
|
|
71
|
-
dbms: options?.dbms ?? "postgres"
|
|
72
|
-
}
|
|
73
|
-
}));
|
|
74
|
-
if (options?.stage === "test") return ret;
|
|
75
|
-
Object.assign(ret, {
|
|
76
|
-
"autobe/histories.json": JSON.stringify(histories),
|
|
77
|
-
"autobe/tokenUsage.json": JSON.stringify(tokenUsage)
|
|
78
|
-
});
|
|
79
|
-
return ret;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
33
|
function emplaceMap(dict, key, generator) {
|
|
83
34
|
const oldbie = dict.get(key);
|
|
84
35
|
if (oldbie !== undefined) {
|
|
@@ -90,13 +41,9 @@ function emplaceMap(dict, key, generator) {
|
|
|
90
41
|
}
|
|
91
42
|
|
|
92
43
|
class AutoBeAgentBase {
|
|
93
|
-
constructor(
|
|
94
|
-
this.asset = asset;
|
|
44
|
+
constructor() {
|
|
95
45
|
this.listeners_ = new Map;
|
|
96
46
|
}
|
|
97
|
-
async getFiles(options) {
|
|
98
|
-
return getAutoBeGenerated(await this.asset.compiler(), this.asset.state(), this.getHistories(), this.getTokenUsage(), options);
|
|
99
|
-
}
|
|
100
47
|
on(type, listener) {
|
|
101
48
|
emplaceMap(this.listeners_, type, () => new Set).add(listener);
|
|
102
49
|
return this;
|
|
@@ -289,150 +236,6 @@ class AutoBeTokenUsage {
|
|
|
289
236
|
}
|
|
290
237
|
}
|
|
291
238
|
|
|
292
|
-
var TokenUsageComputer;
|
|
293
|
-
|
|
294
|
-
(function(TokenUsageComputer) {
|
|
295
|
-
TokenUsageComputer.plus = (x, y) => ({
|
|
296
|
-
total: x.total + y.total,
|
|
297
|
-
input: {
|
|
298
|
-
total: x.input.total + y.input.total,
|
|
299
|
-
cached: x.input.cached + y.input.cached
|
|
300
|
-
},
|
|
301
|
-
output: {
|
|
302
|
-
total: x.output.total + y.output.total,
|
|
303
|
-
reasoning: x.output.reasoning + y.output.reasoning,
|
|
304
|
-
accepted_prediction: x.output.accepted_prediction + y.output.accepted_prediction,
|
|
305
|
-
rejected_prediction: x.output.rejected_prediction + y.output.rejected_prediction
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
TokenUsageComputer.increment = (x, y) => {
|
|
309
|
-
x.total += y.total;
|
|
310
|
-
x.input.total += y.input.total;
|
|
311
|
-
x.input.cached += y.input.cached;
|
|
312
|
-
x.output.total += y.output.total;
|
|
313
|
-
x.output.reasoning += y.output.reasoning;
|
|
314
|
-
x.output.accepted_prediction += y.output.accepted_prediction;
|
|
315
|
-
x.output.rejected_prediction += y.output.rejected_prediction;
|
|
316
|
-
};
|
|
317
|
-
})(TokenUsageComputer || (TokenUsageComputer = {}));
|
|
318
|
-
|
|
319
|
-
var AutoBeFunctionCallingMetricFactory;
|
|
320
|
-
|
|
321
|
-
(function(AutoBeFunctionCallingMetricFactory) {
|
|
322
|
-
AutoBeFunctionCallingMetricFactory.create = () => ({
|
|
323
|
-
attempt: 0,
|
|
324
|
-
success: 0,
|
|
325
|
-
consent: 0,
|
|
326
|
-
validationFailure: 0,
|
|
327
|
-
invalidJson: 0
|
|
328
|
-
});
|
|
329
|
-
AutoBeFunctionCallingMetricFactory.increment = (x, y) => {
|
|
330
|
-
x.attempt += y.attempt;
|
|
331
|
-
x.success += y.success;
|
|
332
|
-
x.consent += y.consent;
|
|
333
|
-
x.validationFailure += y.validationFailure;
|
|
334
|
-
x.invalidJson += y.invalidJson;
|
|
335
|
-
};
|
|
336
|
-
AutoBeFunctionCallingMetricFactory.plus = (x, y) => ({
|
|
337
|
-
attempt: x.attempt + y.attempt,
|
|
338
|
-
success: x.success + y.success,
|
|
339
|
-
consent: x.consent + y.consent,
|
|
340
|
-
validationFailure: x.validationFailure + y.validationFailure,
|
|
341
|
-
invalidJson: x.invalidJson + y.invalidJson
|
|
342
|
-
});
|
|
343
|
-
AutoBeFunctionCallingMetricFactory.minus = (x, y) => ({
|
|
344
|
-
attempt: x.attempt - y.attempt,
|
|
345
|
-
success: x.success - y.success,
|
|
346
|
-
consent: x.consent - y.consent,
|
|
347
|
-
validationFailure: x.validationFailure - y.validationFailure,
|
|
348
|
-
invalidJson: x.invalidJson - y.invalidJson
|
|
349
|
-
});
|
|
350
|
-
})(AutoBeFunctionCallingMetricFactory || (AutoBeFunctionCallingMetricFactory = {}));
|
|
351
|
-
|
|
352
|
-
var AutoBeProcessAggregateFactory;
|
|
353
|
-
|
|
354
|
-
(function(AutoBeProcessAggregateFactory) {
|
|
355
|
-
AutoBeProcessAggregateFactory.createAggregate = () => ({
|
|
356
|
-
metric: AutoBeFunctionCallingMetricFactory.create(),
|
|
357
|
-
tokenUsage: (new AutoBeTokenUsageComponent).toJSON()
|
|
358
|
-
});
|
|
359
|
-
AutoBeProcessAggregateFactory.createCollection = () => ({
|
|
360
|
-
total: AutoBeProcessAggregateFactory.createAggregate()
|
|
361
|
-
});
|
|
362
|
-
AutoBeProcessAggregateFactory.computeTotal = collection => {
|
|
363
|
-
const total = AutoBeProcessAggregateFactory.createAggregate();
|
|
364
|
-
for (const [key, value] of Object.entries(collection)) {
|
|
365
|
-
if (key === "total") continue;
|
|
366
|
-
AutoBeFunctionCallingMetricFactory.increment(total.metric, value.metric);
|
|
367
|
-
TokenUsageComputer.increment(total.tokenUsage, value.tokenUsage);
|
|
368
|
-
}
|
|
369
|
-
return total;
|
|
370
|
-
};
|
|
371
|
-
AutoBeProcessAggregateFactory.emplaceEvent = (collection, event) => {
|
|
372
|
-
var _a, _b;
|
|
373
|
-
(_a = collection)[_b = event.type] ?? (_a[_b] = AutoBeProcessAggregateFactory.createAggregate());
|
|
374
|
-
collection.total ?? (collection.total = AutoBeProcessAggregateFactory.computeTotal(collection));
|
|
375
|
-
const local = collection[event.type];
|
|
376
|
-
const total = collection.total;
|
|
377
|
-
AutoBeFunctionCallingMetricFactory.increment(local.metric, event.metric);
|
|
378
|
-
AutoBeFunctionCallingMetricFactory.increment(total.metric, event.metric);
|
|
379
|
-
TokenUsageComputer.increment(local.tokenUsage, event.tokenUsage);
|
|
380
|
-
TokenUsageComputer.increment(total.tokenUsage, event.tokenUsage);
|
|
381
|
-
};
|
|
382
|
-
AutoBeProcessAggregateFactory.filterPhase = (collection, phase) => {
|
|
383
|
-
const result = AutoBeProcessAggregateFactory.createCollection();
|
|
384
|
-
for (const [key, value] of Object.entries(collection)) {
|
|
385
|
-
if (key === "total") continue; else if (key.startsWith(phase) === false) continue;
|
|
386
|
-
result[key] = value;
|
|
387
|
-
AutoBeFunctionCallingMetricFactory.increment(result.total.metric, value.metric);
|
|
388
|
-
TokenUsageComputer.increment(result.total.tokenUsage, value.tokenUsage);
|
|
389
|
-
}
|
|
390
|
-
return result;
|
|
391
|
-
};
|
|
392
|
-
AutoBeProcessAggregateFactory.reduce = collections => {
|
|
393
|
-
var _a;
|
|
394
|
-
const result = AutoBeProcessAggregateFactory.createCollection();
|
|
395
|
-
for (const collection of collections) {
|
|
396
|
-
for (const [key, value] of Object.entries(collection)) {
|
|
397
|
-
if (key === "total") continue;
|
|
398
|
-
(_a = result)[key] ?? (_a[key] = AutoBeProcessAggregateFactory.createAggregate());
|
|
399
|
-
const local = result[key];
|
|
400
|
-
AutoBeFunctionCallingMetricFactory.increment(local.metric, value.metric);
|
|
401
|
-
TokenUsageComputer.increment(local.tokenUsage, value.tokenUsage);
|
|
402
|
-
AutoBeFunctionCallingMetricFactory.increment(result.total.metric, value.metric);
|
|
403
|
-
TokenUsageComputer.increment(result.total.tokenUsage, value.tokenUsage);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
result.total ?? (result.total = AutoBeProcessAggregateFactory.createAggregate());
|
|
407
|
-
Object.assign(result.total, AutoBeProcessAggregateFactory.computeTotal(result));
|
|
408
|
-
return result;
|
|
409
|
-
};
|
|
410
|
-
AutoBeProcessAggregateFactory.increment = (x, y) => {
|
|
411
|
-
var _a;
|
|
412
|
-
for (const [key, value] of Object.entries(y)) {
|
|
413
|
-
if (key === "total") continue;
|
|
414
|
-
(_a = x)[key] ?? (_a[key] = AutoBeProcessAggregateFactory.createAggregate());
|
|
415
|
-
const local = x[key];
|
|
416
|
-
AutoBeFunctionCallingMetricFactory.increment(local.metric, value.metric);
|
|
417
|
-
}
|
|
418
|
-
x.total ?? (x.total = AutoBeProcessAggregateFactory.createAggregate());
|
|
419
|
-
Object.assign(x.total, AutoBeProcessAggregateFactory.computeTotal(x));
|
|
420
|
-
};
|
|
421
|
-
AutoBeProcessAggregateFactory.minus = (x, y) => {
|
|
422
|
-
var _a;
|
|
423
|
-
const result = JSON.parse(JSON.stringify(x));
|
|
424
|
-
for (const [key, value] of Object.entries(y)) {
|
|
425
|
-
if (key === "total") continue;
|
|
426
|
-
(_a = result)[key] ?? (_a[key] = AutoBeProcessAggregateFactory.createAggregate());
|
|
427
|
-
const local = result[key];
|
|
428
|
-
AutoBeFunctionCallingMetricFactory.minus(local.metric, value.metric);
|
|
429
|
-
}
|
|
430
|
-
result.total ?? (result.total = AutoBeProcessAggregateFactory.createAggregate());
|
|
431
|
-
Object.assign(result.total, AutoBeProcessAggregateFactory.computeTotal(result));
|
|
432
|
-
return result;
|
|
433
|
-
};
|
|
434
|
-
})(AutoBeProcessAggregateFactory || (AutoBeProcessAggregateFactory = {}));
|
|
435
|
-
|
|
436
239
|
function createAgenticaHistory(props) {
|
|
437
240
|
if (props.history.type === "userMessage") return {
|
|
438
241
|
...props.history,
|
|
@@ -749,10 +552,9 @@ const getCriticalCompiler = (critical, compiler) => {
|
|
|
749
552
|
write: (app, dmbs) => lock(() => compiler.prisma.write(app, dmbs))
|
|
750
553
|
},
|
|
751
554
|
interface: {
|
|
752
|
-
write: doc => lock(() => compiler.interface.write(doc)),
|
|
555
|
+
write: (doc, exclude) => lock(() => compiler.interface.write(doc, exclude)),
|
|
753
556
|
transform: doc => lock(() => compiler.interface.transform(doc)),
|
|
754
|
-
invert: doc => lock(() => compiler.interface.invert(doc))
|
|
755
|
-
getTemplate: () => lock(() => compiler.interface.getTemplate())
|
|
557
|
+
invert: doc => lock(() => compiler.interface.invert(doc))
|
|
756
558
|
},
|
|
757
559
|
typescript: {
|
|
758
560
|
compile: props => lock(() => compiler.typescript.compile(props)),
|
|
@@ -763,14 +565,13 @@ const getCriticalCompiler = (critical, compiler) => {
|
|
|
763
565
|
compile: props => lock(() => compiler.test.compile(props)),
|
|
764
566
|
validate: props => lock(() => compiler.test.validate(props)),
|
|
765
567
|
write: props => lock(() => compiler.test.write(props)),
|
|
766
|
-
getExternal: () => lock(() => compiler.test.getExternal())
|
|
767
|
-
getTemplate: () => lock(() => compiler.test.getTemplate())
|
|
568
|
+
getExternal: () => lock(() => compiler.test.getExternal())
|
|
768
569
|
},
|
|
769
570
|
realize: {
|
|
770
571
|
controller: props => lock(() => compiler.realize.controller(props)),
|
|
771
|
-
test: props => lock(() => compiler.realize.test(props))
|
|
772
|
-
|
|
773
|
-
|
|
572
|
+
test: props => lock(() => compiler.realize.test(props))
|
|
573
|
+
},
|
|
574
|
+
getTemplate: options => lock(() => compiler.getTemplate(options))
|
|
774
575
|
};
|
|
775
576
|
};
|
|
776
577
|
|
|
@@ -1107,6 +908,108 @@ const createAutoBeState = histories => {
|
|
|
1107
908
|
};
|
|
1108
909
|
};
|
|
1109
910
|
|
|
911
|
+
const getAutoBeRealizeGenerated = async props => ({
|
|
912
|
+
...Object.fromEntries(props.functions.map(f => [ f.location, f.content ])),
|
|
913
|
+
...Object.fromEntries(props.authorizations.map(auth => [ [ auth.decorator.location, auth.decorator.content ], [ auth.provider.location, auth.provider.content ], [ auth.payload.location, auth.payload.content ] ]).flat()),
|
|
914
|
+
...await props.compiler.realize.controller({
|
|
915
|
+
document: props.document,
|
|
916
|
+
functions: props.functions,
|
|
917
|
+
authorizations: props.authorizations
|
|
918
|
+
})
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
async function getAutoBeGenerated(props) {
|
|
922
|
+
const options = {
|
|
923
|
+
phase: props.options?.phase ?? props.state.realize ? "realize" : props.state.test ? "test" : props.state.interface ? "interface" : "analyze",
|
|
924
|
+
dbms: props.options?.dbms ?? "postgres"
|
|
925
|
+
};
|
|
926
|
+
const ret = await props.compiler.getTemplate(options);
|
|
927
|
+
ret["README.md"] = writeReadMe(props.state, ret["README.md"]);
|
|
928
|
+
if (props.state.analyze === null) return ret;
|
|
929
|
+
Object.assign(ret, Object.fromEntries(props.state.analyze.files.map(file => [ `docs/analysis/${file.filename.split("/").at(-1)}`, file.content ])));
|
|
930
|
+
if (props.options?.phase === "analyze") return ret;
|
|
931
|
+
if (props.state.prisma?.step === props.state.analyze.step) {
|
|
932
|
+
const schemaFiles = (options?.dbms ?? "postgres") === "postgres" ? props.state.prisma.schemas : await props.compiler.prisma.write(props.state.prisma.result.data, options.dbms);
|
|
933
|
+
Object.assign(ret, Object.fromEntries(Object.entries(schemaFiles).map(([key, value]) => [ `prisma/schema/${key.split("/").at(-1)}`, value ])), {
|
|
934
|
+
"autobe/prisma.json": JSON.stringify(props.state.prisma.result.data)
|
|
935
|
+
});
|
|
936
|
+
if (props.state.prisma.compiled.type === "success") ret["docs/ERD.md"] = props.state.prisma.compiled.document; else if (props.state.prisma.compiled.type === "failure") ret["prisma/compile-error-reason.log"] = props.state.prisma.compiled.reason;
|
|
937
|
+
}
|
|
938
|
+
if (props.options?.phase === "prisma") return ret;
|
|
939
|
+
if (props.state.interface?.step === props.state.analyze.step) {
|
|
940
|
+
const files = await props.compiler.interface.write(props.state.interface.document, Object.keys(ret));
|
|
941
|
+
Object.assign(ret, props.state.test?.step === props.state.interface.step ? Object.fromEntries(Object.entries(files).filter(([key]) => key.startsWith("test/features/") === false)) : files, {
|
|
942
|
+
"autobe/document.json": JSON.stringify(props.state.interface.document)
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
if (props.options?.phase === "interface") return ret;
|
|
946
|
+
if (props.state.test?.step === props.state.analyze.step) Object.assign(ret, Object.fromEntries(props.state.test.files.map(f => [ f.location, f.content ])));
|
|
947
|
+
if (props.state.realize?.step === props.state.analyze.step) Object.assign(ret, await getAutoBeRealizeGenerated({
|
|
948
|
+
compiler: props.compiler,
|
|
949
|
+
document: props.state.interface.document,
|
|
950
|
+
authorizations: props.state.realize.authorizations,
|
|
951
|
+
functions: props.state.realize.functions,
|
|
952
|
+
options: {
|
|
953
|
+
dbms: options?.dbms ?? "postgres"
|
|
954
|
+
}
|
|
955
|
+
}));
|
|
956
|
+
if (props.options?.phase === "test") return ret;
|
|
957
|
+
Object.assign(ret, {
|
|
958
|
+
"autobe/histories.json": JSON.stringify(props.histories),
|
|
959
|
+
"autobe/tokenUsage.json": JSON.stringify(props.tokenUsage)
|
|
960
|
+
});
|
|
961
|
+
return ret;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
function writeReadMe(state, readme) {
|
|
965
|
+
const emoji = history => history ? success(history) ? "✅" : "❌" : "⬜";
|
|
966
|
+
return readme.replaceAll("{{ANALYSIS_EMOJI}}", emoji(state.analyze)).replaceAll("{{PRISMA_EMOJI}}", emoji(state.prisma)).replaceAll("{{INTERFACE_EMOJI}}", emoji(state.interface)).replaceAll("{{TEST_EMOJI}}", emoji(state.test)).replaceAll("{{REALIZE_EMOJI}}", emoji(state.realize)).replaceAll("{{BENCHMARK_AGGREGATE}}", writeBenchmarkAggregate(state)).replaceAll("{{BENCHMARK_FUNCTION_CALLING}}", writeBenchmarkFunctionCalling(state));
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
function writeBenchmarkAggregate(state) {
|
|
970
|
+
return [ "analyze", "prisma", "interface", "test", "realize" ].map(key => {
|
|
971
|
+
const h = state[key];
|
|
972
|
+
if (h === null) return `⬜ ${key} | | | | `;
|
|
973
|
+
return [ `${success(h) ? "✅" : "❌"} ${h.type}`, Object.entries(label(h)).map(([k, v]) => `${k}: ${v.toLocaleString()}`).join(", "), (h.aggregates.total.metric.success / h.aggregates.total.metric.attempt * 100).toFixed(2) + " %", h.aggregates.total.tokenUsage.total.toLocaleString(), Math.round((new Date(h.completed_at).getTime() - new Date(h.created_at).getTime()) / 1e3) + " sec" ].join(" | ");
|
|
974
|
+
}).join("\n");
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
function writeBenchmarkFunctionCalling(state) {
|
|
978
|
+
const aggregates = AutoBeProcessAggregateFactory.reduce([ state.analyze, state.prisma, state.interface, state.test, state.realize ].filter(h => h !== null).map(h => h.aggregates));
|
|
979
|
+
return Object.entries(aggregates).map(([key, value]) => [ key, value.metric.attempt.toLocaleString(), value.metric.validationFailure.toLocaleString(), value.metric.invalidJson.toLocaleString(), value.metric.success.toLocaleString(), (value.metric.success / value.metric.attempt * 100).toFixed(2) + " %" ].join(" | ")).join("\n");
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
function success(history) {
|
|
983
|
+
if (history.type === "analyze") return true; else if (history.type === "interface") return history.missed.length === 0; else if (history.type === "prisma" || history.type === "test" || history.type === "realize") return history.compiled.type === "success";
|
|
984
|
+
throw new Error("Unknown history type encountered.");
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
function label(history) {
|
|
988
|
+
if (history.type === "analyze") return {
|
|
989
|
+
actors: history.actors.length,
|
|
990
|
+
documents: history.files.length
|
|
991
|
+
}; else if (history.type === "prisma") return {
|
|
992
|
+
namespaces: history.result.data.files.length,
|
|
993
|
+
models: history.result.data.files.map(f => f.models).flat().length
|
|
994
|
+
}; else if (history.type === "interface") return {
|
|
995
|
+
operations: history.document.operations.length,
|
|
996
|
+
schemas: Object.keys(history.document.components.schemas).length
|
|
997
|
+
}; else if (history.type === "test") {
|
|
998
|
+
return {
|
|
999
|
+
functions: history.files.length,
|
|
1000
|
+
...history.compiled.type === "failure" ? {
|
|
1001
|
+
errors: new Set(history.compiled.diagnostics.map(d => d.file ?? "")).size
|
|
1002
|
+
} : {}
|
|
1003
|
+
};
|
|
1004
|
+
} else if (history.type === "realize") return {
|
|
1005
|
+
functions: history.functions.length,
|
|
1006
|
+
...history.compiled.type === "failure" ? {
|
|
1007
|
+
errors: new Set(history.compiled.diagnostics.map(d => d.file ?? "")).size
|
|
1008
|
+
} : {}
|
|
1009
|
+
};
|
|
1010
|
+
throw new Error("Unknown history type encountered.");
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1110
1013
|
function assertSchemaModel(model) {
|
|
1111
1014
|
if (model === "3.0") throw new Error([ "Error on AutoBeAgent.constructor(): schema version 3.0 is not supported", "due to limitations in the JSON schema specification for function calling.", "Please use a different model that supports modern JSON schema features." ].join(" "));
|
|
1112
1015
|
}
|
|
@@ -1118,7 +1021,7 @@ const executeCachedBatch = async (ctx, taskList, promptCacheKey) => {
|
|
|
1118
1021
|
const semaphore = ctx.vendor.semaphore && ctx.vendor.semaphore instanceof Semaphore ? ctx.vendor.semaphore.max() : ctx.vendor.semaphore ?? 16;
|
|
1119
1022
|
const remained = taskList.slice(1).map((task, index) => new Pair(task, index));
|
|
1120
1023
|
const tail = [];
|
|
1121
|
-
await Promise.all(new Array(semaphore).map(async () => {
|
|
1024
|
+
await Promise.all(new Array(semaphore).fill(0).map(async () => {
|
|
1122
1025
|
while (remained.length !== 0) {
|
|
1123
1026
|
const batch = remained.splice(0, 1)[0];
|
|
1124
1027
|
const result = await batch.first(promptCacheKey);
|
|
@@ -51836,7 +51739,8 @@ async function compileRealizeFiles(ctx, props) {
|
|
|
51836
51739
|
const prisma = ctx.state().prisma?.compiled;
|
|
51837
51740
|
const payloads = Object.fromEntries(props.authorizations.map(el => [ el.payload.location, el.payload.content ]));
|
|
51838
51741
|
const compiler = await ctx.compiler();
|
|
51839
|
-
const templateFiles = await compiler.
|
|
51742
|
+
const templateFiles = await compiler.getTemplate({
|
|
51743
|
+
phase: "realize",
|
|
51840
51744
|
dbms: "sqlite"
|
|
51841
51745
|
});
|
|
51842
51746
|
const nodeModules = prisma?.type === "success" ? prisma.nodeModules : {};
|
|
@@ -53346,7 +53250,8 @@ async function orchestrateRealizeAuthorizationWrite(ctx) {
|
|
|
53346
53250
|
total: actors.length,
|
|
53347
53251
|
completed: 0
|
|
53348
53252
|
};
|
|
53349
|
-
const templates = await (await ctx.compiler()).
|
|
53253
|
+
const templates = await (await ctx.compiler()).getTemplate({
|
|
53254
|
+
phase: "realize",
|
|
53350
53255
|
dbms: "sqlite"
|
|
53351
53256
|
});
|
|
53352
53257
|
const authorizations = await executeCachedBatch(ctx, actors.map(a => promptCacheKey => process$4(ctx, {
|
|
@@ -55003,7 +54908,7 @@ function filterDiagnostics(failures, locations) {
|
|
|
55003
54908
|
async function getRealizeWriteDto(ctx, operation) {
|
|
55004
54909
|
const document = filterDocument$1(operation, ctx.state().interface.document);
|
|
55005
54910
|
const compiler = await ctx.compiler();
|
|
55006
|
-
const entries = Object.entries(await compiler.interface.write(document));
|
|
54911
|
+
const entries = Object.entries(await compiler.interface.write(document, []));
|
|
55007
54912
|
const filter = (prefix, exclude) => {
|
|
55008
54913
|
const result = entries.filter(([key]) => key.startsWith(prefix) === true);
|
|
55009
54914
|
return Object.fromEntries(result);
|
|
@@ -59555,7 +59460,7 @@ const correct = async (ctx, props, life) => {
|
|
|
59555
59460
|
pointer.value.draft = await completeTestCode(ctx, props.function.artifacts, pointer.value.draft);
|
|
59556
59461
|
ctx.dispatch({
|
|
59557
59462
|
type: "testCorrect",
|
|
59558
|
-
kind: "
|
|
59463
|
+
kind: "overall",
|
|
59559
59464
|
id: v7(),
|
|
59560
59465
|
created_at: (new Date).toISOString(),
|
|
59561
59466
|
file: props.validate.file,
|
|
@@ -64009,7 +63914,7 @@ const getTestTemplateCode = (scenario, document) => StringUtil.trim`
|
|
|
64009
63914
|
async function getTestScenarioArtifacts(ctx, scenario) {
|
|
64010
63915
|
const compiler = await ctx.compiler();
|
|
64011
63916
|
const document = filterDocument(scenario, ctx.state().interface.document);
|
|
64012
|
-
const entries = Object.entries(await compiler.interface.write(document));
|
|
63917
|
+
const entries = Object.entries(await compiler.interface.write(document, []));
|
|
64013
63918
|
const filter = (prefix, exclude) => {
|
|
64014
63919
|
const result = entries.filter(([key]) => key.startsWith(prefix) === true);
|
|
64015
63920
|
return Object.fromEntries(exclude ? result.filter(([key]) => key.startsWith(exclude) === false) : result);
|
|
@@ -65844,10 +65749,7 @@ function isRetryError(error) {
|
|
|
65844
65749
|
|
|
65845
65750
|
class AutoBeAgent extends AutoBeAgentBase {
|
|
65846
65751
|
constructor(props) {
|
|
65847
|
-
super(
|
|
65848
|
-
compiler: () => this.context_.compiler(),
|
|
65849
|
-
state: () => this.state_
|
|
65850
|
-
});
|
|
65752
|
+
super();
|
|
65851
65753
|
this.props_ = props;
|
|
65852
65754
|
this.histories_ = props.histories?.slice() ?? [];
|
|
65853
65755
|
this.state_ = createAutoBeState(this.histories_);
|
|
@@ -66001,6 +65903,15 @@ class AutoBeAgent extends AutoBeAgentBase {
|
|
|
66001
65903
|
getTokenUsage() {
|
|
66002
65904
|
return this.usage_;
|
|
66003
65905
|
}
|
|
65906
|
+
async getFiles(options) {
|
|
65907
|
+
return await getAutoBeGenerated({
|
|
65908
|
+
compiler: await this.context_.compiler(),
|
|
65909
|
+
state: this.state_,
|
|
65910
|
+
histories: this.getHistories(),
|
|
65911
|
+
tokenUsage: this.getTokenUsage(),
|
|
65912
|
+
options
|
|
65913
|
+
});
|
|
65914
|
+
}
|
|
66004
65915
|
getAggregates(latest = false) {
|
|
66005
65916
|
if (latest === false) return this.aggregates_;
|
|
66006
65917
|
const state = this.context_.state();
|
|
@@ -66031,10 +65942,7 @@ var index = Object.freeze({
|
|
|
66031
65942
|
|
|
66032
65943
|
class AutoBeMockAgent extends AutoBeAgentBase {
|
|
66033
65944
|
constructor(props) {
|
|
66034
|
-
super(
|
|
66035
|
-
compiler: () => this.compiler_.get(),
|
|
66036
|
-
state: () => createAutoBeState(this.histories_)
|
|
66037
|
-
});
|
|
65945
|
+
super();
|
|
66038
65946
|
this.props_ = props;
|
|
66039
65947
|
this.histories_ = [];
|
|
66040
65948
|
this.compiler_ = new Singleton(async () => props.compiler({
|
|
@@ -66103,6 +66011,15 @@ class AutoBeMockAgent extends AutoBeAgentBase {
|
|
|
66103
66011
|
getTokenUsage() {
|
|
66104
66012
|
return this.token_usage_;
|
|
66105
66013
|
}
|
|
66014
|
+
async getFiles(options) {
|
|
66015
|
+
return await getAutoBeGenerated({
|
|
66016
|
+
compiler: await this.compiler_.get(),
|
|
66017
|
+
state: createAutoBeState(this.histories_),
|
|
66018
|
+
histories: this.getHistories(),
|
|
66019
|
+
tokenUsage: this.getTokenUsage(),
|
|
66020
|
+
options
|
|
66021
|
+
});
|
|
66022
|
+
}
|
|
66106
66023
|
getPhase() {
|
|
66107
66024
|
const state = createAutoBeState(this.histories_);
|
|
66108
66025
|
if (state.analyze === null) return null; else if (state.realize?.step === state.analyze.step) return "realize"; else if (state.test?.step === state.analyze.step) return "test"; else if (state.interface?.step === state.analyze.step) return "interface"; else if (state.prisma?.step === state.analyze.step) return "prisma";
|