minimal-forge-work-pack-sync 0.1.57 → 0.1.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +133 -12
- package/dist/python.js +1 -1
- package/dist/repair.js +26 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7615,12 +7615,14 @@ var WORKER_FEEDBACK_MAX_MESSAGE_LENGTH = 24e3;
|
|
|
7615
7615
|
// packages/shared/src/contracts/settings.ts
|
|
7616
7616
|
var DOCUMENT_READER_AGENT = "document-reader";
|
|
7617
7617
|
var OPENROUTER_ALIAS_PROVIDER_NAME = "OpenRouter (via Forge)";
|
|
7618
|
-
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.
|
|
7618
|
+
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.58";
|
|
7619
7619
|
var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
|
|
7620
7620
|
var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
|
|
7621
7621
|
var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
|
|
7622
7622
|
var FIRECRAWL_KEYLESS_MCP_URL = "https://mcp.firecrawl.dev/v2/mcp";
|
|
7623
7623
|
var FIRECRAWL_KEYLESS_PERMISSION = `${FIRECRAWL_KEYLESS_MCP_NAME}_*`;
|
|
7624
|
+
var COMPUTER_USE_NATIVE_PERMISSION = "computer_*";
|
|
7625
|
+
var COMPUTER_USE_MCP_PERMISSION = "computer-use_*";
|
|
7624
7626
|
function mergeWorkerOpenCodeConfig(existing, manifest, forgeBaseUrl, forgeApiKey = "{env:FORGE_API_KEY}", options = {}) {
|
|
7625
7627
|
const existingProvider = withoutLegacyForgeProviders(isRecord(existing.provider) ? existing.provider : {});
|
|
7626
7628
|
const nextConfig = {
|
|
@@ -7715,11 +7717,32 @@ function targetWorkPackSyncPluginVersion(manifest, existing) {
|
|
|
7715
7717
|
}
|
|
7716
7718
|
return configuredWorkPackSyncPluginVersion(existing) ?? WORK_PACK_SYNC_PLUGIN_VERSION;
|
|
7717
7719
|
}
|
|
7720
|
+
function managedComputerUseRule(rule) {
|
|
7721
|
+
if (rule === "deny") return "deny";
|
|
7722
|
+
if (isRecord(rule)) {
|
|
7723
|
+
const normalized = {};
|
|
7724
|
+
for (const [pattern, action] of Object.entries(rule)) {
|
|
7725
|
+
normalized[pattern] = action === "allow" ? "ask" : action;
|
|
7726
|
+
}
|
|
7727
|
+
return "*" in normalized ? normalized : { "*": "ask", ...normalized };
|
|
7728
|
+
}
|
|
7729
|
+
return "ask";
|
|
7730
|
+
}
|
|
7718
7731
|
function managedPermission(value) {
|
|
7719
7732
|
const existing = typeof value === "string" && ["allow", "ask", "deny"].includes(value) ? { "*": value } : isRecord(value) ? value : {};
|
|
7733
|
+
const denyAll = existing["*"] === "deny";
|
|
7734
|
+
const rest = {};
|
|
7735
|
+
for (const [key, entry] of Object.entries(existing)) {
|
|
7736
|
+
if (!denyAll && (key === COMPUTER_USE_NATIVE_PERMISSION || key === COMPUTER_USE_MCP_PERMISSION)) continue;
|
|
7737
|
+
rest[key] = entry;
|
|
7738
|
+
}
|
|
7720
7739
|
return {
|
|
7721
|
-
...
|
|
7722
|
-
...
|
|
7740
|
+
...denyAll ? {} : { [FIRECRAWL_KEYLESS_PERMISSION]: "ask" },
|
|
7741
|
+
...rest,
|
|
7742
|
+
...denyAll ? {} : {
|
|
7743
|
+
[COMPUTER_USE_NATIVE_PERMISSION]: managedComputerUseRule(existing[COMPUTER_USE_NATIVE_PERMISSION]),
|
|
7744
|
+
[COMPUTER_USE_MCP_PERMISSION]: managedComputerUseRule(existing[COMPUTER_USE_MCP_PERMISSION])
|
|
7745
|
+
},
|
|
7723
7746
|
forge_decide: "allow",
|
|
7724
7747
|
forge_decide_run: "allow",
|
|
7725
7748
|
forge_generate_codebook: "allow",
|
|
@@ -26767,6 +26790,7 @@ async function readJsoncObject(filePath) {
|
|
|
26767
26790
|
// packages/cli/src/workerPrompt.ts
|
|
26768
26791
|
import { createHash as createHash5 } from "node:crypto";
|
|
26769
26792
|
var STOCK_OPENWORK_PROMPT_SHA256 = "b84527bf738ab37c726ccd43c3161df30fbddd5384aadbe7abf3cfeb3fced497";
|
|
26793
|
+
var FORGE_COMPUTER_USE_INSTRUCTION = `Para criar, ler ou editar documentos Word (.docx), folhas de c\xE1lculo Excel (.xlsx) e apresenta\xE7\xF5es PowerPoint (.pptx), usa sempre c\xF3digo ou scripts sobre os ficheiros (por exemplo Python com as bibliotecas preparadas pelo Forge), nunca controlo de ecr\xE3 ou rato (computer_* / computer-use_*). Usa controlo de computador apenas como \xFAltimo recurso quando n\xE3o existir alternativa por ficheiro ou c\xF3digo, avisando primeiro a pessoa de que vais mexer no ecr\xE3 ou no rato e aguardando aprova\xE7\xE3o expl\xEDcita.`;
|
|
26770
26794
|
var FORGE_WORKER_PROMPT = `\xC9s o assistente de trabalho do Forge no OpenWork. Ajudas a pessoa a concluir
|
|
26771
26795
|
tarefas com os ficheiros, fontes e ferramentas a que tem acesso. N\xE3o pressuponhas
|
|
26772
26796
|
conhecimentos t\xE9cnicos nem inventes capacidades ou acessos.
|
|
@@ -26839,6 +26863,8 @@ e conven\xE7\xF5es pedidos. Verifica c\xE1lculos, completude, abertura dos fiche
|
|
|
26839
26863
|
e resultado das altera\xE7\xF5es. Usa as ferramentas de documentos, folhas de
|
|
26840
26864
|
c\xE1lculo e apresenta\xE7\xF5es dispon\xEDveis quando forem adequadas \xE0 entrega.
|
|
26841
26865
|
|
|
26866
|
+
${FORGE_COMPUTER_USE_INSTRUCTION}
|
|
26867
|
+
|
|
26842
26868
|
Comunica por defeito em portugu\xEAs europeu (PT-PT), de forma natural e concisa;
|
|
26843
26869
|
adapta a l\xEDngua ao pedido ou destinat\xE1rio. Preserva nomes de ferramentas,
|
|
26844
26870
|
identificadores e c\xF3digo. Come\xE7a pelo resultado ou decis\xE3o, d\xE1 atualiza\xE7\xF5es
|
|
@@ -26983,6 +27009,8 @@ async function prepareLocalStartup(paths, credentials) {
|
|
|
26983
27009
|
import { lstat as lstat6, readFile as readFile13, realpath } from "node:fs/promises";
|
|
26984
27010
|
import path13 from "node:path";
|
|
26985
27011
|
var OPENWORK_ENGINE_HEADER = "// Minimal Forge OpenWork engine configuration\n";
|
|
27012
|
+
var OPENWORK_ENGINE_INSTRUCTIONS_FILENAME = "forge-computer-use-instructions.md";
|
|
27013
|
+
var OPENWORK_ENGINE_INSTRUCTIONS_HEADER = "<!-- Minimal Forge OpenWork engine instructions -->\n";
|
|
26986
27014
|
async function inspectOpenworkEngineConfig(directory) {
|
|
26987
27015
|
if (!path13.isAbsolute(directory)) throw new Error("Indique a pasta absoluta de configura\xE7\xE3o do motor ativo.");
|
|
26988
27016
|
const root = await realpath(directory);
|
|
@@ -27028,12 +27056,38 @@ function renderOpenworkEngineConfig(manifest, credentials, paths, directory, exi
|
|
|
27028
27056
|
throw new Error("O servidor ainda n\xE3o aprovou um plugin com suporte OpenCode 2 (m\xEDnimo 0.1.49). N\xE3o altere o motor.");
|
|
27029
27057
|
}
|
|
27030
27058
|
config2.plugin = (config2.plugin ?? []).map((entry) => Array.isArray(entry) ? [entry[0], { ...entry[1], openworkEngineConfigDir: directory }] : entry);
|
|
27031
|
-
|
|
27059
|
+
const instructionsPath = path13.join(directory, OPENWORK_ENGINE_INSTRUCTIONS_FILENAME);
|
|
27060
|
+
const rawInstructions = config2.instructions;
|
|
27061
|
+
const existingInstructions = Array.isArray(rawInstructions) ? rawInstructions.filter((item) => typeof item === "string") : [];
|
|
27062
|
+
const instructions = existingInstructions.includes(instructionsPath) ? existingInstructions : [...existingInstructions, instructionsPath];
|
|
27063
|
+
return { ...config2, instructions, skills: [paths.skillsDir] };
|
|
27064
|
+
}
|
|
27065
|
+
async function writeOpenworkEngineInstructions(directory) {
|
|
27066
|
+
const file2 = path13.join(directory, OPENWORK_ENGINE_INSTRUCTIONS_FILENAME);
|
|
27067
|
+
let existing;
|
|
27068
|
+
try {
|
|
27069
|
+
const entry = await lstat6(file2);
|
|
27070
|
+
if (!entry.isFile() || entry.isSymbolicLink()) {
|
|
27071
|
+
throw new Error("Preserve o ficheiro de instru\xE7\xF5es do motor; n\xE3o \xE9 um ficheiro regular.");
|
|
27072
|
+
}
|
|
27073
|
+
existing = await readFile13(file2, "utf8");
|
|
27074
|
+
} catch (error45) {
|
|
27075
|
+
if (error45.code !== "ENOENT") throw error45;
|
|
27076
|
+
}
|
|
27077
|
+
if (existing !== void 0 && !existing.startsWith(OPENWORK_ENGINE_INSTRUCTIONS_HEADER)) {
|
|
27078
|
+
throw new Error("J\xE1 existe um ficheiro de instru\xE7\xF5es alheio ao Forge. Preserve-o e pe\xE7a revis\xE3o acompanhada.");
|
|
27079
|
+
}
|
|
27080
|
+
const content = `${OPENWORK_ENGINE_INSTRUCTIONS_HEADER}${FORGE_COMPUTER_USE_INSTRUCTION}
|
|
27081
|
+
`;
|
|
27082
|
+
if (existing === content) return false;
|
|
27083
|
+
await writeOwnerOnlyTextAtomic(file2, content);
|
|
27084
|
+
return true;
|
|
27032
27085
|
}
|
|
27033
27086
|
async function writeOpenworkEngineConfig(directory, config2) {
|
|
27034
27087
|
const state = await inspectOpenworkEngineConfig(directory);
|
|
27088
|
+
const instructionsChanged = await writeOpenworkEngineInstructions(state.directory);
|
|
27035
27089
|
const content = OPENWORK_ENGINE_HEADER + JSON.stringify(config2, null, 2) + "\n";
|
|
27036
|
-
if (state.content === content) return { changed:
|
|
27090
|
+
if (state.content === content) return { changed: instructionsChanged };
|
|
27037
27091
|
await writeOwnerOnlyTextAtomic(state.file, content);
|
|
27038
27092
|
return { changed: true };
|
|
27039
27093
|
}
|
|
@@ -27478,11 +27532,19 @@ function startWorkPackPythonCheck(paths, report) {
|
|
|
27478
27532
|
const readiness = await check2();
|
|
27479
27533
|
const interpreter = readiness.interpreter ? interpreterInstruction(readiness.interpreter) : "Usa somente o Python escolhido na prepara\xE7\xE3o Forge.";
|
|
27480
27534
|
if (readiness.status === "ready") return interpreter;
|
|
27535
|
+
if (canAutoRepairPython(readiness)) {
|
|
27536
|
+
return `${interpreter}
|
|
27537
|
+
${pythonIssueMessage(readiness)} Resolve isto automaticamente antes de executar os scripts Python desta skill: avisa a pessoa numa frase simples, sem termos t\xE9cnicos (n\xE3o fales em bibliotecas nem pacotes), que est\xE1s a atualizar rapidamente as ferramentas necess\xE1rias, executa ${PREPARE_COMMAND} e, se devolver status "ready", continua logo a tarefa usando o Python registado. S\xF3 pares e pe\xE7as ajuda ao suporte se a repara\xE7\xE3o falhar.`;
|
|
27538
|
+
}
|
|
27481
27539
|
return `${interpreter}
|
|
27482
|
-
${pythonIssueMessage(readiness)} Informa a pessoa e aguarda que a prepara\xE7\xE3o seja
|
|
27540
|
+
${pythonIssueMessage(readiness)} Informa a pessoa em linguagem simples, sem termos t\xE9cnicos, e aguarda que a prepara\xE7\xE3o seja conclu\xEDda antes de executar os scripts Python desta skill. Podes continuar as partes da tarefa que n\xE3o dependem de Python.`;
|
|
27483
27541
|
}
|
|
27484
27542
|
};
|
|
27485
27543
|
}
|
|
27544
|
+
function canAutoRepairPython(readiness) {
|
|
27545
|
+
if (readiness.status !== "not-ready" || !readiness.interpreter || readiness.requiresPythonSelection) return false;
|
|
27546
|
+
return Boolean(readiness.packages?.some(({ status }) => status === "missing" || status === "incompatible"));
|
|
27547
|
+
}
|
|
27486
27548
|
function pythonIssueKey(readiness) {
|
|
27487
27549
|
if (readiness.status === "ready") return void 0;
|
|
27488
27550
|
const failures = readiness.packages?.filter((item) => item.status !== "ready").map(({ name, status }) => [name, status]).sort();
|
|
@@ -27492,13 +27554,11 @@ function pythonIssueMessage(readiness) {
|
|
|
27492
27554
|
const reason = readiness.reason ?? "A prepara\xE7\xE3o de Python est\xE1 por verificar neste computador.";
|
|
27493
27555
|
const failedPackages = readiness.packages?.filter((item) => item.status !== "ready").map((item) => item.name) ?? [];
|
|
27494
27556
|
const details = failedPackages.length ? ` Pacotes a verificar: ${failedPackages.join(", ")}.` : "";
|
|
27495
|
-
let action = `Para
|
|
27557
|
+
let action = `Para reparar automaticamente o ambiente registado, executa ${PREPARE_COMMAND}.`;
|
|
27496
27558
|
if (!readiness.interpreter || readiness.requiresPythonSelection) {
|
|
27497
27559
|
action = `Segue as instru\xE7\xF5es Forge para escolher um Python suportado e usa ${PREPARE_COMMAND} --python <caminho absoluto>.`;
|
|
27498
|
-
} else {
|
|
27499
|
-
|
|
27500
|
-
const failedTest = readiness.packages?.some(({ status }) => status === "import-failed") || readiness.documents?.excel === false || readiness.documents?.word === false || readiness.documents?.powerpoint === false;
|
|
27501
|
-
if (!repairable && failedTest) action = "Consulta o resultado da verifica\xE7\xE3o e pede ajuda \xE0 equipa de suporte se necess\xE1rio.";
|
|
27560
|
+
} else if (!canAutoRepairPython(readiness)) {
|
|
27561
|
+
action = "Consulta o resultado da verifica\xE7\xE3o e pede ajuda \xE0 equipa de suporte se necess\xE1rio.";
|
|
27502
27562
|
}
|
|
27503
27563
|
return `${reason}${details} ${action}`;
|
|
27504
27564
|
}
|
|
@@ -27507,7 +27567,7 @@ function interpreterInstruction(interpreter) {
|
|
|
27507
27567
|
}
|
|
27508
27568
|
|
|
27509
27569
|
// packages/cli/src/workPackSyncPlugin.ts
|
|
27510
|
-
var PLUGIN_VERSION = "0.1.
|
|
27570
|
+
var PLUGIN_VERSION = "0.1.58";
|
|
27511
27571
|
var FORGE_DECISION_TIMEOUT_MS = 11e4;
|
|
27512
27572
|
var STATUS_FILENAME = "work-pack-startup-status.json";
|
|
27513
27573
|
var PYTHON_STATUS_FILENAME = "python-startup-status.json";
|
|
@@ -27582,6 +27642,7 @@ var ForgeWorkPackSyncServer = async (_input, options) => {
|
|
|
27582
27642
|
return {
|
|
27583
27643
|
...client ? { event: createReasoningLoopGuard(client, console.error, reportReasoningLoop) } : {},
|
|
27584
27644
|
"experimental.chat.system.transform": async (_input2, output) => {
|
|
27645
|
+
output.system.push(FORGE_COMPUTER_USE_INSTRUCTION);
|
|
27585
27646
|
if (skills.active) output.system.push(MANAGED_SKILL_INSTRUCTION);
|
|
27586
27647
|
},
|
|
27587
27648
|
"tool.execute.before": async (input, output) => skills.assertWritable(input.tool, output.args, directory),
|
|
@@ -27661,6 +27722,10 @@ async function ForgeWorkPackSyncSetup(ctx) {
|
|
|
27661
27722
|
for (const registration of registrations) editor.add(registration);
|
|
27662
27723
|
});
|
|
27663
27724
|
await ctx.tool.hook("execute.before", async (event) => {
|
|
27725
|
+
if (isComputerUseTool(event.tool)) {
|
|
27726
|
+
await assertComputerUsePermission(ctx, event);
|
|
27727
|
+
return;
|
|
27728
|
+
}
|
|
27664
27729
|
if (!["edit", "write", "patch", "apply_patch"].includes(event.tool)) return;
|
|
27665
27730
|
const { skills } = await managedSkills;
|
|
27666
27731
|
await skills.assertWritable(event.tool, event.input, ctx.location.directory);
|
|
@@ -27680,6 +27745,62 @@ async function ForgeWorkPackSyncSetup(ctx) {
|
|
|
27680
27745
|
});
|
|
27681
27746
|
return startReasoningLoopGuard(ctx, reportReasoningLoop);
|
|
27682
27747
|
}
|
|
27748
|
+
function isComputerUseTool(name) {
|
|
27749
|
+
return name.startsWith("computer_") || name.startsWith("computer-use_");
|
|
27750
|
+
}
|
|
27751
|
+
function describeComputerUseResource(toolName, input) {
|
|
27752
|
+
if (input && typeof input === "object" && !Array.isArray(input)) {
|
|
27753
|
+
const record2 = input;
|
|
27754
|
+
for (const key of ["app_id", "app", "application", "target", "window", "url", "action", "command"]) {
|
|
27755
|
+
const value = record2[key];
|
|
27756
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
27757
|
+
return `${toolName}: ${value.trim().slice(0, 120)}`;
|
|
27758
|
+
}
|
|
27759
|
+
}
|
|
27760
|
+
}
|
|
27761
|
+
return toolName;
|
|
27762
|
+
}
|
|
27763
|
+
var SENSITIVE_KEY_PATTERN = /(password|passphrase|secret|token|api[_-]?key)/i;
|
|
27764
|
+
var SECRET_VALUE_KEYS = /* @__PURE__ */ new Set(["text", "value", "input", "keys", "content"]);
|
|
27765
|
+
function sanitizeComputerUseValue(value, insideSecret = false) {
|
|
27766
|
+
if (Array.isArray(value)) {
|
|
27767
|
+
return value.map((item) => sanitizeComputerUseValue(item, insideSecret));
|
|
27768
|
+
}
|
|
27769
|
+
if (!value || typeof value !== "object") return value;
|
|
27770
|
+
const record2 = value;
|
|
27771
|
+
const isSecretRecord = insideSecret || record2.secret === true;
|
|
27772
|
+
const sanitized = {};
|
|
27773
|
+
for (const [key, entry] of Object.entries(record2)) {
|
|
27774
|
+
if (key === "secret" && typeof entry === "boolean") {
|
|
27775
|
+
sanitized[key] = entry;
|
|
27776
|
+
} else if (SENSITIVE_KEY_PATTERN.test(key) || isSecretRecord && SECRET_VALUE_KEYS.has(key)) {
|
|
27777
|
+
sanitized[key] = "[redacted]";
|
|
27778
|
+
} else {
|
|
27779
|
+
sanitized[key] = sanitizeComputerUseValue(entry, isSecretRecord);
|
|
27780
|
+
}
|
|
27781
|
+
}
|
|
27782
|
+
return sanitized;
|
|
27783
|
+
}
|
|
27784
|
+
async function assertComputerUsePermission(ctx, event) {
|
|
27785
|
+
event.signal?.throwIfAborted();
|
|
27786
|
+
if (typeof ctx.permission?.assert !== "function" || !event.sessionID) {
|
|
27787
|
+
throw new Error("O controlo do computador requer aprova\xE7\xE3o expl\xEDcita, mas este motor n\xE3o exp\xF4s o pedido de permiss\xE3o. Atualize o OpenWork.");
|
|
27788
|
+
}
|
|
27789
|
+
const inputRecord = event.input && typeof event.input === "object" && !Array.isArray(event.input) ? sanitizeComputerUseValue(event.input) : void 0;
|
|
27790
|
+
await ctx.permission.assert({
|
|
27791
|
+
sessionID: event.sessionID,
|
|
27792
|
+
...event.agent ? { agent: event.agent } : {},
|
|
27793
|
+
action: event.tool,
|
|
27794
|
+
resources: [describeComputerUseResource(event.tool, event.input)],
|
|
27795
|
+
save: [],
|
|
27796
|
+
metadata: {
|
|
27797
|
+
tool: event.tool,
|
|
27798
|
+
...inputRecord ? { input: inputRecord } : {}
|
|
27799
|
+
},
|
|
27800
|
+
...event.messageID && event.id ? { source: { type: "tool", messageID: event.messageID, id: event.id } } : {}
|
|
27801
|
+
});
|
|
27802
|
+
event.signal?.throwIfAborted();
|
|
27803
|
+
}
|
|
27683
27804
|
async function skillOutput(official, python) {
|
|
27684
27805
|
const instruction = official.loaded ? await python?.skillInstruction(official.metadata.name) : void 0;
|
|
27685
27806
|
return instruction ? `${instruction}
|
package/dist/python.js
CHANGED
|
@@ -229,7 +229,7 @@ var DEFAULT_DEBUG_TRACE_LIMITS = {
|
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
// packages/shared/src/contracts/settings.ts
|
|
232
|
-
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.
|
|
232
|
+
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.58";
|
|
233
233
|
var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
|
|
234
234
|
var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
|
|
235
235
|
var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
|
package/dist/repair.js
CHANGED
|
@@ -505,12 +505,14 @@ var DEVICE_ENROLLMENT_PROTOCOL_VERSION = 1;
|
|
|
505
505
|
// packages/shared/src/contracts/settings.ts
|
|
506
506
|
var DOCUMENT_READER_AGENT = "document-reader";
|
|
507
507
|
var OPENROUTER_ALIAS_PROVIDER_NAME = "OpenRouter (via Forge)";
|
|
508
|
-
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.
|
|
508
|
+
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.58";
|
|
509
509
|
var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
|
|
510
510
|
var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
|
|
511
511
|
var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
|
|
512
512
|
var FIRECRAWL_KEYLESS_MCP_URL = "https://mcp.firecrawl.dev/v2/mcp";
|
|
513
513
|
var FIRECRAWL_KEYLESS_PERMISSION = `${FIRECRAWL_KEYLESS_MCP_NAME}_*`;
|
|
514
|
+
var COMPUTER_USE_NATIVE_PERMISSION = "computer_*";
|
|
515
|
+
var COMPUTER_USE_MCP_PERMISSION = "computer-use_*";
|
|
514
516
|
function mergeWorkerOpenCodeConfig(existing, manifest, forgeBaseUrl, forgeApiKey = "{env:FORGE_API_KEY}", options = {}) {
|
|
515
517
|
const existingProvider = withoutLegacyForgeProviders(isRecord(existing.provider) ? existing.provider : {});
|
|
516
518
|
const nextConfig = {
|
|
@@ -605,11 +607,32 @@ function targetWorkPackSyncPluginVersion(manifest, existing) {
|
|
|
605
607
|
}
|
|
606
608
|
return configuredWorkPackSyncPluginVersion(existing) ?? WORK_PACK_SYNC_PLUGIN_VERSION;
|
|
607
609
|
}
|
|
610
|
+
function managedComputerUseRule(rule) {
|
|
611
|
+
if (rule === "deny") return "deny";
|
|
612
|
+
if (isRecord(rule)) {
|
|
613
|
+
const normalized = {};
|
|
614
|
+
for (const [pattern, action] of Object.entries(rule)) {
|
|
615
|
+
normalized[pattern] = action === "allow" ? "ask" : action;
|
|
616
|
+
}
|
|
617
|
+
return "*" in normalized ? normalized : { "*": "ask", ...normalized };
|
|
618
|
+
}
|
|
619
|
+
return "ask";
|
|
620
|
+
}
|
|
608
621
|
function managedPermission(value) {
|
|
609
622
|
const existing = typeof value === "string" && ["allow", "ask", "deny"].includes(value) ? { "*": value } : isRecord(value) ? value : {};
|
|
623
|
+
const denyAll = existing["*"] === "deny";
|
|
624
|
+
const rest = {};
|
|
625
|
+
for (const [key, entry] of Object.entries(existing)) {
|
|
626
|
+
if (!denyAll && (key === COMPUTER_USE_NATIVE_PERMISSION || key === COMPUTER_USE_MCP_PERMISSION)) continue;
|
|
627
|
+
rest[key] = entry;
|
|
628
|
+
}
|
|
610
629
|
return {
|
|
611
|
-
...
|
|
612
|
-
...
|
|
630
|
+
...denyAll ? {} : { [FIRECRAWL_KEYLESS_PERMISSION]: "ask" },
|
|
631
|
+
...rest,
|
|
632
|
+
...denyAll ? {} : {
|
|
633
|
+
[COMPUTER_USE_NATIVE_PERMISSION]: managedComputerUseRule(existing[COMPUTER_USE_NATIVE_PERMISSION]),
|
|
634
|
+
[COMPUTER_USE_MCP_PERMISSION]: managedComputerUseRule(existing[COMPUTER_USE_MCP_PERMISSION])
|
|
635
|
+
},
|
|
613
636
|
forge_decide: "allow",
|
|
614
637
|
forge_decide_run: "allow",
|
|
615
638
|
forge_generate_codebook: "allow",
|