@okrlinkhub/fly-agents 0.1.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 (63) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +229 -0
  3. package/dist/client/_generated/_ignore.d.ts +1 -0
  4. package/dist/client/_generated/_ignore.d.ts.map +1 -0
  5. package/dist/client/_generated/_ignore.js +3 -0
  6. package/dist/client/_generated/_ignore.js.map +1 -0
  7. package/dist/client/index.d.ts +164 -0
  8. package/dist/client/index.d.ts.map +1 -0
  9. package/dist/client/index.js +188 -0
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/component/_generated/api.d.ts +36 -0
  12. package/dist/component/_generated/api.d.ts.map +1 -0
  13. package/dist/component/_generated/api.js +31 -0
  14. package/dist/component/_generated/api.js.map +1 -0
  15. package/dist/component/_generated/component.d.ts +159 -0
  16. package/dist/component/_generated/component.d.ts.map +1 -0
  17. package/dist/component/_generated/component.js +11 -0
  18. package/dist/component/_generated/component.js.map +1 -0
  19. package/dist/component/_generated/dataModel.d.ts +46 -0
  20. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  21. package/dist/component/_generated/dataModel.js +11 -0
  22. package/dist/component/_generated/dataModel.js.map +1 -0
  23. package/dist/component/_generated/server.d.ts +121 -0
  24. package/dist/component/_generated/server.d.ts.map +1 -0
  25. package/dist/component/_generated/server.js +78 -0
  26. package/dist/component/_generated/server.js.map +1 -0
  27. package/dist/component/convex.config.d.ts +3 -0
  28. package/dist/component/convex.config.d.ts.map +1 -0
  29. package/dist/component/convex.config.js +3 -0
  30. package/dist/component/convex.config.js.map +1 -0
  31. package/dist/component/lib.d.ts +136 -0
  32. package/dist/component/lib.d.ts.map +1 -0
  33. package/dist/component/lib.js +607 -0
  34. package/dist/component/lib.js.map +1 -0
  35. package/dist/component/schema.d.ts +109 -0
  36. package/dist/component/schema.d.ts.map +1 -0
  37. package/dist/component/schema.js +52 -0
  38. package/dist/component/schema.js.map +1 -0
  39. package/dist/component/storage.d.ts +161 -0
  40. package/dist/component/storage.d.ts.map +1 -0
  41. package/dist/component/storage.js +178 -0
  42. package/dist/component/storage.js.map +1 -0
  43. package/dist/react/index.d.ts +2 -0
  44. package/dist/react/index.d.ts.map +1 -0
  45. package/dist/react/index.js +6 -0
  46. package/dist/react/index.js.map +1 -0
  47. package/package.json +105 -0
  48. package/src/client/_generated/_ignore.ts +1 -0
  49. package/src/client/index.test.ts +34 -0
  50. package/src/client/index.ts +214 -0
  51. package/src/client/setup.test.ts +26 -0
  52. package/src/component/_generated/api.ts +52 -0
  53. package/src/component/_generated/component.ts +200 -0
  54. package/src/component/_generated/dataModel.ts +60 -0
  55. package/src/component/_generated/server.ts +156 -0
  56. package/src/component/convex.config.ts +3 -0
  57. package/src/component/lib.test.ts +79 -0
  58. package/src/component/lib.ts +704 -0
  59. package/src/component/schema.ts +61 -0
  60. package/src/component/setup.test.ts +11 -0
  61. package/src/component/storage.ts +213 -0
  62. package/src/react/index.ts +7 -0
  63. package/src/test.ts +18 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,229 @@
