@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.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,
|
|
@@ -1924,7 +1927,15 @@ function createGuardrail(options) {
|
|
|
1924
1927
|
}
|
|
1925
1928
|
|
|
1926
1929
|
// src/utils/stateSnapshot.ts
|
|
1927
|
-
var DISALLOWED_CTX_KEYS = /* @__PURE__ */ new Set([
|
|
1930
|
+
var DISALLOWED_CTX_KEYS = /* @__PURE__ */ new Set([
|
|
1931
|
+
"__onEvent",
|
|
1932
|
+
"__onProgress",
|
|
1933
|
+
"__onStream",
|
|
1934
|
+
"__traceSession",
|
|
1935
|
+
"__paused",
|
|
1936
|
+
"__cancellationToken",
|
|
1937
|
+
"__abortSignal"
|
|
1938
|
+
]);
|
|
1928
1939
|
var clone = (value) => {
|
|
1929
1940
|
if (typeof globalThis.structuredClone === "function") {
|
|
1930
1941
|
return globalThis.structuredClone(value);
|
|
@@ -2911,7 +2922,7 @@ function createContextTools(stateRef, opts) {
|
|
|
2911
2922
|
schema: zod.z.object({
|
|
2912
2923
|
operation: zod.z.enum(["write", "read"]),
|
|
2913
2924
|
todoList: zod.z.array(zod.z.object({
|
|
2914
|
-
id: zod.z.number().int().
|
|
2925
|
+
id: zod.z.number().int().min(1).describe("Sequential id starting from 1"),
|
|
2915
2926
|
title: zod.z.string().min(1),
|
|
2916
2927
|
description: zod.z.string().min(1),
|
|
2917
2928
|
status: zod.z.enum(["not-started", "in-progress", "completed"]),
|
|
@@ -3088,6 +3099,7 @@ function createSmartAgent(opts) {
|
|
|
3088
3099
|
if (currentSummaries && currentSummaries.length > 0 && (!state.summaries || state.summaries.length === 0)) {
|
|
3089
3100
|
state = { ...state, summaries: currentSummaries };
|
|
3090
3101
|
}
|
|
3102
|
+
if (state.ctx?.__awaitingApproval || state.ctx?.__waitingForInput) break;
|
|
3091
3103
|
if (state.ctx?.__needsSummarization && summarizer) {
|
|
3092
3104
|
const ctx = { ...state.ctx || {} };
|
|
3093
3105
|
delete ctx.__needsSummarization;
|