openmausbot 0.1.73 → 0.1.75
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/assets/{index-BYbK7ber.js → index-BTlyRwLl.js} +1 -1
- package/dist/assets/index-CeMbvsgx.js +305 -0
- package/dist/assets/index-DH7Zax6L.css +1 -0
- package/dist/index.html +2 -2
- package/dist-server/container-mcp.js +9 -0
- package/dist-server/index.js +1402 -1048
- package/dist-server/mcp-gate.js +58 -16
- package/dist-server/openmausbot.js +543 -271
- package/dist-server/pair-cli.js +543 -271
- package/dist-server/permission-proxy.js +119 -14
- package/dist-server/server/auto-approve.js +44 -205
- package/dist-server/server/channel-queue.js +20 -2
- package/dist-server/server/config.js +36 -1
- package/dist-server/server/drivers/acp/core.js +58 -4
- package/dist-server/server/drivers/acp/grok.js +15 -2
- package/dist-server/server/drivers/antigravity-acp.js +5 -4
- package/dist-server/server/drivers/antigravity.js +9 -4
- package/dist-server/server/drivers/claude.js +113 -13
- package/dist-server/server/drivers/codex.js +37 -15
- package/dist-server/server/drivers/retry.js +4 -0
- package/dist-server/server/engine-install.js +9 -5
- package/dist-server/server/index.js +265 -233
- package/dist-server/server/message-db.js +70 -3
- package/dist-server/server/permission-proxy.js +90 -15
- package/dist-server/server/procs.js +82 -23
- package/dist-server/server/routines.js +67 -8
- package/dist-server/server/setup-mode.js +6 -7
- package/dist-server/server/steer-queue.js +27 -7
- package/dist-server/server/store.js +19 -0
- package/dist-server/server/team-manifest.js +1 -1
- package/dist-server/server/thread-events.js +10 -1
- package/dist-server/server/webhooks.js +4 -1
- package/dist-server/server/workspace-backup.js +24 -9
- package/dist-server/server/workspace.js +13 -0
- package/dist-server/shared/approval-mode.js +11 -10
- package/dist-server/shared/ask-question.js +172 -0
- package/dist-server/shared/provider-safety.js +6 -0
- package/dist-server/vps-container-mcp.js +9 -0
- package/package.json +1 -1
- package/dist/assets/index-BLJ7byG3.js +0 -296
- package/dist/assets/index-De2TRLxu.css +0 -1
- package/dist-server/server/auto-review.js +0 -79
|
@@ -72,6 +72,25 @@ function redactBotAuthored(message) {
|
|
|
72
72
|
card.summary = redactSecretsInText(card.summary);
|
|
73
73
|
if (typeof card.held === "string")
|
|
74
74
|
card.held = redactSecretsInText(card.held);
|
|
75
|
+
if (typeof card.answeredText === "string")
|
|
76
|
+
card.answeredText = redactSecretsInText(card.answeredText);
|
|
77
|
+
// Bot-authored question text sits behind the subtitle the same way a
|
|
78
|
+
// routine's instructions do, so it is scrubbed on the same boundary.
|
|
79
|
+
if (card.questionRequest) {
|
|
80
|
+
card.questionRequest = {
|
|
81
|
+
...card.questionRequest,
|
|
82
|
+
questions: card.questionRequest.questions.map((question) => ({
|
|
83
|
+
...question,
|
|
84
|
+
question: redactSecretsInText(question.question),
|
|
85
|
+
...(question.header ? { header: redactSecretsInText(question.header) } : {}),
|
|
86
|
+
options: question.options.map((option) => ({
|
|
87
|
+
...option,
|
|
88
|
+
label: redactSecretsInText(option.label),
|
|
89
|
+
...(option.description ? { description: redactSecretsInText(option.description) } : {}),
|
|
90
|
+
})),
|
|
91
|
+
})),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
75
94
|
// Routine definitions are executable bot-authored text stored behind the
|
|
76
95
|
// visible summary. Scrub the durable payload too so nesting it on a card
|
|
77
96
|
// cannot bypass the transcript's secret-redaction boundary.
|
|
@@ -139,7 +139,7 @@ export function parseTeamManifest(value) {
|
|
|
139
139
|
*
|
|
140
140
|
* 1. Allowlist, not blocklist. The returned object is built field by field
|
|
141
141
|
* from the parsed member, so every privilege-bearing BotRecord field —
|
|
142
|
-
* approvalMode, autoApprove,
|
|
142
|
+
* approvalMode, autoApprove, alwaysAllow, chiefOfStaff, approvePeerComms, composio,
|
|
143
143
|
* computer, cloudBackend, cwd — is structurally absent, whatever the
|
|
144
144
|
* file claimed. parseTeamManifest already drops unknown member keys;
|
|
145
145
|
* this keeps the guarantee even if the schema grows a field later,
|
|
@@ -133,6 +133,14 @@ const stringOrMissing = (value) => value === undefined || typeof value === "stri
|
|
|
133
133
|
const stringOrNullOrMissing = (value) => value === undefined || value === null || typeof value === "string";
|
|
134
134
|
const numberOrNullOrMissing = (value) => value === undefined || value === null || typeof value === "number";
|
|
135
135
|
const stringsOrMissing = (value) => value === undefined || (Array.isArray(value) && value.every((item) => typeof item === "string"));
|
|
136
|
+
/** A replayed structured ask. Only the shape the card actually reads is
|
|
137
|
+
* required; the rest is optional and simply absent on an older event. */
|
|
138
|
+
const askQuestionsOrMissing = (value) => value === undefined ||
|
|
139
|
+
(Array.isArray(value) &&
|
|
140
|
+
value.every((question) => isRecord(question) &&
|
|
141
|
+
typeof question.question === "string" &&
|
|
142
|
+
Array.isArray(question.options) &&
|
|
143
|
+
question.options.every((option) => isRecord(option) && typeof option.label === "string")));
|
|
136
144
|
function isRuntimeEvent(value) {
|
|
137
145
|
if (!isRecord(value) ||
|
|
138
146
|
typeof value.eventId !== "string" ||
|
|
@@ -179,7 +187,8 @@ function isRuntimeEvent(value) {
|
|
|
179
187
|
return ((value.requestType === "permission" || value.requestType === "question") &&
|
|
180
188
|
typeof value.tool === "string" &&
|
|
181
189
|
typeof value.summary === "string" &&
|
|
182
|
-
stringsOrMissing(value.choices)
|
|
190
|
+
stringsOrMissing(value.choices) &&
|
|
191
|
+
askQuestionsOrMissing(value.questions));
|
|
183
192
|
case "request.resolved":
|
|
184
193
|
return ((value.behavior === "allow" || value.behavior === "deny" || value.behavior === "answer") &&
|
|
185
194
|
(value.source === "user" ||
|
|
@@ -370,7 +370,10 @@ export class WebhookManager {
|
|
|
370
370
|
const requestedDeliveryId = String(event.deliveryId ?? "").trim().slice(0, 200);
|
|
371
371
|
if (requestedDeliveryId) {
|
|
372
372
|
const key = `${trigger.endpointId}:${requestedDeliveryId}`;
|
|
373
|
-
const
|
|
373
|
+
const committed = this.options.findRun?.(trigger.id, requestedDeliveryId);
|
|
374
|
+
const duplicate = committed
|
|
375
|
+
? { runId: committed.id }
|
|
376
|
+
: this.deliveries.find((delivery) => delivery.key === key);
|
|
374
377
|
if (duplicate) {
|
|
375
378
|
this.appendAttempt(trigger, event, {
|
|
376
379
|
outcome: "duplicate",
|
|
@@ -32,7 +32,7 @@ const EXCLUSION_NOTES = [
|
|
|
32
32
|
"External project folders, CLI login homes, browser session homes, OS keychains, companion devices and other servers.",
|
|
33
33
|
"VM/container disk layers and remote cloud data; durable files inside this workspace are included.",
|
|
34
34
|
];
|
|
35
|
-
const RESTORE_WARNING = "Restoring pauses routines, webhooks and calendar calls, and does not resume pending delegations or queued runs. Definitions and historical receipts are retained; review before enabling them again.";
|
|
35
|
+
const RESTORE_WARNING = "Restoring pauses routines, webhooks and calendar calls, and does not resume pending delegations, queued chat messages or queued runs. Definitions and historical receipts are retained; review before enabling them again.";
|
|
36
36
|
function excluded(name) {
|
|
37
37
|
return EXCLUDED.has(name) || excludedWorkspaceAuthPath(name) || name.startsWith("openmausbot-server.lease.") || name.startsWith("box-create-requests.lock.") || /^perm-[A-Za-z0-9_-]+\.sock$/.test(name);
|
|
38
38
|
}
|
|
@@ -887,17 +887,32 @@ function prepareRestore(dataDir, id, manifest) {
|
|
|
887
887
|
});
|
|
888
888
|
}
|
|
889
889
|
const dbPath = join(prepared, "messages.db");
|
|
890
|
-
if (existsSync(dbPath)
|
|
890
|
+
if (existsSync(dbPath)) {
|
|
891
891
|
const db = new DatabaseSync(dbPath);
|
|
892
892
|
try {
|
|
893
|
-
const update = db.prepare("UPDATE messages SET json = ?, text = ? WHERE thread_id = ? AND id = ?");
|
|
894
893
|
db.exec("BEGIN");
|
|
895
|
-
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
894
|
+
if (manifest.sourceDataDir !== resolve(dataDir)) {
|
|
895
|
+
const update = db.prepare("UPDATE messages SET json = ?, text = ? WHERE thread_id = ? AND id = ?");
|
|
896
|
+
for (const row of db.prepare("SELECT thread_id, id, json FROM messages").iterate()) {
|
|
897
|
+
const message = JSON.parse(String(row.json));
|
|
898
|
+
rebaseMessage(message, manifest.sourceDataDir, resolve(dataDir));
|
|
899
|
+
const json = JSON.stringify(message);
|
|
900
|
+
if (json !== row.json)
|
|
901
|
+
update.run(json, record(message) && typeof message.text === "string" ? message.text : null, row.thread_id, row.id);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
// Import is not a server restart: the source may still be running.
|
|
905
|
+
// Keep accepted words/receipts for review, but never execute a copy of
|
|
906
|
+
// its pending work (including when restoring to the original home).
|
|
907
|
+
if (db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'chat_followups'").get()) {
|
|
908
|
+
const pause = db.prepare("UPDATE chat_followups SET status = 'interrupted', payload = ? WHERE id = ?");
|
|
909
|
+
for (const row of db.prepare("SELECT id, payload FROM chat_followups WHERE status IN ('pending', 'dispatching', 'interrupted')").iterate()) {
|
|
910
|
+
const payload = JSON.parse(String(row.payload));
|
|
911
|
+
rebaseMessage(payload, manifest.sourceDataDir, resolve(dataDir));
|
|
912
|
+
if (record(payload))
|
|
913
|
+
delete payload.prompt;
|
|
914
|
+
pause.run(JSON.stringify(payload), row.id);
|
|
915
|
+
}
|
|
901
916
|
}
|
|
902
917
|
db.exec("COMMIT");
|
|
903
918
|
}
|
|
@@ -52,6 +52,19 @@ export function ensureWorkspace(botId) {
|
|
|
52
52
|
export function workspaceDir(botId) {
|
|
53
53
|
return join(WORKSPACES_DIR, botId);
|
|
54
54
|
}
|
|
55
|
+
/** File locations, not file contents or wider tool permissions. Threads keep
|
|
56
|
+
* independent working directories; the same bot can find its earlier output
|
|
57
|
+
* without assuming that a file absent from the current directory was lost. */
|
|
58
|
+
export function workspaceLocationsPrompt(botId, cwd, botCwd) {
|
|
59
|
+
return "\n\nFile locations for this bot (absolute paths): " + JSON.stringify({
|
|
60
|
+
currentWorkingFolder: cwd ?? "Provider default; inspect the working directory before using relative paths",
|
|
61
|
+
sharedBotFolder: workspaceDir(botId),
|
|
62
|
+
otherThreadFiles: join(TASK_WORKSPACES_DIR, botId),
|
|
63
|
+
...(botCwd ? { configuredProjectFolder: botCwd } : {}),
|
|
64
|
+
}) + ". Different conversations can have different working folders. For an existing file, use the exact path from the conversation; if missing here, check this bot's listed folders before saying it is gone or recreating it." +
|
|
65
|
+
" Follow an explicitly requested destination. Otherwise put new task output in the current working folder and report its absolute path so another thread or room can use it." +
|
|
66
|
+
" Do not move old files, edit another active thread's work, or read another bot's private folders without authorization. These paths do not grant additional access.";
|
|
67
|
+
}
|
|
55
68
|
/** Lines as a person counts them: a file that ends in a newline has no
|
|
56
69
|
* extra empty line after it. Every budget check and every "N lines"
|
|
57
70
|
* message uses this one count. */
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
/** The
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/** The approval levels exposed by the app. Each one is a provider's own
|
|
2
|
+
* permission mode, passed through: OpenMausBot never decides a permission
|
|
3
|
+
* itself (Full access aside, which answers residual prompts because that is
|
|
4
|
+
* what the person granted). The order is the order the selector shows. */
|
|
5
|
+
export const APPROVAL_MODES = ["ask", "edits", "auto", "full", "custom"];
|
|
6
|
+
/** Only providers with an implemented permission mapping may expose a level.
|
|
7
|
+
* `edits` (auto-accept edits) exists where the engine has such a mode:
|
|
8
|
+
* Claude and Grok `acceptEdits`, Antigravity `auto_edit`. Codex's Ask already
|
|
9
|
+
* runs `workspace-write`, so an edits level would change nothing there. */
|
|
4
10
|
export function supportsApprovalMode(driverKind, mode) {
|
|
5
11
|
if (mode === "custom")
|
|
6
12
|
return driverKind === "codex";
|
|
13
|
+
if (mode === "edits")
|
|
14
|
+
return ["claudeAgent", "grokAgent", "antigravityAgent"].includes(driverKind ?? "");
|
|
7
15
|
if (mode !== "full")
|
|
8
16
|
return true;
|
|
9
17
|
return ["codex", "claudeAgent", "antigravityAgent", "cursorAgent", "grokAgent", "opencodeGo"].includes(driverKind ?? "");
|
|
@@ -11,13 +19,6 @@ export function supportsApprovalMode(driverKind, mode) {
|
|
|
11
19
|
export function hasNativeAutoReview(driverKind) {
|
|
12
20
|
return ["codex", "claudeAgent", "cursorAgent", "grokAgent"].includes(driverKind ?? "");
|
|
13
21
|
}
|
|
14
|
-
/** A native reviewer has already declined to decide, or Auto has no native
|
|
15
|
-
* equivalent. Never second-guess that request with the app's heuristic rules.
|
|
16
|
-
* Antigravity and OpenCode Full approve residual ACP tool-permission requests
|
|
17
|
-
* through the app's explicit Full-access grant. Questions remain interactive. */
|
|
18
|
-
export function requiresNativeApproval(driverKind, mode) {
|
|
19
|
-
return mode === "auto" || (mode === "full" && ["claudeAgent", "cursorAgent", "grokAgent"].includes(driverKind));
|
|
20
|
-
}
|
|
21
22
|
export function isApprovalMode(value) {
|
|
22
23
|
return typeof value === "string" && APPROVAL_MODES.includes(value);
|
|
23
24
|
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured questions raised by a provider's own "ask the human" tool —
|
|
3
|
+
* Claude Code's built-in `AskUserQuestion`.
|
|
4
|
+
*
|
|
5
|
+
* That tool reaches us as a PERMISSION ask (the CLI routes it through
|
|
6
|
+
* --permission-prompt-tool like any other tool use), which is exactly the
|
|
7
|
+
* wrong shape: a person cannot answer "which model should this bot use?"
|
|
8
|
+
* with Deny / Always allow / Allow once. So the ask is re-read here into the
|
|
9
|
+
* questions the model actually posed, the card renders them as choices, and
|
|
10
|
+
* the answer goes back as text.
|
|
11
|
+
*
|
|
12
|
+
* The payload is bot-authored, so every field is treated as untrusted: the
|
|
13
|
+
* shape is validated rather than cast, and the counts and lengths are capped
|
|
14
|
+
* so a runaway (or hostile) tool call cannot produce an unreadable card.
|
|
15
|
+
*/
|
|
16
|
+
/** The provider tool whose input this module understands. */
|
|
17
|
+
export const ASK_USER_QUESTION_TOOL = "AskUserQuestion";
|
|
18
|
+
/** Caps. Claude Code's own limits are smaller (1-4 questions, 2-4 options);
|
|
19
|
+
* these leave room for a provider that widens them without letting a card
|
|
20
|
+
* grow without bound. */
|
|
21
|
+
export const MAX_QUESTIONS = 6;
|
|
22
|
+
export const MAX_OPTIONS = 12;
|
|
23
|
+
const MAX_QUESTION_TEXT = 400;
|
|
24
|
+
const MAX_LABEL = 120;
|
|
25
|
+
const MAX_DESCRIPTION = 400;
|
|
26
|
+
/** One free-text answer. Long enough for a sentence or two of context. */
|
|
27
|
+
export const MAX_CUSTOM_ANSWER = 2000;
|
|
28
|
+
function text(value, limit) {
|
|
29
|
+
if (typeof value !== "string")
|
|
30
|
+
return undefined;
|
|
31
|
+
const trimmed = value.trim();
|
|
32
|
+
return trimmed ? trimmed.slice(0, limit) : undefined;
|
|
33
|
+
}
|
|
34
|
+
function isRecord(value) {
|
|
35
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36
|
+
}
|
|
37
|
+
function parseOption(value) {
|
|
38
|
+
// A bare string is not the documented shape, but it is the obvious
|
|
39
|
+
// degradation and costs one line to accept.
|
|
40
|
+
if (typeof value === "string") {
|
|
41
|
+
const label = text(value, MAX_LABEL);
|
|
42
|
+
return label ? { label } : null;
|
|
43
|
+
}
|
|
44
|
+
if (!isRecord(value))
|
|
45
|
+
return null;
|
|
46
|
+
const label = text(value.label, MAX_LABEL);
|
|
47
|
+
if (!label)
|
|
48
|
+
return null;
|
|
49
|
+
const description = text(value.description, MAX_DESCRIPTION);
|
|
50
|
+
return description ? { label, description } : { label };
|
|
51
|
+
}
|
|
52
|
+
function parseQuestion(value) {
|
|
53
|
+
if (!isRecord(value))
|
|
54
|
+
return null;
|
|
55
|
+
const question = text(value.question, MAX_QUESTION_TEXT);
|
|
56
|
+
if (!question)
|
|
57
|
+
return null;
|
|
58
|
+
const options = [];
|
|
59
|
+
const seen = new Set();
|
|
60
|
+
for (const raw of Array.isArray(value.options) ? value.options : []) {
|
|
61
|
+
const option = parseOption(raw);
|
|
62
|
+
// Duplicate labels are the one thing a radio group cannot survive: the
|
|
63
|
+
// answer text could no longer say which row was picked.
|
|
64
|
+
if (!option || seen.has(option.label))
|
|
65
|
+
continue;
|
|
66
|
+
seen.add(option.label);
|
|
67
|
+
options.push(option);
|
|
68
|
+
if (options.length === MAX_OPTIONS)
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
// A question with nothing to choose from is still answerable — the card
|
|
72
|
+
// always offers free text — so an empty option list is kept, not dropped.
|
|
73
|
+
const header = text(value.header, MAX_LABEL);
|
|
74
|
+
return {
|
|
75
|
+
question,
|
|
76
|
+
...(header ? { header } : {}),
|
|
77
|
+
...(value.multiSelect === true ? { multiSelect: true } : {}),
|
|
78
|
+
options,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** The questions inside an AskUserQuestion tool input, or null when the
|
|
82
|
+
* payload is not one (a malformed call falls back to the ordinary card). */
|
|
83
|
+
export function parseAskQuestions(input) {
|
|
84
|
+
if (!isRecord(input) || !Array.isArray(input.questions))
|
|
85
|
+
return null;
|
|
86
|
+
const questions = [];
|
|
87
|
+
for (const raw of input.questions) {
|
|
88
|
+
const question = parseQuestion(raw);
|
|
89
|
+
if (!question)
|
|
90
|
+
continue;
|
|
91
|
+
questions.push(question);
|
|
92
|
+
if (questions.length === MAX_QUESTIONS)
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
return questions.length ? questions : null;
|
|
96
|
+
}
|
|
97
|
+
/** The one line the card subtitle and a spoken prompt show. */
|
|
98
|
+
export function askQuestionSummary(questions) {
|
|
99
|
+
const first = questions[0]?.question ?? "";
|
|
100
|
+
const rest = questions.length - 1;
|
|
101
|
+
return rest > 0 ? `${first} (+${rest} more question${rest > 1 ? "s" : ""})` : first;
|
|
102
|
+
}
|
|
103
|
+
/** Flat labels for clients that only know how to render a list of choices
|
|
104
|
+
* (the phone companions, and any older desktop build). Only a single
|
|
105
|
+
* question can be answered that way without losing which one was answered. */
|
|
106
|
+
export function questionChoices(questions) {
|
|
107
|
+
if (questions.length !== 1)
|
|
108
|
+
return undefined;
|
|
109
|
+
const only = questions[0];
|
|
110
|
+
if (only.multiSelect || only.options.length < 2)
|
|
111
|
+
return undefined;
|
|
112
|
+
return only.options.map((option) => option.label);
|
|
113
|
+
}
|
|
114
|
+
/** The lead-in on a formatted answer. It exists for the model — the answer
|
|
115
|
+
* is delivered on the deny channel, so it has to say what it is — and the
|
|
116
|
+
* card strips it back off when it shows the person what they sent. */
|
|
117
|
+
export const ANSWER_PREAMBLE = "The user answered your questions.";
|
|
118
|
+
/**
|
|
119
|
+
* What the model is told. It arrives as the tool's result, so it has to
|
|
120
|
+
* stand on its own: name each question, then what was picked for it.
|
|
121
|
+
*/
|
|
122
|
+
export function formatQuestionAnswers(questions, answers) {
|
|
123
|
+
const blocks = [];
|
|
124
|
+
questions.forEach((question, index) => {
|
|
125
|
+
const picked = (answers[index] ?? []).map((value) => value.trim()).filter(Boolean);
|
|
126
|
+
if (!picked.length)
|
|
127
|
+
return;
|
|
128
|
+
blocks.push(`Q: ${question.question}\nA: ${picked.join(", ")}`);
|
|
129
|
+
});
|
|
130
|
+
if (!blocks.length)
|
|
131
|
+
return "";
|
|
132
|
+
return `${ANSWER_PREAMBLE}\n\n${blocks.join("\n\n")}`;
|
|
133
|
+
}
|
|
134
|
+
/** The same answer with the model-facing lead-in removed, for the settled
|
|
135
|
+
* card. Anything that does not carry the lead-in is shown as it is. */
|
|
136
|
+
export function answerWithoutPreamble(answer) {
|
|
137
|
+
return answer.startsWith(`${ANSWER_PREAMBLE}\n\n`) ? answer.slice(ANSWER_PREAMBLE.length + 2) : answer;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The answer text, read back as one value per question.
|
|
141
|
+
*
|
|
142
|
+
* `AskUserQuestion` is answered through its own `answers` field, keyed by the
|
|
143
|
+
* question's text — but the card sends ONE answer for the whole set, because
|
|
144
|
+
* a person answers the whole card at once. `formatQuestionAnswers` writes
|
|
145
|
+
* each question's text beside its answer for exactly this reason, so the map
|
|
146
|
+
* is recovered rather than guessed.
|
|
147
|
+
*
|
|
148
|
+
* A message that carries no blocks at all is the flat path: an older client,
|
|
149
|
+
* or a phone answering a single-question card with one of the option labels
|
|
150
|
+
* the harness also sends. With exactly one question there is no ambiguity
|
|
151
|
+
* about what it answers, so the whole message is that question's answer.
|
|
152
|
+
* With more than one there is, and nothing is filed.
|
|
153
|
+
*/
|
|
154
|
+
export function questionAnswersByQuestion(message, questions) {
|
|
155
|
+
const answers = {};
|
|
156
|
+
const known = new Map(questions.map((entry) => [entry.question, entry.question]));
|
|
157
|
+
for (const block of message.split("\n\n")) {
|
|
158
|
+
const match = /^Q: ([\s\S]+?)\nA: ([\s\S]+)$/.exec(block.trim());
|
|
159
|
+
if (!match)
|
|
160
|
+
continue;
|
|
161
|
+
// Only a question this ask actually posed. An unrecognized block is
|
|
162
|
+
// dropped rather than filed under a key the tool never asked about.
|
|
163
|
+
const question = known.get(match[1].trim());
|
|
164
|
+
if (question)
|
|
165
|
+
answers[question] = match[2].trim();
|
|
166
|
+
}
|
|
167
|
+
if (Object.keys(answers).length)
|
|
168
|
+
return answers;
|
|
169
|
+
const only = questions.length === 1 ? questions[0] : undefined;
|
|
170
|
+
const flat = message.trim();
|
|
171
|
+
return only && flat ? { [only.question]: flat } : {};
|
|
172
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Match provider error wording, not ordinary assistant discussions of safety. */
|
|
2
|
+
export function isProviderSafetyBlock(message) {
|
|
3
|
+
return /\bblocked by (?:our|the provider['’]s) safety systems\b|\bsafety monitoring\b.{0,100}\b(?:paused|ended|blocked)\b|\b(?:safety_check_failed|safety_policy_violation)\b/i.test(message);
|
|
4
|
+
}
|
|
5
|
+
export const PROVIDER_SAFETY_GUIDANCE = "The provider stopped this task. Full access controls tool approvals, not provider safety checks. Review the provider’s findings in Codex if available; OpenMausBot cannot override this block.";
|
|
6
|
+
export const PROVIDER_SAFETY_HELP_URL = "https://learn.chatgpt.com/docs/agent-approvals-security#safety-monitoring-and-paused-tasks";
|
|
@@ -15114,6 +15114,14 @@ var featureConfigSchema = external_exports.object({
|
|
|
15114
15114
|
* also has its own switch. */
|
|
15115
15115
|
browser: external_exports.boolean().optional()
|
|
15116
15116
|
});
|
|
15117
|
+
var onboardingConfigSchema = external_exports.object({
|
|
15118
|
+
/** ISO timestamp of finishing (or skipping to the end of) the welcome flow. */
|
|
15119
|
+
completedAt: external_exports.string().trim().max(40).optional(),
|
|
15120
|
+
/** Which welcome flow was completed; a newer flow may re-show itself. */
|
|
15121
|
+
version: external_exports.number().int().min(0).max(1e3).optional(),
|
|
15122
|
+
reelSeen: external_exports.boolean().optional(),
|
|
15123
|
+
hintsSeen: external_exports.array(external_exports.string().trim().min(1).max(60)).max(100).optional()
|
|
15124
|
+
}).strict();
|
|
15117
15125
|
var instanceConfigSchema = external_exports.object({
|
|
15118
15126
|
driver: external_exports.string().min(1),
|
|
15119
15127
|
displayName: optionalText,
|
|
@@ -15207,6 +15215,7 @@ var appConfigSchema = external_exports.object({
|
|
|
15207
15215
|
threads: external_exports.object({ maxConcurrentPerBot: external_exports.number().int().min(1).max(MAX_CONCURRENT_BOT_THREADS) }).strict().optional(),
|
|
15208
15216
|
localVm: localVmConfigSchema.optional(),
|
|
15209
15217
|
features: featureConfigSchema.optional(),
|
|
15218
|
+
onboarding: onboardingConfigSchema.optional(),
|
|
15210
15219
|
browserProfiles: browserProfilesSchema.optional(),
|
|
15211
15220
|
instances: instanceConfigMapSchema.optional(),
|
|
15212
15221
|
/** User-configured MCP servers, mounted into every capable engine. Kept
|