@playdrop/playdrop-cli 0.12.32 → 0.12.34
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/config/client-meta.json +2 -2
- package/dist/apiClient.js +16 -1
- package/dist/commandContext.js +3 -0
- package/dist/commands/upload.js +2 -0
- package/dist/commands/worker/runtime.d.ts +2 -0
- package/dist/commands/worker/runtime.js +14 -10
- package/dist/commands/worker.d.ts +9 -29
- package/dist/commands/worker.js +604 -660
- package/dist/index.js +6 -0
- package/dist/workspaceAuth.d.ts +1 -0
- package/dist/workspaceAuth.js +59 -0
- package/node_modules/@playdrop/api-client/dist/client.d.ts +2 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +2 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.js +11 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +3 -2
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +5 -0
- package/node_modules/@playdrop/config/client-meta.json +2 -2
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts +5 -0
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/agent-task-terminal.js +117 -0
- package/node_modules/@playdrop/types/dist/api.d.ts +97 -103
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +1 -1
- package/node_modules/@playdrop/types/dist/index.d.ts +1 -0
- package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/index.js +3 -1
- package/package.json +1 -1
package/config/client-meta.json
CHANGED
package/dist/apiClient.js
CHANGED
|
@@ -14,14 +14,29 @@ function readPositiveIntEnv(name) {
|
|
|
14
14
|
const parsed = Number(raw);
|
|
15
15
|
return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
|
|
16
16
|
}
|
|
17
|
+
function readWorkerTaskTokenEnv() {
|
|
18
|
+
if (process.env.PLAYDROP_WORKER_CONTEXT !== '1') {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
const token = process.env.PLAYDROP_WORKER_TASK_TOKEN?.trim() ?? '';
|
|
22
|
+
if (!token) {
|
|
23
|
+
throw new Error('worker_task_token_missing');
|
|
24
|
+
}
|
|
25
|
+
return token;
|
|
26
|
+
}
|
|
17
27
|
function createCliClientHeaders(input) {
|
|
18
28
|
const onBehalfCreatorUsername = input.onBehalfCreatorUsername;
|
|
19
29
|
const creatorUsername = typeof onBehalfCreatorUsername === 'string'
|
|
20
30
|
? onBehalfCreatorUsername.trim()
|
|
21
31
|
: '';
|
|
22
|
-
const
|
|
32
|
+
const explicitAgentTaskToken = typeof input.agentTaskToken === 'string'
|
|
23
33
|
? input.agentTaskToken.trim()
|
|
24
34
|
: '';
|
|
35
|
+
const workerTaskToken = readWorkerTaskTokenEnv();
|
|
36
|
+
if (explicitAgentTaskToken && workerTaskToken && explicitAgentTaskToken !== workerTaskToken) {
|
|
37
|
+
throw new Error('worker_task_token_mismatch');
|
|
38
|
+
}
|
|
39
|
+
const agentTaskToken = explicitAgentTaskToken || workerTaskToken;
|
|
25
40
|
const agentTaskId = Number.isInteger(input.agentTaskId) && Number(input.agentTaskId) > 0
|
|
26
41
|
? Number(input.agentTaskId)
|
|
27
42
|
: readPositiveIntEnv('PLAYDROP_WORKER_TASK_ID');
|
package/dist/commandContext.js
CHANGED
|
@@ -112,6 +112,9 @@ async function loadWorkspaceAwareConfig(command, options) {
|
|
|
112
112
|
?? (process.env.PLAYDROP_WORKER_CONTEXT === '1' ? process.cwd() : undefined);
|
|
113
113
|
try {
|
|
114
114
|
workspaceAuth = workspacePath ? (0, workspaceAuth_1.findWorkspaceAuthConfig)(workspacePath) : null;
|
|
115
|
+
if (!workspaceAuth && workspacePath && process.env.PLAYDROP_WORKER_CONTEXT === '1') {
|
|
116
|
+
workspaceAuth = (0, workspaceAuth_1.findWorkerTaskWorkspaceAuthConfig)(workspacePath);
|
|
117
|
+
}
|
|
115
118
|
}
|
|
116
119
|
catch (error) {
|
|
117
120
|
if (error instanceof workspaceAuth_1.WorkspaceAuthConfigError) {
|
package/dist/commands/upload.js
CHANGED
|
@@ -61,6 +61,7 @@ export declare function buildCodexExecArgs(input: {
|
|
|
61
61
|
reasoningEffort: string;
|
|
62
62
|
networkAccess: boolean;
|
|
63
63
|
sandboxMode?: CodexSandboxMode;
|
|
64
|
+
imagePaths?: string[];
|
|
64
65
|
}): string[];
|
|
65
66
|
export type CodexSandboxMode = 'danger-full-access' | 'workspace-write' | 'read-only';
|
|
66
67
|
export declare function readCodexSandboxMode(env?: NodeJS.ProcessEnv): CodexSandboxMode;
|
|
@@ -89,6 +90,7 @@ export declare function buildClaudeDeniedPermissionRules(denyReadRoots?: string[
|
|
|
89
90
|
export declare function buildWorkerChildEnv(input: {
|
|
90
91
|
binDir: string;
|
|
91
92
|
taskId: number;
|
|
93
|
+
taskToken: string;
|
|
92
94
|
attempt: number;
|
|
93
95
|
envName: string;
|
|
94
96
|
eventDir?: string;
|
|
@@ -456,8 +456,6 @@ function buildCodexExecArgs(input) {
|
|
|
456
456
|
'exec',
|
|
457
457
|
'--json',
|
|
458
458
|
'--ephemeral',
|
|
459
|
-
'--ignore-user-config',
|
|
460
|
-
'--ignore-rules',
|
|
461
459
|
'--sandbox',
|
|
462
460
|
sandboxMode,
|
|
463
461
|
'--cd',
|
|
@@ -467,11 +465,14 @@ function buildCodexExecArgs(input) {
|
|
|
467
465
|
input.model,
|
|
468
466
|
'-c',
|
|
469
467
|
`model_reasoning_effort="${input.reasoningEffort}"`,
|
|
470
|
-
'-',
|
|
471
468
|
];
|
|
472
469
|
if (sandboxMode === 'workspace-write') {
|
|
473
|
-
args.
|
|
470
|
+
args.push('-c', `sandbox_workspace_write.network_access=${input.networkAccess ? 'true' : 'false'}`);
|
|
474
471
|
}
|
|
472
|
+
for (const imagePath of input.imagePaths ?? []) {
|
|
473
|
+
args.push('--image', imagePath);
|
|
474
|
+
}
|
|
475
|
+
args.push('-');
|
|
475
476
|
return args;
|
|
476
477
|
}
|
|
477
478
|
function readCodexSandboxMode(env = process.env) {
|
|
@@ -516,15 +517,13 @@ function buildClaudeExecArgs(input) {
|
|
|
516
517
|
: input.playwrightMcp
|
|
517
518
|
? [...allowedPermissionRules, PLAYWRIGHT_MCP_ALLOWED_TOOL_RULE]
|
|
518
519
|
: allowedPermissionRules;
|
|
519
|
-
// --safe-mode disables ALL MCP servers, including ones passed explicitly via --mcp-config
|
|
520
|
-
// (verified empirically on claude 2.1.207). Playwright judge sessions therefore drop it:
|
|
521
|
-
// their CLAUDE_CONFIG_DIR is an isolated per-task directory with no user customizations,
|
|
522
|
-
// so the surface --safe-mode guards is already empty, while --strict-mcp-config and the
|
|
523
|
-
// permission rules below stay in force.
|
|
524
520
|
const args = [
|
|
525
521
|
'-p',
|
|
526
|
-
...(input.playwrightMcp ? [] : ['--safe-mode']),
|
|
527
522
|
'--strict-mcp-config',
|
|
523
|
+
'--setting-sources',
|
|
524
|
+
'project',
|
|
525
|
+
'--input-format',
|
|
526
|
+
'stream-json',
|
|
528
527
|
'--model',
|
|
529
528
|
model,
|
|
530
529
|
'--output-format',
|
|
@@ -745,10 +744,15 @@ function buildWorkerChildEnv(input) {
|
|
|
745
744
|
}
|
|
746
745
|
}
|
|
747
746
|
child.PLAYDROP_WORKER_CONTEXT = '1';
|
|
747
|
+
const taskToken = input.taskToken.trim();
|
|
748
|
+
if (!taskToken) {
|
|
749
|
+
throw new Error('invalid_worker_task_token');
|
|
750
|
+
}
|
|
748
751
|
if (!Number.isInteger(input.attempt) || input.attempt <= 0) {
|
|
749
752
|
throw new Error('invalid_worker_task_attempt');
|
|
750
753
|
}
|
|
751
754
|
child.PLAYDROP_WORKER_TASK_ID = String(input.taskId);
|
|
755
|
+
child.PLAYDROP_WORKER_TASK_TOKEN = taskToken;
|
|
752
756
|
child.PLAYDROP_WORKER_TASK_ATTEMPT = String(input.attempt);
|
|
753
757
|
if (input.devPort !== undefined) {
|
|
754
758
|
if (!Number.isInteger(input.devPort) || input.devPort <= 0 || input.devPort > 65535) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ApiClient } from '@playdrop/api-client';
|
|
2
|
-
import { type AgentExecutionTarget, type AgentRuntime, type
|
|
2
|
+
import { type AgentExecutionTarget, type AgentRuntime, type AgentTaskNextStepSuggestion, type AgentTaskResponse, type AgentWorkerCapabilities, type AgentWorkerResponse, type AgentWorkerUpdatePolicyResponse, type WorkerTaskAssignmentV2, type WorkerTaskPluginV2, type WorkerClaimAgentTaskResponse } from '@playdrop/types';
|
|
3
3
|
import { loadConfig } from '../config';
|
|
4
4
|
import { type WorkerPlaydropAssetRequirement } from './upload';
|
|
5
5
|
import { type LoggedProcessResult, type LoggedProcessTranscriptChunk } from './worker/runtime';
|
|
@@ -141,7 +141,7 @@ export declare function allocateWorkerDevPort(input: {
|
|
|
141
141
|
}): number;
|
|
142
142
|
export declare function isWorkerContextCommandAllowed(argv: string[]): boolean;
|
|
143
143
|
export declare function resolveWorkerExecutionTargetFromRole(role: unknown): AgentExecutionTarget;
|
|
144
|
-
export declare function
|
|
144
|
+
export declare function normalizeWorkerTaskAssignmentV2(claim: WorkerClaimAgentTaskResponse): WorkerTaskAssignmentV2 | null;
|
|
145
145
|
export declare function nextClaimBackoffMs(currentMs: number): number;
|
|
146
146
|
export declare function claimBackoffDelayMs(currentMs: number, random?: () => number): number;
|
|
147
147
|
export declare function resolveWorkerHomeDir(): string;
|
|
@@ -171,20 +171,11 @@ export declare function assertTaskUploadResultMatchesContext(input: {
|
|
|
171
171
|
creatorUsername: string;
|
|
172
172
|
};
|
|
173
173
|
}): void;
|
|
174
|
-
export declare function
|
|
175
|
-
export declare function stagePlaydropPluginReferences(input: {
|
|
176
|
-
workspaceDir: string;
|
|
177
|
-
pluginRoot: string;
|
|
178
|
-
kind: AgentTaskKind;
|
|
179
|
-
}): Promise<string[]>;
|
|
180
|
-
export declare function stageCodexTaskSkills(input: {
|
|
181
|
-
workspaceDir: string;
|
|
182
|
-
stagedPluginPaths: readonly string[];
|
|
183
|
-
}): Promise<string[]>;
|
|
174
|
+
export declare function stageAssignmentWorkspaceV2(workspaceDir: string, workspace: WorkerTaskAssignmentV2['workspace']): Promise<void>;
|
|
184
175
|
export declare function assertAssignmentPluginBundleExtractionBounds(buffer: Buffer): void;
|
|
185
176
|
export declare function stageAssignmentPluginBundle(input: {
|
|
186
177
|
workspaceDir: string;
|
|
187
|
-
pluginBundle:
|
|
178
|
+
pluginBundle: WorkerTaskPluginV2;
|
|
188
179
|
}): Promise<string>;
|
|
189
180
|
export declare function resolveDevPluginWorkingTree(input: {
|
|
190
181
|
workingTree?: string;
|
|
@@ -224,25 +215,13 @@ export declare function buildWorkerClaimBody(input: {
|
|
|
224
215
|
capabilities: AgentWorkerCapabilities;
|
|
225
216
|
runningTaskCount?: number;
|
|
226
217
|
}): {
|
|
218
|
+
protocolVersion: 2;
|
|
227
219
|
workerKey: string;
|
|
228
220
|
capabilities: AgentWorkerCapabilities;
|
|
229
221
|
};
|
|
230
|
-
export type WorkerBaseApp = {
|
|
231
|
-
appName: string;
|
|
232
|
-
version: string;
|
|
233
|
-
appId: number;
|
|
234
|
-
appVersionId: number;
|
|
235
|
-
};
|
|
236
|
-
export declare function resolveWorkerBaseSource(value: WorkerAgentTaskBaseSourceResponse | null | undefined): WorkerBaseApp;
|
|
237
222
|
export declare function extractZipArchive(zipBuffer: Uint8Array, targetDir: string): string[];
|
|
238
|
-
export declare function readWorkerProjectVersion(projectDir: string, appName: string): string;
|
|
239
223
|
export declare function buildCataloguePreviewPayload(cataloguePath: string, workspaceDir?: string): Record<string, unknown>;
|
|
240
|
-
export declare function
|
|
241
|
-
baseVersion: string;
|
|
242
|
-
projectVersion: string;
|
|
243
|
-
appName: string;
|
|
244
|
-
}): void;
|
|
245
|
-
export declare function removeStaleWorkerControlFilesFromBaseSource(stagingDir: string): Promise<void>;
|
|
224
|
+
export declare function removeStaleWorkerControlFiles(stagingDir: string): Promise<void>;
|
|
246
225
|
export declare function resolveCodexModel(model: string, reasoningEffortOverride?: string | null): WorkerCodexModel;
|
|
247
226
|
export declare function resolveClaudeModel(model: string, reasoningEffortOverride?: string | null): WorkerClaudeModel;
|
|
248
227
|
export declare function prepareCodexRunHomes(input: {
|
|
@@ -351,12 +330,12 @@ export declare function assertLaunchAgentPlistCompatible(input: {
|
|
|
351
330
|
}): void;
|
|
352
331
|
export declare function showWorkerStatus(options?: WorkerStatusOptions): Promise<WorkerStatusPayload>;
|
|
353
332
|
export declare function setupWorker(options?: WorkerSetupOptions): Promise<void>;
|
|
354
|
-
export declare function instrumentTaskChromeTitleMatchers(assignment:
|
|
333
|
+
export declare function instrumentTaskChromeTitleMatchers(assignment: WorkerTaskAssignmentV2): string[];
|
|
355
334
|
type InstrumentBrowserHygieneRunner = (command: string, args: string[]) => Promise<{
|
|
356
335
|
stdout: string;
|
|
357
336
|
stderr: string;
|
|
358
337
|
}>;
|
|
359
|
-
export declare function enforceInstrumentBrowserHygiene(assignment:
|
|
338
|
+
export declare function enforceInstrumentBrowserHygiene(assignment: WorkerTaskAssignmentV2, options?: {
|
|
360
339
|
platform?: NodeJS.Platform;
|
|
361
340
|
runner?: InstrumentBrowserHygieneRunner;
|
|
362
341
|
}): Promise<{
|
|
@@ -365,6 +344,7 @@ export declare function enforceInstrumentBrowserHygiene(assignment: WorkerAgentT
|
|
|
365
344
|
}>;
|
|
366
345
|
export declare function startWorker(options?: WorkerStartOptions): Promise<void>;
|
|
367
346
|
export declare function reportTask(options: TaskReportOptions): Promise<void>;
|
|
347
|
+
export declare function showTaskContext(): void;
|
|
368
348
|
export declare function reportCatalogueTask(options: TaskCatalogueReportOptions): Promise<void>;
|
|
369
349
|
export declare function uploadTask(options?: TaskUploadOptions): Promise<void>;
|
|
370
350
|
export declare function claimSlugTask(options: TaskClaimSlugOptions): Promise<void>;
|