@playdrop/playdrop-cli 0.12.31 → 0.12.33

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.
Files changed (27) hide show
  1. package/config/client-meta.json +2 -2
  2. package/dist/apiClient.js +16 -1
  3. package/dist/commands/upload.js +2 -0
  4. package/dist/commands/worker/runtime.d.ts +2 -0
  5. package/dist/commands/worker/runtime.js +14 -10
  6. package/dist/commands/worker.d.ts +23 -30
  7. package/dist/commands/worker.js +639 -656
  8. package/dist/index.js +6 -0
  9. package/node_modules/@playdrop/api-client/dist/client.d.ts +2 -1
  10. package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
  11. package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +2 -1
  12. package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts.map +1 -1
  13. package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.js +11 -0
  14. package/node_modules/@playdrop/api-client/dist/index.d.ts +3 -2
  15. package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
  16. package/node_modules/@playdrop/api-client/dist/index.js +5 -0
  17. package/node_modules/@playdrop/config/client-meta.json +2 -2
  18. package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts +5 -0
  19. package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts.map +1 -0
  20. package/node_modules/@playdrop/types/dist/agent-task-terminal.js +117 -0
  21. package/node_modules/@playdrop/types/dist/api.d.ts +100 -102
  22. package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
  23. package/node_modules/@playdrop/types/dist/api.js +1 -1
  24. package/node_modules/@playdrop/types/dist/index.d.ts +1 -0
  25. package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
  26. package/node_modules/@playdrop/types/dist/index.js +3 -1
  27. package/package.json +1 -1
