minimal-forge-work-pack-sync 0.1.36 → 0.1.38

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 CHANGED
@@ -117,17 +117,17 @@ var require_visit = __commonJS({
117
117
  visit.BREAK = BREAK;
118
118
  visit.SKIP = SKIP;
119
119
  visit.REMOVE = REMOVE;
120
- function visit_(key, node, visitor, path12) {
121
- const ctrl = callVisitor(key, node, visitor, path12);
120
+ function visit_(key, node, visitor, path13) {
121
+ const ctrl = callVisitor(key, node, visitor, path13);
122
122
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
123
- replaceNode(key, path12, ctrl);
124
- return visit_(key, ctrl, visitor, path12);
123
+ replaceNode(key, path13, ctrl);
124
+ return visit_(key, ctrl, visitor, path13);
125
125
  }
126
126
  if (typeof ctrl !== "symbol") {
127
127
  if (identity.isCollection(node)) {
128
- path12 = Object.freeze(path12.concat(node));
128
+ path13 = Object.freeze(path13.concat(node));
129
129
  for (let i = 0; i < node.items.length; ++i) {
130
- const ci2 = visit_(i, node.items[i], visitor, path12);
130
+ const ci2 = visit_(i, node.items[i], visitor, path13);
131
131
  if (typeof ci2 === "number")
132
132
  i = ci2 - 1;
133
133
  else if (ci2 === BREAK)
@@ -138,13 +138,13 @@ var require_visit = __commonJS({
138
138
  }
139
139
  }
140
140
  } else if (identity.isPair(node)) {
141
- path12 = Object.freeze(path12.concat(node));
142
- const ck = visit_("key", node.key, visitor, path12);
141
+ path13 = Object.freeze(path13.concat(node));
142
+ const ck = visit_("key", node.key, visitor, path13);
143
143
  if (ck === BREAK)
144
144
  return BREAK;
145
145
  else if (ck === REMOVE)
146
146
  node.key = null;
147
- const cv = visit_("value", node.value, visitor, path12);
147
+ const cv = visit_("value", node.value, visitor, path13);
148
148
  if (cv === BREAK)
149
149
  return BREAK;
150
150
  else if (cv === REMOVE)
@@ -165,17 +165,17 @@ var require_visit = __commonJS({
165
165
  visitAsync.BREAK = BREAK;
166
166
  visitAsync.SKIP = SKIP;
167
167
  visitAsync.REMOVE = REMOVE;
168
- async function visitAsync_(key, node, visitor, path12) {
169
- const ctrl = await callVisitor(key, node, visitor, path12);
168
+ async function visitAsync_(key, node, visitor, path13) {
169
+ const ctrl = await callVisitor(key, node, visitor, path13);
170
170
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
171
- replaceNode(key, path12, ctrl);
172
- return visitAsync_(key, ctrl, visitor, path12);
171
+ replaceNode(key, path13, ctrl);
172
+ return visitAsync_(key, ctrl, visitor, path13);
173
173
  }
174
174
  if (typeof ctrl !== "symbol") {
175
175
  if (identity.isCollection(node)) {
176
- path12 = Object.freeze(path12.concat(node));
176
+ path13 = Object.freeze(path13.concat(node));
177
177
  for (let i = 0; i < node.items.length; ++i) {
178
- const ci2 = await visitAsync_(i, node.items[i], visitor, path12);
178
+ const ci2 = await visitAsync_(i, node.items[i], visitor, path13);
179
179
  if (typeof ci2 === "number")
180
180
  i = ci2 - 1;
181
181
  else if (ci2 === BREAK)
@@ -186,13 +186,13 @@ var require_visit = __commonJS({
186
186
  }
187
187
  }
188
188
  } else if (identity.isPair(node)) {
189
- path12 = Object.freeze(path12.concat(node));
190
- const ck = await visitAsync_("key", node.key, visitor, path12);
189
+ path13 = Object.freeze(path13.concat(node));
190
+ const ck = await visitAsync_("key", node.key, visitor, path13);
191
191
  if (ck === BREAK)
192
192
  return BREAK;
193
193
  else if (ck === REMOVE)
194
194
  node.key = null;
195
- const cv = await visitAsync_("value", node.value, visitor, path12);
195
+ const cv = await visitAsync_("value", node.value, visitor, path13);
196
196
  if (cv === BREAK)
197
197
  return BREAK;
198
198
  else if (cv === REMOVE)
@@ -219,23 +219,23 @@ var require_visit = __commonJS({
219
219
  }
220
220
  return visitor;
221
221
  }
222
- function callVisitor(key, node, visitor, path12) {
222
+ function callVisitor(key, node, visitor, path13) {
223
223
  if (typeof visitor === "function")
224
- return visitor(key, node, path12);
224
+ return visitor(key, node, path13);
225
225
  if (identity.isMap(node))
226
- return visitor.Map?.(key, node, path12);
226
+ return visitor.Map?.(key, node, path13);
227
227
  if (identity.isSeq(node))
228
- return visitor.Seq?.(key, node, path12);
228
+ return visitor.Seq?.(key, node, path13);
229
229
  if (identity.isPair(node))
230
- return visitor.Pair?.(key, node, path12);
230
+ return visitor.Pair?.(key, node, path13);
231
231
  if (identity.isScalar(node))
232
- return visitor.Scalar?.(key, node, path12);
232
+ return visitor.Scalar?.(key, node, path13);
233
233
  if (identity.isAlias(node))
234
- return visitor.Alias?.(key, node, path12);
234
+ return visitor.Alias?.(key, node, path13);
235
235
  return void 0;
236
236
  }
237
- function replaceNode(key, path12, node) {
238
- const parent = path12[path12.length - 1];
237
+ function replaceNode(key, path13, node) {
238
+ const parent = path13[path13.length - 1];
239
239
  if (identity.isCollection(parent)) {
240
240
  parent.items[key] = node;
241
241
  } else if (identity.isPair(parent)) {
@@ -847,10 +847,10 @@ var require_Collection = __commonJS({
847
847
  var createNode = require_createNode();
848
848
  var identity = require_identity();
849
849
  var Node = require_Node();
850
- function collectionFromPath(schema, path12, value) {
850
+ function collectionFromPath(schema, path13, value) {
851
851
  let v2 = value;
852
- for (let i = path12.length - 1; i >= 0; --i) {
853
- const k2 = path12[i];
852
+ for (let i = path13.length - 1; i >= 0; --i) {
853
+ const k2 = path13[i];
854
854
  if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
855
855
  const a = [];
856
856
  a[k2] = v2;
@@ -869,7 +869,7 @@ var require_Collection = __commonJS({
869
869
  sourceObjects: /* @__PURE__ */ new Map()
870
870
  });
871
871
  }
872
- var isEmptyPath = (path12) => path12 == null || typeof path12 === "object" && !!path12[Symbol.iterator]().next().done;
872
+ var isEmptyPath = (path13) => path13 == null || typeof path13 === "object" && !!path13[Symbol.iterator]().next().done;
873
873
  var Collection = class extends Node.NodeBase {
874
874
  constructor(type, schema) {
875
875
  super(type);
@@ -899,11 +899,11 @@ var require_Collection = __commonJS({
899
899
  * be a Pair instance or a `{ key, value }` object, which may not have a key
900
900
  * that already exists in the map.
901
901
  */
902
- addIn(path12, value) {
903
- if (isEmptyPath(path12))
902
+ addIn(path13, value) {
903
+ if (isEmptyPath(path13))
904
904
  this.add(value);
905
905
  else {
906
- const [key, ...rest] = path12;
906
+ const [key, ...rest] = path13;
907
907
  const node = this.get(key, true);
908
908
  if (identity.isCollection(node))
909
909
  node.addIn(rest, value);
@@ -917,8 +917,8 @@ var require_Collection = __commonJS({
917
917
  * Removes a value from the collection.
918
918
  * @returns `true` if the item was found and removed.
919
919
  */
920
- deleteIn(path12) {
921
- const [key, ...rest] = path12;
920
+ deleteIn(path13) {
921
+ const [key, ...rest] = path13;
922
922
  if (rest.length === 0)
923
923
  return this.delete(key);
924
924
  const node = this.get(key, true);
@@ -932,8 +932,8 @@ var require_Collection = __commonJS({
932
932
  * scalar values from their surrounding node; to disable set `keepScalar` to
933
933
  * `true` (collections are always returned intact).
934
934
  */
935
- getIn(path12, keepScalar) {
936
- const [key, ...rest] = path12;
935
+ getIn(path13, keepScalar) {
936
+ const [key, ...rest] = path13;
937
937
  const node = this.get(key, true);
938
938
  if (rest.length === 0)
939
939
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -951,8 +951,8 @@ var require_Collection = __commonJS({
951
951
  /**
952
952
  * Checks if the collection includes a value with the key `key`.
953
953
  */
954
- hasIn(path12) {
955
- const [key, ...rest] = path12;
954
+ hasIn(path13) {
955
+ const [key, ...rest] = path13;
956
956
  if (rest.length === 0)
957
957
  return this.has(key);
958
958
  const node = this.get(key, true);
@@ -962,8 +962,8 @@ var require_Collection = __commonJS({
962
962
  * Sets a value in this collection. For `!!set`, `value` needs to be a
963
963
  * boolean to add/remove the item from the set.
964
964
  */
965
- setIn(path12, value) {
966
- const [key, ...rest] = path12;
965
+ setIn(path13, value) {
966
+ const [key, ...rest] = path13;
967
967
  if (rest.length === 0) {
968
968
  this.set(key, value);
969
969
  } else {
@@ -3478,9 +3478,9 @@ var require_Document = __commonJS({
3478
3478
  this.contents.add(value);
3479
3479
  }
3480
3480
  /** Adds a value to the document. */
3481
- addIn(path12, value) {
3481
+ addIn(path13, value) {
3482
3482
  if (assertCollection(this.contents))
3483
- this.contents.addIn(path12, value);
3483
+ this.contents.addIn(path13, value);
3484
3484
  }
3485
3485
  /**
3486
3486
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3555,14 +3555,14 @@ var require_Document = __commonJS({
3555
3555
  * Removes a value from the document.
3556
3556
  * @returns `true` if the item was found and removed.
3557
3557
  */
3558
- deleteIn(path12) {
3559
- if (Collection.isEmptyPath(path12)) {
3558
+ deleteIn(path13) {
3559
+ if (Collection.isEmptyPath(path13)) {
3560
3560
  if (this.contents == null)
3561
3561
  return false;
3562
3562
  this.contents = null;
3563
3563
  return true;
3564
3564
  }
3565
- return assertCollection(this.contents) ? this.contents.deleteIn(path12) : false;
3565
+ return assertCollection(this.contents) ? this.contents.deleteIn(path13) : false;
3566
3566
  }
3567
3567
  /**
3568
3568
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3577,10 +3577,10 @@ var require_Document = __commonJS({
3577
3577
  * scalar values from their surrounding node; to disable set `keepScalar` to
3578
3578
  * `true` (collections are always returned intact).
3579
3579
  */
3580
- getIn(path12, keepScalar) {
3581
- if (Collection.isEmptyPath(path12))
3580
+ getIn(path13, keepScalar) {
3581
+ if (Collection.isEmptyPath(path13))
3582
3582
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3583
- return identity.isCollection(this.contents) ? this.contents.getIn(path12, keepScalar) : void 0;
3583
+ return identity.isCollection(this.contents) ? this.contents.getIn(path13, keepScalar) : void 0;
3584
3584
  }
3585
3585
  /**
3586
3586
  * Checks if the document includes a value with the key `key`.
@@ -3591,10 +3591,10 @@ var require_Document = __commonJS({
3591
3591
  /**
3592
3592
  * Checks if the document includes a value at `path`.
3593
3593
  */
3594
- hasIn(path12) {
3595
- if (Collection.isEmptyPath(path12))
3594
+ hasIn(path13) {
3595
+ if (Collection.isEmptyPath(path13))
3596
3596
  return this.contents !== void 0;
3597
- return identity.isCollection(this.contents) ? this.contents.hasIn(path12) : false;
3597
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path13) : false;
3598
3598
  }
3599
3599
  /**
3600
3600
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3611,13 +3611,13 @@ var require_Document = __commonJS({
3611
3611
  * Sets a value in this document. For `!!set`, `value` needs to be a
3612
3612
  * boolean to add/remove the item from the set.
3613
3613
  */
3614
- setIn(path12, value) {
3615
- if (Collection.isEmptyPath(path12)) {
3614
+ setIn(path13, value) {
3615
+ if (Collection.isEmptyPath(path13)) {
3616
3616
  this.contents = value;
3617
3617
  } else if (this.contents == null) {
3618
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path12), value);
3618
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path13), value);
3619
3619
  } else if (assertCollection(this.contents)) {
3620
- this.contents.setIn(path12, value);
3620
+ this.contents.setIn(path13, value);
3621
3621
  }
3622
3622
  }
3623
3623
  /**
@@ -5578,9 +5578,9 @@ var require_cst_visit = __commonJS({
5578
5578
  visit.BREAK = BREAK;
5579
5579
  visit.SKIP = SKIP;
5580
5580
  visit.REMOVE = REMOVE;
5581
- visit.itemAtPath = (cst, path12) => {
5581
+ visit.itemAtPath = (cst, path13) => {
5582
5582
  let item = cst;
5583
- for (const [field, index] of path12) {
5583
+ for (const [field, index] of path13) {
5584
5584
  const tok = item?.[field];
5585
5585
  if (tok && "items" in tok) {
5586
5586
  item = tok.items[index];
@@ -5589,23 +5589,23 @@ var require_cst_visit = __commonJS({
5589
5589
  }
5590
5590
  return item;
5591
5591
  };
5592
- visit.parentCollection = (cst, path12) => {
5593
- const parent = visit.itemAtPath(cst, path12.slice(0, -1));
5594
- const field = path12[path12.length - 1][0];
5592
+ visit.parentCollection = (cst, path13) => {
5593
+ const parent = visit.itemAtPath(cst, path13.slice(0, -1));
5594
+ const field = path13[path13.length - 1][0];
5595
5595
  const coll = parent?.[field];
5596
5596
  if (coll && "items" in coll)
5597
5597
  return coll;
5598
5598
  throw new Error("Parent collection not found");
5599
5599
  };
5600
- function _visit(path12, item, visitor) {
5601
- let ctrl = visitor(item, path12);
5600
+ function _visit(path13, item, visitor) {
5601
+ let ctrl = visitor(item, path13);
5602
5602
  if (typeof ctrl === "symbol")
5603
5603
  return ctrl;
5604
5604
  for (const field of ["key", "value"]) {
5605
5605
  const token = item[field];
5606
5606
  if (token && "items" in token) {
5607
5607
  for (let i = 0; i < token.items.length; ++i) {
5608
- const ci2 = _visit(Object.freeze(path12.concat([[field, i]])), token.items[i], visitor);
5608
+ const ci2 = _visit(Object.freeze(path13.concat([[field, i]])), token.items[i], visitor);
5609
5609
  if (typeof ci2 === "number")
5610
5610
  i = ci2 - 1;
5611
5611
  else if (ci2 === BREAK)
@@ -5616,10 +5616,10 @@ var require_cst_visit = __commonJS({
5616
5616
  }
5617
5617
  }
5618
5618
  if (typeof ctrl === "function" && field === "key")
5619
- ctrl = ctrl(item, path12);
5619
+ ctrl = ctrl(item, path13);
5620
5620
  }
5621
5621
  }
5622
- return typeof ctrl === "function" ? ctrl(item, path12) : ctrl;
5622
+ return typeof ctrl === "function" ? ctrl(item, path13) : ctrl;
5623
5623
  }
5624
5624
  exports.visit = visit;
5625
5625
  }
@@ -7607,7 +7607,7 @@ var DEFAULT_DEBUG_TRACE_LIMITS = {
7607
7607
  // packages/shared/src/contracts/settings.ts
7608
7608
  var DOCUMENT_READER_AGENT = "document-reader";
7609
7609
  var OPENROUTER_ALIAS_PROVIDER_NAME = "OpenRouter (via Forge)";
7610
- var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.36";
7610
+ var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.38";
7611
7611
  var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
7612
7612
  var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
7613
7613
  var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
@@ -7866,7 +7866,7 @@ async function probeHealth(url2, route, headers, healthyField, source) {
7866
7866
  }
7867
7867
 
7868
7868
  // packages/cli/src/workPackSyncPlugin.ts
7869
- import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
7869
+ import { createHash as createHash7, randomUUID as randomUUID4 } from "node:crypto";
7870
7870
  import { pathToFileURL } from "node:url";
7871
7871
 
7872
7872
  // packages/cli/src/skillUsageReporter.ts
@@ -8171,8 +8171,8 @@ async function replaceFile(filename, contents) {
8171
8171
 
8172
8172
  // packages/cli/src/workPackSyncPlugin.ts
8173
8173
  var import_yaml = __toESM(require_dist(), 1);
8174
- import { link, mkdir as mkdir6, mkdtemp as mkdtemp2, readdir as readdir4, readFile as readFile10, realpath, rename as rename7, rm as rm5, rmdir, stat as stat2, unlink, writeFile as writeFile7 } from "node:fs/promises";
8175
- import path11 from "node:path";
8174
+ import { link, mkdir as mkdir7, mkdtemp as mkdtemp2, readdir as readdir5, readFile as readFile11, realpath, rename as rename8, rm as rm6, rmdir, stat as stat3, unlink, writeFile as writeFile8 } from "node:fs/promises";
8175
+ import path12 from "node:path";
8176
8176
 
8177
8177
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/external.js
8178
8178
  var external_exports = {};
@@ -8905,10 +8905,10 @@ function mergeDefs(...defs) {
8905
8905
  function cloneDef(schema) {
8906
8906
  return mergeDefs(schema._zod.def);
8907
8907
  }
8908
- function getElementAtPath(obj, path12) {
8909
- if (!path12)
8908
+ function getElementAtPath(obj, path13) {
8909
+ if (!path13)
8910
8910
  return obj;
8911
- return path12.reduce((acc, key) => acc?.[key], obj);
8911
+ return path13.reduce((acc, key) => acc?.[key], obj);
8912
8912
  }
8913
8913
  function promiseAllObject(promisesObj) {
8914
8914
  const keys = Object.keys(promisesObj);
@@ -9269,11 +9269,11 @@ function aborted(x, startIndex = 0) {
9269
9269
  }
9270
9270
  return false;
9271
9271
  }
9272
- function prefixIssues(path12, issues) {
9272
+ function prefixIssues(path13, issues) {
9273
9273
  return issues.map((iss) => {
9274
9274
  var _a;
9275
9275
  (_a = iss).path ?? (_a.path = []);
9276
- iss.path.unshift(path12);
9276
+ iss.path.unshift(path13);
9277
9277
  return iss;
9278
9278
  });
9279
9279
  }
@@ -9441,7 +9441,7 @@ function treeifyError(error45, _mapper) {
9441
9441
  return issue2.message;
9442
9442
  };
9443
9443
  const result = { errors: [] };
9444
- const processError = (error46, path12 = []) => {
9444
+ const processError = (error46, path13 = []) => {
9445
9445
  var _a, _b;
9446
9446
  for (const issue2 of error46.issues) {
9447
9447
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -9451,7 +9451,7 @@ function treeifyError(error45, _mapper) {
9451
9451
  } else if (issue2.code === "invalid_element") {
9452
9452
  processError({ issues: issue2.issues }, issue2.path);
9453
9453
  } else {
9454
- const fullpath = [...path12, ...issue2.path];
9454
+ const fullpath = [...path13, ...issue2.path];
9455
9455
  if (fullpath.length === 0) {
9456
9456
  result.errors.push(mapper(issue2));
9457
9457
  continue;
@@ -9483,8 +9483,8 @@ function treeifyError(error45, _mapper) {
9483
9483
  }
9484
9484
  function toDotPath(_path) {
9485
9485
  const segs = [];
9486
- const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
9487
- for (const seg of path12) {
9486
+ const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
9487
+ for (const seg of path13) {
9488
9488
  if (typeof seg === "number")
9489
9489
  segs.push(`[${seg}]`);
9490
9490
  else if (typeof seg === "symbol")
@@ -25012,8 +25012,8 @@ async function operateWorkPack(paths, credentials, skillBySlug, approvedModelIds
25012
25012
  }
25013
25013
  previousManagedPaths = await managedWorkPackPaths(paths, target);
25014
25014
  archive = await downloadSkill(credentials, skill.url);
25015
- const sha2562 = createHash4("sha256").update(archive).digest("hex");
25016
- if (sha2562 !== skill.sha256) return { status: "failed", restoration: "exact", code: "checksum-mismatch" };
25015
+ const sha2563 = createHash4("sha256").update(archive).digest("hex");
25016
+ if (sha2563 !== skill.sha256) return { status: "failed", restoration: "exact", code: "checksum-mismatch" };
25017
25017
  } catch (error45) {
25018
25018
  return exactPackFailure(error45);
25019
25019
  }
@@ -26127,8 +26127,8 @@ function isRecord4(value) {
26127
26127
  }
26128
26128
 
26129
26129
  // packages/cli/src/localWorkerSync.ts
26130
- import { readFile as readFile9 } from "node:fs/promises";
26131
- import path10 from "node:path";
26130
+ import { readFile as readFile10 } from "node:fs/promises";
26131
+ import path11 from "node:path";
26132
26132
 
26133
26133
  // packages/cli/src/recoveryLauncher.ts
26134
26134
  import { chmod as chmod5, readFile as readFile8 } from "node:fs/promises";
@@ -26171,13 +26171,61 @@ exec '${nodePath.replace(/'/g, "'\\''")}' ./forge-repair.mjs "$@"
26171
26171
  `;
26172
26172
  }
26173
26173
 
26174
+ // packages/cli/src/rollback.ts
26175
+ import { createHash as createHash6 } from "node:crypto";
26176
+ import { chmod as chmod6, mkdir as mkdir6, readFile as readFile9, readdir as readdir4, rename as rename7, rm as rm5, stat as stat2, writeFile as writeFile7 } from "node:fs/promises";
26177
+ import path10 from "node:path";
26178
+ async function recordRollbackEvidencePlugin(paths, expectedContent) {
26179
+ if ((await readRollbackLifecycle(paths))?.state !== "pilot") return;
26180
+ const capsule = await readRollbackCapsule(paths);
26181
+ const pluginPath = path10.join(paths.pluginDir, FORGE_EVIDENCE_PLUGIN_FILENAME);
26182
+ const managed = capsule?.managed.files.find((file2) => file2.path === pluginPath);
26183
+ if (!capsule || !managed) return;
26184
+ const current = await readFile9(pluginPath, "utf8").catch(() => void 0);
26185
+ if (current !== expectedContent) return;
26186
+ const fingerprint = sha2562(Buffer.from(current));
26187
+ if (managed.sha256 === fingerprint) return;
26188
+ managed.sha256 = fingerprint;
26189
+ await writeProtectedJsonAtomic(paths.rollbackCapsulePath, capsule);
26190
+ }
26191
+ async function readRollbackLifecycle(paths) {
26192
+ return readJson(paths.rollbackLifecyclePath);
26193
+ }
26194
+ async function readRollbackCapsule(paths) {
26195
+ return readJson(paths.rollbackCapsulePath);
26196
+ }
26197
+ async function writeProtectedJsonAtomic(filePath, value) {
26198
+ const directory = path10.dirname(filePath);
26199
+ await mkdir6(directory, { recursive: true, mode: 448 });
26200
+ await protectRollbackPath(directory, "directory");
26201
+ const temporary = path10.join(directory, `.${path10.basename(filePath)}.${process.pid}.tmp`);
26202
+ await writeFile7(temporary, `${JSON.stringify(value, null, 2)}
26203
+ `, { mode: 384 });
26204
+ await protectRollbackPath(temporary, "file");
26205
+ await rename7(temporary, filePath);
26206
+ }
26207
+ async function protectRollbackPath(filePath, kind, options = {}) {
26208
+ await protectOwnerOnlyPath(filePath, kind, { ...options, failureContext: "o material de rollback" });
26209
+ }
26210
+ async function readJson(filePath) {
26211
+ const raw = await readFile9(filePath, "utf8").catch((error45) => {
26212
+ if (error45.code === "ENOENT") return void 0;
26213
+ throw error45;
26214
+ });
26215
+ if (!raw) return void 0;
26216
+ return JSON.parse(raw);
26217
+ }
26218
+ function sha2562(value) {
26219
+ return createHash6("sha256").update(value).digest("hex");
26220
+ }
26221
+
26174
26222
  // packages/cli/src/localWorkerSync.ts
26175
26223
  async function syncLocalWorker(paths, credentials, manifest) {
26176
- const recovery = await recoverCoreSyncTransaction({ journalPath: path10.join(paths.forgeDir, "core-sync-journal.json") });
26224
+ const recovery = await recoverCoreSyncTransaction({ journalPath: path11.join(paths.forgeDir, "core-sync-journal.json") });
26177
26225
  if (recovery.status === "uncertain") throw new CoreSyncUncertainError(recovery.message, recovery.uncertainPaths);
26178
26226
  let current;
26179
26227
  try {
26180
- current = JSON.parse(await readFile9(paths.opencodeConfigPath, "utf8"));
26228
+ current = JSON.parse(await readFile10(paths.opencodeConfigPath, "utf8"));
26181
26229
  } catch {
26182
26230
  throw new Error("A configura\xE7\xE3o local n\xE3o \xE9 JSON simples v\xE1lido; preserve os ficheiros e pe\xE7a apoio.");
26183
26231
  }
@@ -26191,11 +26239,12 @@ async function syncLocalWorker(paths, credentials, manifest) {
26191
26239
  await installRecoveryLauncher(paths, credentials.forgeBaseUrl);
26192
26240
  const result = await applyManifest(paths, credentials, manifest);
26193
26241
  await removeWellKnownAuth(paths, credentials);
26242
+ await recordRollbackEvidencePlugin(paths, renderEvidencePlugin());
26194
26243
  return result;
26195
26244
  }
26196
26245
 
26197
26246
  // packages/cli/src/workPackSyncPlugin.ts
26198
- var PLUGIN_VERSION = "0.1.36";
26247
+ var PLUGIN_VERSION = "0.1.38";
26199
26248
  var FORGE_DECISION_TIMEOUT_MS = 11e4;
26200
26249
  var STATUS_FILENAME = "work-pack-startup-status.json";
26201
26250
  var activeSync = /* @__PURE__ */ new Map();
@@ -26209,7 +26258,7 @@ var ForgeWorkPackSyncServer = async (_input, options) => {
26209
26258
  activeSync.set(syncKey, sync);
26210
26259
  }
26211
26260
  const state = await sync;
26212
- const legacyPath = path11.join(state.paths.pluginDir, FORGE_EVIDENCE_PLUGIN_FILENAME);
26261
+ const legacyPath = path12.join(state.paths.pluginDir, FORGE_EVIDENCE_PLUGIN_FILENAME);
26213
26262
  const ownershipSymbol = /* @__PURE__ */ Symbol.for("minimal-forge.legacy-evidence-owners.v1");
26214
26263
  const shared = globalThis;
26215
26264
  const legacyOwners = shared[ownershipSymbol] ??= /* @__PURE__ */ new Set();
@@ -26220,13 +26269,13 @@ var ForgeWorkPackSyncServer = async (_input, options) => {
26220
26269
  const slug = typeof input.args?.name === "string" ? input.args.name.trim().toLowerCase() : "";
26221
26270
  if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug)) return;
26222
26271
  try {
26223
- await readFile10(path11.join(state.paths.skillsDir, slug, ".forge-version"), "utf8");
26272
+ await readFile11(path12.join(state.paths.skillsDir, slug, ".forge-version"), "utf8");
26224
26273
  } catch {
26225
26274
  return;
26226
26275
  }
26227
26276
  try {
26228
26277
  const { forgeApiKey } = await readForgeCredentials(state.paths, forgeBaseUrl);
26229
- const credentialId = createHash6("sha256").update(forgeApiKey).digest("hex");
26278
+ const credentialId = createHash7("sha256").update(forgeApiKey).digest("hex");
26230
26279
  const reportUsage = skillUsageReporter(forgeBaseUrl, credentialId, (events) => fetch(`${forgeBaseUrl}/sync/evidence`, {
26231
26280
  method: "POST",
26232
26281
  redirect: "error",
@@ -26245,10 +26294,10 @@ var ForgeWorkPackSyncServer = async (_input, options) => {
26245
26294
  const name = Array.isArray(entry) ? entry[0] : entry;
26246
26295
  return name === legacyPath || name === pathToFileURL(legacyPath).href;
26247
26296
  });
26248
- const legacy = registered ? await readFile10(legacyPath, "utf8").catch(() => "") : "";
26297
+ const legacy = registered ? await readFile11(legacyPath, "utf8").catch(() => "") : "";
26249
26298
  const oldLegacyRegistered = registered && legacy.startsWith(FORGE_PLUGIN_HEADER) && legacy.includes("work_pack_invocation") && !legacy.includes("minimal-forge.skill-usage.v1");
26250
26299
  if (oldLegacyRegistered) legacyOwners.add(legacyOwnerKey);
26251
- if (oldLegacyRegistered) await writeFile7(legacyPath, renderEvidencePlugin()).catch(() => {
26300
+ if (oldLegacyRegistered) await writeFile8(legacyPath, renderEvidencePlugin()).catch(() => {
26252
26301
  console.error("[Forge evidence] Legacy hook upgrade failed; existing hook retained");
26253
26302
  });
26254
26303
  await projectCurrentExtensions(config2, state);
@@ -26276,7 +26325,7 @@ function createForgeImageTool(forgeBaseUrl, gatewayBaseUrl, paths) {
26276
26325
  const requestId = randomUUID4();
26277
26326
  let referenceDataUrl;
26278
26327
  if (args.referencePath) {
26279
- const bytes = await readFile10(args.referencePath);
26328
+ const bytes = await readFile11(args.referencePath);
26280
26329
  if (bytes.byteLength > 25e5) throw new Error("A imagem de refer\xEAncia \xE9 demasiado grande. Reduza-a antes de tentar novamente.");
26281
26330
  const mime = bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])) ? "image/png" : bytes.subarray(0, 3).equals(Buffer.from([255, 216, 255])) ? "image/jpeg" : bytes.subarray(0, 4).toString() === "RIFF" && bytes.subarray(8, 12).toString() === "WEBP" ? "image/webp" : void 0;
26282
26331
  if (!mime) throw new Error("A refer\xEAncia tem de ser PNG, JPEG ou WebP.");
@@ -26302,8 +26351,8 @@ function createForgeImageTool(forgeBaseUrl, gatewayBaseUrl, paths) {
26302
26351
  if (image.byteLength > 8 * 1024 * 1024 || !image.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) {
26303
26352
  throw new Error(`O PNG recebido \xE9 inv\xE1lido. Refer\xEAncia: ${requestId}`);
26304
26353
  }
26305
- const destination = path11.join(context.directory, `forge-image-${requestId}.png`);
26306
- await writeFile7(destination, image, { flag: "wx" });
26354
+ const destination = path12.join(context.directory, `forge-image-${requestId}.png`);
26355
+ await writeFile8(destination, image, { flag: "wx" });
26307
26356
  const reset = body.quota && new Intl.DateTimeFormat("pt-PT", { dateStyle: "long", timeZone: "Europe/Lisbon" }).format(new Date(body.quota.resetsAt));
26308
26357
  const remaining = body.quota ? ` Restam ${body.quota.remaining} imagens at\xE9 ${reset}.` : "";
26309
26358
  return `Imagem guardada em ${destination}.${remaining}
@@ -26349,7 +26398,7 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths, responseD
26349
26398
  let requestBody;
26350
26399
  if (fromFile) {
26351
26400
  const file2 = await fileInsideWorkspace(context.directory, args.request_file);
26352
- const raw = await readFile10(file2, "utf8");
26401
+ const raw = await readFile11(file2, "utf8");
26353
26402
  if (Buffer.byteLength(raw) > 512 * 1024) throw new Error("O ficheiro de pedido excede 512 KiB.");
26354
26403
  let parsed;
26355
26404
  try {
@@ -26368,8 +26417,8 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths, responseD
26368
26417
  if (args.state === void 0 || !args.questions || Object.keys(args.questions).length === 0) throw new Error("Indica state e questions.");
26369
26418
  requestBody = { state: args.state, questions: args.questions };
26370
26419
  }
26371
- const responseDir = await mkdtemp2(path11.join(responseDirectory ?? context.directory, ".forge-decision-"));
26372
- const responseFile = path11.join(responseDir, "response.json");
26420
+ const responseDir = await mkdtemp2(path12.join(responseDirectory ?? context.directory, ".forge-decision-"));
26421
+ const responseFile = path12.join(responseDir, "response.json");
26373
26422
  try {
26374
26423
  const credentials = await readForgeCredentials(paths, forgeBaseUrl);
26375
26424
  const response = await fetch(`${decisionBaseUrl}/v1/decisions`, {
@@ -26390,7 +26439,7 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths, responseD
26390
26439
  }
26391
26440
  if (response.ok && body && typeof body === "object" && body.answers && typeof body.answers === "object") {
26392
26441
  try {
26393
- await writeFile7(responseFile, raw, { flag: "wx", mode: 384 });
26442
+ await writeFile8(responseFile, raw, { flag: "wx", mode: 384 });
26394
26443
  return JSON.stringify({ ...body, response_file: responseFile }, null, 2);
26395
26444
  } catch {
26396
26445
  return JSON.stringify({
@@ -26415,14 +26464,14 @@ function createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths, responseD
26415
26464
  }
26416
26465
  async function fileInsideWorkspace(directory, candidate) {
26417
26466
  const workspace = await realpath(directory);
26418
- const file2 = await realpath(path11.resolve(workspace, candidate));
26419
- const relative = path11.relative(workspace, file2);
26420
- if (!relative || (relative === ".." || relative.startsWith(`..${path11.sep}`)) || path11.isAbsolute(relative)) throw new Error("O ficheiro tem de estar dentro do workspace.");
26467
+ const file2 = await realpath(path12.resolve(workspace, candidate));
26468
+ const relative = path12.relative(workspace, file2);
26469
+ if (!relative || (relative === ".." || relative.startsWith(`..${path12.sep}`)) || path12.isAbsolute(relative)) throw new Error("O ficheiro tem de estar dentro do workspace.");
26421
26470
  return file2;
26422
26471
  }
26423
26472
  async function fileExists(candidate) {
26424
26473
  try {
26425
- await stat2(candidate);
26474
+ await stat3(candidate);
26426
26475
  return true;
26427
26476
  } catch (error45) {
26428
26477
  if (error45.code === "ENOENT") return false;
@@ -26443,19 +26492,19 @@ function createForgeDecisionRunTool(forgeBaseUrl, decisionBaseUrl, paths) {
26443
26492
  args: { plan_file: tool.schema.string().describe("Caminho de jev/plan.json dentro do workspace") },
26444
26493
  async execute(args, context) {
26445
26494
  const planFile = await fileInsideWorkspace(context.directory, args.plan_file);
26446
- if (path11.basename(planFile) !== "plan.json" || path11.basename(path11.dirname(planFile)) !== "jev") throw new Error("Indica o ficheiro jev/plan.json.");
26447
- const runDir = path11.dirname(path11.dirname(planFile));
26448
- const plan = JSON.parse(await readFile10(planFile, "utf8"));
26495
+ if (path12.basename(planFile) !== "plan.json" || path12.basename(path12.dirname(planFile)) !== "jev") throw new Error("Indica o ficheiro jev/plan.json.");
26496
+ const runDir = path12.dirname(path12.dirname(planFile));
26497
+ const plan = JSON.parse(await readFile11(planFile, "utf8"));
26449
26498
  if (plan.engine !== "jev-batch" || plan.model !== "typesafe/jev-1.13" || !Array.isArray(plan.batches)) throw new Error("O plano Jev \xE9 inv\xE1lido.");
26450
26499
  const batches = plan.batches;
26451
- const responsePath = path11.join(runDir, "jev", "responses");
26452
- await mkdir6(responsePath, { recursive: true });
26500
+ const responsePath = path12.join(runDir, "jev", "responses");
26501
+ await mkdir7(responsePath, { recursive: true });
26453
26502
  const responseDir = await fileInsideWorkspace(context.directory, responsePath);
26454
- if (path11.dirname(responseDir) !== path11.join(runDir, "jev")) throw new Error("A pasta de respostas tem de pertencer ao run Jev.");
26503
+ if (path12.dirname(responseDir) !== path12.join(runDir, "jev")) throw new Error("A pasta de respostas tem de pertencer ao run Jev.");
26455
26504
  const decide = createForgeDecisionTool(forgeBaseUrl, decisionBaseUrl, paths, responseDir);
26456
- const lockDir = path11.join(runDir, "jev", ".decide-run.lock");
26505
+ const lockDir = path12.join(runDir, "jev", ".decide-run.lock");
26457
26506
  try {
26458
- await mkdir6(lockDir);
26507
+ await mkdir7(lockDir);
26459
26508
  } catch (error45) {
26460
26509
  if (error45.code !== "EEXIST") throw error45;
26461
26510
  throw new Error("Este plano j\xE1 est\xE1 em execu\xE7\xE3o ou tem uma chamada interrompida. Verificar as respostas e recuperar o lote antes de remover jev/.decide-run.lock; n\xE3o repetir chamadas incertas.");
@@ -26464,26 +26513,26 @@ function createForgeDecisionRunTool(forgeBaseUrl, decisionBaseUrl, paths) {
26464
26513
  let saved = 0;
26465
26514
  let skipped = 0;
26466
26515
  try {
26467
- await writeFile7(path11.join(lockDir, "owner.json"), JSON.stringify({ pid: process.pid, started_at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
26516
+ await writeFile8(path12.join(lockDir, "owner.json"), JSON.stringify({ pid: process.pid, started_at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
26468
26517
  for (const batch of batches) {
26469
26518
  context.abort.throwIfAborted();
26470
26519
  const batchId = batch.batch_id;
26471
26520
  if (typeof batchId !== "string" || !/^batch-[0-9]{4}-[A-Za-z0-9._-]+$/.test(batchId) || typeof batch.request_file !== "string" || typeof batch.request_fingerprint !== "string") {
26472
26521
  throw new Error("O plano Jev cont\xE9m um lote inv\xE1lido.");
26473
26522
  }
26474
- const acceptedFile = path11.join(runDir, "jev", "accepted", `${batchId}.json`);
26475
- const responseFile = path11.join(responseDir, `${batchId}.response.json`);
26523
+ const acceptedFile = path12.join(runDir, "jev", "accepted", `${batchId}.json`);
26524
+ const responseFile = path12.join(responseDir, `${batchId}.response.json`);
26476
26525
  const requestFile = await fileInsideWorkspace(context.directory, batch.request_file);
26477
- if (path11.dirname(requestFile) !== path11.join(runDir, "jev", "requests")) throw new Error(`${batchId}: pedido fora do run.`);
26478
- const request = JSON.parse(await readFile10(requestFile, "utf8"));
26479
- const fingerprint = createHash6("sha256").update(canonicalJson(request)).digest("hex");
26526
+ if (path12.dirname(requestFile) !== path12.join(runDir, "jev", "requests")) throw new Error(`${batchId}: pedido fora do run.`);
26527
+ const request = JSON.parse(await readFile11(requestFile, "utf8"));
26528
+ const fingerprint = createHash7("sha256").update(canonicalJson(request)).digest("hex");
26480
26529
  if (fingerprint !== batch.request_fingerprint) throw new Error(`${batchId}: fingerprint do pedido n\xE3o corresponde ao plano.`);
26481
26530
  if (await fileExists(acceptedFile) || await fileExists(responseFile)) {
26482
26531
  skipped++;
26483
26532
  continue;
26484
26533
  }
26485
26534
  let result;
26486
- await writeFile7(path11.join(lockDir, "owner.json"), JSON.stringify({ pid: process.pid, batch_id: batchId, request_fingerprint: fingerprint, started_at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
26535
+ await writeFile8(path12.join(lockDir, "owner.json"), JSON.stringify({ pid: process.pid, batch_id: batchId, request_fingerprint: fingerprint, started_at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
26487
26536
  try {
26488
26537
  const output = await decide.execute({ request_file: requestFile }, context);
26489
26538
  result = JSON.parse(typeof output === "string" ? output : output.output);
@@ -26508,7 +26557,7 @@ function createForgeDecisionRunTool(forgeBaseUrl, decisionBaseUrl, paths) {
26508
26557
  error: "Resposta conclu\xEDda mas n\xE3o copiada para o run; recuperar o ficheiro indicado, sem repetir a chamada."
26509
26558
  });
26510
26559
  }
26511
- await unlink(result.response_file).then(() => rmdir(path11.dirname(result.response_file))).catch(() => void 0);
26560
+ await unlink(result.response_file).then(() => rmdir(path12.dirname(result.response_file))).catch(() => void 0);
26512
26561
  saved++;
26513
26562
  }
26514
26563
  return JSON.stringify({
@@ -26520,7 +26569,7 @@ function createForgeDecisionRunTool(forgeBaseUrl, decisionBaseUrl, paths) {
26520
26569
  next_step: "Executar jev-accept sobre as respostas guardadas ainda n\xE3o aceites; depois jev-validate e jev-merge."
26521
26570
  });
26522
26571
  } finally {
26523
- if (releaseLock) await rm5(lockDir, { recursive: true });
26572
+ if (releaseLock) await rm6(lockDir, { recursive: true });
26524
26573
  }
26525
26574
  }
26526
26575
  });
@@ -26635,7 +26684,7 @@ async function synchronizeAtStartup(forgeBaseUrl, input, localConfig) {
26635
26684
  }
26636
26685
  async function savedGatewayBaseUrl(paths, credentials, forgeBaseUrl) {
26637
26686
  try {
26638
- const config2 = objectRecord(parseJsonc(await readFile10(paths.opencodeConfigPath, "utf8")));
26687
+ const config2 = objectRecord(parseJsonc(await readFile11(paths.opencodeConfigPath, "utf8")));
26639
26688
  const options = objectRecord(objectRecord(objectRecord(config2.provider).forge).options);
26640
26689
  if (options.apiKey !== credentials.forgeApiKey || typeof options.baseURL !== "string" || !options.baseURL.endsWith("/v1")) return void 0;
26641
26690
  const origin = options.baseURL.slice(0, -"/v1".length);
@@ -26660,7 +26709,7 @@ function resolveStartupPaths() {
26660
26709
  return resolvePaths(void 0, void 0, env);
26661
26710
  }
26662
26711
  async function readForgeCredentials(paths, forgeBaseUrl) {
26663
- const raw = await readFile10(paths.opencodeAuthPath, "utf8").catch((error45) => {
26712
+ const raw = await readFile11(paths.opencodeAuthPath, "utf8").catch((error45) => {
26664
26713
  if (error45.code === "ENOENT") return void 0;
26665
26714
  throw error45;
26666
26715
  });
@@ -26703,22 +26752,22 @@ function parseForgeBaseUrl(options) {
26703
26752
  async function managedProjectionNames(paths) {
26704
26753
  const agents = /* @__PURE__ */ new Set();
26705
26754
  const commands = /* @__PURE__ */ new Set();
26706
- const entries = await readdir4(paths.skillsDir, { withFileTypes: true }).catch((error45) => {
26755
+ const entries = await readdir5(paths.skillsDir, { withFileTypes: true }).catch((error45) => {
26707
26756
  if (error45.code === "ENOENT") return [];
26708
26757
  throw error45;
26709
26758
  });
26710
26759
  for (const entry of entries) {
26711
26760
  if (!entry.isDirectory()) continue;
26712
- const folder = path11.join(paths.skillsDir, entry.name);
26713
- const marker = await readFile10(path11.join(folder, ".forge-version"), "utf8").catch(() => "");
26761
+ const folder = path12.join(paths.skillsDir, entry.name);
26762
+ const marker = await readFile11(path12.join(folder, ".forge-version"), "utf8").catch(() => "");
26714
26763
  if (!marker.trim()) continue;
26715
- for (const name of await readProjectionRecord(path11.join(folder, ".forge-agents"))) agents.add(stripMarkdownExtension(name));
26716
- for (const name of await readProjectionRecord(path11.join(folder, ".forge-commands"))) commands.add(stripMarkdownExtension(name));
26764
+ for (const name of await readProjectionRecord(path12.join(folder, ".forge-agents"))) agents.add(stripMarkdownExtension(name));
26765
+ for (const name of await readProjectionRecord(path12.join(folder, ".forge-commands"))) commands.add(stripMarkdownExtension(name));
26717
26766
  }
26718
26767
  return { agents, commands };
26719
26768
  }
26720
26769
  async function readProjectionRecord(filePath) {
26721
- const raw = await readFile10(filePath, "utf8").catch(() => "");
26770
+ const raw = await readFile11(filePath, "utf8").catch(() => "");
26722
26771
  return raw.split("\n").map((line) => line.trim()).filter(
26723
26772
  (line) => line.endsWith(".md") && !line.includes("/") && !line.includes("\\") && line !== ".."
26724
26773
  );
@@ -26729,21 +26778,21 @@ async function projectCurrentExtensions(config2, state) {
26729
26778
  for (const name of state.before.agents) if (!state.after.agents.has(name)) delete agents[name];
26730
26779
  for (const name of state.before.commands) if (!state.after.commands.has(name)) delete commands[name];
26731
26780
  for (const name of state.after.agents) {
26732
- agents[name] = await parseMarkdownConfig(path11.join(state.paths.agentsDir, `${name}.md`), "prompt");
26781
+ agents[name] = await parseMarkdownConfig(path12.join(state.paths.agentsDir, `${name}.md`), "prompt");
26733
26782
  }
26734
26783
  for (const name of state.after.commands) {
26735
- commands[name] = await parseMarkdownConfig(path11.join(state.paths.commandsDir, `${name}.md`), "template");
26784
+ commands[name] = await parseMarkdownConfig(path12.join(state.paths.commandsDir, `${name}.md`), "template");
26736
26785
  }
26737
26786
  config2.agent = agents;
26738
26787
  config2.command = commands;
26739
26788
  }
26740
26789
  async function parseMarkdownConfig(filePath, bodyField) {
26741
- const raw = await readFile10(filePath, "utf8");
26790
+ const raw = await readFile11(filePath, "utf8");
26742
26791
  const match = /^---\r?\n([\s\S]+?)\r?\n---\r?\n?([\s\S]*)$/.exec(raw);
26743
- if (!match) throw new Error(`A extens\xE3o Forge ${path11.basename(filePath)} n\xE3o tem frontmatter v\xE1lido`);
26792
+ if (!match) throw new Error(`A extens\xE3o Forge ${path12.basename(filePath)} n\xE3o tem frontmatter v\xE1lido`);
26744
26793
  const data = (0, import_yaml.parse)(match[1]);
26745
26794
  if (!data || typeof data !== "object" || Array.isArray(data)) {
26746
- throw new Error(`A extens\xE3o Forge ${path11.basename(filePath)} n\xE3o tem frontmatter v\xE1lido`);
26795
+ throw new Error(`A extens\xE3o Forge ${path12.basename(filePath)} n\xE3o tem frontmatter v\xE1lido`);
26747
26796
  }
26748
26797
  const config2 = { ...data, [bodyField]: match[2].trim() };
26749
26798
  if (bodyField === "prompt" && typeof config2.permission === "string" && ["allow", "ask", "deny"].includes(config2.permission)) {
@@ -26758,12 +26807,12 @@ function stripMarkdownExtension(filename) {
26758
26807
  return filename.slice(0, -3);
26759
26808
  }
26760
26809
  async function writeStatus(paths, value) {
26761
- await mkdir6(paths.forgeDir, { recursive: true });
26762
- const target = path11.join(paths.forgeDir, STATUS_FILENAME);
26763
- const temporary = path11.join(paths.forgeDir, `.${STATUS_FILENAME}.${process.pid}.tmp`);
26764
- await writeFile7(temporary, `${JSON.stringify(value, null, 2)}
26810
+ await mkdir7(paths.forgeDir, { recursive: true });
26811
+ const target = path12.join(paths.forgeDir, STATUS_FILENAME);
26812
+ const temporary = path12.join(paths.forgeDir, `.${STATUS_FILENAME}.${process.pid}.tmp`);
26813
+ await writeFile8(temporary, `${JSON.stringify(value, null, 2)}
26765
26814
  `, { mode: 384 });
26766
- await rename7(temporary, target);
26815
+ await rename8(temporary, target);
26767
26816
  }
26768
26817
  function safeErrorMessage(error45) {
26769
26818
  const message = error45 instanceof Error ? error45.message : "erro desconhecido";
package/dist/repair.js CHANGED
@@ -401,7 +401,7 @@ var DEVICE_ENROLLMENT_PROTOCOL_VERSION = 1;
401
401
  // packages/shared/src/contracts/settings.ts
402
402
  var DOCUMENT_READER_AGENT = "document-reader";
403
403
  var OPENROUTER_ALIAS_PROVIDER_NAME = "OpenRouter (via Forge)";
404
- var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.36";
404
+ var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.38";
405
405
  var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
406
406
  var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
407
407
  var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimal-forge-work-pack-sync",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "Minimal Forge Work Pack startup synchronization for OpenCode and OpenWork.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {