@yeaft/webchat-agent 1.0.249 → 1.0.250
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/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +276 -273
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +2 -2
- package/local-runtime/web/style.bundle.css +1 -1
- package/local-runtime/web/style.bundle.css.gz +0 -0
- package/package.json +1 -1
- package/yeaft/work-center/bridge.js +2 -2
- package/yeaft/work-center/debug-projection.js +1 -0
- package/yeaft/work-center/projection.js +5 -1
- package/yeaft/work-center/service.js +16 -0
|
Binary file
|
package/package.json
CHANGED
|
@@ -35,8 +35,8 @@ const BROWSER_FILE_FIELDS = Object.freeze({
|
|
|
35
35
|
delete: ['id', 'revision'],
|
|
36
36
|
guide: ['id', 'guidance', 'actionId', 'revision', 'generation', 'files'],
|
|
37
37
|
get_action_messages: ['id', 'actionId', 'generation', 'cursor', 'limit'],
|
|
38
|
-
get_action_requests: ['id', 'actionId'],
|
|
39
|
-
get_action_request: ['id', 'actionId', 'runId', 'requestId'],
|
|
38
|
+
get_action_requests: ['id', 'actionId', 'generation'],
|
|
39
|
+
get_action_request: ['id', 'actionId', 'generation', 'runId', 'requestId'],
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
function browserFilePayload(op, value) {
|
|
@@ -639,6 +639,7 @@ export function enforceActionRequestDetailBudget(detail, omittedLoopCount = 0) {
|
|
|
639
639
|
const metadata = value => truncateUtf8(value, 4 * 1024);
|
|
640
640
|
return {
|
|
641
641
|
actionId: metadata(detail.actionId),
|
|
642
|
+
generation: Math.max(1, Number(detail.generation) || 1),
|
|
642
643
|
request: {
|
|
643
644
|
id: metadata(request.id),
|
|
644
645
|
runId: metadata(request.runId),
|
|
@@ -1088,7 +1088,10 @@ export function projectActionRequestIndex(action, entries) {
|
|
|
1088
1088
|
inputTokens: count(turn.summaryInputTokens),
|
|
1089
1089
|
outputTokens: count(turn.summaryOutputTokens),
|
|
1090
1090
|
totalTokens: count(turn.totalTokens),
|
|
1091
|
-
})).sort((left, right) => right.
|
|
1091
|
+
})).sort((left, right) => right.generation - left.generation
|
|
1092
|
+
|| right.attempt - left.attempt
|
|
1093
|
+
|| right.openedAt - left.openedAt
|
|
1094
|
+
|| right.id.localeCompare(left.id)),
|
|
1092
1095
|
};
|
|
1093
1096
|
}
|
|
1094
1097
|
|
|
@@ -1160,6 +1163,7 @@ export function projectActionRequestDetail(action, run, history, runs = [run]) {
|
|
|
1160
1163
|
});
|
|
1161
1164
|
return enforceActionRequestDetailBudget({
|
|
1162
1165
|
actionId: boundedDebugIdentity(action.id, MAX_ACTION_REQUEST_METADATA_BYTES),
|
|
1166
|
+
generation: Math.max(1, count(action.generation) || 1),
|
|
1163
1167
|
request: {
|
|
1164
1168
|
id: boundedDebugIdentity(turn.turnId, MAX_ACTION_REQUEST_METADATA_BYTES),
|
|
1165
1169
|
runId: boundedDebugIdentity(run.id, MAX_ACTION_REQUEST_METADATA_BYTES),
|
|
@@ -165,6 +165,14 @@ export class WorkCenterService {
|
|
|
165
165
|
case 'get_action_requests': {
|
|
166
166
|
const detail = this.#requiredItem(payload.id);
|
|
167
167
|
const action = this.#requiredAction(detail, payload.actionId);
|
|
168
|
+
const expectedGeneration = Number(payload.generation);
|
|
169
|
+
if (!Number.isInteger(expectedGeneration) || expectedGeneration < 1) {
|
|
170
|
+
throw new Error('generation must be a positive integer');
|
|
171
|
+
}
|
|
172
|
+
const currentGeneration = Math.max(1, Number(action.generation) || 1);
|
|
173
|
+
if (currentGeneration !== expectedGeneration) {
|
|
174
|
+
throw new Error('Action generation changed before requests were loaded');
|
|
175
|
+
}
|
|
168
176
|
const entries = [];
|
|
169
177
|
for (const run of detail.runs.filter(item => item.actionId === action.id)) {
|
|
170
178
|
const history = await this.#debugHistory(run, { indexOnly: true });
|
|
@@ -177,6 +185,14 @@ export class WorkCenterService {
|
|
|
177
185
|
case 'get_action_request': {
|
|
178
186
|
const detail = this.#requiredItem(payload.id);
|
|
179
187
|
const action = this.#requiredAction(detail, payload.actionId);
|
|
188
|
+
const expectedGeneration = Number(payload.generation);
|
|
189
|
+
if (!Number.isInteger(expectedGeneration) || expectedGeneration < 1) {
|
|
190
|
+
throw new Error('generation must be a positive integer');
|
|
191
|
+
}
|
|
192
|
+
const currentGeneration = Math.max(1, Number(action.generation) || 1);
|
|
193
|
+
if (currentGeneration !== expectedGeneration) {
|
|
194
|
+
throw new Error('Action generation changed before request detail was loaded');
|
|
195
|
+
}
|
|
180
196
|
const requestId = requiredString(payload.requestId, 'requestId');
|
|
181
197
|
const run = detail.runs.find(item => item.actionId === action.id && item.id === payload.runId);
|
|
182
198
|
if (!run) throw new Error('Action request not found');
|