@botiverse/porthole 0.15.3 → 0.16.1
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/CHANGELOG.md +70 -0
- package/dist/annotate/types.d.ts +15 -1
- package/dist/annotate/validate.js +19 -1
- package/dist/bridge/bridge.d.ts +1 -8
- package/dist/bridge/bridge.js +0 -7
- package/dist/bridge/types.d.ts +1 -1
- package/dist/check/page-source.js +1 -1
- package/dist/check/page.js +1 -1
- package/dist/compile/policy.d.ts +0 -7
- package/dist/compile/policy.js +1 -10
- package/dist/config/capabilities.d.ts +8 -14
- package/dist/config/capabilities.js +4 -5
- package/dist/config/schema.d.ts +2 -13
- package/dist/config/validate.js +0 -24
- package/dist/conformance/behavior.js +26 -37
- package/dist/conformance/clipboard.js +47 -1
- package/dist/conformance/harness-source.js +1 -1
- package/dist/displays/displays.js +1 -3
- package/dist/guide/limits.js +1 -1
- package/dist/guide/runtime.js +1 -1
- package/dist/host/create-host.d.ts +1 -1
- package/dist/host/create-host.js +8 -52
- package/dist/host/door.d.ts +1 -1
- package/dist/host/locate.d.ts +1 -1
- package/dist/host/locate.js +2 -2
- package/dist/host/outcome.d.ts +5 -12
- package/dist/host/outcome.js +8 -16
- package/dist/host/types.d.ts +6 -22
- package/dist/index.d.ts +2 -4
- package/dist/index.js +2 -4
- package/dist/isolation/served.d.ts +4 -14
- package/dist/isolation/served.js +7 -28
- package/dist/isolation/types.d.ts +2 -25
- package/dist/isolation/types.js +0 -23
- package/dist/platform/focus-field.d.ts +11 -0
- package/dist/platform/focus-field.js +18 -0
- package/dist/platform/types.d.ts +7 -23
- package/dist/platform/web.js +8 -106
- package/dist/presets/presets.d.ts +0 -2
- package/dist/presets/presets.js +0 -1
- package/dist/react/frame.d.ts +0 -8
- package/dist/react/frame.js +0 -4
- package/dist/runtime/contract.d.ts +2 -2
- package/dist/runtime/contract.js +2 -2
- package/dist/runtime/types.generated.js +6 -6
- package/dist/server/files.js +7 -23
- package/dist/server/host.d.ts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +4 -6
- package/dist/server/naming.js +1 -1
- package/dist/server/server.js +28 -166
- package/dist/server/types.d.ts +7 -7
- package/dist/shell/annotate.d.ts +3 -0
- package/dist/shell/annotate.js +15 -5
- package/dist/shell/plan.d.ts +0 -5
- package/dist/shell/plan.js +2 -4
- package/dist/shell/runtime.js +1 -268
- package/docs/ADOPTING.md +398 -1081
- package/docs/DECISIONS.md +172 -10
- package/docs/DESIGN.md +1114 -1388
- package/docs/PRINCIPLES.md +85 -1
- package/docs/THREAT_MODEL.md +658 -1127
- package/package.json +1 -1
- package/src/annotate/types.ts +12 -1
- package/src/annotate/validate.ts +23 -1
- package/src/bridge/bridge.ts +1 -17
- package/src/bridge/types.ts +1 -1
- package/src/check/page.ts +1 -1
- package/src/compile/policy.ts +1 -11
- package/src/config/capabilities.ts +8 -14
- package/src/config/schema.ts +2 -13
- package/src/config/validate.ts +0 -28
- package/src/conformance/behavior.ts +50 -52
- package/src/conformance/clipboard.ts +56 -1
- package/src/displays/displays.ts +1 -3
- package/src/guide/limits.ts +1 -1
- package/src/guide/runtime.ts +1 -1
- package/src/host/create-host.ts +8 -53
- package/src/host/door.ts +1 -1
- package/src/host/locate.ts +2 -2
- package/src/host/outcome.ts +8 -21
- package/src/host/types.ts +6 -20
- package/src/index.ts +2 -4
- package/src/isolation/served.ts +6 -34
- package/src/isolation/types.ts +2 -31
- package/src/platform/focus-field.ts +18 -0
- package/src/platform/types.ts +7 -22
- package/src/platform/web.ts +8 -129
- package/src/presets/presets.ts +0 -3
- package/src/react/frame.tsx +0 -10
- package/src/runtime/contract.ts +4 -4
- package/src/runtime/types.generated.ts +6 -6
- package/src/server/files.ts +4 -19
- package/src/server/host.ts +1 -1
- package/src/server/index.ts +4 -16
- package/src/server/naming.ts +1 -1
- package/src/server/server.ts +29 -189
- package/src/server/types.ts +7 -7
- package/src/shell/annotate.ts +15 -5
- package/src/shell/plan.ts +2 -9
- package/src/shell/runtime.ts +1 -268
- package/types/runtime/v1/artifact.d.ts +2 -3
- package/types/runtime/v1/assets.d.ts +1 -1
- package/types/runtime/v1/chat.d.ts +2 -2
- package/types/runtime/v1/comments.d.ts +1 -1
- package/types/runtime/v1/downloads.d.ts +2 -2
- package/types/runtime/v1/links.d.ts +2 -2
- package/dist/platform/focus-guard.d.ts +0 -288
- package/dist/platform/focus-guard.js +0 -838
- package/dist/server/nested.d.ts +0 -66
- package/dist/server/nested.js +0 -121
- package/dist/shell/frame.d.ts +0 -28
- package/dist/shell/frame.js +0 -407
- package/docs/ARCHITECTURE.md +0 -359
- package/docs/OBJECTIVES.md +0 -116
- package/src/platform/focus-guard.ts +0 -1114
- package/src/server/nested.ts +0 -157
- package/src/shell/frame.ts +0 -444
package/src/shell/runtime.ts
CHANGED
|
@@ -276,8 +276,6 @@ export const SHELL_RUNTIME = String.raw`(() => {
|
|
|
276
276
|
// takes the next load for that page, not for content that left). Anything else stays stopped:
|
|
277
277
|
// another path of the origin, a file that isn't a page, another origin.
|
|
278
278
|
let navigating = (_url) => {};
|
|
279
|
-
// A nested page's files' address renewed by its shell (P111), which the shell's message gives.
|
|
280
|
-
let adoptFiles = (_base) => false;
|
|
281
279
|
let filesBase = plan.files && typeof plan.files.base === "string" ? plan.files.base : null;
|
|
282
280
|
// Every address the page's files had (P083: a sealed one is renewed): what reports say as "./".
|
|
283
281
|
const filesBases = filesBase === null ? [] : [filesBase];
|
|
@@ -931,14 +929,9 @@ export const SHELL_RUNTIME = String.raw`(() => {
|
|
|
931
929
|
const noRewrite = function () {
|
|
932
930
|
throw new Error("document.open and document.write aren't available here: build the page with DOM methods");
|
|
933
931
|
};
|
|
934
|
-
const unfixedBeforeRewrite = unfixed.length;
|
|
935
932
|
for (const name of ["open", "write", "writeln"]) {
|
|
936
933
|
lock(Document.prototype, name, noRewrite);
|
|
937
934
|
}
|
|
938
|
-
// Whether all three are fixed in place. The press port rests on it (P148): document.open() takes
|
|
939
|
-
// every listener off the window, the runtime's among them, and a document opened and closed
|
|
940
|
-
// again loads again, so content that could call it would hear a port before the runtime did.
|
|
941
|
-
const rewriteFixed = unfixed.length === unfixedBeforeRewrite;
|
|
942
935
|
|
|
943
936
|
// Some engines act on a hint the moment its element is connected or changed (WebKit opens a
|
|
944
937
|
// preconnect then, outside the CSP), before the observer's microtask. So every way to connect a
|
|
@@ -1402,254 +1395,6 @@ export const SHELL_RUNTIME = String.raw`(() => {
|
|
|
1402
1395
|
]);
|
|
1403
1396
|
}
|
|
1404
1397
|
|
|
1405
|
-
// A nested page's real presses, told to its shell (P148). The shell sees a press in the page only
|
|
1406
|
-
// as its own activation turning on, and a press within 5 s of the last gesture turns nothing on
|
|
1407
|
-
// (P111): to the host that reads as a button that does nothing. So the runtime, which runs before
|
|
1408
|
-
// any content and hears the browser's own events first, tells the shell each one, over a
|
|
1409
|
-
// MessagePort the shell sends at each load of the page's frame. What keeps that the runtime's
|
|
1410
|
-
// word and never the content's:
|
|
1411
|
-
// - the port: taken here, by the first listener there is (on window, capturing), from the first
|
|
1412
|
-
// message that is the browser's own (isTrusted), from the parent read now, that names the
|
|
1413
|
-
// method and carries exactly one port. The event goes no further. Every other event of that
|
|
1414
|
-
// name is stopped too, so content never hears one, and one that fails a check doesn't use up
|
|
1415
|
-
// the one port. The port is in this closure alone: no content holds it or can post on it. No
|
|
1416
|
-
// second port is taken: the shell's next one (it sends one at every load of the frame, and
|
|
1417
|
-
// WebKit fires a load for a navigation within the document) is answered on the first, that
|
|
1418
|
-
// this document is still here;
|
|
1419
|
-
// - the press: only the browser's own events (isTrusted), read through the platform's getters
|
|
1420
|
-
// kept now. A mouse on its way down; a finger or a pen on its way up (one that scrolls ends in
|
|
1421
|
-
// pointercancel: HTML's own rule for what activates); Enter or Space, not held down, on a
|
|
1422
|
-
// native control that isn't editable (a link takes Enter alone), by its tag and type, never
|
|
1423
|
-
// its role, which is the content's word; a click on such a control (an assistive technology's
|
|
1424
|
-
// activation is a click alone), but not the click a form gives its submit button when Enter is
|
|
1425
|
-
// pressed in another of its fields, which is typing, nor any click while a key is down;
|
|
1426
|
-
// - what is told: nothing but that there was one. No place, no target, no time.
|
|
1427
|
-
// After a press is told, what the page's calls say to its host (send, below) waits for the
|
|
1428
|
-
// shell's word that it has the press (it tells the host before it answers), so a call made in
|
|
1429
|
-
// the press's own handler never arrives ahead of it; a shell that doesn't answer in 250 ms
|
|
1430
|
-
// holds nothing back.
|
|
1431
|
-
// None of it is installed unless all of it can be (a built-in missing, or document.open, write
|
|
1432
|
-
// or writeln not fixed in place above): the page then tells no press, and the host has the
|
|
1433
|
-
// shell's activation alone, as before.
|
|
1434
|
-
let pressHeld = null;
|
|
1435
|
-
const pressParent = window.parent;
|
|
1436
|
-
if (plan.press === true && !hostless && pressParent !== window && rewriteFixed) {
|
|
1437
|
-
const messageProto = typeof MessageEvent === "function" ? MessageEvent.prototype : null;
|
|
1438
|
-
const messageSourceOf = getterOf(messageProto, "source");
|
|
1439
|
-
const messageDataOf = getterOf(messageProto, "data");
|
|
1440
|
-
const messagePortsOf = getterOf(messageProto, "ports");
|
|
1441
|
-
const stopNow = Event.prototype.stopImmediatePropagation;
|
|
1442
|
-
const portProto = typeof MessagePort === "function" ? MessagePort.prototype : null;
|
|
1443
|
-
const portPost = portProto === null ? null : portProto.postMessage;
|
|
1444
|
-
const portStart = portProto === null ? null : portProto.start;
|
|
1445
|
-
const eventTargetOf = getterOf(Event.prototype, "target");
|
|
1446
|
-
const pointerTypeOf = getterOf(typeof PointerEvent === "function" ? PointerEvent.prototype : null, "pointerType");
|
|
1447
|
-
const keyProto = typeof KeyboardEvent === "function" ? KeyboardEvent.prototype : null;
|
|
1448
|
-
const keyOf = getterOf(keyProto, "key");
|
|
1449
|
-
const repeatOf = getterOf(keyProto, "repeat");
|
|
1450
|
-
const editableOf = getterOf(HTMLElement.prototype, "isContentEditable");
|
|
1451
|
-
const designModeOf = getterOf(Document.prototype, "designMode");
|
|
1452
|
-
const activeOf = getterOf(Document.prototype, "activeElement");
|
|
1453
|
-
const controlTypeOf = getterOf(HTMLInputElement.prototype, "type");
|
|
1454
|
-
// Each control's form through its own getter: a field tied to a form by its form attribute is
|
|
1455
|
-
// not inside that form's element.
|
|
1456
|
-
const formGetters = bare(null);
|
|
1457
|
-
formGetters.button = getterOf(HTMLButtonElement.prototype, "form");
|
|
1458
|
-
formGetters.input = getterOf(HTMLInputElement.prototype, "form");
|
|
1459
|
-
formGetters.select = getterOf(HTMLSelectElement.prototype, "form");
|
|
1460
|
-
formGetters.textarea = getterOf(HTMLTextAreaElement.prototype, "form");
|
|
1461
|
-
const pressLater = setTimeout;
|
|
1462
|
-
const pressNoLater = clearTimeout;
|
|
1463
|
-
const pressListen = EventTarget.prototype.addEventListener;
|
|
1464
|
-
const all =
|
|
1465
|
-
messageSourceOf !== null && messageDataOf !== null && messagePortsOf !== null &&
|
|
1466
|
-
typeof stopNow === "function" && typeof portPost === "function" && typeof portStart === "function" &&
|
|
1467
|
-
eventTargetOf !== null && pointerTypeOf !== null && keyOf !== null && repeatOf !== null &&
|
|
1468
|
-
editableOf !== null && designModeOf !== null && activeOf !== null && controlTypeOf !== null &&
|
|
1469
|
-
formGetters.button !== null && formGetters.input !== null && formGetters.select !== null && formGetters.textarea !== null &&
|
|
1470
|
-
localNameOf !== null && namespaceOf !== null && nodeTypeOf !== null;
|
|
1471
|
-
if (all) {
|
|
1472
|
-
let port = null;
|
|
1473
|
-
// How many presses the shell hasn't answered yet, and the timer that stops waiting for it.
|
|
1474
|
-
let unanswered = 0;
|
|
1475
|
-
let giveUp = 0;
|
|
1476
|
-
const release = () => {
|
|
1477
|
-
unanswered = 0;
|
|
1478
|
-
callOf(pressNoLater, window, [giveUp]);
|
|
1479
|
-
const held = pressHeld;
|
|
1480
|
-
pressHeld = null;
|
|
1481
|
-
if (held !== null) {
|
|
1482
|
-
for (let i = 0; i < held.length; i += 1) {
|
|
1483
|
-
post(held[i]);
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
};
|
|
1487
|
-
const tellPress = () => {
|
|
1488
|
-
if (port === null) {
|
|
1489
|
-
return;
|
|
1490
|
-
}
|
|
1491
|
-
try {
|
|
1492
|
-
callOf(portPost, port, [0]);
|
|
1493
|
-
} catch (_) {
|
|
1494
|
-
return;
|
|
1495
|
-
}
|
|
1496
|
-
unanswered += 1;
|
|
1497
|
-
if (pressHeld === null) {
|
|
1498
|
-
pressHeld = [];
|
|
1499
|
-
}
|
|
1500
|
-
callOf(pressNoLater, window, [giveUp]);
|
|
1501
|
-
giveUp = callOf(pressLater, window, [release, 250]);
|
|
1502
|
-
};
|
|
1503
|
-
callOf(pressListen, window, [
|
|
1504
|
-
"message",
|
|
1505
|
-
(event) => {
|
|
1506
|
-
let named = false;
|
|
1507
|
-
try {
|
|
1508
|
-
const data = callOf(messageDataOf, event, []);
|
|
1509
|
-
named = data !== null && typeof data === "object" && data.method === "porthole/shell/press-port";
|
|
1510
|
-
} catch (_) {}
|
|
1511
|
-
if (!named) {
|
|
1512
|
-
return;
|
|
1513
|
-
}
|
|
1514
|
-
callOf(stopNow, event, []);
|
|
1515
|
-
if (event.isTrusted !== true) {
|
|
1516
|
-
return;
|
|
1517
|
-
}
|
|
1518
|
-
try {
|
|
1519
|
-
const ports = callOf(messagePortsOf, event, []);
|
|
1520
|
-
if (callOf(messageSourceOf, event, []) !== pressParent || ports === null || ports.length !== 1) {
|
|
1521
|
-
return;
|
|
1522
|
-
}
|
|
1523
|
-
// Only the first is ever taken. A later one is the shell's for a load that left this
|
|
1524
|
-
// document where it was (WebKit's, for a navigation within it, P142): told, on the
|
|
1525
|
-
// port held, that this document is still here, so the shell goes on hearing that one.
|
|
1526
|
-
if (port !== null) {
|
|
1527
|
-
callOf(portPost, port, [1]);
|
|
1528
|
-
return;
|
|
1529
|
-
}
|
|
1530
|
-
const taken = ports[0];
|
|
1531
|
-
// The shell's answer to a press: it has it, and has told the host.
|
|
1532
|
-
callOf(pressListen, taken, [
|
|
1533
|
-
"message",
|
|
1534
|
-
() => {
|
|
1535
|
-
unanswered -= 1;
|
|
1536
|
-
if (unanswered <= 0) {
|
|
1537
|
-
release();
|
|
1538
|
-
}
|
|
1539
|
-
},
|
|
1540
|
-
]);
|
|
1541
|
-
callOf(portStart, taken, []);
|
|
1542
|
-
port = taken;
|
|
1543
|
-
} catch (_) {}
|
|
1544
|
-
},
|
|
1545
|
-
true,
|
|
1546
|
-
]);
|
|
1547
|
-
// A native control a key or a click presses: "both" (Enter and Space), "enter" (a link), or
|
|
1548
|
-
// "" for anything else, an editable one included. By the kept getters: the tag and the type,
|
|
1549
|
-
// never an attribute the content writes to say what it is.
|
|
1550
|
-
const controlOf = (node) => {
|
|
1551
|
-
if (typeOf(node) !== 1 || callOf(namespaceOf, node, []) !== XHTML) {
|
|
1552
|
-
return "";
|
|
1553
|
-
}
|
|
1554
|
-
const name = callOf(localNameOf, node, []);
|
|
1555
|
-
let kind = "";
|
|
1556
|
-
if (name === "button" || name === "summary") {
|
|
1557
|
-
kind = "both";
|
|
1558
|
-
} else if (name === "input") {
|
|
1559
|
-
const type = callOf(controlTypeOf, node, []);
|
|
1560
|
-
kind = type === "button" || type === "submit" || type === "reset" ? "both" : "";
|
|
1561
|
-
} else if (name === "a") {
|
|
1562
|
-
kind = callOf(hasAttributeIn, node, ["href"]) === true ? "enter" : "";
|
|
1563
|
-
}
|
|
1564
|
-
return kind !== "" && callOf(editableOf, node, []) !== true ? kind : "";
|
|
1565
|
-
};
|
|
1566
|
-
const formOf = (node) => {
|
|
1567
|
-
if (typeOf(node) !== 1 || callOf(namespaceOf, node, []) !== XHTML) {
|
|
1568
|
-
return null;
|
|
1569
|
-
}
|
|
1570
|
-
const getter = formGetters[callOf(localNameOf, node, [])];
|
|
1571
|
-
return typeof getter === "function" ? callOf(getter, node, []) : null;
|
|
1572
|
-
};
|
|
1573
|
-
// The browser's own event: nothing a page dispatches is a press.
|
|
1574
|
-
const real = (event) => event.isTrusted === true;
|
|
1575
|
-
// Whether a key is down: from the browser's own keydown to its keyup, or the next press of
|
|
1576
|
-
// a pointer. No click in that time is a press. The key's own press was judged as it went
|
|
1577
|
-
// down, where it went down: content that moves the focus to its button inside the keydown
|
|
1578
|
-
// of an Enter typed in a text field gets that button a click of the browser's own, and a
|
|
1579
|
-
// held key's repeats give a button one each. An assistive technology's click comes with no
|
|
1580
|
-
// key down.
|
|
1581
|
-
let keyDown = false;
|
|
1582
|
-
const pointed = (down) => (event) => {
|
|
1583
|
-
if (!real(event)) {
|
|
1584
|
-
return;
|
|
1585
|
-
}
|
|
1586
|
-
keyDown = false;
|
|
1587
|
-
try {
|
|
1588
|
-
if ((callOf(pointerTypeOf, event, []) === "mouse") === down) {
|
|
1589
|
-
tellPress();
|
|
1590
|
-
}
|
|
1591
|
-
} catch (_) {}
|
|
1592
|
-
};
|
|
1593
|
-
callOf(pressListen, window, ["pointerdown", pointed(true), true]);
|
|
1594
|
-
callOf(pressListen, window, ["pointerup", pointed(false), true]);
|
|
1595
|
-
callOf(pressListen, window, [
|
|
1596
|
-
"keyup",
|
|
1597
|
-
(event) => {
|
|
1598
|
-
if (real(event)) {
|
|
1599
|
-
keyDown = false;
|
|
1600
|
-
}
|
|
1601
|
-
},
|
|
1602
|
-
true,
|
|
1603
|
-
]);
|
|
1604
|
-
callOf(pressListen, window, [
|
|
1605
|
-
"keydown",
|
|
1606
|
-
(event) => {
|
|
1607
|
-
if (!real(event)) {
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
keyDown = true;
|
|
1611
|
-
try {
|
|
1612
|
-
// A key held down goes on being the key it was when it went down, wherever the focus
|
|
1613
|
-
// has moved since: its repeats are no press.
|
|
1614
|
-
const key = callOf(keyOf, event, []);
|
|
1615
|
-
if ((key !== "Enter" && key !== " ") || callOf(repeatOf, event, []) === true || callOf(designModeOf, document, []) === "on") {
|
|
1616
|
-
return;
|
|
1617
|
-
}
|
|
1618
|
-
const kind = controlOf(callOf(eventTargetOf, event, []));
|
|
1619
|
-
if (kind === "both" || (kind === "enter" && key === "Enter")) {
|
|
1620
|
-
tellPress();
|
|
1621
|
-
}
|
|
1622
|
-
} catch (_) {}
|
|
1623
|
-
},
|
|
1624
|
-
true,
|
|
1625
|
-
]);
|
|
1626
|
-
callOf(pressListen, window, [
|
|
1627
|
-
"click",
|
|
1628
|
-
(event) => {
|
|
1629
|
-
if (!real(event)) {
|
|
1630
|
-
return;
|
|
1631
|
-
}
|
|
1632
|
-
try {
|
|
1633
|
-
const target = callOf(eventTargetOf, event, []);
|
|
1634
|
-
if (keyDown || controlOf(target) === "") {
|
|
1635
|
-
return;
|
|
1636
|
-
}
|
|
1637
|
-
// A form's own click on its submit button, for Enter in another of its fields.
|
|
1638
|
-
const active = callOf(activeOf, document, []);
|
|
1639
|
-
if (active !== null && active !== target) {
|
|
1640
|
-
const form = formOf(target);
|
|
1641
|
-
if (form !== null && form === formOf(active)) {
|
|
1642
|
-
return;
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
tellPress();
|
|
1646
|
-
} catch (_) {}
|
|
1647
|
-
},
|
|
1648
|
-
true,
|
|
1649
|
-
]);
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
1398
|
// The clipboard is the host's to write (P051): content can neither write nor read it. A copy
|
|
1654
1399
|
// the person makes (their keys, their menu) copies their selection as the browser makes it: no
|
|
1655
1400
|
// copy or cut listener of the content's runs, so none can swap what goes on the clipboard.
|
|
@@ -1868,14 +1613,8 @@ export const SHELL_RUNTIME = String.raw`(() => {
|
|
|
1868
1613
|
window.parent.postMessage(Object.assign({ jsonrpc: "2.0" }, message), "*");
|
|
1869
1614
|
}
|
|
1870
1615
|
};
|
|
1871
|
-
// After a press was told to the shell (P148), what the shell's protocol says next (a call, an
|
|
1872
|
-
// answer) waits for the shell to have the press: posted by the release above, through post.
|
|
1873
1616
|
const send = (message) => {
|
|
1874
1617
|
if (plan.protocol === "shell") {
|
|
1875
|
-
if (pressHeld !== null) {
|
|
1876
|
-
pressHeld[pressHeld.length] = message;
|
|
1877
|
-
return;
|
|
1878
|
-
}
|
|
1879
1618
|
post(message);
|
|
1880
1619
|
}
|
|
1881
1620
|
};
|
|
@@ -1916,7 +1655,7 @@ export const SHELL_RUNTIME = String.raw`(() => {
|
|
|
1916
1655
|
// modules keep the address they loaded from; the server serves their own loads till the session
|
|
1917
1656
|
// ends.
|
|
1918
1657
|
const replace = History.prototype.replaceState;
|
|
1919
|
-
// The files' origin, read from the address itself
|
|
1658
|
+
// The files' origin, read from the address itself.
|
|
1920
1659
|
const filesOrigin = filesBase === null ? null : new NativeURL(filesBase).origin;
|
|
1921
1660
|
// A renewed sealed address (P083): one segment under the same origin's sealed prefix, checked
|
|
1922
1661
|
// through the platform's own functions (content may have replaced a prototype's, and the base
|
|
@@ -1936,7 +1675,6 @@ export const SHELL_RUNTIME = String.raw`(() => {
|
|
|
1936
1675
|
filesBases.push(base);
|
|
1937
1676
|
return true;
|
|
1938
1677
|
};
|
|
1939
|
-
adoptFiles = adopt;
|
|
1940
1678
|
if (filesBase !== null && typeof plan.files.expires === "number") {
|
|
1941
1679
|
const nativeFetch = window.fetch.bind(window);
|
|
1942
1680
|
const renewIn = (expires) => Math.max(30000, expires - Date.now() - 300000);
|
|
@@ -2506,11 +2244,6 @@ export const SHELL_RUNTIME = String.raw`(() => {
|
|
|
2506
2244
|
case "ui/notifications/tool-input":
|
|
2507
2245
|
void render(params.arguments);
|
|
2508
2246
|
break;
|
|
2509
|
-
case "porthole/files-renewed":
|
|
2510
|
-
// From the page's parent only (the listener's check): a nested page's shell renewed its
|
|
2511
|
-
// files' sealed address, which this page can't (its loads aren't its origin's own, P111).
|
|
2512
|
-
adoptFiles(params.base);
|
|
2513
|
-
break;
|
|
2514
2247
|
case "ui/notifications/host-context-changed":
|
|
2515
2248
|
applyTheme(params);
|
|
2516
2249
|
break;
|
|
@@ -36,9 +36,8 @@ interface PortholeArtifact {
|
|
|
36
36
|
/** The current version and its files (fetch a file by its relative path). Level: view. */
|
|
37
37
|
get(): Promise<PortholeArtifactVersion>;
|
|
38
38
|
/**
|
|
39
|
-
* Publishes a new version of this artifact
|
|
40
|
-
*
|
|
41
|
-
* admin.
|
|
39
|
+
* Publishes a new version of this artifact; the app asks the person first. The page can't
|
|
40
|
+
* change what it declares. On conflict: get() again, merge, publish again. Level: admin.
|
|
42
41
|
*/
|
|
43
42
|
publish(
|
|
44
43
|
change: PortholeArtifactPublish,
|
|
@@ -34,7 +34,7 @@ interface PortholeAssets {
|
|
|
34
34
|
* written in the page loads too, except in some browsers' frames (Safari's); this always does.
|
|
35
35
|
*/
|
|
36
36
|
url(id: string): string;
|
|
37
|
-
/** Removes one
|
|
37
|
+
/** Removes one; the app asks the person first. Level: admin. */
|
|
38
38
|
delete(id: string): Promise<boolean>;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
interface PortholeChat {
|
|
4
4
|
/**
|
|
5
|
-
* Sends text to the agent as the person's message ("explain this point")
|
|
6
|
-
* Resolves true if it was sent. Level: interact.
|
|
5
|
+
* Sends text to the agent as the person's message ("explain this point"); the app asks them
|
|
6
|
+
* first. Resolves true if it was sent. Level: interact.
|
|
7
7
|
*/
|
|
8
8
|
send(text: string): Promise<boolean>;
|
|
9
9
|
}
|
|
@@ -28,7 +28,7 @@ interface PortholeComments {
|
|
|
28
28
|
* Opens the app's comment composer at the anchor (a name alone is { name }), starting with
|
|
29
29
|
* `options.draft` if given. The person writes and posts it in the app. Resolves true if the
|
|
30
30
|
* composer opened, false if it didn't (the app may refuse while the person is writing).
|
|
31
|
-
* Write-only: a page never reads comments.
|
|
31
|
+
* Write-only: a page never reads comments. Level: view.
|
|
32
32
|
*/
|
|
33
33
|
open(anchor: PortholeCommentAnchor | string, options?: PortholeCommentOptions): Promise<boolean>;
|
|
34
34
|
}
|
|
@@ -11,8 +11,8 @@ interface PortholeDownload {
|
|
|
11
11
|
|
|
12
12
|
interface PortholeDownloads {
|
|
13
13
|
/**
|
|
14
|
-
* Hands the person a file to save (<a download> and script-driven saves don't work here)
|
|
15
|
-
*
|
|
14
|
+
* Hands the person a file to save (<a download> and script-driven saves don't work here);
|
|
15
|
+
* the app asks them first. Resolves true if the download started. Level: view.
|
|
16
16
|
*/
|
|
17
17
|
save(file: PortholeDownload): Promise<boolean>;
|
|
18
18
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
interface PortholeLinks {
|
|
4
4
|
/**
|
|
5
|
-
* Opens an http(s) link outside the page (a click on an <a href> does the same)
|
|
6
|
-
*
|
|
5
|
+
* Opens an http(s) link outside the page (a click on an <a href> does the same); the app asks
|
|
6
|
+
* the person first. Resolves true if it opened. Level: view.
|
|
7
7
|
*/
|
|
8
8
|
open(url: string): Promise<boolean>;
|
|
9
9
|
}
|