@kindgi/sdk 0.0.0-bootstrap.0 → 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 +201 -0
- package/README.md +167 -1
- package/dist/build.d.ts +10 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +11 -0
- package/dist/build.js.map +1 -0
- package/dist/client.d.ts +28 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +29 -0
- package/dist/client.js.map +1 -0
- package/dist/define.d.ts +25 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +37 -0
- package/dist/define.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/webhooks.d.ts +15 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +16 -0
- package/dist/webhooks.js.map +1 -0
- package/package.json +80 -4
- package/skills/kindgi-authoring-agents/SKILL.md +253 -0
- package/skills/kindgi-authoring-flows/SKILL.md +299 -0
- package/skills/kindgi-authoring-guardrails/SKILL.md +291 -0
- package/skills/kindgi-authoring-mcp-servers/SKILL.md +289 -0
- package/skills/kindgi-authoring-providers/SKILL.md +704 -0
- package/skills/kindgi-authoring-tools/SKILL.md +288 -0
- package/skills/kindgi-framework-feedback/SKILL.md +211 -0
- package/skills/kindgi-getting-started/SKILL.md +181 -0
- package/skills/kindgi-python-authoring-agents/SKILL.md +205 -0
- package/skills/kindgi-python-authoring-flows/SKILL.md +322 -0
- package/skills/kindgi-python-authoring-guardrails/SKILL.md +173 -0
- package/skills/kindgi-python-authoring-tools/SKILL.md +299 -0
- package/skills/kindgi-python-getting-started/SKILL.md +240 -0
- package/src/build.ts +18 -0
- package/src/client.ts +147 -0
- package/src/define.ts +75 -0
- package/src/index.ts +20 -0
- package/src/types.ts +86 -0
- package/src/webhooks.ts +34 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kindgi-python-getting-started
|
|
3
|
+
description: >
|
|
4
|
+
Getting a Python Kindgi pack running: what a pack is, scaffolding one
|
|
5
|
+
(`kindgi init <name> --template=python`) or adding `[tool.kindgi]` to
|
|
6
|
+
an existing Python app, `uv sync`, `kindgi dev`, the first agent run,
|
|
7
|
+
connecting a real model, flows, calling the Kindgi API from Python
|
|
8
|
+
(`kindgi.client`), and building an image. Load this when a Python
|
|
9
|
+
project has no `[tool.kindgi]` table yet and the user asks to "add
|
|
10
|
+
Kindgi", "make an agent", "set up a pack", or when you are orienting
|
|
11
|
+
in a Python pack (pyproject.toml with `[tool.kindgi]`) for the first
|
|
12
|
+
time. Authoring tools, guardrails and agents is covered by
|
|
13
|
+
kindgi-python-authoring-tools, kindgi-python-authoring-guardrails and
|
|
14
|
+
kindgi-python-authoring-agents; models by kindgi-authoring-providers.
|
|
15
|
+
type: core
|
|
16
|
+
library: "kindgi (Python)"
|
|
17
|
+
version: "0.1.0"
|
|
18
|
+
sdk_version: "0.0.0"
|
|
19
|
+
pack_languages: [python]
|
|
20
|
+
sources:
|
|
21
|
+
- sdks/python/README.md
|
|
22
|
+
- sdks/python/src/kindgi/pack/config.py
|
|
23
|
+
- sdks/python/src/kindgi/pack/discovery.py
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Getting started with Kindgi in Python
|
|
27
|
+
|
|
28
|
+
> **Running `kindgi`:** a Python pack has no Node project, so the
|
|
29
|
+
> `kindgi` CLI (a Node 22+ program) is the one on `PATH`. Python
|
|
30
|
+
> commands run in the pack's environment: `uv run …`.
|
|
31
|
+
|
|
32
|
+
## What a pack is
|
|
33
|
+
|
|
34
|
+
A **pack** is a project Kindgi indexes and runs. Its config is the
|
|
35
|
+
`[tool.kindgi]` table of `pyproject.toml`; its primitives live in four
|
|
36
|
+
folders, one or more per `.py` file, at module level:
|
|
37
|
+
|
|
38
|
+
- **Tools** (`tools/*.py`, `@tool`) — your Python code an agent or flow
|
|
39
|
+
calls.
|
|
40
|
+
- **Guardrails** (`guardrails/*.py`, `@guardrail`) — checks over an
|
|
41
|
+
agent's turn.
|
|
42
|
+
- **Agents** (`agents/*.py`, `Agent(...)`) — data: instructions, tools,
|
|
43
|
+
capabilities. The model runs in Kindgi.
|
|
44
|
+
- **Flows** (`flows/*.py`, `Flow(...)`) — data: steps (tool or agent
|
|
45
|
+
nodes) and the edges between them.
|
|
46
|
+
|
|
47
|
+
Kindgi runs the tools and checks in the pack's own Python process (the
|
|
48
|
+
pack service) and calls them over HTTP; everything else runs in the
|
|
49
|
+
Kindgi runtime. A module whose name starts with `_` is a helper, not a
|
|
50
|
+
primitive; `test_*.py`, `*_test.py` and `conftest.py` are skipped.
|
|
51
|
+
|
|
52
|
+
## Scaffold a new pack
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
kindgi init my-pack --template=python
|
|
56
|
+
cd my-pack
|
|
57
|
+
uv sync # .venv with the kindgi package
|
|
58
|
+
uv run pytest
|
|
59
|
+
kindgi dev # boots Kindgi locally and runs this pack, reloading on save
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`kindgi dev` needs Postgres: it starts one in Docker unless
|
|
63
|
+
`KINDGI_DATABASE_URL` points at yours. It runs the pack with
|
|
64
|
+
`.venv/bin/python` (or `dev.python` in `[tool.kindgi]`, e.g.
|
|
65
|
+
`["uv", "run", "python"]`), checks that interpreter can import
|
|
66
|
+
`kindgi`, and swaps the code on every save.
|
|
67
|
+
|
|
68
|
+
## Add Kindgi to an existing Python app
|
|
69
|
+
|
|
70
|
+
In the app's directory (where its `pyproject.toml` is):
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
kindgi init # --pack-id=<id> if the app's name doesn't make one
|
|
74
|
+
uv sync # or what it prints for Poetry / pip
|
|
75
|
+
kindgi dev
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`kindgi init` edits the app's `pyproject.toml` in place — your layout and
|
|
79
|
+
comments stay — appending the `[tool.kindgi]` tables (the pack id from
|
|
80
|
+
`[project].name`, or `[tool.poetry].name` in a Poetry 1 app; discovery
|
|
81
|
+
under `kindgi/`; in a Poetry app, `dev.python` runs `poetry run python`)
|
|
82
|
+
and adding `kindgi` to `[project].dependencies`; where it can't edit the
|
|
83
|
+
dependencies (Poetry 1, `dynamic`), it prints the command to run. It adds the `kindgi/tools`,
|
|
84
|
+
`guardrails`, `agents` and `flows` folders, these skills and `.gitignore`
|
|
85
|
+
entries. An app with a `package.json` too gets a TypeScript pack unless you
|
|
86
|
+
pass `--template=python`.
|
|
87
|
+
|
|
88
|
+
The pack root is on `sys.path`, so tools import the app's own packages by
|
|
89
|
+
name (`from acme.text import normalize`); inside `kindgi/`, import the pack's
|
|
90
|
+
modules relatively. Don't add an `__init__.py` to `kindgi/` — the folder
|
|
91
|
+
would then shadow the `kindgi` package. `kindgi dev` reads the app's `.env`
|
|
92
|
+
/ `.env.local` — keys already there reach the tools as environment
|
|
93
|
+
variables.
|
|
94
|
+
|
|
95
|
+
## Layout of the template
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
my-pack/
|
|
99
|
+
├── pyproject.toml # [tool.kindgi] — id, version, (discovery, dev, environments)
|
|
100
|
+
├── tools/echo.py, tools/greet.py # @tool
|
|
101
|
+
├── guardrails/response_not_empty.py # @guardrail
|
|
102
|
+
├── agents/echo_agent.py # Agent(...)
|
|
103
|
+
├── flows/echo_flow.py # Flow(...)
|
|
104
|
+
├── tests/test_tools.py # the tools and the check, called directly
|
|
105
|
+
├── README.md
|
|
106
|
+
└── .claude/skills/ # these skills (`kindgi skills sync` refreshes them)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The `[tool.kindgi]` keys are the ones `kindgi.config.ts` takes —
|
|
110
|
+
`pack`, `discovery`, `dev`, `env`, `environments` — spelled the same.
|
|
111
|
+
|
|
112
|
+
## First run
|
|
113
|
+
|
|
114
|
+
With `kindgi dev` running, from another terminal in the pack directory:
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
kindgi runs start --agent=my-pack.echo-agent --input='{"userMessage":"Ada"}'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The answer comes from `dev-echo`, a **fallback** provider a new pack
|
|
121
|
+
gets: no model, no key — it calls the first tool and replies "Tool
|
|
122
|
+
responded: …", and the turn carries a `fallback-provider` warning. For
|
|
123
|
+
a real model, put the key in `.env` and register a provider:
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
kindgi secrets set ANTHROPIC_API_KEY --env=local --scope=tenant # no-echo prompt
|
|
127
|
+
kindgi providers register --preset=anthropic
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
It takes over at the next turn. Details and other providers:
|
|
131
|
+
`kindgi-authoring-providers`.
|
|
132
|
+
|
|
133
|
+
`uv run python -m kindgi.pack index --pack-dir .` prints what Kindgi
|
|
134
|
+
sees (the index); `kindgi dev` reports a broken file with its path and
|
|
135
|
+
keeps serving the rest.
|
|
136
|
+
|
|
137
|
+
## Flows
|
|
138
|
+
|
|
139
|
+
A flow is data: nodes and edges (`flow.schema.json`). A node's `ref` may
|
|
140
|
+
be the `Tool` object:
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
# flows/record.py
|
|
144
|
+
from kindgi import Flow
|
|
145
|
+
|
|
146
|
+
from ..tools.ledger import record_expense
|
|
147
|
+
|
|
148
|
+
record = Flow(
|
|
149
|
+
id="acme.ledger.record-flow",
|
|
150
|
+
version="0.1.0",
|
|
151
|
+
nodes=[{"id": "record", "kind": "tool", "ref": record_expense}],
|
|
152
|
+
edges=[
|
|
153
|
+
{"id": "e-start", "from": "$start", "to": "record"},
|
|
154
|
+
{"id": "e-end", "from": "record", "to": "$end"},
|
|
155
|
+
],
|
|
156
|
+
)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
A node gets its single upstream node's output (the run input after
|
|
160
|
+
`$start`), or what its `inputMapping` says: each key a `{"literal": …}`
|
|
161
|
+
or a `{"path": …}` rooted at `runInput`, `state` or
|
|
162
|
+
`nodeOutputs.<nodeId>`. The indexer checks every flow against the
|
|
163
|
+
schema. Run one with `kindgi runs start --flow=<id> --input='{…}'`;
|
|
164
|
+
branches, loops and agent steps → `kindgi-python-authoring-flows`.
|
|
165
|
+
|
|
166
|
+
## Calling Kindgi from Python
|
|
167
|
+
|
|
168
|
+
`kindgi.client` covers the whole API:
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from kindgi.client import Kindgi
|
|
172
|
+
|
|
173
|
+
client = Kindgi() # KINDGI_API_URL + KINDGI_API_TOKEN, or Kindgi(url, token=…)
|
|
174
|
+
run = client.runs.start(agent="my-pack.echo-agent", input={"userMessage": "Ada"})
|
|
175
|
+
print(run.status, run.output["response"]["content"])
|
|
176
|
+
for event in client.runs.stream(str(run.id)):
|
|
177
|
+
print(event.kind)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
`AsyncKindgi` is the asyncio twin. `kindgi dev` prints the URL and the
|
|
181
|
+
token; `.kindgirc.json` in the pack holds them for the CLI.
|
|
182
|
+
|
|
183
|
+
## Build an image
|
|
184
|
+
|
|
185
|
+
`kindgi build --env=<name>` (an `[tool.kindgi.environments.<name>]`
|
|
186
|
+
block) builds the pack's image. Its dependencies install from the pack's
|
|
187
|
+
lockfile, frozen, main dependencies only: `uv.lock` (run `uv lock`
|
|
188
|
+
first), or in a Poetry app `poetry.lock` (`poetry lock`; the image brings
|
|
189
|
+
its own pinned Poetry). The index is built in the image; the pack service
|
|
190
|
+
is its entrypoint. An app with only `requirements.txt` can't build yet.
|
|
191
|
+
|
|
192
|
+
Debian packages the code needs (OCR, PDF tools, `libmagic`, …) are
|
|
193
|
+
declared in `pyproject.toml`; the image installs them, for the build and
|
|
194
|
+
at run time:
|
|
195
|
+
|
|
196
|
+
```toml
|
|
197
|
+
[tool.kindgi.image]
|
|
198
|
+
system-packages = ["tesseract-ocr", "poppler-utils"] # names, or name=version
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The variables the code reads from `os.environ` (a database URL, a bucket)
|
|
202
|
+
are declared too, names only. A deployed pack service missing a `required`
|
|
203
|
+
one isn't ready, and its `/readyz` names it:
|
|
204
|
+
|
|
205
|
+
```toml
|
|
206
|
+
[tool.kindgi.env]
|
|
207
|
+
required = ["DATABASE_URL"]
|
|
208
|
+
optional = ["SENTRY_DSN"]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
A `[tool.uv] required-version` that excludes the image's uv stops the
|
|
212
|
+
build before anything uploads, with the range to use.
|
|
213
|
+
|
|
214
|
+
## Two things need the human
|
|
215
|
+
|
|
216
|
+
- **The pack id and version** in `[tool.kindgi.pack]`. The id prefixes
|
|
217
|
+
every primitive (`<pack-id>.<name>`); pick it once.
|
|
218
|
+
- **Model credentials.** Ask for the key; never invent or hard-code one.
|
|
219
|
+
|
|
220
|
+
## Next
|
|
221
|
+
|
|
222
|
+
- A tool → `kindgi-python-authoring-tools`.
|
|
223
|
+
- A guardrail → `kindgi-python-authoring-guardrails`.
|
|
224
|
+
- An agent → `kindgi-python-authoring-agents`.
|
|
225
|
+
- A flow → `kindgi-python-authoring-flows`.
|
|
226
|
+
- A real model → `kindgi-authoring-providers`.
|
|
227
|
+
- An external resource (a database) for the coding agent →
|
|
228
|
+
`kindgi-authoring-mcp-servers`.
|
|
229
|
+
|
|
230
|
+
## Keeping skills up to date
|
|
231
|
+
|
|
232
|
+
`kindgi skills sync` refreshes `.claude/skills/` from the CLI's copy
|
|
233
|
+
(local edits are kept unless `--force`); `kindgi dev` says when they are
|
|
234
|
+
out of date.
|
|
235
|
+
|
|
236
|
+
## When the framework itself is the problem
|
|
237
|
+
|
|
238
|
+
If the bug is in Kindgi or the `kindgi` package and not in the pack's
|
|
239
|
+
code, load `kindgi-framework-feedback` and file it with
|
|
240
|
+
`kindgi feedback write`.
|
package/src/build.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@kindgi/sdk/build` — a TypeScript pack image's build extensions, for
|
|
6
|
+
* `image` in `kindgi.config.*` (`systemPackages`, `extensions`,
|
|
7
|
+
* `buildEnv`).
|
|
8
|
+
*
|
|
9
|
+
* Re-exports `@kindgi/handler-runtime/build-extensions` verbatim.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export { defineBuildExtension, prisma } from '@kindgi/handler-runtime/build-extensions';
|
|
13
|
+
export type {
|
|
14
|
+
BuildExtension,
|
|
15
|
+
BuildStep,
|
|
16
|
+
ImageConfig,
|
|
17
|
+
PrismaExtensionOptions,
|
|
18
|
+
} from '@kindgi/handler-runtime/build-extensions';
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@kindgi/sdk/client` — client callsite surface.
|
|
6
|
+
*
|
|
7
|
+
* Re-exports `createClient` plus every resource-client type, the error
|
|
8
|
+
* surface, transport primitives, and streaming helpers from the
|
|
9
|
+
* `@kindgi/client` package (`sdks/typescript/` in this repository).
|
|
10
|
+
* Names preserved verbatim.
|
|
11
|
+
*
|
|
12
|
+
* This sub-path intentionally does NOT re-export the branded ID types
|
|
13
|
+
* (`AgentId`, `RunId`, etc.) that `@kindgi/client` also happens to
|
|
14
|
+
* surface — those live in `@kindgi/sdk/types` to keep the flat barrel
|
|
15
|
+
* (`import { ... } from '@kindgi/sdk'`) collision-free.
|
|
16
|
+
*
|
|
17
|
+
* Callsite examples target
|
|
18
|
+
* `import { createClient } from '@kindgi/sdk/client'`.
|
|
19
|
+
*
|
|
20
|
+
* @module @kindgi/sdk/client
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// ---- Client factory + top-level shape ----
|
|
24
|
+
export { createClient } from '@kindgi/client';
|
|
25
|
+
export type { KindgiClient } from '@kindgi/client';
|
|
26
|
+
|
|
27
|
+
// ---- Resource client types + per-resource input shapes ----
|
|
28
|
+
export type {
|
|
29
|
+
AdapterConfigureInput,
|
|
30
|
+
AdapterFilter,
|
|
31
|
+
AdapterTestInput,
|
|
32
|
+
AdaptersClient,
|
|
33
|
+
AddMembershipInput,
|
|
34
|
+
AgentsClient,
|
|
35
|
+
ApplyProposalInput,
|
|
36
|
+
ApprovalFilter,
|
|
37
|
+
ApprovalsClient,
|
|
38
|
+
ArtifactFilter,
|
|
39
|
+
ArtifactsClient,
|
|
40
|
+
AuditClient,
|
|
41
|
+
AuditExportInput,
|
|
42
|
+
BatchDecideInput,
|
|
43
|
+
BudgetsClient,
|
|
44
|
+
CapabilitiesClient,
|
|
45
|
+
CapabilityFilter,
|
|
46
|
+
ClientOptions,
|
|
47
|
+
CompleteTokenInput,
|
|
48
|
+
ConversationFilter,
|
|
49
|
+
ConversationsClient,
|
|
50
|
+
CostClient,
|
|
51
|
+
DecideInput,
|
|
52
|
+
DraftProposalsInput,
|
|
53
|
+
EventsClient,
|
|
54
|
+
FactsClient,
|
|
55
|
+
FlowFilter,
|
|
56
|
+
FlowsClient,
|
|
57
|
+
FlowValidateResult,
|
|
58
|
+
GuardrailFilter,
|
|
59
|
+
GuardrailsClient,
|
|
60
|
+
LogsClient,
|
|
61
|
+
McpClient,
|
|
62
|
+
McpEndpointFilter,
|
|
63
|
+
McpEndpointsClient,
|
|
64
|
+
TeamMembershipsClient,
|
|
65
|
+
MemoryClient,
|
|
66
|
+
MessageFilter,
|
|
67
|
+
ObservationFilter,
|
|
68
|
+
ObservationsClient,
|
|
69
|
+
OrgsClient,
|
|
70
|
+
PackFilter,
|
|
71
|
+
PacksClient,
|
|
72
|
+
PageFilter,
|
|
73
|
+
PatternsInput,
|
|
74
|
+
PoliciesClient,
|
|
75
|
+
PolicyListFilter,
|
|
76
|
+
PolicyVersionsFilter,
|
|
77
|
+
ProposalDryRunInput,
|
|
78
|
+
ProposalListInput,
|
|
79
|
+
ProposalsClient,
|
|
80
|
+
ProvenanceClient,
|
|
81
|
+
ProvenanceExportInput,
|
|
82
|
+
ProviderFilter,
|
|
83
|
+
ProvidersClient,
|
|
84
|
+
ReflectReviewInput,
|
|
85
|
+
RegistryClient,
|
|
86
|
+
RegistryFilter,
|
|
87
|
+
ResumeRunInput,
|
|
88
|
+
ReviewerFilter,
|
|
89
|
+
ReviewersClient,
|
|
90
|
+
RollbackProposalInput,
|
|
91
|
+
Run,
|
|
92
|
+
RunsClient,
|
|
93
|
+
SchedulesClient,
|
|
94
|
+
SessionsClient,
|
|
95
|
+
StartRunInput,
|
|
96
|
+
SubmitForReviewInput,
|
|
97
|
+
SubscriptionsClient,
|
|
98
|
+
SupervisorClient,
|
|
99
|
+
ListTeamsFilter,
|
|
100
|
+
TeamsClient,
|
|
101
|
+
TenantClient,
|
|
102
|
+
TenantConfigClient,
|
|
103
|
+
TokenFilter,
|
|
104
|
+
TokensClient,
|
|
105
|
+
ReinstateToolVersionResult,
|
|
106
|
+
ToolFilter,
|
|
107
|
+
ToolVersionFilter,
|
|
108
|
+
ToolsClient,
|
|
109
|
+
Transport,
|
|
110
|
+
TransportRequest,
|
|
111
|
+
UsageClient,
|
|
112
|
+
UsageSummaryInput,
|
|
113
|
+
UserFilter,
|
|
114
|
+
UsersClient,
|
|
115
|
+
WebhooksClient,
|
|
116
|
+
WithdrawProposalInput,
|
|
117
|
+
} from '@kindgi/client';
|
|
118
|
+
|
|
119
|
+
// ---- Error surface ----
|
|
120
|
+
export { KindgiApiError, fromWire, notImplementedInPreview, notYetWired } from '@kindgi/client';
|
|
121
|
+
export type {
|
|
122
|
+
AuthError,
|
|
123
|
+
ConflictError,
|
|
124
|
+
GuardrailViolation,
|
|
125
|
+
GuardrailViolationError,
|
|
126
|
+
InvalidRequestError,
|
|
127
|
+
NetworkError,
|
|
128
|
+
NotFoundError,
|
|
129
|
+
NotImplementedInPreviewError,
|
|
130
|
+
NotYetWiredError,
|
|
131
|
+
RateLimitedError,
|
|
132
|
+
ServerError,
|
|
133
|
+
KindgiError,
|
|
134
|
+
} from '@kindgi/client';
|
|
135
|
+
|
|
136
|
+
// ---- Streaming helpers (SSE parser + resume) ----
|
|
137
|
+
export { readSse, unwrapSseData } from '@kindgi/client';
|
|
138
|
+
export type { SseEvent, SseReadOptions } from '@kindgi/client';
|
|
139
|
+
|
|
140
|
+
// ---- Following a run (browser-safe: a page follows a run with a public token) ----
|
|
141
|
+
export { followRun, subscribeToRun } from '@kindgi/client';
|
|
142
|
+
export type {
|
|
143
|
+
FollowRunOptions,
|
|
144
|
+
RunProgress,
|
|
145
|
+
RunProgressEvent,
|
|
146
|
+
SubscribeToRunOptions,
|
|
147
|
+
} from '@kindgi/client';
|
package/src/define.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@kindgi/sdk/define` — pack authoring surface.
|
|
6
|
+
*
|
|
7
|
+
* Re-exports the authoring primitives from the individual packages
|
|
8
|
+
* (`@kindgi/tools`, `@kindgi/guardrails`, `@kindgi/agents`,
|
|
9
|
+
* `@kindgi/flow`, `@kindgi/schema`) verbatim — no renaming, no
|
|
10
|
+
* behavior. Consumers reading those packages' docs find matching
|
|
11
|
+
* symbols here.
|
|
12
|
+
*
|
|
13
|
+
* The SDK facade is the recommended public developer surface. The
|
|
14
|
+
* individual packages remain importable directly.
|
|
15
|
+
*
|
|
16
|
+
* @module @kindgi/sdk/define
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// ---- Tools ----
|
|
20
|
+
export {
|
|
21
|
+
defineTool,
|
|
22
|
+
defineToolAsync,
|
|
23
|
+
invokeTool,
|
|
24
|
+
registerToolSpecSynthesizer,
|
|
25
|
+
} from '@kindgi/tools';
|
|
26
|
+
export type {
|
|
27
|
+
DefinedTool,
|
|
28
|
+
DefineToolSpec,
|
|
29
|
+
HttpAuthSpec,
|
|
30
|
+
HttpHeaderSpec,
|
|
31
|
+
HttpMethod,
|
|
32
|
+
HttpRequestBodySpec,
|
|
33
|
+
HttpToolSpec,
|
|
34
|
+
InferInput,
|
|
35
|
+
InferOutput,
|
|
36
|
+
Tool,
|
|
37
|
+
ToolContext,
|
|
38
|
+
ToolManifest,
|
|
39
|
+
ToolSecretRef,
|
|
40
|
+
ToolSpec,
|
|
41
|
+
ToolSpecSynthesizer,
|
|
42
|
+
} from '@kindgi/tools';
|
|
43
|
+
|
|
44
|
+
// ---- Guardrails (checks) ----
|
|
45
|
+
export { defineCheck } from '@kindgi/guardrails';
|
|
46
|
+
export type { DefineCheckSpec, DefinedCheck, InferCheckConfig } from '@kindgi/guardrails';
|
|
47
|
+
|
|
48
|
+
// ---- Agents ----
|
|
49
|
+
export { defineAgent } from '@kindgi/agents';
|
|
50
|
+
export type { Agent, DefineAgentSpec } from '@kindgi/agents';
|
|
51
|
+
|
|
52
|
+
// ---- Flow ----
|
|
53
|
+
//
|
|
54
|
+
// `defineFlow` is the author-facing primitive that mirrors `defineTool`
|
|
55
|
+
// / `defineCheck` / `defineAgent` — a thin wrapper over `loadFlow` that
|
|
56
|
+
// runs the same validation gauntlet and returns `Result<Flow,
|
|
57
|
+
// FlowError>`. Pack authors reach for `defineFlow` in TypeScript;
|
|
58
|
+
// `loadFlow` remains the wire-form entry point for JSON coming off disk
|
|
59
|
+
// / network.
|
|
60
|
+
export { defineFlow } from '@kindgi/flow';
|
|
61
|
+
export type {
|
|
62
|
+
EdgePolicy,
|
|
63
|
+
FanoutNode,
|
|
64
|
+
Flow,
|
|
65
|
+
FlowSpec,
|
|
66
|
+
LoopNode,
|
|
67
|
+
SubflowNode,
|
|
68
|
+
} from '@kindgi/flow';
|
|
69
|
+
|
|
70
|
+
// ---- Zod-optional helpers ----
|
|
71
|
+
//
|
|
72
|
+
// Direct access for callers that prefer to convert / inspect schemas
|
|
73
|
+
// themselves rather than let `defineTool` / `defineCheck` do it implicitly.
|
|
74
|
+
export { isZodSchema, toJSONSchema } from '@kindgi/schema';
|
|
75
|
+
export type { AnySchema, ZodLikeSchema } from '@kindgi/schema';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@kindgi/sdk` — public developer facade.
|
|
6
|
+
*
|
|
7
|
+
* Flat barrel that re-exports the three sub-paths for callers who prefer
|
|
8
|
+
* a single import: `import { defineTool, createClient, type RunId } from
|
|
9
|
+
* '@kindgi/sdk'`.
|
|
10
|
+
*
|
|
11
|
+
* Sub-paths are the primary developer-facing shape (`@kindgi/sdk/define`,
|
|
12
|
+
* `@kindgi/sdk/client`, `@kindgi/sdk/types`); this barrel is a
|
|
13
|
+
* convenience alias.
|
|
14
|
+
*
|
|
15
|
+
* @module @kindgi/sdk
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export * from './define.js';
|
|
19
|
+
export * from './client.js';
|
|
20
|
+
export * from './types.js';
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@kindgi/sdk/types` — branded IDs, framework-wide result envelope,
|
|
6
|
+
* pagination, refs, temporal + version primitives.
|
|
7
|
+
*
|
|
8
|
+
* Re-exports types from `@kindgi/types` under their own names. These
|
|
9
|
+
* are the workspace-wide identifiers callers pass across the SDK
|
|
10
|
+
* boundary.
|
|
11
|
+
*
|
|
12
|
+
* The /types sub-path is where branded identifiers live in the public
|
|
13
|
+
* facade.
|
|
14
|
+
*
|
|
15
|
+
* @module @kindgi/sdk/types
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export type {
|
|
19
|
+
BlobRef,
|
|
20
|
+
Brand,
|
|
21
|
+
ContentHash,
|
|
22
|
+
Cursor,
|
|
23
|
+
DatasetRef,
|
|
24
|
+
DurationMs,
|
|
25
|
+
ErrOf,
|
|
26
|
+
Filter,
|
|
27
|
+
IsoDuration,
|
|
28
|
+
OkOf,
|
|
29
|
+
Page,
|
|
30
|
+
Result,
|
|
31
|
+
SchemaMajor,
|
|
32
|
+
Semver,
|
|
33
|
+
SignatureValue,
|
|
34
|
+
Timestamp,
|
|
35
|
+
VersionedRef,
|
|
36
|
+
} from '@kindgi/types';
|
|
37
|
+
|
|
38
|
+
// ---- Branded IDs ----
|
|
39
|
+
//
|
|
40
|
+
// Re-exported individually rather than via `export type *` so the flat
|
|
41
|
+
// barrel (`import { RunId } from '@kindgi/sdk'`) can see them —
|
|
42
|
+
// `verbatimModuleSyntax` requires named type re-exports for `export *`
|
|
43
|
+
// forwarding to work through the barrel.
|
|
44
|
+
export type {
|
|
45
|
+
AgentId,
|
|
46
|
+
ApiTokenId,
|
|
47
|
+
ApprovalId,
|
|
48
|
+
ArtifactId,
|
|
49
|
+
AuditBundleId,
|
|
50
|
+
ComplianceEvidenceId,
|
|
51
|
+
ConversationId,
|
|
52
|
+
DatasetId,
|
|
53
|
+
EdgeId,
|
|
54
|
+
EventId,
|
|
55
|
+
FactId,
|
|
56
|
+
FixProposalId,
|
|
57
|
+
FlowId,
|
|
58
|
+
InstallationId,
|
|
59
|
+
GuardrailId,
|
|
60
|
+
KeyId,
|
|
61
|
+
LogEntryId,
|
|
62
|
+
NodeId,
|
|
63
|
+
ObservationId,
|
|
64
|
+
OrgId,
|
|
65
|
+
PackId,
|
|
66
|
+
PolicyId,
|
|
67
|
+
ProjectId,
|
|
68
|
+
ProvenanceId,
|
|
69
|
+
ProviderId,
|
|
70
|
+
ReviewerId,
|
|
71
|
+
RunId,
|
|
72
|
+
ScheduleId,
|
|
73
|
+
SessionId,
|
|
74
|
+
SigningKeyId,
|
|
75
|
+
SubscriptionId,
|
|
76
|
+
SupervisorId,
|
|
77
|
+
TeamId,
|
|
78
|
+
TenantId,
|
|
79
|
+
ThreadId,
|
|
80
|
+
ToolId,
|
|
81
|
+
TriggerId,
|
|
82
|
+
UserId,
|
|
83
|
+
WaitTokenId,
|
|
84
|
+
WebhookDeliveryId,
|
|
85
|
+
WebhookId,
|
|
86
|
+
} from '@kindgi/types';
|
package/src/webhooks.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@kindgi/sdk/webhooks` — receiving Kindgi's webhooks. Server only: it
|
|
6
|
+
* uses `node:crypto`, so it stays out of `/client` (browser-safe) and the
|
|
7
|
+
* flat barrel.
|
|
8
|
+
*
|
|
9
|
+
* Re-exports the Standard Webhooks helpers from `@kindgi/crypto`:
|
|
10
|
+
* `verifyWebhook` for a receiver, `generateWebhookSecret` for the secret an
|
|
11
|
+
* app registers by name, and `signWebhook` / `webhookHeaders` to test a
|
|
12
|
+
* receiver.
|
|
13
|
+
*
|
|
14
|
+
* @module @kindgi/sdk/webhooks
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
DEFAULT_WEBHOOK_TOLERANCE_SECONDS,
|
|
19
|
+
generateWebhookSecret,
|
|
20
|
+
isStrongWebhookSecret,
|
|
21
|
+
signWebhook,
|
|
22
|
+
verifyWebhook,
|
|
23
|
+
WEBHOOK_HEADERS,
|
|
24
|
+
WEBHOOK_SECRET_MIN_BYTES,
|
|
25
|
+
WEBHOOK_SECRET_PREFIX,
|
|
26
|
+
webhookHeaders,
|
|
27
|
+
} from '@kindgi/crypto';
|
|
28
|
+
export type {
|
|
29
|
+
SignWebhookInput,
|
|
30
|
+
VerifyWebhookFailure,
|
|
31
|
+
VerifyWebhookInput,
|
|
32
|
+
VerifyWebhookResult,
|
|
33
|
+
WebhookRequestHeaders,
|
|
34
|
+
} from '@kindgi/crypto';
|