behavior-contracts 0.4.0 → 0.5.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.
Files changed (51) hide show
  1. package/README.md +78 -29
  2. package/dist/generator/core.d.ts +14 -0
  3. package/dist/generator/core.d.ts.map +1 -1
  4. package/dist/generator/core.js +1 -0
  5. package/dist/generator/core.js.map +1 -1
  6. package/dist/generator/emit-raw-abi-go.d.ts.map +1 -1
  7. package/dist/generator/emit-raw-abi-go.js +2 -1
  8. package/dist/generator/emit-raw-abi-go.js.map +1 -1
  9. package/dist/generator/emit-straightline-go.d.ts +2 -0
  10. package/dist/generator/emit-straightline-go.d.ts.map +1 -1
  11. package/dist/generator/emit-straightline-go.js +37 -19
  12. package/dist/generator/emit-straightline-go.js.map +1 -1
  13. package/dist/generator/emit-straightline-native-go.d.ts +54 -0
  14. package/dist/generator/emit-straightline-native-go.d.ts.map +1 -0
  15. package/dist/generator/emit-straightline-native-go.js +835 -0
  16. package/dist/generator/emit-straightline-native-go.js.map +1 -0
  17. package/dist/generator/emit-straightline-native-rust.d.ts +27 -0
  18. package/dist/generator/emit-straightline-native-rust.d.ts.map +1 -0
  19. package/dist/generator/emit-straightline-native-rust.js +624 -0
  20. package/dist/generator/emit-straightline-native-rust.js.map +1 -0
  21. package/dist/generator/emit-straightline-rust.d.ts.map +1 -1
  22. package/dist/generator/emit-straightline-rust.js +5 -12
  23. package/dist/generator/emit-straightline-rust.js.map +1 -1
  24. package/dist/generator/emit-straightline-typed-go.d.ts +17 -0
  25. package/dist/generator/emit-straightline-typed-go.d.ts.map +1 -1
  26. package/dist/generator/emit-straightline-typed-go.js +4 -1
  27. package/dist/generator/emit-straightline-typed-go.js.map +1 -1
  28. package/dist/generator/emit-straightline-typed-rust.d.ts +16 -0
  29. package/dist/generator/emit-straightline-typed-rust.d.ts.map +1 -1
  30. package/dist/generator/emit-straightline-typed-rust.js +2 -0
  31. package/dist/generator/emit-straightline-typed-rust.js.map +1 -1
  32. package/dist/generator/emit-straightline-typescript.d.ts.map +1 -1
  33. package/dist/generator/emit-straightline-typescript.js +4 -10
  34. package/dist/generator/emit-straightline-typescript.js.map +1 -1
  35. package/dist/generator/emit-typed-native-go.d.ts +63 -0
  36. package/dist/generator/emit-typed-native-go.d.ts.map +1 -0
  37. package/dist/generator/emit-typed-native-go.js +1840 -0
  38. package/dist/generator/emit-typed-native-go.js.map +1 -0
  39. package/dist/generator/emit-typed-native-rust.d.ts +52 -0
  40. package/dist/generator/emit-typed-native-rust.d.ts.map +1 -0
  41. package/dist/generator/emit-typed-native-rust.js +1673 -0
  42. package/dist/generator/emit-typed-native-rust.js.map +1 -0
  43. package/dist/generator/index.d.ts +2 -0
  44. package/dist/generator/index.d.ts.map +1 -1
  45. package/dist/generator/index.js +16 -0
  46. package/dist/generator/index.js.map +1 -1
  47. package/dist/generator/straightline.d.ts +46 -0
  48. package/dist/generator/straightline.d.ts.map +1 -1
  49. package/dist/generator/straightline.js +65 -0
  50. package/dist/generator/straightline.js.map +1 -1
  51. package/package.json +1 -1
