@bubblegum-ai/node 0.0.6-alpha.0 → 0.0.6-alpha.10
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 +92 -1
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/client.js +118 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +16 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +1 -1
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/protocol.d.ts.map +1 -0
- package/dist/cjs/protocol.js +31 -0
- package/dist/cjs/protocol.js.map +1 -0
- package/dist/cjs/session.d.ts +191 -0
- package/dist/cjs/session.d.ts.map +1 -0
- package/dist/cjs/session.js +275 -0
- package/dist/cjs/session.js.map +1 -0
- package/dist/cjs/types.d.ts +76 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +10 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/client.d.ts +56 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/errors.d.ts +7 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +17 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/protocol.d.ts +53 -0
- package/dist/esm/protocol.d.ts.map +1 -0
- package/dist/esm/protocol.js.map +1 -0
- package/dist/esm/session.d.ts +191 -0
- package/dist/esm/session.d.ts.map +1 -0
- package/dist/esm/session.js +271 -0
- package/dist/esm/session.js.map +1 -0
- package/dist/esm/types.d.ts +76 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +16 -6
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js.map +0 -1
- package/dist/session.d.ts +0 -85
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -141
- package/dist/session.js.map +0 -1
- package/dist/types.d.ts +0 -40
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- /package/dist/{client.d.ts → cjs/client.d.ts} +0 -0
- /package/dist/{errors.d.ts → cjs/errors.d.ts} +0 -0
- /package/dist/{protocol.d.ts → cjs/protocol.d.ts} +0 -0
- /package/dist/{client.js → esm/client.js} +0 -0
- /package/dist/{errors.js → esm/errors.js} +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{protocol.js → esm/protocol.js} +0 -0
- /package/dist/{types.js → esm/types.js} +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bubblegum = void 0;
|
|
4
|
+
const client_js_1 = require("./client.js");
|
|
5
|
+
const errors_js_1 = require("./errors.js");
|
|
6
|
+
const protocol_js_1 = require("./protocol.js");
|
|
7
|
+
/**
|
|
8
|
+
* The ergonomic, engine-owned session. `launch()` spawns the bridge, negotiates
|
|
9
|
+
* the protocol, and opens a session whose Playwright/Appium handle lives inside
|
|
10
|
+
* the Python engine; every call here is a thin proxy to the same four primitives
|
|
11
|
+
* the Python SDK exposes, returning the identical `StepResult` shape.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* const bg = await Bubblegum.launch({ url: "https://example.com/login" });
|
|
15
|
+
* try {
|
|
16
|
+
* await bg.act('Enter "tom" into Username');
|
|
17
|
+
* await bg.act("Click Login");
|
|
18
|
+
* await bg.verify("Dashboard is visible");
|
|
19
|
+
* } finally {
|
|
20
|
+
* await bg.close();
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
class Bubblegum {
|
|
25
|
+
client;
|
|
26
|
+
sessionId;
|
|
27
|
+
constructor(client, sessionId) {
|
|
28
|
+
this.client = client;
|
|
29
|
+
this.sessionId = sessionId;
|
|
30
|
+
}
|
|
31
|
+
/** Spawn the bridge, handshake, and open a session (engine-owned by default). */
|
|
32
|
+
static async launch(opts = {}) {
|
|
33
|
+
const client = new client_js_1.BridgeClient(opts);
|
|
34
|
+
try {
|
|
35
|
+
await client.handshake();
|
|
36
|
+
if (opts.cdpEndpoint && !client.hasCapability("channel.web.cdp")) {
|
|
37
|
+
throw new errors_js_1.BridgeError(protocol_js_1.ErrorCodes.Unsupported, "this engine does not support CDP attach (channel.web.cdp); upgrade bubblegum-ai");
|
|
38
|
+
}
|
|
39
|
+
const { session_id } = await client.request("session.open", {
|
|
40
|
+
channel: opts.channel ?? "web",
|
|
41
|
+
url: opts.url,
|
|
42
|
+
headless: opts.headless ?? true,
|
|
43
|
+
dry_run: opts.dryRun ?? false,
|
|
44
|
+
appium_url: opts.appiumUrl,
|
|
45
|
+
capabilities: opts.capabilities,
|
|
46
|
+
cdp_endpoint: opts.cdpEndpoint,
|
|
47
|
+
page_index: opts.pageIndex,
|
|
48
|
+
});
|
|
49
|
+
return new Bubblegum(client, session_id);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
await client.close();
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Attach the engine to a browser your test already controls, over CDP
|
|
58
|
+
* (client-owned mode). Launch your Chromium with a remote-debugging port and
|
|
59
|
+
* pass its endpoint:
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* const browser = await chromium.launch({ args: ["--remote-debugging-port=9222"] });
|
|
63
|
+
* const bg = await Bubblegum.attach({ cdpEndpoint: "http://localhost:9222" });
|
|
64
|
+
* await bg.act("Click Login"); // drives the page your test opened
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
static attach(opts) {
|
|
68
|
+
return Bubblegum.launch({ ...opts, channel: "web" });
|
|
69
|
+
}
|
|
70
|
+
/** The bridge client (for advanced use / capability checks). */
|
|
71
|
+
get bridge() {
|
|
72
|
+
return this.client;
|
|
73
|
+
}
|
|
74
|
+
act(instruction, options) {
|
|
75
|
+
return this.client.request("act", {
|
|
76
|
+
session_id: this.sessionId,
|
|
77
|
+
instruction,
|
|
78
|
+
options,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Dry-run a list of steps against the *current* page and report whether each
|
|
83
|
+
* one resolves — without executing anything. Lets you validate a script (or a
|
|
84
|
+
* page's worth of steps) in one batch instead of discovering failures one run
|
|
85
|
+
* at a time.
|
|
86
|
+
*
|
|
87
|
+
* Because nothing executes, steps are all checked against the page as it is
|
|
88
|
+
* now (no navigation between them) — so call it once per page (e.g. after
|
|
89
|
+
* landing on each screen) with that screen's steps.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* const report = await bg.preflight([
|
|
93
|
+
* 'Select "Active" from the Participant status dropdown',
|
|
94
|
+
* 'Select "Change of mind" from the Reason dropdown',
|
|
95
|
+
* 'Click the Submit button',
|
|
96
|
+
* ]);
|
|
97
|
+
* console.table(report); // see status / confidence / resolver per step
|
|
98
|
+
* if (report.some(r => !r.ok)) throw new Error("preflight found unresolved steps");
|
|
99
|
+
*/
|
|
100
|
+
async preflight(steps, options) {
|
|
101
|
+
const out = [];
|
|
102
|
+
for (const step of steps) {
|
|
103
|
+
const instruction = typeof step === "string" ? step : step.instruction;
|
|
104
|
+
const perStep = typeof step === "string" ? undefined : step.options;
|
|
105
|
+
const r = await this.act(instruction, { ...options, ...perStep, dry_run: true });
|
|
106
|
+
out.push({
|
|
107
|
+
instruction,
|
|
108
|
+
status: r.status,
|
|
109
|
+
ok: r.status === "dry_run" || r.status === "passed" || r.status === "recovered",
|
|
110
|
+
confidence: r.confidence,
|
|
111
|
+
resolver: r.target?.resolver_name ?? null,
|
|
112
|
+
ref: r.target?.ref ?? null,
|
|
113
|
+
error: r.error?.message ?? null,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
verify(instruction, options) {
|
|
119
|
+
return this.client.request("verify", {
|
|
120
|
+
session_id: this.sessionId,
|
|
121
|
+
instruction,
|
|
122
|
+
options,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
extract(instruction, options) {
|
|
126
|
+
return this.client.request("extract", {
|
|
127
|
+
session_id: this.sessionId,
|
|
128
|
+
instruction,
|
|
129
|
+
options,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Click an element inside a table cell, addressed by column + row.
|
|
134
|
+
*
|
|
135
|
+
* The cell's clickable child (a link / button) is clicked when present — ideal
|
|
136
|
+
* when the visible text is dynamic (a UUID, a DB id) and so can't be named.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* await bg.clickInTable({ column: "PPHID", row: "first" });
|
|
140
|
+
* await bg.clickInTable({ column: "PPHID", rowMatch: { Name: dbName } });
|
|
141
|
+
*/
|
|
142
|
+
clickInTable(spec) {
|
|
143
|
+
const { column, row, rowMatch, timeoutMs } = spec;
|
|
144
|
+
const options = { action_type: "click", column };
|
|
145
|
+
if (rowMatch)
|
|
146
|
+
options.row_match = rowMatch;
|
|
147
|
+
else if (row !== undefined)
|
|
148
|
+
options.row = row;
|
|
149
|
+
if (timeoutMs !== undefined)
|
|
150
|
+
options.timeout_ms = timeoutMs;
|
|
151
|
+
return this.act(`click the ${column} cell`, options);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Click a link by its text (exact, then case-insensitive, then substring).
|
|
155
|
+
* Handy when the link label is a dynamic value pulled from a DB.
|
|
156
|
+
*/
|
|
157
|
+
clickLink(text, options) {
|
|
158
|
+
const opts = { action_type: "click", link_text: text };
|
|
159
|
+
if (options?.exact !== undefined)
|
|
160
|
+
opts.exact = options.exact;
|
|
161
|
+
if (options?.timeoutMs !== undefined)
|
|
162
|
+
opts.timeout_ms = options.timeoutMs;
|
|
163
|
+
return this.act(`click the link "${text}"`, opts);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Assert columns / cell values in a data table (Ant Design / native / ARIA).
|
|
167
|
+
*
|
|
168
|
+
* - `columns`: header names that must all be present.
|
|
169
|
+
* - `row`: column -> value used to locate the row(s) (e.g. a key from your DB).
|
|
170
|
+
* - `cell`: column -> expected value asserted in the matched row(s).
|
|
171
|
+
*
|
|
172
|
+
* At least one of `columns` / `cell` should be provided. Matching is
|
|
173
|
+
* whitespace-normalised, case-insensitive, and tolerates a value rendered
|
|
174
|
+
* inside a badge (expected is matched as a substring of the cell).
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* await bg.verifyTable({ columns: ["PPHID", "Account Status", "Profile Status"] });
|
|
178
|
+
* await bg.verifyTable({ row: { Name: dbName }, cell: { "Account Status": dbStatus } });
|
|
179
|
+
*/
|
|
180
|
+
verifyTable(spec) {
|
|
181
|
+
const { description, timeoutMs, ...rest } = spec;
|
|
182
|
+
const options = { assertion_type: "table", ...rest };
|
|
183
|
+
if (timeoutMs !== undefined)
|
|
184
|
+
options.timeout_ms = timeoutMs;
|
|
185
|
+
return this.verify(description ?? "table assertion", options);
|
|
186
|
+
}
|
|
187
|
+
recover(args) {
|
|
188
|
+
return this.client.request("recover", {
|
|
189
|
+
session_id: this.sessionId,
|
|
190
|
+
failed_selector: args.failedSelector,
|
|
191
|
+
intent: args.intent,
|
|
192
|
+
options: args.options,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
async isVisible(target) {
|
|
196
|
+
const r = await this.client.request("is_visible", {
|
|
197
|
+
session_id: this.sessionId,
|
|
198
|
+
target,
|
|
199
|
+
});
|
|
200
|
+
return r.value;
|
|
201
|
+
}
|
|
202
|
+
async isChecked(target) {
|
|
203
|
+
const r = await this.client.request("is_checked", {
|
|
204
|
+
session_id: this.sessionId,
|
|
205
|
+
target,
|
|
206
|
+
});
|
|
207
|
+
return r.value;
|
|
208
|
+
}
|
|
209
|
+
async selectedValue(target) {
|
|
210
|
+
const r = await this.client.request("selected_value", {
|
|
211
|
+
session_id: this.sessionId,
|
|
212
|
+
target,
|
|
213
|
+
});
|
|
214
|
+
return r.value;
|
|
215
|
+
}
|
|
216
|
+
async explain(instruction) {
|
|
217
|
+
const r = await this.client.request("explain", {
|
|
218
|
+
session_id: this.sessionId,
|
|
219
|
+
instruction,
|
|
220
|
+
});
|
|
221
|
+
return r.explanation;
|
|
222
|
+
}
|
|
223
|
+
summary() {
|
|
224
|
+
return this.client.request("summary", { session_id: this.sessionId });
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Write reports (Allure / HTML / JSON / JUnit) from every step this session
|
|
228
|
+
* ran, using the engine's own reporters — the same output the Python/pytest
|
|
229
|
+
* path produces. Call it once near the end of your run (e.g. in `finally`,
|
|
230
|
+
* before `close()`):
|
|
231
|
+
*
|
|
232
|
+
* ```ts
|
|
233
|
+
* await bg.report({ html: "reports/run.html", allure: "allure-results" });
|
|
234
|
+
* // -> { written: { html: "/abs/...", allure: "/abs/..." }, steps: 12 }
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
report(opts) {
|
|
238
|
+
if (!this.client.hasCapability("report.write")) {
|
|
239
|
+
throw new errors_js_1.BridgeError(protocol_js_1.ErrorCodes.Unsupported, "this engine does not support report generation (report.write); upgrade bubblegum-ai");
|
|
240
|
+
}
|
|
241
|
+
const resolve = (v, fallback) => v === true ? fallback : v || undefined;
|
|
242
|
+
const params = { session_id: this.sessionId };
|
|
243
|
+
const html = resolve(opts.html, "bubblegum_report.html");
|
|
244
|
+
const json = resolve(opts.json, "bubblegum_report.json");
|
|
245
|
+
const junit = resolve(opts.junit, "bubblegum_report.xml");
|
|
246
|
+
const allure = resolve(opts.allure, "allure-results");
|
|
247
|
+
const summary = resolve(opts.summary, "bubblegum-summary.html");
|
|
248
|
+
if (html)
|
|
249
|
+
params.html = html;
|
|
250
|
+
if (json)
|
|
251
|
+
params.json = json;
|
|
252
|
+
if (junit)
|
|
253
|
+
params.junit = junit;
|
|
254
|
+
if (allure)
|
|
255
|
+
params.allure = allure;
|
|
256
|
+
if (summary)
|
|
257
|
+
params.summary = summary;
|
|
258
|
+
if (opts.title)
|
|
259
|
+
params.title = opts.title;
|
|
260
|
+
if (opts.suiteName)
|
|
261
|
+
params.suite_name = opts.suiteName;
|
|
262
|
+
return this.client.request("report.write", params);
|
|
263
|
+
}
|
|
264
|
+
/** Close the engine session and tear down the bridge process. */
|
|
265
|
+
async close() {
|
|
266
|
+
try {
|
|
267
|
+
await this.client.request("session.close", { session_id: this.sessionId });
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
await this.client.close();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
exports.Bubblegum = Bubblegum;
|
|
275
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":";;;AAAA,2CAAgE;AAChE,2CAA0C;AAC1C,+CAA2C;AA+E3C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,SAAS;IAED;IACA;IAFnB,YACmB,MAAoB,EACpB,SAAiB;QADjB,WAAM,GAAN,MAAM,CAAc;QACpB,cAAS,GAAT,SAAS,CAAQ;IACjC,CAAC;IAEJ,iFAAiF;IACjF,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAsB,EAAE;QAC1C,MAAM,MAAM,GAAG,IAAI,wBAAY,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,MAAM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,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QAC7B,IAAI,IAAI;YAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QAC7B,IAAI,KAAK;YAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAChC,IAAI,MAAM;YAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACnC,IAAI,OAAO;YAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QACtC,IAAI,IAAI,CAAC,KAAK;YAAE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC1C,IAAI,IAAI,CAAC,SAAS;YAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;QAEvD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAe,cAAc,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;IAED,iEAAiE;IACjE,KAAK,CAAC,KAAK;QACT,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QAC7E,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAtQD,8BAsQC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript mirror of the engine's result schemas (`bubblegum/core/schemas.py`).
|
|
3
|
+
*
|
|
4
|
+
* Kept intentionally close to the Pydantic models. `[key: string]: unknown`
|
|
5
|
+
* index signatures let newer engine fields flow through without breaking the
|
|
6
|
+
* client (additive-first), while the named fields stay strongly typed.
|
|
7
|
+
*/
|
|
8
|
+
export type StepStatus = "passed" | "failed" | "recovered" | "dry_run" | "skipped";
|
|
9
|
+
export interface ResolvedTarget {
|
|
10
|
+
ref: string;
|
|
11
|
+
confidence: number;
|
|
12
|
+
resolver_name: string;
|
|
13
|
+
metadata?: Record<string, unknown>;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface ErrorInfo {
|
|
17
|
+
error_type: string;
|
|
18
|
+
message: string;
|
|
19
|
+
resolver_name?: string | null;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface StepResult {
|
|
23
|
+
status: StepStatus;
|
|
24
|
+
action: string;
|
|
25
|
+
target: ResolvedTarget | null;
|
|
26
|
+
confidence: number;
|
|
27
|
+
duration_ms: number;
|
|
28
|
+
error?: ErrorInfo | null;
|
|
29
|
+
traces?: unknown[];
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
export interface SessionSummary {
|
|
33
|
+
total: number;
|
|
34
|
+
passed: number;
|
|
35
|
+
failed: number;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
/** Per-call options forwarded verbatim to the engine SDK (timeout_ms, selector, …). */
|
|
39
|
+
export type StepOptions = Record<string, unknown>;
|
|
40
|
+
/**
|
|
41
|
+
* Which reports to write from the session's accumulated step results.
|
|
42
|
+
*
|
|
43
|
+
* Each field is either an output path, or `true` to use the default name
|
|
44
|
+
* (`bubblegum_report.html` / `.json` / `.xml`, and `allure-results/` for
|
|
45
|
+
* Allure). Omit a field to skip that format. Paths are resolved relative to the
|
|
46
|
+
* engine process's working directory.
|
|
47
|
+
*/
|
|
48
|
+
export interface ReportOptions {
|
|
49
|
+
/** Single-file HTML report. */
|
|
50
|
+
html?: string | boolean;
|
|
51
|
+
/** Machine-readable JSON report. */
|
|
52
|
+
json?: string | boolean;
|
|
53
|
+
/** JUnit XML (for CI test-report ingestion). */
|
|
54
|
+
junit?: string | boolean;
|
|
55
|
+
/** Allure 2 results *directory* (view with `allure serve <dir>`). */
|
|
56
|
+
allure?: string | boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Cross-run suite summary HTML. Each test run upserts itself (keyed by
|
|
59
|
+
* `suiteName`) into a sibling `*.json` manifest, so several independently-run
|
|
60
|
+
* tests aggregate into one overview (per-test pass/fail + grand totals)
|
|
61
|
+
* instead of overwriting each other. Pass a distinct `suiteName` per test.
|
|
62
|
+
*/
|
|
63
|
+
summary?: string | boolean;
|
|
64
|
+
/** Report title (HTML/JSON). */
|
|
65
|
+
title?: string;
|
|
66
|
+
/** Suite / test name (Allure/JUnit, and the summary manifest key). */
|
|
67
|
+
suiteName?: string;
|
|
68
|
+
}
|
|
69
|
+
/** Result of {@link Bubblegum.report}: resolved paths written, and step count. */
|
|
70
|
+
export interface ReportResult {
|
|
71
|
+
/** Format → resolved absolute path (or directory, for Allure). */
|
|
72
|
+
written: Record<string, string>;
|
|
73
|
+
/** Number of steps included in the report. */
|
|
74
|
+
steps: number;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnF,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,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of the engine's result schemas (`bubblegum/core/schemas.py`).
|
|
4
|
+
*
|
|
5
|
+
* Kept intentionally close to the Pydantic models. `[key: string]: unknown`
|
|
6
|
+
* index signatures let newer engine fields flow through without breaking the
|
|
7
|
+
* client (additive-first), while the named fields stay strongly typed.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Handshake } from "./protocol.js";
|
|
2
|
+
/**
|
|
3
|
+
* A line-oriented duplex link to the bridge. The default implementation spawns
|
|
4
|
+
* the Python `bubblegum bridge` process, but it is an interface so tests (and
|
|
5
|
+
* future transports — e.g. a long-lived daemon socket) can inject their own.
|
|
6
|
+
*/
|
|
7
|
+
export interface Transport {
|
|
8
|
+
/** Write one newline-delimited JSON-RPC message. */
|
|
9
|
+
send(line: string): void;
|
|
10
|
+
/** Register the handler for each inbound line. */
|
|
11
|
+
onLine(cb: (line: string) => void): void;
|
|
12
|
+
/** Register the handler invoked when the link closes (optionally with an error). */
|
|
13
|
+
onClose(cb: (err?: Error) => void): void;
|
|
14
|
+
/** Tear the link down. */
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface SpawnOptions {
|
|
18
|
+
/** Executable to launch (default: `python`). */
|
|
19
|
+
command?: string;
|
|
20
|
+
/** Args (default: `["-m", "bubblegum.bridge"]`). */
|
|
21
|
+
args?: string[];
|
|
22
|
+
cwd?: string;
|
|
23
|
+
env?: NodeJS.ProcessEnv;
|
|
24
|
+
}
|
|
25
|
+
/** Spawn the Python bridge as a child process and frame JSON-RPC over its stdio. */
|
|
26
|
+
export declare function spawnBridgeTransport(opts?: SpawnOptions): Transport;
|
|
27
|
+
export interface BridgeClientOptions {
|
|
28
|
+
/** Inject a transport (tests/daemon). When omitted, a Python bridge is spawned. */
|
|
29
|
+
transport?: Transport;
|
|
30
|
+
/** Spawn options for the default transport. Ignored when `transport` is given. */
|
|
31
|
+
spawn?: SpawnOptions;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Low-level JSON-RPC client over a {@link Transport}: assigns request ids,
|
|
35
|
+
* correlates responses, surfaces engine errors as {@link BridgeError}, and
|
|
36
|
+
* negotiates the protocol version via {@link BridgeClient.handshake}.
|
|
37
|
+
*/
|
|
38
|
+
export declare class BridgeClient {
|
|
39
|
+
private readonly transport;
|
|
40
|
+
private readonly pending;
|
|
41
|
+
private nextId;
|
|
42
|
+
private closed;
|
|
43
|
+
/** Populated after a successful {@link handshake}. */
|
|
44
|
+
handshakeInfo?: Handshake;
|
|
45
|
+
constructor(opts?: BridgeClientOptions);
|
|
46
|
+
private onLine;
|
|
47
|
+
private onClose;
|
|
48
|
+
/** Issue a request and resolve with its `result` (or reject with a {@link BridgeError}). */
|
|
49
|
+
request<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;
|
|
50
|
+
/** Negotiate with the engine; throws if its protocol version is unsupported. */
|
|
51
|
+
handshake(): Promise<Handshake>;
|
|
52
|
+
/** True if the engine advertised the given capability in its handshake. */
|
|
53
|
+
hasCapability(name: string): boolean;
|
|
54
|
+
close(): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,SAAS,EAIV,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kDAAkD;IAClD,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM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MAAM,EAAE,MAAM,EAAE,CAAC;QAChE,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAA+B,EAAE,MAAM,EAAE,CAAC,CAAC;YAC3E,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gFAAgF;IAChF,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAY,WAAW,CAAC,CAAC;QACxD,IAAI,CAAE,2BAAiD,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACxF,MAAM,IAAI,WAAW,CACnB,UAAU,CAAC,WAAW,EACtB,oBAAoB,IAAI,CAAC,gBAAgB,mCAAmC;gBAC1E,cAAc,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC,CACvF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2EAA2E;IAC3E,aAAa,CAAC,IAAY;QACxB,OAAO,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** An error returned by the bridge (a JSON-RPC error response) or a transport failure. */
|
|
2
|
+
export declare class BridgeError extends Error {
|
|
3
|
+
readonly code: number;
|
|
4
|
+
readonly data?: unknown;
|
|
5
|
+
constructor(code: number, message: string, data?: unknown);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;gBAEZ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAM1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAS;IACb,IAAI,CAAW;IAExB,YAAY,IAAY,EAAE,OAAe,EAAE,IAAc;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @bubblegum-ai/node — Node/TypeScript client for the Bubblegum engine.
|
|
3
|
+
*
|
|
4
|
+
* Drives AI-powered, natural-language Playwright/Appium test steps from JS/TS by
|
|
5
|
+
* spawning the Python `bubblegum bridge` and speaking its JSON-RPC protocol. The
|
|
6
|
+
* Python engine stays the single source of truth for grounding; this package is
|
|
7
|
+
* a thin, typed proxy. See ../../docs/distribution-npm-and-pypi.md.
|
|
8
|
+
*/
|
|
9
|
+
export { Bubblegum } from "./session.js";
|
|
10
|
+
export type { Channel, LaunchOptions, AttachOptions, RecoverArgs } from "./session.js";
|
|
11
|
+
export { BridgeClient, spawnBridgeTransport } from "./client.js";
|
|
12
|
+
export type { Transport, SpawnOptions, BridgeClientOptions } from "./client.js";
|
|
13
|
+
export { BridgeError } from "./errors.js";
|
|
14
|
+
export { PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, ErrorCodes, } from "./protocol.js";
|
|
15
|
+
export type { Handshake, JsonRpcResponse } from "./protocol.js";
|
|
16
|
+
export type { StepResult, StepStatus, ResolvedTarget, ErrorInfo, SessionSummary, StepOptions, ReportOptions, ReportResult, } from "./types.js";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhE,YAAY,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,UAAU,GACX,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire protocol for the Bubblegum bridge — the TypeScript mirror of
|
|
3
|
+
* `bubblegum/bridge/protocol.py`. Keep these in lockstep with the Python side.
|
|
4
|
+
*
|
|
5
|
+
* The client negotiates against the engine via `handshake`: it feature-detects
|
|
6
|
+
* on `capabilities` and refuses to run against a `protocol_version` it does not
|
|
7
|
+
* support, so a newer engine can keep serving an older client (additive-first).
|
|
8
|
+
*/
|
|
9
|
+
/** Protocol versions this client speaks. v1 = the 0.1.0 bridge slice. */
|
|
10
|
+
export declare const SUPPORTED_PROTOCOL_VERSIONS: readonly [1];
|
|
11
|
+
/** The latest protocol version this client was written against. */
|
|
12
|
+
export declare const PROTOCOL_VERSION = 1;
|
|
13
|
+
/** JSON-RPC 2.0 + bridge error codes (mirror of the Python side). */
|
|
14
|
+
export declare const ErrorCodes: {
|
|
15
|
+
readonly ParseError: -32700;
|
|
16
|
+
readonly InvalidRequest: -32600;
|
|
17
|
+
readonly MethodNotFound: -32601;
|
|
18
|
+
readonly InvalidParams: -32602;
|
|
19
|
+
readonly InternalError: -32603;
|
|
20
|
+
readonly SessionNotFound: -32001;
|
|
21
|
+
readonly EngineError: -32002;
|
|
22
|
+
readonly Unsupported: -32003;
|
|
23
|
+
};
|
|
24
|
+
export type JsonRpcId = number | string | null;
|
|
25
|
+
export interface JsonRpcRequest {
|
|
26
|
+
jsonrpc: "2.0";
|
|
27
|
+
id?: JsonRpcId;
|
|
28
|
+
method: string;
|
|
29
|
+
params?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface JsonRpcSuccess {
|
|
32
|
+
jsonrpc: "2.0";
|
|
33
|
+
id: JsonRpcId;
|
|
34
|
+
result: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface JsonRpcErrorResponse {
|
|
37
|
+
jsonrpc: "2.0";
|
|
38
|
+
id: JsonRpcId;
|
|
39
|
+
error: {
|
|
40
|
+
code: number;
|
|
41
|
+
message: string;
|
|
42
|
+
data?: unknown;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export type JsonRpcResponse = JsonRpcSuccess | JsonRpcErrorResponse;
|
|
46
|
+
export declare function isErrorResponse(msg: JsonRpcResponse): msg is JsonRpcErrorResponse;
|
|
47
|
+
/** Result of the `handshake` method. */
|
|
48
|
+
export interface Handshake {
|
|
49
|
+
engine_version: string;
|
|
50
|
+
protocol_version: number;
|
|
51
|
+
capabilities: string[];
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,cAAe,CAAC;AAExD,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,qEAAqE;AACrE,eAAO,MAAM,UAAU;;;;;;;;;CASb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,SAAS,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACn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