minimal-forge-work-pack-sync 0.1.12 → 0.1.13
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 +265 -208
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19882,6 +19882,225 @@ async function reportWorkPackObservations(credentials, kind, workPacks) {
|
|
|
19882
19882
|
}
|
|
19883
19883
|
}
|
|
19884
19884
|
|
|
19885
|
+
// packages/shared/src/contracts/models.ts
|
|
19886
|
+
var BUILT_IN_OPENROUTER_MODELS = [
|
|
19887
|
+
{
|
|
19888
|
+
id: "anthropic/claude-sonnet-4-6",
|
|
19889
|
+
name: "Assistente de trabalho profundo",
|
|
19890
|
+
approvedByDefault: true,
|
|
19891
|
+
requiredInConfig: false,
|
|
19892
|
+
upstreamModel: "anthropic/claude-sonnet-4.6",
|
|
19893
|
+
metadata: {
|
|
19894
|
+
family: "anthropic",
|
|
19895
|
+
release_date: "2026-02-17",
|
|
19896
|
+
attachment: true,
|
|
19897
|
+
reasoning: true,
|
|
19898
|
+
temperature: true,
|
|
19899
|
+
tool_call: true,
|
|
19900
|
+
limit: { context: 1e6, output: 128e3 },
|
|
19901
|
+
modalities: { input: ["text", "image", "pdf"], output: ["text"] }
|
|
19902
|
+
}
|
|
19903
|
+
},
|
|
19904
|
+
{
|
|
19905
|
+
id: "anthropic/claude-haiku-4-5",
|
|
19906
|
+
name: "Assistente r\xE1pido",
|
|
19907
|
+
approvedByDefault: true,
|
|
19908
|
+
requiredInConfig: false,
|
|
19909
|
+
upstreamModel: "anthropic/claude-haiku-4.5",
|
|
19910
|
+
metadata: {
|
|
19911
|
+
family: "anthropic",
|
|
19912
|
+
release_date: "2025-10-15",
|
|
19913
|
+
attachment: true,
|
|
19914
|
+
reasoning: true,
|
|
19915
|
+
temperature: true,
|
|
19916
|
+
tool_call: true,
|
|
19917
|
+
limit: { context: 2e5, output: 64e3 },
|
|
19918
|
+
modalities: { input: ["text", "image", "pdf"], output: ["text"] }
|
|
19919
|
+
}
|
|
19920
|
+
},
|
|
19921
|
+
{
|
|
19922
|
+
id: "openai/gpt-5.4-mini",
|
|
19923
|
+
name: "Assistente de ficheiros e ecr\xE3",
|
|
19924
|
+
approvedByDefault: true,
|
|
19925
|
+
requiredInConfig: false,
|
|
19926
|
+
metadata: {
|
|
19927
|
+
family: "gpt-mini",
|
|
19928
|
+
release_date: "2026-03-17",
|
|
19929
|
+
attachment: true,
|
|
19930
|
+
reasoning: true,
|
|
19931
|
+
temperature: false,
|
|
19932
|
+
tool_call: true,
|
|
19933
|
+
limit: { context: 4e5, input: 272e3, output: 128e3 },
|
|
19934
|
+
modalities: { input: ["text", "image", "pdf"], output: ["text"] },
|
|
19935
|
+
variants: openRouterReasoningVariants(["none", "xhigh"])
|
|
19936
|
+
}
|
|
19937
|
+
},
|
|
19938
|
+
{
|
|
19939
|
+
id: "minimax/minimax-m3",
|
|
19940
|
+
name: "Assistente de pesquisa",
|
|
19941
|
+
approvedByDefault: true,
|
|
19942
|
+
requiredInConfig: false,
|
|
19943
|
+
metadata: {
|
|
19944
|
+
family: "minimax",
|
|
19945
|
+
release_date: "2026-04-07",
|
|
19946
|
+
attachment: true,
|
|
19947
|
+
reasoning: true,
|
|
19948
|
+
temperature: true,
|
|
19949
|
+
tool_call: true,
|
|
19950
|
+
limit: { context: 524288, output: 512e3 },
|
|
19951
|
+
modalities: { input: ["text", "image", "video"], output: ["text"] }
|
|
19952
|
+
}
|
|
19953
|
+
},
|
|
19954
|
+
{
|
|
19955
|
+
id: "minimax/minimax-m2.7",
|
|
19956
|
+
name: "Assistente de reda\xE7\xE3o",
|
|
19957
|
+
approvedByDefault: true,
|
|
19958
|
+
requiredInConfig: false,
|
|
19959
|
+
metadata: {
|
|
19960
|
+
family: "minimax",
|
|
19961
|
+
release_date: "2026-03-18",
|
|
19962
|
+
attachment: false,
|
|
19963
|
+
reasoning: true,
|
|
19964
|
+
temperature: true,
|
|
19965
|
+
tool_call: true,
|
|
19966
|
+
limit: { context: 196608, output: 196608 },
|
|
19967
|
+
modalities: { input: ["text"], output: ["text"] }
|
|
19968
|
+
}
|
|
19969
|
+
},
|
|
19970
|
+
{
|
|
19971
|
+
id: "xiaomi/mimo-v2.5",
|
|
19972
|
+
name: "Assistente de revis\xE3o multim\xE9dia",
|
|
19973
|
+
approvedByDefault: true,
|
|
19974
|
+
requiredInConfig: false,
|
|
19975
|
+
metadata: {
|
|
19976
|
+
family: "mimo",
|
|
19977
|
+
release_date: "2026-04-22",
|
|
19978
|
+
attachment: true,
|
|
19979
|
+
reasoning: true,
|
|
19980
|
+
temperature: true,
|
|
19981
|
+
tool_call: true,
|
|
19982
|
+
interleaved: { field: "reasoning_details" },
|
|
19983
|
+
limit: { context: 32e3, output: 131072 },
|
|
19984
|
+
modalities: { input: ["text", "audio", "image", "video"], output: ["text"] }
|
|
19985
|
+
}
|
|
19986
|
+
},
|
|
19987
|
+
{
|
|
19988
|
+
id: "xiaomi/mimo-v2.5-pro",
|
|
19989
|
+
name: "Assistente de contexto longo",
|
|
19990
|
+
approvedByDefault: true,
|
|
19991
|
+
requiredInConfig: false,
|
|
19992
|
+
metadata: {
|
|
19993
|
+
family: "mimo",
|
|
19994
|
+
release_date: "2026-04-22",
|
|
19995
|
+
attachment: false,
|
|
19996
|
+
reasoning: true,
|
|
19997
|
+
temperature: true,
|
|
19998
|
+
tool_call: true,
|
|
19999
|
+
interleaved: { field: "reasoning_content" },
|
|
20000
|
+
limit: { context: 1048576, output: 131072 },
|
|
20001
|
+
modalities: { input: ["text"], output: ["text"] }
|
|
20002
|
+
}
|
|
20003
|
+
},
|
|
20004
|
+
{
|
|
20005
|
+
id: "z-ai/glm-5.2",
|
|
20006
|
+
name: "Assistente de an\xE1lise",
|
|
20007
|
+
approvedByDefault: false,
|
|
20008
|
+
requiredInConfig: false,
|
|
20009
|
+
metadata: {
|
|
20010
|
+
family: "glm",
|
|
20011
|
+
release_date: "2026-02-12",
|
|
20012
|
+
attachment: false,
|
|
20013
|
+
reasoning: true,
|
|
20014
|
+
temperature: true,
|
|
20015
|
+
tool_call: true,
|
|
20016
|
+
interleaved: { field: "reasoning_content" },
|
|
20017
|
+
limit: { context: 1048576, output: 32768 },
|
|
20018
|
+
modalities: { input: ["text"], output: ["text"] }
|
|
20019
|
+
}
|
|
20020
|
+
}
|
|
20021
|
+
];
|
|
20022
|
+
var APPROVED_MODELS = BUILT_IN_OPENROUTER_MODELS.filter((model) => model.approvedByDefault).map(stripCatalogFlags);
|
|
20023
|
+
function cloneModel(model) {
|
|
20024
|
+
return {
|
|
20025
|
+
id: model.id,
|
|
20026
|
+
name: model.name,
|
|
20027
|
+
...model.provider ? { provider: model.provider } : {},
|
|
20028
|
+
...model.upstreamModel ? { upstreamModel: model.upstreamModel } : {},
|
|
20029
|
+
...model.billingMode ? { billingMode: model.billingMode } : {},
|
|
20030
|
+
...model.metadata ? { metadata: structuredClone(model.metadata) } : {}
|
|
20031
|
+
};
|
|
20032
|
+
}
|
|
20033
|
+
function stripCatalogFlags(model) {
|
|
20034
|
+
const { approvedByDefault: _approvedByDefault, requiredInConfig: _requiredInConfig, ...approved } = model;
|
|
20035
|
+
return cloneModel(approved);
|
|
20036
|
+
}
|
|
20037
|
+
function openRouterReasoningVariants(efforts) {
|
|
20038
|
+
return Object.fromEntries(efforts.map((effort) => [effort, { reasoning: { effort } }]));
|
|
20039
|
+
}
|
|
20040
|
+
|
|
20041
|
+
// packages/shared/src/contracts/debugTrace.ts
|
|
20042
|
+
var DEFAULT_DEBUG_TRACE_LIMITS = {
|
|
20043
|
+
eventEnvelopeBytes: 256 * 1024,
|
|
20044
|
+
artifactChunkBytes: 2 * 1024 * 1024,
|
|
20045
|
+
// Serialized request bodies must remain comfortably below Vercel's 4.5 MB
|
|
20046
|
+
// function request limit after JSON and base64 overhead.
|
|
20047
|
+
uploadBatchBytes: 3 * 1024 * 1024,
|
|
20048
|
+
uploadBatchRecords: 100,
|
|
20049
|
+
fileSnapshotBytes: 1024 * 1024,
|
|
20050
|
+
serverTraceBudgetBytes: 250 * 1024 * 1024,
|
|
20051
|
+
workerTraceQuotaPer24h: 100,
|
|
20052
|
+
workerBytesQuotaPer24h: 1024 * 1024 * 1024,
|
|
20053
|
+
localQueueBytes: 1024 * 1024 * 1024,
|
|
20054
|
+
retryBackoffMinMs: 5e3,
|
|
20055
|
+
retryBackoffMaxMs: 5 * 60 * 1e3,
|
|
20056
|
+
queueMaxAgeDays: 7,
|
|
20057
|
+
rawTempExposureSeconds: 15 * 60
|
|
20058
|
+
};
|
|
20059
|
+
|
|
20060
|
+
// packages/shared/src/contracts/settings.ts
|
|
20061
|
+
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.13";
|
|
20062
|
+
var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
|
|
20063
|
+
var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
|
|
20064
|
+
var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
|
|
20065
|
+
var FIRECRAWL_KEYLESS_PERMISSION = `${FIRECRAWL_KEYLESS_MCP_NAME}_*`;
|
|
20066
|
+
|
|
20067
|
+
// packages/shared/src/workPackBaseline.ts
|
|
20068
|
+
function normalizePackExtensionModel(pathLabel, content, approvedModelIds, slug) {
|
|
20069
|
+
const match = /^---\n([\s\S]+?)\n---/.exec(content);
|
|
20070
|
+
const frontmatter = match?.[1];
|
|
20071
|
+
if (!match || frontmatter === void 0) return content;
|
|
20072
|
+
const modelLines = [...frontmatter.matchAll(/^model:\s*(.*?)\s*$/gm)];
|
|
20073
|
+
if (modelLines.length === 0) return content;
|
|
20074
|
+
if (modelLines.length > 1) {
|
|
20075
|
+
throw new Error(`A extens\xE3o ${pathLabel} do pacote de trabalho ${slug} define model mais do que uma vez`);
|
|
20076
|
+
}
|
|
20077
|
+
const rawModel = modelLines[0][1].replace(/^(['"])(.*)\1$/, "$2");
|
|
20078
|
+
const separator = rawModel.indexOf("/");
|
|
20079
|
+
const provider = separator > 0 ? rawModel.slice(0, separator) : "";
|
|
20080
|
+
const modelId = separator > 0 ? rawModel.slice(separator + 1) : "";
|
|
20081
|
+
if (provider !== "forge" && provider !== "openrouter" || !approvedModelIds.has(modelId)) {
|
|
20082
|
+
throw new Error(
|
|
20083
|
+
`A extens\xE3o ${pathLabel} do pacote de trabalho ${slug} usa um modelo que n\xE3o est\xE1 aprovado no Forge`
|
|
20084
|
+
);
|
|
20085
|
+
}
|
|
20086
|
+
if (provider === "forge") return content;
|
|
20087
|
+
const normalizedFrontmatter = frontmatter.replace(/^model:\s*.*?$/m, `model: forge/${modelId}`);
|
|
20088
|
+
return `${content.slice(0, match.index)}---
|
|
20089
|
+
${normalizedFrontmatter}
|
|
20090
|
+
---${content.slice(match.index + match[0].length)}`;
|
|
20091
|
+
}
|
|
20092
|
+
function canonicalWorkPackState(state) {
|
|
20093
|
+
const compare = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
20094
|
+
return JSON.stringify({
|
|
20095
|
+
schemaVersion: 1,
|
|
20096
|
+
version: state.version,
|
|
20097
|
+
files: [...state.files].sort((a, b2) => compare(a.path, b2.path)),
|
|
20098
|
+
directories: [...state.directories].sort(compare),
|
|
20099
|
+
agents: [...state.agents].sort((a, b2) => compare(a.filename, b2.filename)),
|
|
20100
|
+
commands: [...state.commands].sort((a, b2) => compare(a.filename, b2.filename))
|
|
20101
|
+
});
|
|
20102
|
+
}
|
|
20103
|
+
|
|
19885
20104
|
// packages/cli/src/sync.ts
|
|
19886
20105
|
import { createHash as createHash2 } from "node:crypto";
|
|
19887
20106
|
import { chmod, cp, lstat as lstat2, mkdtemp, mkdir as mkdir2, readdir as readdir2, readFile as readFile2, rm, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -22857,188 +23076,6 @@ var To = (s3) => {
|
|
|
22857
23076
|
s3.mtimeCache || (s3.mtimeCache = /* @__PURE__ */ new Map()), s3.filter = t ? (e, i) => t(e, i) && !((s3.mtimeCache?.get(e) ?? i.mtime ?? 0) > (i.mtime ?? 0)) : (e, i) => !((s3.mtimeCache?.get(e) ?? i.mtime ?? 0) > (i.mtime ?? 0));
|
|
22858
23077
|
};
|
|
22859
23078
|
|
|
22860
|
-
// packages/shared/src/contracts/models.ts
|
|
22861
|
-
var BUILT_IN_OPENROUTER_MODELS = [
|
|
22862
|
-
{
|
|
22863
|
-
id: "anthropic/claude-sonnet-4-6",
|
|
22864
|
-
name: "Assistente de trabalho profundo",
|
|
22865
|
-
approvedByDefault: true,
|
|
22866
|
-
requiredInConfig: false,
|
|
22867
|
-
upstreamModel: "anthropic/claude-sonnet-4.6",
|
|
22868
|
-
metadata: {
|
|
22869
|
-
family: "anthropic",
|
|
22870
|
-
release_date: "2026-02-17",
|
|
22871
|
-
attachment: true,
|
|
22872
|
-
reasoning: true,
|
|
22873
|
-
temperature: true,
|
|
22874
|
-
tool_call: true,
|
|
22875
|
-
limit: { context: 1e6, output: 128e3 },
|
|
22876
|
-
modalities: { input: ["text", "image", "pdf"], output: ["text"] }
|
|
22877
|
-
}
|
|
22878
|
-
},
|
|
22879
|
-
{
|
|
22880
|
-
id: "anthropic/claude-haiku-4-5",
|
|
22881
|
-
name: "Assistente r\xE1pido",
|
|
22882
|
-
approvedByDefault: true,
|
|
22883
|
-
requiredInConfig: false,
|
|
22884
|
-
upstreamModel: "anthropic/claude-haiku-4.5",
|
|
22885
|
-
metadata: {
|
|
22886
|
-
family: "anthropic",
|
|
22887
|
-
release_date: "2025-10-15",
|
|
22888
|
-
attachment: true,
|
|
22889
|
-
reasoning: true,
|
|
22890
|
-
temperature: true,
|
|
22891
|
-
tool_call: true,
|
|
22892
|
-
limit: { context: 2e5, output: 64e3 },
|
|
22893
|
-
modalities: { input: ["text", "image", "pdf"], output: ["text"] }
|
|
22894
|
-
}
|
|
22895
|
-
},
|
|
22896
|
-
{
|
|
22897
|
-
id: "openai/gpt-5.4-mini",
|
|
22898
|
-
name: "Assistente de ficheiros e ecr\xE3",
|
|
22899
|
-
approvedByDefault: true,
|
|
22900
|
-
requiredInConfig: false,
|
|
22901
|
-
metadata: {
|
|
22902
|
-
family: "gpt-mini",
|
|
22903
|
-
release_date: "2026-03-17",
|
|
22904
|
-
attachment: true,
|
|
22905
|
-
reasoning: true,
|
|
22906
|
-
temperature: false,
|
|
22907
|
-
tool_call: true,
|
|
22908
|
-
limit: { context: 4e5, input: 272e3, output: 128e3 },
|
|
22909
|
-
modalities: { input: ["text", "image", "pdf"], output: ["text"] },
|
|
22910
|
-
variants: openRouterReasoningVariants(["none", "xhigh"])
|
|
22911
|
-
}
|
|
22912
|
-
},
|
|
22913
|
-
{
|
|
22914
|
-
id: "minimax/minimax-m3",
|
|
22915
|
-
name: "Assistente de pesquisa",
|
|
22916
|
-
approvedByDefault: true,
|
|
22917
|
-
requiredInConfig: false,
|
|
22918
|
-
metadata: {
|
|
22919
|
-
family: "minimax",
|
|
22920
|
-
release_date: "2026-04-07",
|
|
22921
|
-
attachment: true,
|
|
22922
|
-
reasoning: true,
|
|
22923
|
-
temperature: true,
|
|
22924
|
-
tool_call: true,
|
|
22925
|
-
limit: { context: 524288, output: 512e3 },
|
|
22926
|
-
modalities: { input: ["text", "image", "video"], output: ["text"] }
|
|
22927
|
-
}
|
|
22928
|
-
},
|
|
22929
|
-
{
|
|
22930
|
-
id: "minimax/minimax-m2.7",
|
|
22931
|
-
name: "Assistente de reda\xE7\xE3o",
|
|
22932
|
-
approvedByDefault: true,
|
|
22933
|
-
requiredInConfig: false,
|
|
22934
|
-
metadata: {
|
|
22935
|
-
family: "minimax",
|
|
22936
|
-
release_date: "2026-03-18",
|
|
22937
|
-
attachment: false,
|
|
22938
|
-
reasoning: true,
|
|
22939
|
-
temperature: true,
|
|
22940
|
-
tool_call: true,
|
|
22941
|
-
limit: { context: 196608, output: 196608 },
|
|
22942
|
-
modalities: { input: ["text"], output: ["text"] }
|
|
22943
|
-
}
|
|
22944
|
-
},
|
|
22945
|
-
{
|
|
22946
|
-
id: "xiaomi/mimo-v2.5",
|
|
22947
|
-
name: "Assistente de revis\xE3o multim\xE9dia",
|
|
22948
|
-
approvedByDefault: true,
|
|
22949
|
-
requiredInConfig: false,
|
|
22950
|
-
metadata: {
|
|
22951
|
-
family: "mimo",
|
|
22952
|
-
release_date: "2026-04-22",
|
|
22953
|
-
attachment: true,
|
|
22954
|
-
reasoning: true,
|
|
22955
|
-
temperature: true,
|
|
22956
|
-
tool_call: true,
|
|
22957
|
-
interleaved: { field: "reasoning_details" },
|
|
22958
|
-
limit: { context: 32e3, output: 131072 },
|
|
22959
|
-
modalities: { input: ["text", "audio", "image", "video"], output: ["text"] }
|
|
22960
|
-
}
|
|
22961
|
-
},
|
|
22962
|
-
{
|
|
22963
|
-
id: "xiaomi/mimo-v2.5-pro",
|
|
22964
|
-
name: "Assistente de contexto longo",
|
|
22965
|
-
approvedByDefault: true,
|
|
22966
|
-
requiredInConfig: false,
|
|
22967
|
-
metadata: {
|
|
22968
|
-
family: "mimo",
|
|
22969
|
-
release_date: "2026-04-22",
|
|
22970
|
-
attachment: false,
|
|
22971
|
-
reasoning: true,
|
|
22972
|
-
temperature: true,
|
|
22973
|
-
tool_call: true,
|
|
22974
|
-
interleaved: { field: "reasoning_content" },
|
|
22975
|
-
limit: { context: 1048576, output: 131072 },
|
|
22976
|
-
modalities: { input: ["text"], output: ["text"] }
|
|
22977
|
-
}
|
|
22978
|
-
},
|
|
22979
|
-
{
|
|
22980
|
-
id: "z-ai/glm-5.2",
|
|
22981
|
-
name: "Assistente de an\xE1lise",
|
|
22982
|
-
approvedByDefault: false,
|
|
22983
|
-
requiredInConfig: false,
|
|
22984
|
-
metadata: {
|
|
22985
|
-
family: "glm",
|
|
22986
|
-
release_date: "2026-02-12",
|
|
22987
|
-
attachment: false,
|
|
22988
|
-
reasoning: true,
|
|
22989
|
-
temperature: true,
|
|
22990
|
-
tool_call: true,
|
|
22991
|
-
interleaved: { field: "reasoning_content" },
|
|
22992
|
-
limit: { context: 1048576, output: 32768 },
|
|
22993
|
-
modalities: { input: ["text"], output: ["text"] }
|
|
22994
|
-
}
|
|
22995
|
-
}
|
|
22996
|
-
];
|
|
22997
|
-
var APPROVED_MODELS = BUILT_IN_OPENROUTER_MODELS.filter((model) => model.approvedByDefault).map(stripCatalogFlags);
|
|
22998
|
-
function cloneModel(model) {
|
|
22999
|
-
return {
|
|
23000
|
-
id: model.id,
|
|
23001
|
-
name: model.name,
|
|
23002
|
-
...model.provider ? { provider: model.provider } : {},
|
|
23003
|
-
...model.upstreamModel ? { upstreamModel: model.upstreamModel } : {},
|
|
23004
|
-
...model.billingMode ? { billingMode: model.billingMode } : {},
|
|
23005
|
-
...model.metadata ? { metadata: structuredClone(model.metadata) } : {}
|
|
23006
|
-
};
|
|
23007
|
-
}
|
|
23008
|
-
function stripCatalogFlags(model) {
|
|
23009
|
-
const { approvedByDefault: _approvedByDefault, requiredInConfig: _requiredInConfig, ...approved } = model;
|
|
23010
|
-
return cloneModel(approved);
|
|
23011
|
-
}
|
|
23012
|
-
function openRouterReasoningVariants(efforts) {
|
|
23013
|
-
return Object.fromEntries(efforts.map((effort) => [effort, { reasoning: { effort } }]));
|
|
23014
|
-
}
|
|
23015
|
-
|
|
23016
|
-
// packages/shared/src/contracts/debugTrace.ts
|
|
23017
|
-
var DEFAULT_DEBUG_TRACE_LIMITS = {
|
|
23018
|
-
eventEnvelopeBytes: 256 * 1024,
|
|
23019
|
-
artifactChunkBytes: 2 * 1024 * 1024,
|
|
23020
|
-
// Serialized request bodies must remain comfortably below Vercel's 4.5 MB
|
|
23021
|
-
// function request limit after JSON and base64 overhead.
|
|
23022
|
-
uploadBatchBytes: 3 * 1024 * 1024,
|
|
23023
|
-
uploadBatchRecords: 100,
|
|
23024
|
-
fileSnapshotBytes: 1024 * 1024,
|
|
23025
|
-
serverTraceBudgetBytes: 250 * 1024 * 1024,
|
|
23026
|
-
workerTraceQuotaPer24h: 100,
|
|
23027
|
-
workerBytesQuotaPer24h: 1024 * 1024 * 1024,
|
|
23028
|
-
localQueueBytes: 1024 * 1024 * 1024,
|
|
23029
|
-
retryBackoffMinMs: 5e3,
|
|
23030
|
-
retryBackoffMaxMs: 5 * 60 * 1e3,
|
|
23031
|
-
queueMaxAgeDays: 7,
|
|
23032
|
-
rawTempExposureSeconds: 15 * 60
|
|
23033
|
-
};
|
|
23034
|
-
|
|
23035
|
-
// packages/shared/src/contracts/settings.ts
|
|
23036
|
-
var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.12";
|
|
23037
|
-
var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
|
|
23038
|
-
var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
|
|
23039
|
-
var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
|
|
23040
|
-
var FIRECRAWL_KEYLESS_PERMISSION = `${FIRECRAWL_KEYLESS_MCP_NAME}_*`;
|
|
23041
|
-
|
|
23042
23079
|
// packages/cli/src/workPackReconciler.ts
|
|
23043
23080
|
async function reconcileWorkPacks(input) {
|
|
23044
23081
|
assertUniqueSlugs(input.desired, "desired");
|
|
@@ -23257,6 +23294,34 @@ async function adoptWorkPackInstalledState(input) {
|
|
|
23257
23294
|
await writeJsonAtomic(path2.join(input.packDir, WORK_PACK_LOCAL_STATE_FILENAME), state);
|
|
23258
23295
|
return checkWorkPackInstalledState(input).then((result) => result === "match");
|
|
23259
23296
|
}
|
|
23297
|
+
async function adoptVerifiedWorkPackState(input) {
|
|
23298
|
+
const tree = await digestPackTree(input.packDir);
|
|
23299
|
+
if (!tree) return false;
|
|
23300
|
+
const projections = async (kind, directory) => {
|
|
23301
|
+
const prefix = `${kind}/`;
|
|
23302
|
+
const expected = tree.files.filter((file2) => file2.path.startsWith(prefix) && !file2.path.slice(prefix.length).includes("/") && file2.path.endsWith(".md") && !file2.path.slice(prefix.length).startsWith("._"));
|
|
23303
|
+
const result = [];
|
|
23304
|
+
for (const file2 of expected) {
|
|
23305
|
+
const filename = file2.path.slice(prefix.length);
|
|
23306
|
+
const absolute = path2.join(directory, filename);
|
|
23307
|
+
const info = await lstat(absolute);
|
|
23308
|
+
if (!info.isFile() || info.isSymbolicLink()) throw new Error("Unsafe projection");
|
|
23309
|
+
result.push({ filename, sha256: digest(await readFile(absolute)) });
|
|
23310
|
+
}
|
|
23311
|
+
return result.sort((a, b2) => a.filename.localeCompare(b2.filename));
|
|
23312
|
+
};
|
|
23313
|
+
const state = {
|
|
23314
|
+
schemaVersion: 1,
|
|
23315
|
+
version: input.version,
|
|
23316
|
+
...tree,
|
|
23317
|
+
agents: await projections("agents", input.agentsDir),
|
|
23318
|
+
commands: await projections("commands", input.commandsDir)
|
|
23319
|
+
};
|
|
23320
|
+
if (digest(Buffer.from(canonicalWorkPackState(state))) !== input.fingerprint) return false;
|
|
23321
|
+
if (!await matchesInstalledState(input, state)) return false;
|
|
23322
|
+
await writeJsonAtomic(path2.join(input.packDir, WORK_PACK_LOCAL_STATE_FILENAME), state);
|
|
23323
|
+
return await checkWorkPackInstalledState(input) === "match";
|
|
23324
|
+
}
|
|
23260
23325
|
async function readInstalledState(packDir) {
|
|
23261
23326
|
const raw = await readFile(path2.join(packDir, WORK_PACK_LOCAL_STATE_FILENAME), "utf8").catch(() => void 0);
|
|
23262
23327
|
if (!raw) return void 0;
|
|
@@ -23512,11 +23577,27 @@ async function operateWorkPack(paths, credentials, skillBySlug, approvedModelIds
|
|
|
23512
23577
|
}
|
|
23513
23578
|
}
|
|
23514
23579
|
if (ownership === "managed" && !sameVersion) {
|
|
23515
|
-
|
|
23580
|
+
let localState = await checkWorkPackInstalledState({
|
|
23516
23581
|
packDir: target,
|
|
23517
23582
|
agentsDir: paths.agentsDir,
|
|
23518
23583
|
commandsDir: paths.commandsDir
|
|
23519
23584
|
});
|
|
23585
|
+
if (localState === "missing") {
|
|
23586
|
+
try {
|
|
23587
|
+
const baselineUrl = `/sync/skills/${encodeURIComponent(skill.slug)}/baseline/${encodeURIComponent(currentVersion.trim())}`;
|
|
23588
|
+
const baseline = JSON.parse(new TextDecoder().decode(await downloadSkill(credentials, baselineUrl)));
|
|
23589
|
+
if (typeof baseline.fingerprint === "string" && /^[a-f0-9]{64}$/.test(baseline.fingerprint)) {
|
|
23590
|
+
localState = await adoptVerifiedWorkPackState({
|
|
23591
|
+
packDir: target,
|
|
23592
|
+
agentsDir: paths.agentsDir,
|
|
23593
|
+
commandsDir: paths.commandsDir,
|
|
23594
|
+
version: currentVersion.trim(),
|
|
23595
|
+
fingerprint: baseline.fingerprint
|
|
23596
|
+
}) ? "match" : "missing";
|
|
23597
|
+
}
|
|
23598
|
+
} catch {
|
|
23599
|
+
}
|
|
23600
|
+
}
|
|
23520
23601
|
if (localState !== "match") {
|
|
23521
23602
|
return {
|
|
23522
23603
|
status: "failed",
|
|
@@ -24172,30 +24253,6 @@ async function workPackNeedsModelNormalization(target, approvedModelIds, slug) {
|
|
|
24172
24253
|
function normalizePackAgentModel(filename, content, approvedModelIds, slug) {
|
|
24173
24254
|
return normalizePackExtensionModel(`agents/${filename}`, content, approvedModelIds, slug);
|
|
24174
24255
|
}
|
|
24175
|
-
function normalizePackExtensionModel(pathLabel, content, approvedModelIds, slug) {
|
|
24176
|
-
const match = /^---\n([\s\S]+?)\n---/.exec(content);
|
|
24177
|
-
const frontmatter = match?.[1];
|
|
24178
|
-
if (!match || frontmatter === void 0) return content;
|
|
24179
|
-
const modelLines = [...frontmatter.matchAll(/^model:\s*(.*?)\s*$/gm)];
|
|
24180
|
-
if (modelLines.length === 0) return content;
|
|
24181
|
-
if (modelLines.length > 1) {
|
|
24182
|
-
throw new Error(`A extens\xE3o ${pathLabel} do pacote de trabalho ${slug} define model mais do que uma vez`);
|
|
24183
|
-
}
|
|
24184
|
-
const rawModel = modelLines[0][1].replace(/^(['"])(.*)\1$/, "$2");
|
|
24185
|
-
const separator = rawModel.indexOf("/");
|
|
24186
|
-
const provider = separator > 0 ? rawModel.slice(0, separator) : "";
|
|
24187
|
-
const modelId = separator > 0 ? rawModel.slice(separator + 1) : "";
|
|
24188
|
-
if (provider !== "forge" && provider !== "openrouter" || !approvedModelIds.has(modelId)) {
|
|
24189
|
-
throw new Error(
|
|
24190
|
-
`A extens\xE3o ${pathLabel} do pacote de trabalho ${slug} usa um modelo que n\xE3o est\xE1 aprovado no Forge`
|
|
24191
|
-
);
|
|
24192
|
-
}
|
|
24193
|
-
if (provider === "forge") return content;
|
|
24194
|
-
const normalizedFrontmatter = frontmatter.replace(/^model:\s*.*?$/m, `model: forge/${modelId}`);
|
|
24195
|
-
return `${content.slice(0, match.index)}---
|
|
24196
|
-
${normalizedFrontmatter}
|
|
24197
|
-
---${content.slice(match.index + match[0].length)}`;
|
|
24198
|
-
}
|
|
24199
24256
|
async function readPackCommandFiles(skillFolder) {
|
|
24200
24257
|
const commandsFolder = path3.join(skillFolder, "commands");
|
|
24201
24258
|
const entries = await readdir2(commandsFolder, { withFileTypes: true }).catch((error45) => {
|
|
@@ -24438,7 +24495,7 @@ async function writeTextAtomic(filePath, content) {
|
|
|
24438
24495
|
}
|
|
24439
24496
|
|
|
24440
24497
|
// packages/cli/src/workPackSyncPlugin.ts
|
|
24441
|
-
var PLUGIN_VERSION = "0.1.
|
|
24498
|
+
var PLUGIN_VERSION = "0.1.13";
|
|
24442
24499
|
var STATUS_FILENAME = "work-pack-startup-status.json";
|
|
24443
24500
|
var activeSync = /* @__PURE__ */ new Map();
|
|
24444
24501
|
var ForgeWorkPackSyncServer = async (_input, options) => {
|