@onesi/genesis 0.0.1-stage → 0.1.13
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 +29 -0
- package/dist/beacons.d.ts +103 -0
- package/dist/beacons.js +77 -0
- package/dist/blinds-owner-enrollment.d.ts +171 -0
- package/dist/blinds-owner-enrollment.js +150 -0
- package/dist/client.d.ts +19996 -0
- package/dist/client.js +277 -0
- package/dist/context.d.ts +50 -0
- package/dist/context.js +153 -0
- package/dist/dials.d.ts +299 -0
- package/dist/dials.js +100 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.js +66 -0
- package/dist/flares.d.ts +170 -0
- package/dist/flares.js +56 -0
- package/dist/fleets.d.ts +186 -0
- package/dist/fleets.js +136 -0
- package/dist/flocks.d.ts +155 -0
- package/dist/flocks.js +39 -0
- package/dist/foundry-billing.d.ts +97 -0
- package/dist/foundry-billing.js +107 -0
- package/dist/gears.d.ts +107 -0
- package/dist/gears.js +20 -0
- package/dist/generated/operations.d.ts +19949 -0
- package/dist/generated/operations.js +23846 -0
- package/dist/generated/schema.d.ts +35413 -0
- package/dist/generated/schema.js +1 -0
- package/dist/genesis.d.ts +2926 -0
- package/dist/genesis.js +206 -0
- package/dist/genesis.openapi.json +49321 -0
- package/dist/henry.d.ts +168 -0
- package/dist/henry.js +45 -0
- package/dist/hives-cells.d.ts +127 -0
- package/dist/hives-cells.js +151 -0
- package/dist/hives-environment.d.ts +28 -0
- package/dist/hives-environment.js +58 -0
- package/dist/hives-functions.d.ts +36 -0
- package/dist/hives-functions.js +185 -0
- package/dist/hives-marketplace.d.ts +128 -0
- package/dist/hives-marketplace.js +187 -0
- package/dist/hives-node.d.ts +9 -0
- package/dist/hives-node.js +152 -0
- package/dist/hives-operations.d.ts +337 -0
- package/dist/hives-operations.js +41 -0
- package/dist/hives-queue-consumer.d.ts +56 -0
- package/dist/hives-queue-consumer.js +95 -0
- package/dist/hives-queue-funding.d.ts +28 -0
- package/dist/hives-queue-funding.js +81 -0
- package/dist/hives-queues.d.ts +137 -0
- package/dist/hives-queues.js +143 -0
- package/dist/hives-resources-transport.d.ts +23 -0
- package/dist/hives-resources-transport.js +204 -0
- package/dist/hives-response.d.ts +2 -0
- package/dist/hives-response.js +32 -0
- package/dist/hives-runtimes.d.ts +34 -0
- package/dist/hives-runtimes.js +32 -0
- package/dist/hives-topics.d.ts +51 -0
- package/dist/hives-topics.js +79 -0
- package/dist/hives-upload.d.ts +9 -0
- package/dist/hives-upload.js +23 -0
- package/dist/hives-volumes.d.ts +64 -0
- package/dist/hives-volumes.js +117 -0
- package/dist/idempotency.d.ts +4 -0
- package/dist/idempotency.js +17 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +25 -0
- package/dist/instances.d.ts +25 -0
- package/dist/instances.js +11 -0
- package/dist/lanes.d.ts +267 -0
- package/dist/lanes.js +41 -0
- package/dist/minds-agent.d.ts +60 -0
- package/dist/minds-agent.js +190 -0
- package/dist/minds-owner.d.ts +110 -0
- package/dist/minds-owner.js +226 -0
- package/dist/minds.d.ts +269 -0
- package/dist/minds.js +193 -0
- package/dist/relays-enrollment.d.ts +33 -0
- package/dist/relays-enrollment.js +115 -0
- package/dist/runner-grant.d.ts +10 -0
- package/dist/runner-grant.js +133 -0
- package/dist/runner.d.ts +68 -0
- package/dist/runner.js +116 -0
- package/dist/types.d.ts +87 -0
- package/dist/types.js +1 -0
- package/dist/urls.d.ts +6 -0
- package/dist/urls.js +31 -0
- package/package.json +49 -1
package/dist/flares.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { idempotencyHeaders } from './idempotency.js';
|
|
2
|
+
/** Flares v2 (Sandbox): flares, conversations, commitments, presence, trust and choreography.
|
|
3
|
+
* Every mutation needs one stable idempotency key; reuse it to replay instead of acting twice. */
|
|
4
|
+
export function flaresModule(client) {
|
|
5
|
+
const write = async (id, input, idempotencyKey) => client.request(id, input, { headers: idempotencyHeaders(id, idempotencyKey) });
|
|
6
|
+
return {
|
|
7
|
+
list: (q = {}) => client.request('flares_listFlares', q),
|
|
8
|
+
get: (id) => client.request('flares_getFlare', { id }),
|
|
9
|
+
send: (body, key) => write('flares_sendFlare', { body }, key),
|
|
10
|
+
sendBatch: (body, key) => write('flares_sendFlareBatch', { body }, key),
|
|
11
|
+
acknowledge: (id, body, key) => write('flares_acknowledgeFlare', { id, body }, key),
|
|
12
|
+
act: (id, body, key) => write('flares_actOnFlare', { id, body }, key),
|
|
13
|
+
conversations: {
|
|
14
|
+
list: () => client.request('flares_listConversations'),
|
|
15
|
+
get: (id) => client.request('flares_getConversation', { id }),
|
|
16
|
+
create: (body, key) => write('flares_createConversation', { body }, key),
|
|
17
|
+
send: (id, body, key) => write('flares_sendConversationMessage', { id, body }, key),
|
|
18
|
+
close: (id, key) => write('flares_closeConversation', { id }, key),
|
|
19
|
+
},
|
|
20
|
+
commitments: {
|
|
21
|
+
list: () => client.request('flares_listCommitments'),
|
|
22
|
+
get: (id) => client.request('flares_getCommitment', { id }),
|
|
23
|
+
create: (body, key) => write('flares_createCommitment', { body }, key),
|
|
24
|
+
accept: (id, key) => write('flares_acceptCommitment', { id }, key),
|
|
25
|
+
start: (id, key) => write('flares_startCommitment', { id }, key),
|
|
26
|
+
progress: (id, body, key) => write('flares_reportCommitmentProgress', { id, body }, key),
|
|
27
|
+
fulfill: (id, body, key) => write('flares_fulfillCommitment', { id, body }, key),
|
|
28
|
+
fail: (id, body, key) => write('flares_failCommitment', { id, body }, key),
|
|
29
|
+
},
|
|
30
|
+
presence: {
|
|
31
|
+
heartbeat: (body, key) => write('flares_presenceHeartbeat', { body }, key),
|
|
32
|
+
get: (did) => client.request('flares_getPresence', { did }),
|
|
33
|
+
},
|
|
34
|
+
trust: {
|
|
35
|
+
score: (did) => client.request('flares_getTrustScore', { did }),
|
|
36
|
+
check: (body, key) => write('flares_checkTrust', { body }, key),
|
|
37
|
+
endorsements: (did) => client.request('flares_listEndorsements', { did }),
|
|
38
|
+
endorse: (body, key) => write('flares_createEndorsement', { body }, key),
|
|
39
|
+
revoke: (id, key) => write('flares_revokeEndorsement', { id }, key),
|
|
40
|
+
},
|
|
41
|
+
choreography: {
|
|
42
|
+
workflows: {
|
|
43
|
+
list: () => client.request('flares_listChoreographyWorkflows'),
|
|
44
|
+
create: (body, key) => write('flares_createChoreographyWorkflow', { body }, key),
|
|
45
|
+
start: (workflow_id, key) => write('flares_startChoreographyExecution', { workflow_id }, key),
|
|
46
|
+
},
|
|
47
|
+
executions: {
|
|
48
|
+
list: () => client.request('flares_listChoreographyExecutions'),
|
|
49
|
+
get: (execution_id) => client.request('flares_getChoreographyExecution', { execution_id }),
|
|
50
|
+
completeStep: (execution_id, step_id, body, key) => write('flares_completeChoreographyStep', { execution_id, step_id, body }, key),
|
|
51
|
+
failStep: (execution_id, step_id, body, key) => write('flares_failChoreographyStep', { execution_id, step_id, body }, key),
|
|
52
|
+
cancel: (execution_id, key) => write('flares_cancelChoreographyExecution', { execution_id }, key),
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
package/dist/fleets.d.ts
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
import type { OperationInput } from './types.js';
|
|
3
|
+
type TaskInput = NonNullable<OperationInput<'fleets_submitTask'>['body']>;
|
|
4
|
+
type AgentLaunchInput = NonNullable<OperationInput<'fleets_launchAgent'>['body']>;
|
|
5
|
+
type AgentCommandInput = NonNullable<OperationInput<'fleets_commandAgent'>['body']>;
|
|
6
|
+
export interface FleetsInstanceOptions {
|
|
7
|
+
idempotencyKey?: string;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
}
|
|
10
|
+
/** Managed Henry instances and tasks scoped to the credential's verified org. */
|
|
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
|
+
};
|
|
66
|
+
instances: {
|
|
67
|
+
list: (query?: OperationInput<"fleets_listInstances">) => Promise<{
|
|
68
|
+
instances: import("./index.js").components["schemas"]["Fleets.Instance"][];
|
|
69
|
+
next_cursor: string | null;
|
|
70
|
+
}>;
|
|
71
|
+
get: (instance_id: string) => Promise<{
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
organization_id: string;
|
|
75
|
+
workspace_id: string;
|
|
76
|
+
project_id: string;
|
|
77
|
+
admission_held: boolean | null;
|
|
78
|
+
physical_state: "created" | "running" | "held" | "stopped" | "recovery_required" | "released";
|
|
79
|
+
status_evidence: "live_controller" | "confirmed_release_receipt";
|
|
80
|
+
release_acknowledged_at_ms: number | null;
|
|
81
|
+
harness_ready: boolean;
|
|
82
|
+
observed_at_ms: number | null;
|
|
83
|
+
lease_expires: {
|
|
84
|
+
wall_ms: number;
|
|
85
|
+
logical: number;
|
|
86
|
+
} | null;
|
|
87
|
+
}>;
|
|
88
|
+
stop: (instance_id: string, options?: FleetsInstanceOptions) => Promise<{
|
|
89
|
+
id: string;
|
|
90
|
+
state: "released";
|
|
91
|
+
reaped: true;
|
|
92
|
+
data_retained: true;
|
|
93
|
+
status_evidence: "confirmed_release_receipt";
|
|
94
|
+
release_acknowledged_at_ms: number;
|
|
95
|
+
}>;
|
|
96
|
+
start: (instance_id: string, options?: FleetsInstanceOptions) => Promise<{
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
organization_id: string;
|
|
100
|
+
workspace_id: string;
|
|
101
|
+
project_id: string;
|
|
102
|
+
admission_held: boolean | null;
|
|
103
|
+
physical_state: "created" | "running" | "held" | "stopped" | "recovery_required" | "released";
|
|
104
|
+
status_evidence: "live_controller" | "confirmed_release_receipt";
|
|
105
|
+
release_acknowledged_at_ms: number | null;
|
|
106
|
+
harness_ready: boolean;
|
|
107
|
+
observed_at_ms: number | null;
|
|
108
|
+
lease_expires: {
|
|
109
|
+
wall_ms: number;
|
|
110
|
+
logical: number;
|
|
111
|
+
} | null;
|
|
112
|
+
}>;
|
|
113
|
+
};
|
|
114
|
+
connection: {
|
|
115
|
+
get: () => Promise<{
|
|
116
|
+
connected: boolean;
|
|
117
|
+
model: string;
|
|
118
|
+
updated_at?: number;
|
|
119
|
+
}>;
|
|
120
|
+
set: (api_key: string) => Promise<{
|
|
121
|
+
connected: boolean;
|
|
122
|
+
model: string;
|
|
123
|
+
updated_at?: number;
|
|
124
|
+
}>;
|
|
125
|
+
delete: () => Promise<{
|
|
126
|
+
connected: boolean;
|
|
127
|
+
model: string;
|
|
128
|
+
updated_at?: number;
|
|
129
|
+
}>;
|
|
130
|
+
};
|
|
131
|
+
usage: {
|
|
132
|
+
/** Task lifecycle and execution-time usage events, paged by task like tasks.list. */
|
|
133
|
+
events: (query?: OperationInput<"fleets_listUsageEvents">) => Promise<{
|
|
134
|
+
events: import("./index.js").components["schemas"]["Fleets.UsageEvent"][];
|
|
135
|
+
next_before: string | null;
|
|
136
|
+
}>;
|
|
137
|
+
};
|
|
138
|
+
tasks: {
|
|
139
|
+
list: (query?: OperationInput<"fleets_listTasks">) => Promise<{
|
|
140
|
+
tasks: import("./index.js").components["schemas"]["Fleets.Summary"][];
|
|
141
|
+
next_before: string | null;
|
|
142
|
+
}>;
|
|
143
|
+
submit: (body: TaskInput) => Promise<{
|
|
144
|
+
task_id: string;
|
|
145
|
+
status: import("./index.js").components["schemas"]["Fleets.Status"];
|
|
146
|
+
submitted_at: string;
|
|
147
|
+
started_at?: string | null;
|
|
148
|
+
completed_at?: string | null;
|
|
149
|
+
}>;
|
|
150
|
+
get: (task_id: string) => Promise<{
|
|
151
|
+
task_id: string;
|
|
152
|
+
status: import("./index.js").components["schemas"]["Fleets.Status"];
|
|
153
|
+
submitted_at: string;
|
|
154
|
+
started_at?: string | null;
|
|
155
|
+
completed_at?: string | null;
|
|
156
|
+
}>;
|
|
157
|
+
cancel: (task_id: string) => Promise<{
|
|
158
|
+
task_id: string;
|
|
159
|
+
status: import("./index.js").components["schemas"]["Fleets.Status"];
|
|
160
|
+
}>;
|
|
161
|
+
receipt: (task_id: string) => Promise<{
|
|
162
|
+
task_id: string;
|
|
163
|
+
status: import("./index.js").components["schemas"]["Fleets.Status"];
|
|
164
|
+
submitted_at: string;
|
|
165
|
+
started_at?: string | null;
|
|
166
|
+
completed_at?: string | null;
|
|
167
|
+
} & {
|
|
168
|
+
tenant: string;
|
|
169
|
+
principal: string;
|
|
170
|
+
idempotency_key: string | null;
|
|
171
|
+
request_fingerprint: string;
|
|
172
|
+
timeout_seconds: number;
|
|
173
|
+
exit_code: number | null;
|
|
174
|
+
exit_signal: number | null;
|
|
175
|
+
cleanup_result: {
|
|
176
|
+
process_group_gone?: boolean;
|
|
177
|
+
workdir_removed?: boolean;
|
|
178
|
+
sigkill_sent?: boolean;
|
|
179
|
+
} | null;
|
|
180
|
+
henry_receipt?: {
|
|
181
|
+
[key: string]: unknown;
|
|
182
|
+
};
|
|
183
|
+
}>;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
export {};
|
package/dist/fleets.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { GenesisError } from './errors.js';
|
|
2
|
+
const byteLength = (value) => new TextEncoder().encode(value).byteLength;
|
|
3
|
+
const invalid = (operationId, message) => new GenesisError({
|
|
4
|
+
status: 0, type: 'invalid_request', operationId, message,
|
|
5
|
+
});
|
|
6
|
+
function instanceOptions(operation, options) {
|
|
7
|
+
const key = options.idempotencyKey;
|
|
8
|
+
if (key !== undefined && (typeof key !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(key))) {
|
|
9
|
+
throw invalid(operation, 'Idempotency-Key must be one canonical UUID4.');
|
|
10
|
+
}
|
|
11
|
+
return { signal: options.signal, ...(key === undefined ? {} : { headers: { 'idempotency-key': key } }) };
|
|
12
|
+
}
|
|
13
|
+
function validateTask(body) {
|
|
14
|
+
if (typeof body?.input !== 'string' || !body.input || byteLength(body.input) > 65536 || body.input.includes('\0')) {
|
|
15
|
+
throw invalid('fleets_submitTask', 'Task input must contain 1–65536 UTF-8 bytes without NUL.');
|
|
16
|
+
}
|
|
17
|
+
if (body.timeout_seconds !== undefined && (!Number.isInteger(body.timeout_seconds) || body.timeout_seconds < 1 || body.timeout_seconds > 3600)) {
|
|
18
|
+
throw invalid('fleets_submitTask', 'Timeout must be 1–3600 seconds.');
|
|
19
|
+
}
|
|
20
|
+
if (body.idempotency_key !== undefined && (typeof body.idempotency_key !== 'string' || !/^[!-~]{1,128}$/.test(body.idempotency_key))) {
|
|
21
|
+
throw invalid('fleets_submitTask', 'Idempotency key must contain 1–128 visible ASCII characters.');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function validateKey(apiKey) {
|
|
25
|
+
if (typeof apiKey !== 'string' || !apiKey || byteLength(apiKey) > 4096 || /[\r\n\0]/.test(apiKey)) {
|
|
26
|
+
throw invalid('fleets_setConnection', 'Foundry key must contain 1–4096 UTF-8 bytes without CR, LF or NUL.');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const instanceId = (value, operation) => {
|
|
30
|
+
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)) {
|
|
31
|
+
throw invalid(operation, 'Invalid Fleets instance ID.');
|
|
32
|
+
}
|
|
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
|
+
}
|
|
64
|
+
/** Managed Henry instances and tasks scoped to the credential's verified org. */
|
|
65
|
+
export function fleetsModule(client) {
|
|
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
|
+
},
|
|
91
|
+
instances: {
|
|
92
|
+
list: async (query = {}) => {
|
|
93
|
+
if (query.limit !== undefined && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 50)) {
|
|
94
|
+
throw invalid('fleets_listInstances', 'Limit must be 1–50.');
|
|
95
|
+
}
|
|
96
|
+
if (query.after !== undefined)
|
|
97
|
+
instanceId(query.after, 'fleets_listInstances');
|
|
98
|
+
return client.request('fleets_listInstances', query);
|
|
99
|
+
},
|
|
100
|
+
get: async (instance_id) => {
|
|
101
|
+
instanceId(instance_id, 'fleets_getInstance');
|
|
102
|
+
return client.request('fleets_getInstance', { instance_id });
|
|
103
|
+
},
|
|
104
|
+
stop: async (instance_id, options = {}) => {
|
|
105
|
+
instanceId(instance_id, 'fleets_stopInstance');
|
|
106
|
+
return client.request('fleets_stopInstance', { instance_id }, instanceOptions('fleets_stopInstance', options));
|
|
107
|
+
},
|
|
108
|
+
start: async (instance_id, options = {}) => {
|
|
109
|
+
instanceId(instance_id, 'fleets_startInstance');
|
|
110
|
+
return client.request('fleets_startInstance', { instance_id }, instanceOptions('fleets_startInstance', options));
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
connection: {
|
|
114
|
+
get: () => client.request('fleets_getConnection', {}),
|
|
115
|
+
set: async (api_key) => {
|
|
116
|
+
validateKey(api_key);
|
|
117
|
+
return client.request('fleets_setConnection', { body: { api_key } });
|
|
118
|
+
},
|
|
119
|
+
delete: () => client.request('fleets_deleteConnection', {}),
|
|
120
|
+
},
|
|
121
|
+
usage: {
|
|
122
|
+
/** Task lifecycle and execution-time usage events, paged by task like tasks.list. */
|
|
123
|
+
events: (query = {}) => client.request('fleets_listUsageEvents', query),
|
|
124
|
+
},
|
|
125
|
+
tasks: {
|
|
126
|
+
list: (query = {}) => client.request('fleets_listTasks', query),
|
|
127
|
+
submit: async (body) => {
|
|
128
|
+
validateTask(body);
|
|
129
|
+
return client.request('fleets_submitTask', { body });
|
|
130
|
+
},
|
|
131
|
+
get: (task_id) => client.request('fleets_getTask', { task_id }),
|
|
132
|
+
cancel: (task_id) => client.request('fleets_cancelTask', { task_id }),
|
|
133
|
+
receipt: (task_id) => client.request('fleets_getTaskReceipt', { task_id }),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
package/dist/flocks.d.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
import type { OperationInput } from './types.js';
|
|
3
|
+
/** Org scope comes from the One account credential verified by the gateway. */
|
|
4
|
+
export declare function flocksModule(client: GenesisClient): {
|
|
5
|
+
readiness: {
|
|
6
|
+
get: () => Promise<{
|
|
7
|
+
node_enrollment_available: boolean;
|
|
8
|
+
reason_code?: "node_credential_issuer_unavailable";
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
nodes: {
|
|
12
|
+
list: () => Promise<{
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
nickname: string;
|
|
16
|
+
platform: string;
|
|
17
|
+
cpu_count: number;
|
|
18
|
+
state: "enrolled" | "revoked";
|
|
19
|
+
last_seen_at: number;
|
|
20
|
+
enrolled_at: number;
|
|
21
|
+
}[]>;
|
|
22
|
+
rename: (id: string, nickname: string) => Promise<{
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
nickname: string;
|
|
26
|
+
platform: string;
|
|
27
|
+
cpu_count: number;
|
|
28
|
+
state: "enrolled" | "revoked";
|
|
29
|
+
last_seen_at: number;
|
|
30
|
+
enrolled_at: number;
|
|
31
|
+
}>;
|
|
32
|
+
revoke: (id: string) => Promise<{
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
nickname: string;
|
|
36
|
+
platform: string;
|
|
37
|
+
cpu_count: number;
|
|
38
|
+
state: "enrolled" | "revoked";
|
|
39
|
+
last_seen_at: number;
|
|
40
|
+
enrolled_at: number;
|
|
41
|
+
}>;
|
|
42
|
+
heartbeat: (id: string, nodeBinding: string) => Promise<{
|
|
43
|
+
accepted: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
enroll: (body: OperationInput<"flocks_enrollNode">["body"]) => Promise<{
|
|
46
|
+
node: import("./index.js").components["schemas"]["Flocks.Node"];
|
|
47
|
+
node_binding: string;
|
|
48
|
+
heartbeat_interval_seconds: number;
|
|
49
|
+
}>;
|
|
50
|
+
activate: (id: string, body: OperationInput<"flocks_activateNode">["body"]) => Promise<{
|
|
51
|
+
node: import("./index.js").components["schemas"]["Flocks.Node"];
|
|
52
|
+
activated: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
rotateCredential: (id: string, body: OperationInput<"flocks_rotateNodeCredential">["body"]) => Promise<{
|
|
55
|
+
accepted: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
/** Harnesses each node reports, with version and readiness. */
|
|
59
|
+
harnesses: {
|
|
60
|
+
list: (query?: OperationInput<"flocks_listHarnesses">) => Promise<{
|
|
61
|
+
known_harnesses: string[];
|
|
62
|
+
items: import("./index.js").components["schemas"]["Flocks.NodeHarnesses"][];
|
|
63
|
+
next_cursor: string | null;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
/** Harness agents (pick a harness, optionally pin a node) and canonical agent execution (a_<ULID>, human session token). */
|
|
67
|
+
agents: {
|
|
68
|
+
list: (query?: OperationInput<"flocks_listAgents">) => Promise<{
|
|
69
|
+
items: import("./index.js").components["schemas"]["Flocks.Agent"][];
|
|
70
|
+
next_cursor: string | null;
|
|
71
|
+
}>;
|
|
72
|
+
create: (body: OperationInput<"flocks_createAgent">["body"]) => Promise<{
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
harness: string;
|
|
76
|
+
node_id: string | null;
|
|
77
|
+
owner_subject?: string;
|
|
78
|
+
created_at: number;
|
|
79
|
+
updated_at: number;
|
|
80
|
+
}>;
|
|
81
|
+
get: (agent_id: string) => Promise<{
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
harness: string;
|
|
85
|
+
node_id: string | null;
|
|
86
|
+
owner_subject?: string;
|
|
87
|
+
created_at: number;
|
|
88
|
+
updated_at: number;
|
|
89
|
+
}>;
|
|
90
|
+
execute: (agent_id: string, body: OperationInput<"flocks_executeAgent">["body"]) => Promise<{
|
|
91
|
+
schemaVersion: 1;
|
|
92
|
+
agentId: string;
|
|
93
|
+
canonicalAgentDid: string;
|
|
94
|
+
bindingRevision: string;
|
|
95
|
+
executionId: string;
|
|
96
|
+
revision: number;
|
|
97
|
+
outcome: "accepted" | "already_admitted";
|
|
98
|
+
}>;
|
|
99
|
+
status: (agent_id: string) => Promise<{
|
|
100
|
+
schemaVersion: 1;
|
|
101
|
+
agentId: string;
|
|
102
|
+
canonicalAgentDid: string;
|
|
103
|
+
bindingRevision: string;
|
|
104
|
+
executionId: string;
|
|
105
|
+
revision: number;
|
|
106
|
+
status: "working" | "success" | "error";
|
|
107
|
+
observedAtMs: number;
|
|
108
|
+
expiresAtMs: number;
|
|
109
|
+
}>;
|
|
110
|
+
cancel: (agent_id: string, idempotency_key: string) => Promise<{
|
|
111
|
+
schemaVersion: 1;
|
|
112
|
+
agentId: string;
|
|
113
|
+
canonicalAgentDid: string;
|
|
114
|
+
bindingRevision: string;
|
|
115
|
+
executionId: string;
|
|
116
|
+
revision: number;
|
|
117
|
+
outcome: "cancelled" | "already_terminal" | "cancel_requested";
|
|
118
|
+
observedAtMs: number;
|
|
119
|
+
expiresAtMs: number;
|
|
120
|
+
}>;
|
|
121
|
+
};
|
|
122
|
+
runs: {
|
|
123
|
+
list: (query?: OperationInput<"flocks_listRuns">) => Promise<{
|
|
124
|
+
items: import("./index.js").components["schemas"]["Flocks.Run"][];
|
|
125
|
+
next_cursor: string | null;
|
|
126
|
+
}>;
|
|
127
|
+
get: (run_id: string) => Promise<{
|
|
128
|
+
id: string;
|
|
129
|
+
agent_id: string;
|
|
130
|
+
harness: string;
|
|
131
|
+
node_id: string | null;
|
|
132
|
+
task: string;
|
|
133
|
+
state: "pending" | "running" | "completed" | "failed";
|
|
134
|
+
error_code: string | null;
|
|
135
|
+
owner_subject?: string;
|
|
136
|
+
created_at: number;
|
|
137
|
+
updated_at: number;
|
|
138
|
+
}>;
|
|
139
|
+
};
|
|
140
|
+
joinTokens: {
|
|
141
|
+
exchange: (body: OperationInput<"flocks_exchangeJoinToken">["body"]) => Promise<{
|
|
142
|
+
node_id: string;
|
|
143
|
+
organization_id: string;
|
|
144
|
+
credential_id: string;
|
|
145
|
+
credential_value: string;
|
|
146
|
+
scopes: "flocks:node"[];
|
|
147
|
+
expires_at: string;
|
|
148
|
+
node_nonce_hash?: string;
|
|
149
|
+
}>;
|
|
150
|
+
create: (ttlSeconds?: number) => Promise<{
|
|
151
|
+
token: string;
|
|
152
|
+
expires_at: number;
|
|
153
|
+
}>;
|
|
154
|
+
};
|
|
155
|
+
};
|
package/dist/flocks.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Org scope comes from the One account credential verified by the gateway. */
|
|
2
|
+
export function flocksModule(client) {
|
|
3
|
+
const nodePath = (id) => ({ id });
|
|
4
|
+
return {
|
|
5
|
+
readiness: {
|
|
6
|
+
get: () => client.request('flocks_getEnrollmentReadiness'),
|
|
7
|
+
},
|
|
8
|
+
nodes: {
|
|
9
|
+
list: () => client.request('flocks_listNodes'),
|
|
10
|
+
rename: (id, nickname) => client.request('flocks_renameNode', { ...nodePath(id), body: { nickname } }),
|
|
11
|
+
revoke: (id) => client.request('flocks_revokeNode', nodePath(id)),
|
|
12
|
+
heartbeat: (id, nodeBinding) => client.request('flocks_heartbeatNode', { ...nodePath(id), body: { node_binding: nodeBinding } }),
|
|
13
|
+
enroll: (body) => client.request('flocks_enrollNode', { body }),
|
|
14
|
+
activate: (id, body) => client.request('flocks_activateNode', { id, body }),
|
|
15
|
+
rotateCredential: (id, body) => client.request('flocks_rotateNodeCredential', { id, body }),
|
|
16
|
+
},
|
|
17
|
+
/** Harnesses each node reports, with version and readiness. */
|
|
18
|
+
harnesses: {
|
|
19
|
+
list: (query = {}) => client.request('flocks_listHarnesses', query),
|
|
20
|
+
},
|
|
21
|
+
/** Harness agents (pick a harness, optionally pin a node) and canonical agent execution (a_<ULID>, human session token). */
|
|
22
|
+
agents: {
|
|
23
|
+
list: (query = {}) => client.request('flocks_listAgents', query),
|
|
24
|
+
create: (body) => client.request('flocks_createAgent', { body }),
|
|
25
|
+
get: (agent_id) => client.request('flocks_getAgent', { agent_id }),
|
|
26
|
+
execute: (agent_id, body) => client.request('flocks_executeAgent', { agent_id, body }),
|
|
27
|
+
status: (agent_id) => client.request('flocks_getAgentStatus', { agent_id }),
|
|
28
|
+
cancel: (agent_id, idempotency_key) => client.request('flocks_cancelAgent', { agent_id, body: { idempotency_key } }),
|
|
29
|
+
},
|
|
30
|
+
runs: {
|
|
31
|
+
list: (query = {}) => client.request('flocks_listRuns', query),
|
|
32
|
+
get: (run_id) => client.request('flocks_getRun', { run_id }),
|
|
33
|
+
},
|
|
34
|
+
joinTokens: {
|
|
35
|
+
exchange: (body) => client.request('flocks_exchangeJoinToken', { body }),
|
|
36
|
+
create: (ttlSeconds = 600) => client.request('flocks_createJoinToken', { body: { ttl_seconds: ttlSeconds } }),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
export declare const foundryBillingOperations: readonly ["foundry_readBillingProfile", "foundry_ensureBillingProfile", "foundry_createNativeCreditCheckout", "foundry_readNativeCreditBalance"];
|
|
3
|
+
export declare const isFoundryBillingOperation: (id: string) => boolean;
|
|
4
|
+
/** One gateway dispatch, no redirect or automatic retry. Native billing always
|
|
5
|
+
* uses the caller's original human credential; customer/provider selectors are absent. */
|
|
6
|
+
export declare function foundryBillingTransport(options: {
|
|
7
|
+
operationId: string;
|
|
8
|
+
input: Record<string, unknown>;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
routing: string;
|
|
11
|
+
url: string;
|
|
12
|
+
credential: () => Promise<string | undefined>;
|
|
13
|
+
fetch: typeof fetch;
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}): Promise<Response>;
|
|
16
|
+
export declare function foundryBilling(client: GenesisClient): {
|
|
17
|
+
profile: (options?: {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
schemaVersion: 1;
|
|
21
|
+
status: "ready" | "pending" | "attention_required";
|
|
22
|
+
organizationId: string;
|
|
23
|
+
billingAccountId: string;
|
|
24
|
+
environmentId: "sandbox";
|
|
25
|
+
stripeAccountId: string;
|
|
26
|
+
stripeCustomerId: string | null;
|
|
27
|
+
livemode: false;
|
|
28
|
+
canEnsure: boolean;
|
|
29
|
+
} | {
|
|
30
|
+
foundry_account_id: string;
|
|
31
|
+
available_microdollars: number;
|
|
32
|
+
granted_microdollars: number;
|
|
33
|
+
reserved_microdollars: number;
|
|
34
|
+
reserved_overage_microdollars: number;
|
|
35
|
+
settlement_owner: "foundry";
|
|
36
|
+
launch_listed: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
ensureProfile: (operationKey: string, options?: {
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}) => Promise<{
|
|
41
|
+
schemaVersion: 1;
|
|
42
|
+
status: "ready" | "pending" | "attention_required";
|
|
43
|
+
organizationId: string;
|
|
44
|
+
billingAccountId: string;
|
|
45
|
+
environmentId: "sandbox";
|
|
46
|
+
stripeAccountId: string;
|
|
47
|
+
stripeCustomerId: string | null;
|
|
48
|
+
livemode: false;
|
|
49
|
+
canEnsure: boolean;
|
|
50
|
+
} | {
|
|
51
|
+
intent_id: string;
|
|
52
|
+
stripe_checkout_session_id: string;
|
|
53
|
+
checkout_url?: string;
|
|
54
|
+
status?: "paid" | "processing";
|
|
55
|
+
stripe_payment_intent_id?: string;
|
|
56
|
+
}>;
|
|
57
|
+
checkoutCredits: (purchaseKey: string, options?: {
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
}) => Promise<{
|
|
60
|
+
schemaVersion: 1;
|
|
61
|
+
status: "ready" | "pending" | "attention_required";
|
|
62
|
+
organizationId: string;
|
|
63
|
+
billingAccountId: string;
|
|
64
|
+
environmentId: "sandbox";
|
|
65
|
+
stripeAccountId: string;
|
|
66
|
+
stripeCustomerId: string | null;
|
|
67
|
+
livemode: false;
|
|
68
|
+
canEnsure: boolean;
|
|
69
|
+
} | {
|
|
70
|
+
intent_id: string;
|
|
71
|
+
stripe_checkout_session_id: string;
|
|
72
|
+
checkout_url?: string;
|
|
73
|
+
status?: "paid" | "processing";
|
|
74
|
+
stripe_payment_intent_id?: string;
|
|
75
|
+
}>;
|
|
76
|
+
creditBalance: (options?: {
|
|
77
|
+
signal?: AbortSignal;
|
|
78
|
+
}) => Promise<{
|
|
79
|
+
schemaVersion: 1;
|
|
80
|
+
status: "ready" | "pending" | "attention_required";
|
|
81
|
+
organizationId: string;
|
|
82
|
+
billingAccountId: string;
|
|
83
|
+
environmentId: "sandbox";
|
|
84
|
+
stripeAccountId: string;
|
|
85
|
+
stripeCustomerId: string | null;
|
|
86
|
+
livemode: false;
|
|
87
|
+
canEnsure: boolean;
|
|
88
|
+
} | {
|
|
89
|
+
foundry_account_id: string;
|
|
90
|
+
available_microdollars: number;
|
|
91
|
+
granted_microdollars: number;
|
|
92
|
+
reserved_microdollars: number;
|
|
93
|
+
reserved_overage_microdollars: number;
|
|
94
|
+
settlement_owner: "foundry";
|
|
95
|
+
launch_listed: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
};
|