assistme 0.6.2 → 0.6.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.
- package/dist/index.js +17 -6
- package/package.json +1 -1
- package/src/agent/self-analyzer.ts +17 -9
package/dist/index.js
CHANGED
|
@@ -3846,11 +3846,11 @@ var SELF_ANALYSIS_OUTPUT_FORMAT = {
|
|
|
3846
3846
|
type: "object",
|
|
3847
3847
|
properties: {
|
|
3848
3848
|
is_perfect: { type: "boolean" },
|
|
3849
|
-
overall_score: { type: "number" },
|
|
3849
|
+
overall_score: { type: "number", minimum: 1, maximum: 10 },
|
|
3850
3850
|
task_completion_quality: {
|
|
3851
3851
|
type: "object",
|
|
3852
3852
|
properties: {
|
|
3853
|
-
score: { type: "number" },
|
|
3853
|
+
score: { type: "number", minimum: 1, maximum: 10 },
|
|
3854
3854
|
assessment: { type: "string" }
|
|
3855
3855
|
},
|
|
3856
3856
|
required: ["score", "assessment"]
|
|
@@ -3875,11 +3875,11 @@ var SELF_ANALYSIS_OUTPUT_FORMAT = {
|
|
|
3875
3875
|
type: "object",
|
|
3876
3876
|
properties: {
|
|
3877
3877
|
session_logs_useful: { type: "boolean" },
|
|
3878
|
-
session_logs_gaps: { type: "string" },
|
|
3878
|
+
session_logs_gaps: { type: ["string", "null"] },
|
|
3879
3879
|
message_events_useful: { type: "boolean" },
|
|
3880
|
-
message_events_gaps: { type: "string" },
|
|
3880
|
+
message_events_gaps: { type: ["string", "null"] },
|
|
3881
3881
|
conversation_context_useful: { type: "boolean" },
|
|
3882
|
-
conversation_context_gaps: { type: "string" }
|
|
3882
|
+
conversation_context_gaps: { type: ["string", "null"] }
|
|
3883
3883
|
},
|
|
3884
3884
|
required: [
|
|
3885
3885
|
"session_logs_useful",
|
|
@@ -4163,7 +4163,18 @@ Respond with a JSON object now.`;
|
|
|
4163
4163
|
(_, reject) => setTimeout(() => reject(new Error(`Self-analysis timed out after ${SELF_ANALYSIS_TIMEOUT_MS / 1e3}s`)), SELF_ANALYSIS_TIMEOUT_MS)
|
|
4164
4164
|
);
|
|
4165
4165
|
const structuredOutput = await Promise.race([analysisPromise, timeoutPromise]);
|
|
4166
|
-
|
|
4166
|
+
let analysis = null;
|
|
4167
|
+
if (structuredOutput) {
|
|
4168
|
+
const result = SelfAnalysisResultSchema.safeParse(structuredOutput);
|
|
4169
|
+
if (result.success) {
|
|
4170
|
+
analysis = result.data;
|
|
4171
|
+
} else {
|
|
4172
|
+
log.warn(
|
|
4173
|
+
`Self-analysis: schema validation failed: ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
|
|
4174
|
+
);
|
|
4175
|
+
log.debug(`Self-analysis: raw output: ${JSON.stringify(structuredOutput).slice(0, 500)}`);
|
|
4176
|
+
}
|
|
4177
|
+
}
|
|
4167
4178
|
if (!analysis) {
|
|
4168
4179
|
log.warn("Self-analysis: no valid structured output");
|
|
4169
4180
|
return;
|
package/package.json
CHANGED
|
@@ -9,7 +9,6 @@ import { log } from "../utils/logger.js";
|
|
|
9
9
|
import {
|
|
10
10
|
SelfAnalysisResultSchema,
|
|
11
11
|
type SelfAnalysisResult,
|
|
12
|
-
safeParse,
|
|
13
12
|
} from "../utils/schemas.js";
|
|
14
13
|
import { errorMessage } from "../utils/errors.js";
|
|
15
14
|
import {
|
|
@@ -37,11 +36,11 @@ const SELF_ANALYSIS_OUTPUT_FORMAT: OutputFormat = {
|
|
|
37
36
|
type: "object",
|
|
38
37
|
properties: {
|
|
39
38
|
is_perfect: { type: "boolean" },
|
|
40
|
-
overall_score: { type: "number" },
|
|
39
|
+
overall_score: { type: "number", minimum: 1, maximum: 10 },
|
|
41
40
|
task_completion_quality: {
|
|
42
41
|
type: "object",
|
|
43
42
|
properties: {
|
|
44
|
-
score: { type: "number" },
|
|
43
|
+
score: { type: "number", minimum: 1, maximum: 10 },
|
|
45
44
|
assessment: { type: "string" },
|
|
46
45
|
},
|
|
47
46
|
required: ["score", "assessment"],
|
|
@@ -66,11 +65,11 @@ const SELF_ANALYSIS_OUTPUT_FORMAT: OutputFormat = {
|
|
|
66
65
|
type: "object",
|
|
67
66
|
properties: {
|
|
68
67
|
session_logs_useful: { type: "boolean" },
|
|
69
|
-
session_logs_gaps: { type: "string" },
|
|
68
|
+
session_logs_gaps: { type: ["string", "null"] },
|
|
70
69
|
message_events_useful: { type: "boolean" },
|
|
71
|
-
message_events_gaps: { type: "string" },
|
|
70
|
+
message_events_gaps: { type: ["string", "null"] },
|
|
72
71
|
conversation_context_useful: { type: "boolean" },
|
|
73
|
-
conversation_context_gaps: { type: "string" },
|
|
72
|
+
conversation_context_gaps: { type: ["string", "null"] },
|
|
74
73
|
},
|
|
75
74
|
required: [
|
|
76
75
|
"session_logs_useful",
|
|
@@ -436,9 +435,18 @@ export async function analyzeSelfPostTask(opts: {
|
|
|
436
435
|
const structuredOutput = await Promise.race([analysisPromise, timeoutPromise]);
|
|
437
436
|
|
|
438
437
|
// Validate against Zod schema
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
438
|
+
let analysis: SelfAnalysisResult | null = null;
|
|
439
|
+
if (structuredOutput) {
|
|
440
|
+
const result = SelfAnalysisResultSchema.safeParse(structuredOutput);
|
|
441
|
+
if (result.success) {
|
|
442
|
+
analysis = result.data;
|
|
443
|
+
} else {
|
|
444
|
+
log.warn(
|
|
445
|
+
`Self-analysis: schema validation failed: ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
|
|
446
|
+
);
|
|
447
|
+
log.debug(`Self-analysis: raw output: ${JSON.stringify(structuredOutput).slice(0, 500)}`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
442
450
|
|
|
443
451
|
if (!analysis) {
|
|
444
452
|
log.warn("Self-analysis: no valid structured output");
|