@@ -0,0 +1,117 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var agent_task_terminal_exports = {};
19
+ __export(agent_task_terminal_exports, {
20
+ cancelledTerminalReason: () => cancelledTerminalReason,
21
+ classifyAgentTaskTerminalReason: () => classifyAgentTaskTerminalReason,
22
+ queueExpiredTerminalReason: () => queueExpiredTerminalReason
23
+ });
24
+ module.exports = __toCommonJS(agent_task_terminal_exports);
25
+ function classifyAgentTaskTerminalReason(rawError, source) {
26
+ const raw = rawError.trim() || "agent_failure";
27
+ const lower = raw.toLowerCase();
28
+ const candidates = [
29
+ matchFailure(lower, /(upload_validation(?::[a-z0-9_.-]+)?|upload[^\n.!?]{0,80}validat|validat(?:e|ion)[^\n.!?]{0,80}upload|invalid[^\n.!?]{0,80}archive|invalid[^\n.!?]{0,80}catalogue)/, {
30
+ category: "upload_validation",
31
+ retryable: false,
32
+ source,
33
+ message: "The uploaded result did not pass validation."
34
+ }),
35
+ matchFailure(lower, /(instrument_error(?::[a-z0-9_.-]+)?|browser_control|renderer|screenshot|playwright|chrome instrument|waitforselector|(?:native )?listing recorder)/, {
36
+ category: "instrument_error",
37
+ retryable: true,
38
+ source: "instrument",
39
+ message: "The required browser or capture instrument failed."
40
+ }),
41
+ matchFailure(lower, /(capacity|overloaded|rate.?limit|too many requests|quota|(?:^|\D)429(?:\D|$))/, {
42
+ category: "provider_capacity",
43
+ retryable: true,
44
+ source: "provider",
45
+ message: "The agent provider had no available capacity."
46
+ }),
47
+ matchFailure(lower, /(econnreset|econnrefused|connection|network|socket|disconnected|dns|fetch failed)/, {
48
+ category: "provider_connection",
49
+ retryable: true,
50
+ source: "provider",
51
+ message: "The connection to the agent provider was lost."
52
+ }),
53
+ matchFailure(lower, /(timed? ?out|timeout|deadline exceeded)/, {
54
+ category: "provider_timeout",
55
+ retryable: true,
56
+ source: "provider",
57
+ message: "The agent provider did not finish before the timeout."
58
+ })
59
+ ].filter((candidate) => candidate !== null).sort((a, b) => a.index - b.index);
60
+ const firstSpecificFailure = candidates[0];
61
+ if (firstSpecificFailure) {
62
+ return terminal(firstSpecificFailure.category, raw, firstSpecificFailure.retryable, firstSpecificFailure.source, firstSpecificFailure.message, firstSpecificFailure.code);
63
+ }
64
+ const interrupted = /(worker_shutdown|worker_session_expired|agent_task_stale_running_reaped|lease_expired|signal_|sigterm|sigkill|interrupted)/.test(lower);
65
+ return terminal("agent_failure", raw, interrupted, source, interrupted ? "The agent process was interrupted." : "The agent failed to complete the task.", interrupted ? "interrupted_worker_process" : "agent_failure");
66
+ }
67
+ function matchFailure(raw, pattern, failure) {
68
+ const match = pattern.exec(raw);
69
+ if (!match) {
70
+ return null;
71
+ }
72
+ const specificCode = /^(?:instrument_error|upload_validation):[a-z0-9_.-]+$/.test(match[0]) ? match[0] : failure.category;
73
+ return {
74
+ ...failure,
75
+ index: match.index,
76
+ code: specificCode
77
+ };
78
+ }
79
+ function queueExpiredTerminalReason(rawError) {
80
+ return {
81
+ kind: "expiration",
82
+ category: "queue_expired",
83
+ code: rawError.trim() || "queue_expired",
84
+ message: "The task expired before a compatible worker could start it.",
85
+ retryable: true,
86
+ rawError: rawError.trim() || null,
87
+ source: "server"
88
+ };
89
+ }
90
+ function cancelledTerminalReason(code = "cancelled") {
91
+ return {
92
+ kind: "cancellation",
93
+ category: "cancelled",
94
+ code,
95
+ message: "The task was cancelled.",
96
+ retryable: false,
97
+ rawError: null,
98
+ source: "server"
99
+ };
100
+ }
101
+ function terminal(category, rawError, retryable, source, message, code = category) {
102
+ return {
103
+ kind: "failure",
104
+ category,
105
+ code,
106
+ message,
107
+ retryable,
108
+ rawError,
109
+ source
110
+ };
111
+ }
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ cancelledTerminalReason,
115
+ classifyAgentTaskTerminalReason,
116
+ queueExpiredTerminalReason
117
+ });
@@ -130,8 +130,11 @@ export interface ContentTagSummary {
130
130
  slug: string;
131
131
  displayName: string;
132
132
  }
133
- export declare const AGENT_TASK_STATUS_VALUES: readonly ["QUEUED", "RUNNING", "DONE", "FAILED", "CANCELLED"];
133
+ export declare const AGENT_TASK_STATUS_VALUES: readonly ["QUEUED", "RUNNING", "DONE", "FAILED", "EXPIRED", "CANCELLED"];
134
134
  export type AgentTaskStatus = typeof AGENT_TASK_STATUS_VALUES[number];
135
+ export type JsonValue = null | boolean | number | string | JsonValue[] | {
136
+ [key: string]: JsonValue;
137
+ };
135
138
  export declare const AGENT_TASK_CREATOR_FEEDBACK_STATUS_VALUES: readonly ["UNSEEN", "VIEWED", "PLAYED", "APPROVED", "DISAPPROVED"];
136
139
  export type AgentTaskCreatorFeedbackStatus = typeof AGENT_TASK_CREATOR_FEEDBACK_STATUS_VALUES[number];
137
140
  export declare const AGENT_TASK_KIND_VALUES: readonly ["NEW_GAME", "REMIX_GAME", "GAME_UPDATE", "GAME_REVIEW", "GAME_EVAL"];
@@ -174,6 +177,7 @@ export type AgentAvailabilityFailureReason = typeof AGENT_TASK_AVAILABILITY_FAIL
174
177
  export interface AgentAttemptOption {
175
178
  agent: AgentRuntime;
176
179
  model: string;
180
+ reasoningEffort?: string | null;
177
181
  }
