@cognipeer/agent-sdk 0.2.8 → 0.3.0

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/index.cjs CHANGED
@@ -915,6 +915,7 @@ function createTraceSession(opts) {
915
915
  const sessionId = generateSessionId();
916
916
  const runtime = {
917
917
  sessionId,
918
+ threadId: opts.tracing?.threadId,
918
919
  startedAt: Date.now(),
919
920
  resolvedConfig: cfg,
920
921
  events: [],
@@ -949,6 +950,7 @@ async function startStreamingSession(session, agentRuntime) {
949
950
  const startedAtIso = new Date(session.startedAt).toISOString();
950
951
  const payload = {
951
952
  sessionId: session.sessionId,
953
+ threadId: session.threadId,
952
954
  startedAt: startedAtIso,
953
955
  agent: agentInfo,
954
956
  config: configSnapshot
@@ -1130,6 +1132,7 @@ async function finalizeTraceSession(session, params = {}) {
1130
1132
  const initialStatus = params.status ? params.status : session.errors.length > 0 ? "error" : "success";
1131
1133
  const buildPayload = (status2) => ({
1132
1134
  sessionId: session.sessionId,
1135
+ threadId: session.threadId,
1133
1136
  startedAt: startedAtIso,
1134
1137
  endedAt: endedAtIso,
1135
1138
  durationMs,
@@ -2417,6 +2420,7 @@ function createAgent(opts) {
2417
2420
  };
2418
2421
  let res;
2419
2422
  try {
2423
+ await startStreamingSession(traceSession, runtimeWithInvokeLimits);
2420
2424
  res = await runLoop(initial, config, emit);
2421
2425
  } catch (err) {
2422
2426
  await finalizeTraceSession(traceSession, {