@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 +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -169,6 +169,8 @@ type TracingMode = "batched" | "streaming";
|
|
|
169
169
|
type TracingConfig = {
|
|
170
170
|
enabled: boolean;
|
|
171
171
|
mode?: TracingMode;
|
|
172
|
+
/** Thread identifier; groups multiple sessions across agents into a single thread. */
|
|
173
|
+
threadId?: string;
|
|
172
174
|
logData?: boolean;
|
|
173
175
|
sink?: TraceSinkConfig;
|
|
174
176
|
};
|
|
@@ -341,6 +343,7 @@ type TraceSessionConfigSnapshot = {
|
|
|
341
343
|
};
|
|
342
344
|
type TraceSessionFile = {
|
|
343
345
|
sessionId: string;
|
|
346
|
+
threadId?: string;
|
|
344
347
|
startedAt: string;
|
|
345
348
|
endedAt?: string;
|
|
346
349
|
durationMs?: number;
|
|
@@ -380,6 +383,7 @@ type ResolvedTraceConfig = {
|
|
|
380
383
|
};
|
|
381
384
|
type TraceSessionRuntime = {
|
|
382
385
|
sessionId: string;
|
|
386
|
+
threadId?: string;
|
|
383
387
|
startedAt: number;
|
|
384
388
|
resolvedConfig: ResolvedTraceConfig;
|
|
385
389
|
events: TraceEventRecord[];
|
package/dist/index.d.ts
CHANGED
|
@@ -169,6 +169,8 @@ type TracingMode = "batched" | "streaming";
|
|
|
169
169
|
type TracingConfig = {
|
|
170
170
|
enabled: boolean;
|
|
171
171
|
mode?: TracingMode;
|
|
172
|
+
/** Thread identifier; groups multiple sessions across agents into a single thread. */
|
|
173
|
+
threadId?: string;
|
|
172
174
|
logData?: boolean;
|
|
173
175
|
sink?: TraceSinkConfig;
|
|
174
176
|
};
|
|
@@ -341,6 +343,7 @@ type TraceSessionConfigSnapshot = {
|
|
|
341
343
|
};
|
|
342
344
|
type TraceSessionFile = {
|
|
343
345
|
sessionId: string;
|
|
346
|
+
threadId?: string;
|
|
344
347
|
startedAt: string;
|
|
345
348
|
endedAt?: string;
|
|
346
349
|
durationMs?: number;
|
|
@@ -380,6 +383,7 @@ type ResolvedTraceConfig = {
|
|
|
380
383
|
};
|
|
381
384
|
type TraceSessionRuntime = {
|
|
382
385
|
sessionId: string;
|
|
386
|
+
threadId?: string;
|
|
383
387
|
startedAt: number;
|
|
384
388
|
resolvedConfig: ResolvedTraceConfig;
|
|
385
389
|
events: TraceEventRecord[];
|
package/dist/index.mjs
CHANGED
|
@@ -906,6 +906,7 @@ function createTraceSession(opts) {
|
|
|
906
906
|
const sessionId = generateSessionId();
|
|
907
907
|
const runtime = {
|
|
908
908
|
sessionId,
|
|
909
|
+
threadId: opts.tracing?.threadId,
|
|
909
910
|
startedAt: Date.now(),
|
|
910
911
|
resolvedConfig: cfg,
|
|
911
912
|
events: [],
|
|
@@ -940,6 +941,7 @@ async function startStreamingSession(session, agentRuntime) {
|
|
|
940
941
|
const startedAtIso = new Date(session.startedAt).toISOString();
|
|
941
942
|
const payload = {
|
|
942
943
|
sessionId: session.sessionId,
|
|
944
|
+
threadId: session.threadId,
|
|
943
945
|
startedAt: startedAtIso,
|
|
944
946
|
agent: agentInfo,
|
|
945
947
|
config: configSnapshot
|
|
@@ -1121,6 +1123,7 @@ async function finalizeTraceSession(session, params = {}) {
|
|
|
1121
1123
|
const initialStatus = params.status ? params.status : session.errors.length > 0 ? "error" : "success";
|
|
1122
1124
|
const buildPayload = (status2) => ({
|
|
1123
1125
|
sessionId: session.sessionId,
|
|
1126
|
+
threadId: session.threadId,
|
|
1124
1127
|
startedAt: startedAtIso,
|
|
1125
1128
|
endedAt: endedAtIso,
|
|
1126
1129
|
durationMs,
|
|
@@ -2408,6 +2411,7 @@ function createAgent(opts) {
|
|
|
2408
2411
|
};
|
|
2409
2412
|
let res;
|
|
2410
2413
|
try {
|
|
2414
|
+
await startStreamingSession(traceSession, runtimeWithInvokeLimits);
|
|
2411
2415
|
res = await runLoop(initial, config, emit);
|
|
2412
2416
|
} catch (err) {
|
|
2413
2417
|
await finalizeTraceSession(traceSession, {
|