@@ -0,0 +1,54 @@
1
+ /**
2
+ * emit-straightline-native-go.ts — Go NATIVE-PORTS straight-line emitter (bc 0.5.0).
3
+ *
4
+ * # What this removes (the generic key-value plumbing on the PORT plane)
5
+ *
6
+ * The straight-line emitter (emit-straightline-go.ts) builds, per componentRef node, a
7
+ * GENERIC key-value port container:
8
+ *
9
+ * ports_row := dslcontracts.NewObj() // a map[string]Value alloc
10
+ * pv_row_PK := slBindVE(input, "pk") // slVE{Val,Err} wrapper
11
+ * if pv_row_PK.Err != nil { return nil, ... } // (dead branch for infallible ports)
12
+ * ports_row.Set("PK", pv_row_PK.Val) // boxed Value insert into the map
13
+ * o_row, _ := dslcontracts.ExecHandler(handlers, "row", "GetItem", ports_row, nil) // generic dispatch
14
+ *
15
+ * Measured (go1.26): NewObj()+3×Set == ~326 ns/op + 6 allocs/op — essentially the ENTIRE
16
+ * cost of a single-op straight-line component (~335 ns/op). That generic key-value container
17
+ * is the residual "遅い処理" that made a single-op point read tie/lose the ir interpreter.
18
+ *
19
+ * # What this emits (native ports struct + native handler entry)
20
+ *
21
+ * type portsGetItem_row struct { Table, PK, SK string } // typed per the port's static type
22
+ * func (p portsGetItem_row) Port(name string) (dslcontracts.Value, bool) { ... } // PortReader
23
+ * ...
24
+ * pkS, ok := input.Get("pk"); if !ok { return nil, UNKNOWN_BINDING } // a fallible port: direct return
25
+ * ports := portsGetItem_row{Table: "Items", PK: pkS, SK: skS} // ZERO map alloc, ZERO boxing
26
+ * outcome, resolved := dslcontracts.ExecNativeHandler(handlers, "row", "GetItem", ports, nil)
27
+ *
28
+ * Statically-typed ports (string/int/float/bool derivable from a literal / concat / a ref to a
29
+ * typed input param) become typed struct fields assigned directly — no slVE wrapper, no dead
30
+ * error branch. A port whose type is genuinely dynamic keeps a `dslcontracts.Value` field (one
31
+ * boxed leaf, still no map). Fallible ports (a ref that can UNKNOWN_BINDING / a concat that can
32
+ * TYPE_MISMATCH) keep their error path as a DIRECT return (not an slVE wrapper struct).
33
+ *
34
+ * Fail-closed operator semantics are unchanged: overflow/short-circuit/type errors still route
35
+ * through the A0 primitives (the dynamic port path calls emitExpr = the primitive SSoT). Only
36
+ * the port CONTAINER + dispatch go native.
37
+ *
38
+ * # Scope (additive)
39
+ *
40
+ * Covers strictly-sequential componentRef components (sequentialOrder != null, no map/cond
41
+ * body node). map/cond/real-concurrency components fall through to the generic straight-line
42
+ * body (emitted alongside, byte-identical) — BindNative binds only the native-covered
43
+ * components; a consumer keeps the rest on the generic Bind. This mirrors go-typed-raw's
44
+ * additive discipline. The literal/ir endpoint and the generic Bind are UNCHANGED.
45
+ */
46
+ import type { EmitterPlugin } from "./core.js";
47
+ /**
48
+ * goStraightlineNativeEmitter — language id `go-straightline-native` (bc 0.5.0). Emits the
49
+ * generic straight-line body (fallback + helpers) plus the NATIVE-PORTS layer (per-node ports
50
+ * struct built by direct assignment + BindNative through the native handler seam). Additive:
51
+ * the generic Bind / literal / ir endpoints are unchanged.
52
+ */
53
+ export declare const goStraightlineNativeEmitter: EmitterPlugin;
54
+ //# sourceMappingURL=emit-straightline-native-go.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-straightline-native-go.d.ts","sourceRoot":"","sources":["../../src/generator/emit-straightline-native-go.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,WAAW,CAAC;AAs3B5D;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAMzC,CAAC"}