Files
cindy/apps/desktop/src/shared/inputError.ts
bobo c68e9097f2 fix(bots): 统一群执行收尾与失败状态展示 (#5736)
* fix(bots): settle failed group turns and show recovery guidance

Signed-off-by: xd-bobo <caojianbo@xd.com>

* docs(design): register group runtime failure notice

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): make group failure notices easier to read

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): preserve failure reasons and thread notices

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(mobile): show group runtime failure guidance

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): classify Codex tags and runtime watchdog timeouts

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): preserve runtime failures in local history upgrades

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): 刷新已加载旧页的失败提示

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): unify execution settlement and failure projection

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): reuse native Pi prompt timeout classification

Signed-off-by: xd-bobo <caojianbo@xd.com>

* docs(protocol): separate group failure contract additions

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): classify lane preparation model failures

Signed-off-by: xd-bobo <caojianbo@xd.com>

* test(bots): align parity fixtures with failure snapshots

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): reuse native overload errors in group failures

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(bots): reconcile failures only for displayed message sources

Signed-off-by: xd-bobo <caojianbo@xd.com>

---------

Signed-off-by: xd-bobo <caojianbo@xd.com>
2026-10-10 19:11:14 +08:00

24 lines
1.1 KiB
TypeScript

export const PI_IMAGE_INPUT_UNSUPPORTED_CODE = 'PI_IMAGE_INPUT_UNSUPPORTED';
export const PI_IMAGE_INPUT_UNSUPPORTED_MARKER = `[${PI_IMAGE_INPUT_UNSUPPORTED_CODE}]`;
/** Stable Desktop main -> renderer/device-link marker; presentation localizes at display time. */
export function isPiImageInputUnsupportedError(value: unknown): boolean {
const message = value instanceof Error ? value.message : String(value ?? '');
const code =
value && typeof value === 'object' && !Array.isArray(value)
? (value as { code?: unknown }).code
: null;
return (
code === PI_IMAGE_INPUT_UNSUPPORTED_CODE || message.includes(PI_IMAGE_INPUT_UNSUPPORTED_MARKER)
);
}
/** The existing Pi prompt RPC expiry signal, shared by native recovery and group settlement. */
export function isPiPromptRpcTimeoutError(data: unknown): boolean {
if (!data || typeof data !== 'object') return false;
const rec = data as { message?: unknown; sdkError?: unknown };
return [rec.message, rec.sdkError].some(
value => typeof value === 'string' && /pi rpc timeout after \d+ms: prompt\b/i.test(value),
);
}