@tomflow/chatloop-tools 0.9.60 → 0.9.61

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/chatloop-context",
3
- "version": "0.6.23",
3
+ "version": "0.6.24",
4
4
  "type": "module",
5
5
  "description": "Independent local Context SDK and short-lived CLI for Chat Loop projects",
6
6
  "publishConfig": {
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "ps-list": "9.0.0",
37
- "@tomflow/chatloop-extension": "0.4.31",
37
+ "@tomflow/chatloop-extension": "0.4.32",
38
38
  "@tomflow/chatloop-trace": "0.4.6"
39
39
  }
40
40
  }
@@ -48,6 +48,12 @@ handlers and existing trust boundaries. New send/Owner/Native mutation
48
48
  requires a separate authorized security review and implementation; it cannot
49
49
  be enabled by dropping in a capability file. Browser read actions never
50
50
  clear an unknown send result or adopt a different Chat Owner.
51
+ Screenshot uses Chrome `captureVisibleTab` with the existing per-tab user
52
+ invocation (`activeTab`) or already granted capture permission; opening an
53
+ Action page programmatically does not itself grant this permission. Missing
54
+ permission is reported as `CAPTURE_PERMISSION_REQUIRED`, other capture API
55
+ failures as `CAPTURE_API_FAILED`, without exposing raw browser diagnostics.
56
+ Do not broaden host permissions or change the current Owner to obtain a screenshot.
51
57
 
52
58
  ### Validation
53
59
 
@@ -93,7 +99,12 @@ a Worker-only failed Native sync permits at most one additional fenced repair,
93
99
  never a general BLOCKED retry. Two distinct genuine Form A-confirmation
94
100
  user Turns may serve as SOFT R/P evidence in an explicitly
95
101
  specified original Chat; this never substitutes for Context approval or Start
96
- permission. IPC messages are one-shot and have durable identity checks. CLI and Native
102
+ permission. Without a supplied Chat URL, a distinct exact Form A pair in an
103
+ already-open, actively processing P-confirmation Turn can be a candidate.
104
+ The candidate must be unique; Native Context still compares both approval
105
+ sources to the reserved Task before Owner binding. Idle generic Form pairs,
106
+ multiple candidates and mismatched approval sources do not grant an Owner.
107
+ No URL means no Chat creation. IPC messages are one-shot and have durable identity checks. CLI and Native
97
108
  Host resolve the same private `chatloop-extension-v2-<uid>` IPC directory in
98
109
  the fixed system temporary root (macOS `/private/tmp`, Linux `/tmp`),
99
110
  independent of TMPDIR/TMP/TEMP. The prior namespace is retained as historical
