assistme 0.6.5 → 0.6.7
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/{chunk-3V6TCGZG.js → chunk-5F4P6MYZ.js} +1 -1
- package/dist/{chunk-JVA6DHXD.js → chunk-EPKN2PW5.js} +2 -2
- package/dist/{config-T4357GAE.js → config-OV2BLYB7.js} +1 -1
- package/dist/index.js +37 -14
- package/dist/job-runner-VIGPBGRE.js +7 -0
- package/package.json +1 -1
- package/src/agent/self-analyzer.ts +42 -9
- package/src/utils/config.ts +2 -2
- package/dist/job-runner-W6CTTJMR.js +0 -7
|
@@ -8,7 +8,7 @@ var CONFIG_DEFAULTS = {
|
|
|
8
8
|
supabaseAnonKey: SUPABASE_ANON_KEY_DEFAULT,
|
|
9
9
|
sessionName: "Default",
|
|
10
10
|
model: "claude-sonnet-4-20250514",
|
|
11
|
-
maxTurns:
|
|
11
|
+
maxTurns: 500,
|
|
12
12
|
taskTimeoutMinutes: 10
|
|
13
13
|
};
|
|
14
14
|
var config = new Conf({
|
|
@@ -27,7 +27,7 @@ function getConfig() {
|
|
|
27
27
|
workspacePath: resolve(workspacePath),
|
|
28
28
|
sessionName: config.get("sessionName") || "Default",
|
|
29
29
|
model: config.get("model") || "claude-sonnet-4-20250514",
|
|
30
|
-
maxTurns: config.get("maxTurns") ||
|
|
30
|
+
maxTurns: config.get("maxTurns") || 500,
|
|
31
31
|
taskTimeoutMinutes: config.get("taskTimeoutMinutes") || 10
|
|
32
32
|
};
|
|
33
33
|
}
|
package/dist/index.js
CHANGED
|
@@ -46,13 +46,13 @@ import {
|
|
|
46
46
|
setLogHook,
|
|
47
47
|
setLogLevel,
|
|
48
48
|
writeAuthStore
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-5F4P6MYZ.js";
|
|
50
50
|
import {
|
|
51
51
|
clearConfig,
|
|
52
52
|
getConfig,
|
|
53
53
|
getConfigPath,
|
|
54
54
|
setConfig
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-EPKN2PW5.js";
|
|
56
56
|
|
|
57
57
|
// src/index.ts
|
|
58
58
|
import { Command } from "commander";
|
|
@@ -92,7 +92,7 @@ async function logout() {
|
|
|
92
92
|
|
|
93
93
|
// src/db/session.ts
|
|
94
94
|
async function createSession(sessionName, workspacePath, version2) {
|
|
95
|
-
const { getConfig: getConfig2 } = await import("./config-
|
|
95
|
+
const { getConfig: getConfig2 } = await import("./config-OV2BLYB7.js");
|
|
96
96
|
const data = await callMcpHandler("session.create", {
|
|
97
97
|
session_name: sessionName,
|
|
98
98
|
workspace_path: workspacePath,
|
|
@@ -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:
|
|
3878
|
+
session_logs_gaps: { type: "string" },
|
|
3879
3879
|
message_events_useful: { type: "boolean" },
|
|
3880
|
-
message_events_gaps: { type:
|
|
3880
|
+
message_events_gaps: { type: "string" },
|
|
3881
3881
|
conversation_context_useful: { type: "boolean" },
|
|
3882
|
-
conversation_context_gaps: { type:
|
|
3882
|
+
conversation_context_gaps: { type: "string" }
|
|
3883
3883
|
},
|
|
3884
3884
|
required: [
|
|
3885
3885
|
"session_logs_useful",
|
|
@@ -4106,6 +4106,13 @@ ${dataQualityNotes}
|
|
|
4106
4106
|
}
|
|
4107
4107
|
}
|
|
4108
4108
|
async function runAnalysisQuery(model, prompt) {
|
|
4109
|
+
const result = await attemptQuery(model, prompt, SELF_ANALYSIS_OUTPUT_FORMAT);
|
|
4110
|
+
if (result) return result;
|
|
4111
|
+
log.info("Self-analysis: retrying without structured output (fallback)");
|
|
4112
|
+
const fallbackResult = await attemptQuery(model, prompt, void 0);
|
|
4113
|
+
return fallbackResult;
|
|
4114
|
+
}
|
|
4115
|
+
async function attemptQuery(model, prompt, outputFormat) {
|
|
4109
4116
|
let structuredOutput;
|
|
4110
4117
|
for await (const message of query2({
|
|
4111
4118
|
prompt,
|
|
@@ -4113,8 +4120,8 @@ async function runAnalysisQuery(model, prompt) {
|
|
|
4113
4120
|
model,
|
|
4114
4121
|
maxTurns: 10,
|
|
4115
4122
|
allowedTools: [],
|
|
4116
|
-
effort: "
|
|
4117
|
-
outputFormat:
|
|
4123
|
+
effort: "medium",
|
|
4124
|
+
...outputFormat ? { outputFormat } : {}
|
|
4118
4125
|
}
|
|
4119
4126
|
})) {
|
|
4120
4127
|
if (message.type === "result") {
|
|
@@ -4126,9 +4133,16 @@ async function runAnalysisQuery(model, prompt) {
|
|
|
4126
4133
|
`Self-analysis cost: $${successMsg.total_cost_usd.toFixed(4)}`
|
|
4127
4134
|
);
|
|
4128
4135
|
if (!structuredOutput) {
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
)
|
|
4136
|
+
const text = String(successMsg.result ?? "");
|
|
4137
|
+
const parsed = tryParseJson(text);
|
|
4138
|
+
if (parsed) {
|
|
4139
|
+
log.info("Self-analysis: parsed JSON from text result");
|
|
4140
|
+
structuredOutput = parsed;
|
|
4141
|
+
} else {
|
|
4142
|
+
log.warn(
|
|
4143
|
+
`Self-analysis: success but no structured_output. result text: ${text.slice(0, 500)}`
|
|
4144
|
+
);
|
|
4145
|
+
}
|
|
4132
4146
|
}
|
|
4133
4147
|
} else {
|
|
4134
4148
|
log.warn(
|
|
@@ -4139,6 +4153,15 @@ async function runAnalysisQuery(model, prompt) {
|
|
|
4139
4153
|
}
|
|
4140
4154
|
return structuredOutput;
|
|
4141
4155
|
}
|
|
4156
|
+
function tryParseJson(text) {
|
|
4157
|
+
const jsonMatch = text.match(/```(?:json)?\s*([\s\S]*?)```/) || text.match(/(\{[\s\S]*\})/);
|
|
4158
|
+
if (!jsonMatch) return null;
|
|
4159
|
+
try {
|
|
4160
|
+
return JSON.parse(jsonMatch[1]);
|
|
4161
|
+
} catch {
|
|
4162
|
+
return null;
|
|
4163
|
+
}
|
|
4164
|
+
}
|
|
4142
4165
|
async function analyzeSelfPostTask(opts) {
|
|
4143
4166
|
const {
|
|
4144
4167
|
model,
|
|
@@ -7104,7 +7127,7 @@ function registerJobCommands(program2) {
|
|
|
7104
7127
|
jobCmd.command("list").description("List your defined jobs").action(async () => {
|
|
7105
7128
|
try {
|
|
7106
7129
|
const userId = await getCurrentUserId();
|
|
7107
|
-
const { JobRunner: JobRunner2 } = await import("./job-runner-
|
|
7130
|
+
const { JobRunner: JobRunner2 } = await import("./job-runner-VIGPBGRE.js");
|
|
7108
7131
|
const runner = new JobRunner2();
|
|
7109
7132
|
const jobs = await runner.listJobs();
|
|
7110
7133
|
if (jobs.length === 0) {
|
|
@@ -7128,7 +7151,7 @@ function registerJobCommands(program2) {
|
|
|
7128
7151
|
jobCmd.command("status [name]").description("Show run history for a job (or all jobs)").option("-l, --limit <number>", "Max runs to show (default: 5)").action(async (name, opts) => {
|
|
7129
7152
|
try {
|
|
7130
7153
|
const userId = await getCurrentUserId();
|
|
7131
|
-
const { JobRunner: JobRunner2 } = await import("./job-runner-
|
|
7154
|
+
const { JobRunner: JobRunner2 } = await import("./job-runner-VIGPBGRE.js");
|
|
7132
7155
|
const runner = new JobRunner2();
|
|
7133
7156
|
const runs = await runner.getRunHistory(name, parseInt(opts.limit || "5"));
|
|
7134
7157
|
if (runs.length === 0) {
|
|
@@ -7167,7 +7190,7 @@ Job Run History${name ? ` \u2014 ${name}` : ""}:`));
|
|
|
7167
7190
|
process.exit(1);
|
|
7168
7191
|
}
|
|
7169
7192
|
const userId = await getCurrentUserId();
|
|
7170
|
-
const { JobRunner: JobRunner2 } = await import("./job-runner-
|
|
7193
|
+
const { JobRunner: JobRunner2 } = await import("./job-runner-VIGPBGRE.js");
|
|
7171
7194
|
const runner = new JobRunner2();
|
|
7172
7195
|
const job = await runner.loadJob(name);
|
|
7173
7196
|
if (!job) {
|
package/package.json
CHANGED
|
@@ -65,11 +65,11 @@ const SELF_ANALYSIS_OUTPUT_FORMAT: OutputFormat = {
|
|
|
65
65
|
type: "object",
|
|
66
66
|
properties: {
|
|
67
67
|
session_logs_useful: { type: "boolean" },
|
|
68
|
-
session_logs_gaps: { type:
|
|
68
|
+
session_logs_gaps: { type: "string" },
|
|
69
69
|
message_events_useful: { type: "boolean" },
|
|
70
|
-
message_events_gaps: { type:
|
|
70
|
+
message_events_gaps: { type: "string" },
|
|
71
71
|
conversation_context_useful: { type: "boolean" },
|
|
72
|
-
conversation_context_gaps: { type:
|
|
72
|
+
conversation_context_gaps: { type: "string" },
|
|
73
73
|
},
|
|
74
74
|
required: [
|
|
75
75
|
"session_logs_useful",
|
|
@@ -348,6 +348,21 @@ async function submitSelfAnalysisFeedback(analysis: SelfAnalysisResult): Promise
|
|
|
348
348
|
// ── Query Runner ────────────────────────────────────────────────
|
|
349
349
|
|
|
350
350
|
async function runAnalysisQuery(model: string, prompt: string): Promise<unknown> {
|
|
351
|
+
// First attempt: structured output
|
|
352
|
+
const result = await attemptQuery(model, prompt, SELF_ANALYSIS_OUTPUT_FORMAT);
|
|
353
|
+
if (result) return result;
|
|
354
|
+
|
|
355
|
+
// Fallback: no structured output, parse JSON from text response
|
|
356
|
+
log.info("Self-analysis: retrying without structured output (fallback)");
|
|
357
|
+
const fallbackResult = await attemptQuery(model, prompt, undefined);
|
|
358
|
+
return fallbackResult;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
async function attemptQuery(
|
|
362
|
+
model: string,
|
|
363
|
+
prompt: string,
|
|
364
|
+
outputFormat: OutputFormat | undefined
|
|
365
|
+
): Promise<unknown> {
|
|
351
366
|
let structuredOutput: unknown;
|
|
352
367
|
|
|
353
368
|
// Use independent query() instead of session resume to avoid
|
|
@@ -358,8 +373,8 @@ async function runAnalysisQuery(model: string, prompt: string): Promise<unknown>
|
|
|
358
373
|
model,
|
|
359
374
|
maxTurns: 10,
|
|
360
375
|
allowedTools: [],
|
|
361
|
-
effort: "
|
|
362
|
-
outputFormat:
|
|
376
|
+
effort: "medium",
|
|
377
|
+
...(outputFormat ? { outputFormat } : {}),
|
|
363
378
|
},
|
|
364
379
|
})) {
|
|
365
380
|
if (message.type === "result") {
|
|
@@ -371,10 +386,17 @@ async function runAnalysisQuery(model: string, prompt: string): Promise<unknown>
|
|
|
371
386
|
`Self-analysis cost: $${successMsg.total_cost_usd.toFixed(4)}`
|
|
372
387
|
);
|
|
373
388
|
if (!structuredOutput) {
|
|
374
|
-
//
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
)
|
|
389
|
+
// Try to parse JSON from text result as fallback
|
|
390
|
+
const text = String((successMsg as any).result ?? "");
|
|
391
|
+
const parsed = tryParseJson(text);
|
|
392
|
+
if (parsed) {
|
|
393
|
+
log.info("Self-analysis: parsed JSON from text result");
|
|
394
|
+
structuredOutput = parsed;
|
|
395
|
+
} else {
|
|
396
|
+
log.warn(
|
|
397
|
+
`Self-analysis: success but no structured_output. result text: ${text.slice(0, 500)}`
|
|
398
|
+
);
|
|
399
|
+
}
|
|
378
400
|
}
|
|
379
401
|
} else {
|
|
380
402
|
log.warn(
|
|
@@ -387,6 +409,17 @@ async function runAnalysisQuery(model: string, prompt: string): Promise<unknown>
|
|
|
387
409
|
return structuredOutput;
|
|
388
410
|
}
|
|
389
411
|
|
|
412
|
+
function tryParseJson(text: string): unknown {
|
|
413
|
+
// Extract JSON from text that may contain markdown code fences
|
|
414
|
+
const jsonMatch = text.match(/```(?:json)?\s*([\s\S]*?)```/) || text.match(/(\{[\s\S]*\})/);
|
|
415
|
+
if (!jsonMatch) return null;
|
|
416
|
+
try {
|
|
417
|
+
return JSON.parse(jsonMatch[1]);
|
|
418
|
+
} catch {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
390
423
|
// ── Main Entry Point ────────────────────────────────────────────
|
|
391
424
|
|
|
392
425
|
/**
|
package/src/utils/config.ts
CHANGED
|
@@ -28,7 +28,7 @@ const CONFIG_DEFAULTS: Partial<AssistMeConfig> = {
|
|
|
28
28
|
supabaseAnonKey: SUPABASE_ANON_KEY_DEFAULT,
|
|
29
29
|
sessionName: "Default",
|
|
30
30
|
model: "claude-sonnet-4-20250514",
|
|
31
|
-
maxTurns:
|
|
31
|
+
maxTurns: 500,
|
|
32
32
|
taskTimeoutMinutes: 10,
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -51,7 +51,7 @@ export function getConfig(): AssistMeConfig {
|
|
|
51
51
|
workspacePath: resolve(workspacePath),
|
|
52
52
|
sessionName: config.get("sessionName") || "Default",
|
|
53
53
|
model: config.get("model") || "claude-sonnet-4-20250514",
|
|
54
|
-
maxTurns: config.get("maxTurns") ||
|
|
54
|
+
maxTurns: config.get("maxTurns") || 500,
|
|
55
55
|
taskTimeoutMinutes: config.get("taskTimeoutMinutes") || 10,
|
|
56
56
|
};
|
|
57
57
|
}
|