@tomflow/chatloop-extension 0.3.53 → 0.3.54

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.
@@ -41,7 +41,7 @@ async function sendOnce(target, text) {
41
41
  const expectedMarker=expected.recoveryMode==="TOOL_PREFLIGHT_REPAIRED"
42
42
  ? "[CHAT_LOOP_STATUS:BLOCKED]" : "[CHAT_LOOP_STATUS:CONTINUE]";
43
43
  if (lines.at(-1)?.trim() !== expectedMarker
44
- || (replyText.match(/\[CHAT_LOOP_STATUS:(?:CONTINUE|DONE|BLOCKED)\]/g) || []).length !== 1) {
44
+ || lines.filter(line=>/^\[CHAT_LOOP_STATUS:(?:CONTINUE|DONE|BLOCKED)\]$/.test(line.trim())).length !== 1) {
45
45
  throw Error("CONTINUE_STATUS_CHANGED");
46
46
  }
47
47
  const turnState = scope.getAttribute?.('data-talvt-turn-state');
@@ -87,12 +87,16 @@ async function verifyOldChat(target, summary, mode = "EXPLICIT") {
87
87
  const tailText = entries.slice(-24).filter(item => item !== head).map(item =>
88
88
  (item.role === "user" ? "用户:" : "助手:") + item.text.slice(-3000))
89
89
  .join("\n\n").slice(-21000);
90
- const excerpt = "【原始任务用户消息】\n" + headText
90
+ const excerpt = "【当前可见片段首条用户消息|可能不是原始任务】\n" + headText
91
91
  + "\n\n【最近轮次证据】\n" + tailText;
92
92
  if (excerpt.length < 120) throw Error("SOURCE_CONTEXT_TOO_SHORT");
93
- return {ok: true, snapshot: "【交接参考:只读网页片段,可能截断】\n" + excerpt
93
+ const identity="【来源 Chat】https://chatgpt.com"+expected.page
94
+ +(expected.sessionId?"\n【来源 Session】"+expected.sessionId:"")
95
+ +(expected.projectId?"\n【项目标识】"+expected.projectId:"")
96
+ +(Number.isSafeInteger(expected.generation)?"\n【来源 generation】"+expected.generation:"");
97
+ return {ok: true, snapshot: "【交接参考:只读网页片段,可能截断】\n"+identity+"\n"+excerpt
94
98
  + (handoffMode === "ERROR" ? "\n【中断说明】当前 Chat 明确出现上下文容量错误,最后一条用户消息未收到完整助手回复;任何上轮工具副作用均需先核实,不得盲目重复。" : "")
95
- + "\n【证据边界】此片段不等于完整记录;必须通过实际工具、仓库和来源核对任务进展。"};
99
+ + "\n【证据边界】DOM可能虚拟化,首条可见消息不保证是原始任务,也不能作为新增批准。此片段不等于完整记录;必须通过实际工具、唯一Context和来源核对任务进展。"};
96
100
  }
97
101
  return {ok: true};
98
102
  }, args: [target, summary, mode]
@@ -1022,6 +1022,8 @@ async function onTake(message, sender) {
1022
1022
  handoffMode: run.handoffMode || null, retryMode: run.retryMode || null,
1023
1023
  recoveryMode:run.recoveryMode||null,
1024
1024
  target: {tabId: run.tabId, page: run.page,
1025
+ ...(run.sessionId?{sessionId:run.sessionId,projectId:run.projectId,
1026
+ generation:run.generation||0}:{}),
1025
1027
  recoveryMode:run.recoveryMode||null,
1026
1028
  assistantKey: run.assistantKey,
1027
1029
  userKey: run.retryMode === "NATIVE" || run.handoffMode === "ERROR"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Chat Loop Extension",
4
- "version": "0.3.53",
4
+ "version": "0.3.54",
5
5
  "description": "Chat Loop browser companion: Eye actions, Turn observer, Continue and Handoff Actions",
6
6
  "permissions": [
7
7
  "activeTab",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/chatloop-extension",
3
- "version": "0.3.53",
3
+ "version": "0.3.54",
4
4
  "type": "module",
5
5
  "description": "Chat Loop Extension package: nine formal Action pages and its own native CLI bridge",
6
6
  "bin": {