@ceki/sdk 1.12.0 → 1.14.0
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/README.md +25 -8
- package/dist/cli.js +956 -116
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +425 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +167 -5
- package/dist/index.d.ts +167 -5
- package/dist/index.js +414 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -242,14 +242,23 @@ declare class Browser {
|
|
|
242
242
|
method: string;
|
|
243
243
|
params?: Record<string, unknown>;
|
|
244
244
|
}, timeout?: number): Promise<unknown>;
|
|
245
|
-
|
|
245
|
+
private _humanizeForCall;
|
|
246
|
+
navigate(url: string, timeout?: number, opts?: {
|
|
247
|
+
human?: boolean;
|
|
248
|
+
}): Promise<{
|
|
246
249
|
url: string;
|
|
247
250
|
frameId?: string;
|
|
248
251
|
}>;
|
|
249
|
-
click(x: number, y: number
|
|
252
|
+
click(x: number, y: number, opts?: {
|
|
253
|
+
human?: boolean;
|
|
254
|
+
}): Promise<void>;
|
|
250
255
|
private _sendKeystroke;
|
|
251
|
-
type(text: string
|
|
252
|
-
|
|
256
|
+
type(text: string, opts?: {
|
|
257
|
+
human?: boolean;
|
|
258
|
+
}): Promise<void>;
|
|
259
|
+
scroll(opts?: ScrollOptions & {
|
|
260
|
+
human?: boolean;
|
|
261
|
+
}): Promise<void>;
|
|
253
262
|
screenshot(opts?: ScreenshotOptions): Promise<{
|
|
254
263
|
data: string;
|
|
255
264
|
} | Buffer>;
|
|
@@ -418,4 +427,157 @@ declare class ChatSendFailed extends CekiBrowserError {
|
|
|
418
427
|
constructor(status: number, messageText: string);
|
|
419
428
|
}
|
|
420
429
|
|
|
421
|
-
|
|
430
|
+
declare const ROLE_REVIEWER = 5;
|
|
431
|
+
declare const ROLE_QA = 6;
|
|
432
|
+
type Benefitable = {
|
|
433
|
+
type: string;
|
|
434
|
+
value: number;
|
|
435
|
+
};
|
|
436
|
+
type ParticipantSpec = {
|
|
437
|
+
participable_id: number;
|
|
438
|
+
type: 'agent' | 'user' | string;
|
|
439
|
+
role_id: number;
|
|
440
|
+
};
|
|
441
|
+
declare class ContractError extends Error {
|
|
442
|
+
constructor(message: string);
|
|
443
|
+
}
|
|
444
|
+
/** Parse 'agent:N' / 'user:N' into {type, value}. Throws on malformed input. */
|
|
445
|
+
declare function parseBenefitable(value: string | null | undefined): Benefitable | null;
|
|
446
|
+
/** Parse 'agent:N' / 'user:N' into {participable_id, type, role_id}.
|
|
447
|
+
*
|
|
448
|
+
* Wire shape declared by the create-contract-event MCP tool schema:
|
|
449
|
+
* `participable_id` + `type` (short token: 'agent' or 'user') + `role_id`.
|
|
450
|
+
* The MCP tool drops any field it does not know about, so sending
|
|
451
|
+
* `participable_type` (FQCN) silently loses the type and the backend
|
|
452
|
+
* membership lookup defaults to user → misleading 422 "Participant must
|
|
453
|
+
* be a member of the contract". Send `type`.
|
|
454
|
+
*/
|
|
455
|
+
declare function parseParticipant(value: string | null | undefined, roleId: number): ParticipantSpec | null;
|
|
456
|
+
/** Strip undefined and null values; keep 0, false, '', [], {}. */
|
|
457
|
+
declare function cleanArgs<T extends Record<string, unknown>>(o: T): Partial<T>;
|
|
458
|
+
/** Derive a short (<=60 char) label from a desc's first non-empty line. */
|
|
459
|
+
declare function deriveLabel(desc: string | null | undefined): string;
|
|
460
|
+
declare function contractIdsFromEnv(): string[];
|
|
461
|
+
/** Injectable HTTP transport — vitest swaps this out in tests. */
|
|
462
|
+
type HttpResponse = {
|
|
463
|
+
status: number;
|
|
464
|
+
text(): Promise<string>;
|
|
465
|
+
json(): Promise<unknown>;
|
|
466
|
+
};
|
|
467
|
+
interface HttpClient {
|
|
468
|
+
post(url: string, init: {
|
|
469
|
+
headers: Record<string, string>;
|
|
470
|
+
body: string;
|
|
471
|
+
}): Promise<HttpResponse>;
|
|
472
|
+
get(url: string, init: {
|
|
473
|
+
headers: Record<string, string>;
|
|
474
|
+
}): Promise<HttpResponse>;
|
|
475
|
+
}
|
|
476
|
+
type ContractClientOptions = {
|
|
477
|
+
endpoint?: string;
|
|
478
|
+
apiBase?: string;
|
|
479
|
+
token?: string;
|
|
480
|
+
http?: HttpClient;
|
|
481
|
+
timeoutMs?: number;
|
|
482
|
+
};
|
|
483
|
+
type CreateOptions = {
|
|
484
|
+
label: string;
|
|
485
|
+
type?: number;
|
|
486
|
+
status?: number;
|
|
487
|
+
kalScheduleId?: number;
|
|
488
|
+
start?: string;
|
|
489
|
+
end?: string;
|
|
490
|
+
timezone?: string;
|
|
491
|
+
date?: string;
|
|
492
|
+
duration?: number;
|
|
493
|
+
amount?: number;
|
|
494
|
+
currency?: string;
|
|
495
|
+
description?: string;
|
|
496
|
+
data?: Record<string, unknown>;
|
|
497
|
+
benefitable?: string;
|
|
498
|
+
reviewer?: string;
|
|
499
|
+
qa?: string;
|
|
500
|
+
participants?: ParticipantSpec[];
|
|
501
|
+
};
|
|
502
|
+
type CommentOptions = {
|
|
503
|
+
label?: string;
|
|
504
|
+
type?: number;
|
|
505
|
+
status?: number;
|
|
506
|
+
start?: string;
|
|
507
|
+
end?: string;
|
|
508
|
+
date?: string;
|
|
509
|
+
duration?: number;
|
|
510
|
+
amount?: number;
|
|
511
|
+
currency?: string;
|
|
512
|
+
description?: string;
|
|
513
|
+
benefitable?: string;
|
|
514
|
+
};
|
|
515
|
+
type ProposeOptions = {
|
|
516
|
+
status?: number;
|
|
517
|
+
label?: string;
|
|
518
|
+
description?: string;
|
|
519
|
+
start?: string;
|
|
520
|
+
end?: string;
|
|
521
|
+
date?: string;
|
|
522
|
+
duration?: number;
|
|
523
|
+
amount?: number;
|
|
524
|
+
currency?: string;
|
|
525
|
+
benefitable?: string;
|
|
526
|
+
};
|
|
527
|
+
type ProgressOptions = {
|
|
528
|
+
status?: number;
|
|
529
|
+
desc: string;
|
|
530
|
+
};
|
|
531
|
+
type ProgressResult = {
|
|
532
|
+
status_correction: unknown;
|
|
533
|
+
comment: unknown;
|
|
534
|
+
};
|
|
535
|
+
declare class ContractClient {
|
|
536
|
+
readonly endpoint: string;
|
|
537
|
+
readonly apiBase: string;
|
|
538
|
+
readonly token: string;
|
|
539
|
+
private http;
|
|
540
|
+
constructor(opts?: ContractClientOptions);
|
|
541
|
+
private headers;
|
|
542
|
+
private rpc;
|
|
543
|
+
/** Call MCP tool; unwrap content[].text (JSON-parsed) or structuredContent. */
|
|
544
|
+
call(tool: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
545
|
+
tools(): Promise<unknown>;
|
|
546
|
+
raw(tool: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
547
|
+
listContracts(): Promise<unknown>;
|
|
548
|
+
members(contractId: number): Promise<unknown>;
|
|
549
|
+
tasks(contractId: number): Promise<unknown>;
|
|
550
|
+
myJobs(): Promise<unknown>;
|
|
551
|
+
task(eventId: number): Promise<unknown>;
|
|
552
|
+
children(eventId: number): Promise<unknown>;
|
|
553
|
+
history(eventId: number, opts?: {
|
|
554
|
+
limit?: number;
|
|
555
|
+
}): Promise<unknown>;
|
|
556
|
+
create(contractId: number, opts: CreateOptions): Promise<unknown>;
|
|
557
|
+
comment(eventId: number, opts?: CommentOptions): Promise<unknown>;
|
|
558
|
+
propose(eventId: number, opts?: ProposeOptions): Promise<unknown>;
|
|
559
|
+
/** Status correction (optional) + progress comment in one shot.
|
|
560
|
+
*
|
|
561
|
+
* The event's own description is NOT touched. `desc` becomes the
|
|
562
|
+
* body of a child comment-event, not a label/description overwrite
|
|
563
|
+
* on the parent event. Use this for Hand/QA/Reviewer progress
|
|
564
|
+
* reports — `propose --desc` would clobber the parent spec.
|
|
565
|
+
*/
|
|
566
|
+
progress(eventId: number, opts: ProgressOptions): Promise<ProgressResult>;
|
|
567
|
+
vote(eventId: number, ids: number[], vote: boolean): Promise<unknown>;
|
|
568
|
+
/** GET /agent/polling. Returns [] on 429 (rate-limit, 10/min/token). */
|
|
569
|
+
poll(): Promise<unknown[]>;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
type TimelogClientOptions = ContractClientOptions & {
|
|
573
|
+
contract?: ContractClient;
|
|
574
|
+
};
|
|
575
|
+
declare class TimelogClient {
|
|
576
|
+
private c;
|
|
577
|
+
constructor(opts?: TimelogClientOptions);
|
|
578
|
+
start(eventId: number): Promise<unknown>;
|
|
579
|
+
stop(eventId: number, label?: string): Promise<unknown>;
|
|
580
|
+
check(eventId: number): Promise<unknown>;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export { AuthError, type Benefitable, Browser, BrowserChat, type BrowserOption, BrowserProfile, CaptchaError, type CaptchaOptions, type CaptchaResult, CaptchaTimeoutError, CdpUnrecoverable, CekiBrowserError, type ChatHistoryOptions, type ChatMessage, ChatSendFailed, Client, type CommentOptions, type ConnectOptions, ConnectionLost, ContractClient, type ContractClientOptions, ContractError, type CreateOptions, type HttpClient, type HttpResponse, HumanProfile, Humanizer, InsufficientFunds, type Match, NotOwner, type ParticipantSpec, type Profile, type ProfileExportOptions, type ProgressOptions, type ProgressResult, type ProposeOptions, ProviderDisconnected, ProviderOffline, ROLE_QA, ROLE_REVIEWER, RateLimitExceeded, type ReadReceipt, type RentOptions, type ScreenshotOptions, type ScrollOptions, SessionEnded, SessionExpired, type SessionInfo, SessionNotFound, type Snapshot, TimelogClient, type TimelogClientOptions, TimeoutError, TransportError, cleanArgs, connect, contractIdsFromEnv, deriveLabel, parseBenefitable, parseParticipant };
|
package/dist/index.d.ts
CHANGED
|
@@ -242,14 +242,23 @@ declare class Browser {
|
|
|
242
242
|
method: string;
|
|
243
243
|
params?: Record<string, unknown>;
|
|
244
244
|
}, timeout?: number): Promise<unknown>;
|
|
245
|
-
|
|
245
|
+
private _humanizeForCall;
|
|
246
|
+
navigate(url: string, timeout?: number, opts?: {
|
|
247
|
+
human?: boolean;
|
|
248
|
+
}): Promise<{
|
|
246
249
|
url: string;
|
|
247
250
|
frameId?: string;
|
|
248
251
|
}>;
|
|
249
|
-
click(x: number, y: number
|
|
252
|
+
click(x: number, y: number, opts?: {
|
|
253
|
+
human?: boolean;
|
|
254
|
+
}): Promise<void>;
|
|
250
255
|
private _sendKeystroke;
|
|
251
|
-
type(text: string
|
|
252
|
-
|
|
256
|
+
type(text: string, opts?: {
|
|
257
|
+
human?: boolean;
|
|
258
|
+
}): Promise<void>;
|
|
259
|
+
scroll(opts?: ScrollOptions & {
|
|
260
|
+
human?: boolean;
|
|
261
|
+
}): Promise<void>;
|
|
253
262
|
screenshot(opts?: ScreenshotOptions): Promise<{
|
|
254
263
|
data: string;
|
|
255
264
|
} | Buffer>;
|
|
@@ -418,4 +427,157 @@ declare class ChatSendFailed extends CekiBrowserError {
|
|
|
418
427
|
constructor(status: number, messageText: string);
|
|
419
428
|
}
|
|
420
429
|
|
|
421
|
-
|
|
430
|
+
declare const ROLE_REVIEWER = 5;
|
|
431
|
+
declare const ROLE_QA = 6;
|
|
432
|
+
type Benefitable = {
|
|
433
|
+
type: string;
|
|
434
|
+
value: number;
|
|
435
|
+
};
|
|
436
|
+
type ParticipantSpec = {
|
|
437
|
+
participable_id: number;
|
|
438
|
+
type: 'agent' | 'user' | string;
|
|
439
|
+
role_id: number;
|
|
440
|
+
};
|
|
441
|
+
declare class ContractError extends Error {
|
|
442
|
+
constructor(message: string);
|
|
443
|
+
}
|
|
444
|
+
/** Parse 'agent:N' / 'user:N' into {type, value}. Throws on malformed input. */
|
|
445
|
+
declare function parseBenefitable(value: string | null | undefined): Benefitable | null;
|
|
446
|
+
/** Parse 'agent:N' / 'user:N' into {participable_id, type, role_id}.
|
|
447
|
+
*
|
|
448
|
+
* Wire shape declared by the create-contract-event MCP tool schema:
|
|
449
|
+
* `participable_id` + `type` (short token: 'agent' or 'user') + `role_id`.
|
|
450
|
+
* The MCP tool drops any field it does not know about, so sending
|
|
451
|
+
* `participable_type` (FQCN) silently loses the type and the backend
|
|
452
|
+
* membership lookup defaults to user → misleading 422 "Participant must
|
|
453
|
+
* be a member of the contract". Send `type`.
|
|
454
|
+
*/
|
|
455
|
+
declare function parseParticipant(value: string | null | undefined, roleId: number): ParticipantSpec | null;
|
|
456
|
+
/** Strip undefined and null values; keep 0, false, '', [], {}. */
|
|
457
|
+
declare function cleanArgs<T extends Record<string, unknown>>(o: T): Partial<T>;
|
|
458
|
+
/** Derive a short (<=60 char) label from a desc's first non-empty line. */
|
|
459
|
+
declare function deriveLabel(desc: string | null | undefined): string;
|
|
460
|
+
declare function contractIdsFromEnv(): string[];
|
|
461
|
+
/** Injectable HTTP transport — vitest swaps this out in tests. */
|
|
462
|
+
type HttpResponse = {
|
|
463
|
+
status: number;
|
|
464
|
+
text(): Promise<string>;
|
|
465
|
+
json(): Promise<unknown>;
|
|
466
|
+
};
|
|
467
|
+
interface HttpClient {
|
|
468
|
+
post(url: string, init: {
|
|
469
|
+
headers: Record<string, string>;
|
|
470
|
+
body: string;
|
|
471
|
+
}): Promise<HttpResponse>;
|
|
472
|
+
get(url: string, init: {
|
|
473
|
+
headers: Record<string, string>;
|
|
474
|
+
}): Promise<HttpResponse>;
|
|
475
|
+
}
|
|
476
|
+
type ContractClientOptions = {
|
|
477
|
+
endpoint?: string;
|
|
478
|
+
apiBase?: string;
|
|
479
|
+
token?: string;
|
|
480
|
+
http?: HttpClient;
|
|
481
|
+
timeoutMs?: number;
|
|
482
|
+
};
|
|
483
|
+
type CreateOptions = {
|
|
484
|
+
label: string;
|
|
485
|
+
type?: number;
|
|
486
|
+
status?: number;
|
|
487
|
+
kalScheduleId?: number;
|
|
488
|
+
start?: string;
|
|
489
|
+
end?: string;
|
|
490
|
+
timezone?: string;
|
|
491
|
+
date?: string;
|
|
492
|
+
duration?: number;
|
|
493
|
+
amount?: number;
|
|
494
|
+
currency?: string;
|
|
495
|
+
description?: string;
|
|
496
|
+
data?: Record<string, unknown>;
|
|
497
|
+
benefitable?: string;
|
|
498
|
+
reviewer?: string;
|
|
499
|
+
qa?: string;
|
|
500
|
+
participants?: ParticipantSpec[];
|
|
501
|
+
};
|
|
502
|
+
type CommentOptions = {
|
|
503
|
+
label?: string;
|
|
504
|
+
type?: number;
|
|
505
|
+
status?: number;
|
|
506
|
+
start?: string;
|
|
507
|
+
end?: string;
|
|
508
|
+
date?: string;
|
|
509
|
+
duration?: number;
|
|
510
|
+
amount?: number;
|
|
511
|
+
currency?: string;
|
|
512
|
+
description?: string;
|
|
513
|
+
benefitable?: string;
|
|
514
|
+
};
|
|
515
|
+
type ProposeOptions = {
|
|
516
|
+
status?: number;
|
|
517
|
+
label?: string;
|
|
518
|
+
description?: string;
|
|
519
|
+
start?: string;
|
|
520
|
+
end?: string;
|
|
521
|
+
date?: string;
|
|
522
|
+
duration?: number;
|
|
523
|
+
amount?: number;
|
|
524
|
+
currency?: string;
|
|
525
|
+
benefitable?: string;
|
|
526
|
+
};
|
|
527
|
+
type ProgressOptions = {
|
|
528
|
+
status?: number;
|
|
529
|
+
desc: string;
|
|
530
|
+
};
|
|
531
|
+
type ProgressResult = {
|
|
532
|
+
status_correction: unknown;
|
|
533
|
+
comment: unknown;
|
|
534
|
+
};
|
|
535
|
+
declare class ContractClient {
|
|
536
|
+
readonly endpoint: string;
|
|
537
|
+
readonly apiBase: string;
|
|
538
|
+
readonly token: string;
|
|
539
|
+
private http;
|
|
540
|
+
constructor(opts?: ContractClientOptions);
|
|
541
|
+
private headers;
|
|
542
|
+
private rpc;
|
|
543
|
+
/** Call MCP tool; unwrap content[].text (JSON-parsed) or structuredContent. */
|
|
544
|
+
call(tool: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
545
|
+
tools(): Promise<unknown>;
|
|
546
|
+
raw(tool: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
547
|
+
listContracts(): Promise<unknown>;
|
|
548
|
+
members(contractId: number): Promise<unknown>;
|
|
549
|
+
tasks(contractId: number): Promise<unknown>;
|
|
550
|
+
myJobs(): Promise<unknown>;
|
|
551
|
+
task(eventId: number): Promise<unknown>;
|
|
552
|
+
children(eventId: number): Promise<unknown>;
|
|
553
|
+
history(eventId: number, opts?: {
|
|
554
|
+
limit?: number;
|
|
555
|
+
}): Promise<unknown>;
|
|
556
|
+
create(contractId: number, opts: CreateOptions): Promise<unknown>;
|
|
557
|
+
comment(eventId: number, opts?: CommentOptions): Promise<unknown>;
|
|
558
|
+
propose(eventId: number, opts?: ProposeOptions): Promise<unknown>;
|
|
559
|
+
/** Status correction (optional) + progress comment in one shot.
|
|
560
|
+
*
|
|
561
|
+
* The event's own description is NOT touched. `desc` becomes the
|
|
562
|
+
* body of a child comment-event, not a label/description overwrite
|
|
563
|
+
* on the parent event. Use this for Hand/QA/Reviewer progress
|
|
564
|
+
* reports — `propose --desc` would clobber the parent spec.
|
|
565
|
+
*/
|
|
566
|
+
progress(eventId: number, opts: ProgressOptions): Promise<ProgressResult>;
|
|
567
|
+
vote(eventId: number, ids: number[], vote: boolean): Promise<unknown>;
|
|
568
|
+
/** GET /agent/polling. Returns [] on 429 (rate-limit, 10/min/token). */
|
|
569
|
+
poll(): Promise<unknown[]>;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
type TimelogClientOptions = ContractClientOptions & {
|
|
573
|
+
contract?: ContractClient;
|
|
574
|
+
};
|
|
575
|
+
declare class TimelogClient {
|
|
576
|
+
private c;
|
|
577
|
+
constructor(opts?: TimelogClientOptions);
|
|
578
|
+
start(eventId: number): Promise<unknown>;
|
|
579
|
+
stop(eventId: number, label?: string): Promise<unknown>;
|
|
580
|
+
check(eventId: number): Promise<unknown>;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export { AuthError, type Benefitable, Browser, BrowserChat, type BrowserOption, BrowserProfile, CaptchaError, type CaptchaOptions, type CaptchaResult, CaptchaTimeoutError, CdpUnrecoverable, CekiBrowserError, type ChatHistoryOptions, type ChatMessage, ChatSendFailed, Client, type CommentOptions, type ConnectOptions, ConnectionLost, ContractClient, type ContractClientOptions, ContractError, type CreateOptions, type HttpClient, type HttpResponse, HumanProfile, Humanizer, InsufficientFunds, type Match, NotOwner, type ParticipantSpec, type Profile, type ProfileExportOptions, type ProgressOptions, type ProgressResult, type ProposeOptions, ProviderDisconnected, ProviderOffline, ROLE_QA, ROLE_REVIEWER, RateLimitExceeded, type ReadReceipt, type RentOptions, type ScreenshotOptions, type ScrollOptions, SessionEnded, SessionExpired, type SessionInfo, SessionNotFound, type Snapshot, TimelogClient, type TimelogClientOptions, TimeoutError, TransportError, cleanArgs, connect, contractIdsFromEnv, deriveLabel, parseBenefitable, parseParticipant };
|