@ontrove/sdk 0.1.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @ontrove/sdk
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - dbf6fa1: Product-taxonomy renames: connectors are now **sources** (their per-feed
8
+ children are **feeds**), and hosted MCP servers are presented as **toolkits**.
9
+ No compatibility aliases.
10
+
11
+ - `@ontrove/sdk`: `defineConnector` → `defineSource`, `runConnector` →
12
+ `runSource`, `validateConnectorManifest` → `validateSourceManifest`,
13
+ `TroveConnector` → `TroveSource`, and `ConnectorDocument`/`ConnectorContext`/
14
+ `ConnectorSyncResult`/`ConnectorManifest`/`ConnectorContentType` →
15
+ `Source*`.
16
+ - `@ontrove/cli`: the `trove connector`/`trove connectors` command family is now
17
+ `trove source`/`trove sources`; `--connector` filter flags are now `--source`,
18
+ and the child-level `--source` flag is now `--feed` (`trove ingest --source
19
+ <id> --feed <id>`). All GraphQL operations target the renamed schema
20
+ (`sources`, `source`, `createSource`, `addFeed`, `sourceId`/`feedId`,
21
+ `totalSources`, `documentsBySourceType`, …). The `trove mcp *` namespace is
22
+ unchanged.
23
+ - `@ontrove/mcp`: `ctx.trove.search`'s `TroveSearchOpts.connector` option is now
24
+ `source` (requires a Trove cloud that accepts the `source` wire key).
25
+
3
26
  ## 0.1.0
4
27
 
5
28
  Initial release — the connector authoring SDK: `defineConnector`, the `sync(ctx)`
package/README.md CHANGED
@@ -1,18 +1,19 @@
1
1
  # @ontrove/sdk
2
2
 
3
- The thin standard library for authoring **Trove connectors**. You write a
4
- `sync(ctx)` that fetches from a source and returns documents; the SDK owns the
5
- document shape, the typed `ctx` capability object, the watermark/cursor model,
6
- the local-run harness the CLI drives, and manifest validation.
3
+ The thin standard library for authoring **Trove sources** the things that fill
4
+ your Library. You write a `sync(ctx)` that fetches new content and returns
5
+ documents; the SDK owns the document shape, the typed `ctx` capability object,
6
+ the watermark/cursor model, the local-run harness the CLI drives, and manifest
7
+ validation.
7
8
 
