skillscript-runtime 0.13.8 → 0.14.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/README.md +11 -11
- package/dist/bootstrap.d.ts +13 -13
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +31 -31
- package/dist/bootstrap.js.map +1 -1
- package/dist/cli.js +6 -6
- package/dist/cli.js.map +1 -1
- package/dist/compile.js +2 -2
- package/dist/compile.js.map +1 -1
- package/dist/connectors/config.d.ts +4 -4
- package/dist/connectors/config.d.ts.map +1 -1
- package/dist/connectors/config.js +7 -7
- package/dist/connectors/config.js.map +1 -1
- package/dist/connectors/{memory-store-mcp.d.ts → data-store-mcp.d.ts} +8 -8
- package/dist/connectors/data-store-mcp.d.ts.map +1 -0
- package/dist/connectors/{memory-store-mcp.js → data-store-mcp.js} +31 -31
- package/dist/connectors/data-store-mcp.js.map +1 -0
- package/dist/connectors/{memory-store.d.ts → data-store.d.ts} +12 -12
- package/dist/connectors/data-store.d.ts.map +1 -0
- package/dist/connectors/{memory-store.js → data-store.js} +7 -7
- package/dist/connectors/data-store.js.map +1 -0
- package/dist/connectors/index.d.ts +5 -5
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +7 -7
- package/dist/connectors/index.js.map +1 -1
- package/dist/connectors/local-model-mcp.js +1 -1
- package/dist/connectors/local-model-mcp.js.map +1 -1
- package/dist/connectors/registry.d.ts +10 -10
- package/dist/connectors/registry.d.ts.map +1 -1
- package/dist/connectors/registry.js +11 -11
- package/dist/connectors/registry.js.map +1 -1
- package/dist/connectors/sqlite-skill-store.js +1 -1
- package/dist/connectors/sqlite-skill-store.js.map +1 -1
- package/dist/connectors/types.d.ts +23 -23
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/connectors/types.js +2 -2
- package/dist/connectors/types.js.map +1 -1
- package/dist/dashboard/spa/app.js +2 -2
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +4 -4
- package/dist/errors.js.map +1 -1
- package/dist/help-content.js +27 -27
- package/dist/help-content.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/lint.js +18 -18
- package/dist/lint.js.map +1 -1
- package/dist/mcp-server.d.ts +1 -1
- package/dist/mcp-server.js +10 -10
- package/dist/mcp-server.js.map +1 -1
- package/dist/runtime-config.d.ts +2 -2
- package/dist/runtime-config.d.ts.map +1 -1
- package/dist/runtime-config.js +1 -1
- package/dist/runtime-config.js.map +1 -1
- package/dist/runtime.js +6 -6
- package/dist/runtime.js.map +1 -1
- package/dist/skill-manager.js +1 -1
- package/dist/skill-manager.js.map +1 -1
- package/dist/testing/conformance.d.ts +8 -8
- package/dist/testing/conformance.d.ts.map +1 -1
- package/dist/testing/conformance.js +8 -8
- package/dist/testing/conformance.js.map +1 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/trace.d.ts +3 -3
- package/docs/adopter-playbook.md +18 -18
- package/docs/configuration.md +8 -8
- package/docs/connector-contract-reference.md +9 -9
- package/docs/language-reference.md +38 -63
- package/docs/sqlite-skill-store.md +1 -1
- package/examples/README.md +5 -5
- package/examples/connectors/{MemoryStoreTemplate/MemoryStoreTemplate.ts → DataStoreTemplate/DataStoreTemplate.ts} +34 -34
- package/examples/connectors/{MemoryStoreTemplate → DataStoreTemplate}/README.md +36 -36
- package/examples/connectors/LocalModelTemplate/README.md +1 -1
- package/examples/connectors/McpConnectorTemplate/McpConnectorTemplate.ts +2 -2
- package/examples/connectors/McpConnectorTemplate/README.md +5 -5
- package/examples/connectors/README.md +3 -3
- package/examples/connectors/SkillStoreTemplate/README.md +1 -1
- package/examples/connectors/SkillStoreTemplate/SkillStoreTemplate.ts +1 -1
- package/examples/custom-bootstrap.example.ts +8 -8
- package/examples/onboarding-scaffold/README.md +7 -7
- package/examples/onboarding-scaffold/bootstrap.ts +10 -10
- package/examples/onboarding-scaffold/{file-memory-store.ts → file-data-store.ts} +18 -18
- package/examples/skillscripts/classify-support-ticket.skill.md +4 -4
- package/examples/skillscripts/doc-qa-with-citations.skill.md +1 -1
- package/examples/skillscripts/feedback-sentiment-scan.skill.md +3 -3
- package/examples/skillscripts/hello.skill.provenance.json +1 -1
- package/examples/skillscripts/morning-brief.skill.md +3 -3
- package/examples/skillscripts/service-health-watch.skill.md +1 -1
- package/package.json +1 -1
- package/scaffold/config.toml +2 -2
- package/scaffold/connectors.json +3 -3
- package/dist/connectors/memory-store-mcp.d.ts.map +0 -1
- package/dist/connectors/memory-store-mcp.js.map +0 -1
- package/dist/connectors/memory-store.d.ts.map +0 -1
- package/dist/connectors/memory-store.js.map +0 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* DataStoreTemplate — fork-me skeleton for writing your own DataStore impl.
|
|
3
3
|
*
|
|
4
4
|
* This is NOT a runnable connector. Every method throws a "TODO" error. The
|
|
5
|
-
* purpose is to surface the
|
|
5
|
+
* purpose is to surface the DataStore contract surface in a copy-and-customize
|
|
6
6
|
* shape so adopters writing AMP-, Pinecone-, Weaviate-, Qdrant-, or
|
|
7
|
-
* Postgres-backed
|
|
7
|
+
* Postgres-backed DataStores have a starting skeleton.
|
|
8
8
|
*
|
|
9
9
|
* Forking workflow:
|
|
10
|
-
* 1. Copy this directory into your codebase (`cp -r examples/connectors/
|
|
11
|
-
* 2. Rename the class — typically `<Substrate>
|
|
10
|
+
* 1. Copy this directory into your codebase (`cp -r examples/connectors/DataStoreTemplate examples/connectors/MyDataStore`)
|
|
11
|
+
* 2. Rename the class — typically `<Substrate>DataStore` (e.g., `PineconeDataStore`, `AmpDataStore`)
|
|
12
12
|
* 3. Implement each method against your substrate's API
|
|
13
13
|
* 4. Update `staticCapabilities()` to declare what your impl actually supports
|
|
14
14
|
* 5. Register from your adopter bootstrap:
|
|
15
|
-
* `registry.
|
|
15
|
+
* `registry.registerDataStore("primary", new MyDataStore({ ... }))`
|
|
16
16
|
* 6. Validate via the conformance suite:
|
|
17
|
-
* `
|
|
17
|
+
* `DataStoreConformance.buildTests({ build: () => new MyDataStore(...), ctor: MyDataStore })`
|
|
18
18
|
*
|
|
19
|
-
* See `src/connectors/
|
|
20
|
-
* (`
|
|
21
|
-
* `src/connectors/types.ts` (`
|
|
22
|
-
* `QueryFilters` + `
|
|
19
|
+
* See `src/connectors/data-store.ts` for the working reference implementation
|
|
20
|
+
* (`SqliteDataStore` — SQLite + FTS5 backing). The full contract spec lives in
|
|
21
|
+
* `src/connectors/types.ts` (`DataStore` interface + `PortableData` +
|
|
22
|
+
* `QueryFilters` + `DataWrite` types).
|
|
23
23
|
*
|
|
24
|
-
* Runtime hosts (MCP server + web dashboard) honor whichever
|
|
24
|
+
* Runtime hosts (MCP server + web dashboard) honor whichever DataStore impl
|
|
25
25
|
* you register via the registry, so once your fork passes the conformance
|
|
26
|
-
* suite the entire `$
|
|
26
|
+
* suite the entire `$ data_read` / `$ data_write` dispatch path reads + writes
|
|
27
27
|
* against your substrate.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import type {
|
|
31
|
-
|
|
31
|
+
DataStore,
|
|
32
32
|
QueryFilters,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
PortableData,
|
|
34
|
+
DataWrite,
|
|
35
|
+
DataWriteRecord,
|
|
36
|
+
DataStoreCapabilities,
|
|
37
37
|
ManifestInfo,
|
|
38
38
|
} from "skillscript-runtime/connectors";
|
|
39
39
|
|
|
40
40
|
/** Replace with your substrate's connection config (host, dbName, API key, etc.). */
|
|
41
|
-
export interface
|
|
41
|
+
export interface DataStoreTemplateConfig {
|
|
42
42
|
// TODO — declare the fields your substrate needs to connect.
|
|
43
43
|
// Examples:
|
|
44
44
|
// pineconeApiKey?: string;
|
|
@@ -48,16 +48,16 @@ export interface MemoryStoreTemplateConfig {
|
|
|
48
48
|
exampleConfigField?: string;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export class
|
|
51
|
+
export class DataStoreTemplate implements DataStore {
|
|
52
52
|
/**
|
|
53
53
|
* Declare what your impl supports. The runtime + lint consult these flags
|
|
54
54
|
* before exercising features. Set conservatively — overclaiming triggers
|
|
55
55
|
* cryptic downstream failures; underclaiming hides usable features.
|
|
56
56
|
*/
|
|
57
|
-
static staticCapabilities():
|
|
57
|
+
static staticCapabilities(): DataStoreCapabilities {
|
|
58
58
|
return {
|
|
59
|
-
connector_type: "
|
|
60
|
-
implementation: "
|
|
59
|
+
connector_type: "data_store",
|
|
60
|
+
implementation: "DataStoreTemplate", // ← rename to your class name
|
|
61
61
|
contract_version: "1.0.0",
|
|
62
62
|
features: {
|
|
63
63
|
// TODO — set each flag based on what your substrate can actually do.
|
|
@@ -73,29 +73,29 @@ export class MemoryStoreTemplate implements MemoryStore {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
76
|
-
constructor(_config:
|
|
76
|
+
constructor(_config: DataStoreTemplateConfig) {
|
|
77
77
|
// TODO — establish your substrate connection. For SQL: open the database
|
|
78
78
|
// + run schema migrations. For vector DB: cache the SDK client + index
|
|
79
79
|
// name. For HTTP: store the base URL + auth headers.
|
|
80
|
-
throw new Error("
|
|
80
|
+
throw new Error("DataStoreTemplate is a fork-me skeleton; replace with your impl.");
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Capability snapshot for `runtime_capabilities` discovery. Return free-form
|
|
85
85
|
* substrate-specific metadata (kind, version, supported modes, score range, etc.).
|
|
86
86
|
*
|
|
87
|
-
* The bundled `
|
|
87
|
+
* The bundled `SqliteDataStore.manifest()` returns:
|
|
88
88
|
* { capabilities_version: "1", manifest: { kind: "sqlite-fts",
|
|
89
89
|
* supported_modes: ["fts"], score_range: "unbounded",
|
|
90
90
|
* supported_filters: ["domain_tags"], supports_write: true } }
|
|
91
91
|
*/
|
|
92
|
-
async manifest(): Promise<ManifestInfo<"
|
|
92
|
+
async manifest(): Promise<ManifestInfo<"data_store">> {
|
|
93
93
|
// TODO — return a snapshot of your substrate's capabilities.
|
|
94
94
|
throw new Error("TODO: manifest() — return substrate-specific capability snapshot.");
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* Query memories by mode + filter. Return `
|
|
98
|
+
* Query memories by mode + filter. Return `PortableData[]` ordered by
|
|
99
99
|
* relevance (most relevant first). Empty result is fine; never throw "not
|
|
100
100
|
* found" — return [].
|
|
101
101
|
*
|
|
@@ -109,7 +109,7 @@ export class MemoryStoreTemplate implements MemoryStore {
|
|
|
109
109
|
* `types.ts`, these top-level fields are first-class for substrates
|
|
110
110
|
* that have them.
|
|
111
111
|
*
|
|
112
|
-
* `
|
|
112
|
+
* `PortableData` core fields:
|
|
113
113
|
* - Always: `id`, `summary`, `created_at`
|
|
114
114
|
* - Often: `detail`, `score`, `domain_tags`, `payload_type`
|
|
115
115
|
* - Per-substrate (curated): `pinned`, `confidence`, `thread_status`,
|
|
@@ -117,23 +117,23 @@ export class MemoryStoreTemplate implements MemoryStore {
|
|
|
117
117
|
* - Catch-all: `metadata` object for substrate-specific extensions
|
|
118
118
|
*/
|
|
119
119
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
120
|
-
async query(_filters: QueryFilters): Promise<
|
|
120
|
+
async query(_filters: QueryFilters): Promise<PortableData[]> {
|
|
121
121
|
// TODO — translate `filters` to your substrate's query API.
|
|
122
122
|
// - Reject unsupported `mode` values with a clear error (don't silently
|
|
123
123
|
// fall back; cold authors will be confused)
|
|
124
124
|
// - Apply curated-subset filters (domain_tags, payload_type, etc.) where
|
|
125
125
|
// the substrate supports them
|
|
126
|
-
// - Map your substrate's result rows into `
|
|
126
|
+
// - Map your substrate's result rows into `PortableData` shape
|
|
127
127
|
// - Order by relevance (most relevant first)
|
|
128
128
|
// - Honor `limit`
|
|
129
|
-
throw new Error("TODO: query() — return
|
|
129
|
+
throw new Error("TODO: query() — return PortableData[] ordered by relevance.");
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Persist a new memory entry. Return the substrate-assigned `id` +
|
|
134
134
|
* `created_at` (unix seconds).
|
|
135
135
|
*
|
|
136
|
-
* `
|
|
136
|
+
* `DataWrite` shape:
|
|
137
137
|
* - `content`: string (required; the memory body)
|
|
138
138
|
* - `tags`: string[] (optional; routed to substrate's tag mechanism)
|
|
139
139
|
* - `recipients`: string[] (optional advisory — substrates with alerting
|
|
@@ -143,7 +143,7 @@ export class MemoryStoreTemplate implements MemoryStore {
|
|
|
143
143
|
* extensions like `vault`, `payload_type`, `confidence`)
|
|
144
144
|
*/
|
|
145
145
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
146
|
-
async write(_entry:
|
|
146
|
+
async write(_entry: DataWrite): Promise<DataWriteRecord> {
|
|
147
147
|
// TODO — persist the memory via your substrate.
|
|
148
148
|
// - Generate or accept an id (substrate-dependent)
|
|
149
149
|
// - Persist content + tags + metadata
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DataStoreTemplate — fork-me skeleton
|
|
2
2
|
|
|
3
|
-
A skeleton `
|
|
3
|
+
A skeleton `DataStore` implementation for adopters writing their own. Not runnable; every method throws a `TODO` error. Copy this directory, rename, fill in the substrate-specific work.
|
|
4
4
|
|
|
5
5
|
Use this when you want skillscript memories backed by:
|
|
6
6
|
- A vector database (Pinecone, Weaviate, Qdrant, Chroma)
|
|
7
|
-
- A memory
|
|
7
|
+
- A data store backing (memory broker like AMP, hosted memory API, vector DB, etc.)
|
|
8
8
|
- A different SQL flavor (Postgres + pgvector, MySQL)
|
|
9
9
|
- An HTTP CRUD service
|
|
10
10
|
- Anything else with query + write semantics
|
|
@@ -12,32 +12,32 @@ Use this when you want skillscript memories backed by:
|
|
|
12
12
|
## The three legs
|
|
13
13
|
|
|
14
14
|
```
|
|
15
|
-
|
|
16
|
-
├──
|
|
15
|
+
DataStore (choose which connector)
|
|
16
|
+
├── SqliteDataStore (bundled, SQLite + FTS5 — src/connectors/data-store.ts)
|
|
17
17
|
├── (no other bundled impl — vector DBs and remote services are adopter-side)
|
|
18
18
|
└── Your fork from this template
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
The runtime is substrate-agnostic. Memories don't know which backend they're stored against — the contract is the `
|
|
21
|
+
The runtime is substrate-agnostic. Memories don't know which backend they're stored against — the contract is the `DataStore` interface, and any class implementing it works.
|
|
22
22
|
|
|
23
23
|
## Forking workflow
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
cp -r examples/connectors/
|
|
26
|
+
cp -r examples/connectors/DataStoreTemplate examples/connectors/MyDataStore
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
1. **Rename the class.** Convention: `<Substrate>
|
|
30
|
-
2. **Define your config interface.** Edit `
|
|
29
|
+
1. **Rename the class.** Convention: `<Substrate>DataStore` (e.g., `PineconeDataStore`, `PostgresDataStore`, `AmpDataStore`).
|
|
30
|
+
2. **Define your config interface.** Edit `DataStoreTemplateConfig` to declare what your substrate needs (connection URL, API key, vault name, index name, etc.).
|
|
31
31
|
3. **Implement each method.** Three methods + `staticCapabilities()`. Each has a TODO comment in the skeleton explaining what to do.
|
|
32
32
|
4. **Update `staticCapabilities()`** to declare what your impl actually supports. The runtime + lint consult these flags before exercising features.
|
|
33
33
|
5. **Wire from your adopter bootstrap:**
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
36
|
import { Registry } from "skillscript-runtime";
|
|
37
|
-
import {
|
|
37
|
+
import { MyDataStore } from "./MyDataStore.js";
|
|
38
38
|
|
|
39
39
|
const registry = new Registry();
|
|
40
|
-
registry.
|
|
40
|
+
registry.registerDataStore("primary", new MyDataStore({
|
|
41
41
|
// your config
|
|
42
42
|
}));
|
|
43
43
|
```
|
|
@@ -46,37 +46,37 @@ cp -r examples/connectors/MemoryStoreTemplate examples/connectors/MyMemoryStore
|
|
|
46
46
|
|
|
47
47
|
```typescript
|
|
48
48
|
import { describe, it } from "vitest";
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
49
|
+
import { DataStoreConformance } from "skillscript-runtime/testing";
|
|
50
|
+
import { MyDataStore } from "./MyDataStore.js";
|
|
51
51
|
|
|
52
|
-
describe("
|
|
53
|
-
const tests =
|
|
54
|
-
build: () => new
|
|
55
|
-
ctor:
|
|
52
|
+
describe("MyDataStore conformance", () => {
|
|
53
|
+
const tests = DataStoreConformance.buildTests({
|
|
54
|
+
build: () => new MyDataStore({ /* test config */ }),
|
|
55
|
+
ctor: MyDataStore,
|
|
56
56
|
});
|
|
57
57
|
for (const t of tests) it(`[${t.category}] ${t.name}`, t.run);
|
|
58
58
|
});
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
The conformance suite verifies your impl honors the contract: method presence, return-type shape, capability flag self-consistency. Passes → runtime treats your impl interchangeably with `
|
|
61
|
+
The conformance suite verifies your impl honors the contract: method presence, return-type shape, capability flag self-consistency. Passes → runtime treats your impl interchangeably with `SqliteDataStore`.
|
|
62
62
|
|
|
63
63
|
## Reference implementation
|
|
64
64
|
|
|
65
65
|
When in doubt about semantics, read the bundled impl:
|
|
66
66
|
|
|
67
|
-
- **`src/connectors/
|
|
67
|
+
- **`src/connectors/data-store.ts`** — `SqliteDataStore`, SQLite + FTS5-backed. Schema lives in `bootstrap()` (memories table + FTS virtual table + AFTER INSERT/UPDATE/DELETE triggers). Single-process. Capability flags: `supports_writes: true`, `supports_tag_filter: true`, FTS only (semantic / rerank false).
|
|
68
68
|
|
|
69
69
|
## Contract surface (3 methods)
|
|
70
70
|
|
|
71
|
-
The
|
|
71
|
+
The DataStore contract is narrower than SkillStore. Three methods + `staticCapabilities()`:
|
|
72
72
|
|
|
73
73
|
| Method | What it does | When called |
|
|
74
74
|
|---|---|---|
|
|
75
|
-
| `query(filters)` | Read memories by mode + filter; return `
|
|
76
|
-
| `write(entry)` | Persist a new memory; return `{id, created_at}` | Every `$
|
|
75
|
+
| `query(filters)` | Read memories by mode + filter; return `PortableData[]` | Every `$ data_read mode=... query=...` op |
|
|
76
|
+
| `write(entry)` | Persist a new memory; return `{id, created_at}` | Every `$ data_write content=... -> R` op + `data_write` skill notify routes |
|
|
77
77
|
| `manifest()` | Capability snapshot for `runtime_capabilities` discovery | At startup + on-demand from MCP clients |
|
|
78
78
|
|
|
79
|
-
Per the curated-subset framing in `src/connectors/types.ts`, `
|
|
79
|
+
Per the curated-subset framing in `src/connectors/types.ts`, `PortableData` has a 4-tier field model:
|
|
80
80
|
|
|
81
81
|
1. **Core fields** — `id`, `summary`, `detail`, `score` (always-meaningful)
|
|
82
82
|
2. **Curated substrate subset** — top-level fields with portable concepts: `domain_tags`, `payload_type`, `knowledge_type`, `pinned`, `confidence`, `thread_status`, `recipients`, `expires_at`, `agent_id`, `vault`
|
|
@@ -89,8 +89,8 @@ Per the curated-subset framing in `src/connectors/types.ts`, `PortableMemory` ha
|
|
|
89
89
|
|
|
90
90
|
`QueryFilters.mode` is the dispatch axis:
|
|
91
91
|
|
|
92
|
-
- **`"fts"`** — full-text search; substrate-defined (BM25, BM25F, etc.). `
|
|
93
|
-
- **`"semantic"`** — embedding-based similarity. Vector-DB substrates support this; `
|
|
92
|
+
- **`"fts"`** — full-text search; substrate-defined (BM25, BM25F, etc.). `SqliteDataStore` supports this via FTS5.
|
|
93
|
+
- **`"semantic"`** — embedding-based similarity. Vector-DB substrates support this; `SqliteDataStore` does not.
|
|
94
94
|
- **`"rerank"`** — substrate-defined hybrid (e.g., FTS retrieve + embedding rerank). Optional.
|
|
95
95
|
- **substrate-specific strings** — your fork can define its own modes; document them in `manifest().manifest.supported_modes`.
|
|
96
96
|
|
|
@@ -111,7 +111,7 @@ Honor what your substrate supports; ignore the rest. Document the supported set
|
|
|
111
111
|
|
|
112
112
|
## `write()` semantics
|
|
113
113
|
|
|
114
|
-
The `
|
|
114
|
+
The `DataWrite` shape:
|
|
115
115
|
|
|
116
116
|
- **`content`** (required) — the memory body
|
|
117
117
|
- **`tags`** (optional) — routed to your substrate's tag mechanism
|
|
@@ -125,18 +125,18 @@ If your substrate doesn't support writes (read-only memory like a search index o
|
|
|
125
125
|
|
|
126
126
|
## Wiring against the dashboard / MCP
|
|
127
127
|
|
|
128
|
-
Runtime hosts honor whichever
|
|
128
|
+
Runtime hosts honor whichever DataStore impl your registry has. To make your fork visible through `skillfile dashboard`:
|
|
129
129
|
|
|
130
|
-
- Write a custom bootstrap that constructs the runtime with your
|
|
130
|
+
- Write a custom bootstrap that constructs the runtime with your DataStore (see `src/bootstrap.ts` for the reference shape)
|
|
131
131
|
- OR (planned future) declare in `~/.skillscript/connectors.json`:
|
|
132
132
|
|
|
133
133
|
```json
|
|
134
134
|
{
|
|
135
135
|
"substrate": {
|
|
136
|
-
"
|
|
136
|
+
"data_store": {
|
|
137
137
|
"type": "custom",
|
|
138
|
-
"module": "./my-
|
|
139
|
-
"export": "
|
|
138
|
+
"module": "./my-data-store.js",
|
|
139
|
+
"export": "MyDataStore",
|
|
140
140
|
"config": { "pineconeApiKey": "${PINECONE_KEY}" }
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -145,11 +145,11 @@ Runtime hosts honor whichever MemoryStore impl your registry has. To make your f
|
|
|
145
145
|
|
|
146
146
|
Current limitation: sync `bootstrap()` can't dynamic-import, so the `custom` form surfaces an error today. Programmatic bootstrap is the path until async-bootstrap support lands.
|
|
147
147
|
|
|
148
|
-
##
|
|
148
|
+
## DataStore vs SkillStore differences
|
|
149
149
|
|
|
150
150
|
Both are substrate-agnostic, but they differ in shape:
|
|
151
151
|
|
|
152
|
-
| Aspect | SkillStore |
|
|
152
|
+
| Aspect | SkillStore | DataStore |
|
|
153
153
|
|---|---|---|
|
|
154
154
|
| Methods | 8 (load, query, metadata, versions, store, delete, update_status, manifest) | 3 (query, write, manifest) |
|
|
155
155
|
| Versioning | First-class (`versions()`, `load(name, version)`) | Substrate-side (e.g., `supersededById` in AMP); not in contract |
|
|
@@ -158,12 +158,12 @@ Both are substrate-agnostic, but they differ in shape:
|
|
|
158
158
|
| Curated-subset fields | None | Many (`domain_tags`, `pinned`, `confidence`, `recipients`, etc.) |
|
|
159
159
|
| Forking complexity | Higher (multi-method state machine) | Lower (three methods, simpler semantics) |
|
|
160
160
|
|
|
161
|
-
The narrower contract is why
|
|
161
|
+
The narrower contract is why DataStoreTemplate ships sooner + smaller than SkillStoreTemplate.
|
|
162
162
|
|
|
163
163
|
## Further reading
|
|
164
164
|
|
|
165
165
|
- **[`../../../docs/configuration.md`](../../../docs/configuration.md)** — substrate selection via `connectors.json`
|
|
166
166
|
- **[`../../../docs/adopter-playbook.md`](../../../docs/adopter-playbook.md)** — programmatic-bootstrap patterns; two-instance posture
|
|
167
|
-
- **`src/connectors/types.ts`** — authoritative `
|
|
167
|
+
- **`src/connectors/types.ts`** — authoritative `DataStore` interface, `PortableData`, `QueryFilters`, `DataWrite` types
|
|
168
168
|
- **`src/testing/conformance.ts`** — the per-contract conformance test suites
|
|
169
|
-
- **`src/connectors/
|
|
169
|
+
- **`src/connectors/data-store.ts`** — `SqliteDataStore` reference impl + schema
|
|
@@ -113,7 +113,7 @@ Adopters wire their custom LocalModel **programmatically** from their bootstrap:
|
|
|
113
113
|
registry.registerLocalModel("default", new MyLocalModel({ /* config */ }));
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
Declarative custom-LocalModel via `connectors.json` `substrate.local_model: {type: "custom", module, export, config}` form is **deferred** until async-bootstrap support lands. Same limitation applies to `SkillStore` and `
|
|
116
|
+
Declarative custom-LocalModel via `connectors.json` `substrate.local_model: {type: "custom", module, export, config}` form is **deferred** until async-bootstrap support lands. Same limitation applies to `SkillStore` and `DataStore` custom forms — sync `bootstrap()` can't `await import()`. Not LocalModel-specific.
|
|
117
117
|
|
|
118
118
|
## Wiring against the dashboard / MCP
|
|
119
119
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* - `LocalModelMcpConnector` — bridges a registered LocalModel as
|
|
16
16
|
* `$ llm prompt=...` MCP dispatch. Auto-wired when LocalModel substrate
|
|
17
17
|
* is configured.
|
|
18
|
-
* - `
|
|
19
|
-
* `$
|
|
18
|
+
* - `DataStoreMcpConnector` — bridges a registered DataStore as
|
|
19
|
+
* `$ data_read mode=...` MCP dispatch. Auto-wired when DataStore substrate
|
|
20
20
|
* is configured.
|
|
21
21
|
*
|
|
22
22
|
* Fork from this template when none of those fit — e.g.:
|
|
@@ -9,7 +9,7 @@ A skeleton `McpConnector` implementation for adopters writing their own. Not run
|
|
|
9
9
|
| `RemoteMcpConnector` | Stdio bridging to remote MCP servers (`npx mcp-remote ...`). YouTrack, GitHub, Linear, most adopter MCP wiring goes through this. JSON-configurable via `connectors.json`. |
|
|
10
10
|
| `CallbackMcpConnector` | Wraps a JS function. Test rigs + embedder-wired transports where the dispatch is local code. |
|
|
11
11
|
| `LocalModelMcpConnector` | Bridges a registered `LocalModel` as `$ llm prompt=...`. Auto-wired when `substrate.local_model` is set. |
|
|
12
|
-
| `
|
|
12
|
+
| `DataStoreMcpConnector` | Bridges a registered `DataStore` as `$ data_read mode=...`. Auto-wired when `substrate.data_store` is set. |
|
|
13
13
|
|
|
14
14
|
**Fork this template only when none of those fit** — e.g.:
|
|
15
15
|
|
|
@@ -72,7 +72,7 @@ The bundled impls are the canonical reference:
|
|
|
72
72
|
- **`src/connectors/mcp-remote.ts`** — `RemoteMcpConnector`. Most comprehensive: stdio framing (LSP and newline), child process lifecycle (spawn → initialize → tools/list cache → SIGTERM/SIGKILL on dispose), `fromConfig` factory with strict validation, per-message timeout discipline. The closest reference for any transport that needs robust lifecycle management.
|
|
73
73
|
- **`src/connectors/mcp.ts`** — `CallbackMcpConnector`. Minimal reference: 60 LOC. The closest reference for embedder-wired transports.
|
|
74
74
|
|
|
75
|
-
When in doubt, read both + the bridge classes (`local-model-mcp.ts`, `
|
|
75
|
+
When in doubt, read both + the bridge classes (`local-model-mcp.ts`, `data-store-mcp.ts`) for how single-substrate bridges work.
|
|
76
76
|
|
|
77
77
|
## Contract surface (2 methods)
|
|
78
78
|
|
|
@@ -131,15 +131,15 @@ Two registration paths:
|
|
|
131
131
|
|
|
132
132
|
The declarative path is the canonical adopter pattern for stdio-bridged remote MCPs. Your fork is for transports the declarative path can't express.
|
|
133
133
|
|
|
134
|
-
## McpConnector vs. SkillStore /
|
|
134
|
+
## McpConnector vs. SkillStore / DataStore differences
|
|
135
135
|
|
|
136
|
-
| Aspect | McpConnector | SkillStore /
|
|
136
|
+
| Aspect | McpConnector | SkillStore / DataStore |
|
|
137
137
|
|---|---|---|
|
|
138
138
|
| Methods | 2 (call, manifest) | 3-8 (more state machine) |
|
|
139
139
|
| Cardinality | Many instances per deployment | One singleton per slot |
|
|
140
140
|
| Substrate config | Per-instance via top-level keys | `substrate` section short/object/custom |
|
|
141
141
|
| Class extensibility | `registerConnectorClass()` for adopter-custom classes | Programmatic bootstrap (or `substrate.skill_store: {type: "custom", ...}` once async-bootstrap lands) |
|
|
142
|
-
| Auto-wired bridges | `llm` + `memory` + `
|
|
142
|
+
| Auto-wired bridges | `llm` + `memory` + `data_write` (LocalModel + DataStore exposed via bridge connectors) | n/a (these ARE the substrates being bridged) |
|
|
143
143
|
|
|
144
144
|
McpConnector is fundamentally the "dispatch to external tools" surface — narrowest contract, broadest range of impls.
|
|
145
145
|
|
|
@@ -7,9 +7,9 @@ Worked examples + fork-me templates for adopter-written connectors. The bundled
|
|
|
7
7
|
| Contract | Bundled defaults | Worked example | Fork template |
|
|
8
8
|
|---|---|---|---|
|
|
9
9
|
| `SkillStore` | `FilesystemSkillStore`, `SqliteSkillStore` (in `src/connectors/`) | — | **[SkillStoreTemplate/](./SkillStoreTemplate/)** |
|
|
10
|
-
| `
|
|
10
|
+
| `DataStore` | `SqliteDataStore` (in `src/connectors/`) | — | **[DataStoreTemplate/](./DataStoreTemplate/)** |
|
|
11
11
|
| `LocalModel` | `OllamaLocalModel` (in `src/connectors/`; opt-in via substrate config) | — | **[LocalModelTemplate/](./LocalModelTemplate/)** |
|
|
12
|
-
| `McpConnector` | `RemoteMcpConnector`, `CallbackMcpConnector`, `LocalModelMcpConnector`, `
|
|
12
|
+
| `McpConnector` | `RemoteMcpConnector`, `CallbackMcpConnector`, `LocalModelMcpConnector`, `DataStoreMcpConnector` (in `src/connectors/`) | — | **[McpConnectorTemplate/](./McpConnectorTemplate/)** |
|
|
13
13
|
| `AgentConnector` | `NoOpAgentConnector` (in `src/connectors/`) | **[HttpWebhookAgentConnector/](./HttpWebhookAgentConnector/)** | — |
|
|
14
14
|
|
|
15
15
|
**Bundled defaults** are runnable out of the box — wired through `connectors.json` substrate config or programmatic bootstrap.
|
|
@@ -35,7 +35,7 @@ Worked examples + fork-me templates for adopter-written connectors. The bundled
|
|
|
35
35
|
- **[`docs/configuration.md`](../../docs/configuration.md)** — substrate selection via `connectors.json`; programmatic-bootstrap vs declarative patterns
|
|
36
36
|
- **[`docs/adopter-playbook.md`](../../docs/adopter-playbook.md)** — Case 1 vs Case 2 wiring decisions; two-instance posture; upstream-merge-friendly conventions
|
|
37
37
|
- **[`docs/connector-contract-reference.md`](../../docs/connector-contract-reference.md)** — interface contracts for adopter agents writing connector impls
|
|
38
|
-
- **`src/connectors/types.ts`** — authoritative contract interfaces (SkillStore,
|
|
38
|
+
- **`src/connectors/types.ts`** — authoritative contract interfaces (SkillStore, DataStore, LocalModel, McpConnector)
|
|
39
39
|
- **`src/testing/conformance.ts`** — the per-contract conformance test suites
|
|
40
40
|
|
|
41
41
|
## Naming convention
|
|
@@ -5,7 +5,7 @@ A skeleton `SkillStore` implementation for adopters writing their own. Not runna
|
|
|
5
5
|
Use this when you want skillscript skills backed by:
|
|
6
6
|
- A database the bundled impls don't cover (Postgres, MySQL, MongoDB, etc.)
|
|
7
7
|
- A vector store (Pinecone, Weaviate, Qdrant)
|
|
8
|
-
- A memory
|
|
8
|
+
- A data store backing (memory broker like AMP, hosted memory API, vector DB, etc.)
|
|
9
9
|
- An HTTP CRUD service
|
|
10
10
|
- Anything else with a query/write interface
|
|
11
11
|
|
|
@@ -138,7 +138,7 @@ export class SkillStoreTemplate implements SkillStore {
|
|
|
138
138
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
139
139
|
async versions(_name: string): Promise<VersionInfo[]> {
|
|
140
140
|
// TODO — return version chain. SQL substrates: SELECT FROM skill_versions
|
|
141
|
-
// ORDER BY changed_at.
|
|
141
|
+
// ORDER BY changed_at. DataStore-style: query memories with the right tag.
|
|
142
142
|
throw new Error("TODO: versions() — return VersionInfo[] chronologically.");
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
// **When to write your own bootstrap.** The bundled `bootstrap()` from
|
|
5
5
|
// `skillscript-runtime` wires `FilesystemSkillStore` + `OllamaLocalModel` +
|
|
6
|
-
// `
|
|
7
|
-
// different substrates (your own
|
|
6
|
+
// `SqliteDataStore` + the v0.7.2 bridges. If your deployment uses
|
|
7
|
+
// different substrates (your own data store, a hosted LLM API, an MCP
|
|
8
8
|
// server for agent delivery, etc.), write your own bootstrap rather than
|
|
9
9
|
// modifying the bundled one. Prevents merge conflicts on every upstream
|
|
10
10
|
// release that touches `src/bootstrap.ts`.
|
|
@@ -83,17 +83,17 @@ const registry = new Registry();
|
|
|
83
83
|
const skillStore = new FilesystemSkillStore(config.skillsDir ?? `${HOME}/skills`);
|
|
84
84
|
registry.registerSkillStore("primary", skillStore);
|
|
85
85
|
|
|
86
|
-
// Wire your own LocalModel,
|
|
86
|
+
// Wire your own LocalModel, DataStore, AgentConnector here. For typed-
|
|
87
87
|
// contract impls, this is the "case 1" wiring — substrate-portable.
|
|
88
88
|
// registry.registerLocalModel("default", new MyHostedLlmAdapter(...));
|
|
89
|
-
// registry.
|
|
89
|
+
// registry.registerDataStore("primary", new MyMemoryAdapter(...));
|
|
90
90
|
// registry.registerAgentConnector("primary", new MyAgentHarnessAdapter(...));
|
|
91
91
|
|
|
92
|
-
// Then wire bridges if you want the canonical `$ llm` / `$
|
|
93
|
-
// import { LocalModelMcpConnector,
|
|
92
|
+
// Then wire bridges if you want the canonical `$ llm` / `$ data_read` surfaces:
|
|
93
|
+
// import { LocalModelMcpConnector, DataStoreMcpConnector } from "skillscript-runtime";
|
|
94
94
|
// registry.registerMcpConnector("llm", new LocalModelMcpConnector(registry.getLocalModel("default")));
|
|
95
|
-
// const ms = registry.
|
|
96
|
-
// if (ms !== undefined) registry.registerMcpConnector("
|
|
95
|
+
// const ms = registry.listDataStores().find((e) => e.name === "primary");
|
|
96
|
+
// if (ms !== undefined) registry.registerMcpConnector("data_read", new DataStoreMcpConnector(ms.instance));
|
|
97
97
|
|
|
98
98
|
// Wire any connectors.json instances.
|
|
99
99
|
for (const c of connectors) {
|
|
@@ -6,11 +6,11 @@ A complete adopter-deployment example demonstrating substrate-portable wiring fo
|
|
|
6
6
|
|
|
7
7
|
Skillscript's substrate-portability story is conditional: **typed-contract wiring (Case 1)** keeps skills portable across substrates; **MCP-tools wiring (Case 2)** locks skills to a specific substrate. This scaffold is Case 1 end-to-end.
|
|
8
8
|
|
|
9
|
-
- **
|
|
9
|
+
- **DataStore** → `FileDataStore` (JSON file with simple substring FTS)
|
|
10
10
|
- **LocalModel** → `OpenAILocalModel` (HTTP to Chat Completions API)
|
|
11
11
|
- **AgentConnector** → `TmuxShellAgentConnector` (delivers to tmux sessions via `send-keys`)
|
|
12
12
|
|
|
13
|
-
Each impl conforms to the typed contract from `skillscript-runtime/connectors`. Skills authored against this scaffold use the canonical `$ llm prompt=...` and `$
|
|
13
|
+
Each impl conforms to the typed contract from `skillscript-runtime/connectors`. Skills authored against this scaffold use the canonical `$ llm prompt=...` and `$ data_read mode=fts query=...` surfaces — *the same calls would work against any other Case-1-wired substrate* (Pinecone, Ollama, Anthropic API, etc.).
|
|
14
14
|
|
|
15
15
|
## Quick start
|
|
16
16
|
|
|
@@ -44,7 +44,7 @@ node --loader ts-node/esm bootstrap.ts
|
|
|
44
44
|
|
|
45
45
|
| File | Purpose | LOC |
|
|
46
46
|
|---|---|---|
|
|
47
|
-
| `file-
|
|
47
|
+
| `file-data-store.ts` | `DataStore` impl — JSON file substrate | ~95 |
|
|
48
48
|
| `openai-local-model.ts` | `LocalModel` impl — Chat Completions API | ~85 |
|
|
49
49
|
| `tmux-shell-agent-connector.ts` | `AgentConnector` impl — tmux send-keys | ~75 |
|
|
50
50
|
| `bootstrap.ts` | Wiring — Registry, bridges, scheduler, MCP server | ~75 |
|
|
@@ -53,7 +53,7 @@ node --loader ts-node/esm bootstrap.ts
|
|
|
53
53
|
|
|
54
54
|
## Two-instance posture
|
|
55
55
|
|
|
56
|
-
To run this scaffold *alongside* an existing skillscript dev instance, just copy the scaffold to a separate directory with its own `skillscript.config.json` pointing at different `dashboard.port` + `skillsDir` + `
|
|
56
|
+
To run this scaffold *alongside* an existing skillscript dev instance, just copy the scaffold to a separate directory with its own `skillscript.config.json` pointing at different `dashboard.port` + `skillsDir` + `dataDbPath` etc. The `--config <path>` CLI flag selects which config to use; no two instances will collide on disk or port.
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
# dev instance on default port
|
|
@@ -67,14 +67,14 @@ skillfile dashboard --config ./adopter.config.json # contains "dashboard": { "p
|
|
|
67
67
|
|
|
68
68
|
For your real deployment, swap each adapter:
|
|
69
69
|
|
|
70
|
-
- `
|
|
70
|
+
- `FileDataStore` → your actual data store (Pinecone, Postgres-pgvector, Obsidian-backed, in-house store, memory broker, etc.)
|
|
71
71
|
- `OpenAILocalModel` → your actual LLM (Ollama via the bundled `OllamaLocalModel`, Anthropic via your own adapter, hosted-OpenAI as shown, etc.)
|
|
72
72
|
- `TmuxShellAgentConnector` → your actual agent delivery (webhook POST, named-pipe write, your harness's API, etc.)
|
|
73
73
|
|
|
74
|
-
The skill bodies don't need to change. `$ llm prompt=...` keeps working; `$
|
|
74
|
+
The skill bodies don't need to change. `$ llm prompt=...` keeps working; `$ data_read mode=fts query=...` keeps working. That's the substrate-portability claim, validated by you wiring different substrates against the same typed contracts.
|
|
75
75
|
|
|
76
76
|
## Where to go next
|
|
77
77
|
|
|
78
78
|
- **Adopter playbook** — `docs/adopter-playbook.md` walks through Case 1 vs Case 2 wiring patterns
|
|
79
79
|
- **Custom bootstrap walkthrough** — `examples/custom-bootstrap.example.ts` shows registering custom McpConnector classes via `registerConnectorClass`
|
|
80
|
-
- **v0.8.x roadmap** — `$
|
|
80
|
+
- **v0.8.x roadmap** — `$ data_write` ships in v0.8.x bundled with the auth model. When that lands, extend `FileDataStore` with the corresponding `write()` method.
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// Copy this file into your deployment and modify substrate choices to
|
|
5
5
|
// match your environment. The shape is:
|
|
6
6
|
// 1. Construct a Registry
|
|
7
|
-
// 2. Register your substrate impls (SkillStore + LocalModel +
|
|
8
|
-
// 3. Wire bridges so canonical `$ llm` / `$
|
|
7
|
+
// 2. Register your substrate impls (SkillStore + LocalModel + DataStore + AgentConnector)
|
|
8
|
+
// 3. Wire bridges so canonical `$ llm` / `$ data_read` dispatch works
|
|
9
9
|
// 4. Load connectors.json + skillscript.config.json
|
|
10
10
|
// 5. Wire scheduler + MCP server
|
|
11
11
|
// 6. Start
|
|
@@ -20,15 +20,15 @@ import {
|
|
|
20
20
|
import { Scheduler } from "skillscript-runtime/scheduler";
|
|
21
21
|
import { FilesystemTraceStore } from "skillscript-runtime/trace";
|
|
22
22
|
import { McpServer } from "skillscript-runtime/mcp-server";
|
|
23
|
-
// Note: LocalModelMcpConnector +
|
|
23
|
+
// Note: LocalModelMcpConnector + DataStoreMcpConnector are bridge classes
|
|
24
24
|
// already exported from skillscript-runtime/connectors. They wrap any
|
|
25
25
|
// typed-contract impl as an MCP-dispatchable connector.
|
|
26
26
|
import {
|
|
27
27
|
LocalModelMcpConnector,
|
|
28
|
-
|
|
28
|
+
DataStoreMcpConnector,
|
|
29
29
|
} from "skillscript-runtime/connectors";
|
|
30
30
|
|
|
31
|
-
import {
|
|
31
|
+
import { FileDataStore } from "./file-data-store.js";
|
|
32
32
|
import { OpenAILocalModel } from "./openai-local-model.js";
|
|
33
33
|
import { TmuxShellAgentConnector } from "./tmux-shell-agent-connector.js";
|
|
34
34
|
|
|
@@ -44,10 +44,10 @@ const skillStore = new FilesystemSkillStore(config.skillsDir ?? `${HOME}/skills`
|
|
|
44
44
|
registry.registerSkillStore("primary", skillStore);
|
|
45
45
|
|
|
46
46
|
// File-backed memory at $SKILLSCRIPT_HOME/memory.json
|
|
47
|
-
const
|
|
48
|
-
filePath: config.
|
|
47
|
+
const dataStore = new FileDataStore({
|
|
48
|
+
filePath: config.dataDbPath ?? `${HOME}/memory.json`,
|
|
49
49
|
});
|
|
50
|
-
registry.
|
|
50
|
+
registry.registerDataStore("primary", dataStore);
|
|
51
51
|
|
|
52
52
|
// OpenAI LLM — reads OPENAI_API_KEY from env.
|
|
53
53
|
const openai = new OpenAILocalModel({ defaultModel: "gpt-4o-mini" });
|
|
@@ -63,10 +63,10 @@ const agentConnector = new TmuxShellAgentConnector({
|
|
|
63
63
|
});
|
|
64
64
|
registry.registerAgentConnector("primary", agentConnector);
|
|
65
65
|
|
|
66
|
-
// Step 3: wire bridges so `$ llm` / `$
|
|
66
|
+
// Step 3: wire bridges so `$ llm` / `$ data_read` dispatch through the
|
|
67
67
|
// adopter substrates above (case 1 typed-contract wiring — portable).
|
|
68
68
|
registry.registerMcpConnector("llm", new LocalModelMcpConnector(openai));
|
|
69
|
-
registry.registerMcpConnector("
|
|
69
|
+
registry.registerMcpConnector("data_read", new DataStoreMcpConnector(dataStore));
|
|
70
70
|
|
|
71
71
|
// Step 4: wire connectors.json instances (adopter-defined MCP servers).
|
|
72
72
|
for (const c of connectors) {
|