Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
{ "path": "../../packages/provision-kit" },
{ "path": "../../packages/proxy" },
{ "path": "../../packages/react-native" },
{ "path": "../../packages/remote" },
{ "path": "../../packages/replay-port" },
{ "path": "../../packages/replay-test" },
{ "path": "../../packages/selectors" },
Expand Down
4 changes: 2 additions & 2 deletions oxlint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export default defineConfig({
files: [
'src/daemon-client/daemon-client-rpc.ts',
'packages/daemon/src/server/downloadable-artifact-http.ts',
'src/remote/remote-request-diagnostics.ts',
'src/remote/upload-stream.ts',
'packages/remote/src/remote-request-diagnostics.ts',
'packages/remote/src/upload-stream.ts',
],
rules: {
'unicorn/catch-error-name': 'off',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
"@agent-device/provision-kit": "workspace:*",
"@agent-device/proxy": "workspace:*",
"@agent-device/react-native": "workspace:*",
"@agent-device/remote": "workspace:*",
"@agent-device/replay-port": "workspace:*",
"@agent-device/replay-test": "workspace:*",
"@agent-device/selectors": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SIMPLE_PUBLISHERS = [
new URL('../provider-lease-expiry.ts', import.meta.url),
new URL('../../core/session-script-writer.ts', import.meta.url),
new URL('../../../../../packages/platform-apple/src/runner/runner-lease.ts', import.meta.url),
new URL('../../../../../src/remote/remote-connection-state.ts', import.meta.url),
new URL('../../../../../packages/remote/src/remote-connection-state.ts', import.meta.url),
] as const;

const PROCESS_LOCK_SOURCE = new URL(
Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/src/server/request-diagnostics-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* DAEMON host. A remote caller — a CI runner driving an EAS/limrun simulator —
* cannot read that filesystem, so the record has to be reachable over the same
* base URL and token the caller already holds. The client side is
* `src/remote/remote-request-diagnostics.ts`.
* `packages/remote/src/remote-request-diagnostics.ts`.
*
* Scope: exactly one record, addressed the way the error names it
* (`DaemonError.diagnosticsRecord`). A record that was never written (the
Expand Down
43 changes: 43 additions & 0 deletions packages/remote/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@agent-device/remote",
"version": "0.0.0",
"private": true,
"type": "module",
"description": "Remote-daemon client plumbing: remote config profiles and their provenance, the persisted remote connection state, request artifact upload/download, and remote diagnostics localization. Internal workspace package bundled into the published agent-device artifact.",
"dependencies": {
"@agent-device/capture-kit": "workspace:*",
"@agent-device/contracts": "workspace:*",
"@agent-device/daemon-contracts": "workspace:*",
"@agent-device/host-kit": "workspace:*",
"@agent-device/kernel": "workspace:*"
},
"exports": {
"./daemon-artifacts": {
"types": "./src/daemon-artifacts.ts",
"default": "./src/daemon-artifacts.ts"
},
"./remote-config": {
"types": "./src/remote-config.ts",
"default": "./src/remote-config.ts"
},
"./remote-config-core": {
"types": "./src/remote-config-core.ts",
"default": "./src/remote-config-core.ts"
},
"./remote-config-schema": {
"types": "./src/remote-config-schema.ts",
"default": "./src/remote-config-schema.ts"
},
"./remote-connection-state": {
"types": "./src/remote-connection-state.ts",
"default": "./src/remote-connection-state.ts"
},
"./remote-request-diagnostics": {
"types": "./src/remote-request-diagnostics.ts",
"default": "./src/remote-request-diagnostics.ts"
}
},
"devDependencies": {
"@agent-device/test-kit": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
import { test } from 'vitest';
import { test, vi } from 'vitest';
import assert from 'node:assert/strict';
import { withCapturedStderr } from '../../__tests__/test-utils/stream-capture.ts';
import {
createStderrUploadProgressReporter,
type UploadProgressEvent,
} from '../upload-progress.ts';

function renderEvents(events: UploadProgressEvent[]): string {
return withCapturedStderr(
() => {
const sink = createStderrUploadProgressReporter();
assert.equal(sink !== undefined, true);
for (const event of events) sink!(event);
},
{ interactive: true },
);
let output = '';
const write = vi.spyOn(process.stderr, 'write').mockImplementation((chunk: unknown) => {
output += String(chunk);
return true;
});
vi.stubEnv('CI', undefined);
const isTTYDescriptor = Object.getOwnPropertyDescriptor(process.stderr, 'isTTY');
Object.defineProperty(process.stderr, 'isTTY', { configurable: true, value: true });
try {
const sink = createStderrUploadProgressReporter();
assert.equal(sink !== undefined, true);
for (const event of events) sink!(event);
} finally {
if (isTTYDescriptor) Object.defineProperty(process.stderr, 'isTTY', isTTYDescriptor);
else delete (process.stderr as unknown as Record<string, unknown>).isTTY;
write.mockRestore();
vi.unstubAllEnvs();
}
return output;
}

test('the stderr reporter formats start, resume, progress and fallback events', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions packages/remote/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"noEmit": false,
"emitDeclarationOnly": true,
"declaration": true,
"declarationDir": "./dist-types",
"rootDir": "./src",
"tsBuildInfoFile": "./dist-types/index.tsbuildinfo"
},
"include": ["src"],
"references": [
{ "path": "../capture-kit" },
{ "path": "../contracts" },
{ "path": "../daemon-contracts" },
{ "path": "../host-kit" },
{ "path": "../kernel" },
{ "path": "../test-kit" }
]
}
2 changes: 1 addition & 1 deletion packages/replay-port/src/daemon-port/test-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export async function runReplayTestCommand(command: ReplayTestCommand): Promise<
/**
* #2246: against a remote daemon, the client redirects `--artifacts-dir` to a temp directory on
* THIS host before the suite runs (`prepareRemoteRequestArtifacts` in
* `src/remote/daemon-artifacts.ts`) — the caller's real `cwd` names no path here, so the
* `packages/remote/src/daemon-artifacts.ts`) — the caller's real `cwd` names no path here, so the
* scheduler above must never resolve suite artifacts against it. `req.meta.clientArtifactPaths`
* is how that client tells the daemon the real caller-local ROOT (e.g. `--artifacts-dir`, or its
* default) it will pull the directory back into once the request returns — that root is resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { trimEdgeDashes } from '@agent-device/kernel/collections';
import type { ReplayTestAttemptOutcome } from '@agent-device/replay-test';

/**
* `test`'s default artifacts root when `--artifacts-dir` is not given. `src/remote/daemon-artifacts.ts`
* `test`'s default artifacts root when `--artifacts-dir` is not given. `packages/remote/src/daemon-artifacts.ts`
* keeps its own copy of this literal (to redirect a remote request without resolving anything
* against the daemon's `cwd`, #2246): pulling it from `@agent-device/contracts` instead grew this
* package's eager import closure by 3 modules for one string, past its pinned budget
Expand Down
25 changes: 25 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/__tests__/help-conformance-sample-producers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
renderConnectSuccess,
} from '../../src/cli/commands/connection-presentation.ts';
import type { ConnectVerification } from '../../src/cli/connection/connect-provider-adapters.ts';
import type { RemoteConnectionState } from '../../src/remote/remote-connection-state.ts';
import type { RemoteConnectionState } from '@agent-device/remote/remote-connection-state';
import { AppError, normalizeError } from '@agent-device/kernel/errors';
import type { SnapshotQualityVerdict } from '@agent-device/kernel/snapshot';
import { renderSnapshotQualityWarnings } from '@agent-device/capture-kit/quality-warnings';
Expand Down
2 changes: 1 addition & 1 deletion scripts/layering/architecture-ownership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const CLIENT_SIDE_POLICY_NAME = 'client-side';
export const LOGICAL_MODULE_POLICIES = [
{
name: CLIENT_SIDE_POLICY_NAME,
roots: ['src/cli.ts', 'src/cli/', 'src/client/', 'src/remote/', 'src/daemon-client/'],
roots: ['src/cli.ts', 'src/cli/', 'src/client/', 'packages/remote/src/', 'src/daemon-client/'],
forbiddenTargetRoots: [DAEMON_SOURCE_ROOT],
},
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/layering/daemon-modularity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ for (const file of [
'src/cli.ts',
'src/cli/commands/daemon.ts',
'src/client/client-normalizers.ts',
'src/remote/daemon-artifacts.ts',
'packages/remote/src/daemon-artifacts.ts',
'src/daemon-client/daemon-client.ts',
]) {
for (const [kind, source] of [
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-agent-cdp-session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { installIsolatedCliTestEnv } from './cli-test-env.ts';
import {
hashRemoteConfigFile,
writeRemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import type { DaemonResponse } from '../daemon-client/daemon-client.ts';

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-close.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
seedConnectionState,
type StoredConnectionSeed,
} from './remote-connection.fixtures.ts';
import { readRemoteConnectionState } from '../remote/remote-connection-state.ts';
import { readRemoteConnectionState } from '@agent-device/remote/remote-connection-state';
import type { DaemonRequest, DaemonResponse } from '../daemon-client/daemon-client.ts';

function runCliWithDaemonStartupFailure(argv: string[]): Promise<CapturedCliRun> {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-config-limrun.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
hashRemoteConfigFile,
readActiveConnectionState,
writeRemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import { runCliCapture } from './cli-capture.ts';
import { makeTempWorkspace } from './cli-config-fixtures.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
hashRemoteConfigFile,
readActiveConnectionState,
readRemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import { runCliCapture, type CapturedDaemonRequest } from './cli-capture.ts';
import { makeTempWorkspace } from './cli-config-fixtures.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-react-devtools-session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { installIsolatedCliTestEnv } from './cli-test-env.ts';
import {
hashRemoteConfigFile,
writeRemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import type { DaemonResponse } from '../daemon-client/daemon-client.ts';

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cloud-connect-auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'node:path';
import { connectCommand } from '../cli/commands/connection.ts';
import { beginStdoutCapture } from './test-utils/stream-capture.ts';
import { resolveCloudAccessForConnect } from '../cli/auth-session.ts';
import { readActiveConnectionState } from '../remote/remote-connection-state.ts';
import { readActiveConnectionState } from '@agent-device/remote/remote-connection-state';
import type { AgentDeviceClient } from '../agent-device-client.ts';
import { mkdtempForTestSync } from '@agent-device/test-kit';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cloud-connect-profile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
readActiveConnectionState,
readRemoteConnectionState,
type RemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import type { AgentDeviceClient } from '../agent-device-client.ts';
import { resolveConnectProviderProfile } from '../cli/connection/connect-provider-adapters.ts';
import { AppError } from '@agent-device/kernel/errors';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cloud-connect-testmu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { runCliCapture } from './cli-capture.ts';
import {
readActiveConnectionState,
type RemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import { AppError } from '@agent-device/kernel/errors';
import { verifyTestMuConnection } from '@agent-device/testmu/connection-verification';
import testMuPlugin from '@agent-device/testmu';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/lease-provider-profile-fields.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { createProviderDeviceRuntimeRequestProviders } from '../provider-device-
import {
hashRemoteConfigFile,
writeRemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import { createTransport } from './client-transport-fixture.ts';
import { runCliCapture } from './cli-capture.ts';
import { makeTempWorkspace } from './cli-config-fixtures.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/remote-connection-harmonyos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
resolveRequestedLeaseBackend,
} from '../cli/commands/connection-runtime.ts';
import { disconnectCommand } from '../cli/commands/connection.ts';
import { readRemoteConnectionState } from '../remote/remote-connection-state.ts';
import { readRemoteConnectionState } from '@agent-device/remote/remote-connection-state';
import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry';

test('HarmonyOS platform resolves to its proxy lease backend', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/remote-connection-macos-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { AgentDeviceClient } from '../agent-device-client.ts';
import { connectCommand, disconnectCommand } from '../cli/commands/connection.ts';
import { materializeRemoteConnectionForCommand } from '../cli/commands/connection-runtime.ts';
import { beginStdoutCapture } from './test-utils/stream-capture.ts';
import { readRemoteConnectionState } from '../remote/remote-connection-state.ts';
import { readRemoteConnectionState } from '@agent-device/remote/remote-connection-state';
import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry';

const LEASE_ID = 'a1b2c3d4e5f60718293a4b5c6d7e8f90';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/remote-connection-platform-axis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { connectCommand } from '../cli/commands/connection.ts';
import { materializeRemoteConnectionForCommand } from '../cli/commands/connection-runtime.ts';
import { AppError } from '@agent-device/kernel/errors';
import { readRemoteConnectionState } from '../remote/remote-connection-state.ts';
import { readRemoteConnectionState } from '@agent-device/remote/remote-connection-state';

afterEach(() => {
vi.clearAllMocks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ vi.mock('@agent-device/react-native', async (importOriginal) => ({
}));

import { materializeRemoteConnectionForCommand } from '../cli/commands/connection-runtime.ts';
import { readRemoteConnectionState } from '../remote/remote-connection-state.ts';
import { readRemoteConnectionState } from '@agent-device/remote/remote-connection-state';

const IPHONE_SIMULATOR = {
platform: 'ios',
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/remote-connection-proxy-lease-id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ vi.mock('@agent-device/react-native', async (importOriginal) => ({
}));

import { materializeRemoteConnectionForCommand } from '../cli/commands/connection-runtime.ts';
import { readRemoteConnectionState } from '../remote/remote-connection-state.ts';
import { readRemoteConnectionState } from '@agent-device/remote/remote-connection-state';

const DAEMON_LEASE_ID = 'abc123abc123abc1';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/remote-connection.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
hashRemoteConfigFile,
writeRemoteConnectionState,
type RemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import { mkdtempForTestSync } from '@agent-device/test-kit';

export const unexpectedCommandCall = async (): Promise<never> => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/remote-connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
readActiveConnectionState,
readRemoteConnectionState,
writeRemoteConnectionState,
} from '../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import type { AgentDeviceClient } from '../agent-device-client.ts';

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { maybeRunUpgradeNotifier } from './cli/update-check.ts';
import {
resolveRemoteConnectionDefaults,
type RemoteConnectionRequestMetadata,
} from './remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import { resolveRemoteAuthForCli } from './cli/auth-session.ts';
import type { FlagKey } from '@agent-device/command-registry/flag-types';
import type { CliFlags } from '@agent-device/contracts/command';
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/__tests__/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
hashRemoteConfigFile,
writeRemoteConnectionState,
type RemoteConnectionState,
} from '../../../remote/remote-connection-state.ts';
} from '@agent-device/remote/remote-connection-state';
import { mkdtempForTestSync } from '@agent-device/test-kit';

type ConnectionFixture = {
Expand Down
Loading
Loading