minimal-forge-work-pack-sync 0.1.25 → 0.1.27

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.
Files changed (2) hide show
  1. package/dist/index.js +30 -3
  2. 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.25";
7551
+ var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.27";
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";
@@ -25165,7 +25165,8 @@ function isRecord(value) {
25165
25165
  }
25166
25166
 
25167
25167
  // packages/cli/src/workPackSyncPlugin.ts
25168
- var PLUGIN_VERSION = "0.1.25";
25168
+ var PLUGIN_VERSION = "0.1.27";
25169
+ var FORGE_DECISION_TIMEOUT_MS = 11e4;
25169
25170
  var STATUS_FILENAME = "work-pack-startup-status.json";
25170
25171
  var activeSync = /* @__PURE__ */ new Map();
25171
25172
  var ForgeWorkPackSyncServer = async (_input, options) => {
@@ -25223,6 +25224,7 @@ var ForgeWorkPackSyncServer = async (_input, options) => {
25223
25224
  },
25224
25225
  tool: {
25225
25226
  forge_decide: createForgeDecisionTool(forgeBaseUrl, state.decisionBaseUrl, state.paths),
25227
+ forge_generate_codebook: createForgeCodebookTool(forgeBaseUrl, state.decisionBaseUrl, state.paths),
25226
25228
  forge_feedback: createForgeFeedbackTool(forgeBaseUrl, state.paths)
25227
25229
  }
25228
25230
  };
@@ -25265,7 +25267,7 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths) {
25265
25267
  "content-type": "application/json"
25266
25268
  },
25267
25269
  body: JSON.stringify({ state: args.state, questions: args.questions }),
25268
- signal: AbortSignal.any([context.abort, AbortSignal.timeout(95e3)])
25270
+ signal: AbortSignal.any([context.abort, AbortSignal.timeout(FORGE_DECISION_TIMEOUT_MS)])
25269
25271
  });
25270
25272
  const body = await response.json().catch(() => void 0);
25271
25273
  if (response.ok && body && typeof body === "object" && body.answers && typeof body.answers === "object") {
@@ -25277,6 +25279,30 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths) {
25277
25279
  }
25278
25280
  });
25279
25281
  }
25282
+ function createForgeCodebookTool(forgeBaseUrl, gatewayBaseUrl, paths) {
25283
+ return tool({
25284
+ description: "Gera um rascunho de codebook em portugu\xEAs europeu a partir de uma pergunta e das respostas. Apresentar para aprova\xE7\xE3o humana antes de codificar; n\xE3o aplica c\xF3digos nem altera ficheiros.",
25285
+ args: {
25286
+ question: tool.schema.string().trim().min(1).max(1e4).describe("Texto da pergunta aberta"),
25287
+ responses: tool.schema.array(tool.schema.string().trim().min(1).max(2e4)).min(1).max(2e3).describe("Respostas da mesma pergunta, sem identificadores pessoais desnecess\xE1rios")
25288
+ },
25289
+ async execute(args, context) {
25290
+ const credentials = await readWellKnownForgeCredentials(paths.opencodeAuthPath, forgeBaseUrl);
25291
+ const response = await fetch(`${gatewayBaseUrl}/v1/codebooks`, {
25292
+ method: "POST",
25293
+ redirect: "error",
25294
+ headers: { authorization: `Bearer ${credentials.forgeApiKey}`, "content-type": "application/json" },
25295
+ body: JSON.stringify({ question: args.question, responses: args.responses }),
25296
+ signal: AbortSignal.any([context.abort, AbortSignal.timeout(FORGE_DECISION_TIMEOUT_MS)])
25297
+ });
25298
+ const body = await response.json().catch(() => void 0);
25299
+ if (response.ok && body && typeof body.codebook === "object" && body.codebook !== null) {
25300
+ return JSON.stringify(body, null, 2);
25301
+ }
25302
+ throw new Error(`O Forge n\xE3o concluiu o codebook (HTTP ${response.status}). Pe\xE7a ao respons\xE1vel para verificar a liga\xE7\xE3o Groq.`);
25303
+ }
25304
+ });
25305
+ }
25280
25306
  function createForgeFeedbackTool(forgeBaseUrl, paths) {
25281
25307
  return tool({
25282
25308
  description: "Envia ao respons\xE1vel pelo Forge apenas a mensagem de feedback ou pedido de ajuda aprovada pela pessoa.",
@@ -25471,6 +25497,7 @@ var ForgeWorkPackSyncPlugin = {
25471
25497
  };
25472
25498
  var workPackSyncPlugin_default = ForgeWorkPackSyncPlugin;
25473
25499
  export {
25500
+ FORGE_DECISION_TIMEOUT_MS,
25474
25501
  ForgeWorkPackSyncServer,
25475
25502
  workPackSyncPlugin_default as default,
25476
25503
  resolveDecisionBaseUrl
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimal-forge-work-pack-sync",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "Minimal Forge Work Pack startup synchronization for OpenCode and OpenWork.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {