@optimuslabs/harness-map-staging 1.5.41 → 1.5.42

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.
@@ -30,6 +30,11 @@ const KINDS = ['agent', 'login', 'skill'];
30
30
  const BUNDLE_ID = /^[A-Za-z0-9][A-Za-z0-9.-]{0,254}$/;
31
31
  /** Where the gate leaves a login block's words for the runner: a folder of its own under tmpdir. */
32
32
  const WORDS_PREFIX = 'optimus-window-words-';
33
+ /**
34
+ * How long the window may stay open. It waits for a person, so this is long; it exists so a window
35
+ * that never appears (osascript stuck before drawing) is stopped and reported, not left spinning.
36
+ */
37
+ const WINDOW_TIME_LIMIT_MS = 5 * 60 * 1000;
33
38
  /** Write a login block's words where only the runner reads them; returns the file's path. */
34
39
  function writeWords(words) {
35
40
  const dir = mkdtempSync(join(tmpdir(), WORDS_PREFIX));
@@ -108,19 +113,39 @@ function agentVersion(agent) {
108
113
  const out = spawnSync('plutil', ['-extract', 'CFBundleShortVersionString', 'raw', plist], { encoding: 'utf8' });
109
114
  return out.status === 0 ? (out.stdout || '').trim().slice(0, 32) : '';
110
115
  }
116
+ /**
117
+ * True when this process is Intel code under Rosetta on Apple Silicon (an x64 node, such as Intel
118
+ * Homebrew's). Its children run as Intel code too, and osascript as Intel code hangs in
119
+ * `ObjC.registerSubclass` before the window is drawn. False on a real Intel Mac (no such sysctl).
120
+ */
121
+ export function underRosetta() {
122
+ const out = spawnSync('sysctl', ['-n', 'sysctl.proc_translated'], { encoding: 'utf8' });
123
+ return out.status === 0 && (out.stdout || '').trim() === '1';
124
+ }
125
+ /** The osascript command line for the window: native arm64 through `arch` when under Rosetta. */
126
+ function osascriptCommand(args, rosetta) {
127
+ return rosetta ? ['/usr/bin/arch', ['-arm64', '/usr/bin/osascript', ...args]] : ['osascript', args];
128
+ }
111
129
  /** Draw the window and return what the user did; null when it could not open. */
112
130
  export function showWindow(words) {
113
131
  return drawWindow(words).result;
114
132
  }
115
133
  /** Draw the window: what the user did, or why it could not be shown (`error`, '' when it was). */
116
- export function drawWindow(words) {
134
+ export function drawWindow(words, rosetta = underRosetta()) {
117
135
  if (!words)
118
136
  return { result: null, error: 'no words to show' };
119
137
  const dir = mkdtempSync(join(tmpdir(), 'optimus-window-'));
120
138
  const payloadPath = join(dir, 'payload.json');
121
139
  try {
122
140
  writeFileSync(payloadPath, JSON.stringify({ words }));
123
- const out = spawnSync('osascript', ['-l', 'JavaScript', WINDOW_SCRIPT, payloadPath], { encoding: 'utf8' });
141
+ const [cmd, args] = osascriptCommand(['-l', 'JavaScript', WINDOW_SCRIPT, payloadPath], rosetta);
142
+ // A fixed command, no shell: osascript (or arch running it) with our own script and payload.
143
+ const out = spawnSync(cmd, args, { encoding: 'utf8', timeout: WINDOW_TIME_LIMIT_MS }); // nosafe: SAFE801
144
+ if (out.error?.code === 'ETIMEDOUT') {
145
+ const error = `osascript stopped: still running after ${WINDOW_TIME_LIMIT_MS / 1000}s`;
146
+ hookRunLog(`agent_access_window: ${error}`);
147
+ return { result: null, error };
148
+ }
124
149
  if (out.status !== 0) {
125
150
  const error = `osascript failed (exit ${out.status ?? out.signal}): ${(out.stderr || out.error?.message || '').trim()}`;
126
151
  hookRunLog(`agent_access_window: ${error}`);
@@ -156,13 +181,20 @@ export function actOn(result) {
156
181
  */
157
182
  export async function runAgentAccessWindow(agent, kind, wordsPath = '') {
158
183
  const launched = process.env[JOB_LABEL_ENV] ? 'launchd' : 'spawn';
159
- const metadata = { darwin: release(), kind, launched, agent_version: agentVersion(agent) };
184
+ const rosetta = underRosetta();
185
+ const metadata = {
186
+ darwin: release(),
187
+ kind,
188
+ launched,
189
+ rosetta: rosetta ? 'yes' : 'no',
190
+ agent_version: agentVersion(agent),
191
+ };
160
192
  // The server knows a fixed set of units; the window is part of the prompt gate's compliance.
161
193
  // "started" first: a window process the agent stopped never reports more, and that shows.
162
194
  const report = { unit: 'compliance', command: 'agent_access_window', metadata };
163
195
  await reportFunctionalRun({ ...report, outcome: 'started', message: `${agent}: window process started (${launched})` });
164
196
  const words = wordsPath ? readWords(wordsPath) : syncedWindow(agent);
165
- const { result, error } = drawWindow(words ?? undefined);
197
+ const { result, error } = drawWindow(words ?? undefined, rosetta);
166
198
  if (result)
167
199
  actOn(result);
168
200
  await reportFunctionalRun({
@@ -0,0 +1,93 @@
1
+ Copyright 2019 The Manrope Project Authors (https://github.com/sharanda/manrope)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimuslabs/harness-map-staging",
3
- "version": "1.5.41",
3
+ "version": "1.5.42",
4
4
  "description": "CLI helpers for logging hardware UUIDs and posting startup payloads to Optimus Security.",
5
5
  "type": "module",
6
6
  "bin": {