Skip to content
10 changes: 10 additions & 0 deletions packages/command-registry/src/flag-definitions-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,16 @@ export const CONNECTION_FLAG_DEFINITIONS: readonly FlagDefinition[] = [
projectConfig: false,
recorded: false,
},
{
key: 'form',
names: ['--form'],
type: 'string',
usageLabel: '--form <form>',
usageDescription:
'Connect cloud list: show only devices of this form, for example phone or tablet',
projectConfig: false,
recorded: false,
},
{
key: 'sessionLock',
names: ['--session-lock'],
Expand Down
16 changes: 9 additions & 7 deletions packages/command-surface/src/schema/cli-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ export function resolveConfigDefaults(options: {
cwd: string;
cliFlags: CliFlags;
env: EnvMap;
}): ConfigDefaults {
const defaults: ConfigDefaults = { flags: {} };
}): ConfigDefaults & { configFileFlags: Partial<CliFlags> } {
const configFileFlags: Partial<CliFlags> = {};
let devicePin: DevicePin | undefined;
for (const entry of resolveConfigPaths(options.cwd, options.cliFlags.config, options.env)) {
const parsed = loadSingleConfigFile(entry, options.command);
mergeDefinedFlags(defaults.flags, parsed.flags);
if (parsed.devicePin) defaults.devicePin = parsed.devicePin;
mergeDefinedFlags(configFileFlags, parsed.flags);
if (parsed.devicePin) devicePin = parsed.devicePin;
}
const flags = { ...configFileFlags };
if (options.command !== 'help' && !options.cliFlags.help) {
mergeDefinedFlags(defaults.flags, readEnvFlagDefaults(options.env, options.command));
mergeDefinedFlags(flags, readEnvFlagDefaults(options.env, options.command));
}
if (defaults.devicePin) mergeDefinedFlags(defaults.flags, defaults.devicePin.selector);
return defaults;
if (devicePin) mergeDefinedFlags(flags, devicePin.selector);
return { flags, configFileFlags, ...(devicePin && { devicePin }) };
}

