@ohos-perf/core 0.20.0 → 0.22.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/dist/index.d.ts +518 -97
- package/dist/index.js +840 -267
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5980,7 +5980,7 @@ function parseStep(value, path, seen) {
|
|
|
5980
5980
|
if (seen.has(id)) throw stepError(idPath, `duplicate step id ${JSON.stringify(id)}`);
|
|
5981
5981
|
seen.add(id);
|
|
5982
5982
|
const name = step.name === void 0 ? id : requiredString(step.name, `${path}.name`, stepError);
|
|
5983
|
-
const expect = step.expect === void 0 ? void 0 :
|
|
5983
|
+
const expect = step.expect === void 0 ? void 0 : parseExpectation(step.expect, `${path}.expect`);
|
|
5984
5984
|
return {
|
|
5985
5985
|
id,
|
|
5986
5986
|
name,
|
|
@@ -5991,7 +5991,7 @@ function parseStep(value, path, seen) {
|
|
|
5991
5991
|
...expect === void 0 ? {} : { expect }
|
|
5992
5992
|
};
|
|
5993
5993
|
}
|
|
5994
|
-
function
|
|
5994
|
+
function parseExpectation(value, path) {
|
|
5995
5995
|
const block = fields(value, path, ["present", "absent", "foreground"], stepError);
|
|
5996
5996
|
let present;
|
|
5997
5997
|
if (block.present !== void 0) {
|
|
@@ -6179,8 +6179,8 @@ var PARITY_ROWS = [
|
|
|
6179
6179
|
{
|
|
6180
6180
|
row: 5,
|
|
6181
6181
|
name: "LLM GUI agent (`gui-agent`)",
|
|
6182
|
-
status: "
|
|
6183
|
-
reason: "
|
|
6182
|
+
status: "ported",
|
|
6183
|
+
reason: ""
|
|
6184
6184
|
},
|
|
6185
6185
|
{
|
|
6186
6186
|
row: 6,
|
|
@@ -6322,8 +6322,8 @@ var PARITY_ROWS = [
|
|
|
6322
6322
|
{
|
|
6323
6323
|
row: 28,
|
|
6324
6324
|
name: "Symbol recovery",
|
|
6325
|
-
status: "
|
|
6326
|
-
reason: "
|
|
6325
|
+
status: "ported",
|
|
6326
|
+
reason: ""
|
|
6327
6327
|
},
|
|
6328
6328
|
{
|
|
6329
6329
|
row: 29,
|
|
@@ -8081,10 +8081,10 @@ function shuffled(items, seed) {
|
|
|
8081
8081
|
const out = [...items];
|
|
8082
8082
|
const next = mulberry32(seed);
|
|
8083
8083
|
for (let index = out.length - 1; index > 0; index -= 1) {
|
|
8084
|
-
const
|
|
8084
|
+
const pick2 = Math.floor(next() * (index + 1));
|
|
8085
8085
|
const held = out[index];
|
|
8086
|
-
out[index] = out[
|
|
8087
|
-
out[
|
|
8086
|
+
out[index] = out[pick2];
|
|
8087
|
+
out[pick2] = held;
|
|
8088
8088
|
}
|
|
8089
8089
|
return out;
|
|
8090
8090
|
}
|
|
@@ -8301,7 +8301,7 @@ async function resolveAppVersion(device, app) {
|
|
|
8301
8301
|
return void 0;
|
|
8302
8302
|
}
|
|
8303
8303
|
}
|
|
8304
|
-
function
|
|
8304
|
+
function evaluateExpectation(expect, nodes, app) {
|
|
8305
8305
|
const outcomes = [];
|
|
8306
8306
|
for (const clause of expect.present ?? []) {
|
|
8307
8307
|
const matched = matchSelector(nodes, clause.selector);
|
|
@@ -8479,7 +8479,7 @@ var ScenarioRunner = class {
|
|
|
8479
8479
|
);
|
|
8480
8480
|
}
|
|
8481
8481
|
const nodes = await this.device.uiTree();
|
|
8482
|
-
expectations =
|
|
8482
|
+
expectations = evaluateExpectation(step.expect, nodes, scenario.app);
|
|
8483
8483
|
failure ??= failureOf(expectations);
|
|
8484
8484
|
} catch (err) {
|
|
8485
8485
|
failure ??= `expectation could not be evaluated: ${message2(err)}`;
|
|
@@ -8543,32 +8543,807 @@ var ScenarioRunner = class {
|
|
|
8543
8543
|
};
|
|
8544
8544
|
}
|
|
8545
8545
|
}
|
|
8546
|
-
};
|
|
8547
|
-
function testInfoOf(result) {
|
|
8546
|
+
};
|
|
8547
|
+
function testInfoOf(result) {
|
|
8548
|
+
return {
|
|
8549
|
+
version: 1,
|
|
8550
|
+
scenario: result.scenario,
|
|
8551
|
+
app: {
|
|
8552
|
+
packageName: result.app,
|
|
8553
|
+
...result.appVersion === void 0 ? {} : { version: result.appVersion }
|
|
8554
|
+
},
|
|
8555
|
+
device: result.device,
|
|
8556
|
+
startedAtMs: result.startedAtMs,
|
|
8557
|
+
durationMs: result.durationMs,
|
|
8558
|
+
rounds: result.rounds,
|
|
8559
|
+
steps: result.steps.length,
|
|
8560
|
+
status: result.status
|
|
8561
|
+
};
|
|
8562
|
+
}
|
|
8563
|
+
function writeRunFiles(outDir, result) {
|
|
8564
|
+
mkdirSync9(outDir, { recursive: true });
|
|
8565
|
+
const write = (name, value) => {
|
|
8566
|
+
writeFileSync8(join9(outDir, name), `${JSON.stringify(value, null, 2)}
|
|
8567
|
+
`);
|
|
8568
|
+
};
|
|
8569
|
+
write("testInfo.json", testInfoOf(result));
|
|
8570
|
+
write("steps.json", { version: 1, steps: result.steps });
|
|
8571
|
+
write("pids.json", result.pids);
|
|
8572
|
+
}
|
|
8573
|
+
|
|
8574
|
+
// src/scenario/agent.ts
|
|
8575
|
+
var IRREVERSIBLE_PATTERNS = [
|
|
8576
|
+
{
|
|
8577
|
+
pattern: /\bpay\b|\bpay now\b|立即支付|确认支付|去支付|立即购买/i,
|
|
8578
|
+
why: "payment is irreversible",
|
|
8579
|
+
sample: "\u7ACB\u5373\u652F\u4ED8"
|
|
8580
|
+
},
|
|
8581
|
+
{
|
|
8582
|
+
pattern: /\b(?:confirm order|place order|submit order|buy now)\b|提交订单|确认下单/i,
|
|
8583
|
+
why: "placing an order is irreversible",
|
|
8584
|
+
sample: "Confirm order"
|
|
8585
|
+
},
|
|
8586
|
+
{
|
|
8587
|
+
pattern: /\btransfer\b|\bsend money\b|\bremit\b|转账/i,
|
|
8588
|
+
why: "a transfer moves money and cannot be undone",
|
|
8589
|
+
sample: "Transfer"
|
|
8590
|
+
},
|
|
8591
|
+
{
|
|
8592
|
+
pattern: /\b(?:log ?in|sign ?in|register|sign ?up)\b|登录|注册/i,
|
|
8593
|
+
why: "signing in changes the account state",
|
|
8594
|
+
sample: "Log in"
|
|
8595
|
+
},
|
|
8596
|
+
{
|
|
8597
|
+
pattern: /\b(?:delete|unsubscribe|publish|post|share)\b|删除|注销|发布/i,
|
|
8598
|
+
why: "the action destroys or publishes content",
|
|
8599
|
+
sample: "Delete"
|
|
8600
|
+
}
|
|
8601
|
+
];
|
|
8602
|
+
function labelsOf(node) {
|
|
8603
|
+
const labels = [node.text.trim(), node.id.replace(/[_-]+/g, " ").trim()];
|
|
8604
|
+
return labels.filter((label2) => label2 !== "");
|
|
8605
|
+
}
|
|
8606
|
+
function irreversibleReason(node) {
|
|
8607
|
+
for (const label2 of labelsOf(node)) {
|
|
8608
|
+
for (const entry of IRREVERSIBLE_PATTERNS) {
|
|
8609
|
+
if (entry.pattern.test(label2)) return entry.why;
|
|
8610
|
+
}
|
|
8611
|
+
}
|
|
8612
|
+
return void 0;
|
|
8613
|
+
}
|
|
8614
|
+
function describeDecision(decision) {
|
|
8615
|
+
if ("done" in decision) return "done";
|
|
8616
|
+
const action = decision.action;
|
|
8617
|
+
switch (action.action) {
|
|
8618
|
+
case "click":
|
|
8619
|
+
return `click at (${action.x}, ${action.y})`;
|
|
8620
|
+
case "swipe":
|
|
8621
|
+
return `swipe (${action.fromX}, ${action.fromY}) to (${action.toX}, ${action.toY})`;
|
|
8622
|
+
case "key":
|
|
8623
|
+
return `key ${String(action.key)}`;
|
|
8624
|
+
case "inputText":
|
|
8625
|
+
return `type ${JSON.stringify(action.text)} at (${action.x}, ${action.y})`;
|
|
8626
|
+
case "text":
|
|
8627
|
+
return `type ${JSON.stringify(action.text)}`;
|
|
8628
|
+
}
|
|
8629
|
+
}
|
|
8630
|
+
function oneLine(text) {
|
|
8631
|
+
return text.replace(/\r?\n/g, "\\n").replace(/\t/g, "\\t");
|
|
8632
|
+
}
|
|
8633
|
+
function renderTree(tree) {
|
|
8634
|
+
if (tree.length === 0) {
|
|
8635
|
+
return "(the screen is empty: no nodes were dumped)";
|
|
8636
|
+
}
|
|
8637
|
+
return tree.map((node) => {
|
|
8638
|
+
const parts = [
|
|
8639
|
+
`${" ".repeat(Math.max(0, node.depth - 1))}${node.type}`,
|
|
8640
|
+
node.text.trim() === "" ? "" : JSON.stringify(oneLine(node.text)),
|
|
8641
|
+
node.id === "" ? "" : `id=${node.id}`,
|
|
8642
|
+
node.bounds,
|
|
8643
|
+
node.clickable ? "clickable" : "unclickable"
|
|
8644
|
+
];
|
|
8645
|
+
if (!node.enabled) parts.push("disabled");
|
|
8646
|
+
if (node.scrollable) parts.push("scrollable");
|
|
8647
|
+
return parts.filter((part) => part !== "").join(" ");
|
|
8648
|
+
}).join("\n");
|
|
8649
|
+
}
|
|
8650
|
+
function badInput(message3) {
|
|
8651
|
+
return new OhosPerfError(message3, { code: "SCENARIO_BAD_INPUT" });
|
|
8652
|
+
}
|
|
8653
|
+
function assertOptions(options) {
|
|
8654
|
+
if (options.task.trim() === "") {
|
|
8655
|
+
throw badInput("agent task must not be empty");
|
|
8656
|
+
}
|
|
8657
|
+
if (!Number.isSafeInteger(options.maxSteps) || options.maxSteps < 1) {
|
|
8658
|
+
throw badInput(
|
|
8659
|
+
`agent maxSteps must be a positive integer (got ${String(options.maxSteps)})`
|
|
8660
|
+
);
|
|
8661
|
+
}
|
|
8662
|
+
}
|
|
8663
|
+
function assertDecision(decision, step) {
|
|
8664
|
+
if (typeof decision !== "object" || decision === null) {
|
|
8665
|
+
throw badInput(`agent step ${step}: the model returned no decision`);
|
|
8666
|
+
}
|
|
8667
|
+
const record = decision;
|
|
8668
|
+
const hasAction = record["action"] !== void 0;
|
|
8669
|
+
const hasDone = record["done"] === true;
|
|
8670
|
+
if (hasAction === hasDone) {
|
|
8671
|
+
throw badInput(
|
|
8672
|
+
`agent step ${step}: the model must answer with exactly one of an action or done`
|
|
8673
|
+
);
|
|
8674
|
+
}
|
|
8675
|
+
return decision;
|
|
8676
|
+
}
|
|
8677
|
+
function agentPrompt(request) {
|
|
8678
|
+
const history = request.history.length === 0 ? "(no steps yet)" : request.history.map((entry) => {
|
|
8679
|
+
const did = entry.did === void 0 ? entry.status : `${entry.did} \u2014 ${entry.status}`;
|
|
8680
|
+
const detail11 = entry.detail === void 0 ? "" : ` (${entry.detail})`;
|
|
8681
|
+
return ` ${entry.step + 1}. ${did}: ${entry.reason}${detail11}`;
|
|
8682
|
+
}).join("\n");
|
|
8683
|
+
return [
|
|
8684
|
+
`You are driving the app ${request.app} on an OHOS device to complete a task.`,
|
|
8685
|
+
`Task: ${request.task}`,
|
|
8686
|
+
"",
|
|
8687
|
+
`Step ${request.step + 1} of ${request.maxSteps}.`,
|
|
8688
|
+
"",
|
|
8689
|
+
"The current screen, one node per line:",
|
|
8690
|
+
request.screen,
|
|
8691
|
+
"",
|
|
8692
|
+
"Steps so far:",
|
|
8693
|
+
history,
|
|
8694
|
+
"",
|
|
8695
|
+
"Answer with one JSON object and nothing else. To act:",
|
|
8696
|
+
' {"action": {"action": "click", "x": 540, "y": 1170}, "reason": "why"}',
|
|
8697
|
+
"Allowed gestures: click, swipe, key, inputText, text.",
|
|
8698
|
+
"To finish, include the expectation that proves the task is done:",
|
|
8699
|
+
' {"done": true, "reason": "why", "expect": {"present": [{"selector": {"kind": "text", "text": "Done"}}]}}',
|
|
8700
|
+
"A done answer without an expectation is recorded as unverified, not as success.",
|
|
8701
|
+
"Do not tap payment, ordering, transfer, sign-in, delete or publish actions."
|
|
8702
|
+
].join("\n");
|
|
8703
|
+
}
|
|
8704
|
+
var GESTURE_NAMES = /* @__PURE__ */ new Set(["click", "swipe", "key", "inputText", "text"]);
|
|
8705
|
+
function parseGesture(value) {
|
|
8706
|
+
if (typeof value !== "object" || value === null) {
|
|
8707
|
+
throw badInput(`the answer's "action" must be a gesture object`);
|
|
8708
|
+
}
|
|
8709
|
+
const record = value;
|
|
8710
|
+
const name = record["action"];
|
|
8711
|
+
if (typeof name !== "string" || !GESTURE_NAMES.has(name)) {
|
|
8712
|
+
throw badInput(
|
|
8713
|
+
`the answer's gesture must be one of ${[...GESTURE_NAMES].join(", ")} (got ${JSON.stringify(name)})`
|
|
8714
|
+
);
|
|
8715
|
+
}
|
|
8716
|
+
return value;
|
|
8717
|
+
}
|
|
8718
|
+
function unfence(text) {
|
|
8719
|
+
const match = /^\s*```(?:json)?\s*\n([\s\S]*?)\n\s*```\s*$/.exec(text);
|
|
8720
|
+
return match === null ? text : match[1];
|
|
8721
|
+
}
|
|
8722
|
+
function parseDecision(text) {
|
|
8723
|
+
let parsed;
|
|
8724
|
+
try {
|
|
8725
|
+
parsed = JSON.parse(unfence(text));
|
|
8726
|
+
} catch {
|
|
8727
|
+
throw badInput(
|
|
8728
|
+
`the model's answer is not JSON: ${JSON.stringify(text.slice(0, 120))}`
|
|
8729
|
+
);
|
|
8730
|
+
}
|
|
8731
|
+
const decision = assertDecision(parsed, 0);
|
|
8732
|
+
const record = parsed;
|
|
8733
|
+
const reason = typeof record["reason"] === "string" ? record["reason"] : "";
|
|
8734
|
+
if ("done" in decision) {
|
|
8735
|
+
const expect = record["expect"] === void 0 ? void 0 : parseExpectation(record["expect"], "expect");
|
|
8736
|
+
return { done: true, reason, ...expect === void 0 ? {} : { expect } };
|
|
8737
|
+
}
|
|
8738
|
+
return { action: parseGesture(record["action"]), reason };
|
|
8739
|
+
}
|
|
8740
|
+
function targetOf(tree, x, y) {
|
|
8741
|
+
const containing = tree.filter((node) => {
|
|
8742
|
+
const rect = node.boundsRect ?? parseBounds(node.bounds);
|
|
8743
|
+
if (rect === void 0) return false;
|
|
8744
|
+
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
|
8745
|
+
});
|
|
8746
|
+
const area = (node) => {
|
|
8747
|
+
const rect = node.boundsRect ?? parseBounds(node.bounds);
|
|
8748
|
+
return (rect.right - rect.left) * (rect.bottom - rect.top);
|
|
8749
|
+
};
|
|
8750
|
+
return containing.slice().sort((a, b) => Number(b.clickable) - Number(a.clickable) || area(a) - area(b))[0];
|
|
8751
|
+
}
|
|
8752
|
+
function unmetExpectation(expect, tree, app) {
|
|
8753
|
+
const outcomes = evaluateExpectation(expect, tree, app);
|
|
8754
|
+
const failed = outcomes.filter((outcome) => !outcome.ok);
|
|
8755
|
+
if (failed.length === 0) return void 0;
|
|
8756
|
+
return failed.map((outcome) => outcome.detail === void 0 ? outcome.label : `${outcome.label}: ${outcome.detail}`).join("; ");
|
|
8757
|
+
}
|
|
8758
|
+
async function runAgent(device, model, options) {
|
|
8759
|
+
assertOptions(options);
|
|
8760
|
+
const steps = [];
|
|
8761
|
+
const history = [];
|
|
8762
|
+
const states = /* @__PURE__ */ new Set();
|
|
8763
|
+
let status = "exhausted";
|
|
8764
|
+
for (let index = 0; index < options.maxSteps; index += 1) {
|
|
8765
|
+
const tree = await device.uiTree();
|
|
8766
|
+
const before = hashTree(tree);
|
|
8767
|
+
states.add(before);
|
|
8768
|
+
const decision = assertDecision(
|
|
8769
|
+
await model.decide({
|
|
8770
|
+
task: options.task,
|
|
8771
|
+
app: options.app,
|
|
8772
|
+
step: index,
|
|
8773
|
+
maxSteps: options.maxSteps,
|
|
8774
|
+
screen: renderTree(tree),
|
|
8775
|
+
history: [...history]
|
|
8776
|
+
}),
|
|
8777
|
+
index
|
|
8778
|
+
);
|
|
8779
|
+
if ("done" in decision) {
|
|
8780
|
+
if (decision.expect === void 0) {
|
|
8781
|
+
status = "unverified";
|
|
8782
|
+
steps.push({
|
|
8783
|
+
index,
|
|
8784
|
+
status: "unverified",
|
|
8785
|
+
reason: decision.reason,
|
|
8786
|
+
detail: "the model claimed done with no expectation, so the screen proves nothing",
|
|
8787
|
+
before,
|
|
8788
|
+
after: before,
|
|
8789
|
+
navigated: false
|
|
8790
|
+
});
|
|
8791
|
+
break;
|
|
8792
|
+
}
|
|
8793
|
+
const unmet = unmetExpectation(decision.expect, tree, options.app);
|
|
8794
|
+
if (unmet === void 0) {
|
|
8795
|
+
status = "completed";
|
|
8796
|
+
steps.push({
|
|
8797
|
+
index,
|
|
8798
|
+
status: "verified",
|
|
8799
|
+
reason: decision.reason,
|
|
8800
|
+
before,
|
|
8801
|
+
after: before,
|
|
8802
|
+
navigated: false
|
|
8803
|
+
});
|
|
8804
|
+
break;
|
|
8805
|
+
}
|
|
8806
|
+
status = "unverified";
|
|
8807
|
+
steps.push({
|
|
8808
|
+
index,
|
|
8809
|
+
status: "unverified",
|
|
8810
|
+
reason: decision.reason,
|
|
8811
|
+
detail: unmet,
|
|
8812
|
+
before,
|
|
8813
|
+
after: before,
|
|
8814
|
+
navigated: false
|
|
8815
|
+
});
|
|
8816
|
+
break;
|
|
8817
|
+
}
|
|
8818
|
+
const gesture = decision.action;
|
|
8819
|
+
const point = gesture.action === "click" || gesture.action === "inputText" ? { x: gesture.x, y: gesture.y } : void 0;
|
|
8820
|
+
const target = point === void 0 ? void 0 : targetOf(tree, point.x, point.y);
|
|
8821
|
+
const refused = target === void 0 ? void 0 : irreversibleReason(target);
|
|
8822
|
+
if (refused !== void 0 && options.allowIrreversible !== true) {
|
|
8823
|
+
status = "refused";
|
|
8824
|
+
steps.push({
|
|
8825
|
+
index,
|
|
8826
|
+
status: "refused",
|
|
8827
|
+
reason: decision.reason,
|
|
8828
|
+
action: gesture,
|
|
8829
|
+
detail: refused,
|
|
8830
|
+
before,
|
|
8831
|
+
after: before,
|
|
8832
|
+
navigated: false
|
|
8833
|
+
});
|
|
8834
|
+
break;
|
|
8835
|
+
}
|
|
8836
|
+
let failure;
|
|
8837
|
+
try {
|
|
8838
|
+
await device.gesture(gesture);
|
|
8839
|
+
} catch (err) {
|
|
8840
|
+
failure = err.message;
|
|
8841
|
+
}
|
|
8842
|
+
const nextTree = await device.uiTree();
|
|
8843
|
+
const after = hashTree(nextTree);
|
|
8844
|
+
states.add(after);
|
|
8845
|
+
const step = {
|
|
8846
|
+
index,
|
|
8847
|
+
status: failure === void 0 ? "acted" : "failed",
|
|
8848
|
+
reason: decision.reason,
|
|
8849
|
+
action: gesture,
|
|
8850
|
+
...failure === void 0 ? {} : { detail: failure },
|
|
8851
|
+
before,
|
|
8852
|
+
after,
|
|
8853
|
+
navigated: after !== before
|
|
8854
|
+
};
|
|
8855
|
+
steps.push(step);
|
|
8856
|
+
history.push({
|
|
8857
|
+
step: index,
|
|
8858
|
+
status: step.status,
|
|
8859
|
+
reason: decision.reason,
|
|
8860
|
+
did: describeDecision(decision),
|
|
8861
|
+
...failure === void 0 ? {} : { detail: failure }
|
|
8862
|
+
});
|
|
8863
|
+
}
|
|
8864
|
+
return {
|
|
8865
|
+
version: 1,
|
|
8866
|
+
task: options.task,
|
|
8867
|
+
app: options.app,
|
|
8868
|
+
steps,
|
|
8869
|
+
status,
|
|
8870
|
+
statesReached: states.size
|
|
8871
|
+
};
|
|
8872
|
+
}
|
|
8873
|
+
async function replayAgent(device, transcript) {
|
|
8874
|
+
let performed = 0;
|
|
8875
|
+
let skipped = 0;
|
|
8876
|
+
for (const step of transcript.steps) {
|
|
8877
|
+
if (step.action === void 0) {
|
|
8878
|
+
skipped += 1;
|
|
8879
|
+
continue;
|
|
8880
|
+
}
|
|
8881
|
+
const tree = await device.uiTree();
|
|
8882
|
+
if (hashTree(tree) !== step.before) {
|
|
8883
|
+
return { performed, skipped, divergedAt: step.index };
|
|
8884
|
+
}
|
|
8885
|
+
await device.gesture(step.action);
|
|
8886
|
+
performed += 1;
|
|
8887
|
+
}
|
|
8888
|
+
return { performed, skipped };
|
|
8889
|
+
}
|
|
8890
|
+
|
|
8891
|
+
// src/hap/elf.ts
|
|
8892
|
+
var EM_AARCH64 = 183;
|
|
8893
|
+
var SHT_SYMTAB = 2;
|
|
8894
|
+
var SHT_NOBITS = 8;
|
|
8895
|
+
var SHT_DYNSYM = 11;
|
|
8896
|
+
function fail(message3, cause) {
|
|
8897
|
+
throw new OhosPerfError(message3, { code: "ELF_INVALID", ...cause === void 0 ? {} : { cause } });
|
|
8898
|
+
}
|
|
8899
|
+
function view(bytes) {
|
|
8900
|
+
return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
8901
|
+
}
|
|
8902
|
+
function field(dv, at, size, what) {
|
|
8903
|
+
if (at < 0 || at + size > dv.byteLength) {
|
|
8904
|
+
fail(`ELF is truncated: ${what} at offset ${at} runs past the ${dv.byteLength}-byte file`);
|
|
8905
|
+
}
|
|
8906
|
+
if (size === 1) return dv.getUint8(at);
|
|
8907
|
+
if (size === 2) return dv.getUint16(at, true);
|
|
8908
|
+
if (size === 4) return dv.getUint32(at, true);
|
|
8909
|
+
return dv.getUint32(at, true) + dv.getUint32(at + 4, true) * 2 ** 32;
|
|
8910
|
+
}
|
|
8911
|
+
function readString(table, offset) {
|
|
8912
|
+
if (offset < 0 || offset >= table.length) return "";
|
|
8913
|
+
const end = table.indexOf(0, offset);
|
|
8914
|
+
return new TextDecoder("utf-8").decode(
|
|
8915
|
+
table.subarray(offset, end === -1 ? table.length : end)
|
|
8916
|
+
);
|
|
8917
|
+
}
|
|
8918
|
+
function bindOf(info) {
|
|
8919
|
+
const bind = info >> 4;
|
|
8920
|
+
if (bind === 0) return "local";
|
|
8921
|
+
if (bind === 1) return "global";
|
|
8922
|
+
if (bind === 2) return "weak";
|
|
8923
|
+
return "other";
|
|
8924
|
+
}
|
|
8925
|
+
function typeOf(info) {
|
|
8926
|
+
const type = info & 15;
|
|
8927
|
+
if (type === 0) return "notype";
|
|
8928
|
+
if (type === 1) return "object";
|
|
8929
|
+
if (type === 2) return "func";
|
|
8930
|
+
if (type === 3) return "section";
|
|
8931
|
+
if (type === 4) return "file";
|
|
8932
|
+
return "other";
|
|
8933
|
+
}
|
|
8934
|
+
function symbolTableOf(dv, sections, links, bytes, index) {
|
|
8935
|
+
const section = sections[index];
|
|
8936
|
+
const link = links[index];
|
|
8937
|
+
const strings = link >= 0 && link < sections.length ? bytes.subarray(sections[link].offset, sections[link].offset + sections[link].size) : new Uint8Array(0);
|
|
8938
|
+
const entrySize = section.entrySize === 0 ? 24 : section.entrySize;
|
|
8939
|
+
const count = Math.floor(section.size / entrySize);
|
|
8940
|
+
const symbols = [];
|
|
8941
|
+
for (let at = 0; at < count; at += 1) {
|
|
8942
|
+
const base = section.offset + at * entrySize;
|
|
8943
|
+
if (at === 0) continue;
|
|
8944
|
+
const nameOffset = field(dv, base, 4, "st_name");
|
|
8945
|
+
const info = field(dv, base + 4, 1, "st_info");
|
|
8946
|
+
const sectionIndex = field(dv, base + 6, 2, "st_shndx");
|
|
8947
|
+
const value = field(dv, base + 8, 8, "st_value");
|
|
8948
|
+
const size = field(dv, base + 16, 8, "st_size");
|
|
8949
|
+
const name = readString(strings, nameOffset);
|
|
8950
|
+
symbols.push({ name, bind: bindOf(info), type: typeOf(info), size, value, sectionIndex });
|
|
8951
|
+
}
|
|
8952
|
+
return symbols;
|
|
8953
|
+
}
|
|
8954
|
+
function readElf(bytes) {
|
|
8955
|
+
if (bytes.length < 4) {
|
|
8956
|
+
fail(`ELF is truncated: ${bytes.length} bytes is shorter than the 4-byte magic`);
|
|
8957
|
+
}
|
|
8958
|
+
if (bytes[0] !== 127 || bytes[1] !== 69 || bytes[2] !== 76 || bytes[3] !== 70) {
|
|
8959
|
+
fail("not an ELF file: the first four bytes are not \\x7fELF");
|
|
8960
|
+
}
|
|
8961
|
+
if (bytes.length < 16) {
|
|
8962
|
+
fail(`ELF is truncated: ${bytes.length} bytes is shorter than the 16-byte ident`);
|
|
8963
|
+
}
|
|
8964
|
+
const bits = bytes[4] === 2 ? 64 : bytes[4] === 1 ? 32 : 0;
|
|
8965
|
+
if (bits === 0) {
|
|
8966
|
+
fail(`unsupported ELF class ${String(bytes[4])}: only 32-bit and 64-bit are defined`);
|
|
8967
|
+
}
|
|
8968
|
+
const endian = bytes[5] === 1 ? "little" : bytes[5] === 2 ? "big" : void 0;
|
|
8969
|
+
if (endian === void 0) {
|
|
8970
|
+
fail(`unsupported ELF data encoding ${String(bytes[5])}: only little and big endian are defined`);
|
|
8971
|
+
}
|
|
8972
|
+
if (bits !== 64 || endian !== "little") {
|
|
8973
|
+
fail(`unsupported ELF: ${String(bits)}-bit ${endian}-endian; OHOS ships 64-bit little-endian`);
|
|
8974
|
+
}
|
|
8975
|
+
const headerSize = 64;
|
|
8976
|
+
if (bytes.length < headerSize) {
|
|
8977
|
+
fail(`ELF is truncated: ${bytes.length} bytes is shorter than the ${headerSize}-byte header`);
|
|
8978
|
+
}
|
|
8979
|
+
const dv = view(bytes);
|
|
8980
|
+
const machine = field(dv, 18, 2, "e_machine");
|
|
8981
|
+
const type = field(dv, 16, 2, "e_type");
|
|
8982
|
+
const shoff = field(dv, 40, 8, "e_shoff");
|
|
8983
|
+
const shentsize = field(dv, 58, 2, "e_shentsize");
|
|
8984
|
+
const shnum = field(dv, 60, 2, "e_shnum");
|
|
8985
|
+
const shstrndx = field(dv, 62, 2, "e_shstrndx");
|
|
8986
|
+
if (shnum === 0) {
|
|
8987
|
+
return {
|
|
8988
|
+
bits: 64,
|
|
8989
|
+
endian,
|
|
8990
|
+
machine,
|
|
8991
|
+
type,
|
|
8992
|
+
sections: [],
|
|
8993
|
+
symbols: [],
|
|
8994
|
+
section: () => void 0,
|
|
8995
|
+
bytesOf: () => new Uint8Array(0)
|
|
8996
|
+
};
|
|
8997
|
+
}
|
|
8998
|
+
if (shentsize !== 64) {
|
|
8999
|
+
fail(`unsupported section header size ${shentsize}: a 64-bit ELF uses 64`);
|
|
9000
|
+
}
|
|
9001
|
+
if (shoff + shnum * shentsize > bytes.length) {
|
|
9002
|
+
fail(
|
|
9003
|
+
`ELF is truncated: the section header table at offset ${shoff} with ${shnum} entries runs past the ${bytes.length}-byte file`
|
|
9004
|
+
);
|
|
9005
|
+
}
|
|
9006
|
+
if (shstrndx >= shnum) {
|
|
9007
|
+
fail(`e_shstrndx ${shstrndx} names a section beyond the ${shnum} the file declares`);
|
|
9008
|
+
}
|
|
9009
|
+
const raw = [];
|
|
9010
|
+
const links = [];
|
|
9011
|
+
for (let index = 0; index < shnum; index += 1) {
|
|
9012
|
+
const at = shoff + index * shentsize;
|
|
9013
|
+
raw.push({
|
|
9014
|
+
nameOffset: field(dv, at, 4, `section[${index}].sh_name`),
|
|
9015
|
+
type: field(dv, at + 4, 4, `section[${index}].sh_type`),
|
|
9016
|
+
flags: field(dv, at + 8, 8, `section[${index}].sh_flags`),
|
|
9017
|
+
offset: field(dv, at + 24, 8, `section[${index}].sh_offset`),
|
|
9018
|
+
size: field(dv, at + 32, 8, `section[${index}].sh_size`),
|
|
9019
|
+
link: field(dv, at + 40, 4, `section[${index}].sh_link`),
|
|
9020
|
+
entrySize: field(dv, at + 56, 8, `section[${index}].sh_entsize`)
|
|
9021
|
+
});
|
|
9022
|
+
links.push(raw[index].link);
|
|
9023
|
+
}
|
|
9024
|
+
for (const [index, section] of raw.entries()) {
|
|
9025
|
+
if (section.type === SHT_NOBITS || section.type === 0) continue;
|
|
9026
|
+
if (section.offset + section.size > bytes.length) {
|
|
9027
|
+
fail(
|
|
9028
|
+
`ELF is truncated: section ${index} at offset ${section.offset} with size ${section.size} runs past the ${bytes.length}-byte file`
|
|
9029
|
+
);
|
|
9030
|
+
}
|
|
9031
|
+
}
|
|
9032
|
+
const nameTable = raw[shstrndx];
|
|
9033
|
+
const strings = bytes.subarray(nameTable.offset, nameTable.offset + nameTable.size);
|
|
9034
|
+
const sections = raw.map((section) => ({
|
|
9035
|
+
name: readString(strings, section.nameOffset),
|
|
9036
|
+
type: section.type,
|
|
9037
|
+
flags: section.flags,
|
|
9038
|
+
offset: section.offset,
|
|
9039
|
+
size: section.size,
|
|
9040
|
+
entrySize: section.entrySize
|
|
9041
|
+
}));
|
|
9042
|
+
const symbols = [];
|
|
9043
|
+
for (const [index, section] of sections.entries()) {
|
|
9044
|
+
if (section.type !== SHT_SYMTAB && section.type !== SHT_DYNSYM) continue;
|
|
9045
|
+
symbols.push(...symbolTableOf(dv, sections, links, bytes, index));
|
|
9046
|
+
}
|
|
9047
|
+
const byName = new Map(sections.map((section) => [section.name, section]));
|
|
9048
|
+
return {
|
|
9049
|
+
bits: 64,
|
|
9050
|
+
endian,
|
|
9051
|
+
machine,
|
|
9052
|
+
type,
|
|
9053
|
+
sections,
|
|
9054
|
+
symbols,
|
|
9055
|
+
section: (name) => byName.get(name),
|
|
9056
|
+
bytesOf: (name) => {
|
|
9057
|
+
const section = byName.get(name);
|
|
9058
|
+
if (section === void 0 || section.type === SHT_NOBITS) return new Uint8Array(0);
|
|
9059
|
+
return bytes.subarray(section.offset, section.offset + section.size);
|
|
9060
|
+
}
|
|
9061
|
+
};
|
|
9062
|
+
}
|
|
9063
|
+
function classifyInstruction(word) {
|
|
9064
|
+
const masked = (mask) => (word & mask) >>> 0;
|
|
9065
|
+
if (masked(4294966303) === 3596550144) return "ret";
|
|
9066
|
+
if (masked(4294966303) === 3594452992) return "blr";
|
|
9067
|
+
if (masked(4294966303) === 3592355840) return "br";
|
|
9068
|
+
if (masked(4227858432) === 2483027968) return "bl";
|
|
9069
|
+
if (masked(4227858432) === 335544320) return "b";
|
|
9070
|
+
if (masked(4278190096) === 1409286144) return "bcond";
|
|
9071
|
+
if (masked(2113929216) === 872415232) return "cbz";
|
|
9072
|
+
if (masked(2113929216) === 905969664) return "tbz";
|
|
9073
|
+
if (masked(2667577344) === 2415919104) return "adrp";
|
|
9074
|
+
if (masked(2667577344) === 268435456) return "adr";
|
|
9075
|
+
if (masked(989855744) === 956301312) {
|
|
9076
|
+
return masked(4194304) === 0 ? "str" : "ldr";
|
|
9077
|
+
}
|
|
9078
|
+
if (masked(520093696) === 285212672) return "add";
|
|
9079
|
+
if (masked(167772160) === 167772160) return "vector";
|
|
9080
|
+
return "other";
|
|
9081
|
+
}
|
|
9082
|
+
function countInstructions(payload) {
|
|
9083
|
+
const counts = {
|
|
9084
|
+
total: 0,
|
|
9085
|
+
ret: 0,
|
|
9086
|
+
blr: 0,
|
|
9087
|
+
br: 0,
|
|
9088
|
+
bl: 0,
|
|
9089
|
+
b: 0,
|
|
9090
|
+
bcond: 0,
|
|
9091
|
+
cbz: 0,
|
|
9092
|
+
tbz: 0,
|
|
9093
|
+
adrp: 0,
|
|
9094
|
+
adr: 0,
|
|
9095
|
+
ldr: 0,
|
|
9096
|
+
str: 0,
|
|
9097
|
+
add: 0,
|
|
9098
|
+
vector: 0,
|
|
9099
|
+
other: 0
|
|
9100
|
+
};
|
|
9101
|
+
const dv = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
9102
|
+
const words = Math.floor(payload.length / 4);
|
|
9103
|
+
for (let index = 0; index < words; index += 1) {
|
|
9104
|
+
const cls = classifyInstruction(dv.getUint32(index * 4, true));
|
|
9105
|
+
counts[cls] += 1;
|
|
9106
|
+
counts.total += 1;
|
|
9107
|
+
}
|
|
9108
|
+
return counts;
|
|
9109
|
+
}
|
|
9110
|
+
|
|
9111
|
+
// src/hap/symbols-recovery.ts
|
|
9112
|
+
var ADDRESS_FORM = /^(.+)\+0x([0-9a-fA-F]+)$/;
|
|
9113
|
+
function addressOfOffset(symbol) {
|
|
9114
|
+
const match = ADDRESS_FORM.exec(symbol);
|
|
9115
|
+
if (match === null) return void 0;
|
|
9116
|
+
const offset = Number.parseInt(match[2], 16);
|
|
9117
|
+
if (!Number.isSafeInteger(offset) || offset < 0) return void 0;
|
|
9118
|
+
return { library: match[1], offset };
|
|
9119
|
+
}
|
|
9120
|
+
function symbolIndex(elf) {
|
|
9121
|
+
return elf.symbols.filter((symbol) => symbol.type === "func" && symbol.size > 0 && symbol.name !== "").map((symbol) => ({
|
|
9122
|
+
name: symbol.name,
|
|
9123
|
+
start: symbol.value,
|
|
9124
|
+
end: symbol.value + symbol.size,
|
|
9125
|
+
size: symbol.size,
|
|
9126
|
+
bind: symbol.bind
|
|
9127
|
+
})).sort((a, b) => a.start - b.start || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
9128
|
+
}
|
|
9129
|
+
function functionAt(index, offset) {
|
|
9130
|
+
for (const range of index) {
|
|
9131
|
+
if (range.start > offset) return void 0;
|
|
9132
|
+
if (offset >= range.start && offset < range.end) return range;
|
|
9133
|
+
}
|
|
9134
|
+
return void 0;
|
|
9135
|
+
}
|
|
9136
|
+
function recoverSymbols(bytes, unresolved) {
|
|
9137
|
+
const elf = readElf(bytes);
|
|
9138
|
+
const index = symbolIndex(elf);
|
|
9139
|
+
const stripped = index.length === 0;
|
|
9140
|
+
const recovered = [];
|
|
9141
|
+
const missed = [];
|
|
9142
|
+
for (const address of [...unresolved].sort()) {
|
|
9143
|
+
const ref = addressOfOffset(address);
|
|
9144
|
+
if (ref === void 0) {
|
|
9145
|
+
missed.push({ address, reason: "not an address of the form lib.so+0xoffset" });
|
|
9146
|
+
continue;
|
|
9147
|
+
}
|
|
9148
|
+
if (stripped) {
|
|
9149
|
+
missed.push({
|
|
9150
|
+
address,
|
|
9151
|
+
reason: "the file has no symbol table (it is stripped), so no function boundary is recorded"
|
|
9152
|
+
});
|
|
9153
|
+
continue;
|
|
9154
|
+
}
|
|
9155
|
+
const found = functionAt(index, ref.offset);
|
|
9156
|
+
if (found === void 0) {
|
|
9157
|
+
missed.push({ address, reason: `no function recorded at ${address}` });
|
|
9158
|
+
continue;
|
|
9159
|
+
}
|
|
9160
|
+
recovered.push({
|
|
9161
|
+
address,
|
|
9162
|
+
offset: ref.offset,
|
|
9163
|
+
name: found.name,
|
|
9164
|
+
start: found.start,
|
|
9165
|
+
end: found.end,
|
|
9166
|
+
basis: "recorded"
|
|
9167
|
+
});
|
|
9168
|
+
}
|
|
9169
|
+
return { recovered, unresolved: missed };
|
|
9170
|
+
}
|
|
9171
|
+
var PLACEHOLDER = /^(?:fcn|sym|sub|loc|unk|fun)[._][0-9a-f]+$/i;
|
|
9172
|
+
function normaliseName(name) {
|
|
9173
|
+
let text = name.trim();
|
|
9174
|
+
text = text.replace(/^(?:sym\.(?:imp\.)?|fcn\.)/i, "");
|
|
9175
|
+
text = text.replace(/\(.*\)$/, "");
|
|
9176
|
+
text = text.replace(/\s*->.*$/, "");
|
|
9177
|
+
text = text.replace(/^_Z\d+/, "");
|
|
9178
|
+
text = text.replace(/^_+/, "");
|
|
9179
|
+
return text.toLowerCase();
|
|
9180
|
+
}
|
|
9181
|
+
function isNameable(symbol) {
|
|
9182
|
+
if (symbol.type !== "func" || symbol.size === 0) return false;
|
|
9183
|
+
if (symbol.name === "") return false;
|
|
9184
|
+
if (PLACEHOLDER.test(symbol.name)) return false;
|
|
9185
|
+
return true;
|
|
9186
|
+
}
|
|
9187
|
+
async function measureNaming(bytes, answer) {
|
|
9188
|
+
const elf = readElf(bytes);
|
|
9189
|
+
const held = elf.symbols.filter(isNameable).map((symbol) => ({
|
|
9190
|
+
truth: symbol.name,
|
|
9191
|
+
start: symbol.value,
|
|
9192
|
+
size: symbol.size,
|
|
9193
|
+
bind: symbol.bind
|
|
9194
|
+
})).sort((a, b) => a.start - b.start || (a.truth < b.truth ? -1 : a.truth > b.truth ? 1 : 0));
|
|
9195
|
+
const text = elf.bytesOf(".text");
|
|
9196
|
+
const textStart = elf.section(".text")?.offset ?? 0;
|
|
9197
|
+
const bodyOf = (start, size) => {
|
|
9198
|
+
const from = start - textStart;
|
|
9199
|
+
if (from < 0 || from + size > text.length) return new Uint8Array(0);
|
|
9200
|
+
return text.subarray(from, from + size);
|
|
9201
|
+
};
|
|
9202
|
+
const cases = [];
|
|
9203
|
+
for (const held_out of held) {
|
|
9204
|
+
const body = bodyOf(held_out.start, held_out.size);
|
|
9205
|
+
const question = {
|
|
9206
|
+
...held_out,
|
|
9207
|
+
body,
|
|
9208
|
+
counts: countInstructions(body)
|
|
9209
|
+
};
|
|
9210
|
+
let reply;
|
|
9211
|
+
try {
|
|
9212
|
+
reply = await answer(question);
|
|
9213
|
+
} catch (err) {
|
|
9214
|
+
throw new OhosPerfError(
|
|
9215
|
+
`naming ${question.truth} failed: ${err.message}`,
|
|
9216
|
+
{ code: "AGENT_NAMING_FAILED", cause: err }
|
|
9217
|
+
);
|
|
9218
|
+
}
|
|
9219
|
+
cases.push({
|
|
9220
|
+
truth: question.truth,
|
|
9221
|
+
answer: reply,
|
|
9222
|
+
correct: normaliseName(reply) === normaliseName(question.truth),
|
|
9223
|
+
start: question.start,
|
|
9224
|
+
size: question.size
|
|
9225
|
+
});
|
|
9226
|
+
}
|
|
9227
|
+
const correct = cases.filter((entry) => entry.correct).length;
|
|
9228
|
+
return {
|
|
9229
|
+
heldOut: cases.length,
|
|
9230
|
+
correct,
|
|
9231
|
+
accuracy: cases.length === 0 ? void 0 : correct / cases.length,
|
|
9232
|
+
cases
|
|
9233
|
+
};
|
|
9234
|
+
}
|
|
9235
|
+
|
|
9236
|
+
// src/scenario/agent-client.ts
|
|
9237
|
+
var OWN_BASE_URL = "OHOS_PERF_AGENT_BASE_URL";
|
|
9238
|
+
var OWN_API_KEY = "OHOS_PERF_AGENT_API_KEY";
|
|
9239
|
+
var OWN_MODEL = "OHOS_PERF_AGENT_MODEL";
|
|
9240
|
+
var FALLBACK_BASE_URL = "GLM_BASE_URL";
|
|
9241
|
+
var FALLBACK_API_KEY = "GLM_API_KEY";
|
|
9242
|
+
var FALLBACK_MODEL = "GLM_MODEL";
|
|
9243
|
+
var DEFAULT_MODEL = "autoglm-phone-9b";
|
|
9244
|
+
var DEFAULT_TIMEOUT_MS4 = 6e4;
|
|
9245
|
+
var EXCERPT_CHARS = 200;
|
|
9246
|
+
function pick(env, own, fallback) {
|
|
9247
|
+
const value = env[own];
|
|
9248
|
+
if (value !== void 0 && value.trim() !== "") return value.trim();
|
|
9249
|
+
const other = env[fallback];
|
|
9250
|
+
return other !== void 0 && other.trim() !== "" ? other.trim() : void 0;
|
|
9251
|
+
}
|
|
9252
|
+
function readAgentConfig(env) {
|
|
9253
|
+
const baseUrl = pick(env, OWN_BASE_URL, FALLBACK_BASE_URL);
|
|
9254
|
+
const apiKey = pick(env, OWN_API_KEY, FALLBACK_API_KEY);
|
|
9255
|
+
if (baseUrl === void 0 || apiKey === void 0) return void 0;
|
|
9256
|
+
return {
|
|
9257
|
+
baseUrl,
|
|
9258
|
+
apiKey,
|
|
9259
|
+
model: pick(env, OWN_MODEL, FALLBACK_MODEL) ?? DEFAULT_MODEL
|
|
9260
|
+
};
|
|
9261
|
+
}
|
|
9262
|
+
function badClient(message3) {
|
|
9263
|
+
return new OhosPerfError(message3, { code: "AGENT_BAD_CONFIG" });
|
|
9264
|
+
}
|
|
9265
|
+
function contentOf(body) {
|
|
9266
|
+
if (typeof body !== "object" || body === null) {
|
|
9267
|
+
throw new OhosPerfError("the model endpoint returned a body that is not an object", {
|
|
9268
|
+
code: "AGENT_BAD_RESPONSE"
|
|
9269
|
+
});
|
|
9270
|
+
}
|
|
9271
|
+
const choices = body["choices"];
|
|
9272
|
+
if (!Array.isArray(choices) || choices.length === 0) {
|
|
9273
|
+
throw new OhosPerfError(
|
|
9274
|
+
"the model endpoint returned no choices; expected an OpenAI-compatible /chat/completions response",
|
|
9275
|
+
{ code: "AGENT_BAD_RESPONSE" }
|
|
9276
|
+
);
|
|
9277
|
+
}
|
|
9278
|
+
const first = choices[0];
|
|
9279
|
+
const message3 = first?.["message"];
|
|
9280
|
+
const content = message3?.["content"];
|
|
9281
|
+
if (typeof content !== "string") {
|
|
9282
|
+
throw new OhosPerfError("the model endpoint returned a choice with no message content", {
|
|
9283
|
+
code: "AGENT_BAD_RESPONSE"
|
|
9284
|
+
});
|
|
9285
|
+
}
|
|
9286
|
+
return content;
|
|
9287
|
+
}
|
|
9288
|
+
function httpAgentModel(options) {
|
|
9289
|
+
const baseUrl = options.baseUrl.trim().replace(/\/+$/, "");
|
|
9290
|
+
const model = options.model.trim();
|
|
9291
|
+
if (baseUrl === "") throw badClient("the agent base URL must not be empty");
|
|
9292
|
+
if (model === "") throw badClient("the agent model name must not be empty");
|
|
9293
|
+
const url = `${baseUrl}/chat/completions`;
|
|
9294
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS4;
|
|
8548
9295
|
return {
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
9296
|
+
async decide(turn) {
|
|
9297
|
+
const body = {
|
|
9298
|
+
model,
|
|
9299
|
+
messages: [{ role: "user", content: agentPrompt(turn) }],
|
|
9300
|
+
// The answer is JSON the loop parses, so the endpoint is asked for JSON
|
|
9301
|
+
// rather than for prose that happens to contain some.
|
|
9302
|
+
response_format: { type: "json_object" }
|
|
9303
|
+
};
|
|
9304
|
+
let response;
|
|
9305
|
+
try {
|
|
9306
|
+
response = await options.fetch(url, {
|
|
9307
|
+
method: "POST",
|
|
9308
|
+
headers: {
|
|
9309
|
+
"Content-Type": "application/json",
|
|
9310
|
+
Authorization: `Bearer ${options.apiKey}`
|
|
9311
|
+
},
|
|
9312
|
+
body: JSON.stringify(body),
|
|
9313
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
9314
|
+
});
|
|
9315
|
+
} catch (err) {
|
|
9316
|
+
throw new OhosPerfError(
|
|
9317
|
+
`the agent endpoint could not be reached: ${err.message}`,
|
|
9318
|
+
{ code: "AGENT_UNREACHABLE", cause: err }
|
|
9319
|
+
);
|
|
9320
|
+
}
|
|
9321
|
+
const text = await response.text();
|
|
9322
|
+
if (!response.ok) {
|
|
9323
|
+
throw new OhosPerfError(
|
|
9324
|
+
`the agent endpoint answered ${response.status}: ${text.slice(0, EXCERPT_CHARS)}`,
|
|
9325
|
+
{ code: "AGENT_HTTP_ERROR" }
|
|
9326
|
+
);
|
|
9327
|
+
}
|
|
9328
|
+
const content = contentOf(safeJson(text));
|
|
9329
|
+
if (content.trim() === "") {
|
|
9330
|
+
throw new OhosPerfError("the model returned an empty answer", {
|
|
9331
|
+
code: "AGENT_BAD_RESPONSE"
|
|
9332
|
+
});
|
|
9333
|
+
}
|
|
9334
|
+
return parseDecision(content);
|
|
9335
|
+
}
|
|
8561
9336
|
};
|
|
8562
9337
|
}
|
|
8563
|
-
function
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
9338
|
+
function safeJson(text) {
|
|
9339
|
+
try {
|
|
9340
|
+
return JSON.parse(text);
|
|
9341
|
+
} catch {
|
|
9342
|
+
throw new OhosPerfError(
|
|
9343
|
+
`the agent endpoint answered with something that is not JSON: ${text.slice(0, EXCERPT_CHARS)}`,
|
|
9344
|
+
{ code: "AGENT_BAD_RESPONSE" }
|
|
9345
|
+
);
|
|
9346
|
+
}
|
|
8572
9347
|
}
|
|
8573
9348
|
|
|
8574
9349
|
// src/query/rows.ts
|
|
@@ -17642,7 +18417,7 @@ var CENTRAL_SIGNATURE = 33639248;
|
|
|
17642
18417
|
var LOCAL_SIGNATURE = 67324752;
|
|
17643
18418
|
var ZIP64_SENTINEL = 4294967295;
|
|
17644
18419
|
var ZIP_COMMENT_MAX = 65535;
|
|
17645
|
-
function
|
|
18420
|
+
function fail2(code, message3) {
|
|
17646
18421
|
throw new OhosPerfError(message3, { code });
|
|
17647
18422
|
}
|
|
17648
18423
|
function u16(bytes, at) {
|
|
@@ -17653,7 +18428,7 @@ function u32(bytes, at) {
|
|
|
17653
18428
|
}
|
|
17654
18429
|
function need(bytes, at, length, end, what) {
|
|
17655
18430
|
if (at < 0 || length < 0 || at + length > end) {
|
|
17656
|
-
|
|
18431
|
+
fail2("HAP_NOT_ZIP", `${what} lies outside the archive`);
|
|
17657
18432
|
}
|
|
17658
18433
|
}
|
|
17659
18434
|
function isZip(bytes) {
|
|
@@ -17669,32 +18444,32 @@ function findEocd(bytes) {
|
|
|
17669
18444
|
function assertSafeName(name) {
|
|
17670
18445
|
const normalized = name.replace(/\\/g, "/");
|
|
17671
18446
|
if (normalized.startsWith("/") || /^[A-Za-z]:/.test(normalized)) {
|
|
17672
|
-
|
|
18447
|
+
fail2("HAP_UNSAFE_PATH", `archive entry ${JSON.stringify(name)} is an absolute path`);
|
|
17673
18448
|
}
|
|
17674
18449
|
if (normalized.split("/").includes("..")) {
|
|
17675
|
-
|
|
18450
|
+
fail2("HAP_UNSAFE_PATH", `archive entry ${JSON.stringify(name)} climbs out of the archive`);
|
|
17676
18451
|
}
|
|
17677
18452
|
}
|
|
17678
18453
|
function openZip(bytes) {
|
|
17679
18454
|
const eocd = findEocd(bytes);
|
|
17680
18455
|
if (eocd === -1) {
|
|
17681
|
-
|
|
18456
|
+
fail2("HAP_NOT_ZIP", "not a ZIP archive: no end-of-central-directory record");
|
|
17682
18457
|
}
|
|
17683
18458
|
const count = u16(bytes, eocd + 10);
|
|
17684
18459
|
const centralSize = u32(bytes, eocd + 12);
|
|
17685
18460
|
const centralOffset = u32(bytes, eocd + 16);
|
|
17686
18461
|
if (count === 65535 || centralSize === ZIP64_SENTINEL || centralOffset === ZIP64_SENTINEL) {
|
|
17687
|
-
|
|
18462
|
+
fail2("HAP_ZIP64_UNSUPPORTED", "ZIP64 archives are not supported");
|
|
17688
18463
|
}
|
|
17689
18464
|
if (centralOffset + centralSize > bytes.length) {
|
|
17690
|
-
|
|
18465
|
+
fail2("HAP_NOT_ZIP", "central directory lies outside the archive");
|
|
17691
18466
|
}
|
|
17692
18467
|
const entries = [];
|
|
17693
18468
|
let at = centralOffset;
|
|
17694
18469
|
for (let index = 0; index < count; index++) {
|
|
17695
18470
|
need(bytes, at, 46, bytes.length, `central directory entry ${index}`);
|
|
17696
18471
|
if (u32(bytes, at) !== CENTRAL_SIGNATURE) {
|
|
17697
|
-
|
|
18472
|
+
fail2("HAP_NOT_ZIP", `central directory entry ${index} has no header`);
|
|
17698
18473
|
}
|
|
17699
18474
|
const flags = u16(bytes, at + 8);
|
|
17700
18475
|
const method = u16(bytes, at + 10);
|
|
@@ -17709,14 +18484,14 @@ function openZip(bytes) {
|
|
|
17709
18484
|
const name = new TextDecoder("utf-8").decode(bytes.subarray(at + 46, at + 46 + nameLength));
|
|
17710
18485
|
at += 46 + nameLength + extraLength + commentLength;
|
|
17711
18486
|
if (size === ZIP64_SENTINEL || compressedSize === ZIP64_SENTINEL || localOffset === ZIP64_SENTINEL) {
|
|
17712
|
-
|
|
18487
|
+
fail2("HAP_ZIP64_UNSUPPORTED", `archive entry ${JSON.stringify(name)} needs ZIP64`);
|
|
17713
18488
|
}
|
|
17714
18489
|
assertSafeName(name);
|
|
17715
18490
|
if ((flags & 1) !== 0) {
|
|
17716
|
-
|
|
18491
|
+
fail2("HAP_ENCRYPTED_ENTRY", `archive entry ${JSON.stringify(name)} is encrypted`);
|
|
17717
18492
|
}
|
|
17718
18493
|
if (method !== 0 && method !== 8) {
|
|
17719
|
-
|
|
18494
|
+
fail2(
|
|
17720
18495
|
"HAP_UNSUPPORTED_METHOD",
|
|
17721
18496
|
`archive entry ${JSON.stringify(name)} uses compression method ${method}; only stored (0) and deflate (8) are supported`
|
|
17722
18497
|
);
|
|
@@ -17724,13 +18499,13 @@ function openZip(bytes) {
|
|
|
17724
18499
|
if (name.endsWith("/")) continue;
|
|
17725
18500
|
need(bytes, localOffset, 30, bytes.length, `archive entry ${JSON.stringify(name)} local header`);
|
|
17726
18501
|
if (u32(bytes, localOffset) !== LOCAL_SIGNATURE) {
|
|
17727
|
-
|
|
18502
|
+
fail2("HAP_NOT_ZIP", `archive entry ${JSON.stringify(name)} has no local header`);
|
|
17728
18503
|
}
|
|
17729
18504
|
const localNameLength = u16(bytes, localOffset + 26);
|
|
17730
18505
|
const localExtraLength = u16(bytes, localOffset + 28);
|
|
17731
18506
|
const dataOffset = localOffset + 30 + localNameLength + localExtraLength;
|
|
17732
18507
|
if (dataOffset + compressedSize > bytes.length) {
|
|
17733
|
-
|
|
18508
|
+
fail2("HAP_NOT_ZIP", `archive entry ${JSON.stringify(name)} is truncated`);
|
|
17734
18509
|
}
|
|
17735
18510
|
entries.push({ name, size, compressedSize, crc32: crc, method, dataOffset });
|
|
17736
18511
|
}
|
|
@@ -17753,7 +18528,7 @@ function openZip(bytes) {
|
|
|
17753
18528
|
}
|
|
17754
18529
|
const actual = crc322(out);
|
|
17755
18530
|
if (actual !== entry.crc32) {
|
|
17756
|
-
|
|
18531
|
+
fail2(
|
|
17757
18532
|
"HAP_CRC_MISMATCH",
|
|
17758
18533
|
`archive entry ${JSON.stringify(entry.name)} fails its CRC check: header ${entry.crc32.toString(16)}, data ${actual.toString(16)}`
|
|
17759
18534
|
);
|
|
@@ -17763,225 +18538,6 @@ function openZip(bytes) {
|
|
|
17763
18538
|
};
|
|
17764
18539
|
}
|
|
17765
18540
|
|
|
17766
|
-
// src/hap/elf.ts
|
|
17767
|
-
var EM_AARCH64 = 183;
|
|
17768
|
-
var SHT_SYMTAB = 2;
|
|
17769
|
-
var SHT_NOBITS = 8;
|
|
17770
|
-
var SHT_DYNSYM = 11;
|
|
17771
|
-
function fail2(message3, cause) {
|
|
17772
|
-
throw new OhosPerfError(message3, { code: "ELF_INVALID", ...cause === void 0 ? {} : { cause } });
|
|
17773
|
-
}
|
|
17774
|
-
function view(bytes) {
|
|
17775
|
-
return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
17776
|
-
}
|
|
17777
|
-
function field(dv, at, size, what) {
|
|
17778
|
-
if (at < 0 || at + size > dv.byteLength) {
|
|
17779
|
-
fail2(`ELF is truncated: ${what} at offset ${at} runs past the ${dv.byteLength}-byte file`);
|
|
17780
|
-
}
|
|
17781
|
-
if (size === 1) return dv.getUint8(at);
|
|
17782
|
-
if (size === 2) return dv.getUint16(at, true);
|
|
17783
|
-
if (size === 4) return dv.getUint32(at, true);
|
|
17784
|
-
return dv.getUint32(at, true) + dv.getUint32(at + 4, true) * 2 ** 32;
|
|
17785
|
-
}
|
|
17786
|
-
function readString(table, offset) {
|
|
17787
|
-
if (offset < 0 || offset >= table.length) return "";
|
|
17788
|
-
const end = table.indexOf(0, offset);
|
|
17789
|
-
return new TextDecoder("utf-8").decode(
|
|
17790
|
-
table.subarray(offset, end === -1 ? table.length : end)
|
|
17791
|
-
);
|
|
17792
|
-
}
|
|
17793
|
-
function bindOf(info) {
|
|
17794
|
-
const bind = info >> 4;
|
|
17795
|
-
if (bind === 0) return "local";
|
|
17796
|
-
if (bind === 1) return "global";
|
|
17797
|
-
if (bind === 2) return "weak";
|
|
17798
|
-
return "other";
|
|
17799
|
-
}
|
|
17800
|
-
function typeOf(info) {
|
|
17801
|
-
const type = info & 15;
|
|
17802
|
-
if (type === 0) return "notype";
|
|
17803
|
-
if (type === 1) return "object";
|
|
17804
|
-
if (type === 2) return "func";
|
|
17805
|
-
if (type === 3) return "section";
|
|
17806
|
-
if (type === 4) return "file";
|
|
17807
|
-
return "other";
|
|
17808
|
-
}
|
|
17809
|
-
function symbolTableOf(dv, sections, links, bytes, index) {
|
|
17810
|
-
const section = sections[index];
|
|
17811
|
-
const link = links[index];
|
|
17812
|
-
const strings = link >= 0 && link < sections.length ? bytes.subarray(sections[link].offset, sections[link].offset + sections[link].size) : new Uint8Array(0);
|
|
17813
|
-
const entrySize = section.entrySize === 0 ? 24 : section.entrySize;
|
|
17814
|
-
const count = Math.floor(section.size / entrySize);
|
|
17815
|
-
const symbols = [];
|
|
17816
|
-
for (let at = 0; at < count; at += 1) {
|
|
17817
|
-
const base = section.offset + at * entrySize;
|
|
17818
|
-
if (at === 0) continue;
|
|
17819
|
-
const nameOffset = field(dv, base, 4, "st_name");
|
|
17820
|
-
const info = field(dv, base + 4, 1, "st_info");
|
|
17821
|
-
const sectionIndex = field(dv, base + 6, 2, "st_shndx");
|
|
17822
|
-
const size = field(dv, base + 16, 8, "st_size");
|
|
17823
|
-
const name = readString(strings, nameOffset);
|
|
17824
|
-
symbols.push({ name, bind: bindOf(info), type: typeOf(info), size, sectionIndex });
|
|
17825
|
-
}
|
|
17826
|
-
return symbols;
|
|
17827
|
-
}
|
|
17828
|
-
function readElf(bytes) {
|
|
17829
|
-
if (bytes.length < 4) {
|
|
17830
|
-
fail2(`ELF is truncated: ${bytes.length} bytes is shorter than the 4-byte magic`);
|
|
17831
|
-
}
|
|
17832
|
-
if (bytes[0] !== 127 || bytes[1] !== 69 || bytes[2] !== 76 || bytes[3] !== 70) {
|
|
17833
|
-
fail2("not an ELF file: the first four bytes are not \\x7fELF");
|
|
17834
|
-
}
|
|
17835
|
-
if (bytes.length < 16) {
|
|
17836
|
-
fail2(`ELF is truncated: ${bytes.length} bytes is shorter than the 16-byte ident`);
|
|
17837
|
-
}
|
|
17838
|
-
const bits = bytes[4] === 2 ? 64 : bytes[4] === 1 ? 32 : 0;
|
|
17839
|
-
if (bits === 0) {
|
|
17840
|
-
fail2(`unsupported ELF class ${String(bytes[4])}: only 32-bit and 64-bit are defined`);
|
|
17841
|
-
}
|
|
17842
|
-
const endian = bytes[5] === 1 ? "little" : bytes[5] === 2 ? "big" : void 0;
|
|
17843
|
-
if (endian === void 0) {
|
|
17844
|
-
fail2(`unsupported ELF data encoding ${String(bytes[5])}: only little and big endian are defined`);
|
|
17845
|
-
}
|
|
17846
|
-
if (bits !== 64 || endian !== "little") {
|
|
17847
|
-
fail2(`unsupported ELF: ${String(bits)}-bit ${endian}-endian; OHOS ships 64-bit little-endian`);
|
|
17848
|
-
}
|
|
17849
|
-
const headerSize = 64;
|
|
17850
|
-
if (bytes.length < headerSize) {
|
|
17851
|
-
fail2(`ELF is truncated: ${bytes.length} bytes is shorter than the ${headerSize}-byte header`);
|
|
17852
|
-
}
|
|
17853
|
-
const dv = view(bytes);
|
|
17854
|
-
const machine = field(dv, 18, 2, "e_machine");
|
|
17855
|
-
const type = field(dv, 16, 2, "e_type");
|
|
17856
|
-
const shoff = field(dv, 40, 8, "e_shoff");
|
|
17857
|
-
const shentsize = field(dv, 58, 2, "e_shentsize");
|
|
17858
|
-
const shnum = field(dv, 60, 2, "e_shnum");
|
|
17859
|
-
const shstrndx = field(dv, 62, 2, "e_shstrndx");
|
|
17860
|
-
if (shnum === 0) {
|
|
17861
|
-
return {
|
|
17862
|
-
bits: 64,
|
|
17863
|
-
endian,
|
|
17864
|
-
machine,
|
|
17865
|
-
type,
|
|
17866
|
-
sections: [],
|
|
17867
|
-
symbols: [],
|
|
17868
|
-
section: () => void 0,
|
|
17869
|
-
bytesOf: () => new Uint8Array(0)
|
|
17870
|
-
};
|
|
17871
|
-
}
|
|
17872
|
-
if (shentsize !== 64) {
|
|
17873
|
-
fail2(`unsupported section header size ${shentsize}: a 64-bit ELF uses 64`);
|
|
17874
|
-
}
|
|
17875
|
-
if (shoff + shnum * shentsize > bytes.length) {
|
|
17876
|
-
fail2(
|
|
17877
|
-
`ELF is truncated: the section header table at offset ${shoff} with ${shnum} entries runs past the ${bytes.length}-byte file`
|
|
17878
|
-
);
|
|
17879
|
-
}
|
|
17880
|
-
if (shstrndx >= shnum) {
|
|
17881
|
-
fail2(`e_shstrndx ${shstrndx} names a section beyond the ${shnum} the file declares`);
|
|
17882
|
-
}
|
|
17883
|
-
const raw = [];
|
|
17884
|
-
const links = [];
|
|
17885
|
-
for (let index = 0; index < shnum; index += 1) {
|
|
17886
|
-
const at = shoff + index * shentsize;
|
|
17887
|
-
raw.push({
|
|
17888
|
-
nameOffset: field(dv, at, 4, `section[${index}].sh_name`),
|
|
17889
|
-
type: field(dv, at + 4, 4, `section[${index}].sh_type`),
|
|
17890
|
-
flags: field(dv, at + 8, 8, `section[${index}].sh_flags`),
|
|
17891
|
-
offset: field(dv, at + 24, 8, `section[${index}].sh_offset`),
|
|
17892
|
-
size: field(dv, at + 32, 8, `section[${index}].sh_size`),
|
|
17893
|
-
link: field(dv, at + 40, 4, `section[${index}].sh_link`),
|
|
17894
|
-
entrySize: field(dv, at + 56, 8, `section[${index}].sh_entsize`)
|
|
17895
|
-
});
|
|
17896
|
-
links.push(raw[index].link);
|
|
17897
|
-
}
|
|
17898
|
-
for (const [index, section] of raw.entries()) {
|
|
17899
|
-
if (section.type === SHT_NOBITS || section.type === 0) continue;
|
|
17900
|
-
if (section.offset + section.size > bytes.length) {
|
|
17901
|
-
fail2(
|
|
17902
|
-
`ELF is truncated: section ${index} at offset ${section.offset} with size ${section.size} runs past the ${bytes.length}-byte file`
|
|
17903
|
-
);
|
|
17904
|
-
}
|
|
17905
|
-
}
|
|
17906
|
-
const nameTable = raw[shstrndx];
|
|
17907
|
-
const strings = bytes.subarray(nameTable.offset, nameTable.offset + nameTable.size);
|
|
17908
|
-
const sections = raw.map((section) => ({
|
|
17909
|
-
name: readString(strings, section.nameOffset),
|
|
17910
|
-
type: section.type,
|
|
17911
|
-
flags: section.flags,
|
|
17912
|
-
offset: section.offset,
|
|
17913
|
-
size: section.size,
|
|
17914
|
-
entrySize: section.entrySize
|
|
17915
|
-
}));
|
|
17916
|
-
const symbols = [];
|
|
17917
|
-
for (const [index, section] of sections.entries()) {
|
|
17918
|
-
if (section.type !== SHT_SYMTAB && section.type !== SHT_DYNSYM) continue;
|
|
17919
|
-
symbols.push(...symbolTableOf(dv, sections, links, bytes, index));
|
|
17920
|
-
}
|
|
17921
|
-
const byName = new Map(sections.map((section) => [section.name, section]));
|
|
17922
|
-
return {
|
|
17923
|
-
bits: 64,
|
|
17924
|
-
endian,
|
|
17925
|
-
machine,
|
|
17926
|
-
type,
|
|
17927
|
-
sections,
|
|
17928
|
-
symbols,
|
|
17929
|
-
section: (name) => byName.get(name),
|
|
17930
|
-
bytesOf: (name) => {
|
|
17931
|
-
const section = byName.get(name);
|
|
17932
|
-
if (section === void 0 || section.type === SHT_NOBITS) return new Uint8Array(0);
|
|
17933
|
-
return bytes.subarray(section.offset, section.offset + section.size);
|
|
17934
|
-
}
|
|
17935
|
-
};
|
|
17936
|
-
}
|
|
17937
|
-
function classifyInstruction(word) {
|
|
17938
|
-
const masked = (mask) => (word & mask) >>> 0;
|
|
17939
|
-
if (masked(4294966303) === 3596550144) return "ret";
|
|
17940
|
-
if (masked(4294966303) === 3594452992) return "blr";
|
|
17941
|
-
if (masked(4294966303) === 3592355840) return "br";
|
|
17942
|
-
if (masked(4227858432) === 2483027968) return "bl";
|
|
17943
|
-
if (masked(4227858432) === 335544320) return "b";
|
|
17944
|
-
if (masked(4278190096) === 1409286144) return "bcond";
|
|
17945
|
-
if (masked(2113929216) === 872415232) return "cbz";
|
|
17946
|
-
if (masked(2113929216) === 905969664) return "tbz";
|
|
17947
|
-
if (masked(2667577344) === 2415919104) return "adrp";
|
|
17948
|
-
if (masked(2667577344) === 268435456) return "adr";
|
|
17949
|
-
if (masked(989855744) === 956301312) {
|
|
17950
|
-
return masked(4194304) === 0 ? "str" : "ldr";
|
|
17951
|
-
}
|
|
17952
|
-
if (masked(520093696) === 285212672) return "add";
|
|
17953
|
-
if (masked(167772160) === 167772160) return "vector";
|
|
17954
|
-
return "other";
|
|
17955
|
-
}
|
|
17956
|
-
function countInstructions(payload) {
|
|
17957
|
-
const counts = {
|
|
17958
|
-
total: 0,
|
|
17959
|
-
ret: 0,
|
|
17960
|
-
blr: 0,
|
|
17961
|
-
br: 0,
|
|
17962
|
-
bl: 0,
|
|
17963
|
-
b: 0,
|
|
17964
|
-
bcond: 0,
|
|
17965
|
-
cbz: 0,
|
|
17966
|
-
tbz: 0,
|
|
17967
|
-
adrp: 0,
|
|
17968
|
-
adr: 0,
|
|
17969
|
-
ldr: 0,
|
|
17970
|
-
str: 0,
|
|
17971
|
-
add: 0,
|
|
17972
|
-
vector: 0,
|
|
17973
|
-
other: 0
|
|
17974
|
-
};
|
|
17975
|
-
const dv = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
17976
|
-
const words = Math.floor(payload.length / 4);
|
|
17977
|
-
for (let index = 0; index < words; index += 1) {
|
|
17978
|
-
const cls = classifyInstruction(dv.getUint32(index * 4, true));
|
|
17979
|
-
counts[cls] += 1;
|
|
17980
|
-
counts.total += 1;
|
|
17981
|
-
}
|
|
17982
|
-
return counts;
|
|
17983
|
-
}
|
|
17984
|
-
|
|
17985
18541
|
// src/hap/optimization.ts
|
|
17986
18542
|
var OFFLINE_WINDOW = { startNs: 0, endNs: 0 };
|
|
17987
18543
|
var LTO_PATTERNS = [
|
|
@@ -19393,6 +19949,7 @@ export {
|
|
|
19393
19949
|
HiprofilerCollector,
|
|
19394
19950
|
HitraceCollector,
|
|
19395
19951
|
IGNORED_ATTRIBUTES,
|
|
19952
|
+
IRREVERSIBLE_PATTERNS,
|
|
19396
19953
|
IngestError,
|
|
19397
19954
|
InstantQuery,
|
|
19398
19955
|
JsheapCollector,
|
|
@@ -19433,6 +19990,8 @@ export {
|
|
|
19433
19990
|
UiAnalyzer,
|
|
19434
19991
|
UitestCollector,
|
|
19435
19992
|
VsyncAnalyzer,
|
|
19993
|
+
addressOfOffset,
|
|
19994
|
+
agentPrompt,
|
|
19436
19995
|
aggregateUnreleased,
|
|
19437
19996
|
analyseAnimations,
|
|
19438
19997
|
analyzeBinaries,
|
|
@@ -19470,12 +20029,14 @@ export {
|
|
|
19470
20029
|
cropRegion,
|
|
19471
20030
|
decodePng,
|
|
19472
20031
|
defaultAnalyzers,
|
|
20032
|
+
describeDecision,
|
|
19473
20033
|
deviceExplorationHost,
|
|
19474
20034
|
dhash,
|
|
19475
20035
|
diffTrees,
|
|
19476
20036
|
discoverCases,
|
|
19477
20037
|
encodePng,
|
|
19478
20038
|
escapeHtml,
|
|
20039
|
+
evaluateExpectation,
|
|
19479
20040
|
evidence,
|
|
19480
20041
|
executeAction,
|
|
19481
20042
|
explorationDevice,
|
|
@@ -19484,12 +20045,15 @@ export {
|
|
|
19484
20045
|
filterEmptyFrames,
|
|
19485
20046
|
flattenUiTree,
|
|
19486
20047
|
ftracePlugin,
|
|
20048
|
+
functionAt,
|
|
19487
20049
|
gpuPlugin,
|
|
19488
20050
|
hapSection,
|
|
19489
20051
|
hashTree,
|
|
19490
20052
|
hiperfRecordCommand,
|
|
20053
|
+
httpAgentModel,
|
|
19491
20054
|
ingestScene,
|
|
19492
20055
|
inspectBinary,
|
|
20056
|
+
irreversibleReason,
|
|
19493
20057
|
isUnresolvedSymbol,
|
|
19494
20058
|
isZip,
|
|
19495
20059
|
loadCases,
|
|
@@ -19498,11 +20062,13 @@ export {
|
|
|
19498
20062
|
matchHapRules,
|
|
19499
20063
|
matchRules,
|
|
19500
20064
|
matchSelector,
|
|
20065
|
+
measureNaming,
|
|
19501
20066
|
memoryPlugin,
|
|
19502
20067
|
metric,
|
|
19503
20068
|
nativeEventKind,
|
|
19504
20069
|
nativehookPlugin,
|
|
19505
20070
|
nodeIdentity,
|
|
20071
|
+
normaliseName,
|
|
19506
20072
|
openDb,
|
|
19507
20073
|
openZip,
|
|
19508
20074
|
optimizationSection,
|
|
@@ -19510,6 +20076,7 @@ export {
|
|
|
19510
20076
|
paritySummary,
|
|
19511
20077
|
parseBounds,
|
|
19512
20078
|
parseCoverageReport,
|
|
20079
|
+
parseDecision,
|
|
19513
20080
|
parseFpsCounts,
|
|
19514
20081
|
parseHilogLine,
|
|
19515
20082
|
parseHilogText,
|
|
@@ -19522,6 +20089,7 @@ export {
|
|
|
19522
20089
|
parseSmapsRollup,
|
|
19523
20090
|
planNextAction,
|
|
19524
20091
|
queryDefinitions,
|
|
20092
|
+
readAgentConfig,
|
|
19525
20093
|
readElf,
|
|
19526
20094
|
readHidumperCapture,
|
|
19527
20095
|
readHilogText,
|
|
@@ -19529,6 +20097,7 @@ export {
|
|
|
19529
20097
|
readProcfsSamples,
|
|
19530
20098
|
readSceneMetadata,
|
|
19531
20099
|
readUiTree,
|
|
20100
|
+
recoverSymbols,
|
|
19532
20101
|
renderBundle,
|
|
19533
20102
|
renderEvidenceCsv,
|
|
19534
20103
|
renderFlamegraphHtml,
|
|
@@ -19539,14 +20108,17 @@ export {
|
|
|
19539
20108
|
renderReportXlsx,
|
|
19540
20109
|
renderScenesComparison,
|
|
19541
20110
|
renderSummaryJson,
|
|
20111
|
+
renderTree,
|
|
19542
20112
|
renderTrendHtml,
|
|
19543
20113
|
renderTrendJson,
|
|
19544
20114
|
renderUiDiffHtml,
|
|
20115
|
+
replayAgent,
|
|
19545
20116
|
resolveAppIdentity,
|
|
19546
20117
|
resolveAppIpids,
|
|
19547
20118
|
resolveQueryLimit,
|
|
19548
20119
|
resolveSelector,
|
|
19549
20120
|
round2HalfEven,
|
|
20121
|
+
runAgent,
|
|
19550
20122
|
runAnalyzerSections,
|
|
19551
20123
|
runAnalyzers,
|
|
19552
20124
|
runDrillDown,
|
|
@@ -19554,6 +20126,7 @@ export {
|
|
|
19554
20126
|
runProbe,
|
|
19555
20127
|
sortSteps,
|
|
19556
20128
|
summarizeReport,
|
|
20129
|
+
symbolIndex,
|
|
19557
20130
|
tableRowCounts,
|
|
19558
20131
|
trendRunFromReport,
|
|
19559
20132
|
unknownQueryError,
|