arkgate 2.9.2 → 2.11.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +12 -2
  3. package/SECURITY.md +3 -4
  4. package/bin/ark-check.mjs +41 -16
  5. package/bin/ark-mcp.mjs +335 -111
  6. package/bin/ark.mjs +35 -5
  7. package/bin/lib/agent-gates.mjs +161 -8
  8. package/bin/lib/architecture-scan.mjs +23 -1
  9. package/bin/lib/auto-patch.mjs +264 -0
  10. package/bin/lib/baseline-key.mjs +17 -0
  11. package/bin/lib/config-warnings.mjs +22 -0
  12. package/bin/lib/core-layers.mjs +7 -0
  13. package/bin/lib/core-ratchet.mjs +3 -7
  14. package/bin/lib/doctor-plan.mjs +83 -5
  15. package/bin/lib/port-proof.mjs +309 -0
  16. package/bin/lib/prepare-write.mjs +130 -0
  17. package/bin/lib/remediation.mjs +21 -0
  18. package/bin/lib/safety-diagnostics.mjs +263 -0
  19. package/bin/lib/scan-files.mjs +51 -6
  20. package/bin/lib/violations.mjs +3 -3
  21. package/dist/index.cjs +115 -11
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +5 -3
  24. package/dist/index.d.ts +5 -3
  25. package/dist/index.js +115 -11
  26. package/dist/index.js.map +1 -1
  27. package/dist/nestjs/index.cjs +18 -5
  28. package/dist/nestjs/index.cjs.map +1 -1
  29. package/dist/nestjs/index.d.cts +1 -1
  30. package/dist/nestjs/index.d.ts +1 -1
  31. package/dist/nestjs/index.js +18 -5
  32. package/dist/nestjs/index.js.map +1 -1
  33. package/dist/runtime/index.cjs +115 -11
  34. package/dist/runtime/index.cjs.map +1 -1
  35. package/dist/runtime/index.d.cts +1 -1
  36. package/dist/runtime/index.d.ts +1 -1
  37. package/dist/runtime/index.js +115 -11
  38. package/dist/runtime/index.js.map +1 -1
  39. package/dist/{types-D6Q8WHes.d.cts → types-BZ17b9i5.d.cts} +5 -1
  40. package/dist/{types-D6Q8WHes.d.ts → types-BZ17b9i5.d.ts} +5 -1
  41. package/docs/agent-guide.md +15 -1
  42. package/docs/ai-gates.md +63 -5
  43. package/docs/enthusiast/how-to-agent-gates.md +8 -0
  44. package/docs/enthusiast/reference-commands.md +1 -1
  45. package/docs/package-surface.md +2 -2
  46. package/docs/production-hardening.md +5 -0
  47. package/package.json +6 -2
  48. package/server.json +2 -2
  49. package/templates/skills/ark-explain.md +1 -1
  50. package/templates/skills/ark-loop.md +2 -1
@@ -1801,7 +1801,7 @@ var elevenLayerProfile = createArchitectureProfile({
1801
1801
  var MANIFEST_SCHEMA_VERSION = "1.0";
1802
1802
 
1803
1803
  // src/version.ts
1804
- var version = "2.9.2";
1804
+ var version = "2.11.0";
1805
1805
 
1806
1806
  // src/kernel/manifest/createArkManifest.ts
1807
1807
  function policyId(name) {
@@ -2176,15 +2176,18 @@ function sleep(ms) {
2176
2176
  });
2177
2177
  }
2178
2178
  async function withTimeout(operation, timeoutMs, stepName) {
2179
- if (timeoutMs === void 0) return operation;
2179
+ const controller = new AbortController();
2180
+ if (timeoutMs === void 0) return operation(controller.signal);
2180
2181
  let timeout;
2181
2182
  const timeoutPromise = new Promise((_, reject) => {
2182
2183
  timeout = setTimeout(() => {
2183
- reject(new Error(`Workflow step "${stepName}" timed out after ${timeoutMs}ms.`));
2184
+ const error = new Error(`Workflow step "${stepName}" timed out after ${timeoutMs}ms.`);
2185
+ controller.abort(error);
2186
+ reject(error);
2184
2187
  }, timeoutMs);
2185
2188
  });
2186
2189
  try {
2187
- return await Promise.race([operation, timeoutPromise]);
2190
+ return await Promise.race([operation(controller.signal), timeoutPromise]);
2188
2191
  } finally {
2189
2192
  if (timeout) clearTimeout(timeout);
2190
2193
  }
@@ -2219,6 +2222,15 @@ var WorkflowEngineImpl = class {
2219
2222
  if (this.definitions.has(definition.name)) {
2220
2223
  throw new Error(`Workflow "${definition.name}" is already registered.`);
2221
2224
  }
2225
+ const names = /* @__PURE__ */ new Set();
2226
+ for (const step of definition.steps) {
2227
+ if (names.has(step.name)) {
2228
+ throw new Error(
2229
+ `Workflow "${definition.name}" has duplicate step name "${step.name}".`
2230
+ );
2231
+ }
2232
+ names.add(step.name);
2233
+ }
2222
2234
  this.definitions.set(definition.name, definition);
2223
2235
  if (definition.startOn) {
2224
2236
  const trigger = definition.startOn;
@@ -2259,6 +2271,7 @@ var WorkflowEngineImpl = class {
2259
2271
  } catch (err) {
2260
2272
  await this.compensate(snapshot, definition.steps, err);
2261
2273
  snapshot.status = "failed";
2274
+ snapshot.currentStep = void 0;
2262
2275
  snapshot.error = errorMessage(err);
2263
2276
  snapshot.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
2264
2277
  await this.store.save(snapshot);
@@ -2287,7 +2300,7 @@ var WorkflowEngineImpl = class {
2287
2300
  await this.store.save(snapshot);
2288
2301
  try {
2289
2302
  const result = await withTimeout(
2290
- Promise.resolve(step.execute(snapshot.context, this.bus)),
2303
+ (signal) => Promise.resolve(step.execute(snapshot.context, this.bus, signal)),
2291
2304
  step.timeoutMs,
2292
2305
  step.name
2293
2306
  );