test-wuying-agentbay-sdk 0.13.1-beta.20251224100120 → 0.13.1-beta.20251224113236

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.
@@ -43,6 +43,7 @@ demonstrateLogging().catch(console.error);
43
43
  ### Properties
44
44
 
45
45
  - `enableConsole`
46
+ - `format`
46
47
  - `level`
47
48
  - `logFile`
48
49
  - `maxFileSize`
@@ -55,6 +56,12 @@ demonstrateLogging().catch(console.error);
55
56
 
56
57
  ___
57
58
 
59
+ ### format
60
+
61
+ • `Optional` **format**: `string`
62
+
63
+ ___
64
+
58
65
  ### level
59
66
 
60
67
  • `Optional` **level**: ``LogLevel``
@@ -315,8 +315,6 @@ if (result.success) {
315
315
  }
316
316
  ```
317
317
 
318
- ___
319
-
320
318
  ### info
321
319
 
322
320
  ▸ **info**(): `Promise`\<`OperationResult`\>
@@ -20,6 +20,7 @@ examples/
20
20
  │ │ └── get/ # Session retrieval
21
21
  │ └── advanced/ # Advanced features
22
22
  │ ├── agent-module-example/ # AI-powered automation
23
+ │ ├── session-metrics/ # Runtime metrics via MCP get_metrics
23
24
  │ ├── vpc-session-example/ # Secure isolated network environments
24
25
  │ └── archive-upload-mode-example/ # Archive upload mode
25
26
  ├── browser-use/ # Browser automation (browser_latest)
@@ -0,0 +1,19 @@
1
+ # Session Metrics Example (TypeScript)
2
+
3
+ This example demonstrates how to retrieve **runtime metrics** for a session using `session.getMetrics()`.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js 16+
8
+ - AgentBay API Key (set as environment variable `AGENTBAY_API_KEY`)
9
+
10
+ ## Run
11
+
12
+ ```bash
13
+ export AGENTBAY_API_KEY=your_api_key_here
14
+
15
+ cd typescript/docs/examples/common-features/advanced/session-metrics
16
+ npx ts-node main.ts
17
+ ```
18
+
19
+
@@ -0,0 +1,33 @@
1
+ import { AgentBay } from "wuying-agentbay-sdk";
2
+
3
+ async function main(): Promise<void> {
4
+ const apiKey = process.env.AGENTBAY_API_KEY;
5
+ if (!apiKey) {
6
+ throw new Error("AGENTBAY_API_KEY environment variable is not set");
7
+ }
8
+
9
+ const agentBay = new AgentBay({ apiKey });
10
+ const create = await agentBay.create({ imageId: "linux_latest" });
11
+ if (!create.success || !create.session) {
12
+ throw new Error(create.errorMessage || "failed to create session");
13
+ }
14
+
15
+ const session = create.session;
16
+ try {
17
+ const metrics = await session.getMetrics();
18
+ if (!metrics.success) {
19
+ throw new Error(metrics.errorMessage || "getMetrics failed");
20
+ }
21
+ console.log(metrics.data);
22
+ } finally {
23
+ await session.delete();
24
+ }
25
+ }
26
+
27
+ main().catch((err) => {
28
+ // eslint-disable-next-line no-console
29
+ console.error(err);
30
+ process.exit(1);
31
+ });
32
+
33
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-wuying-agentbay-sdk",
3
- "version": "0.13.1-beta.20251224100120",
3
+ "version": "0.13.1-beta.20251224113236",
4
4
  "description": "TypeScript SDK for interacting with the Wuying AgentBay cloud runtime environment",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",