@open-wa/cli 5.0.0-alpha.7 → 5.0.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/LICENSE.md CHANGED
@@ -55,9 +55,9 @@ Licensor hereby grants permission by this license ("License"), free of charge,
55
55
  4. Compliance with Human Rights Laws and Human Rights Principles:
56
56
 
57
57
  a. **Human Rights Laws**. The Software shall not be used by any person or entity for any systems, activities, or other uses that violate any applicable laws, regulations, or rules that protect human, civil, labor, privacy, political, environmental, security, economic, due process, or similar rights (the "Human Rights Laws"). Where the Human Rights Laws of more than one jurisdiction are applicable to the use of the Software, the Human Rights Laws that are most protective of the individuals or groups harmed shall apply.
58
-
58
+
59
59
  b. **Human Rights Principles**. Licensee is advised to consult the articles of the United Nations Universal Declaration of Human Rights (https://www.un.org/en/universal-declaration-human-rights/) and the United Nations Global Compact (https://www.unglobalcompact.org/ what-is-gc/mission/principles) that define recognized principles of international human rights (the "Human Rights Principles"). It is Licensor's express intent that all use of the Software be consistent with Human Rights Principles. If Licensor receives notification or otherwise learns of an alleged violation of any Human Rights Principles relating to Licensee's use of the Software, Licensor may in its discretion and without obligation (i) (a) notify Licensee of such allegation and (b) allow Licensee 90 days from notification under (i)(a) to investigate and respond to Licensor regarding the allegation and (ii) (a) after the earlier of 90 days from notification under (i)(a), or Licensee's response under (i)(b), notify Licensee of License termination and (b) allow Licensee an additional 90 days from notification under (ii)(a) to cease use of the Software.
60
-
60
+
61
61
  c. **Indemnity**. Licensee shall hold harmless and indemnify Licensor against all losses, damages, liabilities, deficiencies, claims, actions, judgments, settlements, interest, awards, penalties, fines, costs, or expenses of whatever kind, including Licensor's reasonable attorneys' fees, arising out of or relating to Licensee's non-compliance with this License or use of the Software in violation of Human Rights Laws or Human Rights Principles. 
62
62
 
63
63
  5. Enforceability: If any portion or provision of this License is determined to be invalid, illegal, or unenforceable by a court of competent jurisdiction, then such invalidity, illegality, or unenforceability shall not affect any other term or provision of this License or invalidate or render unenforceable such term or provision in any other jurisdiction. Upon a determination that any term or provision is invalid, illegal, or unenforceable, to the extent permitted by applicable law, the court may modify this License to affect the original intent of the parties as closely as possible. The section headings are for convenience only and are not intended to affect the construction or interpretation of this License. Any rule of construction to the effect that ambiguities are to be resolved against the drafting party shall not apply in interpreting this License. The language in this License shall be interpreted as to its fair meaning and not strictly for or against any party.
package/README.md CHANGED
@@ -24,8 +24,8 @@ wa-automate --help
24
24
 
25
25
  ## Documentation
26
26
 
27
- See the [CLI reference](https://docs.openwa.dev/reference/cli) on our docs site.
27
+ See the [CLI reference](https://openwa.dev/reference/cli) on our docs site.
28
28
 
29
29
  ## License
30
30
 
31
- [H-DNH V1.0](https://github.com/open-wa/wa-automate-nodejs/blob/main/LICENSE.md) — Hippocratic + Do Not Harm
31
+ [H-DNH 1.1](https://github.com/open-wa/wa-automate-nodejs/blob/master/LICENSE.md) — Hippocratic + Do Not Harm
package/dist/bin.cjs CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
2
  //#region \0rolldown/runtime.js
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
@@ -17,19 +16,20 @@ var __copyProps = (to, from, except, desc) => {
17
16
  }
18
17
  return to;
19
18
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
21
20
  value: mod,
22
21
  enumerable: true
23
22
  }) : target, mod));
24
23
  //#endregion
25
- const require_event_projection_store = require("./event-projection-store-BM9eOQXx.cjs");
24
+ const require_event_projection_store = require("./event-projection-store-DRXPBnNc.cjs");
26
25
  let _open_wa_wa_automate = require("@open-wa/wa-automate");
27
26
  let ws = require("ws");
28
- ws = __toESM(ws);
27
+ ws = __toESM(ws, 1);
29
28
  let qrcode = require("qrcode");
30
- qrcode = __toESM(qrcode);
29
+ qrcode = __toESM(qrcode, 1);
31
30
  //#region src/tunnel-client.ts
32
31
  var TunnelClient = class {
32
+ options;
33
33
  ws = null;
34
34
  reconnectTimeout = null;
35
35
  isDestroyed = false;
@@ -55,7 +55,8 @@ var TunnelClient = class {
55
55
  if (this.isDestroyed) return;
56
56
  let urlStr = this.options.proxyHost;
57
57
  if (urlStr.startsWith("http")) urlStr = urlStr.replace(/^http/, "ws");
58
- this.ws = new ws.default(`${urlStr}/sessions/${encodeURIComponent(this.options.sessionId)}/upstream?token=${encodeURIComponent(this.options.proxyToken)}`);
58
+ const connectUrl = `${urlStr}/sessions/${encodeURIComponent(this.options.sessionId)}/upstream?token=${encodeURIComponent(this.options.proxyToken)}`;
59
+ this.ws = new ws.default(connectUrl);
59
60
  this.ws.on("open", () => {
60
61
  this.log("info", `[TunnelClient] Connected upstream for session ${this.options.sessionId}`);
61
62
  });
@@ -395,4 +396,3 @@ async function main() {
395
396
  }
396
397
  main();
397
398
  //#endregion
398
- exports.__toESM = __toESM;
package/dist/bin.d.cts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -1,4 +1,3 @@
1
- require("./bin.cjs");
2
1
  let zod = require("zod");
3
2
  //#region src/config/cli-flags-schema.ts
4
3
  const OutputModeOverrideSchema = zod.z.enum(["interactive", "plain"]);
@@ -86,20 +85,8 @@ var OutputBroker = class {
86
85
  this.forward("error", "console", stringifyArgs(args), () => this.originalConsole?.error(...args));
87
86
  };
88
87
  if (this.interceptStreams) {
89
- process.stdout.write = ((chunk, encoding, callback) => {
90
- const message = Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk);
91
- this.forward("info", "stdout", message, () => this.originalWrites?.stdout(chunk, encoding, callback));
92
- if (this.interactive && !this.passthrough) if (typeof encoding === "function") encoding(void 0);
93
- else callback?.(void 0);
94
- return true;
95
- });
96
- process.stderr.write = ((chunk, encoding, callback) => {
97
- const message = Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk);
98
- this.forward("error", "stderr", message, () => this.originalWrites?.stderr(chunk, encoding, callback));
99
- if (this.interactive && !this.passthrough) if (typeof encoding === "function") encoding(void 0);
100
- else callback?.(void 0);
101
- return true;
102
- });
88
+ process.stdout.write = this.createStreamInterceptor("info", "stdout", this.originalWrites.stdout);
89
+ process.stderr.write = this.createStreamInterceptor("error", "stderr", this.originalWrites.stderr);
103
90
  }
104
91
  }
