@shapeshift-labs/frontier-lang-compiler 0.2.46 → 0.2.48

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.
package/README.md CHANGED
@@ -333,6 +333,7 @@ Extract a surgical semantic slice when a worker only needs one symbol, region, n
333
333
 
334
334
  ```js
335
335
  import {
336
+ createSemanticSliceAdmissionRecord,
336
337
  createSemanticSlice,
337
338
  importNativeSource,
338
339
  testSemanticSlice,
@@ -362,11 +363,16 @@ const gate = testSemanticSlice(slice, {
362
363
  });
363
364
 
364
365
  console.log(gate.status); // "passed", "needs-review", or "failed"
366
+ const admission = createSemanticSliceAdmissionRecord(slice, { testResult: gate });
367
+ console.log(admission.mergeScore.value); // sortable 0-100 semantic merge score
368
+ console.log(admission.autoMergeClaim); // always false
365
369
  console.log(writeSemanticSliceJson(slice)); // stable JSON for worker inputs
366
370
  ```
367
371
 
368
372
  A semantic slice is the small unit a swarm can hand to a worker instead of copying a full repository. It carries the selected symbols, ownership regions, native nodes, relations, occurrences, source-map links, source spans, source excerpts, source hashes, focused verification commands, fixture hints, and merge-admission metadata. It does not claim the patch is correct; it makes the context and conflicts machine-readable so admission scoring can combine changed ownership, focused test status, stale/source-hash checks, evidence, and semantic risk in one sortable record.
369
373
 
374
+ Slice admission records add a compact `frontier.lang.semanticMergeScore.v1` score with semantic-selection, source-freshness, ownership-isolation, verification-evidence, and review-risk components. They are built for coordinator queues and dashboards: sort likely useful slices first, reject stale or empty slices early, and keep correctness proof separate from merge metadata.
375
+
370
376
  Compile native source imports through the same reader/IR/writer facade that swarms use for sidecar evidence. Same-language targets preserve exact source when hashes match; cross-language targets emit declaration stubs until a real adapter provides stronger evidence:
371
377
 
