@zyraxon-ai/sdk-next 19.0.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/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @ZYRAXON-ai/sdk-next
2
+
3
+ Effect-native scoped ZYRAXON host for in-process applications. This transitional package will replace the existing generated `@ZYRAXON-ai/sdk` after its consumers migrate.
4
+
5
+ The SDK executes Server's assembled HTTP router in memory. It opens no listener and performs no network I/O, while preserving the same routing, middleware, handlers, codecs, and errors as the network client.
6
+
7
+ ```ts
8
+ import { ZYRAXON } from "@ZYRAXON-ai/sdk-next"
9
+
10
+ const ZYRAXON = yield * ZYRAXON.create()
11
+ const session = yield * ZYRAXON.sessions.get({ sessionID })
12
+ ```
13
+
14
+ It also exports `Tool` and exposes local-only `tools.register(...)`, replacing the former `@ZYRAXON-ai/core/public` facade. Registration uses Core's host-level `ApplicationTools` service shared by the host's Locations; each Location retains its own `ToolRegistry` for overlay, lookup, and settlement. Closing the owning Effect Scope releases router resources, location services, fibers, and scoped tool registrations.
15
+
16
+ `sessions.events({ sessionID, after })` replays durable events after the optional aggregate sequence, then emits newly committed durable events. `sessions.interrupt(...)` targets execution owned by this host, and `sessions.message(...)` retrieves one projected Session message.
17
+
18
+ The same constructor is available as a service Layer:
19
+
20
+ ```ts
21
+ const program = Effect.gen(function* () {
22
+ const ZYRAXON = yield* ZYRAXON.Service
23
+ return yield* ZYRAXON.sessions.get({ sessionID })
24
+ })
25
+
26
+ yield * program.pipe(Effect.provide(ZYRAXON.layer))
27
+ ```
28
+
29
+ `ZYRAXON.layer` adapts `ZYRAXON.create()` for dependency injection; it does not define another host implementation.
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "name": "@zyraxon-ai/sdk-next",
4
+ "version": "19.0.2",
5
+ "type": "module",
6
+ "license": "SEE LICENSE IN LICENSE",
7
+ "description": "Next-generation ZYRAXON AI SDK built with Effect-TS",
8
+ "homepage": "https://zyraxonai.lovable.app",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/onelpawarai-X/ZYRAXON-AI.git",
12
+ "directory": "packages/sdk-next"
13
+ },
14
+ "author": "OMG / Lx Sayidi <sayidilx@gmail.com>",
15
+ "exports": {
16
+ ".": "./src/index.ts"
17
+ },
18
+ "scripts": {
19
+ "test": "bun test --timeout 5000",
20
+ "typecheck": "tsgo --noEmit"
21
+ },
22
+ "dependencies": {
23
+ "@zyraxon-ai/client": "workspace:*",
24
+ "@zyraxon-ai/core": "workspace:*",
25
+ "@zyraxon-ai/server": "workspace:*",
26
+ "effect": "catalog:"
27
+ },
28
+ "devDependencies": {
29
+ "@tsconfig/bun": "catalog:",
30
+ "@types/bun": "catalog:",
31
+ "@typescript/native-preview": "catalog:"
32
+ }
33
+ }
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ export * as Zyraxon from "./zyraxon"
2
+ export * as Tool from "./tool"
3
+
4
+ export { ClientError } from "@zyraxon-ai/client/effect"
5
+ export {
6
+ AbsolutePath,
7
+ Agent,
8
+ Location,
9
+ Model,
10
+ Prompt,
11
+ Provider,
12
+ RelativePath,
13
+ Session,
14
+ SessionInput,
15
+ SessionMessage,
16
+ } from "@zyraxon-ai/client/effect"
17
+ export type { ZyraxonEvent } from "@zyraxon-ai/client/effect"
package/src/tool.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { Failure, RegistrationError, make } from "@zyraxon-ai/core/tool/tool"
2
+ export type { AnyTool, Content, Context, Definition } from "@zyraxon-ai/core/tool/tool"
package/src/zyraxon.ts ADDED
@@ -0,0 +1,49 @@
1
+ import { Zyraxon } from "@zyraxon-ai/client/effect"
2
+ import { AppNodeBuilder } from "@zyraxon-ai/core/effect/app-node-builder"
3
+ import { LayerNode } from "@zyraxon-ai/core/effect/layer-node"
4
+ import { PermissionSaved } from "@zyraxon-ai/core/permission/saved"
5
+ import { ApplicationTools } from "@zyraxon-ai/core/tool/application-tools"
6
+ import { createEmbeddedRoutes } from "@zyraxon-ai/server/routes"
7
+ import { Context, Effect, Layer, Scope } from "effect"
8
+ import { FetchHttpClient, HttpRouter, HttpServer } from "effect/unstable/http"
9
+
10
+ export const create = Effect.fn("Zyraxon.create")(function* () {
11
+ const scope = yield* Scope.Scope
12
+ const memoMap = yield* Layer.makeMemoMap
13
+ const context = yield* Layer.buildWithMemoMap(
14
+ AppNodeBuilder.build(LayerNode.group([ApplicationTools.node, PermissionSaved.node])),
15
+ memoMap,
16
+ scope,
17
+ )
18
+ const tools = Context.get(context, ApplicationTools.Service)
19
+ const permissions = Context.get(context, PermissionSaved.Service)
20
+ const web = yield* Effect.acquireRelease(
21
+ Effect.sync(() =>
22
+ HttpRouter.toWebHandler(
23
+ createEmbeddedRoutes().pipe(
24
+ HttpRouter.provideRequest(Layer.succeed(PermissionSaved.Service, permissions)),
25
+ Layer.provide(HttpServer.layerServices),
26
+ ),
27
+ { disableLogger: true, memoMap },
28
+ ),
29
+ ),
30
+ (web) => Effect.promise(web.dispose),
31
+ )
32
+ const fetch = Object.assign((input: RequestInfo | URL, init?: RequestInit) => web.handler(new Request(input, init)), {
33
+ preconnect: () => undefined,
34
+ }) satisfies typeof globalThis.fetch
35
+ const client = yield* Zyraxon.make({ baseUrl: "http://opencode.local" }).pipe(
36
+ Effect.provide(FetchHttpClient.layer),
37
+ Effect.provideService(FetchHttpClient.Fetch, fetch),
38
+ )
39
+ return {
40
+ ...client,
41
+ tools: { register: tools.register },
42
+ }
43
+ })
44
+
45
+ export type Interface = Effect.Success<ReturnType<typeof create>>
46
+
47
+ export class Service extends Context.Service<Service, Interface>()("@zyraxon-ai/sdk-next/Zyraxon") {}
48
+
49
+ export const layer = Layer.effect(Service, create())
package/sst-env.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /* This file is auto-generated by SST. Do not edit. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /* deno-fmt-ignore-file */
5
+ /* biome-ignore-all lint: auto-generated */
6
+
7
+ /// <reference path="../../sst-env.d.ts" />
8
+
9
+ import "sst"
10
+ export {}
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "@tsconfig/bun/tsconfig.json",
4
+ "compilerOptions": {
5
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
6
+ "noUncheckedIndexedAccess": false
7
+ }
8
+ }