@agentic-kit/harness 0.2.0 → 0.3.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/README.md +71 -88
- package/blueprint/blueprint-schema.d.ts +177 -134
- package/blueprint/blueprint-schema.js +90 -75
- package/esm/blueprint/blueprint-schema.d.ts +177 -134
- package/esm/blueprint/blueprint-schema.js +89 -74
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,119 +1,101 @@
|
|
|
1
1
|
# @agentic-kit/harness
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[`constructive-skills`](https://github.com/constructive-io/constructive-skills)
|
|
7
|
-
(plus optional overlays), so guidance stays fresh without a host release.
|
|
3
|
+
<p align="center" width="100%">
|
|
4
|
+
<img height="250" src="https://raw.githubusercontent.com/constructive-io/constructive/refs/heads/main/assets/outline-logo.svg" />
|
|
5
|
+
</p>
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
<p align="center" width="100%">
|
|
8
|
+
<a href="https://github.com/constructive-io/constructive/actions/workflows/run-tests.yaml">
|
|
9
|
+
<img height="20" src="https://github.com/constructive-io/constructive/actions/workflows/run-tests.yaml/badge.svg" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/constructive-io/constructive/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@agentic-kit/harness"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/constructive?filename=agentic%2Fharness%2Fpackage.json"/></a>
|
|
13
|
+
</p>
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Give your coding agent a backend. `@agentic-kit/harness` is the host-neutral core of the **Constructive harness** — skills releases, confirm gating, and blueprint logic that turn a generic coding agent into a secure, full-stack app builder.
|
|
14
16
|
|
|
17
|
+
```bash
|
|
18
|
+
npm install @agentic-kit/harness
|
|
15
19
|
```
|
|
16
|
-
@agentic-kit/protocol → agentic-kit → @agentic-kit/agent (LLM/runtime substrate)
|
|
17
|
-
↓
|
|
18
|
-
@agentic-kit/harness (this package)
|
|
19
|
-
↓
|
|
20
|
-
pi/Electron desktop adapter | terminal CLI | MCP server | exports
|
|
21
|
-
```
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
- `
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- Release fetching + freshness:
|
|
35
|
-
- `fetchSkillsRelease()` — resolves a pin (exact version, semver range, or
|
|
36
|
-
dist-tag) against the npm registry, downloads the tarball, verifies its
|
|
37
|
-
SRI integrity, and unpacks it to `data/skills/<version>/`. Already
|
|
38
|
-
downloaded releases are reused without network (offline fallback;
|
|
39
|
-
`latestLocalRelease()` picks the newest local one when the registry is
|
|
40
|
-
unreachable).
|
|
41
|
-
- `checkForSkillsUpdate()` — registry update check cached in
|
|
42
|
-
`cache/skills-update-check.json` (TTL, default 24h); only recommends
|
|
43
|
-
releases inside `compatibleSkillsRange`, and flags
|
|
44
|
-
`harnessUpgradeRequired` when newer skills need newer tool code. Never
|
|
45
|
-
throws — falls back to cache or "no update" offline.
|
|
46
|
-
- `fetchSkillsFromGit()` / `checkForSkillsUpdateFromGit()` — the same fetch
|
|
47
|
-
and update check straight from the GitHub repo (the skills repo is just a
|
|
48
|
-
git repository, released by tagging): a pin (tag, semver range against
|
|
49
|
-
tags, full commit SHA, or branch) resolves via the GitHub API, the
|
|
50
|
-
codeload tarball unpacks into the same `<skillsRoot>/<version>/` layout,
|
|
51
|
-
so caching, offline fallback (`latestLocalRelease()`), and
|
|
52
|
-
`DirectorySkillSource` work identically.
|
|
53
|
-
- Ordered-overlay skill resolution:
|
|
54
|
-
- `SkillsManifest` — ordered source layers, each with its own version pin
|
|
55
|
-
and include/exclude filters, plus `compatibleSkillsRange` so updaters
|
|
56
|
-
never adopt a skills release the installed tool code doesn't support.
|
|
57
|
-
- `DirectorySkillSource` — loads the agentskills.io layout
|
|
58
|
-
(`<skill>/SKILL.md` + references/scripts).
|
|
59
|
-
- `resolveSkills()` — last-write-wins merge across layers (hardened base →
|
|
60
|
-
team overlays → private known-gaps overlay), then transitive frontmatter
|
|
61
|
-
`requires:` expansion: a skill can declare skills it depends on
|
|
62
|
-
(`requires: [constructive-security]` or a YAML list) and they are pulled
|
|
63
|
-
in even when a layer's `include` filter omits them; explicit `exclude`
|
|
64
|
-
entries still win, and unresolvable requirements surface through
|
|
65
|
-
`onMissingRequire` instead of throwing.
|
|
66
|
-
- `materializeSkills()` — writes the merged tree with `{{VAR}}`
|
|
67
|
-
substitution (e.g. `HARNESS_TEMPLATES_DIR`).
|
|
68
|
-
|
|
69
|
-
- Tool-call gating (`src/gating/`, extracted from `constructive-desktop`):
|
|
70
|
-
- `createConfirmGate()` — host-neutral confirm gate for the mutating db
|
|
71
|
-
tools: per-run decline memory (a declined call re-issued with equivalent
|
|
72
|
-
args is auto-blocked without re-prompting), runnable-project/token
|
|
73
|
-
short-circuits, and blueprint/records/policy previews. Hosts inject a
|
|
74
|
-
`GateHost` (confirm UI + skip notification); the pi adapter maps pi's
|
|
75
|
-
`tool_call` extension event onto `GateToolCallEvent`/`GateResult` 1:1.
|
|
76
|
-
- `buildConfirmPrompt()` / `MUTATING_DB_TOOLS` / `ConfirmPreview` — the
|
|
77
|
-
per-tool confirmation copy and structured previews hosts render.
|
|
78
|
-
- Blueprint domain logic (`src/blueprint/`): `expandBlueprintDefaults()`
|
|
79
|
-
(derive Data* nodes, default grants, policy field defaults),
|
|
80
|
-
`BlueprintDefinitionSchema` (typebox), field type/default parsing, and the
|
|
81
|
-
vendored policy-provisioning config tables.
|
|
82
|
-
|
|
83
|
-
## Roadmap (per #1273)
|
|
84
|
-
|
|
85
|
-
- Typed db-tools (`provision_database`, `provision_blueprint`, `run_codegen`,
|
|
86
|
-
…) extracted from `constructive-desktop` against `HarnessContext` (needs
|
|
87
|
-
the generated modules ORM published or generated in-package).
|
|
88
|
-
- pi adapter, terminal CLI, and `.claude`/MCP export surfaces.
|
|
21
|
+
Code only: **no skills are bundled**. Skills are pulled at runtime from [`constructive-skills`](https://github.com/constructive-io/constructive-skills) (plus your overlays), so guidance stays fresh without a host release.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **Skill releases** — fetch a pinned release (npm version/range/dist-tag, or a git tag/semver/SHA/branch straight from GitHub), verified and cached under `~/.constructive/data/skills/<version>/`; offline falls back to the newest local release.
|
|
26
|
+
- **Ordered overlays** — layer skill sources (hardened base → team overlays → private known-gaps), last write wins by skill name, with include/exclude filters and transitive `requires:` expansion.
|
|
27
|
+
- **Confirm gating** — a host-neutral gate for mutating db tools: per-run decline memory (equivalent-args retries are auto-blocked), short-circuits for runnable projects, and structured previews your UI renders.
|
|
28
|
+
- **Blueprint logic** — `expandBlueprintDefaults()`, the zod `BlueprintZod`/JSON-Schema `BlueprintSchema`, field type/default parsing, and policy-provisioning tables.
|
|
29
|
+
- **Appstash state** — everything lives in the [`appstash`](https://www.npmjs.com/package/appstash) `~/.constructive/{config,cache,data,logs}` layout; project directories are untouched.
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
89
32
|
|
|
90
33
|
```ts
|
|
91
34
|
import {
|
|
92
35
|
DirectorySkillSource,
|
|
36
|
+
fetchSkillsFromGit,
|
|
93
37
|
harnessDirs,
|
|
94
38
|
materializeSkills,
|
|
95
39
|
resolveSkills,
|
|
96
40
|
} from '@agentic-kit/harness';
|
|
97
41
|
|
|
98
42
|
const dirs = harnessDirs();
|
|
43
|
+
|
|
44
|
+
const release = await fetchSkillsFromGit({
|
|
45
|
+
repo: 'constructive-io/constructive-skills',
|
|
46
|
+
pin: '^1.0.0',
|
|
47
|
+
skillsRoot: dirs.skillsRoot,
|
|
48
|
+
});
|
|
49
|
+
|
|
99
50
|
const skills = await resolveSkills(
|
|
100
51
|
{
|
|
101
|
-
sources: [
|
|
102
|
-
|
|
103
|
-
{ name: 'known-gaps', pin: 'abc1234' },
|
|
104
|
-
],
|
|
105
|
-
compatibleSkillsRange: '^1.2.0',
|
|
52
|
+
sources: [{ name: 'constructive-skills' }, { name: 'my-overlay' }],
|
|
53
|
+
compatibleSkillsRange: '^1.0.0',
|
|
106
54
|
},
|
|
107
55
|
[
|
|
108
|
-
new DirectorySkillSource('constructive-skills',
|
|
109
|
-
new DirectorySkillSource('
|
|
56
|
+
new DirectorySkillSource('constructive-skills', release.skillsDir),
|
|
57
|
+
new DirectorySkillSource('my-overlay', '/path/to/private/overlay'),
|
|
110
58
|
]
|
|
111
59
|
);
|
|
60
|
+
|
|
112
61
|
materializeSkills(dirs.materializedDir, skills, {
|
|
113
62
|
templateVars: { HARNESS_TEMPLATES_DIR: '/path/to/templates' },
|
|
114
63
|
});
|
|
115
64
|
```
|
|
116
65
|
|
|
66
|
+
## API surface
|
|
67
|
+
|
|
68
|
+
- **Contracts** — `HarnessContext` / `HarnessCredentials` / `GateRequest`: hosts inject cwd, endpoints, credentials, and a confirm gate; the core owns everything host-neutral.
|
|
69
|
+
- **Dirs** — `harnessDirs()`: downloaded releases under `data/skills/<version>`, merged tree under `cache/skills-materialized`, update-check metadata in `cache/`.
|
|
70
|
+
- **Fetching** — `fetchSkillsRelease()` (npm), `fetchSkillsFromGit()` (GitHub tags/SHAs/branches via codeload tarballs), `latestLocalRelease()` (offline).
|
|
71
|
+
- **Freshness** — `checkForSkillsUpdate()` / `checkForSkillsUpdateFromGit()`: TTL-cached update checks that never throw, respect `compatibleSkillsRange`, and flag `harnessUpgradeRequired` when newer skills need newer tool code.
|
|
72
|
+
- **Resolution** — `SkillsManifest`, `DirectorySkillSource` (agentskills.io layout: `<skill>/SKILL.md` + references/scripts), `resolveSkills()`, `materializeSkills()` with `{{VAR}}` substitution.
|
|
73
|
+
- **Gating** — `createConfirmGate()`, `buildConfirmPrompt()`, `MUTATING_DB_TOOLS`, `ConfirmPreview`; adapters map host events onto `GateToolCallEvent`/`GateResult` 1:1.
|
|
74
|
+
- **Blueprints** — `expandBlueprintDefaults()`, `BlueprintZod`/`BlueprintSchema`, field types/defaults, policy provisioning.
|
|
75
|
+
|
|
76
|
+
## Hosts
|
|
77
|
+
|
|
78
|
+
The same harness powers multiple hosts:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
@agentic-kit/protocol → agentic-kit → @agentic-kit/agent (LLM/runtime substrate)
|
|
82
|
+
↓
|
|
83
|
+
@agentic-kit/harness (this package)
|
|
84
|
+
↓
|
|
85
|
+
Constructive Desktop (Electron) | @agentic-kit/cli (`agent`) | your host
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Roadmap
|
|
89
|
+
|
|
90
|
+
- Typed db-tools (`provision_database`, `provision_blueprint`, `run_codegen`, …) extracted from Constructive Desktop against `HarnessContext`.
|
|
91
|
+
- Shared host adapter package and `.claude`/MCP export surfaces.
|
|
92
|
+
|
|
93
|
+
## Related
|
|
94
|
+
|
|
95
|
+
- [`@agentic-kit/cli`](https://www.npmjs.com/package/@agentic-kit/cli) — `agent`, a local, secure-by-default coding agent built on this harness.
|
|
96
|
+
- [`agentic-kit`](https://www.npmjs.com/package/agentic-kit) — the umbrella package (chat + agent + harness).
|
|
97
|
+
- Planning: [constructive-planning#1273](https://github.com/constructive-io/constructive-planning/issues/1273), [#1274](https://github.com/constructive-io/constructive-planning/issues/1274), [#1277](https://github.com/constructive-io/constructive-planning/issues/1277).
|
|
98
|
+
|
|
117
99
|
---
|
|
118
100
|
|
|
119
101
|
## Education and Tutorials
|
|
@@ -148,6 +130,7 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
|
|
|
148
130
|
### 🧪 Testing
|
|
149
131
|
|
|
150
132
|
* [pgsql-test](https://github.com/constructive-io/constructive/tree/main/postgres/pgsql-test): **📊 Isolated testing environments** with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
|
|
133
|
+
* [pglite-test](https://github.com/constructive-io/constructive/tree/main/postgres/pglite-test): **🪶 Drop-in pgsql-test replacement backed by PGlite** — in-process Postgres, no server required, instance-per-suite isolation.
|
|
151
134
|
* [pgsql-seed](https://github.com/constructive-io/constructive/tree/main/postgres/pgsql-seed): **🌱 PostgreSQL seeding utilities** for CSV, JSON, SQL data loading, and pgpm deployment.
|
|
152
135
|
* [supabase-test](https://github.com/constructive-io/constructive/tree/main/postgres/supabase-test): **🧪 Supabase-native test harness** preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.
|
|
153
136
|
* [graphile-test](https://github.com/constructive-io/constructive/tree/main/graphile/graphile-test): **🔐 Authentication mocking** for Graphile-focused test helpers and emulating row-level security contexts.
|
|
@@ -1,138 +1,181 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
name:
|
|
4
|
-
type:
|
|
5
|
-
is_required:
|
|
6
|
-
default:
|
|
7
|
-
}>;
|
|
8
|
-
declare const
|
|
9
|
-
$type:
|
|
10
|
-
data:
|
|
11
|
-
privileges:
|
|
12
|
-
policy_role:
|
|
13
|
-
permissive:
|
|
14
|
-
}>;
|
|
15
|
-
declare const
|
|
16
|
-
$type:
|
|
17
|
-
data:
|
|
18
|
-
}>]>;
|
|
19
|
-
declare const
|
|
20
|
-
$type:
|
|
21
|
-
source_table:
|
|
22
|
-
target_table:
|
|
23
|
-
field_name:
|
|
24
|
-
delete_action:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
junction_table_name: Type.TString;
|
|
31
|
-
delete_action: Type.TOptional<Type.TUnion<[Type.TLiteral<"c">, Type.TLiteral<"r">, Type.TLiteral<"n">, Type.TLiteral<"a">, Type.TLiteral<"d">]>>;
|
|
32
|
-
}>]>;
|
|
33
|
-
declare const TableBlueprint: Type.TObject<{
|
|
34
|
-
table_name: Type.TString;
|
|
35
|
-
nodes: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
36
|
-
$type: Type.TString;
|
|
37
|
-
data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
38
|
-
}>]>>>;
|
|
39
|
-
fields: Type.TOptional<Type.TArray<Type.TObject<{
|
|
40
|
-
name: Type.TString;
|
|
41
|
-
type: Type.TString;
|
|
42
|
-
is_required: Type.TOptional<Type.TBoolean>;
|
|
43
|
-
default: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
44
|
-
}>>>;
|
|
45
|
-
policies: Type.TArray<Type.TObject<{
|
|
46
|
-
$type: Type.TString;
|
|
47
|
-
data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
48
|
-
privileges: Type.TOptional<Type.TArray<Type.TString>>;
|
|
49
|
-
policy_role: Type.TOptional<Type.TString>;
|
|
50
|
-
permissive: Type.TOptional<Type.TBoolean>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const FieldBlueprintSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
type: z.ZodString;
|
|
5
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const PolicyBlueprintSchema: z.ZodObject<{
|
|
9
|
+
$type: z.ZodString;
|
|
10
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
+
privileges: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
policy_role: z.ZodOptional<z.ZodString>;
|
|
13
|
+
permissive: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
declare const NodeBlueprintSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
16
|
+
$type: z.ZodString;
|
|
17
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
18
|
+
}, z.core.$strip>]>;
|
|
19
|
+
declare const RelationBlueprintSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
20
|
+
$type: z.ZodLiteral<"RelationBelongsTo">;
|
|
21
|
+
source_table: z.ZodString;
|
|
22
|
+
target_table: z.ZodString;
|
|
23
|
+
field_name: z.ZodString;
|
|
24
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
25
|
+
c: "c";
|
|
26
|
+
r: "r";
|
|
27
|
+
n: "n";
|
|
28
|
+
a: "a";
|
|
29
|
+
d: "d";
|
|
51
30
|
}>>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
default: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
65
|
-
}>>>;
|
|
66
|
-
policies: Type.TArray<Type.TObject<{
|
|
67
|
-
$type: Type.TString;
|
|
68
|
-
data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
69
|
-
privileges: Type.TOptional<Type.TArray<Type.TString>>;
|
|
70
|
-
policy_role: Type.TOptional<Type.TString>;
|
|
71
|
-
permissive: Type.TOptional<Type.TBoolean>;
|
|
72
|
-
}>>;
|
|
31
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
$type: z.ZodLiteral<"RelationManyToMany">;
|
|
34
|
+
source_table: z.ZodString;
|
|
35
|
+
target_table: z.ZodString;
|
|
36
|
+
junction_table_name: z.ZodString;
|
|
37
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
c: "c";
|
|
39
|
+
r: "r";
|
|
40
|
+
n: "n";
|
|
41
|
+
a: "a";
|
|
42
|
+
d: "d";
|
|
73
43
|
}>>;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
44
|
+
}, z.core.$strip>]>;
|
|
45
|
+
declare const TableBlueprintSchema: z.ZodObject<{
|
|
46
|
+
table_name: z.ZodString;
|
|
47
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
48
|
+
$type: z.ZodString;
|
|
49
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
50
|
+
}, z.core.$strip>]>>>;
|
|
51
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
type: z.ZodString;
|
|
54
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
56
|
+
}, z.core.$strip>>>;
|
|
57
|
+
policies: z.ZodArray<z.ZodObject<{
|
|
58
|
+
$type: z.ZodString;
|
|
59
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
+
privileges: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
|
+
policy_role: z.ZodOptional<z.ZodString>;
|
|
62
|
+
permissive: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export declare const BlueprintDefinitionZod: z.ZodObject<{
|
|
66
|
+
tables: z.ZodArray<z.ZodObject<{
|
|
67
|
+
table_name: z.ZodString;
|
|
68
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
69
|
+
$type: z.ZodString;
|
|
70
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
71
|
+
}, z.core.$strip>]>>>;
|
|
72
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
type: z.ZodString;
|
|
75
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
77
|
+
}, z.core.$strip>>>;
|
|
78
|
+
policies: z.ZodArray<z.ZodObject<{
|
|
79
|
+
$type: z.ZodString;
|
|
80
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
|
+
privileges: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
+
policy_role: z.ZodOptional<z.ZodString>;
|
|
83
|
+
permissive: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
87
|
+
$type: z.ZodLiteral<"RelationBelongsTo">;
|
|
88
|
+
source_table: z.ZodString;
|
|
89
|
+
target_table: z.ZodString;
|
|
90
|
+
field_name: z.ZodString;
|
|
91
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
c: "c";
|
|
93
|
+
r: "r";
|
|
94
|
+
n: "n";
|
|
95
|
+
a: "a";
|
|
96
|
+
d: "d";
|
|
97
|
+
}>>;
|
|
98
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
100
|
+
$type: z.ZodLiteral<"RelationManyToMany">;
|
|
101
|
+
source_table: z.ZodString;
|
|
102
|
+
target_table: z.ZodString;
|
|
103
|
+
junction_table_name: z.ZodString;
|
|
104
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
105
|
+
c: "c";
|
|
106
|
+
r: "r";
|
|
107
|
+
n: "n";
|
|
108
|
+
a: "a";
|
|
109
|
+
d: "d";
|
|
112
110
|
}>>;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
111
|
+
}, z.core.$strip>]>>>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export declare const BlueprintZod: z.ZodObject<{
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
description: z.ZodString;
|
|
116
|
+
definition: z.ZodObject<{
|
|
117
|
+
tables: z.ZodArray<z.ZodObject<{
|
|
118
|
+
table_name: z.ZodString;
|
|
119
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
120
|
+
$type: z.ZodString;
|
|
121
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
122
|
+
}, z.core.$strip>]>>>;
|
|
123
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
type: z.ZodString;
|
|
126
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
128
|
+
}, z.core.$strip>>>;
|
|
129
|
+
policies: z.ZodArray<z.ZodObject<{
|
|
130
|
+
$type: z.ZodString;
|
|
131
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
|
+
privileges: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
|
+
policy_role: z.ZodOptional<z.ZodString>;
|
|
134
|
+
permissive: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
138
|
+
$type: z.ZodLiteral<"RelationBelongsTo">;
|
|
139
|
+
source_table: z.ZodString;
|
|
140
|
+
target_table: z.ZodString;
|
|
141
|
+
field_name: z.ZodString;
|
|
142
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
143
|
+
c: "c";
|
|
144
|
+
r: "r";
|
|
145
|
+
n: "n";
|
|
146
|
+
a: "a";
|
|
147
|
+
d: "d";
|
|
148
|
+
}>>;
|
|
149
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
$type: z.ZodLiteral<"RelationManyToMany">;
|
|
152
|
+
source_table: z.ZodString;
|
|
153
|
+
target_table: z.ZodString;
|
|
154
|
+
junction_table_name: z.ZodString;
|
|
155
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
156
|
+
c: "c";
|
|
157
|
+
r: "r";
|
|
158
|
+
n: "n";
|
|
159
|
+
a: "a";
|
|
160
|
+
d: "d";
|
|
161
|
+
}>>;
|
|
162
|
+
}, z.core.$strip>]>>>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
/**
|
|
168
|
+
* JSON Schema objects for hosts that hand tool parameter schemas to an agent
|
|
169
|
+
* runtime (e.g. pi's `ToolDefinition.parameters`). Same shapes the previous
|
|
170
|
+
* typebox exports produced.
|
|
171
|
+
*/
|
|
172
|
+
export declare const BlueprintDefinitionSchema: Record<string, unknown>;
|
|
173
|
+
export declare const BlueprintSchema: Record<string, unknown>;
|
|
174
|
+
export type Blueprint = z.infer<typeof BlueprintZod>;
|
|
175
|
+
export type BlueprintDefinition = z.infer<typeof BlueprintDefinitionZod>;
|
|
176
|
+
export type TableBlueprint = z.infer<typeof TableBlueprintSchema>;
|
|
177
|
+
export type FieldBlueprint = z.infer<typeof FieldBlueprintSchema>;
|
|
178
|
+
export type PolicyBlueprint = z.infer<typeof PolicyBlueprintSchema>;
|
|
179
|
+
export type RelationBlueprint = z.infer<typeof RelationBlueprintSchema>;
|
|
180
|
+
export type NodeBlueprint = z.infer<typeof NodeBlueprintSchema>;
|
|
138
181
|
export {};
|
|
@@ -1,86 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlueprintSchema = exports.BlueprintDefinitionSchema = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
name:
|
|
7
|
-
type:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
is_required:
|
|
11
|
-
default:
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
exports.BlueprintSchema = exports.BlueprintDefinitionSchema = exports.BlueprintZod = exports.BlueprintDefinitionZod = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const FieldBlueprintSchema = zod_1.z.object({
|
|
6
|
+
name: zod_1.z.string().describe('Field name in snake_case'),
|
|
7
|
+
type: zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.describe('PostgreSQL type: uuid, text, integer, smallint, numeric, boolean, date, timestamp, timestamptz, time, json, jsonb, inet, citext, email, url, image, upload'),
|
|
10
|
+
is_required: zod_1.z.boolean().optional().describe('Whether the field is NOT NULL'),
|
|
11
|
+
default: zod_1.z
|
|
12
|
+
.union([zod_1.z.string(), zod_1.z.null()])
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('SQL default expression, e.g. "uuidv7()", "now()", "\'draft\'"'),
|
|
14
15
|
});
|
|
15
|
-
const
|
|
16
|
-
$type:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
data:
|
|
20
|
-
privileges:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
const PolicyBlueprintSchema = zod_1.z.object({
|
|
17
|
+
$type: zod_1.z
|
|
18
|
+
.string()
|
|
19
|
+
.describe('Policy type: AuthzDirectOwner, AuthzEntityMembership, AuthzAllowAll, AuthzPublishable, AuthzAppMembership'),
|
|
20
|
+
data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional().describe('Policy config overrides'),
|
|
21
|
+
privileges: zod_1.z
|
|
22
|
+
.array(zod_1.z.string())
|
|
23
|
+
.optional()
|
|
24
|
+
.describe('SQL privileges this policy applies to, lowercase, e.g. ["select","insert","update","delete"]. Defaults to all.'),
|
|
25
|
+
policy_role: zod_1.z.string().optional().describe('Role name. Defaults to "authenticated".'),
|
|
26
|
+
permissive: zod_1.z
|
|
27
|
+
.boolean()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Whether permissive (true) or restrictive (false). Defaults to true.'),
|
|
27
30
|
});
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
$type:
|
|
32
|
-
data:
|
|
31
|
+
const NodeBlueprintSchema = zod_1.z.union([
|
|
32
|
+
zod_1.z.string().describe('Node type shorthand, e.g. "DataTimestamps"'),
|
|
33
|
+
zod_1.z.object({
|
|
34
|
+
$type: zod_1.z.string().describe('Node type, e.g. "DataDirectOwner"'),
|
|
35
|
+
data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional().describe('Node configuration data'),
|
|
33
36
|
}),
|
|
34
37
|
]);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const DeleteActionSchema = zod_1.z
|
|
39
|
+
.enum(['c', 'r', 'n', 'a', 'd'])
|
|
40
|
+
.describe('FK delete action: c=CASCADE, r=RESTRICT, n=SET NULL, a=NO ACTION (default), d=SET DEFAULT');
|
|
41
|
+
const BelongsToRelationSchema = zod_1.z.object({
|
|
42
|
+
$type: zod_1.z.literal('RelationBelongsTo'),
|
|
43
|
+
source_table: zod_1.z.string().describe('Source table name'),
|
|
44
|
+
target_table: zod_1.z.string().describe('Target table name'),
|
|
45
|
+
field_name: zod_1.z.string().describe('FK column name on the source table, e.g. "author_id"'),
|
|
46
|
+
delete_action: DeleteActionSchema.optional(),
|
|
47
|
+
is_required: zod_1.z.boolean().optional().describe('Whether the FK is NOT NULL (default: true)'),
|
|
43
48
|
});
|
|
44
|
-
const
|
|
45
|
-
$type:
|
|
46
|
-
source_table:
|
|
47
|
-
target_table:
|
|
48
|
-
|
|
49
|
-
delete_action:
|
|
50
|
-
is_required: typebox_1.Type.Optional(typebox_1.Type.Boolean({ description: 'Whether the FK is NOT NULL (default: true)' })),
|
|
49
|
+
const ManyToManyRelationSchema = zod_1.z.object({
|
|
50
|
+
$type: zod_1.z.literal('RelationManyToMany'),
|
|
51
|
+
source_table: zod_1.z.string().describe('Source table name'),
|
|
52
|
+
target_table: zod_1.z.string().describe('Target table name'),
|
|
53
|
+
junction_table_name: zod_1.z.string().describe('Junction table name, e.g. "post_tags"'),
|
|
54
|
+
delete_action: DeleteActionSchema.optional(),
|
|
51
55
|
});
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
description: 'Custom fields only — do NOT include id, timestamps, or node-generated fields (owner_id, entity_id, is_published, published_at)',
|
|
67
|
-
})),
|
|
68
|
-
policies: typebox_1.Type.Array(PolicyBlueprint, {
|
|
69
|
-
description: 'RLS policies for this table. At least one required.',
|
|
70
|
-
}),
|
|
56
|
+
const RelationBlueprintSchema = zod_1.z.union([BelongsToRelationSchema, ManyToManyRelationSchema]);
|
|
57
|
+
const TableBlueprintSchema = zod_1.z.object({
|
|
58
|
+
table_name: zod_1.z.string().describe('PostgreSQL table name in snake_case, plural'),
|
|
59
|
+
nodes: zod_1.z
|
|
60
|
+
.array(NodeBlueprintSchema)
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('Data behavior nodes (e.g. DataTimestamps, DataSoftDelete). DataId and DataTimestamps are auto-included.'),
|
|
63
|
+
fields: zod_1.z
|
|
64
|
+
.array(FieldBlueprintSchema)
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('Custom fields only — do NOT include id, timestamps, or node-generated fields (owner_id, entity_id, is_published, published_at)'),
|
|
67
|
+
policies: zod_1.z
|
|
68
|
+
.array(PolicyBlueprintSchema)
|
|
69
|
+
.describe('RLS policies for this table. At least one required.'),
|
|
71
70
|
});
|
|
72
|
-
exports.
|
|
73
|
-
tables:
|
|
74
|
-
relations:
|
|
71
|
+
exports.BlueprintDefinitionZod = zod_1.z.object({
|
|
72
|
+
tables: zod_1.z.array(TableBlueprintSchema).describe('Tables to create'),
|
|
73
|
+
relations: zod_1.z
|
|
74
|
+
.array(RelationBlueprintSchema)
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Relations between tables'),
|
|
75
77
|
});
|
|
76
|
-
exports.
|
|
77
|
-
name:
|
|
78
|
-
description:
|
|
79
|
-
definition: exports.
|
|
80
|
-
categories:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
exports.BlueprintZod = zod_1.z.object({
|
|
79
|
+
name: zod_1.z.string().describe('Blueprint name in snake_case'),
|
|
80
|
+
description: zod_1.z.string().describe('Brief description of what this schema is for'),
|
|
81
|
+
definition: exports.BlueprintDefinitionZod,
|
|
82
|
+
categories: zod_1.z
|
|
83
|
+
.array(zod_1.z.string())
|
|
84
|
+
.optional()
|
|
85
|
+
.describe('Template categories if saved as template, e.g. ["e-commerce", "healthcare"]'),
|
|
86
|
+
tags: zod_1.z
|
|
87
|
+
.array(zod_1.z.string())
|
|
88
|
+
.optional()
|
|
89
|
+
.describe('Freeform search tags if saved as template, e.g. ["products", "orders"]'),
|
|
86
90
|
});
|
|
91
|
+
/**
|
|
92
|
+
* JSON Schema objects for hosts that hand tool parameter schemas to an agent
|
|
93
|
+
* runtime (e.g. pi's `ToolDefinition.parameters`). Same shapes the previous
|
|
94
|
+
* typebox exports produced.
|
|
95
|
+
*/
|
|
96
|
+
exports.BlueprintDefinitionSchema = toJsonSchema(exports.BlueprintDefinitionZod);
|
|
97
|
+
exports.BlueprintSchema = toJsonSchema(exports.BlueprintZod);
|
|
98
|
+
function toJsonSchema(schema) {
|
|
99
|
+
const { $schema: _$schema, ...rest } = zod_1.z.toJSONSchema(schema, { target: 'draft-7' });
|
|
100
|
+
return rest;
|
|
101
|
+
}
|
|
@@ -1,138 +1,181 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
name:
|
|
4
|
-
type:
|
|
5
|
-
is_required:
|
|
6
|
-
default:
|
|
7
|
-
}>;
|
|
8
|
-
declare const
|
|
9
|
-
$type:
|
|
10
|
-
data:
|
|
11
|
-
privileges:
|
|
12
|
-
policy_role:
|
|
13
|
-
permissive:
|
|
14
|
-
}>;
|
|
15
|
-
declare const
|
|
16
|
-
$type:
|
|
17
|
-
data:
|
|
18
|
-
}>]>;
|
|
19
|
-
declare const
|
|
20
|
-
$type:
|
|
21
|
-
source_table:
|
|
22
|
-
target_table:
|
|
23
|
-
field_name:
|
|
24
|
-
delete_action:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
junction_table_name: Type.TString;
|
|
31
|
-
delete_action: Type.TOptional<Type.TUnion<[Type.TLiteral<"c">, Type.TLiteral<"r">, Type.TLiteral<"n">, Type.TLiteral<"a">, Type.TLiteral<"d">]>>;
|
|
32
|
-
}>]>;
|
|
33
|
-
declare const TableBlueprint: Type.TObject<{
|
|
34
|
-
table_name: Type.TString;
|
|
35
|
-
nodes: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
36
|
-
$type: Type.TString;
|
|
37
|
-
data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
38
|
-
}>]>>>;
|
|
39
|
-
fields: Type.TOptional<Type.TArray<Type.TObject<{
|
|
40
|
-
name: Type.TString;
|
|
41
|
-
type: Type.TString;
|
|
42
|
-
is_required: Type.TOptional<Type.TBoolean>;
|
|
43
|
-
default: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
44
|
-
}>>>;
|
|
45
|
-
policies: Type.TArray<Type.TObject<{
|
|
46
|
-
$type: Type.TString;
|
|
47
|
-
data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
48
|
-
privileges: Type.TOptional<Type.TArray<Type.TString>>;
|
|
49
|
-
policy_role: Type.TOptional<Type.TString>;
|
|
50
|
-
permissive: Type.TOptional<Type.TBoolean>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const FieldBlueprintSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
type: z.ZodString;
|
|
5
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const PolicyBlueprintSchema: z.ZodObject<{
|
|
9
|
+
$type: z.ZodString;
|
|
10
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
+
privileges: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
policy_role: z.ZodOptional<z.ZodString>;
|
|
13
|
+
permissive: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
declare const NodeBlueprintSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
16
|
+
$type: z.ZodString;
|
|
17
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
18
|
+
}, z.core.$strip>]>;
|
|
19
|
+
declare const RelationBlueprintSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
20
|
+
$type: z.ZodLiteral<"RelationBelongsTo">;
|
|
21
|
+
source_table: z.ZodString;
|
|
22
|
+
target_table: z.ZodString;
|
|
23
|
+
field_name: z.ZodString;
|
|
24
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
25
|
+
c: "c";
|
|
26
|
+
r: "r";
|
|
27
|
+
n: "n";
|
|
28
|
+
a: "a";
|
|
29
|
+
d: "d";
|
|
51
30
|
}>>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
default: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
65
|
-
}>>>;
|
|
66
|
-
policies: Type.TArray<Type.TObject<{
|
|
67
|
-
$type: Type.TString;
|
|
68
|
-
data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
69
|
-
privileges: Type.TOptional<Type.TArray<Type.TString>>;
|
|
70
|
-
policy_role: Type.TOptional<Type.TString>;
|
|
71
|
-
permissive: Type.TOptional<Type.TBoolean>;
|
|
72
|
-
}>>;
|
|
31
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
$type: z.ZodLiteral<"RelationManyToMany">;
|
|
34
|
+
source_table: z.ZodString;
|
|
35
|
+
target_table: z.ZodString;
|
|
36
|
+
junction_table_name: z.ZodString;
|
|
37
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
c: "c";
|
|
39
|
+
r: "r";
|
|
40
|
+
n: "n";
|
|
41
|
+
a: "a";
|
|
42
|
+
d: "d";
|
|
73
43
|
}>>;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
44
|
+
}, z.core.$strip>]>;
|
|
45
|
+
declare const TableBlueprintSchema: z.ZodObject<{
|
|
46
|
+
table_name: z.ZodString;
|
|
47
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
48
|
+
$type: z.ZodString;
|
|
49
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
50
|
+
}, z.core.$strip>]>>>;
|
|
51
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
type: z.ZodString;
|
|
54
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
56
|
+
}, z.core.$strip>>>;
|
|
57
|
+
policies: z.ZodArray<z.ZodObject<{
|
|
58
|
+
$type: z.ZodString;
|
|
59
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
+
privileges: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
|
+
policy_role: z.ZodOptional<z.ZodString>;
|
|
62
|
+
permissive: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export declare const BlueprintDefinitionZod: z.ZodObject<{
|
|
66
|
+
tables: z.ZodArray<z.ZodObject<{
|
|
67
|
+
table_name: z.ZodString;
|
|
68
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
69
|
+
$type: z.ZodString;
|
|
70
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
71
|
+
}, z.core.$strip>]>>>;
|
|
72
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
type: z.ZodString;
|
|
75
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
77
|
+
}, z.core.$strip>>>;
|
|
78
|
+
policies: z.ZodArray<z.ZodObject<{
|
|
79
|
+
$type: z.ZodString;
|
|
80
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
|
+
privileges: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
+
policy_role: z.ZodOptional<z.ZodString>;
|
|
83
|
+
permissive: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
87
|
+
$type: z.ZodLiteral<"RelationBelongsTo">;
|
|
88
|
+
source_table: z.ZodString;
|
|
89
|
+
target_table: z.ZodString;
|
|
90
|
+
field_name: z.ZodString;
|
|
91
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
c: "c";
|
|
93
|
+
r: "r";
|
|
94
|
+
n: "n";
|
|
95
|
+
a: "a";
|
|
96
|
+
d: "d";
|
|
97
|
+
}>>;
|
|
98
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
100
|
+
$type: z.ZodLiteral<"RelationManyToMany">;
|
|
101
|
+
source_table: z.ZodString;
|
|
102
|
+
target_table: z.ZodString;
|
|
103
|
+
junction_table_name: z.ZodString;
|
|
104
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
105
|
+
c: "c";
|
|
106
|
+
r: "r";
|
|
107
|
+
n: "n";
|
|
108
|
+
a: "a";
|
|
109
|
+
d: "d";
|
|
112
110
|
}>>;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
111
|
+
}, z.core.$strip>]>>>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export declare const BlueprintZod: z.ZodObject<{
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
description: z.ZodString;
|
|
116
|
+
definition: z.ZodObject<{
|
|
117
|
+
tables: z.ZodArray<z.ZodObject<{
|
|
118
|
+
table_name: z.ZodString;
|
|
119
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
120
|
+
$type: z.ZodString;
|
|
121
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
122
|
+
}, z.core.$strip>]>>>;
|
|
123
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
type: z.ZodString;
|
|
126
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
128
|
+
}, z.core.$strip>>>;
|
|
129
|
+
policies: z.ZodArray<z.ZodObject<{
|
|
130
|
+
$type: z.ZodString;
|
|
131
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
|
+
privileges: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
|
+
policy_role: z.ZodOptional<z.ZodString>;
|
|
134
|
+
permissive: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
138
|
+
$type: z.ZodLiteral<"RelationBelongsTo">;
|
|
139
|
+
source_table: z.ZodString;
|
|
140
|
+
target_table: z.ZodString;
|
|
141
|
+
field_name: z.ZodString;
|
|
142
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
143
|
+
c: "c";
|
|
144
|
+
r: "r";
|
|
145
|
+
n: "n";
|
|
146
|
+
a: "a";
|
|
147
|
+
d: "d";
|
|
148
|
+
}>>;
|
|
149
|
+
is_required: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
$type: z.ZodLiteral<"RelationManyToMany">;
|
|
152
|
+
source_table: z.ZodString;
|
|
153
|
+
target_table: z.ZodString;
|
|
154
|
+
junction_table_name: z.ZodString;
|
|
155
|
+
delete_action: z.ZodOptional<z.ZodEnum<{
|
|
156
|
+
c: "c";
|
|
157
|
+
r: "r";
|
|
158
|
+
n: "n";
|
|
159
|
+
a: "a";
|
|
160
|
+
d: "d";
|
|
161
|
+
}>>;
|
|
162
|
+
}, z.core.$strip>]>>>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
/**
|
|
168
|
+
* JSON Schema objects for hosts that hand tool parameter schemas to an agent
|
|
169
|
+
* runtime (e.g. pi's `ToolDefinition.parameters`). Same shapes the previous
|
|
170
|
+
* typebox exports produced.
|
|
171
|
+
*/
|
|
172
|
+
export declare const BlueprintDefinitionSchema: Record<string, unknown>;
|
|
173
|
+
export declare const BlueprintSchema: Record<string, unknown>;
|
|
174
|
+
export type Blueprint = z.infer<typeof BlueprintZod>;
|
|
175
|
+
export type BlueprintDefinition = z.infer<typeof BlueprintDefinitionZod>;
|
|
176
|
+
export type TableBlueprint = z.infer<typeof TableBlueprintSchema>;
|
|
177
|
+
export type FieldBlueprint = z.infer<typeof FieldBlueprintSchema>;
|
|
178
|
+
export type PolicyBlueprint = z.infer<typeof PolicyBlueprintSchema>;
|
|
179
|
+
export type RelationBlueprint = z.infer<typeof RelationBlueprintSchema>;
|
|
180
|
+
export type NodeBlueprint = z.infer<typeof NodeBlueprintSchema>;
|
|
138
181
|
export {};
|
|
@@ -1,83 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
name:
|
|
4
|
-
type:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
is_required:
|
|
8
|
-
default:
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const FieldBlueprintSchema = z.object({
|
|
3
|
+
name: z.string().describe('Field name in snake_case'),
|
|
4
|
+
type: z
|
|
5
|
+
.string()
|
|
6
|
+
.describe('PostgreSQL type: uuid, text, integer, smallint, numeric, boolean, date, timestamp, timestamptz, time, json, jsonb, inet, citext, email, url, image, upload'),
|
|
7
|
+
is_required: z.boolean().optional().describe('Whether the field is NOT NULL'),
|
|
8
|
+
default: z
|
|
9
|
+
.union([z.string(), z.null()])
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('SQL default expression, e.g. "uuidv7()", "now()", "\'draft\'"'),
|
|
11
12
|
});
|
|
12
|
-
const
|
|
13
|
-
$type:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
data:
|
|
17
|
-
privileges:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const PolicyBlueprintSchema = z.object({
|
|
14
|
+
$type: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe('Policy type: AuthzDirectOwner, AuthzEntityMembership, AuthzAllowAll, AuthzPublishable, AuthzAppMembership'),
|
|
17
|
+
data: z.record(z.string(), z.unknown()).optional().describe('Policy config overrides'),
|
|
18
|
+
privileges: z
|
|
19
|
+
.array(z.string())
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('SQL privileges this policy applies to, lowercase, e.g. ["select","insert","update","delete"]. Defaults to all.'),
|
|
22
|
+
policy_role: z.string().optional().describe('Role name. Defaults to "authenticated".'),
|
|
23
|
+
permissive: z
|
|
24
|
+
.boolean()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Whether permissive (true) or restrictive (false). Defaults to true.'),
|
|
24
27
|
});
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
$type:
|
|
29
|
-
data:
|
|
28
|
+
const NodeBlueprintSchema = z.union([
|
|
29
|
+
z.string().describe('Node type shorthand, e.g. "DataTimestamps"'),
|
|
30
|
+
z.object({
|
|
31
|
+
$type: z.string().describe('Node type, e.g. "DataDirectOwner"'),
|
|
32
|
+
data: z.record(z.string(), z.unknown()).optional().describe('Node configuration data'),
|
|
30
33
|
}),
|
|
31
34
|
]);
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const DeleteActionSchema = z
|
|
36
|
+
.enum(['c', 'r', 'n', 'a', 'd'])
|
|
37
|
+
.describe('FK delete action: c=CASCADE, r=RESTRICT, n=SET NULL, a=NO ACTION (default), d=SET DEFAULT');
|
|
38
|
+
const BelongsToRelationSchema = z.object({
|
|
39
|
+
$type: z.literal('RelationBelongsTo'),
|
|
40
|
+
source_table: z.string().describe('Source table name'),
|
|
41
|
+
target_table: z.string().describe('Target table name'),
|
|
42
|
+
field_name: z.string().describe('FK column name on the source table, e.g. "author_id"'),
|
|
43
|
+
delete_action: DeleteActionSchema.optional(),
|
|
44
|
+
is_required: z.boolean().optional().describe('Whether the FK is NOT NULL (default: true)'),
|
|
40
45
|
});
|
|
41
|
-
const
|
|
42
|
-
$type:
|
|
43
|
-
source_table:
|
|
44
|
-
target_table:
|
|
45
|
-
|
|
46
|
-
delete_action:
|
|
47
|
-
is_required: Type.Optional(Type.Boolean({ description: 'Whether the FK is NOT NULL (default: true)' })),
|
|
46
|
+
const ManyToManyRelationSchema = z.object({
|
|
47
|
+
$type: z.literal('RelationManyToMany'),
|
|
48
|
+
source_table: z.string().describe('Source table name'),
|
|
49
|
+
target_table: z.string().describe('Target table name'),
|
|
50
|
+
junction_table_name: z.string().describe('Junction table name, e.g. "post_tags"'),
|
|
51
|
+
delete_action: DeleteActionSchema.optional(),
|
|
48
52
|
});
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
description: 'Custom fields only — do NOT include id, timestamps, or node-generated fields (owner_id, entity_id, is_published, published_at)',
|
|
64
|
-
})),
|
|
65
|
-
policies: Type.Array(PolicyBlueprint, {
|
|
66
|
-
description: 'RLS policies for this table. At least one required.',
|
|
67
|
-
}),
|
|
53
|
+
const RelationBlueprintSchema = z.union([BelongsToRelationSchema, ManyToManyRelationSchema]);
|
|
54
|
+
const TableBlueprintSchema = z.object({
|
|
55
|
+
table_name: z.string().describe('PostgreSQL table name in snake_case, plural'),
|
|
56
|
+
nodes: z
|
|
57
|
+
.array(NodeBlueprintSchema)
|
|
58
|
+
.optional()
|
|
59
|
+
.describe('Data behavior nodes (e.g. DataTimestamps, DataSoftDelete). DataId and DataTimestamps are auto-included.'),
|
|
60
|
+
fields: z
|
|
61
|
+
.array(FieldBlueprintSchema)
|
|
62
|
+
.optional()
|
|
63
|
+
.describe('Custom fields only — do NOT include id, timestamps, or node-generated fields (owner_id, entity_id, is_published, published_at)'),
|
|
64
|
+
policies: z
|
|
65
|
+
.array(PolicyBlueprintSchema)
|
|
66
|
+
.describe('RLS policies for this table. At least one required.'),
|
|
68
67
|
});
|
|
69
|
-
export const
|
|
70
|
-
tables:
|
|
71
|
-
relations:
|
|
68
|
+
export const BlueprintDefinitionZod = z.object({
|
|
69
|
+
tables: z.array(TableBlueprintSchema).describe('Tables to create'),
|
|
70
|
+
relations: z
|
|
71
|
+
.array(RelationBlueprintSchema)
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('Relations between tables'),
|
|
72
74
|
});
|
|
73
|
-
export const
|
|
74
|
-
name:
|
|
75
|
-
description:
|
|
76
|
-
definition:
|
|
77
|
-
categories:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
export const BlueprintZod = z.object({
|
|
76
|
+
name: z.string().describe('Blueprint name in snake_case'),
|
|
77
|
+
description: z.string().describe('Brief description of what this schema is for'),
|
|
78
|
+
definition: BlueprintDefinitionZod,
|
|
79
|
+
categories: z
|
|
80
|
+
.array(z.string())
|
|
81
|
+
.optional()
|
|
82
|
+
.describe('Template categories if saved as template, e.g. ["e-commerce", "healthcare"]'),
|
|
83
|
+
tags: z
|
|
84
|
+
.array(z.string())
|
|
85
|
+
.optional()
|
|
86
|
+
.describe('Freeform search tags if saved as template, e.g. ["products", "orders"]'),
|
|
83
87
|
});
|
|
88
|
+
/**
|
|
89
|
+
* JSON Schema objects for hosts that hand tool parameter schemas to an agent
|
|
90
|
+
* runtime (e.g. pi's `ToolDefinition.parameters`). Same shapes the previous
|
|
91
|
+
* typebox exports produced.
|
|
92
|
+
*/
|
|
93
|
+
export const BlueprintDefinitionSchema = toJsonSchema(BlueprintDefinitionZod);
|
|
94
|
+
export const BlueprintSchema = toJsonSchema(BlueprintZod);
|
|
95
|
+
function toJsonSchema(schema) {
|
|
96
|
+
const { $schema: _$schema, ...rest } = z.toJSONSchema(schema, { target: 'draft-7' });
|
|
97
|
+
return rest;
|
|
98
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-kit/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
5
5
|
"description": "Host-agnostic Constructive harness core — skill overlay resolution, materialization, and on-disk layout for harness hosts (desktop, CLI, MCP)",
|
|
6
6
|
"main": "index.js",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"appstash": "^0.7.0",
|
|
33
33
|
"semver": "^7.7.2",
|
|
34
34
|
"tar": "^7.4.3",
|
|
35
|
-
"
|
|
35
|
+
"zod": "^4.4.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/semver": "^7.7.0"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [],
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "6f85eefed51d88b3a857ff36d20da44b7ebb47c9"
|
|
42
42
|
}
|