372
378
  ```js
@@ -4,6 +4,7 @@ import {
4
4
  createNativeSourcePreservation,
5
5
  createSemanticImportSidecar,
6
6
  createSemanticSlice,
7
+ createSemanticSliceAdmissionRecord,
7
8
  projectNativeImportToSource,
8
9
  summarizeNativeImportFeatureEvidence,
9
10
  testSemanticSlice
@@ -40,6 +41,11 @@ export function measureNativeTransformations(nativeImportResults) {
40
41
  const semanticSliceGates = semanticSlices.map((slice) => testSemanticSlice(slice, { requireSourceMapLinks: false }));
41
42
  const sliceGateDurationMs = performance.now() - sliceGateStart;
42
43
  const sliceGateFailures = semanticSliceGates.filter((gate) => gate.status === 'failed').length;
44
+ const sliceAdmissionStart = performance.now();
45
+ const semanticSliceAdmissions = semanticSlices.map((slice, index) => createSemanticSliceAdmissionRecord(slice, {
46
+ testResult: semanticSliceGates[index]
47
+ }));
48
+ const sliceAdmissionDurationMs = performance.now() - sliceAdmissionStart;
43
49
 
44
50
  const featureEvidenceStart = performance.now();
45
51
  const featureEvidenceSummaries = nativeImportResults.map((imported) => summarizeNativeImportFeatureEvidence(imported.losses, {
@@ -65,9 +71,12 @@ export function measureNativeTransformations(nativeImportResults) {
65
71
  semanticSlices: semanticSlices.length,
66
72
  sliceDurationMs,
67
73
  sliceGateDurationMs,
74
+ sliceAdmissionDurationMs,
68
75
  sliceSourceMapLinks,
69
76
  sliceConflictKeys,
70
77
  sliceGateFailures,
78
+ sliceAdmissions: semanticSliceAdmissions.length,
79
+ sliceAdmissionRejected: semanticSliceAdmissions.filter((admission) => admission.action === 'reject').length,
71
80
  featureEvidencePolicyMatches,
72
81
  featureEvidenceDurationMs,
73
82
  nativeProjections: nativeProjections.length,
package/bench/smoke.mjs CHANGED
@@ -51,9 +51,12 @@ console.log(JSON.stringify({
51
51
  semanticSlices: transformMetrics.semanticSlices,
52
52
  sliceDurationMs: Number(transformMetrics.sliceDurationMs.toFixed(2)),
53
53
  sliceGateDurationMs: Number(transformMetrics.sliceGateDurationMs.toFixed(2)),
54
+ sliceAdmissionDurationMs: Number(transformMetrics.sliceAdmissionDurationMs.toFixed(2)),
54
55
  sliceSourceMapLinks: transformMetrics.sliceSourceMapLinks,
55
56
  sliceConflictKeys: transformMetrics.sliceConflictKeys,
56
57
  sliceGateFailures: transformMetrics.sliceGateFailures,
58
+ sliceAdmissions: transformMetrics.sliceAdmissions,
59
+ sliceAdmissionRejected: transformMetrics.sliceAdmissionRejected,
57
60
  featureEvidencePolicyMatches: transformMetrics.featureEvidencePolicyMatches,
58
61
  featureEvidenceDurationMs: Number(transformMetrics.featureEvidenceDurationMs.toFixed(2)),
59
62
  nativeProjections: transformMetrics.nativeProjections,
@@ -43,6 +43,7 @@ import type { NativeSourceTokenKind, NativeSourcePreservedToken, NativeSourcePre
43
43
  import type { SemanticImportOwnershipRegion, SemanticImportSidecarSymbol, SemanticImportRegionTaxonomySummary, SemanticImportPatchHint, SemanticImportSidecarImportEntry, SemanticImportSidecarSourcePreservationRecord, SemanticImportSidecarUniversalAstLayerSummary, SemanticImportSidecarProofSpecSummary, SemanticImportSidecarParadigmSemanticsSummary, SemanticImportSidecar, SemanticImportSidecarOptions } from './semantic-sidecar.js';
44
44
  import type { NativeSourceChangeKind, NativeSourceChangeProjectionEndpoint, NativeSourceChangeProjectionSourceMapLink, NativeSourceChangeProjectionMetadata, NativeSourceChangeProjectionSummary, NativeSourceChangeSymbol, NativeSourceChangeRegion, NativeSourceChangeSummary, DiffNativeSourceImportsOptions, DiffNativeSourcesOptions, NativeSourceChangeSet } from './native-diff.js';
45
45
  import type { SemanticSliceInput, CreateSemanticSliceOptions, SemanticSliceSourceMapLink, SemanticSliceSourceFile, SemanticSliceExpectedAssertion, SemanticSlice, TestSemanticSliceOptions, SemanticSliceTestAssertion, SemanticSliceTestResult } from './semantic-slice.js';
46
+ import type { CreateSemanticSliceAdmissionRecordOptions, SemanticSliceAdmissionRecord } from './semantic-slice-admission.js';
46
47
  import type { NativeImporterAdapterExactness, NativeImporterAdapterSemanticCoverage, NativeImporterAdapterCoverageSnapshot, NativeImporterAdapterCoverageObserved, NativeImporterAdapterCoverageCapabilityRow, NativeImporterAdapterCoverageCapabilityEvidence, NativeImporterAdapterCoverageSummary, NativeImporterAdapterCoverageInput } from './adapter-coverage.js';
47
48
  import type { NativeImporterAdapterDiagnostic, ImportNativeSourceOptions, NativeSourceImportResult, ExternalSemanticIndexFormat, ImportExternalSemanticIndexOptions, ExternalSemanticIndexImportSummary, ExternalSemanticIndexImportResult, NativeImporterAdapterParseInput, NativeImporterAdapterParseResult, NativeImporterAdapter, NativeImporterAdapterSummary, RunNativeImporterAdapterOptions, NativeImporterAdapterImportResult } from './import-adapter-core.js';
48
49
  import type { JavaScriptNativeImporterAdapterOptions, TypeScriptCompilerNativeImporterAdapterOptions, PythonAstNativeImporterAdapterOptions, RustSynNativeImporterAdapterOptions, ClangAstNativeImporterAdapterOptions, GoAstNativeImporterAdapterOptions } from './import-adapter-options-native.js';
@@ -109,6 +110,7 @@ export declare function importNativeSource(input: ImportNativeSourceOptions): Na
109
110
  export declare function diffNativeSources(input: DiffNativeSourcesOptions): NativeSourceChangeSet;
110
111
  export declare function diffNativeSourceImports(input: DiffNativeSourceImportsOptions): NativeSourceChangeSet;
111
112
  export declare function createSemanticSlice(input: SemanticSliceInput, options?: CreateSemanticSliceOptions): SemanticSlice;
113
+ export declare function createSemanticSliceAdmissionRecord(slice: SemanticSlice, options?: CreateSemanticSliceAdmissionRecordOptions): SemanticSliceAdmissionRecord;
112
114
  export declare function testSemanticSlice(slice: SemanticSlice, options?: TestSemanticSliceOptions): SemanticSliceTestResult;
113
115
  export declare function readSemanticSliceJson(source: string): SemanticSlice;
114
116
  export declare function writeSemanticSliceJson(slice: SemanticSlice): string;
@@ -0,0 +1,82 @@
1
+ import type { EvidenceRecord, SemanticMergeReadiness } from '@shapeshift-labs/frontier-lang-kernel';
2
+ import type { SemanticSlice, SemanticSliceTestResult, TestSemanticSliceOptions } from './semantic-slice.js';
3
+
4
+ export type SemanticSliceAdmissionAction = 'admit' | 'prioritize' | 'reject';
5
+ export type SemanticSliceAdmissionPriority = 'low' | 'normal' | 'high' | 'blocker';
6
+ export type SemanticSliceAdmissionRisk = 'low' | 'medium' | 'high' | 'unknown';
7
+ export type SemanticSliceAdmissionScoreComponentKey =
8
+ | 'semanticSelection'
9
+ | 'sourceFreshness'
10
+ | 'ownershipIsolation'
11
+ | 'verificationEvidence'
12
+ | 'reviewRisk';
13
+ export type SemanticSliceAdmissionScoreComponentStatus = 'strong' | 'partial' | 'weak' | 'blocked';
14
+
15
+ export interface SemanticSliceAdmissionScoreComponent {
16
+ readonly key: SemanticSliceAdmissionScoreComponentKey;
17
+ readonly score: number;
18
+ readonly weight: number;
19
+ readonly weightedScore: number;
20
+ readonly status: SemanticSliceAdmissionScoreComponentStatus;
21
+ readonly reasons: readonly string[];
22
+ readonly signals: Record<string, unknown>;
23
+ }
24
+
25
+ export interface SemanticSliceAdmissionMergeScore {
26
+ readonly schema: 'frontier.lang.semanticMergeScore.v1';
27
+ readonly version: 1;
28
+ readonly value: number;
29
+ readonly uncappedValue: number;
30
+ readonly sortKey: number;
31
+ readonly higherIsBetter: true;
32
+ readonly readiness: SemanticMergeReadiness;
33
+ readonly risk: SemanticSliceAdmissionRisk;
34
+ readonly action: SemanticSliceAdmissionAction;
35
+ readonly components: Readonly<Record<SemanticSliceAdmissionScoreComponentKey, SemanticSliceAdmissionScoreComponent>>;
36
+ readonly penalties: readonly string[];
37
+ }
38
+
39
+ export interface SemanticSliceAdmissionRecord {
40
+ readonly kind: 'frontier.lang.semanticSliceAdmission';
41
+ readonly version: 1;
42
+ readonly id: string;
43
+ readonly generatedAt: number;
44
+ readonly sliceId?: string;
45
+ readonly importId?: string;
46
+ readonly sourcePath?: string;
47
+ readonly action: SemanticSliceAdmissionAction;
48
+ readonly priority: SemanticSliceAdmissionPriority;
49
+ readonly readiness: SemanticMergeReadiness;
50
+ readonly risk: SemanticSliceAdmissionRisk;
51
+ readonly autoMergeClaim: false;
52
+ readonly reviewRequired: boolean;
53
+ readonly mergeScore: SemanticSliceAdmissionMergeScore;
54
+ readonly counts: {
55
+ readonly symbols: number;
56
+ readonly ownershipRegions: number;
57
+ readonly nativeNodes: number;
58
+ readonly sourceMapLinks: number;
59
+ readonly sourceFiles: number;
60
+ readonly focusedCommands: number;
61
+ readonly fixtureHints: number;
62
+ readonly assertions: number;
63
+ readonly failedAssertions: number;
64
+ readonly warningAssertions: number;
65
+ };
66
+ readonly conflictKeys: readonly string[];
67
+ readonly ownershipKeys: readonly string[];
68
+ readonly sourceHashes: SemanticSlice['mergeAdmission']['sourceHashes'];
69
+ readonly testResult?: SemanticSliceTestResult;
70
+ readonly reasons: readonly string[];
71
+ readonly metadata: Record<string, unknown>;
72
+ }
73
+
74
+ export interface CreateSemanticSliceAdmissionRecordOptions extends TestSemanticSliceOptions {
75
+ readonly testResult?: SemanticSliceTestResult;
76
+ readonly evidence?: readonly EvidenceRecord[];
77
+ }
78
+
79
+ export declare function createSemanticSliceAdmissionRecord(
80
+ slice: SemanticSlice,
81
+ options?: CreateSemanticSliceAdmissionRecordOptions
82
+ ): SemanticSliceAdmissionRecord;
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export * from './declarations/semantic-patch-bundle.js';
17
17
  export * from './declarations/semantic-sidecar.js';
18
18
  export * from './declarations/native-diff.js';
19
19
  export * from './declarations/semantic-slice.js';
20
+ export * from './declarations/semantic-slice-admission.js';
20
21
  export * from './declarations/adapter-coverage.js';
21
22
  export * from './declarations/import-adapter-core.js';
22
23
  export * from './declarations/import-adapter-options-native.js';
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ export { createPythonAstNativeImporterAdapter } from './internal/index-impl/crea
23
23
  export { createRustSynNativeImporterAdapter } from './internal/index-impl/createRustSynNativeImporterAdapter.js';
24
24
  export { createSemanticImportSidecar } from './internal/index-impl/createSemanticImportSidecar.js';
25
25
  export { createSemanticSlice } from './internal/index-impl/createSemanticSlice.js';
26
+ export { createSemanticSliceAdmissionRecord } from './internal/index-impl/createSemanticSliceAdmissionRecord.js';
26
27
  export { createSwiftSyntaxNativeImporterAdapter } from './internal/index-impl/createSwiftSyntaxNativeImporterAdapter.js';
27
28
  export { createTreeSitterNativeImporterAdapter } from './internal/index-impl/createTreeSitterNativeImporterAdapter.js';
28
29
  export { createTypeScriptCompilerNativeImporterAdapter } from './internal/index-impl/createTypeScriptCompilerNativeImporterAdapter.js';
@@ -0,0 +1,180 @@
1
+ import{idFragment,maxSemanticMergeReadiness,uniqueStrings}from'../../native-import-utils.js';
2
+ import{testSemanticSlice}from'./testSemanticSlice.js';
3
+
4
+ const readinessScore=Object.freeze({ready:100,'ready-with-losses':78,'needs-review':48,blocked:0});
5
+ const readinessRank=Object.freeze({ready:3,'ready-with-losses':2,'needs-review':1,blocked:0});
6
+ const actionRank=Object.freeze({admit:2,prioritize:1,reject:0});
7
+ const riskRank=Object.freeze({low:3,medium:2,unknown:1,high:0});
8
+
9
+ export function createSemanticSliceAdmissionRecord(slice,options={}){
10
+ const testResult=options.testResult??(options.currentSources?testSemanticSlice(slice,options):undefined);
11
+ const readiness=worstReadiness(slice?.mergeAdmission?.readiness??slice?.summary?.readiness??'needs-review',testResult?.readiness??'ready');
12
+ const components={
13
+ semanticSelection:semanticSelectionScore(slice),
14
+ sourceFreshness:sourceFreshnessScore(slice,testResult),
15
+ ownershipIsolation:ownershipIsolationScore(slice),
16
+ verificationEvidence:verificationEvidenceScore(slice,testResult,options),
17
+ reviewRisk:reviewRiskScore(slice,readiness,testResult)
18
+ };
19
+ const value=mergeScoreValue(components,readiness);
20
+ const action=admissionAction(slice,readiness,components,testResult);
21
+ const risk=admissionRisk(readiness,components,testResult);
22
+ return{
23
+ kind:'frontier.lang.semanticSliceAdmission',
24
+ version:1,
25
+ id:options.id??`semantic_slice_admission_${idFragment(slice?.id??'slice')}`,
26
+ generatedAt:options.generatedAt??Date.now(),
27
+ sliceId:slice?.id,
28
+ importId:slice?.importId,
29
+ sourcePath:slice?.sourcePath,
30
+ action,
31
+ priority:admissionPriority(action,risk,readiness),
32
+ readiness,
33
+ risk,
34
+ autoMergeClaim:false,
35
+ reviewRequired:action!=='admit'||readiness!=='ready',
36
+ mergeScore:{
37
+ schema:'frontier.lang.semanticMergeScore.v1',
38
+ version:1,
39
+ value,
40
+ uncappedValue:value,
41
+ sortKey:mergeScoreSortKey(value,action,risk,readiness),
42
+ higherIsBetter:true,
43
+ readiness,
44
+ risk,
45
+ action,
46
+ components,
47
+ penalties:uniqueStrings(Object.values(components).flatMap((component)=>component.score<100?component.reasons:[]))
48
+ },
49
+ counts:{
50
+ symbols:slice?.summary?.symbols??slice?.symbols?.length??0,
51
+ ownershipRegions:slice?.summary?.ownershipRegions??slice?.ownershipRegions?.length??0,
52
+ nativeNodes:slice?.summary?.nativeNodes??slice?.nativeNodes?.length??0,
53
+ sourceMapLinks:slice?.summary?.sourceMapLinks??slice?.sourceMapLinks?.length??0,
54
+ sourceFiles:slice?.summary?.sourceFiles??slice?.sourceFiles?.length??0,
55
+ focusedCommands:slice?.verification?.focusedCommands?.length??0,
56
+ fixtureHints:slice?.verification?.fixtureHints?.length??0,
57
+ assertions:testResult?.summary?.assertions??0,
58
+ failedAssertions:testResult?.summary?.failed??0,
59
+ warningAssertions:testResult?.summary?.warnings??0
60
+ },
61
+ conflictKeys:uniqueStrings(slice?.mergeAdmission?.conflictKeys??[]),
62
+ ownershipKeys:uniqueStrings(slice?.mergeAdmission?.ownershipKeys??[]),
63
+ sourceHashes:slice?.mergeAdmission?.sourceHashes??[],
64
+ testResult,
65
+ reasons:uniqueStrings([
66
+ ...(slice?.mergeAdmission?.reasons??[]),
67
+ ...Object.values(components).flatMap((component)=>component.reasons)
68
+ ]),
69
+ metadata:{
70
+ note:'Semantic slice admission is sortable merge-review evidence for isolated worker inputs; it is not a correctness proof and never grants auto-merge by itself.',
71
+ ...(options.metadata??{})
72
+ }
73
+ };
74
+ }
75
+
76
+ function semanticSelectionScore(slice){
77
+ const symbols=slice?.summary?.symbols??slice?.symbols?.length??0;
78
+ const regions=slice?.summary?.ownershipRegions??slice?.ownershipRegions?.length??0;
79
+ const nativeNodes=slice?.summary?.nativeNodes??slice?.nativeNodes?.length??0;
80
+ const links=slice?.summary?.sourceMapLinks??slice?.sourceMapLinks?.length??0;
81
+ const unresolved=slice?.summary?.unresolvedEntryRefs??slice?.unresolvedEntryRefs?.length??0;
82
+ const selected=symbols+regions+nativeNodes;
83
+ let score=selected>0?70:0;
84
+ if(symbols>0)score+=12;
85
+ if(regions>0)score+=10;
86
+ if(links>0)score+=8;
87
+ score=Math.max(0,Math.min(100,score-unresolved*25));
88
+ return scoreComponent('semanticSelection',score,[
89
+ ...(selected===0?['Slice selected no symbols, ownership regions, or native nodes.']:[]),
90
+ ...(unresolved?[`${unresolved} semantic slice entry ref(s) did not resolve.`]:[])
91
+ ],{symbols,ownershipRegions:regions,nativeNodes,sourceMapLinks:links,unresolvedEntryRefs:unresolved});
92
+ }
93
+
94
+ function sourceFreshnessScore(slice,testResult){
95
+ const sourceHashes=slice?.mergeAdmission?.sourceHashes??[];
96
+ const checks=(testResult?.assertions??[]).filter((assertion)=>String(assertion.id??'').startsWith('sourceHash:'));
97
+ const failed=checks.filter((assertion)=>assertion.status==='failed').length;
98
+ const warnings=checks.filter((assertion)=>assertion.status==='warning').length;
99
+ const passed=checks.filter((assertion)=>assertion.status==='passed').length;
100
+ const score=failed?0:checks.length?Math.max(20,Math.round((passed*100+warnings*55)/checks.length)):sourceHashes.length?55:35;
101
+ return scoreComponent('sourceFreshness',score,[
102
+ ...(failed?[`${failed} source hash check(s) failed.`]:[]),
103
+ ...(!checks.length&&sourceHashes.length?['Slice has source hashes but no current source check was run.']:[]),
104
+ ...(!sourceHashes.length?['Slice has no source hashes for stale-check admission.']:[])
105
+ ],{sourceHashes:sourceHashes.length,checks:checks.length,passed,warnings,failed});
106
+ }
107
+
108
+ function ownershipIsolationScore(slice){
109
+ const conflictKeys=slice?.mergeAdmission?.conflictKeys?.length??0;
110
+ const ownershipKeys=slice?.mergeAdmission?.ownershipKeys?.length??0;
111
+ const reviewRequired=slice?.mergeAdmission?.reviewRequired===true;
112
+ const score=conflictKeys?Math.max(45,100-Math.max(0,conflictKeys-1)*8-(reviewRequired?16:0)):15;
113
+ return scoreComponent('ownershipIsolation',score,[
114
+ ...(!conflictKeys?['Slice exposes no conflict keys for ownership isolation.']:[]),
115
+ ...(reviewRequired?['Slice merge admission already requires review.']:[])
116
+ ],{conflictKeys,ownershipKeys,reviewRequired});
117
+ }
118
+
119
+ function verificationEvidenceScore(slice,testResult,options){
120
+ const focused=slice?.verification?.focusedCommands?.length??0;
121
+ const fixtures=slice?.verification?.fixtureHints?.length??0;
122
+ const evidence=[...(options.evidence??[]),...(slice?.evidence??[])];
123
+ const failed=(testResult?.summary?.failed??0)+evidence.filter((record)=>record?.status==='failed').length;
124
+ const warnings=testResult?.summary?.warnings??0;
125
+ let score=focused||fixtures||evidence.length?72:45;
126
+ score+=Math.min(18,focused*8+fixtures*4+evidence.length*3);
127
+ score-=failed*35+warnings*8;
128
+ return scoreComponent('verificationEvidence',Math.max(0,Math.min(100,score)),[
129
+ ...(!focused?['Slice has no focused verification command.']:[]),
130
+ ...(failed?[`${failed} failed assertion or evidence record(s).`]:[])
131
+ ],{focusedCommands:focused,fixtureHints:fixtures,evidenceRecords:evidence.length,failed,warnings});
132
+ }
133
+
134
+ function reviewRiskScore(slice,readiness,testResult){
135
+ const losses=slice?.summary?.losses??slice?.losses?.length??0;
136
+ const failed=testResult?.summary?.failed??0;
137
+ const base=readinessScore[readiness]??48;
138
+ const score=Math.max(0,Math.min(100,base-losses*4-failed*25));
139
+ return scoreComponent('reviewRisk',score,[
140
+ ...(readiness!=='ready'?[`Slice readiness is ${readiness}.`]:[]),
141
+ ...(losses?[`Slice carries ${losses} native import loss record(s).`]:[])
142
+ ],{readiness,losses,failedAssertions:failed});
143
+ }
144
+
145
+ function scoreComponent(key,score,reasons,signals){
146
+ const rounded=Math.round(Math.max(0,Math.min(100,score)));
147
+ return{key,score:rounded,weight:20,weightedScore:rounded*20/100,status:rounded>=85?'strong':rounded>=60?'partial':rounded>0?'weak':'blocked',reasons,signals};
148
+ }
149
+
150
+ function mergeScoreValue(components,readiness){
151
+ const values=Object.values(components);
152
+ const score=values.reduce((sum,component)=>sum+component.weightedScore,0)/values.reduce((sum,component)=>sum+component.weight,0)*100;
153
+ return Math.round(Math.max(0,Math.min(readiness==='blocked'?35:100,score)));
154
+ }
155
+
156
+ function admissionAction(slice,readiness,components,testResult){
157
+ if(readiness==='blocked'||(testResult?.summary?.failed??0)>0||components.semanticSelection.score===0||components.sourceFreshness.score===0)return'reject';
158
+ if(readiness!=='ready'||slice?.mergeAdmission?.reviewRequired||Object.values(components).some((component)=>component.score<70))return'prioritize';
159
+ return'admit';
160
+ }
161
+
162
+ function admissionRisk(readiness,components,testResult){
163
+ if(readiness==='blocked'||(testResult?.summary?.failed??0)>0)return'high';
164
+ if(readiness==='needs-review'||Object.values(components).some((component)=>component.score<60))return'medium';
165
+ return'low';
166
+ }
167
+
168
+ function admissionPriority(action,risk,readiness){
169
+ if(action==='reject')return'blocker';
170
+ if(readiness==='needs-review'||risk==='medium')return'high';
171
+ return action==='prioritize'?'normal':'low';
172
+ }
173
+
174
+ function mergeScoreSortKey(value,action,risk,readiness){
175
+ return value+(actionRank[action]??0)*1000+(riskRank[risk]??0)*100+(readinessRank[readiness]??0)*10;
176
+ }
177
+
178
+ function worstReadiness(...values){
179
+ return values.reduce((current,value)=>maxSemanticMergeReadiness(current,value??'ready'),'ready');
180
+ }
@@ -24,12 +24,12 @@ const packageRows = [
24
24
  row('@shapeshift-labs/frontier-lang-rust', '0.2.8', 'rust', 'rust-syn', { target: 'rust', proofKeys: ['parserAst', 'sourceMap', 'semanticSidecar', 'macroExpansionEvidence'] }),
25
25
  row('@shapeshift-labs/frontier-lang-python', '0.2.8', 'python', 'python-ast', { target: 'python', formats: ['python-ast', 'libcst'] }),
26
26
  row('@shapeshift-labs/frontier-lang-c', '0.2.8', 'c', 'clang-ast-json', { target: 'c', proofKeys: ['parserAst', 'sourceMap', 'semanticSidecar', 'compileCommandsHash', 'preprocessorRecordsHash'] }),
27
- platform('@shapeshift-labs/frontier-lang-java', '0.1.5', 'java', 'java-ast', ['semanticdb', 'lsp']),
28
- platform('@shapeshift-labs/frontier-lang-kotlin', '0.1.5', 'kotlin', 'kotlin-psi', ['semanticdb', 'lsp']),
29
- platform('@shapeshift-labs/frontier-lang-swift', '0.1.5', 'swift', 'swift-syntax', ['sourcekit-lsp', 'lsp']),
30
- platform('@shapeshift-labs/frontier-lang-csharp', '0.1.5', 'csharp', 'roslyn-csharp', ['lsp']),
31
- platform('@shapeshift-labs/frontier-lang-go', '0.1.5', 'go', 'go-ast', ['lsp']),
32
- platform('@shapeshift-labs/frontier-lang-clang', '0.1.5', 'c', 'clang-ast-json', ['lsp'], {
27
+ platform('@shapeshift-labs/frontier-lang-java', '0.1.6', 'java', 'java-ast', ['semanticdb', 'lsp']),
28
+ platform('@shapeshift-labs/frontier-lang-kotlin', '0.1.6', 'kotlin', 'kotlin-psi', ['semanticdb', 'lsp']),
29
+ platform('@shapeshift-labs/frontier-lang-swift', '0.1.6', 'swift', 'swift-syntax', ['sourcekit-lsp', 'lsp']),
30
+ platform('@shapeshift-labs/frontier-lang-csharp', '0.1.6', 'csharp', 'roslyn-csharp', ['lsp']),
31
+ platform('@shapeshift-labs/frontier-lang-go', '0.1.6', 'go', 'go-ast', ['lsp']),
32
+ platform('@shapeshift-labs/frontier-lang-clang', '0.1.6', 'c', 'clang-ast-json', ['lsp'], {
33
33
  supportedLanguages: ['c', 'cpp'],
34
34
  proofKeys: ['parserAst', 'semanticIndex', 'compileCommandsHash', 'preprocessorRecordsHash']
35
35
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-compiler",
3
- "version": "0.2.46",
3
+ "version": "0.2.48",
4
4
  "description": "Compiler facade for Frontier Lang source documents and language projection adapters.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",