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
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule, InjectionToken, OptionalFactoryDependency } from '@nestjs/common';
2
- import { A as ArkKernel, C as CreateArkKernelOptions } from '../types-D6Q8WHes.cjs';
2
+ import { A as ArkKernel, C as CreateArkKernelOptions } from '../types-BZ17b9i5.cjs';
3
3
 
4
4
  /** Injection token for the Ark kernel instance. */
5
5
  declare const ARK_KERNEL: unique symbol;
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule, InjectionToken, OptionalFactoryDependency } from '@nestjs/common';
2
- import { A as ArkKernel, C as CreateArkKernelOptions } from '../types-D6Q8WHes.js';
2
+ import { A as ArkKernel, C as CreateArkKernelOptions } from '../types-BZ17b9i5.js';
3
3
 
4
4
  /** Injection token for the Ark kernel instance. */
5
5
  declare const ARK_KERNEL: unique symbol;
@@ -1778,7 +1778,7 @@ var elevenLayerProfile = createArchitectureProfile({
1778
1778
  var MANIFEST_SCHEMA_VERSION = "1.0";
1779
1779
 
1780
1780
  // src/version.ts
1781
- var version = "2.9.2";
1781
+ var version = "2.11.0";
1782
1782
 
1783
1783
  // src/kernel/manifest/createArkManifest.ts
1784
1784
  function policyId(name) {
@@ -2153,15 +2153,18 @@ function sleep(ms) {
2153
2153
  });
2154
2154
  }
2155
2155
  async function withTimeout(operation, timeoutMs, stepName) {
2156
- if (timeoutMs === void 0) return operation;
2156
+ const controller = new AbortController();
2157
+ if (timeoutMs === void 0) return operation(controller.signal);
2157
2158
  let timeout;
2158
2159
  const timeoutPromise = new Promise((_, reject) => {
2159
2160
  timeout = setTimeout(() => {
2160
- reject(new Error(`Workflow step "${stepName}" timed out after ${timeoutMs}ms.`));
2161
+ const error = new Error(`Workflow step "${stepName}" timed out after ${timeoutMs}ms.`);
2162
+ controller.abort(error);
2163
+ reject(error);
2161
2164
  }, timeoutMs);
2162
2165
  });
2163
2166
  try {
2164
- return await Promise.race([operation, timeoutPromise]);
2167
+ return await Promise.race([operation(controller.signal), timeoutPromise]);
2165
2168
  } finally {
2166
2169
  if (timeout) clearTimeout(timeout);
2167
2170
  }
@@ -2196,6 +2199,15 @@ var WorkflowEngineImpl = class {
2196
2199
  if (this.definitions.has(definition.name)) {
2197
2200
  throw new Error(`Workflow "${definition.name}" is already registered.`);
2198
2201
  }
2202
+ const names = /* @__PURE__ */ new Set();
2203
+ for (const step of definition.steps) {
2204
+ if (names.has(step.name)) {
2205
+ throw new Error(
2206
+ `Workflow "${definition.name}" has duplicate step name "${step.name}".`
2207
+ );
2208
+ }
2209
+ names.add(step.name);
2210
+ }
2199
2211
  this.definitions.set(definition.name, definition);
2200
2212
  if (definition.startOn) {
2201
2213
  const trigger = definition.startOn;
@@ -2236,6 +2248,7 @@ var WorkflowEngineImpl = class {
2236
2248
  } catch (err) {
2237
2249
  await this.compensate(snapshot, definition.steps, err);
2238
2250
  snapshot.status = "failed";
2251
+ snapshot.currentStep = void 0;
2239
2252
  snapshot.error = errorMessage(err);
2240
2253
  snapshot.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
2241
2254
  await this.store.save(snapshot);
@@ -2264,7 +2277,7 @@ var WorkflowEngineImpl = class {
2264
2277
  await this.store.save(snapshot);
2265
2278
  try {
2266
2279
  const result = await withTimeout(
2267
- Promise.resolve(step.execute(snapshot.context, this.bus)),
2280
+ (signal) => Promise.resolve(step.execute(snapshot.context, this.bus, signal)),
2268
2281
  step.timeoutMs,
2269
2282
  step.name
2270
2283
  );