@smartergpt/lexrunner 1.5.1 → 2.0.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.
@@ -133,6 +133,10 @@ var CONFIG_ERROR_CODES = {
133
133
  var POLICY_ERROR_CODES = {
134
134
  /** No policy file found in any search path */
135
135
  POLICY_NOT_FOUND: "POLICY_NOT_FOUND",
136
+ /** A policy output already exists and overwrite was not explicit */
137
+ POLICY_ALREADY_EXISTS: "POLICY_ALREADY_EXISTS",
138
+ /** A constrained policy source directory resolves outside the repository */
139
+ POLICY_SOURCE_DIR_OUTSIDE_ROOT: "POLICY_SOURCE_DIR_OUTSIDE_ROOT",
136
140
  /** Policy file exists but has invalid JSON */
137
141
  POLICY_PARSE_ERROR: "POLICY_PARSE_ERROR",
138
142
  /** Policy file fails schema validation */
@@ -9913,6 +9913,10 @@ var CONFIG_ERROR_CODES = {
9913
9913
  var POLICY_ERROR_CODES = {
9914
9914
  /** No policy file found in any search path */
9915
9915
  POLICY_NOT_FOUND: "POLICY_NOT_FOUND",
9916
+ /** A policy output already exists and overwrite was not explicit */
9917
+ POLICY_ALREADY_EXISTS: "POLICY_ALREADY_EXISTS",
9918
+ /** A constrained policy source directory resolves outside the repository */
9919
+ POLICY_SOURCE_DIR_OUTSIDE_ROOT: "POLICY_SOURCE_DIR_OUTSIDE_ROOT",
9916
9920
  /** Policy file exists but has invalid JSON */
9917
9921
  POLICY_PARSE_ERROR: "POLICY_PARSE_ERROR",
9918
9922
  /** Policy file fails schema validation */
@@ -10436,7 +10440,10 @@ var CLI_CAPABILITIES = Object.freeze({
10436
10440
  check: Object.freeze([]),
10437
10441
  timeline: Object.freeze([RUNTIME_OPERATION_CAPABILITIES.FRAME_READ]),
10438
10442
  "frames:export": Object.freeze([RUNTIME_OPERATION_CAPABILITIES.FRAME_READ]),
10439
- "frames:import": Object.freeze([RUNTIME_OPERATION_CAPABILITIES.FRAME_WRITE]),
10443
+ "frames:import": Object.freeze([
10444
+ RUNTIME_OPERATION_CAPABILITIES.FRAME_READ,
10445
+ RUNTIME_OPERATION_CAPABILITIES.FRAME_WRITE
10446
+ ]),
10440
10447
  "db:vacuum": Object.freeze([RUNTIME_OPERATION_CAPABILITIES.FRAME_ADMIN]),
10441
10448
  "db:backup": Object.freeze([RUNTIME_OPERATION_CAPABILITIES.FRAME_ADMIN]),
10442
10449
  "db:repair": Object.freeze([RUNTIME_OPERATION_CAPABILITIES.FRAME_ADMIN]),
@@ -10447,6 +10454,7 @@ var CLI_CAPABILITIES = Object.freeze({
10447
10454
  "db:encrypt": Object.freeze([RUNTIME_OPERATION_CAPABILITIES.FRAME_ADMIN]),
10448
10455
  "db:stats": Object.freeze([RUNTIME_OPERATION_CAPABILITIES.FRAME_READ]),
10449
10456
  "policy:check": Object.freeze([]),
10457
+ "policy:generate": Object.freeze([]),
10450
10458
  "policy:add-module": Object.freeze([]),
10451
10459
  "instructions:init": Object.freeze([]),
10452
10460
  "instructions:generate": Object.freeze([]),
@@ -10936,6 +10944,7 @@ var FrameSpendMetadata = import_zod5.z.object({
10936
10944
  prompts: import_zod5.z.number().optional(),
10937
10945
  tokens_estimated: import_zod5.z.number().optional()
10938
10946
  });
10947
+ var CallerProvenance = import_zod5.z.record(import_zod5.z.string(), import_zod5.z.json());
10939
10948
  var ModuleAttribution = import_zod5.z.object({
10940
10949
  mode: import_zod5.z.enum(["explicit", "inferred", "fallback"]),
10941
10950
  confidence: import_zod5.z.enum(["high", "medium", "low"]),
@@ -10966,7 +10975,8 @@ var FrameStatusSnapshot = import_zod5.z.object({
10966
10975
  next_action: import_zod5.z.string(),
10967
10976
  blockers: import_zod5.z.array(import_zod5.z.string()).optional(),
10968
10977
  merge_blockers: import_zod5.z.array(import_zod5.z.string()).optional(),
10969
- tests_failing: import_zod5.z.array(import_zod5.z.string()).optional()
10978
+ tests_failing: import_zod5.z.array(import_zod5.z.string()).optional(),
10979
+ provenance: CallerProvenance.optional()
10970
10980
  });
10971
10981
  var CapabilityTier = import_zod5.z.enum(["senior", "mid", "junior"]);
10972
10982
  var TaskComplexity = import_zod5.z.object({
@@ -10994,7 +11004,7 @@ var Frame = import_zod5.z.object({
10994
11004
  status_snapshot: FrameStatusSnapshot,
10995
11005
  keywords: import_zod5.z.array(import_zod5.z.string()).optional(),
10996
11006
  atlas_frame_id: import_zod5.z.string().optional(),
10997
- // Link to Atlas Frame (spatial neighborhood)
11007
+ // Legacy Policy Neighborhood snapshot reference
10998
11008
  feature_flags: import_zod5.z.array(import_zod5.z.string()).optional(),
10999
11009
  permissions: import_zod5.z.array(import_zod5.z.string()).optional(),
11000
11010
  module_attribution: ModuleAttribution.optional(),
@@ -11218,6 +11228,13 @@ var COMPATIBILITY_OBJECTS = Object.freeze({
11218
11228
 
11219
11229
  // node_modules/@smartergpt/lex/dist/memory/store/postgres/scoped-frame-store.js
11220
11230
  var import_node_crypto14 = require("crypto");
11231
+ var FRAME_STORE_PROTECTED_RELATIONS = Object.freeze([
11232
+ "frames",
11233
+ "lex_frame_store_migrations",
11234
+ "lex_frame_store_unowned_frames_v1",
11235
+ "lex_frame_store_recovery_operations",
11236
+ "lex_frame_store_recovery_assignments"
11237
+ ]);
11221
11238
 
11222
11239
  // node_modules/@smartergpt/lex/dist/memory/store/postgres/behavioral-store.js
11223
11240
  var import_node_crypto15 = require("crypto");
package/mcp-server.mjs CHANGED
@@ -455,10 +455,23 @@ const tools = {
455
455
  type: "string",
456
456
  description: "Output directory for gate results",
457
457
  },
458
+ timeoutMs: {
459
+ type: "integer",
460
+ minimum: 1,
461
+ maximum: 86400000,
462
+ description:
463
+ "Operation-default gate timeout in milliseconds; a plan gate timeoutMs overrides it exactly",
464
+ },
458
465
  },
459
466
  },
460
467
  call: async (args) => {
461
468
  try {
469
+ if (
470
+ args.timeoutMs !== undefined &&
471
+ (!Number.isInteger(args.timeoutMs) || args.timeoutMs < 1 || args.timeoutMs > 86400000)
472
+ ) {
473
+ throw new Error("timeoutMs must be an integer from 1 through 86400000 milliseconds");
474
+ }
462
475
  const artifact = new core.PlanArtifactService().resolve({
463
476
  planFile: args.planFile,
464
477
  workingDir: process.cwd(),
@@ -472,6 +485,7 @@ const tools = {
472
485
  await new core.GateExecutionService().run({
473
486
  plan: artifact.plan,
474
487
  artifactDir: outDir,
488
+ timeoutMs: args.timeoutMs,
475
489
  onlyItem: args.onlyItem,
476
490
  onlyGate: args.onlyGate,
477
491
  options: { emitReceipt: false, suppressStdout: true },
@@ -621,7 +635,7 @@ const tools = {
621
635
  },
622
636
 
623
637
  health: {
624
- description: "DEPRECATED: use doctor. Compatibility alias scheduled for removal in 2.0.0.",
638
+ description: "DEPRECATED: use doctor. Compatibility alias scheduled for removal in 3.0.0.",
625
639
  inputSchema: {
626
640
  type: "object",
627
641
  properties: {
@@ -640,7 +654,7 @@ const tools = {
640
654
  });
641
655
  const health = {
642
656
  ...doctor,
643
- deprecation: { tool: "health", replacement: "doctor", removeIn: "2.0.0" },
657
+ deprecation: { tool: "health", replacement: "doctor", removeIn: "3.0.0" },
644
658
  };
645
659
 
646
660
  return {
@@ -884,17 +898,52 @@ const tools = {
884
898
  description:
885
899
  "Explicit plan.json path (default: repository plan.json, then profile runner fallback)",
886
900
  },
901
+ evidenceFile: {
902
+ type: "string",
903
+ minLength: 1,
904
+ maxLength: 4096,
905
+ description: "Explicit gate evidence manifest returned by gates.run",
906
+ },
907
+ evidenceSha256: {
908
+ type: "string",
909
+ pattern: "^sha256:[a-f0-9]{64}$",
910
+ description: "Expected SHA-256 returned with the gate evidence manifest",
911
+ },
887
912
  },
888
913
  },
889
914
  call: async (args) => {
890
915
  try {
916
+ const hasEvidenceFile = args.evidenceFile !== undefined;
917
+ const hasEvidenceDigest = args.evidenceSha256 !== undefined;
918
+ if (hasEvidenceFile !== hasEvidenceDigest) {
919
+ throw new Error("evidenceFile and evidenceSha256 must be supplied together");
920
+ }
921
+ if (
922
+ hasEvidenceFile &&
923
+ (typeof args.evidenceFile !== "string" ||
924
+ args.evidenceFile.length < 1 ||
925
+ Buffer.byteLength(args.evidenceFile, "utf8") > 4096 ||
926
+ typeof args.evidenceSha256 !== "string" ||
927
+ !/^sha256:[a-f0-9]{64}$/u.test(args.evidenceSha256))
928
+ ) {
929
+ throw new Error("evidenceFile or evidenceSha256 is invalid");
930
+ }
891
931
  const artifact = new core.PlanArtifactService().resolve({
892
932
  planFile: args.planFile,
893
933
  workingDir: process.cwd(),
894
934
  profileDir: config.profileDir,
895
935
  });
896
936
  const result = {
897
- ...new core.IntegrationStatusQueryService().run(artifact.plan),
937
+ ...new core.IntegrationStatusQueryService().run(
938
+ artifact.plan,
939
+ args.evidenceFile
940
+ ? {
941
+ evidenceFile: args.evidenceFile,
942
+ evidenceSha256: args.evidenceSha256,
943
+ repoRoot: process.cwd(),
944
+ }
945
+ : undefined
946
+ ),
898
947
  planArtifact: artifact.identity,
899
948
  };
900
949
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartergpt/lexrunner",
3
- "version": "1.5.1",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"
@@ -131,7 +131,7 @@
131
131
  "@modelcontextprotocol/sdk": "^1.18.2",
132
132
  "@octokit/auth-token": "^6.0.0",
133
133
  "@octokit/rest": "^22.0.0",
134
- "@smartergpt/lex": "^4.0.0",
134
+ "@smartergpt/lex": "4.0.3",
135
135
  "@types/babel__traverse": "^7.28.0",
136
136
  "ajv": "^8.20.0",
137
137
  "better-sqlite3-multiple-ciphers": "^12.6.2",
@@ -0,0 +1,86 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://smartergpt.dev/schemas/lexrunner/gate-evidence-manifest-v1.json",
4
+ "title": "LexRunner Gate Evidence Manifest v1",
5
+ "type": "object",
6
+ "required": ["schemaVersion", "createdAt", "plan", "candidate", "selection", "entries"],
7
+ "properties": {
8
+ "schemaVersion": { "const": "lexrunner-gate-evidence-manifest/v1" },
9
+ "createdAt": { "type": "string" },
10
+ "plan": {
11
+ "type": "object",
12
+ "required": ["digest", "schemaVersion", "target", "itemCount"],
13
+ "properties": {
14
+ "digest": { "$ref": "#/$defs/sha256" },
15
+ "schemaVersion": { "type": "string" },
16
+ "target": { "type": "string" },
17
+ "itemCount": { "type": "integer", "minimum": 0 }
18
+ },
19
+ "additionalProperties": false
20
+ },
21
+ "candidate": {
22
+ "type": "object",
23
+ "required": ["repositoryRoot", "head", "worktreeDigest"],
24
+ "properties": {
25
+ "repositoryRoot": { "type": "string", "minLength": 1 },
26
+ "head": { "type": "string", "pattern": "^[a-f0-9]{40,64}$" },
27
+ "worktreeDigest": { "$ref": "#/$defs/sha256" }
28
+ },
29
+ "additionalProperties": false
30
+ },
31
+ "selection": {
32
+ "type": "object",
33
+ "required": ["onlyItem", "onlyGate"],
34
+ "properties": {
35
+ "onlyItem": { "type": ["string", "null"] },
36
+ "onlyGate": { "type": ["string", "null"] }
37
+ },
38
+ "additionalProperties": false
39
+ },
40
+ "entries": {
41
+ "type": "array",
42
+ "maxItems": 16384,
43
+ "items": {
44
+ "type": "object",
45
+ "required": ["item", "gate", "declaredGateDigest", "result", "receipt"],
46
+ "properties": {
47
+ "item": { "type": "string", "minLength": 1, "maxLength": 512 },
48
+ "gate": { "type": "string", "minLength": 1, "maxLength": 512 },
49
+ "declaredGateDigest": { "$ref": "#/$defs/sha256" },
50
+ "result": {
51
+ "type": "object",
52
+ "required": ["status", "attempts"],
53
+ "properties": {
54
+ "status": {
55
+ "enum": ["pass", "fail", "blocked", "skipped", "retrying"]
56
+ },
57
+ "exitCode": { "type": "number" },
58
+ "duration": { "type": "number", "minimum": 0 },
59
+ "timeoutMs": { "type": "integer", "minimum": 1 },
60
+ "failureKind": {
61
+ "enum": ["nonzero_exit", "spawn_error", "timeout", "evidence_error"]
62
+ },
63
+ "attempts": { "type": "integer", "minimum": 0 },
64
+ "lastAttempt": { "type": "string" }
65
+ },
66
+ "additionalProperties": false
67
+ },
68
+ "receipt": {
69
+ "type": "object",
70
+ "required": ["path", "sha256"],
71
+ "properties": {
72
+ "path": { "type": "string", "minLength": 1, "maxLength": 4096 },
73
+ "sha256": { "$ref": "#/$defs/sha256" }
74
+ },
75
+ "additionalProperties": false
76
+ }
77
+ },
78
+ "additionalProperties": false
79
+ }
80
+ }
81
+ },
82
+ "$defs": {
83
+ "sha256": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
84
+ },
85
+ "additionalProperties": false
86
+ }
@@ -8,6 +8,7 @@
8
8
  "required": [
9
9
  "schemaVersion",
10
10
  "attempt",
11
+ "binding",
11
12
  "declaredGate",
12
13
  "execution",
13
14
  "outcome",
@@ -15,8 +16,27 @@
15
16
  "artifacts"
16
17
  ],
17
18
  "properties": {
18
- "schemaVersion": { "const": "lexrunner-gate-execution-receipt/v1" },
19
+ "schemaVersion": { "const": "lexrunner-gate-execution-receipt/v2" },
19
20
  "attempt": { "type": "integer", "minimum": 1 },
21
+ "binding": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": ["item", "declaredGateDigest", "candidateDigest", "timeoutMs"],
25
+ "properties": {
26
+ "item": { "type": ["string", "null"], "minLength": 1 },
27
+ "declaredGateDigest": {
28
+ "type": "string",
29
+ "pattern": "^sha256:[a-f0-9]{64}$"
30
+ },
31
+ "candidateDigest": {
32
+ "anyOf": [
33
+ { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
34
+ { "type": "null" }
35
+ ]
36
+ },
37
+ "timeoutMs": { "type": "integer", "minimum": 1 }
38
+ }
39
+ },
20
40
  "declaredGate": {
21
41
  "type": "object",
22
42
  "additionalProperties": false,
@@ -139,7 +139,7 @@
139
139
  "additionalProperties": false,
140
140
  "default": {}
141
141
  },
142
- "security": {
142
+ "security": {
143
143
  "type": "object",
144
144
  "properties": {
145
145
  "blockCritical": {
@@ -272,6 +272,11 @@
272
272
  "input": {
273
273
  "type": "object",
274
274
  "additionalProperties": {}
275
+ },
276
+ "timeoutMs": {
277
+ "type": "integer",
278
+ "exclusiveMinimum": 0,
279
+ "maximum": 86400000
275
280
  }
276
281
  },
277
282
  "required": [
@@ -297,4 +302,4 @@
297
302
  "additionalProperties": false
298
303
  }
299
304
  }
300
- }
305
+ }