assistme 0.8.10 → 0.8.12
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-QGH5MFJA.js → chunk-5ML5YMCM.js} +30 -227
- package/dist/chunk-MP4E522X.js +8587 -0
- package/dist/chunk-YHUARPU7.js +161 -0
- package/dist/{chunk-HY3FFXSQ.js → chunk-ZUUASYPZ.js} +28 -3
- package/dist/{config-2HH7PO34.js → config-D6BMAQGN.js} +1 -1
- package/dist/index.js +1881 -2141
- package/dist/job-runner-NA3KJCKA.js +8 -0
- package/dist/logger-5TGLXZKK.js +20 -0
- package/dist/workers/entry.js +7 -3367
- package/eslint.config.mjs +154 -0
- package/package.json +7 -1
- package/src/agent/execution/coach-prompt.md +26 -0
- package/src/agent/{event-hooks.ts → execution/event-hooks.ts} +32 -32
- package/src/agent/execution/index.ts +38 -0
- package/src/agent/execution/processor-qa.ts +142 -0
- package/src/agent/execution/processor-setup.ts +111 -0
- package/src/agent/execution/processor.ts +279 -0
- package/src/agent/execution/prompt-builder.ts +106 -0
- package/src/agent/execution/self-scoring-coach.ts +113 -0
- package/src/agent/execution/self-scoring.ts +321 -0
- package/src/agent/{system-prompt.ts → execution/system-prompt.md} +59 -10
- package/src/agent/execution/system-prompt.ts +21 -0
- package/src/agent/execution/task-verifier.ts +272 -0
- package/src/agent/{title-generator.ts → execution/title-generator.ts} +4 -3
- package/src/agent/execution/verification-prompt.md +16 -0
- package/src/agent/execution/verification-session.ts +129 -0
- package/src/agent/heartbeat/compiler-prompt.md +27 -0
- package/src/agent/{heartbeat-checks.ts → heartbeat/heartbeat-checks.ts} +7 -5
- package/src/agent/{heartbeat-compiler.ts → heartbeat/heartbeat-compiler.ts} +9 -33
- package/src/agent/heartbeat/heartbeat-io.ts +138 -0
- package/src/agent/heartbeat/heartbeat-system-prompt.md +16 -0
- package/src/agent/heartbeat/index.ts +28 -0
- package/src/agent/{proactive-monitor.ts → heartbeat/proactive-monitor.ts} +60 -197
- package/src/agent/{session-heartbeat.ts → heartbeat/session-heartbeat.ts} +2 -2
- package/src/agent/memory/index.ts +6 -0
- package/src/agent/memory/manager.ts +158 -0
- package/src/agent/{self-analyzer.ts → memory/self-analyzer.ts} +30 -51
- package/src/agent/scheduling/index.ts +15 -0
- package/src/agent/{job-analysis-poller.ts → scheduling/job-analysis-poller.ts} +2 -2
- package/src/agent/{job-runner.ts → scheduling/job-runner.ts} +43 -30
- package/src/agent/{scheduler.ts → scheduling/scheduler.ts} +5 -4
- package/src/agent/{task-poller.ts → scheduling/task-poller.ts} +4 -4
- package/src/agent/shared/index.ts +5 -0
- package/src/agent/{sdk-stream.ts → shared/sdk-stream.ts} +10 -5
- package/src/agent/shared/types.ts +18 -0
- package/src/agent/skills/index.ts +49 -0
- package/src/agent/{skills.ts → skills/manager.ts} +61 -270
- package/src/agent/skills/skill-crud.ts +216 -0
- package/src/agent/{skill-db.ts → skills/skill-db.ts} +2 -2
- package/src/agent/skills/skill-discovery.ts +62 -0
- package/src/agent/{skill-evaluator.ts → skills/skill-evaluator.ts} +8 -7
- package/src/agent/{skill-format.ts → skills/skill-format.ts} +4 -15
- package/src/agent/{skill-marketplace.ts → skills/skill-marketplace.ts} +21 -18
- package/src/agent/skills/skill-sync.ts +87 -0
- package/src/agent/{skill-types.ts → skills/skill-types.ts} +12 -9
- package/src/agent/{skill-utils.ts → skills/skill-utils.ts} +55 -11
- package/src/browser/actions-basic.ts +285 -0
- package/src/browser/actions.ts +293 -0
- package/src/browser/chrome-discovery.ts +119 -0
- package/src/browser/chrome-launcher.ts +14 -359
- package/src/browser/chrome-profile.ts +243 -0
- package/src/browser/connection.ts +352 -0
- package/src/browser/controller.ts +86 -1788
- package/src/browser/delays.ts +35 -0
- package/src/browser/navigation.ts +189 -0
- package/src/browser/scripts.ts +168 -0
- package/src/browser/snapshot-scripts.ts +327 -0
- package/src/browser/snapshot.ts +346 -0
- package/src/commands/auth.ts +24 -27
- package/src/commands/browser.ts +31 -37
- package/src/commands/config.ts +13 -20
- package/src/commands/credential.ts +26 -25
- package/src/commands/job.ts +37 -33
- package/src/commands/memory.ts +28 -24
- package/src/commands/monitor.ts +31 -40
- package/src/commands/schedule.ts +25 -23
- package/src/commands/skill.ts +19 -37
- package/src/commands/start.ts +25 -24
- package/src/commands/status.ts +14 -21
- package/src/credentials/credential-store.ts +97 -39
- package/src/credentials/encryption.ts +3 -3
- package/src/credentials/index.ts +4 -5
- package/src/credentials/local-store.ts +1 -0
- package/src/credentials/program-store.ts +33 -5
- package/src/db/analysis-data.ts +1 -1
- package/src/db/auth-store.ts +1 -0
- package/src/db/auth.ts +1 -1
- package/src/db/conversation.ts +6 -4
- package/src/db/event.ts +15 -25
- package/src/db/job-poll.ts +1 -1
- package/src/db/session-log.ts +5 -14
- package/src/db/session.ts +3 -2
- package/src/db/supabase.ts +11 -11
- package/src/db/task.ts +3 -2
- package/src/db/types.ts +1 -0
- package/src/index.ts +9 -8
- package/src/mcp/agent-tools-server.ts +27 -1375
- package/src/mcp/ask-user.ts +8 -6
- package/src/mcp/browser-server.ts +52 -43
- package/src/mcp/office-server.ts +119 -0
- package/src/mcp/skill-confirmation.ts +2 -4
- package/src/mcp/tools/ask-user-tools.ts +82 -0
- package/src/mcp/tools/credential-tools.ts +131 -0
- package/src/mcp/tools/heartbeat-tools.ts +91 -0
- package/src/mcp/tools/job-tools.ts +224 -0
- package/src/mcp/tools/memory-tools.ts +54 -0
- package/src/mcp/tools/program-tools.ts +162 -0
- package/src/mcp/tools/response.ts +30 -0
- package/src/mcp/tools/skill-tools-discovery.ts +288 -0
- package/src/mcp/tools/skill-tools.ts +215 -0
- package/src/mcp/tools/types.ts +10 -0
- package/src/office/document.ts +277 -0
- package/src/office/index.ts +48 -0
- package/src/office/presentation.ts +252 -0
- package/src/office/reader.ts +434 -0
- package/src/office/schemas.ts +196 -0
- package/src/office/spreadsheet.ts +77 -0
- package/src/orchestrator.ts +61 -63
- package/src/tools/browser.ts +9 -9
- package/src/tools/filesystem.ts +7 -18
- package/src/tools/index.ts +84 -47
- package/src/tools/shell.ts +8 -75
- package/src/types/modules.d.ts +309 -0
- package/src/utils/config.ts +4 -3
- package/src/utils/constants.ts +54 -97
- package/src/utils/errors.ts +46 -1
- package/src/utils/fire-and-forget.ts +29 -0
- package/src/utils/logger.ts +3 -3
- package/src/utils/rate-limiter.ts +5 -115
- package/src/utils/retry.ts +7 -120
- package/src/utils/schemas.ts +2 -0
- package/src/utils/template-loader.ts +49 -0
- package/src/workers/base-handler.ts +3 -3
- package/src/workers/conversation.ts +6 -4
- package/src/workers/entry.ts +2 -2
- package/src/workers/index.ts +5 -5
- package/src/workers/manager.ts +45 -24
- package/src/workers/worker-lifecycle.ts +12 -11
- package/tests/agent/command-injection.test.ts +154 -0
- package/tests/agent/event-hooks.test.ts +30 -24
- package/tests/agent/heartbeat-checks.test.ts +11 -6
- package/tests/agent/mcp-servers.test.ts +4 -3
- package/tests/agent/memory.test.ts +2 -70
- package/tests/agent/proactive-monitor.test.ts +31 -29
- package/tests/agent/processor.test.ts +203 -13
- package/tests/agent/qa-pipeline.test.ts +389 -0
- package/tests/agent/scheduler.test.ts +3 -2
- package/tests/agent/sdk-stream.test.ts +3 -2
- package/tests/agent/self-analyzer.test.ts +5 -3
- package/tests/agent/self-scoring.test.ts +451 -0
- package/tests/agent/session.test.ts +3 -3
- package/tests/agent/skill-format.test.ts +8 -4
- package/tests/agent/skill-search.test.ts +4 -3
- package/tests/agent/skill-types.test.ts +68 -0
- package/tests/agent/skill-utils.test.ts +3 -3
- package/tests/agent/skills.test.ts +3 -3
- package/tests/agent/task-verifier.test.ts +386 -0
- package/tests/agent/title-generator.test.ts +4 -3
- package/tests/browser/snapshot.test.ts +185 -0
- package/tests/credentials/credential-store.test.ts +9 -8
- package/tests/credentials/encryption.test.ts +5 -4
- package/tests/credentials/program-store.test.ts +13 -12
- package/tests/db/supabase.test.ts +1 -1
- package/tests/mcp/ask-user.test.ts +1 -1
- package/tests/mcp/skill-confirmation.integration.test.ts +17 -17
- package/tests/mcp/skill-confirmation.test.ts +4 -3
- package/tests/office/document.test.ts +239 -0
- package/tests/office/error-recovery.test.ts +328 -0
- package/tests/office/executeTool.test.ts +283 -0
- package/tests/office/office-server.test.ts +21 -0
- package/tests/office/presentation.test.ts +296 -0
- package/tests/office/reader.test.ts +326 -0
- package/tests/office/spreadsheet.test.ts +184 -0
- package/tests/tools/filesystem.test.ts +7 -7
- package/tests/tools/shell.test.ts +41 -72
- package/tests/utils/config.test.ts +2 -2
- package/tests/utils/errors.test.ts +89 -0
- package/tests/utils/rate-limiter.test.ts +8 -96
- package/tests/utils/retry.test.ts +3 -110
- package/dist/chunk-T3DBLWUW.js +0 -3741
- package/dist/job-runner-IBVUDW6A.js +0 -7
- package/eslint.config.js +0 -20
- package/src/agent/mcp-servers.ts +0 -7
- package/src/agent/memory.ts +0 -280
- package/src/agent/processor.ts +0 -317
- package/src/agent/prompt-builder.ts +0 -83
- package/src/agent/skill-extractor.ts +0 -8
- package/src/agent/task-timeout.ts +0 -50
- /package/src/agent/{heartbeat-types.ts → heartbeat/heartbeat-types.ts} +0 -0
- /package/src/agent/{skill-search.ts → skills/skill-search.ts} +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
log
|
|
3
|
+
} from "./chunk-YHUARPU7.js";
|
|
1
4
|
import {
|
|
2
5
|
errorMessage,
|
|
3
6
|
getConfig,
|
|
4
7
|
getDataDir
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZUUASYPZ.js";
|
|
6
9
|
|
|
7
10
|
// src/db/auth-store.ts
|
|
8
11
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -57,154 +60,6 @@ async function callMcpHandler(action, params = {}, overrideToken) {
|
|
|
57
60
|
return body.data;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
// src/utils/logger.ts
|
|
61
|
-
import chalk from "chalk";
|
|
62
|
-
import { randomUUID } from "crypto";
|
|
63
|
-
import { readFileSync as readFileSync2 } from "fs";
|
|
64
|
-
import { join as join2, dirname } from "path";
|
|
65
|
-
import { fileURLToPath } from "url";
|
|
66
|
-
var currentLevel = "info";
|
|
67
|
-
var currentCorrelationId = null;
|
|
68
|
-
var currentConversationId = null;
|
|
69
|
-
var logHook = null;
|
|
70
|
-
var logTransport = null;
|
|
71
|
-
var PKG_VERSION = (() => {
|
|
72
|
-
try {
|
|
73
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
74
|
-
for (const rel of ["../package.json", "../../package.json"]) {
|
|
75
|
-
try {
|
|
76
|
-
const pkg = JSON.parse(readFileSync2(join2(__dirname, rel), "utf-8"));
|
|
77
|
-
if (pkg.version) return pkg.version;
|
|
78
|
-
} catch {
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
} catch {
|
|
82
|
-
}
|
|
83
|
-
return "unknown";
|
|
84
|
-
})();
|
|
85
|
-
var LEVEL_ORDER = {
|
|
86
|
-
debug: 0,
|
|
87
|
-
info: 1,
|
|
88
|
-
warn: 2,
|
|
89
|
-
error: 3
|
|
90
|
-
};
|
|
91
|
-
function setLogLevel(level) {
|
|
92
|
-
currentLevel = level;
|
|
93
|
-
}
|
|
94
|
-
function setLogHook(hook) {
|
|
95
|
-
logHook = hook;
|
|
96
|
-
}
|
|
97
|
-
function setLogTransport(transport) {
|
|
98
|
-
logTransport = transport;
|
|
99
|
-
}
|
|
100
|
-
function setCorrelationId(id) {
|
|
101
|
-
currentCorrelationId = id;
|
|
102
|
-
}
|
|
103
|
-
function setLogConversationId(id) {
|
|
104
|
-
currentConversationId = id;
|
|
105
|
-
}
|
|
106
|
-
function newCorrelationId() {
|
|
107
|
-
const id = randomUUID().slice(0, 8);
|
|
108
|
-
currentCorrelationId = id;
|
|
109
|
-
return id;
|
|
110
|
-
}
|
|
111
|
-
function shouldLog(level) {
|
|
112
|
-
return LEVEL_ORDER[level] >= LEVEL_ORDER[currentLevel];
|
|
113
|
-
}
|
|
114
|
-
function timestamp() {
|
|
115
|
-
return (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
|
|
116
|
-
}
|
|
117
|
-
function prefix() {
|
|
118
|
-
const ts = timestamp();
|
|
119
|
-
const base = `${ts} v${PKG_VERSION}`;
|
|
120
|
-
return currentCorrelationId ? `${base} ${currentCorrelationId}` : base;
|
|
121
|
-
}
|
|
122
|
-
var log = {
|
|
123
|
-
debug(msg, ...args) {
|
|
124
|
-
if (shouldLog("debug")) {
|
|
125
|
-
const text = formatArgs(msg, args);
|
|
126
|
-
if (logTransport) {
|
|
127
|
-
logTransport("debug", text);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
logHook?.("stdout", `[DEBUG] ${text}`, currentConversationId);
|
|
131
|
-
console.log(chalk.gray(`[${prefix()}] DEBUG`), msg, ...args);
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
info(msg, ...args) {
|
|
135
|
-
if (shouldLog("info")) {
|
|
136
|
-
const text = formatArgs(msg, args);
|
|
137
|
-
if (logTransport) {
|
|
138
|
-
logTransport("info", text);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
logHook?.("stdout", text, currentConversationId);
|
|
142
|
-
console.log(chalk.blue(`[${prefix()}]`), msg, ...args);
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
success(msg, ...args) {
|
|
146
|
-
if (shouldLog("info")) {
|
|
147
|
-
const text = formatArgs(msg, args);
|
|
148
|
-
if (logTransport) {
|
|
149
|
-
logTransport("success", text);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
logHook?.("stdout", `\u2713 ${text}`, currentConversationId);
|
|
153
|
-
console.log(chalk.green(`[${prefix()}] \u2713`), msg, ...args);
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
warn(msg, ...args) {
|
|
157
|
-
if (shouldLog("warn")) {
|
|
158
|
-
const text = formatArgs(msg, args);
|
|
159
|
-
if (logTransport) {
|
|
160
|
-
logTransport("warn", text);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
logHook?.("stderr", `[WARN] ${text}`, currentConversationId);
|
|
164
|
-
console.log(chalk.yellow(`[${prefix()}] WARN`), msg, ...args);
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
error(msg, ...args) {
|
|
168
|
-
if (shouldLog("error")) {
|
|
169
|
-
const text = formatArgs(msg, args);
|
|
170
|
-
if (logTransport) {
|
|
171
|
-
logTransport("error", text);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
logHook?.("stderr", `[ERROR] ${text}`, currentConversationId);
|
|
175
|
-
console.error(chalk.red(`[${prefix()}] ERROR`), msg, ...args);
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
agent(msg) {
|
|
179
|
-
if (logTransport) {
|
|
180
|
-
logTransport("agent", msg);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
logHook?.("stdout", `\u25B8 ${msg}`, currentConversationId);
|
|
184
|
-
console.log(chalk.cyan(" \u25B8"), msg);
|
|
185
|
-
},
|
|
186
|
-
tool(name, msg) {
|
|
187
|
-
if (logTransport) {
|
|
188
|
-
logTransport("tool", msg, name);
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
logHook?.("stdout", `\u26A1 ${name}: ${msg}`, currentConversationId);
|
|
192
|
-
console.log(chalk.magenta(` \u26A1 ${name}:`), msg);
|
|
193
|
-
},
|
|
194
|
-
result(msg) {
|
|
195
|
-
if (logTransport) {
|
|
196
|
-
logTransport("result", msg);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
logHook?.("stdout", `\u2190 ${msg}`, currentConversationId);
|
|
200
|
-
console.log(chalk.green(" \u2190"), msg);
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
function formatArgs(msg, args) {
|
|
204
|
-
if (args.length === 0) return msg;
|
|
205
|
-
return `${msg} ${args.map((a) => typeof a === "string" ? a : JSON.stringify(a)).join(" ")}`;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
63
|
// src/utils/schemas.ts
|
|
209
64
|
import { z } from "zod";
|
|
210
65
|
function safeParse(schema, data) {
|
|
@@ -240,6 +95,7 @@ var JobRowSchema = z.object({
|
|
|
240
95
|
job_id: z.string(),
|
|
241
96
|
job_name: z.string(),
|
|
242
97
|
job_description: z.string().optional().default(""),
|
|
98
|
+
job_prompt: z.string().optional().nullable(),
|
|
243
99
|
skill_id: z.string().optional().nullable(),
|
|
244
100
|
skill_name: z.string().optional().nullable(),
|
|
245
101
|
skill_description: z.string().optional().default(""),
|
|
@@ -250,6 +106,7 @@ var JobListRowSchema = z.object({
|
|
|
250
106
|
id: z.string(),
|
|
251
107
|
name: z.string(),
|
|
252
108
|
description: z.string().optional().default(""),
|
|
109
|
+
prompt: z.string().optional().nullable(),
|
|
253
110
|
skill_count: z.number().optional().default(0)
|
|
254
111
|
});
|
|
255
112
|
var JobRunRowSchema = z.object({
|
|
@@ -319,40 +176,7 @@ var SelfAnalysisResultSchema = z.object({
|
|
|
319
176
|
summary: z.string()
|
|
320
177
|
});
|
|
321
178
|
|
|
322
|
-
// src/
|
|
323
|
-
var MAX_RESPONSE_CONTENT_LENGTH = 5e4;
|
|
324
|
-
var MAX_TOOL_RESULT_LENGTH = 1e4;
|
|
325
|
-
var MAX_SKILL_RECORD_RESULT_LENGTH = 300;
|
|
326
|
-
var MAX_TOOL_INPUT_LOG_LENGTH = 200;
|
|
327
|
-
var MAX_JOB_SUMMARY_LENGTH = 1e4;
|
|
328
|
-
var MAX_HISTORY_RESPONSE_LENGTH = 1500;
|
|
329
|
-
var MAX_HISTORY_ENTRIES = 10;
|
|
330
|
-
var SKILL_DESCRIPTION_BUDGET_CHARS = 16e3;
|
|
331
|
-
var SHELL_TIMEOUT_MS = 3e4;
|
|
332
|
-
var SHELL_MAX_OUTPUT = 5e4;
|
|
333
|
-
var CDP_COMMAND_TIMEOUT_MS = 15e3;
|
|
334
|
-
var WS_CONNECT_TIMEOUT_MS = 5e3;
|
|
335
|
-
var SCHEDULER_INTERVAL_MS = 3e4;
|
|
336
|
-
var FRAME_CONTEXTS_MAX_SIZE = 500;
|
|
337
|
-
var MAX_FILE_SEARCH_RESULTS = 50;
|
|
338
|
-
var MAX_CONTENT_SEARCH_FILES = 200;
|
|
339
|
-
var MAX_CONTENT_SEARCH_RESULTS = 30;
|
|
340
|
-
var MEMORY_DEDUP_SIMILARITY_THRESHOLD = 0.75;
|
|
341
|
-
var MEMORY_COMPRESSION_THRESHOLD = 50;
|
|
342
|
-
var MEMORY_COMPRESSION_TARGET = 30;
|
|
343
|
-
var SELF_ANALYSIS_MAX_SESSION_LOGS = 200;
|
|
344
|
-
var SELF_ANALYSIS_MAX_MESSAGE_EVENTS = 300;
|
|
345
|
-
var SELF_ANALYSIS_MAX_CONVERSATION_MESSAGES = 10;
|
|
346
|
-
var SELF_ANALYSIS_LOG_CONTEXT_CHARS = 2e4;
|
|
347
|
-
var SELF_ANALYSIS_EVENT_CONTEXT_CHARS = 2e4;
|
|
348
|
-
var SELF_ANALYSIS_TIMEOUT_MS = 18e4;
|
|
349
|
-
var EDSGER_PRODUCT_SLUG = "assistme";
|
|
350
|
-
var HEARTBEAT_INTERVAL_MS = 30 * 6e4;
|
|
351
|
-
var HEARTBEAT_MAX_BUDGET_USD = 0.25;
|
|
352
|
-
var HEARTBEAT_LOG_MAX_ENTRIES = 100;
|
|
353
|
-
var MAX_COMPLETE_TASK_RETRIES = 2;
|
|
354
|
-
|
|
355
|
-
// src/agent/job-runner.ts
|
|
179
|
+
// src/agent/scheduling/job-runner.ts
|
|
356
180
|
var JobRunner = class {
|
|
357
181
|
/**
|
|
358
182
|
* Load a job and its linked skills from the database.
|
|
@@ -366,15 +190,16 @@ var JobRunner = class {
|
|
|
366
190
|
if (!data || !Array.isArray(data) || data.length === 0) {
|
|
367
191
|
return null;
|
|
368
192
|
}
|
|
369
|
-
const rows = data.map((row) => safeParse(JobRowSchema, row)).filter(
|
|
193
|
+
const rows = data.map((row) => safeParse(JobRowSchema, row)).filter((r) => r != null);
|
|
370
194
|
if (rows.length === 0) return null;
|
|
371
195
|
const first = rows[0];
|
|
372
196
|
return {
|
|
373
197
|
jobId: first.job_id,
|
|
374
198
|
jobName: first.job_name,
|
|
375
199
|
jobDescription: first.job_description,
|
|
200
|
+
jobPrompt: first.job_prompt ?? null,
|
|
376
201
|
skills: rows.filter((row) => row.skill_id).map((row) => ({
|
|
377
|
-
skillId: row.skill_id,
|
|
202
|
+
skillId: row.skill_id ?? "",
|
|
378
203
|
skillName: row.skill_name || "",
|
|
379
204
|
skillDescription: row.skill_description,
|
|
380
205
|
skillEmoji: row.skill_emoji,
|
|
@@ -392,7 +217,7 @@ var JobRunner = class {
|
|
|
392
217
|
async listJobs() {
|
|
393
218
|
try {
|
|
394
219
|
const data = await callMcpHandler("job.list");
|
|
395
|
-
return (data || []).map((row) => safeParse(JobListRowSchema, row)).filter(
|
|
220
|
+
return (data || []).map((row) => safeParse(JobListRowSchema, row)).filter((r) => r != null).map((row) => ({
|
|
396
221
|
id: row.id,
|
|
397
222
|
name: row.name,
|
|
398
223
|
description: row.description,
|
|
@@ -430,7 +255,7 @@ var JobRunner = class {
|
|
|
430
255
|
await callMcpHandler("job.complete_run", {
|
|
431
256
|
run_id: runId,
|
|
432
257
|
status,
|
|
433
|
-
summary: summary
|
|
258
|
+
summary: summary || null
|
|
434
259
|
});
|
|
435
260
|
}
|
|
436
261
|
/**
|
|
@@ -442,7 +267,7 @@ var JobRunner = class {
|
|
|
442
267
|
job_name: jobName || null,
|
|
443
268
|
limit
|
|
444
269
|
});
|
|
445
|
-
return (data || []).map((row) => safeParse(JobRunRowSchema, row)).filter(
|
|
270
|
+
return (data || []).map((row) => safeParse(JobRunRowSchema, row)).filter((r) => r != null).map((row) => ({
|
|
446
271
|
runId: row.run_id,
|
|
447
272
|
jobName: row.job_name,
|
|
448
273
|
status: row.status,
|
|
@@ -469,7 +294,12 @@ var JobRunner = class {
|
|
|
469
294
|
prompt += `**Name:** ${job.jobName}
|
|
470
295
|
`;
|
|
471
296
|
prompt += `**Description:** ${job.jobDescription}
|
|
472
|
-
|
|
297
|
+
`;
|
|
298
|
+
if (job.jobPrompt) {
|
|
299
|
+
prompt += `**Current Execution Prompt:** ${job.jobPrompt}
|
|
300
|
+
`;
|
|
301
|
+
}
|
|
302
|
+
prompt += `
|
|
473
303
|
`;
|
|
474
304
|
if (job.skills.length > 0) {
|
|
475
305
|
prompt += `**Current Skills:**
|
|
@@ -510,9 +340,10 @@ var JobRunner = class {
|
|
|
510
340
|
* chain them based on what it discovers at runtime.
|
|
511
341
|
*/
|
|
512
342
|
buildJobPrompt(job, runId) {
|
|
343
|
+
const effectiveDescription = job.jobPrompt || job.jobDescription;
|
|
513
344
|
let prompt = `## Job: ${job.jobName}
|
|
514
345
|
`;
|
|
515
|
-
prompt += `*${
|
|
346
|
+
prompt += `*${effectiveDescription}*
|
|
516
347
|
|
|
517
348
|
`;
|
|
518
349
|
prompt += `**Run ID:** ${runId}
|
|
@@ -536,12 +367,19 @@ var JobRunner = class {
|
|
|
536
367
|
}
|
|
537
368
|
prompt += `
|
|
538
369
|
### How to Work
|
|
370
|
+
`;
|
|
371
|
+
prompt += `- **IMPORTANT \u2014 do NOT call \`job_run\` again**: You are already executing this job. Calling \`job_run\` would create an infinite loop. Use \`skill_invoke\` to load individual skills instead.
|
|
372
|
+
`;
|
|
373
|
+
prompt += `- **Plan first**: Before jumping into actions, briefly plan your approach \u2014 which sites/tools to use, in what order, and how to verify results.
|
|
539
374
|
`;
|
|
540
375
|
prompt += `- **Be agentic**: Decide what to do based on what you discover. `;
|
|
541
376
|
prompt += `If checking Slack reveals a request that requires GitHub work, go do the GitHub work immediately \u2014 don't just note it for later.
|
|
542
377
|
`;
|
|
543
378
|
prompt += `- **Chain dynamically**: One skill's output should inform your next action. `;
|
|
544
379
|
prompt += `For example, if you find an assigned GitHub issue, use your coding skills to implement it.
|
|
380
|
+
`;
|
|
381
|
+
prompt += `- **Use separate tabs for different sites**: When working across multiple websites, open each in its own tab (browser_new_tab). `;
|
|
382
|
+
prompt += `This preserves page state and avoids re-navigation. Use browser_switch_tab to move between them.
|
|
545
383
|
`;
|
|
546
384
|
prompt += `- **Skip what's irrelevant**: If a capability doesn't apply right now, skip it.
|
|
547
385
|
`;
|
|
@@ -550,6 +388,8 @@ var JobRunner = class {
|
|
|
550
388
|
`;
|
|
551
389
|
prompt += `- **Respond and act**: If you find messages or issues that need replies, reply to them. `;
|
|
552
390
|
prompt += `If you find code tasks, implement them.
|
|
391
|
+
`;
|
|
392
|
+
prompt += `- **Handle auth walls**: If a site requires login, use browser_request_user_action immediately \u2014 do not waste attempts trying to bypass auth walls.
|
|
553
393
|
|
|
554
394
|
`;
|
|
555
395
|
prompt += `When finished, provide a summary of what you accomplished and any items that need the user's attention.
|
|
@@ -562,43 +402,6 @@ export {
|
|
|
562
402
|
readAuthStore,
|
|
563
403
|
writeAuthStore,
|
|
564
404
|
callMcpHandler,
|
|
565
|
-
setLogLevel,
|
|
566
|
-
setLogHook,
|
|
567
|
-
setLogTransport,
|
|
568
|
-
setCorrelationId,
|
|
569
|
-
setLogConversationId,
|
|
570
|
-
newCorrelationId,
|
|
571
|
-
log,
|
|
572
|
-
MAX_RESPONSE_CONTENT_LENGTH,
|
|
573
|
-
MAX_TOOL_RESULT_LENGTH,
|
|
574
|
-
MAX_SKILL_RECORD_RESULT_LENGTH,
|
|
575
|
-
MAX_TOOL_INPUT_LOG_LENGTH,
|
|
576
|
-
MAX_HISTORY_RESPONSE_LENGTH,
|
|
577
|
-
MAX_HISTORY_ENTRIES,
|
|
578
|
-
SKILL_DESCRIPTION_BUDGET_CHARS,
|
|
579
|
-
SHELL_TIMEOUT_MS,
|
|
580
|
-
SHELL_MAX_OUTPUT,
|
|
581
|
-
CDP_COMMAND_TIMEOUT_MS,
|
|
582
|
-
WS_CONNECT_TIMEOUT_MS,
|
|
583
|
-
SCHEDULER_INTERVAL_MS,
|
|
584
|
-
FRAME_CONTEXTS_MAX_SIZE,
|
|
585
|
-
MAX_FILE_SEARCH_RESULTS,
|
|
586
|
-
MAX_CONTENT_SEARCH_FILES,
|
|
587
|
-
MAX_CONTENT_SEARCH_RESULTS,
|
|
588
|
-
MEMORY_DEDUP_SIMILARITY_THRESHOLD,
|
|
589
|
-
MEMORY_COMPRESSION_THRESHOLD,
|
|
590
|
-
MEMORY_COMPRESSION_TARGET,
|
|
591
|
-
SELF_ANALYSIS_MAX_SESSION_LOGS,
|
|
592
|
-
SELF_ANALYSIS_MAX_MESSAGE_EVENTS,
|
|
593
|
-
SELF_ANALYSIS_MAX_CONVERSATION_MESSAGES,
|
|
594
|
-
SELF_ANALYSIS_LOG_CONTEXT_CHARS,
|
|
595
|
-
SELF_ANALYSIS_EVENT_CONTEXT_CHARS,
|
|
596
|
-
SELF_ANALYSIS_TIMEOUT_MS,
|
|
597
|
-
EDSGER_PRODUCT_SLUG,
|
|
598
|
-
HEARTBEAT_INTERVAL_MS,
|
|
599
|
-
HEARTBEAT_MAX_BUDGET_USD,
|
|
600
|
-
HEARTBEAT_LOG_MAX_ENTRIES,
|
|
601
|
-
MAX_COMPLETE_TASK_RETRIES,
|
|
602
405
|
safeParse,
|
|
603
406
|
SkillRowSchema,
|
|
604
407
|
SkillCreateResultSchema,
|