@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.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -118
  3. package/dist/access.d.ts +659 -0
  4. package/dist/access.js +638 -0
  5. package/dist/access.js.map +1 -0
  6. package/dist/ai.d.ts +176 -0
  7. package/dist/ai.js +112 -0
  8. package/dist/ai.js.map +1 -0
  9. package/dist/artifacts.d.ts +165 -0
  10. package/dist/artifacts.js +129 -0
  11. package/dist/artifacts.js.map +1 -0
  12. package/dist/auth.d.ts +896 -0
  13. package/dist/auth.js +828 -0
  14. package/dist/auth.js.map +1 -0
  15. package/dist/billing.d.ts +758 -0
  16. package/dist/billing.js +553 -0
  17. package/dist/billing.js.map +1 -0
  18. package/dist/broker.d.ts +226 -0
  19. package/dist/broker.js +187 -0
  20. package/dist/broker.js.map +1 -0
  21. package/dist/build.d.ts +313 -0
  22. package/dist/build.js +271 -0
  23. package/dist/build.js.map +1 -0
  24. package/dist/common.d.ts +162 -0
  25. package/dist/common.js +41 -0
  26. package/dist/common.js.map +1 -0
  27. package/dist/config.d.ts +198 -0
  28. package/dist/config.js +168 -0
  29. package/dist/config.js.map +1 -0
  30. package/dist/connections.d.ts +354 -0
  31. package/dist/connections.js +313 -0
  32. package/dist/connections.js.map +1 -0
  33. package/dist/data.d.ts +858 -0
  34. package/dist/data.js +814 -0
  35. package/dist/data.js.map +1 -0
  36. package/dist/entitlement.d.ts +172 -0
  37. package/dist/entitlement.js +116 -0
  38. package/dist/entitlement.js.map +1 -0
  39. package/dist/events.d.ts +1324 -0
  40. package/dist/events.js +1227 -0
  41. package/dist/events.js.map +1 -0
  42. package/dist/hosting.d.ts +709 -0
  43. package/dist/hosting.js +611 -0
  44. package/dist/hosting.js.map +1 -0
  45. package/dist/index.d.ts +79 -33656
  46. package/dist/index.js +113 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/keys.d.ts +438 -0
  49. package/dist/keys.js +406 -0
  50. package/dist/keys.js.map +1 -0
  51. package/dist/methods.d.ts +2 -0
  52. package/dist/methods.js +3995 -0
  53. package/dist/methods.js.map +1 -0
  54. package/dist/network.d.ts +733 -0
  55. package/dist/network.js +711 -0
  56. package/dist/network.js.map +1 -0
  57. package/dist/notify.d.ts +1359 -0
  58. package/dist/notify.js +1282 -0
  59. package/dist/notify.js.map +1 -0
  60. package/dist/observability.d.ts +509 -0
  61. package/dist/observability.js +437 -0
  62. package/dist/observability.js.map +1 -0
  63. package/dist/release.d.ts +303 -0
  64. package/dist/release.js +214 -0
  65. package/dist/release.js.map +1 -0
  66. package/dist/runners.d.ts +262 -0
  67. package/dist/runners.js +238 -0
  68. package/dist/runners.js.map +1 -0
  69. package/dist/runtime.d.ts +88 -0
  70. package/dist/runtime.js +226 -0
  71. package/dist/runtime.js.map +1 -0
  72. package/dist/sandboxes.d.ts +1705 -0
  73. package/dist/sandboxes.js +1226 -0
  74. package/dist/sandboxes.js.map +1 -0
  75. package/dist/secrets.d.ts +508 -0
  76. package/dist/secrets.js +474 -0
  77. package/dist/secrets.js.map +1 -0
  78. package/dist/workflows.d.ts +678 -0
  79. package/dist/workflows.js +595 -0
  80. package/dist/workflows.js.map +1 -0
  81. package/package.json +33 -112
  82. package/dist/connect.d.ts +0 -2838
  83. package/dist/connect.mjs +0 -220
  84. package/dist/connect.mjs.map +0 -1
  85. package/dist/health/index.d.ts +0 -1394
  86. package/dist/health/index.mjs +0 -1394
  87. package/dist/health/index.mjs.map +0 -1
  88. package/dist/index.mjs +0 -38429
  89. package/dist/index.mjs.map +0 -1
  90. package/dist/nextjs/index.d.ts +0 -724
  91. package/dist/nextjs/index.mjs +0 -3332
  92. package/dist/nextjs/index.mjs.map +0 -1
  93. package/dist/react/index.d.ts +0 -13066
  94. package/dist/react/index.mjs +0 -35329
  95. package/dist/react/index.mjs.map +0 -1
  96. package/dist/server/index.d.ts +0 -2000
  97. package/dist/server/index.mjs +0 -3446
  98. package/dist/server/index.mjs.map +0 -1
  99. package/dist/web-analytics.d.ts +0 -90
  100. package/dist/web-analytics.mjs +0 -225
  101. 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
- # `@sylphx/sdk` — TypeScript Platform SDK
1
+ # @sylphx/sdk
2
2
 
3
- First-class **external** TypeScript client for Sylphx Platform.
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
- | Language | App (runtime) | Management (operators) |
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 { API_TYPES_CONTRACT_PACKAGE, API_TYPES_CONTRACT_REVISION } from '@sylphx/sdk'
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
- 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
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
- ## Install (commercial)
104
-
105
- ```bash
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
-
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.