@chen-rmag/ai-runner 0.1.1 → 0.1.2
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/core/runner.d.ts +2 -2
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +9 -10
- package/dist/core/runner.js.map +1 -1
- package/dist/types/external.d.ts +1 -1
- package/dist/types/external.d.ts.map +1 -1
- package/package.json +3 -1
- package/playwright-report/index.html +85 -0
- package/src/core/runner.ts +4 -5
- package/src/types/external.ts +1 -1
- package/test-results/.playwright-artifacts-0/107bcb547ab0ead80171878de446b70a.webm +0 -0
- package/test-results/.playwright-artifacts-0/traces/2b44595acb72d064bcfe-d221aa8edff47ebd0467.network +1 -0
- package/test-results/.playwright-artifacts-0/traces/2b44595acb72d064bcfe-d221aa8edff47ebd0467.trace +18 -0
- package/test-results/.playwright-artifacts-0/traces/resources/4d2ccb820d3be7199f10b4f644a17812ff816df0.html +1 -0
- package/test-results/.playwright-artifacts-0/traces/resources/page@3e1e8abed60b2b8d7625139113824703-1768726350530.jpeg +0 -0
- package/test-results/.playwright-artifacts-0/traces/resources/page@3e1e8abed60b2b8d7625139113824703-1768726352500.jpeg +0 -0
- package/tests/agent/test-heal-agent.spec.ts +3 -1
package/src/core/runner.ts
CHANGED
|
@@ -12,10 +12,10 @@ import type {
|
|
|
12
12
|
ExecutionContext
|
|
13
13
|
} from '../types';
|
|
14
14
|
import { HealAgent } from '../agents/heal-agent';
|
|
15
|
-
import { ModelConfigRepository } from '@
|
|
16
|
-
import { TestCaseRepository } from '@ai-test/core-infra/dist/repositories/TestCaseRepository';
|
|
15
|
+
import { ModelConfigRepository, TestCaseRepository } from '@chen-rmag/core-infra';
|
|
17
16
|
import type { ModelConfig } from '../types/external';
|
|
18
17
|
import { ChatAnthropic } from '@langchain/anthropic';
|
|
18
|
+
import { ChatOpenAI } from '@langchain/openai';
|
|
19
19
|
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -372,11 +372,11 @@ export class Runner {
|
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
/**
|
|
375
|
-
*
|
|
375
|
+
* 结束清理自愈过程内容
|
|
376
376
|
*
|
|
377
377
|
* @returns 自愈摘要信息
|
|
378
378
|
*/
|
|
379
|
-
async
|
|
379
|
+
async stop(): Promise<HealSummary> {
|
|
380
380
|
// 等待模型配置加载完成
|
|
381
381
|
await this.modelConfigReady;
|
|
382
382
|
|
|
@@ -536,7 +536,6 @@ export class Runner {
|
|
|
536
536
|
});
|
|
537
537
|
|
|
538
538
|
case 'openai':
|
|
539
|
-
const { ChatOpenAI } = require('@langchain/openai');
|
|
540
539
|
return new ChatOpenAI({
|
|
541
540
|
apiKey: this.modelConfig.apiKey,
|
|
542
541
|
modelName: this.modelConfig.modelName,
|
package/src/types/external.ts
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"resource-snapshot","snapshot":{"pageref":"page@3e1e8abed60b2b8d7625139113824703","startedDateTime":"2026-01-18T08:52:30.589Z","time":2824.679,"request":{"method":"GET","url":"https://example.com/","httpVersion":"HTTP/2.0","cookies":[],"headers":[{"name":":authority","value":"example.com"},{"name":":method","value":"GET"},{"name":":path","value":"/"},{"name":":scheme","value":"https"},{"name":"accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"accept-encoding","value":"gzip, deflate, br, zstd"},{"name":"accept-language","value":"en-US"},{"name":"priority","value":"u=0, i"},{"name":"sec-ch-ua","value":"\"Chromium\";v=\"143\", \"Not A(Brand\";v=\"24\""},{"name":"sec-ch-ua-mobile","value":"?0"},{"name":"sec-ch-ua-platform","value":"\"Windows\""},{"name":"sec-fetch-dest","value":"document"},{"name":"sec-fetch-mode","value":"navigate"},{"name":"sec-fetch-site","value":"none"},{"name":"sec-fetch-user","value":"?1"},{"name":"upgrade-insecure-requests","value":"1"},{"name":"user-agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.7499.4 Safari/537.36"}],"queryString":[],"headersSize":668,"bodySize":0},"response":{"status":200,"statusText":"","httpVersion":"HTTP/2.0","cookies":[],"headers":[{"name":"age","value":"11814"},{"name":"allow","value":"GET, HEAD"},{"name":"cf-cache-status","value":"HIT"},{"name":"cf-ray","value":"9bfcdb566ca8cba4-LAX"},{"name":"content-encoding","value":"gzip"},{"name":"content-type","value":"text/html"},{"name":"date","value":"Sun, 18 Jan 2026 08:52:32 GMT"},{"name":"last-modified","value":"Tue, 13 Jan 2026 19:10:53 GMT"},{"name":"server","value":"cloudflare"},{"name":"vary","value":"Accept-Encoding"}],"content":{"size":513,"mimeType":"text/html","compression":0,"_sha1":"4d2ccb820d3be7199f10b4f644a17812ff816df0.html"},"headersSize":0,"bodySize":550,"redirectURL":"","_transferSize":550},"cache":{},"timings":{"dns":-1,"connect":1311.968,"ssl":1311.117,"send":0,"wait":200.252,"receive":1.342},"_frameref":"frame@bbbe0730c3869fecdabad794c01dc433","_monotonicTime":4574.151,"serverIPAddress":"127.0.0.1","_serverPort":7890,"_securityDetails":{"protocol":"TLS 1.3","subjectName":"example.com","issuer":"Cloudflare TLS Issuing ECC CA 3","validFrom":1765913972,"validTo":1773685964}}}
|
package/test-results/.playwright-artifacts-0/traces/2b44595acb72d064bcfe-d221aa8edff47ebd0467.trace
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{"version":8,"type":"context-options","origin":"library","browserName":"chromium","playwrightVersion":"1.57.0","options":{"noDefaultViewport":false,"viewport":{"width":1280,"height":720},"ignoreHTTPSErrors":false,"javaScriptEnabled":true,"bypassCSP":false,"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.7499.4 Safari/537.36","locale":"en-US","offline":false,"deviceScaleFactor":1,"isMobile":false,"hasTouch":false,"colorScheme":"light","acceptDownloads":"accept","baseURL":"https://example.com","recordVideo":{"dir":"/Users/aihuishou/ai_project/test_agent/ai-runner/test-results/.playwright-artifacts-0","size":{"width":800,"height":450}},"serviceWorkers":"allow","selectorEngines":[],"testIdAttributeName":"data-testid"},"platform":"darwin","wallTime":1768726350068,"monotonicTime":4052.811,"sdkLanguage":"javascript","testIdAttributeName":"data-testid","contextId":"browser-context@9fd4fc41d0b4c14ff6fe4adbf28b3516","title":"tests/agent/test-heal-agent.spec.ts:49 › AIHeal - ReAct Agent 集成 › 应该调用 ReAct Agent 接管执行"}
|
|
2
|
+
{"type":"before","callId":"call@6","startTime":4055.379,"class":"BrowserContext","method":"newPage","params":{},"stepId":"pw:api@33","beforeSnapshot":"before@call@6"}
|
|
3
|
+
{"type":"event","time":4511.149,"class":"BrowserContext","method":"page","params":{"pageId":"page@3e1e8abed60b2b8d7625139113824703"}}
|
|
4
|
+
{"type":"after","callId":"call@6","endTime":4511.205,"result":{"page":"<Page>"},"afterSnapshot":"after@call@6"}
|
|
5
|
+
{"type":"before","callId":"call@8","startTime":4513.919,"class":"Frame","method":"goto","params":{"url":"https://example.com","timeout":0,"waitUntil":"load"},"stepId":"pw:api@34","pageId":"page@3e1e8abed60b2b8d7625139113824703","beforeSnapshot":"before@call@8"}
|
|
6
|
+
{"type":"screencast-frame","pageId":"page@3e1e8abed60b2b8d7625139113824703","sha1":"page@3e1e8abed60b2b8d7625139113824703-1768726350530.jpeg","width":1280,"height":720,"timestamp":4515.65,"frameSwapWallTime":1768726350525.269}
|
|
7
|
+
{"type":"frame-snapshot","snapshot":{"callId":"call@8","snapshotName":"before@call@8","pageId":"page@3e1e8abed60b2b8d7625139113824703","frameId":"frame@bbbe0730c3869fecdabad794c01dc433","frameUrl":"about:blank","html":["HTML",{},["HEAD",{},["BASE",{"href":"about:blank"}]],["BODY"]],"viewport":{"width":1280,"height":720},"timestamp":4522.67,"wallTime":1768726350537,"collectionTime":6.399999998509884,"resourceOverrides":[],"isMainFrame":true}}
|
|
8
|
+
{"type":"log","callId":"call@8","time":4523.71,"message":"navigating to \"https://example.com/\", waiting until \"load\""}
|
|
9
|
+
{"type":"after","callId":"call@8","endTime":6444.064,"result":{"response":"<Response>"},"afterSnapshot":"after@call@8"}
|
|
10
|
+
{"type":"screencast-frame","pageId":"page@3e1e8abed60b2b8d7625139113824703","sha1":"page@3e1e8abed60b2b8d7625139113824703-1768726352500.jpeg","width":1280,"height":720,"timestamp":6485.673,"frameSwapWallTime":1768726352498.813}
|
|
11
|
+
{"type":"frame-snapshot","snapshot":{"callId":"call@8","snapshotName":"after@call@8","pageId":"page@3e1e8abed60b2b8d7625139113824703","frameId":"frame@bbbe0730c3869fecdabad794c01dc433","frameUrl":"https://example.com/","doctype":"html","html":["HTML",{"lang":"en"},["HEAD",{},["BASE",{"href":"https://example.com/"}],["TITLE",{},"Example Domain"],["META",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["STYLE",{},"body{background:#eee;width:60vw;margin:15vh auto;font-family:system-ui,sans-serif}h1{font-size:1.5em}div{opacity:0.8}a:link,a:visited{color:#348}"]],["BODY",{},["DIV",{},["H1",{},"Example Domain"],["P",{},"This domain is for use in documentation examples without needing permission. Avoid use in operations."],["P",{},["A",{"href":"https://iana.org/domains/example"},"Learn more"]]],"\n"]],"viewport":{"width":1280,"height":720},"timestamp":6487.409,"wallTime":1768726352501,"collectionTime":2.5,"resourceOverrides":[],"isMainFrame":true}}
|
|
12
|
+
{"type":"before","callId":"call@10","startTime":11517.101,"class":"Frame","method":"title","params":{},"stepId":"pw:api@35","pageId":"page@3e1e8abed60b2b8d7625139113824703","beforeSnapshot":"before@call@10"}
|
|
13
|
+
{"type":"console","messageType":"error","text":"Failed to load resource: the server responded with a status of 404 ()","args":[],"location":{"url":"https://example.com/favicon.ico","lineNumber":0,"columnNumber":0},"time":11517.867,"pageId":"page@3e1e8abed60b2b8d7625139113824703"}
|
|
14
|
+
{"type":"after","callId":"call@10","endTime":11518.022,"result":{"value":"Example Domain"},"afterSnapshot":"after@call@10"}
|
|
15
|
+
{"type":"before","callId":"call@12","startTime":11521.362,"class":"Frame","method":"click","params":{"selector":"#non-existent","timeout":100},"stepId":"pw:api@37","pageId":"page@3e1e8abed60b2b8d7625139113824703","beforeSnapshot":"before@call@12"}
|
|
16
|
+
{"type":"frame-snapshot","snapshot":{"callId":"call@12","snapshotName":"before@call@12","pageId":"page@3e1e8abed60b2b8d7625139113824703","frameId":"frame@bbbe0730c3869fecdabad794c01dc433","frameUrl":"https://example.com/","doctype":"html","html":[[1,17]],"viewport":{"width":1280,"height":720},"timestamp":11522.079,"wallTime":1768726357537,"collectionTime":0.10000000149011612,"resourceOverrides":[],"isMainFrame":true}}
|
|
17
|
+
{"type":"log","callId":"call@12","time":11522.717,"message":"waiting for locator('#non-existent')"}
|
|
18
|
+
{"type":"after","callId":"call@12","endTime":11623.206,"error":{"message":"Timeout 100ms exceeded.","stack":"TimeoutError: Timeout 100ms exceeded.\n at ProgressController.run (/Users/aihuishou/ai_project/test_agent/ai-runner/node_modules/playwright-core/lib/server/progress.js:68:28)\n at FrameDispatcher._runCommand (/Users/aihuishou/ai_project/test_agent/ai-runner/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js:95:31)\n at DispatcherConnection.dispatch (/Users/aihuishou/ai_project/test_agent/ai-runner/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js:329:39)","name":"TimeoutError"},"afterSnapshot":"after@call@12"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!doctype html><html lang="en"><head><title>Example Domain</title><meta name="viewport" content="width=device-width, initial-scale=1"><style>body{background:#eee;width:60vw;margin:15vh auto;font-family:system-ui,sans-serif}h1{font-size:1.5em}div{opacity:0.8}a:link,a:visited{color:#348}</style><body><div><h1>Example Domain</h1><p>This domain is for use in documentation examples without needing permission. Avoid use in operations.<p><a href="https://iana.org/domains/example">Learn more</a></div></body></html>
|
|
Binary file
|
|
Binary file
|
|
@@ -69,10 +69,12 @@ test.describe('AIHeal - ReAct Agent 集成', () => {
|
|
|
69
69
|
await page.click('#non-existent', { timeout: 100 });
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
+
|
|
73
|
+
|
|
72
74
|
// 验证变量被 Agent 更新
|
|
73
75
|
console.log('userUrl.value:', runner.get('current_url'));
|
|
74
76
|
|
|
75
|
-
const summary = await runner.
|
|
77
|
+
const summary = await runner.stop();
|
|
76
78
|
console.log('summary', summary.modifiedScript);
|
|
77
79
|
});
|
|
78
80
|
|