@elizaos/cli 1.6.4-alpha.9 → 1.6.4
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 +53 -0
- package/dist/commands/deploy/actions/deploy-ecs.d.ts.map +1 -1
- package/dist/commands/deploy/index.d.ts.map +1 -1
- package/dist/commands/deploy/types.d.ts +2 -0
- package/dist/commands/deploy/types.d.ts.map +1 -1
- package/dist/commands/deploy/utils/docker-build.d.ts.map +1 -1
- package/dist/commands/login/actions/login.d.ts.map +1 -1
- package/dist/index.js +270 -100
- package/dist/index.js.map +41 -41
- package/dist/templates/plugin-quick-starter/package.json +2 -2
- package/dist/templates/plugin-starter/package.json +2 -2
- package/dist/templates/project-starter/package.json +6 -6
- package/dist/templates/project-tee-starter/package.json +4 -4
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -2
- package/package.json +7 -7
- package/templates/plugin-quick-starter/package.json +2 -2
- package/templates/plugin-starter/package.json +2 -2
- package/templates/project-starter/package.json +6 -6
- package/templates/project-tee-starter/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4749,7 +4749,7 @@ __export(exports_version, {
|
|
|
4749
4749
|
BUILD_TIME: () => BUILD_TIME,
|
|
4750
4750
|
BUILD_ENV: () => BUILD_ENV
|
|
4751
4751
|
});
|
|
4752
|
-
var CLI_VERSION = "1.6.4
|
|
4752
|
+
var CLI_VERSION = "1.6.4", CLI_NAME = "@elizaos/cli", CLI_DESCRIPTION = "elizaOS CLI - Manage your AI agents and plugins", BUILD_TIME = "2025-11-05T19:02:42.101Z", BUILD_ENV = "production", version_default;
|
|
4753
4753
|
var init_version = __esm(() => {
|
|
4754
4754
|
version_default = {
|
|
4755
4755
|
version: CLI_VERSION,
|
|
@@ -30437,7 +30437,7 @@ function mergeUint8Arrays(items) {
|
|
|
30437
30437
|
}
|
|
30438
30438
|
|
|
30439
30439
|
// ../../node_modules/puppeteer-core/lib/esm/puppeteer/util/version.js
|
|
30440
|
-
var packageVersion = "24.
|
|
30440
|
+
var packageVersion = "24.29.0";
|
|
30441
30441
|
|
|
30442
30442
|
// ../../node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.js
|
|
30443
30443
|
async function importDebug() {
|
|
@@ -30866,9 +30866,9 @@ var init_Browser = __esm(() => {
|
|
|
30866
30866
|
const { timeout: ms = 30000, signal } = options;
|
|
30867
30867
|
return await firstValueFrom(merge2(fromEmitterEvent(this, "targetcreated"), fromEmitterEvent(this, "targetchanged"), from(this.targets())).pipe(filterAsync(predicate), raceWith(fromAbortSignal(signal), timeout(ms))));
|
|
30868
30868
|
}
|
|
30869
|
-
async pages() {
|
|
30869
|
+
async pages(includeAll = false) {
|
|
30870
30870
|
const contextPages = await Promise.all(this.browserContexts().map((context2) => {
|
|
30871
|
-
return context2.pages();
|
|
30871
|
+
return context2.pages(includeAll);
|
|
30872
30872
|
}));
|
|
30873
30873
|
return contextPages.reduce((acc, x2) => {
|
|
30874
30874
|
return acc.concat(x2);
|
|
@@ -35825,8 +35825,12 @@ class Accessibility {
|
|
|
35825
35825
|
if (!frame) {
|
|
35826
35826
|
return;
|
|
35827
35827
|
}
|
|
35828
|
-
|
|
35829
|
-
|
|
35828
|
+
try {
|
|
35829
|
+
const iframeSnapshot = await frame.accessibility.snapshot(options);
|
|
35830
|
+
root2.iframeSnapshot = iframeSnapshot ?? undefined;
|
|
35831
|
+
} catch (error46) {
|
|
35832
|
+
debugError(error46);
|
|
35833
|
+
}
|
|
35830
35834
|
} catch (e_1) {
|
|
35831
35835
|
env_1.error = e_1;
|
|
35832
35836
|
env_1.hasError = true;
|
|
@@ -36086,7 +36090,8 @@ class AXNode {
|
|
|
36086
36090
|
} finally {
|
|
36087
36091
|
__disposeResources9(env_2);
|
|
36088
36092
|
}
|
|
36089
|
-
}
|
|
36093
|
+
},
|
|
36094
|
+
backendNodeId: this.payload.backendDOMNodeId
|
|
36090
36095
|
};
|
|
36091
36096
|
const userStringProperties = [
|
|
36092
36097
|
"name",
|
|
@@ -36220,6 +36225,7 @@ var __addDisposableResource9 = function(env3, value, async2) {
|
|
|
36220
36225
|
return value;
|
|
36221
36226
|
}, __disposeResources9;
|
|
36222
36227
|
var init_Accessibility = __esm(() => {
|
|
36228
|
+
init_util2();
|
|
36223
36229
|
__disposeResources9 = function(SuppressedError3) {
|
|
36224
36230
|
return function(env3) {
|
|
36225
36231
|
function fail(e2) {
|
|
@@ -36319,7 +36325,10 @@ var init_FileChooser = () => {};
|
|
|
36319
36325
|
// ../../node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js
|
|
36320
36326
|
class CallbackRegistry {
|
|
36321
36327
|
#callbacks = new Map;
|
|
36322
|
-
#idGenerator
|
|
36328
|
+
#idGenerator;
|
|
36329
|
+
constructor(idGenerator) {
|
|
36330
|
+
this.#idGenerator = idGenerator;
|
|
36331
|
+
}
|
|
36323
36332
|
create(label, timeout2, request) {
|
|
36324
36333
|
const callback = new Callback(this.#idGenerator(), label, timeout2);
|
|
36325
36334
|
this.#callbacks.set(callback.id, callback);
|
|
@@ -36421,12 +36430,10 @@ class Callback {
|
|
|
36421
36430
|
return this.#label;
|
|
36422
36431
|
}
|
|
36423
36432
|
}
|
|
36424
|
-
var idGenerator;
|
|
36425
36433
|
var init_CallbackRegistry = __esm(() => {
|
|
36426
36434
|
init_Deferred();
|
|
36427
36435
|
init_Errors();
|
|
36428
36436
|
init_util2();
|
|
36429
|
-
idGenerator = createIncrementalIdGenerator();
|
|
36430
36437
|
});
|
|
36431
36438
|
|
|
36432
36439
|
// ../../node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Coverage.js
|
|
@@ -48124,13 +48131,14 @@ var init_Connection = __esm(() => {
|
|
|
48124
48131
|
#delay;
|
|
48125
48132
|
#timeout = 0;
|
|
48126
48133
|
#closed = false;
|
|
48127
|
-
#callbacks
|
|
48134
|
+
#callbacks;
|
|
48128
48135
|
#emitters = [];
|
|
48129
|
-
constructor(url2, transport, delay = 0, timeout2) {
|
|
48136
|
+
constructor(url2, transport, idGenerator, delay = 0, timeout2) {
|
|
48130
48137
|
super();
|
|
48131
48138
|
this.#url = url2;
|
|
48132
48139
|
this.#delay = delay;
|
|
48133
48140
|
this.#timeout = timeout2 ?? 180000;
|
|
48141
|
+
this.#callbacks = new CallbackRegistry(idGenerator);
|
|
48134
48142
|
this.#transport = transport;
|
|
48135
48143
|
this.#transport.onmessage = this.onMessage.bind(this);
|
|
48136
48144
|
this.#transport.onclose = this.unbind.bind(this);
|
|
@@ -48248,7 +48256,7 @@ async function connectBidiOverCdp(cdp) {
|
|
|
48248
48256
|
transportBiDi.on("bidiResponse", (message) => {
|
|
48249
48257
|
pptrTransport.onmessage(JSON.stringify(message));
|
|
48250
48258
|
});
|
|
48251
|
-
const pptrBiDiConnection = new BidiConnection(cdp.url(), pptrTransport, cdp.delay, cdp.timeout);
|
|
48259
|
+
const pptrBiDiConnection = new BidiConnection(cdp.url(), pptrTransport, cdp._idGenerator, cdp.delay, cdp.timeout);
|
|
48252
48260
|
const bidiServer = await BidiMapper.BidiServer.createAndStart(transportBiDi, cdpConnectionAdapter, cdpConnectionAdapter.browserClient(), "", undefined, bidiServerLogger);
|
|
48253
48261
|
return pptrBiDiConnection;
|
|
48254
48262
|
}
|
|
@@ -49305,6 +49313,7 @@ var init_BrowsingContext = __esm(() => {
|
|
|
49305
49313
|
let _removePreloadScript_decorators;
|
|
49306
49314
|
let _setGeolocationOverride_decorators;
|
|
49307
49315
|
let _setTimezoneOverride_decorators;
|
|
49316
|
+
let _setScreenOrientationOverride_decorators;
|
|
49308
49317
|
let _getCookies_decorators;
|
|
49309
49318
|
let _setCookie_decorators;
|
|
49310
49319
|
let _setFiles_decorators;
|
|
@@ -49340,6 +49349,7 @@ var init_BrowsingContext = __esm(() => {
|
|
|
49340
49349
|
__esDecorate12(this, null, _removePreloadScript_decorators, { kind: "method", name: "removePreloadScript", static: false, private: false, access: { has: (obj) => ("removePreloadScript" in obj), get: (obj) => obj.removePreloadScript }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
49341
49350
|
__esDecorate12(this, null, _setGeolocationOverride_decorators, { kind: "method", name: "setGeolocationOverride", static: false, private: false, access: { has: (obj) => ("setGeolocationOverride" in obj), get: (obj) => obj.setGeolocationOverride }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
49342
49351
|
__esDecorate12(this, null, _setTimezoneOverride_decorators, { kind: "method", name: "setTimezoneOverride", static: false, private: false, access: { has: (obj) => ("setTimezoneOverride" in obj), get: (obj) => obj.setTimezoneOverride }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
49352
|
+
__esDecorate12(this, null, _setScreenOrientationOverride_decorators, { kind: "method", name: "setScreenOrientationOverride", static: false, private: false, access: { has: (obj) => ("setScreenOrientationOverride" in obj), get: (obj) => obj.setScreenOrientationOverride }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
49343
49353
|
__esDecorate12(this, null, _getCookies_decorators, { kind: "method", name: "getCookies", static: false, private: false, access: { has: (obj) => ("getCookies" in obj), get: (obj) => obj.getCookies }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
49344
49354
|
__esDecorate12(this, null, _setCookie_decorators, { kind: "method", name: "setCookie", static: false, private: false, access: { has: (obj) => ("setCookie" in obj), get: (obj) => obj.setCookie }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
49345
49355
|
__esDecorate12(this, null, _setFiles_decorators, { kind: "method", name: "setFiles", static: false, private: false, access: { has: (obj) => ("setFiles" in obj), get: (obj) => obj.setFiles }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
@@ -49632,6 +49642,12 @@ var init_BrowsingContext = __esm(() => {
|
|
|
49632
49642
|
contexts: [this.id]
|
|
49633
49643
|
});
|
|
49634
49644
|
}
|
|
49645
|
+
async setScreenOrientationOverride(screenOrientation) {
|
|
49646
|
+
await this.#session.send("emulation.setScreenOrientationOverride", {
|
|
49647
|
+
screenOrientation,
|
|
49648
|
+
contexts: [this.id]
|
|
49649
|
+
});
|
|
49650
|
+
}
|
|
49635
49651
|
async getCookies(options = {}) {
|
|
49636
49652
|
const { result: { cookies } } = await this.#session.send("storage.getCookies", {
|
|
49637
49653
|
...options,
|
|
@@ -49700,6 +49716,8 @@ var init_BrowsingContext = __esm(() => {
|
|
|
49700
49716
|
return context2.#reason;
|
|
49701
49717
|
})], _setTimezoneOverride_decorators = [throwIfDisposed((context2) => {
|
|
49702
49718
|
return context2.#reason;
|
|
49719
|
+
})], _setScreenOrientationOverride_decorators = [throwIfDisposed((context2) => {
|
|
49720
|
+
return context2.#reason;
|
|
49703
49721
|
})], _getCookies_decorators = [throwIfDisposed((context2) => {
|
|
49704
49722
|
return context2.#reason;
|
|
49705
49723
|
})], _setCookie_decorators = [throwIfDisposed((context2) => {
|
|
@@ -52989,6 +53007,9 @@ var init_Page2 = __esm(() => {
|
|
|
52989
53007
|
resize(_params) {
|
|
52990
53008
|
throw new Error("Method not implemented for WebDriver BiDi yet.");
|
|
52991
53009
|
}
|
|
53010
|
+
openDevTools() {
|
|
53011
|
+
throw new Error("Method not implemented for WebDriver BiDi yet.");
|
|
53012
|
+
}
|
|
52992
53013
|
async focusedFrame() {
|
|
52993
53014
|
const env_1 = { stack: [], error: undefined, hasError: false };
|
|
52994
53015
|
try {
|
|
@@ -53045,7 +53066,9 @@ var init_Page2 = __esm(() => {
|
|
|
53045
53066
|
async reload(options = {}) {
|
|
53046
53067
|
const [response] = await Promise.all([
|
|
53047
53068
|
this.#frame.waitForNavigation(options),
|
|
53048
|
-
this.#frame.browsingContext.reload(
|
|
53069
|
+
this.#frame.browsingContext.reload({
|
|
53070
|
+
ignoreCache: options.ignoreCache ? true : undefined
|
|
53071
|
+
})
|
|
53049
53072
|
]).catch(rewriteNavigationError(this.url(), options.timeout ?? this._timeoutSettings.navigationTimeout()));
|
|
53050
53073
|
return response;
|
|
53051
53074
|
}
|
|
@@ -53106,13 +53129,25 @@ var init_Page2 = __esm(() => {
|
|
|
53106
53129
|
}
|
|
53107
53130
|
async setViewport(viewport) {
|
|
53108
53131
|
if (!this.browser().cdpSupported) {
|
|
53109
|
-
|
|
53110
|
-
|
|
53111
|
-
|
|
53112
|
-
|
|
53113
|
-
|
|
53114
|
-
|
|
53115
|
-
|
|
53132
|
+
const viewportSize = viewport?.width && viewport?.height ? {
|
|
53133
|
+
width: viewport.width,
|
|
53134
|
+
height: viewport.height
|
|
53135
|
+
} : null;
|
|
53136
|
+
const devicePixelRatio = viewport?.deviceScaleFactor ? viewport.deviceScaleFactor : null;
|
|
53137
|
+
const screenOrientation = viewport ? viewport.isLandscape ? {
|
|
53138
|
+
natural: "landscape",
|
|
53139
|
+
type: "landscape-primary"
|
|
53140
|
+
} : {
|
|
53141
|
+
natural: "portrait",
|
|
53142
|
+
type: "portrait-primary"
|
|
53143
|
+
} : null;
|
|
53144
|
+
await Promise.all([
|
|
53145
|
+
this.#frame.browsingContext.setViewport({
|
|
53146
|
+
viewport: viewportSize,
|
|
53147
|
+
devicePixelRatio
|
|
53148
|
+
}),
|
|
53149
|
+
this.#frame.browsingContext.setScreenOrientationOverride(screenOrientation)
|
|
53150
|
+
]);
|
|
53116
53151
|
this.#viewport = viewport;
|
|
53117
53152
|
return;
|
|
53118
53153
|
}
|
|
@@ -53834,11 +53869,12 @@ var init_BrowserContext2 = __esm(() => {
|
|
|
53834
53869
|
return [target, ...frames.values()];
|
|
53835
53870
|
});
|
|
53836
53871
|
}
|
|
53837
|
-
async newPage() {
|
|
53872
|
+
async newPage(options) {
|
|
53838
53873
|
const env_1 = { stack: [], error: undefined, hasError: false };
|
|
53839
53874
|
try {
|
|
53840
53875
|
const _guard = __addDisposableResource18(env_1, await this.waitForScreenshotOperations(), false);
|
|
53841
|
-
const
|
|
53876
|
+
const type = options?.type === "window" ? "window" : "tab";
|
|
53877
|
+
const context2 = await this.userContext.createBrowsingContext(type);
|
|
53842
53878
|
const page = this.#pages.get(context2);
|
|
53843
53879
|
if (!page) {
|
|
53844
53880
|
throw new Error("Page is not found");
|
|
@@ -53868,7 +53904,7 @@ var init_BrowserContext2 = __esm(() => {
|
|
|
53868
53904
|
browser() {
|
|
53869
53905
|
return this.#browser;
|
|
53870
53906
|
}
|
|
53871
|
-
async pages() {
|
|
53907
|
+
async pages(_includeAll = false) {
|
|
53872
53908
|
return [...this.userContext.browsingContexts].map((context2) => {
|
|
53873
53909
|
return this.#pages.get(context2);
|
|
53874
53910
|
});
|
|
@@ -287305,9 +287341,29 @@ async function ensureDockerfile(projectPath) {
|
|
|
287305
287341
|
}
|
|
287306
287342
|
return dockerfilePath;
|
|
287307
287343
|
}
|
|
287344
|
+
function detectHostPlatform() {
|
|
287345
|
+
const arch = process.arch;
|
|
287346
|
+
if (arch === "arm64") {
|
|
287347
|
+
return "linux/arm64";
|
|
287348
|
+
} else if (arch === "x64") {
|
|
287349
|
+
return "linux/amd64";
|
|
287350
|
+
} else if (arch === "arm") {
|
|
287351
|
+
return "linux/arm/v7";
|
|
287352
|
+
} else if (arch === "ia32") {
|
|
287353
|
+
return "linux/386";
|
|
287354
|
+
}
|
|
287355
|
+
logger26.warn(`Unknown architecture ${arch}, defaulting to linux/amd64`);
|
|
287356
|
+
return "linux/amd64";
|
|
287357
|
+
}
|
|
287308
287358
|
async function buildDockerImage(options) {
|
|
287309
287359
|
try {
|
|
287310
|
-
const
|
|
287360
|
+
const hostPlatform = detectHostPlatform();
|
|
287361
|
+
const platform2 = options.platform || process.env.ELIZA_DOCKER_PLATFORM || hostPlatform;
|
|
287362
|
+
if (platform2 !== hostPlatform) {
|
|
287363
|
+
logger26.warn(`Cross-compiling from ${hostPlatform} to ${platform2}`);
|
|
287364
|
+
logger26.warn("This may be slower and requires Docker BuildKit with QEMU emulation");
|
|
287365
|
+
logger26.info("Tip: Set ELIZA_DOCKER_PLATFORM=" + hostPlatform + " to use native platform");
|
|
287366
|
+
}
|
|
287311
287367
|
logger26.info(`Building Docker image: ${options.imageTag} (platform: ${platform2})`);
|
|
287312
287368
|
const dockerfilePath = options.dockerfile ? path26.join(options.projectPath, options.dockerfile) : await ensureDockerfile(options.projectPath);
|
|
287313
287369
|
if (!fs14.existsSync(dockerfilePath)) {
|
|
@@ -287773,7 +287829,8 @@ async function deployWithECS(options) {
|
|
|
287773
287829
|
imageTag: localImageTag,
|
|
287774
287830
|
buildArgs: {
|
|
287775
287831
|
NODE_ENV: "production"
|
|
287776
|
-
}
|
|
287832
|
+
},
|
|
287833
|
+
platform: options.platform
|
|
287777
287834
|
});
|
|
287778
287835
|
if (!buildResult.success) {
|
|
287779
287836
|
return {
|
|
@@ -287836,6 +287893,11 @@ async function deployWithECS(options) {
|
|
|
287836
287893
|
logger28.info(`\uD83C\uDD95 No existing project found. This will be a FRESH deployment.`);
|
|
287837
287894
|
}
|
|
287838
287895
|
}
|
|
287896
|
+
const detectedPlatform = await getDetectedPlatform(options.platform);
|
|
287897
|
+
const architecture = detectedPlatform.includes("arm64") ? "arm64" : "x86_64";
|
|
287898
|
+
logger28.info(`\uD83C\uDFD7\uFE0F Target architecture: ${architecture} (from platform: ${detectedPlatform})`);
|
|
287899
|
+
const instanceDefaults = getInstanceDefaults(architecture);
|
|
287900
|
+
logger28.info(`\uD83D\uDCBB AWS instance type: ${instanceDefaults.instanceType} (${architecture})`);
|
|
287839
287901
|
const containerConfig = {
|
|
287840
287902
|
name: containerName,
|
|
287841
287903
|
project_name: projectName,
|
|
@@ -287845,8 +287907,9 @@ async function deployWithECS(options) {
|
|
|
287845
287907
|
image_tag: imageBuildData.ecrImageTag,
|
|
287846
287908
|
port: options.port || 3000,
|
|
287847
287909
|
desired_count: options.desiredCount || 1,
|
|
287848
|
-
cpu: options.cpu ||
|
|
287849
|
-
memory: options.memory ||
|
|
287910
|
+
cpu: options.cpu || instanceDefaults.cpu,
|
|
287911
|
+
memory: options.memory || instanceDefaults.memory,
|
|
287912
|
+
architecture,
|
|
287850
287913
|
environment_vars: {
|
|
287851
287914
|
...environmentVars,
|
|
287852
287915
|
PORT: (options.port || 3000).toString(),
|
|
@@ -288037,6 +288100,38 @@ function parseEnvironmentVariables(envOptions) {
|
|
|
288037
288100
|
}
|
|
288038
288101
|
return environmentVars;
|
|
288039
288102
|
}
|
|
288103
|
+
async function getDetectedPlatform(platformOverride) {
|
|
288104
|
+
if (platformOverride) {
|
|
288105
|
+
return platformOverride;
|
|
288106
|
+
}
|
|
288107
|
+
if (process.env.ELIZA_DOCKER_PLATFORM) {
|
|
288108
|
+
return process.env.ELIZA_DOCKER_PLATFORM;
|
|
288109
|
+
}
|
|
288110
|
+
const arch = process.arch;
|
|
288111
|
+
if (arch === "arm64") {
|
|
288112
|
+
return "linux/arm64";
|
|
288113
|
+
} else if (arch === "x64") {
|
|
288114
|
+
return "linux/amd64";
|
|
288115
|
+
} else if (arch === "arm") {
|
|
288116
|
+
return "linux/arm/v7";
|
|
288117
|
+
}
|
|
288118
|
+
return "linux/amd64";
|
|
288119
|
+
}
|
|
288120
|
+
function getInstanceDefaults(architecture) {
|
|
288121
|
+
if (architecture === "arm64") {
|
|
288122
|
+
return {
|
|
288123
|
+
instanceType: "t4g.small",
|
|
288124
|
+
cpu: 1792,
|
|
288125
|
+
memory: 1792
|
|
288126
|
+
};
|
|
288127
|
+
} else {
|
|
288128
|
+
return {
|
|
288129
|
+
instanceType: "t3.small",
|
|
288130
|
+
cpu: 1792,
|
|
288131
|
+
memory: 1792
|
|
288132
|
+
};
|
|
288133
|
+
}
|
|
288134
|
+
}
|
|
288040
288135
|
|
|
288041
288136
|
// src/commands/deploy/actions/deploy.ts
|
|
288042
288137
|
async function deployProject(options) {
|
|
@@ -288054,9 +288149,9 @@ async function deployProject(options) {
|
|
|
288054
288149
|
}
|
|
288055
288150
|
|
|
288056
288151
|
// src/commands/deploy/index.ts
|
|
288057
|
-
var deploy = new Command().name("deploy").description("Deploy ElizaOS project to AWS ECS (Elastic Container Service)").option("-n, --name <name>", "Name for the deployment").option("--project-name <name>", "Project name (defaults to directory name)").option("-p, --port <port>", "Port the container listens on", (value) => parseInt(value, 10), 3000).option("--desired-count <count>", "Number of container instances to run", (value) => parseInt(value, 10), 1).option("--cpu <units>", "CPU units (1792 = 1.75 vCPU, 87.5% of t4g.
|
|
288152
|
+
var deploy = new Command().name("deploy").description("Deploy ElizaOS project to AWS ECS (Elastic Container Service)").option("-n, --name <name>", "Name for the deployment").option("--project-name <name>", "Project name (defaults to directory name)").option("-p, --port <port>", "Port the container listens on", (value) => parseInt(value, 10), 3000).option("--desired-count <count>", "Number of container instances to run", (value) => parseInt(value, 10), 1).option("--cpu <units>", "CPU units (1792 = 1.75 vCPU, 87.5% of t4g.small 2 vCPUs)", (value) => parseInt(value, 10), 1792).option("--memory <mb>", "Memory in MB (1792 MB = 1.75 GiB, 87.5% of t4g.small 2 GiB)", (value) => parseInt(value, 10), 1792).option("-k, --api-key <key>", "ElizaOS Cloud API key").option("-u, --api-url <url>", "ElizaOS Cloud API URL", "https://www.elizacloud.ai").option("-e, --env <KEY=VALUE>", "Environment variable (can be specified multiple times)", (value, previous) => {
|
|
288058
288153
|
return previous.concat([value]);
|
|
288059
|
-
}, []).option("--skip-build", "Skip Docker build and use existing image").option("--image-uri <uri>", "Use existing ECR image URI (requires --skip-build)").action(async (options) => {
|
|
288154
|
+
}, []).option("--skip-build", "Skip Docker build and use existing image").option("--image-uri <uri>", "Use existing ECR image URI (requires --skip-build)").option("--platform <platform>", "Docker platform for build (e.g., linux/amd64, linux/arm64). Defaults to host platform.", undefined).action(async (options) => {
|
|
288060
288155
|
try {
|
|
288061
288156
|
if (isNaN(options.port) || options.port < 1 || options.port > 65535) {
|
|
288062
288157
|
logger30.error("\u274C Error: Port must be a number between 1 and 65535");
|
|
@@ -288111,10 +288206,10 @@ init_esm();
|
|
|
288111
288206
|
import { logger as logger31 } from "@elizaos/core";
|
|
288112
288207
|
async function listContainersAction(options) {
|
|
288113
288208
|
try {
|
|
288114
|
-
const apiKey = options.apiKey || process.env.
|
|
288209
|
+
const apiKey = options.apiKey || process.env.ELIZA_SERVER_AUTH_TOKEN;
|
|
288115
288210
|
const apiUrl = options.apiUrl || "https://www.elizacloud.ai";
|
|
288116
288211
|
if (!apiKey) {
|
|
288117
|
-
logger31.error("\u274C Error: API key is required. Use --api-key or set
|
|
288212
|
+
logger31.error("\u274C Error: API key is required. Use --api-key or set ELIZA_SERVER_AUTH_TOKEN environment variable.");
|
|
288118
288213
|
process.exit(1);
|
|
288119
288214
|
}
|
|
288120
288215
|
logger31.info("\uD83D\uDCCB Fetching container list...");
|
|
@@ -288185,10 +288280,10 @@ async function confirmDeletion(containerName, projectName) {
|
|
|
288185
288280
|
}
|
|
288186
288281
|
async function deleteContainerAction(containerId, options) {
|
|
288187
288282
|
try {
|
|
288188
|
-
const apiKey = options.apiKey || process.env.
|
|
288283
|
+
const apiKey = options.apiKey || process.env.ELIZA_SERVER_AUTH_TOKEN;
|
|
288189
288284
|
const apiUrl = options.apiUrl || "https://www.elizacloud.ai";
|
|
288190
288285
|
if (!apiKey) {
|
|
288191
|
-
logger32.error("\u274C Error: API key is required. Use --api-key or set
|
|
288286
|
+
logger32.error("\u274C Error: API key is required. Use --api-key or set ELIZA_SERVER_AUTH_TOKEN environment variable.");
|
|
288192
288287
|
process.exit(1);
|
|
288193
288288
|
}
|
|
288194
288289
|
let targetContainerId = containerId;
|
|
@@ -288276,10 +288371,10 @@ import { logger as logger33 } from "@elizaos/core";
|
|
|
288276
288371
|
import * as path29 from "path";
|
|
288277
288372
|
async function getContainerLogsAction(containerId, options) {
|
|
288278
288373
|
try {
|
|
288279
|
-
const apiKey = options.apiKey || process.env.
|
|
288374
|
+
const apiKey = options.apiKey || process.env.ELIZA_SERVER_AUTH_TOKEN;
|
|
288280
288375
|
const apiUrl = options.apiUrl || "https://www.elizacloud.ai";
|
|
288281
288376
|
if (!apiKey) {
|
|
288282
|
-
logger33.error("\u274C Error: API key is required. Use --api-key or set
|
|
288377
|
+
logger33.error("\u274C Error: API key is required. Use --api-key or set ELIZA_SERVER_AUTH_TOKEN environment variable.");
|
|
288283
288378
|
process.exit(1);
|
|
288284
288379
|
}
|
|
288285
288380
|
let targetContainerId = containerId;
|
|
@@ -289841,8 +289936,11 @@ var parseClass = (glob, position) => {
|
|
|
289841
289936
|
};
|
|
289842
289937
|
|
|
289843
289938
|
// ../../node_modules/glob/node_modules/minimatch/dist/esm/unescape.js
|
|
289844
|
-
var unescape2 = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
289845
|
-
|
|
289939
|
+
var unescape2 = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
289940
|
+
if (magicalBraces) {
|
|
289941
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
289942
|
+
}
|
|
289943
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
289846
289944
|
};
|
|
289847
289945
|
|
|
289848
289946
|
// ../../node_modules/glob/node_modules/minimatch/dist/esm/ast.js
|
|
@@ -290123,7 +290221,7 @@ class AST {
|
|
|
290123
290221
|
if (this.#root === this)
|
|
290124
290222
|
this.#fillNegs();
|
|
290125
290223
|
if (!this.type) {
|
|
290126
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
290224
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
290127
290225
|
const src = this.#parts.map((p2) => {
|
|
290128
290226
|
const [re, _3, hasMagic, uflag] = typeof p2 === "string" ? AST.#parseGlob(p2, this.#hasMagic, noEmpty) : p2.toRegExpSource(allowDot);
|
|
290129
290227
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
@@ -290225,10 +290323,7 @@ class AST {
|
|
|
290225
290323
|
}
|
|
290226
290324
|
}
|
|
290227
290325
|
if (c3 === "*") {
|
|
290228
|
-
|
|
290229
|
-
re += starNoEmpty;
|
|
290230
|
-
else
|
|
290231
|
-
re += star;
|
|
290326
|
+
re += noEmpty && glob === "*" ? starNoEmpty : star;
|
|
290232
290327
|
hasMagic = true;
|
|
290233
290328
|
continue;
|
|
290234
290329
|
}
|
|
@@ -290244,7 +290339,10 @@ class AST {
|
|
|
290244
290339
|
}
|
|
290245
290340
|
|
|
290246
290341
|
// ../../node_modules/glob/node_modules/minimatch/dist/esm/escape.js
|
|
290247
|
-
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
290342
|
+
var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
290343
|
+
if (magicalBraces) {
|
|
290344
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
290345
|
+
}
|
|
290248
290346
|
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
290249
290347
|
};
|
|
290250
290348
|
|
|
@@ -290848,16 +290946,27 @@ globstar while`, file2, fr, pattern, pr, swallowee);
|
|
|
290848
290946
|
pp[i2] = twoStar;
|
|
290849
290947
|
}
|
|
290850
290948
|
} else if (next === undefined) {
|
|
290851
|
-
pp[i2 - 1] = prev + "(
|
|
290949
|
+
pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
290852
290950
|
} else if (next !== GLOBSTAR) {
|
|
290853
290951
|
pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
290854
290952
|
pp[i2 + 1] = GLOBSTAR;
|
|
290855
290953
|
}
|
|
290856
290954
|
});
|
|
290857
|
-
|
|
290955
|
+
const filtered = pp.filter((p2) => p2 !== GLOBSTAR);
|
|
290956
|
+
if (this.partial && filtered.length >= 1) {
|
|
290957
|
+
const prefixes = [];
|
|
290958
|
+
for (let i2 = 1;i2 <= filtered.length; i2++) {
|
|
290959
|
+
prefixes.push(filtered.slice(0, i2).join("/"));
|
|
290960
|
+
}
|
|
290961
|
+
return "(?:" + prefixes.join("|") + ")";
|
|
290962
|
+
}
|
|
290963
|
+
return filtered.join("/");
|
|
290858
290964
|
}).join("|");
|
|
290859
290965
|
const [open, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
290860
290966
|
re = "^" + open + re + close + "$";
|
|
290967
|
+
if (this.partial) {
|
|
290968
|
+
re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
|
|
290969
|
+
}
|
|
290861
290970
|
if (this.negate)
|
|
290862
290971
|
re = "^(?!" + re + ").+$";
|
|
290863
290972
|
try {
|
|
@@ -296782,6 +296891,25 @@ async function handleLogin(options) {
|
|
|
296782
296891
|
const sessionId = generateSessionId();
|
|
296783
296892
|
console.log(exports_base.dim(`Session ID: ${sessionId}
|
|
296784
296893
|
`));
|
|
296894
|
+
const createSpinner = ora("Initializing authentication session...").start();
|
|
296895
|
+
try {
|
|
296896
|
+
const createResponse = await fetch(`${cloudUrl}/api/auth/cli-session`, {
|
|
296897
|
+
method: "POST",
|
|
296898
|
+
headers: {
|
|
296899
|
+
"Content-Type": "application/json"
|
|
296900
|
+
},
|
|
296901
|
+
body: JSON.stringify({ sessionId })
|
|
296902
|
+
});
|
|
296903
|
+
if (!createResponse.ok) {
|
|
296904
|
+
createSpinner.fail("Failed to initialize session");
|
|
296905
|
+
const errorText = await createResponse.text();
|
|
296906
|
+
throw new Error(`Failed to create session: ${createResponse.status} ${errorText}`);
|
|
296907
|
+
}
|
|
296908
|
+
createSpinner.succeed("Session initialized");
|
|
296909
|
+
} catch (error46) {
|
|
296910
|
+
createSpinner.fail("Failed to connect to cloud");
|
|
296911
|
+
throw new Error(`Could not connect to ElizaOS Cloud at ${cloudUrl}. Please check the URL and try again.`);
|
|
296912
|
+
}
|
|
296785
296913
|
const authUrl = `${cloudUrl}/auth/cli-login?session=${sessionId}`;
|
|
296786
296914
|
if (options.browser) {
|
|
296787
296915
|
console.log(exports_base.cyan(`Opening browser for authentication...
|
|
@@ -296895,7 +297023,7 @@ function displaySuccessMessage(authResult) {
|
|
|
296895
297023
|
|
|
296896
297024
|
// src/commands/login/index.ts
|
|
296897
297025
|
var login2 = new Command().name("login").description("Authenticate with ElizaOS Cloud to get an API key");
|
|
296898
|
-
login2.option("-u, --cloud-url <url>", "URL of ElizaOS Cloud", process.env.ELIZA_CLOUD_URL || "https://elizacloud.ai").option("--no-browser", "Do not automatically open browser").option("--timeout <seconds>", "Authentication timeout in seconds", "300").action(async (options) => {
|
|
297026
|
+
login2.option("-u, --cloud-url <url>", "URL of ElizaOS Cloud", process.env.ELIZA_CLOUD_URL || "https://www.elizacloud.ai").option("--no-browser", "Do not automatically open browser").option("--timeout <seconds>", "Authentication timeout in seconds", "300").action(async (options) => {
|
|
296899
297027
|
try {
|
|
296900
297028
|
await handleLogin(options);
|
|
296901
297029
|
} catch (error46) {
|
|
@@ -299041,7 +299169,7 @@ init_Errors();
|
|
|
299041
299169
|
class CdpCDPSession extends CDPSession {
|
|
299042
299170
|
#sessionId;
|
|
299043
299171
|
#targetType;
|
|
299044
|
-
#callbacks
|
|
299172
|
+
#callbacks;
|
|
299045
299173
|
#connection;
|
|
299046
299174
|
#parentSessionId;
|
|
299047
299175
|
#target;
|
|
@@ -299051,6 +299179,7 @@ class CdpCDPSession extends CDPSession {
|
|
|
299051
299179
|
super();
|
|
299052
299180
|
this.#connection = connection;
|
|
299053
299181
|
this.#targetType = targetType;
|
|
299182
|
+
this.#callbacks = new CallbackRegistry(connection._idGenerator);
|
|
299054
299183
|
this.#sessionId = sessionId;
|
|
299055
299184
|
this.#parentSessionId = parentSessionId;
|
|
299056
299185
|
this.#rawErrors = rawErrors;
|
|
@@ -299138,10 +299267,12 @@ class Connection extends EventEmitter4 {
|
|
|
299138
299267
|
#manuallyAttached = new Set;
|
|
299139
299268
|
#callbacks;
|
|
299140
299269
|
#rawErrors = false;
|
|
299141
|
-
|
|
299270
|
+
#idGenerator;
|
|
299271
|
+
constructor(url2, transport, delay = 0, timeout2, rawErrors = false, idGenerator = createIncrementalIdGenerator()) {
|
|
299142
299272
|
super();
|
|
299143
299273
|
this.#rawErrors = rawErrors;
|
|
299144
|
-
this.#
|
|
299274
|
+
this.#idGenerator = idGenerator;
|
|
299275
|
+
this.#callbacks = new CallbackRegistry(idGenerator);
|
|
299145
299276
|
this.#url = url2;
|
|
299146
299277
|
this.#delay = delay;
|
|
299147
299278
|
this.#timeout = timeout2 ?? 180000;
|
|
@@ -299161,6 +299292,9 @@ class Connection extends EventEmitter4 {
|
|
|
299161
299292
|
get _closed() {
|
|
299162
299293
|
return this.#closed;
|
|
299163
299294
|
}
|
|
299295
|
+
get _idGenerator() {
|
|
299296
|
+
return this.#idGenerator;
|
|
299297
|
+
}
|
|
299164
299298
|
get _sessions() {
|
|
299165
299299
|
return this.#sessions;
|
|
299166
299300
|
}
|
|
@@ -303432,6 +303566,12 @@ class CdpPage extends Page {
|
|
|
303432
303566
|
isJavaScriptEnabled() {
|
|
303433
303567
|
return this.#emulationManager.javascriptEnabled;
|
|
303434
303568
|
}
|
|
303569
|
+
async openDevTools() {
|
|
303570
|
+
const pageTargetId = this.target()._targetId;
|
|
303571
|
+
const browser2 = this.browser();
|
|
303572
|
+
const devtoolsPage = await browser2._createDevToolsPage(pageTargetId);
|
|
303573
|
+
return devtoolsPage;
|
|
303574
|
+
}
|
|
303435
303575
|
async waitForFileChooser(options = {}) {
|
|
303436
303576
|
const needsEnable = this.#fileChooserDeferreds.size === 0;
|
|
303437
303577
|
const { timeout: timeout2 = this._timeoutSettings.timeout() } = options;
|
|
@@ -303747,7 +303887,9 @@ class CdpPage extends Page {
|
|
|
303747
303887
|
...options,
|
|
303748
303888
|
ignoreSameDocumentNavigation: true
|
|
303749
303889
|
}),
|
|
303750
|
-
this.#primaryTargetClient.send("Page.reload"
|
|
303890
|
+
this.#primaryTargetClient.send("Page.reload", {
|
|
303891
|
+
ignoreCache: options?.ignoreCache ?? false
|
|
303892
|
+
})
|
|
303751
303893
|
]);
|
|
303752
303894
|
return result;
|
|
303753
303895
|
}
|
|
@@ -304064,9 +304206,9 @@ class CdpBrowserContext extends BrowserContext {
|
|
|
304064
304206
|
return target.browserContext() === this;
|
|
304065
304207
|
});
|
|
304066
304208
|
}
|
|
304067
|
-
async pages() {
|
|
304209
|
+
async pages(includeAll = false) {
|
|
304068
304210
|
const pages = await Promise.all(this.targets().filter((target) => {
|
|
304069
|
-
return target.type() === "page" || target.type() === "other" && this.#browser._getIsPageTargetCallback()?.(target);
|
|
304211
|
+
return target.type() === "page" || (target.type() === "other" || includeAll) && this.#browser._getIsPageTargetCallback()?.(target);
|
|
304070
304212
|
}).map((target) => {
|
|
304071
304213
|
return target.page();
|
|
304072
304214
|
}));
|
|
@@ -304093,11 +304235,11 @@ class CdpBrowserContext extends BrowserContext {
|
|
|
304093
304235
|
browserContextId: this.#id || undefined
|
|
304094
304236
|
});
|
|
304095
304237
|
}
|
|
304096
|
-
async newPage() {
|
|
304238
|
+
async newPage(options) {
|
|
304097
304239
|
const env_1 = { stack: [], error: undefined, hasError: false };
|
|
304098
304240
|
try {
|
|
304099
304241
|
const _guard = __addDisposableResource13(env_1, await this.waitForScreenshotOperations(), false);
|
|
304100
|
-
return await this.#browser._createPageInContext(this.#id);
|
|
304242
|
+
return await this.#browser._createPageInContext(this.#id, options);
|
|
304101
304243
|
} catch (e_1) {
|
|
304102
304244
|
env_1.error = e_1;
|
|
304103
304245
|
env_1.hasError = true;
|
|
@@ -304375,9 +304517,10 @@ class TargetManager extends EventEmitter4 {
|
|
|
304375
304517
|
#attachedToTargetListenersBySession = new WeakMap;
|
|
304376
304518
|
#detachedFromTargetListenersBySession = new WeakMap;
|
|
304377
304519
|
#initializeDeferred = Deferred.create();
|
|
304378
|
-
#targetsIdsForInit = new Set;
|
|
304379
304520
|
#waitForInitiallyDiscoveredTargets = true;
|
|
304380
304521
|
#discoveryFilter = [{}];
|
|
304522
|
+
#targetsIdsForInit = new Set;
|
|
304523
|
+
#initialAttachDone = false;
|
|
304381
304524
|
constructor(connection, targetFactory, targetFilterCallback, waitForInitiallyDiscoveredTargets = true) {
|
|
304382
304525
|
super();
|
|
304383
304526
|
this.#connection = connection;
|
|
@@ -304390,25 +304533,11 @@ class TargetManager extends EventEmitter4 {
|
|
|
304390
304533
|
this.#connection.on(CDPSessionEvent.SessionDetached, this.#onSessionDetached);
|
|
304391
304534
|
this.#setupAttachmentListeners(this.#connection);
|
|
304392
304535
|
}
|
|
304393
|
-
#storeExistingTargetsForInit = () => {
|
|
304394
|
-
if (!this.#waitForInitiallyDiscoveredTargets) {
|
|
304395
|
-
return;
|
|
304396
|
-
}
|
|
304397
|
-
for (const [targetId, targetInfo] of this.#discoveredTargetsByTargetId.entries()) {
|
|
304398
|
-
const targetForFilter = new CdpTarget(targetInfo, undefined, undefined, this, undefined);
|
|
304399
|
-
const isPageOrFrame = targetInfo.type === "page" || targetInfo.type === "iframe";
|
|
304400
|
-
const isExtension = targetInfo.url.startsWith("chrome-extension://");
|
|
304401
|
-
if ((!this.#targetFilterCallback || this.#targetFilterCallback(targetForFilter)) && isPageOrFrame && !isExtension) {
|
|
304402
|
-
this.#targetsIdsForInit.add(targetId);
|
|
304403
|
-
}
|
|
304404
|
-
}
|
|
304405
|
-
};
|
|
304406
304536
|
async initialize() {
|
|
304407
304537
|
await this.#connection.send("Target.setDiscoverTargets", {
|
|
304408
304538
|
discover: true,
|
|
304409
304539
|
filter: this.#discoveryFilter
|
|
304410
304540
|
});
|
|
304411
|
-
this.#storeExistingTargetsForInit();
|
|
304412
304541
|
await this.#connection.send("Target.setAutoAttach", {
|
|
304413
304542
|
waitForDebuggerOnStart: true,
|
|
304414
304543
|
flatten: true,
|
|
@@ -304421,6 +304550,7 @@ class TargetManager extends EventEmitter4 {
|
|
|
304421
304550
|
...this.#discoveryFilter
|
|
304422
304551
|
]
|
|
304423
304552
|
});
|
|
304553
|
+
this.#initialAttachDone = true;
|
|
304424
304554
|
this.#finishInitializationIfReady();
|
|
304425
304555
|
await this.#initializeDeferred.valueOrThrow();
|
|
304426
304556
|
}
|
|
@@ -304530,7 +304660,6 @@ class TargetManager extends EventEmitter4 {
|
|
|
304530
304660
|
return;
|
|
304531
304661
|
}
|
|
304532
304662
|
if (targetInfo.type === "service_worker") {
|
|
304533
|
-
this.#finishInitializationIfReady(targetInfo.targetId);
|
|
304534
304663
|
await silentDetach();
|
|
304535
304664
|
if (this.#attachedTargetsByTargetId.has(targetInfo.targetId)) {
|
|
304536
304665
|
return;
|
|
@@ -304543,12 +304672,18 @@ class TargetManager extends EventEmitter4 {
|
|
|
304543
304672
|
}
|
|
304544
304673
|
const isExistingTarget = this.#attachedTargetsByTargetId.has(targetInfo.targetId);
|
|
304545
304674
|
const target = isExistingTarget ? this.#attachedTargetsByTargetId.get(targetInfo.targetId) : this.#targetFactory(targetInfo, session2, parentSession instanceof CdpCDPSession ? parentSession : undefined);
|
|
304675
|
+
const parentTarget = parentSession instanceof CdpCDPSession ? parentSession.target() : null;
|
|
304546
304676
|
if (this.#targetFilterCallback && !this.#targetFilterCallback(target)) {
|
|
304547
304677
|
this.#ignoredTargets.add(targetInfo.targetId);
|
|
304548
|
-
|
|
304678
|
+
if (parentTarget?.type() === "tab") {
|
|
304679
|
+
this.#finishInitializationIfReady(parentTarget._targetId);
|
|
304680
|
+
}
|
|
304549
304681
|
await silentDetach();
|
|
304550
304682
|
return;
|
|
304551
304683
|
}
|
|
304684
|
+
if (this.#waitForInitiallyDiscoveredTargets && event.targetInfo.type === "tab" && !this.#initialAttachDone) {
|
|
304685
|
+
this.#targetsIdsForInit.add(event.targetInfo.targetId);
|
|
304686
|
+
}
|
|
304552
304687
|
this.#setupAttachmentListeners(session2);
|
|
304553
304688
|
if (isExistingTarget) {
|
|
304554
304689
|
session2.setTarget(target);
|
|
@@ -304558,14 +304693,14 @@ class TargetManager extends EventEmitter4 {
|
|
|
304558
304693
|
this.#attachedTargetsByTargetId.set(targetInfo.targetId, target);
|
|
304559
304694
|
this.#attachedTargetsBySessionId.set(session2.id(), target);
|
|
304560
304695
|
}
|
|
304561
|
-
const parentTarget = parentSession instanceof CDPSession ? parentSession.target() : null;
|
|
304562
304696
|
parentTarget?._addChildTarget(target);
|
|
304563
304697
|
parentSession.emit(CDPSessionEvent.Ready, session2);
|
|
304564
|
-
this.#targetsIdsForInit.delete(target._targetId);
|
|
304565
304698
|
if (!isExistingTarget) {
|
|
304566
304699
|
this.emit("targetAvailable", target);
|
|
304567
304700
|
}
|
|
304568
|
-
|
|
304701
|
+
if (parentTarget?.type() === "tab") {
|
|
304702
|
+
this.#finishInitializationIfReady(parentTarget._targetId);
|
|
304703
|
+
}
|
|
304569
304704
|
await Promise.all([
|
|
304570
304705
|
session2.send("Target.setAutoAttach", {
|
|
304571
304706
|
waitForDebuggerOnStart: true,
|
|
@@ -304580,6 +304715,9 @@ class TargetManager extends EventEmitter4 {
|
|
|
304580
304715
|
if (targetId !== undefined) {
|
|
304581
304716
|
this.#targetsIdsForInit.delete(targetId);
|
|
304582
304717
|
}
|
|
304718
|
+
if (!this.#initialAttachDone) {
|
|
304719
|
+
return;
|
|
304720
|
+
}
|
|
304583
304721
|
if (this.#targetsIdsForInit.size === 0) {
|
|
304584
304722
|
this.#initializeDeferred.resolve();
|
|
304585
304723
|
}
|
|
@@ -304751,10 +304889,14 @@ class CdpBrowser extends Browser {
|
|
|
304751
304889
|
async newPage() {
|
|
304752
304890
|
return await this.#defaultContext.newPage();
|
|
304753
304891
|
}
|
|
304754
|
-
async _createPageInContext(contextId) {
|
|
304892
|
+
async _createPageInContext(contextId, options) {
|
|
304893
|
+
const hasTargets = this.targets().filter((t) => {
|
|
304894
|
+
return t.browserContext().id === contextId;
|
|
304895
|
+
}).length > 0;
|
|
304755
304896
|
const { targetId } = await this.#connection.send("Target.createTarget", {
|
|
304756
304897
|
url: "about:blank",
|
|
304757
|
-
browserContextId: contextId || undefined
|
|
304898
|
+
browserContextId: contextId || undefined,
|
|
304899
|
+
newWindow: hasTargets && options?.type === "window" ? true : undefined
|
|
304758
304900
|
});
|
|
304759
304901
|
const target = await this.waitForTarget((t) => {
|
|
304760
304902
|
return t._targetId === targetId;
|
|
@@ -304772,6 +304914,26 @@ class CdpBrowser extends Browser {
|
|
|
304772
304914
|
}
|
|
304773
304915
|
return page;
|
|
304774
304916
|
}
|
|
304917
|
+
async _createDevToolsPage(pageTargetId) {
|
|
304918
|
+
const openDevToolsResponse = await this.#connection.send("Target.openDevTools", {
|
|
304919
|
+
targetId: pageTargetId
|
|
304920
|
+
});
|
|
304921
|
+
const target = await this.waitForTarget((t) => {
|
|
304922
|
+
return t._targetId === openDevToolsResponse.targetId;
|
|
304923
|
+
});
|
|
304924
|
+
if (!target) {
|
|
304925
|
+
throw new Error(`Missing target for DevTools page (id = ${pageTargetId})`);
|
|
304926
|
+
}
|
|
304927
|
+
const initialized = await target._initializedDeferred.valueOrThrow() === InitializationStatus.SUCCESS;
|
|
304928
|
+
if (!initialized) {
|
|
304929
|
+
throw new Error(`Failed to create target for DevTools page (id = ${pageTargetId})`);
|
|
304930
|
+
}
|
|
304931
|
+
const page = await target.page();
|
|
304932
|
+
if (!page) {
|
|
304933
|
+
throw new Error(`Failed to create a DevTools Page for target (id = ${pageTargetId})`);
|
|
304934
|
+
}
|
|
304935
|
+
return page;
|
|
304936
|
+
}
|
|
304775
304937
|
async installExtension(path51) {
|
|
304776
304938
|
const { id } = await this.#connection.send("Extensions.loadUnpacked", { path: path51 });
|
|
304777
304939
|
return id;
|
|
@@ -304829,8 +304991,8 @@ class CdpBrowser extends Browser {
|
|
|
304829
304991
|
// ../../node_modules/puppeteer-core/lib/esm/puppeteer/cdp/BrowserConnector.js
|
|
304830
304992
|
init_util2();
|
|
304831
304993
|
async function _connectToCdpBrowser(connectionTransport, url2, options) {
|
|
304832
|
-
const { acceptInsecureCerts = false, networkEnabled = true, defaultViewport = DEFAULT_VIEWPORT, downloadBehavior, targetFilter, _isPageTarget: isPageTarget, slowMo = 0, protocolTimeout, handleDevToolsAsPage } = options;
|
|
304833
|
-
const connection = new Connection(url2, connectionTransport, slowMo, protocolTimeout);
|
|
304994
|
+
const { acceptInsecureCerts = false, networkEnabled = true, defaultViewport = DEFAULT_VIEWPORT, downloadBehavior, targetFilter, _isPageTarget: isPageTarget, slowMo = 0, protocolTimeout, handleDevToolsAsPage, idGenerator = createIncrementalIdGenerator() } = options;
|
|
304995
|
+
const connection = new Connection(url2, connectionTransport, slowMo, protocolTimeout, false, idGenerator);
|
|
304834
304996
|
const { browserContextIds } = await connection.send("Target.getBrowserContexts");
|
|
304835
304997
|
const browser2 = await CdpBrowser._create(connection, browserContextIds, acceptInsecureCerts, defaultViewport, downloadBehavior, undefined, () => {
|
|
304836
304998
|
return connection.send("Browser.close").catch(debugError);
|
|
@@ -304883,7 +305045,9 @@ class ExtensionTransport {
|
|
|
304883
305045
|
});
|
|
304884
305046
|
};
|
|
304885
305047
|
#dispatchResponse(message) {
|
|
304886
|
-
|
|
305048
|
+
setTimeout(() => {
|
|
305049
|
+
this.onmessage?.(JSON.stringify(message));
|
|
305050
|
+
}, 0);
|
|
304887
305051
|
}
|
|
304888
305052
|
send(message) {
|
|
304889
305053
|
const parsed = JSON.parse(message);
|
|
@@ -304939,6 +305103,7 @@ class ExtensionTransport {
|
|
|
304939
305103
|
if (parsed.sessionId === "tabTargetSessionId") {
|
|
304940
305104
|
this.#dispatchResponse({
|
|
304941
305105
|
method: "Target.attachedToTarget",
|
|
305106
|
+
sessionId: "tabTargetSessionId",
|
|
304942
305107
|
params: {
|
|
304943
305108
|
targetInfo: pageTargetInfo,
|
|
304944
305109
|
sessionId: "pageTargetSessionId"
|
|
@@ -306642,8 +306807,8 @@ async function _connectToBiDiBrowser(connectionTransport, url2, options) {
|
|
|
306642
306807
|
}
|
|
306643
306808
|
async function getBiDiConnection(connectionTransport, url2, options) {
|
|
306644
306809
|
const BiDi = await Promise.resolve().then(() => (init_bidi(), exports_bidi));
|
|
306645
|
-
const { slowMo = 0, protocolTimeout } = options;
|
|
306646
|
-
const pureBidiConnection = new BiDi.BidiConnection(url2, connectionTransport, slowMo, protocolTimeout);
|
|
306810
|
+
const { slowMo = 0, protocolTimeout, idGenerator = createIncrementalIdGenerator() } = options;
|
|
306811
|
+
const pureBidiConnection = new BiDi.BidiConnection(url2, connectionTransport, idGenerator, slowMo, protocolTimeout);
|
|
306647
306812
|
try {
|
|
306648
306813
|
const result = await pureBidiConnection.send("session.status", {});
|
|
306649
306814
|
if ("type" in result && result.type === "success") {
|
|
@@ -306660,7 +306825,7 @@ async function getBiDiConnection(connectionTransport, url2, options) {
|
|
|
306660
306825
|
}
|
|
306661
306826
|
}
|
|
306662
306827
|
pureBidiConnection.unbind();
|
|
306663
|
-
const cdpConnection = new Connection(url2, connectionTransport, slowMo, protocolTimeout, true);
|
|
306828
|
+
const cdpConnection = new Connection(url2, connectionTransport, slowMo, protocolTimeout, true, idGenerator);
|
|
306664
306829
|
const version3 = await cdpConnection.send("Browser.getVersion");
|
|
306665
306830
|
if (version3.product.toLowerCase().includes("firefox")) {
|
|
306666
306831
|
throw new UnsupportedOperation("Firefox is not supported in BiDi over CDP mode.");
|
|
@@ -306788,9 +306953,9 @@ init_WaitTask();
|
|
|
306788
306953
|
init_XPathQueryHandler();
|
|
306789
306954
|
// ../../node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js
|
|
306790
306955
|
var PUPPETEER_REVISIONS = Object.freeze({
|
|
306791
|
-
chrome: "
|
|
306792
|
-
"chrome-headless-shell": "
|
|
306793
|
-
firefox: "stable_144.0"
|
|
306956
|
+
chrome: "142.0.7444.59",
|
|
306957
|
+
"chrome-headless-shell": "142.0.7444.59",
|
|
306958
|
+
firefox: "stable_144.0.2"
|
|
306794
306959
|
});
|
|
306795
306960
|
// ../../node_modules/puppeteer-core/lib/esm/puppeteer/util/util.js
|
|
306796
306961
|
init_Deferred();
|
|
@@ -306982,8 +307147,9 @@ function relativeExecutablePath(platform2, _buildId) {
|
|
|
306982
307147
|
return path51.join("chrome-" + folder(platform2), "chrome.exe");
|
|
306983
307148
|
}
|
|
306984
307149
|
}
|
|
307150
|
+
var baseVersionUrl = "https://googlechromelabs.github.io/chrome-for-testing";
|
|
306985
307151
|
async function getLastKnownGoodReleaseForChannel(channel) {
|
|
306986
|
-
const data = await getJSON(new URL(
|
|
307152
|
+
const data = await getJSON(new URL(`${baseVersionUrl}/last-known-good-versions.json`));
|
|
306987
307153
|
for (const channel2 of Object.keys(data.channels)) {
|
|
306988
307154
|
data.channels[channel2.toLowerCase()] = data.channels[channel2];
|
|
306989
307155
|
delete data.channels[channel2];
|
|
@@ -306991,11 +307157,11 @@ async function getLastKnownGoodReleaseForChannel(channel) {
|
|
|
306991
307157
|
return data.channels[channel];
|
|
306992
307158
|
}
|
|
306993
307159
|
async function getLastKnownGoodReleaseForMilestone(milestone) {
|
|
306994
|
-
const data = await getJSON(new URL(
|
|
307160
|
+
const data = await getJSON(new URL(`${baseVersionUrl}/latest-versions-per-milestone.json`));
|
|
306995
307161
|
return data.milestones[milestone];
|
|
306996
307162
|
}
|
|
306997
307163
|
async function getLastKnownGoodReleaseForBuild(buildPrefix) {
|
|
306998
|
-
const data = await getJSON(new URL(
|
|
307164
|
+
const data = await getJSON(new URL(`${baseVersionUrl}/latest-patch-versions-per-build.json`));
|
|
306999
307165
|
return data.builds[buildPrefix];
|
|
307000
307166
|
}
|
|
307001
307167
|
async function resolveBuildId(channel) {
|
|
@@ -307407,6 +307573,7 @@ var FirefoxChannel;
|
|
|
307407
307573
|
FirefoxChannel2["BETA"] = "beta";
|
|
307408
307574
|
FirefoxChannel2["NIGHTLY"] = "nightly";
|
|
307409
307575
|
})(FirefoxChannel || (FirefoxChannel = {}));
|
|
307576
|
+
var baseVersionUrl2 = "https://product-details.mozilla.org/1.0";
|
|
307410
307577
|
async function resolveBuildId3(channel = FirefoxChannel.NIGHTLY) {
|
|
307411
307578
|
const channelToVersionKey = {
|
|
307412
307579
|
[FirefoxChannel.ESR]: "FIREFOX_ESR",
|
|
@@ -307415,7 +307582,7 @@ async function resolveBuildId3(channel = FirefoxChannel.NIGHTLY) {
|
|
|
307415
307582
|
[FirefoxChannel.BETA]: "FIREFOX_DEVEDITION",
|
|
307416
307583
|
[FirefoxChannel.NIGHTLY]: "FIREFOX_NIGHTLY"
|
|
307417
307584
|
};
|
|
307418
|
-
const versions2 = await getJSON(new URL(
|
|
307585
|
+
const versions2 = await getJSON(new URL(`${baseVersionUrl2}/firefox_versions.json`));
|
|
307419
307586
|
const version3 = versions2[channelToVersionKey[channel]];
|
|
307420
307587
|
if (!version3) {
|
|
307421
307588
|
throw new Error(`Channel ${channel} is not found.`);
|
|
@@ -308588,7 +308755,7 @@ function isValidBrowser(browser2) {
|
|
|
308588
308755
|
function isValidPlatform(platform2) {
|
|
308589
308756
|
return Object.values(BrowserPlatform).includes(platform2);
|
|
308590
308757
|
}
|
|
308591
|
-
var packageVersion2 = "2.10.
|
|
308758
|
+
var packageVersion2 = "2.10.13";
|
|
308592
308759
|
|
|
308593
308760
|
class CLI {
|
|
308594
308761
|
#cachePath;
|
|
@@ -308919,7 +309086,7 @@ class BrowserLauncher {
|
|
|
308919
309086
|
return this.#browser;
|
|
308920
309087
|
}
|
|
308921
309088
|
async launch(options = {}) {
|
|
308922
|
-
const { dumpio = false, enableExtensions = false, env: env4 = process.env, handleSIGINT = true, handleSIGTERM = true, handleSIGHUP = true, acceptInsecureCerts = false, networkEnabled = true, defaultViewport = DEFAULT_VIEWPORT, downloadBehavior, slowMo = 0, timeout: timeout2 = 30000, waitForInitialPage = true, protocolTimeout, handleDevToolsAsPage } = options;
|
|
309089
|
+
const { dumpio = false, enableExtensions = false, env: env4 = process.env, handleSIGINT = true, handleSIGTERM = true, handleSIGHUP = true, acceptInsecureCerts = false, networkEnabled = true, defaultViewport = DEFAULT_VIEWPORT, downloadBehavior, slowMo = 0, timeout: timeout2 = 30000, waitForInitialPage = true, protocolTimeout, handleDevToolsAsPage, idGenerator = createIncrementalIdGenerator() } = options;
|
|
308923
309090
|
let { protocol } = options;
|
|
308924
309091
|
if (this.#browser === "firefox" && protocol === undefined) {
|
|
308925
309092
|
protocol = "webDriverBiDi";
|
|
@@ -308972,20 +309139,23 @@ class BrowserLauncher {
|
|
|
308972
309139
|
slowMo,
|
|
308973
309140
|
defaultViewport,
|
|
308974
309141
|
acceptInsecureCerts,
|
|
308975
|
-
networkEnabled
|
|
309142
|
+
networkEnabled,
|
|
309143
|
+
idGenerator
|
|
308976
309144
|
});
|
|
308977
309145
|
} else {
|
|
308978
309146
|
if (usePipe) {
|
|
308979
309147
|
cdpConnection = await this.createCdpPipeConnection(browserProcess, {
|
|
308980
309148
|
timeout: timeout2,
|
|
308981
309149
|
protocolTimeout,
|
|
308982
|
-
slowMo
|
|
309150
|
+
slowMo,
|
|
309151
|
+
idGenerator
|
|
308983
309152
|
});
|
|
308984
309153
|
} else {
|
|
308985
309154
|
cdpConnection = await this.createCdpSocketConnection(browserProcess, {
|
|
308986
309155
|
timeout: timeout2,
|
|
308987
309156
|
protocolTimeout,
|
|
308988
|
-
slowMo
|
|
309157
|
+
slowMo,
|
|
309158
|
+
idGenerator
|
|
308989
309159
|
});
|
|
308990
309160
|
}
|
|
308991
309161
|
if (protocol === "webDriverBiDi") {
|
|
@@ -309056,12 +309226,12 @@ class BrowserLauncher {
|
|
|
309056
309226
|
async createCdpSocketConnection(browserProcess, opts) {
|
|
309057
309227
|
const browserWSEndpoint = await browserProcess.waitForLineOutput(CDP_WEBSOCKET_ENDPOINT_REGEX, opts.timeout);
|
|
309058
309228
|
const transport = await NodeWebSocketTransport.create(browserWSEndpoint);
|
|
309059
|
-
return new Connection(browserWSEndpoint, transport, opts.slowMo, opts.protocolTimeout);
|
|
309229
|
+
return new Connection(browserWSEndpoint, transport, opts.slowMo, opts.protocolTimeout, false, opts.idGenerator);
|
|
309060
309230
|
}
|
|
309061
309231
|
async createCdpPipeConnection(browserProcess, opts) {
|
|
309062
309232
|
const { 3: pipeWrite, 4: pipeRead } = browserProcess.nodeProcess.stdio;
|
|
309063
309233
|
const transport = new PipeTransport(pipeWrite, pipeRead);
|
|
309064
|
-
return new Connection("", transport, opts.slowMo, opts.protocolTimeout);
|
|
309234
|
+
return new Connection("", transport, opts.slowMo, opts.protocolTimeout, false, opts.idGenerator);
|
|
309065
309235
|
}
|
|
309066
309236
|
async createBiDiOverCdpBrowser(browserProcess, cdpConnection, closeCallback, opts) {
|
|
309067
309237
|
const bidiOnly = process.env["PUPPETEER_WEBDRIVER_BIDI_ONLY"] === "true";
|
|
@@ -309081,7 +309251,7 @@ class BrowserLauncher {
|
|
|
309081
309251
|
const browserWSEndpoint = await browserProcess.waitForLineOutput(WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, opts.timeout) + "/session";
|
|
309082
309252
|
const transport = await NodeWebSocketTransport.create(browserWSEndpoint);
|
|
309083
309253
|
const BiDi = await Promise.resolve().then(() => (init_bidi(), exports_bidi));
|
|
309084
|
-
const bidiConnection = new BiDi.BidiConnection(browserWSEndpoint, transport, opts.slowMo, opts.protocolTimeout);
|
|
309254
|
+
const bidiConnection = new BiDi.BidiConnection(browserWSEndpoint, transport, opts.idGenerator, opts.slowMo, opts.protocolTimeout);
|
|
309085
309255
|
return await BiDi.BidiBrowser.create({
|
|
309086
309256
|
connection: bidiConnection,
|
|
309087
309257
|
closeCallback,
|
|
@@ -309945,7 +310115,7 @@ var getConfiguration = () => {
|
|
|
309945
310115
|
const result = import_cosmiconfig.cosmiconfigSync("puppeteer", {
|
|
309946
310116
|
searchStrategy: "global"
|
|
309947
310117
|
}).search();
|
|
309948
|
-
const configuration = result ? result.config : {};
|
|
310118
|
+
const configuration = result ? { ...result.config } : {};
|
|
309949
310119
|
configuration.logLevel = getLogLevel(process.env["PUPPETEER_LOGLEVEL"] ?? configuration.logLevel);
|
|
309950
310120
|
configuration.defaultBrowser = getDefaultBrowser(process.env["PUPPETEER_BROWSER"] ?? configuration.defaultBrowser);
|
|
309951
310121
|
configuration.executablePath = process.env["PUPPETEER_EXECUTABLE_PATH"] ?? configuration.executablePath;
|
|
@@ -313188,5 +313358,5 @@ main().catch((error46) => {
|
|
|
313188
313358
|
process.exit(1);
|
|
313189
313359
|
});
|
|
313190
313360
|
|
|
313191
|
-
//# debugId=
|
|
313361
|
+
//# debugId=575E1BAC108F155B64756E2164756E21
|
|
313192
313362
|
//# sourceMappingURL=index.js.map
|