@amd-gaia/agent-ui 0.26.1-rc.2 → 0.27.0-rc.10
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/bin/gaia-ui.cjs +57 -3
- package/dist/assets/AdvancedSettings-BLR8jrQ6.js +1 -0
- package/dist/assets/AutomationsSettings-Cl-NlbrD.js +1 -0
- package/dist/assets/ConnectorsPane-BGI8nBUb.css +1 -0
- package/dist/assets/ConnectorsPane-Dcuevs9v.js +1 -0
- package/dist/assets/DocumentLibrary-BHNYPjV3.js +5 -0
- package/dist/assets/DocumentLibrary-fEMoY7lH.css +1 -0
- package/dist/assets/FileBrowser-1goNp4CP.css +1 -0
- package/dist/assets/FileBrowser-Dosu_Lh8.js +4 -0
- package/dist/assets/MemoryDashboard-1g_y8lqR.js +1 -0
- package/dist/assets/MemoryDashboard-RpfLag-v.css +1 -0
- package/dist/assets/MessagingSettings-DkTMjERx.js +1 -0
- package/dist/assets/{MobileAccessModal-CX4NZmr4.css → MobileAccessModal-BrZMaERi.css} +1 -1
- package/dist/assets/MobileAccessModal-Cj_Qjsbv.js +2 -0
- package/dist/assets/ScheduleManager-B8xUdWID.js +1 -0
- package/dist/assets/ScheduleManager-BZzEH2-W.css +1 -0
- package/dist/assets/Temml-CCjoacWt.woff2 +0 -0
- package/dist/assets/index-bP0Mo7oA.css +1 -0
- package/dist/assets/index-eiWfnMcl.js +225 -0
- package/dist/assets/useFocusTrap-hXXaHKVF.js +6 -0
- package/dist/index.html +3 -3
- package/dist/sw.js +1 -1
- package/main.cjs +165 -101
- package/package.json +5 -3
- package/preload.cjs +34 -0
- package/services/auto-updater.cjs +99 -0
- package/services/backend-orphan.cjs +162 -1
- package/services/browser-pane/bridge-error.cjs +20 -0
- package/services/browser-pane/bridge-server.cjs +496 -0
- package/services/browser-pane/cdp-session.cjs +375 -0
- package/services/browser-pane/contract.d.ts +448 -0
- package/services/browser-pane/dev-servers.cjs +478 -0
- package/services/browser-pane/input.cjs +375 -0
- package/services/browser-pane/ipc.cjs +267 -0
- package/services/browser-pane/navigation-policy.cjs +255 -0
- package/services/browser-pane/pane-host.cjs +1686 -0
- package/services/browser-pane/picker-world.js +360 -0
- package/services/browser-pane/picker.cjs +261 -0
- package/services/browser-pane/service-ports.cjs +66 -0
- package/services/dev-qa-mode.cjs +32 -0
- package/services/quit-guard.cjs +8 -4
- package/services/ui-token.cjs +156 -0
- package/dist/assets/AdvancedSettings-C-9ErldS.js +0 -1
- package/dist/assets/AutomationsSettings-CL3K4hLZ.js +0 -1
- package/dist/assets/ConnectorsPane-DpGR78cA.js +0 -1
- package/dist/assets/ConnectorsPane-w-HLcq3n.css +0 -1
- package/dist/assets/DocumentLibrary-BKZdx6rJ.css +0 -1
- package/dist/assets/DocumentLibrary-N7tBbt9v.js +0 -5
- package/dist/assets/FileBrowser-CO2p3xa2.js +0 -4
- package/dist/assets/FileBrowser-CrRQXiPo.css +0 -1
- package/dist/assets/MemoryDashboard-1OIrKFIa.js +0 -1
- package/dist/assets/MemoryDashboard-B4AO_CU8.css +0 -1
- package/dist/assets/MessagingSettings-0AJnsoWA.js +0 -1
- package/dist/assets/MobileAccessModal-CnPB1BEN.js +0 -2
- package/dist/assets/ScheduleManager-BYOhqnfv.js +0 -1
- package/dist/assets/ScheduleManager-DQBnf_IN.css +0 -1
- package/dist/assets/index-Bkx-QRv4.css +0 -1
- package/dist/assets/index-C-3wCH_s.js +0 -116
- package/dist/assets/useT-DuzpQY8p.js +0 -6
- package/dist/assets/zap-gF9QDKfa.js +0 -1
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
* - installVersion(tag) → downgrade/install a specific tagged release
|
|
42
42
|
* - clearPin() → resume auto-updates (clear the version pin)
|
|
43
43
|
* - revertUpdate() → go back to the version before the last update
|
|
44
|
+
* - markSetupWorked() → note that setup finished on the running version
|
|
45
|
+
* - revertToLastWorking() → go back to the last version setup finished on
|
|
44
46
|
* - setAutoUpdate(enabled) → persist the auto-update preference
|
|
45
47
|
* - downloadUpdate() → download the offered update ("Update now")
|
|
46
48
|
* - restartToInstall() → restart into a downloaded update
|
|
@@ -92,6 +94,8 @@ const PICKER_FEED_PAGES = 3;
|
|
|
92
94
|
// Where a restart notes the update it started: a silent install that fails
|
|
93
95
|
// shows nothing, so the next launch is what finds out.
|
|
94
96
|
const INSTALL_ATTEMPT_PATH = path.join(os.homedir(), ".gaia", "update-attempt.json");
|
|
97
|
+
// The last app version first-run setup finished on, and when: {version, at}.
|
|
98
|
+
const LAST_WORKING_PATH = path.join(os.homedir(), ".gaia", "last-working-version.json");
|
|
95
99
|
const PREVIOUS_VERSION_KEY = "previousAppVersion";
|
|
96
100
|
const LAUNCHES_SINCE_UPDATE_KEY = "launchesSinceUpdate";
|
|
97
101
|
// Same cap as the TUI's sumsAtOnce, to go easy on proxies.
|
|
@@ -343,6 +347,8 @@ const state = {
|
|
|
343
347
|
pinnedVersion: null,
|
|
344
348
|
previousVersion: null,
|
|
345
349
|
startFailed: false,
|
|
350
|
+
// An older version setup last finished on, {version, at}, or null.
|
|
351
|
+
lastWorking: null,
|
|
346
352
|
autoUpdate: false,
|
|
347
353
|
// Offer release candidates too; off by default. A release-candidate build
|
|
348
354
|
// is offered newer candidates without it.
|
|
@@ -1225,6 +1231,80 @@ async function revertUpdate() {
|
|
|
1225
1231
|
}
|
|
1226
1232
|
}
|
|
1227
1233
|
|
|
1234
|
+
/** Installing an older release in-app is proven only for the Windows setup and the AppImage. */
|
|
1235
|
+
function _canInstallOlder() {
|
|
1236
|
+
return process.platform === "win32" || (process.platform === "linux" && Boolean(process.env.APPIMAGE));
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* The older version setup last finished on, as {version, at}, or null. Only a
|
|
1241
|
+
* version that really finished setup on this PC counts. Works before init().
|
|
1242
|
+
*/
|
|
1243
|
+
function lastWorkingVersion() {
|
|
1244
|
+
if (isDisabled() || !_canInstallOlder()) return null;
|
|
1245
|
+
const { version, at } = _readJsonFile(LAST_WORKING_PATH);
|
|
1246
|
+
if (typeof version !== "string" || typeof at !== "string" || Number.isNaN(Date.parse(at))) return null;
|
|
1247
|
+
return _compareVersions(version, _runningVersion()) < 0 ? { version, at } : null;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/** Setup finished on the running version: it is the one to come back to. Throws when it can't be saved. */
|
|
1251
|
+
function markSetupWorked() {
|
|
1252
|
+
const record = { version: _runningVersion(), at: new Date().toISOString() };
|
|
1253
|
+
fs.mkdirSync(path.dirname(LAST_WORKING_PATH), { recursive: true });
|
|
1254
|
+
const tmp = `${LAST_WORKING_PATH}.${process.pid}.tmp`;
|
|
1255
|
+
fs.writeFileSync(tmp, JSON.stringify(record));
|
|
1256
|
+
fs.renameSync(tmp, LAST_WORKING_PATH);
|
|
1257
|
+
setState({ lastWorking: lastWorkingVersion() });
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Go back to the version setup last finished on, pinned so the broken one
|
|
1262
|
+
* isn't reinstalled. A failed setup is the user's call to make, so a pin they
|
|
1263
|
+
* set doesn't stop it; a failed install puts that pin back.
|
|
1264
|
+
*/
|
|
1265
|
+
async function revertToLastWorking() {
|
|
1266
|
+
const last = lastWorkingVersion();
|
|
1267
|
+
if (!last) {
|
|
1268
|
+
throw _userError(
|
|
1269
|
+
"noEarlier",
|
|
1270
|
+
{ url: RELEASES_PAGE },
|
|
1271
|
+
`There is no earlier GAIA version to go back to on this PC. Pick one in Settings → General → Updates, or download it from ${RELEASES_PAGE}.`
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1274
|
+
if (state.status === STATES.DOWNLOADING) {
|
|
1275
|
+
throw _userError("checkBusy", {}, "An update is already downloading — try again in a moment.");
|
|
1276
|
+
}
|
|
1277
|
+
log("info", `Setup failed on GAIA ${_runningVersion()}: going back to ${last.version}, where it last finished`);
|
|
1278
|
+
const tag = _tagForVersion(last.version);
|
|
1279
|
+
const userPin = state.pinnedVersion;
|
|
1280
|
+
try {
|
|
1281
|
+
await installVersion(tag);
|
|
1282
|
+
} catch (err) {
|
|
1283
|
+
// A refused restart leaves the pin and the download: neither may outlive it.
|
|
1284
|
+
if (state.pinnedVersion === tag) {
|
|
1285
|
+
clearPin();
|
|
1286
|
+
if (userPin) {
|
|
1287
|
+
try {
|
|
1288
|
+
_savePin(userPin);
|
|
1289
|
+
setState({ pinnedVersion: userPin });
|
|
1290
|
+
// clearPin() turned auto-download on and swapped to the forward feed.
|
|
1291
|
+
autoUpdaterRef.setFeedURL(_releaseFeed(userPin));
|
|
1292
|
+
_applyInstallPolicy();
|
|
1293
|
+
} catch (pinErr) {
|
|
1294
|
+
const reason = (pinErr && pinErr.message) || String(pinErr);
|
|
1295
|
+
log("error", `Couldn't put back the pin to ${userPin}:`, reason);
|
|
1296
|
+
throw _userError(
|
|
1297
|
+
"failedWith",
|
|
1298
|
+
{ reason: `${err.message} The pin to ${userPin} could not be put back in ${UPDATE_CONFIG_PATH} (${reason}).` },
|
|
1299
|
+
`${err.message} The pin to ${userPin} could not be put back: ${reason}`
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
throw err;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1228
1308
|
/** True for the first few launches after an update landed, the only time a failed start blames it. */
|
|
1229
1309
|
function _updateIsRecent() {
|
|
1230
1310
|
// An attempt from the running version is a failed install, not an update.
|
|
@@ -1668,6 +1748,14 @@ function registerIpcHandlers() {
|
|
|
1668
1748
|
await revertUpdate();
|
|
1669
1749
|
return getState();
|
|
1670
1750
|
});
|
|
1751
|
+
ipcMain.handle("gaia:update:setup-worked", () => {
|
|
1752
|
+
markSetupWorked();
|
|
1753
|
+
return getState();
|
|
1754
|
+
});
|
|
1755
|
+
ipcMain.handle("gaia:update:revert-to-working", async () => {
|
|
1756
|
+
await revertToLastWorking();
|
|
1757
|
+
return getState();
|
|
1758
|
+
});
|
|
1671
1759
|
ipcMain.handle("gaia:update:resume", async () => {
|
|
1672
1760
|
clearPin();
|
|
1673
1761
|
return getState();
|
|
@@ -1703,6 +1791,8 @@ function unregisterIpcHandlers() {
|
|
|
1703
1791
|
"gaia:update:list-releases",
|
|
1704
1792
|
"gaia:update:install-version",
|
|
1705
1793
|
"gaia:update:revert",
|
|
1794
|
+
"gaia:update:setup-worked",
|
|
1795
|
+
"gaia:update:revert-to-working",
|
|
1706
1796
|
"gaia:update:resume",
|
|
1707
1797
|
"gaia:update:set-auto-update",
|
|
1708
1798
|
"gaia:update:set-include-prereleases",
|
|
@@ -1813,6 +1903,7 @@ function init(mainWindow, options = {}) {
|
|
|
1813
1903
|
}
|
|
1814
1904
|
_readInstallOutcome();
|
|
1815
1905
|
state.previousVersion = previousVersion();
|
|
1906
|
+
state.lastWorking = lastWorkingVersion();
|
|
1816
1907
|
} catch (err) {
|
|
1817
1908
|
log("error", "Failed to load electron-updater:", err && err.message);
|
|
1818
1909
|
setState({
|
|
@@ -1909,6 +2000,11 @@ function _initDisabled() {
|
|
|
1909
2000
|
state.currentVersion = electron.app.getVersion() || null;
|
|
1910
2001
|
if (!ipcHandlersRegistered) {
|
|
1911
2002
|
electron.ipcMain.handle("gaia:update:get-status", () => getState());
|
|
2003
|
+
// Still recorded, so turning updates back on knows where setup worked.
|
|
2004
|
+
electron.ipcMain.handle("gaia:update:setup-worked", () => {
|
|
2005
|
+
markSetupWorked();
|
|
2006
|
+
return getState();
|
|
2007
|
+
});
|
|
1912
2008
|
ipcHandlersRegistered = true;
|
|
1913
2009
|
}
|
|
1914
2010
|
}
|
|
@@ -1962,6 +2058,9 @@ module.exports = {
|
|
|
1962
2058
|
installVersion,
|
|
1963
2059
|
previousVersion,
|
|
1964
2060
|
revertUpdate,
|
|
2061
|
+
lastWorkingVersion,
|
|
2062
|
+
markSetupWorked,
|
|
2063
|
+
revertToLastWorking,
|
|
1965
2064
|
reportStartFailure,
|
|
1966
2065
|
clearStartFailure,
|
|
1967
2066
|
clearPin,
|
|
@@ -11,8 +11,16 @@
|
|
|
11
11
|
// unrelated user process (issue #782 TOCTOU mitigation).
|
|
12
12
|
|
|
13
13
|
const realFs = require("fs");
|
|
14
|
+
const path = require("path");
|
|
14
15
|
const { spawnSync: realSpawnSync } = require("child_process");
|
|
15
16
|
|
|
17
|
+
// One record per running app, named for the app's pid: two copies of the app
|
|
18
|
+
// sharing ~/.gaia (an installed app and a dev build) must not see each other's
|
|
19
|
+
// live backend as an orphan (issue #7062).
|
|
20
|
+
const PIDFILE_DIR = "backend-pids";
|
|
21
|
+
// Written by versions before per-app records; read only to clean up after them.
|
|
22
|
+
const LEGACY_PIDFILE = "backend.pid";
|
|
23
|
+
|
|
16
24
|
// Legitimate backend invocation is `gaia chat --ui --ui-port <port>`. Match on
|
|
17
25
|
// "gaia" plus one of the backend-specific flags so unrelated Python/Node
|
|
18
26
|
// processes (Jupyter, LSP, etc.) are never matched.
|
|
@@ -80,4 +88,157 @@ function isGaiaBackendProcess(pid, deps = {}) {
|
|
|
80
88
|
return false;
|
|
81
89
|
}
|
|
82
90
|
|
|
83
|
-
|
|
91
|
+
function pidAlive(pid) {
|
|
92
|
+
try {
|
|
93
|
+
process.kill(pid, 0);
|
|
94
|
+
return true;
|
|
95
|
+
} catch (err) {
|
|
96
|
+
// EPERM: it exists but belongs to someone else.
|
|
97
|
+
return err.code === "EPERM";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function backendRecordPath(gaiaDir, ownerPid) {
|
|
102
|
+
return path.join(gaiaDir, PIDFILE_DIR, `${ownerPid}.pid`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Record that app `ownerPid` started backend `backendPid`. Returns the file written. */
|
|
106
|
+
function recordBackend({ gaiaDir, ownerPid, backendPid, fs = realFs }) {
|
|
107
|
+
const file = backendRecordPath(gaiaDir, ownerPid);
|
|
108
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
109
|
+
fs.writeFileSync(file, String(backendPid), { mode: 0o600 });
|
|
110
|
+
return file;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Remove app `ownerPid`'s record, but only while it still names `backendPid`. */
|
|
114
|
+
function forgetBackend({ gaiaDir, ownerPid, backendPid, fs = realFs }) {
|
|
115
|
+
const file = backendRecordPath(gaiaDir, ownerPid);
|
|
116
|
+
let recorded;
|
|
117
|
+
try {
|
|
118
|
+
recorded = parseInt(fs.readFileSync(file, "utf8").trim(), 10);
|
|
119
|
+
} catch (err) {
|
|
120
|
+
if (err.code === "ENOENT") return false;
|
|
121
|
+
throw err;
|
|
122
|
+
}
|
|
123
|
+
if (recorded !== backendPid) return false;
|
|
124
|
+
fs.unlinkSync(file);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Stop every recorded backend whose app is gone, and delete its record.
|
|
130
|
+
* A backend whose app is still running is left alone, record and all: it
|
|
131
|
+
* belongs to another copy of the app sharing this ~/.gaia.
|
|
132
|
+
*
|
|
133
|
+
* @returns {Promise<{ killed: number[], kept: number[] }>} backend pids
|
|
134
|
+
*/
|
|
135
|
+
async function cleanupOrphanedBackends({
|
|
136
|
+
gaiaDir,
|
|
137
|
+
selfPid = process.pid,
|
|
138
|
+
killBackend,
|
|
139
|
+
isBackend = isGaiaBackendProcess,
|
|
140
|
+
isAlive = pidAlive,
|
|
141
|
+
fs = realFs,
|
|
142
|
+
logger = console,
|
|
143
|
+
}) {
|
|
144
|
+
const killed = [];
|
|
145
|
+
const kept = [];
|
|
146
|
+
|
|
147
|
+
async function stopIfBackend(backendPid, source) {
|
|
148
|
+
let confirmed = false;
|
|
149
|
+
try {
|
|
150
|
+
confirmed = isBackend(backendPid);
|
|
151
|
+
} catch (err) {
|
|
152
|
+
logger.warn(`[main] Could not verify pid ${backendPid} from ${source}: ${err.message}`);
|
|
153
|
+
}
|
|
154
|
+
if (!confirmed) {
|
|
155
|
+
logger.log(`[main] PID ${backendPid} from ${source} is not a GAIA backend; skipping kill`);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
await killBackend(backendPid);
|
|
160
|
+
killed.push(backendPid);
|
|
161
|
+
logger.log(`[main] Stopped orphaned backend pid ${backendPid} (from ${source})`);
|
|
162
|
+
} catch (err) {
|
|
163
|
+
logger.warn(`[main] Could not stop orphaned backend pid ${backendPid}: ${err.message}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function readPid(file) {
|
|
168
|
+
return parseInt(fs.readFileSync(file, "utf8").trim(), 10);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function remove(file) {
|
|
172
|
+
try {
|
|
173
|
+
fs.unlinkSync(file);
|
|
174
|
+
} catch (err) {
|
|
175
|
+
if (err.code !== "ENOENT") logger.warn(`[main] Could not remove ${file}: ${err.message}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const legacy = path.join(gaiaDir, LEGACY_PIDFILE);
|
|
180
|
+
if (fs.existsSync(legacy)) {
|
|
181
|
+
try {
|
|
182
|
+
const backendPid = readPid(legacy);
|
|
183
|
+
if (!Number.isNaN(backendPid)) await stopIfBackend(backendPid, LEGACY_PIDFILE);
|
|
184
|
+
} catch (err) {
|
|
185
|
+
logger.warn(`[main] Failed reading ${legacy}: ${err.message}`);
|
|
186
|
+
}
|
|
187
|
+
remove(legacy);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const dir = path.join(gaiaDir, PIDFILE_DIR);
|
|
191
|
+
let names = [];
|
|
192
|
+
try {
|
|
193
|
+
names = fs.readdirSync(dir);
|
|
194
|
+
} catch (err) {
|
|
195
|
+
if (err.code !== "ENOENT") logger.warn(`[main] Could not list ${dir}: ${err.message}`);
|
|
196
|
+
}
|
|
197
|
+
for (const name of names) {
|
|
198
|
+
const m = /^(\d+)\.pid$/.exec(name);
|
|
199
|
+
if (!m) continue;
|
|
200
|
+
const ownerPid = Number(m[1]);
|
|
201
|
+
const file = path.join(dir, name);
|
|
202
|
+
let backendPid;
|
|
203
|
+
try {
|
|
204
|
+
backendPid = readPid(file);
|
|
205
|
+
} catch (err) {
|
|
206
|
+
logger.warn(`[main] Failed reading ${file}: ${err.message}`);
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (ownerPid !== selfPid && isAlive(ownerPid)) {
|
|
210
|
+
// A record whose backend is gone is stale, even if its app's pid is now
|
|
211
|
+
// someone else's; it can never protect a live backend, so drop it.
|
|
212
|
+
let stale = false;
|
|
213
|
+
if (!Number.isNaN(backendPid)) {
|
|
214
|
+
try {
|
|
215
|
+
stale = !isBackend(backendPid);
|
|
216
|
+
} catch (err) {
|
|
217
|
+
logger.warn(`[main] Could not verify pid ${backendPid} from ${PIDFILE_DIR}/${name}: ${err.message}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (stale) {
|
|
221
|
+
logger.log(`[main] Backend pid ${backendPid} of app pid ${ownerPid} is gone; removing its record`);
|
|
222
|
+
remove(file);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (!Number.isNaN(backendPid)) kept.push(backendPid);
|
|
226
|
+
logger.log(`[main] Backend pid ${backendPid} belongs to running GAIA app pid ${ownerPid}; leaving it`);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (!Number.isNaN(backendPid)) await stopIfBackend(backendPid, `${PIDFILE_DIR}/${name}`);
|
|
230
|
+
remove(file);
|
|
231
|
+
}
|
|
232
|
+
return { killed, kept };
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
module.exports = {
|
|
236
|
+
isGaiaBackendProcess,
|
|
237
|
+
commandLooksLikeBackend,
|
|
238
|
+
cleanupOrphanedBackends,
|
|
239
|
+
recordBackend,
|
|
240
|
+
forgetBackend,
|
|
241
|
+
backendRecordPath,
|
|
242
|
+
PIDFILE_DIR,
|
|
243
|
+
LEGACY_PIDFILE,
|
|
244
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright(C) 2026 Advanced Micro Devices, Inc. All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/** An agent op's failure, with a code from BridgeErrorCode and a message written for the model. */
|
|
7
|
+
class BridgeError extends Error {
|
|
8
|
+
/**
|
|
9
|
+
* @param {import("./contract").BridgeErrorCode} code
|
|
10
|
+
* @param {string} message
|
|
11
|
+
* @param {Record<string, unknown>} [data]
|
|
12
|
+
*/
|
|
13
|
+
constructor(code, message, data = {}) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.data = data;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = { BridgeError };
|