minimal-forge-work-pack-sync 0.1.21 → 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.
- package/dist/index.js +57 -3
- 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.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";
|
|
@@ -7556,6 +7556,9 @@ var FIRECRAWL_KEYLESS_PERMISSION = `${FIRECRAWL_KEYLESS_MCP_NAME}_*`;
|
|
|
7556
7556
|
|
|
7557
7557
|
// packages/shared/src/workPackBaseline.ts
|
|
7558
7558
|
function normalizePackExtensionModel(pathLabel, content, approvedModelIds, slug) {
|
|
7559
|
+
return normalizeExtensionModel(pathLabel, content, slug, (modelId) => approvedModelIds.has(modelId));
|
|
7560
|
+
}
|
|
7561
|
+
function normalizeExtensionModel(pathLabel, content, slug, acceptsModel) {
|
|
7559
7562
|
const match = /^---\n([\s\S]+?)\n---/.exec(content);
|
|
7560
7563
|
const frontmatter = match?.[1];
|
|
7561
7564
|
if (!match || frontmatter === void 0) return content;
|
|
@@ -7568,7 +7571,7 @@ function normalizePackExtensionModel(pathLabel, content, approvedModelIds, slug)
|
|
|
7568
7571
|
const separator = rawModel.indexOf("/");
|
|
7569
7572
|
const provider = separator > 0 ? rawModel.slice(0, separator) : "";
|
|
7570
7573
|
const modelId = separator > 0 ? rawModel.slice(separator + 1) : "";
|
|
7571
|
-
if (provider !== "forge" && provider !== "openrouter" || !
|
|
7574
|
+
if (provider !== "forge" && provider !== "openrouter" || !acceptsModel(modelId)) {
|
|
7572
7575
|
throw new Error(
|
|
7573
7576
|
`A extens\xE3o ${pathLabel} do pacote de trabalho ${slug} usa um modelo que n\xE3o est\xE1 aprovado no Forge`
|
|
7574
7577
|
);
|
|
@@ -25155,7 +25158,7 @@ function isRecord(value) {
|
|
|
25155
25158
|
}
|
|
25156
25159
|
|
|
25157
25160
|
// packages/cli/src/workPackSyncPlugin.ts
|
|
25158
|
-
var PLUGIN_VERSION = "0.1.
|
|
25161
|
+
var PLUGIN_VERSION = "0.1.23";
|
|
25159
25162
|
var STATUS_FILENAME = "work-pack-startup-status.json";
|
|
25160
25163
|
var activeSync = /* @__PURE__ */ new Map();
|
|
25161
25164
|
var ForgeWorkPackSyncServer = async (_input, options) => {
|
|
@@ -25212,10 +25215,61 @@ var ForgeWorkPackSyncServer = async (_input, options) => {
|
|
|
25212
25215
|
if (state.forgeConfigVerified) applySharedWorkerPrompt(config2);
|
|
25213
25216
|
},
|
|
25214
25217
|
tool: {
|
|
25218
|
+
forge_decide: createForgeDecisionTool(forgeBaseUrl, state.paths),
|
|
25215
25219
|
forge_feedback: createForgeFeedbackTool(forgeBaseUrl, state.paths)
|
|
25216
25220
|
}
|
|
25217
25221
|
};
|
|
25218
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
|
+
}
|
|
25219
25273
|
function createForgeFeedbackTool(forgeBaseUrl, paths) {
|
|
25220
25274
|
return tool({
|
|
25221
25275
|
description: "Envia ao respons\xE1vel pelo Forge apenas a mensagem de feedback ou pedido de ajuda aprovada pela pessoa.",
|