@onesi/genesis 0.0.1-stage → 0.2.0

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 (113) hide show
  1. package/README.md +29 -0
  2. package/dist/auto.d.ts +1010 -0
  3. package/dist/auto.js +125 -0
  4. package/dist/beacons.d.ts +145 -0
  5. package/dist/beacons.js +148 -0
  6. package/dist/blinds-owner-enrollment.d.ts +280 -0
  7. package/dist/blinds-owner-enrollment.js +169 -0
  8. package/dist/client.d.ts +52 -0
  9. package/dist/client.js +384 -0
  10. package/dist/context.d.ts +50 -0
  11. package/dist/context.js +153 -0
  12. package/dist/dials.d.ts +299 -0
  13. package/dist/dials.js +100 -0
  14. package/dist/errors.d.ts +35 -0
  15. package/dist/errors.js +66 -0
  16. package/dist/flares.d.ts +202 -0
  17. package/dist/flares.js +61 -0
  18. package/dist/fleets.d.ts +218 -0
  19. package/dist/fleets.js +189 -0
  20. package/dist/flocks.d.ts +439 -0
  21. package/dist/flocks.js +98 -0
  22. package/dist/foundry-billing.d.ts +97 -0
  23. package/dist/foundry-billing.js +107 -0
  24. package/dist/foundry.d.ts +424 -0
  25. package/dist/foundry.js +133 -0
  26. package/dist/garden.d.ts +754 -0
  27. package/dist/garden.js +76 -0
  28. package/dist/gateway.d.ts +365 -0
  29. package/dist/gateway.js +82 -0
  30. package/dist/gears.d.ts +226 -0
  31. package/dist/gears.js +42 -0
  32. package/dist/generated/operations.d.ts +4 -0
  33. package/dist/generated/operations.js +65134 -0
  34. package/dist/generated/schema.d.ts +87658 -0
  35. package/dist/generated/schema.js +1 -0
  36. package/dist/genesis.d.ts +9574 -0
  37. package/dist/genesis.js +271 -0
  38. package/dist/genesis.openapi.json +128522 -0
  39. package/dist/henry.d.ts +369 -0
  40. package/dist/henry.js +268 -0
  41. package/dist/hives-cells.d.ts +127 -0
  42. package/dist/hives-cells.js +151 -0
  43. package/dist/hives-environment.d.ts +37 -0
  44. package/dist/hives-environment.js +80 -0
  45. package/dist/hives-functions.d.ts +36 -0
  46. package/dist/hives-functions.js +185 -0
  47. package/dist/hives-marketplace.d.ts +128 -0
  48. package/dist/hives-marketplace.js +187 -0
  49. package/dist/hives-node.d.ts +9 -0
  50. package/dist/hives-node.js +155 -0
  51. package/dist/hives-operations.d.ts +451 -0
  52. package/dist/hives-operations.js +43 -0
  53. package/dist/hives-platform.d.ts +149 -0
  54. package/dist/hives-platform.js +183 -0
  55. package/dist/hives-queue-consumer.d.ts +56 -0
  56. package/dist/hives-queue-consumer.js +95 -0
  57. package/dist/hives-queue-funding.d.ts +28 -0
  58. package/dist/hives-queue-funding.js +81 -0
  59. package/dist/hives-queues.d.ts +137 -0
  60. package/dist/hives-queues.js +143 -0
  61. package/dist/hives-resources-transport.d.ts +23 -0
  62. package/dist/hives-resources-transport.js +204 -0
  63. package/dist/hives-response.d.ts +2 -0
  64. package/dist/hives-response.js +32 -0
  65. package/dist/hives-runtimes.d.ts +34 -0
  66. package/dist/hives-runtimes.js +32 -0
  67. package/dist/hives-sse.d.ts +24 -0
  68. package/dist/hives-sse.js +111 -0
  69. package/dist/hives-topics.d.ts +51 -0
  70. package/dist/hives-topics.js +79 -0
  71. package/dist/hives-upload.d.ts +9 -0
  72. package/dist/hives-upload.js +23 -0
  73. package/dist/hives-volumes.d.ts +64 -0
  74. package/dist/hives-volumes.js +117 -0
  75. package/dist/iam-directory.d.ts +8 -0
  76. package/dist/iam-directory.js +23 -0
  77. package/dist/iam.d.ts +391 -0
  78. package/dist/iam.js +92 -0
  79. package/dist/idempotency.d.ts +7 -0
  80. package/dist/idempotency.js +39 -0
  81. package/dist/index.d.ts +47 -0
  82. package/dist/index.js +37 -0
  83. package/dist/instances.d.ts +200 -0
  84. package/dist/instances.js +43 -0
  85. package/dist/lanes.d.ts +267 -0
  86. package/dist/lanes.js +41 -0
  87. package/dist/minds-agent.d.ts +88 -0
  88. package/dist/minds-agent.js +233 -0
  89. package/dist/minds-engine.d.ts +394 -0
  90. package/dist/minds-engine.js +555 -0
  91. package/dist/minds-owner.d.ts +110 -0
  92. package/dist/minds-owner.js +226 -0
  93. package/dist/minds.d.ts +377 -0
  94. package/dist/minds.js +228 -0
  95. package/dist/orgs.d.ts +405 -0
  96. package/dist/orgs.js +63 -0
  97. package/dist/relays-enrollment.d.ts +33 -0
  98. package/dist/relays-enrollment.js +115 -0
  99. package/dist/runner-grant.d.ts +10 -0
  100. package/dist/runner-grant.js +133 -0
  101. package/dist/runner.d.ts +72 -0
  102. package/dist/runner.js +117 -0
  103. package/dist/scopes.d.ts +310 -0
  104. package/dist/scopes.js +40 -0
  105. package/dist/taps.d.ts +118 -0
  106. package/dist/taps.js +45 -0
  107. package/dist/traces.d.ts +574 -0
  108. package/dist/traces.js +97 -0
  109. package/dist/types.d.ts +98 -0
  110. package/dist/types.js +1 -0
  111. package/dist/urls.d.ts +6 -0
  112. package/dist/urls.js +31 -0
  113. package/package.json +49 -1
