@radheim/sdk 0.0.0-stage → 2.4.3

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 (47) hide show
  1. package/README.md +148 -3
  2. package/dist/chunks/contracts-21rejh3w.js +79 -0
  3. package/dist/chunks/contracts-4gf949th.js +14 -0
  4. package/dist/chunks/contracts-6ard325q.js +23 -0
  5. package/dist/chunks/contracts-9921d0eq.js +18 -0
  6. package/dist/chunks/contracts-9rqn6x4v.js +16 -0
  7. package/dist/chunks/contracts-9ybt1tz4.js +14 -0
  8. package/dist/chunks/contracts-d8k8mt5a.js +49 -0
  9. package/dist/chunks/contracts-f8tdk121.js +128 -0
  10. package/dist/chunks/contracts-fc2gzwgc.js +52 -0
  11. package/dist/chunks/contracts-q7txhdnb.js +25 -0
  12. package/dist/chunks/contracts-r4rmkqh9.js +44 -0
  13. package/dist/chunks/contracts-rnpbh5as.js +55 -0
  14. package/dist/chunks/contracts-v8gt2qd1.js +29 -0
  15. package/dist/contracts.d.ts +26 -0
  16. package/dist/contracts.js +58 -0
  17. package/dist/effect/index.d.ts +10 -0
  18. package/dist/effect/index.js +85 -0
  19. package/dist/effect/opencode.d.ts +55 -0
  20. package/dist/effect/opencode.js +17 -0
  21. package/dist/effect/tool.d.ts +3 -0
  22. package/dist/effect/tool.js +8 -0
  23. package/dist/effect/workerd.d.ts +34 -0
  24. package/dist/effect/workerd.js +44 -0
  25. package/dist/index.d.ts +5 -0
  26. package/dist/index.js +75 -0
  27. package/dist/internal/effect.d.ts +12 -0
  28. package/dist/internal/effect.js +14 -0
  29. package/dist/internal/fetch.d.ts +7 -0
  30. package/dist/internal/fetch.js +8 -0
  31. package/dist/internal/host.d.ts +64 -0
  32. package/dist/internal/host.js +11 -0
  33. package/dist/internal/instances.d.ts +21 -0
  34. package/dist/internal/instances.js +10 -0
  35. package/dist/internal/promise.d.ts +8 -0
  36. package/dist/internal/promise.js +12 -0
  37. package/dist/internal/workerd.d.ts +12 -0
  38. package/dist/internal/workerd.js +8 -0
  39. package/dist/logging.d.ts +14 -0
  40. package/dist/logging.js +6 -0
  41. package/dist/opencode.d.ts +31 -0
  42. package/dist/opencode.js +13 -0
  43. package/dist/tool.d.ts +3 -0
  44. package/dist/tool.js +8 -0
  45. package/dist/workerd.d.ts +51 -0
  46. package/dist/workerd.js +41 -0
  47. package/package.json +59 -4
