@yeaft/webchat-agent 1.0.621 → 1.0.623

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.
@@ -7,6 +7,7 @@ const FIELDS = Object.freeze({
7
7
  status: [], open: [], snapshot: [], receipt: ['clientMessageId', 'requestHash'],
8
8
  send: ['text', 'clientMessageId', 'attachments'], think: ['text', 'clientMessageId', 'attachments'],
9
9
  dream: ['clientMessageId'], cancel: ['episodeId'],
10
+ executions: [], pause: ['episodeId'], resume: ['episodeId'],
10
11
  tasks: ['cursor', 'limit'], task_log: ['taskId', 'offset', 'maxBytes'], task_cancel: ['taskId'], agent_close: ['agentId'],
11
12
  outputs: ['cursor', 'limit'], output_read: ['outputId', 'offset', 'maxBytes'],
12
13
  messages: ['cursor', 'limit'], traces: ['cursor', 'limit'], turns: ['cursor', 'limit'],
@@ -73,6 +74,15 @@ export function createPersonRelay({
73
74
  await reply(client, envelope, { ok: false, errorCode: 'invalid_request', error: 'Invalid digital person payload' });
74
75
  return true;
75
76
  }
77
+ if (['executions', 'pause', 'resume'].includes(op)) {
78
+ const value = source ?? {};
79
+ const invalid = Object.keys(value).some(key => !FIELDS[op].includes(key))
80
+ || (op !== 'executions' && (typeof value.episodeId !== 'string' || !/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(value.episodeId)));
81
+ if (invalid) {
82
+ await reply(client, envelope, { ok: false, errorCode: 'invalid_request', error: 'Invalid digital person execution control' });
83
+ return true;
84
+ }
85
+ }
76
86
  if (op === 'turns' && ((source?.cursor != null && (!Number.isSafeInteger(source.cursor) || source.cursor < 1))
77
87
  || (Object.hasOwn(source ?? {}, 'limit') && (!Number.isInteger(source.limit) || source.limit < 1 || source.limit > 20)))) {
78
88
  await reply(client, envelope, { ok: false, errorCode: 'invalid_request', error: 'Invalid digital person turn page' });
@@ -1 +1 @@
1
- {"version":"1.0.621"}
1
+ {"version":"1.0.623"}