@@ -0,0 +1,202 @@
1
+ import type { GenesisClient } from './client.js';
2
+ import type { OperationInput as In } from './types.js';
3
+ /** Flares v2 (Sandbox): flares, conversations, commitments, presence, trust and choreography.
4
+ * Every mutation needs one stable idempotency key; reuse it to replay instead of acting twice. */
5
+ export declare function flaresModule(client: GenesisClient): {
6
+ list: (q?: In<"flares_listFlares">) => Promise<({
7
+ id?: string;
8
+ status?: string;
9
+ flareType?: string;
10
+ recipientId?: string;
11
+ recipientType?: string;
12
+ priority?: string;
13
+ channels?: string[];
14
+ createdAt?: string;
15
+ updatedAt?: string;
16
+ deliveryReceipts?: {
17
+ [key: string]: unknown;
18
+ };
19
+ } & {
20
+ [key: string]: unknown;
21
+ })[]>;
22
+ get: (id: string) => Promise<{
23
+ id?: string;
24
+ status?: string;
25
+ flareType?: string;
26
+ recipientId?: string;
27
+ recipientType?: string;
28
+ priority?: string;
29
+ channels?: string[];
30
+ createdAt?: string;
31
+ updatedAt?: string;
32
+ deliveryReceipts?: {
33
+ [key: string]: unknown;
34
+ };
35
+ } & {
36
+ [key: string]: unknown;
37
+ }>;
38
+ send: (body: In<"flares_sendFlare">["body"], key: string) => Promise<{
39
+ id?: string;
40
+ status?: string;
41
+ }>;
42
+ sendBatch: (body: In<"flares_sendFlareBatch">["body"], key: string) => Promise<{
43
+ results?: import("./index.js").components["schemas"]["Flares.SendFlareResponse"][];
44
+ }>;
45
+ acknowledge: (id: string, body: In<"flares_acknowledgeFlare">["body"], key: string) => Promise<{
46
+ [key: string]: unknown;
47
+ }>;
48
+ act: (id: string, body: In<"flares_actOnFlare">["body"], key: string) => Promise<{
49
+ [key: string]: unknown;
50
+ }>;
51
+ conversations: {
52
+ list: () => Promise<{
53
+ [key: string]: unknown;
54
+ }[]>;
55
+ get: (id: string) => Promise<{
56
+ [key: string]: unknown;
57
+ }>;
58
+ create: (body: In<"flares_createConversation">["body"], key: string) => Promise<{
59
+ [key: string]: unknown;
60
+ }>;
61
+ send: (id: string, body: In<"flares_sendConversationMessage">["body"], key: string) => Promise<{
62
+ [key: string]: unknown;
63
+ }>;
64
+ close: (id: string, key: string) => Promise<{
65
+ [key: string]: unknown;
66
+ }>;
67
+ };
68
+ commitments: {
69
+ list: () => Promise<{
70
+ [key: string]: unknown;
71
+ }[]>;
72
+ get: (id: string) => Promise<{
73
+ [key: string]: unknown;
74
+ }>;
75
+ create: (body: In<"flares_createCommitment">["body"], key: string) => Promise<{
76
+ [key: string]: unknown;
77
+ }>;
78
+ accept: (id: string, key: string) => Promise<{
79
+ [key: string]: unknown;
80
+ }>;
81
+ start: (id: string, key: string) => Promise<{
82
+ [key: string]: unknown;
83
+ }>;
84
+ progress: (id: string, body: In<"flares_reportCommitmentProgress">["body"], key: string) => Promise<{
85
+ [key: string]: unknown;
86
+ }>;
87
+ fulfill: (id: string, body: In<"flares_fulfillCommitment">["body"], key: string) => Promise<{
88
+ [key: string]: unknown;
89
+ }>;
90
+ fail: (id: string, body: In<"flares_failCommitment">["body"], key: string) => Promise<{
91
+ [key: string]: unknown;
92
+ }>;
93
+ };
94
+ presence: {
95
+ list: () => Promise<({
96
+ did?: string;
97
+ status?: string;
98
+ sessionId?: string;
99
+ sessionCount?: number;
100
+ lastSeenAt?: string;
101
+ } & {
102
+ [key: string]: unknown;
103
+ })[]>;
104
+ heartbeat: (body: In<"flares_presenceHeartbeat">["body"], key: string) => Promise<{
105
+ did?: string;
106
+ status?: string;
107
+ sessionId?: string;
108
+ sessionCount?: number;
109
+ lastSeenAt?: string;
110
+ } & {
111
+ [key: string]: unknown;
112
+ }>;
113
+ get: (did: string) => Promise<{
114
+ did?: string;
115
+ status?: string;
116
+ sessionId?: string;
117
+ sessionCount?: number;
118
+ lastSeenAt?: string;
119
+ } & {
120
+ [key: string]: unknown;
121
+ }>;
122
+ };
123
+ trust: {
124
+ list: () => Promise<({
125
+ did?: string;
126
+ score?: number;
127
+ confidence?: number;
128
+ dataPoints?: number;
129
+ computedAt?: string;
130
+ expiresAt?: string;
131
+ trustLevel?: string;
132
+ endorsementCount?: number;
133
+ } & {
134
+ [key: string]: unknown;
135
+ })[]>;
136
+ score: (did: string) => Promise<{
137
+ did?: string;
138
+ score?: number;
139
+ confidence?: number;
140
+ dataPoints?: number;
141
+ computedAt?: string;
142
+ expiresAt?: string;
143
+ trustLevel?: string;
144
+ endorsementCount?: number;
145
+ } & {
146
+ [key: string]: unknown;
147
+ }>;
148
+ check: (body: In<"flares_checkTrust">["body"], key: string) => Promise<{
149
+ [key: string]: unknown;
150
+ }>;
151
+ endorsements: (did: string) => Promise<{
152
+ [key: string]: unknown;
153
+ }[]>;
154
+ endorse: (body: In<"flares_createEndorsement">["body"], key: string) => Promise<{
155
+ [key: string]: unknown;
156
+ }>;
157
+ revoke: (id: string, key: string) => Promise<{
158
+ [key: string]: unknown;
159
+ }>;
160
+ };
161
+ activity: {
162
+ list: (q?: In<"flares_listActivity">) => Promise<({
163
+ id?: string;
164
+ at?: string;
165
+ action?: string;
166
+ resourceId?: string | null;
167
+ actor?: string;
168
+ } & {
169
+ [key: string]: unknown;
170
+ })[]>;
171
+ };
172
+ choreography: {
173
+ workflows: {
174
+ list: () => Promise<{
175
+ [key: string]: unknown;
176
+ }[]>;
177
+ create: (body: In<"flares_createChoreographyWorkflow">["body"], key: string) => Promise<{
178
+ [key: string]: unknown;
179
+ }>;
180
+ start: (workflow_id: string, key: string) => Promise<{
181
+ [key: string]: unknown;
182
+ }>;
183
+ };
184
+ executions: {
185
+ list: () => Promise<{
186
+ [key: string]: unknown;
187
+ }[]>;
188
+ get: (execution_id: string) => Promise<{
189
+ [key: string]: unknown;
190
+ }>;
191
+ completeStep: (execution_id: string, step_id: string, body: In<"flares_completeChoreographyStep">["body"], key: string) => Promise<{
192
+ [key: string]: unknown;
193
+ }>;
194
+ failStep: (execution_id: string, step_id: string, body: In<"flares_failChoreographyStep">["body"], key: string) => Promise<{
195
+ [key: string]: unknown;
196
+ }>;
197
+ cancel: (execution_id: string, key: string) => Promise<{
198
+ [key: string]: unknown;
199
+ }>;
200
+ };
201
+ };
202
+ };
package/dist/flares.js ADDED
@@ -0,0 +1,61 @@
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
+ list: () => client.request('flares_listPresence'),
32
+ heartbeat: (body, key) => write('flares_presenceHeartbeat', { body }, key),
33
+ get: (did) => client.request('flares_getPresence', { did }),
34
+ },
35
+ trust: {
36
+ list: () => client.request('flares_listTrust'),
37
+ score: (did) => client.request('flares_getTrustScore', { did }),
38
+ check: (body, key) => write('flares_checkTrust', { body }, key),
39
+ endorsements: (did) => client.request('flares_listEndorsements', { did }),
40
+ endorse: (body, key) => write('flares_createEndorsement', { body }, key),
41
+ revoke: (id, key) => write('flares_revokeEndorsement', { id }, key),
42
+ },
43
+ activity: {
44
+ list: (q = {}) => client.request('flares_listActivity', q),
45
+ },
46
+ choreography: {
47
+ workflows: {
48
+ list: () => client.request('flares_listChoreographyWorkflows'),
49
+ create: (body, key) => write('flares_createChoreographyWorkflow', { body }, key),
50
+ start: (workflow_id, key) => write('flares_startChoreographyExecution', { workflow_id }, key),
51
+ },
52
+ executions: {
53
+ list: () => client.request('flares_listChoreographyExecutions'),
54
+ get: (execution_id) => client.request('flares_getChoreographyExecution', { execution_id }),
55
+ completeStep: (execution_id, step_id, body, key) => write('flares_completeChoreographyStep', { execution_id, step_id, body }, key),
56
+ failStep: (execution_id, step_id, body, key) => write('flares_failChoreographyStep', { execution_id, step_id, body }, key),
57
+ cancel: (execution_id, key) => write('flares_cancelChoreographyExecution', { execution_id }, key),
58
+ },
59
+ },
60
+ };
61
+ }
@@ -0,0 +1,218 @@
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
+ type AgentUpdateInput = NonNullable<OperationInput<'fleets_updateAgent'>['body']>;
7
+ type AgentLogsQuery = Omit<OperationInput<'fleets_getAgentLogs'>, 'agent_id'>;
8
+ type TaskLogsQuery = Omit<OperationInput<'fleets_getTaskLogs'>, 'task_id'>;
9
+ export interface FleetsInstanceOptions {
10
+ idempotencyKey?: string;
11
+ signal?: AbortSignal;
12
+ }
13
+ /** Managed Henry instances and tasks scoped to the credential's verified org. */
14
+ export declare function fleetsModule(client: GenesisClient): {
15
+ agents: {
16
+ list: () => Promise<{
17
+ agents: import("./index.js").components["schemas"]["Fleets.Agent"][];
18
+ }>;
19
+ launch: (body: AgentLaunchInput) => Promise<{
20
+ id: string;
21
+ name: string;
22
+ state: "launching" | "running" | "stopping" | "stopped" | "recovering" | "recovery_required";
23
+ memory: import("./index.js").components["schemas"]["Fleets.Memory"];
24
+ model?: string | null;
25
+ inference: {
26
+ provider: "foundry";
27
+ mode: "managed";
28
+ };
29
+ created_at_ms: number;
30
+ updated_at_ms: number;
31
+ last_operation_id?: string | null;
32
+ }>;
33
+ get: (agent_id: string) => Promise<{
34
+ id: string;
35
+ name: string;
36
+ state: "launching" | "running" | "stopping" | "stopped" | "recovering" | "recovery_required";
37
+ memory: import("./index.js").components["schemas"]["Fleets.Memory"];
38
+ model?: string | null;
39
+ inference: {
40
+ provider: "foundry";
41
+ mode: "managed";
42
+ };
43
+ created_at_ms: number;
44
+ updated_at_ms: number;
45
+ last_operation_id?: string | null;
46
+ }>;
47
+ command: (agent_id: string, body: AgentCommandInput) => Promise<{
48
+ agent: import("./index.js").components["schemas"]["Fleets.Agent"];
49
+ operation_id: string;
50
+ result?: {
51
+ [key: string]: unknown;
52
+ };
53
+ }>;
54
+ stop: (agent_id: string) => Promise<{
55
+ agent: import("./index.js").components["schemas"]["Fleets.Agent"];
56
+ operation_id: string;
57
+ result?: {
58
+ [key: string]: unknown;
59
+ };
60
+ }>;
61
+ recover: (agent_id: string) => Promise<{
62
+ agent: import("./index.js").components["schemas"]["Fleets.Agent"];
63
+ operation_id: string;
64
+ result?: {
65
+ [key: string]: unknown;
66
+ };
67
+ }>;
68
+ /** Change name, model, instructions or memory. A memory change needs a stopped agent. */
69
+ update: (agent_id: string, body: AgentUpdateInput) => Promise<{
70
+ agent: import("./index.js").components["schemas"]["Fleets.Agent"];
71
+ operation_id: string;
72
+ result?: {
73
+ [key: string]: unknown;
74
+ };
75
+ }>;
76
+ /** Delete a stopped (or recovery_required) idle agent and its log. */
77
+ delete: (agent_id: string) => Promise<{
78
+ id: string;
79
+ deleted: true;
80
+ operation_id: string;
81
+ }>;
82
+ /** Operation log, oldest first; page with after = next_after. */
83
+ logs: (agent_id: string, query?: AgentLogsQuery) => Promise<{
84
+ agent_id: string;
85
+ state: "launching" | "running" | "stopping" | "stopped" | "recovering" | "recovery_required";
86
+ entries: import("./index.js").components["schemas"]["Fleets.AgentLogEntry"][];
87
+ next_after: number | null;
88
+ }>;
89
+ };
90
+ instances: {
91
+ list: (query?: OperationInput<"fleets_listInstances">) => Promise<{
92
+ instances: import("./index.js").components["schemas"]["Fleets.Instance"][];
93
+ next_cursor: string | null;
94
+ }>;
95
+ get: (instance_id: string) => Promise<{
96
+ id: string;
97
+ name: string;
98
+ organization_id: string;
99
+ workspace_id: string;
100
+ project_id: string;
101
+ admission_held: boolean | null;
102
+ physical_state: "created" | "running" | "held" | "stopped" | "recovery_required" | "released";
103
+ status_evidence: "live_controller" | "confirmed_release_receipt";
104
+ release_acknowledged_at_ms: number | null;
105
+ harness_ready: boolean;
106
+ observed_at_ms: number | null;
107
+ lease_expires: {
108
+ wall_ms: number;
109
+ logical: number;
110
+ } | null;
111
+ }>;
112
+ stop: (instance_id: string, options?: FleetsInstanceOptions) => Promise<{
113
+ id: string;
114
+ state: "released";
115
+ reaped: true;
116
+ data_retained: true;
117
+ status_evidence: "confirmed_release_receipt";
118
+ release_acknowledged_at_ms: number;
119
+ }>;
120
+ start: (instance_id: string, options?: FleetsInstanceOptions) => Promise<{
121
+ id: string;
122
+ name: string;
123
+ organization_id: string;
124
+ workspace_id: string;
125
+ project_id: string;
126
+ admission_held: boolean | null;
127
+ physical_state: "created" | "running" | "held" | "stopped" | "recovery_required" | "released";
128
+ status_evidence: "live_controller" | "confirmed_release_receipt";
129
+ release_acknowledged_at_ms: number | null;
130
+ harness_ready: boolean;
131
+ observed_at_ms: number | null;
132
+ lease_expires: {
133
+ wall_ms: number;
134
+ logical: number;
135
+ } | null;
136
+ }>;
137
+ };
138
+ connection: {
139
+ get: () => Promise<{
140
+ connected: boolean;
141
+ model: string;
142
+ updated_at?: number;
143
+ }>;
144
+ set: (api_key: string) => Promise<{
145
+ connected: boolean;
146
+ model: string;
147
+ updated_at?: number;
148
+ }>;
149
+ delete: () => Promise<{
150
+ connected: boolean;
151
+ model: string;
152
+ updated_at?: number;
153
+ }>;
154
+ };
155
+ usage: {
156
+ /** Task lifecycle and execution-time usage events, paged by task like tasks.list. */
157
+ events: (query?: OperationInput<"fleets_listUsageEvents">) => Promise<{
158
+ events: import("./index.js").components["schemas"]["Fleets.UsageEvent"][];
159
+ next_before: string | null;
160
+ }>;
161
+ };
162
+ tasks: {
163
+ list: (query?: OperationInput<"fleets_listTasks">) => Promise<{
164
+ tasks: import("./index.js").components["schemas"]["Fleets.Summary"][];
165
+ next_before: string | null;
166
+ }>;
167
+ submit: (body: TaskInput) => Promise<{
168
+ task_id: string;
169
+ status: import("./index.js").components["schemas"]["Fleets.Status"];
170
+ submitted_at: string;
171
+ started_at?: string | null;
172
+ completed_at?: string | null;
173
+ }>;
174
+ get: (task_id: string) => Promise<{
175
+ task_id: string;
176
+ status: import("./index.js").components["schemas"]["Fleets.Status"];
177
+ submitted_at: string;
178
+ started_at?: string | null;
179
+ completed_at?: string | null;
180
+ }>;
181
+ cancel: (task_id: string) => Promise<{
182
+ task_id: string;
183
+ status: import("./index.js").components["schemas"]["Fleets.Status"];
184
+ }>;
185
+ receipt: (task_id: string) => Promise<{
186
+ task_id: string;
187
+ status: import("./index.js").components["schemas"]["Fleets.Status"];
188
+ submitted_at: string;
189
+ started_at?: string | null;
190
+ completed_at?: string | null;
191
+ } & {
192
+ tenant: string;
193
+ principal: string;
194
+ idempotency_key: string | null;
195
+ request_fingerprint: string;
196
+ timeout_seconds: number;
197
+ exit_code: number | null;
198
+ exit_signal: number | null;
199
+ cleanup_result: {
200
+ process_group_gone?: boolean;
201
+ workdir_removed?: boolean;
202
+ sigkill_sent?: boolean;
203
+ } | null;
204
+ henry_receipt?: {
205
+ [key: string]: unknown;
206
+ };
207
+ }>;
208
+ /** Lifecycle and output log; poll with after = next_after until complete. */
209
+ logs: (task_id: string, query?: TaskLogsQuery) => Promise<{
210
+ task_id: string;
211
+ state: "pending" | "running" | "cancelling" | "completed" | "failed" | "cancelled" | "timed_out";
212
+ complete: boolean;
213
+ entries: import("./index.js").components["schemas"]["Fleets.TaskLogEntry"][];
214
+ next_after: number | null;
215
+ }>;
216
+ };
217
+ };
218
+ export {};
package/dist/fleets.js ADDED
@@ -0,0 +1,189 @@
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
+ validateMemory('fleets_launchAgent', body.memory);
50
+ if (body.idempotency_key !== undefined && (typeof body.idempotency_key !== 'string' || !/^[!-~]{1,128}$/.test(body.idempotency_key))) {
51
+ throw invalid('fleets_launchAgent', 'Idempotency key must contain 1–128 visible ASCII characters.');
52
+ }
53
+ }
54
+ function validateAgentCommand(body) {
55
+ if (!body || typeof body.input !== 'string' || !body.input.trim() || byteLength(body.input) > 65536 || body.input.includes('\0')) {
56
+ throw invalid('fleets_commandAgent', 'Agent input must contain 1–65536 UTF-8 bytes without NUL.');
57
+ }
58
+ }
59
+ function validateMemory(operation, memory) {
60
+ if (memory === undefined)
61
+ return;
62
+ if (!memory || !['minds', 'files', 'custom'].includes(memory.provider))
63
+ throw invalid(operation, 'Memory provider must be minds, files, or custom.');
64
+ if (memory.provider === 'custom' && !memory.endpoint)
65
+ throw invalid(operation, 'Custom memory requires an endpoint.');
66
+ }
67
+ function validateAgentUpdate(body) {
68
+ const op = 'fleets_updateAgent';
69
+ if (!body || typeof body !== 'object' || Array.isArray(body))
70
+ throw invalid(op, 'Provide at least one of name, model, instructions or memory.');
71
+ const keys = Object.keys(body);
72
+ if (!keys.length || keys.some(key => !['name', 'model', 'instructions', 'memory'].includes(key))) {
73
+ throw invalid(op, 'Provide at least one of name, model, instructions or memory.');
74
+ }
75
+ if (body.name !== undefined && (typeof body.name !== 'string' || !body.name.trim() || byteLength(body.name) > 128)) {
76
+ throw invalid(op, 'Agent name must contain 1–128 UTF-8 bytes.');
77
+ }
78
+ if (body.model !== undefined && body.model !== null && (typeof body.model !== 'string' || !body.model || byteLength(body.model) > 128)) {
79
+ throw invalid(op, 'Agent model must contain 1–128 UTF-8 bytes, or be null to clear it.');
80
+ }
81
+ if (body.instructions !== undefined && body.instructions !== null
82
+ && (typeof body.instructions !== 'string' || byteLength(body.instructions) > 65536 || body.instructions.includes('\0'))) {
83
+ throw invalid(op, 'Agent instructions must contain at most 65536 UTF-8 bytes without NUL, or be null to clear them.');
84
+ }
85
+ validateMemory(op, body.memory);
86
+ }
87
+ const cursor = (value, operation, max) => {
88
+ if (value !== undefined && (!Number.isSafeInteger(value) || value < 0 || value > max)) {
89
+ throw invalid(operation, 'after must be a non-negative integer cursor (next_after).');
90
+ }
91
+ };
92
+ /** Managed Henry instances and tasks scoped to the credential's verified org. */
93
+ export function fleetsModule(client) {
94
+ return {
95
+ agents: {
96
+ list: () => client.request('fleets_listAgents'),
97
+ launch: async (body) => {
98
+ validateAgentLaunch(body);
99
+ return client.request('fleets_launchAgent', { body });
100
+ },
101
+ get: async (agent_id) => {
102
+ agentId(agent_id, 'fleets_getAgent');
103
+ return client.request('fleets_getAgent', { agent_id });
104
+ },
105
+ command: async (agent_id, body) => {
106
+ agentId(agent_id, 'fleets_commandAgent');
107
+ validateAgentCommand(body);
108
+ return client.request('fleets_commandAgent', { agent_id, body });
109
+ },
110
+ stop: async (agent_id) => {
111
+ agentId(agent_id, 'fleets_stopAgent');
112
+ return client.request('fleets_stopAgent', { agent_id });
113
+ },
114
+ recover: async (agent_id) => {
115
+ agentId(agent_id, 'fleets_recoverAgent');
116
+ return client.request('fleets_recoverAgent', { agent_id });
117
+ },
118
+ /** Change name, model, instructions or memory. A memory change needs a stopped agent. */
119
+ update: async (agent_id, body) => {
120
+ agentId(agent_id, 'fleets_updateAgent');
121
+ validateAgentUpdate(body);
122
+ return client.request('fleets_updateAgent', { agent_id, body });
123
+ },
124
+ /** Delete a stopped (or recovery_required) idle agent and its log. */
125
+ delete: async (agent_id) => {
126
+ agentId(agent_id, 'fleets_deleteAgent');
127
+ return client.request('fleets_deleteAgent', { agent_id });
128
+ },
129
+ /** Operation log, oldest first; page with after = next_after. */
130
+ logs: async (agent_id, query = {}) => {
131
+ agentId(agent_id, 'fleets_getAgentLogs');
132
+ cursor(query.after, 'fleets_getAgentLogs', Number.MAX_SAFE_INTEGER);
133
+ if (query.limit !== undefined && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 200)) {
134
+ throw invalid('fleets_getAgentLogs', 'Limit must be 1–200.');
135
+ }
136
+ return client.request('fleets_getAgentLogs', { agent_id, ...query });
137
+ },
138
+ },
139
+ instances: {
140
+ list: async (query = {}) => {
141
+ if (query.limit !== undefined && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 50)) {
142
+ throw invalid('fleets_listInstances', 'Limit must be 1–50.');
143
+ }
144
+ if (query.after !== undefined)
145
+ instanceId(query.after, 'fleets_listInstances');
146
+ return client.request('fleets_listInstances', query);
147
+ },
148
+ get: async (instance_id) => {
149
+ instanceId(instance_id, 'fleets_getInstance');
150
+ return client.request('fleets_getInstance', { instance_id });
151
+ },
152
+ stop: async (instance_id, options = {}) => {
153
+ instanceId(instance_id, 'fleets_stopInstance');
154
+ return client.request('fleets_stopInstance', { instance_id }, instanceOptions('fleets_stopInstance', options));
155
+ },
156
+ start: async (instance_id, options = {}) => {
157
+ instanceId(instance_id, 'fleets_startInstance');
158
+ return client.request('fleets_startInstance', { instance_id }, instanceOptions('fleets_startInstance', options));
159
+ },
160
+ },
161
+ connection: {
162
+ get: () => client.request('fleets_getConnection', {}),
163
+ set: async (api_key) => {
164
+ validateKey(api_key);
165
+ return client.request('fleets_setConnection', { body: { api_key } });
166
+ },
167
+ delete: () => client.request('fleets_deleteConnection', {}),
168
+ },
169
+ usage: {
170
+ /** Task lifecycle and execution-time usage events, paged by task like tasks.list. */
171
+ events: (query = {}) => client.request('fleets_listUsageEvents', query),
172
+ },
173
+ tasks: {
174
+ list: (query = {}) => client.request('fleets_listTasks', query),
175
+ submit: async (body) => {
176
+ validateTask(body);
177
+ return client.request('fleets_submitTask', { body });
178
+ },
179
+ get: (task_id) => client.request('fleets_getTask', { task_id }),
180
+ cancel: (task_id) => client.request('fleets_cancelTask', { task_id }),
181
+ receipt: (task_id) => client.request('fleets_getTaskReceipt', { task_id }),
182
+ /** Lifecycle and output log; poll with after = next_after until complete. */
183
+ logs: async (task_id, query = {}) => {
184
+ cursor(query.after, 'fleets_getTaskLogs', 4294967295);
185
+ return client.request('fleets_getTaskLogs', { task_id, ...query });
186
+ },
187
+ },
188
+ };
189
+ }