@neuraloom/contracts 0.1.22 → 0.1.23

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.
@@ -3,7 +3,8 @@
3
3
  * Cortex × NeuraLoom bridge event payloads + ingestion receipts (v1.0.0).
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BRIDGE_EVENT_PAYLOAD_SCHEMAS = exports.githubReadResultSchema = exports.githubReadRequestSchema = exports.CodexRunnerCredentialRequestSchema = exports.CodexExecutorRuntimeResultPayloadSchema = exports.CodexExecutorRuntimeRequestPayloadSchema = exports.CodexExecutorWorkflowResultPayloadSchema = exports.CodexExecutorWorkflowRequestPayloadSchema = exports.CodexExecutorAuthorizationResultPayloadSchema = exports.CodexExecutorAuthorizationRequestPayloadSchema = exports.CodexExecutorRuntimeJobSchema = exports.CodexSignedSandboxWorkerPayloadSchema = exports.CodexSignedWorkerPayloadSchema = exports.CodexExecutorApprovedScopeSchema = exports.CodexExecutorRuntimeIdentitySchema = exports.CortexBridgeIngestionReceiptApiResponseSchema = exports.NeuraloomIngestionReceiptPayloadSchema = exports.CortexIngestionReceiptPayloadSchema = exports.ProductReleasePackageMvpBridgePayloadSchema = exports.DocDriftDetectedPayloadSchema = exports.DocDraftReadyPayloadSchema = exports.GuardianViolationEventPayloadSchema = exports.EngineeringCheckpointRecordedPayloadSchema = exports.EngineeringCheckpointVerificationSummarySchema = exports.EngineeringCheckpointRevisionSummarySchema = exports.ProofRunRecordedPayloadSchema = exports.PullRequestReadyPayloadSchema = exports.ImplementationPlanReadyPayloadSchema = exports.RepoFindingTaskPayloadSchema = exports.RepoIntelligenceResultPayloadSchema = exports.FindingReconciliationEvidenceSchema = exports.REPO_INTEL_ACTIVE_FINDING_IDS_MAX = exports.NeuraloomGraphGapsSchema = exports.NEURALOOM_GRAPH_GAPS_MAX_NODES = exports.NeuraloomGraphGapNodeSchema = exports.NeuraloomGraphGapStatusSchema = exports.NeuraloomGraphGapSeveritySchema = exports.NEURALOOM_GRAPH_GAPS_VERSION = exports.TaskGithubIssueRequestPayloadSchema = exports.EngineeringIssueResolutionPayloadSchema = exports.CortexTaskGithubIssuePointerSchema = exports.PortfolioRepoLinkPayloadSchema = exports.CreativeWorkflowResultPayloadSchema = exports.BrandContextLineageSchema = exports.CreativeWorkflowRequestPayloadSchema = exports.RepoIntelligenceRequestPayloadSchema = exports.BridgeIngestionReceiptStatusSchema = exports.BridgeProofKindSchema = exports.BridgeFindingSeveritySchema = void 0;
6
+ exports.githubReadResultSchema = exports.githubReadRequestSchema = exports.CodexRunnerCredentialRequestSchema = exports.CodexExecutorRuntimeResultPayloadSchema = exports.CodexExecutorRuntimeRequestPayloadSchema = exports.CodexExecutorWorkflowResultPayloadSchema = exports.CodexExecutorWorkflowRequestPayloadSchema = exports.CodexExecutorAuthorizationResultPayloadSchema = exports.CodexExecutorAuthorizationRequestPayloadSchema = exports.CodexExecutorRuntimeJobSchema = exports.CodexSignedSandboxWorkerPayloadSchema = exports.CodexSignedWorkerPayloadSchema = exports.CodexExecutorApprovedScopeSchema = exports.CodexExecutorRuntimeIdentitySchema = exports.CortexBridgeIngestionReceiptApiResponseSchema = exports.NeuraloomIngestionReceiptPayloadSchema = exports.CortexIngestionReceiptPayloadSchema = exports.ProductReleasePackageMvpBridgePayloadSchema = exports.DocDriftDetectedPayloadSchema = exports.DocDraftReadyPayloadSchema = exports.GuardianViolationEventPayloadSchema = exports.EngineeringCheckpointRecordedPayloadSchema = exports.EngineeringCheckpointVerificationSummarySchema = exports.EngineeringCheckpointRevisionSummarySchema = exports.ProofRunRecordedPayloadSchema = exports.PullRequestReadyPayloadSchema = exports.ImplementationPlanReadyPayloadSchema = exports.RepoFindingTaskPayloadSchema = exports.RepoIntelligenceResultPayloadSchema = exports.FindingReconciliationEvidenceSchema = exports.REPO_INTEL_ACTIVE_FINDING_IDS_MAX = exports.NeuraloomGraphGapsSchema = exports.NEURALOOM_GRAPH_GAPS_MAX_NODES = exports.NeuraloomGraphGapNodeSchema = exports.NeuraloomGraphGapStatusSchema = exports.NeuraloomGraphGapSeveritySchema = exports.NEURALOOM_GRAPH_GAPS_VERSION = exports.TaskGithubIssueRequestPayloadSchema = exports.EngineeringIssueResolutionPayloadSchema = exports.EngineeringIssueRecoveryReceiptSchema = exports.EngineeringIssueRecoveryProofSchema = exports.CortexTaskGithubIssuePointerSchema = exports.PortfolioRepoLinkPayloadSchema = exports.CreativeWorkflowResultPayloadSchema = exports.BrandContextLineageSchema = exports.CreativeWorkflowRequestPayloadSchema = exports.RepoIntelligenceRequestPayloadSchema = exports.BridgeIngestionReceiptStatusSchema = exports.BridgeProofKindSchema = exports.BridgeFindingSeveritySchema = void 0;
7
+ exports.BRIDGE_EVENT_PAYLOAD_SCHEMAS = void 0;
7
8
  exports.githubIssueUrlMatches = githubIssueUrlMatches;
