minimal-forge-work-pack-sync 0.1.23 → 0.1.25
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 +27 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7548,11 +7548,18 @@ 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.25";
|
|
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";
|
|
7555
7555
|
var FIRECRAWL_KEYLESS_PERMISSION = `${FIRECRAWL_KEYLESS_MCP_NAME}_*`;
|
|
7556
|
+
function normalizeGatewayBaseUrl(value) {
|
|
7557
|
+
const url2 = new URL(value);
|
|
7558
|
+
if (url2.protocol !== "https:" || url2.username || url2.password || url2.port || url2.pathname !== "/" || url2.search || url2.hash) {
|
|
7559
|
+
throw new Error("Gateway URL must be an HTTPS origin without credentials, path, port, query or fragment");
|
|
7560
|
+
}
|
|
7561
|
+
return url2.origin;
|
|
7562
|
+
}
|
|
7556
7563
|
|
|
7557
7564
|
// packages/shared/src/workPackBaseline.ts
|
|
7558
7565
|
function normalizePackExtensionModel(pathLabel, content, approvedModelIds, slug) {
|
|
@@ -25158,7 +25165,7 @@ function isRecord(value) {
|
|
|
25158
25165
|
}
|
|
25159
25166
|
|
|
25160
25167
|
// packages/cli/src/workPackSyncPlugin.ts
|
|
25161
|
-
var PLUGIN_VERSION = "0.1.
|
|
25168
|
+
var PLUGIN_VERSION = "0.1.25";
|
|
25162
25169
|
var STATUS_FILENAME = "work-pack-startup-status.json";
|
|
25163
25170
|
var activeSync = /* @__PURE__ */ new Map();
|
|
25164
25171
|
var ForgeWorkPackSyncServer = async (_input, options) => {
|
|
@@ -25215,12 +25222,12 @@ var ForgeWorkPackSyncServer = async (_input, options) => {
|
|
|
25215
25222
|
if (state.forgeConfigVerified) applySharedWorkerPrompt(config2);
|
|
25216
25223
|
},
|
|
25217
25224
|
tool: {
|
|
25218
|
-
forge_decide: createForgeDecisionTool(forgeBaseUrl, state.paths),
|
|
25225
|
+
forge_decide: createForgeDecisionTool(forgeBaseUrl, state.decisionBaseUrl, state.paths),
|
|
25219
25226
|
forge_feedback: createForgeFeedbackTool(forgeBaseUrl, state.paths)
|
|
25220
25227
|
}
|
|
25221
25228
|
};
|
|
25222
25229
|
};
|
|
25223
|
-
function createForgeDecisionTool(forgeBaseUrl, paths) {
|
|
25230
|
+
function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths) {
|
|
25224
25231
|
const question = tool.schema.discriminatedUnion("type", [
|
|
25225
25232
|
tool.schema.object({
|
|
25226
25233
|
type: tool.schema.literal("noul"),
|
|
@@ -25250,7 +25257,7 @@ function createForgeDecisionTool(forgeBaseUrl, paths) {
|
|
|
25250
25257
|
},
|
|
25251
25258
|
async execute(args, context) {
|
|
25252
25259
|
const credentials = await readWellKnownForgeCredentials(paths.opencodeAuthPath, forgeBaseUrl);
|
|
25253
|
-
const response = await fetch(`${
|
|
25260
|
+
const response = await fetch(`${decisionBaseUrl}/v1/decisions`, {
|
|
25254
25261
|
method: "POST",
|
|
25255
25262
|
redirect: "error",
|
|
25256
25263
|
headers: {
|
|
@@ -25303,11 +25310,13 @@ async function synchronizeAtStartup(forgeBaseUrl, input) {
|
|
|
25303
25310
|
const before = await managedProjectionNames(paths);
|
|
25304
25311
|
let credentials;
|
|
25305
25312
|
let forgeConfigVerified = false;
|
|
25313
|
+
let decisionBaseUrl = forgeBaseUrl;
|
|
25306
25314
|
const runtime = await observeRuntime(input);
|
|
25307
25315
|
try {
|
|
25308
25316
|
await retireDebugCapture(paths);
|
|
25309
25317
|
credentials = await readWellKnownForgeCredentials(paths.opencodeAuthPath, forgeBaseUrl);
|
|
25310
25318
|
const manifest = await fetchManifest(credentials);
|
|
25319
|
+
decisionBaseUrl = resolveDecisionBaseUrl(manifest.gatewayBaseUrl, forgeBaseUrl);
|
|
25311
25320
|
forgeConfigVerified = true;
|
|
25312
25321
|
const result = await applyWorkPackManifest(paths, credentials, manifest, {});
|
|
25313
25322
|
await reportWorkPackObservations(credentials, "sync", result.workPackObservations, runtime);
|
|
@@ -25327,7 +25336,7 @@ async function synchronizeAtStartup(forgeBaseUrl, input) {
|
|
|
25327
25336
|
installed: result.installed,
|
|
25328
25337
|
removed: result.removed
|
|
25329
25338
|
});
|
|
25330
|
-
return { paths, before, after, forgeConfigVerified };
|
|
25339
|
+
return { paths, before, after, forgeConfigVerified, decisionBaseUrl };
|
|
25331
25340
|
} catch (error45) {
|
|
25332
25341
|
const message = safeErrorMessage(error45);
|
|
25333
25342
|
console.error("[Forge work-pack sync] Startup sync failed:", message);
|
|
@@ -25340,7 +25349,16 @@ async function synchronizeAtStartup(forgeBaseUrl, input) {
|
|
|
25340
25349
|
}).catch(() => void 0);
|
|
25341
25350
|
if (credentials) await reportFailure(credentials, "sync", new Error(message), runtime);
|
|
25342
25351
|
const after = await managedProjectionNames(paths).catch(() => before);
|
|
25343
|
-
return { paths, before, after, forgeConfigVerified };
|
|
25352
|
+
return { paths, before, after, forgeConfigVerified, decisionBaseUrl };
|
|
25353
|
+
}
|
|
25354
|
+
}
|
|
25355
|
+
function resolveDecisionBaseUrl(gatewayBaseUrl, forgeBaseUrl) {
|
|
25356
|
+
if (!gatewayBaseUrl) return forgeBaseUrl;
|
|
25357
|
+
try {
|
|
25358
|
+
return normalizeGatewayBaseUrl(gatewayBaseUrl);
|
|
25359
|
+
} catch {
|
|
25360
|
+
console.error("[Forge decisions] Invalid gateway URL ignored; using the Forge origin");
|
|
25361
|
+
return forgeBaseUrl;
|
|
25344
25362
|
}
|
|
25345
25363
|
}
|
|
25346
25364
|
function resolveStartupPaths() {
|
|
@@ -25454,5 +25472,6 @@ var ForgeWorkPackSyncPlugin = {
|
|
|
25454
25472
|
var workPackSyncPlugin_default = ForgeWorkPackSyncPlugin;
|
|
25455
25473
|
export {
|
|
25456
25474
|
ForgeWorkPackSyncServer,
|
|
25457
|
-
workPackSyncPlugin_default as default
|
|
25475
|
+
workPackSyncPlugin_default as default,
|
|
25476
|
+
resolveDecisionBaseUrl
|
|
25458
25477
|
};
|