minimal-forge-work-pack-sync 0.1.22 → 0.1.23

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 +53 -2
  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.22";
7551
+ var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.23";
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";
@@ -25158,7 +25158,7 @@ function isRecord(value) {
25158
25158
  }
25159
25159
 
25160
25160
  // packages/cli/src/workPackSyncPlugin.ts
25161
- var PLUGIN_VERSION = "0.1.22";
25161
+ var PLUGIN_VERSION = "0.1.23";
25162
25162
  var STATUS_FILENAME = "work-pack-startup-status.json";
25163
25163
  var activeSync = /* @__PURE__ */ new Map();
25164
25164
  var ForgeWorkPackSyncServer = async (_input, options) => {
@@ -25215,10 +25215,61 @@ var ForgeWorkPackSyncServer = async (_input, options) => {
25215
25215
  if (state.forgeConfigVerified) applySharedWorkerPrompt(config2);
25216
25216
  },
25217
25217
  tool: {
25218
+ forge_decide: createForgeDecisionTool(forgeBaseUrl, state.paths),
25218
25219
  forge_feedback: createForgeFeedbackTool(forgeBaseUrl, state.paths)
25219
25220
  }
25220
25221
  };
25221
25222
  };
25223
+ function createForgeDecisionTool(forgeBaseUrl, paths) {
25224
+ const question = tool.schema.discriminatedUnion("type", [
25225
+ tool.schema.object({
25226
+ type: tool.schema.literal("noul"),
25227
+ instructions: tool.schema.string(),
25228
+ criteria: tool.schema.object({ true: tool.schema.string(), false: tool.schema.string() }).optional()
25229
+ }),
25230
+ tool.schema.object({
25231
+ type: tool.schema.literal("choice"),
25232
+ instructions: tool.schema.string(),
25233
+ criteria: tool.schema.record(tool.schema.string(), tool.schema.string())
25234
+ }),
25235
+ tool.schema.object({
25236
+ type: tool.schema.literal("score"),
25237
+ instructions: tool.schema.string(),
25238
+ criteria: tool.schema.array(tool.schema.string())
25239
+ })
25240
+ ]);
25241
+ return tool({
25242
+ 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.",
25243
+ args: {
25244
+ state: tool.schema.union([
25245
+ tool.schema.string(),
25246
+ tool.schema.record(tool.schema.string(), tool.schema.any()),
25247
+ tool.schema.array(tool.schema.any())
25248
+ ]).describe("Texto, objeto ou lista com toda a evid\xEAncia necess\xE1ria para decidir"),
25249
+ questions: tool.schema.record(tool.schema.string(), question).describe("Perguntas identificadas por uma chave est\xE1vel")
25250
+ },
25251
+ async execute(args, context) {
25252
+ const credentials = await readWellKnownForgeCredentials(paths.opencodeAuthPath, forgeBaseUrl);
25253
+ const response = await fetch(`${forgeBaseUrl}/v1/decisions`, {
25254
+ method: "POST",
25255
+ redirect: "error",
25256
+ headers: {
25257
+ authorization: `Bearer ${credentials.forgeApiKey}`,
25258
+ "content-type": "application/json"
25259
+ },
25260
+ body: JSON.stringify({ state: args.state, questions: args.questions }),
25261
+ signal: AbortSignal.any([context.abort, AbortSignal.timeout(95e3)])
25262
+ });
25263
+ const body = await response.json().catch(() => void 0);
25264
+ if (response.ok && body && typeof body === "object" && body.answers && typeof body.answers === "object") {
25265
+ return JSON.stringify(body, null, 2);
25266
+ }
25267
+ const nested = body?.error && typeof body.error === "object" && !Array.isArray(body.error) ? body.error.message : void 0;
25268
+ 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})`;
25269
+ throw new Error(safeError);
25270
+ }
25271
+ });
25272
+ }
25222
25273
  function createForgeFeedbackTool(forgeBaseUrl, paths) {
25223
25274
  return tool({
25224
25275
  description: "Envia ao respons\xE1vel pelo Forge apenas a mensagem de feedback ou pedido de ajuda aprovada pela pessoa.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimal-forge-work-pack-sync",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Minimal Forge Work Pack startup synchronization for OpenCode and OpenWork.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {