tjs-lang 0.8.0 → 0.8.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.
Files changed (53) hide show
  1. package/CLAUDE.md +6 -2
  2. package/CONTEXT.md +4 -0
  3. package/demo/docs.json +12 -690
  4. package/dist/eslint.config.d.ts +2 -0
  5. package/dist/index.js +137 -135
  6. package/dist/index.js.map +4 -4
  7. package/dist/src/lang/emitters/js-wasm.d.ts +5 -1
  8. package/dist/src/lang/emitters/js.d.ts +9 -0
  9. package/dist/src/lang/index.d.ts +1 -0
  10. package/dist/src/lang/module-loader.d.ts +125 -0
  11. package/dist/src/lang/parser-transforms.d.ts +79 -0
  12. package/dist/src/lang/parser-types.d.ts +33 -0
  13. package/dist/src/lang/wasm.d.ts +67 -1
  14. package/dist/tjs-batteries.js +2 -2
  15. package/dist/tjs-batteries.js.map +2 -2
  16. package/dist/tjs-eval.js +39 -37
  17. package/dist/tjs-eval.js.map +3 -3
  18. package/dist/tjs-from-ts.js +2 -2
  19. package/dist/tjs-from-ts.js.map +2 -2
  20. package/dist/tjs-lang.js +102 -102
  21. package/dist/tjs-lang.js.map +3 -3
  22. package/dist/tjs-vm.js +50 -48
  23. package/dist/tjs-vm.js.map +3 -3
  24. package/docs/README.md +2 -0
  25. package/docs/lm-studio-setup.md +143 -0
  26. package/docs/universal-endpoint.md +122 -0
  27. package/llms.txt +8 -2
  28. package/package.json +5 -4
  29. package/src/batteries/audit.ts +3 -3
  30. package/src/batteries/llm.ts +8 -3
  31. package/src/builder.ts +0 -3
  32. package/src/cli/commands/test.ts +1 -1
  33. package/src/lang/docs.test.ts +0 -1
  34. package/src/lang/emitters/from-ts.ts +1 -1
  35. package/src/lang/emitters/js.ts +0 -1
  36. package/src/lang/linter.ts +1 -1
  37. package/src/lang/module-loader.test.ts +9 -5
  38. package/src/lang/module-loader.ts +4 -5
  39. package/src/lang/parser-params.ts +1 -1
  40. package/src/lang/parser-transforms.ts +12 -18
  41. package/src/lang/perf.test.ts +10 -4
  42. package/src/lang/runtime.ts +0 -1
  43. package/src/lang/wasm.test.ts +14 -14
  44. package/src/linalg/linalg.test.ts +8 -2
  45. package/src/linalg/vector-search.bench.test.ts +31 -10
  46. package/src/types/Type.ts +6 -6
  47. package/src/use-cases/asymmetric-client-server.test.ts +0 -2
  48. package/src/use-cases/client-server.test.ts +1 -1
  49. package/src/use-cases/unbundled-imports.test.ts +0 -1
  50. package/src/vm/runtime.ts +3 -3
  51. package/src/vm/vm.ts +3 -1
  52. package/dist/examples/modules/dist/main.d.ts +0 -34
  53. package/dist/examples/modules/dist/math.d.ts +0 -120
package/CLAUDE.md CHANGED
@@ -87,7 +87,10 @@ bun run functions:serve # Local functions emulator
87
87
  - `src/lang/json-schema.ts` - JSON Schema generation from TypeDescriptors and example values
88
88
  - `src/lang/linter.ts` - Static analysis (unused vars, unreachable code, no-explicit-new)
89
89
  - `src/lang/runtime.ts` - TJS runtime (monadic errors, type checking, wrapClass)
