@armoriq/policy-ir 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ArmorIQ Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @armoriq/policy-ir
2
+
3
+ The Armor Policy v2 intermediate representation, shared by every runtime that
4
+ evaluates a policy: conmap, the Armor CLI daemon, the SDK pre-check and OPA.
5
+
6
+ The IR is data, never a program. One canonical serialization and one
7
+ `policyHash` make it the hashing and signing boundary; one golden-vector suite,
8
+ exported from this package, is what every evaluator must pass before release.
9
+
10
+ ## What is here
11
+
12
+ | Export | Purpose |
13
+ |---|---|
14
+ | `PolicyDocument`, `Statement`, … | the `armor.policy.v2` types |
15
+ | `canonicalJson(value)` | sorted keys, compact, ASCII escapes; the platform's one hashing rule |
16
+ | `policyHash(document)` | `sha256:` over the canonical document without `policyHash` |
17
+ | `schemaHash(inputSchema)` | `sha256:` over the canonicalized tool input schema, as the SDKs and the tool inventory compute it |
18
+ | `@armoriq/policy-ir/vectors` | the fixtures: canonical forms, policy hashes, schema hashes |
19
+
20
+ C0 is complete in this package; the conmap binding of the inventory port and the compile endpoint follow in conmap-auto.
21
+
22
+ ## Vectors
23
+
24
+ `vectors/*.json` are generated by `npm run vectors:generate` and committed. The
25
+ evaluation vectors are authored expectations; generation fails if the evaluator
26
+ disagrees with one, so a wrong expectation cannot be pinned by accident.
27
+ CI fails if regenerating them changes anything. A consumer asserts equality
28
+ against them; it never edits them.
29
+
30
+ ## Development
31
+
32
+ ```
33
+ npm ci
34
+ npm run check # lint, typecheck, test, build, smoke (ESM and CJS consumers)
35
+ ```
36
+
37
+ Every function is held under a cyclomatic complexity of 10 by lint. Releases
38
+ are tags `vX.Y.Z` matching `package.json`; the publish workflow runs the full
39
+ check before `npm publish`.