@yeaft/webchat-agent 1.0.604 → 1.0.606
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/server/handlers/client-person.js +14 -1
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +165 -115
- 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/person/bridge.js +3 -0
- package/yeaft/person/contracts.js +24 -1
- package/yeaft/person/service.js +11 -1
- package/yeaft/person/task-host.js +124 -9
|
@@ -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
|
+
tasks: [], task_log: ['taskId', 'offset', 'maxBytes'], task_cancel: ['taskId'], agent_close: ['agentId'],
|
|
10
11
|
messages: ['cursor', 'limit'], traces: ['cursor', 'limit'],
|
|
11
12
|
inspect: ['section', 'cursor', 'limit'], search: ['query', 'cursor', 'limit'],
|
|
12
13
|
settings: ['name', 'autonomyEnabled', 'modelCandidates'],
|
|
@@ -62,6 +63,18 @@ export function createPersonRelay({
|
|
|
62
63
|
await reply(client, envelope, { ok: false, error: 'Invalid digital person payload' });
|
|
63
64
|
return true;
|
|
64
65
|
}
|
|
66
|
+
if (['tasks', 'task_log', 'task_cancel', 'agent_close'].includes(op)) {
|
|
67
|
+
const value = source ?? {};
|
|
68
|
+
const idKey = op === 'agent_close' ? 'agentId' : 'taskId';
|
|
69
|
+
const invalid = Object.keys(value).some(key => !FIELDS[op].includes(key))
|
|
70
|
+
|| (op !== 'tasks' && (typeof value[idKey] !== 'string' || !/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(value[idKey])))
|
|
71
|
+
|| (Object.hasOwn(value, 'offset') && (!Number.isSafeInteger(value.offset) || value.offset < 0))
|
|
72
|
+
|| (Object.hasOwn(value, 'maxBytes') && (!Number.isInteger(value.maxBytes) || value.maxBytes < 1 || value.maxBytes > 65536));
|
|
73
|
+
if (invalid) {
|
|
74
|
+
await reply(client, envelope, { ok: false, errorCode: 'invalid_request', error: 'Invalid digital person task payload' });
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
65
78
|
const payload = Object.fromEntries(FIELDS[op].filter(key => Object.hasOwn(source || {}, key)).map(key => [key, source[key]]));
|
|
66
79
|
if (JSON.stringify(payload).length > 40_000) {
|
|
67
80
|
await reply(client, envelope, { ok: false, error: 'Digital person input is too large' });
|
|
@@ -127,7 +140,7 @@ export function createPersonRelay({
|
|
|
127
140
|
await reply(row.client, row.envelope, msg.ok === true
|
|
128
141
|
? { ok: true, data: msg.data }
|
|
129
142
|
: { ok: false,
|
|
130
|
-
errorCode: ['outcome_unknown', 'invalid_request', 'busy', 'unsupported', 'not_configured', 'not_open', 'stale', 'idempotency_conflict', 'attachment_expired', 'invalid_attachment', 'unsupported_attachment', 'attachment_limit', 'image_model', 'model_selection'].includes(msg.errorCode) ? msg.errorCode : 'requestFailed',
|
|
143
|
+
errorCode: ['outcome_unknown', 'invalid_request', 'busy', 'unsupported', 'not_configured', 'not_open', 'stale', 'idempotency_conflict', 'attachment_expired', 'invalid_attachment', 'unsupported_attachment', 'attachment_limit', 'image_model', 'model_selection', 'not_found', 'task_scope_denied', 'task_control_unavailable'].includes(msg.errorCode) ? msg.errorCode : 'requestFailed',
|
|
131
144
|
error: typeof msg.error === 'string' ? msg.error.slice(0, 500) : 'Digital person request failed' });
|
|
132
145
|
return true;
|
|
133
146
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.606"}
|