1
+ # Convex Fly Agents
2
+
3
+ [![npm version](https://badge.fury.io/js/@okrlinkhub%2Ffly-agents.svg)](https://badge.fury.io/js/@okrlinkhub%2Ffly-agents)
4
+
5
+ `@okrlinkhub/fly-agents` is a Convex component for provisioning and managing
6
+ Fly.io machines dedicated to OpenClaw agents.
7
+
8
+ The component is focused on:
9
+
10
+ - machine lifecycle (`provision`, `start`, `stop`, `deprovision`);
11
+ - metadata and status tracking in Convex;
12
+ - propagation of runtime environment (bridge URL, service credentials, skill
13
+ whitelist).
14
+
15
+ Required runtime values for OpenClaw provisioning:
16
+
17
+ - `LLM_MODEL` (must not be `gpt-5-mini`)
18
+ - `LLM_API_KEY`
19
+ - `TELEGRAM_BOT_TOKEN`
20
+ - `AGENT_BRIDGE_URL`
21
+ - `ALLOWED_SKILLS_JSON`
22
+ - `OPENCLAW_APP_KEY`
23
+ - `TENANT_ID`
24
+ - `USER_ID`
25
+ - `OPENCLAW_SERVICE_ID`
26
+ - `OPENCLAW_SERVICE_KEY`
27
+ - `OPENCLAW_GATEWAY_TOKEN`
28
+
29
+ ## Installation
30
+
31
+ ```sh
32
+ npm install @okrlinkhub/fly-agents
33
+ ```
34
+
35
+ Enable the component in `convex/convex.config.ts`:
36
+
37
+ ```ts
38
+ import { defineApp } from "convex/server";
39
+ import flyAgents from "@okrlinkhub/fly-agents/convex.config.js";
40
+
41
+ const app = defineApp();
42
+ app.use(flyAgents);
43
+
44
+ export default app;
45
+ ```
46
+
47
+ ## API Surface
48
+
49
+ Main component functions (`components.flyAgents.lib.*`):
50
+
51
+ - `provisionAgentMachine`
52
+ - `recreateAgentFromLatestSnapshot`
53
+ - `startAgentMachine`
54
+ - `stopAgentMachine`
55
+ - `deprovisionAgentMachine`
56
+ - `touchAgentActivity`
57
+ - `createAgentSnapshot`
58
+ - `sweepIdleAgentsAndSnapshot`
59
+ - `listAgentMachinesByTenant`
60
+ - `getAgentMachine`
61
+ - `updateAllowedSkills`
62
+
63
+ ## Example
64
+
65
+ ```ts
66
+ import { action } from "./_generated/server";
67
+ import { components } from "./_generated/api";
68
+ import { v } from "convex/values";
69
+
70
+ export const provision = action({
71
+ args: {
72
+ userId: v.string(),
73
+ tenantId: v.string(),
74
+ flyApiToken: v.string(),
75
+ flyAppName: v.string(),
76
+ llmModel: v.string(),
77
+ llmApiKey: v.string(),
78
+ telegramBotToken: v.string(),
79
+ bridgeUrl: v.string(),
80
+ allowedSkillsJson: v.string(),
81
+ appKey: v.string(),
82
+ serviceId: v.string(),
83
+ serviceKey: v.string(),
84
+ openclawGatewayToken: v.string(),
85
+ },
86
+ handler: async (ctx, args) => {
87
+ return await ctx.runAction(components.flyAgents.lib.provisionAgentMachine, args);
88
+ },
89
+ });
90
+ ```
91
+
92
+ See more example usage in [example.ts](./example/convex/example.ts).
93
+
94
+ ## Post-Provisioning Steps (Telegram + Model)
95
+
96
+ After provisioning a new machine, run these operational steps before handing the
97
+ service to the end user.
98
+
99
+ ### 1) Approve Telegram pairing code
100
+
101
+ When the user sends a Telegram pairing code, approve it on the target machine:
102
+
103
+ ```sh
104
+ fly ssh console -a "<fly-app-name>" --machine "<machine-id>" -C "sh -lc 'cd /app && node ./openclaw.mjs pairing approve telegram <PAIRING_CODE>'"
105
+ ```
106
+
107
+ Notes:
108
+
109
+ - Use `node ./openclaw.mjs ...` (the `openclaw` binary may not be in `PATH`).
110
+ - Replace `<PAIRING_CODE>` with the code received from the user.
111
+ - Run this command as a single-shot operation only (no parallel retries).
112
+
113
+ ### Pairing safe flow (anti-concurrency)
114
+
115
+ To avoid gateway instability caused by concurrent pairing commands:
116
+
117
+ 1. Run exactly one pairing command per machine at a time.
118
+ 2. If a pairing command appears stuck, do not launch another one; restart the
119
+ machine first.
120
+ 3. Re-run a single pairing command only after the gateway is healthy again.
121
+
122
+ Quick checks:
123
+
124
+ ```sh
125
+ # Gateway actually listening
126
+ fly logs -a "<fly-app-name>" --machine "<machine-id>" --no-tail
127
+
128
+ # Should include: [gateway] listening on ws://0.0.0.0:3000
129
+ ```
130
+
131
+ ### 2) Force the configured model on OpenClaw
132
+
133
+ With the current OpenClaw image, `LLM_MODEL` can be present in machine env but
134
+ the runtime may keep using a previously persisted default model. Force the model
135
+ right after provisioning:
136
+
137
+ ```sh
138
+ fly ssh console -a "<fly-app-name>" --machine "<machine-id>" -C "sh -lc 'cd /app && node ./openclaw.mjs models set <LLM_MODEL>'"
139
+ ```
140
+
141
+ Recommended model id format includes provider prefix, for example:
142
+
143
+ - `moonshotai/kimi-k2.5`
144
+
145
+ ### 3) Verify effective model
146
+
147
+ ```sh
148
+ fly ssh console -a "<fly-app-name>" --machine "<machine-id>" -C "sh -lc 'cd /app && node ./openclaw.mjs models status --plain'"
149
+ ```
150
+
151
+ ### Gateway startup note (image behavior)
152
+
153
+ If a new machine stays in `started` state but no `[gateway] listening ...` line
154
+ appears in logs, rebuild and deploy an image where `entrypoint.sh` does not force
155
+ `--dev` by default for `gateway run`.
156
+
157
+ - Default recommended: production startup without `--dev`.
158
+ - Optional dev mode: set `OPENCLAW_GATEWAY_DEV_MODE=true` only when needed.
159
+
160
+ Current hardened image behavior:
161
+
162
+ - Cleans `/tmp/openclaw` and `/tmp/openclaw-*` at each boot.
163
+ - Applies readiness watchdog on gateway startup.
164
+ - Fails fast if gateway does not bind in time (`OPENCLAW_STARTUP_TIMEOUT_SEC`,
165
+ default `240`), so Fly restart policy can recover automatically.
166
+ - Uses TCP readiness checks with `grace_period=240s` to reduce false positives
167
+ (`VM started` while gateway is still booting).
168
+
169
+ ## Idle Backup + Recreate flow
170
+
171
+ To reduce active-machine costs while preserving state, the component supports:
172
+
173
+ 1. heartbeat activity update (`touchAgentActivity`);
174
+ 2. idle sweep after 30m (`sweepIdleAgentsAndSnapshot`);
175
+ 3. snapshot metadata persisted in Convex (`agentSnapshots`);
176
+ 4. recreate from latest snapshot (`recreateAgentFromLatestSnapshot`).
177
+
178
+ ### Recommended operational sequence
179
+
180
+ ```sh
181
+ # 1) Update activity when agent receives traffic
182
+ components.flyAgents.lib.touchAgentActivity
183
+
184
+ # 2) Run periodic sweeper (every 5 minutes)
185
+ components.flyAgents.lib.sweepIdleAgentsAndSnapshot
186
+
187
+ # 3) When same agent returns, recreate from latest snapshot
188
+ components.flyAgents.lib.recreateAgentFromLatestSnapshot
189
+ ```
190
+
191
+ ### Idle sweep defaults
192
+
193
+ - inactivity threshold: `30` minutes (configurable per call via `idleMinutes`);
194
+ - pre-stop backup: `openclaw-state-plus-manifest`;
195
+ - safe rollout option: `dryRun=true` to inspect candidates without stopping.
196
+
197
+ ### Gateway auth requirement (critical)
198
+
199
+ When binding gateway on `lan`, `OPENCLAW_GATEWAY_TOKEN` must be set on the
200
+ machine. If missing/empty, OpenClaw refuses to bind and the machine can look
201
+ "healthy" on Fly while the gateway is not actually serving traffic.
202
+
203
+ Expected failure logs when token is missing:
204
+
205
+ - `Refusing to bind gateway to lan without auth.`
206
+ - `Set gateway.auth.token/password (or OPENCLAW_GATEWAY_TOKEN/OPENCLAW_GATEWAY_PASSWORD) ...`
207
+
208
+ Quick fix:
209
+
210
+ ```sh
211
+ fly machine update "<machine-id>" -a "<fly-app-name>" -e OPENCLAW_GATEWAY_TOKEN="<token>" --yes
212
+ ```
213
+
214
+ ### Version compatibility note
215
+
216
+ If logs show:
217
+
218
+ - `Config was last written by a newer OpenClaw (...)`
219
+
220
+ the runtime image version is older than the config/state writer and startup can
221
+ be unstable. Prefer running machines with a consistent OpenClaw version across
222
+ restarts and rebuilds.
223
+
224
+ ## Local Development
225
+
226
+ ```sh
227
+ npm i
228
+ npm run dev
229
+ ```
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=_ignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_ignore.d.ts","sourceRoot":"","sources":["../../../src/client/_generated/_ignore.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This is only here so convex-test can detect a _generated folder
3
+ //# sourceMappingURL=_ignore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_ignore.js","sourceRoot":"","sources":["../../../src/client/_generated/_ignore.ts"],"names":[],"mappings":";AAAA,kEAAkE"}
@@ -0,0 +1,164 @@
1
+ import type { Auth } from "convex/server";
2
+ import type { ComponentApi } from "../component/_generated/component.js";
3
+ export declare function exposeApi(component: ComponentApi, options: {
4
+ auth: (ctx: {
5
+ auth: Auth;
6
+ }, operation: {
7
+ type: "list";
8
+ tenantId: string;
9
+ } | {
10
+ type: "get";
11
+ machineDocId: string;
12
+ } | {
13
+ type: "updateSkills";
14
+ machineDocId: string;
15
+ } | {
16
+ type: "provision";
17
+ tenantId: string;
18
+ } | {
19
+ type: "recreate";
20
+ tenantId: string;
21
+ } | {
22
+ type: "start";
23
+ machineDocId: string;
24
+ } | {
25
+ type: "stop";
26
+ machineDocId: string;
27
+ } | {
28
+ type: "deprovision";
29
+ machineDocId: string;
30
+ } | {
31
+ type: "touchActivity";
32
+ machineDocId: string;
33
+ } | {
34
+ type: "snapshot";
35
+ machineDocId: string;
36
+ } | {
37
+ type: "sweep";
38
+ }) => Promise<string>;
39
+ }): {
40
+ listAgentMachinesByTenant: import("convex/server").RegisteredQuery<"public", {
41
+ tenantId: string;
42
+ }, Promise<{
43
+ _creationTime: number;
44
+ _id: string;
45
+ allowedSkills: Array<string>;
46
+ appKey: string;
47
+ bridgeUrl: string;
48
+ flyVolumeId?: string;
49
+ lastActivityAt?: number;
50
+ lastError?: string;
51
+ lastWakeAt?: number;
52
+ latestSnapshotId?: string;
53
+ lifecycleMode?: "running" | "hibernated";
54
+ machineId?: string;
55
+ memoryMB: number;
56
+ region: string;
57
+ serviceId: string;
58
+ serviceKey: string;
59
+ status: "provisioning" | "running" | "stopped" | "hibernated" | "error" | "deleted";
60
+ tenantId: string;
61
+ userId: string;
62
+ }[]>>;
63
+ getAgentMachine: import("convex/server").RegisteredQuery<"public", {
64
+ machineDocId: string;
65
+ }, Promise<{
66
+ _creationTime: number;
67
+ _id: string;
68
+ allowedSkills: Array<string>;
69
+ appKey: string;
70
+ bridgeUrl: string;
71
+ flyVolumeId?: string;
72
+ lastActivityAt?: number;
73
+ lastError?: string;
74
+ lastWakeAt?: number;
75
+ latestSnapshotId?: string;
76
+ lifecycleMode?: "running" | "hibernated";
77
+ machineId?: string;
78
+ memoryMB: number;
79
+ region: string;
80
+ serviceId: string;
81
+ serviceKey: string;
82
+ status: "provisioning" | "running" | "stopped" | "hibernated" | "error" | "deleted";
83
+ tenantId: string;
84
+ userId: string;
85
+ } | null>>;
86
+ updateAllowedSkills: import("convex/server").RegisteredMutation<"public", {
87
+ machineDocId: string;
88
+ allowedSkills: string[];
89
+ }, Promise<null>>;
90
+ touchAgentActivity: import("convex/server").RegisteredMutation<"public", {
91
+ machineDocId: string;
92
+ }, Promise<any>>;
93
+ provisionAgentMachine: import("convex/server").RegisteredAction<"public", {
94
+ allowedSkills?: string[] | undefined;
95
+ allowedSkillsJson?: string | undefined;
96
+ appKey?: string | undefined;
97
+ bridgeUrl?: string | undefined;
98
+ image?: string | undefined;
99
+ llmApiKey?: string | undefined;
100
+ llmModel?: string | undefined;
101
+ memoryMB?: number | undefined;
102
+ region?: string | undefined;
103
+ restoreFromLatestSnapshot?: boolean | undefined;
104
+ serviceId?: string | undefined;
105
+ serviceKey?: string | undefined;
106
+ telegramBotToken?: string | undefined;
107
+ flyApiToken: string;
108
+ flyAppName: string;
109
+ tenantId: string;
110
+ openclawGatewayToken: string;
111
+ userId: string;
112
+ }, Promise<{
113
+ machineDocId: string;
114
+ machineId: string;
115
+ volumeId: string;
116
+ }>>;
117
+ recreateAgentFromLatestSnapshot: import("convex/server").RegisteredAction<"public", {
118
+ allowedSkills?: string[] | undefined;
119
+ allowedSkillsJson?: string | undefined;
120
+ appKey?: string | undefined;
121
+ bridgeUrl?: string | undefined;
122
+ image?: string | undefined;
123
+ llmApiKey?: string | undefined;
124
+ llmModel?: string | undefined;
125
+ memoryMB?: number | undefined;
126
+ region?: string | undefined;
127
+ serviceId?: string | undefined;
128
+ serviceKey?: string | undefined;
129
+ telegramBotToken?: string | undefined;
130
+ flyApiToken: string;
131
+ flyAppName: string;
132
+ tenantId: string;
133
+ openclawGatewayToken: string;
134
+ userId: string;
135
+ }, Promise<any>>;
136
+ createAgentSnapshot: import("convex/server").RegisteredAction<"public", {
137
+ flyApiToken: string;
138
+ flyAppName: string;
139
+ machineDocId: string;
140
+ }, Promise<any>>;
141
+ sweepIdleAgentsAndSnapshot: import("convex/server").RegisteredAction<"public", {
142
+ dryRun?: boolean | undefined;
143
+ idleMinutes?: number | undefined;
144
+ limit?: number | undefined;
145
+ flyApiToken: string;
146
+ flyAppName: string;
147
+ }, Promise<any>>;
148
+ startAgentMachine: import("convex/server").RegisteredAction<"public", {
149
+ flyApiToken: string;
150
+ flyAppName: string;
151
+ machineDocId: string;
152
+ }, Promise<null>>;
153
+ stopAgentMachine: import("convex/server").RegisteredAction<"public", {
154
+ flyApiToken: string;
155
+ flyAppName: string;
156
+ machineDocId: string;
157
+ }, Promise<null>>;
158
+ deprovisionAgentMachine: import("convex/server").RegisteredAction<"public", {
159
+ flyApiToken: string;
160
+ flyAppName: string;
161
+ machineDocId: string;
162
+ }, Promise<null>>;
163
+ };
164
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE,wBAAgB,SAAS,CACvB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE;IACP,IAAI,EAAE,CACJ,GAAG,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,EACnB,SAAS,EACL;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAClC;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GACrC;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAC9C;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GACvC;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GACtC;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GACvC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GACtC;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAC7C;QAAE,IAAI,EAAE,eAAe,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAC/C;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAC1C;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAClB,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyLF"}