@arbidocs/blocks 0.5.126 → 0.5.128
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/README.md +19 -0
- package/dist/{ConnectedCallDock-733O5M36.cjs → ConnectedCallDock-XJOYVVAH.cjs} +5 -5
- package/dist/{ConnectedCallDock-733O5M36.cjs.map → ConnectedCallDock-XJOYVVAH.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-TAUGSRGV.cjs → ConnectedCallRoom-CUDYAPQK.cjs} +5 -5
- package/dist/{ConnectedCallRoom-TAUGSRGV.cjs.map → ConnectedCallRoom-CUDYAPQK.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-HDE522YC.cjs → ConnectedNativeDocxComparison-JUF2TI2P.cjs} +9 -9
- package/dist/{ConnectedNativeDocxComparison-HDE522YC.cjs.map → ConnectedNativeDocxComparison-JUF2TI2P.cjs.map} +1 -1
- package/dist/ConnectedPresentation-SI3L77J4.cjs +1 -1
- package/dist/{ConnectedSlidesTab-JSPU6EY5.cjs → ConnectedSlidesTab-E76OVY34.cjs} +3 -3
- package/dist/{ConnectedSlidesTab-JSPU6EY5.cjs.map → ConnectedSlidesTab-E76OVY34.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-4FHPOAFZ.cjs → ConnectedStreamedWordArtifact-Q64DRRQD.cjs} +9 -9
- package/dist/{ConnectedStreamedWordArtifact-4FHPOAFZ.cjs.map → ConnectedStreamedWordArtifact-Q64DRRQD.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-BDNXP3D4.cjs → DocumentReviewCard-M53XFLI2.cjs} +4 -4
- package/dist/{DocumentReviewCard-BDNXP3D4.cjs.map → DocumentReviewCard-M53XFLI2.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-WQRNSKWM.cjs → FilesViewerDialog-C7XHGK36.cjs} +9 -9
- package/dist/{FilesViewerDialog-WQRNSKWM.cjs.map → FilesViewerDialog-C7XHGK36.cjs.map} +1 -1
- package/dist/{NativeDocxEditor-SUDULUN3.cjs → NativeDocxEditor-2PTEK6ND.cjs} +6 -6
- package/dist/{NativeDocxEditor-SUDULUN3.cjs.map → NativeDocxEditor-2PTEK6ND.cjs.map} +1 -1
- package/dist/WorkspaceTableView-3XYAV4BV.cjs +1 -1
- package/dist/agents/index.cjs +1 -1
- package/dist/ai-IEIR7SC2.cjs +1 -1
- package/dist/calls/index.cjs +2 -2
- package/dist/{chunk-Q6N5D3R5.cjs → chunk-23I5EUZA.cjs} +45 -15
- package/dist/chunk-23I5EUZA.cjs.map +1 -0
- package/dist/{chunk-KXIRVKCJ.cjs → chunk-ERRXU2HL.cjs} +38 -6
- package/dist/chunk-ERRXU2HL.cjs.map +1 -0
- package/dist/{chunk-6B4CCDDB.cjs → chunk-ESVRVZ53.cjs} +5 -5
- package/dist/{chunk-6B4CCDDB.cjs.map → chunk-ESVRVZ53.cjs.map} +1 -1
- package/dist/{chunk-KA3F6TIH.cjs → chunk-IWHP7FAB.cjs} +12 -5
- package/dist/chunk-IWHP7FAB.cjs.map +1 -0
- package/dist/{chunk-OHHKBURG.cjs → chunk-IWMHQTVL.cjs} +401 -18
- package/dist/chunk-IWMHQTVL.cjs.map +1 -0
- package/dist/{chunk-FGOJBOZX.cjs → chunk-IZJ5L246.cjs} +4 -4
- package/dist/{chunk-FGOJBOZX.cjs.map → chunk-IZJ5L246.cjs.map} +1 -1
- package/dist/{chunk-I4X72WUT.cjs → chunk-MMSHIIKG.cjs} +6 -6
- package/dist/{chunk-I4X72WUT.cjs.map → chunk-MMSHIIKG.cjs.map} +1 -1
- package/dist/{chunk-LXM5QXII.cjs → chunk-MXBXZXXQ.cjs} +3 -3
- package/dist/{chunk-LXM5QXII.cjs.map → chunk-MXBXZXXQ.cjs.map} +1 -1
- package/dist/{chunk-463QM764.cjs → chunk-NG2EE7HR.cjs} +3 -3
- package/dist/{chunk-463QM764.cjs.map → chunk-NG2EE7HR.cjs.map} +1 -1
- package/dist/chunk-NTDQQLDD.cjs +18 -0
- package/dist/{chunk-OALQGO5C.cjs.map → chunk-NTDQQLDD.cjs.map} +1 -1
- package/dist/{chunk-XNB27POJ.cjs → chunk-Q6IKXWPG.cjs} +4 -4
- package/dist/{chunk-XNB27POJ.cjs.map → chunk-Q6IKXWPG.cjs.map} +1 -1
- package/dist/{chunk-LOB2ATS5.cjs → chunk-VLQCLQAS.cjs} +5 -5
- package/dist/{chunk-LOB2ATS5.cjs.map → chunk-VLQCLQAS.cjs.map} +1 -1
- package/dist/{chunk-4KEQ62SL.cjs → chunk-YP5EBGLU.cjs} +6 -6
- package/dist/{chunk-4KEQ62SL.cjs.map → chunk-YP5EBGLU.cjs.map} +1 -1
- package/dist/{chunk-FB3JXSQT.cjs → chunk-ZQNTYINE.cjs} +10 -10
- package/dist/{chunk-FB3JXSQT.cjs.map → chunk-ZQNTYINE.cjs.map} +1 -1
- package/dist/{chunk-CMPHJRVV.cjs → chunk-ZYGAXD3N.cjs} +3 -3
- package/dist/{chunk-CMPHJRVV.cjs.map → chunk-ZYGAXD3N.cjs.map} +1 -1
- package/dist/connect/docx.cjs +13 -13
- package/dist/connect/index.cjs +245 -299
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +7 -7
- package/dist/connection/conversation/MermaidDiagram.js +11 -2
- package/dist/connection/conversation/MermaidDiagram.js.map +2 -2
- package/dist/connection/conversation/download-mermaid.d.ts +2 -0
- package/dist/connection/conversation/download-mermaid.js +29 -0
- package/dist/connection/conversation/download-mermaid.js.map +7 -0
- package/dist/connection/remote-control/ConnectedRemoteControlConsent.js +6 -3
- package/dist/connection/remote-control/ConnectedRemoteControlConsent.js.map +2 -2
- package/dist/connection/remote-control/ConnectedRemoteControlIndicator.js +12 -2
- package/dist/connection/remote-control/ConnectedRemoteControlIndicator.js.map +2 -2
- package/dist/connection/remote-control/ConnectedRemoteControlSwitch.js +1 -1
- package/dist/connection/remote-control/ConnectedRemoteControlSwitch.js.map +1 -1
- package/dist/connection/remote-control/browser-diagnostics.d.ts +7 -0
- package/dist/connection/remote-control/browser-diagnostics.js +109 -0
- package/dist/connection/remote-control/browser-diagnostics.js.map +7 -0
- package/dist/connection/remote-control/remoteControl.d.ts +9 -1
- package/dist/connection/remote-control/remoteControl.js +146 -10
- package/dist/connection/remote-control/remoteControl.js.map +2 -2
- package/dist/connection/remote-control/screen-sharing.d.ts +11 -0
- package/dist/connection/remote-control/screen-sharing.js +78 -0
- package/dist/connection/remote-control/screen-sharing.js.map +7 -0
- package/dist/connection/report-problem/screen-capture.d.ts +1 -0
- package/dist/connection/report-problem/screen-capture.js +2 -1
- package/dist/connection/report-problem/screen-capture.js.map +2 -2
- package/dist/docx/NativeDocxEditor.js +14 -12
- package/dist/docx/NativeDocxEditor.js.map +2 -2
- package/dist/docx/index.cjs +38 -38
- package/dist/docx/useVersionAutosave.d.ts +10 -0
- package/dist/docx/useVersionAutosave.js +36 -0
- package/dist/docx/useVersionAutosave.js.map +7 -0
- package/dist/embed/index.cjs +10 -10
- package/dist/facts/index.cjs +43 -43
- package/dist/index.cjs +94 -94
- package/dist/settings/index.cjs +1 -1
- package/dist/shell/RemoteControlPill.d.ts +2 -1
- package/dist/shell/RemoteControlPill.js +10 -3
- package/dist/shell/RemoteControlPill.js.map +2 -2
- package/dist/shell/index.cjs +21 -21
- package/dist/studio/index.cjs +1 -1
- package/dist/workflow-canvas/index.cjs +12 -12
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/chunk-KA3F6TIH.cjs.map +0 -1
- package/dist/chunk-KXIRVKCJ.cjs.map +0 -1
- package/dist/chunk-OALQGO5C.cjs +0 -18
- package/dist/chunk-OHHKBURG.cjs.map +0 -1
- package/dist/chunk-Q6N5D3R5.cjs.map +0 -1
|
@@ -6,7 +6,7 @@ var chunk7NLO7ASW_cjs = require('./chunk-7NLO7ASW.cjs');
|
|
|
6
6
|
var chunk7PN3YENO_cjs = require('./chunk-7PN3YENO.cjs');
|
|
7
7
|
var chunkTJY7XPDE_cjs = require('./chunk-TJY7XPDE.cjs');
|
|
8
8
|
var chunkXNW62J54_cjs = require('./chunk-XNW62J54.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkERRXU2HL_cjs = require('./chunk-ERRXU2HL.cjs');
|
|
10
10
|
var chunkT73BHNQX_cjs = require('./chunk-T73BHNQX.cjs');
|
|
11
11
|
var chunk223D4727_cjs = require('./chunk-223D4727.cjs');
|
|
12
12
|
var chunkQQMMCXBP_cjs = require('./chunk-QQMMCXBP.cjs');
|
|
@@ -61,20 +61,358 @@ var renderConnectedUser = (user, { tooltip, variant = "icon" }) => /* @__PURE__
|
|
|
61
61
|
showTooltip: tooltip
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
// src/connection/report-problem/screen-capture.ts
|
|
66
|
+
var ScreenCaptureError = class extends Error {
|
|
67
|
+
constructor(code, message) {
|
|
68
|
+
super(message);
|
|
69
|
+
this.code = code;
|
|
70
|
+
this.name = "ScreenCaptureError";
|
|
71
|
+
}
|
|
72
|
+
code;
|
|
73
|
+
};
|
|
74
|
+
function canCaptureScreen() {
|
|
75
|
+
return typeof navigator !== "undefined" && !!navigator.mediaDevices?.getDisplayMedia;
|
|
76
|
+
}
|
|
77
|
+
async function captureCurrentTab() {
|
|
78
|
+
if (!canCaptureScreen()) {
|
|
79
|
+
throw new ScreenCaptureError("unsupported", "This browser can't capture the screen.");
|
|
80
|
+
}
|
|
81
|
+
let stream;
|
|
82
|
+
try {
|
|
83
|
+
stream = await navigator.mediaDevices.getDisplayMedia({
|
|
84
|
+
video: { displaySurface: "browser" },
|
|
85
|
+
audio: false,
|
|
86
|
+
// Chromium hints: offer this tab first, and don't let the person switch surfaces mid-capture.
|
|
87
|
+
preferCurrentTab: true,
|
|
88
|
+
selfBrowserSurface: "include",
|
|
89
|
+
surfaceSwitching: "exclude"
|
|
90
|
+
});
|
|
91
|
+
} catch (error) {
|
|
92
|
+
const name = error instanceof DOMException ? error.name : "";
|
|
93
|
+
if (name === "NotAllowedError" || name === "AbortError") {
|
|
94
|
+
throw new ScreenCaptureError("cancelled", "Screen capture was cancelled.");
|
|
95
|
+
}
|
|
96
|
+
throw new ScreenCaptureError("failed", "Couldn't start screen capture.");
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
return await grabFrame(stream);
|
|
100
|
+
} finally {
|
|
101
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function grabFrame(stream) {
|
|
105
|
+
const video = document.createElement("video");
|
|
106
|
+
video.muted = true;
|
|
107
|
+
video.playsInline = true;
|
|
108
|
+
video.srcObject = stream;
|
|
109
|
+
await video.play();
|
|
110
|
+
for (let i = 0; i < 50 && (!video.videoWidth || !video.videoHeight); i++) {
|
|
111
|
+
await new Promise((resolve) => setTimeout(resolve, 40));
|
|
112
|
+
}
|
|
113
|
+
await new Promise((resolve) => requestAnimationFrame(() => resolve(null)));
|
|
114
|
+
const canvas = document.createElement("canvas");
|
|
115
|
+
canvas.width = video.videoWidth;
|
|
116
|
+
canvas.height = video.videoHeight;
|
|
117
|
+
const ctx = canvas.getContext("2d");
|
|
118
|
+
if (!ctx || !canvas.width) throw new ScreenCaptureError("failed", "Couldn't read the screen.");
|
|
119
|
+
ctx.drawImage(video, 0, 0);
|
|
120
|
+
video.srcObject = null;
|
|
121
|
+
return canvasToBlob(canvas);
|
|
122
|
+
}
|
|
123
|
+
function canvasToBlob(canvas) {
|
|
124
|
+
return new Promise(
|
|
125
|
+
(resolve, reject) => canvas.toBlob(
|
|
126
|
+
(blob) => blob ? resolve(blob) : reject(new ScreenCaptureError("failed", "Couldn't save the image.")),
|
|
127
|
+
"image/png"
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// src/connection/remote-control/browser-diagnostics.ts
|
|
133
|
+
function collectBrowserDiagnostics() {
|
|
134
|
+
const lines = [];
|
|
135
|
+
const add = (message) => {
|
|
136
|
+
lines.push(`${(/* @__PURE__ */ new Date()).toISOString()} ${sanitizeDiagnostic(message).slice(0, 1800)}`);
|
|
137
|
+
if (lines.length > 30) lines.shift();
|
|
138
|
+
};
|
|
139
|
+
const stringify = (value) => {
|
|
140
|
+
if (value instanceof Error)
|
|
141
|
+
return chunkT73BHNQX_cjs.formatErrorReport({ error: value, url: safeUrl(location.href) });
|
|
142
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
|
|
143
|
+
return String(value);
|
|
144
|
+
return "[object omitted]";
|
|
145
|
+
};
|
|
146
|
+
const originalError = console.error;
|
|
147
|
+
const originalWarn = console.warn;
|
|
148
|
+
const error = (...args) => {
|
|
149
|
+
add(`error: ${args.map(stringify).join(" ")}`);
|
|
150
|
+
originalError.apply(console, args);
|
|
151
|
+
};
|
|
152
|
+
const warn = (...args) => {
|
|
153
|
+
add(`warning: ${args.map(stringify).join(" ")}`);
|
|
154
|
+
originalWarn.apply(console, args);
|
|
155
|
+
};
|
|
156
|
+
console.error = error;
|
|
157
|
+
console.warn = warn;
|
|
158
|
+
const onError = (event) => add(`uncaught: ${stringify(event.error ?? event.message)}`);
|
|
159
|
+
const onRejection = (event) => add(`unhandled rejection: ${stringify(event.reason)}`);
|
|
160
|
+
window.addEventListener("error", onError);
|
|
161
|
+
window.addEventListener("unhandledrejection", onRejection);
|
|
162
|
+
const originalFetch = window.fetch;
|
|
163
|
+
const wrappedFetch = async (...args) => {
|
|
164
|
+
const input = args[0];
|
|
165
|
+
const url = safeUrl(
|
|
166
|
+
typeof input === "string" ? input : input instanceof URL ? input.href : input.url
|
|
167
|
+
);
|
|
168
|
+
try {
|
|
169
|
+
const response = await originalFetch.apply(window, args);
|
|
170
|
+
if (!response.ok) add(`HTTP ${response.status}: ${url}`);
|
|
171
|
+
return response;
|
|
172
|
+
} catch (failure) {
|
|
173
|
+
add(`request failed: ${url}`);
|
|
174
|
+
throw failure;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
window.fetch = wrappedFetch;
|
|
178
|
+
let resources;
|
|
179
|
+
if (typeof PerformanceObserver !== "undefined") {
|
|
180
|
+
try {
|
|
181
|
+
resources = new PerformanceObserver((list) => {
|
|
182
|
+
for (const entry of list.getEntries()) {
|
|
183
|
+
const resource = entry;
|
|
184
|
+
if ("responseStatus" in resource && Number(resource.responseStatus) >= 400)
|
|
185
|
+
add(`HTTP ${resource.responseStatus}: ${safeUrl(resource.name)}`);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
resources.observe({ type: "resource" });
|
|
189
|
+
} catch {
|
|
190
|
+
resources = void 0;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
snapshot: () => [
|
|
195
|
+
`ARBI tab: ${safeUrl(location.href)}`,
|
|
196
|
+
`Viewport: ${innerWidth} x ${innerHeight}; DPR ${devicePixelRatio}`,
|
|
197
|
+
"Visible ARBI controls (selectors for control_ui):",
|
|
198
|
+
...Array.from(
|
|
199
|
+
document.querySelectorAll(
|
|
200
|
+
'button[data-testid],a[data-testid],input[data-testid]:not([type="password"]),select[data-testid],[role="button"][data-testid]'
|
|
201
|
+
)
|
|
202
|
+
).filter(
|
|
203
|
+
(el) => el.getBoundingClientRect().width > 0 && !el.closest("[data-remote-control-surface]")
|
|
204
|
+
).slice(0, 60).map(
|
|
205
|
+
(el) => `[data-testid=${JSON.stringify(el.dataset.testid)}] ${sanitizeDiagnostic(el.getAttribute("aria-label") ?? el.getAttribute("title") ?? el.textContent ?? "").slice(0, 80)}`
|
|
206
|
+
),
|
|
207
|
+
...lines
|
|
208
|
+
].join("\n").slice(-18e3),
|
|
209
|
+
stop: () => {
|
|
210
|
+
if (console.error === error) console.error = originalError;
|
|
211
|
+
if (console.warn === warn) console.warn = originalWarn;
|
|
212
|
+
if (window.fetch === wrappedFetch) window.fetch = originalFetch;
|
|
213
|
+
window.removeEventListener("error", onError);
|
|
214
|
+
window.removeEventListener("unhandledrejection", onRejection);
|
|
215
|
+
resources?.disconnect();
|
|
216
|
+
lines.length = 0;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function safeUrl(value) {
|
|
221
|
+
try {
|
|
222
|
+
const url = new URL(value, location.href);
|
|
223
|
+
return `${url.origin}${url.pathname}`;
|
|
224
|
+
} catch {
|
|
225
|
+
return "[invalid URL]";
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function sanitizeDiagnostic(value) {
|
|
229
|
+
return value.replace(/https?:\/\/[^\s<>"']+/g, (url) => safeUrl(url)).replace(/\bBearer\s+[^\s,;]+/gi, "Bearer [redacted]").replace(
|
|
230
|
+
/\b(token|password|secret|authorization|api[_-]?key)\s*[:=]\s*[^\s,;]+/gi,
|
|
231
|
+
"$1=[redacted]"
|
|
232
|
+
).replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[redacted token]");
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/connection/remote-control/screen-sharing.ts
|
|
236
|
+
function createScreenSharing() {
|
|
237
|
+
let stream = null;
|
|
238
|
+
let diagnostics = null;
|
|
239
|
+
let generation = 0;
|
|
240
|
+
const stop = () => {
|
|
241
|
+
generation++;
|
|
242
|
+
const previous = stream;
|
|
243
|
+
stream = null;
|
|
244
|
+
previous?.getTracks().forEach((track) => track.stop());
|
|
245
|
+
diagnostics?.stop();
|
|
246
|
+
diagnostics = null;
|
|
247
|
+
};
|
|
248
|
+
return {
|
|
249
|
+
get active() {
|
|
250
|
+
return !!stream?.getVideoTracks().some((track) => track.readyState === "live");
|
|
251
|
+
},
|
|
252
|
+
async start(onEnded) {
|
|
253
|
+
const token = ++generation;
|
|
254
|
+
if (!navigator.mediaDevices?.getDisplayMedia)
|
|
255
|
+
throw new ScreenCaptureError(
|
|
256
|
+
"unsupported",
|
|
257
|
+
"Screen sharing is unavailable in this browser."
|
|
258
|
+
);
|
|
259
|
+
const next = await navigator.mediaDevices.getDisplayMedia({
|
|
260
|
+
video: { displaySurface: "browser" },
|
|
261
|
+
audio: false,
|
|
262
|
+
preferCurrentTab: true,
|
|
263
|
+
selfBrowserSurface: "include",
|
|
264
|
+
surfaceSwitching: "exclude"
|
|
265
|
+
});
|
|
266
|
+
if (token !== generation) {
|
|
267
|
+
next.getTracks().forEach((track) => track.stop());
|
|
268
|
+
throw new ScreenCaptureError("cancelled", "Sharing stopped.");
|
|
269
|
+
}
|
|
270
|
+
stream = next;
|
|
271
|
+
diagnostics = collectBrowserDiagnostics();
|
|
272
|
+
next.getVideoTracks().forEach(
|
|
273
|
+
(track) => track.addEventListener(
|
|
274
|
+
"ended",
|
|
275
|
+
() => {
|
|
276
|
+
if (stream === next) {
|
|
277
|
+
stop();
|
|
278
|
+
onEnded();
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{ once: true }
|
|
282
|
+
)
|
|
283
|
+
);
|
|
284
|
+
},
|
|
285
|
+
async frame() {
|
|
286
|
+
if (!stream) throw new ScreenCaptureError("cancelled", "Sharing stopped.");
|
|
287
|
+
const token = generation;
|
|
288
|
+
const blob = await grabFrame(stream);
|
|
289
|
+
if (token !== generation) throw new ScreenCaptureError("cancelled", "Sharing stopped.");
|
|
290
|
+
if (blob.size > 8 * 1024 * 1024)
|
|
291
|
+
throw new ScreenCaptureError(
|
|
292
|
+
"failed",
|
|
293
|
+
"The shared screen image is too large. Share a smaller window."
|
|
294
|
+
);
|
|
295
|
+
const screenshot_png = await new Promise((resolve, reject) => {
|
|
296
|
+
const reader = new FileReader();
|
|
297
|
+
reader.onload = () => resolve(String(reader.result).split(",")[1]);
|
|
298
|
+
reader.onerror = () => reject(new Error("Could not read the screen frame."));
|
|
299
|
+
reader.readAsDataURL(blob);
|
|
300
|
+
});
|
|
301
|
+
if (token !== generation) throw new ScreenCaptureError("cancelled", "Sharing stopped.");
|
|
302
|
+
return { screenshot_png, diagnostics: diagnostics?.snapshot() ?? "" };
|
|
303
|
+
},
|
|
304
|
+
stop
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// src/connection/remote-control/remoteControl.ts
|
|
309
|
+
var screenRuntimes = /* @__PURE__ */ new WeakMap();
|
|
310
|
+
function screenRuntime(session) {
|
|
311
|
+
let runtime = screenRuntimes.get(session);
|
|
312
|
+
if (!runtime) {
|
|
313
|
+
runtime = { sharing: createScreenSharing(), generation: 0, setup: "", opening: false };
|
|
314
|
+
screenRuntimes.set(session, runtime);
|
|
315
|
+
}
|
|
316
|
+
return runtime;
|
|
317
|
+
}
|
|
318
|
+
function stopScreen(session) {
|
|
319
|
+
const runtime = screenRuntimes.get(session);
|
|
320
|
+
if (!runtime) return;
|
|
321
|
+
runtime.generation++;
|
|
322
|
+
runtime.sharing.stop();
|
|
323
|
+
runtime.setup = "";
|
|
324
|
+
runtime.opening = false;
|
|
325
|
+
const actions = react.remoteControlActions(session);
|
|
326
|
+
if (react.remoteControlStateOf(session.getState()).sharing) actions.setSharing(false);
|
|
327
|
+
}
|
|
328
|
+
function createRemoteControl(session, guided, screenTransport) {
|
|
65
329
|
const actions = react.remoteControlActions(session);
|
|
66
330
|
const state = () => react.remoteControlStateOf(session.getState());
|
|
331
|
+
const runtime = screenRuntime(session);
|
|
332
|
+
const reply = async (req, status) => {
|
|
333
|
+
if ((req.screenRequestId || req.actionRequestId) && screenTransport) {
|
|
334
|
+
await screenTransport.reply(req.screenRequestId || req.actionRequestId, { status }).catch(() => {
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
const disable = () => {
|
|
339
|
+
const pending = state().pending;
|
|
340
|
+
if (pending) void reply(pending, "stopped");
|
|
341
|
+
stopScreen(session);
|
|
342
|
+
actions.setEnabled(false);
|
|
343
|
+
chunkORELHENJ_cjs.cancelGuidedRun();
|
|
344
|
+
};
|
|
345
|
+
const inspect = async (req, keepSharing) => {
|
|
346
|
+
if (!req.screenRequestId || !screenTransport) return;
|
|
347
|
+
const workspace = session.getState().workspaceId;
|
|
348
|
+
if (workspace !== req.workspaceExtId) {
|
|
349
|
+
await reply(req, "unavailable");
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const token = runtime.generation;
|
|
353
|
+
const current = () => token === runtime.generation && session.getState().workspaceId === workspace;
|
|
354
|
+
actions.setControllingAgent({ name: req.agentName, extId: req.agentExtId });
|
|
355
|
+
try {
|
|
356
|
+
if (!runtime.sharing.active) {
|
|
357
|
+
runtime.opening = true;
|
|
358
|
+
await runtime.sharing.start(disable);
|
|
359
|
+
if (!current()) {
|
|
360
|
+
runtime.sharing.stop();
|
|
361
|
+
await reply(req, "stopped");
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
runtime.opening = false;
|
|
365
|
+
actions.setSharing(true);
|
|
366
|
+
if (screenTransport.diagnose)
|
|
367
|
+
runtime.setup = await screenTransport.diagnose().catch(() => "Setup checks unavailable.");
|
|
368
|
+
}
|
|
369
|
+
if (!current()) {
|
|
370
|
+
await reply(req, "stopped");
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const frame = await runtime.sharing.frame();
|
|
374
|
+
if (!current()) {
|
|
375
|
+
await reply(req, "stopped");
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
await screenTransport.reply(req.screenRequestId, {
|
|
379
|
+
status: "captured",
|
|
380
|
+
...frame,
|
|
381
|
+
diagnostics: `${frame.diagnostics}
|
|
382
|
+
${runtime.setup}`.slice(0, 24e3)
|
|
383
|
+
});
|
|
384
|
+
} catch {
|
|
385
|
+
await reply(req, current() ? "unavailable" : "stopped");
|
|
386
|
+
if (current()) disable();
|
|
387
|
+
} finally {
|
|
388
|
+
if (current()) {
|
|
389
|
+
const currentAgent = state().controllingAgent;
|
|
390
|
+
if (currentAgent?.name === req.agentName && currentAgent.extId === req.agentExtId)
|
|
391
|
+
actions.setControllingAgent(null);
|
|
392
|
+
if (!keepSharing) disable();
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
|
67
396
|
const resolveRun = (req) => {
|
|
68
397
|
if (req.steps && req.steps.length > 0) return req.steps;
|
|
69
398
|
if (req.sequenceId && guided.isSequenceId(req.sequenceId)) return req.sequenceId;
|
|
70
399
|
return null;
|
|
71
400
|
};
|
|
72
|
-
const runRemoteRequest = async (req) => {
|
|
401
|
+
const runRemoteRequest = async (req, keepSharing = state().enabled) => {
|
|
402
|
+
if (req.screenRequestId) {
|
|
403
|
+
await inspect(req, keepSharing);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
73
406
|
const run = resolveRun(req);
|
|
74
407
|
if (!run) return;
|
|
408
|
+
const token = runtime.generation;
|
|
75
409
|
actions.setControllingAgent({ name: req.agentName, extId: req.agentExtId });
|
|
76
410
|
try {
|
|
77
411
|
await guided.run(run, { remote: true });
|
|
412
|
+
if (req.actionRequestId)
|
|
413
|
+
await reply(req, token === runtime.generation ? "action_finished" : "stopped");
|
|
414
|
+
} catch {
|
|
415
|
+
await reply(req, "unavailable");
|
|
78
416
|
} finally {
|
|
79
417
|
const current = state().controllingAgent;
|
|
80
418
|
if (current && current.name === req.agentName && current.extId === req.agentExtId) {
|
|
@@ -94,31 +432,49 @@ function createRemoteControl(session, guided) {
|
|
|
94
432
|
}
|
|
95
433
|
const req = react.toRemoteControlRequest(msg, guided.isSequenceId);
|
|
96
434
|
if (!req) return;
|
|
97
|
-
if (
|
|
435
|
+
if ((req.screenRequestId || req.actionRequestId) && (!screenTransport || session.getState().workspaceId !== req.workspaceExtId)) {
|
|
436
|
+
void reply(req, "unavailable");
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (state().enabled && (!req.screenRequestId || runtime.sharing.active)) {
|
|
98
440
|
client.logger.info("[RemoteControl] Enabled \u2014 running requested action from", req.agentName);
|
|
99
441
|
void runRemoteRequest(req);
|
|
100
442
|
return;
|
|
101
443
|
}
|
|
102
444
|
client.logger.info("[RemoteControl] Consent required \u2014 prompting for", req.agentName);
|
|
445
|
+
if (state().pending) void reply(state().pending, "denied");
|
|
103
446
|
actions.request(req);
|
|
104
447
|
},
|
|
105
448
|
grantAndRun(opts) {
|
|
106
449
|
const pending = state().pending;
|
|
450
|
+
const keepSharing = opts.forSession || state().enabled;
|
|
107
451
|
actions.grant(opts);
|
|
108
|
-
if (pending) void runRemoteRequest(pending);
|
|
452
|
+
if (pending) void runRemoteRequest(pending, keepSharing);
|
|
109
453
|
},
|
|
110
|
-
deny: () =>
|
|
111
|
-
|
|
112
|
-
actions.
|
|
113
|
-
|
|
454
|
+
deny: () => {
|
|
455
|
+
const pending = state().pending;
|
|
456
|
+
actions.deny();
|
|
457
|
+
if (pending) void reply(pending, "denied");
|
|
114
458
|
},
|
|
459
|
+
disable,
|
|
115
460
|
enable: () => actions.setEnabled(true)
|
|
116
461
|
};
|
|
117
462
|
}
|
|
118
463
|
function useRemoteControlActions() {
|
|
119
464
|
const session = react.useArbiSessionStore();
|
|
120
465
|
const guided = chunkORELHENJ_cjs.useGuidedRuns();
|
|
121
|
-
|
|
466
|
+
const { arbi } = react.useArbiHost();
|
|
467
|
+
return React6.useMemo(
|
|
468
|
+
() => createRemoteControl(
|
|
469
|
+
session,
|
|
470
|
+
guided,
|
|
471
|
+
arbi ? {
|
|
472
|
+
reply: (id, result) => arbi.remoteControl.replyScreen(id, result),
|
|
473
|
+
diagnose: async () => JSON.stringify(await arbi.diagnose())
|
|
474
|
+
} : void 0
|
|
475
|
+
),
|
|
476
|
+
[session, guided, arbi]
|
|
477
|
+
);
|
|
122
478
|
}
|
|
123
479
|
function useRemoteControlSessionReset() {
|
|
124
480
|
const session = react.useArbiSessionStore();
|
|
@@ -126,6 +482,7 @@ function useRemoteControlSessionReset() {
|
|
|
126
482
|
const userId = react.useArbiSession().user?.external_id ?? null;
|
|
127
483
|
React6.useEffect(() => {
|
|
128
484
|
const reset = () => {
|
|
485
|
+
stopScreen(session);
|
|
129
486
|
react.remoteControlActions(session).reset();
|
|
130
487
|
chunkORELHENJ_cjs.cancelGuidedRun();
|
|
131
488
|
};
|
|
@@ -137,10 +494,22 @@ function useRemoteControlSessionReset() {
|
|
|
137
494
|
];
|
|
138
495
|
return () => off.forEach((unsubscribe) => unsubscribe?.());
|
|
139
496
|
}, [arbi, session]);
|
|
497
|
+
React6.useEffect(
|
|
498
|
+
() => session.subscribe(() => {
|
|
499
|
+
const permission = react.remoteControlStateOf(session.getState());
|
|
500
|
+
const runtime = screenRuntimes.get(session);
|
|
501
|
+
if (runtime && (runtime.sharing.active || runtime.opening) && !permission.enabled && !permission.controllingAgent) {
|
|
502
|
+
stopScreen(session);
|
|
503
|
+
chunkORELHENJ_cjs.cancelGuidedRun();
|
|
504
|
+
}
|
|
505
|
+
}),
|
|
506
|
+
[session]
|
|
507
|
+
);
|
|
140
508
|
const lastUser = React6.useRef(userId);
|
|
141
509
|
React6.useEffect(() => {
|
|
142
510
|
if (lastUser.current === userId) return;
|
|
143
511
|
lastUser.current = userId;
|
|
512
|
+
stopScreen(session);
|
|
144
513
|
react.remoteControlActions(session).reset();
|
|
145
514
|
chunkORELHENJ_cjs.cancelGuidedRun();
|
|
146
515
|
}, [userId, session]);
|
|
@@ -149,6 +518,16 @@ function useRemoteControlHandlers() {
|
|
|
149
518
|
useRemoteControlSessionReset();
|
|
150
519
|
const remote = useRemoteControlActions();
|
|
151
520
|
const { remoteControl } = chunkORELHENJ_cjs.useGuidedRuns();
|
|
521
|
+
const session = react.useArbiSessionStore();
|
|
522
|
+
const workspaceId = react.useArbiSessionState((s) => s.workspaceId);
|
|
523
|
+
React6.useEffect(
|
|
524
|
+
() => () => {
|
|
525
|
+
stopScreen(session);
|
|
526
|
+
react.remoteControlActions(session).setEnabled(false);
|
|
527
|
+
chunkORELHENJ_cjs.cancelGuidedRun();
|
|
528
|
+
},
|
|
529
|
+
[session, workspaceId, remoteControl]
|
|
530
|
+
);
|
|
152
531
|
return React6.useMemo(
|
|
153
532
|
() => remoteControl ? {
|
|
154
533
|
remote_control: (message) => remote.handleMessage(message)
|
|
@@ -1375,7 +1754,7 @@ var AgentStepsComponent = ({
|
|
|
1375
1754
|
summary && !isActive && (step.narration ? (
|
|
1376
1755
|
/* Narration is PROSE (headings, bold, lists): render markdown, not raw asterisks.
|
|
1377
1756
|
Tool summaries stay plain text: one-line headlines where a clamp matters. */
|
|
1378
|
-
/* @__PURE__ */ jsxRuntime.jsx(chunkTP5PGWIO_cjs.StepNarration, { index: step.index, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1757
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkTP5PGWIO_cjs.StepNarration, { index: step.index, children: /* @__PURE__ */ jsxRuntime.jsx(chunkERRXU2HL_cjs.ConnectedMarkdown, { isStreaming: false, children: summary }) })
|
|
1379
1758
|
) : /* @__PURE__ */ jsxRuntime.jsx(chunkTP5PGWIO_cjs.StepSummary, { index: step.index, multiLine: isMultiLine, children: summary })),
|
|
1380
1759
|
details.map((d, di) => /* @__PURE__ */ jsxRuntime.jsx(chunkTP5PGWIO_cjs.StepDetail, { index: step.index, children: d }, di)),
|
|
1381
1760
|
showOutcome && /* @__PURE__ */ jsxRuntime.jsx(chunkTP5PGWIO_cjs.StepOutcome, { index: step.index, failed: outcomeFailed, children: step.outcome }),
|
|
@@ -1757,13 +2136,13 @@ function withAnswerTable(components) {
|
|
|
1757
2136
|
}
|
|
1758
2137
|
return merged;
|
|
1759
2138
|
}
|
|
1760
|
-
var renderMarkdown = ({ components, isStreaming, children }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2139
|
+
var renderMarkdown = ({ components, isStreaming, children }) => /* @__PURE__ */ jsxRuntime.jsx(chunkERRXU2HL_cjs.ConnectedMarkdown, { components: withAnswerTable(components), isStreaming, children });
|
|
1761
2140
|
function LinkInAnswer({ href, children, ...props }) {
|
|
1762
2141
|
const docId = chunkZ2XZ2D4N_cjs.workspaceDocIdFromHref(href, chunkTKHCIHE2_cjs.useBlocksEnvironment().runtimeConfig.deploymentDomain);
|
|
1763
2142
|
if (docId) {
|
|
1764
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2143
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkERRXU2HL_cjs.InternalDocLink, { docId, href, ...props, children });
|
|
1765
2144
|
}
|
|
1766
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2145
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkERRXU2HL_cjs.ExternalLink, { href, ...props, children });
|
|
1767
2146
|
}
|
|
1768
2147
|
var ConnectedCitationRendererComponent = (props) => {
|
|
1769
2148
|
const session = react.useArbiSessionStore();
|
|
@@ -2493,7 +2872,7 @@ var MessageComponent = ({
|
|
|
2493
2872
|
),
|
|
2494
2873
|
subagentTaskRecord && /* @__PURE__ */ jsxRuntime.jsx(chunkM2FOXGJU_cjs.MessageSubagentBadge, { messageId }),
|
|
2495
2874
|
/* @__PURE__ */ jsxRuntime.jsxs(chunkM2FOXGJU_cjs.MessageBody, { messageId, children: [
|
|
2496
|
-
settledNarration ? /* @__PURE__ */ jsxRuntime.jsx(chunkM2FOXGJU_cjs.MessageNarration, { messageId, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2875
|
+
settledNarration ? /* @__PURE__ */ jsxRuntime.jsx(chunkM2FOXGJU_cjs.MessageNarration, { messageId, children: /* @__PURE__ */ jsxRuntime.jsx(chunkERRXU2HL_cjs.ConnectedMarkdown, { isStreaming: false, children: settledNarration }) }) : null,
|
|
2497
2876
|
liveContent ? role === "assistant" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2498
2877
|
ConnectedCitationRenderer,
|
|
2499
2878
|
{
|
|
@@ -2503,7 +2882,7 @@ var MessageComponent = ({
|
|
|
2503
2882
|
messageId: message.external_id || "unknown",
|
|
2504
2883
|
isStreaming: isGenerating
|
|
2505
2884
|
}
|
|
2506
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2885
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(chunkERRXU2HL_cjs.ConnectedMarkdown, { isStreaming: isGenerating, children: linkMentions(
|
|
2507
2886
|
isUser && liveContent.startsWith("/pa ") ? liveContent.slice(4) : liveContent,
|
|
2508
2887
|
message.mentions
|
|
2509
2888
|
) }) : null,
|
|
@@ -5221,8 +5600,12 @@ exports.PENDING_RECOVERY_KEY = PENDING_RECOVERY_KEY;
|
|
|
5221
5600
|
exports.PREMIUM_TIER_TAG = PREMIUM_TIER_TAG;
|
|
5222
5601
|
exports.RunningSubagents = RunningSubagents;
|
|
5223
5602
|
exports.STANDARD_TIER_TAG = STANDARD_TIER_TAG;
|
|
5603
|
+
exports.ScreenCaptureError = ScreenCaptureError;
|
|
5224
5604
|
exports.WorkflowStepMessage = WorkflowStepMessage;
|
|
5225
5605
|
exports.backUpOnSignup = backUpOnSignup;
|
|
5606
|
+
exports.canCaptureScreen = canCaptureScreen;
|
|
5607
|
+
exports.canvasToBlob = canvasToBlob;
|
|
5608
|
+
exports.captureCurrentTab = captureCurrentTab;
|
|
5226
5609
|
exports.completeSsoSignIn = completeSsoSignIn;
|
|
5227
5610
|
exports.createRemoteControl = createRemoteControl;
|
|
5228
5611
|
exports.defaultHost = defaultHost;
|
|
@@ -5240,5 +5623,5 @@ exports.useRemoteControlHandlers = useRemoteControlHandlers;
|
|
|
5240
5623
|
exports.useRemoteControlSessionReset = useRemoteControlSessionReset;
|
|
5241
5624
|
exports.useSsoSignIn = useSsoSignIn;
|
|
5242
5625
|
exports.useWorkspaceDocTitles = useWorkspaceDocTitles;
|
|
5243
|
-
//# sourceMappingURL=chunk-
|
|
5244
|
-
//# sourceMappingURL=chunk-
|
|
5626
|
+
//# sourceMappingURL=chunk-IWMHQTVL.cjs.map
|
|
5627
|
+
//# sourceMappingURL=chunk-IWMHQTVL.cjs.map
|