@autobe/agent 0.30.3 → 0.30.4
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/AutoBeMockAgent.d.ts +2 -1
- package/lib/AutoBeMockAgent.js +37 -16
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/index.mjs +32 -49
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/interface/utils/AutoBeJsonSchemaValidator.js +33 -36
- package/lib/orchestrate/interface/utils/AutoBeJsonSchemaValidator.js.map +1 -1
- package/lib/structures/IAutoBeVendor.d.ts +13 -0
- package/package.json +5 -5
- package/src/AutoBeMockAgent.ts +49 -18
- package/src/orchestrate/interface/utils/AutoBeJsonSchemaValidator.ts +37 -37
- package/src/structures/IAutoBeVendor.ts +14 -0
package/lib/AutoBeMockAgent.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IAutoBeCompiler, IAutoBeCompilerListener, IAutoBePlaygroundReplay } from "@autobe/interface";
|
|
1
|
+
import { AutoBeEvent, IAutoBeCompiler, IAutoBeCompilerListener, IAutoBePlaygroundReplay } from "@autobe/interface";
|
|
2
2
|
export declare namespace AutoBeMockAgent {
|
|
3
3
|
interface IProps {
|
|
4
4
|
compiler: (listener: IAutoBeCompilerListener) => IAutoBeCompiler | Promise<IAutoBeCompiler>;
|
|
5
5
|
replay: IAutoBePlaygroundReplay;
|
|
6
|
+
delay?: ((type: AutoBeEvent.Type) => number | undefined) | undefined;
|
|
6
7
|
}
|
|
7
8
|
}
|
package/lib/AutoBeMockAgent.js
CHANGED
|
@@ -47,17 +47,16 @@ class AutoBeMockAgent extends AutoBeAgentBase_1.AutoBeAgentBase {
|
|
|
47
47
|
: Array.isArray(content)
|
|
48
48
|
? content
|
|
49
49
|
: [content];
|
|
50
|
-
// THE USER-MESSAGE
|
|
51
|
-
const userMessage = {
|
|
52
|
-
id: (0, uuid_1.v7)(),
|
|
53
|
-
type: "userMessage",
|
|
54
|
-
contents: contents.map((c) => (0, createAutoBeMessageContent_1.createAutoBeUserMessageContent)({ content: c })),
|
|
55
|
-
created_at: new Date().toISOString(),
|
|
56
|
-
};
|
|
57
|
-
void this.dispatch(userMessage).catch(() => { });
|
|
58
50
|
// ALREADY REALIZED CASE
|
|
59
51
|
const state = (0, createAutoBeState_1.createAutoBeState)(this.histories_);
|
|
60
52
|
if (state.realize !== null) {
|
|
53
|
+
const userMessage = {
|
|
54
|
+
id: (0, uuid_1.v7)(),
|
|
55
|
+
type: "userMessage",
|
|
56
|
+
contents: contents.map((c) => (0, createAutoBeMessageContent_1.createAutoBeUserMessageContent)({ content: c })),
|
|
57
|
+
created_at: new Date().toISOString(),
|
|
58
|
+
};
|
|
59
|
+
void this.dispatch(userMessage).catch(() => { });
|
|
61
60
|
yield (0, tstl_1.sleep_for)(2000);
|
|
62
61
|
const assistantMessage = {
|
|
63
62
|
id: (0, uuid_1.v7)(),
|
|
@@ -75,10 +74,15 @@ class AutoBeMockAgent extends AutoBeAgentBase_1.AutoBeAgentBase {
|
|
|
75
74
|
return this.histories_;
|
|
76
75
|
}
|
|
77
76
|
const take = (type) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
var _a;
|
|
77
|
+
var _a, _b, _c, _d;
|
|
79
78
|
const snapshots = this.getEventSnapshots(type);
|
|
80
79
|
if (snapshots === null) {
|
|
81
|
-
this.histories_.push(
|
|
80
|
+
this.histories_.push({
|
|
81
|
+
id: (0, uuid_1.v7)(),
|
|
82
|
+
type: "userMessage",
|
|
83
|
+
contents: contents.map((c) => (0, createAutoBeMessageContent_1.createAutoBeUserMessageContent)({ content: c })),
|
|
84
|
+
created_at: new Date().toISOString(),
|
|
85
|
+
});
|
|
82
86
|
this.histories_.push({
|
|
83
87
|
id: (0, uuid_1.v7)(),
|
|
84
88
|
type: "assistantMessage",
|
|
@@ -92,13 +96,30 @@ class AutoBeMockAgent extends AutoBeAgentBase_1.AutoBeAgentBase {
|
|
|
92
96
|
});
|
|
93
97
|
return;
|
|
94
98
|
}
|
|
99
|
+
// Find the nearest user message that led into this phase for history
|
|
100
|
+
// tracking. There may be assistant messages between the user request
|
|
101
|
+
// and the resulting phase history, so we search backwards.
|
|
102
|
+
const phaseIndex = this.props_.replay.histories.findIndex((h) => h.type === type);
|
|
103
|
+
const originalUserMessage = phaseIndex > 0
|
|
104
|
+
? this.props_.replay.histories
|
|
105
|
+
.slice(0, phaseIndex)
|
|
106
|
+
.reverse()
|
|
107
|
+
.find((h) => h.type === "userMessage")
|
|
108
|
+
: undefined;
|
|
95
109
|
for (const s of snapshots) {
|
|
96
|
-
const time = (_a = sleepMap[s.event.type]) !== null &&
|
|
110
|
+
const time = (_d = (_c = (_b = (_a = this.props_).delay) === null || _b === void 0 ? void 0 : _b.call(_a, s.event.type)) !== null && _c !== void 0 ? _c : sleepMap[s.event.type]) !== null && _d !== void 0 ? _d : 500;
|
|
97
111
|
yield (0, tstl_1.sleep_for)((0, tstl_1.randint)(time * 0.2, time * 1.8));
|
|
98
112
|
void this.dispatch(s.event).catch(() => { });
|
|
99
113
|
this.token_usage_ = new AutoBeTokenUsage_1.AutoBeTokenUsage(s.tokenUsage);
|
|
100
114
|
}
|
|
101
|
-
this.histories_.push(userMessage
|
|
115
|
+
this.histories_.push((originalUserMessage === null || originalUserMessage === void 0 ? void 0 : originalUserMessage.type) === "userMessage"
|
|
116
|
+
? originalUserMessage
|
|
117
|
+
: {
|
|
118
|
+
id: (0, uuid_1.v7)(),
|
|
119
|
+
type: "userMessage",
|
|
120
|
+
contents: contents.map((c) => (0, createAutoBeMessageContent_1.createAutoBeUserMessageContent)({ content: c })),
|
|
121
|
+
created_at: new Date().toISOString(),
|
|
122
|
+
});
|
|
102
123
|
this.histories_.push(this.props_.replay.histories.find((h) => h.type === type));
|
|
103
124
|
});
|
|
104
125
|
if (state.analyze === null)
|
|
@@ -170,8 +191,8 @@ const sleepMap = {
|
|
|
170
191
|
analyzeStart: 1000,
|
|
171
192
|
analyzeScenario: 1000,
|
|
172
193
|
analyzeWriteModule: 500,
|
|
173
|
-
analyzeWriteUnit:
|
|
174
|
-
analyzeWriteSection:
|
|
194
|
+
analyzeWriteUnit: 250,
|
|
195
|
+
analyzeWriteSection: 200,
|
|
175
196
|
analyzeSectionReview: 300,
|
|
176
197
|
analyzeScenarioReview: 300,
|
|
177
198
|
analyzeComplete: 1000,
|
|
@@ -191,10 +212,10 @@ const sleepMap = {
|
|
|
191
212
|
// INTERFACE
|
|
192
213
|
interfaceStart: 1000,
|
|
193
214
|
interfaceGroup: 1000,
|
|
194
|
-
interfaceEndpoint:
|
|
215
|
+
interfaceEndpoint: 500,
|
|
195
216
|
interfaceEndpointReview: 1000,
|
|
196
217
|
interfaceOperation: 400,
|
|
197
|
-
interfaceOperationReview:
|
|
218
|
+
interfaceOperationReview: 500,
|
|
198
219
|
interfaceAuthorization: 400,
|
|
199
220
|
interfaceSchema: 400,
|
|
200
221
|
interfaceSchemaCasting: 400,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeMockAgent.js","sourceRoot":"","sources":["../src/AutoBeMockAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAcA,+BAAqD;AACrD,+BAA0B;AAE1B,uDAAoD;AAEpD,iEAA8D;AAC9D,qFAAsF;AACtF,mEAAgE;AAChE,qEAAkE;AAElE,gBAAgB;AAChB,MAAa,eAAgB,SAAQ,iCAAe;IAMlD,YAAmB,KAA6B;QAC9C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAS,CAAC,GAAS,EAAE;YACxC,OAAA,KAAK,CAAC,QAAQ,CAAC;gBACb,OAAO,EAAE;oBACP,IAAI,EAAE;wBACJ,WAAW,EAAE,GAAS,EAAE,gDAAE,CAAC,CAAA;wBAC3B,OAAO,EAAE,GAAS,EAAE,gDAAE,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A4B,EAAE,IAAK;IACnC,gBAAgB,EAAE,IAAK;IACvB,gBAAgB,EAAE,IAAK;IACvB,oBAAoB,EAAE,GAAG;IACzB,mBAAmB,EAAE,IAAK;CAC3B,CAAC"}
|
package/lib/index.mjs
CHANGED
|
@@ -2916,7 +2916,6 @@ var AutoBeJsonSchemaValidator;
|
|
|
2916
2916
|
validateReferenceId(props);
|
|
2917
2917
|
validatePropertyNames(props);
|
|
2918
2918
|
validateNumericRanges(props);
|
|
2919
|
-
validateEmptyProperties(props);
|
|
2920
2919
|
vo(props.typeName, props.schema);
|
|
2921
2920
|
AutoBeOpenApiTypeChecker.skim({
|
|
2922
2921
|
schema: props.schema,
|
|
@@ -3415,38 +3414,6 @@ var AutoBeJsonSchemaValidator;
|
|
|
3415
3414
|
}
|
|
3416
3415
|
});
|
|
3417
3416
|
};
|
|
3418
|
-
const validateEmptyProperties = props => {
|
|
3419
|
-
if (AutoBeOpenApiTypeChecker.isObject(props.schema) === false) return;
|
|
3420
|
-
if (Object.keys(props.schema.properties).length !== 0) return;
|
|
3421
|
-
if (AutoBeJsonSchemaValidator.isObjectType({
|
|
3422
|
-
operations: props.operations,
|
|
3423
|
-
typeName: props.typeName
|
|
3424
|
-
}) === false) return;
|
|
3425
|
-
props.errors.push({
|
|
3426
|
-
path: props.path,
|
|
3427
|
-
expected: "At least 1 property in properties",
|
|
3428
|
-
value: props.schema,
|
|
3429
|
-
description: StringUtil.trim`
|
|
3430
|
-
Schema ${JSON.stringify(props.typeName)} has zero properties but is used
|
|
3431
|
-
as a request body or response body in API operations.
|
|
3432
|
-
|
|
3433
|
-
Empty properties will cause TypeScript compilation errors (TS2339) in the
|
|
3434
|
-
downstream Realize stage because implementation code will try to access
|
|
3435
|
-
properties that don't exist on the type.
|
|
3436
|
-
|
|
3437
|
-
You MUST define at least one property in the schema. Load the database
|
|
3438
|
-
schema and add the appropriate properties based on the DTO type:
|
|
3439
|
-
- ICreate: User-provided business fields (exclude id, timestamps, actor FKs)
|
|
3440
|
-
- IUpdate: All mutable business fields (all optional)
|
|
3441
|
-
- ISummary: Essential display fields for list views
|
|
3442
|
-
- IEntity (root): All public fields including relations
|
|
3443
|
-
- IRequest: Pagination and filter parameters
|
|
3444
|
-
- IJoin/ILogin: Credentials and session context fields
|
|
3445
|
-
|
|
3446
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
3447
|
-
`
|
|
3448
|
-
});
|
|
3449
|
-
};
|
|
3450
3417
|
})(AutoBeJsonSchemaValidator || (AutoBeJsonSchemaValidator = {}));
|
|
3451
3418
|
|
|
3452
3419
|
var AutoBeInterfaceSchemaProgrammer;
|
|
@@ -71305,17 +71272,17 @@ class AutoBeMockAgent extends AutoBeAgentBase {
|
|
|
71305
71272
|
type: "text",
|
|
71306
71273
|
text: content
|
|
71307
71274
|
} ] : Array.isArray(content) ? content : [ content ];
|
|
71308
|
-
const userMessage = {
|
|
71309
|
-
id: v7(),
|
|
71310
|
-
type: "userMessage",
|
|
71311
|
-
contents: contents.map(c => createAutoBeUserMessageContent({
|
|
71312
|
-
content: c
|
|
71313
|
-
})),
|
|
71314
|
-
created_at: (new Date).toISOString()
|
|
71315
|
-
};
|
|
71316
|
-
void this.dispatch(userMessage).catch(() => {});
|
|
71317
71275
|
const state = createAutoBeState(this.histories_);
|
|
71318
71276
|
if (state.realize !== null) {
|
|
71277
|
+
const userMessage = {
|
|
71278
|
+
id: v7(),
|
|
71279
|
+
type: "userMessage",
|
|
71280
|
+
contents: contents.map(c => createAutoBeUserMessageContent({
|
|
71281
|
+
content: c
|
|
71282
|
+
})),
|
|
71283
|
+
created_at: (new Date).toISOString()
|
|
71284
|
+
};
|
|
71285
|
+
void this.dispatch(userMessage).catch(() => {});
|
|
71319
71286
|
await sleep_for(2e3);
|
|
71320
71287
|
const assistantMessage = {
|
|
71321
71288
|
id: v7(),
|
|
@@ -71331,7 +71298,14 @@ class AutoBeMockAgent extends AutoBeAgentBase {
|
|
|
71331
71298
|
const take = async type => {
|
|
71332
71299
|
const snapshots = this.getEventSnapshots(type);
|
|
71333
71300
|
if (snapshots === null) {
|
|
71334
|
-
this.histories_.push(
|
|
71301
|
+
this.histories_.push({
|
|
71302
|
+
id: v7(),
|
|
71303
|
+
type: "userMessage",
|
|
71304
|
+
contents: contents.map(c => createAutoBeUserMessageContent({
|
|
71305
|
+
content: c
|
|
71306
|
+
})),
|
|
71307
|
+
created_at: (new Date).toISOString()
|
|
71308
|
+
});
|
|
71335
71309
|
this.histories_.push({
|
|
71336
71310
|
id: v7(),
|
|
71337
71311
|
type: "assistantMessage",
|
|
@@ -71341,13 +71315,22 @@ class AutoBeMockAgent extends AutoBeAgentBase {
|
|
|
71341
71315
|
});
|
|
71342
71316
|
return;
|
|
71343
71317
|
}
|
|
71318
|
+
const phaseIndex = this.props_.replay.histories.findIndex(h => h.type === type);
|
|
71319
|
+
const originalUserMessage = phaseIndex > 0 ? this.props_.replay.histories.slice(0, phaseIndex).reverse().find(h => h.type === "userMessage") : undefined;
|
|
71344
71320
|
for (const s of snapshots) {
|
|
71345
|
-
const time = sleepMap[s.event.type] ?? 500;
|
|
71321
|
+
const time = this.props_.delay?.(s.event.type) ?? sleepMap[s.event.type] ?? 500;
|
|
71346
71322
|
await sleep_for(randint(time * .2, time * 1.8));
|
|
71347
71323
|
void this.dispatch(s.event).catch(() => {});
|
|
71348
71324
|
this.token_usage_ = new AutoBeTokenUsage(s.tokenUsage);
|
|
71349
71325
|
}
|
|
71350
|
-
this.histories_.push(userMessage
|
|
71326
|
+
this.histories_.push(originalUserMessage?.type === "userMessage" ? originalUserMessage : {
|
|
71327
|
+
id: v7(),
|
|
71328
|
+
type: "userMessage",
|
|
71329
|
+
contents: contents.map(c => createAutoBeUserMessageContent({
|
|
71330
|
+
content: c
|
|
71331
|
+
})),
|
|
71332
|
+
created_at: (new Date).toISOString()
|
|
71333
|
+
});
|
|
71351
71334
|
this.histories_.push(this.props_.replay.histories.find(h => h.type === type));
|
|
71352
71335
|
};
|
|
71353
71336
|
if (state.analyze === null) await take("analyze"); else if (state.database === null) await take("database"); else if (state.interface === null) await take("interface"); else if (state.test === null) await take("test"); else if (state.realize === null) await take("realize");
|
|
@@ -71394,8 +71377,8 @@ const sleepMap = {
|
|
|
71394
71377
|
analyzeStart: 1e3,
|
|
71395
71378
|
analyzeScenario: 1e3,
|
|
71396
71379
|
analyzeWriteModule: 500,
|
|
71397
|
-
analyzeWriteUnit:
|
|
71398
|
-
analyzeWriteSection:
|
|
71380
|
+
analyzeWriteUnit: 250,
|
|
71381
|
+
analyzeWriteSection: 200,
|
|
71399
71382
|
analyzeSectionReview: 300,
|
|
71400
71383
|
analyzeScenarioReview: 300,
|
|
71401
71384
|
analyzeComplete: 1e3,
|
|
@@ -71413,10 +71396,10 @@ const sleepMap = {
|
|
|
71413
71396
|
databaseComplete: 1e3,
|
|
71414
71397
|
interfaceStart: 1e3,
|
|
71415
71398
|
interfaceGroup: 1e3,
|
|
71416
|
-
interfaceEndpoint:
|
|
71399
|
+
interfaceEndpoint: 500,
|
|
71417
71400
|
interfaceEndpointReview: 1e3,
|
|
71418
71401
|
interfaceOperation: 400,
|
|
71419
|
-
interfaceOperationReview:
|
|
71402
|
+
interfaceOperationReview: 500,
|
|
71420
71403
|
interfaceAuthorization: 400,
|
|
71421
71404
|
interfaceSchema: 400,
|
|
71422
71405
|
interfaceSchemaCasting: 400,
|