droidline 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -362,7 +362,8 @@ export class Device extends DeviceCommands {
362
362
  }
363
363
  async _saveImage(cmd, params) {
364
364
  const { path, ...rest } = params;
365
- if (typeof path === "string" && rest.format === undefined) {
365
+ // Only screenshot has a format; pull saves the bytes as they are.
366
+ if (typeof path === "string" && cmd === "screenshot" && rest.format === undefined) {
366
367
  const format = IMAGE_FORMATS[extname(path).toLowerCase()];
367
368
  if (format)
368
369
  rest.format = format;
@@ -129,8 +129,42 @@ export interface App {
129
129
  system?: any;
130
130
  [field: string]: any;
131
131
  }
132
+ export interface Sms {
133
+ id?: any;
134
+ address?: any;
135
+ text?: any;
136
+ time?: any;
137
+ box?: any;
138
+ read?: any;
139
+ mms?: any;
140
+ [field: string]: any;
141
+ }
142
+ export interface Call {
143
+ id?: any;
144
+ number?: any;
145
+ name?: any;
146
+ type?: any;
147
+ time?: any;
148
+ duration?: any;
149
+ [field: string]: any;
150
+ }
151
+ export interface Contact {
152
+ id?: any;
153
+ name?: any;
154
+ numbers?: any;
155
+ emails?: any;
156
+ [field: string]: any;
157
+ }
158
+ export interface FileEntry {
159
+ name?: any;
160
+ path?: any;
161
+ size?: any;
162
+ time?: any;
163
+ dir?: any;
164
+ [field: string]: any;
165
+ }
132
166
  /** Error codes the server can answer with, from spec/commands.json. */
133
- export type ErrorCode = "NOT_FOUND" | "AMBIGUOUS" | "NOT_CLICKABLE" | "TIMEOUT" | "NO_ACCESSIBILITY" | "NO_IME" | "NO_PERMISSION" | "APP_NOT_FOUND" | "ACTIVITY_BLOCKED" | "PROXY_FAILED" | "UNKNOWN_CMD" | "UNSUPPORTED" | "BAD_ARGS" | "DEVICE_NOT_FOUND" | "DEVICE_OFFLINE" | "DEVICE_AMBIGUOUS" | "DEVICE_LEASED" | "LEASE_NOT_FOUND" | "NO_FREE_DEVICE" | "OCR_UNAVAILABLE" | "AGENT_RESTARTED" | "UNAUTHORIZED" | "PAIRING_FAILED" | "INTERNAL";
167
+ export type ErrorCode = "NOT_FOUND" | "AMBIGUOUS" | "NOT_CLICKABLE" | "TIMEOUT" | "NO_ACCESSIBILITY" | "NO_IME" | "NO_PERMISSION" | "APP_NOT_FOUND" | "ACTIVITY_BLOCKED" | "PROXY_FAILED" | "SEND_FAILED" | "LOCATION_OFF" | "UNKNOWN_CMD" | "UNSUPPORTED" | "BAD_ARGS" | "DEVICE_NOT_FOUND" | "DEVICE_OFFLINE" | "DEVICE_AMBIGUOUS" | "DEVICE_LEASED" | "LEASE_NOT_FOUND" | "NO_FREE_DEVICE" | "OCR_UNAVAILABLE" | "AGENT_RESTARTED" | "UNAUTHORIZED" | "PAIRING_FAILED" | "INTERNAL";
134
168
  /** HTTP status and default retryable flag of each error code. */
135
169
  export declare const ERRORS: Readonly<Record<ErrorCode, {
136
170
  readonly http: number;
@@ -526,6 +560,71 @@ export interface NotifyFilterOptions {
526
560
  /** Allowed packages. Omit to read the current list. */
527
561
  packages?: ReadonlyArray<string>;
528
562
  }
563
+ export interface SmsOptions {
564
+ /** Received, sent, or both. @default "inbox" */
565
+ box?: "inbox" | "sent" | "all";
566
+ /** Only messages whose number or sender contains this. Spaces and dashes are ignored. */
567
+ address?: string;
568
+ /** Only messages whose text contains this, ignoring case. */
569
+ contains?: string;
570
+ /** Only messages from the last this many seconds. 0 means any time. @default 0 */
571
+ within?: number;
572
+ /** Most messages to return, up to 500. @default 20 */
573
+ max?: number;
574
+ }
575
+ export interface CallsOptions {
576
+ /** Which calls. @default "all" */
577
+ type?: "all" | "incoming" | "outgoing" | "missed" | "rejected" | "blocked";
578
+ /** Only calls whose number or saved name contains this. Spaces and dashes are ignored. */
579
+ number?: string;
580
+ /** Only calls from the last this many seconds. 0 means any time. @default 0 */
581
+ within?: number;
582
+ /** Most calls to return, up to 500. @default 20 */
583
+ max?: number;
584
+ }
585
+ export interface ContactsOptions {
586
+ /** Only contacts whose name, number or email contains this, ignoring case. Spaces and dashes in numbers are ignored. */
587
+ query?: string;
588
+ /** Most contacts to return, up to 500. @default 50 */
589
+ max?: number;
590
+ }
591
+ export interface WaitSmsOptions {
592
+ /** Only from a number or sender containing this. Spaces and dashes are ignored. */
593
+ address?: string;
594
+ /** Only messages whose text contains this, ignoring case. */
595
+ contains?: string;
596
+ /** Seconds to wait. @default 60 */
597
+ timeout?: number;
598
+ }
599
+ export interface SmsSendResult {
600
+ parts: number;
601
+ }
602
+ export interface FilesOptions {
603
+ /** Folder to list. Empty means the top of shared storage. @default "" */
604
+ path?: string;
605
+ /** name sorts by name, time puts the newest first. @default "name" */
606
+ sort?: "name" | "time";
607
+ /** Most entries to return, up to 1000. @default 200 */
608
+ max?: number;
609
+ }
610
+ export interface PullResult {
611
+ name: string;
612
+ size: number;
613
+ data: string;
614
+ }
615
+ export interface LocationOptions {
616
+ /** Seconds to wait for a new fix. @default 10 */
617
+ timeout?: number;
618
+ /** A fix the phone already has is good enough if it is at most this old. 0 always asks for a new one. @default 60 */
619
+ max_age?: number;
620
+ }
621
+ export interface LocationResult {
622
+ lat: number;
623
+ lon: number;
624
+ accuracy: number;
625
+ time: number;
626
+ provider: string;
627
+ }
529
628
  export interface ChromeGoOptions {
530
629
  /** Open in a new tab. @default false */
531
630
  new_tab?: boolean;
@@ -4183,6 +4282,458 @@ export declare abstract class DeviceCommands {
4183
4282
  * @alias notify_filter
4184
4283
  */
4185
4284
  notifyFilter(packages?: ReadonlyArray<string>, opts?: NotifyFilterOptions): Promise<Array<string>>;
4285
+ /**
4286
+ * Text messages stored on the phone, newest first.
4287
+ *
4288
+ * Optional. Allow SMS on the app's Setup tab first; until then the answer is NO_PERMISSION. Covers SMS and the text of MMS. Chat messages (RCS) are kept by the messaging app itself and are not included. The MCP server lists this tool only when --tools names it.
4289
+ *
4290
+ * @param box Received, sent, or both. Default: "inbox".
4291
+ * @param address Only messages whose number or sender contains this. Spaces and dashes are ignored.
4292
+ * @param contains Only messages whose text contains this, ignoring case.
4293
+ * @param within Only messages from the last this many seconds. 0 means any time. Default: 0.
4294
+ * @param max Most messages to return, up to 500. Default: 20.
4295
+ * @param opts Optional parameters by name, see SmsOptions.
4296
+ * @example await d.sms({ contains: "인증번호", within: 300, max: 1 })
4297
+ */
4298
+ sms(opts?: SmsOptions): Promise<Array<Sms>>;
4299
+ /**
4300
+ * Text messages stored on the phone, newest first.
4301
+ *
4302
+ * Optional. Allow SMS on the app's Setup tab first; until then the answer is NO_PERMISSION. Covers SMS and the text of MMS. Chat messages (RCS) are kept by the messaging app itself and are not included. The MCP server lists this tool only when --tools names it.
4303
+ *
4304
+ * @param box Received, sent, or both. Default: "inbox".
4305
+ * @param address Only messages whose number or sender contains this. Spaces and dashes are ignored.
4306
+ * @param contains Only messages whose text contains this, ignoring case.
4307
+ * @param within Only messages from the last this many seconds. 0 means any time. Default: 0.
4308
+ * @param max Most messages to return, up to 500. Default: 20.
4309
+ * @param opts Optional parameters by name, see SmsOptions.
4310
+ * @example await d.sms({ contains: "인증번호", within: 300, max: 1 })
4311
+ */
4312
+ sms(box?: "inbox" | "sent" | "all", opts?: SmsOptions): Promise<Array<Sms>>;
4313
+ /**
4314
+ * Text messages stored on the phone, newest first.
4315
+ *
4316
+ * Optional. Allow SMS on the app's Setup tab first; until then the answer is NO_PERMISSION. Covers SMS and the text of MMS. Chat messages (RCS) are kept by the messaging app itself and are not included. The MCP server lists this tool only when --tools names it.
4317
+ *
4318
+ * @param box Received, sent, or both. Default: "inbox".
4319
+ * @param address Only messages whose number or sender contains this. Spaces and dashes are ignored.
4320
+ * @param contains Only messages whose text contains this, ignoring case.
4321
+ * @param within Only messages from the last this many seconds. 0 means any time. Default: 0.
4322
+ * @param max Most messages to return, up to 500. Default: 20.
4323
+ * @param opts Optional parameters by name, see SmsOptions.
4324
+ * @example await d.sms({ contains: "인증번호", within: 300, max: 1 })
4325
+ */
4326
+ sms(box?: "inbox" | "sent" | "all", address?: string, opts?: SmsOptions): Promise<Array<Sms>>;
4327
+ /**
4328
+ * Text messages stored on the phone, newest first.
4329
+ *
4330
+ * Optional. Allow SMS on the app's Setup tab first; until then the answer is NO_PERMISSION. Covers SMS and the text of MMS. Chat messages (RCS) are kept by the messaging app itself and are not included. The MCP server lists this tool only when --tools names it.
4331
+ *
4332
+ * @param box Received, sent, or both. Default: "inbox".
4333
+ * @param address Only messages whose number or sender contains this. Spaces and dashes are ignored.
4334
+ * @param contains Only messages whose text contains this, ignoring case.
4335
+ * @param within Only messages from the last this many seconds. 0 means any time. Default: 0.
4336
+ * @param max Most messages to return, up to 500. Default: 20.
4337
+ * @param opts Optional parameters by name, see SmsOptions.
4338
+ * @example await d.sms({ contains: "인증번호", within: 300, max: 1 })
4339
+ */
4340
+ sms(box?: "inbox" | "sent" | "all", address?: string, contains?: string, opts?: SmsOptions): Promise<Array<Sms>>;
4341
+ /**
4342
+ * Text messages stored on the phone, newest first.
4343
+ *
4344
+ * Optional. Allow SMS on the app's Setup tab first; until then the answer is NO_PERMISSION. Covers SMS and the text of MMS. Chat messages (RCS) are kept by the messaging app itself and are not included. The MCP server lists this tool only when --tools names it.
4345
+ *
4346
+ * @param box Received, sent, or both. Default: "inbox".
4347
+ * @param address Only messages whose number or sender contains this. Spaces and dashes are ignored.
4348
+ * @param contains Only messages whose text contains this, ignoring case.
4349
+ * @param within Only messages from the last this many seconds. 0 means any time. Default: 0.
4350
+ * @param max Most messages to return, up to 500. Default: 20.
4351
+ * @param opts Optional parameters by name, see SmsOptions.
4352
+ * @example await d.sms({ contains: "인증번호", within: 300, max: 1 })
4353
+ */
4354
+ sms(box?: "inbox" | "sent" | "all", address?: string, contains?: string, within?: number, opts?: SmsOptions): Promise<Array<Sms>>;
4355
+ /**
4356
+ * Text messages stored on the phone, newest first.
4357
+ *
4358
+ * Optional. Allow SMS on the app's Setup tab first; until then the answer is NO_PERMISSION. Covers SMS and the text of MMS. Chat messages (RCS) are kept by the messaging app itself and are not included. The MCP server lists this tool only when --tools names it.
4359
+ *
4360
+ * @param box Received, sent, or both. Default: "inbox".
4361
+ * @param address Only messages whose number or sender contains this. Spaces and dashes are ignored.
4362
+ * @param contains Only messages whose text contains this, ignoring case.
4363
+ * @param within Only messages from the last this many seconds. 0 means any time. Default: 0.
4364
+ * @param max Most messages to return, up to 500. Default: 20.
4365
+ * @param opts Optional parameters by name, see SmsOptions.
4366
+ * @example await d.sms({ contains: "인증번호", within: 300, max: 1 })
4367
+ */
4368
+ sms(box?: "inbox" | "sent" | "all", address?: string, contains?: string, within?: number, max?: number, opts?: SmsOptions): Promise<Array<Sms>>;
4369
+ /**
4370
+ * Call history, newest first.
4371
+ *
4372
+ * Optional. Allow call history on the app's Setup tab first; until then the answer is NO_PERMISSION. Only calls made through the phone app are listed; calls inside apps such as messengers usually are not. The MCP server lists this tool only when --tools names it.
4373
+ *
4374
+ * @param type Which calls. Default: "all".
4375
+ * @param number Only calls whose number or saved name contains this. Spaces and dashes are ignored.
4376
+ * @param within Only calls from the last this many seconds. 0 means any time. Default: 0.
4377
+ * @param max Most calls to return, up to 500. Default: 20.
4378
+ * @param opts Optional parameters by name, see CallsOptions.
4379
+ * @example await d.calls({ type: "missed", within: 3600 })
4380
+ */
4381
+ calls(opts?: CallsOptions): Promise<Array<Call>>;
4382
+ /**
4383
+ * Call history, newest first.
4384
+ *
4385
+ * Optional. Allow call history on the app's Setup tab first; until then the answer is NO_PERMISSION. Only calls made through the phone app are listed; calls inside apps such as messengers usually are not. The MCP server lists this tool only when --tools names it.
4386
+ *
4387
+ * @param type Which calls. Default: "all".
4388
+ * @param number Only calls whose number or saved name contains this. Spaces and dashes are ignored.
4389
+ * @param within Only calls from the last this many seconds. 0 means any time. Default: 0.
4390
+ * @param max Most calls to return, up to 500. Default: 20.
4391
+ * @param opts Optional parameters by name, see CallsOptions.
4392
+ * @example await d.calls({ type: "missed", within: 3600 })
4393
+ */
4394
+ calls(type?: "all" | "incoming" | "outgoing" | "missed" | "rejected" | "blocked", opts?: CallsOptions): Promise<Array<Call>>;
4395
+ /**
4396
+ * Call history, newest first.
4397
+ *
4398
+ * Optional. Allow call history on the app's Setup tab first; until then the answer is NO_PERMISSION. Only calls made through the phone app are listed; calls inside apps such as messengers usually are not. The MCP server lists this tool only when --tools names it.
4399
+ *
4400
+ * @param type Which calls. Default: "all".
4401
+ * @param number Only calls whose number or saved name contains this. Spaces and dashes are ignored.
4402
+ * @param within Only calls from the last this many seconds. 0 means any time. Default: 0.
4403
+ * @param max Most calls to return, up to 500. Default: 20.
4404
+ * @param opts Optional parameters by name, see CallsOptions.
4405
+ * @example await d.calls({ type: "missed", within: 3600 })
4406
+ */
4407
+ calls(type?: "all" | "incoming" | "outgoing" | "missed" | "rejected" | "blocked", number?: string, opts?: CallsOptions): Promise<Array<Call>>;
4408
+ /**
4409
+ * Call history, newest first.
4410
+ *
4411
+ * Optional. Allow call history on the app's Setup tab first; until then the answer is NO_PERMISSION. Only calls made through the phone app are listed; calls inside apps such as messengers usually are not. The MCP server lists this tool only when --tools names it.
4412
+ *
4413
+ * @param type Which calls. Default: "all".
4414
+ * @param number Only calls whose number or saved name contains this. Spaces and dashes are ignored.
4415
+ * @param within Only calls from the last this many seconds. 0 means any time. Default: 0.
4416
+ * @param max Most calls to return, up to 500. Default: 20.
4417
+ * @param opts Optional parameters by name, see CallsOptions.
4418
+ * @example await d.calls({ type: "missed", within: 3600 })
4419
+ */
4420
+ calls(type?: "all" | "incoming" | "outgoing" | "missed" | "rejected" | "blocked", number?: string, within?: number, opts?: CallsOptions): Promise<Array<Call>>;
4421
+ /**
4422
+ * Call history, newest first.
4423
+ *
4424
+ * Optional. Allow call history on the app's Setup tab first; until then the answer is NO_PERMISSION. Only calls made through the phone app are listed; calls inside apps such as messengers usually are not. The MCP server lists this tool only when --tools names it.
4425
+ *
4426
+ * @param type Which calls. Default: "all".
4427
+ * @param number Only calls whose number or saved name contains this. Spaces and dashes are ignored.
4428
+ * @param within Only calls from the last this many seconds. 0 means any time. Default: 0.
4429
+ * @param max Most calls to return, up to 500. Default: 20.
4430
+ * @param opts Optional parameters by name, see CallsOptions.
4431
+ * @example await d.calls({ type: "missed", within: 3600 })
4432
+ */
4433
+ calls(type?: "all" | "incoming" | "outgoing" | "missed" | "rejected" | "blocked", number?: string, within?: number, max?: number, opts?: CallsOptions): Promise<Array<Call>>;
4434
+ /**
4435
+ * Contacts saved on the phone, by name.
4436
+ *
4437
+ * Optional. Allow contacts on the app's Setup tab first; until then the answer is NO_PERMISSION. The MCP server lists this tool only when --tools names it.
4438
+ *
4439
+ * @param query Only contacts whose name, number or email contains this, ignoring case. Spaces and dashes in numbers are ignored.
4440
+ * @param max Most contacts to return, up to 500. Default: 50.
4441
+ * @param opts Optional parameters by name, see ContactsOptions.
4442
+ * @example await d.contacts("Kim")
4443
+ */
4444
+ contacts(opts?: ContactsOptions): Promise<Array<Contact>>;
4445
+ /**
4446
+ * Contacts saved on the phone, by name.
4447
+ *
4448
+ * Optional. Allow contacts on the app's Setup tab first; until then the answer is NO_PERMISSION. The MCP server lists this tool only when --tools names it.
4449
+ *
4450
+ * @param query Only contacts whose name, number or email contains this, ignoring case. Spaces and dashes in numbers are ignored.
4451
+ * @param max Most contacts to return, up to 500. Default: 50.
4452
+ * @param opts Optional parameters by name, see ContactsOptions.
4453
+ * @example await d.contacts("Kim")
4454
+ */
4455
+ contacts(query?: string, opts?: ContactsOptions): Promise<Array<Contact>>;
4456
+ /**
4457
+ * Contacts saved on the phone, by name.
4458
+ *
4459
+ * Optional. Allow contacts on the app's Setup tab first; until then the answer is NO_PERMISSION. The MCP server lists this tool only when --tools names it.
4460
+ *
4461
+ * @param query Only contacts whose name, number or email contains this, ignoring case. Spaces and dashes in numbers are ignored.
4462
+ * @param max Most contacts to return, up to 500. Default: 50.
4463
+ * @param opts Optional parameters by name, see ContactsOptions.
4464
+ * @example await d.contacts("Kim")
4465
+ */
4466
+ contacts(query?: string, max?: number, opts?: ContactsOptions): Promise<Array<Contact>>;
4467
+ /**
4468
+ * Wait for a new text message and return it.
4469
+ *
4470
+ * Optional, needs the SMS permission like sms. The PC checks the phone's inbox every second, and only messages that arrive after the call starts count. The MCP server lists this tool only when --tools names it.
4471
+ *
4472
+ * @param address Only from a number or sender containing this. Spaces and dashes are ignored.
4473
+ * @param contains Only messages whose text contains this, ignoring case.
4474
+ * @param timeout Seconds to wait. Default: 60.
4475
+ * @param opts Optional parameters by name, see WaitSmsOptions.
4476
+ * @throws {DroidlineError} with code TIMEOUT, NO_PERMISSION.
4477
+ * @example await d.wait_sms({ contains: "인증번호", timeout: 120 })
4478
+ */
4479
+ wait_sms(opts?: WaitSmsOptions): Promise<Sms>;
4480
+ /**
4481
+ * Wait for a new text message and return it.
4482
+ *
4483
+ * Optional, needs the SMS permission like sms. The PC checks the phone's inbox every second, and only messages that arrive after the call starts count. The MCP server lists this tool only when --tools names it.
4484
+ *
4485
+ * @param address Only from a number or sender containing this. Spaces and dashes are ignored.
4486
+ * @param contains Only messages whose text contains this, ignoring case.
4487
+ * @param timeout Seconds to wait. Default: 60.
4488
+ * @param opts Optional parameters by name, see WaitSmsOptions.
4489
+ * @throws {DroidlineError} with code TIMEOUT, NO_PERMISSION.
4490
+ * @example await d.wait_sms({ contains: "인증번호", timeout: 120 })
4491
+ */
4492
+ wait_sms(address?: string, opts?: WaitSmsOptions): Promise<Sms>;
4493
+ /**
4494
+ * Wait for a new text message and return it.
4495
+ *
4496
+ * Optional, needs the SMS permission like sms. The PC checks the phone's inbox every second, and only messages that arrive after the call starts count. The MCP server lists this tool only when --tools names it.
4497
+ *
4498
+ * @param address Only from a number or sender containing this. Spaces and dashes are ignored.
4499
+ * @param contains Only messages whose text contains this, ignoring case.
4500
+ * @param timeout Seconds to wait. Default: 60.
4501
+ * @param opts Optional parameters by name, see WaitSmsOptions.
4502
+ * @throws {DroidlineError} with code TIMEOUT, NO_PERMISSION.
4503
+ * @example await d.wait_sms({ contains: "인증번호", timeout: 120 })
4504
+ */
4505
+ wait_sms(address?: string, contains?: string, opts?: WaitSmsOptions): Promise<Sms>;
4506
+ /**
4507
+ * Wait for a new text message and return it.
4508
+ *
4509
+ * Optional, needs the SMS permission like sms. The PC checks the phone's inbox every second, and only messages that arrive after the call starts count. The MCP server lists this tool only when --tools names it.
4510
+ *
4511
+ * @param address Only from a number or sender containing this. Spaces and dashes are ignored.
4512
+ * @param contains Only messages whose text contains this, ignoring case.
4513
+ * @param timeout Seconds to wait. Default: 60.
4514
+ * @param opts Optional parameters by name, see WaitSmsOptions.
4515
+ * @throws {DroidlineError} with code TIMEOUT, NO_PERMISSION.
4516
+ * @example await d.wait_sms({ contains: "인증번호", timeout: 120 })
4517
+ */
4518
+ wait_sms(address?: string, contains?: string, timeout?: number, opts?: WaitSmsOptions): Promise<Sms>;
4519
+ /**
4520
+ * Wait for a new text message and return it.
4521
+ *
4522
+ * Optional, needs the SMS permission like sms. The PC checks the phone's inbox every second, and only messages that arrive after the call starts count. The MCP server lists this tool only when --tools names it.
4523
+ *
4524
+ * @param address Only from a number or sender containing this. Spaces and dashes are ignored.
4525
+ * @param contains Only messages whose text contains this, ignoring case.
4526
+ * @param timeout Seconds to wait. Default: 60.
4527
+ * @param opts Optional parameters by name, see WaitSmsOptions.
4528
+ * @throws {DroidlineError} with code TIMEOUT, NO_PERMISSION.
4529
+ * @example await d.wait_sms({ contains: "인증번호", timeout: 120 })
4530
+ * @alias wait_sms
4531
+ */
4532
+ waitSms(opts?: WaitSmsOptions): Promise<Sms>;
4533
+ /**
4534
+ * Wait for a new text message and return it.
4535
+ *
4536
+ * Optional, needs the SMS permission like sms. The PC checks the phone's inbox every second, and only messages that arrive after the call starts count. The MCP server lists this tool only when --tools names it.
4537
+ *
4538
+ * @param address Only from a number or sender containing this. Spaces and dashes are ignored.
4539
+ * @param contains Only messages whose text contains this, ignoring case.
4540
+ * @param timeout Seconds to wait. Default: 60.
4541
+ * @param opts Optional parameters by name, see WaitSmsOptions.
4542
+ * @throws {DroidlineError} with code TIMEOUT, NO_PERMISSION.
4543
+ * @example await d.wait_sms({ contains: "인증번호", timeout: 120 })
4544
+ * @alias wait_sms
4545
+ */
4546
+ waitSms(address?: string, opts?: WaitSmsOptions): Promise<Sms>;
4547
+ /**
4548
+ * Wait for a new text message and return it.
4549
+ *
4550
+ * Optional, needs the SMS permission like sms. The PC checks the phone's inbox every second, and only messages that arrive after the call starts count. The MCP server lists this tool only when --tools names it.
4551
+ *
4552
+ * @param address Only from a number or sender containing this. Spaces and dashes are ignored.
4553
+ * @param contains Only messages whose text contains this, ignoring case.
4554
+ * @param timeout Seconds to wait. Default: 60.
4555
+ * @param opts Optional parameters by name, see WaitSmsOptions.
4556
+ * @throws {DroidlineError} with code TIMEOUT, NO_PERMISSION.
4557
+ * @example await d.wait_sms({ contains: "인증번호", timeout: 120 })
4558
+ * @alias wait_sms
4559
+ */
4560
+ waitSms(address?: string, contains?: string, opts?: WaitSmsOptions): Promise<Sms>;
4561
+ /**
4562
+ * Wait for a new text message and return it.
4563
+ *
4564
+ * Optional, needs the SMS permission like sms. The PC checks the phone's inbox every second, and only messages that arrive after the call starts count. The MCP server lists this tool only when --tools names it.
4565
+ *
4566
+ * @param address Only from a number or sender containing this. Spaces and dashes are ignored.
4567
+ * @param contains Only messages whose text contains this, ignoring case.
4568
+ * @param timeout Seconds to wait. Default: 60.
4569
+ * @param opts Optional parameters by name, see WaitSmsOptions.
4570
+ * @throws {DroidlineError} with code TIMEOUT, NO_PERMISSION.
4571
+ * @example await d.wait_sms({ contains: "인증번호", timeout: 120 })
4572
+ * @alias wait_sms
4573
+ */
4574
+ waitSms(address?: string, contains?: string, timeout?: number, opts?: WaitSmsOptions): Promise<Sms>;
4575
+ /**
4576
+ * Send a text message from the phone.
4577
+ *
4578
+ * Optional. Allow sending SMS on the app's Setup tab first. Sends from the phone's default SIM, and your carrier may charge for it. Long text goes out as several parts. Answers after the network accepts every part, or SEND_FAILED. The MCP server lists this tool only when --tools names it.
4579
+ *
4580
+ * @param number Phone number to send to.
4581
+ * @param text Message text.
4582
+ * @throws {DroidlineError} with code SEND_FAILED, NO_PERMISSION.
4583
+ * @example await d.sms_send("01012345678", "On my way")
4584
+ */
4585
+ sms_send(number: string, text: string): Promise<SmsSendResult>;
4586
+ /**
4587
+ * Send a text message from the phone.
4588
+ *
4589
+ * Optional. Allow sending SMS on the app's Setup tab first. Sends from the phone's default SIM, and your carrier may charge for it. Long text goes out as several parts. Answers after the network accepts every part, or SEND_FAILED. The MCP server lists this tool only when --tools names it.
4590
+ *
4591
+ * @param number Phone number to send to.
4592
+ * @param text Message text.
4593
+ * @throws {DroidlineError} with code SEND_FAILED, NO_PERMISSION.
4594
+ * @example await d.sms_send("01012345678", "On my way")
4595
+ * @alias sms_send
4596
+ */
4597
+ smsSend(number: string, text: string): Promise<SmsSendResult>;
4598
+ /**
4599
+ * Start a phone call.
4600
+ *
4601
+ * Optional. Allow phone calls on the app's Setup tab first. Opens the phone app already dialing and answers right away; end the call with hang_up. The MCP server lists this tool only when --tools names it.
4602
+ *
4603
+ * @param number Phone number to call.
4604
+ * @throws {DroidlineError} with code NO_PERMISSION.
4605
+ * @example await d.dial("01012345678")
4606
+ */
4607
+ dial(number: string): Promise<void>;
4608
+ /**
4609
+ * End the current call, or reject a ringing one.
4610
+ *
4611
+ * Optional, needs the phone permission like dial. Answers false when there was no call. The MCP server lists this tool only when --tools names it.
4612
+ *
4613
+ * @throws {DroidlineError} with code NO_PERMISSION.
4614
+ * @example await d.hang_up()
4615
+ */
4616
+ hang_up(): Promise<boolean>;
4617
+ /**
4618
+ * End the current call, or reject a ringing one.
4619
+ *
4620
+ * Optional, needs the phone permission like dial. Answers false when there was no call. The MCP server lists this tool only when --tools names it.
4621
+ *
4622
+ * @throws {DroidlineError} with code NO_PERMISSION.
4623
+ * @example await d.hang_up()
4624
+ * @alias hang_up
4625
+ */
4626
+ hangUp(): Promise<boolean>;
4627
+ /**
4628
+ * List a folder in the phone's shared storage.
4629
+ *
4630
+ * Optional. Allow file access on the app's Setup tab first. Paths are relative to shared storage (/sdcard), such as DCIM/Screenshots or Download, and cannot leave it. The MCP server lists this tool only when --tools names it.
4631
+ *
4632
+ * @param path Folder to list. Empty means the top of shared storage. Default: "".
4633
+ * @param sort name sorts by name, time puts the newest first. Default: "name".
4634
+ * @param max Most entries to return, up to 1000. Default: 200.
4635
+ * @param opts Optional parameters by name, see FilesOptions.
4636
+ * @throws {DroidlineError} with code BAD_ARGS, NO_PERMISSION.
4637
+ * @example await d.files("DCIM/Screenshots", { sort: "time", max: 1 })
4638
+ */
4639
+ files(opts?: FilesOptions): Promise<Array<FileEntry>>;
4640
+ /**
4641
+ * List a folder in the phone's shared storage.
4642
+ *
4643
+ * Optional. Allow file access on the app's Setup tab first. Paths are relative to shared storage (/sdcard), such as DCIM/Screenshots or Download, and cannot leave it. The MCP server lists this tool only when --tools names it.
4644
+ *
4645
+ * @param path Folder to list. Empty means the top of shared storage. Default: "".
4646
+ * @param sort name sorts by name, time puts the newest first. Default: "name".
4647
+ * @param max Most entries to return, up to 1000. Default: 200.
4648
+ * @param opts Optional parameters by name, see FilesOptions.
4649
+ * @throws {DroidlineError} with code BAD_ARGS, NO_PERMISSION.
4650
+ * @example await d.files("DCIM/Screenshots", { sort: "time", max: 1 })
4651
+ */
4652
+ files(path?: string, opts?: FilesOptions): Promise<Array<FileEntry>>;
4653
+ /**
4654
+ * List a folder in the phone's shared storage.
4655
+ *
4656
+ * Optional. Allow file access on the app's Setup tab first. Paths are relative to shared storage (/sdcard), such as DCIM/Screenshots or Download, and cannot leave it. The MCP server lists this tool only when --tools names it.
4657
+ *
4658
+ * @param path Folder to list. Empty means the top of shared storage. Default: "".
4659
+ * @param sort name sorts by name, time puts the newest first. Default: "name".
4660
+ * @param max Most entries to return, up to 1000. Default: 200.
4661
+ * @param opts Optional parameters by name, see FilesOptions.
4662
+ * @throws {DroidlineError} with code BAD_ARGS, NO_PERMISSION.
4663
+ * @example await d.files("DCIM/Screenshots", { sort: "time", max: 1 })
4664
+ */
4665
+ files(path?: string, sort?: "name" | "time", opts?: FilesOptions): Promise<Array<FileEntry>>;
4666
+ /**
4667
+ * List a folder in the phone's shared storage.
4668
+ *
4669
+ * Optional. Allow file access on the app's Setup tab first. Paths are relative to shared storage (/sdcard), such as DCIM/Screenshots or Download, and cannot leave it. The MCP server lists this tool only when --tools names it.
4670
+ *
4671
+ * @param path Folder to list. Empty means the top of shared storage. Default: "".
4672
+ * @param sort name sorts by name, time puts the newest first. Default: "name".
4673
+ * @param max Most entries to return, up to 1000. Default: 200.
4674
+ * @param opts Optional parameters by name, see FilesOptions.
4675
+ * @throws {DroidlineError} with code BAD_ARGS, NO_PERMISSION.
4676
+ * @example await d.files("DCIM/Screenshots", { sort: "time", max: 1 })
4677
+ */
4678
+ files(path?: string, sort?: "name" | "time", max?: number, opts?: FilesOptions): Promise<Array<FileEntry>>;
4679
+ /**
4680
+ * Copy a file from the phone's shared storage to the PC.
4681
+ *
4682
+ * Optional, needs file access like files. Up to 32 MB. Without path the SDKs return the bytes and the CLI saves the file under its own name. The MCP server lists this tool only when --tools names it.
4683
+ *
4684
+ * @param file File on the phone, relative to shared storage, such as Download/report.pdf.
4685
+ * @param path Save to this local file.
4686
+ * @throws {DroidlineError} with code BAD_ARGS, NO_PERMISSION.
4687
+ * @example await d.pull("Download/report.pdf", "report.pdf")
4688
+ */
4689
+ pull(file: string): Promise<Buffer>;
4690
+ /**
4691
+ * Copy a file from the phone's shared storage to the PC.
4692
+ *
4693
+ * Optional, needs file access like files. Up to 32 MB. Without path the SDKs return the bytes and the CLI saves the file under its own name. The MCP server lists this tool only when --tools names it.
4694
+ *
4695
+ * @param file File on the phone, relative to shared storage, such as Download/report.pdf.
4696
+ * @param path Save to this local file.
4697
+ * @throws {DroidlineError} with code BAD_ARGS, NO_PERMISSION.
4698
+ * @example await d.pull("Download/report.pdf", "report.pdf")
4699
+ */
4700
+ pull(file: string, path: string): Promise<string>;
4701
+ /**
4702
+ * The phone's current location.
4703
+ *
4704
+ * Optional. Allow location on the app's Setup tab first, including "Allow all the time", because Droidline asks while it runs in the background. Answers LOCATION_OFF when location is turned off on the phone. The MCP server lists this tool only when --tools names it.
4705
+ *
4706
+ * @param timeout Seconds to wait for a new fix. Default: 10.
4707
+ * @param max_age A fix the phone already has is good enough if it is at most this old. 0 always asks for a new one. Default: 60.
4708
+ * @param opts Optional parameters by name, see LocationOptions.
4709
+ * @throws {DroidlineError} with code TIMEOUT, LOCATION_OFF, NO_PERMISSION.
4710
+ * @example await d.location()
4711
+ */
4712
+ location(opts?: LocationOptions): Promise<LocationResult>;
4713
+ /**
4714
+ * The phone's current location.
4715
+ *
4716
+ * Optional. Allow location on the app's Setup tab first, including "Allow all the time", because Droidline asks while it runs in the background. Answers LOCATION_OFF when location is turned off on the phone. The MCP server lists this tool only when --tools names it.
4717
+ *
4718
+ * @param timeout Seconds to wait for a new fix. Default: 10.
4719
+ * @param max_age A fix the phone already has is good enough if it is at most this old. 0 always asks for a new one. Default: 60.
4720
+ * @param opts Optional parameters by name, see LocationOptions.
4721
+ * @throws {DroidlineError} with code TIMEOUT, LOCATION_OFF, NO_PERMISSION.
4722
+ * @example await d.location()
4723
+ */
4724
+ location(timeout?: number, opts?: LocationOptions): Promise<LocationResult>;
4725
+ /**
4726
+ * The phone's current location.
4727
+ *
4728
+ * Optional. Allow location on the app's Setup tab first, including "Allow all the time", because Droidline asks while it runs in the background. Answers LOCATION_OFF when location is turned off on the phone. The MCP server lists this tool only when --tools names it.
4729
+ *
4730
+ * @param timeout Seconds to wait for a new fix. Default: 10.
4731
+ * @param max_age A fix the phone already has is good enough if it is at most this old. 0 always asks for a new one. Default: 60.
4732
+ * @param opts Optional parameters by name, see LocationOptions.
4733
+ * @throws {DroidlineError} with code TIMEOUT, LOCATION_OFF, NO_PERMISSION.
4734
+ * @example await d.location()
4735
+ */
4736
+ location(timeout?: number, max_age?: number, opts?: LocationOptions): Promise<LocationResult>;
4186
4737
  }
4187
4738
  /** Commands the PC server answers itself. Droidline extends this and implements _run. */
4188
4739
  export declare abstract class ClientCommands extends EventEmitter {
package/dist/generated.js CHANGED
@@ -24,6 +24,10 @@ export const ERRORS = {
24
24
  ACTIVITY_BLOCKED: { http: 422, retryable: false },
25
25
  /** Upstream connection or authentication failed. reason is auth, timeout, refused or protocol. */
26
26
  PROXY_FAILED: { http: 502, retryable: true },
27
+ /** The phone or the network refused the message. reason says why, such as no_service or radio_off. */
28
+ SEND_FAILED: { http: 502, retryable: true },
29
+ /** Turn on location in the phone's quick settings or Settings, then try again. */
30
+ LOCATION_OFF: { http: 409, retryable: false },
27
31
  /** Command not supported. The agent version is returned. */
28
32
  UNKNOWN_CMD: { http: 404, retryable: false },
29
33
  /** The phone's Android version cannot do this without ADB or root. */
@@ -385,6 +389,45 @@ export class DeviceCommands {
385
389
  async notifyFilter(...args) {
386
390
  return this._run("notify_filter", "value", collect("notify_filter", args, [], ["packages"]));
387
391
  }
392
+ async sms(...args) {
393
+ return this._run("sms", "value", collect("sms", args, [], ["box", "address", "contains", "within", "max"]));
394
+ }
395
+ async calls(...args) {
396
+ return this._run("calls", "value", collect("calls", args, [], ["type", "number", "within", "max"]));
397
+ }
398
+ async contacts(...args) {
399
+ return this._run("contacts", "value", collect("contacts", args, [], ["query", "max"]));
400
+ }
401
+ async wait_sms(...args) {
402
+ return this._run("wait_sms", "value", collect("wait_sms", args, [], ["address", "contains", "timeout"]));
403
+ }
404
+ async waitSms(...args) {
405
+ return this._run("wait_sms", "value", collect("wait_sms", args, [], ["address", "contains", "timeout"]));
406
+ }
407
+ async sms_send(...args) {
408
+ return this._run("sms_send", "fields", collect("sms_send", args, ["number", "text"], []));
409
+ }
410
+ async smsSend(...args) {
411
+ return this._run("sms_send", "fields", collect("sms_send", args, ["number", "text"], []));
412
+ }
413
+ async dial(...args) {
414
+ return this._run("dial", "none", collect("dial", args, ["number"], []));
415
+ }
416
+ async hang_up(...args) {
417
+ return this._run("hang_up", "value", collect("hang_up", args, [], []));
418
+ }
419
+ async hangUp(...args) {
420
+ return this._run("hang_up", "value", collect("hang_up", args, [], []));
421
+ }
422
+ async files(...args) {
423
+ return this._run("files", "value", collect("files", args, [], ["path", "sort", "max"]));
424
+ }
425
+ async pull(...args) {
426
+ return this._saveImage("pull", collect("pull", args, ["file"], ["path"]));
427
+ }
428
+ async location(...args) {
429
+ return this._run("location", "fields", collect("location", args, [], ["timeout", "max_age"]));
430
+ }
388
431
  }
389
432
  /** Commands the PC server answers itself. Droidline extends this and implements _run. */
390
433
  export class ClientCommands extends EventEmitter {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "droidline",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Android automation from Node.js: test your apps on real phones, script the tasks you repeat and run many phones at once. No ADB, no USB cable, no root.",
5
5
  "license": "MIT",
6
6
  "type": "module",