8
9
  const zod_1 = require("zod");
9
10
  const film_bridge_events_schema_1 = require("./film-bridge-events.schema");
@@ -141,6 +142,32 @@ exports.CortexTaskGithubIssuePointerSchema = zod_1.z.object({
141
142
  context.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ['epic', 'url'], message: 'Epic URL must match its repository and issue number' });
142
143
  }
143
144
  });
145
+ /** Exact original wire bytes bind caller evidence to the immutable authenticated delivery. */
146
+ exports.EngineeringIssueRecoveryProofSchema = zod_1.z.object({
147
+ schemaVersion: zod_1.z.literal('1.0.0'),
148
+ originalEventId: zod_1.z.string().uuid(),
149
+ originalIdempotencyKey: zod_1.z.string().min(1),
150
+ originalPayloadHash: zod_1.z.string().regex(/^[a-f0-9]{64}$/),
151
+ scanRunId: zod_1.z.string().uuid(),
152
+ snapshotArtifactId: zod_1.z.string().uuid(),
153
+ commitSha: zod_1.z.string().regex(/^[a-f0-9]{40}$/),
154
+ originalEnvelopeBody: zod_1.z.string().min(1).max(32_768).refine(value => new TextEncoder().encode(value).byteLength <= 32_768, 'Original envelope exceeds UTF8 byte bound'),
155
+ }).strict();
156
+ exports.EngineeringIssueRecoveryReceiptSchema = exports.EngineeringIssueRecoveryProofSchema.extend({
157
+ githubIssue: exports.CortexTaskGithubIssuePointerSchema,
158
+ neuraloomTaskId: zod_1.z.string().uuid(),
159
+ cortexTaskId: zod_1.z.string().uuid(),
160
+ findingId: zod_1.z.string().min(1),
161
+ canonicalFindingId: zod_1.z.string().min(1),
162
+ repoFullName: zod_1.z.string().min(1),
163
+ neuraloomProjectId: zod_1.z.string().uuid(),
164
+ brandSlug: zod_1.z.string().min(1),
165
+ productSlug: zod_1.z.string().min(1).optional(),
166
+ }).strict().superRefine((receipt, context) => {
167
+ if (!githubIssueUrlMatches(receipt.githubIssue.url, receipt.repoFullName, receipt.githubIssue.number)) {
168
+ context.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ['githubIssue'], message: 'Recovery issue must match repository' });
169
+ }
170
+ });
144
171
  exports.EngineeringIssueResolutionPayloadSchema = zod_1.z.object({
145
172
  cortexTaskId: zod_1.z.string().uuid(),
146
173
  findingId: zod_1.z.string().min(1),
@@ -150,6 +177,7 @@ exports.EngineeringIssueResolutionPayloadSchema = zod_1.z.object({
150
177
  priority: zod_1.z.enum(['low', 'medium', 'high', 'urgent']),
151
178
  epic: zod_1.z.object({ repoFullName: zod_1.z.string().min(1), number: zod_1.z.number().int().positive(), url: zod_1.z.string().url() }).strict(),
152
179
  githubIssue: exports.CortexTaskGithubIssuePointerSchema.optional(),
180
+ recovery: exports.EngineeringIssueRecoveryProofSchema.optional(),
153
181
  }).strict().superRefine((resolution, context) => {
154
182
  if (!githubIssueUrlMatches(resolution.epic.url, resolution.epic.repoFullName, resolution.epic.number)) {
155
183
  context.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ['epic', 'url'], message: 'Epic URL must match its repository and issue number' });
@@ -492,8 +520,15 @@ exports.CortexIngestionReceiptPayloadSchema = zod_1.z
492
520
  normalizedCandidateId: zod_1.z.string().optional(),
493
521
  githubIssue: exports.CortexTaskGithubIssuePointerSchema.optional(),
494
522
  neuraloomTaskId: zod_1.z.string().uuid().optional(),
523
+ engineeringRecovery: exports.EngineeringIssueRecoveryReceiptSchema.optional(),
495
524
  })
496
- .strict();
525
+ .strict().superRefine((receipt, context) => {
526
+ const recovery = receipt.engineeringRecovery;
527
+ if (recovery && (JSON.stringify(receipt.githubIssue) !== JSON.stringify(recovery.githubIssue) ||
528
+ receipt.neuraloomTaskId !== recovery.neuraloomTaskId || receipt.normalizedCandidateId !== recovery.scanRunId)) {
529
+ context.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ['engineeringRecovery'], message: 'Recovery must agree with outer receipt pointers and scan' });
530
+ }
531
+ });
497
532
  exports.NeuraloomIngestionReceiptPayloadSchema = exports.CortexIngestionReceiptPayloadSchema;
