feat(trial): assemble completed Agent workspace updates
This commit is contained in:
1 parent
8289f27f3e
commit
7c51bb4a00
38 files changed
+2081
-276
No files matched your search
@@ -26,14 +26,17 @@ export class CloudAgentJournal {
|
||||
return this.update(accountKey, validate, value => ({ ...value, recent }));
|
||||
}
|
||||
|
||||
put(accountKey: string, entry: CloudPendingOperation, validate: () => void) {
|
||||
return this.update(accountKey, validate, value => {
|
||||
async put(accountKey: string, entry: CloudPendingOperation, validate: () => void): Promise<boolean> {
|
||||
let alreadyPending = false;
|
||||
await this.update(accountKey, validate, value => {
|
||||
const existing = value.pending.find(item => item.id === entry.id);
|
||||
if (existing && JSON.stringify(existing.input) !== JSON.stringify(entry.input)) {
|
||||
throw new Error('同一次待确认操作不能更改输入');
|
||||
}
|
||||
alreadyPending = Boolean(existing);
|
||||
return { ...value, pending: existing ? value.pending : [...value.pending, entry] };
|
||||
});
|
||||
return alreadyPending;
|
||||
}
|
||||
|
||||
remove(accountKey: string, id: string, validate: () => void) {
|
||||
|
||||
Reference in new issue
Block a user