8
- It is symmetric with the hosted-MCP SDK
9
+ It is symmetric with the toolkit-authoring SDK
9
10
  ([`@ontrove/mcp`](https://www.npmjs.com/package/@ontrove/mcp)) `defineMcpServer`
10
- contract: a connector returns documents to be _stored_ (batch `sync`); an MCP
11
- server returns tool results to be _read live_.
11
+ contract: a source returns documents to be _stored_ (batch `sync`); a toolkit's
12
+ tools return results to be _read live_.
12
13
 
13
- See the full [SDK Reference](https://docs.ontrove.sh/connectors/sdk-reference/),
14
- the [manifest.json reference](https://docs.ontrove.sh/connectors/manifest/), and
15
- the [cursors & sources model](https://docs.ontrove.sh/connectors/cursors-and-sources/)
14
+ See the full [SDK Reference](https://docs.ontrove.sh/sources/sdk-reference/),
15
+ the [manifest.json reference](https://docs.ontrove.sh/sources/manifest/), and
16
+ the [cursors & feeds model](https://docs.ontrove.sh/sources/cursors-and-feeds/)
16
17
  in the docs.
17
18
 
18
19
  ## Install
@@ -23,16 +24,16 @@ npm install @ontrove/sdk
23
24
 
24
25
  ## Quickstart
25
26
 
26
- A connector's `index.ts` must `export default defineConnector(...)`. Your `sync`
27
- fetches from the source and returns documents — each field maps 1:1 onto the
27
+ A source's `index.ts` must `export default defineSource(...)`. Your `sync`
28
+ fetches new content and returns documents — each field maps 1:1 onto the
28
29
  `IngestDocumentInput` the Mac app pushes via `ingestDocuments`.
29
30
 
30
31
  ### Hacker News front page
31
32
 
32
33
  ```ts
33
- import { defineConnector } from '@ontrove/sdk';
34
+ import { defineSource } from '@ontrove/sdk';
34
35
 
35
- export default defineConnector({
36
+ export default defineSource({
36
37
  async sync(ctx) {
37
38
  const res = await ctx.fetch('https://hn.algolia.com/api/v1/search?tags=front_page');
38
39
  const { hits } = await res.json();
@@ -60,11 +61,11 @@ export default defineConnector({
60
61
  > `parseRss` / `stripHtml` below are **your own helpers** — the SDK ships no XML
61
62
  > parser. Bring your own (e.g. [`fast-xml-parser`](https://www.npmjs.com/package/fast-xml-parser)).
62
63
 
63
- ```ts
64
- import { defineConnector } from '@ontrove/sdk';
64
+ ```ts no-typecheck
65
+ import { defineSource } from '@ontrove/sdk';
65
66
  // import { parseRss, stripHtml } from './rss-helpers'; // your own — see note above
66
67
 
67
- export default defineConnector({
68
+ export default defineSource({
68
69
  async sync(ctx) {
69
70
  const feedUrl = ctx.config.feedUrl as string;
70
71
  const since = ctx.cursor.type === 'date' ? new Date(ctx.cursor.value) : new Date(0);
@@ -101,9 +102,9 @@ A bare array is accepted too — `return documents;` is shorthand for
101
102
  | Member | Type | Description |
102
103
  | ------------- | ------------------------------------------- | --------------------------------------------------------------------------- |
103
104
  | `ctx.config` | `C` (typed preferences) | The user's setup preferences. **Never credentials.** |
104
- | `ctx.cursor` | `Watermark` (read-only) | The source's current watermark; `{ type: 'none' }` on first sync. |
105
+ | `ctx.cursor` | `Watermark` (read-only) | The feed's current watermark; `{ type: 'none' }` on first sync. |
105
106
  | `ctx.fetch` | `(url, init?) => Promise<Response>` | Standard `fetch` — routes through the Mac app's networking. |
106
- | `ctx.log` | `(...args) => void` | Structured log entry, surfaced in connector logs. |
107
+ | `ctx.log` | `(...args) => void` | Structured log entry, surfaced in the source's logs. |
107
108
  | `ctx.now` | `() => Date` | Injected clock (deterministic under test). |
108
109
 
109
110
  `ctx.credentials` (Keychain-resolved auth) and `ctx.browser` (Playwright) are
@@ -111,9 +112,9 @@ A bare array is accepted too — `return documents;` is shorthand for
111
112
 
112
113
  ## The document shape → `IngestDocumentInput`
113
114
 
114
- `ConnectorDocument` maps 1:1 onto the GraphQL `IngestDocumentInput` wire type:
115
+ `SourceDocument` maps 1:1 onto the GraphQL `IngestDocumentInput` wire type:
115
116
 
116
- | `ConnectorDocument` | `IngestDocumentInput` | Required |
117
+ | `SourceDocument` | `IngestDocumentInput` | Required |
117
118
  | ------------------- | --------------------- | ------------------------------ |
118
119
  | `id` | `externalId` | **Yes** |
119
120
  | `title` | `title` | No |
@@ -126,27 +127,27 @@ A bare array is accepted too — `return documents;` is shorthand for
126
127
  | `metadata` | `metadata` (JSON) | No |
127
128
  | `contentType` | `contentType` | No (default `text`) |
128
129
 
129
- Dedup is keyed on `(source, id)`, so `sync` is safe to retry — re-returning the
130
+ Dedup is keyed on `(feed, id)`, so `sync` is safe to retry — re-returning the
130
131
  same `id` is skipped.
131
132
 
132
133
  ## Watermarks
133
134
 
134
- A `Watermark` describes how a source resumes between syncs:
135
+ A `Watermark` describes how a feed resumes between syncs:
135
136
 
136
- - `{ type: 'date', value }` — time-ordered sources with "since &lt;date&gt;" filtering (RSS, most APIs).
137
+ - `{ type: 'date', value }` — time-ordered feeds with "since &lt;date&gt;" filtering (RSS, most APIs).
137
138
  - `{ type: 'idSet', values, max? }` — monotonic ids, no reliable date filter.
138
139
  - `{ type: 'none' }` — re-fetch everything; rely on dedup. Always correct, less efficient.
139
140
 
140
141
  ## Local run harness
141
142
 
142
- `runConnector` is what `trove connector dev` / `trove connector test` call. It
143
+ `runSource` is what `trove source dev` / `trove source test` call. It
143
144
  builds a `ctx`, runs `sync`, validates and dedups the documents:
144
145
 
145
- ```ts
146
- import { runConnector } from '@ontrove/sdk';
147
- import connector from './index.js';
146
+ ```ts no-typecheck
147
+ import { runSource } from '@ontrove/sdk';
148
+ import source from './index.js';
148
149
 
149
- const { documents, cursor, duplicatesSkipped } = await runConnector(connector, {
150
+ const { documents, cursor, duplicatesSkipped } = await runSource(source, {
150
151
  config: { feedUrl: 'https://example.com/feed.xml' },
151
152
  cursor: { type: 'date', value: '2026-06-01T00:00:00Z' },
152
153
  });
@@ -154,15 +155,15 @@ const { documents, cursor, duplicatesSkipped } = await runConnector(connector, {
154
155
 
155
156
  ## Manifest validation
156
157
 
157
- `validateConnectorManifest` backs `trove connector validate`. It checks required
158
+ `validateSourceManifest` backs `trove source validate`. It checks required
158
159
  fields and the `id`/`version` patterns, and lints `config` for credential-shaped
159
160
  keys — the same spirit as the cloud's `validateConfig` (config holds preferences
160
161
  only; credentials live in the macOS Keychain).
161
162
 
162
- ```ts
163
- import { validateConnectorManifest } from '@ontrove/sdk';
163
+ ```ts no-typecheck
164
+ import { validateSourceManifest } from '@ontrove/sdk';
164
165
 
165
- const { valid, errors } = validateConnectorManifest(manifest);
166
+ const { valid, errors } = validateSourceManifest(manifest);
166
167
  if (!valid) throw new Error(errors.join('\n'));
167
168
  ```
168
169
 
package/dist/define.d.ts CHANGED
@@ -1,33 +1,33 @@
1
1
  /**
2
- * `defineConnector` — the single entry point for authoring a Trove connector
3
- * (connectors/sdk-reference). It is the symmetric sibling of `defineMcpServer`
2
+ * `defineSource` — the single entry point for authoring a Trove source
3
+ * (sources/sdk-reference). It is the symmetric sibling of `defineMcpServer`
4
4
  * in `@ontrove/mcp`.
5
5
  *
6
6
  * It is an identity function with light, eager validation: it confirms the value
7
- * is a connector object with a `sync` method, so a typo (`snyc`, a missing
7
+ * is a source object with a `sync` method, so a typo (`snyc`, a missing
8
8
  * `sync`, a non-function) fails at authoring/deploy time with a clear message
9
9
  * rather than at the first scheduled run. It does **not** execute `sync` — that is
10
- * {@link runConnector}'s job.
10
+ * {@link runSource}'s job.
11
11
  *
12
12
  * @module
13
13
  */
14
- import type { ConnectorContext, ConnectorDocument, ConnectorSyncResult, TroveConnector } from './types.js';
14
+ import type { SourceContext, SourceDocument, SourceSyncResult, TroveSource } from './types.js';
15
15
  /**
16
- * Validate and return a connector definition unchanged.
16
+ * Validate and return a source definition unchanged.
17
17
  *
18
- * Using `defineConnector(...)` (rather than a bare `satisfies TroveConnector`)
19
- * gives an eager runtime check: the CLI calls this when loading a connector
18
+ * Using `defineSource(...)` (rather than a bare `satisfies TroveSource`)
19
+ * gives an eager runtime check: the CLI calls this when loading a source
20
20
  * module so a malformed export is rejected before any sync runs. The returned
21
21
  * value is the same object, with full inferred types preserved.
22
22
  *
23
- * @typeParam C - The shape of the connector's typed `ctx.config` preferences.
24
- * @param connector - The connector object to validate.
25
- * @returns The same connector object.
26
- * @throws {Error} If `connector` is not an object with a `sync` function.
23
+ * @typeParam C - The shape of the source's typed `ctx.config` preferences.
24
+ * @param source - The source object to validate.
25
+ * @returns The same source object.
26
+ * @throws {Error} If `source` is not an object with a `sync` function.
27
27
  *
28
28
  * @example
29
29
  * ```ts
30
- * export default defineConnector({
30
+ * export default defineSource({
31
31
  * async sync(ctx) {
32
32
  * const res = await ctx.fetch(ctx.config.feedUrl as string);
33
33
  * return parseRss(await res.text());
@@ -35,15 +35,15 @@ import type { ConnectorContext, ConnectorDocument, ConnectorSyncResult, TroveCon
35
35
  * });
36
36
  * ```
37
37
  */
38
- export declare function defineConnector<C = Record<string, unknown>>(connector: TroveConnector<C>): TroveConnector<C>;
38
+ export declare function defineSource<C = Record<string, unknown>>(source: TroveSource<C>): TroveSource<C>;
39
39
  /**
40
- * A connector authored inline as a single `sync` function, for the common case
41
- * where the connector has no other members. Equivalent to
42
- * `defineConnector({ sync })`.
40
+ * A source authored inline as a single `sync` function, for the common case
41
+ * where the source has no other members. Equivalent to
42
+ * `defineSource({ sync })`.
43
43
  *
44
- * @typeParam C - The shape of the connector's typed `ctx.config` preferences.
45
- * @param sync - The connector's `sync(ctx)` implementation.
46
- * @returns A validated {@link TroveConnector} wrapping `sync`.
44
+ * @typeParam C - The shape of the source's typed `ctx.config` preferences.
45
+ * @param sync - The source's `sync(ctx)` implementation.
46
+ * @returns A validated {@link TroveSource} wrapping `sync`.
47
47
  */
48
- export declare function defineSync<C = Record<string, unknown>>(sync: (ctx: ConnectorContext<C>) => Promise<ConnectorSyncResult | ConnectorDocument[]>): TroveConnector<C>;
48
+ export declare function defineSync<C = Record<string, unknown>>(sync: (ctx: SourceContext<C>) => Promise<SourceSyncResult | SourceDocument[]>): TroveSource<C>;
49
49
  //# sourceMappingURL=define.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,GAC3B,cAAc,CAAC,CAAC,CAAC,CAQnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,IAAI,EAAE,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,mBAAmB,GAAG,iBAAiB,EAAE,CAAC,GACrF,cAAc,CAAC,CAAC,CAAC,CAEnB"}
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAQhG;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,IAAI,EAAE,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,gBAAgB,GAAG,cAAc,EAAE,CAAC,GAC5E,WAAW,CAAC,CAAC,CAAC,CAEhB"}
package/dist/define.js CHANGED
@@ -1,32 +1,32 @@
1
1
  /**
2
- * `defineConnector` — the single entry point for authoring a Trove connector
3
- * (connectors/sdk-reference). It is the symmetric sibling of `defineMcpServer`
2
+ * `defineSource` — the single entry point for authoring a Trove source
3
+ * (sources/sdk-reference). It is the symmetric sibling of `defineMcpServer`
4
4
  * in `@ontrove/mcp`.
5
5
  *
6
6
  * It is an identity function with light, eager validation: it confirms the value
7
- * is a connector object with a `sync` method, so a typo (`snyc`, a missing
7
+ * is a source object with a `sync` method, so a typo (`snyc`, a missing
8
8
  * `sync`, a non-function) fails at authoring/deploy time with a clear message
9
9
  * rather than at the first scheduled run. It does **not** execute `sync` — that is
10
- * {@link runConnector}'s job.
10
+ * {@link runSource}'s job.
11
11
  *
12
12
  * @module
13
13
  */
14
14
  /**
15
- * Validate and return a connector definition unchanged.
15
+ * Validate and return a source definition unchanged.
16
16
  *
17
- * Using `defineConnector(...)` (rather than a bare `satisfies TroveConnector`)
18
- * gives an eager runtime check: the CLI calls this when loading a connector
17
+ * Using `defineSource(...)` (rather than a bare `satisfies TroveSource`)
18
+ * gives an eager runtime check: the CLI calls this when loading a source
19
19
  * module so a malformed export is rejected before any sync runs. The returned
20
20
  * value is the same object, with full inferred types preserved.
21
21
  *
22
- * @typeParam C - The shape of the connector's typed `ctx.config` preferences.
23
- * @param connector - The connector object to validate.
24
- * @returns The same connector object.
25
- * @throws {Error} If `connector` is not an object with a `sync` function.
22
+ * @typeParam C - The shape of the source's typed `ctx.config` preferences.
23
+ * @param source - The source object to validate.
24
+ * @returns The same source object.
25
+ * @throws {Error} If `source` is not an object with a `sync` function.
26
26
  *
27
27
  * @example
28
28
  * ```ts
29
- * export default defineConnector({
29
+ * export default defineSource({
30
30
  * async sync(ctx) {
31
31
  * const res = await ctx.fetch(ctx.config.feedUrl as string);
32
32
  * return parseRss(await res.text());
@@ -34,24 +34,24 @@
34
34
  * });
35
35
  * ```
36
36
  */
37
- export function defineConnector(connector) {
38
- if (connector === null || typeof connector !== 'object') {
39
- throw new Error('defineConnector: expected a connector object with a `sync` method');
37
+ export function defineSource(source) {
38
+ if (source === null || typeof source !== 'object') {
39
+ throw new Error('defineSource: expected a source object with a `sync` method');
40
40
  }
41
- if (typeof connector.sync !== 'function') {
42
- throw new Error('defineConnector: connector must have a `sync(ctx)` function');
41
+ if (typeof source.sync !== 'function') {
42
+ throw new Error('defineSource: source must have a `sync(ctx)` function');
43
43
  }
44
- return connector;
44
+ return source;
45
45
  }
46
46
  /**
47
- * A connector authored inline as a single `sync` function, for the common case
48
- * where the connector has no other members. Equivalent to
49
- * `defineConnector({ sync })`.
47
+ * A source authored inline as a single `sync` function, for the common case
48
+ * where the source has no other members. Equivalent to
49
+ * `defineSource({ sync })`.
50
50
  *
51
- * @typeParam C - The shape of the connector's typed `ctx.config` preferences.
52
- * @param sync - The connector's `sync(ctx)` implementation.
53
- * @returns A validated {@link TroveConnector} wrapping `sync`.
51
+ * @typeParam C - The shape of the source's typed `ctx.config` preferences.
52
+ * @param sync - The source's `sync(ctx)` implementation.
53
+ * @returns A validated {@link TroveSource} wrapping `sync`.
54
54
  */
55
55
  export function defineSync(sync) {
56
- return defineConnector({ sync });
56
+ return defineSource({ sync });
57
57
  }
package/dist/index.d.ts CHANGED
@@ -1,19 +1,20 @@
1
1
  /**
2
- * `@ontrove/sdk` — the thin standard library for authoring **Trove connectors**.
3
- * You write a `sync(ctx)` that fetches from a source and returns documents; the
2
+ * `@ontrove/sdk` — the thin standard library for authoring **Trove sources**.
3
+ * You write a `sync(ctx)` that fetches new content and returns documents; the
4
4
  * SDK owns the document shape (which maps 1:1 onto `IngestDocumentInput`), the
5
5
  * typed `ctx` capability object, the watermark/cursor model, the local-run
6
6
  * harness the CLI drives, and manifest validation.
7
7
  *
8
- * It is the symmetric sibling of `@ontrove/mcp`: a connector returns documents to
9
- * be _stored_ (`defineConnector` + `sync`); an MCP server returns tool results to
10
- * be _read live_ (`defineMcpServer`).
8
+ * It is the symmetric sibling of `@ontrove/mcp`, the toolkit-authoring library
9
+ * (every toolkit runs as a full MCP server on Trove's cloud): a source returns
10
+ * documents to be _stored_ (`defineSource` + `sync`); a toolkit's tools return
11
+ * results to be _read live_ (`defineMcpServer`).
11
12
  *
12
13
  * @example
13
14
  * ```ts
14
- * import { defineConnector } from '@ontrove/sdk';
15
+ * import { defineSource } from '@ontrove/sdk';
15
16
  *
16
- * export default defineConnector({
17
+ * export default defineSource({
17
18
  * async sync(ctx) {
18
19
  * const res = await ctx.fetch('https://hn.algolia.com/api/v1/search?tags=front_page');
19
20
  * const { hits } = await res.json();
@@ -32,8 +33,8 @@
32
33
  *
33
34
  * @module
34
35
  */
35
- export { defineConnector, defineSync } from './define.js';
36
- export { isCredentialConfigKey, type ManifestValidationResult, validateConnectorManifest, } from './manifest.js';
37
- export { type RunOptions, type RunResult, runConnector, } from './runtime.js';
38
- export type { ConnectorContentType, ConnectorContext, ConnectorDocument, ConnectorManifest, ConnectorSyncResult, FetchLike, ManifestConfigField, TroveConnector, Watermark, } from './types.js';
36
+ export { defineSource, defineSync } from './define.js';
37
+ export { isCredentialConfigKey, type ManifestValidationResult, validateSourceManifest, } from './manifest.js';
38
+ export { type RunOptions, type RunResult, runSource, } from './runtime.js';
39
+ export type { FetchLike, ManifestConfigField, SourceContentType, SourceContext, SourceDocument, SourceManifest, SourceSyncResult, TroveSource, Watermark, } from './types.js';
39
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,KAAK,wBAAwB,EAC7B,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,SAAS,GACV,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACL,qBAAqB,EACrB,KAAK,wBAAwB,EAC7B,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,SAAS,GACV,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,19 +1,20 @@
1
1
  /**
2
- * `@ontrove/sdk` — the thin standard library for authoring **Trove connectors**.
3
- * You write a `sync(ctx)` that fetches from a source and returns documents; the
2
+ * `@ontrove/sdk` — the thin standard library for authoring **Trove sources**.
3
+ * You write a `sync(ctx)` that fetches new content and returns documents; the
4
4
  * SDK owns the document shape (which maps 1:1 onto `IngestDocumentInput`), the
5
5
  * typed `ctx` capability object, the watermark/cursor model, the local-run
6
6
  * harness the CLI drives, and manifest validation.
7
7
  *
8
- * It is the symmetric sibling of `@ontrove/mcp`: a connector returns documents to
9
- * be _stored_ (`defineConnector` + `sync`); an MCP server returns tool results to
10
- * be _read live_ (`defineMcpServer`).
8
+ * It is the symmetric sibling of `@ontrove/mcp`, the toolkit-authoring library
9
+ * (every toolkit runs as a full MCP server on Trove's cloud): a source returns
10
+ * documents to be _stored_ (`defineSource` + `sync`); a toolkit's tools return
11
+ * results to be _read live_ (`defineMcpServer`).
11
12
  *
12
13
  * @example
13
14
  * ```ts
14
- * import { defineConnector } from '@ontrove/sdk';
15
+ * import { defineSource } from '@ontrove/sdk';
15
16
  *
16
- * export default defineConnector({
17
+ * export default defineSource({
17
18
  * async sync(ctx) {
18
19
  * const res = await ctx.fetch('https://hn.algolia.com/api/v1/search?tags=front_page');
19
20
  * const { hits } = await res.json();
@@ -32,6 +33,6 @@
32
33
  *
33
34
  * @module
34
35
  */
35
- export { defineConnector, defineSync } from './define.js';
36
- export { isCredentialConfigKey, validateConnectorManifest, } from './manifest.js';
37
- export { runConnector, } from './runtime.js';
36
+ export { defineSource, defineSync } from './define.js';
37
+ export { isCredentialConfigKey, validateSourceManifest, } from './manifest.js';
38
+ export { runSource, } from './runtime.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Connector manifest validation for `trove connector validate`
3
- * (see the connectors manifest reference).
2
+ * Source manifest validation for `trove source validate`
3
+ * (see the sources manifest reference).
4
4
  *
5
5
  * Two checks live here:
6
6
  *
@@ -8,7 +8,7 @@
8
8
  * `id` pattern (`^[a-z0-9-]+$`), and well-formedness of `config`.
9
9
  * 2. **Credential-key lint** — the same spirit as the server-side
10
10
  * `validateConfig` (`src/graphql/validate-config.ts`, invariant #6): a
11
- * connector's `config` holds **user preferences only, never credentials**.
11
+ * source's `config` holds **user preferences only, never credentials**.
12
12
  * The cloud rejects writes whose config contains credential-shaped keys, so
13
13
  * the SDK lints the manifest locally to catch the mistake before deploy. Auth
14
14
  * material belongs in the (PROPOSED) `auth` block — surfaced from the macOS
@@ -28,7 +28,7 @@
28
28
  */
29
29
  export declare function isCredentialConfigKey(key: string): boolean;
30
30
  /**
31
- * The outcome of {@link validateConnectorManifest}.
31
+ * The outcome of {@link validateSourceManifest}.
32
32
  */
33
33
  export interface ManifestValidationResult {
34
34
  /** True when no errors were found. */
@@ -37,7 +37,7 @@ export interface ManifestValidationResult {
37
37
  errors: string[];
38
38
  }
39
39
  /**
40
- * Validate a connector `manifest.json` for `trove connector validate`.
40
+ * Validate a source `manifest.json` for `trove source validate`.
41
41
  *
42
42
  * Checks required fields and the `id`/`version` patterns, validates the `config`
43
43
  * descriptors, and runs the credential-key lint (rejecting credential-shaped
@@ -48,5 +48,5 @@ export interface ManifestValidationResult {
48
48
  * @param manifest - The parsed manifest object to validate.
49
49
  * @returns `{ valid, errors }` — `valid: true` with an empty `errors` array on success.
50
50
  */
51
- export declare function validateConnectorManifest(manifest: unknown): ManifestValidationResult;
51
+ export declare function validateSourceManifest(manifest: unknown): ManifestValidationResult;
52
52
  //# sourceMappingURL=manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA+CH;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG1D;AAuCD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,sCAAsC;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,iEAAiE;IACjE,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,OAAO,GAAG,wBAAwB,CAkCrF"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA+CH;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG1D;AAuCD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,sCAAsC;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,iEAAiE;IACjE,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,GAAG,wBAAwB,CAkClF"}
package/dist/manifest.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Connector manifest validation for `trove connector validate`
3
- * (see the connectors manifest reference).
2
+ * Source manifest validation for `trove source validate`
3
+ * (see the sources manifest reference).
4
4
  *
5
5
  * Two checks live here:
6
6
  *
@@ -8,7 +8,7 @@
8
8
  * `id` pattern (`^[a-z0-9-]+$`), and well-formedness of `config`.
9
9
  * 2. **Credential-key lint** — the same spirit as the server-side
10
10
  * `validateConfig` (`src/graphql/validate-config.ts`, invariant #6): a
11
- * connector's `config` holds **user preferences only, never credentials**.
11
+ * source's `config` holds **user preferences only, never credentials**.
12
12
  * The cloud rejects writes whose config contains credential-shaped keys, so
13
13
  * the SDK lints the manifest locally to catch the mistake before deploy. Auth
14
14
  * material belongs in the (PROPOSED) `auth` block — surfaced from the macOS
@@ -20,7 +20,7 @@
20
20
  * @module
21
21
  */
22
22
  /**
23
- * Credential-shaped key patterns that may NOT appear in a connector's `config`
23
+ * Credential-shaped key patterns that may NOT appear in a source's `config`
24
24
  * (invariant #6). Mirrors the authoritative cloud deny-list in
25
25
  * `src/graphql/validate-config.ts`. Matched case-insensitively and
26
26
  * separator-insensitively as substrings, so `apiKey`, `api_key`, `access_token`,
@@ -99,11 +99,11 @@ function validateConfigBlock(config, errors) {
99
99
  if (offending.length > 0) {
100
100
  const unique = [...new Set(offending)];
101
101
  errors.push(`manifest.config must not contain credential-shaped key(s): ${unique.join(', ')}. ` +
102
- 'Connector credentials belong in the macOS Keychain (declared as `auth`), not in `config`.');
102
+ 'Source credentials belong in the macOS Keychain (declared as `auth`), not in `config`.');
103
103
  }
104
104
  }
105
105
  /**
106
- * Validate a connector `manifest.json` for `trove connector validate`.
106
+ * Validate a source `manifest.json` for `trove source validate`.
107
107
  *
108
108
  * Checks required fields and the `id`/`version` patterns, validates the `config`
109
109
  * descriptors, and runs the credential-key lint (rejecting credential-shaped
@@ -114,7 +114,7 @@ function validateConfigBlock(config, errors) {
114
114
  * @param manifest - The parsed manifest object to validate.
115
115
  * @returns `{ valid, errors }` — `valid: true` with an empty `errors` array on success.
116
116
  */
117
- export function validateConnectorManifest(manifest) {
117
+ export function validateSourceManifest(manifest) {
118
118
  const errors = [];
119
119
  if (manifest === null || typeof manifest !== 'object' || Array.isArray(manifest)) {
120
120
  return { valid: false, errors: ['manifest must be a JSON object'] };
package/dist/runtime.d.ts CHANGED
@@ -1,32 +1,32 @@
1
1
  /**
2
- * The local-run harness — what makes `trove connector dev` / `trove connector test`
3
- * work (connectors/sdk-reference; connectors/cursors-and-sources).
2
+ * The local-run harness — what makes `trove source dev` / `trove source test`
3
+ * work (sources/sdk-reference; the cursors guide).
4
4
  *
5
- * {@link runConnector} builds a {@link ConnectorContext} from a `{ config, cursor }`
5
+ * {@link runSource} builds a {@link SourceContext} from a `{ config, cursor }`
6
6
  * spec, invokes `sync(ctx)`, then normalizes and validates the result: it accepts
7
- * either a `ConnectorSyncResult` or a bare `ConnectorDocument[]`, deduplicates by
8
- * `id` (first occurrence wins, matching server-side `(source, id)` dedup), and
7
+ * either a `SourceSyncResult` or a bare `SourceDocument[]`, deduplicates by
8
+ * `id` (first occurrence wins, matching server-side `(feed, id)` dedup), and
9
9
  * validates every document's required fields, surfacing problems clearly instead
10
10
  * of pushing a malformed payload to the cloud.
11
11
  *
12
12
  * It is the symmetric sibling of `@ontrove/mcp`'s `dispatch`/`toFetchHandler`: that
13
- * runs a tool call end-to-end without the hosted runtime; this runs a connector
13
+ * runs a tool call end-to-end without the hosted runtime; this runs a source
14
14
  * sync end-to-end without the Mac app sync engine.
15
15
  *
16
16
  * @module
17
17
  */
18
- import type { ConnectorDocument, FetchLike, TroveConnector, Watermark } from './types.js';
18
+ import type { FetchLike, SourceDocument, TroveSource, Watermark } from './types.js';
19
19
  /**
20
- * The options {@link runConnector} builds a `ctx` from. The CLI passes the
21
- * source's stored config and current cursor; tests inject `fetch`, `log`, and
22
- * `now` for determinism.
20
+ * The options {@link runSource} builds a `ctx` from. The CLI passes the
21
+ * source's stored config and the feed's current cursor; tests inject `fetch`,
22
+ * `log`, and `now` for determinism.
23
23
  *
24
- * @typeParam C - The shape of the connector's typed `ctx.config` preferences.
24
+ * @typeParam C - The shape of the source's typed `ctx.config` preferences.
25
25
  */
26
26
  export interface RunOptions<C = Record<string, unknown>> {
27
27
  /** The source's preference values (no credentials). Defaults to `{}`. */
28
28
  config?: C;
29
- /** The source's current watermark. Defaults to `{ type: 'none' }`. */
29
+ /** The feed's current watermark. Defaults to `{ type: 'none' }`. */
30
30
  cursor?: Watermark;
31
31
  /** The fetch implementation to expose as `ctx.fetch`. Defaults to global `fetch`. */
32
32
  fetchImpl?: FetchLike;
@@ -36,13 +36,13 @@ export interface RunOptions<C = Record<string, unknown>> {
36
36
  now?: () => Date;
37
37
  }
38
38
  /**
39
- * The outcome of {@link runConnector}: the validated, deduped documents, the
39
+ * The outcome of {@link runSource}: the validated, deduped documents, the
40
40
  * resolved cursor, and the captured log lines. Mirrors enough of what the cloud
41
- * ingest reports for `trove connector test` to print a useful summary.
41
+ * ingest reports for `trove source test` to print a useful summary.
42
42
  */
43
43
  export interface RunResult {
44
44
  /** The validated, deduped documents `sync` returned. */
45
- documents: ConnectorDocument[];
45
+ documents: SourceDocument[];
46
46
  /** The cursor `sync` returned, or `{ type: 'none' }` if it returned none. */
47
47
  cursor: Watermark;
48
48
  /** Captured `ctx.log(...)` lines (when no custom `logSink` was supplied). */
@@ -51,20 +51,20 @@ export interface RunResult {
51
51
  duplicatesSkipped: number;
52
52
  }
53
53
  /**
54
- * Run a connector's `sync` against a built `ctx` and collect/validate the result.
54
+ * Run a source's `sync` against a built `ctx` and collect/validate the result.
55
55
  *
56
- * This is the harness the CLI drives for `trove connector dev` / `trove connector
57
- * test`: it builds the {@link ConnectorContext} from `{ config, cursor }`, runs
56
+ * This is the harness the CLI drives for `trove source dev` / `trove source
57
+ * test`: it builds the {@link SourceContext} from `{ config, cursor }`, runs
58
58
  * `sync(ctx)`, normalizes a bare-array return, validates every document's
59
59
  * required fields (clear, indexed errors), and dedups by `id`. Errors thrown by
60
60
  * `sync` itself propagate unchanged so the CLI can report a failed run exactly as
61
61
  * the Mac app would.
62
62
  *
63
- * @typeParam C - The shape of the connector's typed `ctx.config` preferences.
64
- * @param connector - The connector whose `sync` to run.
63
+ * @typeParam C - The shape of the source's typed `ctx.config` preferences.
64
+ * @param source - The source whose `sync` to run.
65
65
  * @param options - The `{ config, cursor }` spec plus test injection points.
66
66
  * @returns The validated, deduped {@link RunResult}.
67
67
  * @throws {Error} If `sync` throws, returns a malformed value, or a document fails validation.
68
68
  */
69
- export declare function runConnector<C = Record<string, unknown>>(connector: TroveConnector<C>, options?: RunOptions<C>): Promise<RunResult>;
69
+ export declare function runSource<C = Record<string, unknown>>(source: TroveSource<C>, options?: RunOptions<C>): Promise<RunResult>;
70
70
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAEV,iBAAiB,EAEjB,SAAS,EACT,cAAc,EACd,SAAS,EACV,MAAM,YAAY,CAAC;AAKpB;;;;;;GAMG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrD,yEAAyE;IACzE,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,sEAAsE;IACtE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,qFAAqF;IACrF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,wFAAwF;IACxF,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,wDAAwD;IACxD,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,6EAA6E;IAC7E,MAAM,EAAE,SAAS,CAAC;IAClB,6EAA6E;IAC7E,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;IAClB,mEAAmE;IACnE,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AA+ED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5D,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,EAC5B,OAAO,GAAE,UAAU,CAAC,CAAC,CAAM,GAC1B,OAAO,CAAC,SAAS,CAAC,CAgCpB"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EAEd,WAAW,EACX,SAAS,EACV,MAAM,YAAY,CAAC;AAKpB;;;;;;GAMG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrD,yEAAyE;IACzE,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,oEAAoE;IACpE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,qFAAqF;IACrF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,wFAAwF;IACxF,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,wDAAwD;IACxD,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,6EAA6E;IAC7E,MAAM,EAAE,SAAS,CAAC;IAClB,6EAA6E;IAC7E,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;IAClB,mEAAmE;IACnE,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AA+ED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,OAAO,GAAE,UAAU,CAAC,CAAC,CAAM,GAC1B,OAAO,CAAC,SAAS,CAAC,CAgCpB"}