@weftlet/core 0.0.0-stage → 0.1.1
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/LICENSE +176 -0
- package/NOTICE +4 -0
- package/README.md +10 -2
- package/THIRD_PARTY_NOTICES.md +13 -0
- package/dist/core.d.ts +229 -0
- package/dist/core.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/util.d.ts +3 -0
- package/dist/util.js +25 -0
- package/package.json +40 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- Modified for standalone extraction; see docs/extraction-manifest.json. -->
|
|
2
|
+
# `@weftlet/core`
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
Graph records, provider and adapter contracts, and deterministic keying utilities for
|
|
5
|
+
[Weftlet](https://github.com/jchewitt/weftlet), an evidence-backed context-graph toolkit for
|
|
6
|
+
AI development agents.
|
|
7
|
+
|
|
8
|
+
The core package has no runtime dependencies. Install `@weftlet/toolkit` for the CLI,
|
|
9
|
+
MCP server, extraction, storage and graph queries.
|
|
10
|
+
|
|
11
|
+
Licensed under Apache-2.0; see LICENSE and NOTICE for attribution.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
<!-- Modified for standalone extraction; dependency versions reflect this distribution. -->
|
|
4
|
+
|
|
5
|
+
Generated for `@weftlet/core` by `pnpm context-graph:licenses`.
|
|
6
|
+
Do not edit this file manually.
|
|
7
|
+
|
|
8
|
+
## Node production dependency inventory
|
|
9
|
+
|
|
10
|
+
<!-- prettier-ignore -->
|
|
11
|
+
| Package | Version(s) | License | Homepage |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| (none) | — | — | — |
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
export type GraphNodeKind = 'Project' | 'Document' | 'Capability' | 'Workflow' | 'Component' | 'Contract' | 'Evidence' | 'Invariant' | 'Snapshot' | 'Provider' | 'PersistenceModel' | 'Scope';
|
|
2
|
+
export type GraphPredicate = 'realizes' | 'implementedBy' | 'consumes' | 'emits' | 'persistsTo' | 'governedBy' | 'definedBy' | 'verifiedBy' | 'operationallyOwnedBy' | 'decisionAuthority' | 'routesThrough' | 'authorizedBy' | 'sourcedFrom' | 'references' | 'contains';
|
|
3
|
+
export interface SourceSpan {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly startLine: number;
|
|
6
|
+
readonly endLine: number;
|
|
7
|
+
readonly digest: string;
|
|
8
|
+
readonly commitSha: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ExtractorIdentity {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly version: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GraphNode {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly kind: GraphNodeKind;
|
|
17
|
+
readonly label: string;
|
|
18
|
+
readonly attributes?: Readonly<Record<string, string | number | boolean>>;
|
|
19
|
+
}
|
|
20
|
+
export interface GraphFact {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly subject: GraphNode;
|
|
23
|
+
readonly predicate: GraphPredicate;
|
|
24
|
+
readonly object: GraphNode;
|
|
25
|
+
readonly provenance: SourceSpan;
|
|
26
|
+
readonly extractor: ExtractorIdentity;
|
|
27
|
+
readonly confidence: number;
|
|
28
|
+
readonly snapshotId: string;
|
|
29
|
+
readonly authority?: 'declared' | 'implemented' | 'validated' | 'observed' | 'inferred' | 'draft';
|
|
30
|
+
/** Approval of the source does not constitute review of a model's extracted assertion. */
|
|
31
|
+
readonly sourceAuthority?: 'declared' | 'inferred' | 'draft';
|
|
32
|
+
readonly extractionReview?: 'unreviewed' | 'approved' | 'deterministic';
|
|
33
|
+
}
|
|
34
|
+
export interface SemanticArtifact {
|
|
35
|
+
readonly key: string;
|
|
36
|
+
readonly stableSemanticId: string;
|
|
37
|
+
readonly source: SourceSpan;
|
|
38
|
+
readonly sourceDigest: string;
|
|
39
|
+
readonly promptVersion: string;
|
|
40
|
+
readonly extractorVersion: string;
|
|
41
|
+
readonly modelIdentity: string;
|
|
42
|
+
readonly adapterVersion: string;
|
|
43
|
+
readonly ontologyVersion: string;
|
|
44
|
+
readonly facts: readonly Omit<GraphFact, 'snapshotId'>[];
|
|
45
|
+
readonly oml: string;
|
|
46
|
+
readonly unresolvedMappings: readonly string[];
|
|
47
|
+
readonly diagnostics?: readonly GraphDiagnostic[];
|
|
48
|
+
readonly rawModelOutput: string;
|
|
49
|
+
readonly outputDigest: string;
|
|
50
|
+
}
|
|
51
|
+
export interface RuntimeTraceReference {
|
|
52
|
+
readonly traceId: string;
|
|
53
|
+
readonly spanId: string;
|
|
54
|
+
readonly serviceName: string;
|
|
55
|
+
readonly serviceVersion: string;
|
|
56
|
+
readonly capability?: string;
|
|
57
|
+
readonly operation?: string;
|
|
58
|
+
readonly environment?: string;
|
|
59
|
+
readonly serviceInstanceId?: string;
|
|
60
|
+
readonly observedAt?: string;
|
|
61
|
+
readonly sourcePath: string;
|
|
62
|
+
readonly sourceDigest: string;
|
|
63
|
+
readonly accepted: boolean;
|
|
64
|
+
readonly reason?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface InvariantResult {
|
|
67
|
+
readonly invariantId: string;
|
|
68
|
+
readonly status: 'pass' | 'fail' | 'unknown';
|
|
69
|
+
readonly message: string;
|
|
70
|
+
readonly provenance: readonly SourceSpan[];
|
|
71
|
+
}
|
|
72
|
+
export interface SnapshotManifest {
|
|
73
|
+
readonly schemaVersion: 1;
|
|
74
|
+
readonly repositoryId: string;
|
|
75
|
+
readonly ref: string;
|
|
76
|
+
readonly commitSha: string;
|
|
77
|
+
readonly baseSha?: string;
|
|
78
|
+
readonly overlayDigest?: string;
|
|
79
|
+
readonly overlayCapture?: {
|
|
80
|
+
readonly files: readonly {
|
|
81
|
+
readonly path: string;
|
|
82
|
+
readonly digest: string | null;
|
|
83
|
+
}[];
|
|
84
|
+
readonly sourcePatterns: readonly string[];
|
|
85
|
+
readonly excludedPaths: readonly string[];
|
|
86
|
+
};
|
|
87
|
+
readonly snapshotId: string;
|
|
88
|
+
readonly configurationDigest?: string;
|
|
89
|
+
readonly scope?: readonly string[];
|
|
90
|
+
readonly ontologyVersion: string;
|
|
91
|
+
readonly extractorVersions: Readonly<Record<string, string>>;
|
|
92
|
+
readonly semanticModel: string;
|
|
93
|
+
readonly semanticPromptVersion: string;
|
|
94
|
+
readonly generatedAt: string;
|
|
95
|
+
readonly contentDigest: string;
|
|
96
|
+
readonly runtimeEvidenceDigest?: string;
|
|
97
|
+
readonly semanticArtifactKeys: readonly string[];
|
|
98
|
+
readonly scipIndexDigest: string;
|
|
99
|
+
readonly rdfDigest: string;
|
|
100
|
+
}
|
|
101
|
+
export interface GraphSnapshot {
|
|
102
|
+
readonly manifest: SnapshotManifest;
|
|
103
|
+
readonly facts: readonly GraphFact[];
|
|
104
|
+
readonly invariants: readonly InvariantResult[];
|
|
105
|
+
readonly runtimeEvidence: readonly RuntimeTraceReference[];
|
|
106
|
+
readonly unresolved: readonly string[];
|
|
107
|
+
readonly diagnostics?: readonly GraphDiagnostic[];
|
|
108
|
+
}
|
|
109
|
+
export type DiagnosticKind = 'missingIntent' | 'ambiguousIntent' | 'implementationGaps' | 'runtimeGaps' | 'drift';
|
|
110
|
+
export interface GraphDiagnostic {
|
|
111
|
+
readonly id: string;
|
|
112
|
+
readonly kind: DiagnosticKind;
|
|
113
|
+
readonly reason: string;
|
|
114
|
+
readonly provenance: readonly SourceSpan[];
|
|
115
|
+
readonly relatedNodeIds: readonly string[];
|
|
116
|
+
/** Query gaps describe the searched snapshot, never absence from the entire repository. */
|
|
117
|
+
readonly evidenceScope: 'source' | 'snapshot-query';
|
|
118
|
+
}
|
|
119
|
+
export interface DiagnosticSection {
|
|
120
|
+
readonly items: readonly GraphDiagnostic[];
|
|
121
|
+
readonly omittedRelevant: number;
|
|
122
|
+
readonly omittedUnrelated: number;
|
|
123
|
+
}
|
|
124
|
+
export type DiagnosticReport = Record<DiagnosticKind, DiagnosticSection> & {
|
|
125
|
+
/** Legacy free text has no reliable category/provenance; inspect it through maintenance CLI. */
|
|
126
|
+
readonly unclassifiedLegacyCount: number;
|
|
127
|
+
};
|
|
128
|
+
export interface ExtractionContext {
|
|
129
|
+
readonly repositoryRoot: string;
|
|
130
|
+
readonly repositoryId: string;
|
|
131
|
+
readonly ref: string;
|
|
132
|
+
readonly commitSha: string;
|
|
133
|
+
readonly baseSha?: string;
|
|
134
|
+
readonly snapshotId: string;
|
|
135
|
+
readonly changedPaths: readonly string[];
|
|
136
|
+
readonly deletedPaths: readonly string[];
|
|
137
|
+
readonly renamedPaths: Readonly<Record<string, string>>;
|
|
138
|
+
readonly semanticPaths?: readonly string[];
|
|
139
|
+
}
|
|
140
|
+
export interface FactExtractor {
|
|
141
|
+
readonly identity: ExtractorIdentity;
|
|
142
|
+
extract(context: ExtractionContext): Promise<readonly GraphFact[]>;
|
|
143
|
+
}
|
|
144
|
+
export interface SemanticSource {
|
|
145
|
+
readonly stableSemanticId: string;
|
|
146
|
+
readonly path: string;
|
|
147
|
+
readonly content: string;
|
|
148
|
+
readonly digest: string;
|
|
149
|
+
}
|
|
150
|
+
export interface SemanticSourceProvider {
|
|
151
|
+
list(context: ExtractionContext): Promise<readonly SemanticSource[]>;
|
|
152
|
+
}
|
|
153
|
+
export interface GraphStore {
|
|
154
|
+
write(snapshot: GraphSnapshot): Promise<void>;
|
|
155
|
+
read(snapshotId: string): Promise<GraphSnapshot | undefined>;
|
|
156
|
+
}
|
|
157
|
+
export interface SnapshotStore extends GraphStore {
|
|
158
|
+
readHead(headName: string): Promise<GraphSnapshot | undefined>;
|
|
159
|
+
updateHead(headName: string, snapshotId: string): Promise<void>;
|
|
160
|
+
}
|
|
161
|
+
export interface ImpactScanRequest {
|
|
162
|
+
readonly snapshotId?: string;
|
|
163
|
+
readonly ownerDocument?: string;
|
|
164
|
+
readonly task?: string;
|
|
165
|
+
readonly checklistItems?: readonly string[];
|
|
166
|
+
readonly changedFiles?: readonly string[];
|
|
167
|
+
readonly symbols?: readonly string[];
|
|
168
|
+
readonly capabilities?: readonly string[];
|
|
169
|
+
readonly maxFacts?: number;
|
|
170
|
+
readonly maxDepth?: number;
|
|
171
|
+
readonly continuation?: string;
|
|
172
|
+
}
|
|
173
|
+
export interface ContextPack {
|
|
174
|
+
readonly snapshot: Pick<SnapshotManifest, 'snapshotId' | 'commitSha' | 'contentDigest' | 'configurationDigest' | 'scope' | 'baseSha' | 'overlayDigest' | 'overlayCapture'>;
|
|
175
|
+
readonly evidenceState?: {
|
|
176
|
+
readonly currentCommit?: string;
|
|
177
|
+
readonly excludedWorkingChanges: readonly string[];
|
|
178
|
+
readonly capturedWorkingChanges?: readonly string[];
|
|
179
|
+
readonly changedSinceCapture?: readonly string[];
|
|
180
|
+
readonly overlayFreshness?: 'current' | 'stale' | 'unknown';
|
|
181
|
+
readonly stale: boolean;
|
|
182
|
+
readonly configurationMatches: boolean;
|
|
183
|
+
readonly eligibleForCurrentDiffValidation: false;
|
|
184
|
+
};
|
|
185
|
+
readonly capabilities: readonly GraphNode[];
|
|
186
|
+
readonly facts: readonly GraphFact[];
|
|
187
|
+
readonly invariants: readonly InvariantResult[];
|
|
188
|
+
readonly runtimeEvidence: readonly RuntimeTraceReference[];
|
|
189
|
+
readonly suggestedFiles: readonly string[];
|
|
190
|
+
readonly coverage: ContextPackCoverage;
|
|
191
|
+
readonly diagnostics: DiagnosticReport;
|
|
192
|
+
readonly markdown: string;
|
|
193
|
+
readonly exploration?: {
|
|
194
|
+
readonly returned: number;
|
|
195
|
+
readonly reachableFacts: number;
|
|
196
|
+
readonly maxDepth: number;
|
|
197
|
+
readonly depthLimitReached: boolean;
|
|
198
|
+
readonly truncated: boolean;
|
|
199
|
+
readonly continuation?: string;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export type ContextPackLane = 'productIntent' | 'contractsAndInvariants' | 'implementationAndConsumers' | 'validationEvidence';
|
|
203
|
+
export interface ContextPackCoverage {
|
|
204
|
+
readonly counts: Readonly<Record<ContextPackLane, number>>;
|
|
205
|
+
readonly gaps: readonly string[];
|
|
206
|
+
}
|
|
207
|
+
export interface ImpactQueryService {
|
|
208
|
+
scan(request: ImpactScanRequest): Promise<ContextPack>;
|
|
209
|
+
}
|
|
210
|
+
export interface InvariantEvaluator {
|
|
211
|
+
evaluate(snapshotId: string, facts: readonly GraphFact[]): Promise<readonly InvariantResult[]>;
|
|
212
|
+
}
|
|
213
|
+
export interface RuntimeEvidenceProvider {
|
|
214
|
+
collect(context: ExtractionContext): Promise<readonly RuntimeTraceReference[]>;
|
|
215
|
+
}
|
|
216
|
+
export interface ContextPackRenderer {
|
|
217
|
+
render(pack: Omit<ContextPack, 'markdown'>): string;
|
|
218
|
+
}
|
|
219
|
+
export interface ContextGraphRepository {
|
|
220
|
+
readFileAt(commitSha: string, path: string): Promise<string>;
|
|
221
|
+
listFilesAt(commitSha: string, roots: readonly string[]): Promise<readonly string[]>;
|
|
222
|
+
}
|
|
223
|
+
export interface ContextGraphAdapter {
|
|
224
|
+
readonly factExtractors: readonly FactExtractor[];
|
|
225
|
+
readonly invariantEvaluators: readonly InvariantEvaluator[];
|
|
226
|
+
}
|
|
227
|
+
export interface ContextGraphAdapterModule {
|
|
228
|
+
createContextGraphAdapter(repository: ContextGraphRepository): ContextGraphAdapter;
|
|
229
|
+
}
|
package/dist/core.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/util.d.ts
ADDED
package/dist/util.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
export function sha256(value) {
|
|
3
|
+
return createHash('sha256').update(value).digest('hex');
|
|
4
|
+
}
|
|
5
|
+
export function stableJson(value) {
|
|
6
|
+
if (Array.isArray(value)) {
|
|
7
|
+
return `[${value.map(stableJson).join(',')}]`;
|
|
8
|
+
}
|
|
9
|
+
if (value !== null && typeof value === 'object') {
|
|
10
|
+
const record = value;
|
|
11
|
+
return `{${Object.keys(record)
|
|
12
|
+
.sort()
|
|
13
|
+
.map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`)
|
|
14
|
+
.join(',')}}`;
|
|
15
|
+
}
|
|
16
|
+
return JSON.stringify(value);
|
|
17
|
+
}
|
|
18
|
+
export function slug(value) {
|
|
19
|
+
return value
|
|
20
|
+
.normalize('NFKD')
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
23
|
+
.replace(/^-|-$/g, '')
|
|
24
|
+
.slice(0, 96);
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weftlet/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Neutral contracts and deterministic utilities for commit-keyed context graphs",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"LICENSE",
|
|
11
|
+
"NOTICE",
|
|
12
|
+
"README.md",
|
|
13
|
+
"THIRD_PARTY_NOTICES.md"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20.11.0"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"provenance": true
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/jchewitt/weftlet.git",
|
|
31
|
+
"directory": "packages/core"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "20.19.11",
|
|
35
|
+
"typescript": "5.5.4",
|
|
36
|
+
"vitest": "3.2.4"
|
|
37
|
+
},
|
|
38
|
+
"x-extraction-modifications": "Destination repository metadata.",
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.json",
|
|
41
|
+
"test": "vitest run"
|
|
42
|
+
}
|
|
6
43
|
}
|