@naylence/runtime 0.3.15 → 0.3.16
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/dist/browser/index.cjs +615 -442
- package/dist/browser/index.mjs +611 -443
- package/dist/cjs/naylence/fame/factory-manifest.js +2 -0
- package/dist/cjs/naylence/fame/node/connection-retry-policy-factory.js +22 -0
- package/dist/cjs/naylence/fame/node/connection-retry-policy.js +2 -0
- package/dist/cjs/naylence/fame/node/default-connection-retry-policy-factory.js +36 -0
- package/dist/cjs/naylence/fame/node/default-connection-retry-policy.js +51 -0
- package/dist/cjs/naylence/fame/node/factory-commons.js +15 -0
- package/dist/cjs/naylence/fame/node/index.js +6 -1
- package/dist/cjs/naylence/fame/node/node-config.js +4 -0
- package/dist/cjs/naylence/fame/node/node-factory.js +1 -0
- package/dist/cjs/naylence/fame/node/node.js +3 -0
- package/dist/cjs/naylence/fame/node/upstream-session-manager.js +63 -23
- package/dist/cjs/naylence/fame/sentinel/sentinel.js +2 -0
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/factory-manifest.js +2 -0
- package/dist/esm/naylence/fame/node/connection-retry-policy-factory.js +18 -0
- package/dist/esm/naylence/fame/node/connection-retry-policy.js +1 -0
- package/dist/esm/naylence/fame/node/default-connection-retry-policy-factory.js +32 -0
- package/dist/esm/naylence/fame/node/default-connection-retry-policy.js +47 -0
- package/dist/esm/naylence/fame/node/factory-commons.js +15 -0
- package/dist/esm/naylence/fame/node/index.js +4 -0
- package/dist/esm/naylence/fame/node/node-config.js +4 -0
- package/dist/esm/naylence/fame/node/node-factory.js +1 -0
- package/dist/esm/naylence/fame/node/node.js +3 -0
- package/dist/esm/naylence/fame/node/upstream-session-manager.js +63 -23
- package/dist/esm/naylence/fame/sentinel/sentinel.js +2 -0
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +615 -442
- package/dist/node/index.mjs +611 -443
- package/dist/node/node.cjs +639 -466
- package/dist/node/node.mjs +635 -467
- package/dist/types/naylence/fame/factory-manifest.d.ts +1 -1
- package/dist/types/naylence/fame/node/connection-retry-policy-factory.d.ts +20 -0
- package/dist/types/naylence/fame/node/connection-retry-policy.d.ts +44 -0
- package/dist/types/naylence/fame/node/default-connection-retry-policy-factory.d.ts +15 -0
- package/dist/types/naylence/fame/node/default-connection-retry-policy.d.ts +36 -0
- package/dist/types/naylence/fame/node/factory-commons.d.ts +2 -0
- package/dist/types/naylence/fame/node/index.d.ts +4 -0
- package/dist/types/naylence/fame/node/node-config.d.ts +2 -0
- package/dist/types/naylence/fame/node/node.d.ts +3 -0
- package/dist/types/naylence/fame/node/upstream-session-manager.d.ts +13 -0
- package/dist/types/naylence/fame/sentinel/sentinel.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/node/node.mjs
CHANGED
|
@@ -724,7 +724,7 @@ class TaskCancelledError extends Error {
|
|
|
724
724
|
* Provides functionality similar to Python's asyncio TaskSpawner with proper
|
|
725
725
|
* error handling, cancellation, and graceful shutdown capabilities.
|
|
726
726
|
*/
|
|
727
|
-
const logger$
|
|
727
|
+
const logger$1m = getLogger('naylence.fame.util.task_spawner');
|
|
728
728
|
function firstDefined(source, keys) {
|
|
729
729
|
for (const key of keys) {
|
|
730
730
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
@@ -885,7 +885,7 @@ class TaskSpawner {
|
|
|
885
885
|
const taskId = `task-${++this._taskCounter}`;
|
|
886
886
|
const taskName = normalizedOptions.name || `unnamed-${taskId}`;
|
|
887
887
|
const timeout = normalizedOptions.timeout ?? this._config.defaultTimeout;
|
|
888
|
-
logger$
|
|
888
|
+
logger$1m.debug('starting_background_task', {
|
|
889
889
|
task_name: taskName,
|
|
890
890
|
task_id: taskId,
|
|
891
891
|
});
|
|
@@ -902,7 +902,7 @@ class TaskSpawner {
|
|
|
902
902
|
task.promise
|
|
903
903
|
.then(() => {
|
|
904
904
|
if (!this._suppressCompletionLogging) {
|
|
905
|
-
logger$
|
|
905
|
+
logger$1m.debug('task_completed_successfully', {
|
|
906
906
|
task_name: taskName,
|
|
907
907
|
task_id: taskId,
|
|
908
908
|
duration_ms: Date.now() - task.startTime,
|
|
@@ -956,7 +956,7 @@ class TaskSpawner {
|
|
|
956
956
|
error.name === 'AbortError' ||
|
|
957
957
|
error.message === 'Task cancelled' ||
|
|
958
958
|
error.message === 'Aborted') {
|
|
959
|
-
logger$
|
|
959
|
+
logger$1m.debug('task_cancelled', {
|
|
960
960
|
task_name: taskName,
|
|
961
961
|
note: 'Task cancelled as requested',
|
|
962
962
|
});
|
|
@@ -964,7 +964,7 @@ class TaskSpawner {
|
|
|
964
964
|
}
|
|
965
965
|
// Handle timeout
|
|
966
966
|
if (error instanceof TaskTimeoutError) {
|
|
967
|
-
logger$
|
|
967
|
+
logger$1m.warning('task_timed_out', {
|
|
968
968
|
task_name: taskName,
|
|
969
969
|
error: error.message,
|
|
970
970
|
});
|
|
@@ -976,7 +976,7 @@ class TaskSpawner {
|
|
|
976
976
|
// Handle known WebSocket shutdown race condition (similar to Python version)
|
|
977
977
|
if (error.message.includes("await wasn't used with future") ||
|
|
978
978
|
error.message.includes('WebSocket closed during receive')) {
|
|
979
|
-
logger$
|
|
979
|
+
logger$1m.debug('task_shutdown_race_condition_handled', {
|
|
980
980
|
task_name: taskName,
|
|
981
981
|
note: 'Normal WebSocket close timing during shutdown - not an error',
|
|
982
982
|
});
|
|
@@ -986,7 +986,7 @@ class TaskSpawner {
|
|
|
986
986
|
if (error.name === 'FameTransportClose' ||
|
|
987
987
|
error.message.includes('normal closure') ||
|
|
988
988
|
error.message.includes('Connection closed')) {
|
|
989
|
-
logger$
|
|
989
|
+
logger$1m.debug('task_shutdown_completed_normally', {
|
|
990
990
|
task_name: taskName,
|
|
991
991
|
note: 'Task closed normally during shutdown',
|
|
992
992
|
});
|
|
@@ -994,7 +994,7 @@ class TaskSpawner {
|
|
|
994
994
|
}
|
|
995
995
|
// Handle PKCE redirect "errors" as info
|
|
996
996
|
if (error.name === 'OAuth2PkceRedirectInitiatedError') {
|
|
997
|
-
logger$
|
|
997
|
+
logger$1m.debug('background_task_redirecting', {
|
|
998
998
|
task_name: taskName,
|
|
999
999
|
note: 'Task interrupted for PKCE redirect',
|
|
1000
1000
|
});
|
|
@@ -1007,14 +1007,14 @@ class TaskSpawner {
|
|
|
1007
1007
|
// Log retriable errors as warnings (they'll be retried by upstream logic)
|
|
1008
1008
|
// Log non-retriable errors as errors (fatal failures)
|
|
1009
1009
|
if (isRetriableError) {
|
|
1010
|
-
logger$
|
|
1010
|
+
logger$1m.warning('background_task_failed', {
|
|
1011
1011
|
task_name: taskName,
|
|
1012
1012
|
error: error.message,
|
|
1013
1013
|
retriable: true,
|
|
1014
1014
|
});
|
|
1015
1015
|
}
|
|
1016
1016
|
else {
|
|
1017
|
-
logger$
|
|
1017
|
+
logger$1m.error('background_task_failed', {
|
|
1018
1018
|
task_name: taskName,
|
|
1019
1019
|
error: error.message,
|
|
1020
1020
|
stack: error.stack,
|
|
@@ -1033,11 +1033,11 @@ class TaskSpawner {
|
|
|
1033
1033
|
async shutdownTasks(options = {}) {
|
|
1034
1034
|
const { gracePeriod, cancelHanging, joinTimeout } = normalizeShutdownOptions(options);
|
|
1035
1035
|
if (this._tasks.size === 0) {
|
|
1036
|
-
logger$
|
|
1036
|
+
logger$1m.debug('shutdown_tasks_no_tasks_to_shutdown');
|
|
1037
1037
|
return;
|
|
1038
1038
|
}
|
|
1039
1039
|
this._suppressCompletionLogging = true;
|
|
1040
|
-
logger$
|
|
1040
|
+
logger$1m.debug('shutting_down_tasks', {
|
|
1041
1041
|
task_count: this._tasks.size,
|
|
1042
1042
|
task_names: Array.from(this._tasks.values()).map((t) => t.name),
|
|
1043
1043
|
grace_period_ms: gracePeriod,
|
|
@@ -1052,7 +1052,7 @@ class TaskSpawner {
|
|
|
1052
1052
|
if (cancelHanging) {
|
|
1053
1053
|
const stillRunning = tasks.filter((task) => task.getState() === TaskState.RUNNING && !completed.has(task));
|
|
1054
1054
|
if (stillRunning.length > 0) {
|
|
1055
|
-
logger$
|
|
1055
|
+
logger$1m.debug('tasks_did_not_complete_within_grace_period', {
|
|
1056
1056
|
hanging_count: stillRunning.length,
|
|
1057
1057
|
});
|
|
1058
1058
|
// Wait for them to finish with individual timeouts
|
|
@@ -1062,7 +1062,7 @@ class TaskSpawner {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
catch (error) {
|
|
1064
1064
|
if (error instanceof TaskTimeoutError) {
|
|
1065
|
-
logger$
|
|
1065
|
+
logger$1m.warning('task_did_not_shutdown', {
|
|
1066
1066
|
task_name: task.name || task.id,
|
|
1067
1067
|
join_timeout_ms: joinTimeout,
|
|
1068
1068
|
});
|
|
@@ -1073,7 +1073,7 @@ class TaskSpawner {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
else if (!(error instanceof TaskCancelledError)) {
|
|
1075
1075
|
/* istanbul ignore next - unreachable defensive branch */
|
|
1076
|
-
logger$
|
|
1076
|
+
logger$1m.error('task_raised_during_cancellation', {
|
|
1077
1077
|
task_name: task.name || task.id,
|
|
1078
1078
|
error: error instanceof Error ? error.message : String(error),
|
|
1079
1079
|
});
|
|
@@ -1192,7 +1192,7 @@ class TaskSpawner {
|
|
|
1192
1192
|
* condition/promise and ensure at most one notifier coroutine exists for a
|
|
1193
1193
|
* flow at any time.
|
|
1194
1194
|
*/
|
|
1195
|
-
const logger$
|
|
1195
|
+
const logger$1l = getLogger('naylence.fame.flow.flow_controller');
|
|
1196
1196
|
/**
|
|
1197
1197
|
* Simple condition variable implementation for TypeScript/Node.js
|
|
1198
1198
|
* Similar to Python's asyncio.Condition
|
|
@@ -1326,7 +1326,7 @@ class FlowController {
|
|
|
1326
1326
|
const newBalance = Math.max(0, Math.min(this.initialWindow, prev + delta));
|
|
1327
1327
|
this.credits.set(flowId, newBalance);
|
|
1328
1328
|
const crossedZero = prev <= 0 && newBalance > 0;
|
|
1329
|
-
logger$
|
|
1329
|
+
logger$1l.debug('flow_controller_add_credits', {
|
|
1330
1330
|
flow_id: flowId,
|
|
1331
1331
|
delta,
|
|
1332
1332
|
prev_balance: prev,
|
|
@@ -1346,12 +1346,12 @@ class FlowController {
|
|
|
1346
1346
|
async acquire(flowId) {
|
|
1347
1347
|
this.ensureFlow(flowId);
|
|
1348
1348
|
const condition = this.conditions.get(flowId);
|
|
1349
|
-
logger$
|
|
1349
|
+
logger$1l.debug('flow_controller_acquire_attempt', {
|
|
1350
1350
|
flow_id: flowId,
|
|
1351
1351
|
current_balance: this.credits.get(flowId),
|
|
1352
1352
|
});
|
|
1353
1353
|
while (this.credits.get(flowId) <= 0) {
|
|
1354
|
-
logger$
|
|
1354
|
+
logger$1l.debug('flow_controller_waiting_for_credits', {
|
|
1355
1355
|
flow_id: flowId,
|
|
1356
1356
|
current_balance: this.credits.get(flowId),
|
|
1357
1357
|
});
|
|
@@ -1359,12 +1359,12 @@ class FlowController {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
const newBalance = this.credits.get(flowId) - 1;
|
|
1361
1361
|
this.credits.set(flowId, newBalance);
|
|
1362
|
-
logger$
|
|
1362
|
+
logger$1l.debug('flow_controller_acquire_success', {
|
|
1363
1363
|
flow_id: flowId,
|
|
1364
1364
|
new_balance: newBalance,
|
|
1365
1365
|
});
|
|
1366
1366
|
if (newBalance <= this.lowWatermark) {
|
|
1367
|
-
logger$
|
|
1367
|
+
logger$1l.debug('flow_controller_acquire_below_low_watermark', {
|
|
1368
1368
|
flow_id: flowId,
|
|
1369
1369
|
low_watermark: this.lowWatermark,
|
|
1370
1370
|
});
|
|
@@ -1388,7 +1388,7 @@ class FlowController {
|
|
|
1388
1388
|
const current = this.credits.get(flowId);
|
|
1389
1389
|
const remaining = Math.max(current - credits, 0);
|
|
1390
1390
|
this.credits.set(flowId, remaining);
|
|
1391
|
-
logger$
|
|
1391
|
+
logger$1l.debug('flow_controller_consume', {
|
|
1392
1392
|
flow_id: flowId,
|
|
1393
1393
|
requested: credits,
|
|
1394
1394
|
prev_balance: current,
|
|
@@ -1414,7 +1414,7 @@ class FlowController {
|
|
|
1414
1414
|
this.windowIds.delete(flowId);
|
|
1415
1415
|
this.credits.set(flowId, this.initialWindow);
|
|
1416
1416
|
this.wakeWaiters(flowId);
|
|
1417
|
-
logger$
|
|
1417
|
+
logger$1l.debug('flow_controller_flow_reset', {
|
|
1418
1418
|
flow_id: flowId,
|
|
1419
1419
|
reset_balance: this.initialWindow,
|
|
1420
1420
|
});
|
|
@@ -2046,7 +2046,7 @@ class TaskCancellationError extends Error {
|
|
|
2046
2046
|
this.name = 'TaskCancellationError';
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
|
-
const logger$
|
|
2049
|
+
const logger$1k = getLogger('naylence.fame.connector.base_async_connector');
|
|
2050
2050
|
// Environment variables
|
|
2051
2051
|
const ENV_VAR_FAME_FLOW_CONTROL = 'FAME_FLOW_CONTROL';
|
|
2052
2052
|
const FLOW_CONTROL_ENABLED = typeof process !== 'undefined' && process?.env
|
|
@@ -2129,7 +2129,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2129
2129
|
if (this._state !== newState) {
|
|
2130
2130
|
const oldState = this._state;
|
|
2131
2131
|
this._state = newState;
|
|
2132
|
-
logger$
|
|
2132
|
+
logger$1k.debug('connector_state_transition', {
|
|
2133
2133
|
connector_id: this._connectorFlowId,
|
|
2134
2134
|
old_state: oldState,
|
|
2135
2135
|
new_state: newState,
|
|
@@ -2168,12 +2168,12 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2168
2168
|
* Stop the connector gracefully
|
|
2169
2169
|
*/
|
|
2170
2170
|
async stop() {
|
|
2171
|
-
logger$
|
|
2171
|
+
logger$1k.debug('stopping_connector', {
|
|
2172
2172
|
current_state: this._state,
|
|
2173
2173
|
connector_id: this._connectorFlowId,
|
|
2174
2174
|
});
|
|
2175
2175
|
if (!ConnectorStateUtils.canStop(this._state)) {
|
|
2176
|
-
logger$
|
|
2176
|
+
logger$1k.debug('connector_stop_already_stopped', {
|
|
2177
2177
|
current_state: this._state,
|
|
2178
2178
|
connector_id: this._connectorFlowId,
|
|
2179
2179
|
});
|
|
@@ -2184,7 +2184,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2184
2184
|
if (this._lastError) {
|
|
2185
2185
|
throw this._lastError;
|
|
2186
2186
|
}
|
|
2187
|
-
logger$
|
|
2187
|
+
logger$1k.debug('connector_stopped', {
|
|
2188
2188
|
current_state: this._state,
|
|
2189
2189
|
connector_id: this._connectorFlowId,
|
|
2190
2190
|
});
|
|
@@ -2193,19 +2193,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2193
2193
|
* Pause the connector (suspends heartbeat and housekeeping, but keeps connection alive)
|
|
2194
2194
|
*/
|
|
2195
2195
|
async pause() {
|
|
2196
|
-
logger$
|
|
2196
|
+
logger$1k.debug('pausing_connector', {
|
|
2197
2197
|
current_state: this._state,
|
|
2198
2198
|
connector_id: this._connectorFlowId,
|
|
2199
2199
|
});
|
|
2200
2200
|
if (this._state !== ConnectorState.STARTED) {
|
|
2201
|
-
logger$
|
|
2201
|
+
logger$1k.debug('connector_pause_invalid_state', {
|
|
2202
2202
|
current_state: this._state,
|
|
2203
2203
|
connector_id: this._connectorFlowId,
|
|
2204
2204
|
});
|
|
2205
2205
|
return;
|
|
2206
2206
|
}
|
|
2207
2207
|
this._setState(ConnectorState.PAUSED);
|
|
2208
|
-
logger$
|
|
2208
|
+
logger$1k.debug('connector_paused', {
|
|
2209
2209
|
current_state: this._state,
|
|
2210
2210
|
connector_id: this._connectorFlowId,
|
|
2211
2211
|
});
|
|
@@ -2214,19 +2214,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2214
2214
|
* Resume the connector from paused state
|
|
2215
2215
|
*/
|
|
2216
2216
|
async resume() {
|
|
2217
|
-
logger$
|
|
2217
|
+
logger$1k.debug('resuming_connector', {
|
|
2218
2218
|
current_state: this._state,
|
|
2219
2219
|
connector_id: this._connectorFlowId,
|
|
2220
2220
|
});
|
|
2221
2221
|
if (this._state !== ConnectorState.PAUSED) {
|
|
2222
|
-
logger$
|
|
2222
|
+
logger$1k.debug('connector_resume_invalid_state', {
|
|
2223
2223
|
current_state: this._state,
|
|
2224
2224
|
connector_id: this._connectorFlowId,
|
|
2225
2225
|
});
|
|
2226
2226
|
return;
|
|
2227
2227
|
}
|
|
2228
2228
|
this._setState(ConnectorState.STARTED);
|
|
2229
|
-
logger$
|
|
2229
|
+
logger$1k.debug('connector_resumed', {
|
|
2230
2230
|
current_state: this._state,
|
|
2231
2231
|
connector_id: this._connectorFlowId,
|
|
2232
2232
|
});
|
|
@@ -2236,7 +2236,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2236
2236
|
*/
|
|
2237
2237
|
async close(code = 1000, reason = 'normal closure') {
|
|
2238
2238
|
if (!ConnectorStateUtils.canClose(this._state)) {
|
|
2239
|
-
logger$
|
|
2239
|
+
logger$1k.warning('connector_close_invalid_state', {
|
|
2240
2240
|
current_state: this._state,
|
|
2241
2241
|
connector_id: this._connectorFlowId,
|
|
2242
2242
|
});
|
|
@@ -2317,7 +2317,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2317
2317
|
// Add to queue and notify send loop
|
|
2318
2318
|
this._sendQueue.push(raw);
|
|
2319
2319
|
// Log for debugging
|
|
2320
|
-
logger$
|
|
2320
|
+
logger$1k.debug('send_envelope_queued', {
|
|
2321
2321
|
queue_length: this._sendQueue.length,
|
|
2322
2322
|
max_queue_size: this._maxQueueSize,
|
|
2323
2323
|
});
|
|
@@ -2366,14 +2366,14 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2366
2366
|
const item = this._sendQueue[0];
|
|
2367
2367
|
if (!item)
|
|
2368
2368
|
continue;
|
|
2369
|
-
logger$
|
|
2369
|
+
logger$1k.debug('send_loop_processing_item', {
|
|
2370
2370
|
queue_length_before_send: this._sendQueue.length,
|
|
2371
2371
|
});
|
|
2372
2372
|
// Send through transport (this may block)
|
|
2373
2373
|
await this._transportSendBytes(item);
|
|
2374
2374
|
// Only remove from queue after successful send
|
|
2375
2375
|
this._sendQueue.shift();
|
|
2376
|
-
logger$
|
|
2376
|
+
logger$1k.debug('send_loop_item_sent', {
|
|
2377
2377
|
queue_length_after_send: this._sendQueue.length,
|
|
2378
2378
|
});
|
|
2379
2379
|
}
|
|
@@ -2386,14 +2386,14 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2386
2386
|
}
|
|
2387
2387
|
else if (error instanceof TaskCancellationError) {
|
|
2388
2388
|
// Task cancellation is expected during shutdown - log as debug, not critical
|
|
2389
|
-
logger$
|
|
2389
|
+
logger$1k.debug('send loop cancelled', {
|
|
2390
2390
|
connector: this.constructor.name,
|
|
2391
2391
|
reason: error.message,
|
|
2392
2392
|
});
|
|
2393
2393
|
// Don't re-throw - this is normal during shutdown
|
|
2394
2394
|
}
|
|
2395
2395
|
else {
|
|
2396
|
-
logger$
|
|
2396
|
+
logger$1k.critical('unexpected exception in send loop', {
|
|
2397
2397
|
connector: this.constructor.name,
|
|
2398
2398
|
error: error instanceof Error ? error.message : String(error),
|
|
2399
2399
|
});
|
|
@@ -2434,7 +2434,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2434
2434
|
env = JSON.parse(jsonStr);
|
|
2435
2435
|
}
|
|
2436
2436
|
catch (error) {
|
|
2437
|
-
logger$
|
|
2437
|
+
logger$1k.error('Invalid envelope', {
|
|
2438
2438
|
message: message.toString(),
|
|
2439
2439
|
error: error instanceof Error ? error.message : String(error),
|
|
2440
2440
|
});
|
|
@@ -2458,7 +2458,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2458
2458
|
};
|
|
2459
2459
|
await withEnvelopeContextAsync(envelopeContext, async () => {
|
|
2460
2460
|
const prettyEnvelope = prettyModel$1(env);
|
|
2461
|
-
logger$
|
|
2461
|
+
logger$1k.trace('connector_received_envelope', {
|
|
2462
2462
|
envelope: env,
|
|
2463
2463
|
pretty: prettyEnvelope,
|
|
2464
2464
|
});
|
|
@@ -2487,7 +2487,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2487
2487
|
if (error instanceof TaskCancellationError) {
|
|
2488
2488
|
throw error;
|
|
2489
2489
|
}
|
|
2490
|
-
logger$
|
|
2490
|
+
logger$1k.error('handler_failed', {
|
|
2491
2491
|
error: error instanceof Error ? error.message : String(error),
|
|
2492
2492
|
envelope_id: env.id ?? null,
|
|
2493
2493
|
trace_id: env.traceId ?? null,
|
|
@@ -2508,14 +2508,14 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2508
2508
|
}
|
|
2509
2509
|
else if (error instanceof TaskCancellationError) {
|
|
2510
2510
|
// Task cancellation is expected during shutdown - log as debug, not critical
|
|
2511
|
-
logger$
|
|
2511
|
+
logger$1k.debug('receive loop cancelled', {
|
|
2512
2512
|
connector: this.constructor.name,
|
|
2513
2513
|
reason: error.message,
|
|
2514
2514
|
});
|
|
2515
2515
|
// Don't re-throw - this is normal during shutdown
|
|
2516
2516
|
}
|
|
2517
2517
|
else {
|
|
2518
|
-
logger$
|
|
2518
|
+
logger$1k.critical('unexpected_error_in recv_loop', {
|
|
2519
2519
|
error: error instanceof Error ? error.message : String(error),
|
|
2520
2520
|
});
|
|
2521
2521
|
throw error;
|
|
@@ -2531,7 +2531,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2531
2531
|
async _maybeEmitCredit(flowId, traceId) {
|
|
2532
2532
|
const remainingCredits = this._flowCtrl.getCredits(flowId);
|
|
2533
2533
|
const needsRefill = this._flowCtrl.needsRefill(flowId);
|
|
2534
|
-
logger$
|
|
2534
|
+
logger$1k.debug('maybe_emit_credit_check', {
|
|
2535
2535
|
connector_id: this._connectorFlowId,
|
|
2536
2536
|
flow_id: flowId,
|
|
2537
2537
|
trace_id: traceId ?? null,
|
|
@@ -2547,7 +2547,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2547
2547
|
}
|
|
2548
2548
|
const delta = this._initialWindow;
|
|
2549
2549
|
this._flowCtrl.addCredits(flowId, delta);
|
|
2550
|
-
logger$
|
|
2550
|
+
logger$1k.debug('maybe_emit_credit_emit', {
|
|
2551
2551
|
connector_id: this._connectorFlowId,
|
|
2552
2552
|
flow_id: flowId,
|
|
2553
2553
|
trace_id: traceId ?? null,
|
|
@@ -2567,7 +2567,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2567
2567
|
});
|
|
2568
2568
|
try {
|
|
2569
2569
|
await this.send(ackEnv);
|
|
2570
|
-
logger$
|
|
2570
|
+
logger$1k.debug('maybe_emit_credit_sent', {
|
|
2571
2571
|
connector_id: this._connectorFlowId,
|
|
2572
2572
|
flow_id: flowId,
|
|
2573
2573
|
trace_id: traceId ?? null,
|
|
@@ -2575,7 +2575,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2575
2575
|
});
|
|
2576
2576
|
}
|
|
2577
2577
|
catch (error) {
|
|
2578
|
-
logger$
|
|
2578
|
+
logger$1k.error('maybe_emit_credit_send_failed', {
|
|
2579
2579
|
connector_id: this._connectorFlowId,
|
|
2580
2580
|
flow_id: flowId,
|
|
2581
2581
|
trace_id: traceId ?? null,
|
|
@@ -2600,13 +2600,13 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2600
2600
|
*/
|
|
2601
2601
|
async _shutdown(code, reason, gracePeriod, exc) {
|
|
2602
2602
|
if (this._closed) {
|
|
2603
|
-
logger$
|
|
2603
|
+
logger$1k.debug('shutdown_already_closed', {
|
|
2604
2604
|
connector_id: this._connectorFlowId,
|
|
2605
2605
|
current_state: this._state,
|
|
2606
2606
|
});
|
|
2607
2607
|
return;
|
|
2608
2608
|
}
|
|
2609
|
-
logger$
|
|
2609
|
+
logger$1k.debug('connector_shutdown_starting', {
|
|
2610
2610
|
connector_id: this._connectorFlowId,
|
|
2611
2611
|
connector_type: this.constructor.name,
|
|
2612
2612
|
code,
|
|
@@ -2636,19 +2636,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2636
2636
|
this._sendPromiseResolve = undefined;
|
|
2637
2637
|
}
|
|
2638
2638
|
// Close transport
|
|
2639
|
-
logger$
|
|
2639
|
+
logger$1k.debug('connector_closing_transport', {
|
|
2640
2640
|
connector_id: this._connectorFlowId,
|
|
2641
2641
|
connector_type: this.constructor.name,
|
|
2642
2642
|
timestamp: new Date().toISOString(),
|
|
2643
2643
|
});
|
|
2644
2644
|
await this._transportClose(code, reason);
|
|
2645
|
-
logger$
|
|
2645
|
+
logger$1k.debug('connector_transport_closed', {
|
|
2646
2646
|
connector_id: this._connectorFlowId,
|
|
2647
2647
|
connector_type: this.constructor.name,
|
|
2648
2648
|
timestamp: new Date().toISOString(),
|
|
2649
2649
|
});
|
|
2650
2650
|
// Shutdown spawned tasks
|
|
2651
|
-
logger$
|
|
2651
|
+
logger$1k.debug('connector_shutting_down_tasks', {
|
|
2652
2652
|
connector_id: this._connectorFlowId,
|
|
2653
2653
|
connector_type: this.constructor.name,
|
|
2654
2654
|
grace_period_ms: effectiveGracePeriod * 1000,
|
|
@@ -2660,14 +2660,14 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2660
2660
|
gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
|
|
2661
2661
|
joinTimeout: this._shutdownJoinTimeout,
|
|
2662
2662
|
});
|
|
2663
|
-
logger$
|
|
2663
|
+
logger$1k.debug('connector_tasks_shutdown_complete', {
|
|
2664
2664
|
connector_id: this._connectorFlowId,
|
|
2665
2665
|
connector_type: this.constructor.name,
|
|
2666
2666
|
timestamp: new Date().toISOString(),
|
|
2667
2667
|
});
|
|
2668
2668
|
}
|
|
2669
2669
|
catch (error) {
|
|
2670
|
-
logger$
|
|
2670
|
+
logger$1k.warning('task_shutdown_error', {
|
|
2671
2671
|
connector_id: this._connectorFlowId,
|
|
2672
2672
|
error: error instanceof Error ? error.message : String(error),
|
|
2673
2673
|
});
|
|
@@ -2680,7 +2680,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2680
2680
|
if (this._closeResolver) {
|
|
2681
2681
|
this._closeResolver();
|
|
2682
2682
|
}
|
|
2683
|
-
logger$
|
|
2683
|
+
logger$1k.debug('connector_shutdown_complete', {
|
|
2684
2684
|
connector_id: this._connectorFlowId,
|
|
2685
2685
|
connector_type: this.constructor.name,
|
|
2686
2686
|
final_state: this._state,
|
|
@@ -2701,7 +2701,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2701
2701
|
* A transport adapter that works with both Node.js and browser WebSocket APIs.
|
|
2702
2702
|
* Supports both native WebSocket clients and server-side WebSocket connections.
|
|
2703
2703
|
*/
|
|
2704
|
-
const logger$
|
|
2704
|
+
const logger$1j = getLogger('naylence.fame.connector.websocket_connector');
|
|
2705
2705
|
/**
|
|
2706
2706
|
* WebSocket state constants (mirrors standard WebSocket states)
|
|
2707
2707
|
*/
|
|
@@ -2742,7 +2742,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
2742
2742
|
websocket.send_bytes &&
|
|
2743
2743
|
typeof websocket.receive_bytes === 'function' &&
|
|
2744
2744
|
typeof websocket.send_bytes === 'function');
|
|
2745
|
-
logger$
|
|
2745
|
+
logger$1j.debug('websocket_connector_created', {
|
|
2746
2746
|
is_fastapi_like: this._isFastApiLike,
|
|
2747
2747
|
ready_state: websocket.readyState,
|
|
2748
2748
|
url: websocket.url,
|
|
@@ -2757,7 +2757,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
2757
2757
|
socketAny.binaryType = 'arraybuffer';
|
|
2758
2758
|
}
|
|
2759
2759
|
catch (error) {
|
|
2760
|
-
logger$
|
|
2760
|
+
logger$1j.debug('websocket_set_binary_type_failed', {
|
|
2761
2761
|
error: error instanceof Error ? error.message : String(error),
|
|
2762
2762
|
current_type: socketAny.binaryType,
|
|
2763
2763
|
});
|
|
@@ -2813,7 +2813,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
2813
2813
|
else {
|
|
2814
2814
|
this._receiveQueue.push(data);
|
|
2815
2815
|
}
|
|
2816
|
-
logger$
|
|
2816
|
+
logger$1j.debug('websocket_message_pushed_to_queue', {
|
|
2817
2817
|
queueLength: this._receiveQueue.length,
|
|
2818
2818
|
waitersLength: this._receiveWaiters.length,
|
|
2819
2819
|
});
|
|
@@ -2866,7 +2866,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
2866
2866
|
const result = receiveMethod.call(this._websocket);
|
|
2867
2867
|
// Ensure we have a Promise
|
|
2868
2868
|
if (!result || typeof result.then !== 'function') {
|
|
2869
|
-
logger$
|
|
2869
|
+
logger$1j.error('fastapi_receive_not_awaitable', {
|
|
2870
2870
|
result_type: typeof result,
|
|
2871
2871
|
result_str: String(result).substring(0, 100),
|
|
2872
2872
|
});
|
|
@@ -2882,7 +2882,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
2882
2882
|
}
|
|
2883
2883
|
// Handle known WebSocket shutdown race condition
|
|
2884
2884
|
if (this._isAwaitFutureError(error)) {
|
|
2885
|
-
logger$
|
|
2885
|
+
logger$1j.debug('websocket_shutdown_race_condition_handled', {
|
|
2886
2886
|
note: 'Normal WebSocket close timing - converting to cancellation',
|
|
2887
2887
|
websocket_state: this._websocket.client_state || 'unknown',
|
|
2888
2888
|
});
|
|
@@ -2925,7 +2925,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
2925
2925
|
}
|
|
2926
2926
|
catch (error) {
|
|
2927
2927
|
if (this._isAwaitFutureError(error)) {
|
|
2928
|
-
logger$
|
|
2928
|
+
logger$1j.debug('websocket_shutdown_race_condition_detected', {
|
|
2929
2929
|
websocket_type: this._websocket.constructor.name,
|
|
2930
2930
|
is_fastapi: this._isFastApiLike,
|
|
2931
2931
|
note: 'Normal WebSocket close timing during shutdown',
|
|
@@ -2971,12 +2971,12 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
2971
2971
|
if (socketAny.readyState !== WebSocketState.CLOSED) {
|
|
2972
2972
|
try {
|
|
2973
2973
|
socketAny.terminate();
|
|
2974
|
-
logger$
|
|
2974
|
+
logger$1j.debug('websocket_force_terminated', {
|
|
2975
2975
|
ready_state: socketAny.readyState,
|
|
2976
2976
|
});
|
|
2977
2977
|
}
|
|
2978
2978
|
catch (error) {
|
|
2979
|
-
logger$
|
|
2979
|
+
logger$1j.debug('websocket_force_terminate_failed', {
|
|
2980
2980
|
error: error instanceof Error ? error.message : String(error),
|
|
2981
2981
|
});
|
|
2982
2982
|
}
|
|
@@ -2987,7 +2987,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
2987
2987
|
}
|
|
2988
2988
|
}
|
|
2989
2989
|
catch (error) {
|
|
2990
|
-
logger$
|
|
2990
|
+
logger$1j.error('websocket_close_failed', {
|
|
2991
2991
|
error: error instanceof Error ? error.message : String(error),
|
|
2992
2992
|
});
|
|
2993
2993
|
// Don't re-throw - close errors are not critical during shutdown
|
|
@@ -3208,7 +3208,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
3208
3208
|
this._removeReceiveHandlers();
|
|
3209
3209
|
}
|
|
3210
3210
|
catch (error) {
|
|
3211
|
-
logger$
|
|
3211
|
+
logger$1j.debug('websocket_remove_handlers_failed', {
|
|
3212
3212
|
error: error instanceof Error ? error.message : String(error),
|
|
3213
3213
|
});
|
|
3214
3214
|
}
|
|
@@ -3262,7 +3262,7 @@ class WebSocketConnector extends BaseAsyncConnector {
|
|
|
3262
3262
|
* Concrete implementations must define supported grant types and provide grant-to-connector
|
|
3263
3263
|
* conversion logic.
|
|
3264
3264
|
*/
|
|
3265
|
-
const logger$
|
|
3265
|
+
const logger$1i = getLogger('naylence.fame.connector.connector_factory');
|
|
3266
3266
|
const CONNECTOR_FACTORY_BASE_TYPE = 'ConnectorFactory';
|
|
3267
3267
|
/**
|
|
3268
3268
|
* Abstract base class for connector factories
|
|
@@ -3298,7 +3298,7 @@ class ConnectorFactory {
|
|
|
3298
3298
|
}
|
|
3299
3299
|
}
|
|
3300
3300
|
catch (error) {
|
|
3301
|
-
logger$
|
|
3301
|
+
logger$1i.warning(`Failed to evaluate grant with factory ${factoryInfo.constructor.name}: ${error}`);
|
|
3302
3302
|
continue;
|
|
3303
3303
|
}
|
|
3304
3304
|
}
|
|
@@ -3341,7 +3341,7 @@ class ConnectorFactory {
|
|
|
3341
3341
|
}
|
|
3342
3342
|
}
|
|
3343
3343
|
catch (error) {
|
|
3344
|
-
logger$
|
|
3344
|
+
logger$1i.warning(`Failed to create connector config from grant: ${error}`);
|
|
3345
3345
|
continue;
|
|
3346
3346
|
}
|
|
3347
3347
|
}
|
|
@@ -3408,20 +3408,20 @@ class ConnectorFactory {
|
|
|
3408
3408
|
return existing;
|
|
3409
3409
|
}
|
|
3410
3410
|
if (existing && !this.isGrantAware(existing)) {
|
|
3411
|
-
logger$
|
|
3411
|
+
logger$1i.warning(`Factory ${factoryInfo.constructor.name} is registered under ${CONNECTOR_FACTORY_BASE_TYPE} but is missing grant conversion APIs; skipping.`);
|
|
3412
3412
|
return null;
|
|
3413
3413
|
}
|
|
3414
3414
|
try {
|
|
3415
3415
|
const instance = new factoryInfo.constructor();
|
|
3416
3416
|
if (!this.isGrantAware(instance)) {
|
|
3417
|
-
logger$
|
|
3417
|
+
logger$1i.warning(`Factory ${factoryInfo.constructor.name} does not implement grant conversion APIs required by ${CONNECTOR_FACTORY_BASE_TYPE}; skipping.`);
|
|
3418
3418
|
return null;
|
|
3419
3419
|
}
|
|
3420
3420
|
factoryInfo.instance = instance;
|
|
3421
3421
|
return instance;
|
|
3422
3422
|
}
|
|
3423
3423
|
catch (error) {
|
|
3424
|
-
logger$
|
|
3424
|
+
logger$1i.warning(`Failed to instantiate factory ${factoryInfo.constructor.name} while resolving grant conversion APIs: ${error}`);
|
|
3425
3425
|
return null;
|
|
3426
3426
|
}
|
|
3427
3427
|
}
|
|
@@ -3580,7 +3580,7 @@ class AuthInjectionStrategyFactory extends AbstractResourceFactory {
|
|
|
3580
3580
|
}
|
|
3581
3581
|
}
|
|
3582
3582
|
|
|
3583
|
-
const logger$
|
|
3583
|
+
const logger$1h = getLogger('naylence.fame.connector.websocket_connector_factory');
|
|
3584
3584
|
let sslLoader = null;
|
|
3585
3585
|
function setWebSocketConnectorSslLoader(loader) {
|
|
3586
3586
|
sslLoader = loader;
|
|
@@ -3591,7 +3591,7 @@ class WebSocketConnectionGrantImpl {
|
|
|
3591
3591
|
this.purpose = 'connection';
|
|
3592
3592
|
}
|
|
3593
3593
|
}
|
|
3594
|
-
const FACTORY_META$
|
|
3594
|
+
const FACTORY_META$1c = {
|
|
3595
3595
|
base: CONNECTOR_FACTORY_BASE_TYPE,
|
|
3596
3596
|
key: 'WebSocketConnector',
|
|
3597
3597
|
};
|
|
@@ -3864,7 +3864,7 @@ class WebSocketConnectorFactory extends ConnectorFactory {
|
|
|
3864
3864
|
}
|
|
3865
3865
|
async _defaultWebSocketClient(url, subprotocols, headers) {
|
|
3866
3866
|
try {
|
|
3867
|
-
logger$
|
|
3867
|
+
logger$1h.debug('websocket_connector_connecting', { url, subprotocols });
|
|
3868
3868
|
if (typeof window !== 'undefined' &&
|
|
3869
3869
|
typeof window.WebSocket !== 'undefined') {
|
|
3870
3870
|
return await this._createBrowserWebSocket(url, subprotocols);
|
|
@@ -3947,7 +3947,7 @@ class WebSocketConnectorFactory extends ConnectorFactory {
|
|
|
3947
3947
|
await Promise.resolve().then(function () { return websocketConnectorNodeSsl; });
|
|
3948
3948
|
}
|
|
3949
3949
|
catch (error) {
|
|
3950
|
-
logger$
|
|
3950
|
+
logger$1h.debug('ssl_certificate_loader_import_failed', {
|
|
3951
3951
|
error: error instanceof Error ? error.message : String(error),
|
|
3952
3952
|
});
|
|
3953
3953
|
}
|
|
@@ -3956,13 +3956,13 @@ class WebSocketConnectorFactory extends ConnectorFactory {
|
|
|
3956
3956
|
if (!loader) {
|
|
3957
3957
|
return undefined;
|
|
3958
3958
|
}
|
|
3959
|
-
return await loader(logger$
|
|
3959
|
+
return await loader(logger$1h);
|
|
3960
3960
|
}
|
|
3961
3961
|
}
|
|
3962
3962
|
|
|
3963
3963
|
var websocketConnectorFactory = /*#__PURE__*/Object.freeze({
|
|
3964
3964
|
__proto__: null,
|
|
3965
|
-
FACTORY_META: FACTORY_META$
|
|
3965
|
+
FACTORY_META: FACTORY_META$1c,
|
|
3966
3966
|
WebSocketConnectorFactory: WebSocketConnectorFactory,
|
|
3967
3967
|
default: WebSocketConnectorFactory,
|
|
3968
3968
|
setWebSocketConnectorSslLoader: setWebSocketConnectorSslLoader
|
|
@@ -4032,6 +4032,7 @@ const MODULES = [
|
|
|
4032
4032
|
"./node/admission/direct-admission-client-factory.js",
|
|
4033
4033
|
"./node/admission/noop-admission-client-factory.js",
|
|
4034
4034
|
"./node/admission/welcome-service-client-factory.js",
|
|
4035
|
+
"./node/default-connection-retry-policy-factory.js",
|
|
4035
4036
|
"./node/default-node-identity-policy-factory.js",
|
|
4036
4037
|
"./node/node-factory.js",
|
|
4037
4038
|
"./node/node-identity-policy-profile-factory.js",
|
|
@@ -4110,6 +4111,7 @@ const MODULE_LOADERS = {
|
|
|
4110
4111
|
"./node/admission/direct-admission-client-factory.js": () => Promise.resolve().then(function () { return directAdmissionClientFactory; }),
|
|
4111
4112
|
"./node/admission/noop-admission-client-factory.js": () => Promise.resolve().then(function () { return noopAdmissionClientFactory; }),
|
|
4112
4113
|
"./node/admission/welcome-service-client-factory.js": () => Promise.resolve().then(function () { return welcomeServiceClientFactory; }),
|
|
4114
|
+
"./node/default-connection-retry-policy-factory.js": () => Promise.resolve().then(function () { return defaultConnectionRetryPolicyFactory; }),
|
|
4113
4115
|
"./node/default-node-identity-policy-factory.js": () => Promise.resolve().then(function () { return defaultNodeIdentityPolicyFactory; }),
|
|
4114
4116
|
"./node/node-factory.js": () => Promise.resolve().then(function () { return nodeFactory; }),
|
|
4115
4117
|
"./node/node-identity-policy-profile-factory.js": () => Promise.resolve().then(function () { return nodeIdentityPolicyProfileFactory; }),
|
|
@@ -4423,12 +4425,12 @@ async function ensureRuntimeFactoriesRegistered(registry = Registry) {
|
|
|
4423
4425
|
}
|
|
4424
4426
|
|
|
4425
4427
|
// This file is auto-generated during build - do not edit manually
|
|
4426
|
-
// Generated from package.json version: 0.3.
|
|
4428
|
+
// Generated from package.json version: 0.3.16
|
|
4427
4429
|
/**
|
|
4428
4430
|
* The package version, injected at build time.
|
|
4429
4431
|
* @internal
|
|
4430
4432
|
*/
|
|
4431
|
-
const VERSION = '0.3.
|
|
4433
|
+
const VERSION = '0.3.16';
|
|
4432
4434
|
|
|
4433
4435
|
let initialized = false;
|
|
4434
4436
|
const runtimePlugin = {
|
|
@@ -4543,7 +4545,7 @@ class EnvCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
4543
4545
|
return new EnvCredentialProvider(resolved.varName);
|
|
4544
4546
|
}
|
|
4545
4547
|
}
|
|
4546
|
-
const FACTORY_META$
|
|
4548
|
+
const FACTORY_META$1b = {
|
|
4547
4549
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
4548
4550
|
key: 'EnvCredentialProvider',
|
|
4549
4551
|
};
|
|
@@ -4551,7 +4553,7 @@ const FACTORY_META$1a = {
|
|
|
4551
4553
|
var envCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
4552
4554
|
__proto__: null,
|
|
4553
4555
|
EnvCredentialProviderFactory: EnvCredentialProviderFactory,
|
|
4554
|
-
FACTORY_META: FACTORY_META$
|
|
4556
|
+
FACTORY_META: FACTORY_META$1b,
|
|
4555
4557
|
default: EnvCredentialProviderFactory,
|
|
4556
4558
|
normalizeEnvConfig: normalizeEnvConfig
|
|
4557
4559
|
});
|
|
@@ -4649,14 +4651,14 @@ class PromptCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
4649
4651
|
return new PromptCredentialProvider(resolved.credentialName);
|
|
4650
4652
|
}
|
|
4651
4653
|
}
|
|
4652
|
-
const FACTORY_META$
|
|
4654
|
+
const FACTORY_META$1a = {
|
|
4653
4655
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
4654
4656
|
key: 'PromptCredentialProvider',
|
|
4655
4657
|
};
|
|
4656
4658
|
|
|
4657
4659
|
var promptCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
4658
4660
|
__proto__: null,
|
|
4659
|
-
FACTORY_META: FACTORY_META$
|
|
4661
|
+
FACTORY_META: FACTORY_META$1a,
|
|
4660
4662
|
PromptCredentialProviderFactory: PromptCredentialProviderFactory,
|
|
4661
4663
|
default: PromptCredentialProviderFactory,
|
|
4662
4664
|
normalizePromptConfig: normalizePromptConfig
|
|
@@ -4710,14 +4712,14 @@ class SecretStoreCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
4710
4712
|
return new SecretStoreCredentialProvider(resolved.secretName);
|
|
4711
4713
|
}
|
|
4712
4714
|
}
|
|
4713
|
-
const FACTORY_META$
|
|
4715
|
+
const FACTORY_META$19 = {
|
|
4714
4716
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
4715
4717
|
key: 'SecretStoreCredentialProvider',
|
|
4716
4718
|
};
|
|
4717
4719
|
|
|
4718
4720
|
var secretStoreCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
4719
4721
|
__proto__: null,
|
|
4720
|
-
FACTORY_META: FACTORY_META$
|
|
4722
|
+
FACTORY_META: FACTORY_META$19,
|
|
4721
4723
|
SecretStoreCredentialProviderFactory: SecretStoreCredentialProviderFactory,
|
|
4722
4724
|
default: SecretStoreCredentialProviderFactory,
|
|
4723
4725
|
normalizeSecretStoreConfig: normalizeSecretStoreConfig
|
|
@@ -4766,14 +4768,14 @@ class StaticCredentialProviderFactory extends CredentialProviderFactory {
|
|
|
4766
4768
|
return new StaticCredentialProvider(resolved.credentialValue);
|
|
4767
4769
|
}
|
|
4768
4770
|
}
|
|
4769
|
-
const FACTORY_META$
|
|
4771
|
+
const FACTORY_META$18 = {
|
|
4770
4772
|
base: CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE,
|
|
4771
4773
|
key: 'StaticCredentialProvider',
|
|
4772
4774
|
};
|
|
4773
4775
|
|
|
4774
4776
|
var staticCredentialProviderFactory = /*#__PURE__*/Object.freeze({
|
|
4775
4777
|
__proto__: null,
|
|
4776
|
-
FACTORY_META: FACTORY_META$
|
|
4778
|
+
FACTORY_META: FACTORY_META$18,
|
|
4777
4779
|
StaticCredentialProviderFactory: StaticCredentialProviderFactory,
|
|
4778
4780
|
default: StaticCredentialProviderFactory,
|
|
4779
4781
|
normalizeStaticConfig: normalizeStaticConfig
|
|
@@ -5635,7 +5637,7 @@ async function withLock(lock, operation) {
|
|
|
5635
5637
|
return await lock.runExclusive(operation);
|
|
5636
5638
|
}
|
|
5637
5639
|
|
|
5638
|
-
const logger$
|
|
5640
|
+
const logger$1g = getLogger('naylence.fame.storage.sqlite_storage_provider');
|
|
5639
5641
|
let cachedSqliteCtor;
|
|
5640
5642
|
async function loadSqliteConstructor() {
|
|
5641
5643
|
if (cachedSqliteCtor !== undefined) {
|
|
@@ -5659,7 +5661,7 @@ async function loadSqliteConstructor() {
|
|
|
5659
5661
|
}
|
|
5660
5662
|
catch (error) {
|
|
5661
5663
|
cachedSqliteCtor = null;
|
|
5662
|
-
logger$
|
|
5664
|
+
logger$1g.error('failed-to-load-better-sqlite3', {
|
|
5663
5665
|
error: error instanceof Error ? error.message : String(error),
|
|
5664
5666
|
});
|
|
5665
5667
|
throw new Error('Failed to load better-sqlite3. Install it to enable SQLite storage support.');
|
|
@@ -5694,7 +5696,7 @@ class SQLiteKeyValueStore {
|
|
|
5694
5696
|
}
|
|
5695
5697
|
catch (error) {
|
|
5696
5698
|
if (this.autoRecover && this.isCorruptionError(error)) {
|
|
5697
|
-
logger$
|
|
5699
|
+
logger$1g.warning('detected-corrupted-db', { path: this.dbPath });
|
|
5698
5700
|
await this.recoverCorruptedDb();
|
|
5699
5701
|
if (!this.db) {
|
|
5700
5702
|
throw new Error('Failed to recover SQLite database');
|
|
@@ -5749,7 +5751,7 @@ class SQLiteKeyValueStore {
|
|
|
5749
5751
|
await this.closeDatabase();
|
|
5750
5752
|
await this.quarantineCorruptedFiles();
|
|
5751
5753
|
await this.openDatabase();
|
|
5752
|
-
logger$
|
|
5754
|
+
logger$1g.warning('quarantined-corrupted-db', { path: this.dbPath });
|
|
5753
5755
|
}
|
|
5754
5756
|
async closeDatabase() {
|
|
5755
5757
|
if (this.db) {
|
|
@@ -5757,7 +5759,7 @@ class SQLiteKeyValueStore {
|
|
|
5757
5759
|
this.db.close();
|
|
5758
5760
|
}
|
|
5759
5761
|
catch (error) {
|
|
5760
|
-
logger$
|
|
5762
|
+
logger$1g.warning('failed-to-close-sqlite-db', {
|
|
5761
5763
|
path: this.dbPath,
|
|
5762
5764
|
error: error instanceof Error ? error.message : String(error),
|
|
5763
5765
|
});
|
|
@@ -5780,7 +5782,7 @@ class SQLiteKeyValueStore {
|
|
|
5780
5782
|
await fsPromises.rename(candidate, quarantinedName);
|
|
5781
5783
|
}
|
|
5782
5784
|
catch (error) {
|
|
5783
|
-
logger$
|
|
5785
|
+
logger$1g.error('failed-to-quarantine-sqlite-file', {
|
|
5784
5786
|
file: candidate,
|
|
5785
5787
|
error: error instanceof Error ? error.message : String(error),
|
|
5786
5788
|
});
|
|
@@ -5881,7 +5883,7 @@ class SQLiteKeyValueStore {
|
|
|
5881
5883
|
result[row.key] = this.deserialize(row.value);
|
|
5882
5884
|
}
|
|
5883
5885
|
catch (error) {
|
|
5884
|
-
logger$
|
|
5886
|
+
logger$1g.warning('skipping-corrupted-sqlite-entry', {
|
|
5885
5887
|
key: row.key,
|
|
5886
5888
|
error: error instanceof Error ? error.message : String(error),
|
|
5887
5889
|
});
|
|
@@ -6876,7 +6878,7 @@ class InMemoryBinding {
|
|
|
6876
6878
|
* TypeScript port of Python's InMemoryFanoutBroker that extends TaskSpawner
|
|
6877
6879
|
* to manage multiple WriteChannel subscribers with concurrent message distribution.
|
|
6878
6880
|
*/
|
|
6879
|
-
const logger$
|
|
6881
|
+
const logger$1f = getLogger('naylence.fame.channel.in_memory.in_memory_fanout_broker');
|
|
6880
6882
|
// Sentinel object for shutdown signaling
|
|
6881
6883
|
const SENTINEL = Symbol('fanout-broker-sentinel');
|
|
6882
6884
|
function isCloseable(obj) {
|
|
@@ -6929,7 +6931,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
6929
6931
|
}
|
|
6930
6932
|
catch (error) {
|
|
6931
6933
|
// Ignore errors when sending sentinel (sink might be closed)
|
|
6932
|
-
logger$
|
|
6934
|
+
logger$1f.debug('error_sending_sentinel', {
|
|
6933
6935
|
error: error.message,
|
|
6934
6936
|
});
|
|
6935
6937
|
}
|
|
@@ -6943,7 +6945,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
6943
6945
|
await sub.close();
|
|
6944
6946
|
}
|
|
6945
6947
|
catch (error) {
|
|
6946
|
-
logger$
|
|
6948
|
+
logger$1f.error('error_closing_subscriber', {
|
|
6947
6949
|
subscriber: sub.toString(),
|
|
6948
6950
|
error: error.message,
|
|
6949
6951
|
});
|
|
@@ -6983,7 +6985,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
6983
6985
|
[envelope, context] = extractEnvelopeAndContext(msg);
|
|
6984
6986
|
}
|
|
6985
6987
|
catch (error) {
|
|
6986
|
-
logger$
|
|
6988
|
+
logger$1f.debug('failed_to_extract_envelope', {
|
|
6987
6989
|
error: error.message,
|
|
6988
6990
|
});
|
|
6989
6991
|
continue;
|
|
@@ -7005,7 +7007,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
7005
7007
|
await sub.send(messageToSend);
|
|
7006
7008
|
}
|
|
7007
7009
|
catch (error) {
|
|
7008
|
-
logger$
|
|
7010
|
+
logger$1f.error('error_sending_to_subscriber', {
|
|
7009
7011
|
subscriber: sub.toString(),
|
|
7010
7012
|
error: error.message,
|
|
7011
7013
|
action: 'unsubscribing',
|
|
@@ -7021,7 +7023,7 @@ class InMemoryFanoutBroker extends TaskSpawner {
|
|
|
7021
7023
|
}
|
|
7022
7024
|
catch (error) {
|
|
7023
7025
|
// Critical broker-level error: log and back off, but keep the loop running
|
|
7024
|
-
logger$
|
|
7026
|
+
logger$1f.critical('receive_loop_failed_unexpectedly', {
|
|
7025
7027
|
error: error.message,
|
|
7026
7028
|
stack: error.stack,
|
|
7027
7029
|
});
|
|
@@ -7730,7 +7732,7 @@ function normalizeResponseType(value) {
|
|
|
7730
7732
|
return value;
|
|
7731
7733
|
}
|
|
7732
7734
|
|
|
7733
|
-
const logger$
|
|
7735
|
+
const logger$1e = getLogger('naylence.fame.node.binding_manager');
|
|
7734
7736
|
const SYSTEM_INBOX$3 = '__sys__';
|
|
7735
7737
|
const DEFAULT_ACK_TIMEOUT_MS = 20000;
|
|
7736
7738
|
class BindingStoreEntryRecord {
|
|
@@ -7816,7 +7818,7 @@ class BindingManager {
|
|
|
7816
7818
|
if (!this.bindings.has(key)) {
|
|
7817
7819
|
const binding = this.bindingFactory(new FameAddress(key));
|
|
7818
7820
|
this.bindings.set(key, binding);
|
|
7819
|
-
logger$
|
|
7821
|
+
logger$1e.debug('restored_binding', { address: key });
|
|
7820
7822
|
}
|
|
7821
7823
|
}
|
|
7822
7824
|
if (!this.hasUpstream) {
|
|
@@ -7826,13 +7828,13 @@ class BindingManager {
|
|
|
7826
7828
|
await this.readvertiseCapabilitiesUpstream();
|
|
7827
7829
|
}
|
|
7828
7830
|
async bind(participant, capabilities) {
|
|
7829
|
-
logger$
|
|
7831
|
+
logger$1e.debug('binding_participant', { participant });
|
|
7830
7832
|
const { prefixAddress, addresses, propagateAddress, capabilityAddress } = this.computeBindingAddresses(participant);
|
|
7831
7833
|
for (const address of addresses) {
|
|
7832
7834
|
if (!this.bindings.has(address)) {
|
|
7833
7835
|
const binding = this.bindingFactory(new FameAddress(address));
|
|
7834
7836
|
this.bindings.set(address, binding);
|
|
7835
|
-
logger$
|
|
7837
|
+
logger$1e.debug('bound_address', { address, participant });
|
|
7836
7838
|
}
|
|
7837
7839
|
}
|
|
7838
7840
|
let propagatedAddress = null;
|
|
@@ -7861,7 +7863,7 @@ class BindingManager {
|
|
|
7861
7863
|
await this.unbindAddressUpstream(propagatedAddress);
|
|
7862
7864
|
}
|
|
7863
7865
|
catch (rollbackError) {
|
|
7864
|
-
logger$
|
|
7866
|
+
logger$1e.error('bind_rollback_failed', {
|
|
7865
7867
|
address: propagatedAddress.toString(),
|
|
7866
7868
|
error: rollbackError.message,
|
|
7867
7869
|
});
|
|
@@ -7880,7 +7882,7 @@ class BindingManager {
|
|
|
7880
7882
|
physicalPath: null,
|
|
7881
7883
|
});
|
|
7882
7884
|
}
|
|
7883
|
-
logger$
|
|
7885
|
+
logger$1e.debug('bind_success', {
|
|
7884
7886
|
participant,
|
|
7885
7887
|
address: prefixAddress.toString(),
|
|
7886
7888
|
capabilities,
|
|
@@ -7916,7 +7918,7 @@ class BindingManager {
|
|
|
7916
7918
|
await this.bindingStore.delete(address);
|
|
7917
7919
|
}
|
|
7918
7920
|
}
|
|
7919
|
-
logger$
|
|
7921
|
+
logger$1e.debug('unbind_success', {
|
|
7920
7922
|
participant,
|
|
7921
7923
|
address: prefixAddress.toString(),
|
|
7922
7924
|
totalBindings: this.bindings.size,
|
|
@@ -7946,7 +7948,7 @@ class BindingManager {
|
|
|
7946
7948
|
await this.bindAddressUpstream(new FameAddress(address));
|
|
7947
7949
|
}
|
|
7948
7950
|
catch (error) {
|
|
7949
|
-
logger$
|
|
7951
|
+
logger$1e.error('rebind_failed', {
|
|
7950
7952
|
address,
|
|
7951
7953
|
error: error.message,
|
|
7952
7954
|
});
|
|
@@ -7965,7 +7967,7 @@ class BindingManager {
|
|
|
7965
7967
|
await this.advertiseCapabilities(new FameAddress(address), Array.from(capabilities));
|
|
7966
7968
|
}
|
|
7967
7969
|
catch (error) {
|
|
7968
|
-
logger$
|
|
7970
|
+
logger$1e.error('capability_replay_failed', {
|
|
7969
7971
|
address,
|
|
7970
7972
|
error: error.message,
|
|
7971
7973
|
});
|
|
@@ -8232,7 +8234,7 @@ class BindingManager {
|
|
|
8232
8234
|
}
|
|
8233
8235
|
}
|
|
8234
8236
|
|
|
8235
|
-
const logger$
|
|
8237
|
+
const logger$1d = getLogger('naylence.fame.node.response_context_manager');
|
|
8236
8238
|
function cloneSecurityContext(source) {
|
|
8237
8239
|
if (!source) {
|
|
8238
8240
|
return undefined;
|
|
@@ -8260,7 +8262,7 @@ class ResponseContextManager {
|
|
|
8260
8262
|
security: responseSecurity,
|
|
8261
8263
|
expectedResponseType: FameResponseType.NONE,
|
|
8262
8264
|
};
|
|
8263
|
-
logger$
|
|
8265
|
+
logger$1d.debug('created_response_context', {
|
|
8264
8266
|
request_id: requestEnvelope.id,
|
|
8265
8267
|
inherited_crypto_level: responseSecurity?.inboundCryptoLevel ?? null,
|
|
8266
8268
|
channel_id: responseSecurity?.cryptoChannelId ?? null,
|
|
@@ -8280,14 +8282,14 @@ class ResponseContextManager {
|
|
|
8280
8282
|
responseContext.fromSystemId = this.getId();
|
|
8281
8283
|
}
|
|
8282
8284
|
// Envelope-level metadata is intentionally omitted to defer to context usage.
|
|
8283
|
-
logger$
|
|
8285
|
+
logger$1d.debug('ensured_response_metadata', {
|
|
8284
8286
|
response_id: responseEnvelope.id,
|
|
8285
8287
|
request_id: requestEnvelope.id,
|
|
8286
8288
|
});
|
|
8287
8289
|
}
|
|
8288
8290
|
}
|
|
8289
8291
|
|
|
8290
|
-
const logger$
|
|
8292
|
+
const logger$1c = getLogger('naylence.fame.node.streaming_response_handler');
|
|
8291
8293
|
function isObject(value) {
|
|
8292
8294
|
return typeof value === 'object' && value !== null;
|
|
8293
8295
|
}
|
|
@@ -8406,12 +8408,12 @@ class StreamingResponseHandler {
|
|
|
8406
8408
|
}
|
|
8407
8409
|
async handleStreamingFameMessageResponses(responses, requestEnvelope, requestContext) {
|
|
8408
8410
|
const asyncResponses = toAsyncIterable(responses);
|
|
8409
|
-
logger$
|
|
8411
|
+
logger$1c.debug('handling_streaming_fame_message_responses', {
|
|
8410
8412
|
request_id: requestEnvelope.id,
|
|
8411
8413
|
});
|
|
8412
8414
|
for await (const response of asyncResponses) {
|
|
8413
8415
|
if (!response?.envelope) {
|
|
8414
|
-
logger$
|
|
8416
|
+
logger$1c.warning('invalid_streaming_response_type', {
|
|
8415
8417
|
request_id: requestEnvelope.id,
|
|
8416
8418
|
actual_type: typeof response,
|
|
8417
8419
|
});
|
|
@@ -8425,7 +8427,7 @@ class StreamingResponseHandler {
|
|
|
8425
8427
|
}
|
|
8426
8428
|
async handleStreamingResponse(result, requestEnvelope, requestContext, replyTo, requestId) {
|
|
8427
8429
|
const iterable = toAsyncIterable(result);
|
|
8428
|
-
logger$
|
|
8430
|
+
logger$1c.debug('handling_streaming_response', {
|
|
8429
8431
|
request_id: requestId,
|
|
8430
8432
|
reply_to: replyTo,
|
|
8431
8433
|
});
|
|
@@ -8436,7 +8438,7 @@ class StreamingResponseHandler {
|
|
|
8436
8438
|
await this.sendRpcResponse(null, requestEnvelope, requestContext, replyTo, requestId);
|
|
8437
8439
|
}
|
|
8438
8440
|
catch (error) {
|
|
8439
|
-
logger$
|
|
8441
|
+
logger$1c.error('streaming_response_handler_error', {
|
|
8440
8442
|
request_id: requestId,
|
|
8441
8443
|
error: error instanceof Error ? error.message : String(error),
|
|
8442
8444
|
});
|
|
@@ -8463,7 +8465,7 @@ class StreamingResponseHandler {
|
|
|
8463
8465
|
});
|
|
8464
8466
|
const responseContext = this.responseContextManager.createResponseContext(requestEnvelope, requestContext);
|
|
8465
8467
|
this.responseContextManager.ensureResponseMetadata(responseEnvelope, requestEnvelope, responseContext);
|
|
8466
|
-
logger$
|
|
8468
|
+
logger$1c.debug('sending_streaming_rpc_response', {
|
|
8467
8469
|
request_id: requestId,
|
|
8468
8470
|
response_envelope_id: responseEnvelope.id,
|
|
8469
8471
|
reply_to: replyTo,
|
|
@@ -8476,7 +8478,7 @@ class StreamingResponseHandler {
|
|
|
8476
8478
|
}
|
|
8477
8479
|
}
|
|
8478
8480
|
|
|
8479
|
-
const logger$
|
|
8481
|
+
const logger$1b = getLogger('naylence.fame.node.channel_polling_manager');
|
|
8480
8482
|
class ChannelPollingManager {
|
|
8481
8483
|
constructor(deliverWrapper, responseContextManager, streamingResponseHandler) {
|
|
8482
8484
|
this.deliverWrapper = deliverWrapper;
|
|
@@ -8484,7 +8486,7 @@ class ChannelPollingManager {
|
|
|
8484
8486
|
this.streamingResponseHandler = streamingResponseHandler;
|
|
8485
8487
|
}
|
|
8486
8488
|
async startPollingLoop(serviceName, channel, handler, stopState, pollTimeoutMs = DEFAULT_POLLING_TIMEOUT_MS) {
|
|
8487
|
-
logger$
|
|
8489
|
+
logger$1b.debug('poll_loop_started', {
|
|
8488
8490
|
recipient: serviceName,
|
|
8489
8491
|
});
|
|
8490
8492
|
try {
|
|
@@ -8492,7 +8494,7 @@ class ChannelPollingManager {
|
|
|
8492
8494
|
while (true) {
|
|
8493
8495
|
if (this.isStopRequested(stopState) && !draining) {
|
|
8494
8496
|
draining = true;
|
|
8495
|
-
logger$
|
|
8497
|
+
logger$1b.debug('poll_loop_draining_pending_messages', {
|
|
8496
8498
|
recipient: serviceName,
|
|
8497
8499
|
});
|
|
8498
8500
|
}
|
|
@@ -8502,7 +8504,7 @@ class ChannelPollingManager {
|
|
|
8502
8504
|
}
|
|
8503
8505
|
catch (error) {
|
|
8504
8506
|
if (error instanceof FameTransportClose) {
|
|
8505
|
-
logger$
|
|
8507
|
+
logger$1b.debug('channel_closed', {
|
|
8506
8508
|
recipient: serviceName,
|
|
8507
8509
|
message: error.message,
|
|
8508
8510
|
});
|
|
@@ -8515,7 +8517,7 @@ class ChannelPollingManager {
|
|
|
8515
8517
|
continue;
|
|
8516
8518
|
}
|
|
8517
8519
|
if (error instanceof Error && error.name === 'AbortError') {
|
|
8518
|
-
logger$
|
|
8520
|
+
logger$1b.debug('listener_cancelled', {
|
|
8519
8521
|
recipient: serviceName,
|
|
8520
8522
|
});
|
|
8521
8523
|
throw error;
|
|
@@ -8527,13 +8529,13 @@ class ChannelPollingManager {
|
|
|
8527
8529
|
continue;
|
|
8528
8530
|
}
|
|
8529
8531
|
if (error instanceof Error && error.message === 'Channel is closed') {
|
|
8530
|
-
logger$
|
|
8532
|
+
logger$1b.debug('channel_closed', {
|
|
8531
8533
|
recipient: serviceName,
|
|
8532
8534
|
});
|
|
8533
8535
|
break;
|
|
8534
8536
|
}
|
|
8535
8537
|
if (error instanceof Error && error.name === 'TaskCancelledError') {
|
|
8536
|
-
logger$
|
|
8538
|
+
logger$1b.debug('listener_cancelled', {
|
|
8537
8539
|
recipient: serviceName,
|
|
8538
8540
|
});
|
|
8539
8541
|
throw error;
|
|
@@ -8545,12 +8547,12 @@ class ChannelPollingManager {
|
|
|
8545
8547
|
continue;
|
|
8546
8548
|
}
|
|
8547
8549
|
if (error instanceof Error && error.message.includes('closed')) {
|
|
8548
|
-
logger$
|
|
8550
|
+
logger$1b.debug('channel_closed', {
|
|
8549
8551
|
recipient: serviceName,
|
|
8550
8552
|
});
|
|
8551
8553
|
break;
|
|
8552
8554
|
}
|
|
8553
|
-
logger$
|
|
8555
|
+
logger$1b.error('transport_error', {
|
|
8554
8556
|
recipient: serviceName,
|
|
8555
8557
|
error: error instanceof Error ? error.message : String(error),
|
|
8556
8558
|
});
|
|
@@ -8566,7 +8568,7 @@ class ChannelPollingManager {
|
|
|
8566
8568
|
}
|
|
8567
8569
|
}
|
|
8568
8570
|
finally {
|
|
8569
|
-
logger$
|
|
8571
|
+
logger$1b.debug('poll_loop_exiting', {
|
|
8570
8572
|
recipient: serviceName,
|
|
8571
8573
|
});
|
|
8572
8574
|
}
|
|
@@ -8579,7 +8581,7 @@ class ChannelPollingManager {
|
|
|
8579
8581
|
await this.processHandlerResult(result, envelope, deliveryContext, serviceName);
|
|
8580
8582
|
}
|
|
8581
8583
|
catch (error) {
|
|
8582
|
-
logger$
|
|
8584
|
+
logger$1b.error('handler_crashed', {
|
|
8583
8585
|
recipient: serviceName,
|
|
8584
8586
|
error: error instanceof Error ? error.message : String(error),
|
|
8585
8587
|
});
|
|
@@ -8593,7 +8595,7 @@ class ChannelPollingManager {
|
|
|
8593
8595
|
return;
|
|
8594
8596
|
}
|
|
8595
8597
|
if (this.streamingResponseHandler.isStreamingFameMessageResponse(result)) {
|
|
8596
|
-
logger$
|
|
8598
|
+
logger$1b.debug('handling_streaming_fame_message_responses', {
|
|
8597
8599
|
service_name: serviceName,
|
|
8598
8600
|
envelope_id: envelope.id,
|
|
8599
8601
|
});
|
|
@@ -8601,7 +8603,7 @@ class ChannelPollingManager {
|
|
|
8601
8603
|
}
|
|
8602
8604
|
}
|
|
8603
8605
|
async handleMessageResponse(response, requestEnvelope, requestContext, serviceName) {
|
|
8604
|
-
logger$
|
|
8606
|
+
logger$1b.debug('delivering_envelope_response_message', {
|
|
8605
8607
|
service_name: serviceName,
|
|
8606
8608
|
response_envelope_id: response.envelope.id,
|
|
8607
8609
|
});
|
|
@@ -8621,7 +8623,7 @@ class ChannelPollingManager {
|
|
|
8621
8623
|
}
|
|
8622
8624
|
}
|
|
8623
8625
|
|
|
8624
|
-
const logger$
|
|
8626
|
+
const logger$1a = getLogger('naylence.fame.node.rpc_server_handler');
|
|
8625
8627
|
function isPlainRecord$6(value) {
|
|
8626
8628
|
if (typeof value !== 'object' || value === null) {
|
|
8627
8629
|
return false;
|
|
@@ -8665,13 +8667,13 @@ class RPCServerHandler {
|
|
|
8665
8667
|
}
|
|
8666
8668
|
async handleRpcRequest(envelope, handlerContext, handler, serviceName) {
|
|
8667
8669
|
if (!this.isDataFrame(envelope.frame)) {
|
|
8668
|
-
logger$
|
|
8670
|
+
logger$1a.warning('rpc_request_missing_data_frame', {
|
|
8669
8671
|
service_name: serviceName,
|
|
8670
8672
|
envelope_id: envelope.id,
|
|
8671
8673
|
});
|
|
8672
8674
|
return;
|
|
8673
8675
|
}
|
|
8674
|
-
logger$
|
|
8676
|
+
logger$1a.debug('rpc_request_received', {
|
|
8675
8677
|
service_name: serviceName,
|
|
8676
8678
|
envelope_id: envelope.id,
|
|
8677
8679
|
trace_id: envelope.traceId,
|
|
@@ -8683,7 +8685,7 @@ class RPCServerHandler {
|
|
|
8683
8685
|
request = parseRequest(envelope.frame.payload);
|
|
8684
8686
|
params = cloneParams(request.params);
|
|
8685
8687
|
const paramKeys = Object.keys(params);
|
|
8686
|
-
logger$
|
|
8688
|
+
logger$1a.debug('parsed_rpc_request', {
|
|
8687
8689
|
service_name: serviceName,
|
|
8688
8690
|
method: request.method,
|
|
8689
8691
|
request_id: request.id,
|
|
@@ -8692,7 +8694,7 @@ class RPCServerHandler {
|
|
|
8692
8694
|
});
|
|
8693
8695
|
}
|
|
8694
8696
|
catch (error) {
|
|
8695
|
-
logger$
|
|
8697
|
+
logger$1a.warning('request_decode_error', {
|
|
8696
8698
|
service_name: serviceName,
|
|
8697
8699
|
envelope_id: envelope.id,
|
|
8698
8700
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -8700,7 +8702,7 @@ class RPCServerHandler {
|
|
|
8700
8702
|
return;
|
|
8701
8703
|
}
|
|
8702
8704
|
if (request.id == null) {
|
|
8703
|
-
logger$
|
|
8705
|
+
logger$1a.warning('request_missing_id', {
|
|
8704
8706
|
service_name: serviceName,
|
|
8705
8707
|
envelope_id: envelope.id,
|
|
8706
8708
|
});
|
|
@@ -8708,7 +8710,7 @@ class RPCServerHandler {
|
|
|
8708
8710
|
}
|
|
8709
8711
|
const replyTo = this.resolveReplyTo(envelope, params);
|
|
8710
8712
|
if (!replyTo) {
|
|
8711
|
-
logger$
|
|
8713
|
+
logger$1a.warning('missing_reply_to', {
|
|
8712
8714
|
service_name: serviceName,
|
|
8713
8715
|
envelope_id: envelope.id,
|
|
8714
8716
|
request_id: request.id,
|
|
@@ -8717,13 +8719,13 @@ class RPCServerHandler {
|
|
|
8717
8719
|
}
|
|
8718
8720
|
let handlerResult;
|
|
8719
8721
|
try {
|
|
8720
|
-
logger$
|
|
8722
|
+
logger$1a.debug('calling_rpc_handler', {
|
|
8721
8723
|
service_name: serviceName,
|
|
8722
8724
|
method: request.method,
|
|
8723
8725
|
request_id: request.id,
|
|
8724
8726
|
});
|
|
8725
8727
|
handlerResult = await handler(request.method, params);
|
|
8726
|
-
logger$
|
|
8728
|
+
logger$1a.debug('rpc_handler_returned', {
|
|
8727
8729
|
service_name: serviceName,
|
|
8728
8730
|
method: request.method,
|
|
8729
8731
|
request_id: request.id,
|
|
@@ -8732,7 +8734,7 @@ class RPCServerHandler {
|
|
|
8732
8734
|
});
|
|
8733
8735
|
}
|
|
8734
8736
|
catch (error) {
|
|
8735
|
-
logger$
|
|
8737
|
+
logger$1a.error('rpc_handler_error', {
|
|
8736
8738
|
service_name: serviceName,
|
|
8737
8739
|
request_id: request.id,
|
|
8738
8740
|
envelope_id: envelope.id,
|
|
@@ -8742,7 +8744,7 @@ class RPCServerHandler {
|
|
|
8742
8744
|
return this.createTraditionalResponse(response, request.id, envelope, replyTo, handlerContext, serviceName);
|
|
8743
8745
|
}
|
|
8744
8746
|
if (isFameMessageResponse(handlerResult)) {
|
|
8745
|
-
logger$
|
|
8747
|
+
logger$1a.debug('returning_response_message', {
|
|
8746
8748
|
service_name: serviceName,
|
|
8747
8749
|
request_id: request.id,
|
|
8748
8750
|
response_envelope_id: handlerResult.envelope.id,
|
|
@@ -8750,7 +8752,7 @@ class RPCServerHandler {
|
|
|
8750
8752
|
return handlerResult;
|
|
8751
8753
|
}
|
|
8752
8754
|
if (this.streamingResponseHandler.isStreamingResult(handlerResult)) {
|
|
8753
|
-
logger$
|
|
8755
|
+
logger$1a.debug('handling_streaming_response', {
|
|
8754
8756
|
service_name: serviceName,
|
|
8755
8757
|
request_id: request.id,
|
|
8756
8758
|
envelope_id: envelope.id,
|
|
@@ -8779,7 +8781,7 @@ class RPCServerHandler {
|
|
|
8779
8781
|
return null;
|
|
8780
8782
|
}
|
|
8781
8783
|
async createTraditionalResponse(payload, requestId, requestEnvelope, replyTo, handlerContext, serviceName) {
|
|
8782
|
-
logger$
|
|
8784
|
+
logger$1a.debug('creating_traditional_response_envelope', {
|
|
8783
8785
|
service_name: serviceName,
|
|
8784
8786
|
request_id: requestId,
|
|
8785
8787
|
envelope_id: requestEnvelope.id,
|
|
@@ -8803,7 +8805,7 @@ class RPCServerHandler {
|
|
|
8803
8805
|
if (requestEnvelope.id) {
|
|
8804
8806
|
responseContext.meta['response-to-id'] = requestEnvelope.id;
|
|
8805
8807
|
}
|
|
8806
|
-
logger$
|
|
8808
|
+
logger$1a.debug('returning_traditional_response', {
|
|
8807
8809
|
service_name: serviceName,
|
|
8808
8810
|
request_id: requestId,
|
|
8809
8811
|
envelope_id: requestEnvelope.id,
|
|
@@ -8868,7 +8870,7 @@ function normalizeErrorCode(code) {
|
|
|
8868
8870
|
return code;
|
|
8869
8871
|
}
|
|
8870
8872
|
|
|
8871
|
-
const logger$
|
|
8873
|
+
const logger$19 = getLogger('naylence.fame.node.rpc_client_manager');
|
|
8872
8874
|
function isPlainRecord$5(value) {
|
|
8873
8875
|
if (typeof value !== 'object' || value === null) {
|
|
8874
8876
|
return false;
|
|
@@ -9085,7 +9087,7 @@ class RPCClientManager {
|
|
|
9085
9087
|
const metaReason = tracked.meta?.['nack_reason'];
|
|
9086
9088
|
const formattedMessage = formatDeliveryErrorMessage(typeof metaCode === 'string' ? metaCode : 'DELIVERY_ERROR', reason ??
|
|
9087
9089
|
(typeof metaReason === 'string' ? metaReason : undefined));
|
|
9088
|
-
logger$
|
|
9090
|
+
logger$19.debug('pending_request_rejected_by_delivery_nack', {
|
|
9089
9091
|
envelope_id: envelopeId,
|
|
9090
9092
|
request_id: requestId,
|
|
9091
9093
|
code: typeof metaCode === 'string' ? metaCode : 'DELIVERY_ERROR',
|
|
@@ -9108,7 +9110,7 @@ class RPCClientManager {
|
|
|
9108
9110
|
this.trackerWithEvents.removeEventHandler?.(this.trackerEventHandler);
|
|
9109
9111
|
}
|
|
9110
9112
|
catch (error) {
|
|
9111
|
-
logger$
|
|
9113
|
+
logger$19.debug('rpc_tracker_handler_remove_failed', {
|
|
9112
9114
|
error: error instanceof Error ? error.message : String(error),
|
|
9113
9115
|
});
|
|
9114
9116
|
}
|
|
@@ -9151,7 +9153,7 @@ class RPCClientManager {
|
|
|
9151
9153
|
this.rpcListenerAddress = await this.listenCallback(recipient, handler);
|
|
9152
9154
|
this.rpcBound = true;
|
|
9153
9155
|
this.boundPhysicalPath = currentPhysicalPath;
|
|
9154
|
-
logger$
|
|
9156
|
+
logger$19.debug('rpc_reply_listener_bound', {
|
|
9155
9157
|
reply_recipient: recipient,
|
|
9156
9158
|
reply_address: this.rpcReplyAddress?.toString(),
|
|
9157
9159
|
listener_address: this.rpcListenerAddress?.toString(),
|
|
@@ -9245,7 +9247,7 @@ class RPCClientManager {
|
|
|
9245
9247
|
const finalizePromise = this.notifyStreamClosed(envelopeId);
|
|
9246
9248
|
if (finalizePromise) {
|
|
9247
9249
|
finalizePromise.catch((notifyError) => {
|
|
9248
|
-
logger$
|
|
9250
|
+
logger$19.debug('stream_tracker_finalize_failed', {
|
|
9249
9251
|
request_id: requestId,
|
|
9250
9252
|
envelope_id: envelopeId,
|
|
9251
9253
|
error: notifyError instanceof Error
|
|
@@ -9306,7 +9308,7 @@ class RPCClientManager {
|
|
|
9306
9308
|
return iterator;
|
|
9307
9309
|
}
|
|
9308
9310
|
async sendRpcRequest(requestId, envelope, expectedResponseType, timeoutMs) {
|
|
9309
|
-
logger$
|
|
9311
|
+
logger$19.debug('sending_rpc_request', {
|
|
9310
9312
|
envp_id: envelope.id,
|
|
9311
9313
|
corr_id: envelope.corrId,
|
|
9312
9314
|
request_id: requestId,
|
|
@@ -9322,7 +9324,7 @@ class RPCClientManager {
|
|
|
9322
9324
|
}
|
|
9323
9325
|
}
|
|
9324
9326
|
catch (error) {
|
|
9325
|
-
logger$
|
|
9327
|
+
logger$19.warning('delivery_tracker_track_failed', {
|
|
9326
9328
|
request_id: requestId,
|
|
9327
9329
|
error: error instanceof Error ? error.message : String(error),
|
|
9328
9330
|
});
|
|
@@ -9335,14 +9337,14 @@ class RPCClientManager {
|
|
|
9335
9337
|
await this.deliverWrapper()(envelope, context);
|
|
9336
9338
|
}
|
|
9337
9339
|
async handleReplyEnvelope(envelope) {
|
|
9338
|
-
logger$
|
|
9340
|
+
logger$19.debug('handle_reply_envelope_received', {
|
|
9339
9341
|
envelope_id: envelope.id,
|
|
9340
9342
|
corr_id: envelope.corrId,
|
|
9341
9343
|
frame_type: envelope.frame?.['type'],
|
|
9342
9344
|
});
|
|
9343
9345
|
let requestId = envelope.corrId ?? envelope.id;
|
|
9344
9346
|
if (!requestId) {
|
|
9345
|
-
logger$
|
|
9347
|
+
logger$19.warning('reply_envelope_missing_corr_id', {
|
|
9346
9348
|
envelope_id: envelope.id,
|
|
9347
9349
|
});
|
|
9348
9350
|
return;
|
|
@@ -9360,12 +9362,12 @@ class RPCClientManager {
|
|
|
9360
9362
|
}
|
|
9361
9363
|
}
|
|
9362
9364
|
if (!entry) {
|
|
9363
|
-
logger$
|
|
9365
|
+
logger$19.debug('no_pending_request_for_reply', {
|
|
9364
9366
|
request_id: requestId,
|
|
9365
9367
|
});
|
|
9366
9368
|
return;
|
|
9367
9369
|
}
|
|
9368
|
-
logger$
|
|
9370
|
+
logger$19.debug('handle_reply_envelope', {
|
|
9369
9371
|
envelope_id: envelope.id,
|
|
9370
9372
|
request_id: requestId,
|
|
9371
9373
|
corr_id: envelope.corrId,
|
|
@@ -9378,7 +9380,7 @@ class RPCClientManager {
|
|
|
9378
9380
|
const ackIndicatesSuccess = frame.ok === true ||
|
|
9379
9381
|
(frame.ok === undefined && !frame.code && !frame.reason);
|
|
9380
9382
|
if (ackIndicatesSuccess) {
|
|
9381
|
-
logger$
|
|
9383
|
+
logger$19.debug('pending_request_delivery_acknowledged', {
|
|
9382
9384
|
request_id: requestId,
|
|
9383
9385
|
envelope_id: envelope.id,
|
|
9384
9386
|
ref_id: frame.refId ?? null,
|
|
@@ -9406,7 +9408,7 @@ class RPCClientManager {
|
|
|
9406
9408
|
entry.timer = null;
|
|
9407
9409
|
}
|
|
9408
9410
|
if (!this.isDataFrame(envelope.frame)) {
|
|
9409
|
-
logger$
|
|
9411
|
+
logger$19.warning('unexpected_reply_frame_type', {
|
|
9410
9412
|
request_id: requestId,
|
|
9411
9413
|
frame_type: envelope.frame?.['type'],
|
|
9412
9414
|
});
|
|
@@ -9472,7 +9474,7 @@ class RPCClientManager {
|
|
|
9472
9474
|
return;
|
|
9473
9475
|
}
|
|
9474
9476
|
Promise.resolve(this.deliveryTracker.onStreamItem(envelopeId, envelope)).catch((error) => {
|
|
9475
|
-
logger$
|
|
9477
|
+
logger$19.debug('stream_tracker_push_failed', {
|
|
9476
9478
|
envelope_id: envelopeId,
|
|
9477
9479
|
error: error instanceof Error ? error.message : String(error),
|
|
9478
9480
|
});
|
|
@@ -9587,7 +9589,7 @@ function normalizeMailbox(mailbox) {
|
|
|
9587
9589
|
return mailbox;
|
|
9588
9590
|
}
|
|
9589
9591
|
|
|
9590
|
-
const logger$
|
|
9592
|
+
const logger$18 = getLogger('naylence.fame.node.envelope_listener_manager');
|
|
9591
9593
|
const SYSTEM_INBOX$2 = '__sys__';
|
|
9592
9594
|
class EnvelopeListener {
|
|
9593
9595
|
constructor(stopFn, task) {
|
|
@@ -9595,7 +9597,7 @@ class EnvelopeListener {
|
|
|
9595
9597
|
this.task = task;
|
|
9596
9598
|
}
|
|
9597
9599
|
stop() {
|
|
9598
|
-
logger$
|
|
9600
|
+
logger$18.debug('stopping_listener', {
|
|
9599
9601
|
task_name: this.task.name,
|
|
9600
9602
|
});
|
|
9601
9603
|
try {
|
|
@@ -9603,7 +9605,7 @@ class EnvelopeListener {
|
|
|
9603
9605
|
if (maybeCleanup &&
|
|
9604
9606
|
typeof maybeCleanup.then === 'function') {
|
|
9605
9607
|
void maybeCleanup.catch((error) => {
|
|
9606
|
-
logger$
|
|
9608
|
+
logger$18.debug('listener_stop_cleanup_failed', {
|
|
9607
9609
|
task_name: this.task.name,
|
|
9608
9610
|
error: error instanceof Error ? error.message : String(error),
|
|
9609
9611
|
});
|
|
@@ -9611,7 +9613,7 @@ class EnvelopeListener {
|
|
|
9611
9613
|
}
|
|
9612
9614
|
}
|
|
9613
9615
|
catch (error) {
|
|
9614
|
-
logger$
|
|
9616
|
+
logger$18.debug('listener_stop_cleanup_failed', {
|
|
9615
9617
|
task_name: this.task.name,
|
|
9616
9618
|
error: error instanceof Error ? error.message : String(error),
|
|
9617
9619
|
});
|
|
@@ -9641,7 +9643,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9641
9643
|
envelope.replyTo = formatAddress(SYSTEM_INBOX$2, this.nodeLike.physicalPath);
|
|
9642
9644
|
}
|
|
9643
9645
|
catch (error) {
|
|
9644
|
-
logger$
|
|
9646
|
+
logger$18.warning('default_reply_to_assignment_failed', {
|
|
9645
9647
|
envelope_id: envelope.id,
|
|
9646
9648
|
service_name: envelope.capabilities?.[0] ?? null,
|
|
9647
9649
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -9666,7 +9668,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9666
9668
|
if (serviceName === SYSTEM_INBOX$2) {
|
|
9667
9669
|
continue;
|
|
9668
9670
|
}
|
|
9669
|
-
logger$
|
|
9671
|
+
logger$18.debug('stopping_listener_for_service', {
|
|
9670
9672
|
service_name: serviceName,
|
|
9671
9673
|
});
|
|
9672
9674
|
entry.listener.stop();
|
|
@@ -9676,7 +9678,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9676
9678
|
catch (error) {
|
|
9677
9679
|
if (!(error instanceof Error) ||
|
|
9678
9680
|
error.name !== 'TaskCancelledError') {
|
|
9679
|
-
logger$
|
|
9681
|
+
logger$18.debug('listener_task_stopped', {
|
|
9680
9682
|
service_name: serviceName,
|
|
9681
9683
|
error: error instanceof Error ? error.message : String(error),
|
|
9682
9684
|
});
|
|
@@ -9684,7 +9686,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9684
9686
|
}
|
|
9685
9687
|
}
|
|
9686
9688
|
if (systemEntry) {
|
|
9687
|
-
logger$
|
|
9689
|
+
logger$18.debug('stopping_listener_for_service', {
|
|
9688
9690
|
service_name: SYSTEM_INBOX$2,
|
|
9689
9691
|
});
|
|
9690
9692
|
systemEntry.listener.stop();
|
|
@@ -9694,7 +9696,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9694
9696
|
catch (error) {
|
|
9695
9697
|
if (!(error instanceof Error) ||
|
|
9696
9698
|
error.name !== 'TaskCancelledError') {
|
|
9697
|
-
logger$
|
|
9699
|
+
logger$18.debug('listener_task_stopped', {
|
|
9698
9700
|
service_name: SYSTEM_INBOX$2,
|
|
9699
9701
|
error: error instanceof Error ? error.message : String(error),
|
|
9700
9702
|
});
|
|
@@ -9711,13 +9713,13 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9711
9713
|
}
|
|
9712
9714
|
async recoverUnhandledInboundEnvelopes() {
|
|
9713
9715
|
if (typeof this.deliveryTracker.listInbound !== 'function') {
|
|
9714
|
-
logger$
|
|
9716
|
+
logger$18.debug('delivery_tracker_missing_inbound_listing');
|
|
9715
9717
|
return;
|
|
9716
9718
|
}
|
|
9717
9719
|
const failedInbound = await this.deliveryTracker.listInbound((env) => env.status === EnvelopeStatus.RECEIVED ||
|
|
9718
9720
|
env.status === EnvelopeStatus.FAILED_TO_HANDLE);
|
|
9719
9721
|
if (!failedInbound.length) {
|
|
9720
|
-
logger$
|
|
9722
|
+
logger$18.debug('no_failed_inbound_envelopes_to_recover');
|
|
9721
9723
|
return;
|
|
9722
9724
|
}
|
|
9723
9725
|
const grouped = new Map();
|
|
@@ -9734,7 +9736,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9734
9736
|
this.pendingRecoveryEnvelopes.set(serviceName, envelopes);
|
|
9735
9737
|
}
|
|
9736
9738
|
});
|
|
9737
|
-
logger$
|
|
9739
|
+
logger$18.debug('discovered_failed_inbound_envelopes', {
|
|
9738
9740
|
total: failedInbound.length,
|
|
9739
9741
|
services: Array.from(grouped.keys()),
|
|
9740
9742
|
});
|
|
@@ -9744,7 +9746,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9744
9746
|
const pollTimeoutMs = options.pollTimeoutMs ??
|
|
9745
9747
|
options.poll_timeout_ms ??
|
|
9746
9748
|
DEFAULT_POLLING_TIMEOUT_MS;
|
|
9747
|
-
logger$
|
|
9749
|
+
logger$18.debug('listen_start', {
|
|
9748
9750
|
recipient: serviceName,
|
|
9749
9751
|
poll_timeout_ms: pollTimeoutMs ?? DEFAULT_POLLING_TIMEOUT_MS,
|
|
9750
9752
|
});
|
|
@@ -9775,7 +9777,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9775
9777
|
tracked?.mailboxType === MailboxType.OUTBOX ||
|
|
9776
9778
|
envelope.frame?.['type'] === 'DeliveryAck';
|
|
9777
9779
|
if (!shouldInvoke) {
|
|
9778
|
-
logger$
|
|
9780
|
+
logger$18.debug('skipping_listener_handler', {
|
|
9779
9781
|
recipient: serviceName,
|
|
9780
9782
|
envelope_id: envelope.id,
|
|
9781
9783
|
tracked_status: tracked?.status,
|
|
@@ -9789,13 +9791,13 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9789
9791
|
? undefined
|
|
9790
9792
|
: (tracked ?? undefined);
|
|
9791
9793
|
if (trackedForHandler && trackedForHandler.attempt > 0) {
|
|
9792
|
-
logger$
|
|
9794
|
+
logger$18.info('resuming_handler_retry_after_restart', {
|
|
9793
9795
|
envelope_id: envelope.id,
|
|
9794
9796
|
current_attempts: trackedForHandler.attempt,
|
|
9795
9797
|
service_name: serviceName,
|
|
9796
9798
|
});
|
|
9797
9799
|
}
|
|
9798
|
-
logger$
|
|
9800
|
+
logger$18.debug('forwarding_to_listener_handler', {
|
|
9799
9801
|
recipient: serviceName,
|
|
9800
9802
|
envelope_id: envelope.id,
|
|
9801
9803
|
frame_type: envelope.frame?.['type'],
|
|
@@ -9814,7 +9816,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9814
9816
|
await channel.send(null);
|
|
9815
9817
|
}
|
|
9816
9818
|
catch (error) {
|
|
9817
|
-
logger$
|
|
9819
|
+
logger$18.debug('listener_stop_signal_failed', {
|
|
9818
9820
|
service_name: serviceName,
|
|
9819
9821
|
error: error instanceof Error ? error.message : String(error),
|
|
9820
9822
|
});
|
|
@@ -9823,7 +9825,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9823
9825
|
await this.listenersLock.runExclusive(async () => {
|
|
9824
9826
|
const existing = this.listeners.get(serviceName);
|
|
9825
9827
|
if (existing) {
|
|
9826
|
-
logger$
|
|
9828
|
+
logger$18.debug('replacing_envelope_listener', { recipient: serviceName });
|
|
9827
9829
|
existing.listener.stop();
|
|
9828
9830
|
try {
|
|
9829
9831
|
await existing.listener.task.promise;
|
|
@@ -9841,13 +9843,13 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9841
9843
|
return binding.address;
|
|
9842
9844
|
}
|
|
9843
9845
|
async listenRpc(serviceName, handler, options = {}) {
|
|
9844
|
-
logger$
|
|
9846
|
+
logger$18.debug('rpc_listen_start', { service_name: serviceName });
|
|
9845
9847
|
const rpcHandler = async (envelope, context) => {
|
|
9846
9848
|
const result = await this.rpcServerHandler.handleRpcRequest(envelope, context, handler, serviceName);
|
|
9847
9849
|
return result ?? null;
|
|
9848
9850
|
};
|
|
9849
9851
|
const address = await this.listen(serviceName, rpcHandler, options);
|
|
9850
|
-
logger$
|
|
9852
|
+
logger$18.debug('rpc_listen_bound', {
|
|
9851
9853
|
service_name: serviceName,
|
|
9852
9854
|
address: address.toString(),
|
|
9853
9855
|
});
|
|
@@ -9916,12 +9918,12 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9916
9918
|
return cached;
|
|
9917
9919
|
});
|
|
9918
9920
|
if (!envelopes.length) {
|
|
9919
|
-
logger$
|
|
9921
|
+
logger$18.debug('no_cached_recovery_for_service', {
|
|
9920
9922
|
service_name: serviceName,
|
|
9921
9923
|
});
|
|
9922
9924
|
return;
|
|
9923
9925
|
}
|
|
9924
|
-
logger$
|
|
9926
|
+
logger$18.debug('recovering_unhandled_envelopes_on_listen', {
|
|
9925
9927
|
service_name: serviceName,
|
|
9926
9928
|
count: envelopes.length,
|
|
9927
9929
|
envelope_ids: envelopes.map((trackedEnvelope) => trackedEnvelope.envelopeId),
|
|
@@ -9932,7 +9934,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9932
9934
|
async recoverServiceEnvelopes(serviceName, envelopes, handler) {
|
|
9933
9935
|
for (const tracked of envelopes) {
|
|
9934
9936
|
try {
|
|
9935
|
-
logger$
|
|
9937
|
+
logger$18.warning('recovering_unhandled_envelope', {
|
|
9936
9938
|
envelope_id: tracked.envelopeId,
|
|
9937
9939
|
service_name: serviceName,
|
|
9938
9940
|
current_attempts: tracked.attempt,
|
|
@@ -9941,13 +9943,13 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9941
9943
|
const originalEnvelope = tracked.originalEnvelope;
|
|
9942
9944
|
const receiverPolicy = this.nodeLike.deliveryPolicy?.receiverRetryPolicy ?? undefined;
|
|
9943
9945
|
await this.executeHandlerWithRetries(handler, originalEnvelope, undefined, receiverPolicy, tracked, serviceName);
|
|
9944
|
-
logger$
|
|
9946
|
+
logger$18.debug('envelope_recovery_completed', {
|
|
9945
9947
|
envelope_id: tracked.envelopeId,
|
|
9946
9948
|
service_name: serviceName,
|
|
9947
9949
|
});
|
|
9948
9950
|
}
|
|
9949
9951
|
catch (error) {
|
|
9950
|
-
logger$
|
|
9952
|
+
logger$18.error('envelope_recovery_failed', {
|
|
9951
9953
|
envelope_id: tracked.envelopeId,
|
|
9952
9954
|
service_name: serviceName,
|
|
9953
9955
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -9993,7 +9995,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
9993
9995
|
await this.deliveryTracker.onEnvelopeHandled(trackedEnvelope);
|
|
9994
9996
|
}
|
|
9995
9997
|
if (currentAttempt > 0) {
|
|
9996
|
-
logger$
|
|
9998
|
+
logger$18.info('handler_retry_succeeded', {
|
|
9997
9999
|
envelope_id: envelope.id,
|
|
9998
10000
|
attempt: currentAttempt + 1,
|
|
9999
10001
|
total_attempts: currentAttempt + 1,
|
|
@@ -10009,7 +10011,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
10009
10011
|
await this.deliveryTracker.onEnvelopeHandleFailed(inboxName, trackedEnvelope, context, error instanceof Error ? error : new Error(String(error)), isFinalAttempt);
|
|
10010
10012
|
}
|
|
10011
10013
|
if (isFinalAttempt) {
|
|
10012
|
-
logger$
|
|
10014
|
+
logger$18.error('handler_execution_failed_exhausted_retries', {
|
|
10013
10015
|
envelope_id: envelope.id,
|
|
10014
10016
|
total_attempts: attemptNumber,
|
|
10015
10017
|
max_retries: retryPolicy?.maxRetries ?? 0,
|
|
@@ -10018,7 +10020,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
10018
10020
|
break;
|
|
10019
10021
|
}
|
|
10020
10022
|
const delayMs = retryPolicy?.nextDelayMs(attemptNumber) ?? 0;
|
|
10021
|
-
logger$
|
|
10023
|
+
logger$18.warning('handler_execution_failed_will_retry', {
|
|
10022
10024
|
envelope_id: envelope.id,
|
|
10023
10025
|
attempt: attemptNumber,
|
|
10024
10026
|
max_retries: retryPolicy?.maxRetries ?? 0,
|
|
@@ -10048,7 +10050,7 @@ class EnvelopeListenerManager extends TaskSpawner {
|
|
|
10048
10050
|
}
|
|
10049
10051
|
}
|
|
10050
10052
|
|
|
10051
|
-
const logger$
|
|
10053
|
+
const logger$17 = getLogger('naylence.fame.delivery.default_delivery_tracker');
|
|
10052
10054
|
const STREAM_END = Symbol('stream-end');
|
|
10053
10055
|
const SWEEPER_TICK = Symbol('tracker-sweeper-tick');
|
|
10054
10056
|
function createDeferred$2() {
|
|
@@ -10280,7 +10282,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10280
10282
|
const expectedResponseType = options.expectedResponseType;
|
|
10281
10283
|
const tracked = await this.lock.runExclusive(async () => {
|
|
10282
10284
|
if (this.ackFutures.has(envelope.id)) {
|
|
10283
|
-
logger$
|
|
10285
|
+
logger$17.debug('tracker_envelope_already_tracked', {
|
|
10284
10286
|
envp_id: envelope.id,
|
|
10285
10287
|
});
|
|
10286
10288
|
return null;
|
|
@@ -10290,7 +10292,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10290
10292
|
if (expectedResponseType & FameResponseType.REPLY ||
|
|
10291
10293
|
expectedResponseType & FameResponseType.STREAM) {
|
|
10292
10294
|
if (existingEnvId && existingEnvId !== envelope.id) {
|
|
10293
|
-
logger$
|
|
10295
|
+
logger$17.debug('envelope_already_tracked_for_replies', {
|
|
10294
10296
|
envp_id: envelope.id,
|
|
10295
10297
|
corr_id: corrId,
|
|
10296
10298
|
expected_response_type: expectedResponseType,
|
|
@@ -10339,7 +10341,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10339
10341
|
return null;
|
|
10340
10342
|
}
|
|
10341
10343
|
await this.scheduleTimer(tracked, options.retryPolicy ?? null, options.retryHandler ?? null);
|
|
10342
|
-
logger$
|
|
10344
|
+
logger$17.debug('tracker_registered_envelope', {
|
|
10343
10345
|
envp_id: envelope.id,
|
|
10344
10346
|
corr_id: tracked.originalEnvelope.corrId,
|
|
10345
10347
|
expected_response: tracked.expectedResponseType,
|
|
@@ -10363,21 +10365,21 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10363
10365
|
return this.awaitEnvelopeFuture(envelopeId, FameResponseType.REPLY | FameResponseType.STREAM, future, timeoutMs);
|
|
10364
10366
|
}
|
|
10365
10367
|
async onEnvelopeDelivered(inboxName, envelope, context) {
|
|
10366
|
-
logger$
|
|
10368
|
+
logger$17.debug('envelope_delivered', {
|
|
10367
10369
|
envp_id: envelope.id,
|
|
10368
10370
|
corr_id: envelope.corrId,
|
|
10369
10371
|
rtype: envelope.rtype ?? FameResponseType.NONE,
|
|
10370
10372
|
frame_type: envelope.frame?.type ?? 'unknown',
|
|
10371
10373
|
});
|
|
10372
10374
|
if (!envelope.corrId) {
|
|
10373
|
-
logger$
|
|
10375
|
+
logger$17.debug('envelope_delivered_no_corr_id', {
|
|
10374
10376
|
envelope_id: envelope.id,
|
|
10375
10377
|
});
|
|
10376
10378
|
return null;
|
|
10377
10379
|
}
|
|
10378
10380
|
if (this.isDeliveryAckFrame(envelope.frame)) {
|
|
10379
10381
|
if (!envelope.frame.refId) {
|
|
10380
|
-
logger$
|
|
10382
|
+
logger$17.debug('envelope_delivered_no_ref_id', {
|
|
10381
10383
|
envelope_id: envelope.id,
|
|
10382
10384
|
});
|
|
10383
10385
|
return null;
|
|
@@ -10415,7 +10417,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10415
10417
|
await inbox.set(envelope.id, tracked);
|
|
10416
10418
|
}
|
|
10417
10419
|
else {
|
|
10418
|
-
logger$
|
|
10420
|
+
logger$17.debug('tracker_duplicate_envelope_already_handled', {
|
|
10419
10421
|
envp_id: envelope.id,
|
|
10420
10422
|
status: tracked.status,
|
|
10421
10423
|
});
|
|
@@ -10458,7 +10460,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10458
10460
|
}
|
|
10459
10461
|
if (isFinalFailure) {
|
|
10460
10462
|
envelope.status = EnvelopeStatus.FAILED_TO_HANDLE;
|
|
10461
|
-
logger$
|
|
10463
|
+
logger$17.error('envelope_handle_failed_final', {
|
|
10462
10464
|
inbox_name: inboxName,
|
|
10463
10465
|
envp_id: envelope.originalEnvelope.id,
|
|
10464
10466
|
error: error?.message ?? 'unknown',
|
|
@@ -10469,7 +10471,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10469
10471
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
10470
10472
|
return;
|
|
10471
10473
|
}
|
|
10472
|
-
logger$
|
|
10474
|
+
logger$17.warning('envelope_handle_failed_retry', {
|
|
10473
10475
|
inbox_name: inboxName,
|
|
10474
10476
|
envp_id: envelope.originalEnvelope.id,
|
|
10475
10477
|
error: error?.message ?? 'unknown',
|
|
@@ -10515,14 +10517,14 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10515
10517
|
if (handledViaFuture) {
|
|
10516
10518
|
await this.markDoneSince(this.ackFutures, refId, this.ackDoneSince);
|
|
10517
10519
|
await this.clearTimer(refId);
|
|
10518
|
-
logger$
|
|
10520
|
+
logger$17.debug('tracker_ack_resolved_without_tracked_envelope', {
|
|
10519
10521
|
envp_id: envelope.id,
|
|
10520
10522
|
ref_id: refId,
|
|
10521
10523
|
corr_id: envelope.corrId,
|
|
10522
10524
|
});
|
|
10523
10525
|
return;
|
|
10524
10526
|
}
|
|
10525
|
-
logger$
|
|
10527
|
+
logger$17.debug('tracker_ack_for_unknown_envelope', {
|
|
10526
10528
|
envp_id: envelope.id,
|
|
10527
10529
|
ref_id: refId,
|
|
10528
10530
|
corr_id: envelope.corrId,
|
|
@@ -10530,7 +10532,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10530
10532
|
return;
|
|
10531
10533
|
}
|
|
10532
10534
|
if (tracked.originalEnvelope.corrId !== envelope.corrId) {
|
|
10533
|
-
logger$
|
|
10535
|
+
logger$17.debug('tracker_ack_corr_id_mismatch', {
|
|
10534
10536
|
envp_id: envelope.id,
|
|
10535
10537
|
expected_corr_id: tracked.originalEnvelope.corrId,
|
|
10536
10538
|
actual_corr_id: envelope.corrId,
|
|
@@ -10555,7 +10557,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10555
10557
|
for (const handler of this.eventHandlers) {
|
|
10556
10558
|
await handler.onEnvelopeAcked?.(tracked);
|
|
10557
10559
|
}
|
|
10558
|
-
logger$
|
|
10560
|
+
logger$17.debug('tracker_envelope_acked', {
|
|
10559
10561
|
envp_id: tracked.originalEnvelope.id,
|
|
10560
10562
|
});
|
|
10561
10563
|
}
|
|
@@ -10573,13 +10575,13 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10573
10575
|
const outbox = this.ensureOutbox();
|
|
10574
10576
|
const tracked = await outbox.get(envelope.frame.refId);
|
|
10575
10577
|
if (!tracked) {
|
|
10576
|
-
logger$
|
|
10578
|
+
logger$17.debug('tracker_nack_for_unknown_envelope', {
|
|
10577
10579
|
envp_id: envelope.id,
|
|
10578
10580
|
});
|
|
10579
10581
|
return;
|
|
10580
10582
|
}
|
|
10581
10583
|
if (tracked.originalEnvelope.corrId !== envelope.corrId) {
|
|
10582
|
-
logger$
|
|
10584
|
+
logger$17.debug('tracker_nack_corr_id_mismatch', {
|
|
10583
10585
|
envp_id: envelope.id,
|
|
10584
10586
|
expected_corr_id: tracked.originalEnvelope.corrId,
|
|
10585
10587
|
actual_corr_id: envelope.corrId,
|
|
@@ -10621,7 +10623,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10621
10623
|
for (const handler of this.eventHandlers) {
|
|
10622
10624
|
await handler.onEnvelopeNacked?.(tracked, ackFrame.reason ?? null);
|
|
10623
10625
|
}
|
|
10624
|
-
logger$
|
|
10626
|
+
logger$17.debug('tracker_envelope_nacked', {
|
|
10625
10627
|
envp_id: tracked.originalEnvelope.id,
|
|
10626
10628
|
reason: ackFrame.reason,
|
|
10627
10629
|
});
|
|
@@ -10669,7 +10671,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10669
10671
|
for (const handler of this.eventHandlers) {
|
|
10670
10672
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
10671
10673
|
}
|
|
10672
|
-
logger$
|
|
10674
|
+
logger$17.debug('tracked_envelope_replied', {
|
|
10673
10675
|
envp_id: trackedEnvelope.originalEnvelope.id,
|
|
10674
10676
|
corr_id: envelope.corrId,
|
|
10675
10677
|
});
|
|
@@ -10743,7 +10745,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10743
10745
|
async addToInboxDlq(trackedEnvelope, reason = null) {
|
|
10744
10746
|
const dlq = this.inboxDlq;
|
|
10745
10747
|
if (!dlq) {
|
|
10746
|
-
logger$
|
|
10748
|
+
logger$17.error('dlq_not_initialized', {
|
|
10747
10749
|
envp_id: trackedEnvelope.originalEnvelope.id,
|
|
10748
10750
|
});
|
|
10749
10751
|
return;
|
|
@@ -10758,7 +10760,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10758
10760
|
const deadLetteredAt = Date.now();
|
|
10759
10761
|
setMetaWithLegacy(trackedEnvelope.meta, 'deadLetteredAtMs', 'dead_lettered_at_ms', deadLetteredAt);
|
|
10760
10762
|
await dlq.set(trackedEnvelope.originalEnvelope.id, trackedEnvelope);
|
|
10761
|
-
logger$
|
|
10763
|
+
logger$17.warning('envelope_moved_to_dlq', {
|
|
10762
10764
|
envp_id: trackedEnvelope.originalEnvelope.id,
|
|
10763
10765
|
service_name: trackedEnvelope.serviceName,
|
|
10764
10766
|
});
|
|
@@ -10787,7 +10789,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10787
10789
|
const toDelete = Object.entries(items).filter(([, value]) => predicate ? predicate(value) : true);
|
|
10788
10790
|
await Promise.all(toDelete.map(([key]) => dlq.delete(key)));
|
|
10789
10791
|
if (toDelete.length) {
|
|
10790
|
-
logger$
|
|
10792
|
+
logger$17.debug('dlq_purged', { count: toDelete.length });
|
|
10791
10793
|
}
|
|
10792
10794
|
return toDelete.length;
|
|
10793
10795
|
}
|
|
@@ -10840,11 +10842,11 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10840
10842
|
}
|
|
10841
10843
|
this.futuresSweeper = null;
|
|
10842
10844
|
}
|
|
10843
|
-
logger$
|
|
10845
|
+
logger$17.debug('tracker_cleanup_completed');
|
|
10844
10846
|
}
|
|
10845
10847
|
async recoverPending() {
|
|
10846
10848
|
const pending = await this.listPending();
|
|
10847
|
-
logger$
|
|
10849
|
+
logger$17.debug('tracker_recovering_pending', { count: pending.length });
|
|
10848
10850
|
await this.lock.runExclusive(async () => {
|
|
10849
10851
|
for (const tracked of pending) {
|
|
10850
10852
|
if (tracked.expectedResponseType & FameResponseType.ACK) {
|
|
@@ -10870,7 +10872,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10870
10872
|
for (const tracked of pending) {
|
|
10871
10873
|
await this.scheduleTimer(tracked, null, null);
|
|
10872
10874
|
}
|
|
10873
|
-
logger$
|
|
10875
|
+
logger$17.debug('tracker_recovery_completed', { count: pending.length });
|
|
10874
10876
|
}
|
|
10875
10877
|
ensureOutbox() {
|
|
10876
10878
|
if (!this.outbox) {
|
|
@@ -10885,7 +10887,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10885
10887
|
return this.inbox;
|
|
10886
10888
|
}
|
|
10887
10889
|
async waitForPendingAcks() {
|
|
10888
|
-
logger$
|
|
10890
|
+
logger$17.debug('tracker_node_preparing_to_stop_waiting_for_pending_acks');
|
|
10889
10891
|
const outbox = this.outbox;
|
|
10890
10892
|
if (!outbox) {
|
|
10891
10893
|
return;
|
|
@@ -10897,7 +10899,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10897
10899
|
continue;
|
|
10898
10900
|
}
|
|
10899
10901
|
if (!future.done) {
|
|
10900
|
-
logger$
|
|
10902
|
+
logger$17.debug('tracker_pending_ack_future_detected', {
|
|
10901
10903
|
envelope_id: envelopeId,
|
|
10902
10904
|
});
|
|
10903
10905
|
pending.push({ envelopeId, future });
|
|
@@ -10905,10 +10907,10 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10905
10907
|
}
|
|
10906
10908
|
});
|
|
10907
10909
|
if (!pending.length) {
|
|
10908
|
-
logger$
|
|
10910
|
+
logger$17.debug('tracker_no_pending_acks_to_wait_for');
|
|
10909
10911
|
return;
|
|
10910
10912
|
}
|
|
10911
|
-
logger$
|
|
10913
|
+
logger$17.debug('tracker_waiting_for_pending_acks', { count: pending.length });
|
|
10912
10914
|
for (const entry of pending) {
|
|
10913
10915
|
if (!entry) {
|
|
10914
10916
|
continue;
|
|
@@ -10925,19 +10927,19 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10925
10927
|
}
|
|
10926
10928
|
try {
|
|
10927
10929
|
await this.awaitWithTimeout(entry.future.promise, remainingMs);
|
|
10928
|
-
logger$
|
|
10930
|
+
logger$17.debug('tracker_received_ack', {
|
|
10929
10931
|
envelope_id: entry.envelopeId,
|
|
10930
10932
|
});
|
|
10931
10933
|
await outbox.delete(entry.envelopeId);
|
|
10932
10934
|
}
|
|
10933
10935
|
catch (error) {
|
|
10934
10936
|
if (error instanceof Error && error.name === 'TimeoutError') {
|
|
10935
|
-
logger$
|
|
10937
|
+
logger$17.debug('tracker_ack_timeout_expired', {
|
|
10936
10938
|
envelope_id: entry.envelopeId,
|
|
10937
10939
|
});
|
|
10938
10940
|
}
|
|
10939
10941
|
else {
|
|
10940
|
-
logger$
|
|
10942
|
+
logger$17.debug('tracker_ack_wait_error', {
|
|
10941
10943
|
envelope_id: entry.envelopeId,
|
|
10942
10944
|
error: error instanceof Error ? error.message : String(error),
|
|
10943
10945
|
});
|
|
@@ -10945,13 +10947,13 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10945
10947
|
}
|
|
10946
10948
|
}
|
|
10947
10949
|
catch (error) {
|
|
10948
|
-
logger$
|
|
10950
|
+
logger$17.error('tracker_error_waiting_for_ack', {
|
|
10949
10951
|
envelope_id: entry.envelopeId,
|
|
10950
10952
|
error: error instanceof Error ? error.message : String(error),
|
|
10951
10953
|
});
|
|
10952
10954
|
}
|
|
10953
10955
|
}
|
|
10954
|
-
logger$
|
|
10956
|
+
logger$17.debug('tracker_finished_waiting_for_pending_acks');
|
|
10955
10957
|
}
|
|
10956
10958
|
async waitForPendingAckDispatches() {
|
|
10957
10959
|
while (this.pendingAckDispatches.size > 0) {
|
|
@@ -11009,7 +11011,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11009
11011
|
for (const handler of this.eventHandlers) {
|
|
11010
11012
|
await handler.onEnvelopeTimeout?.(currentTracked);
|
|
11011
11013
|
}
|
|
11012
|
-
logger$
|
|
11014
|
+
logger$17.debug('tracker_envelope_timed_out', {
|
|
11013
11015
|
envp_id: tracked.originalEnvelope.id,
|
|
11014
11016
|
});
|
|
11015
11017
|
return;
|
|
@@ -11022,7 +11024,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11022
11024
|
currentTracked.timeoutAtMs = nextTimeoutAt;
|
|
11023
11025
|
await outbox.set(tracked.originalEnvelope.id, currentTracked);
|
|
11024
11026
|
await this.scheduleTimer(currentTracked, retryPolicy, retryHandler);
|
|
11025
|
-
logger$
|
|
11027
|
+
logger$17.debug('tracker_retry_deferred_during_shutdown', {
|
|
11026
11028
|
envp_id: tracked.originalEnvelope.id,
|
|
11027
11029
|
defer_ms: shutdownDeferMs,
|
|
11028
11030
|
});
|
|
@@ -11045,7 +11047,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11045
11047
|
});
|
|
11046
11048
|
}
|
|
11047
11049
|
await this.scheduleTimer(currentTracked, retryPolicy, retryHandler);
|
|
11048
|
-
logger$
|
|
11050
|
+
logger$17.debug('envelope_delivery_retry_scheduled', {
|
|
11049
11051
|
envp_id: tracked.originalEnvelope.id,
|
|
11050
11052
|
attempt: currentTracked.attempt,
|
|
11051
11053
|
max_retries: retryPolicy.maxRetries,
|
|
@@ -11057,7 +11059,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11057
11059
|
currentTracked.timeoutAtMs = currentTracked.overallTimeoutAtMs;
|
|
11058
11060
|
await outbox.set(tracked.originalEnvelope.id, currentTracked);
|
|
11059
11061
|
await this.scheduleTimer(currentTracked, retryPolicy, retryHandler);
|
|
11060
|
-
logger$
|
|
11062
|
+
logger$17.debug('envelope_retries_exhausted_waiting_until_overall_timeout', {
|
|
11061
11063
|
envp_id: tracked.originalEnvelope.id,
|
|
11062
11064
|
attempt: currentTracked.attempt,
|
|
11063
11065
|
overall_timeout_at_ms: currentTracked.overallTimeoutAtMs,
|
|
@@ -11077,7 +11079,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11077
11079
|
for (const handler of this.eventHandlers) {
|
|
11078
11080
|
await handler.onEnvelopeTimeout?.(currentTracked);
|
|
11079
11081
|
}
|
|
11080
|
-
logger$
|
|
11082
|
+
logger$17.debug('tracker_envelope_timed_out', {
|
|
11081
11083
|
envp_id: tracked.originalEnvelope.id,
|
|
11082
11084
|
});
|
|
11083
11085
|
}
|
|
@@ -11085,7 +11087,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11085
11087
|
if (error instanceof TaskCancelledError) {
|
|
11086
11088
|
return;
|
|
11087
11089
|
}
|
|
11088
|
-
logger$
|
|
11090
|
+
logger$17.error('tracker_timer_error', {
|
|
11089
11091
|
envp_id: tracked.originalEnvelope.id,
|
|
11090
11092
|
error: error instanceof Error ? error.message : String(error),
|
|
11091
11093
|
});
|
|
@@ -11140,7 +11142,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11140
11142
|
if (timeoutSeconds !== null) {
|
|
11141
11143
|
return await this.awaitWithTimeout(future.promise, timeoutSeconds);
|
|
11142
11144
|
}
|
|
11143
|
-
logger$
|
|
11145
|
+
logger$17.debug('await_envelope_no_timeout_wait', {
|
|
11144
11146
|
envelope_id: envelopeId,
|
|
11145
11147
|
});
|
|
11146
11148
|
return await future.promise;
|
|
@@ -11149,7 +11151,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11149
11151
|
if (error instanceof Error && error.name !== 'TimeoutError') {
|
|
11150
11152
|
throw error;
|
|
11151
11153
|
}
|
|
11152
|
-
logger$
|
|
11154
|
+
logger$17.error('await_envelope_timeout_error', {
|
|
11153
11155
|
envelope_id: envelopeId,
|
|
11154
11156
|
timeout_ms: timeoutSeconds,
|
|
11155
11157
|
future_done: false,
|
|
@@ -11310,7 +11312,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11310
11312
|
this.replyDoneSince.delete(envId);
|
|
11311
11313
|
}
|
|
11312
11314
|
});
|
|
11313
|
-
logger$
|
|
11315
|
+
logger$17.debug('tracker_swept_completed_futures', {
|
|
11314
11316
|
ack_removed: toRemoveAck.length,
|
|
11315
11317
|
reply_removed: toRemoveReply.length,
|
|
11316
11318
|
grace_secs: this.futGcGraceSecs,
|
|
@@ -11324,7 +11326,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11324
11326
|
if (error instanceof Error && error.name === 'TimeoutError') {
|
|
11325
11327
|
continue;
|
|
11326
11328
|
}
|
|
11327
|
-
logger$
|
|
11329
|
+
logger$17.error('tracker_sweeper_error', {
|
|
11328
11330
|
error: error instanceof Error ? error.message : String(error),
|
|
11329
11331
|
});
|
|
11330
11332
|
}
|
|
@@ -11355,14 +11357,14 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11355
11357
|
}
|
|
11356
11358
|
const node = this.node;
|
|
11357
11359
|
if (!envelope.replyTo) {
|
|
11358
|
-
logger$
|
|
11360
|
+
logger$17.error('cannot_send_ack_no_reply_to', { envp_id: envelope.id });
|
|
11359
11361
|
return;
|
|
11360
11362
|
}
|
|
11361
11363
|
if (!envelope.corrId) {
|
|
11362
|
-
logger$
|
|
11364
|
+
logger$17.error('cannot_send_ack_no_corr_id', { envp_id: envelope.id });
|
|
11363
11365
|
return;
|
|
11364
11366
|
}
|
|
11365
|
-
logger$
|
|
11367
|
+
logger$17.debug('tracker_sending_ack', {
|
|
11366
11368
|
envp_id: envelope.id,
|
|
11367
11369
|
ref_id: envelope.id,
|
|
11368
11370
|
to: envelope.replyTo,
|
|
@@ -11382,7 +11384,7 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
11382
11384
|
.send(ackEnvelope)
|
|
11383
11385
|
.then(() => undefined)
|
|
11384
11386
|
.catch((error) => {
|
|
11385
|
-
logger$
|
|
11387
|
+
logger$17.error('tracker_ack_dispatch_failed', {
|
|
11386
11388
|
envp_id: envelope.id,
|
|
11387
11389
|
error: error instanceof Error ? error.message : String(error),
|
|
11388
11390
|
});
|
|
@@ -11468,7 +11470,7 @@ class AsyncEvent {
|
|
|
11468
11470
|
}
|
|
11469
11471
|
}
|
|
11470
11472
|
|
|
11471
|
-
const logger$
|
|
11473
|
+
const logger$16 = getLogger('naylence.fame.node.root_session_manager');
|
|
11472
11474
|
function resolveOption$1(options, primary, ...aliases) {
|
|
11473
11475
|
const record = options;
|
|
11474
11476
|
const primaryKey = primary;
|
|
@@ -11549,7 +11551,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11549
11551
|
this.onAdmissionFailed =
|
|
11550
11552
|
typeof onAdmissionFailed === 'function' ? onAdmissionFailed : undefined;
|
|
11551
11553
|
this.enableContinuousRefresh = enableContinuousRefresh ?? true;
|
|
11552
|
-
logger$
|
|
11554
|
+
logger$16.debug('created_root_session_manager');
|
|
11553
11555
|
}
|
|
11554
11556
|
get isReady() {
|
|
11555
11557
|
return this.readyEvent.isSet();
|
|
@@ -11574,7 +11576,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11574
11576
|
if (this.admissionTask) {
|
|
11575
11577
|
return;
|
|
11576
11578
|
}
|
|
11577
|
-
logger$
|
|
11579
|
+
logger$16.debug('root_session_manager_starting');
|
|
11578
11580
|
this.stopEvent.clear();
|
|
11579
11581
|
this.readyEvent.clear();
|
|
11580
11582
|
const taskName = `root-admission-${this.admissionEpoch}`;
|
|
@@ -11594,10 +11596,10 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11594
11596
|
await this.admissionTask.promise;
|
|
11595
11597
|
throw new FameConnectError('Root session manager failed to become ready');
|
|
11596
11598
|
}
|
|
11597
|
-
logger$
|
|
11599
|
+
logger$16.debug('root_session_manager_started');
|
|
11598
11600
|
}
|
|
11599
11601
|
async stop() {
|
|
11600
|
-
logger$
|
|
11602
|
+
logger$16.debug('root_session_manager_stopping');
|
|
11601
11603
|
this.stopEvent.set();
|
|
11602
11604
|
if (this.admissionTask) {
|
|
11603
11605
|
this.admissionTask.cancel();
|
|
@@ -11609,7 +11611,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11609
11611
|
await this.consumeTask(this.expiryGuardTask);
|
|
11610
11612
|
this.expiryGuardTask = null;
|
|
11611
11613
|
}
|
|
11612
|
-
logger$
|
|
11614
|
+
logger$16.debug('root_session_manager_stopped');
|
|
11613
11615
|
}
|
|
11614
11616
|
async awaitReady(timeoutMs) {
|
|
11615
11617
|
if (this.isReady) {
|
|
@@ -11650,12 +11652,12 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11650
11652
|
await this.onEpochChange(epoch);
|
|
11651
11653
|
}
|
|
11652
11654
|
else {
|
|
11653
|
-
logger$
|
|
11655
|
+
logger$16.debug('epoch_change_ignored_no_handler', { epoch });
|
|
11654
11656
|
}
|
|
11655
11657
|
}
|
|
11656
11658
|
static createForRootSentinel(node, admissionClient, requestedLogicals = [], enableContinuousRefresh = true, onEpochChange) {
|
|
11657
11659
|
const handleWelcome = async (frame) => {
|
|
11658
|
-
logger$
|
|
11660
|
+
logger$16.info('root_admission_successful', {
|
|
11659
11661
|
system_id: frame.systemId,
|
|
11660
11662
|
assigned_path: frame.assignedPath ?? null,
|
|
11661
11663
|
accepted_logicals: frame.acceptedLogicals ?? [],
|
|
@@ -11666,12 +11668,12 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11666
11668
|
? grant.purpose
|
|
11667
11669
|
: undefined;
|
|
11668
11670
|
if (purpose) {
|
|
11669
|
-
logger$
|
|
11671
|
+
logger$16.debug('received_admission_grant', { purpose });
|
|
11670
11672
|
}
|
|
11671
11673
|
}
|
|
11672
11674
|
};
|
|
11673
11675
|
const handleFailure = async (error) => {
|
|
11674
|
-
logger$
|
|
11676
|
+
logger$16.error('root_admission_failed_permanently', {
|
|
11675
11677
|
error: error.message,
|
|
11676
11678
|
});
|
|
11677
11679
|
};
|
|
@@ -11700,10 +11702,10 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11700
11702
|
this.readyEvent.set();
|
|
11701
11703
|
}
|
|
11702
11704
|
if (this.hadSuccessfulAdmission) {
|
|
11703
|
-
logger$
|
|
11705
|
+
logger$16.debug('root_admission_refreshed');
|
|
11704
11706
|
}
|
|
11705
11707
|
else {
|
|
11706
|
-
logger$
|
|
11708
|
+
logger$16.debug('root_admission_completed');
|
|
11707
11709
|
}
|
|
11708
11710
|
this.hadSuccessfulAdmission = true;
|
|
11709
11711
|
delay = RootSessionManager.BACKOFF_INITIAL;
|
|
@@ -11712,7 +11714,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11712
11714
|
await this.startExpiryGuard(welcomeFrame);
|
|
11713
11715
|
const expiryTriggered = await this.waitForExpiryOrStop();
|
|
11714
11716
|
if (expiryTriggered && !this.stopEvent.isSet()) {
|
|
11715
|
-
logger$
|
|
11717
|
+
logger$16.debug('performing_scheduled_re_admission');
|
|
11716
11718
|
continue;
|
|
11717
11719
|
}
|
|
11718
11720
|
}
|
|
@@ -11724,7 +11726,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11724
11726
|
}
|
|
11725
11727
|
const errorObject = error instanceof Error ? error : new Error(String(error));
|
|
11726
11728
|
const willRetry = attempts < RootSessionManager.RETRY_MAX_ATTEMPTS;
|
|
11727
|
-
logger$
|
|
11729
|
+
logger$16.warning('root_admission_failed', {
|
|
11728
11730
|
error: errorObject.message,
|
|
11729
11731
|
attempt: attempts,
|
|
11730
11732
|
will_retry: willRetry,
|
|
@@ -11742,7 +11744,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11742
11744
|
}
|
|
11743
11745
|
}
|
|
11744
11746
|
if (attempts >= RootSessionManager.RETRY_MAX_ATTEMPTS) {
|
|
11745
|
-
logger$
|
|
11747
|
+
logger$16.error('root_admission_max_attempts_exceeded', {
|
|
11746
11748
|
max_attempts: RootSessionManager.RETRY_MAX_ATTEMPTS,
|
|
11747
11749
|
});
|
|
11748
11750
|
}
|
|
@@ -11819,7 +11821,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11819
11821
|
}
|
|
11820
11822
|
async expiryGuard(welcomeFrame, signal) {
|
|
11821
11823
|
if (!welcomeFrame.expiresAt) {
|
|
11822
|
-
logger$
|
|
11824
|
+
logger$16.debug('no_admission_expiry_configured');
|
|
11823
11825
|
await Promise.race([this.stopEvent.wait(), this.waitForAbort(signal)]);
|
|
11824
11826
|
return;
|
|
11825
11827
|
}
|
|
@@ -11828,7 +11830,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11828
11830
|
let delaySeconds = (expiresAt.getTime() - now.getTime()) / 1000 -
|
|
11829
11831
|
RootSessionManager.JWT_REFRESH_SAFETY;
|
|
11830
11832
|
delaySeconds = Math.max(delaySeconds, 0);
|
|
11831
|
-
logger$
|
|
11833
|
+
logger$16.debug('admission_expiry_guard_started', {
|
|
11832
11834
|
welcome_expires_at: expiresAt.toISOString(),
|
|
11833
11835
|
delay_seconds: delaySeconds,
|
|
11834
11836
|
refresh_safety_seconds: RootSessionManager.JWT_REFRESH_SAFETY,
|
|
@@ -11837,7 +11839,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11837
11839
|
if (this.stopEvent.isSet() || signal?.aborted) {
|
|
11838
11840
|
return;
|
|
11839
11841
|
}
|
|
11840
|
-
logger$
|
|
11842
|
+
logger$16.debug('admission_expiry_triggered_refresh', {
|
|
11841
11843
|
expires_at: expiresAt.toISOString(),
|
|
11842
11844
|
current_time: new Date().toISOString(),
|
|
11843
11845
|
seconds_before_expiry: RootSessionManager.JWT_REFRESH_SAFETY,
|
|
@@ -11852,7 +11854,7 @@ class RootSessionManager extends TaskSpawner {
|
|
|
11852
11854
|
return;
|
|
11853
11855
|
}
|
|
11854
11856
|
const errorObject = error instanceof Error ? error : new Error(String(error));
|
|
11855
|
-
logger$
|
|
11857
|
+
logger$16.debug('background_task_error', {
|
|
11856
11858
|
task_name: task.name,
|
|
11857
11859
|
error: errorObject.message,
|
|
11858
11860
|
});
|
|
@@ -11948,7 +11950,7 @@ class BoundedAsyncQueue {
|
|
|
11948
11950
|
}
|
|
11949
11951
|
}
|
|
11950
11952
|
|
|
11951
|
-
const logger$
|
|
11953
|
+
const logger$15 = getLogger('naylence.fame.connector.broadcast_channel_connector');
|
|
11952
11954
|
const BROADCAST_CHANNEL_CONNECTOR_TYPE$1 = 'broadcast-channel-connector';
|
|
11953
11955
|
const DEFAULT_CHANNEL$7 = 'naylence-fabric';
|
|
11954
11956
|
const DEFAULT_INBOX_CAPACITY$7 = 2048;
|
|
@@ -12037,7 +12039,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12037
12039
|
this.localNodeId = normalizedLocalNodeId;
|
|
12038
12040
|
this.targetNodeId = BroadcastChannelConnector.normalizeTargetNodeId(config.initialTargetNodeId);
|
|
12039
12041
|
this.channel = new BroadcastChannel(this.channelName);
|
|
12040
|
-
logger$
|
|
12042
|
+
logger$15.debug('broadcast_channel_connector_created', {
|
|
12041
12043
|
channel: this.channelName,
|
|
12042
12044
|
connector_id: this.connectorId,
|
|
12043
12045
|
local_node_id: this.localNodeId,
|
|
@@ -12049,7 +12051,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12049
12051
|
this.onMsg = (event) => {
|
|
12050
12052
|
// Guard: Don't process if listener was unregistered
|
|
12051
12053
|
if (!this.listenerRegistered) {
|
|
12052
|
-
logger$
|
|
12054
|
+
logger$15.warning('broadcast_channel_message_after_unregister', {
|
|
12053
12055
|
channel: this.channelName,
|
|
12054
12056
|
connector_id: this.connectorId,
|
|
12055
12057
|
timestamp: new Date().toISOString(),
|
|
@@ -12057,7 +12059,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12057
12059
|
return;
|
|
12058
12060
|
}
|
|
12059
12061
|
const message = event.data;
|
|
12060
|
-
logger$
|
|
12062
|
+
logger$15.debug('broadcast_channel_raw_event', {
|
|
12061
12063
|
channel: this.channelName,
|
|
12062
12064
|
connector_id: this.connectorId,
|
|
12063
12065
|
message_type: message && typeof message === 'object'
|
|
@@ -12073,7 +12075,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12073
12075
|
const busMessage = message;
|
|
12074
12076
|
const senderNodeId = BroadcastChannelConnector.normalizeNodeId(busMessage.senderNodeId);
|
|
12075
12077
|
if (!senderNodeId) {
|
|
12076
|
-
logger$
|
|
12078
|
+
logger$15.debug('broadcast_channel_message_rejected', {
|
|
12077
12079
|
channel: this.channelName,
|
|
12078
12080
|
connector_id: this.connectorId,
|
|
12079
12081
|
reason: 'missing_sender_node_id',
|
|
@@ -12081,7 +12083,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12081
12083
|
return;
|
|
12082
12084
|
}
|
|
12083
12085
|
if (senderNodeId === this.localNodeId) {
|
|
12084
|
-
logger$
|
|
12086
|
+
logger$15.debug('broadcast_channel_message_rejected', {
|
|
12085
12087
|
channel: this.channelName,
|
|
12086
12088
|
connector_id: this.connectorId,
|
|
12087
12089
|
reason: 'self_echo',
|
|
@@ -12095,14 +12097,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12095
12097
|
}
|
|
12096
12098
|
const payload = BroadcastChannelConnector.coercePayload(busMessage.payload);
|
|
12097
12099
|
if (!payload) {
|
|
12098
|
-
logger$
|
|
12100
|
+
logger$15.debug('broadcast_channel_payload_rejected', {
|
|
12099
12101
|
channel: this.channelName,
|
|
12100
12102
|
connector_id: this.connectorId,
|
|
12101
12103
|
reason: 'unrecognized_payload_type',
|
|
12102
12104
|
});
|
|
12103
12105
|
return;
|
|
12104
12106
|
}
|
|
12105
|
-
logger$
|
|
12107
|
+
logger$15.debug('broadcast_channel_message_received', {
|
|
12106
12108
|
channel: this.channelName,
|
|
12107
12109
|
sender_id: message?.senderId,
|
|
12108
12110
|
sender_node_id: senderNodeId,
|
|
@@ -12131,14 +12133,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12131
12133
|
}
|
|
12132
12134
|
catch (error) {
|
|
12133
12135
|
if (error instanceof QueueFullError) {
|
|
12134
|
-
logger$
|
|
12136
|
+
logger$15.warning('broadcast_channel_receive_queue_full', {
|
|
12135
12137
|
channel: this.channelName,
|
|
12136
12138
|
inbox_capacity: this.inboxCapacity,
|
|
12137
12139
|
inbox_remaining_capacity: this.inbox.remainingCapacity,
|
|
12138
12140
|
});
|
|
12139
12141
|
}
|
|
12140
12142
|
else {
|
|
12141
|
-
logger$
|
|
12143
|
+
logger$15.error('broadcast_channel_receive_error', {
|
|
12142
12144
|
channel: this.channelName,
|
|
12143
12145
|
error: error instanceof Error ? error.message : String(error),
|
|
12144
12146
|
});
|
|
@@ -12152,7 +12154,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12152
12154
|
// Setup visibility change monitoring
|
|
12153
12155
|
this.visibilityChangeHandler = () => {
|
|
12154
12156
|
const isHidden = document.hidden;
|
|
12155
|
-
logger$
|
|
12157
|
+
logger$15.debug('broadcast_channel_visibility_changed', {
|
|
12156
12158
|
channel: this.channelName,
|
|
12157
12159
|
connector_id: this.connectorId,
|
|
12158
12160
|
visibility: isHidden ? 'hidden' : 'visible',
|
|
@@ -12161,7 +12163,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12161
12163
|
// Pause/resume connector based on visibility
|
|
12162
12164
|
if (isHidden && this.state === ConnectorState.STARTED) {
|
|
12163
12165
|
this.pause().catch((err) => {
|
|
12164
|
-
logger$
|
|
12166
|
+
logger$15.warning('broadcast_channel_pause_failed', {
|
|
12165
12167
|
channel: this.channelName,
|
|
12166
12168
|
connector_id: this.connectorId,
|
|
12167
12169
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -12170,7 +12172,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12170
12172
|
}
|
|
12171
12173
|
else if (!isHidden && this.state === ConnectorState.PAUSED) {
|
|
12172
12174
|
this.resume().catch((err) => {
|
|
12173
|
-
logger$
|
|
12175
|
+
logger$15.warning('broadcast_channel_resume_failed', {
|
|
12174
12176
|
channel: this.channelName,
|
|
12175
12177
|
connector_id: this.connectorId,
|
|
12176
12178
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -12184,7 +12186,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12184
12186
|
// Track page lifecycle events to detect browser unload/discard
|
|
12185
12187
|
if (typeof window !== 'undefined') {
|
|
12186
12188
|
const lifecycleLogger = (event) => {
|
|
12187
|
-
logger$
|
|
12189
|
+
logger$15.debug('broadcast_channel_page_lifecycle', {
|
|
12188
12190
|
channel: this.channelName,
|
|
12189
12191
|
connector_id: this.connectorId,
|
|
12190
12192
|
event_type: event.type,
|
|
@@ -12200,7 +12202,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12200
12202
|
document.addEventListener('resume', lifecycleLogger);
|
|
12201
12203
|
}
|
|
12202
12204
|
// Log initial state with detailed visibility info
|
|
12203
|
-
logger$
|
|
12205
|
+
logger$15.debug('broadcast_channel_initial_visibility', {
|
|
12204
12206
|
channel: this.channelName,
|
|
12205
12207
|
connector_id: this.connectorId,
|
|
12206
12208
|
visibility: document.hidden ? 'hidden' : 'visible',
|
|
@@ -12232,14 +12234,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12232
12234
|
}
|
|
12233
12235
|
catch (error) {
|
|
12234
12236
|
if (error instanceof QueueFullError) {
|
|
12235
|
-
logger$
|
|
12237
|
+
logger$15.warning('broadcast_channel_push_queue_full', {
|
|
12236
12238
|
channel: this.channelName,
|
|
12237
12239
|
inbox_capacity: this.inboxCapacity,
|
|
12238
12240
|
inbox_remaining_capacity: this.inbox.remainingCapacity,
|
|
12239
12241
|
});
|
|
12240
12242
|
throw error;
|
|
12241
12243
|
}
|
|
12242
|
-
logger$
|
|
12244
|
+
logger$15.error('broadcast_channel_push_failed', {
|
|
12243
12245
|
channel: this.channelName,
|
|
12244
12246
|
error: error instanceof Error ? error.message : String(error),
|
|
12245
12247
|
});
|
|
@@ -12249,7 +12251,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12249
12251
|
async _transportSendBytes(data) {
|
|
12250
12252
|
ensureBroadcastEnvironment();
|
|
12251
12253
|
const targetNodeId = this.targetNodeId ?? '*';
|
|
12252
|
-
logger$
|
|
12254
|
+
logger$15.debug('broadcast_channel_message_sending', {
|
|
12253
12255
|
channel: this.channelName,
|
|
12254
12256
|
sender_id: this.connectorId,
|
|
12255
12257
|
sender_node_id: this.localNodeId,
|
|
@@ -12270,7 +12272,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12270
12272
|
return item;
|
|
12271
12273
|
}
|
|
12272
12274
|
async _transportClose(code, reason) {
|
|
12273
|
-
logger$
|
|
12275
|
+
logger$15.debug('broadcast_channel_transport_closing', {
|
|
12274
12276
|
channel: this.channelName,
|
|
12275
12277
|
connector_id: this.connectorId,
|
|
12276
12278
|
code,
|
|
@@ -12279,14 +12281,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12279
12281
|
timestamp: new Date().toISOString(),
|
|
12280
12282
|
});
|
|
12281
12283
|
if (this.listenerRegistered) {
|
|
12282
|
-
logger$
|
|
12284
|
+
logger$15.debug('broadcast_channel_removing_listener', {
|
|
12283
12285
|
channel: this.channelName,
|
|
12284
12286
|
connector_id: this.connectorId,
|
|
12285
12287
|
timestamp: new Date().toISOString(),
|
|
12286
12288
|
});
|
|
12287
12289
|
this.channel.removeEventListener('message', this.onMsg);
|
|
12288
12290
|
this.listenerRegistered = false;
|
|
12289
|
-
logger$
|
|
12291
|
+
logger$15.debug('broadcast_channel_listener_removed', {
|
|
12290
12292
|
channel: this.channelName,
|
|
12291
12293
|
connector_id: this.connectorId,
|
|
12292
12294
|
timestamp: new Date().toISOString(),
|
|
@@ -12299,13 +12301,13 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12299
12301
|
this.visibilityChangeListenerRegistered = false;
|
|
12300
12302
|
this.visibilityChangeHandler = undefined;
|
|
12301
12303
|
}
|
|
12302
|
-
logger$
|
|
12304
|
+
logger$15.debug('broadcast_channel_closing', {
|
|
12303
12305
|
channel: this.channelName,
|
|
12304
12306
|
connector_id: this.connectorId,
|
|
12305
12307
|
timestamp: new Date().toISOString(),
|
|
12306
12308
|
});
|
|
12307
12309
|
this.channel.close();
|
|
12308
|
-
logger$
|
|
12310
|
+
logger$15.debug('broadcast_channel_closed', {
|
|
12309
12311
|
channel: this.channelName,
|
|
12310
12312
|
connector_id: this.connectorId,
|
|
12311
12313
|
timestamp: new Date().toISOString(),
|
|
@@ -12329,7 +12331,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12329
12331
|
if (targetNodeId &&
|
|
12330
12332
|
targetNodeId !== '*' &&
|
|
12331
12333
|
targetNodeId !== this.localNodeId) {
|
|
12332
|
-
logger$
|
|
12334
|
+
logger$15.debug('broadcast_channel_message_rejected', {
|
|
12333
12335
|
channel: this.channelName,
|
|
12334
12336
|
connector_id: this.connectorId,
|
|
12335
12337
|
reason: 'wildcard_target_mismatch',
|
|
@@ -12345,7 +12347,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12345
12347
|
if (expectedSender &&
|
|
12346
12348
|
expectedSender !== '*' &&
|
|
12347
12349
|
senderNodeId !== expectedSender) {
|
|
12348
|
-
logger$
|
|
12350
|
+
logger$15.debug('broadcast_channel_message_rejected', {
|
|
12349
12351
|
channel: this.channelName,
|
|
12350
12352
|
connector_id: this.connectorId,
|
|
12351
12353
|
reason: 'unexpected_sender',
|
|
@@ -12358,7 +12360,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12358
12360
|
if (targetNodeId &&
|
|
12359
12361
|
targetNodeId !== '*' &&
|
|
12360
12362
|
targetNodeId !== this.localNodeId) {
|
|
12361
|
-
logger$
|
|
12363
|
+
logger$15.debug('broadcast_channel_message_rejected', {
|
|
12362
12364
|
channel: this.channelName,
|
|
12363
12365
|
connector_id: this.connectorId,
|
|
12364
12366
|
reason: 'unexpected_target',
|
|
@@ -12383,7 +12385,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12383
12385
|
return 'unknown';
|
|
12384
12386
|
}
|
|
12385
12387
|
logInboxSnapshot(event, extra = {}) {
|
|
12386
|
-
logger$
|
|
12388
|
+
logger$15.debug(event, {
|
|
12387
12389
|
channel: this.channelName,
|
|
12388
12390
|
connector_id: this.connectorId,
|
|
12389
12391
|
connector_state: this.state,
|
|
@@ -12399,7 +12401,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12399
12401
|
await super.start(inboundHandler);
|
|
12400
12402
|
// After transitioning to STARTED, check if tab is already hidden
|
|
12401
12403
|
if (typeof document !== 'undefined' && document.hidden) {
|
|
12402
|
-
logger$
|
|
12404
|
+
logger$15.debug('broadcast_channel_start_in_hidden_tab', {
|
|
12403
12405
|
channel: this.channelName,
|
|
12404
12406
|
connector_id: this.connectorId,
|
|
12405
12407
|
document_hidden: document.hidden,
|
|
@@ -12409,7 +12411,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12409
12411
|
});
|
|
12410
12412
|
// Immediately pause if tab is hidden at start time
|
|
12411
12413
|
await this.pause().catch((err) => {
|
|
12412
|
-
logger$
|
|
12414
|
+
logger$15.warning('broadcast_channel_initial_pause_failed', {
|
|
12413
12415
|
channel: this.channelName,
|
|
12414
12416
|
connector_id: this.connectorId,
|
|
12415
12417
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -12427,7 +12429,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12427
12429
|
return;
|
|
12428
12430
|
}
|
|
12429
12431
|
this.targetNodeId = normalized;
|
|
12430
|
-
logger$
|
|
12432
|
+
logger$15.debug('broadcast_channel_target_updated', {
|
|
12431
12433
|
channel: this.channelName,
|
|
12432
12434
|
connector_id: this.connectorId,
|
|
12433
12435
|
local_node_id: this.localNodeId,
|
|
@@ -12437,7 +12439,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
12437
12439
|
}
|
|
12438
12440
|
setWildcardTarget() {
|
|
12439
12441
|
this.targetNodeId = '*';
|
|
12440
|
-
logger$
|
|
12442
|
+
logger$15.debug('broadcast_channel_target_updated', {
|
|
12441
12443
|
channel: this.channelName,
|
|
12442
12444
|
connector_id: this.connectorId,
|
|
12443
12445
|
local_node_id: this.localNodeId,
|
|
@@ -12565,7 +12567,7 @@ function broadcastChannelGrantToConnectorConfig(grant) {
|
|
|
12565
12567
|
return config;
|
|
12566
12568
|
}
|
|
12567
12569
|
|
|
12568
|
-
const logger$
|
|
12570
|
+
const logger$14 = getLogger('naylence.fame.node.upstream_session_manager');
|
|
12569
12571
|
function isPlainRecord$4(value) {
|
|
12570
12572
|
if (typeof value !== 'object' || value === null) {
|
|
12571
12573
|
return false;
|
|
@@ -12638,6 +12640,7 @@ function normalizeOptions$k(options) {
|
|
|
12638
12640
|
const onEpochChangeValue = pickOption$2(record, 'onEpochChange', 'on_epoch_change');
|
|
12639
12641
|
const onEpochChange = typeof onEpochChangeValue === 'function' ? onEpochChangeValue : undefined;
|
|
12640
12642
|
const admissionClient = pickOption$2(record, 'admissionClient', 'admission_client');
|
|
12643
|
+
const retryPolicy = pickOption$2(record, 'retryPolicy', 'retry_policy');
|
|
12641
12644
|
return {
|
|
12642
12645
|
node,
|
|
12643
12646
|
attachClient,
|
|
@@ -12649,6 +12652,7 @@ function normalizeOptions$k(options) {
|
|
|
12649
12652
|
onAttach: validatedOnAttach,
|
|
12650
12653
|
onEpochChange,
|
|
12651
12654
|
admissionClient: admissionClient ?? undefined,
|
|
12655
|
+
retryPolicy: retryPolicy ?? undefined,
|
|
12652
12656
|
};
|
|
12653
12657
|
}
|
|
12654
12658
|
class UpstreamSessionManager extends TaskSpawner {
|
|
@@ -12668,6 +12672,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12668
12672
|
this.hadSuccessfulAttach = false;
|
|
12669
12673
|
this.lastConnectorState = null;
|
|
12670
12674
|
this.connectEpoch = 0;
|
|
12675
|
+
this.initialAttempts = 0;
|
|
12671
12676
|
this._visibilityHandler = null;
|
|
12672
12677
|
const options = normalizeOptions$k(optionsInput);
|
|
12673
12678
|
this.node = options.node;
|
|
@@ -12681,31 +12686,34 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12681
12686
|
this.admissionClient =
|
|
12682
12687
|
options.admissionClient ?? options.node.admissionClient;
|
|
12683
12688
|
this.wrappedHandler = this.makeHeartbeatEnabledHandler(options.inboundHandler);
|
|
12684
|
-
|
|
12689
|
+
// Store the connection retry policy (can be null, in which case default behavior applies)
|
|
12690
|
+
this.connectionRetryPolicy = options.retryPolicy ?? null;
|
|
12691
|
+
logger$14.debug('created_upstream_session_manager', {
|
|
12685
12692
|
target_system_id: this.targetSystemId,
|
|
12693
|
+
has_retry_policy: this.connectionRetryPolicy !== null,
|
|
12686
12694
|
});
|
|
12687
12695
|
}
|
|
12688
12696
|
get systemId() {
|
|
12689
12697
|
return this.targetSystemId;
|
|
12690
12698
|
}
|
|
12691
12699
|
setupVisibilityListener() {
|
|
12692
|
-
logger$
|
|
12700
|
+
logger$14.debug('setup_visibility_listener_called', {
|
|
12693
12701
|
has_document: typeof document !== 'undefined',
|
|
12694
12702
|
});
|
|
12695
12703
|
if (typeof document !== 'undefined' && document.addEventListener) {
|
|
12696
12704
|
this._visibilityHandler = () => {
|
|
12697
|
-
logger$
|
|
12705
|
+
logger$14.debug('visibility_change_event_fired', {
|
|
12698
12706
|
state: document.visibilityState,
|
|
12699
12707
|
});
|
|
12700
12708
|
if (document.visibilityState === 'visible') {
|
|
12701
|
-
logger$
|
|
12709
|
+
logger$14.debug('visibility_change_detected_waking_up');
|
|
12702
12710
|
this.wakeEvent.set();
|
|
12703
12711
|
}
|
|
12704
12712
|
};
|
|
12705
12713
|
document.addEventListener('visibilitychange', this._visibilityHandler);
|
|
12706
12714
|
}
|
|
12707
12715
|
else {
|
|
12708
|
-
logger$
|
|
12716
|
+
logger$14.debug('setup_visibility_listener_skipped_no_document');
|
|
12709
12717
|
}
|
|
12710
12718
|
}
|
|
12711
12719
|
teardownVisibilityListener() {
|
|
@@ -12738,13 +12746,13 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12738
12746
|
}
|
|
12739
12747
|
throw new FameConnectError('Upstream session manager failed to attach');
|
|
12740
12748
|
}
|
|
12741
|
-
logger$
|
|
12749
|
+
logger$14.debug('upstream_session_manager_started');
|
|
12742
12750
|
}
|
|
12743
12751
|
getActiveConnector() {
|
|
12744
12752
|
return this.connector;
|
|
12745
12753
|
}
|
|
12746
12754
|
async stop() {
|
|
12747
|
-
logger$
|
|
12755
|
+
logger$14.debug('upstream_session_manager_stopping');
|
|
12748
12756
|
this.teardownVisibilityListener();
|
|
12749
12757
|
this.stopEvent.set();
|
|
12750
12758
|
this.currentStopSubtasks?.set();
|
|
@@ -12755,7 +12763,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12755
12763
|
}
|
|
12756
12764
|
catch (error) {
|
|
12757
12765
|
if (!(error instanceof TaskCancelledError)) {
|
|
12758
|
-
logger$
|
|
12766
|
+
logger$14.debug('fsm_task_stopped_with_error', {
|
|
12759
12767
|
error: error.message,
|
|
12760
12768
|
});
|
|
12761
12769
|
}
|
|
@@ -12764,13 +12772,13 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12764
12772
|
}
|
|
12765
12773
|
if (this.connector) {
|
|
12766
12774
|
await this.connector.stop().catch((error) => {
|
|
12767
|
-
logger$
|
|
12775
|
+
logger$14.debug('connector_stop_error', {
|
|
12768
12776
|
error: error.message,
|
|
12769
12777
|
});
|
|
12770
12778
|
});
|
|
12771
12779
|
this.connector = null;
|
|
12772
12780
|
}
|
|
12773
|
-
logger$
|
|
12781
|
+
logger$14.debug('upstream_session_manager_stopped');
|
|
12774
12782
|
}
|
|
12775
12783
|
async send(envelope) {
|
|
12776
12784
|
if (this.messageQueue.length >= UpstreamSessionManager.TX_QUEUE_MAX) {
|
|
@@ -12798,11 +12806,14 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12798
12806
|
}
|
|
12799
12807
|
async fsmLoop() {
|
|
12800
12808
|
let delay = UpstreamSessionManager.BACKOFF_INITIAL;
|
|
12809
|
+
this.initialAttempts = 0;
|
|
12801
12810
|
while (!this.stopEvent.isSet()) {
|
|
12802
12811
|
const startTime = Date.now();
|
|
12812
|
+
this.initialAttempts += 1;
|
|
12803
12813
|
try {
|
|
12804
12814
|
await this.connectCycle();
|
|
12805
12815
|
delay = UpstreamSessionManager.BACKOFF_INITIAL;
|
|
12816
|
+
this.initialAttempts = 0; // Reset on success
|
|
12806
12817
|
}
|
|
12807
12818
|
catch (error) {
|
|
12808
12819
|
// Reset backoff if the connection was alive for more than 10 seconds
|
|
@@ -12812,32 +12823,38 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12812
12823
|
if (error instanceof TaskCancelledError) {
|
|
12813
12824
|
throw error;
|
|
12814
12825
|
}
|
|
12826
|
+
// Determine if we should fail-fast or retry
|
|
12827
|
+
const shouldFailFast = this.shouldFailFastOnError(error);
|
|
12815
12828
|
if (error instanceof FameTransportClose ||
|
|
12816
12829
|
error instanceof FameConnectError) {
|
|
12817
|
-
logger$
|
|
12830
|
+
logger$14.warning('upstream_link_closed', {
|
|
12818
12831
|
error: error.message,
|
|
12819
|
-
will_retry:
|
|
12832
|
+
will_retry: !shouldFailFast,
|
|
12833
|
+
attempt: this.initialAttempts,
|
|
12834
|
+
has_retry_policy: this.connectionRetryPolicy !== null,
|
|
12820
12835
|
});
|
|
12821
|
-
if (
|
|
12836
|
+
if (shouldFailFast && error instanceof FameConnectError) {
|
|
12822
12837
|
throw error;
|
|
12823
12838
|
}
|
|
12824
12839
|
}
|
|
12825
12840
|
else {
|
|
12826
12841
|
const err = error;
|
|
12827
12842
|
if (err.name === 'OAuth2PkceRedirectInitiatedError') {
|
|
12828
|
-
logger$
|
|
12843
|
+
logger$14.info('upstream_link_redirecting', {
|
|
12829
12844
|
error: err.message,
|
|
12830
12845
|
will_retry: true,
|
|
12831
12846
|
});
|
|
12832
12847
|
}
|
|
12833
12848
|
else {
|
|
12834
|
-
logger$
|
|
12849
|
+
logger$14.warning('upstream_link_closed', {
|
|
12835
12850
|
error: err.message,
|
|
12836
|
-
will_retry:
|
|
12851
|
+
will_retry: !shouldFailFast,
|
|
12852
|
+
attempt: this.initialAttempts,
|
|
12853
|
+
has_retry_policy: this.connectionRetryPolicy !== null,
|
|
12837
12854
|
exc_info: true,
|
|
12838
12855
|
});
|
|
12839
12856
|
}
|
|
12840
|
-
if (
|
|
12857
|
+
if (shouldFailFast) {
|
|
12841
12858
|
throw error;
|
|
12842
12859
|
}
|
|
12843
12860
|
}
|
|
@@ -12845,52 +12862,77 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12845
12862
|
}
|
|
12846
12863
|
}
|
|
12847
12864
|
}
|
|
12865
|
+
/**
|
|
12866
|
+
* Determine whether to fail immediately or continue retrying.
|
|
12867
|
+
* Returns true if we should throw the error instead of retrying.
|
|
12868
|
+
*/
|
|
12869
|
+
shouldFailFastOnError(error) {
|
|
12870
|
+
// If no policy is configured, use legacy behavior (fail-fast after first attempt)
|
|
12871
|
+
if (!this.connectionRetryPolicy) {
|
|
12872
|
+
// After first successful attach, always retry (existing behavior)
|
|
12873
|
+
if (this.hadSuccessfulAttach) {
|
|
12874
|
+
return false;
|
|
12875
|
+
}
|
|
12876
|
+
// Without a policy, fail on first error
|
|
12877
|
+
return true;
|
|
12878
|
+
}
|
|
12879
|
+
// Delegate decision to the policy
|
|
12880
|
+
const shouldRetry = this.connectionRetryPolicy.shouldRetry({
|
|
12881
|
+
hadSuccessfulAttach: this.hadSuccessfulAttach,
|
|
12882
|
+
attemptNumber: this.initialAttempts,
|
|
12883
|
+
error,
|
|
12884
|
+
});
|
|
12885
|
+
return !shouldRetry;
|
|
12886
|
+
}
|
|
12848
12887
|
async applyBackoff(delay) {
|
|
12849
12888
|
const jitter = Math.random() * delay;
|
|
12850
|
-
await this.sleepWithStop(delay + jitter);
|
|
12889
|
+
const wasWoken = await this.sleepWithStop(delay + jitter);
|
|
12890
|
+
// If sleep was interrupted by visibility change (user returned to tab),
|
|
12891
|
+
// reset backoff to initial delay for immediate retry with fresh backoff
|
|
12892
|
+
if (wasWoken) {
|
|
12893
|
+
logger$14.debug('backoff_reset_on_visibility_change', {
|
|
12894
|
+
previous_delay: delay,
|
|
12895
|
+
new_delay: UpstreamSessionManager.BACKOFF_INITIAL,
|
|
12896
|
+
});
|
|
12897
|
+
return UpstreamSessionManager.BACKOFF_INITIAL;
|
|
12898
|
+
}
|
|
12851
12899
|
return Math.min(delay * 2, UpstreamSessionManager.BACKOFF_CAP);
|
|
12852
12900
|
}
|
|
12901
|
+
/**
|
|
12902
|
+
* Sleep for the specified duration, but can be interrupted by stop or wake events.
|
|
12903
|
+
* @returns true if interrupted by wake event (e.g., visibility change), false otherwise
|
|
12904
|
+
*/
|
|
12853
12905
|
async sleepWithStop(delaySeconds) {
|
|
12854
12906
|
if (delaySeconds <= 0) {
|
|
12855
|
-
return;
|
|
12856
|
-
}
|
|
12857
|
-
// If the document is visible, cap the backoff delay to improve UX
|
|
12858
|
-
// This ensures that if the user is watching, we retry quickly (e.g. 1s)
|
|
12859
|
-
// instead of waiting for the full exponential backoff (up to 30s).
|
|
12860
|
-
let effectiveDelay = delaySeconds;
|
|
12861
|
-
if (typeof document !== 'undefined' &&
|
|
12862
|
-
document.visibilityState === 'visible') {
|
|
12863
|
-
effectiveDelay = Math.min(delaySeconds, 1.0);
|
|
12864
|
-
if (effectiveDelay < delaySeconds) {
|
|
12865
|
-
logger$13.debug('sleep_reduced_document_visible', {
|
|
12866
|
-
original: delaySeconds,
|
|
12867
|
-
new: effectiveDelay,
|
|
12868
|
-
});
|
|
12869
|
-
}
|
|
12907
|
+
return false;
|
|
12870
12908
|
}
|
|
12909
|
+
// Check if wake event is already set (e.g., visibility just changed)
|
|
12871
12910
|
if (this.wakeEvent.isSet()) {
|
|
12872
12911
|
this.wakeEvent.clear();
|
|
12873
|
-
|
|
12912
|
+
logger$14.debug('sleep_skipped_wake_event_pending');
|
|
12913
|
+
return true;
|
|
12874
12914
|
}
|
|
12875
12915
|
let timeout;
|
|
12876
12916
|
const sleepPromise = new Promise((resolve) => {
|
|
12877
12917
|
timeout = setTimeout(() => {
|
|
12878
12918
|
timeout = undefined;
|
|
12879
12919
|
resolve();
|
|
12880
|
-
},
|
|
12920
|
+
}, delaySeconds * 1000);
|
|
12881
12921
|
});
|
|
12882
12922
|
await Promise.race([
|
|
12883
12923
|
sleepPromise,
|
|
12884
12924
|
this.stopEvent.wait(),
|
|
12885
12925
|
this.wakeEvent.wait(),
|
|
12886
12926
|
]);
|
|
12887
|
-
|
|
12888
|
-
|
|
12927
|
+
const wasWoken = this.wakeEvent.isSet();
|
|
12928
|
+
if (wasWoken) {
|
|
12929
|
+
logger$14.debug('sleep_interrupted_by_wake_event');
|
|
12889
12930
|
this.wakeEvent.clear();
|
|
12890
12931
|
}
|
|
12891
12932
|
if (timeout !== undefined) {
|
|
12892
12933
|
clearTimeout(timeout);
|
|
12893
12934
|
}
|
|
12935
|
+
return wasWoken;
|
|
12894
12936
|
}
|
|
12895
12937
|
getNodeAttachGrant(connectionGrants) {
|
|
12896
12938
|
if (!connectionGrants) {
|
|
@@ -12947,7 +12989,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12947
12989
|
await connector.start(this.wrappedHandler);
|
|
12948
12990
|
this.connector = connector;
|
|
12949
12991
|
const callbackGrants = this.node.gatherSupportedCallbackGrants();
|
|
12950
|
-
logger$
|
|
12992
|
+
logger$14.debug('callback_grants_before_augmentation', {
|
|
12951
12993
|
count: callbackGrants.length,
|
|
12952
12994
|
types: callbackGrants.map((g) => g.type),
|
|
12953
12995
|
});
|
|
@@ -12957,7 +12999,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12957
12999
|
const broadcastCallbackGrant = shouldAddBroadcastGrant
|
|
12958
13000
|
? this.createBroadcastCallbackGrant(grant)
|
|
12959
13001
|
: null;
|
|
12960
|
-
logger$
|
|
13002
|
+
logger$14.debug('broadcast_callback_grant_check', {
|
|
12961
13003
|
should_add: shouldAddBroadcastGrant,
|
|
12962
13004
|
grant_created: !!broadcastCallbackGrant,
|
|
12963
13005
|
});
|
|
@@ -12976,12 +13018,12 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12976
13018
|
const isDuplicate = callbackGrants.some((existing) => JSON.stringify(existing) === JSON.stringify(grant));
|
|
12977
13019
|
if (!isDuplicate) {
|
|
12978
13020
|
callbackGrants.push(grant);
|
|
12979
|
-
logger$
|
|
13021
|
+
logger$14.debug('added_connection_grant_as_callback', {
|
|
12980
13022
|
type: grant.type,
|
|
12981
13023
|
});
|
|
12982
13024
|
}
|
|
12983
13025
|
else {
|
|
12984
|
-
logger$
|
|
13026
|
+
logger$14.debug('skipped_duplicate_connection_grant', {
|
|
12985
13027
|
type: grant.type,
|
|
12986
13028
|
});
|
|
12987
13029
|
}
|
|
@@ -12993,12 +13035,12 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
12993
13035
|
if (broadcastCallbackGrant &&
|
|
12994
13036
|
this.shouldAdvertiseBroadcastGrant(grant, callbackGrants)) {
|
|
12995
13037
|
callbackGrants.push(broadcastCallbackGrant);
|
|
12996
|
-
logger$
|
|
13038
|
+
logger$14.debug('added_broadcast_callback_grant');
|
|
12997
13039
|
}
|
|
12998
13040
|
else if (broadcastCallbackGrant) {
|
|
12999
|
-
logger$
|
|
13041
|
+
logger$14.debug('skipped_duplicate_broadcast_callback_grant');
|
|
13000
13042
|
}
|
|
13001
|
-
logger$
|
|
13043
|
+
logger$14.debug('callback_grants_after_augmentation', {
|
|
13002
13044
|
count: callbackGrants.length,
|
|
13003
13045
|
types: callbackGrants.map((g) => g.type),
|
|
13004
13046
|
});
|
|
@@ -13011,7 +13053,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13011
13053
|
targetAware.setTargetNodeId(this.targetSystemId);
|
|
13012
13054
|
}
|
|
13013
13055
|
catch (error) {
|
|
13014
|
-
logger$
|
|
13056
|
+
logger$14.warning('broadcast_channel_target_apply_failed', {
|
|
13015
13057
|
error: error instanceof Error ? error.message : String(error),
|
|
13016
13058
|
target_node_id: this.targetSystemId,
|
|
13017
13059
|
});
|
|
@@ -13033,14 +13075,14 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13033
13075
|
});
|
|
13034
13076
|
}
|
|
13035
13077
|
else {
|
|
13036
|
-
logger$
|
|
13078
|
+
logger$14.warning('parent_epoch_changed', { epoch });
|
|
13037
13079
|
}
|
|
13038
13080
|
}
|
|
13039
13081
|
if (!this.readyEvent.isSet()) {
|
|
13040
13082
|
this.readyEvent.set();
|
|
13041
13083
|
}
|
|
13042
13084
|
if (this.messageQueue.length > 0) {
|
|
13043
|
-
logger$
|
|
13085
|
+
logger$14.debug('flushing_buffered_frames', {
|
|
13044
13086
|
queue_size: this.messageQueue.length,
|
|
13045
13087
|
});
|
|
13046
13088
|
this.queueEvent.set();
|
|
@@ -13057,12 +13099,12 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13057
13099
|
name: `expiry-guard-${this.connectEpoch}`,
|
|
13058
13100
|
});
|
|
13059
13101
|
if (this.hadSuccessfulAttach) {
|
|
13060
|
-
logger$
|
|
13102
|
+
logger$14.debug('reconnected_to_upstream', {
|
|
13061
13103
|
attach_expires_at: attachInfo.attachExpiresAt?.toISOString?.() ?? null,
|
|
13062
13104
|
});
|
|
13063
13105
|
}
|
|
13064
13106
|
else {
|
|
13065
|
-
logger$
|
|
13107
|
+
logger$14.debug('connected_to_upstream', {
|
|
13066
13108
|
attach_expires_at: attachInfo.attachExpiresAt?.toISOString?.() ?? null,
|
|
13067
13109
|
});
|
|
13068
13110
|
}
|
|
@@ -13080,18 +13122,18 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13080
13122
|
this.currentStopSubtasks = null;
|
|
13081
13123
|
await Promise.allSettled(tasks.map((task) => task.promise));
|
|
13082
13124
|
if (this.connector) {
|
|
13083
|
-
logger$
|
|
13125
|
+
logger$14.debug('upstream_stopping_old_connector', {
|
|
13084
13126
|
connect_epoch: this.connectEpoch,
|
|
13085
13127
|
target_system_id: this.targetSystemId,
|
|
13086
13128
|
timestamp: new Date().toISOString(),
|
|
13087
13129
|
});
|
|
13088
13130
|
await this.connector.stop().catch((err) => {
|
|
13089
|
-
logger$
|
|
13131
|
+
logger$14.warning('upstream_connector_stop_error', {
|
|
13090
13132
|
connect_epoch: this.connectEpoch,
|
|
13091
13133
|
error: err instanceof Error ? err.message : String(err),
|
|
13092
13134
|
});
|
|
13093
13135
|
});
|
|
13094
|
-
logger$
|
|
13136
|
+
logger$14.debug('upstream_old_connector_stopped', {
|
|
13095
13137
|
connect_epoch: this.connectEpoch,
|
|
13096
13138
|
target_system_id: this.targetSystemId,
|
|
13097
13139
|
timestamp: new Date().toISOString(),
|
|
@@ -13144,7 +13186,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13144
13186
|
});
|
|
13145
13187
|
}
|
|
13146
13188
|
catch (error) {
|
|
13147
|
-
logger$
|
|
13189
|
+
logger$14.debug('broadcast_callback_grant_generation_failed', {
|
|
13148
13190
|
error: error instanceof Error ? error.message : String(error),
|
|
13149
13191
|
});
|
|
13150
13192
|
return null;
|
|
@@ -13199,7 +13241,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13199
13241
|
}
|
|
13200
13242
|
}
|
|
13201
13243
|
async heartbeatLoop(connector, stopEvt, signal) {
|
|
13202
|
-
logger$
|
|
13244
|
+
logger$14.debug('starting_heartbeat_loop');
|
|
13203
13245
|
const intervalMs = UpstreamSessionManager.HEARTBEAT_INTERVAL * 1000;
|
|
13204
13246
|
const graceMs = intervalMs * UpstreamSessionManager.HEARTBEAT_GRACE;
|
|
13205
13247
|
this.lastHeartbeatAckTime = Date.now();
|
|
@@ -13235,7 +13277,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13235
13277
|
// Skip heartbeat if connector is paused (e.g., tab is hidden)
|
|
13236
13278
|
// Keep ack time current so we don't timeout immediately after resuming
|
|
13237
13279
|
if (currentState === ConnectorState.PAUSED) {
|
|
13238
|
-
logger$
|
|
13280
|
+
logger$14.debug('skipping_heartbeat_connector_paused', {
|
|
13239
13281
|
connector_state: currentState,
|
|
13240
13282
|
});
|
|
13241
13283
|
this.lastHeartbeatAckTime = Date.now();
|
|
@@ -13244,14 +13286,14 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13244
13286
|
// Reset ack time if just resumed from pause (prevents immediate timeout)
|
|
13245
13287
|
if (previousState === ConnectorState.PAUSED &&
|
|
13246
13288
|
currentState === ConnectorState.STARTED) {
|
|
13247
|
-
logger$
|
|
13289
|
+
logger$14.debug('connector_just_resumed_resetting_ack_time', {
|
|
13248
13290
|
previous_state: previousState,
|
|
13249
13291
|
current_state: currentState,
|
|
13250
13292
|
});
|
|
13251
13293
|
this.lastHeartbeatAckTime = Date.now();
|
|
13252
13294
|
}
|
|
13253
13295
|
const envelope = await this.makeHeartbeatEnvelope();
|
|
13254
|
-
logger$
|
|
13296
|
+
logger$14.debug('sending_heartbeat', {
|
|
13255
13297
|
hb_corr_id: envelope.corrId,
|
|
13256
13298
|
hb_env_id: envelope.id,
|
|
13257
13299
|
});
|
|
@@ -13277,7 +13319,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13277
13319
|
throw new FameConnectError('missed heartbeat acknowledgement');
|
|
13278
13320
|
}
|
|
13279
13321
|
}
|
|
13280
|
-
logger$
|
|
13322
|
+
logger$14.debug('completed_heartbeat_loop');
|
|
13281
13323
|
}
|
|
13282
13324
|
async messagePumpLoop(connector, stopEvt, signal) {
|
|
13283
13325
|
while (!stopEvt.isSet() && !signal?.aborted) {
|
|
@@ -13294,19 +13336,19 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13294
13336
|
if (!envelope) {
|
|
13295
13337
|
continue;
|
|
13296
13338
|
}
|
|
13297
|
-
logger$
|
|
13339
|
+
logger$14.debug('upstream_pump_sending_envelope', {
|
|
13298
13340
|
envelopeId: envelope.id,
|
|
13299
13341
|
type: envelope.frame?.type,
|
|
13300
13342
|
});
|
|
13301
13343
|
try {
|
|
13302
13344
|
await connector.send(envelope);
|
|
13303
|
-
logger$
|
|
13345
|
+
logger$14.debug('upstream_pump_sent_envelope', {
|
|
13304
13346
|
envelopeId: envelope.id,
|
|
13305
13347
|
});
|
|
13306
13348
|
}
|
|
13307
13349
|
catch (error) {
|
|
13308
13350
|
if (error instanceof FameMessageTooLarge) {
|
|
13309
|
-
logger$
|
|
13351
|
+
logger$14.error('failed_to_send_message', { error: error.message });
|
|
13310
13352
|
await this.handleMessageTooLarge(envelope, error.message);
|
|
13311
13353
|
}
|
|
13312
13354
|
else if (error instanceof FameTransportClose) {
|
|
@@ -13368,7 +13410,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13368
13410
|
await fabric.send(ackEnvelope);
|
|
13369
13411
|
}
|
|
13370
13412
|
catch (error) {
|
|
13371
|
-
logger$
|
|
13413
|
+
logger$14.warning('failed_to_send_nack', {
|
|
13372
13414
|
error: error.message,
|
|
13373
13415
|
});
|
|
13374
13416
|
}
|
|
@@ -13382,7 +13424,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13382
13424
|
timestamps.push(info.attachExpiresAt);
|
|
13383
13425
|
}
|
|
13384
13426
|
if (!timestamps.length) {
|
|
13385
|
-
logger$
|
|
13427
|
+
logger$14.debug('no_ttl_expiry_configured');
|
|
13386
13428
|
await this.waitEvent(stopEvt, signal);
|
|
13387
13429
|
return;
|
|
13388
13430
|
}
|
|
@@ -13391,7 +13433,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13391
13433
|
let delaySeconds = (earliest.getTime() - now.getTime()) / 1000 -
|
|
13392
13434
|
UpstreamSessionManager.JWT_REFRESH_SAFETY;
|
|
13393
13435
|
delaySeconds = Math.max(delaySeconds, UpstreamSessionManager.JWT_REFRESH_SAFETY);
|
|
13394
|
-
logger$
|
|
13436
|
+
logger$14.debug('ttl_expiry_guard_started', {
|
|
13395
13437
|
welcome_expires_at: welcome.frame.expiresAt ?? null,
|
|
13396
13438
|
attach_expires_at: info.attachExpiresAt?.toISOString?.() ?? null,
|
|
13397
13439
|
earliest_expiry: earliest.toISOString(),
|
|
@@ -13419,7 +13461,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13419
13461
|
}
|
|
13420
13462
|
}
|
|
13421
13463
|
if (!stopEvt.isSet()) {
|
|
13422
|
-
logger$
|
|
13464
|
+
logger$14.debug('ttl_expiry_triggered_reconnect', {
|
|
13423
13465
|
expires_at: earliest.toISOString(),
|
|
13424
13466
|
current_time: new Date().toISOString(),
|
|
13425
13467
|
seconds_before_expiry: UpstreamSessionManager.JWT_REFRESH_SAFETY,
|
|
@@ -13464,7 +13506,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13464
13506
|
}
|
|
13465
13507
|
await this.node.dispatchEnvelopeEvent('onEnvelopeReceived', this.node, env, context);
|
|
13466
13508
|
if (env.frame.type === 'NodeHeartbeatAck') {
|
|
13467
|
-
logger$
|
|
13509
|
+
logger$14.debug('received_heartbeat_ack', {
|
|
13468
13510
|
hb_ack_env_id: env.id,
|
|
13469
13511
|
hb_ack_corr_id: env.corrId,
|
|
13470
13512
|
hb_routing_epoch: env.frame.routingEpoch,
|
|
@@ -13478,7 +13520,7 @@ class UpstreamSessionManager extends TaskSpawner {
|
|
|
13478
13520
|
await this.onEpochChange(epoch);
|
|
13479
13521
|
}
|
|
13480
13522
|
else {
|
|
13481
|
-
logger$
|
|
13523
|
+
logger$14.warning('parent_epoch_changed', { epoch });
|
|
13482
13524
|
}
|
|
13483
13525
|
}
|
|
13484
13526
|
return;
|
|
@@ -13497,7 +13539,7 @@ UpstreamSessionManager.TX_QUEUE_MAX = 512;
|
|
|
13497
13539
|
UpstreamSessionManager.BACKOFF_INITIAL = 1; // seconds
|
|
13498
13540
|
UpstreamSessionManager.BACKOFF_CAP = 30; // seconds
|
|
13499
13541
|
|
|
13500
|
-
const logger$
|
|
13542
|
+
const logger$13 = getLogger('naylence.fame.node.admission.noop_admission_client');
|
|
13501
13543
|
class NoopAdmissionClient {
|
|
13502
13544
|
constructor(options = {}) {
|
|
13503
13545
|
this.hasUpstream = false;
|
|
@@ -13511,7 +13553,7 @@ class NoopAdmissionClient {
|
|
|
13511
13553
|
const acceptedLogicals = this.autoAcceptLogicals
|
|
13512
13554
|
? [...(requestedLogicals ?? [])]
|
|
13513
13555
|
: [];
|
|
13514
|
-
logger$
|
|
13556
|
+
logger$13.debug('noop_admission_hello', {
|
|
13515
13557
|
systemId: effectiveSystemId,
|
|
13516
13558
|
instanceId,
|
|
13517
13559
|
requestedLogicals,
|
|
@@ -13529,7 +13571,7 @@ class NoopAdmissionClient {
|
|
|
13529
13571
|
});
|
|
13530
13572
|
}
|
|
13531
13573
|
async close() {
|
|
13532
|
-
logger$
|
|
13574
|
+
logger$13.debug('noop_admission_close');
|
|
13533
13575
|
}
|
|
13534
13576
|
}
|
|
13535
13577
|
|
|
@@ -13735,7 +13777,7 @@ class DefaultServiceManager {
|
|
|
13735
13777
|
}
|
|
13736
13778
|
|
|
13737
13779
|
const SYSTEM_INBOX$1 = '__sys__';
|
|
13738
|
-
const logger$
|
|
13780
|
+
const logger$12 = getLogger('naylence.fame.node.node');
|
|
13739
13781
|
function isSnakeCase(name) {
|
|
13740
13782
|
return name.includes('_');
|
|
13741
13783
|
}
|
|
@@ -13862,6 +13904,8 @@ class FameNode extends TaskSpawner {
|
|
|
13862
13904
|
this._acceptedLogicals = new Set(acceptedLogicalsOption);
|
|
13863
13905
|
const deliveryPolicyOption = resolveOption(options, 'deliveryPolicy', 'delivery_policy');
|
|
13864
13906
|
this._deliveryPolicy = deliveryPolicyOption ?? null;
|
|
13907
|
+
const connectionRetryPolicyOption = resolveOption(options, 'connectionRetryPolicy', 'connection_retry_policy');
|
|
13908
|
+
this._connectionRetryPolicy = connectionRetryPolicyOption ?? null;
|
|
13865
13909
|
const admissionClientOption = resolveOption(options, 'admissionClient', 'admission_client');
|
|
13866
13910
|
this._admissionClient = admissionClientOption ?? null;
|
|
13867
13911
|
const attachClientOption = resolveOption(options, 'attachClient', 'attach_client');
|
|
@@ -13991,6 +14035,7 @@ class FameNode extends TaskSpawner {
|
|
|
13991
14035
|
onAttach: (info, connector) => this.handleAttach(info, connector),
|
|
13992
14036
|
onEpochChange: (epoch) => this.handleEpochChange(epoch),
|
|
13993
14037
|
admissionClient: this._admissionClient,
|
|
14038
|
+
retryPolicy: this._connectionRetryPolicy,
|
|
13994
14039
|
});
|
|
13995
14040
|
this._sessionManager = manager;
|
|
13996
14041
|
await manager.start();
|
|
@@ -14002,7 +14047,7 @@ class FameNode extends TaskSpawner {
|
|
|
14002
14047
|
confirmIdentity(systemId, source) {
|
|
14003
14048
|
if (this._confirmedId) {
|
|
14004
14049
|
if (this._confirmedId !== systemId) {
|
|
14005
|
-
logger$
|
|
14050
|
+
logger$12.error('node_identity_mismatch', {
|
|
14006
14051
|
current_id: this._confirmedId,
|
|
14007
14052
|
new_id: systemId,
|
|
14008
14053
|
source,
|
|
@@ -14014,14 +14059,14 @@ class FameNode extends TaskSpawner {
|
|
|
14014
14059
|
const isReassignment = this._provisionalId !== systemId;
|
|
14015
14060
|
this._confirmedId = systemId;
|
|
14016
14061
|
if (isReassignment) {
|
|
14017
|
-
logger$
|
|
14062
|
+
logger$12.debug('node_identity_reassigned', {
|
|
14018
14063
|
system_id: systemId,
|
|
14019
14064
|
previous_id: this._provisionalId,
|
|
14020
14065
|
source,
|
|
14021
14066
|
});
|
|
14022
14067
|
}
|
|
14023
14068
|
else {
|
|
14024
|
-
logger$
|
|
14069
|
+
logger$12.debug('node_identity_confirmed', {
|
|
14025
14070
|
system_id: systemId,
|
|
14026
14071
|
source,
|
|
14027
14072
|
});
|
|
@@ -14089,7 +14134,7 @@ class FameNode extends TaskSpawner {
|
|
|
14089
14134
|
return;
|
|
14090
14135
|
}
|
|
14091
14136
|
if (frameType === 'NodeHeartbeat') {
|
|
14092
|
-
logger$
|
|
14137
|
+
logger$12.debug('received_heartbeat_frame', {
|
|
14093
14138
|
envelopeId: envelope.id,
|
|
14094
14139
|
corrId: envelope.corrId ?? null,
|
|
14095
14140
|
});
|
|
@@ -14101,7 +14146,7 @@ class FameNode extends TaskSpawner {
|
|
|
14101
14146
|
await this.handleDeliveryAck(envelope, context);
|
|
14102
14147
|
return;
|
|
14103
14148
|
}
|
|
14104
|
-
logger$
|
|
14149
|
+
logger$12.debug('unhandled_system_frame', {
|
|
14105
14150
|
envelopeId: envelope.id,
|
|
14106
14151
|
frameType,
|
|
14107
14152
|
});
|
|
@@ -14113,13 +14158,13 @@ class FameNode extends TaskSpawner {
|
|
|
14113
14158
|
}
|
|
14114
14159
|
await this._deliveryTracker.onEnvelopeDelivered(SYSTEM_INBOX$1, envelope, context);
|
|
14115
14160
|
if (frame.ok !== false) {
|
|
14116
|
-
logger$
|
|
14161
|
+
logger$12.debug('delivery_ack_received', {
|
|
14117
14162
|
envelopeId: envelope.id,
|
|
14118
14163
|
corrId: envelope.corrId ?? null,
|
|
14119
14164
|
});
|
|
14120
14165
|
return;
|
|
14121
14166
|
}
|
|
14122
|
-
logger$
|
|
14167
|
+
logger$12.warning('delivery_nack_received', {
|
|
14123
14168
|
envelopeId: envelope.id,
|
|
14124
14169
|
corrId: envelope.corrId ?? null,
|
|
14125
14170
|
code: frame.code ?? null,
|
|
@@ -14129,7 +14174,7 @@ class FameNode extends TaskSpawner {
|
|
|
14129
14174
|
await this.onDeliveryNack(frame, envelope, context);
|
|
14130
14175
|
}
|
|
14131
14176
|
async onDeliveryNack(frame, envelope, _context) {
|
|
14132
|
-
logger$
|
|
14177
|
+
logger$12.debug('delivery_nack_processed', {
|
|
14133
14178
|
envelopeId: envelope.id,
|
|
14134
14179
|
code: frame.code ?? null,
|
|
14135
14180
|
reason: frame.reason ?? null,
|
|
@@ -14244,7 +14289,7 @@ class FameNode extends TaskSpawner {
|
|
|
14244
14289
|
await this._bindingManager.restore();
|
|
14245
14290
|
await this._envelopeListenerManager.start();
|
|
14246
14291
|
this._isStarted = true;
|
|
14247
|
-
logger$
|
|
14292
|
+
logger$12.debug('node_started', {
|
|
14248
14293
|
node_id: this.id,
|
|
14249
14294
|
sid: this.sid,
|
|
14250
14295
|
path: this.physicalPath,
|
|
@@ -14276,7 +14321,7 @@ class FameNode extends TaskSpawner {
|
|
|
14276
14321
|
await this._serviceManager.stop();
|
|
14277
14322
|
await this.dispatchEvent('onNodeStopped', this);
|
|
14278
14323
|
this._isStarted = false;
|
|
14279
|
-
logger$
|
|
14324
|
+
logger$12.debug('node_stopped', {
|
|
14280
14325
|
node_id: this.id,
|
|
14281
14326
|
});
|
|
14282
14327
|
}
|
|
@@ -14466,20 +14511,20 @@ class FameNode extends TaskSpawner {
|
|
|
14466
14511
|
await this.forwardUpstream(processedEnvelope, context);
|
|
14467
14512
|
}
|
|
14468
14513
|
else {
|
|
14469
|
-
logger$
|
|
14514
|
+
logger$12.error('attempted_upstream_loop', {
|
|
14470
14515
|
envelopeId: processedEnvelope.id,
|
|
14471
14516
|
});
|
|
14472
14517
|
}
|
|
14473
14518
|
return;
|
|
14474
14519
|
}
|
|
14475
14520
|
if (!processedEnvelope.to) {
|
|
14476
|
-
logger$
|
|
14521
|
+
logger$12.error('dropping_envelope_without_destination', {
|
|
14477
14522
|
envelopeId: processedEnvelope.id,
|
|
14478
14523
|
capabilities: processedEnvelope.capabilities ?? [],
|
|
14479
14524
|
});
|
|
14480
14525
|
return;
|
|
14481
14526
|
}
|
|
14482
|
-
logger$
|
|
14527
|
+
logger$12.warning('no_local_handler_for_address', {
|
|
14483
14528
|
address: processedEnvelope.to.toString?.() ?? String(processedEnvelope.to),
|
|
14484
14529
|
originType: context?.originType ?? null,
|
|
14485
14530
|
});
|
|
@@ -14603,7 +14648,7 @@ class FameNode extends TaskSpawner {
|
|
|
14603
14648
|
}
|
|
14604
14649
|
}
|
|
14605
14650
|
catch (error) {
|
|
14606
|
-
logger$
|
|
14651
|
+
logger$12.warning('callback_grant_collection_failed', {
|
|
14607
14652
|
error: error instanceof Error ? error.message : String(error),
|
|
14608
14653
|
});
|
|
14609
14654
|
}
|
|
@@ -14666,7 +14711,7 @@ class FameNode extends TaskSpawner {
|
|
|
14666
14711
|
await store.set('self', record);
|
|
14667
14712
|
}
|
|
14668
14713
|
catch (error) {
|
|
14669
|
-
logger$
|
|
14714
|
+
logger$12.warning('node_meta_persist_failed', {
|
|
14670
14715
|
error: error instanceof Error ? error.message : String(error),
|
|
14671
14716
|
});
|
|
14672
14717
|
}
|
|
@@ -14697,6 +14742,7 @@ const FameNodeConfigSchemaInternal = z
|
|
|
14697
14742
|
telemetry: z.unknown().optional().nullable(),
|
|
14698
14743
|
requestedCapabilities: z.array(z.string()).optional(),
|
|
14699
14744
|
identityPolicy: z.unknown().optional().nullable(),
|
|
14745
|
+
connectionRetryPolicy: z.unknown().optional().nullable(),
|
|
14700
14746
|
})
|
|
14701
14747
|
.passthrough();
|
|
14702
14748
|
function normalizeFameNodeConfig(input) {
|
|
@@ -14738,6 +14784,9 @@ function normalizeFameNodeConfig(input) {
|
|
|
14738
14784
|
identityPolicy: parsed.identityPolicy === undefined
|
|
14739
14785
|
? null
|
|
14740
14786
|
: parsed.identityPolicy,
|
|
14787
|
+
connectionRetryPolicy: parsed.connectionRetryPolicy === undefined
|
|
14788
|
+
? null
|
|
14789
|
+
: parsed.connectionRetryPolicy,
|
|
14741
14790
|
};
|
|
14742
14791
|
if (parsed.requestedCapabilities) {
|
|
14743
14792
|
normalized.requestedCapabilities = coerceStringArray$4(parsed.requestedCapabilities);
|
|
@@ -14782,6 +14831,24 @@ class AdmissionClientFactory extends AbstractResourceFactory {
|
|
|
14782
14831
|
}
|
|
14783
14832
|
}
|
|
14784
14833
|
|
|
14834
|
+
const CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE = 'ConnectionRetryPolicyFactory';
|
|
14835
|
+
class ConnectionRetryPolicyFactory extends AbstractResourceFactory {
|
|
14836
|
+
static async createConnectionRetryPolicy(config, options = {}) {
|
|
14837
|
+
if (config) {
|
|
14838
|
+
const policy = await createResource$1(CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE, config, options);
|
|
14839
|
+
if (!policy) {
|
|
14840
|
+
throw new Error('Failed to create connection retry policy from configuration');
|
|
14841
|
+
}
|
|
14842
|
+
return policy;
|
|
14843
|
+
}
|
|
14844
|
+
const policy = await createDefaultResource(CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE, null, options);
|
|
14845
|
+
if (!policy) {
|
|
14846
|
+
throw new Error('Failed to create default connection retry policy');
|
|
14847
|
+
}
|
|
14848
|
+
return policy;
|
|
14849
|
+
}
|
|
14850
|
+
}
|
|
14851
|
+
|
|
14785
14852
|
const TOKEN_PROVIDER_FACTORY_BASE_TYPE = 'TokenProviderFactory';
|
|
14786
14853
|
class TokenProviderFactory extends AbstractResourceFactory {
|
|
14787
14854
|
static async createTokenProvider(config, options = {}) {
|
|
@@ -14819,7 +14886,7 @@ function isIdentityExposingTokenProvider(candidate) {
|
|
|
14819
14886
|
'function');
|
|
14820
14887
|
}
|
|
14821
14888
|
|
|
14822
|
-
const logger$
|
|
14889
|
+
const logger$11 = getLogger('naylence.fame.node.default_node_identity_policy');
|
|
14823
14890
|
class DefaultNodeIdentityPolicy {
|
|
14824
14891
|
async resolveInitialNodeId(context) {
|
|
14825
14892
|
if (context.configuredId) {
|
|
@@ -14849,7 +14916,7 @@ class DefaultNodeIdentityPolicy {
|
|
|
14849
14916
|
if (isIdentityExposingTokenProvider(provider)) {
|
|
14850
14917
|
const identity = await provider.getIdentity();
|
|
14851
14918
|
if (identity && identity.subject) {
|
|
14852
|
-
logger$
|
|
14919
|
+
logger$11.debug('identity_extracted_from_grant', {
|
|
14853
14920
|
identity_id: identity.subject,
|
|
14854
14921
|
grant_type: grant.type,
|
|
14855
14922
|
});
|
|
@@ -14858,7 +14925,7 @@ class DefaultNodeIdentityPolicy {
|
|
|
14858
14925
|
}
|
|
14859
14926
|
}
|
|
14860
14927
|
catch (error) {
|
|
14861
|
-
logger$
|
|
14928
|
+
logger$11.warning('identity_extraction_failed', {
|
|
14862
14929
|
error: error instanceof Error ? error.message : String(error),
|
|
14863
14930
|
grant_type: grant.type,
|
|
14864
14931
|
});
|
|
@@ -14942,7 +15009,7 @@ class AttachmentKeyValidator {
|
|
|
14942
15009
|
}
|
|
14943
15010
|
}
|
|
14944
15011
|
|
|
14945
|
-
const logger
|
|
15012
|
+
const logger$10 = getLogger('naylence.fame.node.admission.default_node_attach_client');
|
|
14946
15013
|
const HANDSHAKE_POLL_INTERVAL_MS = 20;
|
|
14947
15014
|
class DefaultNodeAttachClient {
|
|
14948
15015
|
constructor(options = {}) {
|
|
@@ -14966,7 +15033,7 @@ class DefaultNodeAttachClient {
|
|
|
14966
15033
|
}
|
|
14967
15034
|
else {
|
|
14968
15035
|
// Silently ignore frames from other agents during concurrent handshakes
|
|
14969
|
-
logger
|
|
15036
|
+
logger$10.debug('handshake_ignoring_frame_from_different_system', {
|
|
14970
15037
|
frame_type: envelope.frame.type,
|
|
14971
15038
|
frame_system_id: frameSystemId,
|
|
14972
15039
|
expected_system_id: this.expectedSystemId,
|
|
@@ -15009,7 +15076,7 @@ class DefaultNodeAttachClient {
|
|
|
15009
15076
|
}
|
|
15010
15077
|
}
|
|
15011
15078
|
catch (error) {
|
|
15012
|
-
logger
|
|
15079
|
+
logger$10.debug('stickiness_offer_skipped', {
|
|
15013
15080
|
error: error instanceof Error ? error.message : String(error),
|
|
15014
15081
|
});
|
|
15015
15082
|
}
|
|
@@ -15030,7 +15097,7 @@ class DefaultNodeAttachClient {
|
|
|
15030
15097
|
if (!processedEnvelope) {
|
|
15031
15098
|
throw new Error('Envelope was blocked by onForwardUpstream event');
|
|
15032
15099
|
}
|
|
15033
|
-
logger
|
|
15100
|
+
logger$10.debug('sending_node_attach_envelope', {
|
|
15034
15101
|
envp_id: processedEnvelope.id ?? envelope.id ?? null,
|
|
15035
15102
|
frame_type: processedEnvelope.frame?.type ?? 'unknown',
|
|
15036
15103
|
trace_id: processedEnvelope.traceId ?? envelope.traceId ?? null,
|
|
@@ -15066,7 +15133,7 @@ class DefaultNodeAttachClient {
|
|
|
15066
15133
|
try {
|
|
15067
15134
|
const keyInfos = await this.attachmentKeyValidator.validateKeys(parentKeys);
|
|
15068
15135
|
if (Array.isArray(keyInfos) && keyInfos.length > 0) {
|
|
15069
|
-
logger
|
|
15136
|
+
logger$10.debug('parent_certificate_validation_passed', {
|
|
15070
15137
|
parent_id: parentId,
|
|
15071
15138
|
correlation_id: corrId,
|
|
15072
15139
|
validated_keys: keyInfos.length,
|
|
@@ -15075,7 +15142,7 @@ class DefaultNodeAttachClient {
|
|
|
15075
15142
|
}
|
|
15076
15143
|
catch (error) {
|
|
15077
15144
|
if (error instanceof KeyValidationError) {
|
|
15078
|
-
logger
|
|
15145
|
+
logger$10.error('parent_certificate_validation_failed', {
|
|
15079
15146
|
parent_id: parentId,
|
|
15080
15147
|
correlation_id: corrId,
|
|
15081
15148
|
error_code: error.code,
|
|
@@ -15089,12 +15156,12 @@ class DefaultNodeAttachClient {
|
|
|
15089
15156
|
}
|
|
15090
15157
|
}
|
|
15091
15158
|
else {
|
|
15092
|
-
logger
|
|
15159
|
+
logger$10.debug('parent_certificate_validation_skipped', {
|
|
15093
15160
|
parent_id: parentId,
|
|
15094
15161
|
reason: 'no_validator',
|
|
15095
15162
|
});
|
|
15096
15163
|
}
|
|
15097
|
-
logger
|
|
15164
|
+
logger$10.debug('processing_node_attach_ack', {
|
|
15098
15165
|
parent_id: ackFrame.targetSystemId,
|
|
15099
15166
|
});
|
|
15100
15167
|
this.inHandshake = false;
|
|
@@ -15125,7 +15192,7 @@ class DefaultNodeAttachClient {
|
|
|
15125
15192
|
}
|
|
15126
15193
|
}
|
|
15127
15194
|
catch (error) {
|
|
15128
|
-
logger
|
|
15195
|
+
logger$10.debug('stickiness_accept_skipped', {
|
|
15129
15196
|
error: error instanceof Error ? error.message : String(error),
|
|
15130
15197
|
});
|
|
15131
15198
|
}
|
|
@@ -15179,7 +15246,7 @@ class DefaultNodeAttachClient {
|
|
|
15179
15246
|
// NodeAttach frames during handshake are expected in multi-agent scenarios
|
|
15180
15247
|
// where multiple agents attach concurrently to the same channel
|
|
15181
15248
|
if (envelope.frame.type === 'NodeAttach') {
|
|
15182
|
-
logger
|
|
15249
|
+
logger$10.debug('handshake_ignoring_concurrent_attach', {
|
|
15183
15250
|
frame_type: envelope.frame.type,
|
|
15184
15251
|
frame_system_id: envelope.frame?.systemId ??
|
|
15185
15252
|
'unknown',
|
|
@@ -15187,7 +15254,7 @@ class DefaultNodeAttachClient {
|
|
|
15187
15254
|
}
|
|
15188
15255
|
else {
|
|
15189
15256
|
// Other unexpected frames are still logged as errors
|
|
15190
|
-
logger
|
|
15257
|
+
logger$10.error('unexpected_frame_during_handshake', {
|
|
15191
15258
|
frame_type: envelope.frame.type,
|
|
15192
15259
|
});
|
|
15193
15260
|
}
|
|
@@ -15322,7 +15389,7 @@ class TraceEmitterFactory extends AbstractResourceFactory {
|
|
|
15322
15389
|
// void import('./trace-emitter-profile-factory.js');
|
|
15323
15390
|
|
|
15324
15391
|
const BINDING_STORE_NAMESPACE = '__binding_store';
|
|
15325
|
-
const logger
|
|
15392
|
+
const logger$$ = getLogger('naylence.fame.node.factory_commons');
|
|
15326
15393
|
function isPlainRecord$2(value) {
|
|
15327
15394
|
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
15328
15395
|
}
|
|
@@ -15429,6 +15496,7 @@ async function makeCommonOptions(config, rawConfig) {
|
|
|
15429
15496
|
const telemetryConfig = pickOption$1(config.telemetry ?? null, aliasRecord, 'trace_emitter', 'telemetry_config');
|
|
15430
15497
|
const securityConfig = pickOption$1(config.security ?? null, aliasRecord, 'security_manager', 'security_profile');
|
|
15431
15498
|
const identityPolicyConfig = pickOption$1(config.identityPolicy ?? null, aliasRecord, 'identity_policy', 'node_identity_policy');
|
|
15499
|
+
const connectionRetryPolicyConfig = pickOption$1(config.connectionRetryPolicy ?? null, aliasRecord, 'connection_retry_policy', 'retry_policy');
|
|
15432
15500
|
const publicUrl = pickString$2(config.publicUrl ?? null, aliasRecord, 'public_url') ?? null;
|
|
15433
15501
|
const directParentUrl = pickString$2(config.directParentUrl ?? null, aliasRecord, 'direct_parent_url') ?? null;
|
|
15434
15502
|
const hasParentFlag = config.hasParent || Boolean(aliasRecord.has_parent ?? false);
|
|
@@ -15438,6 +15506,7 @@ async function makeCommonOptions(config, rawConfig) {
|
|
|
15438
15506
|
const nodeMetaStore = await storageProvider.getKeyValueStore(NodeMetaRecord, NODE_META_NAMESPACE);
|
|
15439
15507
|
const nodeMeta = await nodeMetaStore.get('self');
|
|
15440
15508
|
const identityPolicy = await resolveNodeIdentityPolicy(identityPolicyConfig ?? null, expressionOptions);
|
|
15509
|
+
const connectionRetryPolicy = await resolveConnectionRetryPolicy(connectionRetryPolicyConfig ?? null, expressionOptions);
|
|
15441
15510
|
const admissionClient = await resolveAdmissionClient(admissionConfig ?? null, expressionOptions, identityPolicy ?? undefined);
|
|
15442
15511
|
const hasParent = determineHasParent(hasParentFlag, directParentUrl, admissionClient);
|
|
15443
15512
|
const replicaStickinessManager = await resolveReplicaStickinessManager(hasParent, requestedLogicals, expressionOptions);
|
|
@@ -15506,6 +15575,7 @@ async function makeCommonOptions(config, rawConfig) {
|
|
|
15506
15575
|
transportListeners,
|
|
15507
15576
|
traceEmitter,
|
|
15508
15577
|
identityPolicy: identityPolicy ?? undefined,
|
|
15578
|
+
connectionRetryPolicy: connectionRetryPolicy ?? undefined,
|
|
15509
15579
|
};
|
|
15510
15580
|
}
|
|
15511
15581
|
async function resolveNodeIdentityPolicy(config, options) {
|
|
@@ -15513,7 +15583,18 @@ async function resolveNodeIdentityPolicy(config, options) {
|
|
|
15513
15583
|
return await NodeIdentityPolicyFactory.createNodeIdentityPolicy(config ?? undefined, cloneCreateOptions(options));
|
|
15514
15584
|
}
|
|
15515
15585
|
catch (error) {
|
|
15516
|
-
logger
|
|
15586
|
+
logger$$.warning('node_identity_policy_creation_failed', {
|
|
15587
|
+
error: error instanceof Error ? error.message : String(error),
|
|
15588
|
+
});
|
|
15589
|
+
return null;
|
|
15590
|
+
}
|
|
15591
|
+
}
|
|
15592
|
+
async function resolveConnectionRetryPolicy(config, options) {
|
|
15593
|
+
try {
|
|
15594
|
+
return await ConnectionRetryPolicyFactory.createConnectionRetryPolicy(config ?? undefined, cloneCreateOptions(options));
|
|
15595
|
+
}
|
|
15596
|
+
catch (error) {
|
|
15597
|
+
logger$$.warning('connection_retry_policy_creation_failed', {
|
|
15517
15598
|
error: error instanceof Error ? error.message : String(error),
|
|
15518
15599
|
});
|
|
15519
15600
|
return null;
|
|
@@ -15525,7 +15606,7 @@ async function resolveStorageProvider(config, options) {
|
|
|
15525
15606
|
return await StorageProviderFactory.createStorageProvider(config, cloneCreateOptions(options));
|
|
15526
15607
|
}
|
|
15527
15608
|
catch (error) {
|
|
15528
|
-
logger
|
|
15609
|
+
logger$$.warning('storage_provider_creation_failed', {
|
|
15529
15610
|
error: error instanceof Error ? error.message : String(error),
|
|
15530
15611
|
});
|
|
15531
15612
|
}
|
|
@@ -15547,7 +15628,7 @@ async function resolveAdmissionClient(config, options, identityPolicy) {
|
|
|
15547
15628
|
return await AdmissionClientFactory.createAdmissionClient((config ?? null), createOptions);
|
|
15548
15629
|
}
|
|
15549
15630
|
catch (error) {
|
|
15550
|
-
logger
|
|
15631
|
+
logger$$.warning('admission_client_creation_failed', {
|
|
15551
15632
|
error: error instanceof Error ? error.message : String(error),
|
|
15552
15633
|
});
|
|
15553
15634
|
return null;
|
|
@@ -15574,7 +15655,7 @@ async function resolveReplicaStickinessManager(hasParent, requestedLogicals, opt
|
|
|
15574
15655
|
return await ReplicaStickinessManagerFactory.createReplicaStickinessManager(undefined, cloneCreateOptions(options));
|
|
15575
15656
|
}
|
|
15576
15657
|
catch (error) {
|
|
15577
|
-
logger
|
|
15658
|
+
logger$$.debug('replica_stickiness_manager_unavailable', { error });
|
|
15578
15659
|
return null;
|
|
15579
15660
|
}
|
|
15580
15661
|
}
|
|
@@ -15583,7 +15664,7 @@ async function resolveAttachmentKeyValidator(config, options) {
|
|
|
15583
15664
|
return await AttachmentKeyValidatorFactory.createAttachmentKeyValidator(config ?? undefined, cloneCreateOptions(options));
|
|
15584
15665
|
}
|
|
15585
15666
|
catch (error) {
|
|
15586
|
-
logger
|
|
15667
|
+
logger$$.warning('attachment_key_validator_creation_failed', {
|
|
15587
15668
|
error: error instanceof Error ? error.message : String(error),
|
|
15588
15669
|
});
|
|
15589
15670
|
return null;
|
|
@@ -15601,7 +15682,7 @@ async function resolveDeliveryPolicy(config, options) {
|
|
|
15601
15682
|
return await DeliveryPolicyFactory.createDeliveryPolicy(config ?? undefined, cloneCreateOptions(options));
|
|
15602
15683
|
}
|
|
15603
15684
|
catch (error) {
|
|
15604
|
-
logger
|
|
15685
|
+
logger$$.warning('delivery_policy_creation_failed', {
|
|
15605
15686
|
error: error instanceof Error ? error.message : String(error),
|
|
15606
15687
|
});
|
|
15607
15688
|
return null;
|
|
@@ -15615,7 +15696,7 @@ async function resolveTransportListeners(configs, eventListeners, options) {
|
|
|
15615
15696
|
return await TransportListenerFactory.createTransportListeners(configs, eventListeners, cloneCreateOptions(options));
|
|
15616
15697
|
}
|
|
15617
15698
|
catch (error) {
|
|
15618
|
-
logger
|
|
15699
|
+
logger$$.warning('transport_listener_creation_failed', {
|
|
15619
15700
|
error: error instanceof Error ? error.message : String(error),
|
|
15620
15701
|
});
|
|
15621
15702
|
return [];
|
|
@@ -15626,7 +15707,7 @@ async function resolveTraceEmitter(config, options) {
|
|
|
15626
15707
|
return await TraceEmitterFactory.createTraceEmitter(config ?? undefined, cloneCreateOptions(options));
|
|
15627
15708
|
}
|
|
15628
15709
|
catch (error) {
|
|
15629
|
-
logger
|
|
15710
|
+
logger$$.warning('trace_emitter_creation_failed', {
|
|
15630
15711
|
error: error instanceof Error ? error.message : String(error),
|
|
15631
15712
|
});
|
|
15632
15713
|
return null;
|
|
@@ -15682,7 +15763,7 @@ async function createSecurityManagerFromConfig(config, overrides, options) {
|
|
|
15682
15763
|
return manager ?? null;
|
|
15683
15764
|
}
|
|
15684
15765
|
catch (error) {
|
|
15685
|
-
logger
|
|
15766
|
+
logger$$.warning('security_manager_creation_failed', {
|
|
15686
15767
|
error: error instanceof Error ? error.message : String(error),
|
|
15687
15768
|
});
|
|
15688
15769
|
return null;
|
|
@@ -15711,7 +15792,7 @@ async function resolveCryptoProvider(config, options) {
|
|
|
15711
15792
|
// This happens with overlay security profiles that need envelope signing
|
|
15712
15793
|
if (requiresCryptoProvider(config)) {
|
|
15713
15794
|
try {
|
|
15714
|
-
logger
|
|
15795
|
+
logger$$.debug('auto_creating_crypto_provider', {
|
|
15715
15796
|
reason: 'overlay_security_requires_signing',
|
|
15716
15797
|
});
|
|
15717
15798
|
// Dynamically import to avoid circular dependencies
|
|
@@ -15731,7 +15812,7 @@ async function resolveCryptoProvider(config, options) {
|
|
|
15731
15812
|
});
|
|
15732
15813
|
}
|
|
15733
15814
|
catch (error) {
|
|
15734
|
-
logger
|
|
15815
|
+
logger$$.error('failed_to_auto_create_crypto_provider', {
|
|
15735
15816
|
error: error instanceof Error ? error.message : String(error),
|
|
15736
15817
|
});
|
|
15737
15818
|
throw error;
|
|
@@ -16282,7 +16363,7 @@ class NodeLikeFactory extends AbstractResourceFactory {
|
|
|
16282
16363
|
// registerFactory(NODE_LIKE_FACTORY_BASE_TYPE, type, factory);
|
|
16283
16364
|
// }
|
|
16284
16365
|
|
|
16285
|
-
const FACTORY_META$
|
|
16366
|
+
const FACTORY_META$17 = {
|
|
16286
16367
|
base: NODE_LIKE_FACTORY_BASE_TYPE,
|
|
16287
16368
|
key: 'Node',
|
|
16288
16369
|
};
|
|
@@ -16316,6 +16397,7 @@ class NodeFactory extends NodeLikeFactory {
|
|
|
16316
16397
|
nodeMetaStore: components.nodeMetaStore,
|
|
16317
16398
|
transportListeners: components.transportListeners,
|
|
16318
16399
|
defaultServiceConfigs: serviceConfigs,
|
|
16400
|
+
connectionRetryPolicy: components.connectionRetryPolicy,
|
|
16319
16401
|
});
|
|
16320
16402
|
return node;
|
|
16321
16403
|
}
|
|
@@ -16323,7 +16405,7 @@ class NodeFactory extends NodeLikeFactory {
|
|
|
16323
16405
|
|
|
16324
16406
|
var nodeFactory = /*#__PURE__*/Object.freeze({
|
|
16325
16407
|
__proto__: null,
|
|
16326
|
-
FACTORY_META: FACTORY_META$
|
|
16408
|
+
FACTORY_META: FACTORY_META$17,
|
|
16327
16409
|
NodeFactory: NodeFactory,
|
|
16328
16410
|
default: NodeFactory
|
|
16329
16411
|
});
|
|
@@ -16896,7 +16978,7 @@ function normalizeSecurityRequirements(value) {
|
|
|
16896
16978
|
};
|
|
16897
16979
|
}
|
|
16898
16980
|
|
|
16899
|
-
const logger$
|
|
16981
|
+
const logger$_ = getLogger('naylence.fame.node.envelope_security_handler');
|
|
16900
16982
|
const ENCRYPTION_OPTION_ALIAS_PAIRS = [
|
|
16901
16983
|
['recipKid', 'recip_kid'],
|
|
16902
16984
|
['recipientKeyId', 'recipient_key_id'],
|
|
@@ -16945,7 +17027,7 @@ class EnvelopeSecurityHandler {
|
|
|
16945
17027
|
const shouldSign = this.securityPolicy
|
|
16946
17028
|
? await this.securityPolicy.shouldSignEnvelope(envelope, context, this.node)
|
|
16947
17029
|
: false;
|
|
16948
|
-
logger$
|
|
17030
|
+
logger$_.debug('checking_signing', {
|
|
16949
17031
|
has_signer: Boolean(this.envelopeSigner),
|
|
16950
17032
|
should_sign: shouldSign,
|
|
16951
17033
|
envp_id: envelope.id,
|
|
@@ -16967,7 +17049,7 @@ class EnvelopeSecurityHandler {
|
|
|
16967
17049
|
const shouldEncrypt = this.securityPolicy
|
|
16968
17050
|
? await this.securityPolicy.shouldEncryptEnvelope(envelope, context, this.node)
|
|
16969
17051
|
: false;
|
|
16970
|
-
logger$
|
|
17052
|
+
logger$_.debug('checking_encryption', {
|
|
16971
17053
|
has_encryption_manager: Boolean(this.encryptionManager),
|
|
16972
17054
|
should_encrypt: shouldEncrypt,
|
|
16973
17055
|
envp_id: envelope.id,
|
|
@@ -16975,7 +17057,7 @@ class EnvelopeSecurityHandler {
|
|
|
16975
17057
|
});
|
|
16976
17058
|
if (this.encryptionManager && this.securityPolicy) {
|
|
16977
17059
|
if (envelope.sec?.enc) {
|
|
16978
|
-
logger$
|
|
17060
|
+
logger$_.debug('skipping_encryption_already_encrypted', {
|
|
16979
17061
|
envp_id: envelope.id,
|
|
16980
17062
|
destination: envelope.to ? String(envelope.to) : undefined,
|
|
16981
17063
|
});
|
|
@@ -16988,7 +17070,7 @@ class EnvelopeSecurityHandler {
|
|
|
16988
17070
|
CryptoLevel.PLAINTEXT;
|
|
16989
17071
|
desiredCryptoLevel =
|
|
16990
17072
|
await this.securityPolicy.decideResponseCryptoLevel(requestCryptoLevel, envelope, context);
|
|
16991
|
-
logger$
|
|
17073
|
+
logger$_.debug('response_crypto_level_decided', {
|
|
16992
17074
|
envp_id: envelope.id,
|
|
16993
17075
|
crypto_level: desiredCryptoLevel,
|
|
16994
17076
|
destination: envelope.to ? String(envelope.to) : undefined,
|
|
@@ -16999,7 +17081,7 @@ class EnvelopeSecurityHandler {
|
|
|
16999
17081
|
else {
|
|
17000
17082
|
desiredCryptoLevel =
|
|
17001
17083
|
await this.securityPolicy.decideOutboundCryptoLevel(envelope, context, this.node);
|
|
17002
|
-
logger$
|
|
17084
|
+
logger$_.debug('outbound_crypto_level_decided', {
|
|
17003
17085
|
envp_id: envelope.id,
|
|
17004
17086
|
frame_type: envelope.frame.type,
|
|
17005
17087
|
crypto_level: desiredCryptoLevel,
|
|
@@ -17007,11 +17089,11 @@ class EnvelopeSecurityHandler {
|
|
|
17007
17089
|
});
|
|
17008
17090
|
}
|
|
17009
17091
|
if (desiredCryptoLevel === CryptoLevel.SEALED) {
|
|
17010
|
-
logger$
|
|
17092
|
+
logger$_.debug('applying_sealed_encryption', { envp_id: envelope.id });
|
|
17011
17093
|
return await this.handleSealedEncryption(envelope, context);
|
|
17012
17094
|
}
|
|
17013
17095
|
if (desiredCryptoLevel === CryptoLevel.CHANNEL) {
|
|
17014
|
-
logger$
|
|
17096
|
+
logger$_.debug('applying_channel_encryption', { envp_id: envelope.id });
|
|
17015
17097
|
return await this.handleChannelEncryption(envelope, context);
|
|
17016
17098
|
}
|
|
17017
17099
|
}
|
|
@@ -17062,7 +17144,7 @@ class EnvelopeSecurityHandler {
|
|
|
17062
17144
|
frameType === 'KeyAnnounce' ||
|
|
17063
17145
|
frameType === 'SecureOpen' ||
|
|
17064
17146
|
frameType === 'SecureAccept') {
|
|
17065
|
-
logger$
|
|
17147
|
+
logger$_.error('critical_frame_unsigned_rejected', {
|
|
17066
17148
|
envp_id: envelope.id,
|
|
17067
17149
|
frame_type: frameType,
|
|
17068
17150
|
reason: 'critical_frames_must_be_signed',
|
|
@@ -17070,7 +17152,7 @@ class EnvelopeSecurityHandler {
|
|
|
17070
17152
|
return [envelope, false];
|
|
17071
17153
|
}
|
|
17072
17154
|
const action = this.securityPolicy.getUnsignedViolationAction(envelope, context);
|
|
17073
|
-
logger$
|
|
17155
|
+
logger$_.warning('unsigned_envelope_violation', {
|
|
17074
17156
|
envp_id: envelope.id,
|
|
17075
17157
|
frame_type: frameType,
|
|
17076
17158
|
action,
|
|
@@ -17082,26 +17164,26 @@ class EnvelopeSecurityHandler {
|
|
|
17082
17164
|
return [envelope, true];
|
|
17083
17165
|
}
|
|
17084
17166
|
async handleChannelHandshakeComplete(channelId, destination) {
|
|
17085
|
-
logger$
|
|
17167
|
+
logger$_.debug('channel_handshake_completed', {
|
|
17086
17168
|
channel_id: channelId,
|
|
17087
17169
|
destination,
|
|
17088
17170
|
});
|
|
17089
17171
|
if (this.encryptionManager?.notifyChannelEstablished) {
|
|
17090
17172
|
await this.encryptionManager.notifyChannelEstablished(channelId);
|
|
17091
|
-
logger$
|
|
17173
|
+
logger$_.debug('notified_encryption_manager_channel_ready', {
|
|
17092
17174
|
channel_id: channelId,
|
|
17093
17175
|
});
|
|
17094
17176
|
}
|
|
17095
17177
|
}
|
|
17096
17178
|
async handleChannelHandshakeFailed(channelId, destination, reason = 'handshake_failed') {
|
|
17097
|
-
logger$
|
|
17179
|
+
logger$_.debug('channel_handshake_failed', {
|
|
17098
17180
|
channel_id: channelId,
|
|
17099
17181
|
destination,
|
|
17100
17182
|
reason,
|
|
17101
17183
|
});
|
|
17102
17184
|
if (this.encryptionManager?.notifyChannelFailed) {
|
|
17103
17185
|
await this.encryptionManager.notifyChannelFailed(channelId, reason);
|
|
17104
|
-
logger$
|
|
17186
|
+
logger$_.debug('notified_encryption_manager_channel_failed', {
|
|
17105
17187
|
channel_id: channelId,
|
|
17106
17188
|
reason,
|
|
17107
17189
|
});
|
|
@@ -17148,7 +17230,7 @@ class EnvelopeSecurityHandler {
|
|
|
17148
17230
|
checkPayload: false,
|
|
17149
17231
|
});
|
|
17150
17232
|
if (verified) {
|
|
17151
|
-
logger$
|
|
17233
|
+
logger$_.debug('envelope_verified', {
|
|
17152
17234
|
envp_id: envelope.id,
|
|
17153
17235
|
sid: envelope.sid,
|
|
17154
17236
|
kid,
|
|
@@ -17159,7 +17241,7 @@ class EnvelopeSecurityHandler {
|
|
|
17159
17241
|
}
|
|
17160
17242
|
this.keyManagementHandler.queuePendingSignedEnvelope(kid, envelope, context);
|
|
17161
17243
|
await this.keyManagementHandler.maybeRequestSigningKey(kid, context.originType, fromSystemId);
|
|
17162
|
-
logger$
|
|
17244
|
+
logger$_.debug('queued_envelope_missing_signing_key', {
|
|
17163
17245
|
kid,
|
|
17164
17246
|
envp_id: envelope.id,
|
|
17165
17247
|
});
|
|
@@ -17167,7 +17249,7 @@ class EnvelopeSecurityHandler {
|
|
|
17167
17249
|
}
|
|
17168
17250
|
async handleSealedEncryption(envelope, context) {
|
|
17169
17251
|
if (!envelope.to) {
|
|
17170
|
-
logger$
|
|
17252
|
+
logger$_.warning('sealed_encryption_requested_but_no_destination', {
|
|
17171
17253
|
envp_id: envelope.id,
|
|
17172
17254
|
});
|
|
17173
17255
|
return true;
|
|
@@ -17179,20 +17261,20 @@ class EnvelopeSecurityHandler {
|
|
|
17179
17261
|
: undefined;
|
|
17180
17262
|
if (options) {
|
|
17181
17263
|
if (options.encryptionType === 'channel') {
|
|
17182
|
-
logger$
|
|
17264
|
+
logger$_.warning('policy_returned_channel_for_sealed_request', {
|
|
17183
17265
|
envp_id: envelope.id,
|
|
17184
17266
|
});
|
|
17185
17267
|
return await this.handleToBeEncryptedEnvelopeWithOptions(envelope, context, normalizeEncryptionOptions({
|
|
17186
17268
|
requestAddress: envelope.to,
|
|
17187
17269
|
}));
|
|
17188
17270
|
}
|
|
17189
|
-
logger$
|
|
17271
|
+
logger$_.debug('using_sealed_encryption_options', {
|
|
17190
17272
|
envp_id: envelope.id,
|
|
17191
17273
|
options,
|
|
17192
17274
|
});
|
|
17193
17275
|
return await this.handleToBeEncryptedEnvelopeWithOptions(envelope, context, options);
|
|
17194
17276
|
}
|
|
17195
|
-
logger$
|
|
17277
|
+
logger$_.debug('no_encryption_options_requesting_key', {
|
|
17196
17278
|
envp_id: envelope.id,
|
|
17197
17279
|
});
|
|
17198
17280
|
return await this.handleToBeEncryptedEnvelopeWithOptions(envelope, context, normalizeEncryptionOptions({
|
|
@@ -17200,7 +17282,7 @@ class EnvelopeSecurityHandler {
|
|
|
17200
17282
|
}));
|
|
17201
17283
|
}
|
|
17202
17284
|
catch (error) {
|
|
17203
|
-
logger$
|
|
17285
|
+
logger$_.debug('sealed_key_lookup_failed_requesting', {
|
|
17204
17286
|
envp_id: envelope.id,
|
|
17205
17287
|
error: error instanceof Error ? error.message : String(error),
|
|
17206
17288
|
});
|
|
@@ -17211,7 +17293,7 @@ class EnvelopeSecurityHandler {
|
|
|
17211
17293
|
}
|
|
17212
17294
|
async handleChannelEncryption(envelope, context) {
|
|
17213
17295
|
if (!envelope.to) {
|
|
17214
|
-
logger$
|
|
17296
|
+
logger$_.warning('channel_encryption_requested_but_no_destination', {
|
|
17215
17297
|
envp_id: envelope.id,
|
|
17216
17298
|
});
|
|
17217
17299
|
return true;
|
|
@@ -17226,13 +17308,13 @@ class EnvelopeSecurityHandler {
|
|
|
17226
17308
|
return true;
|
|
17227
17309
|
}
|
|
17228
17310
|
if (context.originType !== DeliveryOriginType.LOCAL) {
|
|
17229
|
-
logger$
|
|
17311
|
+
logger$_.warning('envelope_encryption_rejected_non_local', {
|
|
17230
17312
|
origin: context.originType,
|
|
17231
17313
|
});
|
|
17232
17314
|
return true;
|
|
17233
17315
|
}
|
|
17234
17316
|
if (!isDataFrame$4(envelope.frame)) {
|
|
17235
|
-
logger$
|
|
17317
|
+
logger$_.trace('skipping_encryption_non_dataframe', {
|
|
17236
17318
|
envp_id: envelope.id,
|
|
17237
17319
|
frame_type: envelope.frame.type,
|
|
17238
17320
|
});
|
|
@@ -17243,7 +17325,7 @@ class EnvelopeSecurityHandler {
|
|
|
17243
17325
|
? normalizeEncryptionOptions(rawOptions)
|
|
17244
17326
|
: undefined;
|
|
17245
17327
|
if (!options) {
|
|
17246
|
-
logger$
|
|
17328
|
+
logger$_.warning('no_encryption_options_provided', {
|
|
17247
17329
|
envp_id: envelope.id,
|
|
17248
17330
|
});
|
|
17249
17331
|
return true;
|
|
@@ -17255,13 +17337,13 @@ class EnvelopeSecurityHandler {
|
|
|
17255
17337
|
return true;
|
|
17256
17338
|
}
|
|
17257
17339
|
if (context.originType !== DeliveryOriginType.LOCAL) {
|
|
17258
|
-
logger$
|
|
17340
|
+
logger$_.warning('envelope_encryption_rejected_non_local', {
|
|
17259
17341
|
origin: context.originType,
|
|
17260
17342
|
});
|
|
17261
17343
|
return true;
|
|
17262
17344
|
}
|
|
17263
17345
|
if (!isDataFrame$4(envelope.frame)) {
|
|
17264
|
-
logger$
|
|
17346
|
+
logger$_.trace('skipping_encryption_non_dataframe', {
|
|
17265
17347
|
envp_id: envelope.id,
|
|
17266
17348
|
frame_type: envelope.frame.type,
|
|
17267
17349
|
});
|
|
@@ -17278,7 +17360,7 @@ class EnvelopeSecurityHandler {
|
|
|
17278
17360
|
// Skip encryption if envelope is already encrypted
|
|
17279
17361
|
// This prevents re-queuing when replayed envelopes go through security again
|
|
17280
17362
|
if (envelope.sec?.enc) {
|
|
17281
|
-
logger$
|
|
17363
|
+
logger$_.debug('skipping_encryption_already_encrypted', {
|
|
17282
17364
|
envp_id: envelope.id,
|
|
17283
17365
|
destination: envelope.to ? String(envelope.to) : undefined,
|
|
17284
17366
|
});
|
|
@@ -17287,14 +17369,14 @@ class EnvelopeSecurityHandler {
|
|
|
17287
17369
|
try {
|
|
17288
17370
|
const result = await this.encryptionManager.encryptEnvelope(envelope, normalizedOptions);
|
|
17289
17371
|
if (result.status === EncryptionStatus.QUEUED) {
|
|
17290
|
-
logger$
|
|
17372
|
+
logger$_.debug('envelope_queued_for_encryption', {
|
|
17291
17373
|
envp_id: envelope.id,
|
|
17292
17374
|
});
|
|
17293
17375
|
await this.handleEncryptionQueueing(envelope, context, normalizedOptions);
|
|
17294
17376
|
return false;
|
|
17295
17377
|
}
|
|
17296
17378
|
if (result.status === EncryptionStatus.OK) {
|
|
17297
|
-
logger$
|
|
17379
|
+
logger$_.debug('envelope_encrypted', { envp_id: envelope.id });
|
|
17298
17380
|
if (result.envelope) {
|
|
17299
17381
|
envelope.frame = result.envelope.frame;
|
|
17300
17382
|
envelope.sec = result.envelope.sec;
|
|
@@ -17302,17 +17384,17 @@ class EnvelopeSecurityHandler {
|
|
|
17302
17384
|
return true;
|
|
17303
17385
|
}
|
|
17304
17386
|
if (result.status === EncryptionStatus.SKIPPED) {
|
|
17305
|
-
logger$
|
|
17387
|
+
logger$_.debug('envelope_encryption_skipped', { envp_id: envelope.id });
|
|
17306
17388
|
return true;
|
|
17307
17389
|
}
|
|
17308
|
-
logger$
|
|
17390
|
+
logger$_.warning('unknown_encryption_status', {
|
|
17309
17391
|
envp_id: envelope.id,
|
|
17310
17392
|
status: result.status,
|
|
17311
17393
|
});
|
|
17312
17394
|
return true;
|
|
17313
17395
|
}
|
|
17314
17396
|
catch (error) {
|
|
17315
|
-
logger$
|
|
17397
|
+
logger$_.error('encryption_failed', {
|
|
17316
17398
|
envp_id: envelope.id,
|
|
17317
17399
|
error: error instanceof Error ? error.message : String(error),
|
|
17318
17400
|
});
|
|
@@ -17351,7 +17433,7 @@ class EnvelopeSecurityHandler {
|
|
|
17351
17433
|
return;
|
|
17352
17434
|
}
|
|
17353
17435
|
if (normalizedOptions.encryptionType === 'channel') {
|
|
17354
|
-
logger$
|
|
17436
|
+
logger$_.debug('channel_encryption_queueing_handled_internally', {
|
|
17355
17437
|
envp_id: envelope.id,
|
|
17356
17438
|
destination: normalizedOptions.destination
|
|
17357
17439
|
? String(normalizedOptions.destination)
|
|
@@ -17359,13 +17441,13 @@ class EnvelopeSecurityHandler {
|
|
|
17359
17441
|
});
|
|
17360
17442
|
return;
|
|
17361
17443
|
}
|
|
17362
|
-
logger$
|
|
17444
|
+
logger$_.warning('unknown_encryption_queueing_options', {
|
|
17363
17445
|
envp_id: envelope.id,
|
|
17364
17446
|
options: normalizedOptions,
|
|
17365
17447
|
});
|
|
17366
17448
|
}
|
|
17367
17449
|
async handleFailedChannelEnvelopeCleanup(destination, reason) {
|
|
17368
|
-
logger$
|
|
17450
|
+
logger$_.debug('channel_handshake_failure_cleanup_attempted', {
|
|
17369
17451
|
destination,
|
|
17370
17452
|
reason,
|
|
17371
17453
|
note: 'envelope_cleanup_handled_by_encryption_manager',
|
|
@@ -17376,7 +17458,7 @@ class EnvelopeSecurityHandler {
|
|
|
17376
17458
|
}
|
|
17377
17459
|
}
|
|
17378
17460
|
|
|
17379
|
-
const logger$
|
|
17461
|
+
const logger$Z = getLogger('naylence.fame.node.secure_channel_frame_handler');
|
|
17380
17462
|
function isPlainRecord$1(value) {
|
|
17381
17463
|
if (typeof value !== 'object' || value === null) {
|
|
17382
17464
|
return false;
|
|
@@ -17466,7 +17548,7 @@ class SecureChannelFrameHandler {
|
|
|
17466
17548
|
assertSecureChannelManager(this.secureChannelManager);
|
|
17467
17549
|
const frame = envelope.frame;
|
|
17468
17550
|
assertFrameType(frame, 'SecureOpen');
|
|
17469
|
-
logger$
|
|
17551
|
+
logger$Z.debug('received_secure_open', {
|
|
17470
17552
|
cid: frame.cid,
|
|
17471
17553
|
algorithm: frame.alg,
|
|
17472
17554
|
});
|
|
@@ -17489,13 +17571,13 @@ class SecureChannelFrameHandler {
|
|
|
17489
17571
|
stickySid: envelope.sid ?? undefined,
|
|
17490
17572
|
expectedResponseType: FameResponseType.NONE,
|
|
17491
17573
|
};
|
|
17492
|
-
logger$
|
|
17574
|
+
logger$Z.debug('stickiness_requested_for_channel_encryption', {
|
|
17493
17575
|
cid: frame.cid,
|
|
17494
17576
|
reason: 'secure_channel_established',
|
|
17495
17577
|
});
|
|
17496
17578
|
}
|
|
17497
17579
|
await this.sendCallback(responseEnvelope, responseContext);
|
|
17498
|
-
logger$
|
|
17580
|
+
logger$Z.debug('sent_secure_accept', { cid: frame.cid, ok: acceptFrame.ok });
|
|
17499
17581
|
if (acceptFrame.ok && this.envelopeSecurityHandler) {
|
|
17500
17582
|
const destination = extractDestinationFromChannelId(frame.cid);
|
|
17501
17583
|
if (destination) {
|
|
@@ -17507,13 +17589,13 @@ class SecureChannelFrameHandler {
|
|
|
17507
17589
|
assertSecureChannelManager(this.secureChannelManager);
|
|
17508
17590
|
const frame = envelope.frame;
|
|
17509
17591
|
assertFrameType(frame, 'SecureAccept');
|
|
17510
|
-
logger$
|
|
17592
|
+
logger$Z.debug('received_secure_accept', { cid: frame.cid, ok: frame.ok });
|
|
17511
17593
|
const success = await this.secureChannelManager.handleAcceptFrame(frame);
|
|
17512
17594
|
if (!success) {
|
|
17513
|
-
logger$
|
|
17595
|
+
logger$Z.warning('failed_to_complete_channel', { cid: frame.cid });
|
|
17514
17596
|
}
|
|
17515
17597
|
else {
|
|
17516
|
-
logger$
|
|
17598
|
+
logger$Z.debug('channel_established', { cid: frame.cid });
|
|
17517
17599
|
if (this.envelopeSecurityHandler) {
|
|
17518
17600
|
const destination = extractDestinationFromChannelId(frame.cid);
|
|
17519
17601
|
if (destination) {
|
|
@@ -17525,7 +17607,7 @@ class SecureChannelFrameHandler {
|
|
|
17525
17607
|
const destination = extractDestinationFromChannelId(frame.cid);
|
|
17526
17608
|
if (destination) {
|
|
17527
17609
|
await this.envelopeSecurityHandler.handleChannelHandshakeFailed(frame.cid, destination, 'negative_secure_accept');
|
|
17528
|
-
logger$
|
|
17610
|
+
logger$Z.debug('notified_handshake_failure', {
|
|
17529
17611
|
cid: frame.cid,
|
|
17530
17612
|
destination,
|
|
17531
17613
|
});
|
|
@@ -17536,7 +17618,7 @@ class SecureChannelFrameHandler {
|
|
|
17536
17618
|
assertSecureChannelManager(this.secureChannelManager);
|
|
17537
17619
|
const frame = envelope.frame;
|
|
17538
17620
|
assertFrameType(frame, 'SecureClose');
|
|
17539
|
-
logger$
|
|
17621
|
+
logger$Z.debug('received_secure_close', {
|
|
17540
17622
|
cid: frame.cid,
|
|
17541
17623
|
reason: frame.reason,
|
|
17542
17624
|
});
|
|
@@ -17594,7 +17676,7 @@ function createNodeDeliveryContext(options = {}) {
|
|
|
17594
17676
|
class FameEnvironmentContext {
|
|
17595
17677
|
}
|
|
17596
17678
|
|
|
17597
|
-
const FACTORY_META$
|
|
17679
|
+
const FACTORY_META$16 = {
|
|
17598
17680
|
base: NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE,
|
|
17599
17681
|
key: 'DefaultNodeIdentityPolicy',
|
|
17600
17682
|
};
|
|
@@ -17612,11 +17694,11 @@ class DefaultNodeIdentityPolicyFactory extends NodeIdentityPolicyFactory {
|
|
|
17612
17694
|
var defaultNodeIdentityPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
17613
17695
|
__proto__: null,
|
|
17614
17696
|
DefaultNodeIdentityPolicyFactory: DefaultNodeIdentityPolicyFactory,
|
|
17615
|
-
FACTORY_META: FACTORY_META$
|
|
17697
|
+
FACTORY_META: FACTORY_META$16,
|
|
17616
17698
|
default: DefaultNodeIdentityPolicyFactory
|
|
17617
17699
|
});
|
|
17618
17700
|
|
|
17619
|
-
const logger$
|
|
17701
|
+
const logger$Y = getLogger('naylence.fame.node.token_subject_node_identity_policy');
|
|
17620
17702
|
class TokenSubjectNodeIdentityPolicy {
|
|
17621
17703
|
async resolveInitialNodeId(context) {
|
|
17622
17704
|
if (context.configuredId) {
|
|
@@ -17628,7 +17710,7 @@ class TokenSubjectNodeIdentityPolicy {
|
|
|
17628
17710
|
return generateIdAsync();
|
|
17629
17711
|
}
|
|
17630
17712
|
async resolveAdmissionNodeId(context) {
|
|
17631
|
-
logger$
|
|
17713
|
+
logger$Y.debug('resolve_admission_node_id_start', {
|
|
17632
17714
|
grantsCount: context.grants?.length ?? 0,
|
|
17633
17715
|
currentNodeId: context.currentNodeId,
|
|
17634
17716
|
});
|
|
@@ -17637,31 +17719,31 @@ class TokenSubjectNodeIdentityPolicy {
|
|
|
17637
17719
|
try {
|
|
17638
17720
|
const auth = grant.auth;
|
|
17639
17721
|
if (!auth) {
|
|
17640
|
-
logger$
|
|
17722
|
+
logger$Y.debug('skipping_grant_no_auth', { grantType: grant.type });
|
|
17641
17723
|
continue;
|
|
17642
17724
|
}
|
|
17643
17725
|
const tokenProviderConfig = (auth.tokenProvider ??
|
|
17644
17726
|
auth.token_provider);
|
|
17645
17727
|
if (!tokenProviderConfig ||
|
|
17646
17728
|
typeof tokenProviderConfig.type !== 'string') {
|
|
17647
|
-
logger$
|
|
17729
|
+
logger$Y.debug('skipping_grant_invalid_token_provider_config', {
|
|
17648
17730
|
grantType: grant.type,
|
|
17649
17731
|
config: tokenProviderConfig,
|
|
17650
17732
|
});
|
|
17651
17733
|
continue;
|
|
17652
17734
|
}
|
|
17653
|
-
logger$
|
|
17735
|
+
logger$Y.debug('creating_token_provider', {
|
|
17654
17736
|
type: tokenProviderConfig.type,
|
|
17655
17737
|
});
|
|
17656
17738
|
const provider = await TokenProviderFactory.createTokenProvider(tokenProviderConfig);
|
|
17657
17739
|
const isExposing = isIdentityExposingTokenProvider(provider);
|
|
17658
|
-
logger$
|
|
17740
|
+
logger$Y.debug('token_provider_created', {
|
|
17659
17741
|
type: tokenProviderConfig.type,
|
|
17660
17742
|
isIdentityExposing: isExposing,
|
|
17661
17743
|
});
|
|
17662
17744
|
if (isExposing) {
|
|
17663
17745
|
const identity = await provider.getIdentity();
|
|
17664
|
-
logger$
|
|
17746
|
+
logger$Y.debug('retrieved_identity', { identity });
|
|
17665
17747
|
if (identity && identity.subject) {
|
|
17666
17748
|
const hashedSubject = await generateIdAsync({
|
|
17667
17749
|
mode: 'fingerprint',
|
|
@@ -17669,7 +17751,7 @@ class TokenSubjectNodeIdentityPolicy {
|
|
|
17669
17751
|
length: 8,
|
|
17670
17752
|
});
|
|
17671
17753
|
const newNodeId = `${hashedSubject}-${context.currentNodeId}`;
|
|
17672
|
-
logger$
|
|
17754
|
+
logger$Y.info('resolved_identity_from_token', {
|
|
17673
17755
|
subject: identity.subject,
|
|
17674
17756
|
hashedSubject,
|
|
17675
17757
|
newNodeId,
|
|
@@ -17677,17 +17759,17 @@ class TokenSubjectNodeIdentityPolicy {
|
|
|
17677
17759
|
return newNodeId;
|
|
17678
17760
|
}
|
|
17679
17761
|
else {
|
|
17680
|
-
logger$
|
|
17762
|
+
logger$Y.debug('identity_missing_subject', { identity });
|
|
17681
17763
|
}
|
|
17682
17764
|
}
|
|
17683
17765
|
}
|
|
17684
17766
|
catch (err) {
|
|
17685
|
-
logger$
|
|
17767
|
+
logger$Y.warning('failed_to_extract_identity_from_grant', { error: err });
|
|
17686
17768
|
}
|
|
17687
17769
|
}
|
|
17688
17770
|
}
|
|
17689
17771
|
else {
|
|
17690
|
-
logger$
|
|
17772
|
+
logger$Y.debug('no_grants_available');
|
|
17691
17773
|
}
|
|
17692
17774
|
return context.currentNodeId;
|
|
17693
17775
|
}
|
|
@@ -17698,7 +17780,7 @@ var tokenSubjectNodeIdentityPolicy = /*#__PURE__*/Object.freeze({
|
|
|
17698
17780
|
TokenSubjectNodeIdentityPolicy: TokenSubjectNodeIdentityPolicy
|
|
17699
17781
|
});
|
|
17700
17782
|
|
|
17701
|
-
const FACTORY_META$
|
|
17783
|
+
const FACTORY_META$15 = {
|
|
17702
17784
|
base: NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE,
|
|
17703
17785
|
key: 'TokenSubjectNodeIdentityPolicy',
|
|
17704
17786
|
};
|
|
@@ -17717,12 +17799,12 @@ class TokenSubjectNodeIdentityPolicyFactory extends NodeIdentityPolicyFactory {
|
|
|
17717
17799
|
|
|
17718
17800
|
var tokenSubjectNodeIdentityPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
17719
17801
|
__proto__: null,
|
|
17720
|
-
FACTORY_META: FACTORY_META$
|
|
17802
|
+
FACTORY_META: FACTORY_META$15,
|
|
17721
17803
|
TokenSubjectNodeIdentityPolicyFactory: TokenSubjectNodeIdentityPolicyFactory,
|
|
17722
17804
|
default: TokenSubjectNodeIdentityPolicyFactory
|
|
17723
17805
|
});
|
|
17724
17806
|
|
|
17725
|
-
const logger$
|
|
17807
|
+
const logger$X = getLogger('naylence.fame.node.node_identity_policy_profile_factory');
|
|
17726
17808
|
const PROFILE_NAME_DEFAULT = 'default';
|
|
17727
17809
|
const PROFILE_NAME_TOKEN_SUBJECT = 'token-subject';
|
|
17728
17810
|
const PROFILE_NAME_TOKEN_SUBJECT_ALIAS = 'token_subject';
|
|
@@ -17737,7 +17819,7 @@ const PROFILE_MAP$5 = {
|
|
|
17737
17819
|
[PROFILE_NAME_TOKEN_SUBJECT]: TOKEN_SUBJECT_PROFILE,
|
|
17738
17820
|
[PROFILE_NAME_TOKEN_SUBJECT_ALIAS]: TOKEN_SUBJECT_PROFILE,
|
|
17739
17821
|
};
|
|
17740
|
-
const FACTORY_META$
|
|
17822
|
+
const FACTORY_META$14 = {
|
|
17741
17823
|
base: NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE,
|
|
17742
17824
|
key: 'NodeIdentityPolicyProfile',
|
|
17743
17825
|
};
|
|
@@ -17749,7 +17831,7 @@ class NodeIdentityPolicyProfileFactory extends NodeIdentityPolicyFactory {
|
|
|
17749
17831
|
async create(config) {
|
|
17750
17832
|
const normalized = normalizeConfig$t(config);
|
|
17751
17833
|
const profileConfig = resolveProfileConfig$4(normalized.profile);
|
|
17752
|
-
logger$
|
|
17834
|
+
logger$X.debug('enabling_node_identity_policy_profile', {
|
|
17753
17835
|
profile: normalized.profile,
|
|
17754
17836
|
});
|
|
17755
17837
|
return NodeIdentityPolicyFactory.createNodeIdentityPolicy(profileConfig);
|
|
@@ -17785,11 +17867,95 @@ function deepClone$4(value) {
|
|
|
17785
17867
|
|
|
17786
17868
|
var nodeIdentityPolicyProfileFactory = /*#__PURE__*/Object.freeze({
|
|
17787
17869
|
__proto__: null,
|
|
17788
|
-
FACTORY_META: FACTORY_META$
|
|
17870
|
+
FACTORY_META: FACTORY_META$14,
|
|
17789
17871
|
NodeIdentityPolicyProfileFactory: NodeIdentityPolicyProfileFactory,
|
|
17790
17872
|
default: NodeIdentityPolicyProfileFactory
|
|
17791
17873
|
});
|
|
17792
17874
|
|
|
17875
|
+
/**
|
|
17876
|
+
* Environment variable for overriding max initial attempts.
|
|
17877
|
+
*/
|
|
17878
|
+
const ENV_VAR_SESSION_MAX_INITIAL_ATTEMPTS = 'FAME_SESSION_MAX_INITIAL_ATTEMPTS';
|
|
17879
|
+
/**
|
|
17880
|
+
* Default implementation of connection retry policy.
|
|
17881
|
+
*
|
|
17882
|
+
* Before first successful attach:
|
|
17883
|
+
* - Respects maxInitialAttempts configuration
|
|
17884
|
+
* - Uses exponential backoff with jitter
|
|
17885
|
+
*
|
|
17886
|
+
* After first successful attach:
|
|
17887
|
+
* - Always retries (unlimited) to maintain connection
|
|
17888
|
+
* - Resets backoff if connection was stable for >10 seconds
|
|
17889
|
+
*/
|
|
17890
|
+
class DefaultConnectionRetryPolicy {
|
|
17891
|
+
constructor(options = {}) {
|
|
17892
|
+
// Check for environment variable override
|
|
17893
|
+
const envValue = typeof process !== 'undefined'
|
|
17894
|
+
? process.env?.[ENV_VAR_SESSION_MAX_INITIAL_ATTEMPTS]
|
|
17895
|
+
: undefined;
|
|
17896
|
+
if (envValue !== undefined && envValue !== '') {
|
|
17897
|
+
const parsed = parseInt(envValue, 10);
|
|
17898
|
+
this.maxInitialAttempts = isNaN(parsed) ? (options.maxInitialAttempts ?? 1) : parsed;
|
|
17899
|
+
}
|
|
17900
|
+
else {
|
|
17901
|
+
this.maxInitialAttempts = options.maxInitialAttempts ?? 1;
|
|
17902
|
+
}
|
|
17903
|
+
}
|
|
17904
|
+
shouldRetry(context) {
|
|
17905
|
+
// After first successful attach, always retry to maintain connection
|
|
17906
|
+
if (context.hadSuccessfulAttach) {
|
|
17907
|
+
return true;
|
|
17908
|
+
}
|
|
17909
|
+
// maxInitialAttempts = 0 means unlimited retries
|
|
17910
|
+
if (this.maxInitialAttempts === 0) {
|
|
17911
|
+
return true;
|
|
17912
|
+
}
|
|
17913
|
+
// Fail if we've exceeded the configured max attempts
|
|
17914
|
+
return context.attemptNumber < this.maxInitialAttempts;
|
|
17915
|
+
}
|
|
17916
|
+
calculateRetryDelay(_context, baseDelay) {
|
|
17917
|
+
// Add jitter to prevent thundering herd
|
|
17918
|
+
const jitter = Math.random() * baseDelay;
|
|
17919
|
+
return baseDelay + jitter;
|
|
17920
|
+
}
|
|
17921
|
+
}
|
|
17922
|
+
|
|
17923
|
+
const logger$W = getLogger('naylence.fame.node.default-connection-retry-policy-factory');
|
|
17924
|
+
const FACTORY_META$13 = {
|
|
17925
|
+
base: CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE,
|
|
17926
|
+
key: 'DefaultConnectionRetryPolicy',
|
|
17927
|
+
};
|
|
17928
|
+
class DefaultConnectionRetryPolicyFactory extends ConnectionRetryPolicyFactory {
|
|
17929
|
+
constructor() {
|
|
17930
|
+
super(...arguments);
|
|
17931
|
+
this.type = 'DefaultConnectionRetryPolicy';
|
|
17932
|
+
this.isDefault = true;
|
|
17933
|
+
}
|
|
17934
|
+
async create(config) {
|
|
17935
|
+
const options = {};
|
|
17936
|
+
if (config) {
|
|
17937
|
+
const rawMax = config.maxInitialAttempts ??
|
|
17938
|
+
config.max_initial_attempts;
|
|
17939
|
+
if (rawMax !== undefined && rawMax !== null) {
|
|
17940
|
+
options.maxInitialAttempts =
|
|
17941
|
+
typeof rawMax === 'string' ? parseInt(rawMax, 10) : Number(rawMax);
|
|
17942
|
+
}
|
|
17943
|
+
}
|
|
17944
|
+
const policy = new DefaultConnectionRetryPolicy(options);
|
|
17945
|
+
logger$W.debug('connection_retry_policy_created', {
|
|
17946
|
+
maxInitialAttempts: policy.maxInitialAttempts,
|
|
17947
|
+
});
|
|
17948
|
+
return policy;
|
|
17949
|
+
}
|
|
17950
|
+
}
|
|
17951
|
+
|
|
17952
|
+
var defaultConnectionRetryPolicyFactory = /*#__PURE__*/Object.freeze({
|
|
17953
|
+
__proto__: null,
|
|
17954
|
+
DefaultConnectionRetryPolicyFactory: DefaultConnectionRetryPolicyFactory,
|
|
17955
|
+
FACTORY_META: FACTORY_META$13,
|
|
17956
|
+
default: DefaultConnectionRetryPolicyFactory
|
|
17957
|
+
});
|
|
17958
|
+
|
|
17793
17959
|
const LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE = 'LoadBalancerStickinessManagerFactory';
|
|
17794
17960
|
class LoadBalancerStickinessManagerFactory extends AbstractResourceFactory {
|
|
17795
17961
|
static async createLoadBalancerStickinessManager(config, options = {}) {
|
|
@@ -20861,6 +21027,7 @@ class Sentinel extends FameNode {
|
|
|
20861
21027
|
this.maxAttachTtlSec = opts.maxAttachTtlSec ?? null;
|
|
20862
21028
|
this.requestedLogicals = opts.requestedLogicals ?? [];
|
|
20863
21029
|
this.attachClient = opts.attachClient ?? null;
|
|
21030
|
+
this.connectionRetryPolicy = opts.connectionRetryPolicy ?? null;
|
|
20864
21031
|
this.nodeAttachFrameHandler = new NodeAttachFrameHandler({
|
|
20865
21032
|
routingNode: this,
|
|
20866
21033
|
routeManager: this.routeManager,
|
|
@@ -21410,6 +21577,7 @@ class Sentinel extends FameNode {
|
|
|
21410
21577
|
onAttach: (info, connector) => this.onNodeAttachToPeer(info, connector),
|
|
21411
21578
|
onEpochChange: (epoch) => this.onEpochChange(epoch),
|
|
21412
21579
|
onWelcome: async () => undefined,
|
|
21580
|
+
retryPolicy: this.connectionRetryPolicy,
|
|
21413
21581
|
});
|
|
21414
21582
|
await sessionManager.start();
|
|
21415
21583
|
const systemId = sessionManager.systemId;
|
|
@@ -43661,4 +43829,4 @@ var otelSetup = /*#__PURE__*/Object.freeze({
|
|
|
43661
43829
|
setupOtel: setupOtel
|
|
43662
43830
|
});
|
|
43663
43831
|
|
|
43664
|
-
export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$_ as DEFAULT_WELCOME_FACTORY_META, DefaultCryptoProvider, DefaultHttpServer, DefaultKeyManager, DefaultNodeIdentityPolicy, DefaultNodeIdentityPolicyFactory, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM$2 as ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$2 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$$ as FACTORY_META, FAME_FABRIC_FACTORY_BASE_TYPE, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, HttpListener, HttpStatelessConnector, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, InPageListener, InProcessFameFabric, InProcessFameFabricFactory, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodeIdentityPolicyFactory, NodeIdentityPolicyProfileFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, QueueFullError, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, SQLiteKeyValueStore, SQLiteStorageProvider, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_LISTENER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenSubjectNodeIdentityPolicy, TokenSubjectNodeIdentityPolicyFactory, TokenVerifierFactory, TransportListener, TransportListenerFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketListener, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createJwksRouter, createLogicalUri, createNodeDeliveryContext, createApp as createOAuth2ServerApp, createOAuth2TokenRouter, createOpenIDConfigurationRouter, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFabricForNode, getFameRoot, getHttpListenerInstance, getInPageListenerInstance, getKeyProvider, getKeyStore, getLogger, getWebsocketListenerInstance, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isIdentityExposingTokenProvider, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeExtendedFameConfig, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, main as runOAuth2Server, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
|
|
43832
|
+
export { ADMISSION_CLIENT_FACTORY_BASE_TYPE, ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE, AUTHORIZER_FACTORY_BASE_TYPE, AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, AnsiColor, AsyncLock, AttachmentKeyValidator, AuthInjectionStrategyFactory, AuthorizerFactory, BROADCAST_CHANNEL_CONNECTION_GRANT_TYPE, BackPressureFull, BaseAsyncConnector, BaseNodeEventListener, BindingManager, BindingStoreEntryRecord, BrowserAutoKeyCredentialProvider, BrowserWrappedKeyCredentialProvider, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CONNECTION_RETRY_POLICY_FACTORY_BASE_TYPE, CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE, CRYPTO_LEVEL_SECURITY_ORDER, CertificateManagerFactory, ConnectionRetryPolicyFactory, ConnectorConfigDefaults, ConnectorFactory, ConsoleMetricsEmitter, CryptoLevel, FACTORY_META$_ as DEFAULT_WELCOME_FACTORY_META, DefaultConnectionRetryPolicy, DefaultConnectionRetryPolicyFactory, DefaultCryptoProvider, DefaultHttpServer, DefaultKeyManager, DefaultNodeIdentityPolicy, DefaultNodeIdentityPolicyFactory, DefaultSecurityManager, DefaultSecurityPolicy, DefaultWelcomeService, DefaultWelcomeServiceFactory, DevFixedKeyCredentialProvider, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWKS_URL, ENV_VAR_JWT_ALGORITHM$2 as ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE$2 as ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_SESSION_MAX_INITIAL_ATTEMPTS, ENV_VAR_SHOW_ENVELOPES$1 as ENV_VAR_SHOW_ENVELOPES, EdDSAEnvelopeSigner, EncryptedKeyValueStore, EncryptedStorageProviderBase, EncryptedValue, EncryptionConfiguration, EncryptionManagerFactory, EncryptionResult, EncryptionStatus, EnvCredentialProvider, EnvelopeContext, EnvelopeListenerManager, EnvelopeSecurityHandler, EnvelopeSignerFactory, EnvelopeVerifierFactory, FACTORY_META$$ as FACTORY_META, FAME_FABRIC_FACTORY_BASE_TYPE, FIXED_PREFIX_LEN, FameAuthorizedDeliveryContextSchema, FameConnectError, FameEnvironmentContext, FameError, FameMessageTooLarge, FameNode, FameNodeAuthorizationContextSchema, FameProtocolError, FameTransportClose, FlowController, GRANT_PURPOSE_NODE_ATTACH, HTTP_CONNECTION_GRANT_TYPE, HTTP_STATELESS_CONNECTOR_TYPE, HttpListener, HttpStatelessConnector, INPAGE_CONNECTION_GRANT_TYPE, INPAGE_CONNECTOR_TYPE, InMemoryBinding, InMemoryFanoutBroker, InMemoryKeyValueStore, InMemoryReadWriteChannel, InMemoryStorageProvider, InPageConnector, InPageListener, InProcessFameFabric, InProcessFameFabricFactory, IndexedDBKeyValueStore, IndexedDBStorageProvider, InvalidPassphraseError, JWKValidationError, KEY_MANAGER_FACTORY_BASE_TYPE, KEY_STORE_FACTORY_BASE_TYPE, KeyInfo, KeyManagementHandler, KeyManagerFactory, KeyStore, KeyStoreFactory, KeyValidationError, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, LogLevel, LogLevelNames, MemoryMetricsEmitter, NODE_IDENTITY_POLICY_FACTORY_BASE_TYPE, NODE_LIKE_FACTORY_BASE_TYPE, NODE_PLACEMENT_STRATEGY_FACTORY_BASE_TYPE, NoOpMetricsEmitter, NoSecurityPolicy, NodeFactory, NodeIdentityPolicyFactory, NodeIdentityPolicyProfileFactory, NodePlacementStrategyFactory, NoneCredentialProvider, NoopEncryptionManager, NoopKeyValidator, NoopTrustStoreProvider, NotAuthorized, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN$1 as PROFILE_NAME_OPEN, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_STRICT_OVERLAY, PromptCredentialProvider, QueueFullError, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, REQUIRED_FIELDS_BY_KTY, ReplicaStickinessManagerFactory, RootSessionManager, RouteManager, RpcMixin, RpcProxy, SEALED_ENVELOPE_NONCE_LENGTH, SEALED_ENVELOPE_OVERHEAD, SEALED_ENVELOPE_PRIVATE_KEY_LENGTH, SEALED_ENVELOPE_PUBLIC_KEY_LENGTH, SEALED_ENVELOPE_TAG_LENGTH, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SECURITY_MANAGER_FACTORY_BASE_TYPE, SECURITY_POLICY_FACTORY_BASE_TYPE, SQLiteKeyValueStore, SQLiteStorageProvider, STORAGE_PROVIDER_FACTORY_BASE_TYPE, SecretSource, SecretStoreCredentialProvider, SecureChannelFrameHandler, SecureChannelManagerFactory, SecurityAction, SecurityRequirements, Sentinel, SentinelFactory, SessionKeyCredentialProvider, SignaturePolicy, SigningConfig as SigningConfigClass, SigningConfiguration, SimpleLoadBalancerStickinessManager, SimpleLoadBalancerStickinessManagerFactory, StaticCredentialProvider, StorageAESEncryptionManager, TOKEN_ISSUER_FACTORY_BASE_TYPE, TOKEN_PROVIDER_FACTORY_BASE_TYPE, TOKEN_VERIFIER_FACTORY_BASE_TYPE, TRANSPORT_LISTENER_FACTORY_BASE_TYPE, TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, TaskSpawner, TokenIssuerFactory, TokenProviderFactory, TokenSubjectNodeIdentityPolicy, TokenSubjectNodeIdentityPolicyFactory, TokenVerifierFactory, TransportListener, TransportListenerFactory, TransportProvisionerFactory, TrustStoreProviderFactory, TtlValidationError, UpstreamSessionManager, VALID_CURVES_BY_KTY, VALID_KEY_USES, VERSION, WEBSOCKET_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WebSocketCloseCode, WebSocketConnector, WebSocketListener, WebSocketState, WelcomeServiceFactory, _NoopFlowController, __runtimePluginLoader, addEnvelopeFields, addLogLevel, addTimestamp, assertConnectionGrant, assertGrant, basicConfig, broadcastChannelGrantToConnectorConfig, camelToSnakeCase, canonicalJson, capitalizeFirstLetter, color, compareCryptoLevels, compiledPathPattern, consoleTransport, convertWildcardLogicalToDnsConstraint, createConnectorConfig, createEd25519Keypair, createHostLogicalUri, createJwksRouter, createLogicalUri, createNodeDeliveryContext, createApp as createOAuth2ServerApp, createOAuth2TokenRouter, createOpenIDConfigurationRouter, createResource, createRpcProxy, createRsaKeypair, createTransportCloseError, createX25519Keypair, credentialToString, currentTraceId$1 as currentTraceId, debounce, decodeBase64Url, decodeFameDataPayload, deepMerge, defaultJsonEncoder, delay, dropEmpty, enableLogging, encodeUtf8, ensureRuntimeFactoriesRegistered, extractId, extractPoolAddressBase, extractPoolBase, filterKeysByUse, formatTimestamp, formatTimestampForConsole$1 as formatTimestampForConsole, frameDigest, getCurrentEnvelope, getFabricForNode, getFameRoot, getHttpListenerInstance, getInPageListenerInstance, getKeyProvider, getKeyStore, getLogger, getWebsocketListenerInstance, hasCryptoSupport, hostnameToLogical, hostnamesToLogicals, httpGrantToConnectorConfig, immutableHeaders, inPageGrantToConnectorConfig, isAuthInjectionStrategy, isBroadcastChannelConnectionGrant, isConnectionGrant, isConnectorConfig, isEnvelopeLoggingEnabled, isFameError, isFameErrorType, isGrant, isHttpConnectionGrant, isIdentityExposingTokenProvider, isInPageConnectionGrant, isNodeLike, isPlainObject$3 as isPlainObject, isPoolAddress, isPoolLogical, isRegisterable, isTokenExpired, isTokenProvider, isTokenValid, isWebSocketConnectionGrant, jsonDumps, logicalPatternsToDnsConstraints, logicalToHostname, logicalsToHostnames, matchesPoolAddress, matchesPoolLogical, maybeAwait, nodeWelcomeRouter, nodeWelcomeRouterPlugin, normalizeBroadcastChannelConnectionGrant, normalizeEncryptionConfig, normalizeEnvelopeSnapshot, normalizeExtendedFameConfig, normalizeHttpConnectionGrant, normalizeInPageConnectionGrant, normalizeInboundCryptoRules, normalizeInboundSigningRules, normalizeOutboundCryptoRules, normalizeOutboundSigningRules, normalizePath, normalizeResponseCryptoRules, normalizeResponseSigningRules, normalizeSecretSource, normalizeSecurityRequirements, normalizeSigningConfig, normalizeWebSocketConnectionGrant, objectToBytes, operation, parseSealedEnvelope, pinoTransport, prettyModel$1 as prettyModel, registerDefaultFactories, registerDefaultKeyStoreFactory, registerNodePlacementStrategyFactory, registerRuntimeFactories, requireCryptoSupport, retryWithBackoff, main as runOAuth2Server, safeColor, safeImport, sealedDecrypt, sealedEncrypt, secureDigest, setKeyStore, showEnvelopes$1 as showEnvelopes, sleep, snakeToCamelCase, stringifyNonPrimitives, supportsColor, throttle, urlsafeBase64Decode, urlsafeBase64Encode, validateCacheTtlSec, validateEncryptionKey, validateHostLogical, validateHostLogicals, validateJwkComplete, validateJwkStructure, validateJwkUseField, validateJwtTokenTtlSec, validateKeyCorrelationTtlSec, validateLogical, validateLogicalSegment, validateOAuth2TtlSec, validateSigningKey, validateTtlSec, waitForAll, waitForAllSettled, waitForAny, websocketGrantToConnectorConfig, withEnvelopeContext, withEnvelopeContextAsync, withLegacySnakeCaseKeys, withLock, withTimeout };
|