@rine-network/eve 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.
package/LICENSE ADDED
@@ -0,0 +1,291 @@
1
+ EUROPEAN UNION PUBLIC LICENCE v. 1.2
2
+ EUPL (c) the European Union 2007, 2016
3
+
4
+ This European Union Public Licence (the 'EUPL') applies to the Work (as
5
+ defined below) which is provided under the terms of this Licence. Any use of
6
+ the Work, other than as authorised under this Licence is prohibited (to the
7
+ extent such use is covered by a right of the copyright holder of the Work).
8
+
9
+ The Work is provided under the terms of this Licence when the Licensor (as
10
+ defined below) has placed the following notice immediately following the
11
+ copyright notice for the Work:
12
+
13
+ Licensed under the EUPL
14
+
15
+ or has expressed by any other means his willingness to license under the EUPL.
16
+
17
+ 1. Definitions
18
+
19
+ In this Licence, the following terms have the following meaning:
20
+
21
+ - 'The Licence': this Licence.
22
+
23
+ - 'The Original Work': the work or software distributed or communicated by the
24
+ Licensor under this Licence, available as Source Code and also as Executable
25
+ Code as the case may be.
26
+
27
+ - 'Derivative Works': the works or software that could be created by the
28
+ Licensee, based upon the Original Work or modifications thereof. This
29
+ Licence does not define the extent of modification or dependence on the
30
+ Original Work required in order to classify a work as a Derivative Work;
31
+ this extent is determined by copyright law applicable in the country
32
+ mentioned in Article 15.
33
+
34
+ - 'The Work': the Original Work or its Derivative Works.
35
+
36
+ - 'The Source Code': the human-readable form of the Work which is the most
37
+ convenient for people to study and modify.
38
+
39
+ - 'The Executable Code': any code which has generally been compiled and which
40
+ is meant to be interpreted by a computer as a program.
41
+
42
+ - 'The Licensor': the natural or legal person that distributes or communicates
43
+ the Work under the Licence.
44
+
45
+ - 'Contributor(s)': any natural or legal person who modifies the Work under
46
+ the Licence, or otherwise contributes to the creation of a Derivative Work.
47
+
48
+ - 'The Licensee' or 'You': any natural or legal person who makes any usage of
49
+ the Work under the terms of the Licence.
50
+
51
+ - 'Distribution' or 'Communication': any act of selling, giving, lending,
52
+ renting, distributing, communicating, transmitting, or otherwise making
53
+ available, online or offline, copies of the Work or providing access to its
54
+ essential functionalities at the disposal of any other natural or legal
55
+ person.
56
+
57
+ 2. Scope of the rights granted by the Licence
58
+
59
+ The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
60
+ sublicensable licence to do the following, for the duration of copyright vested
61
+ in the Original Work:
62
+
63
+ - use the Work in any circumstance and for all usage,
64
+ - reproduce the Work,
65
+ - modify the Work, and make Derivative Works based upon the Work,
66
+ - communicate to the public, including the right to make available or display
67
+ the Work or copies thereof to the public and perform publicly, as the case
68
+ may be, the Work,
69
+ - distribute the Work or copies thereof,
70
+ - lend and rent the Work or copies thereof,
71
+ - sublicense rights in the Work or copies thereof.
72
+
73
+ Those rights can be exercised on any media, supports and formats, whether now
74
+ known or later invented, as far as the applicable law permits so.
75
+
76
+ In the countries where moral rights apply, the Licensor waives his right to
77
+ exercise his moral right to the extent allowed by law in order to make
78
+ effective the licence of the economic rights here above listed.
79
+
80
+ The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to
81
+ any patents held by the Licensor, to the extent necessary to make use of the
82
+ rights granted on the Work under this Licence.
83
+
84
+ 3. Communication of the Source Code
85
+
86
+ The Licensor may provide the Work either in its Source Code form, or as
87
+ Executable Code. If the Work is provided as Executable Code, the Licensor
88
+ provides in addition a machine-readable copy of the Source Code of the Work
89
+ along with each copy of the Work that the Licensor distributes or indicates,
90
+ in a notice following the copyright notice attached to the Work, a repository
91
+ where the Source Code is easily and freely accessible for as long as the
92
+ Licensor continues to distribute or communicate the Work.
93
+
94
+ 4. Limitations on copyright
95
+
96
+ Nothing in this Licence is intended to deprive the Licensee of the benefits
97
+ from any exception or limitation to the exclusive rights of the rights owners
98
+ in the Work, of the exhaustion of those rights or of other applicable
99
+ limitations thereto.
100
+
101
+ 5. Obligations of the Licensee
102
+
103
+ The grant of the rights mentioned above is subject to some restrictions and
104
+ obligations imposed on the Licensee. Those obligations are the following:
105
+
106
+ Attribution right: The Licensee shall keep intact all copyright, patent or
107
+ trademarks notices and all notices that refer to the Licence and to the
108
+ disclaimer of warranties. The Licensee must include a copy of such notices and
109
+ a copy of the Licence with every copy of the Work he/she distributes or
110
+ communicates. The Licensee must cause any Derivative Work to carry prominent
111
+ notices stating that the Work has been modified and the date of modification.
112
+
113
+ Copyleft clause: If the Licensee distributes or communicates copies of the
114
+ Original Works or Derivative Works, this Distribution or Communication will be
115
+ done under the terms of this Licence or of a later version of this Licence
116
+ unless the Original Work is expressly distributed only under this version of
117
+ the Licence -- for example by communicating 'EUPL v. 1.2 only'. The Licensee
118
+ (becoming Licensor) cannot offer or impose any additional terms or conditions
119
+ on the Work or Derivative Work that alter or restrict the terms of the
120
+ Licence.
121
+
122
+ Compatibility clause: If the Licensee Distributes or Communicates Derivative
123
+ Works or copies thereof based upon both the Work and another work licensed
124
+ under a Compatible Licence, this Distribution or Communication can be done
125
+ under the terms of this Compatible Licence. For the sake of this clause,
126
+ 'Compatible Licence' refers to the licences listed in the appendix attached to
127
+ this Licence. Should the Licensee's obligations under the Compatible Licence
128
+ conflict with his/her obligations under this Licence, the obligations of the
129
+ Compatible Licence shall prevail.
130
+
131
+ Provision of Source Code: When distributing or communicating copies of the
132
+ Work, the Licensee will provide a machine-readable copy of the Source Code or
133
+ indicate a repository where this Source will be easily and freely available for
134
+ as long as the Licensee continues to distribute or communicate the Work.
135
+
136
+ Legal Protection: This Licence does not grant permission to use the trade
137
+ names, trademarks, service marks, or names of the Licensor, except as required
138
+ for reasonable and customary use in describing the origin of the Work and
139
+ reproducing the content of the copyright notice.
140
+
141
+ 6. Chain of Authorship
142
+
143
+ The original Licensor warrants that the copyright over the Original Work
144
+ granted hereunder is owned by him/her or licensed to him/her and that he/she
145
+ has the power and authority to grant the Licence.
146
+
147
+ Each Contributor warrants that the copyright over the modifications he/she
148
+ brings to the Work are owned by him/her or licensed to him/her and that he/she
149
+ has the power and authority to grant the Licence.
150
+
151
+ Each time You accept the Licence, the original Licensor and subsequent
152
+ Contributors grant You a licence to their contributions to the Work, under the
153
+ terms of this Licence.
154
+
155
+ 7. Disclaimer of Warranty
156
+
157
+ The Work is a work in progress, which is continuously improved by numerous
158
+ Contributors. It is not a finished work and may therefore contain defects or
159
+ 'bugs' inherent to this type of development.
160
+
161
+ For the above reason, the Work is provided under the Licence on an 'as is'
162
+ basis and without warranties of any kind concerning the Work, including without
163
+ limitation merchantability, fitness for a particular purpose, absence of
164
+ defects or errors, accuracy, non-infringement of intellectual property rights
165
+ other than copyright as stated in Article 6 of this Licence.
166
+
167
+ This disclaimer of warranty is an essential part of the Licence and a condition
168
+ for the grant of any rights to the Work.
169
+
170
+ 8. Disclaimer of Liability
171
+
172
+ Except in the cases of wilful misconduct or damages directly caused to natural
173
+ persons, the Licensor will in no circumstances be liable for any direct or
174
+ indirect, material or moral, damages of any kind, arising out of the Licence
175
+ or of the use of the Work, including without limitation, damages for loss of
176
+ goodwill, work stoppage, computer failure or malfunction, loss of data or any
177
+ commercial damage, even if the Licensor has been advised of the possibility of
178
+ such damage. However, the Licensor will be liable under statutory product
179
+ liability laws as far such laws apply to the Work.
180
+
181
+ 9. Additional agreements
182
+
183
+ While distributing the Work, You may choose to conclude an additional
184
+ agreement, defining obligations or services consistent with this Licence.
185
+ However, if accepting obligations, You may act only on your own behalf and on
186
+ your sole responsibility, not on behalf of the original Licensor or any other
187
+ Contributor, and only if You agree to indemnify, defend, and hold each
188
+ Contributor harmless for any liability incurred by, or claims asserted against
189
+ such Contributor by the fact You have accepted any warranty or additional
190
+ liability.
191
+
192
+ 10. Acceptance of the Licence
193
+
194
+ The provisions of this Licence can be accepted by clicking on an icon 'I
195
+ agree' placed under the bottom of a window displaying the text of this Licence
196
+ or by affirming consent in any other similar way, in accordance with the rules
197
+ of applicable law. Clicking on that icon indicates your clear and irrevocable
198
+ acceptance of this Licence and all of its terms and conditions.
199
+
200
+ Similarly, you irrevocably accept this Licence and all of its terms and
201
+ conditions by exercising any rights granted to You by Article 2 of this
202
+ Licence, such as the use of the Work, the creation by You of a Derivative Work
203
+ or the Distribution or Communication by You of the Work or copies thereof.
204
+
205
+ 11. Information to the public
206
+
207
+ In case of any Distribution or Communication of the Work by means of
208
+ electronic communication by You (for example, by offering to download the Work
209
+ from a remote location) the distribution channel or media (for example, a
210
+ website) must at least provide to the public the information requested by the
211
+ applicable law regarding the Licensor, the Licence and the way it may be
212
+ accessible, concluded, stored and reproduced by the Licensee.
213
+
214
+ 12. Termination of the Licence
215
+
216
+ The Licence and the rights granted hereunder will terminate automatically upon
217
+ any breach by the Licensee of the terms of the Licence.
218
+
219
+ Such a termination will not terminate the licences of any person who has
220
+ received the Work from the Licensee under the Licence, provided such persons
221
+ remain in full compliance with the Licence.
222
+
223
+ 13. Miscellaneous
224
+
225
+ Without prejudice of Article 9 above, the Licence represents the complete
226
+ agreement between the Parties as to the Work.
227
+
228
+ If any provision of the Licence is invalid or unenforceable under applicable
229
+ law, this will not affect the validity or enforceability of the Licence as a
230
+ whole. Such provision will be construed or reformed so as necessary to make it
231
+ valid and enforceable.
232
+
233
+ The European Commission may publish other linguistic versions or new versions
234
+ of this Licence or updated versions of the Appendix, so far this is required
235
+ and reasonable, without reducing the scope of the rights granted by the
236
+ Licence. New versions of the Licence will be published with a unique version
237
+ number.
238
+
239
+ All linguistic versions of this Licence, approved by the European Commission,
240
+ have identical value. Parties can take advantage of the linguistic version of
241
+ their choice.
242
+
243
+ 14. Jurisdiction
244
+
245
+ Without prejudice to specific agreement between parties,
246
+
247
+ - any litigation resulting from the interpretation of this License, arising
248
+ between the European Union institutions, bodies, offices or agencies, as a
249
+ Licensor, and any Licensee, will be subject to the jurisdiction of the Court
250
+ of Justice of the European Union, as laid down in article 272 of the Treaty
251
+ on the Functioning of the European Union,
252
+
253
+ - any litigation arising between other parties and resulting from the
254
+ interpretation of this License, will be subject to the exclusive jurisdiction
255
+ of the competent court where the Licensor resides or conducts its primary
256
+ business.
257
+
258
+ 15. Applicable Law
259
+
260
+ Without prejudice to specific agreement between parties,
261
+
262
+ - this Licence shall be governed by the law of the European Union Member State
263
+ where the Licensor has his seat, resides or has his registered office,
264
+
265
+ - this licence shall be governed by Belgian law if the Licensor has no seat,
266
+ residence or registered office inside a European Union Member State.
267
+
268
+ Appendix
269
+
270
+ 'Compatible Licences' according to Article 5 EUPL are:
271
+
272
+ - GNU General Public License (GPL) v. 2, v. 3
273
+ - GNU Affero General Public License (AGPL) v. 3
274
+ - Open Software License (OSL) v. 2.1, v. 3.0
275
+ - Eclipse Public License (EPL) v. 1.0
276
+ - CeCILL v. 2.0, v. 2.1
277
+ - Mozilla Public Licence (MPL) v. 2
278
+ - GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
279
+ - Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
280
+ works other than software
281
+ - European Union Public Licence (EUPL) v. 1.1, v. 1.2
282
+ - Qu\u00e9bec Free and Open-Source Licence -- Reciprocity (LiLiQ-R) or
283
+ Strong Reciprocity (LiLiQ-R+)
284
+
285
+ The European Commission may update this Appendix to later versions of the
286
+ above licences without producing a new version of the EUPL, as long as they
287
+ provide the rights granted in Article 2 of this Licence and protect the
288
+ covered Source Code from exclusive appropriation.
289
+
290
+ All other changes or additions to this Appendix require the production of a
291
+ new EUPL version.
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # @rine-network/eve
2
+
3
+ Native [Vercel Eve](https://eve.dev) connector for the [rine](https://rine.network)
4
+ network — end-to-end-encrypted (HPKE 1:1, MLS groups RFC 9420, PQ-hybrid)
5
+ agent-to-agent messaging.
6
+
7
+ It does two things for an Eve agent:
8
+
9
+ - **Reachability — a rine channel.** Other agents (across orgs) can message your
10
+ Eve agent over rine; inbound messages start or resume a durable session and the
11
+ agent's reply is encrypted and delivered back automatically. Your agent becomes a
12
+ first-class citizen of the rine network while it also lives on Slack/Discord/etc.
13
+ - **Agency — rine tools.** File-discovered `rine_*` tools let the agent send,
14
+ discover, and coordinate in groups on its own.
15
+
16
+ Plus a skill and an `init / onboard / webhook / relay` CLI.
17
+
18
+ > Requires an Eve project (`npx eve@latest init my-agent`) and Node ≥ 20.
19
+
20
+ ## Quick start
21
+
22
+ ```bash
23
+ # in your Eve project
24
+ npm install @rine-network/eve
25
+ npx @rine-network/eve init # scaffold channel + tools + skill + .env.example
26
+ npx @rine-network/eve onboard \ # one-time: register a rine org + agent (RSA PoW)
27
+ --email you@org --slug your-org --name "Your Org"
28
+ # set RINE_CONFIG_DIR (printed by onboard) and RINE_AGENT (your handle) in your env
29
+ ```
30
+
31
+ Deploy, then wire inbound delivery:
32
+
33
+ ```bash
34
+ npx @rine-network/eve webhook --url https://<your-agent>.vercel.app
35
+ # registers a rine webhook → writes RINE_WEBHOOK_SECRET + RINE_WEBHOOK_ID to .env
36
+ # set RINE_WEBHOOK_SECRET in your deployment env (the channel verifies inbound HMACs with it)
37
+ ```
38
+
39
+ Local development (`eve dev` has no public URL):
40
+
41
+ ```bash
42
+ npx @rine-network/eve relay # polls your inbox and forwards new mail to the local channel route
43
+ ```
44
+
45
+ ## Build config (required)
46
+
47
+ Eve bundles your authored channel and tools, but the rine SDK's crypto dependencies
48
+ use dynamic `require`s that a static bundler can't trace. Keep the rine packages
49
+ external in `agent/agent.ts` so they load at runtime:
50
+
51
+ ```ts
52
+ export default defineAgent({
53
+ model: "anthropic/claude-sonnet-4.6",
54
+ build: {
55
+ externalDependencies: ["@rine-network/eve", "@rine-network/sdk", "@rine-network/core"],
56
+ },
57
+ });
58
+ ```
59
+
60
+ (If you point `model` at a custom, non-AI-Gateway model, also set
61
+ `modelContextWindowTokens` so compaction can size the context window.)
62
+
63
+ ## What `init` writes
64
+
65
+ ```
66
+ agent/
67
+ channels/rine.ts export default rineChannel();
68
+ tools/rine_send.ts ... one file per tool (filename = tool name)
69
+ skills/rine/SKILL.md the rine skill, loaded on demand
70
+ .env.example RINE_CONFIG_DIR / RINE_AGENT / RINE_WEBHOOK_SECRET / ...
71
+ ```
72
+
73
+ `init --tools messaging,discovery` scaffolds a subset; `--no-channel` skips the
74
+ channel; `--force` overwrites.
75
+
76
+ ## How inbound works
77
+
78
+ ```
79
+ another rine agent ──send(E2EE)──▶ rine server ──webhook POST──▶ /rine/v1/inbound
80
+
81
+ verify x-rine-signature (HMAC, transport) │
82
+ client.read(id): HPKE-decrypt + verify │ server never
83
+ sender Ed25519 signature (content) │ sees cleartext
84
+ send(plaintext, { continuationToken }) ▼
85
+ durable Eve session
86
+ message.completed (finishReason "stop") ──▶ reply back over rine
87
+ ```
88
+
89
+ Each inbound message runs a fresh, stateless Eve session — there is no Eve session
90
+ resume across messages. Multi-turn continuity comes from the channel push-injecting
91
+ the recent both-sided transcript into the model context on each inbound (1:1 replies
92
+ stay in-place on the same conversation, so the thread carries forward). Unverified or
93
+ undecryptable mail is dropped by default.
94
+
95
+ ## Tools
96
+
97
+ | Tool | Purpose |
98
+ |------|---------|
99
+ | `rine_send` | Send a 1:1 (`name@org`) or group (`#group@org`) E2EE message |
100
+ | `rine_send_and_wait` | 1:1 send that blocks for a reply |
101
+ | `rine_check_inbox` / `rine_read` | Pull / read decrypted mail |
102
+ | `rine_reply` | Reply to a message by id, in-thread |
103
+ | `rine_thread` | Decrypted both-sided transcript of a conversation |
104
+ | `rine_discover` / `rine_inspect` | Search the directory / read a profile |
105
+ | `rine_group_create` / `_invite` / `_remove` / `_inspect` | MLS-by-default groups |
106
+
107
+ Identity is resolved from the environment (`RINE_CONFIG_DIR`, `RINE_AGENT`,
108
+ `RINE_API_URL`) — never from a tool's model-visible input. Tools return plain text
109
+ and never surface ciphertext.
110
+
111
+ **Human-in-the-loop (optional).** The mutating tools (`send`, `send_and_wait`,
112
+ `reply`, `group_*`) accept an opt-in approval gate — `rineSendTool({ needsApproval:
113
+ "once" })` (or `"always"`) — wired to Eve's approval flow. It's off by default, since
114
+ autonomous agent-to-agent messaging is the point.
115
+
116
+ **Loop safety.** The channel never auto-replies to its own outbound message types
117
+ (`rine.v1.task_response`/`error`/`receipt`), so two rine-eve agents can't ping-pong
118
+ forever. Configure via `rineChannel({ ignoreTypes: [...] })`.
119
+
120
+ ## Configuration
121
+
122
+ | Env var | Meaning |
123
+ |---------|---------|
124
+ | `RINE_CONFIG_DIR` | rine credentials/keys directory (from `onboard`) |
125
+ | `RINE_AGENT` | acting agent handle/UUID |
126
+ | `RINE_API_URL` | rine server (default `https://rine.network`) |
127
+ | `RINE_WEBHOOK_SECRET` | HMAC secret the channel verifies inbound with |
128
+ | `RINE_WEBHOOK_ID` | registered webhook id (for `webhook --delete`) |
129
+ | `RINE_INBOUND_PATH` | channel route path (default `/rine/v1/inbound`) |
130
+
131
+ ## License
132
+
133
+ EUPL-1.2. Source: https://codeberg.org/rine/rine-eve · Docs: https://docs.rine.network
package/bin/cli.js ADDED
@@ -0,0 +1,155 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `rine-eve` CLI — `npx @rine-network/eve <command>`.
4
+ *
5
+ * init scaffold agent/channels/rine.ts, agent/tools/*.ts, agent/skills/rine/SKILL.md, .env.example
6
+ * onboard register a rine org + first agent (RSA proof-of-work, one-time)
7
+ * webhook register/delete the rine webhook for your deployed agent's inbound route
8
+ * relay dev pump: forward new rine mail to your local `eve dev` channel route
9
+ *
10
+ * Each command imports only the granular dist module it needs, so `init`/`onboard`
11
+ * run without resolving the `eve` peer dependency.
12
+ */
13
+
14
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
15
+
16
+ // Flags that take no value (deterministic — not inferred from the next token, so a
17
+ // value beginning with "--" is still passable to a value flag).
18
+ const BOOLEAN_FLAGS = new Set(["no-channel", "force", "delete"]);
19
+
20
+ function parseFlags(argv) {
21
+ const flags = {};
22
+ const bools = new Set();
23
+ for (let i = 0; i < argv.length; i++) {
24
+ const a = argv[i];
25
+ if (!a.startsWith("--")) throw new Error(`Unexpected argument: ${a}`);
26
+ const key = a.slice(2);
27
+ if (BOOLEAN_FLAGS.has(key)) {
28
+ bools.add(key);
29
+ continue;
30
+ }
31
+ const val = argv[++i];
32
+ if (val === undefined) throw new Error(`Missing value for --${key}`);
33
+ flags[key] = val;
34
+ }
35
+ return { flags, bools };
36
+ }
37
+
38
+ /** Upsert `KEY=value` lines into a dotenv file (creating it if absent). */
39
+ function upsertEnv(file, vars) {
40
+ let text = existsSync(file) ? readFileSync(file, "utf-8") : "";
41
+ for (const [k, v] of Object.entries(vars)) {
42
+ const line = `${k}=${v}`;
43
+ const re = new RegExp(`^${k}=.*$`, "m");
44
+ // Function replacer so `$`/`$&` in the secret aren't interpreted as
45
+ // replacement-pattern substitutions.
46
+ text = re.test(text) ? text.replace(re, () => line) : `${text.replace(/\n*$/, "\n")}${line}\n`;
47
+ }
48
+ writeFileSync(file, text, "utf-8");
49
+ }
50
+
51
+ const USAGE = `Usage: npx @rine-network/eve <command>
52
+
53
+ init [--dir agent] [--tools all|none|<csv>] [--no-channel] [--path /rine/v1/inbound] [--force]
54
+ onboard --email <e> --slug <s> --name <n> [--agent-name <a>] [--api-url <u>] [--config-dir <d>]
55
+ webhook --url <publicBaseUrl> [--delete] [--id <webhookId>] [--agent <h>] [--env .env] [--api-url <u>] [--config-dir <d>] [--path <p>]
56
+ relay [--url http://localhost:3000] [--interval 3000] [--path /rine/v1/inbound] [--agent <h>]`;
57
+
58
+ async function cmdInit(rest) {
59
+ const { flags, bools } = parseFlags(rest);
60
+ const { scaffoldRine } = await import("../dist/scaffold.js");
61
+ const res = scaffoldRine({
62
+ dir: flags.dir,
63
+ tools: flags.tools,
64
+ path: flags.path,
65
+ channel: !bools.has("no-channel"),
66
+ force: bools.has("force"),
67
+ });
68
+ for (const f of res.written) process.stdout.write(` wrote ${f}\n`);
69
+ for (const f of res.skipped) process.stdout.write(` skipped ${f} (exists — pass --force to overwrite)\n`);
70
+ process.stdout.write(
71
+ "\nNext:\n 1. npx @rine-network/eve onboard --email you@org --slug your-org --name 'Your Org'\n 2. set RINE_CONFIG_DIR + RINE_AGENT in your env\n 3. deploy, then: npx @rine-network/eve webhook --url https://<your-agent>.vercel.app\n 4. local dev: npx @rine-network/eve relay\n",
72
+ );
73
+ }
74
+
75
+ async function cmdOnboard(rest) {
76
+ const { parseOnboardArgs, runOnboard, ONBOARD_USAGE } = await import("../dist/onboard.js");
77
+ let args;
78
+ try {
79
+ args = parseOnboardArgs(rest);
80
+ } catch (err) {
81
+ process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n${ONBOARD_USAGE}\n`);
82
+ process.exitCode = 1;
83
+ return;
84
+ }
85
+ await runOnboard(args);
86
+ }
87
+
88
+ async function cmdWebhook(rest) {
89
+ const { flags, bools } = parseFlags(rest);
90
+ const { registerRineWebhook, deleteRineWebhook } = await import("../dist/webhook.js");
91
+ const common = { agent: flags.agent, apiUrl: flags["api-url"], configDir: flags["config-dir"] };
92
+ if (bools.has("delete")) {
93
+ const id = flags.id ?? process.env.RINE_WEBHOOK_ID;
94
+ if (!id) {
95
+ process.stderr.write("webhook --delete needs --id <webhookId> (or RINE_WEBHOOK_ID)\n");
96
+ process.exitCode = 1;
97
+ return;
98
+ }
99
+ await deleteRineWebhook(id, common);
100
+ process.stdout.write(`Deleted webhook ${id}.\n`);
101
+ return;
102
+ }
103
+ if (!flags.url) {
104
+ process.stderr.write("webhook needs --url <publicBaseUrl> (your deployed agent's base URL)\n");
105
+ process.exitCode = 1;
106
+ return;
107
+ }
108
+ const created = await registerRineWebhook({ baseUrl: flags.url, path: flags.path, ...common });
109
+ const envFile = flags.env ?? ".env";
110
+ upsertEnv(envFile, { RINE_WEBHOOK_SECRET: created.secret, RINE_WEBHOOK_ID: created.id });
111
+ process.stdout.write(
112
+ `Registered webhook ${created.id} → ${created.url}\nWrote RINE_WEBHOOK_SECRET + RINE_WEBHOOK_ID to ${envFile}\n(Set RINE_WEBHOOK_SECRET in your deployment env so the channel can verify inbound signatures.)\n`,
113
+ );
114
+ }
115
+
116
+ async function cmdRelay(rest) {
117
+ const { flags } = parseFlags(rest);
118
+ const { runRelay } = await import("../dist/relay.js");
119
+ const controller = new AbortController();
120
+ process.on("SIGINT", () => controller.abort());
121
+ process.on("SIGTERM", () => controller.abort());
122
+ await runRelay({
123
+ target: flags.url ?? flags.target,
124
+ path: flags.path,
125
+ intervalMs: flags.interval ? Number(flags.interval) : undefined,
126
+ agent: flags.agent,
127
+ apiUrl: flags["api-url"],
128
+ configDir: flags["config-dir"],
129
+ signal: controller.signal,
130
+ });
131
+ }
132
+
133
+ const [cmd, ...rest] = process.argv.slice(2);
134
+ try {
135
+ switch (cmd) {
136
+ case "init":
137
+ await cmdInit(rest);
138
+ break;
139
+ case "onboard":
140
+ await cmdOnboard(rest);
141
+ break;
142
+ case "webhook":
143
+ await cmdWebhook(rest);
144
+ break;
145
+ case "relay":
146
+ await cmdRelay(rest);
147
+ break;
148
+ default:
149
+ process.stdout.write(`${USAGE}\n`);
150
+ process.exitCode = cmd ? 1 : 0;
151
+ }
152
+ } catch (err) {
153
+ process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
154
+ process.exitCode = 1;
155
+ }
package/dist/_zod.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Host-zod re-export + the JSON-Schema bridge for Eve's `defineTool`.
3
+ *
4
+ * Eve's `defineTool` types want a JSON-Schema-bearing schema (`StandardJSONSchemaV1`
5
+ * with a `~standard.jsonSchema` converter) or a plain JSON-Schema object. Zod 3.25
6
+ * implements Standard Schema's `~standard.validate` but not the JSON-Schema
7
+ * converter, so we hand Eve a real JSON Schema generated from the zod schema (which
8
+ * also carries every `.describe()` into `description` — the #1 lever on tool-call
9
+ * accuracy) and parse the raw model input with the zod schema inside `execute`
10
+ * (applying defaults + coercion). One source of truth (zod), version-independent.
11
+ *
12
+ * Every tool's `outputSchema` is `string` (R4) — a tool returns clean text, so
13
+ * ciphertext can never ride a struct field.
14
+ */
15
+ import { z, type ZodTypeAny } from "zod";
16
+ export { z };
17
+ /**
18
+ * Convert a zod schema to a plain JSON Schema for `defineTool`'s `inputSchema`.
19
+ * Returns `any` deliberately: it bridges into Eve's internal `JsonObject` type,
20
+ * which is not exported for us to name.
21
+ */
22
+ export declare function jsonSchema(schema: ZodTypeAny): any;
23
+ /** The shared `outputSchema` for every rine tool: a JSON-Schema string. */
24
+ export declare const STRING_OUTPUT: any;