mirror of
https://github.com/stablyai/orca.git
synced 2026-11-14 01:47:24 +00:00
perf(mobile): trim the page bundle back under its old budget (#39182)
* 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
This commit is contained in:
@@ -2,7 +2,7 @@ import { readFile } from 'node:fs/promises'
|
||||
import { readRouteSnapshot } from '../../mobile-web-app/mobile-web-app-route-snapshot.mjs'
|
||||
import { MOBILE_WEB_APP_DEPENDENCY_PATH } from '../../mobile-web-app/mobile-web-app-bundle-dependencies.mjs'
|
||||
import { existsSync, realpathSync } from 'node:fs'
|
||||
import { basename, extname, join, resolve } from 'node:path'
|
||||
import { basename, dirname, extname, join, resolve } from 'node:path'
|
||||
import { createRequire } from 'node:module'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import * as esbuild from 'esbuild'
|
||||
@@ -133,16 +133,61 @@ const HAIRLINE_PLUGIN_NAME = 'orca-hairline-device-pixel'
|
||||
|
||||
const ENTRY_CHUNK_NAME = 'entry'
|
||||
|
||||
const ROUTE_MANIFEST_MODULE = /web-entry[\\/]route-manifest(\.ts)?$/
|
||||
const ROUTE_ENTRY_NAMESPACE = 'orca-route-entry'
|
||||
|
||||
// The entry's static imports as written, minus the manifest: a route importing it would be an output cycle.
|
||||
async function entryImportAnchors() {
|
||||
const scan = await esbuild.build({
|
||||
entryPoints: [entryPoint],
|
||||
write: false,
|
||||
metafile: true,
|
||||
outdir: 'scan',
|
||||
logLevel: 'silent'
|
||||
})
|
||||
const [{ imports }] = Object.values(scan.metafile.outputs)
|
||||
return imports
|
||||
.filter(
|
||||
({ kind, path }) =>
|
||||
kind === 'import-statement' && !ROUTE_MANIFEST_MODULE.test(join(dirname(entryPoint), path))
|
||||
)
|
||||
.map(({ path }) => `import ${JSON.stringify(path)}\n`)
|
||||
.join('')
|
||||
}
|
||||
|
||||
const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
|
||||
// Keep typed route-manifest file for TS/Metro resolution; replace only its body for web.
|
||||
function routeManifestPlugin(manifestSource) {
|
||||
// Routes import the entry's imports first, so esbuild keeps those modules in one chunk instead of one per route subset.
|
||||
function routeManifestPlugin(manifestSource, routes) {
|
||||
let anchors
|
||||
return {
|
||||
name: ROUTE_MANIFEST_PLUGIN_NAME,
|
||||
setup(build) {
|
||||
build.onLoad({ filter: /web-entry[\\/]route-manifest\.ts$/ }, () => ({
|
||||
build.onLoad({ filter: ROUTE_MANIFEST_MODULE }, () => ({
|
||||
contents: manifestSource,
|
||||
loader: 'js',
|
||||
resolveDir: mobileDir
|
||||
}))
|
||||
if (routes.length === 0) {
|
||||
return
|
||||
}
|
||||
const routeImport = new RegExp(
|
||||
`^(?:${routes.map(({ module }) => escapeRegExp(module)).join('|')})$`
|
||||
)
|
||||
build.onResolve({ filter: routeImport }, (args) =>
|
||||
args.kind === 'dynamic-import'
|
||||
? { path: args.path, namespace: ROUTE_ENTRY_NAMESPACE }
|
||||
: undefined
|
||||
)
|
||||
build.onLoad({ filter: /.*/, namespace: ROUTE_ENTRY_NAMESPACE }, async (args) => {
|
||||
anchors ??= entryImportAnchors()
|
||||
return {
|
||||
contents: `${await anchors}export { default } from ${JSON.stringify(args.path)}\n`,
|
||||
loader: 'js',
|
||||
resolveDir: dirname(entryPoint)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,7 +265,7 @@ export function mobileWebAppBuildOptions(routes) {
|
||||
zod: MOBILE_ZOD_PACKAGE
|
||||
},
|
||||
plugins: [
|
||||
routeManifestPlugin(renderMobileWebAppRouteManifest(routes)),
|
||||
routeManifestPlugin(renderMobileWebAppRouteManifest(routes), routes),
|
||||
lucideBarrelPlugin,
|
||||
hairlineDevicePixelPlugin
|
||||
],
|
||||
@@ -399,10 +444,30 @@ function localeCatalogOutputs(metafile) {
|
||||
)
|
||||
}
|
||||
|
||||
// esbuild keeps a whole namespace used as a value: `import { z }` or `z.core` ships ~200 KB of zod locale tables.
|
||||
const ZOD_LOCALE_TABLE_INPUT = /\/zod\/v4\/locales\/(?!en\.js$)[^/]+$/
|
||||
|
||||
function assertNoZodLocaleTables(metafile) {
|
||||
const leaked = Object.values(metafile.outputs).flatMap(({ inputs }) =>
|
||||
Object.entries(inputs)
|
||||
.filter(
|
||||
([input, { bytesInOutput }]) => bytesInOutput > 0 && ZOD_LOCALE_TABLE_INPUT.test(input)
|
||||
)
|
||||
.map(([input]) => input)
|
||||
)
|
||||
if (leaked.length > 0) {
|
||||
throw new Error(
|
||||
`[build-mobile-web-app-bundle] ${String(leaked.length)} zod locale tables reached the page (${leaked[0]}, …); ` +
|
||||
"use `import * as z from 'zod'`, and import nested namespaces like `z.core` directly"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export async function bundleMobileWebApp({ appDir = defaultAppDir } = {}) {
|
||||
const routes = await collectMobileWebAppRoutes(appDir)
|
||||
await assertRoutesCarryNoSynchronousExports(routes)
|
||||
const result = await esbuild.build(mobileWebAppBuildOptions(routes))
|
||||
assertNoZodLocaleTables(result.metafile)
|
||||
const entryOutputPath = Object.keys(result.metafile.outputs).find(
|
||||
(path) => basename(path) === `${ENTRY_CHUNK_NAME}.js`
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@ export const MOBILE_WEB_APP_BUNDLE_MAX_CATALOG_BYTES = 3 * 1024 * 1024
|
||||
|
||||
// Our own fence on the page's code, well inside the phone contract (32 MiB total, 10 MiB per asset in
|
||||
// manifest-contract.ts); it fails the build before the code weighs more than any one asset may.
|
||||
export const MOBILE_WEB_APP_BUNDLE_MAX_TOTAL_BYTES = 9.75 * 1024 * 1024
|
||||
export const MOBILE_WEB_APP_BUNDLE_MAX_TOTAL_BYTES = 9.5 * 1024 * 1024
|
||||
|
||||
// Only this licensed desktop-identical asset has its own allowance; other fonts (KaTeX's) and code count.
|
||||
export const MOBILE_WEB_APP_TERMINAL_FONT_MAX_BYTES = 1200 * 1024
|
||||
@@ -55,22 +55,22 @@ export function mobileWebAppBundleBudgetBytes(manifest) {
|
||||
// Re-measure table when routes change; it is envelope’s only input, and pins must fail rather than permit arbitrary ceiling bumps.
|
||||
export const MOBILE_WEB_APP_BUNDLE_SCRIPT_SWEEP = [
|
||||
['./_layout.tsx', 4],
|
||||
['./h/[hostId]/[...page].tsx', 8],
|
||||
['./h/[hostId]/accounts.tsx', 12],
|
||||
['./h/[hostId]/agent-history/[worktreeId].tsx', 17],
|
||||
['./h/[hostId]/automations.tsx', 24],
|
||||
['./h/[hostId]/edit.tsx', 26],
|
||||
['./h/[hostId]/files/[worktreeId].tsx', 32],
|
||||
['./h/[hostId]/files/preview/[worktreeId].tsx', 42],
|
||||
['./h/[hostId]/history/[worktreeId].tsx', 45],
|
||||
['./h/[hostId]/index.tsx', 55],
|
||||
['./h/[hostId]/new-workspace.tsx', 67],
|
||||
['./h/[hostId]/pr/[worktreeId].tsx', 68],
|
||||
['./h/[hostId]/review/[worktreeId].tsx', 81],
|
||||
['./h/[hostId]/session/[worktreeId].tsx', 96],
|
||||
['./h/[hostId]/source-control/[worktreeId].tsx', 104],
|
||||
['./h/[hostId]/tasks.tsx', 117],
|
||||
['./h/_layout.tsx', 123]
|
||||
['./h/[hostId]/[...page].tsx', 6],
|
||||
['./h/[hostId]/accounts.tsx', 9],
|
||||
['./h/[hostId]/agent-history/[worktreeId].tsx', 12],
|
||||
['./h/[hostId]/automations.tsx', 17],
|
||||
['./h/[hostId]/edit.tsx', 19],
|
||||
['./h/[hostId]/files/[worktreeId].tsx', 25],
|
||||
['./h/[hostId]/files/preview/[worktreeId].tsx', 34],
|
||||
['./h/[hostId]/history/[worktreeId].tsx', 36],
|
||||
['./h/[hostId]/index.tsx', 45],
|
||||
['./h/[hostId]/new-workspace.tsx', 56],
|
||||
['./h/[hostId]/pr/[worktreeId].tsx', 57],
|
||||
['./h/[hostId]/review/[worktreeId].tsx', 69],
|
||||
['./h/[hostId]/session/[worktreeId].tsx', 83],
|
||||
['./h/[hostId]/source-control/[worktreeId].tsx', 90],
|
||||
['./h/[hostId]/tasks.tsx', 104],
|
||||
['./h/_layout.tsx', 108]
|
||||
]
|
||||
|
||||
const sweptScripts = MOBILE_WEB_APP_BUNDLE_SCRIPT_SWEEP.map(([, scripts]) => scripts)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Schemas cover history/status and resume metadata from runtime RPC status, ai-vault, repo, folder-workspace and worktree-catalog methods; rows use shared AiVault types.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { TuiAgent } from '../../../src/shared/agent-launch/catalog/tui-agent'
|
||||
import { isTuiAgent } from '../../../src/shared/agent-launch/catalog/tui-agent-config'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { normalizeExecutionHostId } from '../../../src/shared/execution-host'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
normalizeVisibleExecutionHostIds,
|
||||
parseExecutionHostId,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { AutomationDraftValidationError } from './automation-error'
|
||||
import { getRepoMainWorktreeId } from '../../../src/shared/worktree/id'
|
||||
import { getRepoExecutionHostId, parseExecutionHostId } from '../../../src/shared/execution-host'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Page command schemas mirror runtime browser-core and adjacent pointer/keyboard/dialog methods.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
|
||||
const TimestampSchema = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Reset-credit schemas match runtime status.get and accounts.consumeCodexResetCredit handlers.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { SetupRunPolicy } from '../../../src/shared/orca-yaml-hook-types'
|
||||
import { hostUnionArms, salvagedOptional, salvagingRecord } from '../../../src/shared/zod-salvage'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { RuntimeSpeechModelSummary } from '../../../src/shared/runtime-worktree-contracts'
|
||||
import { hostUnionArms, salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Require an array because the cache sorts/walks it unguarded. Drop rows without name or isDirectory; salvage decorative isSymlink.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Ownership routes writes: unreadable routing members must fail, since salvaging them to absent could send a remote mutation locally.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Require unguarded members, salvage typed guards to their existing fallbacks, and retain unknown for truthiness-only reads.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Tabs publish members directly into ready documents; their readers must be stricter than the preview screen’s guarded normalizers.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Buffer } from 'buffer/index.js'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
|
||||
import type { MobileFilePreviewRpcSender } from './mobile-file-preview-operations'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { PersistedUIState } from '../../../src/shared/persisted-ui-state-types'
|
||||
import type { RepoIcon } from '../../../src/shared/repo-icon'
|
||||
import { hostUnionArms, salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { SidebarInputsReadResultSchema } from '../../../src/shared/sidebar-list/sidebar-inputs-feed-contract'
|
||||
import type { SidebarFeedTransport } from '../../../src/shared/sidebar-feed-client/sidebar-feed-reader'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { MAX_DICTATION_AUDIO_CHUNK_BYTES } from '../../../../src/shared/rpc-contract/speech-params'
|
||||
|
||||
// The shell owns microphone PCM and its wake lock; the page owns dictation state/RPCs. Pull from the ring through existing request/reply rather than adding a push frame.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../../src/shared/zod-salvage'
|
||||
import type { RelayHostReachability } from '../../transport/relay-host-reachability'
|
||||
import type { RpcClient } from '../../transport/rpc-client'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../../src/shared/zod-salvage'
|
||||
import { SUPPORTED_UI_LOCALES } from '../../../../src/shared/ui-locale'
|
||||
import { NODE_PLATFORM_NAMES } from '../../transport/mobile-runtime-host-platform'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
isRpcDeliveryUnknown,
|
||||
markRpcDeliveryUnknown
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { BRIDGE_MAX_SAFE_AREA_INSET } from './bridge-safe-area-insets'
|
||||
|
||||
const offsetSchema = z.number().finite().min(0).max(BRIDGE_MAX_SAFE_AREA_INSET)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { BRIDGE_MAX_METHOD_CHARS } from './bridge-caps'
|
||||
|
||||
// Version gates incompatible shape; negotiate capabilities through grants. Drop unknown keys so independently updated desktop bundles and installed shells tolerate additive fields.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
// Use notify for haptics so frequent row taps cannot fill the 64-slot request window. The envelope owns v to avoid an import cycle.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { CLIPBOARD_IMAGE_MAX_SOURCE_BYTES } from '../../../../src/shared/clipboard-image'
|
||||
import { isKnownRasterImageMimeType } from '../../../../src/shared/raster-image-preview-limits'
|
||||
import { MOBILE_CLIPBOARD_IMAGE_UPLOAD_CHUNK_BASE64_CHARS } from '../../session/mobile-clipboard-image-upload-chunk'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
BRIDGE_MAX_ROUTE_PARAM_CHARS,
|
||||
BRIDGE_MAX_ROUTE_PARAMS,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { BRIDGE_MAX_SAFE_AREA_INSET } from './bridge-safe-area-insets'
|
||||
|
||||
// Publish native keyboard height in page px (iOS from window bottom, Android above bars); the shell overlays IME so the page cannot measure it itself.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
// The page asks native for a decisive liveness probe when its replies stop coming. Older shells refuse the frame with a diagnostic only and keep the idle watchdog.
|
||||
export const BRIDGE_LIVENESS_PROBE_NOTIFY = 'liveness-probe'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { CLIPBOARD_IMAGE_MAX_SOURCE_BYTES } from '../../../../src/shared/clipboard-image'
|
||||
import { MOBILE_CLIPBOARD_IMAGE_UPLOAD_CHUNK_BASE64_CHARS } from '../../session/mobile-clipboard-image-upload-chunk'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
audioReadParamsSchema,
|
||||
audioReadResultSchema,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { BridgeErrorCaptureSchema } from './bridge-error-capture'
|
||||
import { BRIDGE_HAPTICS_NOTIFY_FIELDS } from './bridge-haptics-notify'
|
||||
import { BRIDGE_LIVENESS_PROBE_NOTIFY_FIELDS } from './bridge-liveness-probe-notify'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { BRIDGE_MAX_SAFE_AREA_INSET } from './bridge-safe-area-insets'
|
||||
|
||||
const coordinate = z.number().finite().min(0).max(BRIDGE_MAX_SAFE_AREA_INSET)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
MOBILE_WEB_BUNDLE_MAX_GRANTED_ROUTE_GRANTS,
|
||||
MobileWebBundleGrantNameSchema
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
export const BRIDGE_MAX_SAFE_AREA_INSET = 4096
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
/** The iPhone Duo key rail: terminal keys the shell draws in a side inset strip for the page. */
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { usePageBridgeClient } from '../../transport/client-context.web'
|
||||
import {
|
||||
mediaNameResultSchema,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
// Require uploadId because every append/commit/abort addresses that slot.
|
||||
export const clipboardImageUploadSlotSchema = z.looseObject({ uploadId: z.string() })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import type {
|
||||
MobileGitBranchCompareResult,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import type {
|
||||
PRCheckAnnotation,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { normalizePRCheckHeadSha } from '../../../src/shared/github/pr-check-head'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { openEnum, salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import type { GitHubReaction, PRComment } from '../../../src/shared/github/comment-types'
|
||||
import type {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
// No ok member means the host’s legacy unstructured success.
|
||||
export type GitHubPrMutationStatus =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import type { PRInfo } from '../../../src/shared/github/pull-request-types'
|
||||
import type {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
structuredSessionOpenFailure,
|
||||
type StructuredSessionOpenFailure
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
agentSessionAttachmentAppends,
|
||||
base64DecodedByteLength,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
|
||||
import type { RpcMethodName } from '../transport/rpc-params-contract'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useState, useSyncExternalStore } from 'react'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { Timer } from 'lucide-react-native'
|
||||
import type { ActionSheetAction } from '../components/ActionSheetModal'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createContext, type ContextType } from 'react'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { isAdmissibleAgentJournalRenderItem } from '../../../../src/shared/agent-session/journal/agent-session-journal-schemas'
|
||||
import type { AgentJournalRenderItem } from '../../../../src/shared/agent-session/journal/agent-session-journal-types'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../../transport/rpc-operation'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { relativePathInsideRoot } from '../../../../src/shared/cross-platform-path'
|
||||
import {
|
||||
githubReferenceRepo,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { NATIVE_CHAT_VISUAL_MAX_BYTES } from '../../../../../src/shared/native-chat/native-chat-visual-directive'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../../../transport/rpc-operation'
|
||||
import { rpcResultVariant } from '../../../transport/rpc-operation-result-reader'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import { AGENT_STATUS_STATES } from '../../../src/shared/agent-status/contracts/agent-status-types'
|
||||
import { isTuiAgent } from '../../../src/shared/agent-launch/catalog/tui-agent-config'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Require an explicit opened verdict so malformed replies cannot masquerade as declined opens.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import type { WorktreeDisplayNameSource } from './worktree-display-name'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Unread bodies stay opaque; acceptance alone decides these mutations.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { getAgentSessionOptionCatalog } from '../../../src/shared/agent-session/options/agent-session-option-catalog'
|
||||
import type { CatalogModel } from '../../../src/shared/agent-session/options/agent-session-option-catalog-types'
|
||||
import {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { startAgentSessionCommandMenuQuery } from '../../../src/shared/agent-session/agent-session-command-menu-query'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { AgentSessionSlashCommand } from '../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { RpcClient } from '../transport/rpc-client'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { openEnum, salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
|
||||
const GIT_BRANCH_CHANGE_STATUS = ['modified', 'added', 'deleted', 'renamed', 'copied'] as const
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Require only consumed fields so older hosts can omit unread history metadata.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { openEnum, salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Require only unguarded consumer fields; unread host metadata must not become a compatibility gate.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Require provider for compose routing; preserve unknown tokens that newer hosts may publish.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { TextGenerationFailureFields } from '../../../src/shared/text-generation-failure-copy'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
import type { RpcCompatibleReader } from '../transport/rpc-operation-contract'
|
||||
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
|
||||
import type { GitPushTarget } from '../../../src/shared/worktree/types'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Base-ref and PR-link consumers fall back on absent hints; salvage those fields without requiring unrelated host metadata.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Required identity fields reject unusable rows; optional fields salvage older-host replies.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
isAgentLaunchResult,
|
||||
type AgentLaunchResult
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { prFlag, prText } from '../session/github-pr-entity-reply-schema'
|
||||
import { taskCommentWriteEnvelopeSchema } from './task-provider-entity-reply-schema'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import {
|
||||
CHECK_STATUS,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { prCount, prFlag, prText } from '../session/github-pr-entity-reply-schema'
|
||||
import {
|
||||
detailCheckListSchema,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import { prFlag, prText } from '../session/github-pr-entity-reply-schema'
|
||||
import { taskMutationEnvelopeSchema } from './task-provider-entity-reply-schema'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { GitHubProjectOwnerType } from '../../../src/shared/github/project-types'
|
||||
import { hostUnionArms, salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { normalizePRCheckHeadSha } from '../../../src/shared/github/pr-check-head'
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { GitHubPRFile } from '../../../src/shared/github/pull-request-types'
|
||||
import { hostUnionArms, salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import { prCount, prFlag, prNullableText, prText } from '../session/github-pr-entity-reply-schema'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import { linearIssueRowSchema } from './task-item-detail-reply-schema'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
const createText = (name: string) => salvagedOptional(name, z.string())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { openEnum, salvagedOptional, salvagingArray } from '../../../src/shared/zod-salvage'
|
||||
import { SSH_CONNECTION_STATUS } from '../transport/ssh-connection-status-arms'
|
||||
import { SETUP_RUN_POLICIES } from '../components/new-workspace-reply-schema'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
export const terminalComposerDraftSchema = z.looseObject({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from './rpc-operation'
|
||||
import { rpcResultVariant } from './rpc-operation-result-reader'
|
||||
import type { RpcClient, SendRequestOptions } from './rpc-client'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
import { NODE_PLATFORM_NAMES } from './mobile-runtime-host-platform'
|
||||
import { HOST_MACHINE_KINDS } from '../../../src/shared/host-machine-line'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { RpcClient, SendRequestOptions } from './rpc-client'
|
||||
import type { RpcOperationSender } from './rpc-operation-sender'
|
||||
import { captureGitHubInvocation, supportsExactGitHubOperations } from './github-target-invocation'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { RpcRequest } from './types'
|
||||
|
||||
// Pass added top-level host fields through unchanged so new fields need no mobile binary update.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import type * as z from 'zod'
|
||||
import { collectSalvageDrops } from '../../../src/shared/zod-salvage'
|
||||
import type { RpcCompatibleReader, RpcDecodeIssue } from './rpc-operation-contract'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { MOBILE_PROJECT_SECTIONS_METHOD } from '../../../src/shared/mobile-project-sections-contract'
|
||||
import {
|
||||
ProjectGroupSchema,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { ExecutionHostHealth } from '../../../src/shared/execution-host-health'
|
||||
import { parseExecutionHostId } from '../../../src/shared/execution-host'
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { ExecutionHostId } from '../../../src/shared/execution-host'
|
||||
import type { ExecutionHostHealth } from '../../../src/shared/execution-host-health'
|
||||
import type { MobileRelayHost } from '../../../src/shared/remote-runtime/relay/mobile-relay-hosts-contract'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { salvagedOptional } from '../../../src/shared/zod-salvage'
|
||||
|
||||
// Accept unchanged polls without worktrees; consumers validate their own row projections.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { RpcClient } from '../transport/rpc-client'
|
||||
import type { Worktree } from './workspace-list-sections'
|
||||
import { worktreeCatalogRead } from './worktree-catalog-operations'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Desktop account routing for terminal agents on WSL orcad hosts without account services: four variables, absolute POSIX paths (the shell pointer may use ~/). Structured-session homes remain host-derived. */
|
||||
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
CLAUDE_INJECTED_CONFIG_DIR_ENV,
|
||||
CLAUDE_PROFILE_POINTER_ENV
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Bound replayed context facts to what live writers can produce.
|
||||
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
MAX_CONTEXT_CATEGORIES,
|
||||
MAX_CONTEXT_CATEGORY_NAME_CHARS,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Agent-origin messages carry from outside fingerprints; absence identifies the person at the composer.
|
||||
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { normalizeAgentSessionConversationName } from './agent-session-conversation-name'
|
||||
import { isOrcaSessionId, type OrcaSessionId } from '../orca-session-address'
|
||||
import type { OrchestrationPartyIdentity } from '../orchestration-party-identity'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Advertised agentSession.agents lists registered agents/capabilities before sessions exist. Drop unreadable rows individually; unknown capability arms degrade to the least authority. */
|
||||
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import type { AgentSessionCapabilities } from './agent-session-capabilities'
|
||||
import { isStructuredAgentId } from './lifecycle/agent-session-provider-handle-encoding'
|
||||
import { openEnum } from '../zod-salvage'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
/** Keep newer kinds/audiences/refusal details readable like row state; the fact reader drops anything it cannot place. */
|
||||
export const AgentSessionFailureFactSchema = z.object({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Preserve unknown journal union tags so newer bodies/blocks/goals/approval subjects remain readable.
|
||||
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
/** A tag a newer build could have written: a string with something other than whitespace in it. */
|
||||
export function isJournalTag(value: unknown): value is string {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Older rewind replaces unknown turn/tool/resolution states with placeholders and blocks with raw-JSON text, retaining unknown bodies.
|
||||
// History pages lack row v: extensions must also remain safe for older clients.
|
||||
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { AgentSessionContextUsageSchema } from '../agent-session-context-usage-schema'
|
||||
import { AgentJournalThreadGoalStateSchema } from './agent-session-journal-thread-goal-schema'
|
||||
import { AgentSessionFailureFactSchema } from '../failures/agent-session-failure-fact-schema'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// The journal's thread-goal transition, validated as deeply as the rest of the render model.
|
||||
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import { openDiscriminatedUnion } from './agent-session-journal-open-union'
|
||||
|
||||
const ThreadGoal = z.object({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
AgentJournalItemBodySchema,
|
||||
AgentJournalProducerLinkageFields,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user