@xynolog/sdk 0.8.0 → 0.8.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 +70 -65
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://app.codecov.io/gh/xynolog/sdk/components)
|
|
5
5
|
[](https://www.npmjs.com/package/@xynolog/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@xynolog/sdk)
|
|
7
|
-
[](https://github.com/xynolog/sdk/blob/
|
|
7
|
+
[](https://github.com/xynolog/sdk/blob/v0.8.1/LICENSE)
|
|
8
8
|
|
|
9
9
|
The TypeScript SDK for [Xynolog](https://github.com/xynolog/sdk), an open platform for building
|
|
10
10
|
trusted AI knowledge bases: a shared workspace where humans and AI agents
|
|
@@ -17,10 +17,10 @@ A person's application and an AI agent use the same client. The SDK does not
|
|
|
17
17
|
tell them apart.
|
|
18
18
|
|
|
19
19
|
It has the same namespaces, methods and behaviour as the
|
|
20
|
-
[Rust SDK](https://github.com/xynolog/sdk/tree/
|
|
21
|
-
the [Python SDK](https://github.com/xynolog/sdk/tree/
|
|
22
|
-
the [Go SDK](https://github.com/xynolog/sdk/tree/
|
|
23
|
-
and the [Kotlin SDK](https://github.com/xynolog/sdk/tree/
|
|
20
|
+
[Rust SDK](https://github.com/xynolog/sdk/tree/v0.8.1/rust/sdk) ([`xynolog`](https://crates.io/crates/xynolog) on crates.io)
|
|
21
|
+
the [Python SDK](https://github.com/xynolog/sdk/tree/v0.8.1/python/sdk) ([`xynolog`](https://pypi.org/project/xynolog/) on PyPI)
|
|
22
|
+
the [Go SDK](https://github.com/xynolog/sdk/tree/v0.8.1/go) ([`github.com/xynolog/sdk/go`](https://pkg.go.dev/github.com/xynolog/sdk/go) on pkg.go.dev)
|
|
23
|
+
and the [Kotlin SDK](https://github.com/xynolog/sdk/tree/v0.8.1/kotlin/sdk), for Kotlin and Java programs,
|
|
24
24
|
and the five are held to the same [conformance suite](https://github.com/xynolog/protocol/tree/main/conformance/sdk).
|
|
25
25
|
New to Xynolog? The [Introduction](https://github.com/xynolog/docs/blob/main/builder/INTRODUCTION.md)
|
|
26
26
|
explains the domain and the ideas the API falls out of.
|
|
@@ -31,12 +31,64 @@ explains the domain and the ideas the API falls out of.
|
|
|
31
31
|
npm install @xynolog/sdk
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
Below 1.0 the minor number is the break, and the caret range npm writes into `package.json`
|
|
35
|
+
takes the releases up to the next minor and no further.
|
|
36
|
+
|
|
34
37
|
It runs in a browser and in Node. In a browser it needs Chrome 116, Firefox 124 or Safari 17.4,
|
|
35
38
|
or later: its transport joins abort signals with `AbortSignal.any`, which each of those was the
|
|
36
39
|
first version to have. A client speaks to a running knowledge base.
|
|
37
40
|
The [Quick Start](https://github.com/xynolog/docs/blob/main/builder/QUICK-START.md) sets one up on
|
|
38
41
|
your own machine.
|
|
39
42
|
|
|
43
|
+
## A first program
|
|
44
|
+
|
|
45
|
+
From a signed-in session, and the paper's bytes as `file`, this ingests the
|
|
46
|
+
paper, has a model mark the concepts it mentions, gathers the context around
|
|
47
|
+
it, and generates a summary grounded in that context. Those are the [Quick Start](https://github.com/xynolog/docs/blob/main/builder/QUICK-START.md)'s
|
|
48
|
+
last two steps, from code, and the two that come next. [Connect](#connect) is
|
|
49
|
+
how a session comes to be signed in.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// Ingest: the paper's bytes become a resource.
|
|
53
|
+
const { resourceId } = await session.client.yield.resource({
|
|
54
|
+
name: 'Attention Is All You Need',
|
|
55
|
+
file, // a browser File or a Node Buffer
|
|
56
|
+
format: 'application/pdf',
|
|
57
|
+
storageUri: 'file://papers/attention-is-all-you-need.pdf',
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Annotate: a model reads it and marks each mention of a concept.
|
|
61
|
+
await session.client.mark.delegate(resourceId, { motivation: 'linking', entityTypes: ['Concept'] });
|
|
62
|
+
|
|
63
|
+
// Gather: the paper, its annotations, and what the knowledge base holds around it.
|
|
64
|
+
const context = await session.client.gather.resource(resourceId);
|
|
65
|
+
|
|
66
|
+
// Generate: a new resource, grounded in that context and linked to its source.
|
|
67
|
+
const done = await session.client.yield.delegate({
|
|
68
|
+
title: 'Attention Is All You Need: a summary',
|
|
69
|
+
storageUri: 'file://generated/attention-summary.md',
|
|
70
|
+
context,
|
|
71
|
+
task: 'summary',
|
|
72
|
+
});
|
|
73
|
+
if (done.result && 'resourceId' in done.result) {
|
|
74
|
+
console.log('The summary is', done.result.resourceId);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
opened.dispose(); // what the sign-in gave (Connect): its client, then the session
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Both resources, and every annotation the model made, are in the knowledge base
|
|
81
|
+
for the next participant, person or agent, to read and build on.
|
|
82
|
+
|
|
83
|
+
Where to go from here:
|
|
84
|
+
|
|
85
|
+
- The [Developer Guide](https://github.com/xynolog/docs/blob/main/builder/DEVELOPER-GUIDE.md) has
|
|
86
|
+
each of these steps as a recipe, and the ones after them: reading, searching,
|
|
87
|
+
annotating by hand, reacting to what others do, and testing.
|
|
88
|
+
- The [agent skills](https://github.com/xynolog/docs/tree/main/builder/skills) are whole scripts on
|
|
89
|
+
this SDK, one per task, for an AI coding assistant to load: ingesting a
|
|
90
|
+
corpus, annotating it, linking it, and the layers built on those.
|
|
91
|
+
|
|
40
92
|
## Connect
|
|
41
93
|
|
|
42
94
|
Sign-in happens at the knowledge base's identity provider, never at the gateway. A script uses
|
|
@@ -135,7 +187,7 @@ request trusts, and the proxy it goes through, are that fetch's: the SDK reads n
|
|
|
135
187
|
own for either. In Node, a gateway whose certificate another authority signed is reached with
|
|
136
188
|
undici's `fetch` sent through an `Agent` that trusts that authority; in a browser page, the
|
|
137
189
|
browser decides.
|
|
138
|
-
[`@xynolog/http-transport`](https://github.com/xynolog/sdk/tree/
|
|
190
|
+
[`@xynolog/http-transport`](https://github.com/xynolog/sdk/tree/v0.8.1/typescript/http-transport#the-fetch-it-sends-with)
|
|
139
191
|
says which requests that covers.
|
|
140
192
|
|
|
141
193
|
## Eight verbs
|
|
@@ -159,55 +211,6 @@ Beside the eight are `job`, and `auth` and `system` when the client has a
|
|
|
159
211
|
gateway. What each flow means is in
|
|
160
212
|
[protocol/contract/flows](https://github.com/xynolog/protocol/tree/main/contract/flows).
|
|
161
213
|
|
|
162
|
-
## A first program
|
|
163
|
-
|
|
164
|
-
From a signed-in session, this ingests a paper, has a model mark the concepts
|
|
165
|
-
it mentions, gathers the context around it, and generates a summary grounded
|
|
166
|
-
in that context. Those are the [Quick Start](https://github.com/xynolog/docs/blob/main/builder/QUICK-START.md)'s
|
|
167
|
-
last two steps, from code, and the two that come next. [Connect](#connect) is
|
|
168
|
-
how a session comes to be signed in.
|
|
169
|
-
|
|
170
|
-
```ts
|
|
171
|
-
// Ingest: the paper's bytes become a resource.
|
|
172
|
-
const { resourceId } = await session.client.yield.resource({
|
|
173
|
-
name: 'Attention Is All You Need',
|
|
174
|
-
file, // a browser File or a Node Buffer
|
|
175
|
-
format: 'application/pdf',
|
|
176
|
-
storageUri: 'file://papers/attention-is-all-you-need.pdf',
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// Annotate: a model reads it and marks each mention of a concept.
|
|
180
|
-
await session.client.mark.delegate(resourceId, { motivation: 'linking', entityTypes: ['Concept'] });
|
|
181
|
-
|
|
182
|
-
// Gather: the paper, its annotations, and what the knowledge base holds around it.
|
|
183
|
-
const context = await session.client.gather.resource(resourceId);
|
|
184
|
-
|
|
185
|
-
// Generate: a new resource, grounded in that context and linked to its source.
|
|
186
|
-
const done = await session.client.yield.delegate({
|
|
187
|
-
title: 'Attention Is All You Need: a summary',
|
|
188
|
-
storageUri: 'file://generated/attention-summary.md',
|
|
189
|
-
context,
|
|
190
|
-
task: 'summary',
|
|
191
|
-
});
|
|
192
|
-
if (done.result && 'resourceId' in done.result) {
|
|
193
|
-
console.log('The summary is', done.result.resourceId);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
opened.dispose(); // what the sign-in gave (Connect): its client, then the session
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
Both resources, and every annotation the model made, are in the knowledge base
|
|
200
|
-
for the next participant, person or agent, to read and build on.
|
|
201
|
-
|
|
202
|
-
Where to go from here:
|
|
203
|
-
|
|
204
|
-
- The [Developer Guide](https://github.com/xynolog/docs/blob/main/builder/DEVELOPER-GUIDE.md) has
|
|
205
|
-
each of these steps as a recipe, and the ones after them: reading, searching,
|
|
206
|
-
annotating by hand, reacting to what others do, and testing.
|
|
207
|
-
- The [agent skills](https://github.com/xynolog/docs/tree/main/builder/skills) are whole scripts on
|
|
208
|
-
this SDK, one per task, for an AI coding assistant to load: ingesting a
|
|
209
|
-
corpus, annotating it, linking it, and the layers built on those.
|
|
210
|
-
|
|
211
214
|
## One call, two ways to consume
|
|
212
215
|
|
|
213
216
|
Every long-lived value is an `Observable` with an explicit one-shot path — from the same
|
|
@@ -331,7 +334,7 @@ claims.subscribe(async (job) => {
|
|
|
331
334
|
trace OpenTelemetry has active when the reply arrives, so in a process that has set up
|
|
332
335
|
no OpenTelemetry it is `undefined`, as every trace is there.
|
|
333
336
|
|
|
334
|
-
The [`xynolog-worker` skill](https://github.com/xynolog/sdk/blob/
|
|
337
|
+
The [`xynolog-worker` skill](https://github.com/xynolog/sdk/blob/v0.8.1/skills/xynolog-worker/SKILL.md)
|
|
335
338
|
is a whole worker, sign-in to shutdown, and
|
|
336
339
|
[`protocol/contract/WORKER-CONTRACT.md`](https://github.com/xynolog/protocol/blob/main/contract/WORKER-CONTRACT.md)
|
|
337
340
|
is what a worker promises the dispatcher.
|
|
@@ -380,7 +383,7 @@ is what a worker promises the dispatcher.
|
|
|
380
383
|
|
|
381
384
|
This is everything a non-web consumer (TUI, mobile, daemon, agent) needs — nothing
|
|
382
385
|
page-shaped. Page-level state machines and components, including the **embeddable
|
|
383
|
-
`ResourceViewer`**, live in [`@xynolog/react-ui`](https://github.com/xynolog/sdk/tree/
|
|
386
|
+
`ResourceViewer`**, live in [`@xynolog/react-ui`](https://github.com/xynolog/sdk/tree/v0.8.1/typescript/react-ui).
|
|
384
387
|
|
|
385
388
|
## Documentation
|
|
386
389
|
|
|
@@ -396,14 +399,16 @@ who the SDK is for, where it goes, and the docs in reading order.
|
|
|
396
399
|
|
|
397
400
|
## Related packages
|
|
398
401
|
|
|
399
|
-
- [`xynolog`](https://github.com/xynolog/sdk/tree/
|
|
400
|
-
- [`xynolog`](https://github.com/xynolog/sdk/tree/
|
|
401
|
-
- [`github.com/xynolog/sdk/go`](https://github.com/xynolog/sdk/tree/
|
|
402
|
-
- [`@xynolog/core`](https://github.com/xynolog/sdk/tree/
|
|
403
|
-
- [`@xynolog/http-transport`](https://github.com/xynolog/sdk/tree/
|
|
404
|
-
- [`@xynolog/observability`](https://github.com/xynolog/sdk/tree/
|
|
405
|
-
- [`@xynolog/react-ui`](https://github.com/xynolog/sdk/tree/
|
|
402
|
+
- [`xynolog`](https://github.com/xynolog/sdk/tree/v0.8.1/rust/sdk) — the Rust SDK, a full peer of this one, on [crates.io](https://crates.io/crates/xynolog)
|
|
403
|
+
- [`xynolog`](https://github.com/xynolog/sdk/tree/v0.8.1/python/sdk) — the Python SDK, on [PyPI](https://pypi.org/project/xynolog/)
|
|
404
|
+
- [`github.com/xynolog/sdk/go`](https://github.com/xynolog/sdk/tree/v0.8.1/go) — the Go SDK, on [pkg.go.dev](https://pkg.go.dev/github.com/xynolog/sdk/go), which the `xynolog` launcher is built on
|
|
405
|
+
- [`@xynolog/core`](https://github.com/xynolog/sdk/tree/v0.8.1/typescript/core) — domain types, `ITransport` contract, `Bus`, OpenAPI-derived schemas
|
|
406
|
+
- [`@xynolog/http-transport`](https://github.com/xynolog/sdk/tree/v0.8.1/typescript/http-transport) — HTTP transport (`HttpTransport`, `HttpContentTransport`)
|
|
407
|
+
- [`@xynolog/observability`](https://github.com/xynolog/sdk/tree/v0.8.1/typescript/observability) — OpenTelemetry tracing the SDK propagates across the bus
|
|
408
|
+
- [`@xynolog/react-ui`](https://github.com/xynolog/sdk/tree/v0.8.1/typescript/react-ui) — the embeddable `ResourceViewer` (bring-your-own-session) plus React hooks (`useResourceLoader`, `useMediaToken`, `useObservable`) and the web `SessionStorage`; its docs cross-link the [Developer Guide](https://github.com/xynolog/docs/blob/main/builder/DEVELOPER-GUIDE.md)
|
|
406
409
|
|
|
407
410
|
## License
|
|
408
411
|
|
|
409
|
-
Apache-2.0 — see [LICENSE](https://github.com/xynolog/sdk/blob/
|
|
412
|
+
Apache-2.0 — see [LICENSE](https://github.com/xynolog/sdk/blob/v0.8.1/LICENSE).
|
|
413
|
+
|
|
414
|
+
Working on the SDK itself? See [CONTRIBUTING.md](https://github.com/xynolog/sdk/blob/main/CONTRIBUTING.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynolog/sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Xynolog SDK — XynologClient, namespaces, session/browser, state units, and the bus-request/cache helpers. Transport-agnostic; pair with @xynolog/http-transport (HttpTransport) for the wire.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"url": "git+https://github.com/xynolog/sdk.git",
|
|
33
33
|
"directory": "typescript/sdk"
|
|
34
34
|
},
|
|
35
|
+
"homepage": "https://github.com/xynolog/sdk#readme",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/xynolog/sdk/issues"
|
|
38
|
+
},
|
|
35
39
|
"scripts": {
|
|
36
40
|
"typecheck": "tsc --noEmit",
|
|
37
41
|
"typecheck:conformance": "tsc -p conformance",
|
|
@@ -43,9 +47,9 @@
|
|
|
43
47
|
"test:coverage": "vitest run --coverage"
|
|
44
48
|
},
|
|
45
49
|
"dependencies": {
|
|
46
|
-
"@xynolog/core": "0.8.
|
|
47
|
-
"@xynolog/http-transport": "0.8.
|
|
48
|
-
"@xynolog/observability": "0.8.
|
|
50
|
+
"@xynolog/core": "0.8.1",
|
|
51
|
+
"@xynolog/http-transport": "0.8.1",
|
|
52
|
+
"@xynolog/observability": "0.8.1",
|
|
49
53
|
"rxjs": "^7.8.1"
|
|
50
54
|
},
|
|
51
55
|
"devDependencies": {
|