@botiverse/raft-daemon 0.63.2 → 0.63.3

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.
@@ -16409,7 +16409,7 @@ function acquireDaemonMachineLock(options) {
16409
16409
  throw new DaemonMachineLockConflictError(lockDir, readOwner(lockDir));
16410
16410
  }
16411
16411
 
16412
- // src/localTraceSink.ts
16412
+ // ../trace-client/src/localTraceSink.ts
16413
16413
  import { appendFileSync, mkdirSync as mkdirSync6, readdirSync as readdirSync5, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync6 } from "fs";
16414
16414
  import path16 from "path";
16415
16415
  var DEFAULT_MAX_FILE_BYTES = 5 * 1024 * 1024;
@@ -16580,13 +16580,7 @@ function isDiagnosticErrorAttr(key) {
16580
16580
  return DIAGNOSTIC_ERROR_ATTRS.has(key);
16581
16581
  }
16582
16582
 
16583
- // src/traceBundleUpload.ts
16584
- import { createHash as createHash6, randomUUID as randomUUID7 } from "crypto";
16585
- import { gzipSync as gzipSync2 } from "zlib";
16586
- import { mkdir as mkdir2, readFile as readFile2, readdir as readdir3, stat as stat3, writeFile as writeFile2 } from "fs/promises";
16587
- import path17 from "path";
16588
-
16589
- // src/traceJitter.ts
16583
+ // ../trace-client/src/traceJitter.ts
16590
16584
  import { createHash as createHash5 } from "crypto";
16591
16585
  var INITIAL_UPLOAD_DELAY_SPAN_MS = 3e4;
16592
16586
  var UPLOAD_INTERVAL_JITTER_SPAN_MS = 6e4;
@@ -16615,7 +16609,68 @@ function bucketDelayMs(delayMs) {
16615
16609
  return "10m+";
16616
16610
  }
16617
16611
 
16612
+ // ../trace-client/src/traceClient.ts
16613
+ var MultiSink = class {
16614
+ sinks;
16615
+ onSinkError;
16616
+ constructor(sinks, onSinkError) {
16617
+ this.sinks = sinks;
16618
+ this.onSinkError = onSinkError;
16619
+ }
16620
+ record(span) {
16621
+ for (const sink of this.sinks) {
16622
+ try {
16623
+ sink.record(span);
16624
+ } catch (err) {
16625
+ this.onSinkError?.(sink, err);
16626
+ }
16627
+ }
16628
+ }
16629
+ };
16630
+ var SourceForcingActiveSpan = class {
16631
+ context;
16632
+ inner;
16633
+ constructor(inner) {
16634
+ this.inner = inner;
16635
+ this.context = inner.context;
16636
+ }
16637
+ addEvent(name, attrs) {
16638
+ this.inner.addEvent(name, attrs);
16639
+ }
16640
+ end(status, options) {
16641
+ if (!options?.attrs) {
16642
+ this.inner.end(status, options);
16643
+ return;
16644
+ }
16645
+ const { source: _stripped, ...rest } = options.attrs;
16646
+ this.inner.end(status, { ...options, attrs: rest });
16647
+ }
16648
+ };
16649
+ var SourceForcingTracer = class {
16650
+ inner;
16651
+ source;
16652
+ constructor(inner, source) {
16653
+ this.inner = inner;
16654
+ this.source = source;
16655
+ }
16656
+ startSpan(name, options) {
16657
+ const callerAttrs = options.attrs ?? {};
16658
+ const attrs = { ...callerAttrs, source: this.source };
16659
+ const innerSpan = this.inner.startSpan(name, { ...options, attrs });
16660
+ return new SourceForcingActiveSpan(innerSpan);
16661
+ }
16662
+ };
16663
+ function createTraceClient(options) {
16664
+ const sink = new MultiSink(options.sinks);
16665
+ const baseTracer = new BasicTracer({ sink });
16666
+ return new SourceForcingTracer(baseTracer, options.source);
16667
+ }
16668
+
16618
16669
  // src/traceBundleUpload.ts
16670
+ import { createHash as createHash6, randomUUID as randomUUID7 } from "crypto";
16671
+ import { gzipSync as gzipSync2 } from "zlib";
16672
+ import { mkdir as mkdir2, readFile as readFile2, readdir as readdir3, stat as stat3, writeFile as writeFile2 } from "fs/promises";
16673
+ import path17 from "path";
16619
16674
  var TRACE_UPLOAD_SCOPE = "daemon-trace-bundle:create";
16620
16675
  var DEFAULT_UPLOAD_INTERVAL_MS = 5 * 60 * 1e3;
16621
16676
  var DEFAULT_MIN_FILE_AGE_MS = 60 * 1e3;
@@ -17182,8 +17237,9 @@ var DaemonCore = class {
17182
17237
  maxFileAgeJitterMs: jitter.maxFileAgeJitterMs,
17183
17238
  maxFiles: this.options.localTraceMaxFiles ?? readPositiveIntegerEnv3("SLOCK_DAEMON_TRACE_MAX_FILES", 8)
17184
17239
  });
17185
- this.tracer = this.withDaemonTraceScope(new BasicTracer({
17186
- sink: this.localTraceSink
17240
+ this.tracer = this.withDaemonTraceScope(createTraceClient({
17241
+ source: "daemon",
17242
+ sinks: [this.localTraceSink]
17187
17243
  }));
17188
17244
  this.agentManager.setTracer(this.tracer);
17189
17245
  this.agentManager.setCliTransportTraceDir(path18.join(machineDir, "traces"));
package/dist/core.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  runBundledSlockCli,
12
12
  scanWorkspaceDirectories,
13
13
  subscribeDaemonLogs
14
- } from "./chunk-RNUZAZCS.js";
14
+ } from "./chunk-RZHNJV7U.js";
15
15
  export {
16
16
  DAEMON_CLI_USAGE,
17
17
  DaemonCore,
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-RNUZAZCS.js";
6
+ } from "./chunk-RZHNJV7U.js";
7
7
 
8
8
  // src/index.ts
9
9
  var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-daemon",
3
- "version": "0.63.2",
3
+ "version": "0.63.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",
@@ -59,6 +59,7 @@
59
59
  "devDependencies": {
60
60
  "@botiverse/raft": "workspace:*",
61
61
  "@slock-ai/shared": "workspace:*",
62
+ "@slock-ai/trace-client": "workspace:*",
62
63
  "@types/node": "^25.5.0",
63
64
  "@types/ws": "^8.18.1",
64
65
  "tsup": "^8.5.1",