@ubean/devtools 0.7.4 → 0.7.6
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/client/assets/{browser-agent-rpc-BXhoSh1z-DYzi5afb.js → browser-agent-rpc-BXhoSh1z-dqfZL9hd.js} +1 -1
- package/dist/client/assets/{index-BtMzrmwF.js → index-C-7ywK8q.js} +19 -19
- package/dist/client/index.html +1 -1
- package/dist/index.d.ts +0 -24
- package/dist/index.js +14 -28
- package/package.json +5 -5
package/dist/client/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" href="https://img.soybeanjs.dev/logo-ubean.svg?v=202608192144" type="image/svg+xml" />
|
|
7
7
|
<title>Ubean DevTools</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-C-7ywK8q.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-DtJRaHHQ.css">
|
|
10
10
|
</head>
|
|
11
11
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,7 @@ import { Plugin } from "vite";
|
|
|
2
2
|
import { DevframeDefinition } from "devframe/types";
|
|
3
3
|
import { SharedState } from "devframe/utils/shared-state";
|
|
4
4
|
import "devframe/rpc";
|
|
5
|
-
//#region src/shared/env.d.ts
|
|
6
5
|
export declare function maskSensitiveEnv(env: Record<string, string>): Record<string, string>;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/server/hooks.d.ts
|
|
9
6
|
interface DevToolsHooks {
|
|
10
7
|
beforeCreate: (ctx: CrudHookContext) => void | Promise<void>;
|
|
11
8
|
afterCreate: (ctx: CrudHookContext) => void | Promise<void>;
|
|
@@ -25,8 +22,6 @@ export declare function createDevToolsHooks(): {
|
|
|
25
22
|
callHook: <NameT extends import("hookable").HookKeys<DevToolsHooks>>(name: NameT, ...args: Parameters<import("hookable").InferCallback<DevToolsHooks, NameT>>) => Promise<any> | void;
|
|
26
23
|
};
|
|
27
24
|
type DevToolsHooksInstance = ReturnType<typeof createDevToolsHooks>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/server/crud.d.ts
|
|
30
25
|
interface CrudServerOptions {
|
|
31
26
|
cwd: string;
|
|
32
27
|
hooks?: DevToolsHooksInstance;
|
|
@@ -49,8 +44,6 @@ export declare function createCrudServer(options: CrudServerOptions): {
|
|
|
49
44
|
restore: (path: string) => Promise<CrudResult>;
|
|
50
45
|
};
|
|
51
46
|
type DevToolsCrudServer = ReturnType<typeof createCrudServer>;
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/server/ai.d.ts
|
|
54
47
|
interface AiToolCall {
|
|
55
48
|
id: string;
|
|
56
49
|
name: string;
|
|
@@ -122,8 +115,6 @@ onStreamChunk?: (chunk: AiStreamChunk) => void): {
|
|
|
122
115
|
formatToolResult: (name: string, result: unknown) => string;
|
|
123
116
|
};
|
|
124
117
|
type DevToolsAiServer = ReturnType<typeof createAiServer>;
|
|
125
|
-
//#endregion
|
|
126
|
-
//#region src/node/rpc/playground.d.ts
|
|
127
118
|
interface PlaygroundInvokeParams {
|
|
128
119
|
method: string;
|
|
129
120
|
path: string;
|
|
@@ -136,8 +127,6 @@ interface PlaygroundInvokeResult {
|
|
|
136
127
|
body: unknown;
|
|
137
128
|
headers: Record<string, string>;
|
|
138
129
|
}
|
|
139
|
-
//#endregion
|
|
140
|
-
//#region src/server/terminal.d.ts
|
|
141
130
|
interface TerminalStartParams {
|
|
142
131
|
cwd: string;
|
|
143
132
|
cols?: number;
|
|
@@ -161,8 +150,6 @@ export declare function createTerminalServer(): {
|
|
|
161
150
|
killAll: () => void;
|
|
162
151
|
};
|
|
163
152
|
type TerminalServer = ReturnType<typeof createTerminalServer>;
|
|
164
|
-
//#endregion
|
|
165
|
-
//#region src/types.d.ts
|
|
166
153
|
export interface DevToolsOptions {
|
|
167
154
|
enabled?: boolean;
|
|
168
155
|
port?: number;
|
|
@@ -390,8 +377,6 @@ export interface DevToolsScaffoldOps {
|
|
|
390
377
|
deleteScaffold: (opts: ScaffoldOptions) => Promise<ScaffoldResult>;
|
|
391
378
|
recoverScaffold: (opts: ScaffoldOptions) => Promise<ScaffoldResult>;
|
|
392
379
|
}
|
|
393
|
-
//#endregion
|
|
394
|
-
//#region src/node/state.d.ts
|
|
395
380
|
/** SharedState key for the ubean devtools info snapshot. */
|
|
396
381
|
export declare const UBEAN_INFO_STATE_KEY = "ubean:info";
|
|
397
382
|
/**
|
|
@@ -466,8 +451,6 @@ interface BuildInfoOptions {
|
|
|
466
451
|
export declare function buildDevToolsInfo(opts: BuildInfoOptions): DevToolsInfo;
|
|
467
452
|
/** Initial empty state (used before scan data arrives). */
|
|
468
453
|
export declare function emptyDevToolsInfo(startTime: number): DevToolsInfo;
|
|
469
|
-
//#endregion
|
|
470
|
-
//#region src/node/rpc/types.d.ts
|
|
471
454
|
/**
|
|
472
455
|
* 本包 RPC 的命名空间。所有裸名注册后成为 `<UBEAN_RPC_NAMESPACE>:<bare-name>`。
|
|
473
456
|
*/
|
|
@@ -501,8 +484,6 @@ export declare const UBEAN_ANCHOR_DOCK: {
|
|
|
501
484
|
readonly protocol: "postmessage";
|
|
502
485
|
};
|
|
503
486
|
};
|
|
504
|
-
//#endregion
|
|
505
|
-
//#region src/node/index.d.ts
|
|
506
487
|
/**
|
|
507
488
|
* Options injected by the ubean dev runner so the DevTools plugin can reach
|
|
508
489
|
* Hono-runtime data (scanned routes/pages, the Hono app for in-process
|
|
@@ -580,8 +561,6 @@ interface UbeanDevtoolsPlugin extends Plugin {
|
|
|
580
561
|
readonly __ubeanDevframe: DevframeDefinition;
|
|
581
562
|
}
|
|
582
563
|
export declare function ubeanDevtoolsPlugin(options: UbeanDevtoolsPluginOptions): UbeanDevtoolsPlugin;
|
|
583
|
-
//#endregion
|
|
584
|
-
//#region src/node/rpc/index.d.ts
|
|
585
564
|
interface RpcDeps {
|
|
586
565
|
state: SharedState<DevToolsInfo>;
|
|
587
566
|
getEnvData: () => Record<string, string>;
|
|
@@ -727,8 +706,6 @@ export declare function createAllRpcFunctions(deps: RpcDeps): ({
|
|
|
727
706
|
* 推导。
|
|
728
707
|
*/
|
|
729
708
|
type UbeanRpcFunctions = ReturnType<typeof createAllRpcFunctions>;
|
|
730
|
-
//#endregion
|
|
731
|
-
//#region src/define-tab.d.ts
|
|
732
709
|
/**
|
|
733
710
|
* Custom DevTools tab registration API.
|
|
734
711
|
*
|
|
@@ -746,5 +723,4 @@ interface DevToolsTabDefinition {
|
|
|
746
723
|
export declare function defineDevToolsTab(tab: DevToolsTabDefinition): DevToolsTabDefinition;
|
|
747
724
|
export declare function getCustomTabs(): DevToolsTabDefinition[];
|
|
748
725
|
export declare function clearCustomTabs(): void;
|
|
749
|
-
//#endregion
|
|
750
726
|
export type { AiChatMessage, AiChatResponse, AiToolDefinition, DevToolsAiServer, DevToolsConfigMeta, DevToolsCrudServer, DevToolsHooks, DevToolsHooksInstance, DevToolsTabDefinition, RpcDeps, ScanResultLike, TerminalPollResult, TerminalServer, TerminalStartParams, UbeanDevtoolsPlugin, UbeanDevtoolsPluginOptions, UbeanRpcFunctions };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
import { createHooks } from "hookable";
|
|
5
5
|
import { execSync, spawn } from "node:child_process";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
|
-
|
|
7
|
+
// src/shared/env.ts
|
|
8
8
|
const SENSITIVE_KEY_FRAGMENTS = [
|
|
9
9
|
"KEY",
|
|
10
10
|
"SECRET",
|
|
@@ -20,8 +20,7 @@ function isSensitiveKey(key) {
|
|
|
20
20
|
function maskSensitiveEnv(env) {
|
|
21
21
|
return Object.fromEntries(Object.entries(env).map(([key, value]) => [key, isSensitiveKey(key) ? "***" : value]));
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
//#region src/server/hooks.ts
|
|
23
|
+
// src/server/hooks.ts
|
|
25
24
|
function createDevToolsHooks() {
|
|
26
25
|
const hooks = createHooks();
|
|
27
26
|
function registerHook(type, handler) {
|
|
@@ -707,8 +706,7 @@ You can also ask me questions in natural language, or configure a DeepSeek/OpenA
|
|
|
707
706
|
formatToolResult
|
|
708
707
|
};
|
|
709
708
|
}
|
|
710
|
-
|
|
711
|
-
//#region src/server/crud.ts
|
|
709
|
+
// src/server/crud.ts
|
|
712
710
|
const SCAFFOLD_TYPES = [
|
|
713
711
|
"page",
|
|
714
712
|
"api",
|
|
@@ -1128,8 +1126,7 @@ export default definePlugin({
|
|
|
1128
1126
|
restore
|
|
1129
1127
|
};
|
|
1130
1128
|
}
|
|
1131
|
-
|
|
1132
|
-
//#region src/server/terminal.ts
|
|
1129
|
+
// src/server/terminal.ts
|
|
1133
1130
|
/**
|
|
1134
1131
|
* Terminal session manager — spawns shell processes and buffers output
|
|
1135
1132
|
* for polling-based retrieval by the xterm.js frontend.
|
|
@@ -1318,8 +1315,7 @@ function createTerminalServer() {
|
|
|
1318
1315
|
killAll
|
|
1319
1316
|
};
|
|
1320
1317
|
}
|
|
1321
|
-
|
|
1322
|
-
//#region src/node/rpc/types.ts
|
|
1318
|
+
// src/node/rpc/types.ts
|
|
1323
1319
|
/**
|
|
1324
1320
|
* 身份包装器:校验定义形状,同时**保留 `name` 的字面量类型**。
|
|
1325
1321
|
*
|
|
@@ -1361,8 +1357,7 @@ const UBEAN_ANCHOR_DOCK = {
|
|
|
1361
1357
|
frameId: "ubean",
|
|
1362
1358
|
subTabs: { protocol: "postmessage" }
|
|
1363
1359
|
};
|
|
1364
|
-
|
|
1365
|
-
//#region src/node/rpc/ai.ts
|
|
1360
|
+
// src/node/rpc/ai.ts
|
|
1366
1361
|
/**
|
|
1367
1362
|
* AI RPC functions — `ai-tools` / `ai-chat` / `ai-chat-stream`(裸名,注册到 `ubean` scope)。
|
|
1368
1363
|
*
|
|
@@ -1400,8 +1395,7 @@ function createAiRpcFunctions(ai) {
|
|
|
1400
1395
|
})
|
|
1401
1396
|
];
|
|
1402
1397
|
}
|
|
1403
|
-
|
|
1404
|
-
//#region src/node/rpc/crud.ts
|
|
1398
|
+
// src/node/rpc/crud.ts
|
|
1405
1399
|
/**
|
|
1406
1400
|
* CRUD RPC functions — `crud-create` / `crud-read` / `crud-update` / `crud-delete` /
|
|
1407
1401
|
* `crud-restore`(裸名,注册到 `ubean` scope)。
|
|
@@ -1438,8 +1432,7 @@ function createCrudRpcFunctions(crud) {
|
|
|
1438
1432
|
})
|
|
1439
1433
|
];
|
|
1440
1434
|
}
|
|
1441
|
-
|
|
1442
|
-
//#region src/node/rpc/info.ts
|
|
1435
|
+
// src/node/rpc/info.ts
|
|
1443
1436
|
/**
|
|
1444
1437
|
* Info RPC functions — `get-info` 与 `get-env`(裸名,注册到 `ubean` scope)。
|
|
1445
1438
|
*
|
|
@@ -1461,8 +1454,7 @@ function createInfoRpcFunctions(opts) {
|
|
|
1461
1454
|
setup: () => ({ handler: () => maskSensitiveEnv(opts.getEnvData()) })
|
|
1462
1455
|
})];
|
|
1463
1456
|
}
|
|
1464
|
-
|
|
1465
|
-
//#region src/node/rpc/playground.ts
|
|
1457
|
+
// src/node/rpc/playground.ts
|
|
1466
1458
|
/**
|
|
1467
1459
|
* Playground RPC function — `playground-invoke`(裸名,注册到 `ubean` scope)。
|
|
1468
1460
|
*
|
|
@@ -1507,8 +1499,7 @@ function createPlaygroundRpcFunctions(opts) {
|
|
|
1507
1499
|
} })
|
|
1508
1500
|
})];
|
|
1509
1501
|
}
|
|
1510
|
-
|
|
1511
|
-
//#region src/node/rpc/terminal.ts
|
|
1502
|
+
// src/node/rpc/terminal.ts
|
|
1512
1503
|
/**
|
|
1513
1504
|
* Terminal RPC functions — `terminal-start` / `terminal-input` / `terminal-resize` /
|
|
1514
1505
|
* `terminal-poll` / `terminal-kill`(裸名,注册到 `ubean` scope)。
|
|
@@ -1545,8 +1536,7 @@ function createTerminalRpcFunctions(terminal) {
|
|
|
1545
1536
|
})
|
|
1546
1537
|
];
|
|
1547
1538
|
}
|
|
1548
|
-
|
|
1549
|
-
//#region src/node/rpc/index.ts
|
|
1539
|
+
// src/node/rpc/index.ts
|
|
1550
1540
|
/**
|
|
1551
1541
|
* 全部 RPC 定义(裸名)。`setup` 里逐个 `ctx.scope('ubean').rpc.register(fn)`。
|
|
1552
1542
|
*/
|
|
@@ -1562,8 +1552,7 @@ function createAllRpcFunctions(deps) {
|
|
|
1562
1552
|
...createTerminalRpcFunctions(deps.terminal)
|
|
1563
1553
|
];
|
|
1564
1554
|
}
|
|
1565
|
-
|
|
1566
|
-
//#region src/node/state.ts
|
|
1555
|
+
// src/node/state.ts
|
|
1567
1556
|
/**
|
|
1568
1557
|
* SharedState management for the DTK integration.
|
|
1569
1558
|
*
|
|
@@ -1694,8 +1683,7 @@ function refreshSharedState(state, info) {
|
|
|
1694
1683
|
Object.assign(draft, info);
|
|
1695
1684
|
});
|
|
1696
1685
|
}
|
|
1697
|
-
|
|
1698
|
-
//#region src/node/index.ts
|
|
1686
|
+
// src/node/index.ts
|
|
1699
1687
|
/**
|
|
1700
1688
|
* Path to the pre-built client SPA. Resolved relative to the built server
|
|
1701
1689
|
* bundle (`dist/index.js`), so this points to `dist/client/` at runtime.
|
|
@@ -1850,8 +1838,7 @@ function snapshotEnv(cwd) {
|
|
|
1850
1838
|
for (const [key, value] of Object.entries(process.env)) if (typeof value === "string" && (key in env || key.startsWith("UBEAN_"))) env[key] = value;
|
|
1851
1839
|
return env;
|
|
1852
1840
|
}
|
|
1853
|
-
|
|
1854
|
-
//#region src/define-tab.ts
|
|
1841
|
+
// src/define-tab.ts
|
|
1855
1842
|
/**
|
|
1856
1843
|
* 自定义 tab 注册表 —— **真·进程单例**(挂在 `globalThis` 上)。
|
|
1857
1844
|
*
|
|
@@ -1885,5 +1872,4 @@ function getCustomTabs() {
|
|
|
1885
1872
|
function clearCustomTabs() {
|
|
1886
1873
|
getCustomTabsRegistry().length = 0;
|
|
1887
1874
|
}
|
|
1888
|
-
//#endregion
|
|
1889
1875
|
export { UBEAN_AI_STREAM_STATE_KEY, UBEAN_ANCHOR_DOCK, UBEAN_INFO_STATE_KEY, UBEAN_RPC_NAMESPACE, buildDevToolsInfo, clearCustomTabs, createAiServer, createAllRpcFunctions, createCrudServer, createDevToolsHooks, createTerminalServer, createUbeanDevframe, defineDevToolsTab, emptyDevToolsInfo, getCustomTabs, maskSensitiveEnv, ubeanDevtoolsPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/devtools",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "DevTools for the ubean framework — server middleware, RPC, and the iframe SPA client",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"hono": "4.13.13",
|
|
42
42
|
"typescript": "npm:typescript-native-bridge@latest",
|
|
43
43
|
"unocss": "^66.11.0",
|
|
44
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
45
|
-
"vite-plus": "1.
|
|
44
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
45
|
+
"vite-plus": "1.4.0",
|
|
46
46
|
"vue": "^3.5.44"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@ai-sdk/openai-compatible": "3.0.
|
|
62
|
-
"ai": "7.0.
|
|
61
|
+
"@ai-sdk/openai-compatible": "3.0.77",
|
|
62
|
+
"ai": "7.0.152"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "pnpm run build:server && pnpm run build:client",
|