port-control-graph-contract 0.0.0-stage → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "port-control-graph-contract",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./src/index.ts"
7
+ },
8
+ "files": [
9
+ "src"
10
+ ]
11
+ }
package/src/index.ts ADDED
@@ -0,0 +1,62 @@
1
+ export interface PortEdge<I, P, E> {
2
+ readonly id: E;
3
+ readonly from: { readonly node: I; readonly port: P };
4
+ readonly to: { readonly node: I; readonly port: P };
5
+ }
6
+ export interface ControlShape<P> {
7
+ readonly role: "step" | "choice" | "loop" | "exit";
8
+ readonly enter: P;
9
+ readonly next?: P;
10
+ readonly branches?: readonly {
11
+ readonly port: P;
12
+ readonly order: number;
13
+ readonly default?: boolean;
14
+ }[];
15
+ readonly body?: P;
16
+ }
17
+ export interface PortControlGraph<N, I, P, E> {
18
+ readonly entry: I;
19
+ readonly nodes: readonly N[];
20
+ readonly edges: readonly PortEdge<I, P, E>[];
21
+ }
22
+ export interface ControlGraphRuntime<N, I, P> {
23
+ readonly nodeId: (node: N) => I;
24
+ readonly shape: (node: N) => ControlShape<P>;
25
+ }
26
+ export type StructuredStatement<N, I, P> =
27
+ | { readonly kind: "node"; readonly node: N }
28
+ | {
29
+ readonly kind: "choice";
30
+ readonly node: N;
31
+ readonly branches: readonly {
32
+ readonly port: P;
33
+ readonly body: readonly StructuredStatement<N, I, P>[];
34
+ }[];
35
+ }
36
+ | {
37
+ readonly kind: "loop";
38
+ readonly node: N;
39
+ readonly body: readonly StructuredStatement<N, I, P>[];
40
+ }
41
+ | { readonly kind: "block-ref"; readonly block: number; readonly source: I };
42
+ export interface StructuredForest<N, I, P> {
43
+ readonly statements: readonly StructuredStatement<N, I, P>[];
44
+ readonly blocks: readonly {
45
+ readonly id: number;
46
+ readonly source: I;
47
+ readonly statements: readonly StructuredStatement<N, I, P>[];
48
+ }[];
49
+ readonly inferredNext: readonly { readonly owner: I; readonly next: I }[];
50
+ }
51
+ export interface GraphDiagnostic<I, E> {
52
+ readonly code: string;
53
+ readonly message: string;
54
+ readonly node?: I;
55
+ readonly edge?: E;
56
+ }
57
+ export type LowerGraphResult<N, I, P, E> =
58
+ | { readonly ok: true; readonly forest: StructuredForest<N, I, P> }
59
+ | {
60
+ readonly ok: false;
61
+ readonly diagnostics: readonly GraphDiagnostic<I, E>[];
62
+ };
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.