90
- - `src/lang/wasm.ts` - WASM compiler (opcodes, disassembler, bytecode generation)
90
+ - `src/lang/wasm.ts` - WASM compiler (opcodes, disassembler, bytecode generation; multi-function module composition; wasm-to-wasm `call <index>` resolution)
91
+ - `src/lang/emitters/js-wasm.ts` - JS bootstrap emitter for compiled wasm modules (one `WebAssembly.compile` per file, name→export-index table, type-aware wrappers)
92
+ - `src/lang/module-loader.ts` - Transpile-time `.tjs`/`.ts`/`.js` module loader (Phase 0.75); used by cross-file `wasm function` composition
93
+ - `src/linalg/` - `tjs-lang/linalg` stdlib subpath (f32x4 SIMD vector kernels)
91
94
  - `src/types/` - Type system definitions (Type.ts, Generic.ts)
92
95
  - `src/transpiler/` - AJS transpiler (source → AST)
93
96
  - `src/batteries/` - LM Studio integration (lazy init, model audit, vector search)
@@ -247,6 +250,7 @@ AJS expressions behave differently from JavaScript in several important ways:
247
250
  - Integration tests in `src/use-cases/` (RAG, orchestration, malicious actors)
248
251
  - Security tests in `src/use-cases/malicious-actor.test.ts`
249
252
  - Language tests split across 17 files in `src/lang/` (lang.test.ts, features.test.ts, codegen.test.ts, parser.test.ts, from-ts.test.ts, wasm.test.ts, etc.)
253
+ - LLM integration tests (run via full `bun test`, skipped by `SKIP_LLM_TESTS`) need a local **LM Studio** server with a chat + embedding model loaded. Setup and the hard-won gotchas (model load failures, leaked-VRAM stray `node` worker, updating runtimes, CORS, the audit-cache parallel race) are in [`docs/lm-studio-setup.md`](docs/lm-studio-setup.md).
250
254
 
251
255
  Coverage targets: 98% lines on `src/vm/runtime.ts` (security-critical), 80%+ overall.
252
256
 
@@ -487,7 +491,7 @@ The CLI (`bun src/cli/tjs.ts run`) does NOT inject the test-block `expect` harne
487
491
  - `TODO.md` — Open work, organized by area; move items to the **Completed** section when done
488
492
  - `PLAN.md` — Roadmap
489
493
  - `DOCS-WASM.md` — Canonical WASM reference: inline blocks, `wasm function` declarations, memory model, cross-file composition, `tjs-lang/linalg`, current limitations
490
- - `wasm-library-plan.md` — Cross-file WASM library design (composable `wasm function` declarations, transpile-time module composition, linalg stdlib). Phases 05 complete; see plan for current status.
494
+ - `wasm-library-plan.md` — Cross-file WASM library design (composable `wasm function` declarations, transpile-time module composition, linalg stdlib). **Shipped in v0.8.0** — all phases (0.5, 0.75, 1, 1.5, 2, 3, 4, 5 MVP, 6) complete. See the plan for what's deferred (linalg expansion, i32/f32/v128 return types, etc.).
491
495
  - `MANIFESTO-BUILDER.md` / `MANIFESTO-ENTERPRISE.md` — Positioning docs (audience-targeted pitches)
492
496
  - `benchmarks.md` — Top-level benchmark results (separate from `guides/benchmarks.md`)
493
497
 
package/CONTEXT.md CHANGED
@@ -320,6 +320,10 @@ const registerCallback = ajs`
320
320
 
321
321
  ## 5. Production Considerations
322
322
 
323
+ ### Isomorphic Deployment (Universal Endpoint)
324
+
325
+ Because the VM is environment-agnostic and all IO is injected via capabilities, the _same_ agent program runs unchanged in the data center and in the browser client — with **one security model spanning both** (capabilities + fuel + portable TJS RBAC rules). Atoms are the seam: a client `getRecords` can serve already-loaded data and fall back to the server-side `getRecords` only on a miss, eliminating round-trips. This emerged for free from the sandboxing design rather than being built for. See [`docs/universal-endpoint.md`](docs/universal-endpoint.md).
326
+
323
327
  ### Recursive Agent Fuel
324
328
 
325
329
  When an agent calls sub-agents via `agentRun`, each sub-agent gets its own fuel budget (passed via the capability). Fuel is **not shared** across the call tree by default.