@aiti-ai/aiti-cpu-meter 0.2.10 → 0.2.11
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/DESC.en.md +43 -0
- package/README.md +2 -3
- package/README.zh-CN.md +2 -3
- package/dist/aiti-cpu-meter-client.mjs +1 -1
- package/icon.svg +1 -1
- package/index.ts +0 -1
- package/package.json +12 -3
- package/tools/deploy.mjs +1 -0
package/DESC.en.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Main-thread smoothness detector: a small panel in the corner of the page — a rAF seconds counter + a 0-100 smoothness score (Apdex-anchored, color tiers). **When the main thread stalls, the counter freezes and the score drops off a cliff**; minimize it to a corner icon for long sessions and open it later to see the session average.
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Four ways to use it
|
|
6
|
+
|
|
7
|
+
### 1. Pages of this instance (pi-web)
|
|
8
|
+
|
|
9
|
+
Off by default in the aiti-ai build (turn on "Enable detector" under Feature Management in the extension manager). The panel can be dragged and minimized; position / scoring / minimize toggles are listed under Feature Management below.
|
|
10
|
+
|
|
11
|
+
### 2. Inject into any website: script tag
|
|
12
|
+
|
|
13
|
+
The external build is a single-file IIFE — any page can load it with a `<script>` tag (cross-origin allowed, publicApi declared):
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script src="{{aiti-url}}/api/extensions/{{ext-id}}/aiti-cpu-meter.js" defer></script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
> `{{aiti-url}}` is replaced with **this pi-web instance's external address** (including the `/dev` prefix) — paste it into the target site and it works.
|
|
20
|
+
|
|
21
|
+
### 3. Inject into any website: bookmarklet (no site changes)
|
|
22
|
+
|
|
23
|
+
Create a browser bookmark, paste the line below as its URL (click "Copy"), then click the bookmark on any page to attach the detector:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
javascript:(function(){var s=document.createElement('script');s.src='{{aiti-url}}/api/extensions/{{ext-id}}/aiti-cpu-meter.js';s.defer=1;document.body.appendChild(s)})();void 0
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 4. Site-wide automatic injection: service-tunnels
|
|
30
|
+
|
|
31
|
+
After installing [service-tunnels](http://aiti.pw/extensions/service-tunnels.html), tick "CPU smoothness detector" in its public config — proxied/public page HTML gets injected automatically, no per-page script needed.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Jank analysis (🤖 ask AI)
|
|
36
|
+
|
|
37
|
+
The 🤖 "Ask AI" button in the panel header hands the live data (smoothness score / long tasks / LoAF script attribution / jank snapshot) to `aiti-helper`, which starts a "debug page jank" AI session to find the root cause and propose a fix.
|
|
38
|
+
|
|
39
|
+
## How the numbers work
|
|
40
|
+
|
|
41
|
+
- The counter = real time since the previous frame; a main thread hogged by a long task freezes the counter
|
|
42
|
+
- The 0-100 smoothness score is Apdex-anchored on the long-task ratio, with color tiers (green ≥ 90 / yellow ≥ 70 / red < 70)
|
|
43
|
+
- Session stats: average score / running time / lowest score, accumulating even while minimized
|
package/README.md
CHANGED
|
@@ -6,10 +6,9 @@ English · [简体中文](./README.zh-CN.md)
|
|
|
6
6
|
|
|
7
7
|
## About aiti
|
|
8
8
|
|
|
9
|
-
This package is part of the **aiti** ecosystem — a personal AI development workbench powered by [pi](https://pi.dev): **aiti-agent** (a self-hosted web workbench built on the open-source [pi-web](https://github.com/aiti-ai/
|
|
9
|
+
This package is part of the **aiti** ecosystem — a personal AI development workbench powered by [pi](https://pi.dev): **aiti-agent** (a self-hosted web workbench built on the open-source [pi-web](https://github.com/aiti-ai/aiti-ai)) plus debug injection into mainstream dev tools (aiti-devtools) and a rich extension system.
|
|
10
10
|
|
|
11
|
-
- Workbench
|
|
12
|
-
- Ecosystem monorepo: <https://github.com/aiti-ai/aiti-ai>
|
|
11
|
+
- Workbench & monorepo: <https://github.com/aiti-ai/aiti-ai>
|
|
13
12
|
- Site: <https://aiti.pw>
|
|
14
13
|
|
|
15
14
|
## What it does
|
package/README.zh-CN.md
CHANGED
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
## 关于 aiti
|
|
8
8
|
|
|
9
|
-
本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/
|
|
9
|
+
本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/aiti-ai) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
- 生态仓库: <https://github.com/aiti-ai/aiti-ai>
|
|
11
|
+
- 工作台 / 生态仓库(aiti-agent,基于 pi-web): <https://github.com/aiti-ai/aiti-ai>
|
|
13
12
|
- 官网: <https://aiti.pw>
|
|
14
13
|
|
|
15
14
|
## 功能定位
|
|
@@ -901,7 +901,7 @@ function extDisplayName(id, fallbackName) {
|
|
|
901
901
|
if (over) return over;
|
|
902
902
|
const name = fallbackName ?? entry?.name ?? "";
|
|
903
903
|
if (!name) return id;
|
|
904
|
-
return locale
|
|
904
|
+
return locale.startsWith("zh") ? name : CJK_RE.test(name) ? id : name;
|
|
905
905
|
}
|
|
906
906
|
|
|
907
907
|
// client/src/internal-client.mjs
|
package/icon.svg
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>
|
package/index.ts
CHANGED
|
@@ -125,7 +125,6 @@ export default {
|
|
|
125
125
|
"feat.inject.enabled.desc": "Injects the CPU meter of the \"Service URL\" target instance into the current page (cross-instance viewing requires the target to have this enabled too)",
|
|
126
126
|
"feat.service.url.desc": "Target pi-web base URL (with sub-path, e.g. https://host:port/dev)",
|
|
127
127
|
"ext.displayName": "CPU Meter",
|
|
128
|
-
"ext.description": "Shows a CPU smoothness meter on this instance's page (rAF timer + 0-100 smoothness score + color tiers + minimize). The timer freezes and the score plummets when the main thread jams.",
|
|
129
128
|
"feat.enabled": "Enable the meter",
|
|
130
129
|
"feat.pos": "Position",
|
|
131
130
|
"feat.score": "Smoothness score",
|
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiti-ai/aiti-cpu-meter",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": ". Ships as two artifacts: a pi-web extension (internal) and a standalone single-file injector you can register into any
|
|
3
|
+
"version": "0.2.11",
|
|
4
|
+
"description": "Main-thread smoothness detector — a seconds counter + 0–100 smoothness score + color tiers + minimize + AI jank debugging. Ships as two artifacts: a pi-web extension (internal) and a standalone single-file injector you can register into any website you develop.",
|
|
5
|
+
"displayNameI18n": {
|
|
6
|
+
"en": "CPU Meter"
|
|
7
|
+
},
|
|
8
|
+
"descriptionI18n": {
|
|
9
|
+
"zh-CN": "主线程流畅度检测——读秒 + 0-100 分 + 颜色分层 + 最小化 + AI 卡顿调试(aiti-helper 帮助点);可注入任意站点(内部版/外部版双产物)"
|
|
10
|
+
},
|
|
5
11
|
"soul": "主线程一卡,读秒就停;流畅度一分,忙闲立见——挂在工作页角落,收工点开看平均。",
|
|
12
|
+
"soulI18n": {
|
|
13
|
+
"en": "A stalled main thread stops the clock; one score tells busy from idle."
|
|
14
|
+
},
|
|
6
15
|
"scripts": {
|
|
7
16
|
"build": "node tools/build.mjs",
|
|
8
17
|
"deploy": "node tools/deploy.mjs",
|
|
@@ -10,7 +19,7 @@
|
|
|
10
19
|
},
|
|
11
20
|
"aitiExtProtocol": "1.0",
|
|
12
21
|
"license": "MIT",
|
|
13
|
-
"contentHash": "
|
|
22
|
+
"contentHash": "a7d38d119d3b00f7",
|
|
14
23
|
"repository": {
|
|
15
24
|
"type": "git",
|
|
16
25
|
"url": "git+https://github.com/aiti-ai/aiti-ai.git",
|
package/tools/deploy.mjs
CHANGED
|
@@ -50,6 +50,7 @@ for (const extDir of targets) {
|
|
|
50
50
|
copyFileSync(resolve(root, "icon.svg"), resolve(extDir, "icon.svg"));
|
|
51
51
|
// markdown 描述(extman 详情页渲染;缺文件则详情页无描述块)
|
|
52
52
|
try { copyFileSync(resolve(root, "DESC.md"), resolve(extDir, "DESC.md")); } catch {}
|
|
53
|
+
try { copyFileSync(resolve(root, "DESC.en.md"), resolve(extDir, "DESC.en.md")); } catch {}
|
|
53
54
|
console.log("[deploy] 源码 → " + resolve(extDir, "index.ts"));
|
|
54
55
|
|
|
55
56
|
// 内部版 client(产物统一 dist/,宿主按 index.ts 声明 /assets/dist/… 服务)
|