type ConfigFileSource = DevicePin['source']['kind'];
Expand Down
4 changes: 2 additions & 2 deletions packages/command-surface/src/schema/command-overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ const SCHEMA_ONLY_CLI_COMMAND_SCHEMAS = {
'List cloud offerings or start a hosted session with a CLI login or AGENT_DEVICE_CLOUD_API_KEY. For a custom cloud API, set AGENT_DEVICE_CLOUD_API_KEY_ORIGIN to the same origin as AGENT_DEVICE_CLOUD_BASE_URL. Use AGENT_DEVICE_DAEMON_AUTH_TOKEN for direct remote daemon connections. Direct providers validate credentials and resources before saving state and print any preparation needed before open.',
},
usageOverride:
'connect [cloud] list [--live] [--json] | connect cloud --platform ios|android [--vendor <id>] [--max-minutes <minutes>] [--max-usd <decimal>] [--app-url <url>] [--needs <capability,...>] [--device <model>] [--os <version>] [--show-viewer] | connect [provider] [--target <target>] [--remote-config <path>] [--daemon-base-url <url>] [--tenant <id>] [--run-id <id>] [--lease-id <id>] [--lease-backend <backend>] [--force] [--no-login]',
'connect [cloud] list [--platform ios|android] [--form <form>] [--device <model>] [--os <version>] [--live] [--json] | connect cloud --platform ios|android [--vendor <id>] [--max-minutes <minutes>] [--max-usd <decimal>] [--app-url <url>] [--needs <capability,...>] [--device <model>] [--os <version>] [--show-viewer] | connect [provider] [--target <target>] [--remote-config <path>] [--daemon-base-url <url>] [--tenant <id>] [--run-id <id>] [--lease-id <id>] [--lease-backend <backend>] [--force] [--no-login]',
usageFlags: [],
listUsageOverride: 'connect',
positionalArgs: ['provider?|list'],
allowedFlags: CONNECT_ALLOWED_FLAGS,
supportedFlags: [...CONNECT_SUPPORTED_FLAGS, 'live'],
supportedFlags: [...CONNECT_SUPPORTED_FLAGS, 'live', 'form'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: --form is advertised but is not accepted by the connect CLI because it was added only to supportedFlags, not CONNECT_ALLOWED_FLAGS. Add form to CONNECT_ALLOWED_FLAGS so connect cloud list --form <form> reaches the request parser.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/command-surface/src/schema/command-overrides.ts, line 143:

<comment>`--form` is advertised but is not accepted by the `connect` CLI because it was added only to `supportedFlags`, not `CONNECT_ALLOWED_FLAGS`. Add `form` to `CONNECT_ALLOWED_FLAGS` so `connect cloud list --form <form>` reaches the request parser.</comment>

<file context>
@@ -135,12 +135,12 @@ const SCHEMA_ONLY_CLI_COMMAND_SCHEMAS = {
     positionalArgs: ['provider?|list'],
     allowedFlags: CONNECT_ALLOWED_FLAGS,
-    supportedFlags: [...CONNECT_SUPPORTED_FLAGS, 'live'],
+    supportedFlags: [...CONNECT_SUPPORTED_FLAGS, 'live', 'form'],
     explicitOnlyFlags: ['target'],
   },
</file context>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catalog listing preflight consumes --form before the normal connect allowed-flag check. The production CLI route test at 62f43d403b verifies that it reaches the query string and that booking refuses it. No flag allowance change was needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI test passed at ae45a2b007: catalog preflight sends form=phone on a listing and refuses --form on a booking. Catalog preflight handles the flag before the shared connect allowed-flag check.

explicitOnlyFlags: ['target'],
},
connection: {
Expand Down
2 changes: 2 additions & 0 deletions packages/command-surface/src/schema/option-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type OptionSpec = {

const CONFIG_EXCLUDED_FLAG_KEYS = new Set<FlagKey>([
'live',
'form',
'config',
'remoteConfig',
'help',
Expand All @@ -28,6 +29,7 @@ const CONFIG_EXCLUDED_FLAG_KEYS = new Set<FlagKey>([

const ENV_EXCLUDED_FLAG_KEYS = new Set<FlagKey>([
'live',
'form',
'appsFilter',
'iosSimulatorDeviceSet',
'textStdin',
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/src/cli-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export type CliFlags = CloudProviderProfileFields &
needs?: string;
showViewer?: boolean;
live?: boolean;
form?: string;
kind?: string;
perfTemplate?: string;
sessionLock?: 'reject' | 'strip';
Expand Down
1 change: 1 addition & 0 deletions scripts/integration-progress-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ function summarizeProviderScenarioFlagExclusions() {
'needs',
'showViewer',
'live',
'form',
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion skills/agent-device/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Copy refs byte-for-byte: `@e12`, `@e12-s4` — keep the `@` and any `-sN`. Prefe

Error output includes corrective hints; follow them instead of re-planning. When your host runs commands in a sandbox and allows `agent-device` by command name, run each call as its own command: do not chain it with `;`, `&&`, or `|`, and do not quote its binary path, or the host's allow rule misses the call and it cannot reach the daemon or the device. If the error is `DEVICE_IN_USE`, another session holds the device: open with `--wait <ms>`, or run `agent-device device status --stale` and then `agent-device device release --stale` to clear a reclaimable owner. Never kill daemon processes with `pkill -f agent-device`. Only when the task is specialized (for example gestures, scripting, TV, macOS, remote, or debugging) or a command shape is unclear, run `agent-device help <topic>`. `agent-device --help` lists topics, `agent-device help commands` lists commands; neither is a startup step.

To capture network traffic on a Limrun session, see `agent-device help remote` or the Limrun docs.
To pick a cloud device, run `agent-device connect cloud list`. Filter it with `--platform`, `--form`, `--device`, or `--os`. Compare the offers for that device and OS. Book one with `agent-device connect cloud --session <name> <book flags>`. If those flags omit `--platform`, pass the platform shown for the offer. To capture network traffic on a Limrun session, see `agent-device help remote` or the Limrun docs.
8 changes: 5 additions & 3 deletions src/__tests__/cli-cloud-api-origin.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { afterEach, expect, test, vi } from 'vitest';
import { readCloudConnection } from '../cli/connection/cloud-connection-record.ts';
import { postCloudAuthJson } from '../cli/cloud-auth-request.ts';
import { listCloudVendors } from '../cli/connection/cloud-catalog.ts';
import { fetchCloudCatalogView } from '../cli/connection/cloud-catalog.ts';
import {
createCloudSession,
readCloudSessionRequest,
Expand Down Expand Up @@ -196,10 +196,12 @@ test.each([401, 404])('sign-in reports a %i web page as not the cloud API', asyn
).rejects.toMatchObject({ details: { reason, origin: access.cloudBaseUrl, status } });
});

test('the vendor catalog reports an origin that serves a web page', async () => {
test('the catalog view reports an origin that serves a web page', async () => {
vi.stubGlobal('fetch', vi.fn().mockResolvedValueOnce(page(200)));

await expect(listCloudVendors(access.cloudBaseUrl, access.accessToken)).rejects.toMatchObject({
await expect(
fetchCloudCatalogView(access.cloudBaseUrl, access.accessToken),
).rejects.toMatchObject({
code: 'COMMAND_FAILED',
details: { reason, origin: access.cloudBaseUrl, status: 200, hint: originHint },
});
Expand Down
Loading
Loading