minimal-forge-work-pack-sync 0.1.27 → 0.1.28
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 +22 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7548,7 +7548,7 @@ var DEFAULT_DEBUG_TRACE_LIMITS = {
|
|
|
7548
7548
|
};
|
|
7549
7549
|
|
|
7550
7550
|
// packages/shared/src/contracts/settings.ts
|
|
7551
|
-
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.
|
|
7551
|
+
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.28";
|
|
7552
7552
|
var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
|
|
7553
7553
|
var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
|
|
7554
7554
|
var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
|
|
@@ -7922,7 +7922,7 @@ async function replaceFile(filename, contents) {
|
|
|
7922
7922
|
|
|
7923
7923
|
// packages/cli/src/workPackSyncPlugin.ts
|
|
7924
7924
|
var import_yaml = __toESM(require_dist(), 1);
|
|
7925
|
-
import { mkdir as mkdir3, readdir as readdir4, readFile as readFile4, rename as rename4, writeFile as writeFile4 } from "node:fs/promises";
|
|
7925
|
+
import { mkdir as mkdir3, mkdtemp as mkdtemp2, readdir as readdir4, readFile as readFile4, rename as rename4, writeFile as writeFile4 } from "node:fs/promises";
|
|
7926
7926
|
import path6 from "node:path";
|
|
7927
7927
|
|
|
7928
7928
|
// node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/external.js
|
|
@@ -25165,7 +25165,7 @@ function isRecord(value) {
|
|
|
25165
25165
|
}
|
|
25166
25166
|
|
|
25167
25167
|
// packages/cli/src/workPackSyncPlugin.ts
|
|
25168
|
-
var PLUGIN_VERSION = "0.1.
|
|
25168
|
+
var PLUGIN_VERSION = "0.1.28";
|
|
25169
25169
|
var FORGE_DECISION_TIMEOUT_MS = 11e4;
|
|
25170
25170
|
var STATUS_FILENAME = "work-pack-startup-status.json";
|
|
25171
25171
|
var activeSync = /* @__PURE__ */ new Map();
|
|
@@ -25248,7 +25248,7 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths) {
|
|
|
25248
25248
|
})
|
|
25249
25249
|
]);
|
|
25250
25250
|
return tool({
|
|
25251
|
-
description: "Pede ao Jev uma ou mais decis\xF5es estruturadas sobre o mesmo estado. Usa este recurso para classifica\xE7\xE3o, escolha ou pontua\xE7\xE3o; n\xE3o para gerar texto livre.",
|
|
25251
|
+
description: "Pede ao Jev uma ou mais decis\xF5es estruturadas sobre o mesmo estado. Usa este recurso para classifica\xE7\xE3o, escolha ou pontua\xE7\xE3o; n\xE3o para gerar texto livre. Guarda a resposta integral num ficheiro local e devolve response_file; copiar esse ficheiro, sem transcrever o JSON.",
|
|
25252
25252
|
args: {
|
|
25253
25253
|
state: tool.schema.union([
|
|
25254
25254
|
tool.schema.string(),
|
|
@@ -25258,6 +25258,8 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths) {
|
|
|
25258
25258
|
questions: tool.schema.record(tool.schema.string(), question).describe("Perguntas identificadas por uma chave est\xE1vel")
|
|
25259
25259
|
},
|
|
25260
25260
|
async execute(args, context) {
|
|
25261
|
+
const responseDir = await mkdtemp2(path6.join(context.directory, ".forge-decision-"));
|
|
25262
|
+
const responseFile = path6.join(responseDir, "response.json");
|
|
25261
25263
|
const credentials = await readWellKnownForgeCredentials(paths.opencodeAuthPath, forgeBaseUrl);
|
|
25262
25264
|
const response = await fetch(`${decisionBaseUrl}/v1/decisions`, {
|
|
25263
25265
|
method: "POST",
|
|
@@ -25269,9 +25271,23 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths) {
|
|
|
25269
25271
|
body: JSON.stringify({ state: args.state, questions: args.questions }),
|
|
25270
25272
|
signal: AbortSignal.any([context.abort, AbortSignal.timeout(FORGE_DECISION_TIMEOUT_MS)])
|
|
25271
25273
|
});
|
|
25272
|
-
const
|
|
25274
|
+
const raw = await response.text();
|
|
25275
|
+
let body;
|
|
25276
|
+
try {
|
|
25277
|
+
body = JSON.parse(raw);
|
|
25278
|
+
} catch {
|
|
25279
|
+
}
|
|
25273
25280
|
if (response.ok && body && typeof body === "object" && body.answers && typeof body.answers === "object") {
|
|
25274
|
-
|
|
25281
|
+
try {
|
|
25282
|
+
await writeFile4(responseFile, raw, { flag: "wx", mode: 384 });
|
|
25283
|
+
return JSON.stringify({ ...body, response_file: responseFile }, null, 2);
|
|
25284
|
+
} catch {
|
|
25285
|
+
return JSON.stringify({
|
|
25286
|
+
...body,
|
|
25287
|
+
response_file: null,
|
|
25288
|
+
persistence_error: "A decis\xE3o foi conclu\xEDda, mas n\xE3o foi poss\xEDvel guardar o ficheiro. Recuperar esta resposta do hist\xF3rico da ferramenta; n\xE3o repetir a chamada ao Jev."
|
|
25289
|
+
}, null, 2);
|
|
25290
|
+
}
|
|
25275
25291
|
}
|
|
25276
25292
|
const nested = body?.error && typeof body.error === "object" && !Array.isArray(body.error) ? body.error.message : void 0;
|
|
25277
25293
|
const safeError = typeof nested === "string" && nested.length <= 300 ? nested.replace(/forge_[A-Za-z0-9_-]+/g, "<credencial oculta>") : `O Forge n\xE3o concluiu a decis\xE3o (HTTP ${response.status})`;
|