Import AITURK IDE 1.0.0-beta.1 from Hermes 63279301; preserve MIT license

This commit is contained in:
yilsem committed 2026-09-05 13:26:46 +03:00
commit 03634b1ca3
11340 files changed
+3442369

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
import type { CommandDispatchResponse } from '../gatewayTypes.js'
export type RpcResult = Record<string, any>
export const asRpcResult = <T extends RpcResult = RpcResult>(value: unknown): T | null =>
!value || typeof value !== 'object' || Array.isArray(value) ? null : (value as T)
export const asCommandDispatch = (value: unknown): CommandDispatchResponse | null => {
const o = asRpcResult(value)
if (!o || typeof o.type !== 'string') {
return null
}
const t = o.type
if (t === 'exec' || t === 'plugin') {
return { type: t, output: typeof o.output === 'string' ? o.output : undefined }
}
if (t === 'alias' && typeof o.target === 'string') {
return { type: 'alias', target: o.target }
}
const str = (value: unknown) => (typeof value === 'string' ? value : undefined)
if (t === 'skill' && typeof o.name === 'string') {
return { type: 'skill', name: o.name, message: str(o.message), display: str(o.display) }
}
if (t === 'send' && typeof o.message === 'string') {
return {
type: 'send',
message: o.message,
notice: str(o.notice),
display: str(o.display)
}
}
if (t === 'prefill' && typeof o.message === 'string') {
return {
type: 'prefill',
message: o.message,
notice: typeof o.notice === 'string' ? o.notice : undefined
}
}
return null
}
export const rpcErrorMessage = (err: unknown) =>
err instanceof Error && err.message ? err.message : typeof err === 'string' && err.trim() ? err : 'request failed'