-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
85 lines (77 loc) · 2.87 KB
/
Copy pathapp.js
File metadata and controls
85 lines (77 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
(function () {
const fields = ["actor", "action", "target", "authority", "execution", "evidence", "replay", "recognition", "recourse", "closure"];
const output = document.getElementById("frameOutput");
const status = document.getElementById("consoleStatus");
function value(id) {
const el = document.getElementById(id);
return el ? el.value.trim() : "";
}
function frame() {
const now = new Date().toISOString();
return {
object_type: "BOUNDARYCAM_BOUNDARY_FRAME",
version: "0.4.0",
generated_at: now,
primary_question: "What crossed the boundary?",
frame_id: "BCAM-" + now.replace(/[-:.TZ]/g, "").slice(0, 14),
actor: value("actor"),
action: value("action"),
target: value("target"),
authority: value("authority"),
execution: value("execution"),
evidence: value("evidence"),
replay: value("replay"),
recognition: value("recognition"),
recourse: value("recourse"),
closure: value("closure"),
public_only: true
};
}
function render() {
if (!output) return;
output.textContent = JSON.stringify(frame(), null, 2);
if (status) status.textContent = "Boundary Frame generated.";
}
function loadExample() {
const example = {
actor: "autonomous.browser.agent",
action: "submitted a production form",
target: "external customer-facing web endpoint",
authority: "user-approved capability admission",
execution: "HTTP submission completed",
evidence: "timestamp, request digest, response digest, replay pointer",
replay: "cold replay available from evidence bundle",
recognition: "boundary crossing acknowledged",
recourse: "manual review and rollback path declared",
closure: "public completion state explicit"
};
fields.forEach((id) => {
const el = document.getElementById(id);
if (el) el.value = example[id];
});
render();
}
async function copyFrame() {
render();
if (!output) return;
await navigator.clipboard.writeText(output.textContent);
if (status) status.textContent = "Boundary Frame copied.";
}
function downloadFrame() {
render();
if (!output) return;
const blob = new Blob([output.textContent + "\n"], { type: "application/json" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "boundarycam-frame.json";
a.click();
URL.revokeObjectURL(url);
if (status) status.textContent = "Boundary Frame downloaded.";
}
document.getElementById("buildFrame")?.addEventListener("click", render);
document.getElementById("loadExample")?.addEventListener("click", loadExample);
document.getElementById("copyFrame")?.addEventListener("click", copyFrame);
document.getElementById("downloadFrame")?.addEventListener("click", downloadFrame);
if (output) render();
})();