@typesol/cli 0.43.0 → 0.44.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 (64) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/NOTICE +71 -0
  3. package/README.md +25 -11
  4. package/SECURITY.md +32 -5
  5. package/dist/ai.d.ts +1 -1
  6. package/dist/ai.js +5 -5
  7. package/dist/cli.js +196 -72
  8. package/dist/compiler/analyze.js +4 -0
  9. package/dist/compiler/emit/alias.d.ts +1 -1
  10. package/dist/compiler/emit/alias.js +10 -4
  11. package/dist/compiler/emit/base.d.ts +3 -1
  12. package/dist/compiler/emit/base.js +20 -3
  13. package/dist/compiler/emit/borsh.js +11 -5
  14. package/dist/compiler/emit/calls.d.ts +13 -0
  15. package/dist/compiler/emit/calls.js +91 -8
  16. package/dist/compiler/emit/cpi-core.d.ts +3 -1
  17. package/dist/compiler/emit/cpi-core.js +35 -7
  18. package/dist/compiler/emit/create.js +3 -0
  19. package/dist/compiler/emit/expressions.js +6 -1
  20. package/dist/compiler/emit/function.js +10 -0
  21. package/dist/compiler/emit/shared.d.ts +17 -0
  22. package/dist/compiler/emit/shared.js +36 -3
  23. package/dist/compiler/emit/statements.js +17 -4
  24. package/dist/compiler/emit/storage.d.ts +2 -0
  25. package/dist/compiler/emit/storage.js +16 -8
  26. package/dist/compiler/index.d.ts +15 -1
  27. package/dist/compiler/index.js +40 -3
  28. package/dist/compiler/toolchain.d.ts +41 -1
  29. package/dist/compiler/toolchain.js +102 -3
  30. package/dist/testing-stake.d.ts +2 -1
  31. package/dist/testing-stake.js +2 -1
  32. package/dist/testing.js +6 -4
  33. package/dist/tools/clientgen.d.ts +15 -0
  34. package/dist/tools/clientgen.js +173 -7
  35. package/dist/tools/cpigen.d.ts +0 -15
  36. package/dist/tools/cpigen.js +19 -8
  37. package/dist/tools/doctor.d.ts +17 -2
  38. package/dist/tools/doctor.js +64 -4
  39. package/dist/tools/portgen.js +43 -18
  40. package/dist/workspace.d.ts +20 -0
  41. package/dist/workspace.js +173 -6
  42. package/docs/ai.md +10 -5
  43. package/docs/architecture.md +1 -1
  44. package/docs/audit.md +63 -17
  45. package/docs/case-study-escrow.md +1 -1
  46. package/docs/case-study-phoenix.md +10 -10
  47. package/docs/case-study-raydium-amm.md +3 -3
  48. package/docs/case-study-spl-stake-pool.md +5 -5
  49. package/docs/cli.md +17 -8
  50. package/docs/client.md +11 -3
  51. package/docs/errors.md +1 -1
  52. package/docs/language.md +10 -5
  53. package/docs/mainnet.md +21 -10
  54. package/docs/migrate-from-anchor.md +2 -1
  55. package/docs/runtime.md +11 -1
  56. package/docs/security-model.md +38 -6
  57. package/docs/stability.md +21 -2
  58. package/docs/testing.md +25 -0
  59. package/docs/troubleshooting.md +12 -0
  60. package/llms-full.txt +168 -52
  61. package/llms.txt +1 -1
  62. package/package.json +3 -1
  63. package/runtime/typesol_rt.h +22 -13
  64. package/test/programs/LICENSE-Apache-2.0.txt +201 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,129 @@ codes, and says so here.
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 0.44.0 — 2026-11-11
10
+
11
+ Fixes from an internal review of 0.43.0, and the means to check a release. A helper's Pubkey, Option, string or u256
12
+ argument was not a copy when the helper was not inlined, so a check on a value the helper had just overwritten could
13
+ pass; a named seed list read its seeds when the CPI ran; the stale-reference rule was skipped for account-group fields
14
+ and loaded accounts; the Borsh decoder's length checks could wrap. **Programs built with 0.43.0 or earlier should be
15
+ rebuilt and redeployed** (docs/security-model.md says how to tell whether a program was exposed). New: the npm tarball
16
+ is packed from a clean export of the tag and recorded in `releases/`, the tested toolchain is declared and another one
17
+ warns, and fix-only releases come as patches from here on (SECURITY.md). Of the 76 programs of the 0.43.0 sources, 35
18
+ compile to the same binary as in 0.43.0 and 41 to a different one.
19
+
20
+ - Fixed: a Pubkey, Option, string or u256 argument of a helper was not a copy. The SBF backend passes such a value as a
21
+ pointer to the caller's object, so a helper that was not inlined and wrote that object (`rotate(v, v.admin, caller)`
22
+ with `v.admin = v.pending` inside) then read its own write through the parameter: a check on the old value passed on
23
+ the new one. Whether it happened depended on inlining. The value now arrives by pointer, to a copy taken at the call
24
+ whenever the helper can write (it takes accounts, remaining accounts or `Inout` places) and the value is not out of
25
+ its reach (a local, an instruction argument, an account's key, the program id)
26
+ (test/language/helper-copies.test.ts, inlined and `@noinline`).
27
+ - Fixed: a seed list bound to a name (`const s = signer(["vault", st.count, bump])`), given to a helper, or written
28
+ beside an argument with side effects read its seeds when the CPI ran, so after `st.count += 1n` the program signed
29
+ for another PDA than the one the source names. The seeds are copied where the list is written
30
+ (test/language/pda-signers.test.ts).
31
+ - Fixed: the rule that a reference into an account is not used after a helper that may move its data was skipped when
32
+ the account reached the helper as an account-group field (`grow(g.pool, g.payer)`) or as one loaded with
33
+ `loadAccountMut`; such a program compiled and wrote through the stale reference. Both are refused like a plain
34
+ parameter (test/security/aliasing.test.ts).
35
+ - Fixed: the Borsh decoder's length checks subtracted before comparing, so for an `Option` of a struct that itself
36
+ holds an Option (or a Vec of such structs) a short buffer wrapped the subtraction and the read went past the end
37
+ (up to the struct's size, read only). The checks no longer subtract, and a nested struct's smallest size is checked
38
+ after its tag and for each element; `ts_alloc`, string appends and the stake history reader are written the same
39
+ way (test/language/borsh-nested.test.ts).
40
+ - Fixed: a local read before a closure or list callback that changes it kept the new value (`x += bump()`,
41
+ `two(x, bump())`); it keeps the value it had when read, as the left-to-right order promises
42
+ (test/language/closures.test.ts). A string that views text inside an `Inout` place is copied for the helper that
43
+ takes the place (test/language/inout.test.ts).
44
+ - Fixed: `close()`. Closing an account into itself is a compile error (`CloseTo<…, "self">`, `close(a, a)`), and 2040
45
+ at run time in a helper whose two accounts may be one; `Dup<…>` is refused on an account the body closes; using an
46
+ account after `close()` in the same instruction (its writes were dropped) is a compile error, its `.key` aside
47
+ (test/security/dup.test.ts, test/language/diagnostics.test.ts).
48
+ - Language: `min` / `max`, `switch` and list indexes take a `u256`; a `u256` shift amount or exponent is a compile
49
+ error (it was a C build failure); `x <<= n` and `x >>= n` take an amount of its own integer type, as `<<` does;
50
+ `Ata<Init<TokenAccount>, "@acct.field", …>.create` is a compile error naming the form instead of C that does not
51
+ build (test/language/pow.test.ts, test/language/diagnostics.test.ts).
52
+ - Of the 76 programs of the 0.43.0 sources, 35 compile to the same binary as in 0.43.0 and 41 to a different one:
53
+ those with a helper that takes a Pubkey, Option, string or u256 (the parameter is a pointer now). counter, vault and
54
+ escrow are among the 35. Measured against 0.43.0, the changed example programs move by at most 22 compute units
55
+ either way, and no compared transaction of a port costs more than the original's.
56
+ - Docs: docs/security-model.md says what creation over an existing account returns (the System Program's custom 0;
57
+ 3000 is `initAccount<T>`), and docs/runtime.md names the cases that abort (`PANIC_ON_OVERFLOW`, `PANIC_STYLE`, a
58
+ RedBlackTree whose bytes are inconsistent).
59
+ - CLI: generated `.mcp.json` / `.cursor/mcp.json`, the agent rules, hints and docs run the project's own copy with
60
+ `npx --no-install typesol …` (or `npx @typesol/cli …` outside a project): plain `npx typesol` outside an installed
61
+ project asks the registry for a package of that name, which does not exist. docs/migrate-from-anchor.md installs
62
+ before running `port`.
63
+ - typesol/testing: `testProgram` reuses an up-to-date build (same sources, runtime, TypeSOL, TypeScript and clang
64
+ versions), and builds of one program from parallel test workers wait for each other
65
+ (`<out>/<name>/.typesol-build.lock`, taken over when its process is gone or after 15 minutes) instead of writing
66
+ over each other's files.
67
+ - CLI: `typesol cpi` and `typesol port` check the IDL as `typesol client` does (identifiers, base58 addresses, byte
68
+ lists) and keep IDL text inside escaped comments. A pre-0.30 Anchor IDL gets "run `anchor idl convert`" in all
69
+ three, and a null or non-object IDL or a missing `instructions` list is refused with a message.
70
+ - Client: a type that holds itself through a Vec or an Option (`enum Shape { Rec { kids: Vec<Shape> } }`) gets a lazy
71
+ codec; building it overflowed the stack. `u256` / `i256` are supported (bigint, 32 bytes LE), and
72
+ `Option<Option<T>>` is `Option<T> | null` so Some(None) round-trips; one level more is left out with a note.
73
+ - CLI: `clone`, `client --address`, `verify` and `idl publish` time out RPC requests (30 s, `TYPESOL_RPC_TIMEOUT`) and
74
+ report the host and cause as `doctor` / `deploy` do. `deploy` refuses to run without `--url` or a configured
75
+ `json_rpc_url`, and `deploy` / `idl publish` print the cluster and payer before sending. A `--config` that does not
76
+ exist is a usage error in `deploy --dry-run` and `doctor` too.
77
+ - CLI: `check --json` prints JSON for every outcome (a missing file, bad `--files` input). Printed `cd` and deploy
78
+ hints quote paths. `build file.ts --program-id <missing>` explains instead of failing with ENOENT.
79
+ - Docs: docs/cli.md lists `typesol mcp` and every file `init` writes. docs/mainnet.md's counter size and rent are
80
+ measured (11,400 bytes, about 0.080 SOL at 0.43.0). Case studies link to showcase sources on GitHub. docs/client.md
81
+ describes which PDA seeds are filled in. docs/audit.md's figures come from `scripts/audit-stats.ts` (checked by the
82
+ tests), its unreviewed range runs to 0.43.0, and macOS CI is on demand.
83
+ - Tests: the Phoenix and Stake Pool diff helpers compare account bytes without copying them twice or building hex
84
+ strings unless they differ (phoenix-upstream peak RSS 1.53 GB → 0.77 GB), and the per-order market copies left in
85
+ phoenix-cancel and phoenix-upstream are hoisted.
86
+ - Licences: NOTICE records the third-party code the package ships (lib-sokoban's red-black tree in the runtime
87
+ header, MIT; SPL's big_vec layout and the Stake interface's activation function, Apache-2.0) and the Phoenix and
88
+ SPL Stake Pool ports, and ships in the package with the Apache-2.0 text. Every showcase/mainnet file names its
89
+ source and licence.
90
+ - CI: a program binary whose sha256 differs from test/programs/SOURCES.md fails the fetch step (Token Metadata is
91
+ fetched from mainnet, the build the record names; Bubblegum's record is the build devnet runs now). All fetch-only
92
+ binaries are cached, keyed on SOURCES.md. `CI_REQUIRE_ALL` turns a suite skipped for a missing binary into a
93
+ failure (test/binaries.ts).
94
+ - Docs: docs/testing.md lists the SPL Stake Pool and Phoenix random walks and the red-black tree's trace replay
95
+ against lib-sokoban among the checks against an independent oracle.
96
+ - Releases: `scripts/release-check.ts <version>` packs the npm tarball from a clean `git archive` of the tag (frozen
97
+ install, build, lint, the version and CHANGELOG section checked; `--tests` adds the suite) and writes
98
+ `releases/<version>.json`: the commit, the tarball's shasum and integrity as the registry reports them, and each
99
+ file's sha256. The maintainer publishes that tarball (`npm publish <file>.tgz`) instead of a folder with
100
+ `--ignore-scripts`, and `--verify --registry` compares the registry with the record afterwards. `npm pack` is
101
+ reproducible: two clean packs of v0.43.0 and the published 0.43.0 are the same bytes (shasum 10c2883b…), recorded
102
+ in releases/0.43.0.json (CONTRIBUTING.md, docs/testing.md).
103
+ - Toolchain: the toolchain the release is tested with is declared in one place (`TESTED_TOOLCHAIN`, exported from
104
+ `typesol/compiler`: Agave 3.1.10, platform-tools v1.52, its clang 20.1.7 version line). A build with another clang
105
+ (`build`, `deploy`, `verify`, `typesol/testing`, a reused up-to-date build too) prints one warning per process naming
106
+ both and saying its binaries are not covered by the tests; `--toolchain-strict` on `build` and `deploy`, or
107
+ `TYPESOL_TOOLCHAIN=strict` anywhere, makes it an error. `typesol doctor` has a `toolchain` row (tested, or untested
108
+ with both versions; an error under strict), and its install hint is Agave 3.1.10 instead of "stable". CI runs
109
+ `doctor` under strict, so the tests run on the declared toolchain (test/cli/toolchain.test.ts).
110
+ - Build manifests: `<name>.build.json` records `platformTools` (from the SDK's `platform-tools-<version>.md` marker
111
+ and its link into the cache, when they agree) and `host` (`os`, `arch`) beside `clang`. A manifest without `host`
112
+ (from 0.43.0 or earlier) makes the up-to-date check rebuild once instead of reusing the build; a different
113
+ platform-tools or host rebuilds too. `scripts/release-manifest.ts` takes the platform-tools version from the same
114
+ place (its path pattern found none).
115
+ - CLI: `typesol verify` on a mismatch prints the rebuild's toolchain (clang, platform-tools, host, TypeSOL) and the
116
+ deployed build's when a build manifest's binary hash is the deployed bytes' (`--manifest <file>`, `<name>.build.json`
117
+ next to a given `.so`, or the local build's), and which of them differ. A program on chain records no toolchain, so
118
+ without such a manifest it says the deployed side is unknown and names the local manifest as describing another
119
+ binary.
120
+ - Docs: the README's quick start installs the tested Agave and platform-tools exactly; docs/mainnet.md has "the
121
+ toolchain you deploy with" (keep the build manifest with the deployment; `verify` needs the same toolchain);
122
+ docs/troubleshooting.md explains the warning and verify mismatches; docs/cli.md lists the new flags and rows.
123
+ - Docs: docs/audit.md and docs/security-model.md record the internal review of 0.43.0 (2026-11-11): the defects above,
124
+ what it covered (compiler semantics probes, the runtime and generated C, the tooling) and what it did not (the
125
+ Metaplex and token CPI wrappers' emitters, oracles, SBPF v1/v2 builds, Windows); programs built with 0.43.0 or
126
+ earlier should be rebuilt, and docs/security-model.md says how to tell whether a program was exposed to the helper
127
+ argument defect. SECURITY.md and CONTRIBUTING.md add the fix-release rule (from 0.44.0 on, a release that only
128
+ fixes soundness or security defects is a patch of the latest minor, with no new language surface and the binary
129
+ diff in its notes; older minors are not maintained). docs/stability.md lists what a release gives today: the
130
+ checked tarball, the tested toolchain, the build record, fix releases.
131
+
9
132
  ## 0.43.0 — 2026-11-11
10
133
 
11
134
  Phoenix v1 ported in full, Ellipsis Labs' on-chain limit order book and a native program, from the commit a
package/NOTICE ADDED
@@ -0,0 +1,71 @@
1
+ TypeSOL
2
+ Copyright (c) 2026 TypeSOL contributors. Licensed under the MIT License (LICENSE).
3
+
4
+ Third-party code in the published @typesol/cli package
5
+ --------------------------------------------------------
6
+
7
+ The package ships this NOTICE and the Apache License 2.0 text (test/programs/LICENSE-Apache-2.0.txt).
8
+
9
+ - runtime/typesol_rt.h, the RedBlackTree section (ts_rbt_*): a statement-for-statement port of the red-black tree and
10
+ node allocator of lib-sokoban 0.3.0 (https://github.com/jarry-xiao/sokoban, src/red_black_tree.rs and
11
+ src/node_allocator.rs). lib-sokoban is offered under "MIT OR Apache-2.0"; TypeSOL uses it under the MIT License:
12
+
13
+ MIT License
14
+
15
+ Copyright (c) 2022 Jarry Xiao
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+
35
+ - runtime/typesol_rt.h, the BigVec section (ts_bigvec_*), and the BigVec<T> layout the compiler gives account data:
36
+ they follow SPL Stake Pool's big_vec.rs (solana-program/stake-pool, program/src/big_vec.rs; earlier in
37
+ solana-labs/solana-program-library), licensed under the Apache License, Version 2.0. Changes: rewritten in C and
38
+ TypeScript.
39
+
40
+ - dist/testing-stake.js (src/testing-stake.ts), stakeActivation: a port of Delegation::stake_activating_and_deactivating_v2
41
+ of solana-stake-interface 4.3.0 (https://github.com/solana-program/stake, interface crate), Copyright Anza
42
+ Maintainers. Licence: Apache-2.0 (the crate's Cargo metadata for 4.3.0; text in test/programs/LICENSE-Apache-2.0.txt). Changes: rewritten in TypeScript (BigInt arithmetic with the original's u128 saturation).
43
+
44
+ Third-party material in this repository only (not in the published package)
45
+ ------------------------------------------------------------------------------
46
+
47
+ - test/programs/: program binaries dumped from Solana clusters. The ones kept in the repository are Apache-2.0:
48
+ SPL Account Compression and SPL Noop (solana-labs/solana-program-library), Program Metadata
49
+ (solana-program/program-metadata), coral-xyz/multisig, Raydium CP-Swap, Raydium CLMM and Raydium AMM v4 (raydium-io), Jito's tip
50
+ payment, tip distribution and priority fee distribution programs (jito-foundation/jito-programs), marginfi v2
51
+ (mrgnlabs/marginfi-v2), Solend's token-lending (solendprotocol/solana-program-library) and SPL Stake Pool
52
+ (solana-program/stake-pool); and, under the MIT licence, Phoenix v1 (Ellipsis-Labs/phoenix-v1). The licence texts are test/programs/LICENSE-Apache-2.0.txt and
53
+ test/programs/LICENSE-MIT-phoenix-v1.txt; each binary's source, program id
54
+ and sha256 are in test/programs/SOURCES.md.
55
+ marginfi v2's Drift v2 test build (drift-labs/protocol-v2) is Apache-2.0 too and kept.
56
+ The Metaplex programs, under the Metaplex(TM) NFT Open Source License 1.0, Kamino's lending and farms programs and
57
+ JupLend's lending, liquidity and rewards programs, under the Business Source License 1.1, and Drift's Merkle
58
+ distributor, under the GNU GPL 3.0, are not kept here: scripts/fetch-programs.sh downloads them.
59
+ - showcase/test/fixtures/marginfi/: Marginfi v2's on-chain IDL and three of its mainnet accounts (mrgnlabs/marginfi-v2,
60
+ Apache-2.0), and I80F48 vectors written with the fixed crate (MIT or Apache-2.0).
61
+ - showcase/test/fixtures/kamino/: the IDLs of Kamino's lending (1.25.0) and farms programs, the interface descriptions
62
+ as mrgnlabs/marginfi-v2 keeps them in idls-complete/ (Apache-2.0); the programs are not here (see above).
63
+ - showcase/test/fixtures/drift/, showcase/test/fixtures/juplend/: the IDLs of Drift v2 and of JupLend's lending,
64
+ liquidity and rewards rate model programs, as mrgnlabs/marginfi-v2 keeps them in idls-complete/ (Apache-2.0).
65
+ - showcase/test/fixtures/clmm/: Raydium CLMM's on-chain IDL and the accounts of one mainnet pool (raydium-io/raydium-clmm,
66
+ Apache-2.0).
67
+ - showcase/mainnet/: TypeSOL ports of mainnet programs, which follow their originals' source: Raydium CP-Swap, CLMM
68
+ and AMM v4, Jito's MEV programs, marginfi v2, coral-xyz/multisig and SPL Stake Pool (Apache-2.0), and Phoenix v1
69
+ (MIT, Copyright Ellipsis Labs). Every file says which program it ports and under which licence in its first line.
70
+ - showcase/program-examples/: ports of solana-developers/program-examples (MIT, Copyright Solana Foundation; the
71
+ licence text is in showcase/program-examples/README.md).
package/README.md CHANGED
@@ -141,27 +141,41 @@ transactions to both and compares the results.
141
141
 
142
142
  ## Quick start
143
143
 
144
- You need Node.js 22.12 or later and the Agave CLI (`sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"`).
145
- Run `cargo-build-sbf --version` once; this downloads the platform-tools that TypeSOL compiles with. Rust is not needed.
144
+ You need Node.js 22.12 or later and the Agave CLI with its platform-tools, which hold the clang TypeSOL compiles with.
145
+ Rust is not needed. TypeSOL is tested with **Agave 3.1.10 and platform-tools v1.52** (clang 20.1.7); to install exactly
146
+ those:
147
+
148
+ ```sh
149
+ sh -c "$(curl -sSfL https://release.anza.xyz/v3.1.10/install)"
150
+ cargo-build-sbf --install-only --force-tools-install --tools-version v1.52
151
+ ```
152
+
153
+ Other versions work, but their binaries are not covered by the project's tests: `typesol build` warns once when the
154
+ clang is another one (`--toolchain-strict` or `TYPESOL_TOOLCHAIN=strict` makes that an error), and every build records
155
+ its clang, platform-tools and host in `<name>.build.json`.
146
156
 
147
157
  ```sh
148
158
  npx @typesol/cli init my-app --name counter # typesol.json, programs/counter.ts, tests/counter.test.ts, tsconfig
149
159
  cd my-app && npm install
150
160
  npm test # builds the program and runs it in LiteSVM, an in-process Solana runtime
151
- npx typesol build # target/counter/{counter.so, counter.json (IDL), counter.client.ts, counter.build.json}
161
+ npx --no-install typesol build # target/counter/{counter.so, counter.json (IDL), counter.client.ts, counter.build.json}
152
162
  ```
153
163
 
154
- `npx typesol doctor` checks all of this (Node.js, platform-tools, Solana CLI, keypair, RPC) and prints the command
155
- that fixes anything missing. To deploy, on devnet:
164
+ `npx --no-install typesol doctor` checks all of this (Node.js, platform-tools and whether they are the tested ones, Solana CLI, keypair, RPC) and prints the command
165
+ that fixes anything missing. Inside a project, `npx --no-install typesol …` (or `npm run build`, `npm run deploy`) runs the
166
+ project's own copy; outside one, use `npx @typesol/cli …`. Plain `npx typesol` is not TypeSOL: `typesol` is not the npm
167
+ package's name, so where the project's copy is not installed npx would fetch whatever package has that name.
168
+
169
+ To deploy, on devnet:
156
170
 
157
171
  ```sh
158
172
  solana-keygen new # once, if you have no keypair (~/.config/solana/id.json)
159
173
  solana airdrop 2 --url devnet # test SOL for the rent (rate-limited: https://faucet.solana.com also works)
160
- npx typesol deploy --url devnet
174
+ npx --no-install typesol deploy --url devnet
161
175
  ```
162
176
 
163
177
  or on a local validator: `solana-test-validator` in another terminal, `solana airdrop 5 --url localhost`, then
164
- `npx typesol deploy --url localhost`. `deploy` checks the RPC and the payer's balance before sending anything.
178
+ `npx --no-install typesol deploy --url localhost`. `deploy` checks the RPC and the payer's balance before sending anything.
165
179
 
166
180
  `--template vault` or `--template escrow` starts from a SOL vault or an SPL token escrow instead of the counter, each
167
181
  with a passing LiteSVM test.
@@ -268,16 +282,16 @@ toolchain and records them with every result:
268
282
  <!-- bench:table -->
269
283
  | Instruction | TypeSOL | Pinocchio 0.10 | Native Rust | Anchor 1.0.2 |
270
284
  | --- | ---: | ---: | ---: | ---: |
271
- | counter.initialize | **1,857** | 3,186 | 4,601 | 6,573 |
285
+ | counter.initialize | **1,856** | 3,186 | 4,601 | 6,573 |
272
286
  | counter.increment | **110** | 113 | 857 | 2,323 |
273
- | vault.open | **1,874** | 3,185 | 4,613 | 6,627 |
287
+ | vault.open | **1,875** | 3,185 | 4,613 | 6,627 |
274
288
  | vault.deposit | **1,314** | 1,377 | 2,832 | 4,355 |
275
289
  | vault.withdraw | **315** | 370 | 1,176 | 3,628 |
276
290
  | vault.shut | **161** | 167 | 950 | 2,024 |
277
- | escrow.make | **3,596** | 6,179 | 9,240 | 13,304 |
291
+ | escrow.make | **3,595** | 6,179 | 9,240 | 13,304 |
278
292
  | escrow.take | **4,019** | 4,051 | 8,500 | 14,365 |
279
293
  | escrow.refund | **2,696** | 2,769 | 5,695 | 8,449 |
280
- | binary, counter / vault / escrow | 11.1 / 14.1 / 21.4 KB | 19.6 / 22.9 / 29.4 KB | 27.9 / 35.0 / 46.5 KB | 145.2 / 158.9 / 190.7 KB |
294
+ | binary, counter / vault / escrow | 11.1 / 14.1 / 21.5 KB | 19.6 / 22.9 / 29.4 KB | 27.9 / 35.0 / 46.5 KB | 145.2 / 158.9 / 190.7 KB |
281
295
  <!-- /bench:table -->
282
296
 
283
297
  `initialize`, `open` and `make` include the PDA bump search. TypeSOL hashes PDA candidates with the sha256 and
package/SECURITY.md CHANGED
@@ -4,11 +4,38 @@ TypeSOL generates programs that hold funds. Treat it accordingly.
4
4
 
5
5
  ## Status
6
6
 
7
- - The compiler, runtime and tooling have been through internal security reviews. Every release is covered by execution
8
- tests, differential tests against Anchor, and randomized tests. **TypeSOL has not been audited by an independent
9
- firm.** Do not put significant value behind programs built with it until an external audit of the compiler and
10
- runtime is published, and audit your own programs as you would any Solana program.
11
- - Only the latest 0.x release receives security fixes.
7
+ - The compiler, runtime and tooling have been through internal security reviews by the maintainers. The latest, of
8
+ 0.43.0 on 2026-11-11, found defects in the compiler (one of them can break an authorization check in a helper) and
9
+ in the tooling; they are fixed in 0.44.0. **Rebuild and redeploy programs built with 0.43.0 or
10
+ earlier once it is out**; [docs/security-model.md](docs/security-model.md#review-of-0430-2026-11-11) says how to tell
11
+ whether a program was exposed, and [docs/audit.md](docs/audit.md#earlier-reviews) what that review did and did not
12
+ cover. Every release is covered by execution tests, differential tests against Anchor, and randomized tests.
13
+ **TypeSOL has not been audited by an independent firm.** Do not put significant value behind programs built with it
14
+ until an external audit of the compiler and runtime is published, and audit your own programs as you would any
15
+ Solana program.
16
+ - The tests cover binaries built with the toolchain a release declares as tested (Agave 3.1.10, platform-tools v1.52
17
+ for this one). `typesol build` warns about another one, `--toolchain-strict` refuses it, and each build records its
18
+ toolchain in `<name>.build.json`: keep that file with every deployment.
19
+ - From 0.43.0 on, `releases/<version>.json` records the published npm tarball (its shasum, integrity and every file's
20
+ sha256), packed from a clean export of the release tag; `node scripts/release-check.ts <version> --verify --registry`
21
+ compares it with the registry.
22
+ - Only the latest 0.x release receives security fixes, as fix releases (below).
23
+
24
+ ## Fix releases
25
+
26
+ From 0.44.0 on, a release that only fixes soundness or security defects is published as a patch of the latest minor
27
+ release (0.44.0 → 0.44.1), so a team can take the fix without taking new features:
28
+
29
+ - it adds no language surface (nothing new in `lib/typesol.d.ts`, no construct accepted that was refused) and changes
30
+ no account layout, IDL or error code beyond what the fix itself needs;
31
+ - a program it refuses or builds to another binary is one the defect touches, and the CHANGELOG says which;
32
+ - its release notes carry the binary diff against the previous release (the previous release's sources built by both
33
+ packages, `binary-diff.txt`; see [docs/testing.md](docs/testing.md#reproducing-a-release)), so a team can see whether
34
+ their program's binary changes.
35
+
36
+ Fixes go to the latest minor only; older minors are not maintained. A fix that needs a language or layout change
37
+ comes in the next minor. 0.44.0 itself is a minor release: besides the fixes from the 0.43.0 review it has behaviour
38
+ changes (new compile errors, `deploy` refusing to run without a cluster).
12
39
  - What a compiled program can rely on is specified in [docs/security-model.md](docs/security-model.md); the package
13
40
  for an external audit is [docs/audit.md](docs/audit.md).
14
41
 
package/dist/ai.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The rules every TypeSOL program follows that a model trained on ordinary TypeScript gets wrong first. */
2
- export declare const AGENT_RULES = "## Writing TypeSOL\n\nTypeSOL compiles a subset of TypeScript to a Solana program (native SBF) with an Anchor-compatible IDL. Programs live\nin `programs/`, tests in `tests/`; `typesol.json` lists the programs.\n\n- Exported functions are instructions; their parameters are the accounts (`Signer`, `Account<T>`, `Mut<T>`,\n `Init<T>`, token accounts, programs) and then the arguments. Account data types are exported interfaces.\n- Integers are bigint: `u8` \u2026 `u128`, `i8` \u2026 `i128` (write `1n`, never `1`; take `u64`, never `number`).\n Arithmetic is checked: an overflow fails the instruction. There is no floating point.\n- Import everything from `\"typesol\"`: types, and functions such as `require`, `log`, `min`, `max`,\n `fixedArray`, `emit`, `invoke`.\n- Fail with `require(condition, MyError.Name)` (an exported string enum of messages) or `require(condition, \"message\")`.\n There is no `throw`, `try`, `async`, `class`, `console` or `Math`.\n- An account the instruction changes is `Mut<T>`; one it creates is `Init<T>` (`acct.create(payer, seeds)`).\n- Lists: `FixedArray<T, N>`, `FixedVec<T, N>`, `Vec<T>`; read with `.get(i)` and write with `.set(i, v)`\n (`i` a bigint), not `xs[i]`. `map`, `filter`, `find`, `some`, `reduce` work on them.\n- Strings are `FixedString<N>` in account data; `Option<T>` (`T | null`) for optional values.\n\n## Checking your work\n\n- `npx typesol check` (or `--json`) type-checks every program and lists what TypeSOL refuses, each error with a\n `hint` that says what to write instead. Fix those first; they are faster than a build.\n- `npm test` builds the programs and runs `tests/` in LiteSVM (an in-process Solana runtime). `npx typesol build`\n writes `target/<name>/`: the `.so`, the IDL and a typed client.\n- The MCP server (`npx typesol mcp`, configured in `.mcp.json` and `.cursor/mcp.json`) gives the same check,\n the IDL and the docs as tools.\n- The language reference: `node_modules/typesol/docs/language.md`, or https://typesol.com/llms-full.txt.\n";
2
+ export declare const AGENT_RULES = "## Writing TypeSOL\n\nTypeSOL compiles a subset of TypeScript to a Solana program (native SBF) with an Anchor-compatible IDL. Programs live\nin `programs/`, tests in `tests/`; `typesol.json` lists the programs.\n\n- Exported functions are instructions; their parameters are the accounts (`Signer`, `Account<T>`, `Mut<T>`,\n `Init<T>`, token accounts, programs) and then the arguments. Account data types are exported interfaces.\n- Integers are bigint: `u8` \u2026 `u128`, `i8` \u2026 `i128` (write `1n`, never `1`; take `u64`, never `number`).\n Arithmetic is checked: an overflow fails the instruction. There is no floating point.\n- Import everything from `\"typesol\"`: types, and functions such as `require`, `log`, `min`, `max`,\n `fixedArray`, `emit`, `invoke`.\n- Fail with `require(condition, MyError.Name)` (an exported string enum of messages) or `require(condition, \"message\")`.\n There is no `throw`, `try`, `async`, `class`, `console` or `Math`.\n- An account the instruction changes is `Mut<T>`; one it creates is `Init<T>` (`acct.create(payer, seeds)`).\n- Lists: `FixedArray<T, N>`, `FixedVec<T, N>`, `Vec<T>`; read with `.get(i)` and write with `.set(i, v)`\n (`i` a bigint), not `xs[i]`. `map`, `filter`, `find`, `some`, `reduce` work on them.\n- Strings are `FixedString<N>` in account data; `Option<T>` (`T | null`) for optional values.\n\n## Checking your work\n\n- `npx --no-install typesol check` (or `--json`) type-checks every program and lists what TypeSOL refuses, each error with a\n `hint` that says what to write instead. Fix those first; they are faster than a build.\n- `npm test` builds the programs and runs `tests/` in LiteSVM (an in-process Solana runtime). `npx --no-install typesol build`\n writes `target/<name>/`: the `.so`, the IDL and a typed client.\n- The MCP server (`npx --no-install typesol mcp`, configured in `.mcp.json` and `.cursor/mcp.json`) gives the same check,\n the IDL and the docs as tools.\n- The language reference: `node_modules/typesol/docs/language.md` (after `npm install`), or https://typesol.com/llms-full.txt.\n";
3
3
  /** AGENTS.md for a new project (Codex, Cursor, Zed, and other agents that read it). */
4
4
  export declare function agentsMd(name: string): string;
5
5
  /** Claude Code reads CLAUDE.md, which imports AGENTS.md so the rules are kept in one place. */
package/dist/ai.js CHANGED
@@ -21,13 +21,13 @@ in \`programs/\`, tests in \`tests/\`; \`typesol.json\` lists the programs.
21
21
 
22
22
  ## Checking your work
23
23
 
24
- - \`npx typesol check\` (or \`--json\`) type-checks every program and lists what TypeSOL refuses, each error with a
24
+ - \`npx --no-install typesol check\` (or \`--json\`) type-checks every program and lists what TypeSOL refuses, each error with a
25
25
  \`hint\` that says what to write instead. Fix those first; they are faster than a build.
26
- - \`npm test\` builds the programs and runs \`tests/\` in LiteSVM (an in-process Solana runtime). \`npx typesol build\`
26
+ - \`npm test\` builds the programs and runs \`tests/\` in LiteSVM (an in-process Solana runtime). \`npx --no-install typesol build\`
27
27
  writes \`target/<name>/\`: the \`.so\`, the IDL and a typed client.
28
- - The MCP server (\`npx typesol mcp\`, configured in \`.mcp.json\` and \`.cursor/mcp.json\`) gives the same check,
28
+ - The MCP server (\`npx --no-install typesol mcp\`, configured in \`.mcp.json\` and \`.cursor/mcp.json\`) gives the same check,
29
29
  the IDL and the docs as tools.
30
- - The language reference: \`node_modules/typesol/docs/language.md\`, or https://typesol.com/llms-full.txt.
30
+ - The language reference: \`node_modules/typesol/docs/language.md\` (after \`npm install\`), or https://typesol.com/llms-full.txt.
31
31
  `;
32
32
  /** AGENTS.md for a new project (Codex, Cursor, Zed, and other agents that read it). */
33
33
  export function agentsMd(name) {
@@ -40,4 +40,4 @@ export function cursorRule() {
40
40
  return `---\ndescription: TypeSOL, a TypeScript subset compiled to Solana programs\nglobs: programs/**/*.ts, tests/**/*.ts\nalwaysApply: true\n---\n\n${AGENT_RULES}`;
41
41
  }
42
42
  /** The MCP server configuration Claude Code (.mcp.json) and Cursor (.cursor/mcp.json) read. */
43
- export const MCP_JSON = JSON.stringify({ mcpServers: { typesol: { command: "npx", args: ["typesol", "mcp"] } } }, null, 2) + "\n";
43
+ export const MCP_JSON = JSON.stringify({ mcpServers: { typesol: { command: "npx", args: ["--no-install", "typesol", "mcp"] } } }, null, 2) + "\n";