glidercli 0.4.34 → 0.4.37
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/README.md +44 -3
- package/bin/glider.js +63 -10
- package/docs/setup.json +1 -1
- package/lib/__pycache__/mitmproxy-exact-capture.cpython-313.pyc +0 -0
- package/lib/bserve.js +15 -11
- package/lib/glider-daemon.sh +26 -14
- package/lib/headless-runtime.js +2443 -107
- package/lib/mitmproxy-exact-capture.py +222 -0
- package/lib/status-model.js +54 -0
- package/lib/target-registry.js +100 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ glider loop hn-scrape.yaml
|
|
|
131
131
|
|
|
132
132
|
| Output | Path |
|
|
133
133
|
|--------|------|
|
|
134
|
-
| daemon log |
|
|
134
|
+
| LaunchAgent daemon log | AGLOGS namespace `glider/relay` |
|
|
135
135
|
| domain index | `~/.glider/config/domains.json` |
|
|
136
136
|
| per-host intel | `~/.glider/warch/HOST/glider.json` |
|
|
137
137
|
| explore cache | `~/.glider/bexplore/HOST/` |
|
|
@@ -162,6 +162,47 @@ Subscribers export `apiVersion = "headless-subscriber/v1"`, `configure()`, and
|
|
|
162
162
|
operator's GUI browser. Cookie rotation is exported only after the subscriber
|
|
163
163
|
calls `markAuthenticated()`.
|
|
164
164
|
|
|
165
|
+
Subscribers that set `captureMode: "exhaustive"` receive an append-only
|
|
166
|
+
`cdp-stream.jsonl` journal containing every CDP command, response, and event.
|
|
167
|
+
Obtainable request and response payloads are written as separate hashed files;
|
|
168
|
+
loaded script sources and advertised source-map references are indexed. Set
|
|
169
|
+
`captureAdvertisedSourceMaps: true` to preserve same-origin maps explicitly
|
|
170
|
+
advertised by those scripts as hashed artifacts.
|
|
171
|
+
Set `captureProxyTraffic: true` to add browser-scoped proxy evidence. Glider
|
|
172
|
+
launches pinned mitmproxy 12.3.1 through an installed `mitmdump` or a pinned
|
|
173
|
+
`uv` fallback, binds it only to an ephemeral `127.0.0.1` port, and passes
|
|
174
|
+
`--proxy-server` only to the disposable browser. HTTPS interception trusts only
|
|
175
|
+
the run's ephemeral CA through Chromium's SPKI allowlist; Glider does not alter
|
|
176
|
+
the system proxy, keychain, or trust store and does not use blanket certificate
|
|
177
|
+
error suppression. When standard HTTP proxy environment variables are present,
|
|
178
|
+
the private mitmproxy chains through that upstream without changing system
|
|
179
|
+
settings. The private `proxy/` tree retains the mitmdump log, native
|
|
180
|
+
flow file, HAR, CA confdir, and `exact/` capture. Glider's mitmproxy addon writes
|
|
181
|
+
raw request/response bytes to hashed private artifacts and appends terminal
|
|
182
|
+
`response` or `error` rows to `exact/flows.jsonl`; hashes and lengths are
|
|
183
|
+
validated before reconciliation. Requested proxy startup, addon capture, or
|
|
184
|
+
finalization failure always fails the run closed.
|
|
185
|
+
|
|
186
|
+
When CDP cannot return a response body or redirect-hop body, the exhaustive
|
|
187
|
+
manifest conservatively correlates validated exact-flow entries by method, URL,
|
|
188
|
+
status, and chronological occurrence. HAR request `postData` is retained only
|
|
189
|
+
as HAR evidence and is never promoted as byte-exact. Ambiguous matches remain
|
|
190
|
+
capture issues. Successful CDP bodies remain authoritative. Only an addon
|
|
191
|
+
terminal `response` can close an unfinished response; terminal `error` rows
|
|
192
|
+
retain partial bytes and error evidence while remaining incomplete. Exact
|
|
193
|
+
failed source-map fetches retain a terminal HTTP disposition and body instead
|
|
194
|
+
of claiming map bytes;
|
|
195
|
+
captured `webpack://` script references are classified as non-fetchable virtual
|
|
196
|
+
references. Neither case is reported as a byte gap, while missing evidence
|
|
197
|
+
still fails completeness. The manifest keeps terminal failures closed by proxy
|
|
198
|
+
evidence under `resolvedIssues`; `issues` contains only unresolved failures, so
|
|
199
|
+
a complete run has both `complete: true` and an empty `issues` array without
|
|
200
|
+
discarding the original failure and resolution trail.
|
|
201
|
+
`context.checkpoint(NAME)` additionally records MHTML, DOM and accessibility
|
|
202
|
+
snapshots, frame/resource trees, browser storage, cookies, form validity, and
|
|
203
|
+
performance state. Set `requireCompleteCapture: true` to fail closed when the
|
|
204
|
+
capture manifest reports an observable payload or script gap.
|
|
205
|
+
|
|
165
206
|
| Env | Default | Role |
|
|
166
207
|
|-----|---------|------|
|
|
167
208
|
| `GLIDER` | `~/.glider` | home: config, cache, warch |
|
|
@@ -224,8 +265,8 @@ CLI 0.4.18 expects an extension with `listTabs` plus `incognito` on tabs/windows
|
|
|
224
265
|
| `glider click` | click |
|
|
225
266
|
| `glider type` | type |
|
|
226
267
|
| `glider screenshot` | PNG |
|
|
227
|
-
| `glider frozen` | detect frozen tab |
|
|
228
|
-
| `glider thaw` | unfreeze tab |
|
|
268
|
+
| `glider frozen` | detect frozen tab (detect only; unknown flags/args fail closed) |
|
|
269
|
+
| `glider thaw` | unfreeze tab (`--verify` / `--all`). Not a subcommand of `frozen` |
|
|
229
270
|
| `glider explore` | crawl + HAR |
|
|
230
271
|
| `glider resolve` | host warch |
|
|
231
272
|
| `glider run` | YAML task |
|
package/bin/glider.js
CHANGED
|
@@ -115,7 +115,6 @@ const { configPath, gliderHome, stateDir, capturesDir, scratchDir } = require(pa
|
|
|
115
115
|
const STATE_FILE = path.join(stateDir(), 'glider-state.json');
|
|
116
116
|
const { isBrowserInternalUrl, loadBrowserConfig } = require(path.join(LIB_DIR, 'browser-config.js'));
|
|
117
117
|
const GLIDER = gliderHome();
|
|
118
|
-
const LOG_FILE = path.join(GLIDER, 'relay.log');
|
|
119
118
|
const SESSION_STORE = path.join(GLIDER, 'config', 'active-session.json');
|
|
120
119
|
const { resolveAllowedDomains, assertUrlAllowed, urlAllowed } = require(path.join(LIB_DIR, 'guard.js'));
|
|
121
120
|
const { buildSnapshotExpression, formatSnapshotText } = require(path.join(LIB_DIR, 'bsnapshot.js'));
|
|
@@ -149,6 +148,7 @@ const { DirectCDP, checkChrome } = require(path.join(LIB_DIR, 'cdp-direct.js'));
|
|
|
149
148
|
const { resolveDomain } = require(path.join(LIB_DIR, 'domain-resolve.js'));
|
|
150
149
|
const pinMachine = require(path.join(LIB_DIR, 'pin-machine.js'));
|
|
151
150
|
const relayHeal = require(path.join(LIB_DIR, 'relay-heal.js'));
|
|
151
|
+
const statusModel = require(path.join(LIB_DIR, 'status-model.js'));
|
|
152
152
|
const { npmIsNewer } = require(path.join(LIB_DIR, 'pkg-update.js'));
|
|
153
153
|
const { formatCatalogTui } = require(path.join(LIB_DIR, 'tab-tui.js'));
|
|
154
154
|
const tabMap = require(path.join(LIB_DIR, 'tab-map.js'));
|
|
@@ -1252,7 +1252,9 @@ async function cmdStatus() {
|
|
|
1252
1252
|
const serverOk = relay !== null;
|
|
1253
1253
|
const extOk = serverOk && extensionReady(relay);
|
|
1254
1254
|
const targets = serverOk && relay.extension === true ? await getTargets() : [];
|
|
1255
|
-
const
|
|
1255
|
+
const catalog = serverOk && relay.extension === true ? await fetchCatalogQuiet() : null;
|
|
1256
|
+
const targetSummary = statusModel.summarizeStatus(catalog, targets);
|
|
1257
|
+
const healthy = serverOk && extOk && targetSummary.connectedPageCount > 0;
|
|
1256
1258
|
const healthError = healthy
|
|
1257
1259
|
? null
|
|
1258
1260
|
: !serverOk
|
|
@@ -1261,7 +1263,7 @@ async function cmdStatus() {
|
|
|
1261
1263
|
? 'extension disconnected'
|
|
1262
1264
|
: !extOk
|
|
1263
1265
|
? 'extension worker not alive (socket up, no pong; click Glider icon or reload extension)'
|
|
1264
|
-
: 'no attached targets';
|
|
1266
|
+
: 'no attached page targets';
|
|
1265
1267
|
|
|
1266
1268
|
if (jsonOutput) {
|
|
1267
1269
|
emitJson(healthy, {
|
|
@@ -1271,7 +1273,19 @@ async function cmdStatus() {
|
|
|
1271
1273
|
extension: !!relay?.extension,
|
|
1272
1274
|
extensionWorkerAlive: relay?.extensionWorkerAlive ?? null,
|
|
1273
1275
|
reconnecting: relay?.reconnecting === true,
|
|
1274
|
-
|
|
1276
|
+
catalogAvailable: targetSummary.catalogAvailable,
|
|
1277
|
+
tabCount: targetSummary.tabs.length,
|
|
1278
|
+
debuggerOnlyPageCount: targetSummary.debuggerOnlyPages.length,
|
|
1279
|
+
childTargetCount: targetSummary.childTargets.length,
|
|
1280
|
+
staleTargetCount: targetSummary.staleTargets.length,
|
|
1281
|
+
targetCount: targetSummary.rawTargetCount,
|
|
1282
|
+
tabs: targetSummary.tabs.map((tab) => ({
|
|
1283
|
+
tabId: tab.tabId,
|
|
1284
|
+
sessionId: tab.sessionId,
|
|
1285
|
+
targetId: tab.targetId,
|
|
1286
|
+
title: tab.title || '',
|
|
1287
|
+
url: tab.url || '',
|
|
1288
|
+
})),
|
|
1275
1289
|
targets: targets.map((target) => ({
|
|
1276
1290
|
sessionId: target.sessionId,
|
|
1277
1291
|
targetId: target.targetId,
|
|
@@ -1293,12 +1307,25 @@ async function cmdStatus() {
|
|
|
1293
1307
|
}
|
|
1294
1308
|
|
|
1295
1309
|
if (extOk) {
|
|
1296
|
-
if (
|
|
1297
|
-
console.log(` ${GREEN}✓${NC} ${
|
|
1298
|
-
|
|
1299
|
-
const url =
|
|
1310
|
+
if (targetSummary.tabs.length > 0) {
|
|
1311
|
+
console.log(` ${GREEN}✓${NC} ${targetSummary.tabs.length} tab(s) connected:`);
|
|
1312
|
+
targetSummary.tabs.forEach((tab) => {
|
|
1313
|
+
const url = tab.url || 'unknown';
|
|
1300
1314
|
console.log(` ${B5}${url}${NC}`);
|
|
1301
1315
|
});
|
|
1316
|
+
if (targetSummary.debuggerOnlyPages.length) {
|
|
1317
|
+
console.log(` ${DIM}${targetSummary.debuggerOnlyPages.length} debugger-only page target(s)${NC}`);
|
|
1318
|
+
}
|
|
1319
|
+
if (targetSummary.childTargets.length) {
|
|
1320
|
+
console.log(` ${DIM}${targetSummary.childTargets.length} child CDP target(s)${NC}`);
|
|
1321
|
+
}
|
|
1322
|
+
} else if (!targetSummary.catalogAvailable && targetSummary.fallbackPages.length > 0) {
|
|
1323
|
+
console.log(` ${GREEN}✓${NC} ${targetSummary.fallbackPages.length} page target(s) connected ${DIM}(catalog unavailable)${NC}`);
|
|
1324
|
+
targetSummary.fallbackPages.forEach((target) => {
|
|
1325
|
+
console.log(` ${B5}${target.targetInfo?.url || target.url || 'unknown'}${NC}`);
|
|
1326
|
+
});
|
|
1327
|
+
} else if (targetSummary.debuggerOnlyPages.length > 0) {
|
|
1328
|
+
console.log(` ${GREEN}✓${NC} ${targetSummary.debuggerOnlyPages.length} debugger-only page target(s) connected`);
|
|
1302
1329
|
} else {
|
|
1303
1330
|
console.log(` ${YELLOW}⚠${NC} No tabs connected`);
|
|
1304
1331
|
console.log(` ${DIM}Run: glider connect${NC}`);
|
|
@@ -1400,7 +1427,7 @@ async function cmdStart({ render = true } = {}) {
|
|
|
1400
1427
|
|
|
1401
1428
|
child = spawn(process.execPath, [RELAY_ENTRY], {
|
|
1402
1429
|
detached: true,
|
|
1403
|
-
stdio:
|
|
1430
|
+
stdio: 'ignore',
|
|
1404
1431
|
});
|
|
1405
1432
|
identity = getProcessIdentity(child.pid);
|
|
1406
1433
|
if (!identity) {
|
|
@@ -1926,7 +1953,7 @@ async function cmdInstallDaemon() {
|
|
|
1926
1953
|
if (jsonOutput) emitJson(true, { running: true, port: PORT, pid: record.pid, childPid: record.childPid, alreadyRunning });
|
|
1927
1954
|
log.ok(alreadyRunning ? 'Daemon already running' : 'Daemon started');
|
|
1928
1955
|
log.info('Relay will auto-restart on crash');
|
|
1929
|
-
log.info(
|
|
1956
|
+
log.info('Logs: AGLOGS glider/relay');
|
|
1930
1957
|
log.info(`PID: ${record.pid}`);
|
|
1931
1958
|
return;
|
|
1932
1959
|
}
|
|
@@ -3056,6 +3083,9 @@ async function cmdCorsFetch(url, opts = []) {
|
|
|
3056
3083
|
// Semantics: 'hidden|true' → macrotasks (setTimeout/fetch/XHR/workers) will not fire.
|
|
3057
3084
|
// Exit code: 0 if visible, 1 if hidden (chainable in scripts).
|
|
3058
3085
|
async function cmdFrozen(opts = []) {
|
|
3086
|
+
// Detect only. Unknown flags/positionals fail closed (never silent-ignore).
|
|
3087
|
+
// Wrong form `glider frozen thaw` must die here with the correct verb tip —
|
|
3088
|
+
// no compatibility redirect.
|
|
3059
3089
|
let sessionId = null;
|
|
3060
3090
|
for (let i = 0; i < opts.length; i++) {
|
|
3061
3091
|
const a = opts[i];
|
|
@@ -3064,7 +3094,22 @@ async function cmdFrozen(opts = []) {
|
|
|
3064
3094
|
console.log('Usage: glider frozen [--session <id>]');
|
|
3065
3095
|
console.log(' Detect whether the attached tab is macrotask-frozen (hidden).');
|
|
3066
3096
|
console.log(' Exit code: 0 = visible, 1 = hidden (frozen).');
|
|
3097
|
+
console.log(' Detect only. To unfreeze: glider thaw [--session <id>] [--all] [--verify]');
|
|
3067
3098
|
return;
|
|
3099
|
+
} else if (a.startsWith('-')) {
|
|
3100
|
+
log.fail(`unknown flag: ${a}`);
|
|
3101
|
+
console.log('Usage: glider frozen [--session <id>]');
|
|
3102
|
+
console.log(' Detect only. To unfreeze: glider thaw [--verify]');
|
|
3103
|
+
process.exit(2);
|
|
3104
|
+
} else {
|
|
3105
|
+
log.fail(`unknown argument: ${a}`);
|
|
3106
|
+
console.log('Usage: glider frozen [--session <id>]');
|
|
3107
|
+
if (a === 'thaw' || a === 'unfreeze' || a === 'wake' || a === 'activate' || a === 'restore') {
|
|
3108
|
+
console.log(` '${a}' is not a frozen subcommand. Use: glider thaw [--session <id>] [--all] [--verify]`);
|
|
3109
|
+
} else {
|
|
3110
|
+
console.log(` '${a}' is not a frozen subcommand. To unfreeze: glider thaw [--verify]`);
|
|
3111
|
+
}
|
|
3112
|
+
process.exit(2);
|
|
3068
3113
|
}
|
|
3069
3114
|
}
|
|
3070
3115
|
if (!await ensureConnected()) process.exit(1);
|
|
@@ -3134,6 +3179,14 @@ async function cmdThaw(opts = []) {
|
|
|
3134
3179
|
console.log(' --verify re-check visibility + async liveness after thawing');
|
|
3135
3180
|
console.log(' Reverse of `glider frozen` (detect). Idempotent.');
|
|
3136
3181
|
return;
|
|
3182
|
+
} else if (a.startsWith('-')) {
|
|
3183
|
+
log.fail(`unknown flag: ${a}`);
|
|
3184
|
+
console.log('Usage: glider thaw [--session <id>] [--all] [--verify]');
|
|
3185
|
+
process.exit(2);
|
|
3186
|
+
} else {
|
|
3187
|
+
log.fail(`unknown argument: ${a}`);
|
|
3188
|
+
console.log('Usage: glider thaw [--session <id>] [--all] [--verify]');
|
|
3189
|
+
process.exit(2);
|
|
3137
3190
|
}
|
|
3138
3191
|
}
|
|
3139
3192
|
if (!await ensureConnected()) process.exit(1);
|
package/docs/setup.json
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"registry_base": "$GLIDER",
|
|
44
44
|
"resolve": "glider resolve <url> --json",
|
|
45
45
|
"browser": "$GLIDER/config/browser.json",
|
|
46
|
-
"daemon_log": "
|
|
46
|
+
"daemon_log": "AGLOGS namespace glider/relay when GLIDER_AGLOGS_NAMESPACE is set",
|
|
47
47
|
"cookies_jar": "$GLIDER/cookies/<host>/header.txt",
|
|
48
48
|
"cookies_index": "$GLIDER/cookies/domains.json",
|
|
49
49
|
"cookie_jar_verb": "glider cookie-jar sync|read|list|add|rm|rebuild",
|
|
Binary file
|
package/lib/bserve.js
CHANGED
|
@@ -10,6 +10,7 @@ const fs = require('fs');
|
|
|
10
10
|
const http = require('http');
|
|
11
11
|
const { relayPort } = require('./relay-config.js');
|
|
12
12
|
const { buildCatalog, reapFromMap } = require('./tab-catalog.js');
|
|
13
|
+
const { reconcileAttachedTarget, updateTargetInfo } = require('./target-registry.js');
|
|
13
14
|
|
|
14
15
|
const PORT = relayPort();
|
|
15
16
|
const HOST = '127.0.0.1';
|
|
@@ -316,14 +317,15 @@ function handleExtensionMessage(msg) {
|
|
|
316
317
|
const { method, params, sessionId } = msg.params;
|
|
317
318
|
|
|
318
319
|
if (method === 'Target.attachedToTarget') {
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
})
|
|
326
|
-
|
|
320
|
+
const outcome = reconcileAttachedTarget(connectedTargets, params);
|
|
321
|
+
if (outcome.stored) {
|
|
322
|
+
if (outcome.removedSessionIds.length) {
|
|
323
|
+
console.log(`[relay] Reconciled tab target: ${outcome.removedSessionIds.join(', ')} -> ${params.sessionId}`);
|
|
324
|
+
}
|
|
325
|
+
console.log(`[relay] Target attached: ${params.targetInfo.url}`);
|
|
326
|
+
} else if (outcome.record) {
|
|
327
|
+
console.log(`[relay] Ignored synthetic duplicate for tab ${outcome.record.tabId}`);
|
|
328
|
+
}
|
|
327
329
|
} else if (method === 'Target.detachedFromTarget') {
|
|
328
330
|
connectedTargets.delete(params.sessionId);
|
|
329
331
|
console.log(`[relay] Target detached: ${params.sessionId}`);
|
|
@@ -332,9 +334,11 @@ function handleExtensionMessage(msg) {
|
|
|
332
334
|
console.log(`[relay] Target destroyed: ${params.targetId}`);
|
|
333
335
|
}
|
|
334
336
|
} else if (method === 'Target.targetInfoChanged') {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
337
|
+
updateTargetInfo(connectedTargets, {
|
|
338
|
+
sessionId,
|
|
339
|
+
targetInfo: params.targetInfo,
|
|
340
|
+
tabId: params.tabId,
|
|
341
|
+
});
|
|
338
342
|
}
|
|
339
343
|
|
|
340
344
|
const cdpEvent = { method, params, sessionId };
|
package/lib/glider-daemon.sh
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
# Glider daemon - respawns one relay forever
|
|
3
|
+
# Glider daemon - respawns one relay forever.
|
|
4
4
|
|
|
5
5
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
6
6
|
DAEMON_PATH="$SCRIPT_DIR/glider-daemon.sh"
|
|
7
7
|
BSERVE="$SCRIPT_DIR/bserve.js"
|
|
8
8
|
LOG_DIR="${GLIDER:-$HOME/.glider}"
|
|
9
9
|
PORT="${GLIDER_PORT:-${RELAY_PORT:-19988}}"
|
|
10
|
+
AGLOG_NAMESPACE="${GLIDER_AGLOGS_NAMESPACE:-}"
|
|
11
|
+
AGLOG_BIN="${GLIDER_AGLOG_BIN:-${AG:-$HOME/.agents}/tools/lib/aglog.sh}"
|
|
10
12
|
|
|
11
13
|
case "$PORT" in
|
|
12
14
|
''|*[!0-9]*|0|0*) echo "glider-daemon: invalid relay port: $PORT" >&2; exit 2 ;;
|
|
@@ -29,11 +31,9 @@ process_started_at() {
|
|
|
29
31
|
| sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
LOG_FILE="$LOG_DIR/daemon.log"
|
|
33
34
|
PID_FILE="$LOG_DIR/daemon-$PORT.pid"
|
|
34
35
|
CLAIM_DIR="$LOG_DIR/daemon-$PORT.claim"
|
|
35
36
|
MANAGEMENT_LOCK="$LOG_DIR/daemon-$PORT.management.lock"
|
|
36
|
-
MAX_LOG_SIZE=10485760
|
|
37
37
|
CLAIM_ORPHAN_GRACE_SECONDS=5
|
|
38
38
|
child_pid=""
|
|
39
39
|
child_started=""
|
|
@@ -45,13 +45,16 @@ management_lock_owned=0
|
|
|
45
45
|
|
|
46
46
|
mkdir -p "$LOG_DIR"
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
if [ -n "$AGLOG_NAMESPACE" ] && [ ! -x "$AGLOG_BIN" ]; then
|
|
49
|
+
echo "glider-daemon: AGLOGS adapter is unavailable: $AGLOG_BIN" >&2
|
|
50
|
+
exit 78
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
emit_log_line() {
|
|
54
|
+
if [ -n "$AGLOG_NAMESPACE" ]; then
|
|
55
|
+
printf '%s\n' "$1" | "$AGLOG_BIN" put "$AGLOG_NAMESPACE" - >/dev/null
|
|
56
|
+
else
|
|
57
|
+
printf '%s\n' "$1" >&2
|
|
55
58
|
fi
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -466,10 +469,16 @@ write_pid_record
|
|
|
466
469
|
|
|
467
470
|
initial_handoff=1
|
|
468
471
|
while true; do
|
|
469
|
-
|
|
470
|
-
|
|
472
|
+
emit_log_line "[$(date)] Starting relay on port $PORT..." || {
|
|
473
|
+
echo "glider-daemon: AGLOGS start event failed" >&2
|
|
474
|
+
exit 74
|
|
475
|
+
}
|
|
471
476
|
|
|
472
|
-
|
|
477
|
+
if [ -n "$AGLOG_NAMESPACE" ]; then
|
|
478
|
+
"$NODE_BIN" "$BSERVE" > >("$AGLOG_BIN" put "$AGLOG_NAMESPACE" - >/dev/null) 2>&1 &
|
|
479
|
+
else
|
|
480
|
+
"$NODE_BIN" "$BSERVE" &
|
|
481
|
+
fi
|
|
473
482
|
child_pid=$!
|
|
474
483
|
child_started="$(process_started_at "$child_pid")"
|
|
475
484
|
relay_ready=0
|
|
@@ -523,6 +532,9 @@ while true; do
|
|
|
523
532
|
relay_ready=0
|
|
524
533
|
write_pid_record
|
|
525
534
|
|
|
526
|
-
|
|
535
|
+
emit_log_line "[$(date)] Relay exited with code $EXIT_CODE, restarting in 2s..." || {
|
|
536
|
+
echo "glider-daemon: AGLOGS restart event failed" >&2
|
|
537
|
+
exit 74
|
|
538
|
+
}
|
|
527
539
|
sleep 2
|
|
528
540
|
done
|