178
182
  export interface AgentAttemptPlan {
179
183
  options: AgentAttemptOption[];
@@ -182,6 +186,7 @@ export interface AgentAttemptResult {
182
186
  attemptIndex: number;
183
187
  agent: AgentRuntime;
184
188
  model: string;
189
+ reasoningEffort?: string | null;
185
190
  status: 'selected' | 'unavailable' | 'started' | 'completed' | 'failed';
186
191
  reason?: AgentAvailabilityFailureReason | string | null;
187
192
  message?: string | null;
@@ -211,6 +216,7 @@ export interface AgentWorkerCapabilities {
211
216
  cliVersion?: string;
212
217
  authenticated?: boolean;
213
218
  models?: string[];
219
+ acceptsCustomModels?: boolean;
214
220
  ready?: boolean;
215
221
  }>;
216
222
  ready?: boolean;
@@ -269,6 +275,18 @@ export interface AgentTaskAgentModelSelection {
269
275
  export interface AgentTaskAgentModelOption extends AgentTaskAgentModelSelection {
270
276
  label: string;
271
277
  onlineWorkers: number;
278
+ totalSlots: number;
279
+ runningTasks: number;
280
+ availableSlots: number;
281
+ }
282
+ export interface AgentTaskTerminalReason {
283
+ kind: 'failure' | 'expiration' | 'cancellation';
284
+ category: 'provider_capacity' | 'provider_connection' | 'provider_timeout' | 'instrument_error' | 'upload_validation' | 'agent_failure' | 'queue_expired' | 'cancelled';
285
+ code: string;
286
+ message: string;
287
+ retryable: boolean;
288
+ rawError: string | null;
289
+ source: 'server' | 'worker' | 'agent' | 'provider' | 'instrument';
272
290
  }
273
291
  export interface AgentTaskRefundResponse {
274
292
  state: 'refunded' | 'withheld';
@@ -295,7 +313,7 @@ export interface AgentTaskNextStepSuggestion {
295
313
  }
296
314
  export interface AgentTaskResponse {
297
315
  id: number;
298
- pluginBundleSha?: string | null;
316
+ agentBundleSha?: string | null;
299
317
  workerCliVersion: string | null;
300
318
  platformReleaseSha: string | null;
301
319
  kind: AgentTaskKind;
@@ -335,6 +353,7 @@ export interface AgentTaskResponse {
335
353
  nextSteps: AgentTaskNextStepSuggestion[];
336
354
  creatorFeedbackStatus: AgentTaskCreatorFeedbackStatus;
337
355
  error: string | null;
356
+ terminalReason: AgentTaskTerminalReason | null;
338
357
  workerId?: number | null;
339
358
  workerName?: string | null;
340
359
  lastHeartbeatAt: string | null;
@@ -382,7 +401,7 @@ export interface AgentTaskAttachmentInput {
382
401
  export interface AgentTaskAttachmentUploadResponse {
383
402
  attachment: AgentTaskAttachmentInput;
384
403
  }
385
- export type AgentTaskInputKind = 'prompt' | 'MEDIA' | 'GAME_PLAN' | 'REFERENCE_GAME' | 'REFERENCE_ASSET' | 'REFERENCE_PACK';
404
+ export type AgentTaskInputKind = 'MEDIA' | 'GAME_PLAN' | 'REFERENCE_GAME' | 'REFERENCE_ASSET' | 'REFERENCE_PACK';
386
405
  export type GamePlanQuestionId = 'graphics' | 'surface_targets' | 'genre' | 'theme' | 'controls' | 'player_goal' | 'challenge' | 'first_version_scope' | 'notes';
387
406
  export type GamePlanQuestionKind = 'SINGLE_CHOICE' | 'MULTI_CHOICE' | 'TEXT';
388
407
  export interface GamePlanSelectedOption {
@@ -402,10 +421,6 @@ export interface AgentTaskInputBase {
402
421
  kind: AgentTaskInputKind;
403
422
  note?: string | null;
404
423
  }
405
- export interface AgentTaskPromptInput extends AgentTaskInputBase {
406
- kind: 'prompt';
407
- text?: string | null;
408
- }
409
424
  export interface AgentTaskMediaInput extends AgentTaskInputBase {
410
425
  kind: 'MEDIA';
411
426
  media: AgentTaskAttachmentInput;
@@ -426,7 +441,7 @@ export interface AgentTaskReferenceInput extends AgentTaskInputBase {
426
441
  displayName?: string | null;
427
442
  };
428
443
  }
429
- export type AgentTaskInput = AgentTaskPromptInput | AgentTaskMediaInput | AgentTaskGamePlanInput | AgentTaskReferenceInput;
444
+ export type AgentTaskInput = AgentTaskMediaInput | AgentTaskGamePlanInput | AgentTaskReferenceInput;
430
445
  export interface CreateNewGameAgentTaskRequest {
431
446
  target: AgentExecutionTarget;
432
447
  agent?: AgentRuntime;
@@ -435,8 +450,7 @@ export interface CreateNewGameAgentTaskRequest {
435
450
  prompt: string;
436
451
  surfaceContext?: AgentTaskSurfaceContextRequest;
437
452
  inputs?: AgentTaskInput[];
438
- pluginBundleBase64?: string;
439
- pluginBundleFileName?: string;
453
+ agentBundleSha?: string;
440
454
  }
441
455
  export interface CreateNewGameAgentTaskResponse {
442
456
  task: AgentTaskResponse;
@@ -451,8 +465,7 @@ export interface CreateRemixGameAgentTaskRequest {
451
465
  sourceAppVersionRef: string;
452
466
  surfaceContext?: AgentTaskSurfaceContextRequest;
453
467
  inputs?: AgentTaskInput[];
454
- pluginBundleBase64?: string;
455
- pluginBundleFileName?: string;
468
+ agentBundleSha?: string;
456
469
  }
457
470
  export interface CreateRemixGameAgentTaskResponse {
458
471
  task: AgentTaskResponse;
@@ -471,8 +484,7 @@ export interface CreateGameEvalAgentTaskRequest {
471
484
  judgePromptVersion: string;
472
485
  tieBand?: number | null;
473
486
  targets: GameEvalTargetInput[];
474
- pluginBundleBase64?: string;
475
- pluginBundleFileName?: string;
487
+ agentBundleSha?: string;
476
488
  }
477
489
  export interface CreateGameEvalAgentTaskResponse {
478
490
  task: AgentTaskResponse;
@@ -530,114 +542,98 @@ export interface WorkerPresenceResponse {
530
542
  action?: 'continue' | 'quiesce_for_update';
531
543
  updatePolicy?: AgentWorkerUpdatePolicyResponse | null;
532
544
  }
533
- export interface WorkerClaimAgentTaskRequest {
545
+ export interface WorkerClaimTaskRequestV2 {
546
+ protocolVersion: 2;
534
547
  workerKey: string;
535
548
  capabilities: AgentWorkerCapabilities;
536
549
  }
537
- export interface WorkerAgentTaskBaseSourceResponse {
538
- creatorUsername: string;
539
- appName: string;
540
- version: string;
541
- appId: number;
542
- appVersionId: number;
543
- }
544
- export interface WorkerAgentTaskRemixSourceResponse extends WorkerAgentTaskBaseSourceResponse {
545
- ref: string;
546
- appDisplayName?: string | null;
547
- }
548
- export interface WorkerAgentTaskReviewTargetResponse {
549
- creatorUsername: string;
550
- appName: string;
551
- appDisplayName: string | null;
552
- version: string;
553
- appId: number;
554
- appVersionId: number;
555
- reviewState: ReviewState;
556
- surfaceTargets: AppSurface[];
557
- launchUrl: string;
558
- }
559
- export interface WorkerAgentTaskEvalTargetResponse {
560
- targetId: string;
561
- creatorUsername: string;
562
- appName: string;
563
- appDisplayName: string | null;
564
- version: string;
565
- appId: number;
566
- appVersionId: number;
567
- appVersionRef: string;
568
- creatorPrompt: string | null;
569
- surfaceTargets: AppSurface[];
570
- heroImageUrl: string | null;
571
- iconImageUrl: string | null;
572
- launchUrl: string;
573
- }
574
- export interface WorkerAgentTaskEvalResponse {
575
- mode: GameEvalMode;
576
- judgePromptVersion: string;
577
- tieBand: number | null;
578
- targets: WorkerAgentTaskEvalTargetResponse[];
579
- }
580
- export interface WorkerAgentTaskPluginBundleResponse {
550
+ export interface WorkerTaskPluginV2 {
581
551
  sha256: string;
582
552
  fileName: string;
583
553
  sizeBytes: number;
584
554
  contentBase64: string;
585
555
  }
586
- export interface WorkerAgentTaskWorkspaceFileResponse {
587
- relativePath: string;
556
+ export interface WorkerTaskWorkspaceArchiveV2 {
557
+ path: string;
558
+ format: 'zip';
559
+ sha256: string;
560
+ sizeBytes: number;
561
+ contentBase64: string;
562
+ }
563
+ export interface WorkerTaskWorkspaceFileV2 {
564
+ path: string;
565
+ sha256: string;
566
+ sizeBytes: number;
567
+ contentType: string;
588
568
  contentBase64: string;
589
- contentType?: string;
590
569
  }
591
- export interface WorkerAgentTaskAttachmentResponse {
570
+ export interface WorkerTaskAttachmentV2 {
592
571
  id: string;
572
+ path: string;
593
573
  fileName: string;
594
574
  contentType: string;
595
575
  sizeBytes: number;
596
- relativePath: string;
576
+ sha256: string;
597
577
  description?: string | null;
598
578
  }
599
- export interface WorkerAgentTaskAssignmentResponse {
600
- taskId: number;
601
- taskToken: string;
602
- kind: AgentTaskKind;
603
- target: AgentExecutionTarget;
604
- agent: AgentRuntime;
605
- model: string;
606
- attemptPlan?: AgentAttemptPlan | null;
607
- selectedAttempt?: AgentAttemptOption | null;
579
+ export interface WorkerTaskAssignmentV2 {
580
+ task: {
581
+ id: number;
582
+ token: string;
583
+ type: string;
584
+ executionTarget: AgentExecutionTarget;
585
+ attempt: number;
586
+ metadata: Record<string, JsonValue>;
587
+ };
608
588
  workspace: {
609
589
  folderName: string;
610
- files: WorkerAgentTaskWorkspaceFileResponse[];
590
+ archives: WorkerTaskWorkspaceArchiveV2[];
591
+ files: WorkerTaskWorkspaceFileV2[];
611
592
  };
612
- inputs: {
613
- request: {
614
- prompt: string;
615
- surfaceContext?: AgentTaskSurfaceContext;
616
- };
617
- taskInputs?: AgentTaskInput[];
618
- attachments: WorkerAgentTaskAttachmentResponse[];
619
- baseSource: WorkerAgentTaskBaseSourceResponse | null;
620
- remixSource?: WorkerAgentTaskRemixSourceResponse | null;
621
- reviewTarget?: WorkerAgentTaskReviewTargetResponse | null;
622
- evalTarget?: WorkerAgentTaskEvalResponse | null;
623
- allowedTemplateKeys?: string[];
593
+ plugin: WorkerTaskPluginV2 | null;
594
+ request: {
595
+ prompt: string;
596
+ attachments: WorkerTaskAttachmentV2[];
624
597
  };
625
- pluginBundle: WorkerAgentTaskPluginBundleResponse;
626
- output: {
627
- appId: number | null;
628
- appName: string | null;
629
- version: string;
630
- releaseNoteRequired: boolean;
598
+ agent: {
599
+ runtime: AgentRuntime;
600
+ model: string;
601
+ reasoningEffort: string | null;
602
+ browser: 'NONE' | 'CHROME' | 'PLAYWRIGHT';
631
603
  };
632
- prompt: string;
633
604
  }
634
- export interface WorkerClaimAgentTaskResponse {
635
- task: AgentTaskResponse | null;
636
- action?: 'continue' | 'quiesce_for_update';
637
- updatePolicy?: AgentWorkerUpdatePolicyResponse | null;
638
- taskAssignment?: WorkerAgentTaskAssignmentResponse;
639
- leaseToken?: string;
640
- leaseExpiresAt?: string;
605
+ export type WorkerClaimTaskResponseV2 = {
606
+ protocolVersion: 2;
607
+ action: 'idle' | 'quiesce_for_update';
608
+ assignment: null;
609
+ lease: null;
610
+ updatePolicy: AgentWorkerUpdatePolicyResponse | null;
611
+ } | {
612
+ protocolVersion: 2;
613
+ action: 'run';
614
+ assignment: WorkerTaskAssignmentV2;
615
+ lease: {
616
+ token: string;
617
+ expiresAt: string;
618
+ };
619
+ updatePolicy: AgentWorkerUpdatePolicyResponse | null;
620
+ };
621
+ export type WorkerClaimAgentTaskRequest = WorkerClaimTaskRequestV2;
622
+ export type WorkerClaimAgentTaskResponse = WorkerClaimTaskResponseV2;
623
+ export interface RegisterAgentBundleRequest {
624
+ sha256: string;
625
+ fileName: string;
626
+ contentBase64: string;
627
+ }
628
+ export interface RegisterAgentBundleResponse {
629
+ created: boolean;
630
+ bundle: {
631
+ sha256: string;
632
+ fileName: string;
633
+ sizeBytes: number;
634
+ registrationSource: 'EVAL';
635
+ createdAt: string;
636
+ };
641
637
  }
642
638
  export interface WorkerClaimAgentTaskSlugRequest {
643
639
  appName: string;
@@ -746,6 +742,7 @@ export interface AgentTaskRunResponse {
746
742
  tokenUsage: AgentTaskRunTokenUsageResponse;
747
743
  availableSkillPaths: string[];
748
744
  observedSkillPaths: string[];
745
+ terminalReason: AgentTaskTerminalReason | null;
749
746
  startedAt: string | null;
750
747
  completedAt: string | null;
751
748
  createdAt: string;
@@ -789,6 +786,7 @@ export interface WorkerRecordAgentTaskRunTelemetryRequest {
789
786
  observedSkillPaths?: string[];
790
787
  startedAt?: string | null;
791
788
  completedAt?: string | null;
789
+ terminalReason?: AgentTaskTerminalReason | null;
792
790
  }
793
791
  export interface WorkerRecordAgentTaskRunTelemetryResponse {
794
792
  run: AgentTaskRunResponse;
@@ -869,6 +867,7 @@ export interface WorkerFailAgentTaskRequest {
869
867
  workerKey?: string;
870
868
  leaseToken?: string;
871
869
  error: string;
870
+ terminalReason: AgentTaskTerminalReason;
872
871
  result?: Record<string, unknown>;
873
872
  }
874
873
  export interface AdminAgentTasksResponse {
@@ -950,8 +949,7 @@ export interface CreateAppAgentTaskRequest {
950
949
  prompt: string;
951
950
  surfaceContext?: AgentTaskSurfaceContextRequest;
952
951
  inputs?: AgentTaskInput[];
953
- pluginBundleBase64?: string;
954
- pluginBundleFileName?: string;
952
+ agentBundleSha?: string;
955
953
  }
956
954
  export interface CreateAppAgentTaskResponse {
957
955
  task: AgentTaskResponse;