@lifesi/genesis 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,155 @@
1
+ import type { GenesisClient } from './client.js';
2
+ import type { OperationInput } from './types.js';
3
+ /** Henry always derives its organization from the gateway's verified caller. */
4
+ export declare function henryModule(client: GenesisClient): {
5
+ config: () => Promise<{
6
+ credential_configured: boolean;
7
+ models: {
8
+ id: string;
9
+ }[];
10
+ }>;
11
+ credential: (api_key: string) => Promise<{
12
+ credential_configured: boolean;
13
+ models: {
14
+ id: string;
15
+ }[];
16
+ }>;
17
+ runs: {
18
+ list: (page_token?: string) => Promise<{
19
+ runs: import("./index.js").components["schemas"]["Henry.Run"][];
20
+ next_page_token?: string | null;
21
+ }>;
22
+ create: (body: NonNullable<OperationInput<"henry_createRun">["body"]>) => Promise<{
23
+ id: string;
24
+ task: string;
25
+ model: string;
26
+ status: "ready" | "running" | "acting" | "paused" | "awaiting_approval" | "completed" | "cancelled" | "failed" | "waiting_input";
27
+ created_at: string;
28
+ updated_at: string;
29
+ activity: {
30
+ id: string;
31
+ at: string;
32
+ type: string;
33
+ detail: string;
34
+ }[];
35
+ approvals: {
36
+ id: string;
37
+ action: string;
38
+ url: string;
39
+ status: string;
40
+ requested_at: string;
41
+ }[];
42
+ phases: {
43
+ id?: string;
44
+ code?: number;
45
+ receipt?: Record<string, never>;
46
+ usage?: Record<string, never> | null;
47
+ }[];
48
+ messages: ({
49
+ role: string;
50
+ content?: string | null;
51
+ } & {
52
+ [key: string]: unknown;
53
+ })[];
54
+ }>;
55
+ get: (run_id: string) => Promise<{
56
+ id: string;
57
+ task: string;
58
+ model: string;
59
+ status: "ready" | "running" | "acting" | "paused" | "awaiting_approval" | "completed" | "cancelled" | "failed" | "waiting_input";
60
+ created_at: string;
61
+ updated_at: string;
62
+ activity: {
63
+ id: string;
64
+ at: string;
65
+ type: string;
66
+ detail: string;
67
+ }[];
68
+ approvals: {
69
+ id: string;
70
+ action: string;
71
+ url: string;
72
+ status: string;
73
+ requested_at: string;
74
+ }[];
75
+ phases: {
76
+ id?: string;
77
+ code?: number;
78
+ receipt?: Record<string, never>;
79
+ usage?: Record<string, never> | null;
80
+ }[];
81
+ messages: ({
82
+ role: string;
83
+ content?: string | null;
84
+ } & {
85
+ [key: string]: unknown;
86
+ })[];
87
+ }>;
88
+ command: (run_id: string, action: "pause" | "resume" | "cancel" | "input", text?: string) => Promise<{
89
+ id: string;
90
+ task: string;
91
+ model: string;
92
+ status: "ready" | "running" | "acting" | "paused" | "awaiting_approval" | "completed" | "cancelled" | "failed" | "waiting_input";
93
+ created_at: string;
94
+ updated_at: string;
95
+ activity: {
96
+ id: string;
97
+ at: string;
98
+ type: string;
99
+ detail: string;
100
+ }[];
101
+ approvals: {
102
+ id: string;
103
+ action: string;
104
+ url: string;
105
+ status: string;
106
+ requested_at: string;
107
+ }[];
108
+ phases: {
109
+ id?: string;
110
+ code?: number;
111
+ receipt?: Record<string, never>;
112
+ usage?: Record<string, never> | null;
113
+ }[];
114
+ messages: ({
115
+ role: string;
116
+ content?: string | null;
117
+ } & {
118
+ [key: string]: unknown;
119
+ })[];
120
+ }>;
121
+ approval: (run_id: string, approval_id: string, decision: "approve" | "reject") => Promise<{
122
+ id: string;
123
+ task: string;
124
+ model: string;
125
+ status: "ready" | "running" | "acting" | "paused" | "awaiting_approval" | "completed" | "cancelled" | "failed" | "waiting_input";
126
+ created_at: string;
127
+ updated_at: string;
128
+ activity: {
129
+ id: string;
130
+ at: string;
131
+ type: string;
132
+ detail: string;
133
+ }[];
134
+ approvals: {
135
+ id: string;
136
+ action: string;
137
+ url: string;
138
+ status: string;
139
+ requested_at: string;
140
+ }[];
141
+ phases: {
142
+ id?: string;
143
+ code?: number;
144
+ receipt?: Record<string, never>;
145
+ usage?: Record<string, never> | null;
146
+ }[];
147
+ messages: ({
148
+ role: string;
149
+ content?: string | null;
150
+ } & {
151
+ [key: string]: unknown;
152
+ })[];
153
+ }>;
154
+ };
155
+ };
package/dist/henry.js ADDED
@@ -0,0 +1,14 @@
1
+ /** Henry always derives its organization from the gateway's verified caller. */
2
+ export function henryModule(client) {
3
+ return {
4
+ config: () => client.request('henry_getConfig'),
5
+ credential: (api_key) => client.request('henry_putCredential', { body: { api_key } }),
6
+ runs: {
7
+ list: (page_token) => client.request('henry_listRuns', page_token ? { page_token } : {}),
8
+ create: (body) => client.request('henry_createRun', { body: { ...body, run_id: body.run_id ?? globalThis.crypto.randomUUID() } }),
9
+ get: (run_id) => client.request('henry_getRun', { run_id }),
10
+ command: (run_id, action, text) => client.request('henry_commandRun', { run_id, body: { action, ...(text === undefined ? {} : { text }) } }),
11
+ approval: (run_id, approval_id, decision) => client.request('henry_decideApproval', { run_id, approval_id, body: { decision } }),
12
+ },
13
+ };
14
+ }
@@ -0,0 +1,15 @@
1
+ /** The service separately bounds its serialized guest stdin envelope at 10 MiB. */
2
+ export declare const MAX_FUNCTION_BODY_BYTES: number;
3
+ export declare const MAX_FUNCTION_JSON_BYTES: number;
4
+ export interface HivesInvokeRequest {
5
+ method?: string;
6
+ path?: string;
7
+ headers?: Record<string, string>;
8
+ body?: unknown;
9
+ body_base64?: string;
10
+ }
11
+ export declare function validateHivesInvocation(input: unknown): asserts input is HivesInvokeRequest;
12
+ /** Safe display/transport headers; customer headers never establish identity. */
13
+ export declare function hivesFunctionResponseHeaders(headers: Headers): Headers;
14
+ /** Metadata contracts cannot accidentally expose an upstream env/ciphertext field. */
15
+ export declare function hivesFunctionMetadata(input: unknown, project: unknown): Record<string, unknown>;
@@ -0,0 +1,94 @@
1
+ /** The service separately bounds its serialized guest stdin envelope at 10 MiB. */
2
+ export const MAX_FUNCTION_BODY_BYTES = 10 * 1024 * 1024;
3
+ export const MAX_FUNCTION_JSON_BYTES = 16 * 1024 * 1024;
4
+ const reservedHeaders = new Set(['host', 'connection', 'content-length', 'transfer-encoding', 'keep-alive',
5
+ 'proxy-authenticate', 'proxy-authorization', 'te', 'trailer', 'upgrade', 'set-cookie', 'clear-site-data',
6
+ 'authorization', 'cookie', 'forwarded', 'origin', 'referer', 'x-org-id', 'x-workspace-id', 'x-project-id',
7
+ 'x-admin-token', 'x-tenant-id', 'x-cold-start']);
8
+ const platformHeader = (name) => /^x-(?:auth|genesis|life|l1fe|hives|forwarded|execution)-/.test(name);
9
+ const bytes = (value) => new TextEncoder().encode(value).length;
10
+ const fail = () => { throw new Error('Invalid function request. Check method, path, headers, exclusive body encoding and size limits.'); };
11
+ export function validateHivesInvocation(input) {
12
+ if (!input || typeof input !== 'object' || Array.isArray(input))
13
+ fail();
14
+ const r = input;
15
+ if (Object.keys(r).some((k) => !['method', 'path', 'headers', 'body', 'body_base64'].includes(k)))
16
+ fail();
17
+ if (r.method !== undefined && (typeof r.method !== 'string' || bytes(r.method) > 64 || !/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(r.method)))
18
+ fail();
19
+ if (r.path !== undefined && (typeof r.path !== 'string' || !r.path.startsWith('/') || r.path.startsWith('//') || r.path.includes('#') || bytes(r.path) > 8192 || /[\s\u0000-\u001f\u007f]/.test(r.path)))
20
+ fail();
21
+ let headerBytes = 0;
22
+ if (r.headers !== undefined) {
23
+ if (!r.headers || typeof r.headers !== 'object' || Array.isArray(r.headers) || Object.keys(r.headers).length > 128)
24
+ fail();
25
+ for (const [key, value] of Object.entries(r.headers)) {
26
+ if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(key) || typeof value !== 'string' || /[\u0000-\u0008\u000a-\u001f\u007f]/.test(value)
27
+ || reservedHeaders.has(key.toLowerCase()) || platformHeader(key.toLowerCase()))
28
+ fail();
29
+ headerBytes += bytes(key) + bytes(value);
30
+ if (headerBytes > 64 * 1024)
31
+ fail();
32
+ }
33
+ }
34
+ let size = 0;
35
+ if (r.body_base64 !== undefined) {
36
+ const value = r.body_base64;
37
+ if (r.body != null || typeof value !== 'string' || value.length > Math.ceil(MAX_FUNCTION_BODY_BYTES / 3) * 4
38
+ || value.length % 4 || !/^[A-Za-z0-9+/]*={0,2}$/.test(value))
39
+ fail();
40
+ try {
41
+ const bytes = atob(value);
42
+ if (btoa(bytes) !== value)
43
+ fail();
44
+ size = bytes.length;
45
+ }
46
+ catch {
47
+ fail();
48
+ }
49
+ }
50
+ else if (r.body != null) {
51
+ let value;
52
+ try {
53
+ value = typeof r.body === 'string' ? r.body : JSON.stringify(r.body);
54
+ }
55
+ catch {
56
+ fail();
57
+ }
58
+ if (value === undefined)
59
+ fail();
60
+ size = new TextEncoder().encode(value).length;
61
+ }
62
+ let serialized;
63
+ try {
64
+ serialized = JSON.stringify(r);
65
+ }
66
+ catch {
67
+ fail();
68
+ }
69
+ if (size + headerBytes > MAX_FUNCTION_BODY_BYTES || !serialized || new TextEncoder().encode(serialized).length > MAX_FUNCTION_JSON_BYTES)
70
+ fail();
71
+ }
72
+ /** Safe display/transport headers; customer headers never establish identity. */
73
+ export function hivesFunctionResponseHeaders(headers) {
74
+ const blocked = new Set(['connection', 'keep-alive', 'transfer-encoding', 'upgrade', 'proxy-authenticate', 'proxy-authorization',
75
+ 'te', 'trailer', 'content-length', 'content-encoding', 'set-cookie', 'clear-site-data', 'authorization', 'cookie', 'forwarded', 'host', 'x-org-id', 'x-workspace-id', 'x-project-id', 'x-admin-token', 'x-tenant-id', 'x-hives-guest-status']);
76
+ for (const value of (headers.get('connection') ?? '').split(','))
77
+ blocked.add(value.trim().toLowerCase());
78
+ const safe = new Headers();
79
+ headers.forEach((value, name) => {
80
+ if (!blocked.has(name) && (!platformHeader(name) || ['x-execution-id', 'x-execution-duration-ms'].includes(name)))
81
+ safe.set(name, value);
82
+ });
83
+ safe.set('cache-control', 'no-store');
84
+ return safe;
85
+ }
86
+ /** Metadata contracts cannot accidentally expose an upstream env/ciphertext field. */
87
+ export function hivesFunctionMetadata(input, project) {
88
+ if (!input || typeof input !== 'object' || input.project_id !== project) {
89
+ throw new Error('Hives returned invalid or wrong-project function metadata.');
90
+ }
91
+ const row = input;
92
+ return Object.fromEntries(['id', 'tenant_id', 'project_id', 'name', 'description', 'handler', 'route', 'memory_mb', 'timeout_ms',
93
+ 'status', 'invocations', 'avg_duration_ms', 'created_at', 'updated_at'].map((key) => [key, row[key]]));
94
+ }
@@ -0,0 +1,9 @@
1
+ import { Genesis } from './genesis.js';
2
+ import type { GenesisOptions } from './client.js';
3
+ export declare function closeHivesNodeTransport(): Promise<void>;
4
+ export declare function hivesOperationBudget(id: string): number;
5
+ /** Hives leaf transport. Caller fetch overrides stay authoritative; only native
6
+ * global fetch gets our Agent. Every operation retains an overall body deadline. */
7
+ export declare function createHivesNodeTransport(opts?: GenesisOptions, callerSignal?: AbortSignal): typeof fetch;
8
+ /** Node opt-in for Hives calls. Other services retain the caller transport. */
9
+ export declare function createHivesNodeClient(opts?: GenesisOptions, callerSignal?: AbortSignal): Genesis;
@@ -0,0 +1,150 @@
1
+ import { Agent } from 'undici';
2
+ import { Genesis } from './genesis.js';
3
+ import { operationTable } from './generated/operations.js';
4
+ // Node's native fetch accepts a compatible per-request dispatcher. Never change
5
+ // the global dispatcher or the portable SDK: other products retain their transport.
6
+ const agentOptions = { headersTimeout: 340_000, bodyTimeout: 340_000, connect: { timeout: 5_000 }, connections: 4, pipelining: 1 };
7
+ let agent;
8
+ const nativeAgent = () => agent ??= new Agent(agentOptions);
9
+ export async function closeHivesNodeTransport() {
10
+ const current = agent;
11
+ agent = undefined;
12
+ await current?.destroy();
13
+ }
14
+ export function hivesOperationBudget(id) {
15
+ if (id === 'hives_cancel_deployment' || id === 'hives_delete_deployment')
16
+ return 330_000;
17
+ if (['hives_create_deployment', 'hives_upload_deployment', 'hives_invoke_deployment', 'hives_invoke_function', 'hives_invoke_function_async'].includes(id))
18
+ return 40_000;
19
+ if (['hives_create_function', 'hives_update_function', 'hives_delete_function'].includes(id))
20
+ return 100_000;
21
+ return 20_000;
22
+ }
23
+ const escape = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
24
+ const templatePattern = (value) => new RegExp('^' + value.split(/(\{[^}]+\})/).map((part) => part.startsWith('{') ? '[^/]+' : escape(part)).join('') + '$');
25
+ /** Hives leaf transport. Caller fetch overrides stay authoritative; only native
26
+ * global fetch gets our Agent. Every operation retains an overall body deadline. */
27
+ export function createHivesNodeTransport(opts = {}, callerSignal) {
28
+ const supplied = opts.fetch ?? globalThis.fetch;
29
+ const underlying = supplied.bind(globalThis);
30
+ const useNative = supplied === globalThis.fetch;
31
+ const resolver = new Genesis(opts);
32
+ const routes = Object.entries(operationTable)
33
+ .filter(([, op]) => op.service === 'hives' && !op.internal)
34
+ .flatMap(([id, op]) => {
35
+ const direct = resolver.routing === 'direct';
36
+ let base;
37
+ try {
38
+ base = new URL(direct ? (opts.upstreams?.hives ?? op.upstream.base) : resolver.baseUrl);
39
+ }
40
+ catch {
41
+ throw new Error('Invalid Hives service address.');
42
+ }
43
+ const path = direct ? op.upstream.path : op.path;
44
+ const prefix = base.pathname.replace(/\/+$/, '');
45
+ const paths = [path];
46
+ if (!direct && path.startsWith('/v1/hives/'))
47
+ paths.push(path.replace('/v1/hives/', '/hives/v1/'));
48
+ return paths.map((p) => ({ id, origin: base.origin, method: direct ? op.upstream.method : op.method, pattern: templatePattern(prefix + p) }));
49
+ });
50
+ return (async (input, init = {}) => {
51
+ let url;
52
+ try {
53
+ url = new URL(input instanceof Request ? input.url : String(input));
54
+ }
55
+ catch {
56
+ throw new Error('Invalid Hives request address.');
57
+ }
58
+ const method = (init.method ?? (input instanceof Request ? input.method : 'GET')).toUpperCase();
59
+ const route = routes.find((entry) => entry.origin === url.origin && entry.method === method && entry.pattern.test(url.pathname));
60
+ if (!route)
61
+ return underlying(input, init);
62
+ const controller = new AbortController();
63
+ let message = 'Hives transport failed. Refresh the resource and retry.';
64
+ const safeError = () => new Error(message);
65
+ const signals = [...new Set([callerSignal, init.signal, input instanceof Request ? input.signal : undefined].filter((signal) => !!signal))];
66
+ const canceled = () => {
67
+ message = 'Hives request canceled before completion. Refresh the resource before retrying.';
68
+ controller.abort();
69
+ };
70
+ for (const signal of signals)
71
+ signal.addEventListener('abort', canceled, { once: true });
72
+ const timer = setTimeout(() => {
73
+ message = 'Hives request deadline exceeded. Refresh the resource before retrying.';
74
+ controller.abort();
75
+ }, hivesOperationBudget(route.id));
76
+ timer.unref();
77
+ let abortReject = () => { };
78
+ let reader;
79
+ let bodyController;
80
+ const aborted = () => {
81
+ abortReject(safeError());
82
+ bodyController?.error(safeError());
83
+ void reader?.cancel().catch(() => { });
84
+ cleanup();
85
+ };
86
+ controller.signal.addEventListener('abort', aborted, { once: true });
87
+ const abortPromise = new Promise((_, reject) => { abortReject = reject; });
88
+ void abortPromise.catch(() => { });
89
+ const cleanup = () => {
90
+ clearTimeout(timer);
91
+ for (const signal of signals)
92
+ signal.removeEventListener('abort', canceled);
93
+ controller.signal.removeEventListener('abort', aborted);
94
+ };
95
+ if (signals.some((signal) => signal.aborted))
96
+ canceled();
97
+ try {
98
+ if (controller.signal.aborted)
99
+ throw safeError();
100
+ const requestInit = {
101
+ ...init, signal: controller.signal, cache: 'no-store',
102
+ redirect: init.redirect === 'manual' ? 'manual' : 'error',
103
+ ...(useNative ? { dispatcher: nativeAgent() } : {}),
104
+ };
105
+ const pending = underlying(input, requestInit);
106
+ // A caller transport may ignore AbortSignal. Reject on our budget anyway,
107
+ // and discard any late response rather than presenting an acknowledgement.
108
+ void pending.then((response) => { if (controller.signal.aborted)
109
+ void response.body?.cancel().catch(() => { }); }, () => { });
110
+ const response = await Promise.race([pending, abortPromise]);
111
+ if (controller.signal.aborted)
112
+ throw safeError();
113
+ if (!response.body) {
114
+ cleanup();
115
+ return response;
116
+ }
117
+ reader = response.body.getReader();
118
+ const body = new ReadableStream({
119
+ start(value) { bodyController = value; },
120
+ async pull(value) {
121
+ try {
122
+ const next = await reader.read();
123
+ if (controller.signal.aborted)
124
+ return;
125
+ if (next.done) {
126
+ cleanup();
127
+ value.close();
128
+ }
129
+ else
130
+ value.enqueue(next.value);
131
+ }
132
+ catch {
133
+ cleanup();
134
+ value.error(safeError());
135
+ }
136
+ },
137
+ async cancel() { cleanup(); await reader.cancel().catch(() => { }); },
138
+ });
139
+ return new Response(body, { status: response.status, statusText: response.statusText, headers: response.headers });
140
+ }
141
+ catch {
142
+ cleanup();
143
+ throw safeError();
144
+ }
145
+ });
146
+ }
147
+ /** Node opt-in for Hives calls. Other services retain the caller transport. */
148
+ export function createHivesNodeClient(opts = {}, callerSignal) {
149
+ return new Genesis({ ...opts, fetch: createHivesNodeTransport(opts, callerSignal) });
150
+ }
@@ -0,0 +1,2 @@
1
+ /** Bound completed response bytes without losing binary data or treating HTTP errors as JSON wrappers. */
2
+ export declare function hivesResponseBytes(response: Response): Promise<Uint8Array>;
@@ -0,0 +1,32 @@
1
+ import { MAX_FUNCTION_BODY_BYTES } from './hives-functions.js';
2
+ /** Bound completed response bytes without losing binary data or treating HTTP errors as JSON wrappers. */
3
+ export async function hivesResponseBytes(response) {
4
+ if (!response.body)
5
+ return new Uint8Array();
6
+ const reader = response.body.getReader();
7
+ const chunks = [];
8
+ let size = 0;
9
+ try {
10
+ for (;;) {
11
+ const { value, done } = await reader.read();
12
+ if (done)
13
+ break;
14
+ size += value.byteLength;
15
+ if (size > MAX_FUNCTION_BODY_BYTES) {
16
+ await reader.cancel();
17
+ throw new Error('Hives guest response exceeds 10 MiB.');
18
+ }
19
+ chunks.push(value);
20
+ }
21
+ }
22
+ finally {
23
+ reader.releaseLock();
24
+ }
25
+ const bytes = new Uint8Array(size);
26
+ let offset = 0;
27
+ for (const chunk of chunks) {
28
+ bytes.set(chunk, offset);
29
+ offset += chunk.length;
30
+ }
31
+ return bytes;
32
+ }
@@ -0,0 +1,9 @@
1
+ export declare const MAX_WASM_BYTES: number;
2
+ export interface HivesUploadOptions {
3
+ filename?: string;
4
+ git_sha?: string;
5
+ git_branch?: string;
6
+ git_message?: string;
7
+ }
8
+ /** Real multipart binary; the org and digest are resolved by the authenticated backend. */
9
+ export declare function hivesUploadBody(file: Blob, options?: HivesUploadOptions): Promise<FormData>;
@@ -0,0 +1,23 @@
1
+ export const MAX_WASM_BYTES = 10 * 1024 * 1024;
2
+ /** Real multipart binary; the org and digest are resolved by the authenticated backend. */
3
+ export async function hivesUploadBody(file, options = {}) {
4
+ if (!(file instanceof Blob) || file.size < 4 || file.size > MAX_WASM_BYTES)
5
+ throw new Error('Choose a WebAssembly binary of 4 bytes to 10 MiB.');
6
+ const magic = new Uint8Array(await file.slice(0, 4).arrayBuffer());
7
+ if (magic[0] !== 0 || magic[1] !== 97 || magic[2] !== 115 || magic[3] !== 109)
8
+ throw new Error('The file must be a WebAssembly binary.');
9
+ const limits = { git_sha: 40, git_branch: 255, git_message: 1000 };
10
+ if (options.filename !== undefined && (typeof options.filename !== 'string' || !options.filename.length || options.filename.length > 255 || /[\r\n]/.test(options.filename)))
11
+ throw new Error('WASM filename must contain 1–255 characters without newlines.');
12
+ const form = new FormData();
13
+ form.append('file', file, options.filename ?? 'module.wasm');
14
+ for (const key of Object.keys(limits)) {
15
+ const value = options[key];
16
+ if (value === undefined)
17
+ continue;
18
+ if (typeof value !== 'string' || value.length > limits[key] || (key === 'git_sha' && value.length < 7))
19
+ throw new Error('Invalid deployment Git metadata.');
20
+ form.append(key, value);
21
+ }
22
+ return form;
23
+ }
@@ -0,0 +1,12 @@
1
+ export { Genesis, type ChatMessage } from './genesis.js';
2
+ export { GenesisClient, DEFAULT_BASE_URL, type GenesisOptions, type CredentialProvider } from './client.js';
3
+ export { GenesisError } from './errors.js';
4
+ export { operationTable, services, type OperationId } from './generated/operations.js';
5
+ export type { OperationInput, OperationOutput, OperationMeta, ServiceMeta } from './types.js';
6
+ export type { paths, operations, components } from './generated/schema.js';
7
+ export { hivesUploadBody, MAX_WASM_BYTES, type HivesUploadOptions } from './hives-upload.js';
8
+ export { validateHivesInvocation, hivesFunctionResponseHeaders, MAX_FUNCTION_BODY_BYTES, MAX_FUNCTION_JSON_BYTES, type HivesInvokeRequest } from './hives-functions.js';
9
+ export { hivesResponseBytes } from './hives-response.js';
10
+ export { runnerModule, type RunnerStartInput, type RunnerSnapshot, type RunnerCatalog, type RunnerEvent, type RunnerProviderResult, type RunnerRequestOptions } from './runner.js';
11
+ export { beaconsModule } from './beacons.js';
12
+ export { dialsModule, dialsEmergencyAddressFeedback, type DialsEmergencyAddressFeedback, type DialsScope, type DialsOutboundCall, type DialsCallControl, type DialsEmergencyAddress } from './dials.js';
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { Genesis } from './genesis.js';
2
+ export { GenesisClient, DEFAULT_BASE_URL } from './client.js';
3
+ export { GenesisError } from './errors.js';
4
+ export { operationTable, services } from './generated/operations.js';
5
+ export { hivesUploadBody, MAX_WASM_BYTES } from './hives-upload.js';
6
+ export { validateHivesInvocation, hivesFunctionResponseHeaders, MAX_FUNCTION_BODY_BYTES, MAX_FUNCTION_JSON_BYTES } from './hives-functions.js';
7
+ export { hivesResponseBytes } from './hives-response.js';
8
+ export { runnerModule } from './runner.js';
9
+ export { beaconsModule } from './beacons.js';
10
+ export { dialsModule, dialsEmergencyAddressFeedback } from './dials.js';
@@ -0,0 +1,52 @@
1
+ import type { GenesisClient } from './client.js';
2
+ import type { components } from './generated/schema.js';
3
+ type Schemas = components['schemas'];
4
+ export type RunnerStartInput = Schemas['Runner.StartInput'];
5
+ export type RunnerSnapshot = Schemas['Runner.Snapshot'];
6
+ export type RunnerCatalog = Schemas['Runner.Catalog'];
7
+ export type RunnerEvent = Schemas['Runner.Event'];
8
+ export type RunnerProviderResult = Schemas['Runner.ProviderResult'];
9
+ export type RunnerRequestOptions = {
10
+ signal?: AbortSignal;
11
+ };
12
+ /** Runner routes use the Genesis client's credential; the backend owns org/subject scoping. */
13
+ export declare function runnerModule(client: GenesisClient): Readonly<{
14
+ catalog: (opts?: RunnerRequestOptions) => Promise<{
15
+ workspaces: {
16
+ key: components["schemas"]["Runner.SafeOpaqueRef"];
17
+ label: string;
18
+ }[];
19
+ routes: {
20
+ routeId: components["schemas"]["Runner.SafeOpaqueRef"];
21
+ kind: "external-harness" | "internal-model";
22
+ name: string;
23
+ via: string;
24
+ state: "synthetic" | "bound" | "unbound";
25
+ default: boolean;
26
+ }[];
27
+ }>;
28
+ jobs: Readonly<{
29
+ list: (opts?: RunnerRequestOptions) => Promise<{
30
+ jobs: components["schemas"]["Runner.Snapshot"][];
31
+ }>;
32
+ start: (input: RunnerStartInput, opts?: RunnerRequestOptions) => Promise<{
33
+ jobId: components["schemas"]["Runner.SafeOpaqueRef"];
34
+ snapshot: components["schemas"]["Runner.Snapshot"];
35
+ }>;
36
+ get: (jobId: string, opts?: RunnerRequestOptions) => Promise<{
37
+ snapshot: components["schemas"]["Runner.Snapshot"];
38
+ }>;
39
+ events: (jobId: string, afterSeq?: number, opts?: RunnerRequestOptions) => Promise<{
40
+ events: components["schemas"]["Runner.Event"][];
41
+ nextAfterSeq: number;
42
+ hasMore: boolean;
43
+ }>;
44
+ result: (jobId: string, opts?: RunnerRequestOptions) => Promise<{
45
+ result: components["schemas"]["Runner.ProviderResult"];
46
+ }>;
47
+ cancel: (jobId: string, opts?: RunnerRequestOptions) => Promise<{
48
+ snapshot: components["schemas"]["Runner.Snapshot"];
49
+ }>;
50
+ }>;
51
+ }>;
52
+ export {};