@sylphx/sdk 0.28.0 → 0.31.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/LICENSE +21 -0
- package/README.md +42 -114
- package/dist/access.d.ts +670 -0
- package/dist/access.js +640 -0
- package/dist/access.js.map +1 -0
- package/dist/ai.d.ts +176 -0
- package/dist/ai.js +112 -0
- package/dist/ai.js.map +1 -0
- package/dist/artifacts.d.ts +165 -0
- package/dist/artifacts.js +129 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/auth/verify.d.ts +57 -0
- package/dist/auth/verify.js +157 -0
- package/dist/auth/verify.js.map +1 -0
- package/dist/auth.d.ts +896 -0
- package/dist/auth.js +828 -0
- package/dist/auth.js.map +1 -0
- package/dist/billing.d.ts +854 -0
- package/dist/billing.js +593 -0
- package/dist/billing.js.map +1 -0
- package/dist/broker.d.ts +226 -0
- package/dist/broker.js +187 -0
- package/dist/broker.js.map +1 -0
- package/dist/build.d.ts +313 -0
- package/dist/build.js +271 -0
- package/dist/build.js.map +1 -0
- package/dist/common.d.ts +162 -0
- package/dist/common.js +41 -0
- package/dist/common.js.map +1 -0
- package/dist/config.d.ts +198 -0
- package/dist/config.js +168 -0
- package/dist/config.js.map +1 -0
- package/dist/connections.d.ts +354 -0
- package/dist/connections.js +313 -0
- package/dist/connections.js.map +1 -0
- package/dist/data.d.ts +1141 -0
- package/dist/data.js +1082 -0
- package/dist/data.js.map +1 -0
- package/dist/entitlement.d.ts +179 -0
- package/dist/entitlement.js +117 -0
- package/dist/entitlement.js.map +1 -0
- package/dist/events.d.ts +1324 -0
- package/dist/events.js +1227 -0
- package/dist/events.js.map +1 -0
- package/dist/hosting.d.ts +709 -0
- package/dist/hosting.js +611 -0
- package/dist/hosting.js.map +1 -0
- package/dist/index.d.ts +79 -33656
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +438 -0
- package/dist/keys.js +406 -0
- package/dist/keys.js.map +1 -0
- package/dist/methods.d.ts +2 -0
- package/dist/methods.js +4200 -0
- package/dist/methods.js.map +1 -0
- package/dist/network.d.ts +733 -0
- package/dist/network.js +711 -0
- package/dist/network.js.map +1 -0
- package/dist/notify.d.ts +1753 -0
- package/dist/notify.js +1551 -0
- package/dist/notify.js.map +1 -0
- package/dist/observability.d.ts +509 -0
- package/dist/observability.js +437 -0
- package/dist/observability.js.map +1 -0
- package/dist/release.d.ts +303 -0
- package/dist/release.js +214 -0
- package/dist/release.js.map +1 -0
- package/dist/runners.d.ts +262 -0
- package/dist/runners.js +238 -0
- package/dist/runners.js.map +1 -0
- package/dist/runtime.d.ts +121 -0
- package/dist/runtime.js +305 -0
- package/dist/runtime.js.map +1 -0
- package/dist/sandboxes.d.ts +1705 -0
- package/dist/sandboxes.js +1226 -0
- package/dist/sandboxes.js.map +1 -0
- package/dist/secrets.d.ts +508 -0
- package/dist/secrets.js +474 -0
- package/dist/secrets.js.map +1 -0
- package/dist/workflows.d.ts +678 -0
- package/dist/workflows.js +595 -0
- package/dist/workflows.js.map +1 -0
- package/package.json +33 -112
- package/dist/connect.d.ts +0 -2838
- package/dist/connect.mjs +0 -220
- package/dist/connect.mjs.map +0 -1
- package/dist/health/index.d.ts +0 -1394
- package/dist/health/index.mjs +0 -1394
- package/dist/health/index.mjs.map +0 -1
- package/dist/index.mjs +0 -38429
- package/dist/index.mjs.map +0 -1
- package/dist/nextjs/index.d.ts +0 -724
- package/dist/nextjs/index.mjs +0 -3332
- package/dist/nextjs/index.mjs.map +0 -1
- package/dist/react/index.d.ts +0 -13066
- package/dist/react/index.mjs +0 -35329
- package/dist/react/index.mjs.map +0 -1
- package/dist/server/index.d.ts +0 -2000
- package/dist/server/index.mjs +0 -3446
- package/dist/server/index.mjs.map +0 -1
- package/dist/web-analytics.d.ts +0 -90
- package/dist/web-analytics.mjs +0 -225
- package/dist/web-analytics.mjs.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sylphx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,127 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sylphx/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Sylphx SDK for TypeScript and JavaScript: one API
|
|
4
|
+
(`https://api.sylphx.com`), one key, one namespace per service. Zero runtime
|
|
5
|
+
dependencies (`fetch` only); runs on Node 20+, Bun, Deno, workers, and
|
|
6
|
+
browsers (browsers with publishable keys only).
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
| --- | --- | --- |
|
|
7
|
-
| **TypeScript** | `@sylphx/sdk` → `Client` | `@sylphx/sdk` → `ManagementClient` |
|
|
8
|
-
| **Rust** | `sylphx-sdk` | `sylphx-sdk-management` |
|
|
9
|
-
|
|
10
|
-
**Wire authority:** Protobuf under `api/proto/sylphx/platform/v1/` (sole).
|
|
11
|
-
Not Effect Schema / `@sylphx/contract`.
|
|
12
|
-
|
|
13
|
-
SDK namespaces and command groups are generated or observed projections. They do
|
|
14
|
-
not create Platform primitives, semantic families, lifecycle authorities, or
|
|
15
|
-
compatibility promises. The target ontology is the four primitives `Resource`,
|
|
16
|
-
`Operation`, `Event`, and `Artifact`, with the seven semantic capability
|
|
17
|
-
families declared by the Platform Constitution.
|
|
18
|
-
|
|
19
|
-
## Install
|
|
20
|
-
|
|
21
|
-
```bash
|
|
8
|
+
```sh
|
|
22
9
|
npm install @sylphx/sdk
|
|
23
|
-
# or: bun add @sylphx/sdk
|
|
24
10
|
```
|
|
25
11
|
|
|
26
|
-
## App client (runtime / BaaS)
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
import { Client } from '@sylphx/sdk'
|
|
30
|
-
|
|
31
|
-
const client = Client.create(process.env.SYLPHX_SECRET_KEY!, 'my-tenant')
|
|
32
|
-
await client.kvSet('user:1', { name: 'Ada' }, 60)
|
|
33
|
-
const value = await client.kvGet('user:1')
|
|
34
|
-
await client.kvDelete('user:1')
|
|
35
|
-
// Typed beyond foundation (Protobuf KvIncr):
|
|
36
|
-
await client.kvIncr('visits', 1)
|
|
37
|
-
await client.kvExists('visits')
|
|
38
|
-
await client.kvExpire('visits', 3600)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Management client
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
import { ManagementClient } from '@sylphx/sdk'
|
|
45
|
-
|
|
46
|
-
const mgmt = ManagementClient.create(process.env.SYLPHX_TOKEN!)
|
|
47
|
-
await mgmt.health()
|
|
48
|
-
const me = await mgmt.whoami()
|
|
49
|
-
const projects = await mgmt.listProjects()
|
|
50
|
-
const project = await mgmt.getProject('prj_…')
|
|
51
|
-
// Typed beyond foundation (Protobuf ListEnvironments):
|
|
52
|
-
const envs = await mgmt.listEnvironments('prj_…')
|
|
53
|
-
const env = await mgmt.getEnvironment('prj_…', 'env_…')
|
|
54
|
-
const deps = await mgmt.listDeployments('prj_…')
|
|
55
|
-
// Escape hatch for any Management REST route:
|
|
56
|
-
await mgmt.api('GET', '/projects')
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Agent Computer contract projection
|
|
60
|
-
|
|
61
|
-
Agent Computer payloads, HTTP/SSE bindings, validators, and immutable contract
|
|
62
|
-
identity are generated from the management-rooted Protobuf descriptor graph.
|
|
63
|
-
These exports are the typed wire boundary; they do not imply that a live Agent
|
|
64
|
-
Computer runtime is deployed.
|
|
65
|
-
|
|
66
|
-
The contract is lifecycle-based: a caller must authenticate a `ComputerLease`,
|
|
67
|
-
wait for a provider-backed `READY` result, and use the returned evidence for
|
|
68
|
-
observe/act/postcondition decisions. Unsupported or not-yet-proven profiles
|
|
69
|
-
remain typed refusals or non-ready states; the SDK never treats a stale or
|
|
70
|
-
synthetic readiness value as a live computer.
|
|
71
|
-
|
|
72
12
|
```ts
|
|
73
|
-
import {
|
|
74
|
-
AGENT_COMPUTER_BINDINGS,
|
|
75
|
-
AGENT_COMPUTER_CONTRACT_IDENTITY_SHA256,
|
|
76
|
-
AGENT_COMPUTER_CONTRACT_REVISION,
|
|
77
|
-
validateAgentComputerRequest,
|
|
78
|
-
validateAgentComputerResponse,
|
|
79
|
-
} from '@sylphx/sdk'
|
|
13
|
+
import { Sylphx } from '@sylphx/sdk'
|
|
80
14
|
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
})
|
|
15
|
+
const sylphx = new Sylphx() // reads SYLPHX_API_KEY (and SYLPHX_BASE_URL)
|
|
16
|
+
const me = await sylphx.access.whoami({})
|
|
17
|
+
for await (const project of sylphx.access.projects.listAll({ parent: me.org })) {
|
|
18
|
+
console.log(project.name)
|
|
19
|
+
}
|
|
84
20
|
```
|
|
85
21
|
|
|
86
|
-
|
|
22
|
+
- Every service is a namespace (`sylphx.data`, `sylphx.hosting`, …) and every
|
|
23
|
+
collection an object on it (`sylphx.data.databases`), with `get`, `list`,
|
|
24
|
+
`listAll`, `create`, `update`, `delete`, and each custom method.
|
|
25
|
+
- Types are camelCase; the wire is snake_case JSON, converted by a generated
|
|
26
|
+
codec.
|
|
27
|
+
- Mutations of reconciled Resources return an `Operation`; `await op.wait()`
|
|
28
|
+
resolves to the settled Resource.
|
|
29
|
+
- Errors are `SylphxError` (`code`, `status`, `retryable`, `effect`, `detail`,
|
|
30
|
+
`requestId`) from the one RFC 9457 problem body.
|
|
31
|
+
- Retryable answers are retried with full-jitter backoff, honouring
|
|
32
|
+
`Retry-After`; each logical mutation sends one `Idempotency-Key`.
|
|
33
|
+
- `sylphx.invoke('data.databases.get', { name })` calls any method by id with
|
|
34
|
+
wire JSON.
|
|
35
|
+
- Some services also have a data plane served at their own host, with the same
|
|
36
|
+
key: Sylphx Data's objects and key-value entries are `sylphx.data.objects`
|
|
37
|
+
and `sylphx.data.kv` (at `https://api.data.sylphx.com`). Every such call
|
|
38
|
+
carries one `Sylphx-Effect-Id`, reused on its retries, so a retried write is
|
|
39
|
+
applied once.
|
|
40
|
+
- `SYLPHX_URL` and `SYLPHX_SECRET_URL` (per-project `<project>.api.sylphx.com`
|
|
41
|
+
hosts, retired on 2026-09-03) are not read; a base URL on such a host is
|
|
42
|
+
ignored with a warning.
|
|
43
|
+
- Per-service subpath imports tree-shake: `import { DataApi } from '@sylphx/sdk/data'`.
|
|
87
44
|
|
|
88
45
|
```ts
|
|
89
|
-
|
|
90
|
-
// sylphx.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Operator CLI is the **Rust** binary `sylphx` (crate `sylphx-cli`). Install via
|
|
96
|
-
either channel — same binary product:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
npm install -g @sylphx/cli # npm channel (native binary optionalDeps)
|
|
100
|
-
cargo install sylphx-cli # crates.io channel
|
|
46
|
+
// Bytes travel base64 (`body`, `value`); the bucket and namespace are Data
|
|
47
|
+
// Resources of the environment (`sylphx.data.buckets`, `sylphx.data.kvNamespaces`).
|
|
48
|
+
await sylphx.data.objects.put({ bucketId: 'uploads', key: `${orgId}/cv.pdf`, body: base64, contentType: 'application/pdf' })
|
|
49
|
+
const { body } = await sylphx.data.objects.get({ bucketId: 'uploads', key: `${orgId}/cv.pdf` })
|
|
50
|
+
const hits = await sylphx.data.kv.increment({ namespaceId: 'ratelimit', key: `ip:${ip}` })
|
|
101
51
|
```
|
|
102
52
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
# TypeScript library
|
|
107
|
-
npm install @sylphx/sdk
|
|
108
|
-
|
|
109
|
-
# Rust libraries
|
|
110
|
-
# Cargo.toml: sylphx-sdk = "0.1", sylphx-sdk-management = "0.1"
|
|
111
|
-
|
|
112
|
-
# Operator CLI (Rust binary — npm or cargo)
|
|
113
|
-
npm install -g @sylphx/cli
|
|
114
|
-
# or: cargo install sylphx-cli
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## Batch Jobs (Workload Fabric)
|
|
118
|
-
|
|
119
|
-
The current observed SDK surface uses `WorkClient` → `POST /v1/work/container`.
|
|
120
|
-
That namespace and path are projections, not target authority. The constitutional
|
|
121
|
-
target is a typed `BatchJob` Work Resource whose create, cancellation, retry,
|
|
122
|
-
repair, and terminal truth use the common `Operation` contract.
|
|
123
|
-
|
|
124
|
-
Legacy `RunsClient.run`, `runDistributed`, and compatibility-only worker/task
|
|
125
|
-
re-exports are predecessor surfaces. They are not final target contracts and
|
|
126
|
-
must be deleted rather than retained as throwing aliases.
|
|
127
|
-
|
|
53
|
+
This package is generated from the Sylphx schema registry by `sylphx-gen`; do
|
|
54
|
+
not edit it by hand. Source: `clients/typescript` in the Sylphx monorepo,
|
|
55
|
+
published from its MIT mirror.
|