mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 10:58:10 +00:00
* perf(mobile): trim the page bundle back under its old budget * build(mobile): simplify the route entry anchors and zod table guard * fix(mobile): import zod as a type in the RPC result reader
46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import * as z from 'zod'
|
||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||
|
||
// Guarded capabilities may be absent; keep idempotency policy unknown for the caller’s distinct absent/null/object cases.
|
||
export const taskRuntimeStatusSchema = z.looseObject({
|
||
capabilities: salvagedOptional('capabilities', salvagingArray(z.string())),
|
||
worktreeCreateIdempotency: z.unknown().optional(),
|
||
hostPlatform: salvagedOptional('hostPlatform', z.string())
|
||
})
|
||
|
||
// Persisted UI state is advisory: unreadable payloads hydrate defaults instead of failing the other request-group legs.
|
||
// Forward opaque trust/resume data for field-level narrowing at consumers.
|
||
export const taskUiStateSchema = z
|
||
.looseObject({
|
||
ui: salvagedOptional(
|
||
'ui',
|
||
z.looseObject({
|
||
taskResumeState: z.unknown().optional(),
|
||
trustedOrcaHooks: z.unknown().optional()
|
||
})
|
||
)
|
||
})
|
||
.nullish()
|
||
.catch(undefined)
|
||
.transform((reply) => reply?.ui)
|
||
|
||
// Advisory preflight must decode nullish replies as not installed; reader refusal would fail the whole hydration.
|
||
export const taskPreflightSchema = z
|
||
.looseObject({
|
||
glab: salvagedOptional(
|
||
'glab',
|
||
z.looseObject({ installed: salvagedOptional('installed', z.boolean()) })
|
||
)
|
||
})
|
||
.catch({ glab: undefined })
|
||
|
||
// Nullish Linear probes mean not connected; workspace lists belong to another reader of this method.
|
||
export const taskLinearStatusSchema = z
|
||
.looseObject({
|
||
connected: salvagedOptional('connected', z.boolean())
|
||
})
|
||
.catch({ connected: undefined })
|
||
|
||
// These write bodies are unread; requiring members would introduce failures no consumer previously observed.
|
||
export const taskPreferenceWriteSchema = z.unknown()
|