498
533
  exports.CortexBridgeIngestionReceiptApiResponseSchema = zod_1.z
499
534
  .object({
@@ -139,20 +139,25 @@ export declare const DurableOrchestrationContinueSchema: z.ZodEffects<z.ZodObjec
139
139
  runId: z.ZodString;
140
140
  stepIndex: z.ZodOptional<z.ZodNumber>;
141
141
  stageIndex: z.ZodOptional<z.ZodNumber>;
142
- }, "strip", z.ZodTypeAny, {
142
+ commandId: z.ZodOptional<z.ZodString>;
143
+ }, "strict", z.ZodTypeAny, {
143
144
  runId: string;
144
145
  stepIndex?: number | undefined;
145
146
  stageIndex?: number | undefined;
147
+ commandId?: string | undefined;
146
148
  }, {
147
149
  runId: string;
148
150
  stepIndex?: number | undefined;
149
151
  stageIndex?: number | undefined;
152
+ commandId?: string | undefined;
150
153
  }>, {
151
154
  runId: string;
152
155
  stepIndex?: number | undefined;
153
156
  stageIndex?: number | undefined;
157
+ commandId?: string | undefined;
154
158
  }, {
155
159
  runId: string;
156
160
  stepIndex?: number | undefined;
157
161
  stageIndex?: number | undefined;
162
+ commandId?: string | undefined;
158
163
  }>;
@@ -83,6 +83,7 @@ exports.DurableOrchestrationContinueSchema = zod_1.z
83
83
  runId: zod_1.z.string().uuid(),
84
84
  stepIndex: zod_1.z.number().int().min(0).max(stepMax).optional(),
85
85
  stageIndex: zod_1.z.number().int().min(0).optional(),
86
+ commandId: zod_1.z.string().regex(/^[a-f0-9]{64}$/).optional(),
86
87
  })
87
- .refine((value) => (value.stepIndex !== undefined && value.stageIndex === undefined) ||
88
- (value.stepIndex === undefined && value.stageIndex !== undefined), { message: "Provide exactly one of stepIndex or stageIndex" });
88
+ .strict()
89
+ .refine((value) => [value.stepIndex, value.stageIndex, value.commandId].filter(value => value !== undefined).length === 1, { message: "Provide exactly one of stepIndex, stageIndex or commandId" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuraloom/contracts",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "NeuraLoom contracts package - SSOT for types, schemas, routes, and telemetry",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -48,8 +48,9 @@
48
48
  "typecheck": "tsc --noEmit",
49
49
  "test": "vitest run",
50
50
  "verify:artifact": "node -e \"const fs=require('node:fs'),p=require('./package.json'); Promise.all(Object.entries(p.exports).map(async([key,target])=>{const name=p.name+(key==='.'?'':key.slice(1)),c=require(name),m=await import(name);for(const k of Object.keys(c).filter(k=>k!=='__esModule'))if(!Object.hasOwn(m,k)||m[k]!==c[k])throw Error('Artifact export mismatch: '+name+'.'+k);fs.accessSync(target.types)})).then(()=>{const root=require(p.name),bridge=require(p.name+'/integration');for(const k of ['CodexExecutorRuntimeIdentitySchema','RepoIntelligenceRequestPayloadSchema','githubIssueUrlMatches'])if(!root[k]||root[k]!==bridge[k])throw Error('Artifact instance mismatch: '+k);console.log('All public artifact exports verified')}).catch(e=>{console.error(e);process.exitCode=1})\"",
51
- "prepublishOnly": "pnpm run clean && pnpm run build && pnpm run verify:artifact",
51
+ "prepublishOnly": "pnpm run clean && pnpm run build && pnpm run verify:artifact && pnpm run artifact:check --pack",
52
52
  "publish:check": "pnpm pack --dry-run",
53
+ "artifact:check": "node ../../scripts/check-contracts-artifact.mjs",
53
54
  "publish:npm": "pnpm publish --access public"
54
55
  },
55
56
  "dependencies": {