@stackbone/sdk 0.1.0-alpha.1 → 0.1.0-alpha.2
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 +43 -0
- package/README.md +13 -12
- package/index.cjs +167 -231
- package/index.cjs.map +1 -1
- package/index.d.cts +64 -7
- package/index.d.ts +64 -7
- package/index.js +167 -231
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/stackbone-sdk-0.1.0-alpha.2.tgz +0 -0
- package/stackbone-sdk-0.1.0-alpha.1.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.0-alpha.2] - 2026-05-18
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `client.rag.ingest` (batched mode, e.g. when an `onProgress` callback or a
|
|
15
|
+
`jobWriter` is wired): every chunk batch was wrapping its INSERT in a
|
|
16
|
+
transaction that first ran `DELETE FROM rag_chunks WHERE namespace=? AND
|
|
17
|
+
doc_id=?`. With N batches per document, only the rows inserted by the LAST
|
|
18
|
+
batch survived — every earlier slice was wiped by the next batch's DELETE.
|
|
19
|
+
Split the DELETE into a single `clearDocument` call before the loop;
|
|
20
|
+
`ingestDocument` now only INSERTs its slice.
|
|
21
|
+
- `client.rag` error mapping: `42P01 relation does not exist` was only
|
|
22
|
+
translated to `SdkError('rag_schema_missing')` from the pipeline path.
|
|
23
|
+
`reset()`, the database-handle resolver, and `client.rag.ingestAsync`'s job
|
|
24
|
+
writer used a divergent local copy of `toRagError` that surfaced the raw
|
|
25
|
+
Postgres code instead. Consolidated all three call sites onto a shared
|
|
26
|
+
`modules/rag/errors.ts` so the schema-missing hint is consistent.
|
|
27
|
+
- `RunStepsSpanProcessor.stepIdBySpanId`: spans without a `stackbone.run.id`
|
|
28
|
+
attribute leaked their reservation in the map — `buildRow` returned early
|
|
29
|
+
before the cleanup line ran. Cleanup now happens unconditionally on every
|
|
30
|
+
`onEnd`, so dropped spans no longer accumulate.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- OTLP log records sent by `createPlatformLogger` now carry the actual
|
|
35
|
+
installed SDK version under `scope.version`. Previously every record was
|
|
36
|
+
tagged with a hardcoded `'0.0.1'` regardless of what was published.
|
|
37
|
+
- `client.rag.reset()` invalidates the cached schema fingerprint, so the
|
|
38
|
+
first ingest after a reset re-provisions the schema without serving a
|
|
39
|
+
stale `rag_dim_mismatch`.
|
|
40
|
+
- `client.rag.ingest`: `ensureSchema` now memoises the verified dimensions
|
|
41
|
+
per `Sql` instance, dropping the per-call `_rag_meta` SELECT on the hot
|
|
42
|
+
path. The `stackbone_rag_jobs` writer also collapses its
|
|
43
|
+
`ensureCollection` lookup to a single `INSERT … ON CONFLICT … RETURNING`
|
|
44
|
+
(was a `SELECT` followed by an upsert) and trims `isCancelled` to
|
|
45
|
+
`SELECT status … LIMIT 1`.
|
|
46
|
+
- `OtlpLogsBody` serialisation no longer iterates `Object.entries(LOG_LEVELS)`
|
|
47
|
+
per record to map level numbers to severity text — precomputed lookup
|
|
48
|
+
table replaces the linear scan.
|
|
49
|
+
- `RagModule` test seams (`sqlProvider`, `jobWriterFactory`) now flow
|
|
50
|
+
through a typed 4th constructor parameter (`RagModuleTestDeps`) instead of
|
|
51
|
+
private fields mutated via `as unknown as` casts.
|
|
52
|
+
|
|
10
53
|
## [0.1.0-alpha.1] - 2026-05-15
|
|
11
54
|
|
|
12
55
|
### BREAKING
|
package/README.md
CHANGED
|
@@ -15,13 +15,13 @@ Official TypeScript SDK for [Stackbone](https://stackbone.ai) — the marketplac
|
|
|
15
15
|
- **AI** — Wrapper around the official `openai` SDK pointed at OpenRouter, so 300+ chat, embedding and image models are reachable through a single OpenAI-compatible API
|
|
16
16
|
- **Queues** _(coming soon)_ — Cross-container HTTP push via QStash, with typed job payloads through module augmentation
|
|
17
17
|
- **RAG** — Document parsing, chunking and `pgvector`-backed retrieval through a flat, ceremony-free API
|
|
18
|
-
- **Memory** _(
|
|
19
|
-
- **Prompts** _(
|
|
20
|
-
- **Observability**
|
|
18
|
+
- **Memory** _(surface defined; runtime pending)_ — Long-term agent memory backed by mem0: ingest text or whole conversations, semantic search, per-user / per-session / per-agent scoping, GDPR delete-all, audit history and session lifecycle hooks
|
|
19
|
+
- **Prompts** _(surface defined; runtime pending)_ — Managed prompts stored in the Stackbone control plane: fetch by name with optional version pinning, compile Mustache `{{var}}` templates against a variables map, and full CRUD so prompts can evolve without rebuilding the container
|
|
20
|
+
- **Observability** — OpenTelemetry span processor + run-cost aggregator + per-run logger
|
|
21
21
|
- **Approval** — Human-in-the-loop inbox: fire-and-forget approval requests, HMAC-signed decision callbacks, and an LLM tool wrapper that gates execution behind human review
|
|
22
|
-
- **Secrets** — Read
|
|
22
|
+
- **Secrets** — Read organization-encrypted secrets registered in the dashboard, no client-side cache so rotations propagate immediately
|
|
23
23
|
- **Config** — Typed reads of dynamic per-agent configuration the user set in the dashboard
|
|
24
|
-
- **Connections / Events**
|
|
24
|
+
- **Connections / Events** — OAuth integrations (Notion, GDrive, Slack…) and an organization event bus
|
|
25
25
|
- **TypeScript-first** — Full type definitions and a uniform `Result<T>` envelope on every method (no thrown errors at the SDK boundary)
|
|
26
26
|
- **Lazy initialization** — Modules and partner SDKs are constructed on first access, so env vars rotated by the control plane after `createClient()` are still picked up
|
|
27
27
|
|
|
@@ -327,7 +327,7 @@ await stackbone.rag.reset();
|
|
|
327
327
|
|
|
328
328
|
`client.approval` exposes a **fire-and-forget** primitive: the agent issues an approval request, the call returns immediately with the `approvalId` and a `callbackUrl`, and the control plane POSTs the human's decision to the endpoint the agent registered in `onDecide`. The callback is HMAC-signed (`Stackbone-Signature: t=<unix>,v1=<hex>`) so the agent can authenticate it without storing any per-approval secret.
|
|
329
329
|
|
|
330
|
-
This shape decouples waiting from the container lifecycle — the agent does not have to keep a long-poll connection alive while a human reviews, which means it survives
|
|
330
|
+
This shape decouples waiting from the container lifecycle — the agent does not have to keep a long-poll connection alive while a human reviews, which means it survives idle scale-to-zero and arbitrary numbers of concurrent approvals without tying up sockets.
|
|
331
331
|
|
|
332
332
|
```ts
|
|
333
333
|
// 1. Issue an approval — returns immediately, the human reviews asynchronously.
|
|
@@ -432,7 +432,7 @@ The signing key for `verify()` is read from `STACKBONE_APPROVAL_SIGNING_KEY` (or
|
|
|
432
432
|
|
|
433
433
|
### Secrets
|
|
434
434
|
|
|
435
|
-
`client.secrets` reads
|
|
435
|
+
`client.secrets` reads organization-encrypted secrets the user registered in the dashboard. The SDK is **read-only** by design — secrets are managed in the control plane, never written from inside an agent container. There is no client-side cache: every `get()` is a network call so dashboard rotations propagate immediately.
|
|
436
436
|
|
|
437
437
|
```ts
|
|
438
438
|
// Single secret — `secrets_not_found` error if the name is not registered.
|
|
@@ -468,7 +468,7 @@ const { data: cfg } = await stackbone.config.getMany<{
|
|
|
468
468
|
}>(['reply_tone', 'max_emails']);
|
|
469
469
|
```
|
|
470
470
|
|
|
471
|
-
`secrets.get` returns `secrets_not_found` (with the name in `meta`) when the secret is missing; `config.get` returns `config_not_found` symmetrically. Both `getMany` calls return whatever subset the
|
|
471
|
+
`secrets.get` returns `secrets_not_found` (with the name in `meta`) when the secret is missing; `config.get` returns `config_not_found` symmetrically. Both `getMany` calls return whatever subset the organization has registered — no error for missing entries.
|
|
472
472
|
|
|
473
473
|
### Memory
|
|
474
474
|
|
|
@@ -552,7 +552,7 @@ await stackbone.queues.publish({
|
|
|
552
552
|
retries: 3,
|
|
553
553
|
});
|
|
554
554
|
|
|
555
|
-
// Emit an event to the
|
|
555
|
+
// Emit an event to the organization event bus.
|
|
556
556
|
await stackbone.events.emit('lead.qualified', { leadId: 42 });
|
|
557
557
|
|
|
558
558
|
// List OAuth connections the user attached (Notion, GDrive, Slack…).
|
|
@@ -571,8 +571,8 @@ const stackbone = createClient({
|
|
|
571
571
|
stackboneApiUrl: 'https://api.stackbone.ai',
|
|
572
572
|
// Stable agent identifier used as storage key prefix → STACKBONE_AGENT_ID
|
|
573
573
|
agentId: 'agent_abc123',
|
|
574
|
-
// Postgres connection string for `client.rag`
|
|
575
|
-
//
|
|
574
|
+
// Postgres connection string for `client.database`, `client.rag` and the
|
|
575
|
+
// observability exporter → STACKBONE_POSTGRES_URL
|
|
576
576
|
databaseUrl: 'postgresql://...',
|
|
577
577
|
// OpenRouter credentials → OPENROUTER_API_KEY / OPENROUTER_BASE_URL
|
|
578
578
|
openrouterKey: '...',
|
|
@@ -586,12 +586,13 @@ const stackbone = createClient({
|
|
|
586
586
|
mem0BaseUrl: 'https://api.mem0.ai',
|
|
587
587
|
// HMAC key for verifying approval-decision callbacks → STACKBONE_APPROVAL_SIGNING_KEY
|
|
588
588
|
approvalSigningKey: '...',
|
|
589
|
-
// Object storage credentials →
|
|
589
|
+
// Object storage credentials → STACKBONE_S3_ACCESS_KEY / STACKBONE_S3_SECRET_KEY / STACKBONE_S3_ENDPOINT / STACKBONE_S3_BUCKET / STACKBONE_S3_REGION
|
|
590
590
|
s3: {
|
|
591
591
|
accessKeyId: '...',
|
|
592
592
|
secretAccessKey: '...',
|
|
593
593
|
endpoint: 'https://<account>.r2.cloudflarestorage.com',
|
|
594
594
|
bucket: 'stackbone-prod',
|
|
595
|
+
region: 'auto',
|
|
595
596
|
},
|
|
596
597
|
// OpenTelemetry exporter
|
|
597
598
|
otel: {
|