@wrongstack/governance 0.317.0 → 0.318.0

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.
@@ -45,6 +45,7 @@ export interface GovernanceEvidenceCandidate {
45
45
  readonly state: 'incomplete';
46
46
  readonly missing: readonly GovernanceEvidenceCandidateMissingBinding[];
47
47
  };
48
+ readonly trace: GovernanceEvidenceTraceSnapshot;
48
49
  readonly tool: {
49
50
  readonly callId: string | null;
50
51
  readonly name: string;
package/dist/index.js CHANGED
@@ -1211,7 +1211,7 @@ async function connectGovernanceProjectClient(options) {
1211
1211
 
1212
1212
  // src/sanitize.ts
1213
1213
  function sanitizeGovernanceMessage(message) {
1214
- return message.replace(/wsg_\S{1,700}/gu, "[credential]").slice(0, 512);
1214
+ return message.replace(/wsg_[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*/gu, "[credential]").slice(0, 512);
1215
1215
  }
1216
1216
 
1217
1217
  // src/credential-lease-controller.ts
@@ -2143,6 +2143,7 @@ function validateTaskContractV1(contract) {
2143
2143
  }
2144
2144
  }
2145
2145
  for (const check of contract.requiredChecks) {
2146
+ addRequiredStringIssue(issues, check.id, "requiredChecks[].id");
2146
2147
  for (const requirementId of check.requirementIds) {
2147
2148
  if (!requirementIds.has(requirementId)) {
2148
2149
  issues.push({
@@ -2153,6 +2154,14 @@ function validateTaskContractV1(contract) {
2153
2154
  }
2154
2155
  }
2155
2156
  }
2157
+ for (const assumption of contract.assumptions) {
2158
+ addRequiredStringIssue(issues, assumption.id, "assumptions[].id");
2159
+ addRequiredStringIssue(
2160
+ issues,
2161
+ assumption.statement,
2162
+ `assumptions[${assumption.id}].statement`
2163
+ );
2164
+ }
2156
2165
  if (hasMutatingOperation(contract.autonomy.allowedOperations) && contract.autonomy.allowedPaths.length === 0) {
2157
2166
  issues.push({
2158
2167
  code: "path_scope_missing",
@@ -2247,6 +2256,12 @@ function pathMatchesPattern(value, pattern) {
2247
2256
  const prefix = normalizedPattern.slice(0, -3);
2248
2257
  return path6 === prefix || path6.startsWith(`${prefix}/`);
2249
2258
  }
2259
+ if (normalizedPattern.endsWith("/*")) {
2260
+ const prefix = normalizedPattern.slice(0, -2);
2261
+ if (!path6.startsWith(`${prefix}/`)) return false;
2262
+ const remainder = path6.slice(prefix.length + 1);
2263
+ return remainder.length > 0 && !remainder.includes("/");
2264
+ }
2250
2265
  return path6 === normalizedPattern;
2251
2266
  }
2252
2267
  function pathIsAllowed(contract, value) {
@@ -3045,6 +3060,7 @@ function createGovernanceEvidenceCandidate(trace, outcome) {
3045
3060
  status: "unverified",
3046
3061
  candidateId: missing.length === 0 && toolCallId ? candidateIdentity(trace, { ...outcome, toolCallId }) : null,
3047
3062
  binding,
3063
+ trace,
3048
3064
  tool: Object.freeze({ callId: toolCallId ?? null, name: outcome.toolName }),
3049
3065
  outcome: Object.freeze({
3050
3066
  status: outcome.ok ? "succeeded" : "failed",
@@ -3931,7 +3947,10 @@ var SqliteVerificationLedger = class {
3931
3947
  this.#db.exec("COMMIT");
3932
3948
  return deepFreeze2({ recorded: true, snapshot });
3933
3949
  } catch (error) {
3934
- this.#db.exec("ROLLBACK");
3950
+ try {
3951
+ this.#db.exec("ROLLBACK");
3952
+ } catch {
3953
+ }
3935
3954
  throw error;
3936
3955
  }
3937
3956
  }
@@ -4033,7 +4052,10 @@ var SqliteVerificationLedger = class {
4033
4052
  credential: { leaseId, secret }
4034
4053
  });
4035
4054
  } catch (error) {
4036
- this.#db.exec("ROLLBACK");
4055
+ try {
4056
+ this.#db.exec("ROLLBACK");
4057
+ } catch {
4058
+ }
4037
4059
  throw error;
4038
4060
  }
4039
4061
  }
@@ -4305,7 +4327,10 @@ var SqliteVerificationLedger = class {
4305
4327
  }
4306
4328
  });
4307
4329
  } catch (error) {
4308
- this.#db.exec("ROLLBACK");
4330
+ try {
4331
+ this.#db.exec("ROLLBACK");
4332
+ } catch {
4333
+ }
4309
4334
  throw error;
4310
4335
  }
4311
4336
  }
@@ -489,7 +489,7 @@ async function acquireGovernanceDaemonStartupLease(options) {
489
489
 
490
490
  // src/sanitize.ts
491
491
  function sanitizeGovernanceMessage(message) {
492
- return message.replace(/wsg_\S{1,700}/gu, "[credential]").slice(0, 512);
492
+ return message.replace(/wsg_[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*/gu, "[credential]").slice(0, 512);
493
493
  }
494
494
 
495
495
  // src/attachment-broker-controller.ts
@@ -1212,6 +1212,7 @@ function validateTaskContractV1(contract) {
1212
1212
  }
1213
1213
  }
1214
1214
  for (const check of contract.requiredChecks) {
1215
+ addRequiredStringIssue(issues, check.id, "requiredChecks[].id");
1215
1216
  for (const requirementId of check.requirementIds) {
1216
1217
  if (!requirementIds.has(requirementId)) {
1217
1218
  issues.push({
@@ -1222,6 +1223,14 @@ function validateTaskContractV1(contract) {
1222
1223
  }
1223
1224
  }
1224
1225
  }
1226
+ for (const assumption of contract.assumptions) {
1227
+ addRequiredStringIssue(issues, assumption.id, "assumptions[].id");
1228
+ addRequiredStringIssue(
1229
+ issues,
1230
+ assumption.statement,
1231
+ `assumptions[${assumption.id}].statement`
1232
+ );
1233
+ }
1225
1234
  if (hasMutatingOperation(contract.autonomy.allowedOperations) && contract.autonomy.allowedPaths.length === 0) {
1226
1235
  issues.push({
1227
1236
  code: "path_scope_missing",
@@ -1316,6 +1325,12 @@ function pathMatchesPattern(value, pattern) {
1316
1325
  const prefix = normalizedPattern.slice(0, -3);
1317
1326
  return path5 === prefix || path5.startsWith(`${prefix}/`);
1318
1327
  }
1328
+ if (normalizedPattern.endsWith("/*")) {
1329
+ const prefix = normalizedPattern.slice(0, -2);
1330
+ if (!path5.startsWith(`${prefix}/`)) return false;
1331
+ const remainder = path5.slice(prefix.length + 1);
1332
+ return remainder.length > 0 && !remainder.includes("/");
1333
+ }
1319
1334
  return path5 === normalizedPattern;
1320
1335
  }
1321
1336
  function pathIsAllowed(contract, value) {
@@ -2426,7 +2441,10 @@ var SqliteVerificationLedger = class {
2426
2441
  this.#db.exec("COMMIT");
2427
2442
  return deepFreeze2({ recorded: true, snapshot });
2428
2443
  } catch (error) {
2429
- this.#db.exec("ROLLBACK");
2444
+ try {
2445
+ this.#db.exec("ROLLBACK");
2446
+ } catch {
2447
+ }
2430
2448
  throw error;
2431
2449
  }
2432
2450
  }
@@ -2528,7 +2546,10 @@ var SqliteVerificationLedger = class {
2528
2546
  credential: { leaseId, secret }
2529
2547
  });
2530
2548
  } catch (error) {
2531
- this.#db.exec("ROLLBACK");
2549
+ try {
2550
+ this.#db.exec("ROLLBACK");
2551
+ } catch {
2552
+ }
2532
2553
  throw error;
2533
2554
  }
2534
2555
  }
@@ -2800,7 +2821,10 @@ var SqliteVerificationLedger = class {
2800
2821
  }
2801
2822
  });
2802
2823
  } catch (error) {
2803
- this.#db.exec("ROLLBACK");
2824
+ try {
2825
+ this.#db.exec("ROLLBACK");
2826
+ } catch {
2827
+ }
2804
2828
  throw error;
2805
2829
  }
2806
2830
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/governance",
3
- "version": "0.317.0",
3
+ "version": "0.318.0",
4
4
  "license": "MIT",
5
5
  "description": "Deterministic workflow contracts and transition policy for WrongStack orchestration.",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "README.md"
28
28
  ],
29
29
  "dependencies": {
30
- "@wrongstack/persistence": "0.317.0"
30
+ "@wrongstack/persistence": "0.318.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^26.2.0",