@chibitek/chibi 0.1.210 → 0.1.213
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/{TerminalPanel-DxQoOfkY.js → TerminalPanel-mkQO42zG.js} +1 -1
- package/dist/assets/{abnfDiagram-O67JEVCF-Ds2qYdjS.js → abnfDiagram-O67JEVCF-D_YvZb12.js} +1 -1
- package/dist/assets/{arc-1O9tchZk.js → arc-u7NcCAzn.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-CWuQ1x2F.js → architectureDiagram-NJMV4G6O-CvoIt_0y.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-CNcEkXEx.js → blockDiagram-BEXU5L5S-B0Ry3uOJ.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-BKI_wi9I.js → c4Diagram-YGBWAQC7-DQQBHqDt.js} +1 -1
- package/dist/assets/channel-BG3AR6Y6.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-gO88emfN.js → chunk-2Q5K7J3B-B4IxGiPz.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-DbKNT_-r.js → chunk-3FUC2YCW-BxR5i6Mq.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-BbJCoZVg.js → chunk-5VM5RSS4-CqmFQLrB.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-DXurSCcp.js → chunk-GTNCS2PH-C9lKwjYE.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-BWyt0I_m.js → chunk-GWA4HPMP-DKAnucqk.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-6iWSsogl.js → chunk-JWPE2WC7-CE4DRhto.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-CFoqO9Hw.js → chunk-NETBCI7D-UziBzgi9.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-BZEzAlNi.js → chunk-WEXAMYUT-DVo_P12S.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-W4hfC50f.js → chunk-XXDRQBXY-CBwStBk5.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-BsGmL9e7.js → classDiagram-v2-NBCMYWYE-D4xfjrAt.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-CYtTgIzk.js → cose-bilkent-JH36ORCC-DNpZWduJ.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-DLOi2Q2V.js → cynefin-OW5HDTMX-CMegK4fD.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-BXcXJ3hv.js → cynefinDiagram-VND7K2PF-BBRJHq6u.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-BdBOiuzt.js → dagre-6A5THRUB-BwneJkAI.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-DCf3M4WE.js → diagram-22UHCM2B-p4tq7l1f.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-CzdF-UXi.js → diagram-3UASUU5V-C8BCnB5c.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-_UmmlMOD.js → diagram-ATOU4E4O-Da-Fc2pA.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-DrQODVuX.js → diagram-CDSNMT55-CH7l4Als.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-CE16iJlJ.js → diagram-MLGK6HIB-xO-efOVl.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-DJuTbhbP.js → diagram-MPIPVDR6-CjWQ4FpH.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-f1VEI2Po.js → ebnfDiagram-ZINNZB2B-DbyEj47I.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-BRbs9WzY.js → elk-276RUBZZ-B0uak8Gs.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-DvMp_cQr.js → erDiagram-OPXOYQCR-DHYzl46p.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-CYS1A0fu.js → flowDiagram-KWPJA3E3-CjUIIif9.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-qya_JE9x.js → ganttDiagram-FUAMR5RP-CPjVOkNO.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-ChMUJ3hH.js → gitGraphDiagram-X574FWY7-DnI_xNjh.js} +1 -1
- package/dist/assets/{index-COH7BlyH.js → index-C8wABnWu.js} +177 -177
- package/dist/assets/{index-xE4Li_H2.js → index-kYL6p_po.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-B2VudqsE.js → infoDiagram-VRGFBTTK-SXQSkFFT.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-Bdk47y0t.js → ishikawaDiagram-OU5B5YK6-DF3AQU1D.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-A4StgNQ9.js → journeyDiagram-ZHPQQLJL-IWRv1Evh.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-DZo45dQw.js → kanban-definition-PNTS6WVX-BKpuGZmD.js} +1 -1
- package/dist/assets/{linear-D_rK-Ord.js → linear-S9gqQWWc.js} +1 -1
- package/dist/assets/{mermaid.core-C7CvDDvz.js → mermaid.core-BHRIdye5.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-6fmVPMyc.js → mindmap-definition-NLK3R4M7-BTD52Pxv.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-CD4Qg24h.js → pegDiagram-GJSIUBJH-C91CNvYA.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-DmzQ883B.js → pieDiagram-5QR66LMP-0aP3PVSg.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-BW37utPZ.js → quadrantDiagram-O4NWA36T-CN-CB1dj.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-CWXiMlAb.js → railroadDiagram-XR7U4H2S-DUwKNVqn.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-DHSfr9U3.js → requirementDiagram-PLB6GJNP-BwiKCqXR.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-PebTt4eq.js → sankeyDiagram-IPEJSGJF-DK2nk983.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-DPwp8fia.js → sequenceDiagram-PO4LG4MO-DGQaL2CK.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BX_46o3S.js → sizeCapture-INFHLROL-DjxAs07q.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-W2e0RRrZ.js → stateDiagram-v2-GCMORJYK-DfhvmAHx.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-CkyXpQX9.js → swimlanes-2SLR337P-g4YraApj.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-BnxrvDBt.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-BS-sCjlN.js → timeline-definition-EJHVYXUP-Bh6Ow15M.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-BQre-k6x.js → usecaseDiagram-POWQR4AR-wRtBj8_e.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-CEWCsi_s.js → vennDiagram-UO4OBE2U-D4QR4Odj.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-CXUxqghG.js → wardleyDiagram-VNRHLVJA-DthL_SDi.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-DBgVMpwp.js → xychartDiagram-PMCCYNJV-CK-QrbHO.js} +1 -1
- package/dist/handbook/atomic-handbook.html +1 -1
- package/dist/index.html +1 -1
- package/dist-server/drivers/agents-proxy.js +2 -3
- package/dist-server/index.js +2405 -1990
- package/dist-server/openmausbot.js +180 -95
- package/dist-server/pair-cli.js +180 -95
- package/dist-server/server/auto-approve.js +12 -0
- package/dist-server/server/drivers/acp/core.js +4 -6
- package/dist-server/server/drivers/acp/custom.js +3 -1
- package/dist-server/server/drivers/acp/hermes.js +2 -1
- package/dist-server/server/drivers/agents-catalog.js +2 -2
- package/dist-server/server/drivers/chat-mcp-tools.js +1 -21
- package/dist-server/server/drivers/claude.js +69 -66
- package/dist-server/server/drivers/codex.js +4 -3
- package/dist-server/server/drivers/hermes-context-floor.js +68 -0
- package/dist-server/server/drivers/openai-chat.js +1 -1
- package/dist-server/server/drivers/session-allow-key.js +22 -5
- package/dist-server/server/engine-tiers.js +3 -7
- package/dist-server/server/god-mode-goal.js +78 -0
- package/dist-server/server/god-mode-run-host.js +69 -0
- package/dist-server/server/index.js +70 -73
- package/dist-server/server/model-fallback-repair.js +20 -0
- package/dist-server/server/new-bot-defaults.js +3 -1
- package/dist-server/server/personal-goal-runtime.js +29 -3
- package/dist-server/server/personal-goal-turn.js +2 -1
- package/dist-server/server/personal-goals.js +20 -2
- package/dist-server/server/routes/thread-stop.js +15 -2
- package/dist-server/server/surface.js +1 -1
- package/dist-server/shared/god-mode-run.js +173 -0
- package/dist-server/shared/personal-goal.js +42 -0
- package/package.json +1 -1
- package/dist/assets/channel-CT5xRPK0.js +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-BH9Yry0J.js +0 -8
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const names = (selection, refused) => selection?.instanceId === refused.instanceId && selection.model === refused.requested;
|
|
2
|
+
const replaced = (selection, model) => {
|
|
3
|
+
// A variant or effort belonged to the refused model.
|
|
4
|
+
const { variant: _variant, effort: _effort, ...rest } = selection;
|
|
5
|
+
return { ...rest, model };
|
|
6
|
+
};
|
|
7
|
+
/** Saves the model that ran over the refused one. Returns what changed. */
|
|
8
|
+
export function repairRefusedModel(store, botId, threadId, refused) {
|
|
9
|
+
const task = store.taskByThread(botId, threadId);
|
|
10
|
+
const thread = Boolean(task?.modelSelection && names(task.modelSelection, refused) &&
|
|
11
|
+
store.patchTask(botId, threadId, { modelSelection: replaced(task.modelSelection, refused.model) }));
|
|
12
|
+
const current = store.bot(botId);
|
|
13
|
+
const bot = Boolean(current && names(current.modelSelection, refused) &&
|
|
14
|
+
store.patchBot(botId, { modelSelection: replaced(current.modelSelection, refused.model) }));
|
|
15
|
+
return { thread, bot };
|
|
16
|
+
}
|
|
17
|
+
/** The thread's one line about it. */
|
|
18
|
+
export function refusedModelLine(refused) {
|
|
19
|
+
return `this engine cannot run ${refused.requested}: this thread now uses ${refused.model}`;
|
|
20
|
+
}
|
|
@@ -91,7 +91,7 @@ export const newBotDefaultsSchema = z.object({
|
|
|
91
91
|
}).strict().refine(value => Buffer.byteLength(JSON.stringify(value), "utf8") <= 900_000, "Bot defaults must fit within 900 KB");
|
|
92
92
|
/** Explicit values (including empty values) win. A resolved renderer draft
|
|
93
93
|
* opts out so deleted fields and template extras are not restored on POST. */
|
|
94
|
-
export function resolveBotCreationDefaults(saved, body) {
|
|
94
|
+
export function resolveBotCreationDefaults(saved, body, ownerCreated = true) {
|
|
95
95
|
if (body.useDefaults !== undefined && typeof body.useDefaults !== "boolean") {
|
|
96
96
|
throw Object.assign(new Error("useDefaults must be true or false"), { status: 400 });
|
|
97
97
|
}
|
|
@@ -105,6 +105,8 @@ export function resolveBotCreationDefaults(saved, body) {
|
|
|
105
105
|
if (Object.hasOwn(body, key))
|
|
106
106
|
Object.assign(profile, { [key]: key === "section" && body[key] === null ? "" : body[key] });
|
|
107
107
|
}
|
|
108
|
+
// Review by default; local computer automation retains its consent flow.
|
|
109
|
+
profile.approvalMode ??= ownerCreated && profile.computer !== "local" ? "auto" : "ask";
|
|
108
110
|
const resolved = botDefaultsProfileSchema.safeParse(profile);
|
|
109
111
|
if (!resolved.success)
|
|
110
112
|
throw Object.assign(new Error(resolved.error.message), { status: 400 });
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { GOAL_HELP } from "../shared/personal-goal.js";
|
|
2
2
|
import { PersonalGoals } from "./personal-goals.js";
|
|
3
|
+
import { godModeNextAttemptDelay } from "./god-mode-goal.js";
|
|
4
|
+
import { formatGodModeCountdown } from "../shared/god-mode-run.js";
|
|
5
|
+
/** A restarted app gives its providers this long before a run's next attempt. */
|
|
6
|
+
const GOD_MODE_RESUME_DELAY_MS = 5_000;
|
|
3
7
|
/** Serial continuation per goal; every provider turn still passes normal admission. */
|
|
4
8
|
export class PersonalGoalRuntime {
|
|
5
9
|
goals;
|
|
@@ -9,6 +13,12 @@ export class PersonalGoalRuntime {
|
|
|
9
13
|
constructor(path, host) {
|
|
10
14
|
this.host = host;
|
|
11
15
|
this.goals = new PersonalGoals(path, (goal) => host.changed(goal));
|
|
16
|
+
// A GOD MODE run is non stop: one that was working when Atomic stopped
|
|
17
|
+
// carries on with its remaining time.
|
|
18
|
+
for (const goal of this.goals.liveGodModeRuns()) {
|
|
19
|
+
this.running.add(goal.id);
|
|
20
|
+
setTimeout(() => void this.run(goal), GOD_MODE_RESUME_DELAY_MS).unref?.();
|
|
21
|
+
}
|
|
12
22
|
}
|
|
13
23
|
async command(botId, threadId, command, trigger) {
|
|
14
24
|
if (command.action === "help")
|
|
@@ -21,6 +31,9 @@ export class PersonalGoalRuntime {
|
|
|
21
31
|
if (command.action === "start" || command.action === "resume") {
|
|
22
32
|
if (this.host.busy(botId, threadId) || (goal && this.running.has(goal.id)))
|
|
23
33
|
throw new Error("This conversation is still working. Wait for its turn to settle.");
|
|
34
|
+
if (command.action === "start" && command.godModeMs && !this.host.godMode?.(botId)) {
|
|
35
|
+
throw new Error("A GOD MODE run needs GOD MODE on for this bot. Turn it on in Settings, then start the run again.");
|
|
36
|
+
}
|
|
24
37
|
goal = command.action === "start" ? this.goals.start(botId, threadId, { ...command, ...(trigger?.kind === "user" || trigger?.kind === "owner" ? { trigger } : {}) }) : this.goals.resume(threadId, command);
|
|
25
38
|
// Persist the human command before provider setup reads the conversation.
|
|
26
39
|
this.running.add(goal.id);
|
|
@@ -40,6 +53,8 @@ export class PersonalGoalRuntime {
|
|
|
40
53
|
return this.describe(goal);
|
|
41
54
|
}
|
|
42
55
|
describe(goal) {
|
|
56
|
+
if (goal.godMode)
|
|
57
|
+
return `GOD MODE run ${goal.status}: ${goal.objective}\n${goal.detail}\nTime left: ${formatGodModeCountdown(goal.godMode.endsAt - Date.now())}. Attempts: ${goal.godMode.attempts + 1}.`;
|
|
43
58
|
return `${goal.status}: ${goal.objective}\n${goal.detail}\nTurns: ${goal.turnCount}/${goal.maxTurns}. Tokens: ${goal.tokensUsed}${goal.tokenBudget === undefined ? "" : `/${goal.tokenBudget}`}.`;
|
|
44
59
|
}
|
|
45
60
|
steer(threadId) {
|
|
@@ -54,10 +69,21 @@ export class PersonalGoalRuntime {
|
|
|
54
69
|
this.running.add(goal.id);
|
|
55
70
|
try {
|
|
56
71
|
while (this.goals.begin(goal.id)) {
|
|
57
|
-
|
|
72
|
+
if (goal.godMode && this.host.godMode && !this.host.godMode(goal.botId)) {
|
|
73
|
+
goal.status = "stopped";
|
|
74
|
+
goal.detail = "GOD MODE was turned off, so the run stopped.";
|
|
75
|
+
this.goals.touch(goal);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
// A GOD MODE run treats a turn that could not start as a failed
|
|
79
|
+
// attempt (settle keeps it working); an ordinary goal pauses below.
|
|
80
|
+
const result = goal.godMode
|
|
81
|
+
? await this.host.run(goal).catch((error) => ({ ok: false, text: error instanceof Error ? error.message : String(error), tools: 0 }))
|
|
82
|
+
: await this.host.run(goal);
|
|
58
83
|
this.goals.settle(goal.id, result);
|
|
59
|
-
// Give queued human input priority before reserving another turn
|
|
60
|
-
|
|
84
|
+
// Give queued human input priority before reserving another turn; a
|
|
85
|
+
// GOD MODE run also pauses briefly after failed attempts.
|
|
86
|
+
await new Promise((resolve) => setTimeout(resolve, godModeNextAttemptDelay(goal)));
|
|
61
87
|
}
|
|
62
88
|
}
|
|
63
89
|
catch {
|
|
@@ -3,7 +3,8 @@ export function updatePersonalGoalReceipt(goal, store) {
|
|
|
3
3
|
return;
|
|
4
4
|
const goalRun = { runId: goal.id, goal: goal.objective, status: goal.status,
|
|
5
5
|
coordinatorBotId: goal.botId, coordinatorName: store.bot(goal.botId)?.name ?? "Bot",
|
|
6
|
-
turnCount: goal.turnCount, maxTurns: goal.maxTurns, detail: `${goal.detail} Tokens: ${goal.tokensUsed}${goal.tokenBudget === undefined ? "" : `/${goal.tokenBudget}`}.`, startedAt: goal.createdAt
|
|
6
|
+
turnCount: goal.turnCount, maxTurns: goal.maxTurns, detail: `${goal.detail} Tokens: ${goal.tokensUsed}${goal.tokenBudget === undefined ? "" : `/${goal.tokenBudget}`}.`, startedAt: goal.createdAt,
|
|
7
|
+
...(goal.godMode ? { godMode: { endsAt: goal.godMode.endsAt, attempts: goal.godMode.attempts, log: goal.godMode.log.slice(-100) } } : {}) };
|
|
7
8
|
if (goal.receiptMessageId)
|
|
8
9
|
store.patchMessage(goal.threadId, goal.receiptMessageId, { goalRun });
|
|
9
10
|
else
|
|
@@ -4,6 +4,9 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { writeFileAtomic } from "./atomic.js";
|
|
6
6
|
import { parseGroupGoalDecision } from "./group-goal-run.js";
|
|
7
|
+
import { GOD_MODE_ACTIONS, GOD_MODE_STOP_KINDS, godModeRunInstructions } from "../shared/god-mode-run.js";
|
|
8
|
+
import { beginGodModeTurn, godModeRunLive, newGodModeRun, settleGodModeTurn } from "./god-mode-goal.js";
|
|
9
|
+
const godModeLog = z.object({ at: z.number(), stop: z.enum(GOD_MODE_STOP_KINDS), action: z.enum(GOD_MODE_ACTIONS), detail: z.string() });
|
|
7
10
|
const goalSchema = z.object({
|
|
8
11
|
id: z.string(), botId: z.string(), threadId: z.string(), objective: z.string(),
|
|
9
12
|
criteria: z.array(z.string()), maxTurns: z.number().int().positive().max(1000),
|
|
@@ -14,6 +17,9 @@ const goalSchema = z.object({
|
|
|
14
17
|
trigger: z.union([z.object({ kind: z.literal("owner") }), z.object({ kind: z.literal("user"), email: z.string().optional(), label: z.string().optional() })]).optional(),
|
|
15
18
|
receiptMessageId: z.string().optional(), missing: z.number(), noProgress: z.number(),
|
|
16
19
|
repeated: z.number(), lastReply: z.string(), lastBlocker: z.string(), blockers: z.number(),
|
|
20
|
+
/** A GOD MODE run (server/god-mode-goal.ts): bounded by time, not turns. */
|
|
21
|
+
godMode: z.object({ startedAt: z.number(), endsAt: z.number(), attempts: z.number(), failures: z.number(),
|
|
22
|
+
log: z.array(godModeLog) }).optional(),
|
|
17
23
|
});
|
|
18
24
|
const terminal = (goal) => goal.status === "completed" || goal.status === "stopped";
|
|
19
25
|
/** A single durable objective per conversation. No provider, timer or authority lives here. */
|
|
@@ -33,7 +39,7 @@ export class PersonalGoals {
|
|
|
33
39
|
this.loadError = "Saved goal state could not be read. It has been preserved for recovery; goals are paused.";
|
|
34
40
|
}
|
|
35
41
|
for (const goal of this.records)
|
|
36
|
-
if (goal.status === "working") {
|
|
42
|
+
if (goal.status === "working" && !godModeRunLive(goal, Date.now())) {
|
|
37
43
|
goal.status = "paused";
|
|
38
44
|
goal.detail = "Atomic restarted. Use /goal resume to continue.";
|
|
39
45
|
goal.updatedAt = Date.now();
|
|
@@ -46,6 +52,8 @@ export class PersonalGoals {
|
|
|
46
52
|
save() { writeFileAtomic(this.path, JSON.stringify(this.records), { mode: 0o600 }); }
|
|
47
53
|
touch(goal) { goal.updatedAt = Date.now(); goal.detail = redactSecretsInText(goal.detail); this.changed(goal); this.save(); }
|
|
48
54
|
get(threadId) { return this.records.findLast((goal) => goal.threadId === threadId); }
|
|
55
|
+
/** GOD MODE runs still inside their time, e.g. after a restart. */
|
|
56
|
+
liveGodModeRuns() { return this.records.filter((goal) => godModeRunLive(goal, Date.now())); }
|
|
49
57
|
byId(id) { return this.records.find((goal) => goal.id === id); }
|
|
50
58
|
start(botId, threadId, input) {
|
|
51
59
|
if (this.loadError)
|
|
@@ -53,7 +61,8 @@ export class PersonalGoals {
|
|
|
53
61
|
const previous = this.get(threadId);
|
|
54
62
|
if (previous && !terminal(previous))
|
|
55
63
|
throw new Error("This conversation already has a goal. Resume it or stop it first.");
|
|
56
|
-
const
|
|
64
|
+
const { godModeMs, ...plain } = input;
|
|
65
|
+
const goal = goalSchema.parse({ ...plain, ...(godModeMs ? { godMode: newGodModeRun(Date.now(), godModeMs) } : {}), objective: redactSecretsInText(input.objective), criteria: input.criteria.map(redactSecretsInText), id: randomUUID(), botId, threadId,
|
|
57
66
|
tokensUsed: 0, turnCount: 0, status: "working", detail: "Starting goal.",
|
|
58
67
|
createdAt: Date.now(), updatedAt: Date.now(), missing: 0, noProgress: 0, repeated: 0, lastReply: "", lastBlocker: "", blockers: 0 });
|
|
59
68
|
this.records.push(goal);
|
|
@@ -95,6 +104,10 @@ export class PersonalGoals {
|
|
|
95
104
|
const goal = this.byId(id);
|
|
96
105
|
if (!goal || goal.status !== "working")
|
|
97
106
|
return false;
|
|
107
|
+
if (goal.godMode && !beginGodModeTurn(goal, Date.now())) {
|
|
108
|
+
this.touch(goal);
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
98
111
|
if (goal.turnCount >= goal.maxTurns || (goal.tokenBudget !== undefined && goal.tokensUsed >= goal.tokenBudget)) {
|
|
99
112
|
goal.status = "limit-reached";
|
|
100
113
|
goal.detail = "Goal budget reached.";
|
|
@@ -167,6 +180,9 @@ export class PersonalGoals {
|
|
|
167
180
|
else {
|
|
168
181
|
goal.detail = decision?.detail ?? "Continue the objective and report a valid goal status.";
|
|
169
182
|
}
|
|
183
|
+
// A GOD MODE run never stops on a failure, a question or a blocker.
|
|
184
|
+
if (goal.godMode && goal.status !== "completed")
|
|
185
|
+
settleGodModeTurn(goal, Date.now(), result, decision);
|
|
170
186
|
if (goal.status === "working") {
|
|
171
187
|
if (goal.turnCount >= goal.maxTurns || (goal.tokenBudget !== undefined && goal.tokensUsed >= goal.tokenBudget)) {
|
|
172
188
|
goal.status = "limit-reached";
|
|
@@ -181,6 +197,8 @@ export class PersonalGoals {
|
|
|
181
197
|
}
|
|
182
198
|
}
|
|
183
199
|
export function personalGoalInstructions(goal) {
|
|
200
|
+
if (goal.godMode)
|
|
201
|
+
return godModeRunInstructions({ ...goal, godMode: goal.godMode }, Date.now());
|
|
184
202
|
return [
|
|
185
203
|
"You are pursuing this conversation's durable goal. Complete authorized work; ordinary turn completion does not end the goal.",
|
|
186
204
|
`Objective: ${goal.objective}`,
|
|
@@ -8,10 +8,15 @@
|
|
|
8
8
|
// conversations that assistant can already write to with
|
|
9
9
|
// POST /api/bots/:id/messages.
|
|
10
10
|
import { PASS } from "./table.js";
|
|
11
|
-
const
|
|
11
|
+
const STOP = /^\/api\/bots\/([\w-]+)\/threads\/([\w-]+)\/stop$/;
|
|
12
|
+
const PAUSE = /^\/api\/bots\/([\w-]+)\/threads\/([\w-]+)\/pause$/;
|
|
13
|
+
const RESUME = /^\/api\/bots\/([\w-]+)\/threads\/([\w-]+)\/resume$/;
|
|
12
14
|
export function createThreadStopRoutes(deps) {
|
|
13
15
|
return async ({ res, path, method, json }) => {
|
|
14
|
-
const
|
|
16
|
+
const stop = STOP.exec(path);
|
|
17
|
+
const pause = PAUSE.exec(path);
|
|
18
|
+
const resume = RESUME.exec(path);
|
|
19
|
+
const m = stop ?? pause ?? resume;
|
|
15
20
|
if (!m)
|
|
16
21
|
return PASS;
|
|
17
22
|
if (method !== "POST")
|
|
@@ -19,6 +24,14 @@ export function createThreadStopRoutes(deps) {
|
|
|
19
24
|
const [, botId, threadId] = m;
|
|
20
25
|
if (!deps.owns(botId, threadId))
|
|
21
26
|
return json(res, 404, { error: "no such conversation for this bot" });
|
|
27
|
+
if (pause) {
|
|
28
|
+
const outcome = await deps.hold(botId, threadId);
|
|
29
|
+
return json(res, 200, { ok: true, outcome });
|
|
30
|
+
}
|
|
31
|
+
if (resume) {
|
|
32
|
+
const outcome = await deps.resume(botId, threadId);
|
|
33
|
+
return json(res, 200, { ok: true, outcome });
|
|
34
|
+
}
|
|
22
35
|
// Nothing running: a no-op, so a late Stop never marks a finished
|
|
23
36
|
// request as cancelled.
|
|
24
37
|
if (!deps.working(botId, threadId))
|
|
@@ -131,7 +131,7 @@ export function surfacePrompt(mounted, opts = {}) {
|
|
|
131
131
|
text += ` This conversation is pinned to ${surfaceLabel(opts.pinned)}; changing places requires ${opts.canSelect ? "select_computer or " : ""}the conversation's computer selector, not a different tool name.`;
|
|
132
132
|
}
|
|
133
133
|
if (opts.canSelect)
|
|
134
|
-
text += " For a screen task, use select_computer with no arguments when you need to inspect the actual available targets. Choose the requested place from its result; if the user left the place open, use a suitable available target or surface auto instead of asking them to operate the menu. Browser-only work can stay in Browser; when it needs desktop apps or capabilities the current Browser lacks, select an available Local VM without asking the user to switch it manually. Choose before taking actions, and do not repeat actions already completed if the task must continue elsewhere. Atomic can start an existing configured computer and highlight the selected target. If the right tools are already mounted, use them directly. On a pending switch, end this turn: the original request resumes automatically with the new tools, and then you must carry out the task. Only ask for input for a genuine blocker, such as missing setup, required sign-in or an approval. Never silently replace an explicitly requested VM with the host desktop.";
|
|
134
|
+
text += " For a screen task, use select_computer with no arguments when you need to inspect the actual available targets. Choose the requested place from its result; if the user left the place open, use a suitable available target or surface auto instead of asking them to operate the menu. Browser-only work can stay in Browser; when it needs desktop apps or capabilities the current Browser lacks, select an available Local VM without asking the user to switch it manually. Choose before taking actions, and do not repeat actions already completed if the task must continue elsewhere. Atomic can start an existing configured computer and highlight the selected target. If the right tools are already mounted, use them directly. On a pending switch, end this turn: the original request resumes automatically with the new tools, and then you must carry out the task. After reconnecting, you may select another available surface when the same authorized task requires it; retain completed work and do not repeat unsuccessful selections without a changed condition. Only ask for input for a genuine blocker, such as missing setup, required sign-in or an approval. Never silently replace an explicitly requested VM with the host desktop.";
|
|
135
135
|
if (opts.canSelect)
|
|
136
136
|
text += " If no suitable computer is running but its provider is configured, select_computer can provision one for this computer task; reuse existing resources first. Do not provision merely for ordinary chat or inspection.";
|
|
137
137
|
if (opts.canSelect && !computer && !mounted.browser)
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// A GOD MODE run: GOD MODE and Goal combined, for a fixed time.
|
|
2
|
+
//
|
|
3
|
+
// Erick, 2026-11-22: "2 hours, non stop, approve ALL permissions, bypass
|
|
4
|
+
// permissions, do not ask for anything if there is a way to do it". A run
|
|
5
|
+
// keeps working on one goal until the goal is done or the time is up. Every
|
|
6
|
+
// place a turn would otherwise stop to ask the person becomes the next
|
|
7
|
+
// attempt instead (godModeRunStop). The few things no run may do on its own
|
|
8
|
+
// (godModeHardLimit) are refused to the bot, which keeps working another way;
|
|
9
|
+
// they are never turned into a question either.
|
|
10
|
+
//
|
|
11
|
+
// Pure: a run is a goal with a deadline (server/personal-goals.ts keeps it,
|
|
12
|
+
// server/god-mode-goal.ts applies this policy), and the client shows the
|
|
13
|
+
// countdown from the same record.
|
|
14
|
+
export const GOD_MODE_RUN_DEFAULT_MS = 2 * 60 * 60_000;
|
|
15
|
+
export const GOD_MODE_RUN_MAX_MS = 8 * 60 * 60_000;
|
|
16
|
+
export const GOD_MODE_RUN_MIN_MS = 5 * 60_000;
|
|
17
|
+
/** Every place a turn can stop or ask the person. */
|
|
18
|
+
export const GOD_MODE_STOP_KINDS = [
|
|
19
|
+
"tool-permission", "paid-key", "provider-restriction", "owner-restriction", "approval-switch",
|
|
20
|
+
"question", "turn-failed", "check-in", "turn-ended", "computer-unavailable",
|
|
21
|
+
];
|
|
22
|
+
export const GOD_MODE_ACTIONS = ["approved", "continued", "switched", "answered", "blocked"];
|
|
23
|
+
export const HARD_LIMIT_TEXT = {
|
|
24
|
+
money: "GOD MODE never moves money or buys anything.",
|
|
25
|
+
"delete-user-data": "GOD MODE never deletes data outside the task.",
|
|
26
|
+
"production-deploy": "GOD MODE never deploys to production.",
|
|
27
|
+
"force-push": "GOD MODE never force pushes.",
|
|
28
|
+
"local-postgres": "RULE #1: no local Postgres. Use the cloud Supabase database.",
|
|
29
|
+
};
|
|
30
|
+
const MONEY_TOOL = /(?:^|_|\b)(?:purchase|checkout|buy|pay(?:ment)?s?|transfer|send_money|payout|refund|charge|receive_payment|create_invoice|trade|swap|withdraw|deposit)(?:_|\b|$)/i;
|
|
31
|
+
const MONEY_COMMAND = /\b(?:stripe\s+(?:charges|payouts|transfers|refunds|payment_intents)\s+create|gh\s+sponsor|npm\s+fund\b.*--pay)\b/i;
|
|
32
|
+
const FORCE_PUSH = /\bgit\b[^\n;&|]*\bpush\b[^\n;&|]*(?:\s--force(?:-with-lease)?\b|\s-[a-zA-Z]*f\b|\s\+[^\s]+)/;
|
|
33
|
+
const PRODUCTION_DEPLOY = new RegExp([
|
|
34
|
+
String.raw `\bvercel\b[^\n;&|]*(?:--prod\b|\bpromote\b)`,
|
|
35
|
+
String.raw `\brailway\s+(?:up|redeploy)\b`,
|
|
36
|
+
String.raw `\bfly(?:ctl)?\s+deploy\b`,
|
|
37
|
+
String.raw `\bnetlify\s+deploy\b[^\n;&|]*--prod\b`,
|
|
38
|
+
String.raw `\bsupabase\s+(?:db\s+push|functions\s+deploy)\b`,
|
|
39
|
+
String.raw `\bheroku\b[^\n;&|]*\brelease\b`,
|
|
40
|
+
String.raw `\bgit\s+push\b[^\n;&|]*\bproduction\b`,
|
|
41
|
+
String.raw `\bpnpm\s+release(?::[a-z]+)?\b`,
|
|
42
|
+
String.raw `\bkubectl\b[^\n;&|]*\b(?:apply|rollout)\b[^\n;&|]*\bprod`,
|
|
43
|
+
].join("|"), "i");
|
|
44
|
+
const PRODUCTION_DEPLOY_TOOL = /(?:^|__)(?:deploy|redeploy|accept-deploy|create-deployment|promote)(?:[-_]|$)/i;
|
|
45
|
+
const LOCAL_POSTGRES = new RegExp([
|
|
46
|
+
String.raw `postgres(?:ql)?://[^\s'"]*@(?:localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)\b`,
|
|
47
|
+
String.raw `\bDATABASE_URL\s*=\s*['"]?[^\s'"]*(?:localhost|127\.0\.0\.1)`,
|
|
48
|
+
String.raw `\b(?:psql|pg_dump|pg_restore|createdb|dropdb)\b[^\n;&|]*(?:-h\s*|--host[= ])(?:localhost|127\.0\.0\.1)`,
|
|
49
|
+
String.raw `\b(?:initdb|pg_ctl(?:cluster)?|postgres\s+-D)\b`,
|
|
50
|
+
String.raw `\bbrew\s+services\s+(?:start|run|restart)\s+postgres`,
|
|
51
|
+
String.raw `\bdocker\b[^\n;&|]*\b(?:run|compose\s+up)\b[^\n;&|]*\b(?:postgres|supabase\/postgres|pgvector)\b`,
|
|
52
|
+
String.raw `\bsupabase\s+(?:start|db\s+start|db\s+reset)\b`,
|
|
53
|
+
].join("|"), "i");
|
|
54
|
+
const DELETE_DATA_COMMAND = new RegExp([
|
|
55
|
+
String.raw `\brm\s+(?:-[a-zA-Z]*[rf][a-zA-Z]*\s+)+(?:--\s+)?(?:~|\$HOME|\/(?:\s|$|Users\b|home\b|\*)|\.\.(?:\/|\s|$))`,
|
|
56
|
+
String.raw `\b(?:drop\s+(?:database|schema|table)|truncate\s+table)\b`,
|
|
57
|
+
String.raw `\bdelete\s+from\s+\w+\s*(?:;|$)`,
|
|
58
|
+
String.raw `\bgit\s+(?:clean\s+-[a-zA-Z]*f[a-zA-Z]*d|reset\s+--hard\s+origin)\b`,
|
|
59
|
+
String.raw `\b(?:diskutil\s+erase|mkfs\b|shred\b)`,
|
|
60
|
+
].join("|"), "i");
|
|
61
|
+
const DELETE_DATA_TOOL = /(?:^|__|[-_])(?:delete|destroy|purge|shred|empty_trash|drop)(?:[-_]|$)/i;
|
|
62
|
+
/** The command text or arguments of a tool call, as one string to check. */
|
|
63
|
+
export function toolCallText(input) {
|
|
64
|
+
if (typeof input === "string")
|
|
65
|
+
return input;
|
|
66
|
+
if (!input || typeof input !== "object")
|
|
67
|
+
return "";
|
|
68
|
+
try {
|
|
69
|
+
return JSON.stringify(input);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Which hard limit a tool call crosses, or null when a run may approve it.
|
|
76
|
+
* `workspace` is the run's own folder: deleting inside it is the task. */
|
|
77
|
+
export function godModeHardLimit(tool, input, workspace) {
|
|
78
|
+
const name = tool.replace(/^mcp__[^_]+__/, "");
|
|
79
|
+
const text = toolCallText(input);
|
|
80
|
+
if (LOCAL_POSTGRES.test(text))
|
|
81
|
+
return "local-postgres";
|
|
82
|
+
if (FORCE_PUSH.test(text))
|
|
83
|
+
return "force-push";
|
|
84
|
+
if (PRODUCTION_DEPLOY.test(text) || PRODUCTION_DEPLOY_TOOL.test(tool))
|
|
85
|
+
return "production-deploy";
|
|
86
|
+
if (MONEY_TOOL.test(name) || MONEY_COMMAND.test(text))
|
|
87
|
+
return "money";
|
|
88
|
+
if (DELETE_DATA_TOOL.test(tool) || DELETE_DATA_COMMAND.test(text)) {
|
|
89
|
+
if (workspace && deletesOnlyInside(text, workspace))
|
|
90
|
+
return null;
|
|
91
|
+
return "delete-user-data";
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/** An `rm` whose every target is inside the run's folder. */
|
|
96
|
+
function deletesOnlyInside(text, workspace) {
|
|
97
|
+
const match = /\brm\s+((?:-[a-zA-Z]+\s+)*)(.+)/.exec(text);
|
|
98
|
+
if (!match)
|
|
99
|
+
return false;
|
|
100
|
+
const targets = match[2].split(/\s+/).filter(Boolean).map((target) => target.replace(/^['"]|['"]$/g, ""));
|
|
101
|
+
const root = workspace.replace(/\/+$/, "");
|
|
102
|
+
return targets.length > 0 && targets.every((target) => target.startsWith(`${root}/`) ||
|
|
103
|
+
(!target.startsWith("/") && !target.startsWith("~") && !target.startsWith("$") && !target.split("/").includes("..")));
|
|
104
|
+
}
|
|
105
|
+
/** What a running GOD MODE run does where a turn would stop. Nothing here
|
|
106
|
+
* returns "ask the person": a hard limit is refused to the bot, everything
|
|
107
|
+
* else goes on. */
|
|
108
|
+
export function godModeRunStop(stop) {
|
|
109
|
+
const detail = stop.detail ? ` ${stop.detail}` : "";
|
|
110
|
+
switch (stop.kind) {
|
|
111
|
+
case "tool-permission": {
|
|
112
|
+
const limit = godModeHardLimit(stop.tool ?? "", stop.input, stop.workspace);
|
|
113
|
+
if (limit)
|
|
114
|
+
return { action: "blocked", limit, note: `${HARD_LIMIT_TEXT[limit]} Refused ${stop.tool ?? "a tool"}; keep working another way.` };
|
|
115
|
+
return { action: "approved", note: `approved ${stop.tool ?? "tool"} (GOD MODE run)` };
|
|
116
|
+
}
|
|
117
|
+
case "paid-key":
|
|
118
|
+
return { action: "approved", note: `kept going on a pay-per-use key for this run.${detail}` };
|
|
119
|
+
case "provider-restriction":
|
|
120
|
+
case "owner-restriction":
|
|
121
|
+
case "approval-switch":
|
|
122
|
+
return { action: "switched", note: `moved to another engine for this run.${detail}` };
|
|
123
|
+
case "question":
|
|
124
|
+
return { action: "answered", note: GOD_MODE_QUESTION_ANSWER };
|
|
125
|
+
case "computer-unavailable":
|
|
126
|
+
return { action: "continued", note: `the computer is not available; doing it another way.${detail}` };
|
|
127
|
+
case "turn-failed":
|
|
128
|
+
case "check-in":
|
|
129
|
+
case "turn-ended":
|
|
130
|
+
return { action: "continued", note: `started the next attempt.${detail}` };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** The answer a run gives a bot's question: Erick is not there to answer. */
|
|
134
|
+
export const GOD_MODE_QUESTION_ANSWER = "GOD MODE run: the person is away and will not answer. Pick the option that best finishes the goal, say which you picked, and keep going.";
|
|
135
|
+
/** The instruction every attempt of a run carries, in place of the
|
|
136
|
+
* ordinary goal's "approval requirements still apply ... ask". */
|
|
137
|
+
export function godModeRunInstructions(run, now) {
|
|
138
|
+
const minutes = Math.max(0, Math.round((run.godMode.endsAt - now) / 60_000));
|
|
139
|
+
return [
|
|
140
|
+
"GOD MODE run. Work non stop until the goal is done. Do not ask the person anything: they are away and every tool and permission is approved.",
|
|
141
|
+
`Objective: ${run.objective}`,
|
|
142
|
+
run.criteria.length ? `Completion criteria: ${JSON.stringify(run.criteria)}. Supply one non-empty evidence string per criterion when completed.` : "",
|
|
143
|
+
`Time left: about ${minutes} minutes. Attempt ${run.godMode.attempts + 1}.`,
|
|
144
|
+
`Progress: ${run.detail}`,
|
|
145
|
+
"If one way is blocked, find another way: another tool, another approach, another engine. A failure is the start of the next attempt, not a reason to stop.",
|
|
146
|
+
"Hard limits, never crossed: no moving money or buying anything, no deleting data outside this task, no production deploys, no force pushes, no local Postgres database (cloud Supabase only). Skip that step, say so, and finish the rest.",
|
|
147
|
+
'End with a private envelope: <openmaus-goal>{"status":"continue","next":"self","instruction":"next concrete step","detail":"progress"}</openmaus-goal>',
|
|
148
|
+
'Or status completed with detail, and for criteria "evidence":["verification for criterion 1", ...]. Never claim completion from intent alone; verify first.',
|
|
149
|
+
"Write useful visible results before the envelope. Never show or explain the envelope.",
|
|
150
|
+
].filter(Boolean).join("\n");
|
|
151
|
+
}
|
|
152
|
+
/** The pause before the next attempt after `failures` failed ones in a row:
|
|
153
|
+
* none after a good turn, then 5 s doubling to at most a minute, so an engine
|
|
154
|
+
* that fails at once cannot spin the run through its turns. */
|
|
155
|
+
export function godModeRetryDelayMs(failures) {
|
|
156
|
+
if (failures <= 0)
|
|
157
|
+
return 0;
|
|
158
|
+
return Math.min(60_000, 5_000 * 2 ** (failures - 1));
|
|
159
|
+
}
|
|
160
|
+
/** A requested length, clamped; default two hours. */
|
|
161
|
+
export function godModeRunDuration(requested) {
|
|
162
|
+
if (typeof requested !== "number" || !Number.isFinite(requested))
|
|
163
|
+
return GOD_MODE_RUN_DEFAULT_MS;
|
|
164
|
+
return Math.min(GOD_MODE_RUN_MAX_MS, Math.max(GOD_MODE_RUN_MIN_MS, Math.round(requested)));
|
|
165
|
+
}
|
|
166
|
+
/** "1:59:30" for the countdown. */
|
|
167
|
+
export function formatGodModeCountdown(ms) {
|
|
168
|
+
const total = Math.max(0, Math.ceil(ms / 1000));
|
|
169
|
+
const hours = Math.floor(total / 3600);
|
|
170
|
+
const minutes = Math.floor((total % 3600) / 60);
|
|
171
|
+
const seconds = total % 60;
|
|
172
|
+
return `${hours}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
|
|
173
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export function parseGoalCommand(text) {
|
|
2
|
+
const godMode = parseGodModeCommand(text);
|
|
3
|
+
if (godMode !== undefined)
|
|
4
|
+
return godMode;
|
|
2
5
|
const match = /^\/goal(?:\s+([\s\S]*))?$/i.exec(text.trim());
|
|
3
6
|
if (!match)
|
|
4
7
|
return null;
|
|
@@ -41,3 +44,42 @@ export function parseGoalCommand(text) {
|
|
|
41
44
|
return { action: "start", objective: rest, maxTurns: maxTurns ?? 20, tokenBudget, criteria };
|
|
42
45
|
}
|
|
43
46
|
export const GOAL_HELP = 'Start: /goal [--turns 20] [--tokens N] [--done "criterion"] objective\nControls: /goal status, /goal pause, /goal resume [--turns N] [--tokens N], /goal stop. Resume budgets are total ceilings, not additional allowances. Token limits are checked between turns; a running turn can exceed the limit.';
|
|
47
|
+
/** `/godmode [--hours N | --minutes N] [--done "criterion"] objective`: a goal
|
|
48
|
+
* that runs non stop under GOD MODE until it is done or the time is up
|
|
49
|
+
* (default two hours). `/godmode stop` and `/godmode status` control it like
|
|
50
|
+
* `/goal`. Undefined when the text is not a /godmode command. */
|
|
51
|
+
function parseGodModeCommand(text) {
|
|
52
|
+
const match = /^\/god-?mode(?:\s+([\s\S]*))?$/i.exec(text.trim());
|
|
53
|
+
if (!match)
|
|
54
|
+
return undefined;
|
|
55
|
+
let rest = (match[1] ?? "").trim();
|
|
56
|
+
const control = /^(status|stop|help)$/i.exec(rest);
|
|
57
|
+
if (control)
|
|
58
|
+
return { action: control[1].toLowerCase() };
|
|
59
|
+
let godModeMs = 2 * 60 * 60_000;
|
|
60
|
+
const criteria = [];
|
|
61
|
+
while (rest.startsWith("--")) {
|
|
62
|
+
const flag = /^--(hours|minutes|done)\s+(?:"([^"\n]+)"|'([^'\n]+)'|(\S+))(?:\s|$)/.exec(rest);
|
|
63
|
+
if (!flag)
|
|
64
|
+
throw new Error('Use --hours N, --minutes N, or --done "completion criterion" before the goal.');
|
|
65
|
+
const value = flag[2] ?? flag[3] ?? flag[4];
|
|
66
|
+
if (flag[1] === "done")
|
|
67
|
+
criteria.push(value);
|
|
68
|
+
else {
|
|
69
|
+
const number = Number(value);
|
|
70
|
+
if (!Number.isFinite(number) || number <= 0)
|
|
71
|
+
throw new Error("The run length must be a positive number.");
|
|
72
|
+
godModeMs = Math.round(number * (flag[1] === "hours" ? 60 * 60_000 : 60_000));
|
|
73
|
+
if (godModeMs < 5 * 60_000 || godModeMs > 8 * 60 * 60_000)
|
|
74
|
+
throw new Error("A GOD MODE run lasts between 5 minutes and 8 hours.");
|
|
75
|
+
}
|
|
76
|
+
rest = rest.slice(flag[0].length).trim();
|
|
77
|
+
}
|
|
78
|
+
if (!rest)
|
|
79
|
+
return { action: "help" };
|
|
80
|
+
if (rest.length > 20_000 || criteria.length > 20 || criteria.some((item) => item.length > 2000))
|
|
81
|
+
throw new Error("Goal or completion criteria are too long.");
|
|
82
|
+
// Turns are only a loop guard here: the run is bounded by its time.
|
|
83
|
+
return { action: "start", objective: rest, maxTurns: 1000, criteria, godModeMs };
|
|
84
|
+
}
|
|
85
|
+
export const GOD_MODE_HELP = 'GOD MODE run: /godmode [--hours 2] [--done "criterion"] goal. It works non stop until the goal is done or the time is up, approves every tool, keeps going on pay-per-use keys, and switches engines when one is blocked. It never moves money, deletes data outside the task, deploys to production, force pushes or uses a local Postgres. Stop it with /godmode stop or the Stop button.';
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-C7CvDDvz.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-KWPJA3E3-CYS1A0fu.js";import{_ as a}from"./mermaid.core-C7CvDDvz.js";import"./chunk-5VM5RSS4-BbJCoZVg.js";import"./chunk-XXDRQBXY-W4hfC50f.js";import"./chunk-WEXAMYUT-BZEzAlNi.js";import"./chunk-GWA4HPMP-BWyt0I_m.js";import"./channel-CT5xRPK0.js";import"./index-COH7BlyH.js";var o=a(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),s=o,u=r({styles:s});export{u as diagram};
|