@sylphx/sdk 0.28.0 → 0.30.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 +30 -118
- package/dist/access.d.ts +659 -0
- package/dist/access.js +638 -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.d.ts +896 -0
- package/dist/auth.js +828 -0
- package/dist/auth.js.map +1 -0
- package/dist/billing.d.ts +758 -0
- package/dist/billing.js +553 -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 +858 -0
- package/dist/data.js +814 -0
- package/dist/data.js.map +1 -0
- package/dist/entitlement.d.ts +172 -0
- package/dist/entitlement.js +116 -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 +3995 -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 +1359 -0
- package/dist/notify.js +1282 -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 +88 -0
- package/dist/runtime.js +226 -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,39 @@
|
|
|
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
|
-
```
|
|
25
|
-
|
|
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
|
-
```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'
|
|
80
|
-
|
|
81
|
-
const request = validateAgentComputerRequest('getComputerProfile', {
|
|
82
|
-
profileId: 'profile_…',
|
|
83
|
-
})
|
|
84
10
|
```
|
|
85
11
|
|
|
86
|
-
## Contract identity
|
|
87
|
-
|
|
88
12
|
```ts
|
|
89
|
-
import {
|
|
90
|
-
// sylphx.platform.v1 @ 0.5.0 — same generated identity as Rust sylphx-api-types
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## CLI
|
|
13
|
+
import { Sylphx } from '@sylphx/sdk'
|
|
94
14
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
cargo install sylphx-cli # crates.io channel
|
|
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
|
+
}
|
|
101
20
|
```
|
|
102
21
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
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
|
+
- Per-service subpath imports tree-shake: `import { DataApi } from '@sylphx/sdk/data'`.
|
|
36
|
+
|
|
37
|
+
This package is generated from the Sylphx schema registry by `sylphx-gen`; do
|
|
38
|
+
not edit it by hand. Source: `clients/typescript` in the Sylphx monorepo,
|
|
39
|
+
published from its MIT mirror.
|