@lifesi/genesis 0.1.2 → 0.1.4
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/dist/client.d.ts +1497 -244
- package/dist/client.js +12 -2
- package/dist/fleets.d.ts +56 -0
- package/dist/fleets.js +54 -0
- package/dist/generated/operations.d.ts +1497 -244
- package/dist/generated/operations.js +1809 -325
- package/dist/generated/schema.d.ts +3184 -592
- package/dist/genesis.d.ts +158 -0
- package/dist/genesis.js +13 -0
- package/dist/genesis.openapi.json +6218 -2791
- package/dist/henry.d.ts +7 -0
- package/dist/henry.js +23 -0
- package/dist/hives-functions.d.ts +1 -1
- package/dist/hives-functions.js +3 -1
- package/dist/hives-marketplace.d.ts +128 -0
- package/dist/hives-marketplace.js +187 -0
- package/dist/hives-node.js +1 -1
- package/dist/hives-resources-transport.js +1 -1
- package/dist/hives-volumes.d.ts +64 -0
- package/dist/hives-volumes.js +117 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -65,6 +65,10 @@ export class GenesisClient {
|
|
|
65
65
|
const res = await this.raw(operationId, (input ?? {}), init);
|
|
66
66
|
if (operationTable[operationId].rawResponse)
|
|
67
67
|
return res;
|
|
68
|
+
if (operationId === 'hives_stop_deployment' && res.status !== 200) {
|
|
69
|
+
void res.body?.cancel().catch(() => { });
|
|
70
|
+
throw new GenesisError({ status: 0, type: 'invalid_response', operationId, message: 'Hives did not confirm this deployment stopped. Read its current state before explicitly reconciling stop.' });
|
|
71
|
+
}
|
|
68
72
|
if (res.status === 204)
|
|
69
73
|
return undefined;
|
|
70
74
|
const ct = res.headers.get('content-type') ?? '';
|
|
@@ -79,6 +83,12 @@ export class GenesisClient {
|
|
|
79
83
|
throw new Error('Hives returned invalid function metadata.');
|
|
80
84
|
throw error;
|
|
81
85
|
}
|
|
86
|
+
if (operationId === 'hives_stop_deployment') {
|
|
87
|
+
const requested = input;
|
|
88
|
+
if (!value || value.id !== requested.deployment_id || value.project_id !== requested.project_id || value.status !== 'cancelled') {
|
|
89
|
+
throw new GenesisError({ status: 0, type: 'invalid_response', operationId, message: 'Hives did not confirm this deployment stopped. Read its current state before explicitly reconciling stop.' });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
82
92
|
if (operationId === 'hives_list_functions') {
|
|
83
93
|
if (!value || !Array.isArray(value.data) || !value.pagination)
|
|
84
94
|
throw new Error('Hives returned invalid function list metadata.');
|
|
@@ -86,7 +96,7 @@ export class GenesisClient {
|
|
|
86
96
|
return { data: value.data.map((row) => hivesFunctionMetadata(row, input?.project_id)), pagination };
|
|
87
97
|
}
|
|
88
98
|
if (['hives_get_function', 'hives_create_function', 'hives_update_function'].includes(operationId)) {
|
|
89
|
-
return hivesFunctionMetadata(value, input?.project_id);
|
|
99
|
+
return hivesFunctionMetadata(value, input?.project_id, operationId === 'hives_create_function' ? undefined : input?.function_id);
|
|
90
100
|
}
|
|
91
101
|
if (operationId === 'hives_list_project_environment' || operationId === 'hives_update_project_environment') {
|
|
92
102
|
return hivesEnvironmentMetadata(value, input?.project_id, operationId === 'hives_update_project_environment');
|
|
@@ -113,7 +123,7 @@ export class GenesisClient {
|
|
|
113
123
|
const url = this.url(operationId, input);
|
|
114
124
|
const headers = {
|
|
115
125
|
accept: 'application/json',
|
|
116
|
-
'user-agent': this.opts.userAgent ?? '@lifesi/genesis/0.1.
|
|
126
|
+
'user-agent': this.opts.userAgent ?? '@lifesi/genesis/0.1.4',
|
|
117
127
|
...this.opts.headers, ...init.headers,
|
|
118
128
|
};
|
|
119
129
|
if (runnerGrant) {
|
package/dist/fleets.d.ts
CHANGED
|
@@ -1,12 +1,68 @@
|
|
|
1
1
|
import type { GenesisClient } from './client.js';
|
|
2
2
|
import type { OperationInput } from './types.js';
|
|
3
3
|
type TaskInput = NonNullable<OperationInput<'fleets_submitTask'>['body']>;
|
|
4
|
+
type AgentLaunchInput = NonNullable<OperationInput<'fleets_launchAgent'>['body']>;
|
|
5
|
+
type AgentCommandInput = NonNullable<OperationInput<'fleets_commandAgent'>['body']>;
|
|
4
6
|
export interface FleetsInstanceOptions {
|
|
5
7
|
idempotencyKey?: string;
|
|
6
8
|
signal?: AbortSignal;
|
|
7
9
|
}
|
|
8
10
|
/** Managed Henry instances and tasks scoped to the credential's verified org. */
|
|
9
11
|
export declare function fleetsModule(client: GenesisClient): {
|
|
12
|
+
agents: {
|
|
13
|
+
list: () => Promise<{
|
|
14
|
+
agents: import("./index.js").components["schemas"]["Fleets.Agent"][];
|
|
15
|
+
}>;
|
|
16
|
+
launch: (body: AgentLaunchInput) => Promise<{
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
state: "launching" | "running" | "stopping" | "stopped" | "recovering" | "recovery_required";
|
|
20
|
+
memory: import("./index.js").components["schemas"]["Fleets.Memory"];
|
|
21
|
+
model?: string | null;
|
|
22
|
+
inference: {
|
|
23
|
+
provider: "foundry";
|
|
24
|
+
mode: "managed";
|
|
25
|
+
};
|
|
26
|
+
created_at_ms: number;
|
|
27
|
+
updated_at_ms: number;
|
|
28
|
+
last_operation_id?: string | null;
|
|
29
|
+
}>;
|
|
30
|
+
get: (agent_id: string) => Promise<{
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
state: "launching" | "running" | "stopping" | "stopped" | "recovering" | "recovery_required";
|
|
34
|
+
memory: import("./index.js").components["schemas"]["Fleets.Memory"];
|
|
35
|
+
model?: string | null;
|
|
36
|
+
inference: {
|
|
37
|
+
provider: "foundry";
|
|
38
|
+
mode: "managed";
|
|
39
|
+
};
|
|
40
|
+
created_at_ms: number;
|
|
41
|
+
updated_at_ms: number;
|
|
42
|
+
last_operation_id?: string | null;
|
|
43
|
+
}>;
|
|
44
|
+
command: (agent_id: string, body: AgentCommandInput) => Promise<{
|
|
45
|
+
agent: import("./index.js").components["schemas"]["Fleets.Agent"];
|
|
46
|
+
operation_id: string;
|
|
47
|
+
result?: {
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
stop: (agent_id: string) => Promise<{
|
|
52
|
+
agent: import("./index.js").components["schemas"]["Fleets.Agent"];
|
|
53
|
+
operation_id: string;
|
|
54
|
+
result?: {
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
recover: (agent_id: string) => Promise<{
|
|
59
|
+
agent: import("./index.js").components["schemas"]["Fleets.Agent"];
|
|
60
|
+
operation_id: string;
|
|
61
|
+
result?: {
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
10
66
|
instances: {
|
|
11
67
|
list: (query?: OperationInput<"fleets_listInstances">) => Promise<{
|
|
12
68
|
instances: import("./index.js").components["schemas"]["Fleets.Instance"][];
|
package/dist/fleets.js
CHANGED
|
@@ -31,9 +31,63 @@ const instanceId = (value, operation) => {
|
|
|
31
31
|
throw invalid(operation, 'Invalid Fleets instance ID.');
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
+
const agentId = (value, operation) => {
|
|
35
|
+
if (typeof value !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value)) {
|
|
36
|
+
throw invalid(operation, 'Invalid Fleets agent ID.');
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function validateAgentLaunch(body) {
|
|
40
|
+
if (!body || typeof body.name !== 'string' || !body.name.trim() || byteLength(body.name) > 128) {
|
|
41
|
+
throw invalid('fleets_launchAgent', 'Agent name must contain 1–128 UTF-8 bytes.');
|
|
42
|
+
}
|
|
43
|
+
if (body.instructions !== undefined && (byteLength(body.instructions) > 65536 || body.instructions.includes('\0'))) {
|
|
44
|
+
throw invalid('fleets_launchAgent', 'Agent instructions must contain at most 65536 UTF-8 bytes without NUL.');
|
|
45
|
+
}
|
|
46
|
+
if (body.model !== undefined && (!body.model || byteLength(body.model) > 128)) {
|
|
47
|
+
throw invalid('fleets_launchAgent', 'Agent model must contain 1–128 UTF-8 bytes.');
|
|
48
|
+
}
|
|
49
|
+
if (body.memory !== undefined) {
|
|
50
|
+
if (!['minds', 'files', 'custom'].includes(body.memory.provider))
|
|
51
|
+
throw invalid('fleets_launchAgent', 'Memory provider must be minds, files, or custom.');
|
|
52
|
+
if (body.memory.provider === 'custom' && !body.memory.endpoint)
|
|
53
|
+
throw invalid('fleets_launchAgent', 'Custom memory requires an endpoint.');
|
|
54
|
+
}
|
|
55
|
+
if (body.idempotency_key !== undefined && (typeof body.idempotency_key !== 'string' || !/^[!-~]{1,128}$/.test(body.idempotency_key))) {
|
|
56
|
+
throw invalid('fleets_launchAgent', 'Idempotency key must contain 1–128 visible ASCII characters.');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function validateAgentCommand(body) {
|
|
60
|
+
if (!body || typeof body.input !== 'string' || !body.input.trim() || byteLength(body.input) > 65536 || body.input.includes('\0')) {
|
|
61
|
+
throw invalid('fleets_commandAgent', 'Agent input must contain 1–65536 UTF-8 bytes without NUL.');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
34
64
|
/** Managed Henry instances and tasks scoped to the credential's verified org. */
|
|
35
65
|
export function fleetsModule(client) {
|
|
36
66
|
return {
|
|
67
|
+
agents: {
|
|
68
|
+
list: () => client.request('fleets_listAgents'),
|
|
69
|
+
launch: async (body) => {
|
|
70
|
+
validateAgentLaunch(body);
|
|
71
|
+
return client.request('fleets_launchAgent', { body });
|
|
72
|
+
},
|
|
73
|
+
get: async (agent_id) => {
|
|
74
|
+
agentId(agent_id, 'fleets_getAgent');
|
|
75
|
+
return client.request('fleets_getAgent', { agent_id });
|
|
76
|
+
},
|
|
77
|
+
command: async (agent_id, body) => {
|
|
78
|
+
agentId(agent_id, 'fleets_commandAgent');
|
|
79
|
+
validateAgentCommand(body);
|
|
80
|
+
return client.request('fleets_commandAgent', { agent_id, body });
|
|
81
|
+
},
|
|
82
|
+
stop: async (agent_id) => {
|
|
83
|
+
agentId(agent_id, 'fleets_stopAgent');
|
|
84
|
+
return client.request('fleets_stopAgent', { agent_id });
|
|
85
|
+
},
|
|
86
|
+
recover: async (agent_id) => {
|
|
87
|
+
agentId(agent_id, 'fleets_recoverAgent');
|
|
88
|
+
return client.request('fleets_recoverAgent', { agent_id });
|
|
89
|
+
},
|
|
90
|
+
},
|
|
37
91
|
instances: {
|
|
38
92
|
list: async (query = {}) => {
|
|
39
93
|
if (query.limit !== undefined && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 50)) {
|