@cognipeer/agent-sdk 0.2.9 → 0.3.1
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 +14 -2
- 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 +14 -2
- 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,
|
|
@@ -1915,7 +1918,15 @@ function createGuardrail(options) {
|
|
|
1915
1918
|
}
|
|
1916
1919
|
|
|
1917
1920
|
// src/utils/stateSnapshot.ts
|
|
1918
|
-
var DISALLOWED_CTX_KEYS = /* @__PURE__ */ new Set([
|
|
1921
|
+
var DISALLOWED_CTX_KEYS = /* @__PURE__ */ new Set([
|
|
1922
|
+
"__onEvent",
|
|
1923
|
+
"__onProgress",
|
|
1924
|
+
"__onStream",
|
|
1925
|
+
"__traceSession",
|
|
1926
|
+
"__paused",
|
|
1927
|
+
"__cancellationToken",
|
|
1928
|
+
"__abortSignal"
|
|
1929
|
+
]);
|
|
1919
1930
|
var clone = (value) => {
|
|
1920
1931
|
if (typeof globalThis.structuredClone === "function") {
|
|
1921
1932
|
return globalThis.structuredClone(value);
|
|
@@ -2902,7 +2913,7 @@ function createContextTools(stateRef, opts) {
|
|
|
2902
2913
|
schema: z.object({
|
|
2903
2914
|
operation: z.enum(["write", "read"]),
|
|
2904
2915
|
todoList: z.array(z.object({
|
|
2905
|
-
id: z.number().int().
|
|
2916
|
+
id: z.number().int().min(1).describe("Sequential id starting from 1"),
|
|
2906
2917
|
title: z.string().min(1),
|
|
2907
2918
|
description: z.string().min(1),
|
|
2908
2919
|
status: z.enum(["not-started", "in-progress", "completed"]),
|
|
@@ -3079,6 +3090,7 @@ function createSmartAgent(opts) {
|
|
|
3079
3090
|
if (currentSummaries && currentSummaries.length > 0 && (!state.summaries || state.summaries.length === 0)) {
|
|
3080
3091
|
state = { ...state, summaries: currentSummaries };
|
|
3081
3092
|
}
|
|
3093
|
+
if (state.ctx?.__awaitingApproval || state.ctx?.__waitingForInput) break;
|
|
3082
3094
|
if (state.ctx?.__needsSummarization && summarizer) {
|
|
3083
3095
|
const ctx = { ...state.ctx || {} };
|
|
3084
3096
|
delete ctx.__needsSummarization;
|