@@ -19,7 +19,15 @@ async function saveScreenshot(tab,machine) {
19
19
  if (active?.id !== tab.id) throw Error("TARGET_NOT_VISIBLE");
20
20
  const current = await chrome.tabs.get(tab.id);
21
21
  if (current.url !== tab.url) throw Error("TARGET_CHANGED_BEFORE_CAPTURE");
22
- const dataUrl = await chrome.tabs.captureVisibleTab(tab.windowId, {format: "png"});
22
+ let dataUrl;
23
+ try { dataUrl = await chrome.tabs.captureVisibleTab(tab.windowId, {format: "png"}); }
24
+ catch (error) {
25
+ const message = String(error?.message || '');
26
+ if (/activeTab|<all_urls>|permission|not allowed to capture/i.test(message))
27
+ throw Error('CAPTURE_PERMISSION_REQUIRED');
28
+ if (/^[A-Z][A-Z0-9_]{1,95}$/.test(message)) throw error;
29
+ throw Error('CAPTURE_API_FAILED');
30
+ }
23
31
  if (!dataUrl?.startsWith("data:image/png;base64,")) throw Error("CAPTURE_FAILED");
24
32
  if(machine) { await machineResult(machine,dataUrl.slice("data:image/png;base64,".length)); return; }
25
33
  const stamp = new Date().toISOString().replace(/[:.]/g, "-");
@@ -152,11 +152,18 @@ if (message?.type === "CHAT_LOOP_APPROVAL_EVIDENCE_V1") {
152
152
  ||rIndex>0&&rAssistant?.role!=="assistant"){
153
153
  fail("APPROVAL_REQUIREMENTS_MISSING");return false;
154
154
  }
155
- if(message.expectedTaskId!==undefined){
156
- // A no-URL idle adoption is only eligible for its exact Managed
157
- // Task's TWO native issued approval messages in the same DOM Chat.
155
+ // For a managed no-URL Start the Worker supplies each already-open
156
+ // Chat's own ID. Exact current Form A pairs are *candidates* only while
157
+ // the P-confirmation Turn is live. The Task is NOT inferred from Form
158
+ // prose; Native Context must compare both original approval sources
159
+ // against the reserved Task before any Owner can be committed.
160
+ const task=message.expectedTaskId;
161
+ const formPairCandidate=Boolean(typeof task==='string'
162
+ &&/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/.test(task)
163
+ &&explicitFormChat&&rForm&&pForm);
164
+ if(task!==undefined&&!formPairCandidate){
165
+ // A no-URL idle adoption still needs both Task-scoped issued turns.
158
166
  // No standalone historical affirmations or copied Task summaries.
159
- const task=message.expectedTaskId;
160
167
  const nativeIssue=(row,type)=>typeof task==="string"
161
168
  &&/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/.test(task)
162
169
  &&textOf(row).startsWith(task+"|")
@@ -262,7 +269,8 @@ if (message?.type === "CHAT_LOOP_APPROVAL_EVIDENCE_V1") {
262
269
  &&message.expectedTaskId.length>=8
263
270
  &&issueTask(rUser)===message.expectedTaskId
264
271
  &&issueTask(pUser)===message.expectedTaskId;
265
- if(message.expectedTaskId!==undefined&&!taskScoped){
272
+ if(message.expectedTaskId!==undefined&&!taskScoped
273
+ &&!(formPairCandidate&&(snap.stop||snap.busy)&&!snap.pendingConfirmation)){
266
274
  fail("APPROVAL_TASK_SCOPE_MISMATCH");return false;
267
275
  }
268
276
  const scopedIdle=Boolean(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Chat Loop Extension",
4
- "version": "0.4.31",
4
+ "version": "0.4.32",
5
5
  "description": "Chat Loop browser companion: Eye actions, Turn observer, Continue and Handoff Actions",
6
6
  "permissions": [
7
7
  "activeTab",
@@ -46,7 +46,9 @@ async function approvedAdoptionTarget(chatUrl=null,taskId=null){
46
46
  ||(requestedId && chatIdOf(tab.url)!==requestedId))continue;
47
47
  // No chatUrl means the caller does not authorize opening any Chat.
48
48
  // For the approved Task only, inspect each ALREADY OPEN tab by its own
49
- // immutable Chat ID and require exact native R/P issue-scoped user Turns.
49
+ // immutable Chat ID. An exact live Form A pair may be a candidate, but
50
+ // only the later Native Context permit proves its Task identity. Idle
51
+ // no-URL candidates still require Task-scoped issued user Turns.
50
52
  const scopedId=requestedId||taskId&&chatIdOf(tab.url);
51
53
  const proof=await chrome.tabs.sendMessage(tab.id,
52
54
  {type:"CHAT_LOOP_APPROVAL_EVIDENCE_V1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/chatloop-extension",
3
- "version": "0.4.31",
3
+ "version": "0.4.32",
4
4
  "type": "module",
5
5
  "description": "Chat Loop Extension: reviewed formal Action pages, including TEST_ONLY native App entry",
6
6
  "bin": {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.9.60",
6
+ "version": "0.9.61",
7
7
  "type": "module",
8
8
  "description": "Chat Loop local tools: MCP gateway, isolated bundled tunnel-client and unified CLI",
9
9
  "bin": {
@@ -33,11 +33,11 @@
33
33
  "prepack": "node ./scripts/build-providers.mjs --check && node ./scripts/build-form-app.mjs --check && node ./scripts/build-document-app.mjs --check"
34
34
  },
35
35
  "dependencies": {
36
- "@tomflow/chatloop-context": "0.6.23",
36
+ "@tomflow/chatloop-context": "0.6.24",
37
37
  "@tomflow/chatloop-trace": "0.4.6",
38
38
  "@wonderwhy-er/desktop-commander": "0.2.44",
39
39
  "ps-list": "9.0.0",
40
- "@tomflow/chatloop-extension": "0.4.31"
40
+ "@tomflow/chatloop-extension": "0.4.32"
41
41
  },
42
42
  "bundleDependencies": [
43
43
  "@tomflow/chatloop-context",