@@ -0,0 +1,29 @@
1
+ // src/contracts.ts
2
+ import { Agent as Agent2 } from "@radheim/schema/agent";
3
+ import { Command as Command2 } from "@radheim/schema/command";
4
+ import { Config as Config2 } from "@radheim/schema/config";
5
+ import { Credential as Credential2 } from "@radheim/schema/credential";
6
+ import { Event as Event2 } from "@radheim/schema/event";
7
+ import { FileSystem as FileSystem2 } from "@radheim/schema/filesystem";
8
+ import { Integration as Integration2 } from "@radheim/schema/integration";
9
+ import { Location as Location2 } from "@radheim/schema/location";
10
+ import { Model as Model2 } from "@radheim/schema/model";
11
+ import { Permission as Permission2 } from "@radheim/schema/permission";
12
+ import { PermissionSaved as PermissionSaved2 } from "@radheim/schema/permission-saved";
13
+ import { Project as Project2 } from "@radheim/schema/project";
14
+ import { Worktree as Worktree2 } from "@radheim/schema/worktree";
15
+ import { Prompt as Prompt2 } from "@radheim/schema/prompt";
16
+ import { PromptInput as PromptInput2 } from "@radheim/schema/prompt-input";
17
+ import { Provider as Provider2 } from "@radheim/schema/provider";
18
+ import { Pty as Pty2 } from "@radheim/schema/pty";
19
+ import { Question as Question2 } from "@radheim/schema/question";
20
+ import { Reference as Reference2 } from "@radheim/schema/reference";
21
+ import { WebSearch as WebSearch2 } from "@radheim/schema/websearch";
22
+ import { AbsolutePath as AbsolutePath2, RelativePath as RelativePath2 } from "@radheim/schema/schema";
23
+ import { Session as Session2 } from "@radheim/schema/session";
24
+ import { SessionInbox as SessionInbox2 } from "@radheim/schema/session-inbox";
25
+ import { SessionMessage as SessionMessage2 } from "@radheim/schema/session-message";
26
+ import { Skill as Skill2 } from "@radheim/schema/skill";
27
+ import { Workspace as Workspace2 } from "@radheim/schema/workspace";
28
+
29
+ export { Agent2, Command2, Config2, Credential2, Event2, FileSystem2, Integration2, Location2, Model2, Permission2, PermissionSaved2, Project2, Worktree2, Prompt2, PromptInput2, Provider2, Pty2, Question2, Reference2, WebSearch2, AbsolutePath2, RelativePath2, Session2, SessionInbox2, SessionMessage2, Skill2, Workspace2 };
@@ -0,0 +1,26 @@
1
+ export { Agent } from "@radheim/schema/agent";
2
+ export { Command } from "@radheim/schema/command";
3
+ export { Config } from "@radheim/schema/config";
4
+ export { Credential } from "@radheim/schema/credential";
5
+ export { Event } from "@radheim/schema/event";
6
+ export { FileSystem } from "@radheim/schema/filesystem";
7
+ export { Integration } from "@radheim/schema/integration";
8
+ export { Location } from "@radheim/schema/location";
9
+ export { Model } from "@radheim/schema/model";
10
+ export { Permission } from "@radheim/schema/permission";
11
+ export { PermissionSaved } from "@radheim/schema/permission-saved";
12
+ export { Project } from "@radheim/schema/project";
13
+ export { Worktree } from "@radheim/schema/worktree";
14
+ export { Prompt } from "@radheim/schema/prompt";
15
+ export { PromptInput } from "@radheim/schema/prompt-input";
16
+ export { Provider } from "@radheim/schema/provider";
17
+ export { Pty } from "@radheim/schema/pty";
18
+ export { Question } from "@radheim/schema/question";
19
+ export { Reference } from "@radheim/schema/reference";
20
+ export { WebSearch } from "@radheim/schema/websearch";
21
+ export { AbsolutePath, RelativePath } from "@radheim/schema/schema";
22
+ export { Session } from "@radheim/schema/session";
23
+ export { SessionInbox } from "@radheim/schema/session-inbox";
24
+ export { SessionMessage } from "@radheim/schema/session-message";
25
+ export { Skill } from "@radheim/schema/skill";
26
+ export { Workspace } from "@radheim/schema/workspace";
@@ -0,0 +1,58 @@
1
+ import {
2
+ Agent2,
3
+ Command2,
4
+ Config2,
5
+ Credential2,
6
+ Event2,
7
+ FileSystem2,
8
+ Integration2,
9
+ Location2,
10
+ Model2,
11
+ Permission2,
12
+ PermissionSaved2,
13
+ Project2,
14
+ Worktree2,
15
+ Prompt2,
16
+ PromptInput2,
17
+ Provider2,
18
+ Pty2,
19
+ Question2,
20
+ Reference2,
21
+ WebSearch2,
22
+ AbsolutePath2,
23
+ RelativePath2,
24
+ Session2,
25
+ SessionInbox2,
26
+ SessionMessage2,
27
+ Skill2,
28
+ Workspace2
29
+ } from "./chunks/contracts-v8gt2qd1.js";
30
+ export {
31
+ AbsolutePath2 as AbsolutePath,
32
+ Agent2 as Agent,
33
+ Command2 as Command,
34
+ Config2 as Config,
35
+ Credential2 as Credential,
36
+ Event2 as Event,
37
+ FileSystem2 as FileSystem,
38
+ Integration2 as Integration,
39
+ Location2 as Location,
40
+ Model2 as Model,
41
+ Permission2 as Permission,
42
+ PermissionSaved2 as PermissionSaved,
43
+ Project2 as Project,
44
+ Prompt2 as Prompt,
45
+ PromptInput2 as PromptInput,
46
+ Provider2 as Provider,
47
+ Pty2 as Pty,
48
+ Question2 as Question,
49
+ Reference2 as Reference,
50
+ RelativePath2 as RelativePath,
51
+ Session2 as Session,
52
+ SessionInbox2 as SessionInbox,
53
+ SessionMessage2 as SessionMessage,
54
+ Skill2 as Skill,
55
+ WebSearch2 as WebSearch,
56
+ Workspace2 as Workspace,
57
+ Worktree2 as Worktree
58
+ };
@@ -0,0 +1,10 @@
1
+ export * as Radhe from "./opencode";
2
+ export * as Tool from "./tool";
3
+ export { EnvironmentDriver } from "@radheim/core/environment/driver";
4
+ export { EnvironmentFiles } from "@radheim/core/environment/files";
5
+ export { Identity } from "@radheim/core/machine/identity";
6
+ export { WorkerClient } from "@radheim/core/machine/worker-client";
7
+ export { WorkspaceDriver } from "@radheim/core/workspace/driver";
8
+ export { ClientError } from "@radheim/client/effect";
9
+ export type { RadheEvent } from "@radheim/client/effect";
10
+ export * from "../contracts";
@@ -0,0 +1,85 @@
1
+ import"../chunks/contracts-d8k8mt5a.js";
2
+ import"../chunks/contracts-f8tdk121.js";
3
+ import"../chunks/contracts-fc2gzwgc.js";
4
+ import"../chunks/contracts-21rejh3w.js";
5
+ import"../chunks/contracts-r4rmkqh9.js";
6
+ import {
7
+ exports_opencode
8
+ } from "../chunks/contracts-6ard325q.js";
9
+ import {
10
+ exports_tool
11
+ } from "../chunks/contracts-4gf949th.js";
12
+ import {
13
+ Agent2,
14
+ Command2,
15
+ Config2,
16
+ Credential2,
17
+ Event2,
18
+ FileSystem2,
19
+ Integration2,
20
+ Location2,
21
+ Model2,
22
+ Permission2,
23
+ PermissionSaved2,
24
+ Project2,
25
+ Worktree2,
26
+ Prompt2,
27
+ PromptInput2,
28
+ Provider2,
29
+ Pty2,
30
+ Question2,
31
+ Reference2,
32
+ WebSearch2,
33
+ AbsolutePath2,
34
+ RelativePath2,
35
+ Session2,
36
+ SessionInbox2,
37
+ SessionMessage2,
38
+ Skill2,
39
+ Workspace2
40
+ } from "../chunks/contracts-v8gt2qd1.js";
41
+
42
+ // src/effect/index.ts
43
+ import { EnvironmentDriver } from "@radheim/core/environment/driver";
44
+ import { EnvironmentFiles } from "@radheim/core/environment/files";
45
+ import { Identity } from "@radheim/core/machine/identity";
46
+ import { WorkerClient } from "@radheim/core/machine/worker-client";
47
+ import { WorkspaceDriver } from "@radheim/core/workspace/driver";
48
+ import { ClientError } from "@radheim/client/effect";
49
+ export {
50
+ AbsolutePath2 as AbsolutePath,
51
+ Agent2 as Agent,
52
+ ClientError,
53
+ Command2 as Command,
54
+ Config2 as Config,
55
+ Credential2 as Credential,
56
+ EnvironmentDriver,
57
+ EnvironmentFiles,
58
+ Event2 as Event,
59
+ FileSystem2 as FileSystem,
60
+ Identity,
61
+ Integration2 as Integration,
62
+ Location2 as Location,
63
+ Model2 as Model,
64
+ Permission2 as Permission,
65
+ PermissionSaved2 as PermissionSaved,
66
+ Project2 as Project,
67
+ Prompt2 as Prompt,
68
+ PromptInput2 as PromptInput,
69
+ Provider2 as Provider,
70
+ Pty2 as Pty,
71
+ Question2 as Question,
72
+ exports_opencode as Radhe,
73
+ Reference2 as Reference,
74
+ RelativePath2 as RelativePath,
75
+ Session2 as Session,
76
+ SessionInbox2 as SessionInbox,
77
+ SessionMessage2 as SessionMessage,
78
+ Skill2 as Skill,
79
+ exports_tool as Tool,
80
+ WebSearch2 as WebSearch,
81
+ WorkerClient,
82
+ Workspace2 as Workspace,
83
+ WorkspaceDriver,
84
+ Worktree2 as Worktree
85
+ };
@@ -0,0 +1,55 @@
1
+ export * as Radhe from "./opencode";
2
+ import type { RadheClient } from "@radheim/client/effect";
3
+ import type { Session } from "@radheim/core/session";
4
+ import type { Workspace } from "@radheim/core/workspace";
5
+ import { Context, Layer } from "effect";
6
+ import type { Config, Effect, Scope } from "effect";
7
+ import type { EmbeddedHost } from "../internal/host";
8
+ import type { SdkInstances } from "../internal/instances";
9
+ export type { LogEntry, LogLevel, LogOptions, LogWriter } from "../logging";
10
+ export type CreateOptions<R = never> = EmbeddedHost.CreateOptions<R>;
11
+ /**
12
+ * @deprecated Runtime-profile overrides are an internal hook; use `RadheWorkerd.create` from
13
+ * `@radheim/sdk/workerd/effect` for the workerd profile. Removed in the next minor.
14
+ */
15
+ export type EmbedOptions = EmbeddedHost.EmbedOptions;
16
+ export type InstanceOptions<R = never> = SdkInstances.Options<R>;
17
+ export type InstanceConfiguration = SdkInstances.Configuration;
18
+ export type Interface = Omit<RadheClient, "plugin" | "session" | "event"> & {
19
+ /** @deprecated Use `sessions`, whose `create`, `get` and `move` run in-process. Removed in the next minor. */
20
+ readonly session: RadheClient["session"];
21
+ /** @deprecated Use `events`. Removed in the next minor. */
22
+ readonly event: RadheClient["event"];
23
+ readonly sessions: Omit<RadheClient["session"], "create" | "get" | "move"> & {
24
+ readonly create: Session.Interface["create"];
25
+ readonly get: (input: {
26
+ readonly sessionID: Session.ID;
27
+ }) => ReturnType<Session.Interface["get"]>;
28
+ readonly move: Session.Interface["move"];
29
+ };
30
+ readonly events: RadheClient["event"];
31
+ readonly workspace: {
32
+ readonly create: Workspace.Interface["create"];
33
+ readonly attach: Workspace.Interface["attach"];
34
+ readonly provision: (options: {
35
+ readonly workspaceID: Workspace.ID;
36
+ }) => ReturnType<Workspace.Interface["provision"]>;
37
+ readonly destroy: (options: {
38
+ readonly workspaceID: Workspace.ID;
39
+ }) => ReturnType<Workspace.Interface["destroy"]>;
40
+ readonly suspendIdle: Workspace.Interface["suspendIdle"];
41
+ };
42
+ readonly plugin: EmbeddedHost.Interface["plugins"]["register"] & RadheClient["plugin"];
43
+ };
44
+ export declare const create: {
45
+ <R = never>(options?: CreateOptions<R>): Effect.Effect<Interface, Config.ConfigError | Error, Scope.Scope | R>;
46
+ /**
47
+ * @deprecated `embed` is an internal hook; use `RadheWorkerd.create` from `@radheim/sdk/workerd/effect` for
48
+ * the workerd profile. Removed in the next minor.
49
+ */
50
+ <R = never>(options: CreateOptions<R> | undefined, embed: EmbedOptions | undefined): Effect.Effect<Interface, Config.ConfigError | Error, Scope.Scope | R>;
51
+ };
52
+ declare const Service_base: Context.ServiceClass<Service, "@radheim/sdk/OpenCode", Interface>;
53
+ export declare class Service extends Service_base {
54
+ }
55
+ export declare const layer: <R = never>(options?: CreateOptions<R>) => Layer.Layer<Service, Config.ConfigError | Error, Exclude<R, Scope.Scope>>;
@@ -0,0 +1,17 @@
1
+ import {
2
+ create2,
3
+ Service2,
4
+ layer2,
5
+ exports_opencode
6
+ } from "../chunks/contracts-6ard325q.js";
7
+ import"../chunks/contracts-r4rmkqh9.js";
8
+ import"../chunks/contracts-21rejh3w.js";
9
+ import"../chunks/contracts-fc2gzwgc.js";
10
+ import"../chunks/contracts-d8k8mt5a.js";
11
+ import"../chunks/contracts-f8tdk121.js";
12
+ export {
13
+ exports_opencode as Radhe,
14
+ Service2 as Service,
15
+ create2 as create,
16
+ layer2 as layer
17
+ };
@@ -0,0 +1,3 @@
1
+ export { RegistrationError } from "@radheim/core/tool";
2
+ export { Error } from "@radheim/schema/tool";
3
+ export type { Context, Info } from "@radheim/schema/tool";
@@ -0,0 +1,8 @@
1
+ import {
2
+ RegistrationError2,
3
+ Error2
4
+ } from "../chunks/contracts-4gf949th.js";
5
+ export {
6
+ Error2 as Error,
7
+ RegistrationError2 as RegistrationError
8
+ };
@@ -0,0 +1,34 @@
1
+ export * as RadheWorkerd from "./workerd";
2
+ import { Effect, Layer } from "effect";
3
+ import type { Config, Scope } from "effect";
4
+ import { WorkerdProfile } from "../internal/workerd";
5
+ import { Radhe as Sdk } from "./opencode";
6
+ export type { Configuration, ImageLimits, ImageResizer, ImageResizerInput, ImageResizerOutput, } from "../internal/workerd";
7
+ export interface CreateOptions<R = never> extends WorkerdProfile.Options {
8
+ readonly log?: Sdk.CreateOptions["log"];
9
+ readonly plugins?: Sdk.CreateOptions["plugins"];
10
+ readonly workspaceProviders?: Sdk.CreateOptions["workspaceProviders"];
11
+ readonly instances?: Sdk.CreateOptions<R>["instances"];
12
+ }
13
+ /**
14
+ * The Durable Object's WebSocket Hibernation methods, for an object created with `state`: plain functions, not
15
+ * effects, because the object's methods call them directly, in order and without awaiting anything first.
16
+ *
17
+ * With `state`, create at most one live instance per `ctx`, for example once inside `ctx.blockConcurrencyWhile` in the
18
+ * Durable Object's constructor: a second leaves the machine links the first holds alone.
19
+ */
20
+ export type Hibernation = WorkerdProfile.Hibernation;
21
+ export type Interface = Sdk.Interface & Hibernation & {
22
+ /**
23
+ * Serves a request from outside the Durable Object, as `ServerWorkerd.create`'s handler does: `/api/*` and the
24
+ * `/api/event` stream behind `password` and the cross-site and CORS checks, and machine-link WebSocket upgrades.
25
+ * A Promise, because the Durable Object's `fetch()` method returns one.
26
+ */
27
+ readonly fetch: (request: Request) => Promise<Response>;
28
+ /** Suspends any workspaces past their idle threshold; run from the Durable Object's `alarm()` method. */
29
+ readonly alarm: Effect.Effect<void>;
30
+ };
31
+ export declare const create: <R = never>(options: CreateOptions<R>) => Effect.Effect<Interface, Config.ConfigError | Error, Scope.Scope | R>;
32
+ export declare const layer: <R = never>(options: CreateOptions<R>) => Layer.Layer<Sdk.Service, Config.ConfigError | Error, Exclude<R, Scope.Scope>>;
33
+ /** @deprecated Use `Scope.Scope` from `effect`. Removed in the next minor. */
34
+ export type Requirements = Scope.Scope;
@@ -0,0 +1,44 @@
1
+ import"../chunks/contracts-d8k8mt5a.js";
2
+ import"../chunks/contracts-f8tdk121.js";
3
+ import"../chunks/contracts-fc2gzwgc.js";
4
+ import"../chunks/contracts-21rejh3w.js";
5
+ import {
6
+ createWithHost3
7
+ } from "../chunks/contracts-r4rmkqh9.js";
8
+ import {
9
+ make2
10
+ } from "../chunks/contracts-q7txhdnb.js";
11
+ import {
12
+ Service2
13
+ } from "../chunks/contracts-6ard325q.js";
14
+ import {
15
+ __export
16
+ } from "../chunks/contracts-9rqn6x4v.js";
17
+
18
+ // src/effect/workerd.ts
19
+ var exports_workerd = {};
20
+ __export(exports_workerd, {
21
+ RadheWorkerd: () => exports_workerd,
22
+ create: () => create,
23
+ layer: () => layer
24
+ });
25
+ import { Effect, Layer } from "effect";
26
+ var create = (options) => createWithHost3({
27
+ log: options.log,
28
+ plugins: options.plugins,
29
+ workspaceProviders: options.workspaceProviders,
30
+ instances: options.instances
31
+ }, { profile: make2(options) }).pipe(Effect.map((created) => ({
32
+ ...created.sdk,
33
+ webSocketMessage: created.host.served.webSocketMessage,
34
+ webSocketClose: created.host.served.webSocketClose,
35
+ webSocketError: created.host.served.webSocketError,
36
+ fetch: created.host.handler,
37
+ alarm: Effect.asVoid(created.sdk.workspace.suspendIdle())
38
+ })));
39
+ var layer = (options) => Layer.effect(Service2, create(options));
40
+ export {
41
+ exports_workerd as RadheWorkerd,
42
+ create,
43
+ layer
44
+ };
@@ -0,0 +1,5 @@
1
+ export * as Radhe from "./opencode";
2
+ export * as Tool from "./tool";
3
+ export { ClientError } from "@radheim/client";
4
+ export type { RadheEvent } from "@radheim/client";
5
+ export * from "./contracts";
package/dist/index.js ADDED
@@ -0,0 +1,75 @@
1
+ import"./chunks/contracts-d8k8mt5a.js";
2
+ import"./chunks/contracts-f8tdk121.js";
3
+ import"./chunks/contracts-fc2gzwgc.js";
4
+ import"./chunks/contracts-21rejh3w.js";
5
+ import"./chunks/contracts-rnpbh5as.js";
6
+ import {
7
+ exports_opencode2
8
+ } from "./chunks/contracts-9921d0eq.js";
9
+ import {
10
+ exports_tool2
11
+ } from "./chunks/contracts-9ybt1tz4.js";
12
+ import {
13
+ Agent2,
14
+ Command2,
15
+ Config2,
16
+ Credential2,
17
+ Event2,
18
+ FileSystem2,
19
+ Integration2,
20
+ Location2,
21
+ Model2,
22
+ Permission2,
23
+ PermissionSaved2,
24
+ Project2,
25
+ Worktree2,
26
+ Prompt2,
27
+ PromptInput2,
28
+ Provider2,
29
+ Pty2,
30
+ Question2,
31
+ Reference2,
32
+ WebSearch2,
33
+ AbsolutePath2,
34
+ RelativePath2,
35
+ Session2,
36
+ SessionInbox2,
37
+ SessionMessage2,
38
+ Skill2,
39
+ Workspace2
40
+ } from "./chunks/contracts-v8gt2qd1.js";
41
+
42
+ // src/index.ts
43
+ import { ClientError } from "@radheim/client";
44
+ export {
45
+ AbsolutePath2 as AbsolutePath,
46
+ Agent2 as Agent,
47
+ ClientError,
48
+ Command2 as Command,
49
+ Config2 as Config,
50
+ Credential2 as Credential,
51
+ Event2 as Event,
52
+ FileSystem2 as FileSystem,
53
+ Integration2 as Integration,
54
+ Location2 as Location,
55
+ Model2 as Model,
56
+ Permission2 as Permission,
57
+ PermissionSaved2 as PermissionSaved,
58
+ Project2 as Project,
59
+ Prompt2 as Prompt,
60
+ PromptInput2 as PromptInput,
61
+ Provider2 as Provider,
62
+ Pty2 as Pty,
63
+ Question2 as Question,
64
+ exports_opencode2 as Radhe,
65
+ Reference2 as Reference,
66
+ RelativePath2 as RelativePath,
67
+ Session2 as Session,
68
+ SessionInbox2 as SessionInbox,
69
+ SessionMessage2 as SessionMessage,
70
+ Skill2 as Skill,
71
+ exports_tool2 as Tool,
72
+ WebSearch2 as WebSearch,
73
+ Workspace2 as Workspace,
74
+ Worktree2 as Worktree
75
+ };
@@ -0,0 +1,12 @@
1
+ export * as EffectSdk from "./effect";
2
+ import { Effect } from "effect";
3
+ import type { Config, Scope } from "effect";
4
+ import type { CreateOptions, Interface } from "../effect/opencode";
5
+ import { EmbeddedHost } from "./host";
6
+ /** `OpenCode.create` with the host hooks a runtime profile (such as workerd) needs. */
7
+ export declare const create: <R = never>(options?: CreateOptions<R>, embed?: EmbeddedHost.EmbedOptions) => Effect.Effect<Interface, Config.ConfigError | Error, Scope.Scope | R>;
8
+ /** `create`, returning the host too. */
9
+ export declare const createWithHost: <R = never, H extends EmbeddedHost.RequestHandler = EmbeddedHost.RequestHandler>(options?: CreateOptions<R>, embed?: EmbeddedHost.EmbedOptions<H>) => Effect.Effect<{
10
+ readonly sdk: Interface;
11
+ readonly host: EmbeddedHost.Interface<H>;
12
+ }, Config.ConfigError | Error, Scope.Scope | R>;
@@ -0,0 +1,14 @@
1
+ import {
2
+ create4,
3
+ createWithHost3,
4
+ exports_effect
5
+ } from "../chunks/contracts-r4rmkqh9.js";
6
+ import"../chunks/contracts-21rejh3w.js";
7
+ import"../chunks/contracts-fc2gzwgc.js";
8
+ import"../chunks/contracts-d8k8mt5a.js";
9
+ import"../chunks/contracts-f8tdk121.js";
10
+ export {
11
+ exports_effect as EffectSdk,
12
+ create4 as create,
13
+ createWithHost3 as createWithHost
14
+ };
@@ -0,0 +1,7 @@
1
+ export * as OwnedFetch from "./fetch";
2
+ export declare function make(handler: (request: Request) => Promise<Response>, dispose: () => Promise<void>): {
3
+ fetch: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) & {
4
+ preconnect: () => undefined;
5
+ };
6
+ close: () => Promise<void>;
7
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ make3,
3
+ exports_fetch
4
+ } from "../chunks/contracts-f8tdk121.js";
5
+ export {
6
+ exports_fetch as OwnedFetch,
7
+ make3 as make
8
+ };
@@ -0,0 +1,64 @@
1
+ export * as EmbeddedHost from "./host";
2
+ import { Automation } from "@radheim/core/automation";
3
+ import { Instance } from "@radheim/core/instance/service";
4
+ import { SdkPlugins } from "@radheim/core/plugin/sdk";
5
+ import type { Plugin } from "@radheim/plugin/effect/plugin";
6
+ import { Session } from "@radheim/core/session";
7
+ import { Workspace } from "@radheim/core/workspace";
8
+ import { WorkspaceDriver } from "@radheim/core/workspace/driver";
9
+ import { createEmbeddedRoutes } from "@radheim/server/routes";
10
+ import type { AppOptions, ServerOptions } from "@radheim/server/options";
11
+ import type { LayerNode } from "@radheim/util/effect/layer-node";
12
+ import { Context, Effect, Layer, ManagedRuntime, Scope } from "effect";
13
+ import { type LogOptions } from "../logging";
14
+ import { SdkInstances } from "./instances";
15
+ export interface CreateOptions<R = never> extends AppOptions {
16
+ readonly log?: LogOptions;
17
+ readonly plugins?: ReadonlyArray<Plugin>;
18
+ /**
19
+ * Drivers for remote workspaces, by the provider name `workspace.create` and `workspace.attach` take. Build each with
20
+ * `WorkspaceDriver.make` from `@radheim/sdk/effect`.
21
+ */
22
+ readonly workspaceProviders?: Readonly<Record<string, WorkspaceDriver.Interface>>;
23
+ readonly instances?: SdkInstances.Options<R>;
24
+ /**
25
+ * @deprecated An HTTP listener option: the embedded host serves no browser, so nothing reads the allowlist but the
26
+ * WebSocket origin checks. Removed in the next minor.
27
+ */
28
+ readonly cors?: ServerOptions["cors"];
29
+ /** @deprecated The server's `OPENCODE_SIMULATE` switch, not an SDK option. Removed in the next minor. */
30
+ readonly simulation?: ServerOptions["simulation"];
31
+ }
32
+ export type RequestHandler = (request: Request) => Promise<Response>;
33
+ /** Host hooks for embedding opencode on a non-default runtime profile. */
34
+ export interface EmbedOptions<H extends RequestHandler = RequestHandler> {
35
+ readonly overrides?: LayerNode.Replacements;
36
+ /** Builds and serves a runtime profile's routes in place of the embedded routes and the host's application options. */
37
+ readonly profile?: Profile<H>;
38
+ }
39
+ type Routes = ReturnType<typeof createEmbeddedRoutes>;
40
+ /**
41
+ * A runtime profile's own server, such as `ServerWorkerd.routes` and `ServerWorkerd.serve`: the host still adds its
42
+ * instances, plugins and workspace providers, and registers plugins between building and serving.
43
+ */
44
+ export interface Profile<H extends RequestHandler = RequestHandler> {
45
+ /** The route layer, with the host's replacements applied after the profile's own. */
46
+ readonly routes: (overrides: LayerNode.Replacements) => Routes;
47
+ /** Serves the built context to requests from outside the host. */
48
+ readonly serve: (context: Context.Context<Layer.Success<Routes>>) => Effect.Effect<H, never, Scope.Scope>;
49
+ /** The routes' Basic auth password, which the host's in-process client sends. */
50
+ readonly password?: string;
51
+ }
52
+ export declare const create: <R = never, H extends RequestHandler = RequestHandler>(options?: CreateOptions<R> | undefined, embed?: EmbedOptions<H> | undefined) => Effect.Effect<{
53
+ runtime: ManagedRuntime.ManagedRuntime<import("@radheim/core/shell").Daemon | import("effect/http/HttpClient").HttpClient | import("effect/http/HttpRouter").HttpRouter | import("@radheim/util/fs-util").FSUtil.Service | import("@radheim/util/global").Service | import("@radheim/core/database/database").Service | import("@radheim/core/project").Service | import("@radheim/core/app").Service | import("@radheim/core/credential").Service | import("@radheim/core/kv").Service | import("@radheim/core/wellknown").Service | import("@radheim/core/session/instruction-entry").Service | import("@radheim/core/job").Service | import("@radheim/core/machine/identity").Service | import("@radheim/core/machine/machines").Service | Workspace.Service | import("@radheim/core/codemode/api").Service | import("@radheim/core/permission/saved").Service | import("@radheim/core/location-service-map").Service | import("@radheim/core/persistent-pty/index").Service | Session.Service | import("@radheim/core/push/list").Service | import("@radheim/core/push/sender").Service | import("@radheim/core/worktree").Service | import("@radheim/core/blob-store").Service | import("@radheim/core/session/search-build").Service | import("@radheim/core/video-generation").Service | import("@radheim/core/experimental/browser-tunnel").Service | SdkPlugins.Service | import("@radheim/core/plugin/update").Service | Instance.Service | import("@radheim/core/bus").Service | Automation.Service | import("@radheim/core/session/execution/restart").Service | import("@radheim/core/pty/ticket").Service | import("@radheim/core/session/transfer").Service | import("@radheim/core/location-activity").Service | import("@radheim/core/filesystem/file-watch").Service | import("@radheim/server/space-store").Service | import("@radheim/server/pairing").Service | import("@radheim/server/handlers/machine").MachinesFlag.Service, Error | import("@radheim/core/persistent-pty/index").UnavailableError>;
54
+ served: H;
55
+ /** The in-process client's transport, which carries the host's own password like Code Mode's requests do. */
56
+ fetch: typeof fetch;
57
+ /** Requests from outside the host, checked like any listener's when a profile serves them. */
58
+ handler: (request: Request) => Promise<Response>;
59
+ plugins: SdkPlugins.Interface;
60
+ sessions: Session.Interface;
61
+ workspace: Workspace.Interface;
62
+ close: () => Promise<void>;
63
+ }, Error, R>;
64
+ export type Interface<H extends RequestHandler = RequestHandler> = Effect.Success<ReturnType<typeof create<never, H>>>;
@@ -0,0 +1,11 @@
1
+ import {
2
+ create5,
3
+ exports_host
4
+ } from "../chunks/contracts-21rejh3w.js";
5
+ import"../chunks/contracts-fc2gzwgc.js";
6
+ import"../chunks/contracts-d8k8mt5a.js";
7
+ import"../chunks/contracts-f8tdk121.js";
8
+ export {
9
+ exports_host as EmbeddedHost,
10
+ create5 as create
11
+ };
@@ -0,0 +1,21 @@
1
+ export * as SdkInstances from "./instances";
2
+ import { Instance } from "@radheim/core/instance";
3
+ import type { InstancePlugins } from "@radheim/core/plugin/instance";
4
+ import type { Session } from "@radheim/schema/session";
5
+ import { Context, Effect, Scope } from "effect";
6
+ export interface Configuration {
7
+ readonly plugins: InstancePlugins.List;
8
+ }
9
+ export interface Options<R = never> {
10
+ /** Select a sharing key within the Session's current Location. Must not initialize plugins. */
11
+ readonly key: (session: Session.Info) => string;
12
+ /**
13
+ * Reconstruct configuration on a cache miss. Resources belong to the instance Scope; other requirements
14
+ * are the services the SDK entrypoint was built with.
15
+ */
16
+ readonly configure: (key: string) => Effect.Effect<Configuration, unknown, R | Scope.Scope>;
17
+ }
18
+ /** Closes `configure` over services captured where the SDK entrypoint was built; the host graph has none of its own. */
19
+ export declare function provide<R>(options: Options<R>, context: Context.Context<R>): Options;
20
+ /** Replaces the host's `Instance.node` with per-session instances backed by the host's `LocationServiceMap`. */
21
+ export declare function node(options: Options): import("@radheim/util/effect/layer-node").Provider<Instance.Service, never, import("@radheim/util/effect/layer-node").Tag<"global">, true>;
@@ -0,0 +1,10 @@
1
+ import {
2
+ provide2,
3
+ node2,
4
+ exports_instances
5
+ } from "../chunks/contracts-fc2gzwgc.js";
6
+ export {
7
+ exports_instances as SdkInstances,
8
+ node2 as node,
9
+ provide2 as provide
10
+ };
@@ -0,0 +1,8 @@
1
+ export * as PromiseSdk from "./promise";
2
+ import type { CreateOptions, Interface } from "../opencode";
3
+ import { EmbeddedHost } from "./host";
4
+ /** `OpenCode.create` with the host hooks a runtime profile (such as workerd) needs, returning the host too. */
5
+ export declare function createWithHost<H extends EmbeddedHost.RequestHandler = EmbeddedHost.RequestHandler>(options?: CreateOptions, embed?: EmbeddedHost.EmbedOptions<H>): Promise<{
6
+ readonly sdk: Interface;
7
+ readonly host: EmbeddedHost.Interface<H>;
8
+ }>;
@@ -0,0 +1,12 @@
1
+ import {
2
+ createWithHost2,
3
+ exports_promise
4
+ } from "../chunks/contracts-rnpbh5as.js";
5
+ import"../chunks/contracts-21rejh3w.js";
6
+ import"../chunks/contracts-fc2gzwgc.js";
7
+ import"../chunks/contracts-d8k8mt5a.js";
8
+ import"../chunks/contracts-f8tdk121.js";
9
+ export {
10
+ exports_promise as PromiseSdk,
11
+ createWithHost2 as createWithHost
12
+ };