105
92
  dispose() {
@@ -133,6 +120,22 @@ var OutputBroker = class {
133
120
  write(level, message, source = "runtime") {
134
121
  this.forward(level, source, message);
135
122
  }
123
+ createStreamInterceptor(level, source, originalWrite) {
124
+ const broker = this;
125
+ function write(chunk, encoding, callback) {
126
+ const message = Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk);
127
+ broker.forward(level, source, message, () => {
128
+ if (typeof encoding === "function") originalWrite(chunk, encoding);
129
+ else originalWrite(chunk, encoding, callback);
130
+ });
131
+ if (broker.interactive && !broker.passthrough) {
132
+ if (typeof encoding === "function") encoding(void 0);
133
+ else callback?.(void 0);
134
+ }
135
+ return true;
136
+ }
137
+ return write;
138
+ }
136
139
  forward(level, source, message, passthroughWriter) {
137
140
  const entry = {
138
141
  level,
@@ -183,6 +186,11 @@ async function performGracefulShutdown(state, signal) {
183
186
  } catch (error) {
184
187
  errors.push(normalizeError(error, "client.stop failed"));
185
188
  }
189
+ if (runtime) try {
190
+ runtime.dispose();
191
+ } catch (error) {
192
+ errors.push(normalizeError(error, "runtime.dispose failed"));
193
+ }
186
194
  store?.projectStatus({
187
195
  phase: "shutdown.complete",
188
196
  detail: `Shutdown completed after ${signal}`
package/dist/index.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_projection_store = require("./event-projection-store-BM9eOQXx.cjs");
3
- require("./bin.cjs");
2
+ const require_event_projection_store = require("./event-projection-store-DRXPBnNc.cjs");
4
3
  let _open_wa_wa_automate = require("@open-wa/wa-automate");
5
4
  exports.CliShutdownError = require_event_projection_store.CliShutdownError;
6
5
  exports.EventProjectionStore = require_event_projection_store.EventProjectionStore;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { CliQrPayload, CliRuntimeResult, CliStatusUpdate, parseCliArgs, runCli as main, startCli as start } from "@open-wa/wa-automate";
2
2
  import { z } from "zod";
3
- import { EventEmitter } from "node:events";
3
+ import { HyperEmitter } from "@open-wa/hyperemitter";
4
4
  import { OpenWAEventMap } from "@open-wa/core";
5
-
6
5
  //#region src/config/cli-flags-schema.d.ts
7
6
  declare const CliLocalFlagsSchema: z.ZodObject<{
8
7
  outputMode: z.ZodOptional<z.ZodEnum<{
@@ -15,7 +14,7 @@ interface ParsedCliLocalFlags {
15
14
  flags: CliLocalFlags;
16
15
  forwardedArgs: string[];
17
16
  }
18
- declare function parseCliLocalFlags(argv: string[]): ParsedCliLocalFlags;
17
+ export declare function parseCliLocalFlags(argv: string[]): ParsedCliLocalFlags;
19
18
  //#endregion
20
19
  //#region src/runtime/output-broker.d.ts
21
20
  type BrokerLevel = 'debug' | 'info' | 'warn' | 'error';
@@ -33,7 +32,7 @@ interface OutputBrokerOptions {
33
32
  interceptStreams?: boolean;
34
33
  }
35
34
  type Subscriber = (entry: BrokerEntry) => void;
36
- declare class OutputBroker {
35
+ export declare class OutputBroker {
37
36
  private readonly interactive;
38
37
  private readonly maxEntries;
39
38
  private readonly passthrough;
@@ -51,98 +50,10 @@ declare class OutputBroker {
51
50
  writeRawStdout(message: string): void;
52
51
  writeRawStderr(message: string): void;
53
52
  write(level: BrokerLevel, message: string, source?: BrokerSource): void;
53
+ private createStreamInterceptor;
54
54
  private forward;
55
55
  }
56
- declare function createOutputBroker(options: OutputBrokerOptions): OutputBroker;
57
- //#endregion
58
- //#region ../logger/dist/index.d.cts
59
- //#endregion
60
- //#region src/core/context.d.ts
61
- interface LogContext {
62
- sessionId?: string;
63
- driver?: 'puppeteer' | 'playwright' | 'remote';
64
- requestId?: string;
65
- schemaId?: string;
66
- 'http.method'?: string;
67
- 'http.path'?: string;
68
- 'http.statusCode'?: number;
69
- 'http.latencyMs'?: number;
70
- traceId?: string;
71
- spanId?: string;
72
- isolateId?: string;
73
- colo?: string;
74
- doId?: string;
75
- [key: string]: unknown;
76
- }
77
- //#endregion
78
- //#region src/core/levels.d.ts
79
- type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal'; //#endregion
80
- //#region src/core/logger.d.ts
81
- interface LoggerInterface {
82
- debug(message: string, meta?: LogContext): void;
83
- info(message: string, meta?: LogContext): void;
84
- warn(message: string, meta?: LogContext): void;
85
- error(message: string, meta?: LogContext & {
86
- error?: unknown;
87
- }): void;
88
- fatal(message: string, meta?: LogContext & {
89
- error?: unknown;
90
- }): void;
91
- child(context: LogContext): LoggerInterface;
92
- withContext(context: LogContext): LoggerInterface;
93
- setLevel(level: LogLevel): void;
94
- }
95
- type Logger = LoggerInterface; //#endregion
96
- //#region src/security/rules.d.ts
97
- //#endregion
98
- //#region ../hyperemitter/dist/index.d.cts
99
- interface ListenerOptions {
100
- signal?: AbortSignal;
101
- weak?: object;
102
- captureRejections?: boolean;
103
- }
104
- interface HyperEmitterOptions {
105
- delimiter?: string;
106
- captureRejections?: boolean;
107
- onError?: (error: unknown) => void;
108
- debug?: boolean;
109
- logger?: Logger;
110
- loggerContext?: LogContext;
111
- } //#endregion
112
- //#region src/core/HyperEmitter.d.ts
113
- declare class HyperEmitter<TMap extends object = Record<string, unknown>> {
114
- private readonly delimiter;
115
- private readonly captureRejections;
116
- private readonly onError?;
117
- private readonly finalizer?;
118
- private readonly logger?;
119
- private readonly debugEnabled;
120
- private readonly baseLogContext;
121
- private exactListeners;
122
- private wildcardTree;
123
- private wildcardIndex;
124
- private hasWildcards;
125
- private anyListeners;
126
- constructor(options?: HyperEmitterOptions);
127
- on<K extends keyof TMap & string>(event: K, listener: (payload: TMap[K]) => void | Promise<void>, options?: ListenerOptions): this;
128
- once<K extends keyof TMap & string>(event: K, listener: (payload: TMap[K]) => void | Promise<void>, options?: ListenerOptions): this;
129
- off<K extends keyof TMap & string>(event: K, listener: (payload: TMap[K]) => void | Promise<void>): this;
130
- emit<K extends keyof TMap & string>(event: K, payload: TMap[K]): boolean;
131
- onAny(listener: (event: string, payload: any) => void): this;
132
- offAny(listener: (event: string, payload: any) => void): this;
133
- listenerCount(event?: keyof TMap & string): number;
134
- removeAllListeners(event?: keyof TMap & string): this;
135
- fromNodeEmitter(emitter: EventEmitter, event: string): () => void;
136
- toNodeEmitter(target: EventEmitter): () => void;
137
- onEventTarget(target: EventTarget, type: string, eventName: keyof TMap & string): () => void;
138
- private add;
139
- private dispatch;
140
- private invoke;
141
- private offListener;
142
- private handleRejection;
143
- private removeWildcard;
144
- private logDebug;
145
- } //#endregion
56
+ export declare function createOutputBroker(options: OutputBrokerOptions): OutputBroker;
146
57
  //#endregion
147
58
  //#region src/state/event-projection-store.d.ts
148
59
  interface ProjectionSnapshot {
@@ -161,7 +72,7 @@ interface EventProjectionStoreOptions {
161
72
  eventDebounceMs?: number;
162
73
  }
163
74
  type ProjectionListener = (snapshot: ProjectionSnapshot) => void;
164
- declare class EventProjectionStore {
75
+ export declare class EventProjectionStore {
165
76
  private readonly maxLogs;
166
77
  private readonly eventDebounceMs;
167
78
  private readonly listeners;
@@ -179,7 +90,7 @@ declare class EventProjectionStore {
179
90
  private scheduleFlush;
180
91
  private emit;
181
92
  }
182
- declare function createEventProjectionStore(options?: EventProjectionStoreOptions): EventProjectionStore;
93
+ export declare function createEventProjectionStore(options?: EventProjectionStoreOptions): EventProjectionStore;
183
94
  //#endregion
184
95
  //#region src/runtime/cli-termination.d.ts
185
96
  interface ShutdownRuntimeState {
@@ -189,11 +100,11 @@ interface ShutdownRuntimeState {
189
100
  };
190
101
  store?: EventProjectionStore;
191
102
  }
192
- declare class CliShutdownError extends AggregateError {
103
+ export declare class CliShutdownError extends AggregateError {
193
104
  constructor(errors: Error[], signal: NodeJS.Signals);
194
105
  }
195
- declare function performGracefulShutdown(state: ShutdownRuntimeState, signal: NodeJS.Signals): Promise<void>;
196
- declare function writeVisibleFatalError(message: string, writeRawStderr: (message: string) => void): void;
106
+ export declare function performGracefulShutdown(state: ShutdownRuntimeState, signal: NodeJS.Signals): Promise<void>;
107
+ export declare function writeVisibleFatalError(message: string, writeRawStderr: (message: string) => void): void;
197
108
  //#endregion
198
109
  //#region src/runtime/output-mode.d.ts
199
110
  type OutputModeKind = 'interactive' | 'plain';
@@ -209,7 +120,7 @@ interface DetectOutputModeOptions {
209
120
  stdout?: Pick<NodeJS.WriteStream, 'isTTY'>;
210
121
  stderr?: Pick<NodeJS.WriteStream, 'isTTY'>;
211
122
  }
212
- declare function detectOutputMode(options?: DetectOutputModeOptions): OutputModeContract;
123
+ export declare function detectOutputMode(options?: DetectOutputModeOptions): OutputModeContract;
213
124
  //#endregion
214
125
  //#region src/runtime/shutdown-controller.d.ts
215
126
  interface ShutdownControllerOptions {
@@ -218,7 +129,7 @@ interface ShutdownControllerOptions {
218
129
  cleanup?: () => void | Promise<void>;
219
130
  exit?: (code: number) => never | void;
220
131
  }
221
- declare class ShutdownController {
132
+ export declare class ShutdownController {
222
133
  private readonly timeoutMs;
223
134
  private readonly gracefulShutdown;
224
135
  private readonly cleanup?;
@@ -233,7 +144,7 @@ declare class ShutdownController {
233
144
  handleSignal(signal: NodeJS.Signals): Promise<void>;
234
145
  private runCleanup;
235
146
  }
236
- declare function createShutdownController(options: ShutdownControllerOptions): ShutdownController;
147
+ export declare function createShutdownController(options: ShutdownControllerOptions): ShutdownController;
237
148
  //#endregion
238
- export { CliShutdownError, EventProjectionStore, OutputBroker, ShutdownController, createEventProjectionStore, createOutputBroker, createShutdownController, detectOutputMode, main, parseCliArgs, parseCliLocalFlags, performGracefulShutdown, start, writeVisibleFatalError };
149
+ export { main, parseCliArgs, start };
239
150
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["winston","z","Transport","TransportConfigSchema","ZodLiteral","ZodEnum","ZodOptional","core","$strip","ZodObject","ZodString","ZodNumber","ZodDiscriminatedUnion","type","format","json","pretty","simple","path","maxSize","maxFiles","url","username","password","indexPrefix","bufferSize","flushInterval","brokerUrl","queue","LoggerConfigSchema","ZodArray","ZodBoolean","ZodDefault","level","debug","info","warn","error","fatal","transports","includeStack","TransportConfig","infer","LoggerConfig","LogContext","sessionId","driver","requestId","schemaId","traceId","spanId","isolateId","colo","doId","key","LogEvent","timestamp","message","component","name","stack","code","context","LogLevel","rootLogger","Logger","instance","LoggerInterface","meta","child","withContext","setLevel","createLogger","defaultContext","SanitizationRule","RegExp","pattern","strategy","options","keepChars","replacement","Sanitizer","rules","constructor","customRules","sanitize","findRule","applyRule","hash","sanitizeLogContext","createSanitizer","censorEmail","email","censorPhone","phone","censorWid","wid","censorToken","token","visibleChars","censorMessageBody","body","maxLength","censorObject","T","Record","obj","fields","GET_MATCH_RESULT","ParamIndexMap","ParamStash","Params","Result","RequestHeader","ResponseHeader","CustomHeader","InfoStatusCode","SuccessStatusCode","DeprecatedStatusCode","RedirectStatusCode","ClientErrorStatusCode","ServerErrorStatusCode","UnofficialStatusCode","StatusCode","ContentlessStatusCode","ContentfulStatusCode","Exclude","UnionToIntersection","U","k","I","JSONPrimitive","JSONArray","JSONObject","InvalidJSONValue","args","InvalidToNull","IsInvalid","OmitSymbolKeys","K","JSONValue","JSONParsed","TError","ReadonlyArray","J","Set","Map","toJSON","Simplify","KeyType","IsAny","Bindings","Variables","Env","Next","Promise","Input","ResponseFormat","in","out","outputFormat","BlankInput","RouterRoute","H","basePath","method","handler","HandlerResponse","O","Response","TypedResponse","Handler","E","P","R","Context","c","next","MiddlewareHandler","NotFoundResponse","NotFoundHandler","KnownResponseFormat","F","_data","_status","_format","FormValue","Blob","ParsedFormValue","File","ValidationTargets","form","query","param","_","header","cookie","ParamKey","Component","Name","NameWithPattern","Rest","_Pattern","ParamKeys","Path","ParamKeyToRecord","InputToDataByTarget","Target","RemoveQuestion","FetchEventLike","Request","request","respondWith","promise","passThroughOnException","waitUntil","BodyDataValueDot","x","BodyDataValueDotAll","SimplifyBodyData","BodyDataValueComponent","all","BodyDataValueObject","BodyDataValue","dot","BodyData","ParseBodyOptions","Partial","Body","ArrayBuffer","FormData","text","arrayBuffer","blob","formData","BodyCache","HonoRequest","P2","Options","raw","routeIndex","bodyCache","matchResult","queries","parseBody","addValidatedData","target","data","valid","matchedRoutes","routePath","BaseMime","_baseMimes","aac","avi","avif","av1","bin","bmp","css","csv","eot","epub","gif","gz","htm","html","ico","ics","jpeg","jpg","js","jsonld","map","mid","midi","mjs","mp3","mp4","mpeg","oga","ogv","ogx","opus","otf","pdf","png","rtf","svg","tif","tiff","ts","ttf","txt","wasm","webm","weba","webmanifest","webp","woff","woff2","xhtml","xml","zip","gltf","glb","HeaderRecord","Data","ReadableStream","Uint8Array","ExecutionContext","props","exports","ContextVariableMap","ContextRenderer","DefaultRenderer","content","Renderer","Function","PropsForRenderer","Parameters","Required","Props","Layout","Get","Key","Set$1","value","NewResponse","ResponseOrInit","status","headers","init","BodyRespond","TextRespond","JSONRespond","JSONRespondReturn","object","HTMLRespond","ContextOptions","env","executionCtx","notFoundHandler","SetHeadersOptions","append","SetHeaders","ResponseHeadersInit","Headers","ResponseInit","statusText","Error","Readonly","URL","ReturnType","finalized","req","event","res","_res","render","setLayout","layout","getLayout","setRenderer","renderer","set","get","var","newResponse","redirect","location","notFound","honoLogger","banner_d_exports","BannerOptions","show","showProjectBanner","version","subtitle","color","title","spinner_d_exports","fail","start","stop","succeed","update","animated_d_exports","ProgressLogger","ProgressOptions","total","label","current","done","index_d_exports","animated","banner","spinner","createConsoleTransport","Extract","transport","config","createFileTransport","createElasticsearchTransport","createMQTransport","createCloudflareTransport","index_d_exports$1","createTransport","cloudflare","console","elasticsearch","file","mq","terminal","EventEmitter","_$_open_wa_logger0","EventMap","key","EventListener","T","Promise","payload","ListenerOptions","AbortSignal","signal","weak","captureRejections","HyperEmitterOptions","Logger","LogContext","delimiter","onError","error","debug","logger","loggerContext","HyperEmitter","K","TMap","Record","EventTarget","finalizer","debugEnabled","baseLogContext","exactListeners","wildcardTree","wildcardIndex","hasWildcards","anyListeners","constructor","options","on","event","listener","once","off","emit","onAny","offAny","listenerCount","removeAllListeners","fromNodeEmitter","emitter","toNodeEmitter","target","onEventTarget","type","eventName","add","dispatch","invoke","offListener","handleRejection","removeWildcard","logDebug"],"sources":["../src/config/cli-flags-schema.ts","../src/runtime/output-broker.ts","../../logger/dist/index.d.cts","../../hyperemitter/dist/index.d.cts","../src/state/event-projection-store.ts","../src/runtime/cli-termination.ts","../src/runtime/output-mode.ts","../src/runtime/shutdown-controller.ts"],"mappings":";;;;;;cAIa,mBAAA,EAAmB,CAAA,CAAA,SAAA;;;;;;KAIpB,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,mBAAA;AAAA,UAE1B,mBAAA;EACf,KAAA,EAAO,aAAA;EACP,aAAA;AAAA;AAAA,iBAGc,kBAAA,CAAmB,IAAA,aAAiB,mBAAA;;;KCfxC,WAAA;AAAA,KACA,YAAA;AAAA,UAEK,WAAA;EACf,KAAA,EAAO,WAAA;EACP,OAAA;EACA,MAAA,EAAQ,YAAA;EACR,SAAA;AAAA;AAAA,UAGe,mBAAA;EACf,WAAA;EACA,UAAA;EACA,WAAA;EACA,gBAAA;AAAA;AAAA,KAGG,UAAA,IAAc,KAAA,EAAO,WAAA;AAAA,cA4Bb,YAAA;EAAA,iBACM,WAAA;EAAA,iBACA,UAAA;EAAA,iBACA,WAAA;EAAA,iBACA,gBAAA;EAAA,iBACA,OAAA;EAAA,iBACA,WAAA;EAAA,QACT,SAAA;EAAA,QACA,eAAA;EAAA,QAKA,cAAA;cAKI,OAAA,EAAS,mBAAA;EAOrB,OAAA,CAAA;EAuDA,OAAA,CAAA;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kBAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/config/cli-flags-schema.ts","../src/runtime/output-broker.ts","../src/state/event-projection-store.ts","../src/runtime/cli-termination.ts","../src/runtime/output-mode.ts","../src/runtime/shutdown-controller.ts"],"mappings":";;;;;cAIa,qBAAmB,EAAA;;;;;GAE9B,EAAA,KAAA;KAEU,gBAAgB,EAAE,aAAa;UAE1B;EACf,OAAO;EACP;;wBAGc,mBAAmB,iBAAiB;;;KCfxC;KACA;UAEK;EACf,OAAO;EACP;EACA,QAAQ;EACR;;UAGe;EACf;EACA;EACA;EACA;;KAGG,cAAc,OAAO;qBA4Bb;mBACM;mBACA;mBACA;mBACA;mBACA;mBACA;UACT;UACA;UAKA;EAKR,YAAY,SAAS;EAOrB;EAgCA;EAmBA,UAAU,UAAU;EAOpB,cAAc;EAId,eAAe;EAIf,eAAe;EAIf,MAAM,OAAO,aAAa,iBAAiB,SAAQ;UAI3C;UAiCA;;wBAuBM,mBAAmB,SAAS,sBAAsB;;;UCnMjD;EACf;EACA;EACA;EACA,KAAK;EACL,YAAY;EACZ;EACA;EACA;EACA;;UAGe;EACf;EACA;;KAGG,sBAAsB,UAAU;qBAGxB;mBACM;mBACA;mBACA;mBACA;UAOT;UACA;UACA;EAER,YAAY,UAAS;EAKrB,UAAU,UAAU;EAQpB,eAAe;EAOf,WAAW,OAAO;EAQlB,cAAc,QAAQ;EAatB,UAAU,SAAS;EAOnB,cAAc,SAAS,aAAa;UAmD5B;UAgBA;;wBAQM,2BAA2B,UAAS,8BAAmC;;;UChKtE;EACf,UAAU;EACV;IACE;;EAEF,QAAQ;;qBAGG,yBAAyB;EACpC,YAAY,QAAQ,SAAS,QAAQ,OAAO;;wBAcxB,wBAAwB,OAAO,sBAAsB,QAAQ,OAAO,UAAU;wBA6CpF,uBAAuB,iBAAiB,iBAAiB;;;KCrE7D;UAEK;EACf,MAAM;EACN;EACA;;UAae;EACf,QAAQ;EACR,MAAM,OAAO;EACb,QAAQ,KAAK,OAAO;EACpB,SAAS,KAAK,OAAO;EACrB,SAAS,KAAK,OAAO;;wBAGP,iBAAiB,UAAS,0BAA+B;;;UC5BxD;EACf;EACA,mBAAmB,QAAQ,OAAO,YAAY;EAC9C,uBAAuB;EACvB,QAAQ;;qBAGG;mBACM;mBACA;mBACA;mBACA;UACT;UACA;UACA;mBACS;EAEjB,YAAY,SAAS;EAOrB,QAAQ,UAAS,OAAO;EAgBxB;EAQM,aAAa,QAAQ,OAAO,UAAU;UAyB9B;;wBAUA,yBAAyB,SAAS,4BAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/cli",
3
- "version": "5.0.0-alpha.7",
3
+ "version": "5.0.0",
4
4
  "description": "CLI for @open-wa WhatsApp automation - Easy API mode",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.cjs",
@@ -18,20 +18,22 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "ink": "^5.2.1",
21
+ "@open-wa/core": "5.0.0",
22
+ "@open-wa/hyperemitter": "5.0.0",
23
+ "@open-wa/wa-automate": "5.0.0",
24
+ "ink": "^7.1.1",
22
25
  "qrcode": "^1.5.4",
23
- "react": "^18.3.1",
24
- "ws": "^8.20.0",
25
- "zod": "^4.2.1",
26
- "@open-wa/wa-automate": "5.0.0-alpha.7",
27
- "@open-wa/core": "5.0.0-alpha.7"
26
+ "react": "^19.3.0",
27
+ "ws": "^8.22.0",
28
+ "zod": "^4.6.5"
28
29
  },
29
30
  "devDependencies": {
30
- "@types/node": "^25.9.1",
31
- "@types/react": "^18.3.12",
31
+ "@types/node": "^26.6.3",
32
+ "@types/qrcode": "^1.5.6",
33
+ "@types/react": "^19.3.0",
32
34
  "@types/ws": "^8.18.1",
33
- "typescript": "^6.0.3",
34
- "vitest": "4.1.2"
35
+ "typescript": "^7.0.2",
36
+ "vitest": "5.0.2"
35
37
  },
36
38
  "publishConfig": {
37
39
  "access": "public"
@@ -41,6 +43,10 @@
41
43
  "type": "git",
42
44
  "url": "https://github.com/open-wa/wa-automate-nodejs.git"
43
45
  },
46
+ "license": "SEE LICENSE IN LICENSE.md",
47
+ "files": [
48
+ "dist"
49
+ ],
44
50
  "scripts": {
45
51
  "build": "tsdown src/index.ts src/bin.ts --format cjs",
46
52
  "dev": "tsdown src/index.ts src/bin.ts --format cjs --watch",
@@ -1,4 +0,0 @@
1
- {
2
- "executablePath": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
3
- "updatedAt": "2026-04-05T00:37:41.198Z"
4
- }
@@ -1,20 +0,0 @@
1
-
2
- > @open-wa/cli@5.0.0-alpha.7 build /Users/Mohammed/projects/tools/wa/packages/cli
3
- > tsdown src/index.ts src/bin.ts --format cjs
4
-
5
- ℹ tsdown v0.21.7 powered by rolldown v1.0.0-rc.12
6
- ℹ config file: /Users/Mohammed/projects/tools/wa/packages/cli/tsdown.config.ts
7
- ℹ entry: src/index.ts, src/bin.ts
8
- ℹ tsconfig: tsconfig.json
9
- ℹ Build start
10
- ℹ Cleaning 6 files
11
- ℹ Granting execute permission to dist/bin.cjs
12
- ℹ dist/bin.cjs 12.64 kB │ gzip: 3.93 kB
13
- ℹ dist/index.cjs 1.54 kB │ gzip: 0.43 kB
14
- ℹ dist/event-projection-store-BM9eOQXx.cjs 13.64 kB │ gzip: 3.38 kB
15
- ℹ 3 files, total: 27.82 kB
16
- ℹ dist/index.d.cts.map 10.54 kB │ gzip: 3.68 kB
17
- ℹ dist/index.d.cts 8.50 kB │ gzip: 2.43 kB
18
- ℹ dist/bin.d.cts 0.01 kB │ gzip: 0.03 kB
19
- ℹ 3 files, total: 19.05 kB
20
- ✔ Build complete in 2824ms
@@ -1,20 +0,0 @@
1
-
2
- > @open-wa/cli@5.0.0-alpha.0 test /Users/Mohammed/projects/tools/wa/packages/cli
3
- > vitest run
4
-
5
-
6
-  RUN  v4.1.2 /Users/Mohammed/projects/tools/wa/packages/cli
7
-
8
- ✓ src/__tests__/cli-termination.test.ts (2 tests) 5ms
9
- ✓ src/__tests__/output-broker.test.ts (4 tests) 5ms
10
- ✓ src/__tests__/shutdown-controller.test.ts (3 tests) 8ms
11
- ✓ src/__tests__/interactive-terminal.test.ts (1 test) 48ms
12
- ✓ src/__tests__/output-mode.test.ts (5 tests) 7ms
13
- ✓ src/__tests__/event-projection-store.test.ts (2 tests) 5ms
14
- ✓ src/__tests__/interactive-session.test.ts (2 tests) 62ms
15
-
16
-  Test Files  7 passed (7)
17
-  Tests  19 passed (19)
18
-  Start at  15:26:24
19
-  Duration  457ms (transform 459ms, setup 0ms, import 557ms, tests 140ms, environment 1ms)
20
-
package/CHANGELOG.md DELETED
@@ -1,71 +0,0 @@
1
- # @open-wa/cli
2
-
3
- ## 5.0.0-alpha.7
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies []:
8
- - @open-wa/core@5.0.0-alpha.7
9
- - @open-wa/wa-automate@5.0.0-alpha.7
10
-
11
- ## 5.0.0-alpha.6
12
-
13
- ### Patch Changes
14
-
15
- - Updated dependencies []:
16
- - @open-wa/wa-automate@5.0.0-alpha.6
17
- - @open-wa/core@5.0.0-alpha.6
18
-
19
- ## 5.0.0-alpha.5
20
-
21
- ### Patch Changes
22
-
23
- - Updated dependencies []:
24
- - @open-wa/wa-automate@5.0.0-alpha.5
25
- - @open-wa/core@5.0.0-alpha.5
26
-
27
- ## 5.0.0-alpha.4
28
-
29
- ### Patch Changes
30
-
31
- - Updated dependencies []:
32
- - @open-wa/wa-automate@5.0.0-alpha.4
33
- - @open-wa/core@5.0.0-alpha.4
34
-
35
- ## 5.0.0-alpha.3
36
-
37
- ### Patch Changes
38
-
39
- - Updated dependencies []:
40
- - @open-wa/core@5.0.0-alpha.3
41
- - @open-wa/wa-automate@5.0.0-alpha.3
42
-
43
- ## 5.0.0-alpha.2
44
-
45
- ### Patch Changes
46
-
47
- - Updated dependencies []:
48
- - @open-wa/core@5.0.0-alpha.2
49
- - @open-wa/wa-automate@5.0.0-alpha.2
50
-
51
- ## 6.0.0-alpha.2
52
-
53
- ### Minor Changes
54
-
55
- - Dry run minor bump
56
-
57
- ### Patch Changes
58
-
59
- - Updated dependencies []:
60
- - @open-wa/core@6.0.0-alpha.2
61
- - @open-wa/wa-automate@6.0.0-alpha.2
62
-
63
- ## 5.0.1-alpha.2
64
-
65
- ### Patch Changes
66
-
67
- - Dry run patch bump
68
-
69
- - Updated dependencies []:
70
- - @open-wa/core@5.0.1-alpha.2
71
- - @open-wa/wa-automate@5.0.1-alpha.2
@@ -1,50 +0,0 @@
1
- import { describe, expect, it, vi } from 'vitest';
2
- import { CliShutdownError, performGracefulShutdown, writeVisibleFatalError } from '../runtime/cli-termination';
3
-
4
- describe('CLI termination helpers', () => {
5
- it('attempts all teardown steps even when one rejects', async () => {
6
- const order: string[] = [];
7
- const store = {
8
- projectStatus: vi.fn((update: { phase: string }) => {
9
- order.push(`status:${update.phase}`);
10
- }),
11
- };
12
- const runtime = {
13
- server: {
14
- stop: vi.fn(async () => {
15
- order.push('server.stop');
16
- throw new Error('server breach');
17
- }),
18
- },
19
- client: {
20
- stop: vi.fn(async () => {
21
- order.push('client.stop');
22
- }),
23
- },
24
- } as any;
25
- const tunnelClient = {
26
- disconnect: vi.fn(() => {
27
- order.push('tunnel.disconnect');
28
- }),
29
- };
30
-
31
- const result = performGracefulShutdown({ runtime, tunnelClient, store: store as any }, 'SIGTERM');
32
-
33
- await expect(result).rejects.toBeInstanceOf(CliShutdownError);
34
- expect(order).toEqual([
35
- 'status:shutdown.starting',
36
- 'server.stop',
37
- 'tunnel.disconnect',
38
- 'client.stop',
39
- 'status:shutdown.complete',
40
- ]);
41
- });
42
-
43
- it('writes fatal errors directly to raw stderr for visibility', () => {
44
- const writeRawStderr = vi.fn();
45
-
46
- writeVisibleFatalError('reactor offline', writeRawStderr);
47
-
48
- expect(writeRawStderr).toHaveBeenCalledWith('\nFatal error: reactor offline\n');
49
- });
50
- });