@optimuslabs/harness-map-staging 1.5.44 → 1.5.45
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.
|
@@ -31,27 +31,51 @@ function esc(value) {
|
|
|
31
31
|
.replace(/'/g, ''');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** Manrope, the website's typeface, shipped beside this script (SIL Open Font License, Manrope-OFL.txt). */
|
|
35
|
+
const FONT_FILE = 'manrope-latin-wght-normal.woff2';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The website's typeface as an embedded @font-face, read from the font file beside this script
|
|
39
|
+
* (osascript's own arguments name the script's path), so the window needs no network. '' when it
|
|
40
|
+
* cannot be read: the window then falls back to the system font.
|
|
41
|
+
*/
|
|
42
|
+
function fontFace() {
|
|
43
|
+
try {
|
|
44
|
+
const args = ObjC.deepUnwrap($.NSProcessInfo.processInfo.arguments) || [];
|
|
45
|
+
const script = args.find((a) => String(a).endsWith('agent_block_window.jxa'));
|
|
46
|
+
if (!script) return '';
|
|
47
|
+
const data = $.NSData.dataWithContentsOfFile(String(script).replace(/agent_block_window\.jxa$/, FONT_FILE));
|
|
48
|
+
if (!data || data.isNil()) return '';
|
|
49
|
+
const b64 = data.base64EncodedStringWithOptions(0).js;
|
|
50
|
+
return `@font-face { font-family: "Manrope"; src: url(data:font/woff2;base64,${b64}) format("woff2"); font-weight: 200 800; }`;
|
|
51
|
+
} catch (e) {
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The website's Manrope and logo, its brand green for the primary action and its 8px radius, on the
|
|
58
|
+
* window's own high-contrast colours: solid red and green boxes, near-white text. The website's
|
|
59
|
+
* zinc theme was tried and was harder to read in a small window.
|
|
60
|
+
*/
|
|
34
61
|
const STYLE = `
|
|
35
62
|
:root { color-scheme: dark; }
|
|
36
63
|
* { box-sizing: border-box; }
|
|
37
64
|
html, body { margin: 0; background: transparent; }
|
|
38
|
-
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont,
|
|
65
|
+
body { font: 14px/1.45 Manrope, -apple-system, BlinkMacSystemFont, sans-serif; color: #e8e8ea;
|
|
39
66
|
-webkit-user-select: none; cursor: default; }
|
|
40
67
|
.card { background: #2b2d31; }
|
|
41
|
-
header { display: flex; align-items: center; justify-content: space-between; padding:
|
|
68
|
+
header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px;
|
|
42
69
|
border-bottom: 1px solid #3a3c41; }
|
|
43
|
-
.
|
|
44
|
-
.logo { flex: none; width: 24px; height: 24px; border-radius: 50%; background: #c9f2cf; color: #15361c;
|
|
45
|
-
display: grid; place-items: center; font: 700 12px/1 ui-rounded, -apple-system, sans-serif; }
|
|
46
|
-
.logo.big { width: 44px; height: 44px; font-size: 18px; }
|
|
70
|
+
.logo { display: block; height: 40px; width: auto; margin: -4px 0 -4px -6px; }
|
|
47
71
|
.scope { font-size: 13px; color: #b7b8bc; }
|
|
48
72
|
main { padding: 22px 20px 18px; }
|
|
49
73
|
h1 { font-size: 22px; line-height: 1.25; font-weight: 700; margin: 0 0 16px; color: #fff; }
|
|
50
|
-
.box { border-radius:
|
|
74
|
+
.box { border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
|
|
51
75
|
.reason { background: #3a2224; border: 1px solid #7a3d3d; display: flex; gap: 12px; }
|
|
52
76
|
.reason .icon { flex: none; width: 18px; height: 18px; margin-top: 2px; border: 1.6px solid #f0a8a8;
|
|
53
|
-
border-radius: 50%; color: #f0a8a8; display: grid; place-items: center; font: 700 11px/1 sans-serif; }
|
|
54
|
-
.reason strong { display: block; color: #fff; font-size: 15px; margin-bottom: 4px; }
|
|
77
|
+
border-radius: 50%; color: #f0a8a8; display: grid; place-items: center; font: 700 11px/1 Manrope, sans-serif; }
|
|
78
|
+
.reason strong { display: block; color: #fff; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
|
|
55
79
|
.reason p { margin: 0; color: #dedee0; }
|
|
56
80
|
.reason hr { border: 0; border-top: 1px solid #7a3d3d; margin: 12px 0 10px; }
|
|
57
81
|
.findings { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
|
|
@@ -63,24 +87,25 @@ const STYLE = `
|
|
|
63
87
|
.row { display: flex; align-items: center; gap: 16px; }
|
|
64
88
|
.grow { flex: 1; }
|
|
65
89
|
.label { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8fd39a; }
|
|
66
|
-
.path h2 { margin: 4px 0 2px; font-size: 16px; color: #fff; }
|
|
90
|
+
.path h2 { margin: 4px 0 2px; font-size: 16px; font-weight: 700; color: #fff; }
|
|
67
91
|
.path p { margin: 0; color: #b9bdb9; font-size: 13px; }
|
|
68
92
|
.path p.sub { color: #d4e7d7; font-size: 13.5px; margin-bottom: 4px; }
|
|
69
93
|
.path hr { border: 0; border-top: 1px solid #44574a; margin: 14px 0 12px; }
|
|
70
94
|
.also { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: #b9bdb9; font-size: 13px; }
|
|
71
95
|
.chip { background: #2f3134; border: 1px solid #4b4d52; border-radius: 7px; padding: 5px 12px; color: #e8e8ea; font-size: 13px; }
|
|
72
96
|
button { font: inherit; cursor: pointer; border-radius: 8px; }
|
|
73
|
-
.primary { background: #
|
|
74
|
-
.primary:hover { background: #
|
|
97
|
+
.primary { background: #22c55e; color: #052e16; border: 0; padding: 10px 22px; font-weight: 700; font-size: 14px; white-space: nowrap; }
|
|
98
|
+
.primary:hover { background: #16a34a; }
|
|
75
99
|
.secondary { background: #3a3c41; color: #e8e8ea; border: 1px solid #4b4d52; padding: 8px 20px; font-size: 14px; }
|
|
76
100
|
.secondary:hover { background: #44464b; }
|
|
77
|
-
.link { background: none; border: 0; padding: 0; color: #
|
|
101
|
+
.link { background: none; border: 0; padding: 0; color: #4ade80; text-decoration: underline; font-size: 14px; }
|
|
78
102
|
footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px;
|
|
79
103
|
border-top: 1px solid #3a3c41; gap: 12px; }
|
|
80
104
|
`;
|
|
81
105
|
|
|
106
|
+
/** The website's wordmark for dark backgrounds (frontend_v2/src/assets/optimus_logo_darkbg.svg). */
|
|
82
107
|
function header(w, withScope) {
|
|
83
|
-
return `<header><
|
|
108
|
+
return `<header><svg class="logo" role="img" aria-label="${esc(w.brand)}" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 600 214.5"> <ellipse fill="#7cea9c" cx="122.2" cy="107.3" rx="72.1" ry="72.2"/> <g> <path fill="#ffffff" d="M86.3,107.4c0-9.7,3.5-18,10.4-24.8,7-6.8,15.5-10.2,25.5-10.2s18.6,3.4,25.6,10.3c6.9,6.9,10.4,15.3,10.4,25.3s-3.5,18.6-10.4,25.4c-7,6.8-15.6,10.2-25.8,10.2s-18.6-3.5-25.4-10.4c-6.8-6.8-10.2-15.4-10.2-25.7ZM102.2,107.6c0,6.7,1.8,12.1,5.4,16,3.7,4,8.6,5.9,14.6,5.9s11-2,14.6-5.9c3.6-3.9,5.5-9.2,5.5-15.7s-1.8-11.8-5.5-15.7c-3.7-4-8.6-6-14.6-6s-10.8,2-14.5,6c-3.7,4-5.5,9.1-5.5,15.4Z"/> <path fill="#ffffff" d="M187.2,178.2h-15.6v-104.1h15.6v7.3c6.1-6.1,13.1-9.2,20.9-9.2s16.9,3.4,22.9,10.2c6.1,6.8,9.1,15.3,9.1,25.7s-3,18.5-9.1,25.3c-6,6.7-13.6,10-22.7,10s-14.9-3.2-21.2-9.5v44.2ZM224.2,108.3c0-6.5-1.8-11.7-5.3-15.8-3.6-4.1-8-6.2-13.4-6.2s-10.4,2-13.9,6c-3.6,4-5.3,9.2-5.3,15.6s1.8,11.5,5.3,15.6c3.5,4,8.1,6,13.8,6s9.8-2,13.4-6.1c3.6-4.1,5.4-9.1,5.4-15.2Z"/> <path fill="#ffffff" d="M270.9,88.7v52.9h-15.6v-52.9h-6.6v-14.5h6.6v-24.7h15.6v24.7h12.1v14.5h-12.1Z"/> <path fill="#ffffff" d="M288.3,46.1c0-2.7,1-5.1,3-7.1,2-2,4.4-3,7.1-3s5.2,1,7.2,3c2,1.9,3,4.3,3,7.1s-1,5.2-3,7.2c-1.9,2-4.3,3-7.1,3s-5.2-1-7.2-3c-2-2-3-4.4-3-7.3ZM306.2,74.2v67.4h-15.6v-67.4h15.6Z"/> <path fill="#ffffff" d="M323,74.2h15.6v6.2c3-3.1,5.6-5.3,7.7-6.4,2.3-1.2,5.1-1.7,8.5-1.7,7.6,0,13.6,3.3,18.1,10,4.9-6.6,11.5-10,19.9-10,15.2,0,22.8,9.2,22.8,27.6v41.7h-15.6v-37.4c0-6.5-.8-11-2.4-13.7-1.6-2.7-4.3-4.1-8-4.1s-7.4,1.6-9.4,4.8c-2,3.2-2.9,8.4-2.9,15.6v34.8h-15.6v-37.2c0-12-3.5-18-10.4-18s-7.6,1.6-9.6,4.9c-2,3.3-3,8.4-3,15.5v34.8h-15.6v-67.4Z"/> <path fill="#ffffff" d="M447.6,74.2v38.7c0,11.2,4.4,16.7,13.2,16.7s13.2-5.6,13.2-16.7v-38.7h15.6v39c0,5.4-.7,10.1-2,14-1.3,3.5-3.5,6.7-6.7,9.5-5.3,4.6-11.9,6.8-20.1,6.8s-14.7-2.3-20-6.8c-3.2-2.8-5.5-6-6.8-9.5-1.3-3.1-1.9-7.8-1.9-14v-39h15.6Z"/> <path fill="#ffffff" d="M545.5,85.6l-12.9,6.8c-2-4.2-4.5-6.2-7.5-6.2s-2.7.5-3.7,1.4c-1,.9-1.5,2.2-1.5,3.6,0,2.6,3,5.1,9,7.7,8.3,3.6,13.8,6.8,16.7,9.8,2.9,3,4.3,7,4.3,12.1s-2.4,11.9-7.2,16.3c-4.7,4.2-10.3,6.2-16.9,6.2-11.3,0-19.3-5.5-24-16.5l13.3-6.2c1.8,3.2,3.3,5.3,4.2,6.2,1.9,1.8,4.2,2.6,6.8,2.6,5.3,0,7.9-2.4,7.9-7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M238.7,174.2c1.1,0,2.1-.3,2.9-.9.8-.6,1.5-1.3,2.1-2.2s1-1.9,1.2-2.9c.3-1,.4-2,.4-3,0-1.4-.3-2.5-.9-3.3-.6-.8-1.6-1.2-2.9-1.2s-2,.3-2.9.8-1.5,1.2-2.1,2.1c-.5.9-1,1.8-1.2,2.9-.3,1.1-.4,2.1-.4,3.1s.3,2.5.9,3.4c.6.8,1.6,1.2,2.8,1.2Z"/> <path fill="#7cea9c" d="M259.1,178.2c-1.6,0-3-.2-4.2-.7s-2.1-1.1-2.8-2c-.7-.9-1.1-1.9-1.2-3.1,0,0,0-.1,0-.2,0,0,0-.1,0-.2l4.6-.5c.1,1,.4,1.8,1,2.2.6.5,1.5.7,2.6.7s1.5-.1,2.2-.4,1.2-.6,1.7-1c.4-.4.7-.9.7-1.4s0-1-.4-1.4c-.4-.4-1-.6-1.9-.8l-3.4-.8c-1.8-.4-3.2-1.1-4-2.1-.8-1-1.2-2.2-1-3.7.1-1.3.6-2.5,1.5-3.5.9-1,2-1.7,3.3-2.2s2.8-.8,4.4-.8c2.3,0,4.1.5,5.3,1.4,1.2.9,2,2.1,2.2,3.6,0,0,0,.2,0,.3,0,0,0,.2,0,.3l-4.4.5c-.1-.7-.4-1.3-.9-1.8-.5-.5-1.3-.7-2.4-.7s-1.4.1-2,.3-1.2.5-1.6.9c-.4.4-.7.9-.7,1.4,0,.5,0,1,.4,1.4.4.4,1,.6,2,.9l3.4.7c1.8.4,3.2,1.1,4,2s1.2,2.1,1,3.6c-.1,1-.4,2-1,2.8-.5.8-1.3,1.5-2.2,2.1-.9.6-1.9,1-3.1,1.4-1.1.3-2.3.5-3.6.5Z"/> </g> </svg>${
|
|
84
109
|
withScope ? `<div class="scope">${esc(w.scope)}</div>` : ''
|
|
85
110
|
}</header>`;
|
|
86
111
|
}
|
|
@@ -135,7 +160,7 @@ function formView(w) {
|
|
|
135
160
|
}
|
|
136
161
|
|
|
137
162
|
function pageHtml(p, selfTest) {
|
|
138
|
-
return `<!doctype html><html><head><meta charset="utf-8"><style>${STYLE}</style></head><body>
|
|
163
|
+
return `<!doctype html><html><head><meta charset="utf-8"><style>${fontFace()}${STYLE}</style></head><body>
|
|
139
164
|
<div class="card" id="card">${formView(p.words)}</div>
|
|
140
165
|
<script>
|
|
141
166
|
const post = (m) => window.webkit.messageHandlers.optimus.postMessage(JSON.stringify(m));
|
|
@@ -144,10 +169,39 @@ function pageHtml(p, selfTest) {
|
|
|
144
169
|
document.querySelectorAll('[data-open]').forEach((b) => b.onclick = () => post({ action: 'open', agent: b.dataset.open, bundle_id: b.dataset.bundle }));
|
|
145
170
|
document.addEventListener('keydown', (e) => { if (e.key === 'Escape') post({ action: 'cancel' }); });
|
|
146
171
|
window.addEventListener('load', size);
|
|
172
|
+
// The web view keeps every click, so the window is moved from here: pressing the header (the
|
|
173
|
+
// logo bar, where a title bar would be) sends how far the pointer has moved on the screen.
|
|
174
|
+
const head = document.querySelector('header');
|
|
175
|
+
let from = null;
|
|
176
|
+
head.addEventListener('pointerdown', (e) => {
|
|
177
|
+
from = { x: e.screenX, y: e.screenY };
|
|
178
|
+
head.setPointerCapture(e.pointerId);
|
|
179
|
+
post({ type: 'drag', phase: 'start' });
|
|
180
|
+
});
|
|
181
|
+
head.addEventListener('pointermove', (e) => {
|
|
182
|
+
if (from) post({ type: 'drag', dx: e.screenX - from.x, dy: e.screenY - from.y });
|
|
183
|
+
});
|
|
184
|
+
const stop = () => { from = null; };
|
|
185
|
+
head.addEventListener('pointerup', stop);
|
|
186
|
+
head.addEventListener('pointercancel', stop);
|
|
147
187
|
${selfTest ? "window.addEventListener('load', () => setTimeout(() => post({ action: 'cancel' }), 300));" : ''}
|
|
148
188
|
</script></body></html>`;
|
|
149
189
|
}
|
|
150
190
|
|
|
191
|
+
/** Where the window was when the header was pressed. */
|
|
192
|
+
let dragOrigin = null;
|
|
193
|
+
|
|
194
|
+
/** Move the window by how far the pointer has moved since the header was pressed (screen y is down). */
|
|
195
|
+
function dragWindow(win, m) {
|
|
196
|
+
if (m.phase === 'start') {
|
|
197
|
+
const frame = win.frame;
|
|
198
|
+
dragOrigin = { x: frame.origin.x, y: frame.origin.y };
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (!dragOrigin || typeof m.dx !== 'number' || typeof m.dy !== 'number') return;
|
|
202
|
+
win.setFrameOrigin($.NSMakePoint(dragOrigin.x + m.dx, dragOrigin.y - m.dy));
|
|
203
|
+
}
|
|
204
|
+
|
|
151
205
|
function place(win, height) {
|
|
152
206
|
win.setContentSize($.NSMakeSize(WIDTH, Math.min(Math.max(height, 120), 900)));
|
|
153
207
|
win.center;
|
|
@@ -175,6 +229,10 @@ function run(argv) {
|
|
|
175
229
|
place(win, m.height);
|
|
176
230
|
return;
|
|
177
231
|
}
|
|
232
|
+
if (m.type === 'drag') {
|
|
233
|
+
dragWindow(win, m);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
178
236
|
result = m;
|
|
179
237
|
},
|
|
180
238
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optimuslabs/harness-map-staging",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.45",
|
|
4
4
|
"description": "CLI helpers for logging hardware UUIDs and posting startup payloads to Optimus Security.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dialog_prefs-staging": "dist/cli.js"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "tsc -p tsconfig.json && node ../../../scripts/ensure-bin-executable.mjs && node -e \"const fs=require('fs');fs.mkdirSync('dist/agent_block_window',{recursive:true});fs.copyFileSync('src/agent_block_window/
|
|
18
|
+
"build": "tsc -p tsconfig.json && node ../../../scripts/ensure-bin-executable.mjs && node -e \"const fs=require('fs');fs.mkdirSync('dist/agent_block_window',{recursive:true});for(const f of ['agent_block_window.jxa','manrope-latin-wght-normal.woff2','Manrope-OFL.txt'])fs.copyFileSync('src/agent_block_window/'+f,'dist/agent_block_window/'+f)\"",
|
|
19
19
|
"dev": "ts-node src/cli.ts",
|
|
20
20
|
"lint": "eslint \"src/**/*.ts\"",
|
|
21
21
|
"prepare": "npm run build",
|