feat: bind AgentBus work to account workers
This commit is contained in:
1 parent
d034f649c4
commit
6f9fd0f0bd
31 files changed
+1119
-257
No files matched your search
@@ -11,9 +11,12 @@ Chrome Manifest V3 扩展,在用户已登录的 LTJT ERP 页面内执行经过
|
||||
|
||||
## 当前版本
|
||||
|
||||
当前源码版本为 `0.5.163`。版本化 ZIP、文件哈希和 Skill/DOCX 基线见 [`../../dist/release-manifest.json`](../../dist/release-manifest.json)。旧版本实现流水已冻结在 [`../../archive/project-history/2026-08-16/chrome-extension-README.pre-governance.md`](../../archive/project-history/2026-08-16/chrome-extension-README.pre-governance.md)。
|
||||
当前源码版本为 `0.5.164`。版本化 ZIP、文件哈希和 Skill/DOCX 基线见 [`../../dist/release-manifest.json`](../../dist/release-manifest.json)。旧版本实现流水已冻结在 [`../../archive/project-history/2026-08-16/chrome-extension-README.pre-governance.md`](../../archive/project-history/2026-08-16/chrome-extension-README.pre-governance.md)。
|
||||
|
||||
0.5.163 当前重点:
|
||||
0.5.164 当前重点:
|
||||
|
||||
- 平台会把当前员工账号绑定的 ERP 账号随只读 PING 交给扩展核验;扩展只返回是否匹配,不回传页面中的其他账号文本。
|
||||
- 只有平台确认的唯一在线云电脑、匹配的 ERP 登录身份和任务归属账号三者一致时,任务才可领取或回传结果。
|
||||
|
||||
- 保留 `0.5.162` 的稳定态处理:独立团单个下单只有在表单结构、客户/跟单人/销售人三个原生 SelectBox lookup 数据以及页面 jQuery Ajax 全部就绪后才进入预检;`GetProduct` 外层完成后还会等待页面自身 `ajaxStop`,再应用最终业务字段。该门禁使用原生完成事件和失败超时,不使用固定 sleep,也不在 live gate 静默回填。
|
||||
|
||||
|
||||
@@ -1347,7 +1347,8 @@ async function findOrOpenErpTab(taskId = '') {
|
||||
}
|
||||
}
|
||||
|
||||
async function readErpSessionStatus() {
|
||||
async function readErpSessionStatus(expectedErpAccount = '') {
|
||||
const normalizedExpectedAccount = String(expectedErpAccount || '').trim();
|
||||
const permission = await erpHostPermissionStatus();
|
||||
const keepalive = await readErpKeepaliveState();
|
||||
const tabs = await chrome.tabs.query({ url: `${ERP_ORIGIN}/*` });
|
||||
@@ -1356,6 +1357,7 @@ async function readErpSessionStatus() {
|
||||
return {
|
||||
ok: false,
|
||||
tab_present: false,
|
||||
account_configured: Boolean(normalizedExpectedAccount),
|
||||
account_matched: false,
|
||||
url: '',
|
||||
session_ready: null,
|
||||
@@ -1372,6 +1374,7 @@ async function readErpSessionStatus() {
|
||||
return {
|
||||
ok: false,
|
||||
tab_present: true,
|
||||
account_configured: Boolean(normalizedExpectedAccount),
|
||||
account_matched: false,
|
||||
url: tab.url || '',
|
||||
session_ready: false,
|
||||
@@ -1385,16 +1388,18 @@ async function readErpSessionStatus() {
|
||||
try {
|
||||
const [inspection] = await executeErpScript(tab.id, {
|
||||
target: { tabId: tab.id },
|
||||
func: () => {
|
||||
func: (expectedAccount) => {
|
||||
const bodyText = document.body?.innerText || '';
|
||||
return {
|
||||
url: location.href,
|
||||
title: document.title,
|
||||
account_matched: bodyText.includes('测试ai员工账号'),
|
||||
account_configured: Boolean(expectedAccount),
|
||||
account_matched: Boolean(expectedAccount) && bodyText.includes(expectedAccount),
|
||||
login_or_permission_error: Boolean(document.querySelector('input[type="password"]'))
|
||||
|| /login|无权限|权限不足|permission denied/i.test(`${location.href}\n${document.title}\n${bodyText.slice(0, 400)}`)
|
||||
};
|
||||
}
|
||||
},
|
||||
args: [normalizedExpectedAccount]
|
||||
});
|
||||
const inspectionResult = inspection?.result || {
|
||||
url: tab.url || '',
|
||||
@@ -3753,7 +3758,7 @@ chrome.runtime.onConnect.addListener((port) => {
|
||||
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message?.type === 'LTJT_ERP_SESSION_STATUS') {
|
||||
readErpSessionStatus()
|
||||
readErpSessionStatus(message.expected_erp_account || '')
|
||||
.then((result) => sendResponse(result))
|
||||
.catch((error) => sendResponse({
|
||||
ok: false,
|
||||
|
||||
@@ -45,7 +45,7 @@ async function getAutomationState() {
|
||||
};
|
||||
}
|
||||
|
||||
async function bridgePayload(extra = {}) {
|
||||
async function bridgePayload(extra = {}, expectedErpAccount = '') {
|
||||
let erpSession = {
|
||||
ok: false,
|
||||
tab_present: false,
|
||||
@@ -53,7 +53,10 @@ async function bridgePayload(extra = {}) {
|
||||
url: ''
|
||||
};
|
||||
try {
|
||||
erpSession = await chrome.runtime.sendMessage({ type: 'LTJT_ERP_SESSION_STATUS' }) || erpSession;
|
||||
erpSession = await chrome.runtime.sendMessage({
|
||||
type: 'LTJT_ERP_SESSION_STATUS',
|
||||
expected_erp_account: String(expectedErpAccount || '').trim()
|
||||
}) || erpSession;
|
||||
} catch (error) {
|
||||
erpSession = { ...erpSession, message: error.message || String(error) };
|
||||
}
|
||||
@@ -267,7 +270,7 @@ const bridgeHandler = async (event) => {
|
||||
const requestId = message.requestId || '';
|
||||
try {
|
||||
if (message.type === 'PING') {
|
||||
postReply(requestId, 'PONG', await bridgePayload());
|
||||
postReply(requestId, 'PONG', await bridgePayload({}, message.payload?.expected_erp_account));
|
||||
return;
|
||||
}
|
||||
if (message.type === 'CREATE_TASK') {
|
||||
|
||||
@@ -6077,7 +6077,7 @@
|
||||
}
|
||||
|
||||
window.LTJTOrderAssistant = {
|
||||
version: '0.5.163',
|
||||
version: '0.5.164',
|
||||
resolveNativeListSearchValues,
|
||||
lookupKeywordMatchesText,
|
||||
inspectLifecycleSearchCriteria: lifecycleSearchCriteria,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "联泰下单助手",
|
||||
"version": "0.5.163",
|
||||
"version": "0.5.164",
|
||||
"description": "在已登录 LTJT ERP 页面内规划并受控执行联泰 ERP 业务操作。",
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
|
||||
@@ -919,7 +919,7 @@
|
||||
|
||||
window.LTJTOrderAssistant = {
|
||||
...(window.LTJTOrderAssistant || {}),
|
||||
version: '0.5.163',
|
||||
version: '0.5.164',
|
||||
openTeamBatchForm,
|
||||
pingTeamBatchFrame,
|
||||
preflightTeamBatchNative,
|
||||
|
||||
Reference in new issue
Block a user