Merge origin/main before final dashboard validation
@@ -121,6 +121,9 @@ validation-screenshots/
|
||||
test-results/
|
||||
playwright-report/
|
||||
|
||||
# Claude Code settings are machine-local.
|
||||
**/.claude/settings.local.json
|
||||
|
||||
# Agent skills are installed per machine.
|
||||
/.claude/skills/
|
||||
/.agents/skills/
|
||||
|
||||
@@ -292,11 +292,9 @@ Pair with your desktop app to monitor and steer your agents from your phone.
|
||||
|
||||
- **Discord:** Join the community on **[Discord](https://discord.gg/fzjDKHxv8Q)**.
|
||||
- **Twitter / X:** Follow **[@orca_build](https://x.com/orca_build)** for updates and announcements.
|
||||
- **WeChat:** Scan to join an Orca community WeChat group. If one group is full, join another.
|
||||
- **WeChat:** Scan to join an Orca community WeChat group.
|
||||
|
||||
<img src="docs/assets/wechat-qr-group14.jpg" alt="WeChat QR code for the Orca community" width="160" />
|
||||
<img src="docs/assets/wechat-qr-group15.jpg" alt="WeChat QR code for the Orca community" width="160" />
|
||||
<img src="docs/assets/wechat-qr-group16.jpg" alt="WeChat QR code for the Orca community" width="160" />
|
||||
<img src="docs/assets/wechat-qr.jpg" alt="WeChat QR code for the Orca community" width="160" />
|
||||
|
||||
- **Feedback & Ideas:** We ship fast. Missing something? [Request a new feature](https://github.com/stablyai/orca/issues).
|
||||
- **Privacy:** See the [privacy & telemetry docs](https://www.onorca.dev/docs/telemetry) for what anonymous usage data Orca collects and how to opt out.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Later run-all.ts checks against the same host: rebind, orphan grace, silence,
|
||||
// forced resets and pre-upgrade refusals.
|
||||
// forced resets.
|
||||
import WebSocket from 'ws'
|
||||
import { GRACE_MS, ORIGIN, PING_MS, PORT, SILENCE_MS, makeControl, openPhone, record, sleep, waitFor, type Ctx, type Control } from './run-all-harness'
|
||||
|
||||
@@ -89,12 +89,4 @@ export async function runLifecycleChecks(ctx: Ctx, main: Control, mainAck: Ack):
|
||||
back.client.closeNow()
|
||||
}
|
||||
|
||||
// Bad JWT -> 401 before upgrade; malformed host id -> 429.
|
||||
{
|
||||
const bad = new WebSocket(`ws://127.0.0.1:${PORT}/v1/host/control`, { headers: { authorization: 'Bearer nope' } })
|
||||
const status = await new Promise<number>((res) => bad.on('unexpected-response', (_q, r) => res(r.statusCode ?? 0)))
|
||||
const badHost = new WebSocket(`ws://127.0.0.1:${PORT}/v1/connect/short`)
|
||||
const s2 = await new Promise<number>((res) => badHost.on('unexpected-response', (_q, r) => res(r.statusCode ?? 0)))
|
||||
record('R11/R5 ES256 JWKS rejects bad token (401); malformed host id 429', status === 401 && s2 === 429, `${status},${s2}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,11 +100,6 @@ async function runTests(ctx: Ctx): Promise<void> {
|
||||
const mainAck = await main.client.connect()
|
||||
const transport = main.bindTransport(mainAck.generation)
|
||||
|
||||
// Alarm-driven app ping, answered by the shipped client's pong handler.
|
||||
await sleep(PING_MS * 3 + 300)
|
||||
record('R2/R5 alarm-driven JSON ping parsed by shipped client, pong keeps control alive',
|
||||
main.events.pings >= 2 && main.client.isLive(), `pings=${main.events.pings} live=${main.client.isLive()}`)
|
||||
|
||||
// Phone connect -> conn-open (strict, shipped parser) -> host data -> relay-hello (shipped parser).
|
||||
const phone = openPhone(ctx)
|
||||
const helloOk = await waitFor(() => phone.hello !== null, 5000)
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
1 src/renderer/src/components/activity/use-agent-pane-thread-store-data.ts
|
||||
1 src/renderer/src/components/activity/use-agent-pane-threads.ts
|
||||
4 src/renderer/src/components/agent/AgentSettingsDialog.tsx
|
||||
1 src/renderer/src/components/automations/automation-host-client.ts
|
||||
1 src/renderer/src/components/automations/hosts/automation-host-client.ts
|
||||
1 src/renderer/src/components/automations/automations-page-fixtures.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-controller.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-destination-form.ts
|
||||
1 src/renderer/src/components/automations/authoring/use-automations-page-destination-form.ts
|
||||
1 src/renderer/src/components/browser-pane/ReopenBrowserPageOnServerButton.tsx
|
||||
1 src/renderer/src/components/browser-pane/browser-reopen-on-server.ts
|
||||
1 src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-stream.ts
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# JSX mapped straight over a host collection, per file, outside components/host-picker.
|
||||
# This is a RATCHET: counts may only go DOWN. Draw host lists with HostCombobox or
|
||||
# useBoundedHostRows. Prune after a fix: pnpm check:host-list-render-ratchet --prune
|
||||
1 src/renderer/src/components/automations/AutomationRunsDashboard.tsx
|
||||
1 src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx
|
||||
1 src/renderer/src/components/right-sidebar/ai-vault/panel/AiVaultPanelControls.tsx
|
||||
1 src/renderer/src/components/right-sidebar/source-control/ai/SourceControlAgentActionDialogForm.tsx
|
||||
1 src/renderer/src/components/settings/browser/profiles/BrowserSessionCookiesSection.tsx
|
||||
|
||||
@@ -28,27 +28,27 @@
|
||||
1 src/renderer/src/components/artifacts/ArtifactPublishButton.tsx
|
||||
2 src/renderer/src/components/artifacts/ArtifactsPage.tsx
|
||||
2 src/renderer/src/components/artifacts/useArtifactPagination.ts
|
||||
2 src/renderer/src/components/automations/AutomationEditorPromptEditor.tsx
|
||||
1 src/renderer/src/components/automations/AutomationHostFilterNotice.tsx
|
||||
1 src/renderer/src/components/automations/AutomationProjectCombobox.tsx
|
||||
1 src/renderer/src/components/automations/AutomationRunHistory.tsx
|
||||
1 src/renderer/src/components/automations/AutomationRunsDashboard.tsx
|
||||
1 src/renderer/src/components/automations/AutomationRunsTable.tsx
|
||||
2 src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.tsx
|
||||
1 src/renderer/src/components/automations/hosts/AutomationHostFilterNotice.tsx
|
||||
1 src/renderer/src/components/automations/authoring/AutomationProjectCombobox.tsx
|
||||
1 src/renderer/src/components/automations/runs/AutomationRunHistory.tsx
|
||||
1 src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx
|
||||
1 src/renderer/src/components/automations/runs/AutomationRunsTable.tsx
|
||||
1 src/renderer/src/components/automations/AutomationsPageSurface.tsx
|
||||
1 src/renderer/src/components/automations/use-automation-agent-picker-entries.ts
|
||||
2 src/renderer/src/components/automations/use-automation-create-destination.ts
|
||||
4 src/renderer/src/components/automations/use-automation-host-catalog.ts
|
||||
4 src/renderer/src/components/automations/use-automation-list-search.ts
|
||||
2 src/renderer/src/components/automations/use-automation-migrate-action.ts
|
||||
1 src/renderer/src/components/automations/use-automation-runs-dashboard.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-list-state.ts
|
||||
1 src/renderer/src/components/automations/authoring/use-automation-agent-picker-entries.ts
|
||||
2 src/renderer/src/components/automations/authoring/use-automation-create-destination.ts
|
||||
4 src/renderer/src/components/automations/hosts/use-automation-host-catalog.ts
|
||||
4 src/renderer/src/components/automations/listing/use-automation-list-search.ts
|
||||
2 src/renderer/src/components/automations/authoring/use-automation-migrate-action.ts
|
||||
1 src/renderer/src/components/automations/runs/use-automation-runs-dashboard.ts
|
||||
1 src/renderer/src/components/automations/listing/use-automations-page-list-state.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-local-state.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-refresh.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-setup-state.ts
|
||||
1 src/renderer/src/components/automations/authoring/use-automations-page-setup-state.ts
|
||||
1 src/renderer/src/components/automations/use-automations-page-store-state.ts
|
||||
1 src/renderer/src/components/automations/use-external-automation-scope-retention.ts
|
||||
2 src/renderer/src/components/automations/use-scoped-external-automations.ts
|
||||
16 src/renderer/src/components/automations/use-selected-automation-run-history.ts
|
||||
1 src/renderer/src/components/automations/external/use-external-automation-scope-retention.ts
|
||||
2 src/renderer/src/components/automations/external/use-scoped-external-automations.ts
|
||||
16 src/renderer/src/components/automations/runs/use-selected-automation-run-history.ts
|
||||
7 src/renderer/src/components/browser-extension-install-dialog.tsx
|
||||
1 src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx
|
||||
2 src/renderer/src/components/browser-pane/annotate/MarkupOverlay.tsx
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# This is a RATCHET: counts may only go DOWN. Use useTranslate()/useIntlLocale() from
|
||||
# @/i18n/use-translate. Prune after a fix: pnpm check:render-path-translate-ratchet --prune
|
||||
2 src/renderer/src/components/agent/AgentLaunchPromptComposer.tsx
|
||||
5 src/renderer/src/components/automations/use-external-automation-actions.ts
|
||||
5 src/renderer/src/components/automations/external/use-external-automation-actions.ts
|
||||
1 src/renderer/src/components/diff-comments/useDiffCommentDecorator.tsx
|
||||
2 src/renderer/src/components/editor/markdown-preview/render-tree/use-markdown-preview-components.tsx
|
||||
1 src/renderer/src/components/tab-group/useTabGroupCreationCommands.ts
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { readFile, readdir } 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'
|
||||
@@ -457,6 +457,32 @@ export async function mobileWebAppModuleClosure(entryModules, { absWorkingDir }
|
||||
|
||||
// One lazily imported chunk per UI language; the page fetches only the active one after init.
|
||||
const LOCALE_CATALOG_INPUT = /(^|\/)src\/i18n\/locales\/[^/]+\.json$/
|
||||
const localeCatalogDir = join(mobileDir, 'src', 'i18n', 'locales')
|
||||
|
||||
// The same catalogs as JSON for the host to serve one at a time, to shells that skip the chunks;
|
||||
// English is the page's inline fallback, so it has none.
|
||||
export async function readLocaleCatalogs(directory = localeCatalogDir) {
|
||||
const names = (await readdir(directory))
|
||||
.filter((name) => name.endsWith('.json') && name !== 'en.json')
|
||||
.sort()
|
||||
return Promise.all(
|
||||
names.map(async (name) => {
|
||||
// Minify: the host sends and the phone keeps the parsed object, not the source layout.
|
||||
const bytes = Buffer.from(
|
||||
JSON.stringify(JSON.parse(await readFile(join(directory, name), 'utf8'))),
|
||||
'utf8'
|
||||
)
|
||||
const sha256 = sha256Hex(bytes)
|
||||
return {
|
||||
locale: name.slice(0, -'.json'.length),
|
||||
bytes,
|
||||
path: `catalogs/${sha256}.json`,
|
||||
sha256,
|
||||
byteLength: bytes.byteLength
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
function localeCatalogOutputs(metafile) {
|
||||
return new Set(
|
||||
@@ -586,11 +612,13 @@ export async function buildMobileWebAppBundle({
|
||||
desktopVersion,
|
||||
protocolWindow,
|
||||
{ script, chunks, images, catalogChunks, entryStaticBytes, chunkCount, routeChunks, routeKeys },
|
||||
catalogs,
|
||||
scrollbarStyle
|
||||
] = await Promise.all([
|
||||
readDesktopVersion(),
|
||||
readProtocolWindow(),
|
||||
bundleMobileWebApp({ appDir }),
|
||||
readLocaleCatalogs(),
|
||||
readFile(join(projectDir, 'src/shared/styles/scrollbar-sleek.css'), 'utf8').then((style) =>
|
||||
// The shared desktop stylesheet can be checked out as CRLF on Windows.
|
||||
style.replace(/\r\n/g, '\n')
|
||||
@@ -598,9 +626,14 @@ export async function buildMobileWebAppBundle({
|
||||
])
|
||||
// Names already hash final bytes, so hashedAsset must reproduce them.
|
||||
const scriptAsset = hashedAsset(script, 'js')
|
||||
const catalogChunkSet = new Set(catalogChunks)
|
||||
const written = [
|
||||
scriptAsset,
|
||||
...[...chunks, ...images].map(({ name, bytes }) => hashedAsset(bytes, extname(name).slice(1)))
|
||||
...[...chunks, ...images].map((output) => ({
|
||||
...hashedAsset(output.bytes, extname(output.name).slice(1)),
|
||||
// Shells that read catalogs from the host skip these; older shells download them as before.
|
||||
...(catalogChunkSet.has(output) ? { kind: 'catalog' } : {})
|
||||
}))
|
||||
]
|
||||
|
||||
// Root-absolute URLs survive nested routes; CSP allows only about: base. ESM entry/chunks load under existing self policy.
|
||||
@@ -624,6 +657,7 @@ export async function buildMobileWebAppBundle({
|
||||
const { manifest } = await writeMobileWebBundleTree({
|
||||
outDir,
|
||||
written: [indexAsset, ...written],
|
||||
catalogs,
|
||||
desktopVersion,
|
||||
protocolWindow,
|
||||
routes: resolveMobileWebPageRoutes(routeKeys, pageRoutes),
|
||||
|
||||
@@ -133,6 +133,8 @@ async function compressWithBrotli(written) {
|
||||
export async function writeMobileWebBundleTree({
|
||||
outDir,
|
||||
written,
|
||||
// Host-only JSON outside `assets` and buildId, served one at a time over RPC.
|
||||
catalogs = [],
|
||||
desktopVersion,
|
||||
protocolWindow,
|
||||
// Empty route list makes shell render every screen natively.
|
||||
@@ -143,14 +145,15 @@ export async function writeMobileWebBundleTree({
|
||||
}) {
|
||||
const brotliCopies = brotli ? await compressWithBrotli(written) : new Map()
|
||||
const assets = written
|
||||
.map(({ path, sha256, byteLength, contentType }) => {
|
||||
.map(({ path, sha256, byteLength, contentType, kind }) => {
|
||||
const copy = brotliCopies.get(path)
|
||||
return {
|
||||
path,
|
||||
sha256,
|
||||
byteLength,
|
||||
contentType,
|
||||
...(copy === undefined ? {} : { brotliByteLength: copy.byteLength })
|
||||
...(copy === undefined ? {} : { brotliByteLength: copy.byteLength }),
|
||||
...(kind === undefined ? {} : { kind })
|
||||
}
|
||||
})
|
||||
.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0))
|
||||
@@ -164,14 +167,27 @@ export async function writeMobileWebBundleTree({
|
||||
entrypoint: MOBILE_WEB_BUNDLE_ENTRYPOINT,
|
||||
totalBytes: assets.reduce((total, asset) => total + asset.byteLength, 0),
|
||||
assets,
|
||||
routes
|
||||
routes,
|
||||
...(catalogs.length === 0
|
||||
? {}
|
||||
: {
|
||||
catalogs: catalogs.map(({ locale, path, sha256, byteLength }) => ({
|
||||
locale,
|
||||
path,
|
||||
sha256,
|
||||
byteLength
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
// Clear entire output or stale unreferenced assets ship inside asar.
|
||||
await rm(outDir, { recursive: true, force: true })
|
||||
await mkdir(join(outDir, 'assets'), { recursive: true })
|
||||
for (const asset of written) {
|
||||
await writeFile(join(outDir, asset.path), asset.bytes)
|
||||
if (catalogs.length > 0) {
|
||||
await mkdir(join(outDir, 'catalogs'), { recursive: true })
|
||||
}
|
||||
for (const file of [...written, ...catalogs]) {
|
||||
await writeFile(join(outDir, file.path), file.bytes)
|
||||
}
|
||||
for (const [path, copy] of brotliCopies) {
|
||||
await writeFile(join(outDir, mobileWebBundleBrotliPath(path)), copy)
|
||||
|
||||
@@ -29,6 +29,8 @@ export function mobileWebAppBundleMaxAssets(routeCount, imageCount, catalogChunk
|
||||
// fetched only for the active language, never before the first route. Code keeps its own fence.
|
||||
export const MOBILE_WEB_APP_BUNDLE_MAX_CATALOG_CHUNKS = 10
|
||||
export const MOBILE_WEB_APP_BUNDLE_MAX_CATALOG_BYTES = 3 * 1024 * 1024
|
||||
// The host sends a catalog's JSON in one reply, which must fit a 1 MiB relay frame once encrypted.
|
||||
export const MOBILE_WEB_APP_HOST_CATALOG_MAX_BYTES = 384 * 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.
|
||||
@@ -185,6 +187,23 @@ export async function verifyMobileWebAppBundle({ bundleDir = defaultBundleDir }
|
||||
`${String(MOBILE_WEB_APP_BUNDLE_MAX_CATALOG_BYTES)} bytes`
|
||||
)
|
||||
}
|
||||
// buildId leaves the host's JSON catalogs out, so a stale copy shows only here.
|
||||
const hostCatalogsOf = (built) => JSON.stringify(built.catalogs ?? [])
|
||||
if (hostCatalogsOf(first.manifest) !== hostCatalogsOf(second.manifest)) {
|
||||
fail('host language catalogs are not reproducible')
|
||||
}
|
||||
if (hostCatalogsOf(first.manifest) !== hostCatalogsOf(manifest)) {
|
||||
fail(`${bundleDir} is stale: its host language catalogs differ from a fresh build's`)
|
||||
}
|
||||
const oversized = (manifest.catalogs ?? []).find(
|
||||
(catalog) => catalog.byteLength > MOBILE_WEB_APP_HOST_CATALOG_MAX_BYTES
|
||||
)
|
||||
if (oversized) {
|
||||
fail(
|
||||
`the ${oversized.locale} host catalog is ${String(oversized.byteLength)} bytes, over the ` +
|
||||
`${String(MOBILE_WEB_APP_HOST_CATALOG_MAX_BYTES)} one reply carries`
|
||||
)
|
||||
}
|
||||
const budgetBytes = mobileWebAppBundleBudgetBytes(manifest) - first.catalogBytes
|
||||
if (budgetBytes > MOBILE_WEB_APP_BUNDLE_MAX_TOTAL_BYTES) {
|
||||
fail(
|
||||
|
||||
@@ -4672,53 +4672,44 @@
|
||||
"src/renderer/src/components/artifacts/ArtifactPublishButton.test.tsx": 706,
|
||||
"src/renderer/src/components/artifacts/ArtifactsPage.test.tsx": 2052,
|
||||
"src/renderer/src/components/artifacts/artifact-publish-flow.test.ts": 114,
|
||||
"src/renderer/src/components/automations/AutomationEditorPromptEditor.test.tsx": 396,
|
||||
"src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.test.tsx": 396,
|
||||
"src/renderer/src/components/automations/AutomationPromptDisclosure.test.tsx": 893,
|
||||
"src/renderer/src/components/automations/AutomationRunsTable.test.tsx": 668,
|
||||
"src/renderer/src/components/automations/AutomationSchedulePicker.test.ts": 431,
|
||||
"src/renderer/src/components/automations/AutomationTimeField.test.tsx": 654,
|
||||
"src/renderer/src/components/automations/authoring/AutomationSchedulePicker.test.ts": 431,
|
||||
|
||||
"src/renderer/src/components/automations/AutomationsPage.behavior.test.tsx": 3389,
|
||||
"src/renderer/src/components/automations/AutomationsPage.edit-destination.test.tsx": 2932,
|
||||
"src/renderer/src/components/automations/AutomationsPage.run-navigation.test.tsx": 3056,
|
||||
|
||||
"src/renderer/src/components/automations/ExternalAutomationManagers.test.tsx": 852,
|
||||
"src/renderer/src/components/automations/automation-captured-owner.test.ts": 379,
|
||||
"src/renderer/src/components/automations/automation-create-projects.test.ts": 42,
|
||||
"src/renderer/src/components/automations/hosts/automation-captured-owner.test.ts": 379,
|
||||
"src/renderer/src/components/automations/automation-host-cache-controller.test.ts": 411,
|
||||
"src/renderer/src/components/automations/automation-host-cache-error.test.ts": 391,
|
||||
"src/renderer/src/components/automations/automation-host-cache-health.test.ts": 52,
|
||||
"src/renderer/src/components/automations/automation-host-cache.test.ts": 79,
|
||||
"src/renderer/src/components/automations/automation-host-catalog-generation.test.ts": 258,
|
||||
"src/renderer/src/components/automations/automation-host-client.test.ts": 374,
|
||||
"src/renderer/src/components/automations/hosts/automation-host-cache.test.ts": 79,
|
||||
|
||||
"src/renderer/src/components/automations/automation-host-diagnostics.test.ts": 460,
|
||||
"src/renderer/src/components/automations/automation-host-filter-resolution.test.ts": 256,
|
||||
"src/renderer/src/components/automations/automation-host-health.test.ts": 47,
|
||||
|
||||
"src/renderer/src/components/automations/automation-host-invalidation-window-events.test.ts": 83,
|
||||
"src/renderer/src/components/automations/automation-host-invalidation.test.ts": 85,
|
||||
"src/renderer/src/components/automations/automation-host-list-rows.test.ts": 419,
|
||||
"src/renderer/src/components/automations/automation-host-recovery.test.ts": 51,
|
||||
"src/renderer/src/components/automations/hosts/automation-host-list-rows.test.ts": 419,
|
||||
"src/renderer/src/components/automations/automation-host-scale-gates.test.ts": 638,
|
||||
"src/renderer/src/components/automations/automation-host-scheduler.test.ts": 439,
|
||||
"src/renderer/src/components/automations/automation-legacy-schedule-editing.test.ts": 449,
|
||||
"src/renderer/src/components/automations/automation-list-focus-recovery.test.ts": 48,
|
||||
"src/renderer/src/components/automations/automation-list-row-identity.test.ts": 626,
|
||||
"src/renderer/src/components/automations/automation-list-search.test.ts": 75,
|
||||
"src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts": 439,
|
||||
"src/renderer/src/components/automations/authoring/automation-legacy-schedule-editing.test.ts": 449,
|
||||
|
||||
"src/renderer/src/components/automations/automation-list-view.test.ts": 257,
|
||||
"src/renderer/src/components/automations/automation-run-context.test.ts": 58,
|
||||
"src/renderer/src/components/automations/automation-run-history-keyboard-navigation.test.ts": 434,
|
||||
"src/renderer/src/components/automations/automation-run-open-target.test.ts": 442,
|
||||
"src/renderer/src/components/automations/runs/automation-run-history-keyboard-navigation.test.ts": 434,
|
||||
"src/renderer/src/components/automations/runs/automation-run-open-target.test.ts": 442,
|
||||
"src/renderer/src/components/automations/automation-run-output-snapshot-equivalence.test.ts": 158,
|
||||
"src/renderer/src/components/automations/automation-run-output-snapshot.test.ts": 96,
|
||||
"src/renderer/src/components/automations/automation-setup-decision.test.ts": 58,
|
||||
"src/renderer/src/components/automations/authoring/automation-setup-decision.test.ts": 58,
|
||||
"src/renderer/src/components/automations/automation-usage-model.test.ts": 200,
|
||||
"src/renderer/src/components/automations/external-automation-list-entries.test.ts": 57,
|
||||
"src/renderer/src/components/automations/external-automation-scope-gating.test.ts": 67,
|
||||
"src/renderer/src/components/automations/external/external-automation-scope-gating.test.ts": 67,
|
||||
"src/renderer/src/components/automations/external-automation-scope-keys.test.ts": 53,
|
||||
"src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx": 802,
|
||||
"src/renderer/src/components/automations/use-automation-host-catalog.test.tsx": 920,
|
||||
"src/renderer/src/components/automations/use-automation-list-focus-recovery.test.tsx": 229,
|
||||
"src/renderer/src/components/automations/use-automation-list-search.test.tsx": 679,
|
||||
"src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx": 6692,
|
||||
"src/renderer/src/components/automations/use-automation-runs-dashboard.test.tsx": 854,
|
||||
"src/renderer/src/components/automations/hosts/use-automation-host-catalog-readoption.test.tsx": 802,
|
||||
"src/renderer/src/components/automations/hosts/use-automation-host-catalog.test.tsx": 920,
|
||||
|
||||
"src/renderer/src/components/automations/listing/use-automation-list-search.test.tsx": 679,
|
||||
"src/renderer/src/components/automations/runs/use-automation-runs-dashboard-payload.test.tsx": 6692,
|
||||
"src/renderer/src/components/automations/runs/use-automation-runs-dashboard.test.tsx": 854,
|
||||
"src/renderer/src/components/automations/use-selected-automation-run-history.test.tsx": 2104,
|
||||
"src/renderer/src/components/browser-favicon.test.tsx": 333,
|
||||
"src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.dead-guest.test.tsx": 6219,
|
||||
@@ -5132,7 +5123,6 @@
|
||||
"src/renderer/src/components/mobile/WindowsFirewallNotice.test.tsx": 691,
|
||||
"src/renderer/src/components/mobile/paired-mobile-devices.test.ts": 192,
|
||||
"src/renderer/src/components/mobile/use-mobile-page-paired-devices.test.ts": 475,
|
||||
"src/renderer/src/components/native-chat-recovery/offers/native-chat-launch-resume-decision.test.tsx": 1844,
|
||||
"src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-bulk-progress.test.tsx": 3261,
|
||||
"src/renderer/src/components/native-chat-recovery/offers/native-chat-resume-failed-chat-watch.test.ts": 1954,
|
||||
"src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-finished-run.test.tsx": 4173,
|
||||
@@ -5187,9 +5177,7 @@
|
||||
"src/renderer/src/components/native-chat/selection-quotes/NativeChatSelectionQuote.test.tsx": 2370,
|
||||
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.approval-and-start-failure.test.tsx": 2922,
|
||||
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.availability-notice.test.tsx": 2764,
|
||||
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.history-read-state.test.tsx": 4919,
|
||||
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.host-outage.test.tsx": 3552,
|
||||
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.notice-card.test.tsx": 2911,
|
||||
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.refusal-notices.test.tsx": 3014,
|
||||
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.test.tsx": 4459,
|
||||
"src/renderer/src/components/native-chat/tools/tasks/NativeChatStructuredSessionStatus.test.tsx": 583,
|
||||
@@ -5233,7 +5221,6 @@
|
||||
"src/renderer/src/components/native-chat/composer/focus/native-chat-composer-reveal-focus.test.tsx": 526,
|
||||
"src/renderer/src/components/native-chat/attachments/intake/native-chat-composer-workspace-file-drop.test.tsx": 1166,
|
||||
"src/renderer/src/components/native-chat/drafts/native-chat-draft-retention.test.ts": 1415,
|
||||
"src/renderer/src/components/native-chat/attachments/intake/native-chat-element-file-drop.test.tsx": 2057,
|
||||
"src/renderer/src/components/native-chat/attachments/intake/native-chat-external-attachments-destination.test.tsx": 951,
|
||||
"src/renderer/src/components/native-chat/links/actions/native-chat-file-link-existence.test.ts": 1937,
|
||||
"src/renderer/src/components/native-chat/pane/actions/native-chat-header-ownership.test.tsx": 2796,
|
||||
@@ -5248,7 +5235,6 @@
|
||||
"src/renderer/src/components/native-chat/native-chat-new-rows-marker.test.tsx": 581,
|
||||
"src/renderer/src/components/native-chat/pane/routing/native-chat-open-wake.test.ts": 1807,
|
||||
"src/renderer/src/components/native-chat/pane/ownership/native-chat-owner-selectors.test.tsx": 525,
|
||||
"src/renderer/src/components/native-chat/attachments/intake/native-chat-pane-file-drop.test.tsx": 439,
|
||||
"src/renderer/src/components/native-chat/paste/native-chat-paste-routing.test.tsx": 2417,
|
||||
"src/renderer/src/components/native-chat/session/terminal/delivery/native-chat-pending.test.ts": 273,
|
||||
"src/renderer/src/components/native-chat/composer/editor/native-chat-prompt-document-text.test.ts": 219,
|
||||
@@ -5529,7 +5515,6 @@
|
||||
"src/renderer/src/components/settings/developer-permissions/TerminalTccAttributionNotice.test.tsx": 401,
|
||||
"src/renderer/src/components/settings/voice/VoiceMicrophoneSetting.test.tsx": 957,
|
||||
"src/renderer/src/components/settings/voice/VoicePane.test.tsx": 1042,
|
||||
"src/renderer/src/components/settings/voice/VoiceSpeechModelSection.test.tsx": 503,
|
||||
"src/renderer/src/components/settings/accounts/sign-in/account-add-cancel-target.test.ts": 217,
|
||||
"src/renderer/src/components/settings/accounts/usage/accounts-pane-opencode-credentials.test.ts": 519,
|
||||
"src/renderer/src/lib/agent-session/launch/agent-settings-update-queue.test.ts": 249,
|
||||
@@ -5684,14 +5669,11 @@
|
||||
"src/renderer/src/components/skills/sharing/SkillSharedLinkRow.test.tsx": 817,
|
||||
"src/renderer/src/components/skills/SkillsPage.test.tsx": 3822,
|
||||
"src/renderer/src/components/skills/catalog/skill-agent-filter.test.ts": 274,
|
||||
"src/shared/skill-share-link.test.ts": 55,
|
||||
"src/renderer/src/components/skills/sharing/skill-share-package-selection.test.ts": 49,
|
||||
|
||||
"src/renderer/src/components/sparse/sparse-directory-entry-input.test.ts": 207,
|
||||
"src/renderer/src/components/stats/usage-daily-chart.test.tsx": 333,
|
||||
"src/renderer/src/components/stats/usage-overview-model.test.ts": 364,
|
||||
"src/renderer/src/components/status-bar/ClaudeSwitcherMenu.owner-lifetime.test.tsx": 2317,
|
||||
"src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.test.tsx": 2452,
|
||||
"src/renderer/src/components/status-bar/PortsStatusSegment.render-stability.test.tsx": 2161,
|
||||
|
||||
"src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx": 1838,
|
||||
@@ -6370,9 +6352,7 @@
|
||||
"src/renderer/src/lib/finished-agent-resume-resurrection.test.ts": 1872,
|
||||
"src/renderer/src/lib/focus-terminal-tab-surface.split-focus.test.ts": 331,
|
||||
"src/renderer/src/lib/foreground-terminal-tabs.test.ts": 55,
|
||||
"src/shared/new-workspace/github-links.test.ts": 76,
|
||||
"src/renderer/src/lib/work-items/github/github-source-runtime-context.test.ts": 62,
|
||||
"src/shared/new-workspace/gitlab-links.test.ts": 56,
|
||||
"src/renderer/src/lib/hook-command-delayed-delivery.test.ts": 1904,
|
||||
"src/renderer/src/lib/host-chat-program.test.ts": 2419,
|
||||
"src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts": 1706,
|
||||
@@ -7981,7 +7961,7 @@
|
||||
"tests/e2e/ai-vault-account-stream.unit.test.ts": 4506,
|
||||
"tests/e2e/ai-vault-manual-name-clear.unit.test.ts": 21206,
|
||||
"tests/e2e/automation-chat-reopen.unit.test.ts": 6262,
|
||||
"tests/e2e/automation-save-fallback.unit.test.ts": 9065,
|
||||
|
||||
"tests/e2e/claude-agent-row-view.unit.test.ts": 1491,
|
||||
"tests/e2e/codex-child-approval-activity-row.unit.test.ts": 14886,
|
||||
"tests/e2e/completed-worker-retirement-resume.unit.test.ts": 38857,
|
||||
@@ -8017,7 +7997,7 @@
|
||||
"tests/e2e/host-agent-launch-preferences-work.unit.test.ts": 3882,
|
||||
"tests/e2e/host-agent-launch-settings-hook-bookkeeping.unit.test.ts": 21972,
|
||||
"tests/e2e/host-cold-park-remote-subscriber.unit.test.ts": 5314,
|
||||
"tests/e2e/journal-restored-consumers.unit.test.ts": 33933,
|
||||
|
||||
"tests/e2e/launch-agent-background-session-remote.unit.test.ts": 1016,
|
||||
"tests/e2e/launch-agent-in-new-tab-web-runtime.unit.test.ts": 14288,
|
||||
"tests/e2e/linear-cli-recovery.unit.test.ts": 7592,
|
||||
@@ -8029,7 +8009,7 @@
|
||||
"tests/e2e/native-chat-rewind-boundary.unit.test.ts": 2977,
|
||||
"tests/e2e/native-chat-ssh-transcript.unit.test.ts": 1166,
|
||||
"tests/e2e/native-chat-startup-option-pickers.unit.test.ts": 9377,
|
||||
"tests/e2e/native-chat-transcript-file-order.unit.test.ts": 1066,
|
||||
|
||||
"tests/e2e/native-chat-transcript-reasoning.unit.test.ts": 3341,
|
||||
"tests/e2e/nested-agent-idle-owner.unit.test.ts": 2469,
|
||||
"tests/e2e/omp-child-session-recovery.unit.test.ts": 2205,
|
||||
|
||||
@@ -106,6 +106,19 @@ function parseManifest(bundleDir) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (manifest.catalogs !== undefined && !Array.isArray(manifest.catalogs)) {
|
||||
throw failure('manifest catalogs is not a list')
|
||||
}
|
||||
for (const catalog of manifest.catalogs ?? []) {
|
||||
if (typeof catalog !== 'object' || catalog === null || typeof catalog.locale !== 'string') {
|
||||
throw failure('manifest catalog entry has no locale')
|
||||
}
|
||||
assertSafeRelativePath(catalog.path)
|
||||
if (typeof catalog.sha256 !== 'string' || !SHA256_PATTERN.test(catalog.sha256)) {
|
||||
throw failure(`manifest catalog ${catalog.path} has no sha256 digest`)
|
||||
}
|
||||
assertInteger(catalog.byteLength, `catalogs[${catalog.path}].byteLength`)
|
||||
}
|
||||
if (!manifest.assets.some((asset) => asset.path === manifest.entrypoint)) {
|
||||
throw failure(`manifest entrypoint ${manifest.entrypoint} is not one of its assets`)
|
||||
}
|
||||
@@ -126,6 +139,11 @@ function parseManifest(bundleDir) {
|
||||
return manifest
|
||||
}
|
||||
|
||||
// Assets go to the phone; catalogs stay on the host, which serves one on request.
|
||||
function servedFiles(manifest) {
|
||||
return [...manifest.assets, ...(manifest.catalogs ?? [])]
|
||||
}
|
||||
|
||||
function listBundleFiles(directory, prefix = '') {
|
||||
const found = []
|
||||
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
||||
@@ -164,7 +182,7 @@ function assertNoUnlistedFiles(bundleDir, manifest) {
|
||||
const listed = new Set([
|
||||
'manifest.json',
|
||||
...darkBuildMarkerFileNames(),
|
||||
...manifest.assets.map((asset) => asset.path),
|
||||
...servedFiles(manifest).map((file) => file.path),
|
||||
...brotliCopies(manifest).map((asset) => brotliPath(asset))
|
||||
])
|
||||
const strays = listBundleFiles(bundleDir).filter((path) => !listed.has(path))
|
||||
@@ -180,7 +198,7 @@ function assertNoUnlistedFiles(bundleDir, manifest) {
|
||||
function assertMobileWebBundleBuilt(bundleDir = MOBILE_WEB_BUNDLE_DIR) {
|
||||
const manifest = parseManifest(bundleDir)
|
||||
assertNoUnlistedFiles(bundleDir, manifest)
|
||||
for (const asset of manifest.assets) {
|
||||
for (const asset of servedFiles(manifest)) {
|
||||
const assetPath = join(bundleDir, asset.path)
|
||||
const size = statSize(bundleDir, asset.path)
|
||||
if (size !== asset.byteLength) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import { View } from 'react-native'
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
||||
import { MobileNativeChatQueuedMessages } from './src/session/native-chat/input/MobileNativeChatQueuedMessages'
|
||||
import { MobileNativeChatComposer } from './src/session/native-chat/composer/MobileNativeChatComposer'
|
||||
import { mobileQueuedMessageCards } from './src/session/mobile-structured-queued-message-cards'
|
||||
import { mobileQueuedMessageCards } from './src/session/native-chat/input/mobile-structured-queued-message-cards'
|
||||
import { activateMobileUiLocale, translate } from './src/i18n/mobile-i18n'
|
||||
|
||||
const [mode, locale] = location.hash.slice(1).split(':')
|
||||
|
||||
@@ -19,7 +19,7 @@ export function stageOrcadMobileWebBundle(outputDir, bundleDir = MOBILE_WEB_BUND
|
||||
// The release template refuses the variable itself.
|
||||
assertNoDarkOutputOfOffSwitches([bundleDir])
|
||||
assertMobileWebBundleBuilt(bundleDir)
|
||||
// The guard refuses unlisted files, so the tree is the manifest, its assets and a dark marker.
|
||||
// The guard refuses unlisted files, so the tree is the manifest, its assets and catalogs, and a dark marker.
|
||||
cpSync(bundleDir, join(outputDir, ...ORCAD_MOBILE_WEB_DIR.split('/')), { recursive: true })
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ const { sortJiraIssues } = await jiti.import(
|
||||
'../../../../src/renderer/src/components/jira-issue-sorter.ts'
|
||||
)
|
||||
const { sortAutomationListViewItems } = await jiti.import(
|
||||
'../../../../src/renderer/src/components/automations/automation-list-view.ts'
|
||||
'../../../../src/renderer/src/components/automations/listing/automation-list-view.ts'
|
||||
)
|
||||
const automationLocale = 'en-US'
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ const NODE_RUNTIME_INCLUDE = [
|
||||
'src/main/gitlab/gitlab-known-host-retirement.test.ts',
|
||||
'src/main/window/main-window-updater-deferred-setup.test.ts',
|
||||
'src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts',
|
||||
'src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx',
|
||||
'src/renderer/src/components/automations/runs/use-automation-runs-dashboard-payload.test.tsx',
|
||||
'src/main/native-chat/agent-session-journal/**/*.test.ts',
|
||||
'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts',
|
||||
'src/main/runtime/agent-session/records/agent-session-conversation-name-store.test.ts',
|
||||
@@ -169,7 +169,12 @@ const NODE_RUNTIME_INCLUDE = [
|
||||
'src/main/claude/claude-agent-sdk-contract-pins.test.ts',
|
||||
'config/scripts/orcad-distribution/server-bundle/profile-state-worker-smoke.test.mjs',
|
||||
'config/scripts/desktop-distribution/runtime-verification/process-host-dev-rebuild.test.ts',
|
||||
'config/scripts/test-runtime/node-worker/vitest-node-runtime-pool.test.ts'
|
||||
'config/scripts/test-runtime/node-worker/vitest-node-runtime-pool.test.ts',
|
||||
// Reopen the WAL-backed dismissal cache read-only through the row cache, which Bun on macOS cannot.
|
||||
'src/main/runtime/push/notifications/mobile-notification-dismissal-store.test.ts',
|
||||
'src/main/runtime/push/notifications/mobile-notification-dismissal-read-failure.test.ts',
|
||||
'src/main/ipc/notifications-subject-retirement.test.ts',
|
||||
'src/main/ipc/notifications-external-acknowledgement.test.ts'
|
||||
]
|
||||
|
||||
/** `filters` limits the SQLite import scan to the tests a filtered CLI run can select. */
|
||||
|
||||
|
Before Width: | Height: | Size: 392 KiB |
|
Before Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 391 KiB |
|
Before Width: | Height: | Size: 385 KiB |
|
Before Width: | Height: | Size: 381 KiB |
|
Before Width: | Height: | Size: 386 KiB After Width: | Height: | Size: 395 KiB |
@@ -249,11 +249,9 @@ Associez-la à l'app de bureau pour surveiller et piloter vos agents depuis votr
|
||||
|
||||
- **Discord :** Rejoignez la communauté sur **[Discord](https://discord.gg/fzjDKHxv8Q)**.
|
||||
- **Twitter / X :** Suivez **[@orca_build](https://x.com/orca_build)** pour les news et annonces.
|
||||
- **WeChat :** Scannez pour rejoindre un groupe WeChat de la communauté Orca. Si un groupe est complet, rejoignez-en un autre.
|
||||
- **WeChat :** Scannez pour rejoindre un groupe WeChat de la communauté Orca.
|
||||
|
||||
<img src="../assets/wechat-qr-group14.jpg" alt="QR code du groupe WeChat de la communauté Orca" width="160" />
|
||||
<img src="../assets/wechat-qr-group15.jpg" alt="QR code du groupe WeChat de la communauté Orca" width="160" />
|
||||
<img src="../assets/wechat-qr-group16.jpg" alt="QR code du groupe WeChat de la communauté Orca" width="160" />
|
||||
<img src="../assets/wechat-qr.jpg" alt="QR code du groupe WeChat de la communauté Orca" width="160" />
|
||||
|
||||
- **Feedback & idées :** On ship vite. Il manque quelque chose ? [Demandez une feature](https://github.com/stablyai/orca/issues).
|
||||
- **Confidentialité :** Voir la [doc confidentialité & télémétrie](https://www.onorca.dev/docs/telemetry) pour ce qu'Orca collecte en anonyme et comment désactiver la télémétrie.
|
||||
|
||||
@@ -244,11 +244,9 @@ yay -S stably-orca-bin
|
||||
|
||||
- **Discord:** **[Discord](https://discord.gg/fzjDKHxv8Q)** 커뮤니티에 참여하세요.
|
||||
- **Twitter / X:** 업데이트와 공지는 **[@orca_build](https://x.com/orca_build)** 를 팔로우하세요.
|
||||
- **WeChat:** QR 코드를 스캔해 Orca 커뮤니티 WeChat 그룹에 참여하세요. 한 그룹이 가득 찼다면 다른 그룹에 참여하세요.
|
||||
- **WeChat:** QR 코드를 스캔해 Orca 커뮤니티 WeChat 그룹에 참여하세요.
|
||||
|
||||
<img src="../assets/wechat-qr-group14.jpg" alt="Orca 커뮤니티 WeChat 그룹 QR 코드" width="160" />
|
||||
<img src="../assets/wechat-qr-group15.jpg" alt="Orca 커뮤니티 WeChat 그룹 QR 코드" width="160" />
|
||||
<img src="../assets/wechat-qr-group16.jpg" alt="Orca 커뮤니티 WeChat 그룹 QR 코드" width="160" />
|
||||
<img src="../assets/wechat-qr.jpg" alt="Orca 커뮤니티 WeChat 그룹 QR 코드" width="160" />
|
||||
|
||||
- **피드백과 아이디어:** 우리는 빠르게 출시합니다. 필요한 기능이 있나요? [새 기능을 요청](https://github.com/stablyai/orca/issues)하세요.
|
||||
- **개인정보 보호:** Orca가 수집하는 익명 사용 데이터와 수집 거부 방법은 [개인정보 및 텔레메트리 문서](https://www.onorca.dev/docs/telemetry)를 참고하세요.
|
||||
|
||||
@@ -245,11 +245,9 @@ yay -S stably-orca-bin
|
||||
|
||||
- **Discord:** Присоединяйтесь к сообществу в **[Discord](https://discord.gg/fzjDKHxv8Q)**.
|
||||
- **Twitter / X:** Подпишитесь на **[@orca_build](https://x.com/orca_build)**, чтобы узнавать об обновлениях и анонсах.
|
||||
- **WeChat:** Отсканируйте QR-код, чтобы присоединиться к группе сообщества Orca в WeChat. Если одна группа заполнена, присоединяйтесь к другой.
|
||||
- **WeChat:** Отсканируйте QR-код, чтобы присоединиться к группе сообщества Orca в WeChat.
|
||||
|
||||
<img src="../assets/wechat-qr-group14.jpg" alt="QR-код группы сообщества Orca в WeChat" width="160" />
|
||||
<img src="../assets/wechat-qr-group15.jpg" alt="QR-код группы сообщества Orca в WeChat" width="160" />
|
||||
<img src="../assets/wechat-qr-group16.jpg" alt="QR-код группы сообщества Orca в WeChat" width="160" />
|
||||
<img src="../assets/wechat-qr.jpg" alt="QR-код группы сообщества Orca в WeChat" width="160" />
|
||||
|
||||
- **Отзывы и идеи:** Мы быстро выпускаем обновления. Чего-то не хватает? [Предложите новую возможность](https://github.com/stablyai/orca/issues).
|
||||
- **Конфиденциальность:** В [документации о конфиденциальности и телеметрии](https://www.onorca.dev/docs/telemetry) описано, какие анонимные данные об использовании собирает Orca и как отказаться от их сбора.
|
||||
|
||||
@@ -242,11 +242,9 @@ Ajanlarınızı telefonunuzdan izlemek ve yönlendirmek için masaüstü uygulam
|
||||
|
||||
- **Discord:** Topluluğa **[Discord](https://discord.gg/fzjDKHxv8Q)** üzerinden katılın.
|
||||
- **Twitter / X:** Güncellemeler ve duyurular için **[@orca_build](https://x.com/orca_build)** hesabını takip edin.
|
||||
- **WeChat:** Orca topluluğunun bir WeChat grubuna katılmak için karekodu okutun. Bir grup doluysa başka bir gruba katılabilirsiniz.
|
||||
- **WeChat:** Orca topluluğunun bir WeChat grubuna katılmak için karekodu okutun.
|
||||
|
||||
<img src="../assets/wechat-qr-group14.jpg" alt="Orca topluluğunun WeChat grubu karekodu" width="160" />
|
||||
<img src="../assets/wechat-qr-group15.jpg" alt="Orca topluluğunun WeChat grubu karekodu" width="160" />
|
||||
<img src="../assets/wechat-qr-group16.jpg" alt="Orca topluluğunun WeChat grubu karekodu" width="160" />
|
||||
<img src="../assets/wechat-qr.jpg" alt="Orca topluluğunun WeChat grubu karekodu" width="160" />
|
||||
|
||||
- **Geri bildirim ve fikirler:** Hızlı sürüm çıkarıyoruz. Eksik bulduğunuz bir şey mi var? [Yeni bir özellik isteyin](https://github.com/stablyai/orca/issues).
|
||||
- **Gizlilik:** Orca'nın hangi anonim kullanım verisini topladığını ve bunu nasıl kapatacağınızı [gizlilik ve telemetri dokümanlarında](https://www.onorca.dev/docs/telemetry) bulabilirsiniz.
|
||||
|
||||
@@ -242,11 +242,9 @@ yay -S stably-orca-bin
|
||||
|
||||
- **Discord:** 加入 **[Discord](https://discord.gg/fzjDKHxv8Q)** 社区。
|
||||
- **Twitter / X:** 关注 **[@orca_build](https://x.com/orca_build)** 获取更新和公告。
|
||||
- **微信:** 扫码加入 Orca 社区微信群。如果一个群已满,可以加入其他群。
|
||||
- **微信:** 扫码加入 Orca 社区微信群。
|
||||
|
||||
<img src="../assets/wechat-qr-group14.jpg" alt="Orca 社区微信群二维码" width="160" />
|
||||
<img src="../assets/wechat-qr-group15.jpg" alt="Orca 社区微信群二维码" width="160" />
|
||||
<img src="../assets/wechat-qr-group16.jpg" alt="Orca 社区微信群二维码" width="160" />
|
||||
<img src="../assets/wechat-qr.jpg" alt="Orca 社区微信群二维码" width="160" />
|
||||
|
||||
- **反馈与想法:** 我们发布很快。缺少什么功能?[提交功能请求](https://github.com/stablyai/orca/issues)。
|
||||
- **隐私:** 查看[隐私与遥测文档](https://www.onorca.dev/docs/telemetry),了解 Orca 收集哪些匿名使用数据以及如何退出。
|
||||
|
||||
@@ -18029,7 +18029,7 @@
|
||||
"id": "native-chat-write-accepted",
|
||||
"operation": "nativeChat.terminal-write",
|
||||
"family": "nativeChat.terminal-write",
|
||||
"sites": ["mobile/src/session/native-chat/mobile-native-chat-send.ts"],
|
||||
"sites": ["mobile/src/session/native-chat/composer/mobile-native-chat-send.ts"],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -18065,7 +18065,7 @@
|
||||
"id": "native-chat-write-rejected",
|
||||
"operation": "nativeChat.terminal-write",
|
||||
"family": "nativeChat.terminal-write",
|
||||
"sites": ["mobile/src/session/native-chat/mobile-native-chat-send.ts"],
|
||||
"sites": ["mobile/src/session/native-chat/composer/mobile-native-chat-send.ts"],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -18101,7 +18101,7 @@
|
||||
"id": "native-chat-write-delivery-unknown",
|
||||
"operation": "nativeChat.terminal-write",
|
||||
"family": "nativeChat.terminal-write",
|
||||
"sites": ["mobile/src/session/native-chat/mobile-native-chat-send.ts"],
|
||||
"sites": ["mobile/src/session/native-chat/composer/mobile-native-chat-send.ts"],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -18133,7 +18133,7 @@
|
||||
"id": "native-chat-write-clear-line",
|
||||
"operation": "nativeChat.terminal-write",
|
||||
"family": "nativeChat.terminal-write",
|
||||
"sites": ["mobile/src/session/native-chat/mobile-native-chat-send.ts"],
|
||||
"sites": ["mobile/src/session/native-chat/composer/mobile-native-chat-send.ts"],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -18169,7 +18169,7 @@
|
||||
"id": "native-chat-write-typed-command",
|
||||
"operation": "nativeChat.terminal-write",
|
||||
"family": "nativeChat.terminal-write",
|
||||
"sites": ["mobile/src/session/native-chat/mobile-native-chat-send.ts"],
|
||||
"sites": ["mobile/src/session/native-chat/composer/mobile-native-chat-send.ts"],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -18840,7 +18840,9 @@
|
||||
"id": "structured-launch-unsupported",
|
||||
"operation": "agentSession.structured-launch",
|
||||
"family": "agentSession.structured-launch",
|
||||
"sites": ["mobile/src/session/mobile-structured-agent-session-launch.ts"],
|
||||
"sites": [
|
||||
"mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-launch.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -18870,7 +18872,9 @@
|
||||
"id": "structured-launch-support-refused",
|
||||
"operation": "agentSession.structured-launch",
|
||||
"family": "agentSession.structured-launch",
|
||||
"sites": ["mobile/src/session/mobile-structured-agent-session-launch.ts"],
|
||||
"sites": [
|
||||
"mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-launch.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -18900,7 +18904,9 @@
|
||||
"id": "structured-launch-created",
|
||||
"operation": "agentSession.structured-launch",
|
||||
"family": "agentSession.structured-launch",
|
||||
"sites": ["mobile/src/session/mobile-structured-agent-session-launch.ts"],
|
||||
"sites": [
|
||||
"mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-launch.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -18951,7 +18957,9 @@
|
||||
"id": "structured-launch-definitive-refusal",
|
||||
"operation": "agentSession.structured-launch",
|
||||
"family": "agentSession.structured-launch",
|
||||
"sites": ["mobile/src/session/mobile-structured-agent-session-launch.ts"],
|
||||
"sites": [
|
||||
"mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-launch.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -19003,7 +19011,9 @@
|
||||
"id": "structured-launch-replays-dropped-create",
|
||||
"operation": "agentSession.structured-launch",
|
||||
"family": "agentSession.structured-launch",
|
||||
"sites": ["mobile/src/session/mobile-structured-agent-session-launch.ts"],
|
||||
"sites": [
|
||||
"mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-launch.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -19443,7 +19453,7 @@
|
||||
"id": "native-chat-stop-accepted",
|
||||
"operation": "session.native-chat-stop",
|
||||
"family": "session.native-chat-stop",
|
||||
"sites": ["mobile/src/session/native-chat/use-mobile-native-chat-stop.ts"],
|
||||
"sites": ["mobile/src/session/native-chat/composer/use-mobile-native-chat-stop.ts"],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -19504,7 +19514,7 @@
|
||||
"id": "native-chat-stop-both-rejected",
|
||||
"operation": "session.native-chat-stop",
|
||||
"family": "session.native-chat-stop",
|
||||
"sites": ["mobile/src/session/native-chat/use-mobile-native-chat-stop.ts"],
|
||||
"sites": ["mobile/src/session/native-chat/composer/use-mobile-native-chat-stop.ts"],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -19562,7 +19572,7 @@
|
||||
"id": "native-chat-stop-delivery-unknown",
|
||||
"operation": "session.native-chat-stop",
|
||||
"family": "session.native-chat-stop",
|
||||
"sites": ["mobile/src/session/native-chat/use-mobile-native-chat-stop.ts"],
|
||||
"sites": ["mobile/src/session/native-chat/composer/use-mobile-native-chat-stop.ts"],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
@@ -19962,7 +19972,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -20039,7 +20049,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -20117,7 +20127,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -20152,7 +20162,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -20188,7 +20198,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -20224,7 +20234,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -20280,7 +20290,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -24889,7 +24899,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -24944,7 +24954,7 @@
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-comment-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-git-actions.ts",
|
||||
"mobile/src/source-control/review/use-mobile-diff-review-send-actions.ts",
|
||||
"mobile/src/session/native-chat/mobile-native-chat-stale-input.ts"
|
||||
"mobile/src/session/native-chat/composer/mobile-native-chat-stale-input.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
@@ -25018,7 +25028,9 @@
|
||||
"id": "structured-agent-session-created",
|
||||
"operation": "agentSession.structured-launch",
|
||||
"family": "agentSession.structured-create",
|
||||
"sites": ["mobile/src/session/mobile-structured-agent-session-launch.ts"],
|
||||
"sites": [
|
||||
"mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-launch.ts"
|
||||
],
|
||||
"schedules": [],
|
||||
"steps": [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { openMobileAgentHistoryChat } from './open-mobile-agent-history-chat'
|
||||
import { mobileStructuredSessionOpenMessage } from '../session/mobile-structured-session-open-message'
|
||||
import { mobileStructuredSessionOpenMessage } from '../session/native-chat/agent-session/mobile-structured-session-open-message'
|
||||
import { prepareMobileHistoryResumeTarget } from './mobile-history-resume-target-preparation'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { View } from 'react-native'
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import {
|
||||
openMobileStructuredSession,
|
||||
mobileStructuredSessionHref
|
||||
} from '../session/open-mobile-structured-session'
|
||||
} from '../session/native-chat/agent-session/open-mobile-structured-session'
|
||||
|
||||
/** Consume native opens and ambiguous failures; only an explicit pre-effect refusal resumes in a terminal. */
|
||||
export async function openMobileAgentHistoryChat(args: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { mobileStructuredSessionStatusFeed } from '../session/mobile-structured-session-status-feed'
|
||||
import { mobileStructuredSessionStatusFeed } from '../session/native-chat/agent-session/mobile-structured-session-status-feed'
|
||||
import type { AgentSessionConversationNames } from '../../../src/shared/agent-session/agent-session-conversation-names'
|
||||
import { useForceReconnect } from '../transport/connection/host-client-hooks'
|
||||
import { useWorkspaceClient } from '../worktree/use-workspace-client'
|
||||
|
||||
@@ -4,8 +4,8 @@ import type { MobileImageSource } from '../../platform/media-picker-contract'
|
||||
import type {
|
||||
MobileNativeChatSendIntent,
|
||||
MobileNativeChatSendOutcome
|
||||
} from '../../session/native-chat/mobile-native-chat-send'
|
||||
import type { StructuredMobileSendAttachment } from '../../session/use-mobile-structured-send-with-outcome'
|
||||
} from '../../session/native-chat/composer/mobile-native-chat-send'
|
||||
import type { StructuredMobileSendAttachment } from '../../session/native-chat/composer/use-mobile-structured-send-with-outcome'
|
||||
import { useMobileImageAttachment } from './use-mobile-image-attachment'
|
||||
import {
|
||||
useMobileNativeChatImageAttachments,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
|
||||
|
||||
export type LocaleCatalog = Readonly<Record<string, unknown>>
|
||||
|
||||
// Literal specifiers: Metro evaluates only the chosen module, and the page build splits each into its own chunk.
|
||||
const CATALOG_IMPORTS: Record<Exclude<SupportedUiLocale, 'en'>, () => Promise<LocaleCatalog>> = {
|
||||
de: () => import('./locales/de.json').then((module) => module.default),
|
||||
es: () => import('./locales/es.json').then((module) => module.default),
|
||||
fr: () => import('./locales/fr.json').then((module) => module.default),
|
||||
ja: () => import('./locales/ja.json').then((module) => module.default),
|
||||
ko: () => import('./locales/ko.json').then((module) => module.default),
|
||||
pt: () => import('./locales/pt.json').then((module) => module.default),
|
||||
ru: () => import('./locales/ru.json').then((module) => module.default),
|
||||
tr: () => import('./locales/tr.json').then((module) => module.default),
|
||||
zh: () => import('./locales/zh.json').then((module) => module.default),
|
||||
'zh-Hant': () => import('./locales/zh-Hant.json').then((module) => module.default)
|
||||
}
|
||||
|
||||
export function importBundledLocaleCatalog(
|
||||
locale: Exclude<SupportedUiLocale, 'en'>
|
||||
): Promise<LocaleCatalog> {
|
||||
return CATALOG_IMPORTS[locale]()
|
||||
}
|
||||
@@ -1,23 +1,9 @@
|
||||
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
|
||||
import type { LocaleCatalog } from './bundled-locale-catalogs'
|
||||
|
||||
export type LocaleCatalog = Readonly<Record<string, unknown>>
|
||||
export { importBundledLocaleCatalog as importLocaleCatalog } from './bundled-locale-catalogs'
|
||||
|
||||
// Literal specifiers: Metro evaluates only the chosen module, and the page build splits each into its own chunk.
|
||||
const CATALOG_IMPORTS: Record<Exclude<SupportedUiLocale, 'en'>, () => Promise<LocaleCatalog>> = {
|
||||
de: () => import('./locales/de.json').then((module) => module.default),
|
||||
es: () => import('./locales/es.json').then((module) => module.default),
|
||||
fr: () => import('./locales/fr.json').then((module) => module.default),
|
||||
ja: () => import('./locales/ja.json').then((module) => module.default),
|
||||
ko: () => import('./locales/ko.json').then((module) => module.default),
|
||||
pt: () => import('./locales/pt.json').then((module) => module.default),
|
||||
ru: () => import('./locales/ru.json').then((module) => module.default),
|
||||
tr: () => import('./locales/tr.json').then((module) => module.default),
|
||||
zh: () => import('./locales/zh.json').then((module) => module.default),
|
||||
'zh-Hant': () => import('./locales/zh-Hant.json').then((module) => module.default)
|
||||
}
|
||||
|
||||
export function importLocaleCatalog(
|
||||
locale: Exclude<SupportedUiLocale, 'en'>
|
||||
): Promise<LocaleCatalog> {
|
||||
return CATALOG_IMPORTS[locale]()
|
||||
}
|
||||
// Bundled catalogs never change after their import, so none arrives later; the page build's .web.ts does.
|
||||
export const onLocaleCatalogArrival: (
|
||||
listener: (locale: Exclude<SupportedUiLocale, 'en'>, catalog: LocaleCatalog) => void
|
||||
) => () => void = () => () => undefined
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
|
||||
import { importBundledLocaleCatalog, type LocaleCatalog } from './bundled-locale-catalogs'
|
||||
|
||||
// A shell that skips the catalog chunks has page-locale-catalog-source.ts read them from the desktop
|
||||
// and the device store; other shells import the chunk as before. No transport here, so pages that
|
||||
// only translate pull in none.
|
||||
export type { LocaleCatalog }
|
||||
type CatalogLocale = Exclude<SupportedUiLocale, 'en'>
|
||||
type CatalogLoader = (locale: CatalogLocale) => Promise<LocaleCatalog>
|
||||
type ArrivalListener = (locale: CatalogLocale, catalog: LocaleCatalog) => void
|
||||
|
||||
let loader: CatalogLoader | null = null
|
||||
const arrivalListeners = new Set<ArrivalListener>()
|
||||
|
||||
export function publishPageLocaleCatalogLoader(next: CatalogLoader): void {
|
||||
loader = next
|
||||
}
|
||||
|
||||
// Resolve the catalog or reject so activation falls back to English.
|
||||
export function importLocaleCatalog(locale: CatalogLocale): Promise<LocaleCatalog> {
|
||||
return loader === null ? importBundledLocaleCatalog(locale) : loader(locale)
|
||||
}
|
||||
|
||||
// A catalog that arrives after activation settled: a newer copy, or the first one after an offline start.
|
||||
export function onLocaleCatalogArrival(listener: ArrivalListener): () => void {
|
||||
arrivalListeners.add(listener)
|
||||
return () => {
|
||||
arrivalListeners.delete(listener)
|
||||
}
|
||||
}
|
||||
|
||||
export function announceLocaleCatalog(locale: CatalogLocale, catalog: LocaleCatalog): void {
|
||||
for (const listener of arrivalListeners) {
|
||||
listener(locale, catalog)
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,8 @@ vi.mock('./locale-catalog-imports', () => ({
|
||||
importLocaleCatalog: (locale: string) =>
|
||||
failing.has(locale)
|
||||
? Promise.reject(new Error('missing chunk'))
|
||||
: new Promise((resolve) => pending.set(locale, resolve))
|
||||
: new Promise((resolve) => pending.set(locale, resolve)),
|
||||
onLocaleCatalogArrival: () => () => undefined
|
||||
}))
|
||||
|
||||
const { activateMobileUiLocale, getMobileUiLocale, mobileI18n, translate } =
|
||||
|
||||
@@ -3,7 +3,7 @@ import { resolvePluralFamilyKey } from '../../../src/shared/i18n-plural-family'
|
||||
import { pseudoLocalizeString } from '../../../src/shared/pseudo-localization'
|
||||
import { DEFAULT_UI_LOCALE, type SupportedUiLocale } from '../../../src/shared/ui-locale'
|
||||
import enRuntimeRequired from './en-runtime-required.json'
|
||||
import { importLocaleCatalog } from './locale-catalog-imports'
|
||||
import { importLocaleCatalog, onLocaleCatalogArrival } from './locale-catalog-imports'
|
||||
|
||||
export type Translate = (key: string, fallback: string, options?: TOptions) => string
|
||||
|
||||
@@ -83,10 +83,12 @@ export function subscribeMobileUiLanguage(listener: () => void): () => void {
|
||||
}
|
||||
|
||||
let activationRequest = 0
|
||||
let requestedLocale: SupportedUiLocale = DEFAULT_UI_LOCALE
|
||||
|
||||
// Latest request wins: an older catalog import that settles later must not replace a newer choice.
|
||||
export async function activateMobileUiLocale(locale: SupportedUiLocale): Promise<void> {
|
||||
const request = ++activationRequest
|
||||
requestedLocale = locale
|
||||
try {
|
||||
if (locale !== 'en' && !mobileI18n.hasResourceBundle(locale, 'translation')) {
|
||||
const catalog = await importLocaleCatalog(locale)
|
||||
@@ -115,6 +117,16 @@ export async function activateMobileUiLocale(locale: SupportedUiLocale): Promise
|
||||
publish()
|
||||
}
|
||||
|
||||
// Switch in place, without a reload: a newer copy replaces the shown one, a first copy replaces the English fallback.
|
||||
// Install it even when another language is up now, so switching back shows the newer copy.
|
||||
onLocaleCatalogArrival((locale, catalog) => {
|
||||
mobileI18n.removeResourceBundle(locale, 'translation')
|
||||
mobileI18n.addResourceBundle(locale, 'translation', catalog, false, true, { skipCopy: true })
|
||||
if (locale === requestedLocale) {
|
||||
void activateMobileUiLocale(locale)
|
||||
}
|
||||
})
|
||||
|
||||
// Development-only layout check: accents and pads every string so clipping shows on device.
|
||||
export function setMobilePseudoLocalization(enabled: boolean): void {
|
||||
if (pseudoLocalization !== enabled) {
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import type { ConnectionState } from '../transport/connection/connection-state'
|
||||
import type { RpcResponse } from '../transport/rpc/rpc-wire-types'
|
||||
import {
|
||||
decodeDeviceStoreValue,
|
||||
encodeDeviceStoreValue
|
||||
} from '../device-store/device-store-value-codec'
|
||||
import type { PageDeviceStore } from '../mobile-web-shell/bridge/page-device-store'
|
||||
|
||||
// The page build resolves mobile-i18n's catalog import to the .web module; mirror that here.
|
||||
vi.mock('./locale-catalog-imports', () => import('./locale-catalog-imports.web'))
|
||||
// A shell that skipped the catalog chunks: only locales listed here are on disk.
|
||||
const chunksOnDisk = new Map<string, Record<string, unknown>>()
|
||||
vi.mock('./bundled-locale-catalogs', () => ({
|
||||
importBundledLocaleCatalog: async (locale: string) => {
|
||||
const catalog = chunksOnDisk.get(locale)
|
||||
if (!catalog) {
|
||||
throw new Error('not on disk')
|
||||
}
|
||||
return catalog
|
||||
}
|
||||
}))
|
||||
|
||||
const OLD_SHA = 'a'.repeat(64)
|
||||
const NEW_SHA = 'b'.repeat(64)
|
||||
|
||||
type SentRequest = {
|
||||
method: string
|
||||
params: unknown
|
||||
reply: (response: RpcResponse) => void
|
||||
fail: (error: Error) => void
|
||||
}
|
||||
|
||||
function fakeClient(initial: ConnectionState) {
|
||||
let state = initial
|
||||
let generation = 1
|
||||
const listeners = new Set<(next: ConnectionState) => void>()
|
||||
const sent: SentRequest[] = []
|
||||
return {
|
||||
sent,
|
||||
getState: () => state,
|
||||
getGeneration: () => generation,
|
||||
onStateChange: (listener: (next: ConnectionState) => void) => {
|
||||
listeners.add(listener)
|
||||
return () => {
|
||||
listeners.delete(listener)
|
||||
}
|
||||
},
|
||||
sendRequest: (method: string, params?: unknown) =>
|
||||
new Promise<RpcResponse>((reply, fail) => sent.push({ method, params, reply, fail })),
|
||||
moveTo(next: ConnectionState) {
|
||||
state = next
|
||||
for (const listener of listeners) {
|
||||
listener(next)
|
||||
}
|
||||
},
|
||||
// The shell swaps in an already-connected replacement, as on a relay-to-LAN move.
|
||||
cutover() {
|
||||
generation += 1
|
||||
for (const listener of listeners) {
|
||||
listener('connected')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fakeStore(rows: Record<string, string>): PageDeviceStore & { rows: Map<string, string> } {
|
||||
const stored = new Map(Object.entries(rows))
|
||||
return {
|
||||
rows: stored,
|
||||
available: () => true,
|
||||
read: async (_table, keys) => ({
|
||||
status: 'ok',
|
||||
values: keys.map((key) => stored.get(key) ?? null)
|
||||
}),
|
||||
write: async (_table, ops) => {
|
||||
for (const op of ops) {
|
||||
if (op.value !== null) {
|
||||
stored.set(op.key, op.value)
|
||||
}
|
||||
}
|
||||
return { written: true }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { startPageLocaleCatalogs } = await import('./page-locale-catalog-source')
|
||||
const i18n = await import('./mobile-i18n')
|
||||
|
||||
// Module state outlives a test, so each test uses its own locale and publishes its own source.
|
||||
function openPage(client: ReturnType<typeof fakeClient>, store: PageDeviceStore): void {
|
||||
startPageLocaleCatalogs({ client, store })
|
||||
}
|
||||
|
||||
// Microtasks, then one macrotask, which is when the store write runs.
|
||||
async function settle(): Promise<void> {
|
||||
for (let turn = 0; turn < 20; turn++) {
|
||||
await Promise.resolve()
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 0))
|
||||
}
|
||||
|
||||
describe('the page language catalog', () => {
|
||||
it('opens on the stored copy, then switches in place to the desktop newer one', async () => {
|
||||
const client = fakeClient('connected')
|
||||
const store = fakeStore({
|
||||
'i18n-catalog:de': encodeDeviceStoreValue({
|
||||
v: 1,
|
||||
sha256: OLD_SHA,
|
||||
catalog: { greeting: 'Hallo' }
|
||||
})
|
||||
})
|
||||
openPage(client, store)
|
||||
|
||||
await i18n.activateMobileUiLocale('de')
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('Hallo')
|
||||
expect(client.sent.map(({ method, params }) => ({ method, params }))).toEqual([
|
||||
{ method: 'mobileWeb.bundle.localeCatalog', params: { locale: 'de', knownSha256: OLD_SHA } }
|
||||
])
|
||||
|
||||
client.sent[0].reply({
|
||||
id: 'r1',
|
||||
ok: true,
|
||||
result: { locale: 'de', sha256: NEW_SHA, catalog: { greeting: 'Servus' } }
|
||||
})
|
||||
await settle()
|
||||
|
||||
expect(i18n.getMobileUiLocale()).toBe('de')
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('Servus')
|
||||
expect(decodeDeviceStoreValue(store.rows.get('i18n-catalog:de') ?? '')).toEqual({
|
||||
v: 1,
|
||||
sha256: NEW_SHA,
|
||||
catalog: { greeting: 'Servus' }
|
||||
})
|
||||
})
|
||||
|
||||
it('shows English offline with nothing stored, then the language once the desktop answers', async () => {
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const client = fakeClient('reconnecting')
|
||||
openPage(client, fakeStore({}))
|
||||
|
||||
await i18n.activateMobileUiLocale('fr')
|
||||
expect(i18n.getMobileUiLocale()).toBe('en')
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('Hello')
|
||||
expect(client.sent).toHaveLength(0)
|
||||
|
||||
client.moveTo('connected')
|
||||
await settle()
|
||||
expect(client.sent.map(({ params }) => params)).toEqual([{ locale: 'fr' }])
|
||||
client.sent[0].reply({
|
||||
id: 'r1',
|
||||
ok: true,
|
||||
result: { locale: 'fr', sha256: NEW_SHA, catalog: { greeting: 'Bonjour' } }
|
||||
})
|
||||
await settle()
|
||||
|
||||
expect(i18n.getMobileUiLocale()).toBe('fr')
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('Bonjour')
|
||||
})
|
||||
|
||||
it('opens in English when the first request fails on a live link, then switches on the next connection', async () => {
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const client = fakeClient('connected')
|
||||
openPage(client, fakeStore({}))
|
||||
|
||||
const activation = i18n.activateMobileUiLocale('ja')
|
||||
await settle()
|
||||
client.sent[0].fail(new Error('timed out'))
|
||||
await activation
|
||||
expect(i18n.getMobileUiLocale()).toBe('en')
|
||||
|
||||
client.moveTo('reconnecting')
|
||||
client.moveTo('connected')
|
||||
await settle()
|
||||
client.sent[1].reply({
|
||||
id: 'r2',
|
||||
ok: true,
|
||||
result: { locale: 'ja', sha256: NEW_SHA, catalog: { greeting: 'こんにちは' } }
|
||||
})
|
||||
await settle()
|
||||
|
||||
expect(i18n.getMobileUiLocale()).toBe('ja')
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('こんにちは')
|
||||
})
|
||||
|
||||
it('asks again on the connection a cutover swaps in, without waiting for another reconnect', async () => {
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
const client = fakeClient('reconnecting')
|
||||
openPage(client, fakeStore({}))
|
||||
|
||||
await i18n.activateMobileUiLocale('ko')
|
||||
client.moveTo('connected')
|
||||
await settle()
|
||||
client.cutover()
|
||||
client.sent[0].fail(new Error('client cut over'))
|
||||
await settle()
|
||||
client.sent[1].reply({
|
||||
id: 'r2',
|
||||
ok: true,
|
||||
result: { locale: 'ko', sha256: NEW_SHA, catalog: { greeting: '안녕하세요' } }
|
||||
})
|
||||
await settle()
|
||||
|
||||
expect(i18n.getMobileUiLocale()).toBe('ko')
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('안녕하세요')
|
||||
})
|
||||
|
||||
it('imports the chunk an older shell left on disk, with no wait and no request', async () => {
|
||||
chunksOnDisk.set('es', { greeting: 'Hola' })
|
||||
const client = fakeClient('reconnecting')
|
||||
openPage(client, fakeStore({}))
|
||||
|
||||
await i18n.activateMobileUiLocale('es')
|
||||
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('Hola')
|
||||
expect(client.sent).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,265 @@
|
||||
import * as z from 'zod'
|
||||
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
|
||||
import { SHA256_PATTERN } from '../../../src/shared/mobile-web-bundle/manifest-contract'
|
||||
import {
|
||||
MOBILE_WEB_BUNDLE_LOCALE_CATALOG_METHOD,
|
||||
MobileWebBundleLocaleCatalogResultSchema
|
||||
} from '../../../src/shared/mobile-web-bundle/locale-catalog-contract'
|
||||
import { withTimeoutResult } from '../../../src/shared/promise-timeout-fallback'
|
||||
import {
|
||||
decodeDeviceStoreValue,
|
||||
encodeDeviceStoreValue
|
||||
} from '../device-store/device-store-value-codec'
|
||||
import type { BridgeRpcClient } from '../mobile-web-shell/bridge/bridge-rpc-client'
|
||||
import type { PageDeviceStore } from '../mobile-web-shell/bridge/page-device-store'
|
||||
import { isMobileMethodUnavailableError } from '../transport/rpc/mobile-method-unavailable'
|
||||
import { captureRpcOperationSettlement, defineRpcOperation } from '../transport/rpc/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc/rpc-operation-result-reader'
|
||||
import { importBundledLocaleCatalog } from './bundled-locale-catalogs'
|
||||
import {
|
||||
announceLocaleCatalog as announce,
|
||||
publishPageLocaleCatalogLoader,
|
||||
type LocaleCatalog
|
||||
} from './locale-catalog-imports.web'
|
||||
|
||||
// The desktop serves the active catalog and the phone keeps a copy per host; only the page entry imports this.
|
||||
type CatalogLocale = Exclude<SupportedUiLocale, 'en'>
|
||||
type HeldCatalog = { readonly sha256: string; readonly catalog: LocaleCatalog }
|
||||
type CatalogClient = Pick<
|
||||
BridgeRpcClient,
|
||||
'getState' | 'getGeneration' | 'onStateChange' | 'sendRequest'
|
||||
>
|
||||
type CatalogSource = { readonly client: CatalogClient; readonly store: PageDeviceStore }
|
||||
|
||||
const storedCatalogSchema = z.object({
|
||||
v: z.literal(1),
|
||||
sha256: z.string().regex(SHA256_PATTERN),
|
||||
catalog: z.record(z.string(), z.unknown())
|
||||
})
|
||||
|
||||
const localeCatalogRead = defineRpcOperation({
|
||||
name: 'mobileWeb.bundle-locale-catalog',
|
||||
method: MOBILE_WEB_BUNDLE_LOCALE_CATALOG_METHOD,
|
||||
acceptance: 'require-result-or-throw',
|
||||
barrier: 'on-settle',
|
||||
// Loose like every phone reader, so a host may add fields.
|
||||
read: rpcResultVariant(
|
||||
'mobile-web-bundle-locale-catalog',
|
||||
MobileWebBundleLocaleCatalogResultSchema.loose()
|
||||
)
|
||||
})
|
||||
|
||||
const syncing = new Set<CatalogLocale>()
|
||||
// The stored read plus a relay round trip with the largest catalog fit well inside; past it the page opens in English.
|
||||
const FIRST_PAINT_CATALOG_WAIT_MS = 3_000
|
||||
|
||||
const storeKey = (locale: CatalogLocale): string => `i18n-catalog:${locale}`
|
||||
|
||||
async function readStoredCatalog(
|
||||
store: PageDeviceStore,
|
||||
locale: CatalogLocale
|
||||
): Promise<HeldCatalog | null> {
|
||||
if (!store.available()) {
|
||||
return null
|
||||
}
|
||||
const read = await store.read('cache', [storeKey(locale)]).catch(() => null)
|
||||
const raw = read?.status === 'ok' ? read.values[0] : null
|
||||
if (!raw) {
|
||||
return null
|
||||
}
|
||||
const parsed = storedCatalogSchema.safeParse(decodeDeviceStoreValue(raw))
|
||||
return parsed.success ? { sha256: parsed.data.sha256, catalog: parsed.data.catalog } : null
|
||||
}
|
||||
|
||||
function writeStoredCatalog(
|
||||
store: PageDeviceStore,
|
||||
locale: CatalogLocale,
|
||||
next: HeldCatalog
|
||||
): void {
|
||||
if (store.available()) {
|
||||
const value = encodeDeviceStoreValue({ v: 1, ...next })
|
||||
void store.write('cache', [{ key: storeKey(locale), value }]).catch(() => undefined)
|
||||
}
|
||||
}
|
||||
|
||||
// A send the host never answered, as opposed to a refusal or an unreadable reply.
|
||||
class CatalogSendFailed extends Error {
|
||||
constructor(
|
||||
message: string,
|
||||
readonly generation: number | null = null
|
||||
) {
|
||||
super(message)
|
||||
}
|
||||
}
|
||||
|
||||
const generationOf = (client: CatalogClient): number | null => client.getGeneration?.() ?? null
|
||||
|
||||
// After a failed send, wait for a reconnect or a cutover to another connection, which is often connected already.
|
||||
// False once pairing is revoked: that connection never comes back.
|
||||
function whenConnected(client: CatalogClient, failedGeneration: number | null): Promise<boolean> {
|
||||
let reconnected = failedGeneration === null || client.getState() !== 'connected'
|
||||
const ready = (): boolean =>
|
||||
client.getState() === 'connected' && (reconnected || generationOf(client) !== failedGeneration)
|
||||
if (ready() || client.getState() === 'auth-failed') {
|
||||
return Promise.resolve(ready())
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
const stop = client.onStateChange((state) => {
|
||||
reconnected ||= state !== 'connected'
|
||||
if (ready() || state === 'auth-failed') {
|
||||
stop()
|
||||
resolve(ready())
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Rejects when the connection drops first, so a first paint never waits on a reply that can't come.
|
||||
function beforeConnectionLoss<T>(client: CatalogClient, work: Promise<T>): Promise<T> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const stop = client.onStateChange((state) => {
|
||||
if (state !== 'connected') {
|
||||
stop()
|
||||
reject(new CatalogSendFailed('[i18n] connection lost before the catalog arrived'))
|
||||
}
|
||||
})
|
||||
work.then(
|
||||
(value) => {
|
||||
stop()
|
||||
resolve(value)
|
||||
},
|
||||
(error: unknown) => {
|
||||
stop()
|
||||
reject(error)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// One request. On an answer the copy becomes the page's and the store's.
|
||||
async function askHost(
|
||||
{ client, store }: CatalogSource,
|
||||
locale: CatalogLocale,
|
||||
known: HeldCatalog | undefined
|
||||
): Promise<HeldCatalog> {
|
||||
const generation = generationOf(client)
|
||||
const settled = await captureRpcOperationSettlement(client, localeCatalogRead, {
|
||||
locale,
|
||||
...(known ? { knownSha256: known.sha256 } : {})
|
||||
})
|
||||
if (settled.status === 'rejected') {
|
||||
throw new CatalogSendFailed(`[i18n] the ${locale} catalog request got no answer`, generation)
|
||||
}
|
||||
const { outcome } = settled
|
||||
if (outcome.kind === 'decoded') {
|
||||
const { sha256, catalog } = outcome.value
|
||||
// A null catalog only confirms the copy the phone named.
|
||||
const next = catalog !== null ? { sha256, catalog } : known?.sha256 === sha256 ? known : null
|
||||
if (next) {
|
||||
if (next !== known) {
|
||||
// After the first paint: encoding the copy is main-thread work nothing waits on.
|
||||
setTimeout(() => {
|
||||
writeStoredCatalog(store, locale, next)
|
||||
}, 0)
|
||||
}
|
||||
return next
|
||||
}
|
||||
}
|
||||
const refusal = outcome.kind === 'outer-refused' ? outcome.error : undefined
|
||||
throw new Error(
|
||||
isMobileMethodUnavailableError(refusal?.code, refusal?.message)
|
||||
? '[i18n] this desktop serves no language catalogs'
|
||||
: `[i18n] the desktop answered no ${locale} catalog`
|
||||
)
|
||||
}
|
||||
|
||||
// Asks until the host answers, resending once per new connection; a refusal ends it.
|
||||
async function syncFromHost(
|
||||
current: CatalogSource,
|
||||
locale: CatalogLocale,
|
||||
known: HeldCatalog | undefined,
|
||||
failedGeneration: number | null
|
||||
): Promise<HeldCatalog> {
|
||||
for (;;) {
|
||||
if (!(await whenConnected(current.client, failedGeneration))) {
|
||||
throw new Error('[i18n] this phone is no longer paired with the desktop')
|
||||
}
|
||||
try {
|
||||
return await askHost(current, locale, known)
|
||||
} catch (error) {
|
||||
if (!(error instanceof CatalogSendFailed)) {
|
||||
throw error
|
||||
}
|
||||
failedGeneration = error.generation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// One sync per locale, announcing a copy other than the one the page already shows.
|
||||
function syncOnce(
|
||||
current: CatalogSource,
|
||||
locale: CatalogLocale,
|
||||
known: HeldCatalog | undefined,
|
||||
failedGeneration: number | null = null
|
||||
): void {
|
||||
if (syncing.has(locale)) {
|
||||
return
|
||||
}
|
||||
syncing.add(locale)
|
||||
syncFromHost(current, locale, known, failedGeneration).then(
|
||||
(next) => {
|
||||
syncing.delete(locale)
|
||||
if (next !== known) {
|
||||
announce(locale, next.catalog)
|
||||
}
|
||||
},
|
||||
() => {
|
||||
syncing.delete(locale)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// What a first paint may wait for: the stored copy, else one request while connected.
|
||||
async function firstCatalog(current: CatalogSource, locale: CatalogLocale): Promise<HeldCatalog> {
|
||||
// Only a locale with no catalog installed is asked for, so nothing is held in memory here.
|
||||
const known = await readStoredCatalog(current.store, locale)
|
||||
if (known) {
|
||||
// Show the stored copy now; a newer one replaces it when the host answers.
|
||||
syncOnce(current, locale, known)
|
||||
return known
|
||||
}
|
||||
if (current.client.getState() !== 'connected') {
|
||||
throw new CatalogSendFailed('[i18n] no connection for the catalog yet')
|
||||
}
|
||||
return beforeConnectionLoss(current.client, askHost(current, locale, undefined))
|
||||
}
|
||||
|
||||
async function loadCatalog(current: CatalogSource, locale: CatalogLocale): Promise<LocaleCatalog> {
|
||||
// A generation an older shell downloaded still holds the chunk: no wait, and this page's own strings.
|
||||
const bundled = await importBundledLocaleCatalog(locale).catch(() => null)
|
||||
if (bundled !== null) {
|
||||
return bundled
|
||||
}
|
||||
const first = firstCatalog(current, locale)
|
||||
const settled = await withTimeoutResult(first, FIRST_PAINT_CATALOG_WAIT_MS)
|
||||
if (settled.ok) {
|
||||
return settled.value.catalog
|
||||
}
|
||||
// Activation shows English meanwhile; whatever comes later switches the page in place.
|
||||
first.then(
|
||||
(late) => {
|
||||
announce(locale, late.catalog)
|
||||
},
|
||||
(failure: unknown) => {
|
||||
if (failure instanceof CatalogSendFailed) {
|
||||
syncOnce(current, locale, undefined, failure.generation)
|
||||
}
|
||||
}
|
||||
)
|
||||
throw new Error(`[i18n] no ${locale} catalog for the first paint`)
|
||||
}
|
||||
|
||||
// Before the first activation, so its catalog comes from the desktop and the store.
|
||||
export function startPageLocaleCatalogs(current: CatalogSource): void {
|
||||
publishPageLocaleCatalogLoader((locale) => loadCatalog(current, locale))
|
||||
}
|
||||
@@ -48,6 +48,7 @@ describe('init and state', () => {
|
||||
expect(init.grants.native).toEqual([
|
||||
BRIDGE_FAULT_GRANT,
|
||||
BRIDGE_RPC_ENVELOPE_GRANT,
|
||||
'hostCatalogs',
|
||||
'navigate',
|
||||
'storage',
|
||||
'haptics',
|
||||
|
||||
@@ -205,7 +205,7 @@ describe('grants scoped to the route the page was opened for', () => {
|
||||
const bridge = harness({ routeGrants: navigationOnly, ready: true })
|
||||
expect(bridge.last()).toMatchObject({
|
||||
type: 'init',
|
||||
grants: { native: ['fault', 'rpcEnvelope', 'navigate', 'storage'] }
|
||||
grants: { native: ['fault', 'rpcEnvelope', 'hostCatalogs', 'navigate', 'storage'] }
|
||||
})
|
||||
for (const [method, params] of [
|
||||
['native.clipboard.read', { mime: 'text' }],
|
||||
|
||||
@@ -7,9 +7,8 @@ import { BridgeHostRequests } from './bridge-host-requests'
|
||||
import { BridgeHostSubscriptions } from './bridge-host-subscriptions'
|
||||
import { createBridgeHostStreamFrames } from './bridge-host-stream-frames'
|
||||
import {
|
||||
BRIDGE_FAULT_GRANT,
|
||||
BRIDGE_PROTOCOL_VERSION,
|
||||
BRIDGE_RPC_ENVELOPE_GRANT,
|
||||
BRIDGE_SHELL_GRANTS,
|
||||
readBridgeClientMessage,
|
||||
type BridgeClientMessage
|
||||
} from './bridge/bridge-envelope'
|
||||
@@ -30,11 +29,7 @@ export type { BridgeHost, BridgeHostDiagnostic, BridgeHostOptions } from './brid
|
||||
// Bind the host structurally to one RPC client; the protocol lets pages name no other host. Native origin checks reject expired sessions, and init caps are enforced here.
|
||||
export function createBridgeHost(options: BridgeHostOptions): BridgeHost {
|
||||
const { client, buildId, sessionId, pageRoutes, host } = options
|
||||
const granted: readonly string[] = [
|
||||
BRIDGE_FAULT_GRANT,
|
||||
BRIDGE_RPC_ENVELOPE_GRANT,
|
||||
...options.routeGrants
|
||||
]
|
||||
const granted: readonly string[] = [...BRIDGE_SHELL_GRANTS, ...options.routeGrants]
|
||||
// Validate manifest pairs like the route: a pair refused by the page would invalidate the entire init.
|
||||
const parsedRouteGrants =
|
||||
options.pageRouteGrants === undefined
|
||||
|
||||
@@ -32,10 +32,12 @@ export {
|
||||
BRIDGE_EXTERNAL_LINK_GRANT,
|
||||
BRIDGE_FAULT_GRANT,
|
||||
BRIDGE_FOREGROUND_NUDGE_REASONS,
|
||||
BRIDGE_HOST_CATALOGS_GRANT,
|
||||
BRIDGE_ID_PATTERN,
|
||||
BRIDGE_NAVIGATE_BACK_NOTIFY,
|
||||
BRIDGE_PROTOCOL_VERSION,
|
||||
BRIDGE_RPC_ENVELOPE_GRANT
|
||||
BRIDGE_RPC_ENVELOPE_GRANT,
|
||||
BRIDGE_SHELL_GRANTS
|
||||
} from './bridge-frame-fields'
|
||||
import {
|
||||
isPageStorageKey,
|
||||
|
||||
@@ -25,3 +25,13 @@ export const BRIDGE_EXTERNAL_LINK_GRANT = 'externalLink'
|
||||
|
||||
// Negotiate rpcEnvelope before relying on extra wire fields; older shells drop unknown fields and could execute without caller-required metadata.
|
||||
export const BRIDGE_RPC_ENVELOPE_GRANT = 'rpcEnvelope'
|
||||
|
||||
// The shell skipped the build's language-catalog chunks, so the page reads its catalog from the desktop.
|
||||
export const BRIDGE_HOST_CATALOGS_GRANT = 'hostCatalogs'
|
||||
|
||||
// Granted to every page this shell opens, whatever its route declares.
|
||||
export const BRIDGE_SHELL_GRANTS: readonly string[] = [
|
||||
BRIDGE_FAULT_GRANT,
|
||||
BRIDGE_RPC_ENVELOPE_GRANT,
|
||||
BRIDGE_HOST_CATALOGS_GRANT
|
||||
]
|
||||
|
||||
@@ -6,9 +6,8 @@ import {
|
||||
import { BRIDGE_MAX_PENDING_REQUESTS, BRIDGE_MAX_SUBSCRIPTIONS } from './bridge-caps'
|
||||
import { MOBILE_WEB_SHELL_GRANTS } from '../page-route-policy'
|
||||
import {
|
||||
BRIDGE_FAULT_GRANT,
|
||||
BRIDGE_PROTOCOL_VERSION,
|
||||
BRIDGE_RPC_ENVELOPE_GRANT,
|
||||
BRIDGE_SHELL_GRANTS,
|
||||
type BridgeColorScheme,
|
||||
type BridgeConnectionSnapshot,
|
||||
type BridgeHostMessage,
|
||||
@@ -27,8 +26,7 @@ import type { HostStatusReply } from '../../transport/hosts/host-status-reply-sc
|
||||
|
||||
// Grant the intersection of implemented capabilities and route declarations, plus protocol fault. Use the same resolved list for init and enforcement; new names need no version bump.
|
||||
export const BRIDGE_NATIVE_GRANTS: readonly string[] = [
|
||||
BRIDGE_FAULT_GRANT,
|
||||
BRIDGE_RPC_ENVELOPE_GRANT,
|
||||
...BRIDGE_SHELL_GRANTS,
|
||||
...MOBILE_WEB_SHELL_GRANTS
|
||||
]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
MobileWebBundleManifestReadSchema,
|
||||
shellDownloadedAssets,
|
||||
type MobileWebBundleManifestRead
|
||||
} from '../transport/web-bundle/mobile-web-bundle-reply-schemas'
|
||||
import { MANIFEST_FILE_NAME } from './generation-asset-path'
|
||||
@@ -33,12 +34,13 @@ export async function readWaitingStage(
|
||||
}
|
||||
// Deletes are not atomic, so a kill mid-delete can leave the manifest without its assets; only every byte counts as whole.
|
||||
const sizes = new Map<string, number>()
|
||||
for (const folder of new Set(manifest.assets.map((asset) => parentOf(asset.path)))) {
|
||||
const assets = shellDownloadedAssets(manifest)
|
||||
for (const folder of new Set(assets.map((asset) => parentOf(asset.path)))) {
|
||||
for (const file of await fs.listFiles(folder === '' ? directory : joinUri(directory, folder))) {
|
||||
sizes.set(folder === '' ? file.name : `${folder}/${file.name}`, file.size)
|
||||
}
|
||||
}
|
||||
const whole = manifest.assets.every((asset) => sizes.get(asset.path) === asset.byteLength)
|
||||
const whole = assets.every((asset) => sizes.get(asset.path) === asset.byteLength)
|
||||
return whole ? { hostKey, buildId, directory, manifest } : null
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import type { MobileWebBundleFetchResult } from '../transport/web-bundle/mobile-web-bundle-fetch'
|
||||
import { shellDownloadedAssets } from '../transport/web-bundle/mobile-web-bundle-reply-schemas'
|
||||
import { requireStorablePath } from './generation-asset-path'
|
||||
import { joinUri } from './generation-cache-uri'
|
||||
|
||||
export function stagingAssetsOf(directory: string, result: MobileWebBundleFetchResult) {
|
||||
const reused = new Set(result.reused)
|
||||
return result.manifest.assets.map((asset) => ({
|
||||
return shellDownloadedAssets(result.manifest).map((asset) => ({
|
||||
asset,
|
||||
uri: joinUri(directory, requireStorablePath(asset.path)),
|
||||
bytes: reused.has(asset.path) ? null : requireExactBytes(result.assets.get(asset.path), asset)
|
||||
|
||||
@@ -13,7 +13,7 @@ const HOST = deriveHostCacheKey('host-a')
|
||||
|
||||
function buildResult(options: {
|
||||
buildId?: string
|
||||
assets?: readonly { path: string; byteLength: number }[]
|
||||
assets?: readonly { path: string; byteLength: number; kind?: string }[]
|
||||
bytes?: ReadonlyMap<string, Uint8Array>
|
||||
}): MobileWebBundleFetchResult {
|
||||
const listed = options.assets ?? [
|
||||
@@ -24,7 +24,8 @@ function buildResult(options: {
|
||||
path: asset.path,
|
||||
sha256: String(index).repeat(64).slice(0, 64),
|
||||
byteLength: asset.byteLength,
|
||||
contentType: 'text/html; charset=utf-8'
|
||||
contentType: 'text/html; charset=utf-8',
|
||||
...(asset.kind === undefined ? {} : { kind: asset.kind })
|
||||
}))
|
||||
const totalBytes = assets.reduce((sum, asset) => sum + asset.byteLength, 0)
|
||||
return {
|
||||
@@ -75,4 +76,25 @@ describe('an update staged behind a live page', () => {
|
||||
expect((await store.readActiveGeneration(HOST))?.buildId).toBe(SECOND_BUILD)
|
||||
expect(await fs.fileExists(`${ROOT}/${HOST}/generations/${BUILD}/index.html`)).toBe(false)
|
||||
})
|
||||
|
||||
it('stages a build without its language-catalog chunks and still commits it at the next launch', async () => {
|
||||
const fs = createFakeFileSystem()
|
||||
const first = createGenerationStore({ fileSystem: fs })
|
||||
await activate(first, HOST)
|
||||
first.holdGeneration(HOST)
|
||||
const withCatalog = buildResult({
|
||||
assets: [
|
||||
{ path: 'index.html', byteLength: 8 },
|
||||
{ path: 'assets/de.js', byteLength: 3, kind: 'catalog' }
|
||||
],
|
||||
bytes: new Map([['index.html', new Uint8Array(8)]])
|
||||
})
|
||||
first.deferCommit(await first.stageGeneration(HOST, withCatalog))
|
||||
|
||||
const relaunched = createGenerationStore({ fileSystem: fs })
|
||||
|
||||
const build = withCatalog.manifest.buildId
|
||||
expect((await relaunched.readActiveGeneration(HOST))?.buildId).toBe(build)
|
||||
expect(await fs.fileExists(`${ROOT}/${HOST}/generations/${build}/assets/de.js`)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { fetchMobileWebBundle } from '../transport/web-bundle/mobile-web-bundle-fetch'
|
||||
import { mobileWebBundleStreamBytes } from '../transport/web-bundle/mobile-web-bundle-window-reader'
|
||||
import { mobileWebBundleManifestRead } from '../transport/web-bundle/mobile-web-bundle-operations'
|
||||
import type {
|
||||
MobileWebBundleManifestRead,
|
||||
MobileWebBundleManifestReply
|
||||
import {
|
||||
shellDownloadedAssets,
|
||||
type MobileWebBundleManifestRead,
|
||||
type MobileWebBundleManifestReply
|
||||
} from '../transport/web-bundle/mobile-web-bundle-reply-schemas'
|
||||
import type { MobileWebBundleCompatManifest } from '../transport/web-bundle/mobile-web-bundle-compat'
|
||||
import { runRpcOperation } from '../transport/rpc/rpc-operation'
|
||||
@@ -88,8 +89,9 @@ export async function readManifest(
|
||||
manifest: {
|
||||
...compatOf(manifest),
|
||||
buildId: manifest.buildId,
|
||||
// What this shell downloads: wire bytes, without the catalog chunks it skips.
|
||||
totalBytes: mobileWebBundleStreamBytes(opened),
|
||||
totalAssets: manifest.assets.length,
|
||||
totalAssets: shellDownloadedAssets(manifest).length,
|
||||
routes: manifest.routes
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useLayoutEffect, useRef } from 'react'
|
||||
import { AppState } from 'react-native'
|
||||
import { AppState, Platform } from 'react-native'
|
||||
|
||||
/**
|
||||
* Calls `onLeave` once each time the app leaves the foreground, before the system can kill it from the app
|
||||
@@ -29,13 +29,17 @@ export function useAppLeavesForeground(onLeave: () => void): void {
|
||||
const change = AppState.addEventListener('change', (next) =>
|
||||
next === 'active' ? back() : leave()
|
||||
)
|
||||
// Window focus events come from Android only.
|
||||
const blur = AppState.addEventListener('blur', leave)
|
||||
const focus = AppState.addEventListener('focus', back)
|
||||
// Window focus events come from Android only; iOS's RCTAppState rejects the subscription outright
|
||||
// (a red screen in development), so it is never made there.
|
||||
const windowFocus =
|
||||
Platform.OS === 'android'
|
||||
? [AppState.addEventListener('blur', leave), AppState.addEventListener('focus', back)]
|
||||
: []
|
||||
return () => {
|
||||
change.remove()
|
||||
blur.remove()
|
||||
focus.remove()
|
||||
for (const subscription of windowFocus) {
|
||||
subscription.remove()
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { z } from 'zod'
|
||||
import {
|
||||
missedNotificationsSchema,
|
||||
notificationUnreadReplySchema,
|
||||
PUSH_REGISTER_REFUSAL_REASONS,
|
||||
PUSH_TEST_REFUSAL_REASONS,
|
||||
pushDeliveryTestResultSchema,
|
||||
pushRouteRegistrationSchema
|
||||
} from './notification-reply-schema'
|
||||
|
||||
function reads<T>(schema: z.ZodType<T, unknown>, value: unknown): T {
|
||||
const parsed = schema.safeParse(value)
|
||||
if (!parsed.success) {
|
||||
throw new Error(`expected a readable reply: ${parsed.error.message}`)
|
||||
}
|
||||
return parsed.data
|
||||
}
|
||||
|
||||
function refuses(schema: z.ZodType<unknown, unknown>, value: unknown): boolean {
|
||||
return !schema.safeParse(value).success
|
||||
}
|
||||
|
||||
describe('notification replies tolerate the shapes their call sites guard', () => {
|
||||
it('reads a test-push reply the screen reaches through optional chaining', () => {
|
||||
expect(reads(pushDeliveryTestResultSchema, { accepted: true })?.accepted).toBe(true)
|
||||
expect(reads(pushDeliveryTestResultSchema, null)).toBe(null)
|
||||
expect(reads(pushDeliveryTestResultSchema, undefined)).toBe(undefined)
|
||||
expect(reads(pushDeliveryTestResultSchema, { error: 'refused' })?.accepted).toBe(undefined)
|
||||
})
|
||||
|
||||
// Schema refusal would replace the screen’s generic send-failure copy with a parser error.
|
||||
it('reads a non-object test-push result as absent, which takes the generic copy', () => {
|
||||
for (const value of ['garbage', 7, true, []]) {
|
||||
expect(refuses(pushDeliveryTestResultSchema, value)).toBe(false)
|
||||
const result = reads(pushDeliveryTestResultSchema, value)
|
||||
expect(result?.accepted).toBe(undefined)
|
||||
expect(result?.reason).toBe(undefined)
|
||||
}
|
||||
})
|
||||
|
||||
it('reads a registration reply the reconciler reaches through optional chaining', () => {
|
||||
expect(reads(pushRouteRegistrationSchema, { registered: true })?.registered).toBe(true)
|
||||
expect(reads(pushRouteRegistrationSchema, null)).toBe(null)
|
||||
expect(reads(pushRouteRegistrationSchema, { registered: 'yes' })?.registered).toBe(undefined)
|
||||
})
|
||||
|
||||
it('takes every reply at the two sites whose body nothing reads', () => {
|
||||
expect(refuses(notificationUnreadReplySchema, undefined)).toBe(false)
|
||||
expect(refuses(notificationUnreadReplySchema, null)).toBe(false)
|
||||
expect(refuses(notificationUnreadReplySchema, 'anything')).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('closed enums degrade to the copy main showed', () => {
|
||||
it('keeps a reason the screen branches on and drops one it does not know', () => {
|
||||
expect(
|
||||
reads(pushDeliveryTestResultSchema, { accepted: false, reason: 'rate_limited' })?.reason
|
||||
).toBe('rate_limited')
|
||||
expect(
|
||||
reads(pushDeliveryTestResultSchema, { accepted: false, reason: 'not_registered' })?.reason
|
||||
).toBe('not_registered')
|
||||
expect(reads(pushDeliveryTestResultSchema, { accepted: false, reason: 'quota' })?.reason).toBe(
|
||||
undefined
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps a registration reason and drops an unknown one', () => {
|
||||
const reply = { registered: false, reason: 'throttled' }
|
||||
expect(reads(pushRouteRegistrationSchema, reply)?.reason).toBe('throttled')
|
||||
expect(
|
||||
reads(pushRouteRegistrationSchema, { registered: false, reason: 'moon-phase' })?.reason
|
||||
).toBe(undefined)
|
||||
})
|
||||
|
||||
// Host-pinned unions cover every arm; these loops prove each survives parsing.
|
||||
it('keeps every refusal reason the host declares for either route', () => {
|
||||
for (const reason of PUSH_TEST_REFUSAL_REASONS) {
|
||||
expect(reads(pushDeliveryTestResultSchema, { accepted: false, reason })?.reason).toBe(reason)
|
||||
}
|
||||
for (const reason of PUSH_REGISTER_REFUSAL_REASONS) {
|
||||
expect(reads(pushRouteRegistrationSchema, { registered: false, reason })?.reason).toBe(reason)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('dismissal rows stay opaque', () => {
|
||||
it('keeps every row for readPushNotificationIdentity to judge', () => {
|
||||
const rows = [{ notificationId: 'n-1' }, 'not-a-row', 7]
|
||||
expect(reads(missedNotificationsSchema, { dismissedPushes: rows })?.dismissedPushes).toEqual(
|
||||
rows
|
||||
)
|
||||
})
|
||||
|
||||
it('drops a dismissedPushes that is not an array, as Array.isArray did', () => {
|
||||
expect(reads(missedNotificationsSchema, { dismissedPushes: 'all' })?.dismissedPushes).toBe(
|
||||
undefined
|
||||
)
|
||||
expect(reads(missedNotificationsSchema, null)).toBe(null)
|
||||
})
|
||||
})
|
||||
@@ -16,7 +16,7 @@ import { hostProjectSectionsQuery } from '../host-screen/use-host-project-sectio
|
||||
import { sessionTabsFamily, sessionTabsKey } from '../session/tabs/mobile-session-last-tabs'
|
||||
import type { MobileSessionTab } from '../session/tabs/mobile-session-tabs'
|
||||
import { activeSessionTabOf } from '../session/tabs/active-session-tab'
|
||||
import { storedTabChatTranscriptIdentity } from '../session/native-chat/mobile-native-chat-transcript-store'
|
||||
import { storedTabChatTranscriptIdentity } from '../session/native-chat/transcript/mobile-native-chat-transcript-store'
|
||||
import { gitStatusQuery } from '../source-control/mobile-git-status-query'
|
||||
import { firstPaintTaskKeys } from '../tasks/task-query-storage'
|
||||
import { hostQueryKey } from './host-query-key'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { QueryClient } from '@tanstack/react-query'
|
||||
import type { PageDeviceStore } from '../mobile-web-shell/bridge/page-device-store'
|
||||
import { primeStoredChatTranscripts } from '../session/native-chat/mobile-native-chat-transcript-store'
|
||||
import { primeStoredChatTranscripts } from '../session/native-chat/transcript/mobile-native-chat-transcript-store'
|
||||
import { firstPaintChatTranscriptIdentity, firstPaintQueryKeys } from './first-paint-query-keys'
|
||||
import { createHostQueryPersistence } from './host-query-persistence'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useCallback, useLayoutEffect, useMemo, useRef } from 'react'
|
||||
import { useHostProtocolGates } from '../components/host-protocol-gates-context'
|
||||
import type { TuiAgent } from '../../../src/shared/agent-launch/catalog/tui-agent'
|
||||
import type { StructuredAgentSessionForkSource } from '../../../src/shared/agent-session/structured-agent-session-create'
|
||||
import { MobileNativeChatForkedFromContext } from './mobile-native-chat-notice-context'
|
||||
import { MobileNativeChatForkedFromContext } from './native-chat/transcript/mobile-native-chat-notice-context'
|
||||
import { forkMobileStructuredChat } from './mobile-structured-chat-fork'
|
||||
import {
|
||||
MobileNativeChatForkContext,
|
||||
|
||||
@@ -2,7 +2,7 @@ import './mobile-prompt-render-mocks'
|
||||
import { createElement } from 'react'
|
||||
import { Pressable } from 'react-native'
|
||||
import type { NativeChatMessage } from '../../../../src/shared/native-chat/native-chat-types'
|
||||
import type { MobileNativeChatSendOutcome } from '../native-chat/mobile-native-chat-send'
|
||||
import type { MobileNativeChatSendOutcome } from '../native-chat/composer/mobile-native-chat-send'
|
||||
import type { RpcClient } from '../../transport/rpc/rpc-client-contract'
|
||||
import type { RpcResponse } from '../../transport/rpc/rpc-wire-types'
|
||||
import type { ConnectionState } from '../../transport/connection/connection-state'
|
||||
@@ -55,7 +55,7 @@ vi.mock('../use-mobile-session-view-mode', () => ({
|
||||
})
|
||||
}))
|
||||
// The chat's per-connection CI setting read isn't a prompt write; these tests count only those.
|
||||
vi.mock('../use-mobile-native-chat-ci-result-lines', () => ({
|
||||
vi.mock('../native-chat/preferences/use-mobile-native-chat-ci-result-lines', () => ({
|
||||
useMobileNativeChatCiResultLines: () => false
|
||||
}))
|
||||
vi.mock('../native-chat/use-mobile-native-chat-session-lane', () => ({
|
||||
|
||||
@@ -22,9 +22,9 @@ import {
|
||||
isAgentLaunchReservationTakenRefusal
|
||||
} from '../../../../src/shared/agent-launch/contracts/agent-launch-replay-refusal'
|
||||
import { sendReplayingAmbiguousDelivery } from '../../tasks/replay-on-ambiguous-delivery'
|
||||
import { structuredSessionOperationId } from '../structured-session-operation-id'
|
||||
import { structuredSessionOperationId } from '../native-chat/agent-session/structured-session-operation-id'
|
||||
import { randomV4Uuid } from '../../platform/random-v4-uuid'
|
||||
import { rememberMobileCreatedStructuredSession } from '../mobile-created-structured-sessions'
|
||||
import { rememberMobileCreatedStructuredSession } from '../native-chat/agent-session/mobile-created-structured-sessions'
|
||||
|
||||
// Why: the host waits up to 60s for a terminal agent to become ready before pasting the prompt,
|
||||
// so a prompted launch must outlive that wait or the phone reports a launch that is still running.
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { agentSessionWriteNoticeParts } from '../../../src/shared/agent-session/failures/agent-session-refusal-notice'
|
||||
import { agentSessionRefusalFailure } from '../../../src/shared/agent-session/failures/agent-session-write-failure'
|
||||
import { mobileAgentSessionWriteNoticeText } from './agent-session-write-notice-copy'
|
||||
|
||||
describe('mobileAgentSessionWriteNoticeText', () => {
|
||||
it('names the attachment an expired refusal lists, as its card labels it', () => {
|
||||
const failure = agentSessionRefusalFailure({
|
||||
code: 'agent_session_operation_invalid',
|
||||
details: {
|
||||
reason: 'attachmentExpired',
|
||||
expiredAttachments: [{ uploadId: 'upload-1', name: 'notes.pdf' }]
|
||||
}
|
||||
})
|
||||
expect(
|
||||
mobileAgentSessionWriteNoticeText(agentSessionWriteNoticeParts(failure, 'composer-send'))
|
||||
).toBe('notes.pdf expired. Your message was not sent. Remove it and attach it again.')
|
||||
})
|
||||
})
|
||||
@@ -1,109 +0,0 @@
|
||||
import { createElement, type ReactNode } from 'react'
|
||||
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
|
||||
import { afterEach, expect, it, vi } from 'vitest'
|
||||
import { MobileNativeChatComposer } from './native-chat/composer/MobileNativeChatComposer'
|
||||
import { captureMobileNativeChatTextDestination } from './native-chat/composer/mobile-native-chat-draft-inputs'
|
||||
import {
|
||||
closeMobileNativeChatTabDraft,
|
||||
readMobileNativeChatDraftEditGeneration,
|
||||
resetMobileNativeChatDraftStoreForTests,
|
||||
setMobileNativeChatDraftText
|
||||
} from './native-chat/composer/mobile-native-chat-draft-store'
|
||||
import { findByHostType } from '../test-support/react-test-renderer-host-nodes'
|
||||
|
||||
vi.mock('../components/MobileSwitch', () => ({ MobileSwitch: 'Switch' }))
|
||||
vi.mock('./native-chat/composer/MobileNativeChatContextUsageRing', () => ({
|
||||
useMobileNativeChatContextRing: () => ({ barProps: {}, ring: null })
|
||||
}))
|
||||
// BottomDrawer also carries the option pager, which loads Reanimated at import.
|
||||
vi.mock('react-native-reanimated', async () =>
|
||||
(await import('../test-support/reanimated-pager-stub')).reanimatedPagerStub()
|
||||
)
|
||||
vi.mock('react-native', async () => {
|
||||
const React = await import('react')
|
||||
return {
|
||||
...(await import('../test-support/react-native-motion-stub')).reactNativeMotionStub(),
|
||||
ActivityIndicator: 'ActivityIndicator',
|
||||
Image: 'Image',
|
||||
Keyboard: { dismiss: vi.fn() },
|
||||
Platform: { OS: 'ios' },
|
||||
Pressable: 'Pressable',
|
||||
ScrollView: ({ children, ...props }: { children?: ReactNode }) =>
|
||||
React.createElement('ScrollView', props, children),
|
||||
StyleSheet: { create: (styles: unknown) => styles, hairlineWidth: 1 },
|
||||
Text: 'Text',
|
||||
TextInput: 'TextInput',
|
||||
View: 'View'
|
||||
}
|
||||
})
|
||||
vi.mock('lucide-react-native', () => ({
|
||||
ArrowUp: 'ArrowUp',
|
||||
ListEnd: 'ListEnd',
|
||||
CornerDownRight: 'CornerDownRight',
|
||||
Check: 'Check',
|
||||
ChevronDown: 'ChevronDown',
|
||||
ChevronLeft: 'ChevronLeft',
|
||||
ChevronRight: 'ChevronRight',
|
||||
FileText: 'FileText',
|
||||
Mic: 'Mic',
|
||||
Package: 'Package',
|
||||
Plus: 'Plus',
|
||||
ShieldAlert: 'ShieldAlert',
|
||||
Square: 'Square',
|
||||
Terminal: 'Terminal',
|
||||
X: 'X'
|
||||
}))
|
||||
vi.mock('../components/bottom-drawer/mounted-bottom-drawer', () => ({
|
||||
MountedBottomDrawer: 'BottomDrawer'
|
||||
}))
|
||||
vi.mock('../components/bottom-drawer/bottom-drawer-modal-host-scope', () => ({
|
||||
useBottomDrawerModalHost: () => null
|
||||
}))
|
||||
|
||||
let renderer: ReactTestRenderer | undefined
|
||||
afterEach(async () => {
|
||||
await act(async () => renderer?.unmount())
|
||||
renderer = undefined
|
||||
resetMobileNativeChatDraftStoreForTests()
|
||||
})
|
||||
|
||||
it.each([false, true])(
|
||||
'rejects captured dictation after tab retirement with custom insert=%s',
|
||||
async (customInsert) => {
|
||||
const scope = `retired-dictation-${customInsert}`
|
||||
const insertDictation = vi.fn(() => true)
|
||||
setMobileNativeChatDraftText(scope, 'old text')
|
||||
await act(async () => {
|
||||
renderer = create(
|
||||
createElement(MobileNativeChatComposer, {
|
||||
value: 'old text',
|
||||
draftScopeKey: scope,
|
||||
insertDictation: customInsert ? insertDictation : undefined,
|
||||
onChangeText: vi.fn(),
|
||||
onSend: async () => true,
|
||||
sendSurfaceId: scope,
|
||||
getSendCompletionGeneration: () => 0,
|
||||
getComposerEditGeneration: () => 0
|
||||
})
|
||||
)
|
||||
})
|
||||
act(() => findByHostType(renderer!.root, 'TextInput').props.onFocus())
|
||||
const insert = captureMobileNativeChatTextDestination()?.insert
|
||||
if (!insert) {
|
||||
throw new Error('composer did not register dictation')
|
||||
}
|
||||
act(() => {
|
||||
insert('live dictation')
|
||||
})
|
||||
if (customInsert) {
|
||||
expect(insertDictation).toHaveBeenCalledOnce()
|
||||
} else {
|
||||
expect(readMobileNativeChatDraftEditGeneration(scope)).toBe(2)
|
||||
}
|
||||
insertDictation.mockClear()
|
||||
await act(async () => closeMobileNativeChatTabDraft(scope))
|
||||
expect(insert('late dictation')).toBe(false)
|
||||
expect(insertDictation).not.toHaveBeenCalled()
|
||||
expect(readMobileNativeChatDraftEditGeneration(scope)).toBe(0)
|
||||
}
|
||||
)
|
||||
@@ -4,7 +4,7 @@ import { act } from 'react-test-renderer'
|
||||
import { createWithQueryClient } from '../test-support/query-client-test-renderer'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { createFakeRpcClient, type FakeRpcClient } from '../mobile-web-shell/bridge-host-test-fakes'
|
||||
import type * as NativeChatSendError from './native-chat/use-mobile-native-chat-send-error'
|
||||
import type * as NativeChatSendError from './native-chat/composer/use-mobile-native-chat-send-error'
|
||||
import type * as NativeChatDraftStore from './native-chat/composer/mobile-native-chat-draft-store'
|
||||
|
||||
type ChatView = { shown: boolean; scope: string | null }
|
||||
@@ -69,7 +69,7 @@ vi.mock('../platform/clipboard', () => {
|
||||
})
|
||||
|
||||
// Stub off-path native chat dependencies to keep Expo out of this mic test.
|
||||
vi.mock('./native-chat/use-mobile-native-chat-send-error', async (importOriginal) => ({
|
||||
vi.mock('./native-chat/composer/use-mobile-native-chat-send-error', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof NativeChatSendError>()),
|
||||
useMobileNativeChatSendError: () => ({
|
||||
message: null,
|
||||
@@ -82,7 +82,7 @@ vi.mock('./native-chat/use-mobile-native-chat-send-error', async (importOriginal
|
||||
vi.mock('./native-chat/transcript/use-mobile-native-chat-readability', () => ({
|
||||
useMobileNativeChatReadability: () => false
|
||||
}))
|
||||
vi.mock('./native-chat/use-mobile-native-chat-input-lease', () => ({
|
||||
vi.mock('./native-chat/composer/use-mobile-native-chat-input-lease', () => ({
|
||||
useMobileNativeChatInputLease: () => ({
|
||||
ready: true,
|
||||
readyRef: { current: true },
|
||||
@@ -297,41 +297,6 @@ describe('a mic tap after the host reported dictation is not set up', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('an audio interruption while recording', () => {
|
||||
it('finishes the dictation and keeps what was said', async () => {
|
||||
const rpc = createFakeRpcClient()
|
||||
await startRecording(rpc)
|
||||
act(() => seen.audioListeners.get('onAudioInterruption')?.({ data: 'began' }))
|
||||
const methods = await settle(rpc, 'call me back')
|
||||
expect(methods).toContain('speech.dictation.finish')
|
||||
expect(methods).not.toContain('speech.dictation.cancel')
|
||||
expect(seen.inputs).toEqual(['call me back'])
|
||||
expect(seen.toasts).toEqual(['Dictation inserted'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('leaving the session while recording', () => {
|
||||
it('stops and inserts what was said instead of leaving, and lets the next leave go', async () => {
|
||||
const rpc = createFakeRpcClient()
|
||||
const mounted = await startRecording(rpc)
|
||||
const held: boolean[] = []
|
||||
act(() => {
|
||||
held.push(mounted.current().dictationLeaveHold.hold())
|
||||
})
|
||||
// Back is released while transcribing, so a swipe can leave too.
|
||||
expect(mounted.current().dictationLeaveHold.holdsLeave).toBe(false)
|
||||
act(() => {
|
||||
held.push(mounted.current().dictationLeaveHold.hold())
|
||||
})
|
||||
expect(held).toEqual([true, false])
|
||||
const methods = await settle(rpc, 'one more thing')
|
||||
expect(methods.filter((method) => method === 'speech.dictation.finish')).toHaveLength(1)
|
||||
expect(methods).not.toContain('speech.dictation.cancel')
|
||||
expect(seen.inputs).toEqual(['one more thing'])
|
||||
expect(seen.toasts).toEqual(['Dictation inserted'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('a mic tap while the transcript is processing', () => {
|
||||
it('keeps the transcript that comes back', async () => {
|
||||
const rpc = createFakeRpcClient()
|
||||
@@ -367,19 +332,3 @@ describe('a dictation that ends after switching between chat and terminal', () =
|
||||
expect(seen.inputs).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('a dictation whose session screen was left', () => {
|
||||
it('keeps recording, then puts its words in the chat it started in with a toast that opens it', async () => {
|
||||
seen.chat = { shown: true, scope: 'chat-a' }
|
||||
const rpc = createFakeRpcClient()
|
||||
const mounted = await startRecording(rpc)
|
||||
mounted.leave()
|
||||
expect(mounted.host().getDictation().isRecording).toBe(true)
|
||||
expect(mounted.host().pill?.away).toBe(true)
|
||||
act(() => mounted.host().stop())
|
||||
await settle(rpc, 'ship it')
|
||||
expect(seen.chatWrites).toEqual([['chat-a', 'ship it']])
|
||||
expect(mounted.host().pill?.toast?.message).toBe('Inserted in Claude Code')
|
||||
expect(mounted.host().pill?.toast?.open).toBeTypeOf('function')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
import { afterEach, expect, it, vi } from 'vitest'
|
||||
import capture from '../../../src/shared/__fixtures__/omp-native-commands.json'
|
||||
import * as catalog from '../../../src/shared/native-chat/input/native-chat-slash-commands'
|
||||
import type { NativeChatPickerItem } from '../../../src/shared/native-chat/input/native-chat-picker-items'
|
||||
import { deriveComposerAutocomplete } from '../../../src/shared/native-chat/input/native-chat-composer-autocomplete'
|
||||
import {
|
||||
mobileComposerCatalog,
|
||||
boundedMenuItems
|
||||
} from './native-chat/composer/mobile-native-chat-composer-menu'
|
||||
|
||||
afterEach(() => vi.restoreAllMocks())
|
||||
|
||||
it('bounds native OMP picker name reads at N/10N while preserving first duplicate descriptions', () => {
|
||||
const reportedSkills = catalog.sessionReportedSkills
|
||||
let visits = 0
|
||||
vi.spyOn(catalog, 'sessionReportedSkills').mockImplementation((...args) =>
|
||||
reportedSkills(...args).map((skill) => ({
|
||||
...skill,
|
||||
get name() {
|
||||
visits += 1
|
||||
return skill.name
|
||||
}
|
||||
}))
|
||||
)
|
||||
const native = capture.enabled.availableCommands.find((row) => row.name === 'skill:plan')!
|
||||
for (const surface of ['desktop', 'mobile'] as const) {
|
||||
const counts = [10, 100].map((size) => {
|
||||
const reported = [
|
||||
...Array.from({ length: size }, (_, i) => ({
|
||||
name: `${native.name}-${i}`,
|
||||
kind: 'command' as const,
|
||||
description: i === 0 ? undefined : native.description
|
||||
})),
|
||||
{ name: `${native.name}-0`, kind: 'command' as const, description: 'Later duplicate' },
|
||||
{ name: `${native.name}-1`, kind: 'command' as const, description: 'Later duplicate' }
|
||||
]
|
||||
visits = 0
|
||||
let rows: NativeChatPickerItem[]
|
||||
if (surface === 'desktop') {
|
||||
const picker = deriveComposerAutocomplete(
|
||||
'/plan',
|
||||
5,
|
||||
catalog.sessionSlashCommandSuggestions('omp', reported),
|
||||
[],
|
||||
null,
|
||||
{ status: 'ready', skills: [] },
|
||||
null,
|
||||
catalog.sessionReportedSkills(reported, 'omp')
|
||||
)
|
||||
expect(picker.mode).toBe('slash')
|
||||
if (picker.mode !== 'slash') {
|
||||
throw new Error('Missing native picker')
|
||||
}
|
||||
rows = picker.items
|
||||
} else {
|
||||
const menu = mobileComposerCatalog({
|
||||
agent: 'omp',
|
||||
structured: { reported, conversationCommands: [] }
|
||||
})
|
||||
const picker = deriveComposerAutocomplete(
|
||||
'/plan',
|
||||
5,
|
||||
menu.commands,
|
||||
menu.discovery.skills,
|
||||
menu.profile,
|
||||
menu.discovery,
|
||||
null,
|
||||
menu.sessionSkills
|
||||
)
|
||||
expect(picker.mode).toBe('slash')
|
||||
rows = picker.mode === 'slash' ? boundedMenuItems(picker.items) : []
|
||||
}
|
||||
const skills = rows.filter((row) => row.kind === 'skill')
|
||||
expect(skills).toHaveLength(Math.min(size, surface === 'desktop' ? 50 : 10))
|
||||
expect(new Set(skills.map((row) => row.token)).size).toBe(skills.length)
|
||||
expect(skills.find((row) => row.token === '/skill:plan-0')?.description).toBeNull()
|
||||
expect(skills.find((row) => row.token === '/skill:plan-1')?.description).toBe(
|
||||
native.description
|
||||
)
|
||||
expect(visits).toBeGreaterThanOrEqual(reported.length)
|
||||
expect(visits).toBeLessThanOrEqual(10 * reported.length)
|
||||
return visits
|
||||
})
|
||||
expect(counts[1]).toBeLessThanOrEqual(12 * counts[0]!)
|
||||
}
|
||||
})
|
||||
@@ -1,261 +0,0 @@
|
||||
import { QueuedMessageUpdateParams } from '../../../src/shared/rpc-contract/structured-agent-session-queued-edit-params'
|
||||
import { useMobileNativeChatComposerMenu } from './native-chat/composer/use-mobile-native-chat-composer-menu'
|
||||
import {
|
||||
resetMobileNativeChatDraftStoreForTests,
|
||||
useMobileNativeChatDraft
|
||||
} from './native-chat/composer/mobile-native-chat-draft-store'
|
||||
import {
|
||||
updateMobileNativeChatDraftInputs,
|
||||
resetMobileNativeChatDraftInputsForTests
|
||||
} from './native-chat/composer/mobile-native-chat-draft-inputs'
|
||||
import { createElement, type ReactNode } from 'react'
|
||||
import { act, type ReactTestRenderer } from 'react-test-renderer'
|
||||
import { createWithQueryClient } from '../test-support/query-client-test-renderer'
|
||||
import { afterEach, expect, vi } from 'vitest'
|
||||
import type {
|
||||
AgentSessionQueuedMessage,
|
||||
AgentSessionQueuedMessageEditHoldResult
|
||||
} from '../../../src/shared/agent-session/requests/agent-session-queued-message-wire'
|
||||
import { agentSessionSendBodyFingerprint } from '../../../src/shared/agent-session/requests/structured-agent-session-send-mutation'
|
||||
import { queuedMessageWithEdit } from '../../../src/shared/queued-message-edit'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import type { RpcResponse } from '../transport/rpc/rpc-wire-types'
|
||||
import { useMobileStructuredAgentSession } from './use-mobile-structured-agent-session'
|
||||
import {
|
||||
CAPABLE,
|
||||
SESSION_ID,
|
||||
fieldsOf,
|
||||
mutationOk,
|
||||
ok,
|
||||
snapshotEvent
|
||||
} from './native-chat/agent-session/use-mobile-structured-agent-session-queued.test-fixture'
|
||||
|
||||
export function withText(body: AgentSessionQueuedMessage['body'], text: string) {
|
||||
const edited = queuedMessageWithEdit(body, { text })
|
||||
if (!edited.ok) {
|
||||
throw new Error(edited.reason)
|
||||
}
|
||||
return edited.body
|
||||
}
|
||||
|
||||
export function editHoldReply(params: unknown): RpcResponse {
|
||||
const result: AgentSessionQueuedMessageEditHoldResult =
|
||||
fieldsOf(params).action === 'release'
|
||||
? { status: 'released' }
|
||||
: { status: 'held', fingerprint: 'fp', leaseDurationMs: 120_000, remainingMs: 120_000 }
|
||||
return ok(result)
|
||||
}
|
||||
|
||||
export function readOrHoldReply(method: string, params: unknown): RpcResponse {
|
||||
return method === 'agentSession.queuedMessageEditHold'
|
||||
? editHoldReply(params)
|
||||
: ok({ models: [], current: {} })
|
||||
}
|
||||
|
||||
vi.mock('react-native', async () => ({
|
||||
...(await import('../test-support/react-native-motion-stub')).reactNativeMotionStub(),
|
||||
Text: 'Text',
|
||||
View: 'View',
|
||||
Pressable: 'Pressable',
|
||||
ScrollView: 'ScrollView',
|
||||
TextInput: 'TextInput',
|
||||
ActivityIndicator: 'ActivityIndicator',
|
||||
Image: 'Image',
|
||||
Keyboard: { dismiss: vi.fn() },
|
||||
Platform: { OS: 'ios' },
|
||||
useWindowDimensions: () => ({ fontScale: 1 }),
|
||||
StyleSheet: { create: (styles: unknown) => styles }
|
||||
}))
|
||||
vi.mock('lucide-react-native', () => ({
|
||||
FileText: 'FileText',
|
||||
Package: 'Package',
|
||||
Terminal: 'Terminal',
|
||||
ArrowUp: 'ArrowUp',
|
||||
AtSign: 'AtSign',
|
||||
AlertCircle: 'AlertCircle',
|
||||
Image: 'Image',
|
||||
Paperclip: 'Paperclip',
|
||||
Check: 'Check',
|
||||
ChevronDown: 'ChevronDown',
|
||||
ChevronLeft: 'ChevronLeft',
|
||||
ChevronRight: 'ChevronRight',
|
||||
CornerDownRight: 'CornerDownRight',
|
||||
ListEnd: 'ListEnd',
|
||||
MoreHorizontal: 'MoreHorizontal',
|
||||
Mic: 'Mic',
|
||||
Pencil: 'Pencil',
|
||||
Play: 'Play',
|
||||
Plus: 'Plus',
|
||||
Send: 'Send',
|
||||
ShieldAlert: 'ShieldAlert',
|
||||
Square: 'Square',
|
||||
Trash2: 'Trash2',
|
||||
X: 'X'
|
||||
}))
|
||||
vi.mock('@react-native-async-storage/async-storage', () => ({
|
||||
default: { getItem: async () => null, setItem: async () => {}, removeItem: async () => {} }
|
||||
}))
|
||||
|
||||
export function mobileQueuedEditHarness() {
|
||||
const state: {
|
||||
renderer?: ReactTestRenderer
|
||||
bottomText: string
|
||||
hook?: ReturnType<typeof useMobileStructuredAgentSession>
|
||||
menu?: ReturnType<typeof useMobileNativeChatComposerMenu>
|
||||
listener?: (data: unknown) => void
|
||||
} = { bottomText: '' }
|
||||
const append = vi.fn(() => true)
|
||||
const error = vi.fn()
|
||||
const notice = vi.fn()
|
||||
const resolved = vi.fn()
|
||||
const sendRequest = vi.fn<RpcClient['sendRequest']>()
|
||||
const client: RpcClient = {
|
||||
sendRequest,
|
||||
subscribe: (_method, _params, onData) => {
|
||||
if (_method === 'agentSession.subscribe') {
|
||||
state.listener = onData
|
||||
}
|
||||
return () => {}
|
||||
},
|
||||
updateTerminalSubscriptionViewport: () => {},
|
||||
getState: () => 'connected',
|
||||
getReconnectAttempt: () => 0,
|
||||
getLastConnectedAt: () => null,
|
||||
onStateChange: () => () => {},
|
||||
notifyForeground: () => {},
|
||||
close: () => {}
|
||||
}
|
||||
function Harness({
|
||||
sessionId = SESSION_ID,
|
||||
editSupport = true,
|
||||
enabled = true,
|
||||
connected = true,
|
||||
transport = client,
|
||||
composerScopeKey,
|
||||
imagesSupport = false,
|
||||
skillsSupport = false,
|
||||
agent = 'codex',
|
||||
renderContent
|
||||
}: {
|
||||
sessionId?: string
|
||||
editSupport?: boolean | null
|
||||
enabled?: boolean
|
||||
connected?: boolean
|
||||
transport?: RpcClient | null
|
||||
composerScopeKey?: string
|
||||
imagesSupport?: boolean
|
||||
skillsSupport?: boolean
|
||||
agent?: string
|
||||
renderContent?: (hook: ReturnType<typeof useMobileStructuredAgentSession>) => ReactNode
|
||||
}): ReactNode {
|
||||
state.bottomText = useMobileNativeChatDraft('original-bottom')
|
||||
state.hook = useMobileStructuredAgentSession({
|
||||
client: transport,
|
||||
pairedHostClient: transport,
|
||||
sessionId,
|
||||
sourceIdentity: 'host-a',
|
||||
enabled,
|
||||
connected,
|
||||
agent,
|
||||
hostSupport:
|
||||
editSupport === null
|
||||
? null
|
||||
: {
|
||||
...CAPABLE,
|
||||
sendSkills: true,
|
||||
queuedMessages: false,
|
||||
queuedMessageImageEdit: imagesSupport,
|
||||
queuedMessageSkillsEdit: skillsSupport,
|
||||
queuedMessageEdit: editSupport
|
||||
},
|
||||
composerScopeKey,
|
||||
appendComposerText: append,
|
||||
onSendError: error,
|
||||
onQueuedEditNotice: notice,
|
||||
onActionResolved: resolved
|
||||
})
|
||||
state.menu = useMobileNativeChatComposerMenu({
|
||||
value: state.hook.queued.editor?.text ?? '',
|
||||
onChangeText: (text) => state.hook?.queued.editor?.change(text),
|
||||
agent,
|
||||
structuredCatalog: {
|
||||
reported: [{ name: 'review', kind: 'skill', path: '/B/SKILL.md' }],
|
||||
conversationCommands: []
|
||||
},
|
||||
filePaths: [],
|
||||
focusField: () => {},
|
||||
editing: true,
|
||||
// Mirrors the real composer: the menu hands over its row; the draft keeps name and path.
|
||||
onPickSkill: ({ token, path }) => {
|
||||
const key = state.hook?.queued.editor?.scopeKey
|
||||
if (key && path) {
|
||||
updateMobileNativeChatDraftInputs(key, (before) => ({
|
||||
...before,
|
||||
skills: [{ name: token.slice(1), path }]
|
||||
}))
|
||||
}
|
||||
}
|
||||
})
|
||||
return renderContent?.(state.hook) ?? null
|
||||
}
|
||||
function requestedFingerprint(message: AgentSessionQueuedMessage) {
|
||||
const params = sendRequest.mock.calls.findLast(
|
||||
([method]) => method === 'agentSession.queuedMessageUpdate'
|
||||
)?.[1]
|
||||
const fields = QueuedMessageUpdateParams.parse(params)
|
||||
const edited = queuedMessageWithEdit(message.body, fields)
|
||||
if (!edited.ok) {
|
||||
throw new Error(edited.reason)
|
||||
}
|
||||
return agentSessionSendBodyFingerprint(SESSION_ID, edited.body)
|
||||
}
|
||||
async function mount(
|
||||
message: AgentSessionQueuedMessage,
|
||||
editSupport: boolean | null = true,
|
||||
agent = 'codex',
|
||||
sessionId = SESSION_ID
|
||||
) {
|
||||
vi.clearAllMocks()
|
||||
resetMobileNativeChatDraftInputsForTests()
|
||||
resetMobileNativeChatDraftStoreForTests()
|
||||
sendRequest.mockImplementation(async (method, params) =>
|
||||
method === 'agentSession.queuedMessageUpdate'
|
||||
? mutationOk({
|
||||
status: 'updated',
|
||||
messageId: message.messageId,
|
||||
fingerprint: requestedFingerprint(message)
|
||||
})
|
||||
: readOrHoldReply(method, params)
|
||||
)
|
||||
await act(async () => {
|
||||
state.renderer = createWithQueryClient(
|
||||
createElement(Harness, { editSupport, agent, sessionId })
|
||||
)
|
||||
})
|
||||
const snapshot = snapshotEvent({ queuedMessages: [message], runningTurn: true })
|
||||
act(() => state.listener?.({ ...snapshot, sessionId, page: { ...snapshot.page, sessionId } }))
|
||||
if (editSupport !== null) {
|
||||
await act(async () => {
|
||||
expect(await state.hook!.queued.edit!(message.messageId)).toBe(true)
|
||||
})
|
||||
}
|
||||
}
|
||||
afterEach(async () => {
|
||||
await act(async () => state.renderer?.unmount())
|
||||
vi.useRealTimers()
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
return {
|
||||
state,
|
||||
Harness,
|
||||
mount,
|
||||
client,
|
||||
sendRequest,
|
||||
append,
|
||||
error,
|
||||
notice,
|
||||
resolved,
|
||||
requestedFingerprint
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { AgentJournalFreeTextInput } from '../../../src/shared/agent-session/journal/agent-session-journal-types'
|
||||
import { formatQuestionFreeTextAnswer } from './native-chat/input/mobile-native-chat-question'
|
||||
import {
|
||||
projectStructuredQuestion,
|
||||
structuredQuestionResponseTarget,
|
||||
type StructuredQuestionItem
|
||||
} from './mobile-structured-agent-prompts'
|
||||
|
||||
function prompt(freeTextInput?: AgentJournalFreeTextInput): StructuredQuestionItem {
|
||||
return {
|
||||
itemId: 'item-1',
|
||||
revision: 3,
|
||||
sequence: 1,
|
||||
observedAt: 1,
|
||||
body: {
|
||||
kind: 'question',
|
||||
question: 'Edit the draft',
|
||||
options: [],
|
||||
freeTextQuestionId: 'q1',
|
||||
...(freeTextInput ? { freeTextInput } : {}),
|
||||
resolution: { state: 'pending', selectedOptionId: null, resolvedBy: null, resolvedAt: null }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe('mobile structured free-text questions', () => {
|
||||
it('accepts empty and whitespace text only for the matching allowed prompt', () => {
|
||||
const current = prompt({ allowEmpty: true })
|
||||
const projected = projectStructuredQuestion(current)!
|
||||
for (const answer of ['', ' \n ']) {
|
||||
const response = formatQuestionFreeTextAnswer(projected, answer)
|
||||
expect(structuredQuestionResponseTarget(response, current)).toEqual({
|
||||
itemId: 'item-1',
|
||||
expectedRevision: 3,
|
||||
answer: { questionId: 'q1', optionIds: [], other: answer }
|
||||
})
|
||||
expect(structuredQuestionResponseTarget(response, prompt())).toBeNull()
|
||||
}
|
||||
expect(
|
||||
structuredQuestionResponseTarget(formatQuestionFreeTextAnswer(projected, ''), {
|
||||
...current,
|
||||
revision: 4
|
||||
})
|
||||
).toBeNull()
|
||||
})
|
||||
|
||||
it('keeps legacy trimming for ordinary free-text answers', () => {
|
||||
const current = prompt()
|
||||
const projected = projectStructuredQuestion(current)!
|
||||
expect(
|
||||
structuredQuestionResponseTarget(
|
||||
formatQuestionFreeTextAnswer(projected, ' draft '),
|
||||
current
|
||||
)
|
||||
).toMatchObject({ answer: { other: 'draft' } })
|
||||
expect(structuredQuestionResponseTarget('', current)).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
StructuredAgentSessionForkSource
|
||||
} from '../../../src/shared/agent-session/structured-agent-session-create'
|
||||
import { AGENT_SESSION_CREATE_TAB_PLACEMENT_RUNTIME_CAPABILITY } from '../../../src/shared/agent-session/agent-session-create-capabilities'
|
||||
import { createMobileStructuredAgentSession } from './mobile-structured-agent-session-launch'
|
||||
import { createMobileStructuredAgentSession } from './native-chat/agent-session/mobile-structured-agent-session-launch'
|
||||
import {
|
||||
launchedSelection,
|
||||
withLaunchReply,
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import './transcript/mobile-agent-message-renderer.test-fixture'
|
||||
import { createElement } from 'react'
|
||||
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
|
||||
import { afterEach, expect, it } from 'vitest'
|
||||
import { findAllByHostType } from '../../test-support/react-test-renderer-host-nodes'
|
||||
import { Transcript, textIn } from './transcript/mobile-native-chat-turn-diff.test-fixture'
|
||||
|
||||
let renderer: ReactTestRenderer | null = null
|
||||
afterEach(() => {
|
||||
act(() => renderer?.unmount())
|
||||
renderer = null
|
||||
})
|
||||
|
||||
it('shows finished-turn files outside folded work and opens a patch with one tap', () => {
|
||||
act(() => {
|
||||
renderer = create(createElement(Transcript, { working: true }))
|
||||
})
|
||||
expect(textIn(renderer!.root)).toContain('greeting.ts')
|
||||
act(() => {
|
||||
renderer!.update(createElement(Transcript))
|
||||
})
|
||||
expect(textIn(renderer!.root)).toContain('greeting.ts')
|
||||
expect(textIn(renderer!.root)).not.toContain('diagnostic-output')
|
||||
expect(textIn(renderer!.root)).not.toContain('helloNew()')
|
||||
const file = findAllByHostType(renderer!.root, 'Pressable').find(
|
||||
(node) => node.props.accessibilityLabel === '/repo/greeting.ts'
|
||||
)!
|
||||
act(() => file.props.onPress())
|
||||
expect(textIn(renderer!.root)).toContain('helloNew()')
|
||||
expect(textIn(renderer!.root)).not.toContain('statusNew()')
|
||||
act(() => renderer!.unmount())
|
||||
act(() => {
|
||||
renderer = create(createElement(Transcript))
|
||||
})
|
||||
expect(textIn(renderer!.root)).toContain('status.ts')
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MobileQueuedMessageComposerContext } from '../mobile-queued-message-composer-context'
|
||||
import { MobileQueuedMessageComposerContext } from './input/mobile-queued-message-composer-context'
|
||||
import { Activity, useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { StyleSheet, View } from 'react-native'
|
||||
import { MobileNativeChatView, type MobileNativeChatInputLockReason } from './MobileNativeChatView'
|
||||
@@ -6,11 +6,11 @@ import { useMobileNativeChatProjection } from './transcript/use-mobile-native-ch
|
||||
import { nativeChatDockedTaskList } from '../../../../src/shared/native-chat/input/native-chat-task-list-state'
|
||||
import type { MobileNativeChatImageAttachments } from './composer/use-mobile-native-chat-image-attachments'
|
||||
import type { MobileNativeChatController } from './mobile-native-chat-controller-contract'
|
||||
import type { MobileNativeChatStructuredComposer } from './composer/MobileNativeChatComposer'
|
||||
import type { MobileNativeChatStructuredComposer } from './composer/mobile-native-chat-structured-composer'
|
||||
import { useMobileNativeChatComposerTray } from './composer/use-mobile-native-chat-composer-tray'
|
||||
import { useMobileNativeChatVisualRenderer } from './visual/MobileNativeChatVisual'
|
||||
import { MobileNativeChatVisualContext } from './visual/mobile-native-chat-visual-context'
|
||||
import { MobileNativeChatRootItemSourceContext } from './mobile-native-chat-item-read'
|
||||
import { MobileNativeChatRootItemSourceContext } from './transcript/mobile-native-chat-item-read'
|
||||
import { useMobileNativeChatMessageDetail } from './transcript/use-mobile-native-chat-message-detail'
|
||||
import {
|
||||
MobileNativeChatReplyRevealsContext,
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
import { MobileNativeChatRowOverlaysHost } from './transcript/MobileNativeChatRowOverlaysHost'
|
||||
import { nativeChatAskRequiresTerminal } from '../../../../src/shared/native-chat/native-chat-agent-support'
|
||||
import { tuiAgentDisplayName } from '../../../../src/shared/agent-launch/catalog/tui-agent-display-names'
|
||||
import { MobileNativeChatNoticeContext } from '../mobile-native-chat-notice-context'
|
||||
import { MobileNativeChatNoticeContext } from './transcript/mobile-native-chat-notice-context'
|
||||
import type { MobileNativeChatImageSource } from './visual/mobile-native-chat-image-preview'
|
||||
import type { MobileNativeChatHostOutage } from './mobile-native-chat-host-outage'
|
||||
import { useMobileNativeChatMarkdownLinks } from './use-mobile-native-chat-markdown-links'
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
installChatViewHooks,
|
||||
assistantTurn,
|
||||
banners,
|
||||
bannerText,
|
||||
hostType,
|
||||
listIds,
|
||||
pressSend,
|
||||
render,
|
||||
root,
|
||||
update
|
||||
} from './MobileNativeChatView.harness.test-fixture'
|
||||
|
||||
@@ -51,35 +46,6 @@ vi.mock('./composer/MobileNativeChatComposer', async () => {
|
||||
describe('MobileNativeChatView: send and read failure banners', () => {
|
||||
installChatViewHooks()
|
||||
|
||||
it('leaves only the words of a read that failed for good, over a loaded transcript', async () => {
|
||||
const loaded = [assistantTurn('m1', 'earlier reply')]
|
||||
const words = 'This chat was saved by a newer Orca. Update Orca to open it.'
|
||||
const shown = (text: string) =>
|
||||
root().findAll((node) => hostType(node) === 'Text' && node.props.children === text)
|
||||
const composers = () => root().findAll((node) => hostType(node) === 'Composer')
|
||||
const lists = () => root().findAll((node) => hostType(node) === 'FlatList')
|
||||
const failure = {
|
||||
messages: loaded,
|
||||
folded: loaded,
|
||||
status: 'error' as const,
|
||||
error: words,
|
||||
canStop: true,
|
||||
permission: { title: 'Approve?', options: [{ label: 'Allow', send: '1' }] },
|
||||
sendErrorMessage: 'Message unconfirmed — check chat before retrying'
|
||||
}
|
||||
await render({ ...failure, readFailedFinally: true })
|
||||
expect(shown(words)).toHaveLength(1)
|
||||
expect(composers()).toHaveLength(0)
|
||||
expect(lists()).toHaveLength(0)
|
||||
expect(banners()).toHaveLength(0)
|
||||
expect(root().findAllByProps({ accessibilityLabel: 'Stop the agent' })).toHaveLength(0)
|
||||
|
||||
await update({ ...failure, error: "Orca couldn't open this chat's history right now." })
|
||||
expect(listIds()).toEqual(['m1'])
|
||||
expect(composers()).toHaveLength(1)
|
||||
expect(banners()).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('retires the previous banner before sending and preserves the new delivery notice', async () => {
|
||||
const onClearSendError = vi.fn()
|
||||
await render({
|
||||
@@ -99,6 +65,6 @@ describe('MobileNativeChatView: send and read failure banners', () => {
|
||||
})
|
||||
})
|
||||
|
||||
vi.mock('../MobileQueuedMessageComposer', () => ({
|
||||
vi.mock('./input/MobileQueuedMessageComposer', () => ({
|
||||
MobileQueuedMessageComposer: 'QueuedMessageComposer'
|
||||
}))
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
import './MobileNativeChatView.harness.test-fixture'
|
||||
import { createElement, type ComponentProps } from 'react'
|
||||
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
|
||||
import { Pressable } from 'react-native'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { MobileNativeChatView } from './MobileNativeChatView'
|
||||
import { useMobileNativeChatPromptPresentation } from './input/use-mobile-native-chat-prompt-presentation'
|
||||
import type { MobileChatPermission } from './input/mobile-native-chat-permission'
|
||||
import { setMobileNativeChatDraftText } from './composer/mobile-native-chat-draft-store'
|
||||
vi.mock('react-native', async () => {
|
||||
const React = await import('react')
|
||||
return {
|
||||
...(await import('../../test-support/react-native-motion-stub')).reactNativeMotionStub(),
|
||||
ActivityIndicator: 'ActivityIndicator',
|
||||
Image: 'Image',
|
||||
Platform: { OS: 'ios' },
|
||||
Keyboard: { dismiss: vi.fn() },
|
||||
FlatList: React.forwardRef((props, ref) => {
|
||||
React.useImperativeHandle(ref, () => ({ scrollToEnd: vi.fn(), scrollToOffset: vi.fn() }), [])
|
||||
return React.createElement('FlatList', props)
|
||||
}),
|
||||
Pressable: 'Pressable',
|
||||
ScrollView: 'ScrollView',
|
||||
TextInput: 'TextInput',
|
||||
StyleSheet: { create: (styles: unknown) => styles, hairlineWidth: 1 },
|
||||
Text: 'Text',
|
||||
View: 'View'
|
||||
}
|
||||
})
|
||||
vi.mock('react-native-safe-area-context', () => ({
|
||||
useSafeAreaInsets: () => ({ top: 0, bottom: 0, left: 0, right: 0 })
|
||||
}))
|
||||
vi.mock('react-native-gesture-handler', () => {
|
||||
type GestureChain = {
|
||||
runOnJS: () => GestureChain
|
||||
onStart: () => GestureChain
|
||||
onUpdate: () => GestureChain
|
||||
}
|
||||
const chain: GestureChain = { runOnJS: () => chain, onStart: () => chain, onUpdate: () => chain }
|
||||
return {
|
||||
Gesture: { Simultaneous: () => ({}), Native: () => ({}), Pinch: () => chain },
|
||||
GestureDetector: 'GestureDetector',
|
||||
GestureHandlerRootView: 'GestureHandlerRootView'
|
||||
}
|
||||
})
|
||||
vi.mock('lucide-react-native', () =>
|
||||
Object.fromEntries(
|
||||
[
|
||||
'ArrowDown',
|
||||
'ArrowUp',
|
||||
'ListEnd',
|
||||
'CornerDownRight',
|
||||
'ChevronDown',
|
||||
'ChevronUp',
|
||||
'ChevronsDownUp',
|
||||
'ChevronsUpDown',
|
||||
'ShieldQuestion',
|
||||
'ImagePlus',
|
||||
'Package',
|
||||
'Plus',
|
||||
'Mic',
|
||||
'Square',
|
||||
'X'
|
||||
].map((x) => [x, x])
|
||||
)
|
||||
)
|
||||
vi.mock('./transcript/MobileNativeChatMessage', () => ({
|
||||
MobileNativeChatMessage: 'ChatMessage'
|
||||
}))
|
||||
vi.mock('./transcript/MobileNativeChatLiveLine', () => ({
|
||||
MobileNativeChatLiveLine: 'LiveStatus'
|
||||
}))
|
||||
vi.mock('./input/MobileNativeChatAsk', () => ({ MobileNativeChatAsk: 'ChatAsk' }))
|
||||
vi.mock('./input/MobileNativeChatQuestion', () => ({
|
||||
MobileNativeChatQuestion: 'ChatQuestion'
|
||||
}))
|
||||
vi.mock('./input/MobileNativeChatSessionOptionPickers', () => ({
|
||||
MobileNativeChatSessionOptionPickers: 'SessionOptions'
|
||||
}))
|
||||
vi.mock('./composer/MobileNativeChatComposerMenu', () => ({
|
||||
MobileNativeChatComposerSuggestions: 'Suggestions'
|
||||
}))
|
||||
vi.mock('../../components/ActionSheetModal', () => ({ ActionSheetModal: 'ActionSheetModal' }))
|
||||
vi.mock('../../components/MobileMarkdown', () => ({ MobileMarkdown: 'Markdown' }))
|
||||
let tree: ReactTestRenderer | null = null
|
||||
setMobileNativeChatDraftText('terminal-1', 'no, do X instead')
|
||||
const props = {
|
||||
messages: [],
|
||||
folded: [],
|
||||
status: 'ready' as const,
|
||||
streaming: null,
|
||||
pending: [],
|
||||
onSend: vi.fn(async () => true),
|
||||
sendSurfaceId: 'terminal-1',
|
||||
getSendCompletionGeneration: () => 0,
|
||||
getComposerEditGeneration: () => 0,
|
||||
draftKey: 'terminal-1',
|
||||
onComposerTextChange: vi.fn()
|
||||
}
|
||||
const permission: MobileChatPermission = {
|
||||
title: 'Claude wants to use Bash',
|
||||
options: [{ label: 'Deny', send: String.fromCharCode(27) }]
|
||||
}
|
||||
type Overrides = Partial<ComponentProps<typeof MobileNativeChatView>> & {
|
||||
waitStartedAt?: number
|
||||
sessionKey?: string
|
||||
}
|
||||
function Harness(overrides: Overrides) {
|
||||
const shown = useMobileNativeChatPromptPresentation({
|
||||
permission: overrides.permission ?? null,
|
||||
waitStartedAt: overrides.waitStartedAt ?? 10,
|
||||
scopeKey: 'tab-1',
|
||||
sessionKey: overrides.sessionKey ?? 'session-1',
|
||||
observing: true,
|
||||
respondPermission: overrides.onRespondPermission ?? (async () => false)
|
||||
})
|
||||
return createElement(MobileNativeChatView, {
|
||||
...props,
|
||||
...overrides,
|
||||
permission: shown.permission,
|
||||
promptKey: shown.occurrenceKey,
|
||||
onRespondPermission: shown.respondPermission
|
||||
})
|
||||
}
|
||||
const render = async (overrides: Overrides) => {
|
||||
await act(async () => {
|
||||
const element = createElement(Harness, overrides)
|
||||
if (tree) {
|
||||
tree.update(element)
|
||||
} else {
|
||||
tree = create(element)
|
||||
}
|
||||
})
|
||||
}
|
||||
const sendButton = () => tree!.root.findByProps({ accessibilityLabel: 'Send message' })
|
||||
const approvalAction = () =>
|
||||
tree!.root.findByProps({ testID: 'native-chat-approval-actions' }).findByType(Pressable)
|
||||
afterEach(() => {
|
||||
act(() => tree?.unmount())
|
||||
tree = null
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
describe('terminal prompt presentation with the production view, card and composer', () => {
|
||||
it('a late answer cannot reshow an answered replacement occurrence', async () => {
|
||||
let finishOld: (accepted: boolean) => void = () => {}
|
||||
const onRespondPermission = vi
|
||||
.fn<(send: string) => Promise<boolean>>()
|
||||
.mockReturnValueOnce(
|
||||
new Promise((resolve) => {
|
||||
finishOld = resolve
|
||||
})
|
||||
)
|
||||
.mockResolvedValueOnce(true)
|
||||
await render({ permission, onRespondPermission })
|
||||
act(() => {
|
||||
void approvalAction().props.onPress()
|
||||
})
|
||||
await render({ permission, onRespondPermission, waitStartedAt: 20 })
|
||||
await act(async () => {
|
||||
await approvalAction().props.onPress()
|
||||
})
|
||||
expect(sendButton().props.disabled).toBe(false)
|
||||
await act(async () => finishOld(true))
|
||||
expect(sendButton().props.disabled).toBe(false)
|
||||
})
|
||||
|
||||
it('a late answer cannot dismiss a replacement session', async () => {
|
||||
let finishOld: (accepted: boolean) => void = () => {}
|
||||
const onRespondPermission = vi.fn(
|
||||
() =>
|
||||
new Promise<boolean>((resolve) => {
|
||||
finishOld = resolve
|
||||
})
|
||||
)
|
||||
await render({ permission, onRespondPermission })
|
||||
act(() => {
|
||||
void approvalAction().props.onPress()
|
||||
})
|
||||
await render({ permission, onRespondPermission, sessionKey: 'session-2' })
|
||||
await act(async () => finishOld(true))
|
||||
expect(sendButton().props.disabled).toBe(true)
|
||||
expect(approvalAction().props.disabled).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
vi.mock('../MobileQueuedMessageComposer', () => ({
|
||||
MobileQueuedMessageComposer: 'QueuedMessageComposer'
|
||||
}))
|
||||
@@ -22,19 +22,19 @@ import { useMobileTranslation } from '../../i18n/use-mobile-translation'
|
||||
import { MobileNativeChatInputLockStatus } from './composer/MobileNativeChatInputLockStatus'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import { styles } from './mobile-native-chat-view-styles'
|
||||
import { MobileNativeChatEmptyStateView } from '../MobileNativeChatEmptyStateView'
|
||||
import { mobileNativeChatListFooter } from './mobile-native-chat-list-footer'
|
||||
import { mobileNativeChatListHeader } from './mobile-native-chat-list-header'
|
||||
import { MobileNativeChatEmptyStateView } from './transcript/MobileNativeChatEmptyStateView'
|
||||
import { mobileNativeChatListFooter } from './transcript/mobile-native-chat-list-footer'
|
||||
import { mobileNativeChatListHeader } from './transcript/mobile-native-chat-list-header'
|
||||
import {
|
||||
mobileNativeChatEmptyState,
|
||||
type MobileNativeChatPendingItem
|
||||
} from './mobile-native-chat-render-data'
|
||||
} from './transcript/mobile-native-chat-render-data'
|
||||
import { useMobileNativeChatTransientData } from './transcript/use-mobile-native-chat-transient-data'
|
||||
import { useMobileNativeChatRowKeys } from './transcript/mobile-native-chat-row-keys'
|
||||
import { useMobileNativeChatPinchGesture } from './transcript/use-mobile-native-chat-pinch-gesture'
|
||||
import { useMobileNativeChatTailFollow } from './transcript/use-mobile-native-chat-tail-follow'
|
||||
import { useMobileNativeChatTurnDisclosure } from './transcript/use-mobile-native-chat-turn-disclosure'
|
||||
import { mobileNativeChatComposerPlaceholder } from './use-mobile-native-chat-input-lease'
|
||||
import { mobileNativeChatComposerPlaceholder } from './composer/use-mobile-native-chat-input-lease'
|
||||
import { MobileNativeChatLiveLine } from './transcript/MobileNativeChatLiveLine'
|
||||
import { MobileNativeChatAwaitingInputRow } from './transcript/MobileNativeChatAwaitingInputRow'
|
||||
import type { NativeChatAwaitingInput } from '../../../../src/shared/native-chat/native-chat-terminal-turn'
|
||||
@@ -43,9 +43,9 @@ import type { PendingNativeChatImage } from './composer/mobile-native-chat-image
|
||||
import type { MobilePastedImages } from './composer/mobile-native-chat-composer-paste'
|
||||
import {
|
||||
MobileNativeChatDraftComposer,
|
||||
type MobileNativeChatSendProps,
|
||||
type MobileNativeChatStructuredComposer
|
||||
type MobileNativeChatSendProps
|
||||
} from './composer/MobileNativeChatComposer'
|
||||
import type { MobileNativeChatStructuredComposer } from './composer/mobile-native-chat-structured-composer'
|
||||
import { MobileNativeChatPromptCard } from './input/MobileNativeChatPromptCard'
|
||||
import type { MobileNativeChatMicProps } from './composer/MobileNativeChatComposerMic'
|
||||
import { useMobileNativeChatPromptInputOwner } from './input/use-mobile-native-chat-prompt-input-owner'
|
||||
@@ -54,11 +54,11 @@ import {
|
||||
type ComposerTrayProps
|
||||
} from './composer/use-mobile-native-chat-composer-tray'
|
||||
import type { MobileNativeChatSessionOptionPickersProps } from './input/MobileNativeChatSessionOptionPickers'
|
||||
import { MobileNativeChatScrollRootsBoundary } from '../MobileNativeChatScrollRootsBoundary'
|
||||
import { MobileNativeChatScrollRootsBoundary } from './transcript/MobileNativeChatScrollRootsBoundary'
|
||||
import { MobileNativeChatRowList } from './transcript/MobileNativeChatRowList'
|
||||
import { useMobileNativeChatRowRenderer } from './transcript/use-mobile-native-chat-row-renderer'
|
||||
import type { MobileNativeChatStatus } from './use-mobile-native-chat-session'
|
||||
import type { OlderPagePhase } from '../use-mobile-older-page-loader'
|
||||
import type { MobileNativeChatStatus } from './mobile-native-chat-session-status'
|
||||
import type { OlderPagePhase } from './transcript/use-mobile-older-page-loader'
|
||||
import { MobileNativeChatOpenFileContext } from './mobile-native-chat-open-file-context'
|
||||
import { MobileNativeChatLowerRegion } from './MobileNativeChatLowerRegion'
|
||||
import { MobileNativeChatOfflineQueue } from './input/MobileNativeChatOfflineQueue'
|
||||
|
||||
@@ -208,6 +208,6 @@ describe('MobileNativeChatView', () => {
|
||||
})
|
||||
})
|
||||
|
||||
vi.mock('../MobileQueuedMessageComposer', () => ({
|
||||
vi.mock('./input/MobileQueuedMessageComposer', () => ({
|
||||
MobileQueuedMessageComposer: 'QueuedMessageComposer'
|
||||
}))
|
||||
|
||||
@@ -2,9 +2,9 @@ import type {
|
||||
AgentSessionFailureCopyId,
|
||||
AgentSessionFailureCopyValues,
|
||||
AgentSessionFailureSay
|
||||
} from '../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
import { AGENT_SESSION_FAILURE_COPY } from '../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
} from '../../../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { translate } from '../../../i18n/mobile-i18n'
|
||||
import { AGENT_SESSION_FAILURE_COPY } from '../../../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { START_FAILURE_COPY } from './agent-session-start-failure-copy'
|
||||
import { SEND_FAILURE_COPY } from './agent-session-send-failure-copy'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { AGENT_SESSION_FAILURE_COPY } from '../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { AGENT_SESSION_FAILURE_COPY } from '../../../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import type {
|
||||
AgentSessionFailureCopyId,
|
||||
AgentSessionFailureCopyValues
|
||||
} from '../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
} from '../../../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { translate } from '../../../i18n/mobile-i18n'
|
||||
|
||||
export const SEND_FAILURE_COPY = {
|
||||
unconfirmed: (values) =>
|
||||
@@ -1,8 +1,8 @@
|
||||
import type {
|
||||
AgentSessionFailureCopyId,
|
||||
AgentSessionFailureCopyValues
|
||||
} from '../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
} from '../../../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { translate } from '../../../i18n/mobile-i18n'
|
||||
|
||||
export const START_FAILURE_COPY = {
|
||||
savedConversationMissing: (values) =>
|
||||
@@ -1,10 +1,10 @@
|
||||
import { expiredAttachmentsSentence } from '../../../src/shared/agent-session/failures/agent-session-attachment-failure-words'
|
||||
import { agentSessionFailureSentence } from '../../../src/shared/agent-session/failures/agent-session-failure-words'
|
||||
import { expiredAttachmentsSentence } from '../../../../../src/shared/agent-session/failures/agent-session-attachment-failure-words'
|
||||
import { agentSessionFailureSentence } from '../../../../../src/shared/agent-session/failures/agent-session-failure-words'
|
||||
import type {
|
||||
AgentSessionWriteNoticePart,
|
||||
AgentSessionWriteNoticeSentence
|
||||
} from '../../../src/shared/agent-session/failures/agent-session-write-notice-copy'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
} from '../../../../../src/shared/agent-session/failures/agent-session-write-notice-copy'
|
||||
import { translate } from '../../../i18n/mobile-i18n'
|
||||
import { sayMobileAgentSessionFailure } from './agent-session-failure-copy'
|
||||
|
||||
const SENTENCES: Record<AgentSessionWriteNoticeSentence, () => string> = {
|
||||
@@ -1,18 +1,18 @@
|
||||
import { useCallback, useRef } from 'react'
|
||||
import type { StructuredAgentSessionHostSupport } from './mobile-structured-agent-session-host-support'
|
||||
import type { AgentSessionCancelResult } from '../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { StructuredAgentSessionState } from '../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import { runningStructuredAgentSessionTurnId } from '../../../src/shared/agent-session/view/structured-agent-session-live-turn'
|
||||
import type { AgentSessionCancelResult } from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { StructuredAgentSessionState } from '../../../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import { runningStructuredAgentSessionTurnId } from '../../../../../src/shared/agent-session/view/structured-agent-session-live-turn'
|
||||
import {
|
||||
joinStructuredAgentSessionStop,
|
||||
structuredAgentSessionStopIsJoinable
|
||||
} from '../../../src/shared/agent-session/requests/structured-agent-session-stop-join'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
} from '../../../../../src/shared/agent-session/requests/structured-agent-session-stop-join'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import {
|
||||
requestStructuredAgentSessionMutation,
|
||||
type StructuredAgentSessionMutationCallResult
|
||||
} from './mobile-structured-agent-session-rpc'
|
||||
import { actionableStructuredPrompts } from './mobile-structured-actionable-prompt'
|
||||
import { actionableStructuredPrompts } from '../input/mobile-structured-actionable-prompt'
|
||||
|
||||
type PromptIdentity = { itemId: string; expectedRevision: number }
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
import type { AgentSessionSlashCommand } from '../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { NativeChatSendFollowUp } from '../../../src/shared/native-chat/input/native-chat-follow-up-behavior'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import type { AgentSessionSlashCommand } from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { NativeChatSendFollowUp } from '../../../../../src/shared/native-chat/input/native-chat-follow-up-behavior'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import type { StructuredAgentSessionHostSupport } from './mobile-structured-agent-session-host-support'
|
||||
import type {
|
||||
MobileNativeChatSendIntent,
|
||||
MobileNativeChatSendOutcome
|
||||
} from './native-chat/mobile-native-chat-send'
|
||||
import type { MobileNativeChatVisualSource } from './native-chat/visual/mobile-native-chat-visual-read'
|
||||
import type { MobileChatPermission } from './native-chat/input/mobile-native-chat-permission'
|
||||
import type { MobileChatQuestion } from './native-chat/input/mobile-native-chat-question'
|
||||
import type { MobileNativeChatSession } from './native-chat/use-mobile-native-chat-session'
|
||||
import type { NativeChatLiveTurnIndicator } from '../../../src/shared/native-chat/transcript/native-chat-turn-status'
|
||||
import type { NativeChatResolvedPrompt } from '../../../src/shared/native-chat/native-chat-resolution-receipt'
|
||||
import type { useMobileStructuredAgentOptions } from './use-mobile-structured-agent-options'
|
||||
import type { useMobileStructuredAgentTurnTiming } from './use-mobile-structured-agent-turn-timing'
|
||||
import type { StructuredMobileSendAttachment } from './use-mobile-structured-send-with-outcome'
|
||||
} from '../composer/mobile-native-chat-send'
|
||||
import type { MobileNativeChatVisualSource } from '../visual/mobile-native-chat-visual-read'
|
||||
import type { MobileChatPermission } from '../input/mobile-native-chat-permission'
|
||||
import type { MobileChatQuestion } from '../input/mobile-native-chat-question'
|
||||
import type { MobileNativeChatSession } from '../use-mobile-native-chat-session'
|
||||
import type { NativeChatLiveTurnIndicator } from '../../../../../src/shared/native-chat/transcript/native-chat-turn-status'
|
||||
import type { NativeChatResolvedPrompt } from '../../../../../src/shared/native-chat/native-chat-resolution-receipt'
|
||||
import type { useMobileStructuredAgentOptions } from '../input/use-mobile-structured-agent-options'
|
||||
import type { useMobileStructuredAgentTurnTiming } from '../transcript/use-mobile-structured-agent-turn-timing'
|
||||
import type { StructuredMobileSendAttachment } from '../composer/use-mobile-structured-send-with-outcome'
|
||||
import type {
|
||||
AgentJournalSkillRef,
|
||||
AgentJournalSubmission
|
||||
} from '../../../src/shared/agent-session/journal/agent-session-journal-types'
|
||||
} from '../../../../../src/shared/agent-session/journal/agent-session-journal-types'
|
||||
import type {
|
||||
MobileNativeChatCommandRefusalCauses,
|
||||
MobileNativeChatSendErrorReporter
|
||||
} from './native-chat/use-mobile-native-chat-send-error'
|
||||
import type { MobileStructuredQueuedMessageControls } from './use-mobile-structured-queued-message-controls'
|
||||
import type { MobileStructuredBackgroundTasks } from './use-mobile-structured-background-tasks'
|
||||
import type { NativeChatContextUsageSummary } from '../../../src/shared/native-chat/native-chat-context-usage-summary'
|
||||
import type { MobileStructuredInterruptedContinue } from './use-mobile-structured-interrupted-continue'
|
||||
import type { MobileStructuredThreadGoal } from './use-mobile-structured-thread-goal'
|
||||
import type { MobileStructuredSends } from './use-mobile-structured-sends'
|
||||
import type { AgentSessionRewindSurface } from '../../../src/shared/agent-session/lifecycle/agent-session-rewind-request'
|
||||
import type { MobileNativeChatUsageLimit } from './native-chat/use-mobile-native-chat-usage-limit'
|
||||
} from '../composer/use-mobile-native-chat-send-error'
|
||||
import type { MobileStructuredQueuedMessageControls } from '../input/use-mobile-structured-queued-message-controls'
|
||||
import type { MobileStructuredBackgroundTasks } from '../input/use-mobile-structured-background-tasks'
|
||||
import type { NativeChatContextUsageSummary } from '../../../../../src/shared/native-chat/native-chat-context-usage-summary'
|
||||
import type { MobileStructuredInterruptedContinue } from '../composer/use-mobile-structured-interrupted-continue'
|
||||
import type { MobileStructuredThreadGoal } from '../input/use-mobile-structured-thread-goal'
|
||||
import type { MobileStructuredSends } from '../composer/use-mobile-structured-sends'
|
||||
import type { AgentSessionRewindSurface } from '../../../../../src/shared/agent-session/lifecycle/agent-session-rewind-request'
|
||||
import type { MobileNativeChatUsageLimit } from '../use-mobile-native-chat-usage-limit'
|
||||
|
||||
export type StructuredMobileSession = Omit<
|
||||
ReturnType<typeof useMobileStructuredAgentOptions>,
|
||||
@@ -2,12 +2,12 @@ import {
|
||||
AGENT_SESSION_COMMANDS_ON_REQUEST_CAPABILITY,
|
||||
AGENT_SESSION_MODEL_EFFORT_DISCOVERY_CAPABILITY,
|
||||
AGENT_SESSION_COHERENT_MODEL_CATALOG_CAPABILITY
|
||||
} from '../../../src/shared/agent-session/structured-agent-session-surface-capabilities'
|
||||
} from '../../../../../src/shared/agent-session/structured-agent-session-surface-capabilities'
|
||||
import {
|
||||
AGENT_SESSION_CONVERSATION_STOP_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_PROMPT_CANCEL_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_REPEATED_STOP_RUNTIME_CAPABILITY
|
||||
} from '../../../src/shared/agent-session/lifecycle/agent-session-stop-capabilities'
|
||||
} from '../../../../../src/shared/agent-session/lifecycle/agent-session-stop-capabilities'
|
||||
import {
|
||||
AGENT_SESSION_ITEM_DETAIL_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_SEND_RECORDED_RUNTIME_CAPABILITY,
|
||||
@@ -22,21 +22,21 @@ import {
|
||||
AGENT_SESSION_PHONE_REWIND_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_PHONE_USAGE_LIMIT_CONTINUE_CANCEL_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_QUEUED_MESSAGE_SKILLS_EDIT_RUNTIME_CAPABILITY
|
||||
} from '../../../src/shared/agent-session/agent-session-runtime-capabilities'
|
||||
import { AGENT_SESSION_STATUS_FEED_RUNTIME_CAPABILITY } from '../../../src/shared/agent-session/agent-session-attention-capabilities'
|
||||
} from '../../../../../src/shared/agent-session/agent-session-runtime-capabilities'
|
||||
import { AGENT_SESSION_STATUS_FEED_RUNTIME_CAPABILITY } from '../../../../../src/shared/agent-session/agent-session-attention-capabilities'
|
||||
import {
|
||||
AGENT_SESSION_SEND_SELECTION_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_SEND_OPTIONS_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_SEND_SKILLS_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_SEND_USAGE_LIMIT_CONTINUATION_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_USAGE_LIMIT_AUTO_CONTINUE_RUNTIME_CAPABILITY
|
||||
} from '../../../src/shared/agent-session/agent-session-create-capabilities'
|
||||
} from '../../../../../src/shared/agent-session/agent-session-create-capabilities'
|
||||
import {
|
||||
AGENT_SESSION_PERMISSION_MODES_RUNTIME_CAPABILITY,
|
||||
AGENT_SESSION_PERMISSION_OWN_RUNTIME_CAPABILITY
|
||||
} from '../../../src/shared/agent-session/agent-session-permission-modes-capability'
|
||||
import { SKILL_DISCOVER_WORKSPACE_CAPABILITY } from '../../../src/shared/skill-install-capability'
|
||||
import { AGENT_SESSION_PHONE_CONTINUE_INTERRUPTED_RUNTIME_CAPABILITY } from '../../../src/shared/agent-session/agent-session-continue-interrupted-capability'
|
||||
} from '../../../../../src/shared/agent-session/agent-session-permission-modes-capability'
|
||||
import { SKILL_DISCOVER_WORKSPACE_CAPABILITY } from '../../../../../src/shared/skill-install-capability'
|
||||
import { AGENT_SESSION_PHONE_CONTINUE_INTERRUPTED_RUNTIME_CAPABILITY } from '../../../../../src/shared/agent-session/agent-session-continue-interrupted-capability'
|
||||
|
||||
export type StructuredAgentSessionHostSupport = {
|
||||
commandsOnRequest?: boolean
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import { markRpcDeliveryUnknown } from '../transport/rpc/rpc-delivery-ambiguity'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import { markRpcDeliveryUnknown } from '../../../transport/rpc/rpc-delivery-ambiguity'
|
||||
import { createMobileStructuredAgentSession } from './mobile-structured-agent-session-launch'
|
||||
import './mobile-created-structured-sessions'
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
import { agentSessionForkSourceFailureWords } from '../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { agentSessionForkSourceFailureWords } from '../../../../../src/shared/agent-session/failures/agent-session-failure-copy'
|
||||
import { sayMobileAgentSessionFailure } from './agent-session-failure-copy'
|
||||
import type { TuiAgent } from '../../../src/shared/agent-launch/catalog/tui-agent'
|
||||
import type { TuiAgent } from '../../../../../src/shared/agent-launch/catalog/tui-agent'
|
||||
import type {
|
||||
AgentSessionAttachResult,
|
||||
AgentSessionMutationResult
|
||||
} from '../../../src/shared/agent-session/agent-session-wire'
|
||||
} from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import {
|
||||
isDefinitiveAgentSessionCreateRefusal,
|
||||
isAgentSessionForkSourceAdmissionRefusal,
|
||||
isAgentSessionCreateAdmissionRefusal
|
||||
} from '../../../src/shared/agent-session/failures/agent-session-definitive-refusal'
|
||||
} from '../../../../../src/shared/agent-session/failures/agent-session-definitive-refusal'
|
||||
import {
|
||||
createStructuredAgentSessionId,
|
||||
structuredAgentSessionCreateParams,
|
||||
type StructuredAgentSessionCreateParams,
|
||||
type StructuredAgentSessionForkSource
|
||||
} from '../../../src/shared/agent-session/structured-agent-session-create'
|
||||
import type { StructuredAgentCreateSupportReply } from '../../../src/shared/agent-session/structured-agent-create-support-reply'
|
||||
import { TUI_AGENT_DISPLAY_NAMES } from '../../../src/shared/agent-launch/catalog/tui-agent-display-names'
|
||||
import { hasRuntimeRpcErrorCode } from '../../../src/shared/runtime-rpc-error-code'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
} from '../../../../../src/shared/agent-session/structured-agent-session-create'
|
||||
import type { StructuredAgentCreateSupportReply } from '../../../../../src/shared/agent-session/structured-agent-create-support-reply'
|
||||
import { TUI_AGENT_DISPLAY_NAMES } from '../../../../../src/shared/agent-launch/catalog/tui-agent-display-names'
|
||||
import { hasRuntimeRpcErrorCode } from '../../../../../src/shared/runtime-rpc-error-code'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import {
|
||||
structuredAgentSessionCreate,
|
||||
structuredAgentSupportProbe
|
||||
} from './native-chat/agent-session/mobile-structured-create-operations'
|
||||
import { randomV4Uuid } from '../platform/random-v4-uuid'
|
||||
} from './mobile-structured-create-operations'
|
||||
import { randomV4Uuid } from '../../../platform/random-v4-uuid'
|
||||
import { rememberMobileCreatedStructuredSession } from './mobile-created-structured-sessions'
|
||||
|
||||
// Partial: the reply is read before it is checked.
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { AgentSessionMutationResult } from '../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { AgentSessionMutationResult } from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import type {
|
||||
AgentSessionWireRefusalCode,
|
||||
AgentSessionRefusalReference
|
||||
} from '../../../src/shared/agent-session/failures/agent-session-wire-refusals'
|
||||
import type { AgentJournalCursor } from '../../../src/shared/agent-session/journal/agent-session-journal-identity'
|
||||
import { structuredAgentSessionPayloadFingerprint } from '../../../src/shared/agent-session/lifecycle/structured-agent-session-mutation'
|
||||
import { agentSessionWriteNoticeParts } from '../../../src/shared/agent-session/failures/agent-session-refusal-notice'
|
||||
} from '../../../../../src/shared/agent-session/failures/agent-session-wire-refusals'
|
||||
import type { AgentJournalCursor } from '../../../../../src/shared/agent-session/journal/agent-session-journal-identity'
|
||||
import { structuredAgentSessionPayloadFingerprint } from '../../../../../src/shared/agent-session/lifecycle/structured-agent-session-mutation'
|
||||
import { agentSessionWriteNoticeParts } from '../../../../../src/shared/agent-session/failures/agent-session-refusal-notice'
|
||||
import {
|
||||
agentSessionRefusalFailure,
|
||||
agentSessionThrownFailure,
|
||||
@@ -13,14 +13,14 @@ import {
|
||||
readAgentSessionErrorRefusal,
|
||||
type AgentSessionWriteFailure,
|
||||
type AgentSessionWriteKind
|
||||
} from '../../../src/shared/agent-session/failures/agent-session-write-failure'
|
||||
} from '../../../../../src/shared/agent-session/failures/agent-session-write-failure'
|
||||
import { mobileAgentSessionWriteNoticeText } from './agent-session-write-notice-copy'
|
||||
import { structuredSessionOperationId } from './structured-session-operation-id'
|
||||
import { isRpcDeliveryUnknown } from '../transport/rpc/rpc-delivery-ambiguity'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import '../transport/connection/stable-logical-rpc-client'
|
||||
import { isLogicalClientCutoverError } from '../transport/connection/logical-client-cutover-error'
|
||||
import { MOBILE_NATIVE_CHAT_MIN_WRITE_TIMEOUT_MS } from './native-chat/mobile-native-chat-send'
|
||||
import { isRpcDeliveryUnknown } from '../../../transport/rpc/rpc-delivery-ambiguity'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import '../../../transport/connection/stable-logical-rpc-client'
|
||||
import { isLogicalClientCutoverError } from '../../../transport/connection/logical-client-cutover-error'
|
||||
import { MOBILE_NATIVE_CHAT_MIN_WRITE_TIMEOUT_MS } from '../composer/mobile-native-chat-send'
|
||||
|
||||
export const STRUCTURED_SEND_TIMEOUT_MS = 15_000
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import type { AgentSessionSendResult } from '../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { AgentJournalCursor } from '../../../src/shared/agent-session/journal/agent-session-journal-identity'
|
||||
import type { AgentJournalSkillRef } from '../../../src/shared/agent-session/journal/agent-session-journal-types'
|
||||
import type { AgentSessionSendResult } from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { AgentJournalCursor } from '../../../../../src/shared/agent-session/journal/agent-session-journal-identity'
|
||||
import type { AgentJournalSkillRef } from '../../../../../src/shared/agent-session/journal/agent-session-journal-types'
|
||||
import {
|
||||
structuredAgentSessionSendBody,
|
||||
type StructuredAgentSessionAttachment
|
||||
} from '../../../src/shared/agent-session/requests/structured-agent-session-send-mutation'
|
||||
import { structuredAgentSessionBlocksTooLarge } from '../../../src/shared/rpc-contract/structured-agent-session-message-params'
|
||||
import { AGENT_SESSION_MESSAGE_TOO_LARGE_PARTS } from '../../../src/shared/agent-session/failures/agent-session-refusal-notice'
|
||||
} from '../../../../../src/shared/agent-session/requests/structured-agent-session-send-mutation'
|
||||
import { structuredAgentSessionBlocksTooLarge } from '../../../../../src/shared/rpc-contract/structured-agent-session-message-params'
|
||||
import { AGENT_SESSION_MESSAGE_TOO_LARGE_PARTS } from '../../../../../src/shared/agent-session/failures/agent-session-refusal-notice'
|
||||
import { mobileAgentSessionWriteNoticeText } from './agent-session-write-notice-copy'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import type { MobileNativeChatSendOutcome } from './native-chat/mobile-native-chat-send'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import type { MobileNativeChatSendOutcome } from '../composer/mobile-native-chat-send'
|
||||
import {
|
||||
requestStructuredAgentSessionMutation,
|
||||
timeoutForDeadline
|
||||
} from './mobile-structured-agent-session-rpc'
|
||||
import { mobileStructuredSendDelivery } from './mobile-structured-send-delivery'
|
||||
import type { MobileNativeChatSendErrorReporter } from './native-chat/use-mobile-native-chat-send-error'
|
||||
import { mobileStructuredSendDelivery } from '../composer/mobile-structured-send-delivery'
|
||||
import type { MobileNativeChatSendErrorReporter } from '../composer/use-mobile-native-chat-send-error'
|
||||
|
||||
export async function sendMobileStructuredAgentSessionMessage(input: {
|
||||
client: RpcClient
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { StructuredAgentSessionState } from '../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import type { StructuredAgentSessionState } from '../../../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import {
|
||||
runningStructuredAgentSessionTurnId,
|
||||
structuredAgentSessionHostSaysWorking
|
||||
} from '../../../src/shared/agent-session/view/structured-agent-session-live-turn'
|
||||
import { isStructuredAgentSessionMainAgentWorking } from '../../../src/shared/agent-session/view/structured-agent-session-main-agent-working'
|
||||
} from '../../../../../src/shared/agent-session/view/structured-agent-session-live-turn'
|
||||
import { isStructuredAgentSessionMainAgentWorking } from '../../../../../src/shared/agent-session/view/structured-agent-session-main-agent-working'
|
||||
|
||||
export function mobileStructuredAgentSessionWorking(state: StructuredAgentSessionState): boolean {
|
||||
return structuredAgentSessionHostSaysWorking(state.working, () =>
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { StructuredAgentHostClock } from '../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import type { StructuredAgentHostClock } from '../../../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
|
||||
// Ignore delivery jitter below the precision of displayed clocks.
|
||||
const OFFSET_GRAIN_MS = 1_000
|
||||
@@ -1,6 +1,6 @@
|
||||
import { formatAgentTypeLabel } from '../../../src/shared/agent-status/presentation/agent-type-label'
|
||||
import type { StructuredSessionOpenFailure } from '../../../src/shared/open-structured-agent-session'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
import { formatAgentTypeLabel } from '../../../../../src/shared/agent-status/presentation/agent-type-label'
|
||||
import type { StructuredSessionOpenFailure } from '../../../../../src/shared/open-structured-agent-session'
|
||||
import { translate } from '../../../i18n/mobile-i18n'
|
||||
|
||||
export function mobileStructuredSessionOpenMessage(
|
||||
reason: StructuredSessionOpenFailure['reason'],
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as z from 'zod'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc/rpc-operation'
|
||||
import { rpcResultVariant } from '../transport/rpc/rpc-operation-result-reader'
|
||||
import type { RpcMethodName } from '../../../src/shared/rpc-contract/rpc-params-catalog.generated'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../../../transport/rpc/rpc-operation'
|
||||
import { rpcResultVariant } from '../../../transport/rpc/rpc-operation-result-reader'
|
||||
import type { RpcMethodName } from '../../../../../src/shared/rpc-contract/rpc-params-catalog.generated'
|
||||
|
||||
function openingRead<Method extends RpcMethodName, Schema extends z.ZodType>(
|
||||
method: Method,
|
||||
@@ -1,10 +1,10 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { AgentSessionStatusSummary } from '../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import type { ConnectionState } from '../transport/connection/connection-state'
|
||||
import '../transport/connection/stable-logical-rpc-client'
|
||||
import type { AgentSessionStatusSummary } from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import type { ConnectionState } from '../../../transport/connection/connection-state'
|
||||
import '../../../transport/connection/stable-logical-rpc-client'
|
||||
import { mobileStructuredSessionStatusFeed } from './mobile-structured-session-status-feed'
|
||||
import { stubRpcClient } from '../transport/rpc/rpc-client-test-stub'
|
||||
import { stubRpcClient } from '../../../transport/rpc/rpc-client-test-stub'
|
||||
|
||||
function summary(stopping: boolean): AgentSessionStatusSummary {
|
||||
return {
|
||||
@@ -5,14 +5,14 @@ import {
|
||||
foldAgentSessionStatusEvent,
|
||||
revokeAgentSessionStatusLive,
|
||||
type AgentSessionStatusSnapshot
|
||||
} from '../../../src/shared/agent-session/view/agent-session-status-snapshot-fold'
|
||||
import type { AgentSessionStatusEvent } from '../../../src/shared/agent-session/agent-session-wire'
|
||||
} from '../../../../../src/shared/agent-session/view/agent-session-status-snapshot-fold'
|
||||
import type { AgentSessionStatusEvent } from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import {
|
||||
foldAgentSessionConversationNames,
|
||||
type AgentSessionConversationNames
|
||||
} from '../../../src/shared/agent-session/agent-session-conversation-names'
|
||||
import { isMobileMethodUnavailableError } from '../transport/rpc/mobile-method-unavailable'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
} from '../../../../../src/shared/agent-session/agent-session-conversation-names'
|
||||
import { isMobileMethodUnavailableError } from '../../../transport/rpc/mobile-method-unavailable'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
|
||||
export type MobileStructuredSessionStatusFeed = {
|
||||
subscribe: (listener: () => void) => () => void
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentSessionSubscribeEvent } from '../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { StructuredAgentSessionLiveSubscribe } from '../../../src/shared/agent-session/structured-agent-session-live-read'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import type { AgentSessionSubscribeEvent } from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { StructuredAgentSessionLiveSubscribe } from '../../../../../src/shared/agent-session/structured-agent-session-live-read'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
|
||||
function isSubscribeEvent(value: unknown): value is AgentSessionSubscribeEvent {
|
||||
if (typeof value !== 'object' || value === null || !('type' in value)) {
|
||||
@@ -4,17 +4,17 @@ import {
|
||||
type StructuredSessionOpenSource,
|
||||
type StructuredSessionOpenTab,
|
||||
type StructuredSessionOpenTarget
|
||||
} from '../../../src/shared/open-structured-agent-session'
|
||||
import { isStructuredAgentId } from '../../../src/shared/agent-session/lifecycle/agent-session-provider-handle-encoding'
|
||||
import { structuredAgentSessionPaneKey } from '../../../src/shared/agent-session/view/structured-agent-session-projection'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
} from '../../../../../src/shared/open-structured-agent-session'
|
||||
import { isStructuredAgentId } from '../../../../../src/shared/agent-session/lifecycle/agent-session-provider-handle-encoding'
|
||||
import { structuredAgentSessionPaneKey } from '../../../../../src/shared/agent-session/view/structured-agent-session-projection'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import {
|
||||
structuredOpenLocation,
|
||||
structuredOpenParty,
|
||||
structuredOpenReveal,
|
||||
structuredOpenTabs
|
||||
} from './mobile-structured-session-open-rpc'
|
||||
import { sessionTabActivate } from './tabs/mobile-session-tab-write-operations'
|
||||
import { sessionTabActivate } from '../../tabs/mobile-session-tab-write-operations'
|
||||
|
||||
/** The workspace client already carries executionHost; a single budget includes connect waits. */
|
||||
export async function openMobileStructuredSession(args: {
|
||||
@@ -1,7 +1,7 @@
|
||||
// Keep id generation dependency-free so create/tasks callers do not pull in the native-chat write graph.
|
||||
|
||||
import { createStructuredAgentSessionOperationId } from '../../../src/shared/agent-session/lifecycle/structured-agent-session-mutation'
|
||||
import { randomV4Uuid } from '../platform/random-v4-uuid'
|
||||
import { createStructuredAgentSessionOperationId } from '../../../../../src/shared/agent-session/lifecycle/structured-agent-session-mutation'
|
||||
import { randomV4Uuid } from '../../../platform/random-v4-uuid'
|
||||
|
||||
export function structuredSessionOperationId(now: number = Date.now()): string {
|
||||
return createStructuredAgentSessionOperationId(randomV4Uuid, now)
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback } from 'react'
|
||||
import type { StructuredAgentSessionState } from '../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import type { StructuredAgentSessionState } from '../../../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import {
|
||||
requestStructuredAgentSessionMutation,
|
||||
type StructuredAgentSessionMutationResult
|
||||
@@ -1,24 +1,24 @@
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { AGENT_SESSION_CONVERSATION_COMMAND_TIMEOUT_MS } from '../../../src/shared/agent-session/agent-session-conversation-command'
|
||||
import { AGENT_SESSION_PHONE_REWIND_RUNTIME_CAPABILITY } from '../../../src/shared/agent-session/agent-session-runtime-capabilities'
|
||||
import type { AgentSessionRewindResult } from '../../../src/shared/agent-session/lifecycle/agent-session-rewind'
|
||||
import { AGENT_SESSION_CONVERSATION_COMMAND_TIMEOUT_MS } from '../../../../../src/shared/agent-session/agent-session-conversation-command'
|
||||
import { AGENT_SESSION_PHONE_REWIND_RUNTIME_CAPABILITY } from '../../../../../src/shared/agent-session/agent-session-runtime-capabilities'
|
||||
import type { AgentSessionRewindResult } from '../../../../../src/shared/agent-session/lifecycle/agent-session-rewind'
|
||||
import {
|
||||
createAgentSessionRewindHook,
|
||||
type AgentSessionRewindInput,
|
||||
type AgentSessionRewindSendOutcome
|
||||
} from '../../../src/shared/agent-session/lifecycle/agent-session-rewind-request'
|
||||
import type { StructuredAgentSessionState } from '../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import { actionableStructuredPrompts } from './mobile-structured-actionable-prompt'
|
||||
import { useRouteRelaysCapability } from '../worktree/workspace-server-context'
|
||||
import { sayMobileNativeChatRewind } from './native-chat/mobile-native-chat-rewind-copy'
|
||||
import type { MobileNativeChatSendOutcome } from './native-chat/mobile-native-chat-send'
|
||||
} from '../../../../../src/shared/agent-session/lifecycle/agent-session-rewind-request'
|
||||
import type { StructuredAgentSessionState } from '../../../../../src/shared/agent-session/structured-agent-session-reducer'
|
||||
import { actionableStructuredPrompts } from '../input/mobile-structured-actionable-prompt'
|
||||
import { useRouteRelaysCapability } from '../../../worktree/workspace-server-context'
|
||||
import { sayMobileNativeChatRewind } from '../mobile-native-chat-rewind-copy'
|
||||
import type { MobileNativeChatSendOutcome } from '../composer/mobile-native-chat-send'
|
||||
import { requestStructuredAgentSessionMutation } from './mobile-structured-agent-session-rpc'
|
||||
import { returnMobileNativeChatMessageToComposer } from './mobile-native-chat-message-hand-back'
|
||||
import type { useMobileStructuredAgentOptions } from './use-mobile-structured-agent-options'
|
||||
import { returnMobileNativeChatMessageToComposer } from '../composer/mobile-native-chat-message-hand-back'
|
||||
import type { useMobileStructuredAgentOptions } from '../input/use-mobile-structured-agent-options'
|
||||
import type { MobileStructuredAgentSessionArgs } from './mobile-structured-agent-session-contract'
|
||||
import type { MobileStructuredBackgroundTasks } from './use-mobile-structured-background-tasks'
|
||||
import type { MobileStructuredSendsOut } from './use-mobile-structured-stop-offer'
|
||||
import { tuiAgentDisplayName } from '../../../src/shared/agent-launch/catalog/tui-agent-display-names'
|
||||
import type { MobileStructuredBackgroundTasks } from '../input/use-mobile-structured-background-tasks'
|
||||
import type { MobileStructuredSendsOut } from '../composer/use-mobile-structured-stop-offer'
|
||||
import { tuiAgentDisplayName } from '../../../../../src/shared/agent-launch/catalog/tui-agent-display-names'
|
||||
|
||||
const useAgentSessionRewind = createAgentSessionRewindHook(
|
||||
{ useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState },
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
} from '../../../../../src/shared/agent-session/requests/agent-session-queued-message-wire'
|
||||
import type { AgentSessionSubscribeEvent } from '../../../../../src/shared/agent-session/agent-session-wire'
|
||||
import type { RpcResponse } from '../../../transport/rpc/rpc-wire-types'
|
||||
import type { StructuredAgentSessionHostSupport } from '../../mobile-structured-agent-session-host-support'
|
||||
import type { StructuredAgentSessionHostSupport } from './mobile-structured-agent-session-host-support'
|
||||
|
||||
export const SESSION_ID = 'session-1'
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import type { AgentSessionSubscribeEvent } from '../../../../../src/shared/agent
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import type { RpcResponse } from '../../../transport/rpc/rpc-wire-types'
|
||||
import { markRpcDeliveryUnknown } from '../../../transport/rpc/rpc-delivery-ambiguity'
|
||||
import type { StructuredAgentSessionHostSupport } from '../../mobile-structured-agent-session-host-support'
|
||||
import { useMobileStructuredAgentSession } from '../../use-mobile-structured-agent-session'
|
||||
import type { StructuredAgentSessionHostSupport } from './mobile-structured-agent-session-host-support'
|
||||
import { useMobileStructuredAgentSession } from './use-mobile-structured-agent-session'
|
||||
|
||||
import type { RpcClientContextValue } from '../../../transport/connection/rpc-client-context-contract'
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { AgentSessionSubscribeEvent } from '../../../../../src/shared/agent
|
||||
import { createWithQueryClient } from '../../../test-support/query-client-test-renderer'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import type { RpcResponse } from '../../../transport/rpc/rpc-wire-types'
|
||||
import { useMobileStructuredAgentSession } from '../../use-mobile-structured-agent-session'
|
||||
import { useMobileStructuredAgentSession } from './use-mobile-structured-agent-session'
|
||||
import {
|
||||
SESSION_ID,
|
||||
mutationOk,
|
||||
@@ -29,25 +29,6 @@ const row = (
|
||||
observedAt: sequence,
|
||||
body: { kind: 'message', role, blocks: [{ type: 'text', text }] }
|
||||
})
|
||||
const divider = (sequence: number): AgentJournalRenderItem => ({
|
||||
...row(sequence, 'assistant', ''),
|
||||
body: {
|
||||
kind: 'status',
|
||||
text: 'Context cleared',
|
||||
presentation: 'context-cleared',
|
||||
contextClear: { operationId: `clear-${sequence}`, afterFence: 3, clearedAt: sequence }
|
||||
}
|
||||
})
|
||||
const dividerLands = (sequence: number): AgentSessionSubscribeEvent => ({
|
||||
type: 'batch',
|
||||
sessionId: SESSION_ID,
|
||||
batch: {
|
||||
cursor: { epoch: 'epoch-1', sequence },
|
||||
items: [divider(sequence)],
|
||||
removedItemIds: [],
|
||||
submissions: []
|
||||
}
|
||||
})
|
||||
|
||||
describe('useMobileStructuredAgentSession /clear', () => {
|
||||
let renderer: ReactTestRenderer | null = null
|
||||
@@ -132,22 +113,6 @@ describe('useMobileStructuredAgentSession /clear', () => {
|
||||
}
|
||||
}
|
||||
|
||||
it('hides the old transcript from the press until the divider lands', async () => {
|
||||
const chat = await mount()
|
||||
expect(chat.shown()).toEqual({ text: ['question', 'reply'], clearing: false })
|
||||
|
||||
const { outcome } = await chat.sendClear()
|
||||
expect(chat.shown()).toEqual({ text: [], clearing: true })
|
||||
|
||||
// The host's reply can reach the phone before the divider it already wrote.
|
||||
await chat.reply({ command: 'clear', state: 'completed' })
|
||||
await expect(outcome).resolves.toBe('accepted')
|
||||
expect(chat.shown()).toEqual({ text: [], clearing: true })
|
||||
|
||||
chat.push(dividerLands(3))
|
||||
expect(chat.shown()).toEqual({ text: ['Context cleared'], clearing: false })
|
||||
})
|
||||
|
||||
it('shows the old transcript again when the host refuses the /clear', async () => {
|
||||
const chat = await mount()
|
||||
const { outcome } = await chat.sendClear()
|
||||
|
||||
@@ -7,12 +7,12 @@ import { agentJournalItemKey } from '../../../../../src/shared/agent-session/jou
|
||||
import { AGENT_SESSION_PHONE_CONTINUE_INTERRUPTED_RUNTIME_CAPABILITY } from '../../../../../src/shared/agent-session/agent-session-continue-interrupted-capability'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import type { RpcResponse } from '../../../transport/rpc/rpc-wire-types'
|
||||
import { structuredAgentSessionHostSupport } from '../../mobile-structured-agent-session-host-support'
|
||||
import { structuredAgentSessionHostSupport } from './mobile-structured-agent-session-host-support'
|
||||
import {
|
||||
snapshotEvent,
|
||||
SESSION_ID
|
||||
} from './use-mobile-structured-agent-session-queued.test-fixture'
|
||||
import { useMobileStructuredAgentSession } from '../../use-mobile-structured-agent-session'
|
||||
import { useMobileStructuredAgentSession } from './use-mobile-structured-agent-session'
|
||||
|
||||
vi.mock('@react-native-async-storage/async-storage', () => ({
|
||||
default: { getItem: vi.fn(async () => null), setItem: vi.fn(), removeItem: vi.fn() }
|
||||
|
||||
@@ -4,16 +4,16 @@ import {
|
||||
fieldsOf,
|
||||
mutationOk,
|
||||
ok
|
||||
} from './native-chat/agent-session/use-mobile-structured-agent-session-queued.test-fixture'
|
||||
} from './use-mobile-structured-agent-session-queued.test-fixture'
|
||||
import { act, type ReactTestRenderer } from 'react-test-renderer'
|
||||
import { createWithQueryClient } from '../test-support/query-client-test-renderer'
|
||||
import { createWithQueryClient } from '../../../test-support/query-client-test-renderer'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { AgentJournalRenderItem } from '../../../src/shared/agent-session/journal/agent-session-journal-types'
|
||||
import type { AgentJournalRenderItem } from '../../../../../src/shared/agent-session/journal/agent-session-journal-types'
|
||||
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import type { ConnectionState } from '../transport/connection/connection-state'
|
||||
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
|
||||
import type { ConnectionState } from '../../../transport/connection/connection-state'
|
||||
|
||||
import { structuredSendResultFixture } from './structured-agent-send-result.test-fixture'
|
||||
import { structuredSendResultFixture } from '../../structured-agent-send-result.test-fixture'
|
||||
import { useMobileStructuredAgentSession } from './use-mobile-structured-agent-session'
|
||||
|
||||
const asyncStorage = vi.hoisted(() => ({
|
||||
@@ -1,57 +1,57 @@
|
||||
import { asyncQuestionSourceScope as questionSourceScope } from '../../../src/shared/native-chat/input/native-chat-ask'
|
||||
import { structuredChatTranscriptIdentity } from './native-chat/mobile-native-chat-transcript-store'
|
||||
import { asyncQuestionSourceScope as questionSourceScope } from '../../../../../src/shared/native-chat/input/native-chat-ask'
|
||||
import { structuredChatTranscriptIdentity } from '../transcript/mobile-native-chat-transcript-store'
|
||||
import { useMemo, useRef } from 'react'
|
||||
import { tuiAgentDisplayName } from '../../../src/shared/agent-launch/catalog/tui-agent-display-names'
|
||||
import { tuiAgentDisplayName } from '../../../../../src/shared/agent-launch/catalog/tui-agent-display-names'
|
||||
import { mobileStructuredAgentSessionWorking } from './mobile-structured-agent-session-working'
|
||||
import { isFinalAgentSessionReadRefusal } from '../../../src/shared/agent-session/failures/structured-agent-session-read-refusal'
|
||||
import { isFinalAgentSessionReadRefusal } from '../../../../../src/shared/agent-session/failures/structured-agent-session-read-refusal'
|
||||
import {
|
||||
runningStructuredAgentSessionTurnId,
|
||||
structuredAgentSessionQueueSendsNext
|
||||
} from '../../../src/shared/agent-session/view/structured-agent-session-live-turn'
|
||||
} from '../../../../../src/shared/agent-session/view/structured-agent-session-live-turn'
|
||||
import {
|
||||
actionableStructuredApproval,
|
||||
actionableStructuredQuestion
|
||||
} from './mobile-structured-actionable-prompt'
|
||||
} from '../input/mobile-structured-actionable-prompt'
|
||||
import {
|
||||
projectStructuredPermission,
|
||||
projectStructuredQuestion
|
||||
} from './mobile-structured-agent-prompts'
|
||||
} from '../input/mobile-structured-agent-prompts'
|
||||
import type {
|
||||
MobileStructuredAgentSessionArgs,
|
||||
StructuredMobileSession
|
||||
} from './mobile-structured-agent-session-contract'
|
||||
import type { MobileNativeChatVisualSource } from './native-chat/visual/mobile-native-chat-visual-read'
|
||||
import type { MobileNativeChatVisualSource } from '../visual/mobile-native-chat-visual-read'
|
||||
import { useMobileStructuredAgentState } from './use-mobile-structured-agent-state'
|
||||
import { useMobileStructuredStopPress } from './use-mobile-structured-stop-press'
|
||||
import { useMobileStructuredStopPress } from '../composer/use-mobile-structured-stop-press'
|
||||
import { useMobileStructuredSessionHostStopping } from './use-mobile-structured-session-host-stopping'
|
||||
import { useMobileStructuredPromptResponses } from './use-mobile-structured-prompt-responses'
|
||||
import { useMobileStructuredAgentOptions } from './use-mobile-structured-agent-options'
|
||||
import { useHostModelCatalogCache } from './mobile-host-model-catalog-query'
|
||||
import { useMobileStructuredCommandController } from './use-mobile-structured-command-controller'
|
||||
import { useMobileStructuredSessionOptionStamp } from './use-mobile-structured-session-option-stamp'
|
||||
import { useMobileStructuredAgentTurnTiming } from './use-mobile-structured-agent-turn-timing'
|
||||
import { useMobileStructuredPromptResponses } from '../input/use-mobile-structured-prompt-responses'
|
||||
import { useMobileStructuredAgentOptions } from '../input/use-mobile-structured-agent-options'
|
||||
import { useHostModelCatalogCache } from '../input/mobile-host-model-catalog-query'
|
||||
import { useMobileStructuredCommandController } from '../composer/use-mobile-structured-command-controller'
|
||||
import { useMobileStructuredSessionOptionStamp } from '../input/use-mobile-structured-session-option-stamp'
|
||||
import { useMobileStructuredAgentTurnTiming } from '../transcript/use-mobile-structured-agent-turn-timing'
|
||||
import {
|
||||
pendingStructuredPromptIdentity,
|
||||
useMobileStructuredRequestCancel
|
||||
} from './mobile-structured-agent-session-cancel'
|
||||
import { useMobileStructuredAgentMutate } from './use-mobile-structured-agent-mutation'
|
||||
import { useMobileStructuredSendWithOutcome } from './use-mobile-structured-send-with-outcome'
|
||||
import { useMobileStructuredQueuedMessageControls } from './use-mobile-structured-queued-message-controls'
|
||||
import { useMobileStructuredBackgroundTasks } from './use-mobile-structured-background-tasks'
|
||||
import { useMobileStructuredSends } from './use-mobile-structured-sends'
|
||||
import { useMobileStructuredSendRecorded } from './mobile-structured-send-recorded-read'
|
||||
import { useMobileNativeChatQueueFollowUps as useQueueFollowUps } from './use-mobile-native-chat-queue-follow-ups'
|
||||
import { useMobileStructuredStopOffer } from './use-mobile-structured-stop-offer'
|
||||
import { useMobileStructuredTurnIndicator } from './use-mobile-structured-turn-indicator'
|
||||
import { useMobileStructuredContextUsage } from './use-mobile-structured-context-usage'
|
||||
import { useMobileStructuredInterruptedContinue } from './use-mobile-structured-interrupted-continue'
|
||||
import { useMobileStructuredSendWithOutcome } from '../composer/use-mobile-structured-send-with-outcome'
|
||||
import { useMobileStructuredQueuedMessageControls } from '../input/use-mobile-structured-queued-message-controls'
|
||||
import { useMobileStructuredBackgroundTasks } from '../input/use-mobile-structured-background-tasks'
|
||||
import { useMobileStructuredSends } from '../composer/use-mobile-structured-sends'
|
||||
import { useMobileStructuredSendRecorded } from '../composer/mobile-structured-send-recorded-read'
|
||||
import { useMobileNativeChatQueueFollowUps as useQueueFollowUps } from '../preferences/use-mobile-native-chat-queue-follow-ups'
|
||||
import { useMobileStructuredStopOffer } from '../composer/use-mobile-structured-stop-offer'
|
||||
import { useMobileStructuredTurnIndicator } from '../transcript/use-mobile-structured-turn-indicator'
|
||||
import { useMobileStructuredContextUsage } from '../composer/use-mobile-structured-context-usage'
|
||||
import { useMobileStructuredInterruptedContinue } from '../composer/use-mobile-structured-interrupted-continue'
|
||||
import {
|
||||
useMobileStructuredThreadGoal,
|
||||
useMobileStructuredThreadGoalSend
|
||||
} from './use-mobile-structured-thread-goal'
|
||||
import { useMobileStructuredTranscript } from './use-mobile-structured-transcript'
|
||||
} from '../input/use-mobile-structured-thread-goal'
|
||||
import { useMobileStructuredTranscript } from '../transcript/use-mobile-structured-transcript'
|
||||
import { useMobileStructuredAgentRewind } from './use-mobile-structured-agent-rewind'
|
||||
import { useMobileNativeChatUsageLimit } from './native-chat/use-mobile-native-chat-usage-limit'
|
||||
import { useMobileNativeChatUsageLimit } from '../use-mobile-native-chat-usage-limit'
|
||||
|
||||
export function useMobileStructuredAgentSession(
|
||||
args: MobileStructuredAgentSessionArgs
|
||||