@kindgi/specs 0.0.0-bootstrap.0 → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Kindgi Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,126 @@
1
1
  # @kindgi/specs
2
2
 
3
- A placeholder. Releases come from https://github.com/kindgi/kindgi-sdk.
3
+ **Protocol layer. Source of truth. Human-authored, machine-consumable.**
4
+
5
+ Every artifact kind in Kindgi has its shape defined here as a JSON Schema
6
+ (Draft 2020-12). Package implementations derive their types from these
7
+ schemas — never the other way around. SDKs, runtimes, and external tools
8
+ (Python, Go, community MCP tools) validate and generate against the same
9
+ files.
10
+
11
+ ## Usage
12
+
13
+ Resolve a single schema by name — `@kindgi/specs/<name>.schema.json`:
14
+
15
+ ```ts
16
+ import { readFileSync } from 'node:fs';
17
+ import { createRequire } from 'node:module';
18
+
19
+ const require = createRequire(import.meta.url);
20
+ const flowSchema = JSON.parse(
21
+ readFileSync(require.resolve('@kindgi/specs/flow.schema.json'), 'utf8'),
22
+ );
23
+ ```
24
+
25
+ Example fixtures resolve the same way:
26
+ `@kindgi/specs/examples/flow.example.with-loop.json`.
27
+
28
+ To enumerate the whole set (spec registries, validators, codegen), use the
29
+ directory exports:
30
+
31
+ | Export | Kind | Description |
32
+ |---|---|---|
33
+ | `SPECS_SCHEMAS_DIR` | `string` | Absolute path to the directory holding every `<name>.schema.json`. |
34
+ | `SPECS_EXAMPLES_DIR` | `string` | Absolute path to the example fixtures (`<schema-name>.example.<label>.json`). |
35
+
36
+ Schemas reference each other by `$id` (e.g. `pack.schema.json` →
37
+ `tool.schema.json`), so register the whole set before compiling one — see
38
+ `@kindgi/schema`.
39
+
40
+ ## Schemas
41
+
42
+ | Schema | Purpose |
43
+ |---|---|
44
+ | `agent.schema.json` | Agent — instructions + capabilities + tools + memory, declaratively composed |
45
+ | `audit-bundle.schema.json` | HITL audit bundle — signed export of approvals + decisions + provenance refs |
46
+ | `capability.schema.json` | Capability declaration — model requirements as constraints |
47
+ | `compliance-evidence.schema.json` | Compliance evidence record emitted by the runtime |
48
+ | `discoverable.schema.json` | Discoverable entity marker — cross-history retrieval |
49
+ | `eval-suite.schema.json` | Evaluation suite — subject invoker + case set |
50
+ | `event.schema.json` | Event — the causal glue between runs |
51
+ | `flow.schema.json` | Task flow — nodes, edges, data mapping, versioning |
52
+ | `guardrail.schema.json` | Guardrail declaration — runtime + CI enforcement gates |
53
+ | `memory.schema.json` | Log entries + facts — the two memory primitives |
54
+ | `pack.schema.json` | Pack manifest — installable vertical application |
55
+ | `pack-index.schema.json` | Pack index — the `index.json` a pack build emits; what a runtime registers and a pack service loads |
56
+ | `pack-protocol.schema.json` | Pack protocol v2 — the messages a runtime exchanges with a pack service (any language) |
57
+ | `policy.schema.json` | Tenant policy — access control and scope rules |
58
+ | `provenance.schema.json` | Causal DAG — signed, portable, verifiable outside the runtime |
59
+ | `run-event.schema.json` | Kernel run lifecycle events (SSE stream) |
60
+ | `tool.schema.json` | Tool definition — MCP-compatible, transport-agnostic |
61
+
62
+ ## Rules
63
+
64
+ 1. **Every schema uses Draft 2020-12** (`$schema: "https://json-schema.org/draft/2020-12/schema"`).
65
+ 2. **Every schema has a versioned `$id`** — `https://kindgi.com/schemas/v<N>/<name>.schema.json`. The `<name>` segment must exactly match the filename base. Enforced by `scripts/validate.mjs`.
66
+ 3. **Every schema carries `$comment: "schema-version: X.Y.Z"`** with full semver. Human-readable, non-validating annotation. Also enforced.
67
+ 4. **`additionalProperties: false`** on every object node unless there's a documented reason to allow open-ended keys.
68
+ 5. **Descriptions are load-bearing** — they're what AI codegen and human readers use to understand intent. Write them like production API docs.
69
+ 6. **`$defs` for reusable sub-shapes** — never inline the same shape twice.
70
+ 7. **Examples live under `examples/<schema-name>.example.<label>.json`** — validated in CI by `scripts/validate.mjs`.
71
+
72
+ ## Versioning policy
73
+
74
+ Schemas are wire contracts. Four notions of version are distinct:
75
+
76
+ | Version of | Where | Example |
77
+ |---|---|---|
78
+ | The artifact instance | Inside the artifact (`.version` field) | `flow.version = "1.2.3"` |
79
+ | The schema itself | `$id` path segment + `$comment` | `.../v1/flow.schema.json` + `schema-version: 1.0.0` |
80
+ | The JSON Schema draft | `$schema` | `.../draft/2020-12/schema` |
81
+ | This package | `package.json` `version` (shared by every `@kindgi/*` package) | `@kindgi/specs@0.1.0` |
82
+
83
+ ### When to bump what
84
+
85
+ | Change | Bump |
86
+ |---|---|
87
+ | Wording, description edits, internal `$defs` refactor | none |
88
+ | Add an optional field | patch or minor |
89
+ | Add a required field with default handling in consumers | minor + migration note |
90
+ | Rename a field | **major** — new file, new `$id`, old file archived under `schemas/archive/v<N>/` |
91
+ | Remove a field | **major** |
92
+ | Widen an enum (add a value) | minor (consumers required to tolerate unknown values) |
93
+ | Narrow an enum (remove a value) | **major** |
94
+
95
+ **Until the first stable release (1.0.0 of the `@kindgi/*` packages)**,
96
+ a breaking change — any row marked **major** above — is a **minor**
97
+ bump instead: the `$id` keeps its `v<N>` segment, nothing is archived,
98
+ and the schema's `description` gets a version-history note
99
+ ("Schema-version 1.9.0 removes …") saying what changed. The major rows,
100
+ with a new `$id` and an archived old file, apply from 1.0.0 on.
101
+
102
+ ### Archived majors
103
+
104
+ When a schema bumps major (e.g. v1 → v2), the v1 file moves to
105
+ `schemas/archive/v1/<name>.schema.json` and stays there indefinitely. Old artifacts (provenance DAGs, packs, memory rows serialized
106
+ under v1) continue to validate. Consumers reference by `$id` — old `$id`s
107
+ keep resolving to the archived file.
108
+
109
+ ## Validation
110
+
111
+ ```bash
112
+ pnpm run spec:validate # from the repository root
113
+ pnpm run validate # from this package
114
+ ```
115
+
116
+ Validates:
117
+ - Every schema compiles under Draft 2020-12.
118
+ - Every schema's `$id` matches the versioned URL convention and the filename.
119
+ - Every schema carries a valid `$comment: "schema-version: X.Y.Z"`.
120
+ - Every example fixture in `examples/` validates against its schema.
121
+ - Cross-schema `$ref`s resolve (e.g. `pack.schema.json` referencing `tool.schema.json`).
122
+
123
+ CI runs this on every PR; broken specs fail the build. Packages that bundle
124
+ a copy of a schema for offline validation (`@kindgi/flow`, `@kindgi/tools`,
125
+ `@kindgi/capabilities`, `@kindgi/guardrails`, `@kindgi/provenance`, …) keep a drift test that
126
+ compares their copy with the one resolved from this package.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Absolute path to the directory holding every canonical
3
+ * `<name>.schema.json` shipped with `@kindgi/specs`.
4
+ *
5
+ * For one schema, import or resolve it by name instead
6
+ * (`@kindgi/specs/flow.schema.json`); this directory is for consumers that
7
+ * enumerate the whole set (spec registries, validators, codegen).
8
+ *
9
+ * Resolved from this module's own URL, so it is correct in every layout
10
+ * the package can be installed in (workspace checkout, linked
11
+ * workspace package, `node_modules`) — from both `src/` and `dist/`.
12
+ */
13
+ export declare const SPECS_SCHEMAS_DIR: string;
14
+ /**
15
+ * Absolute path to the example fixtures
16
+ * (`<schema-name>.example.<label>.json`), each of which validates against
17
+ * its schema. Also importable by name as `@kindgi/specs/examples/<file>`.
18
+ */
19
+ export declare const SPECS_EXAMPLES_DIR: string;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAA+D,CAAC;AAEhG;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAgE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+ import { fileURLToPath } from 'node:url';
4
+ /**
5
+ * Absolute path to the directory holding every canonical
6
+ * `<name>.schema.json` shipped with `@kindgi/specs`.
7
+ *
8
+ * For one schema, import or resolve it by name instead
9
+ * (`@kindgi/specs/flow.schema.json`); this directory is for consumers that
10
+ * enumerate the whole set (spec registries, validators, codegen).
11
+ *
12
+ * Resolved from this module's own URL, so it is correct in every layout
13
+ * the package can be installed in (workspace checkout, linked
14
+ * workspace package, `node_modules`) — from both `src/` and `dist/`.
15
+ */
16
+ export const SPECS_SCHEMAS_DIR = fileURLToPath(new URL('../schemas/', import.meta.url));
17
+ /**
18
+ * Absolute path to the example fixtures
19
+ * (`<schema-name>.example.<label>.json`), each of which validates against
20
+ * its schema. Also importable by name as `@kindgi/specs/examples/<file>`.
21
+ */
22
+ export const SPECS_EXAMPLES_DIR = fileURLToPath(new URL('../examples/', import.meta.url));
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAW,aAAa,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhG;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAW,aAAa,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC"}
@@ -0,0 +1,88 @@
1
+ {
2
+ "$schema": "https://kindgi.com/schemas/v1/flow.schema.json",
3
+ "id": "example.with-loop",
4
+ "version": "1.0.0",
5
+ "name": "Example: batch-per-item + iterative refine",
6
+ "description": "A canonical example of the loop primitive: outer flow does one setup step, then hands to a foreach loop over a batch of items; each iteration of the foreach body runs a while loop that iteratively refines a candidate answer until the model returns finishReason='stop' or maxIterations hits. Every loop declares a typed outputSchema — the escape contract for what crosses back to the outer flow.",
7
+ "nodes": [
8
+ {
9
+ "id": "setup",
10
+ "kind": "tool",
11
+ "ref": "prepare-batch"
12
+ },
13
+ {
14
+ "id": "batch-loop",
15
+ "kind": "loop",
16
+ "loopKind": "foreach",
17
+ "iterateOver": { "path": "nodeOutputs.setup.items" },
18
+ "maxIterations": 100,
19
+ "body": {
20
+ "nodes": [
21
+ {
22
+ "id": "refine-loop",
23
+ "kind": "loop",
24
+ "loopKind": "while",
25
+ "evaluationTiming": "after",
26
+ "maxIterations": 8,
27
+ "exitCondition": {
28
+ "op": "or",
29
+ "children": [
30
+ {
31
+ "op": "eq",
32
+ "left": { "path": "iterationOutput.finishReason" },
33
+ "right": { "literal": "stop" }
34
+ },
35
+ {
36
+ "op": "eq",
37
+ "left": { "path": "iterationOutput.finishReason" },
38
+ "right": { "literal": "length" }
39
+ }
40
+ ]
41
+ },
42
+ "body": {
43
+ "nodes": [
44
+ { "id": "model-call", "kind": "agent", "ref": "refiner" },
45
+ { "id": "dispatch-tools", "kind": "tool", "ref": "dispatch" }
46
+ ],
47
+ "edges": [
48
+ { "id": "rl-e1", "from": "$loop-start", "to": "model-call" },
49
+ { "id": "rl-e2", "from": "model-call", "to": "dispatch-tools" },
50
+ { "id": "rl-e3", "from": "dispatch-tools", "to": "$loop-end" }
51
+ ]
52
+ },
53
+ "outputSchema": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "required": ["finishReason", "answer"],
57
+ "properties": {
58
+ "finishReason": {
59
+ "type": "string",
60
+ "enum": ["stop", "length", "tool-calls"]
61
+ },
62
+ "answer": { "type": "string" }
63
+ }
64
+ }
65
+ }
66
+ ],
67
+ "edges": [
68
+ { "id": "bl-e1", "from": "$loop-start", "to": "refine-loop" },
69
+ { "id": "bl-e2", "from": "refine-loop", "to": "$loop-end" }
70
+ ]
71
+ },
72
+ "outputSchema": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "required": ["itemAnswer"],
76
+ "properties": {
77
+ "itemAnswer": { "type": "string" }
78
+ }
79
+ },
80
+ "collectAllIterations": true
81
+ }
82
+ ],
83
+ "edges": [
84
+ { "id": "oe1", "from": "$start", "to": "setup" },
85
+ { "id": "oe2", "from": "setup", "to": "batch-loop" },
86
+ { "id": "oe3", "from": "batch-loop", "to": "$end" }
87
+ ]
88
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "agents": [
3
+ {
4
+ "capabilities": [{ "needs": [{ "feature": "tool-use" }] }],
5
+ "guardrails": ["acme.ledger.response-not-empty"],
6
+ "id": "acme.ledger.bookkeeper",
7
+ "instructions": "Classify the document, then call acme.ledger.record-expense.",
8
+ "modulePath": "agents/bookkeeper.py",
9
+ "name": "Bookkeeper",
10
+ "retrieval": [],
11
+ "tools": [{ "id": "acme.ledger.record-expense", "version": "1.0.0" }],
12
+ "version": "1.0.0"
13
+ }
14
+ ],
15
+ "artifactVersion": "20261001.1",
16
+ "flows": [
17
+ {
18
+ "edges": [
19
+ { "from": "$start", "id": "e-start", "to": "record" },
20
+ { "from": "record", "id": "e-end", "to": "$end" }
21
+ ],
22
+ "id": "acme.ledger.record-flow",
23
+ "kernelPayloadVersion": 1,
24
+ "modulePath": "flows/record.py",
25
+ "nodes": [{ "id": "record", "kind": "tool", "ref": "acme.ledger.record-expense" }],
26
+ "version": "1.0.0"
27
+ }
28
+ ],
29
+ "guardrails": [
30
+ {
31
+ "action": { "on-violation": "halt" },
32
+ "checkId": "acme.ledger.checks.response-not-empty",
33
+ "checkModulePath": "guardrails/response.py",
34
+ "configSchema": {
35
+ "properties": { "minLength": { "default": 1, "minimum": 0, "type": "integer" } },
36
+ "type": "object"
37
+ },
38
+ "id": "acme.ledger.response-not-empty",
39
+ "kind": "zero-llm",
40
+ "scope": { "when": "runtime-only" },
41
+ "severity": "error"
42
+ }
43
+ ],
44
+ "packId": "acme.ledger",
45
+ "packVersion": "1.0.0",
46
+ "publishedAt": "2026-10-01T12:00:00.000Z",
47
+ "tools": [
48
+ {
49
+ "description": "Records an expense in the ledger.",
50
+ "effects": [{ "kind": "writes", "resource": "db:ledger" }],
51
+ "id": "acme.ledger.record-expense",
52
+ "input": {
53
+ "properties": {
54
+ "amountCents": { "minimum": 0, "type": "integer" },
55
+ "vendor": { "type": "string" }
56
+ },
57
+ "required": ["vendor", "amountCents"],
58
+ "type": "object"
59
+ },
60
+ "modulePath": "tools/ledger.py",
61
+ "output": {
62
+ "properties": { "expenseId": { "type": "string" } },
63
+ "required": ["expenseId"],
64
+ "type": "object"
65
+ },
66
+ "version": "1.0.0"
67
+ }
68
+ ],
69
+ "v": 1
70
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "v": 2,
3
+ "kind": "check-invoke",
4
+ "check": { "id": "acme.ledger.checks.response-not-empty" },
5
+ "config": { "minLength": 1 },
6
+ "trace": {
7
+ "runId": "run-1",
8
+ "tenantId": "t-1",
9
+ "output": "Recorded.",
10
+ "toolCalls": [],
11
+ "toolResults": [],
12
+ "modelCalls": [],
13
+ "mode": "runtime"
14
+ }
15
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "protocol": 2,
3
+ "packId": "acme.ledger",
4
+ "packVersion": "1.0.0",
5
+ "artifactVersion": "20261001.1",
6
+ "tools": [{ "id": "acme.ledger.record-expense", "version": "1.0.0" }],
7
+ "checks": ["acme.ledger.checks.response-not-empty"]
8
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "v": 2,
3
+ "kind": "error",
4
+ "code": "input-validation-failed",
5
+ "message": "Tool \"acme.ledger.record-expense\" input failed validation",
6
+ "toolId": "acme.ledger.record-expense",
7
+ "issues": [
8
+ {
9
+ "instancePath": "",
10
+ "schemaPath": "#/required",
11
+ "keyword": "required",
12
+ "params": { "missingProperty": "amountCents" },
13
+ "message": "must have required property 'amountCents'"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "v": 2,
3
+ "kind": "invoke",
4
+ "tool": { "id": "acme.ledger.record-expense", "version": "1.0.0" },
5
+ "input": { "vendor": "Acme Office Supply", "amountCents": 12999 },
6
+ "ctx": {
7
+ "tenantId": "t-1",
8
+ "runId": "run-1",
9
+ "requestId": "toolu_01",
10
+ "env": { "LEDGER_DB": "postgres://ledger" }
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,7 +1,56 @@
1
1
  {
2
2
  "name": "@kindgi/specs",
3
- "version": "0.0.0-bootstrap.0",
4
- "description": "Placeholder so a trusted publisher can be attached. Releases are published from https://github.com/kindgi/kindgi-sdk with provenance; use 0.1.0 or later.",
3
+ "version": "0.1.1",
4
+ "description": "Canonical JSON Schemas (Draft 2020-12) for every Kindgi artifact kind — flow, agent, tool, capability, guardrail, policy, event, run event, memory, provenance, pack, compliance evidence, audit bundle, eval suite, discoverable entity. The wire contracts every SDK, runtime, and external tool validates against. Each schema is importable by name as `@kindgi/specs/<name>.schema.json`.",
5
5
  "license": "Apache-2.0",
6
- "repository": { "type": "git", "url": "git+https://github.com/kindgi/kindgi-sdk.git" }
7
- }
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kindgi/kindgi-sdk.git",
9
+ "directory": "packages/specs"
10
+ },
11
+ "homepage": "https://github.com/kindgi/kindgi-sdk/tree/main/packages/specs#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/kindgi/kindgi-sdk/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./*.schema.json": "./schemas/*.schema.json",
24
+ "./examples/*.json": "./examples/*.json",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "src",
30
+ "schemas",
31
+ "examples",
32
+ "README.md",
33
+ "type-manifest.json"
34
+ ],
35
+ "devDependencies": {
36
+ "@types/node": "^22.10.5",
37
+ "ajv": "^8.17.1",
38
+ "ajv-formats": "^3.0.1",
39
+ "typescript": "^5.7.3",
40
+ "vitest": "^2.1.8"
41
+ },
42
+ "engines": {
43
+ "node": ">=22.0.0"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public",
47
+ "provenance": true
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -p tsconfig.build.json",
51
+ "typecheck": "tsc --noEmit",
52
+ "test": "vitest run",
53
+ "validate": "node scripts/validate.mjs",
54
+ "clean": "rm -rf dist *.tsbuildinfo"
55
+ }
56
+ }