@autobe/benchmark 0.29.2 → 0.30.0
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/example/AutoBeExampleArchiver.d.ts +2 -1
- package/lib/example/AutoBeExampleArchiver.js +41 -19
- package/lib/example/AutoBeExampleArchiver.js.map +1 -1
- package/lib/example/AutoBeExampleBenchmark.d.ts +5 -1
- package/lib/example/AutoBeExampleBenchmark.js +53 -42
- package/lib/example/AutoBeExampleBenchmark.js.map +1 -1
- package/lib/example/{AutoBeExampleDocumentation.d.ts → AutoBeExampleLogger.d.ts} +1 -1
- package/lib/example/{AutoBeExampleDocumentation.js → AutoBeExampleLogger.js} +26 -24
- package/lib/example/AutoBeExampleLogger.js.map +1 -0
- package/lib/example/AutoBeExampleStorage.d.ts +9 -2
- package/lib/example/AutoBeExampleStorage.js +74 -24
- package/lib/example/AutoBeExampleStorage.js.map +1 -1
- package/lib/example/index.d.ts +1 -1
- package/lib/example/index.js +1 -1
- package/lib/example/index.js.map +1 -1
- package/lib/replay/AutoBeReplayComputer.js +35 -28
- package/lib/replay/AutoBeReplayComputer.js.map +1 -1
- package/lib/replay/AutoBeReplayDocumentation.js +5 -3
- package/lib/replay/AutoBeReplayDocumentation.js.map +1 -1
- package/lib/replay/AutoBeReplayStorage.js +10 -3
- package/lib/replay/AutoBeReplayStorage.js.map +1 -1
- package/lib/structures/IAutoBeExampleBenchmarkState.d.ts +1 -1
- package/package.json +5 -6
- package/src/example/AutoBeExampleArchiver.ts +73 -29
- package/src/example/AutoBeExampleBenchmark.ts +74 -43
- package/src/example/{AutoBeExampleDocumentation.ts → AutoBeExampleLogger.ts} +20 -19
- package/src/example/AutoBeExampleStorage.ts +97 -26
- package/src/example/index.ts +1 -1
- package/src/replay/AutoBeReplayComputer.ts +40 -46
- package/src/replay/AutoBeReplayDocumentation.ts +5 -3
- package/src/replay/AutoBeReplayStorage.ts +10 -3
- package/src/structures/IAutoBeExampleBenchmarkState.ts +1 -1
- package/lib/example/AutoBeExampleDocumentation.js.map +0 -1
|
@@ -3,8 +3,9 @@ export declare namespace AutoBeExampleArchiver {
|
|
|
3
3
|
interface IContext {
|
|
4
4
|
vendor: string;
|
|
5
5
|
project: AutoBeExampleProject;
|
|
6
|
+
imagePath?: string;
|
|
6
7
|
agent: (props: IAgentProps) => Promise<IAutoBeAgent>;
|
|
7
|
-
on: (snapshot: AutoBeEventSnapshot) => void;
|
|
8
|
+
on: (snapshot: AutoBeEventSnapshot, agent: IAutoBeAgent) => void;
|
|
8
9
|
}
|
|
9
10
|
interface IAgentProps {
|
|
10
11
|
vendor: string;
|
|
@@ -26,20 +26,22 @@ var AutoBeExampleArchiver;
|
|
|
26
26
|
return (yield conversate(yield AutoBeExampleStorage_1.AutoBeExampleStorage.getUserMessage({
|
|
27
27
|
project: ctx.project,
|
|
28
28
|
phase: "analyze",
|
|
29
|
-
|
|
29
|
+
imagePath: ctx.imagePath,
|
|
30
|
+
}))) ||
|
|
30
31
|
(yield conversate("I'm not familiar with the analyze feature. Please determine everything by yourself, and just show me the analysis report.")) ||
|
|
31
|
-
(yield conversate("I already told you to publish the analysis report. Never ask me anything, and just do
|
|
32
|
+
(yield conversate("I already told you to publish the analysis report. Never ask me anything, and just do anything right now by your decision.")) ||
|
|
33
|
+
(yield conversate("Call analyze() function right now, never ask me anything again. You can do whatever you want."));
|
|
32
34
|
}),
|
|
33
35
|
predicate: (histories) => histories.some((h) => h.type === "analyze"),
|
|
34
36
|
});
|
|
35
37
|
AutoBeExampleArchiver.archivePrisma = (ctx) => archive(ctx, {
|
|
36
|
-
phase: "
|
|
38
|
+
phase: "database",
|
|
37
39
|
trial: getTrial({
|
|
38
40
|
project: ctx.project,
|
|
39
|
-
phase: "
|
|
41
|
+
phase: "database",
|
|
40
42
|
}),
|
|
41
43
|
predicate: (histories) => {
|
|
42
|
-
const prisma = histories.find((h) => h.type === "
|
|
44
|
+
const prisma = histories.find((h) => h.type === "database");
|
|
43
45
|
return prisma !== undefined && prisma.compiled.type === "success";
|
|
44
46
|
},
|
|
45
47
|
});
|
|
@@ -90,9 +92,9 @@ var AutoBeExampleArchiver;
|
|
|
90
92
|
agent.on(type, (e) => {
|
|
91
93
|
const s = {
|
|
92
94
|
event: e,
|
|
93
|
-
tokenUsage: agent.getTokenUsage(),
|
|
95
|
+
tokenUsage: typia_1.default.misc.clone(agent.getTokenUsage()),
|
|
94
96
|
};
|
|
95
|
-
ctx.on(s);
|
|
97
|
+
ctx.on(s, agent);
|
|
96
98
|
snapshots.push(s);
|
|
97
99
|
});
|
|
98
100
|
}
|
|
@@ -102,7 +104,7 @@ var AutoBeExampleArchiver;
|
|
|
102
104
|
project: ctx.project,
|
|
103
105
|
histories,
|
|
104
106
|
analyze: null,
|
|
105
|
-
|
|
107
|
+
database: null,
|
|
106
108
|
interface: null,
|
|
107
109
|
test: null,
|
|
108
110
|
realize: null,
|
|
@@ -142,25 +144,44 @@ var AutoBeExampleArchiver;
|
|
|
142
144
|
});
|
|
143
145
|
});
|
|
144
146
|
try {
|
|
147
|
+
let lastFunctionCallErrorMessage = null;
|
|
145
148
|
// CONVERSATE
|
|
146
149
|
const go = (c) => __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
try {
|
|
151
|
+
const result = yield agent.conversate(c);
|
|
152
|
+
const hasMeaningfulOutput = result.some((h) => h.type !== "userMessage");
|
|
153
|
+
return (result.some((h) => h.type === props.phase) ||
|
|
154
|
+
(hasMeaningfulOutput &&
|
|
155
|
+
result.every((h) => h.type !== "assistantMessage")));
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
if (error instanceof Error &&
|
|
159
|
+
error.message.includes("Failed to function calling")) {
|
|
160
|
+
lastFunctionCallErrorMessage = error.message;
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
149
165
|
});
|
|
150
166
|
const done = yield props.trial(go);
|
|
151
|
-
if (done === false)
|
|
152
|
-
throw new Error(`Failed to function calling in the "${props.phase}" phase of the "${ctx.project}" project.`);
|
|
153
|
-
// AGGREGATE
|
|
154
167
|
const histories = agent.getHistories();
|
|
168
|
+
if (done === false ||
|
|
169
|
+
histories.some((h) => h.type === props.phase) === false) {
|
|
170
|
+
const detail = lastFunctionCallErrorMessage;
|
|
171
|
+
throw new Error(detail
|
|
172
|
+
? `Failed to function calling in the "${props.phase}" phase of the "${ctx.project}" project.\n\n${detail}`
|
|
173
|
+
: `Failed to function calling in the "${props.phase}" phase of the "${ctx.project}" project.`);
|
|
174
|
+
}
|
|
175
|
+
// AGGREGATE
|
|
155
176
|
try {
|
|
156
177
|
yield filesystem_1.FileSystemIterator.save({
|
|
157
178
|
root: `${AutoBeExampleStorage_1.AutoBeExampleStorage.TEST_ROOT}/results/${AutoBeExampleStorage_1.AutoBeExampleStorage.slugModel(ctx.vendor, false)}/${ctx.project}/${props.phase}`,
|
|
158
|
-
files: Object.assign(Object.assign({}, (yield agent.getFiles())), Object.fromEntries(histories
|
|
159
|
-
.filter((h) => h.type === "
|
|
179
|
+
files: Object.assign(Object.assign(Object.assign({}, (yield agent.getFiles())), Object.fromEntries(histories
|
|
180
|
+
.filter((h) => h.type === "database" ||
|
|
160
181
|
h.type === "interface" ||
|
|
161
182
|
h.type === "test" ||
|
|
162
183
|
h.type === "realize")
|
|
163
|
-
.map((h) => [`autobe/${h.type}.instruction.md`, h.instruction]))),
|
|
184
|
+
.map((h) => [`autobe/${h.type}.instruction.md`, h.instruction]))), { "pnpm-workspace.yaml": "" }),
|
|
164
185
|
});
|
|
165
186
|
}
|
|
166
187
|
catch (_a) { }
|
|
@@ -183,6 +204,7 @@ var AutoBeExampleArchiver;
|
|
|
183
204
|
project: ctx.project,
|
|
184
205
|
files: {
|
|
185
206
|
[`${props.phase}.snapshots.json`]: JSON.stringify(snapshots),
|
|
207
|
+
[`${props.phase}.histories.json`]: JSON.stringify(agent.getHistories()),
|
|
186
208
|
[`${props.phase}.error.json`]: JSON.stringify(Object.assign(Object.assign({}, error), { name: error.name, message: error.message, stack: error.stack })),
|
|
187
209
|
},
|
|
188
210
|
});
|
|
@@ -191,7 +213,7 @@ var AutoBeExampleArchiver;
|
|
|
191
213
|
}
|
|
192
214
|
});
|
|
193
215
|
const getTrial = (props) => (conversate) => __awaiter(this, void 0, void 0, function* () {
|
|
194
|
-
return (yield conversate(yield AutoBeExampleStorage_1.AutoBeExampleStorage.getUserMessage(props)
|
|
216
|
+
return (yield conversate(yield AutoBeExampleStorage_1.AutoBeExampleStorage.getUserMessage(props))) ||
|
|
195
217
|
(yield conversate("Don't ask me to do that, and just do it right now.")) ||
|
|
196
218
|
(yield conversate(`I already told you to do ${props.phase} process. Never ask me anything, and just do it right now. Go go go!`));
|
|
197
219
|
});
|
|
@@ -206,7 +228,7 @@ var AutoBeExampleArchiver;
|
|
|
206
228
|
aggregate: utils_1.TokenUsageComputer.zero(),
|
|
207
229
|
facade: utils_1.TokenUsageComputer.zero(),
|
|
208
230
|
analyze: utils_1.TokenUsageComputer.zero(),
|
|
209
|
-
|
|
231
|
+
database: utils_1.TokenUsageComputer.zero(),
|
|
210
232
|
interface: utils_1.TokenUsageComputer.zero(),
|
|
211
233
|
test: utils_1.TokenUsageComputer.zero(),
|
|
212
234
|
realize: utils_1.TokenUsageComputer.zero(),
|
|
@@ -231,7 +253,7 @@ var AutoBeExampleArchiver;
|
|
|
231
253
|
})(AutoBeExampleArchiver || (exports.AutoBeExampleArchiver = AutoBeExampleArchiver = {}));
|
|
232
254
|
const PHASES = [
|
|
233
255
|
"analyze",
|
|
234
|
-
"
|
|
256
|
+
"database",
|
|
235
257
|
"interface",
|
|
236
258
|
"test",
|
|
237
259
|
"realize",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeExampleArchiver.js","sourceRoot":"","sources":["../../src/example/AutoBeExampleArchiver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAwD;AAexD,yCA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;YACvC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;QACL,OAAO;YACL,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,SAAS;YACT,UAAU;SACX,CAAC;IACJ,CAAC,CAAA,CAAC;AACJ,CAAC,EA5VgB,qBAAqB,qCAArB,qBAAqB,QA4VrC;AAED,MAAM,MAAM,GAAkB;IAC5B,SAAS;IACT,UAAU;IACV,WAAW;IACX,MAAM;IACN,SAAS;CACV,CAAC"}
|
|
@@ -9,7 +9,11 @@ export declare namespace AutoBeExampleBenchmark {
|
|
|
9
9
|
vendors: string[];
|
|
10
10
|
projects?: AutoBeExampleProject[];
|
|
11
11
|
phases?: AutoBePhase[];
|
|
12
|
+
imagePath?: string;
|
|
12
13
|
progress: (state: IAutoBeExampleBenchmarkState) => void;
|
|
13
|
-
on?: (event: AutoBeEvent
|
|
14
|
+
on?: (event: AutoBeEvent, agent: IAutoBeAgent, context: {
|
|
15
|
+
vendor: string;
|
|
16
|
+
project: AutoBeExampleProject;
|
|
17
|
+
}) => void;
|
|
14
18
|
}) => Promise<void>;
|
|
15
19
|
}
|
|
@@ -27,16 +27,20 @@ var AutoBeExampleBenchmark;
|
|
|
27
27
|
})),
|
|
28
28
|
};
|
|
29
29
|
const report = () => props.progress(state);
|
|
30
|
-
yield Promise.all(state.vendors.map((vendor) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
yield Promise.all(state.vendors.map((vendor) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
yield executeVendor(ctx, {
|
|
32
|
+
imagePath: props.imagePath,
|
|
33
|
+
phases: props.phases,
|
|
34
|
+
vendorState: vendor,
|
|
35
|
+
on: props.on,
|
|
36
|
+
report,
|
|
37
|
+
});
|
|
35
38
|
})));
|
|
36
39
|
});
|
|
37
40
|
const executeVendor = (ctx, props) => __awaiter(this, void 0, void 0, function* () {
|
|
38
41
|
for (const project of props.vendorState.projects)
|
|
39
42
|
yield executeProject(ctx, {
|
|
43
|
+
imagePath: props.imagePath,
|
|
40
44
|
vendor: props.vendorState.name,
|
|
41
45
|
projectState: project,
|
|
42
46
|
phases: props.phases,
|
|
@@ -55,43 +59,43 @@ var AutoBeExampleBenchmark;
|
|
|
55
59
|
success: null,
|
|
56
60
|
started_at: new Date(),
|
|
57
61
|
completed_at: null,
|
|
58
|
-
|
|
62
|
+
count: 0,
|
|
59
63
|
};
|
|
60
64
|
props.projectState.phases.push(phaseState);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
65
|
+
try {
|
|
66
|
+
phaseState.started_at = new Date();
|
|
67
|
+
phaseState.completed_at = null;
|
|
68
|
+
phaseState.count = 0;
|
|
69
|
+
const success = yield getArchiver(phase)({
|
|
70
|
+
vendor: props.vendor,
|
|
71
|
+
project: props.projectState.name,
|
|
72
|
+
imagePath: props.imagePath,
|
|
73
|
+
agent: (next) => ctx.createAgent(next),
|
|
74
|
+
on: (s, agent) => {
|
|
75
|
+
++phaseState.count;
|
|
76
|
+
const event = s.event;
|
|
77
|
+
if (event.type !== "jsonValidateError" &&
|
|
78
|
+
event.type !== "jsonParseError" &&
|
|
79
|
+
event.type !== "preliminary" &&
|
|
80
|
+
event.type !== "consentFunctionCall")
|
|
81
|
+
phaseState.snapshot = s;
|
|
82
|
+
props.report();
|
|
83
|
+
if (props.on)
|
|
84
|
+
props.on(s.event, agent, {
|
|
85
|
+
vendor: props.vendor,
|
|
86
|
+
project: props.projectState.name,
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
phaseState.success = success;
|
|
91
|
+
phaseState.completed_at = new Date();
|
|
92
|
+
props.report();
|
|
91
93
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
catch (error) {
|
|
95
|
+
console.log(props.vendor, props.projectState.name, phaseState.name, error);
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
if (phaseState.success === null || phaseState.success === false)
|
|
95
99
|
break;
|
|
96
100
|
}
|
|
97
101
|
props.projectState.completed_at = new Date();
|
|
@@ -102,7 +106,7 @@ var AutoBeExampleBenchmark;
|
|
|
102
106
|
const getArchiver = (phase) => {
|
|
103
107
|
if (phase === "analyze")
|
|
104
108
|
return AutoBeExampleArchiver_1.AutoBeExampleArchiver.archiveAnalyze;
|
|
105
|
-
else if (phase === "
|
|
109
|
+
else if (phase === "database")
|
|
106
110
|
return AutoBeExampleArchiver_1.AutoBeExampleArchiver.archivePrisma;
|
|
107
111
|
else if (phase === "interface")
|
|
108
112
|
return AutoBeExampleArchiver_1.AutoBeExampleArchiver.archiveInterface;
|
|
@@ -113,10 +117,17 @@ const getArchiver = (phase) => {
|
|
|
113
117
|
phase;
|
|
114
118
|
throw new Error(`Unknown phase: ${phase}`);
|
|
115
119
|
};
|
|
116
|
-
const PROJECT_SEQUENCE = [
|
|
120
|
+
const PROJECT_SEQUENCE = [
|
|
121
|
+
"todo",
|
|
122
|
+
"bbs",
|
|
123
|
+
"reddit",
|
|
124
|
+
"shopping",
|
|
125
|
+
"account",
|
|
126
|
+
"erp",
|
|
127
|
+
];
|
|
117
128
|
const PHASE_SEQUENCE = [
|
|
118
129
|
"analyze",
|
|
119
|
-
"
|
|
130
|
+
"database",
|
|
120
131
|
"interface",
|
|
121
132
|
"test",
|
|
122
133
|
"realize",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeExampleBenchmark.js","sourceRoot":"","sources":["../../src/example/AutoBeExampleBenchmark.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,mEAAgE;AAEhE,IAAiB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"AutoBeExampleBenchmark.js","sourceRoot":"","sources":["../../src/example/AutoBeExampleBenchmark.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,mEAAgE;AAEhE,IAAiB,sBAAsB,CAyJtC;AAzJD,WAAiB,sBAAsB;IAOxB,8BAAO,GAAG,CACrB,GAAa,EACb,KAWC,EACc,EAAE;QACjB,MAAM,KAAK,GAAiC;YAC1C,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CACxB,CAAC,MAAM,EAA0C,EAAE,CAAC,CAAC;gBACnD,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAC/B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CACrD,CAAC,GAAG,CACH,CAAC,OAAO,EAA2C,EAAE,CAAC,CAAC;oBACrD,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE,EAAE;oBACV,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,IAAI;oBAChB,YAAY,EAAE,IAAI;iBACnB,CAAC,CACH;aACF,CAAC,CACH;SACF,CAAC;QACF,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAO,MAAM,EAAE,EAAE;YACjC,MAAM,aAAa,CAAC,GAAG,EAAE;gBACvB,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;g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__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.AutoBeExampleLogger = void 0;
|
|
7
7
|
const utils_1 = require("@autobe/utils");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
|
-
var
|
|
10
|
-
(function (
|
|
11
|
-
|
|
9
|
+
var AutoBeExampleLogger;
|
|
10
|
+
(function (AutoBeExampleLogger) {
|
|
11
|
+
AutoBeExampleLogger.markdown = (state) => utils_1.StringUtil.trim `
|
|
12
12
|
# AutoBe Example Benchmark Report
|
|
13
13
|
|
|
14
14
|
${markdownIndex(state)}
|
|
@@ -27,31 +27,33 @@ var AutoBeExampleDocumentation;
|
|
|
27
27
|
const markdownVendor = (state) => utils_1.StringUtil.trim `
|
|
28
28
|
## \`${state.name}\`
|
|
29
29
|
|
|
30
|
-
Project | Phase | State | Elapsed Time
|
|
31
|
-
|
|
30
|
+
Project | Phase | State | Count | Elapsed Time
|
|
31
|
+
:-------|:------|:------|------:|-------------:
|
|
32
32
|
${state.projects.map(markdownProject).join("\n")}
|
|
33
33
|
`;
|
|
34
34
|
const markdownProject = (state) => {
|
|
35
|
+
var _a, _b;
|
|
35
36
|
// yellow circle emoji:
|
|
36
37
|
const phase = state.phases.at(-1);
|
|
37
38
|
return [
|
|
38
39
|
state.name,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
?
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
(_a = phase === null || phase === void 0 ? void 0 : phase.name) !== null && _a !== void 0 ? _a : "-",
|
|
41
|
+
phase !== undefined && phase.snapshot !== null
|
|
42
|
+
? [
|
|
43
|
+
state.completed_at !== null
|
|
44
|
+
? state.success
|
|
45
|
+
? "🟢 success"
|
|
46
|
+
: "🔴 failure"
|
|
47
|
+
: "🟡",
|
|
48
|
+
`\`${phase.snapshot.event.type}\``,
|
|
49
|
+
...(typia_1.default.is(phase.snapshot.event)
|
|
50
|
+
? [
|
|
51
|
+
`(${phase.snapshot.event.completed} of ${phase.snapshot.event.total})`,
|
|
52
|
+
]
|
|
53
|
+
: []),
|
|
54
|
+
].join(" ")
|
|
55
|
+
: "-",
|
|
56
|
+
(_b = phase === null || phase === void 0 ? void 0 : phase.count.toLocaleString()) !== null && _b !== void 0 ? _b : "0",
|
|
55
57
|
state.started_at !== null
|
|
56
58
|
? elapsedTime({
|
|
57
59
|
started_at: state.started_at,
|
|
@@ -60,11 +62,11 @@ var AutoBeExampleDocumentation;
|
|
|
60
62
|
: "-",
|
|
61
63
|
].join(" | ");
|
|
62
64
|
};
|
|
63
|
-
})(
|
|
65
|
+
})(AutoBeExampleLogger || (exports.AutoBeExampleLogger = AutoBeExampleLogger = {}));
|
|
64
66
|
const elapsedTime = (props) => {
|
|
65
67
|
var _a;
|
|
66
68
|
return Math.round((((_a = props.completed_at) !== null && _a !== void 0 ? _a : new Date()).getTime() -
|
|
67
69
|
props.started_at.getTime()) /
|
|
68
70
|
1000).toLocaleString() + " sec";
|
|
69
71
|
};
|
|
70
|
-
//# sourceMappingURL=
|
|
72
|
+
//# sourceMappingURL=AutoBeExampleLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoBeExampleLogger.js","sourceRoot":"","sources":["../../src/example/AutoBeExampleLogger.ts"],"names":[],"mappings":";;;;;;AACA,yCAA2C;AAC3C,kDAA0B;AAI1B,IAAiB,mBAAmB,CAoEnC;AApED,WAAiB,mBAAmB;IACrB,4BAAQ,GAAG,CAAC,KAAmC,EAAU,EAAE,CACtE,kBAAU,CAAC,IAAI,CAAA;;;QAGX,aAAa,CAAC,KAAK,CAAC;;QAEpB,KAAK,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AQ,CAAC,KAAK,CAAC;wBACzD,CAAC,CAAC;4BACE,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG;yBACvE;wBACH,CAAC,CAAC,EAAE,CAAC;iBACR,CAAC,IAAI,CAAC,GAAG,CAAC;gBACb,CAAC,CAAC,GAAG;YACP,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC,cAAc,EAAE,mCAAI,GAAG;YACpC,KAAK,CAAC,UAAU,KAAK,IAAI;gBACvB,CAAC,CAAC,WAAW,CAAC;oBACV,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;iBACjC,CAAC;gBACJ,CAAC,CAAC,GAAG;SACR,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,EApEgB,mBAAmB,mCAAnB,mBAAmB,QAoEnC;AAED,MAAM,WAAW,GAAG,CAAC,KAGpB,EAAU,EAAE;;IACX,OAAA,IAAI,CAAC,KAAK,CACR,CAAC,CAAC,MAAA,KAAK,CAAC,YAAY,mCAAI,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;QAC3C,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAK,CACR,CAAC,cAAc,EAAE,GAAG,MAAM,CAAA;CAAA,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutoBeEventSnapshot, AutoBeExampleProject, AutoBeHistory, AutoBePhase,
|
|
1
|
+
import { AutoBeEventSnapshot, AutoBeExampleProject, AutoBeHistory, AutoBePhase, AutoBeUserConversateContent, IAutoBeTokenUsageJson } from "@autobe/interface";
|
|
2
2
|
export declare namespace AutoBeExampleStorage {
|
|
3
3
|
const TEST_ROOT: string;
|
|
4
4
|
const repository: () => string;
|
|
@@ -11,10 +11,17 @@ export declare namespace AutoBeExampleStorage {
|
|
|
11
11
|
project: AutoBeExampleProject;
|
|
12
12
|
files: Record<string, string | null>;
|
|
13
13
|
}) => Promise<void>;
|
|
14
|
+
const load: <T>(props: {
|
|
15
|
+
vendor: string;
|
|
16
|
+
project: AutoBeExampleProject;
|
|
17
|
+
file: string;
|
|
18
|
+
}) => Promise<T | null>;
|
|
19
|
+
const loadImages: (imagePath: string) => Promise<AutoBeUserConversateContent[]>;
|
|
14
20
|
const getUserMessage: (props: {
|
|
15
21
|
project: AutoBeExampleProject;
|
|
16
22
|
phase: AutoBePhase;
|
|
17
|
-
|
|
23
|
+
imagePath?: string;
|
|
24
|
+
}) => Promise<AutoBeUserConversateContent[]>;
|
|
18
25
|
const getVendorModels: () => Promise<string[]>;
|
|
19
26
|
const getHistories: (props: {
|
|
20
27
|
vendor: string;
|
|
@@ -18,7 +18,6 @@ const child_process_1 = __importDefault(require("child_process"));
|
|
|
18
18
|
const fs_1 = __importDefault(require("fs"));
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
20
|
const tstl_1 = require("tstl");
|
|
21
|
-
const uuid_1 = require("uuid");
|
|
22
21
|
var AutoBeExampleStorage;
|
|
23
22
|
(function (AutoBeExampleStorage) {
|
|
24
23
|
AutoBeExampleStorage.TEST_ROOT = `${__dirname}/../../../../test`;
|
|
@@ -31,36 +30,87 @@ var AutoBeExampleStorage;
|
|
|
31
30
|
overwrite: true,
|
|
32
31
|
});
|
|
33
32
|
});
|
|
33
|
+
AutoBeExampleStorage.load = (props) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const location = `${AutoBeExampleStorage.getDirectory(props)}/${props.file}.gz`;
|
|
35
|
+
if (fs_1.default.existsSync(location) === false)
|
|
36
|
+
return null;
|
|
37
|
+
const content = yield filesystem_1.CompressUtil.gunzip(yield fs_1.default.promises.readFile(location));
|
|
38
|
+
return JSON.parse(content);
|
|
39
|
+
});
|
|
40
|
+
AutoBeExampleStorage.loadImages = (imagePath) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const stat = yield fs_1.default.promises.lstat(imagePath);
|
|
42
|
+
const filePaths = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (stat.isFile() === true) {
|
|
44
|
+
if (imagePath.endsWith(".png") === false)
|
|
45
|
+
throw new Error("Image Format must be .png");
|
|
46
|
+
return [imagePath];
|
|
47
|
+
}
|
|
48
|
+
const files = yield fs_1.default.promises.readdir(imagePath);
|
|
49
|
+
return files
|
|
50
|
+
.filter((f) => f.endsWith(".png"))
|
|
51
|
+
.map((f) => path_1.default.join(imagePath, f));
|
|
52
|
+
}))();
|
|
53
|
+
return Promise.all(filePaths.map((filePath) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const extension = path_1.default.extname(filePath).toLowerCase().slice(1);
|
|
55
|
+
const base64Data = `data:image/${extension};base64,${yield fs_1.default.promises.readFile(filePath, "base64")}`;
|
|
56
|
+
return {
|
|
57
|
+
type: "image",
|
|
58
|
+
image: {
|
|
59
|
+
type: "base64",
|
|
60
|
+
data: base64Data,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
})));
|
|
64
|
+
});
|
|
34
65
|
AutoBeExampleStorage.getUserMessage = (props) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const imageMessages = props.imagePath
|
|
67
|
+
? yield AutoBeExampleStorage.loadImages(props.imagePath)
|
|
68
|
+
: [];
|
|
35
69
|
const full = `${AutoBeExampleStorage.TEST_ROOT}/scripts/${props.project}/${props.phase}`;
|
|
70
|
+
if (props.project === "account" && props.phase === "analyze") {
|
|
71
|
+
const files = yield fs_1.default.promises.readdir(full);
|
|
72
|
+
const contents = yield Promise.all(files.map((filename) => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
var _a;
|
|
74
|
+
const filePath = path_1.default.join(full, filename);
|
|
75
|
+
const extension = (_a = filename.split(".").pop()) !== null && _a !== void 0 ? _a : "unknown";
|
|
76
|
+
const base64Data = `data:image/${extension};base64,${yield fs_1.default.promises.readFile(filePath, "base64")}`;
|
|
77
|
+
return {
|
|
78
|
+
type: "image",
|
|
79
|
+
image: {
|
|
80
|
+
type: "base64",
|
|
81
|
+
data: base64Data,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
})));
|
|
85
|
+
return [
|
|
86
|
+
...contents,
|
|
87
|
+
...imageMessages,
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: "Convert the images into a planning document.",
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
}
|
|
36
94
|
if (fs_1.default.existsSync(`${full}.md`) === false) {
|
|
37
95
|
const text = props.phase === "analyze"
|
|
38
96
|
? yield fs_1.default.promises.readFile(`${AutoBeExampleStorage.TEST_ROOT}/scripts/${props.project}.md`, "utf8")
|
|
39
97
|
: PROMPT_TEMPLATE[props.phase];
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
id: (0, uuid_1.v7)(),
|
|
43
|
-
created_at: new Date().toISOString(),
|
|
44
|
-
contents: [
|
|
45
|
-
{
|
|
46
|
-
type: "text",
|
|
47
|
-
text,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
const text = yield fs_1.default.promises.readFile(`${full}.md`, "utf8");
|
|
53
|
-
return {
|
|
54
|
-
type: "userMessage",
|
|
55
|
-
id: (0, uuid_1.v7)(),
|
|
56
|
-
created_at: new Date().toISOString(),
|
|
57
|
-
contents: [
|
|
98
|
+
return [
|
|
99
|
+
...imageMessages,
|
|
58
100
|
{
|
|
59
101
|
type: "text",
|
|
60
|
-
text
|
|
102
|
+
text,
|
|
61
103
|
},
|
|
62
|
-
]
|
|
63
|
-
}
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
const text = yield fs_1.default.promises.readFile(`${full}.md`, "utf8");
|
|
107
|
+
return [
|
|
108
|
+
...imageMessages,
|
|
109
|
+
{
|
|
110
|
+
type: "text",
|
|
111
|
+
text,
|
|
112
|
+
},
|
|
113
|
+
];
|
|
64
114
|
});
|
|
65
115
|
AutoBeExampleStorage.getVendorModels = () => __awaiter(this, void 0, void 0, function* () {
|
|
66
116
|
const result = [];
|
|
@@ -109,7 +159,7 @@ var AutoBeExampleStorage;
|
|
|
109
159
|
aggregate: component(),
|
|
110
160
|
facade: component(),
|
|
111
161
|
analyze: component(),
|
|
112
|
-
|
|
162
|
+
database: component(),
|
|
113
163
|
interface: component(),
|
|
114
164
|
test: component(),
|
|
115
165
|
realize: component(),
|
|
@@ -126,7 +176,7 @@ var AutoBeExampleStorage;
|
|
|
126
176
|
return model;
|
|
127
177
|
};
|
|
128
178
|
const PROMPT_TEMPLATE = {
|
|
129
|
-
|
|
179
|
+
database: "Design the database schema.",
|
|
130
180
|
interface: "Create the API interface specification.",
|
|
131
181
|
test: "Make the e2e test functions.",
|
|
132
182
|
realize: "Implement API functions.",
|