@rine-network/eve 0.3.0 → 0.5.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 (39) hide show
  1. package/README.md +12 -6
  2. package/dist/{channel-WlN3x1wP.js → channel-B81UiHyr.js} +12 -9
  3. package/dist/channel-core.d.ts +9 -6
  4. package/dist/channel.d.ts +1 -1
  5. package/dist/channel.js +1 -1
  6. package/dist/{client-DsG2xtKs.js → client-CXJATA-m.js} +22 -2
  7. package/dist/client.d.ts +18 -0
  8. package/dist/format-groups-list.d.ts +140 -0
  9. package/dist/format-groups.d.ts +81 -0
  10. package/dist/format.d.ts +51 -11
  11. package/dist/index.js +7 -7
  12. package/dist/onboard.js +2 -2
  13. package/dist/{registry-Bn4EqPcp.js → registry-DsU13KY3.js} +47 -2
  14. package/dist/relay.js +2 -2
  15. package/dist/scaffold-DQ2CA1kD.js +239 -0
  16. package/dist/scaffold.js +1 -1
  17. package/dist/schemas-groups-list.d.ts +29 -0
  18. package/dist/schemas-groups.d.ts +83 -9
  19. package/dist/schemas.d.ts +26 -6
  20. package/dist/skill-content.d.ts +8 -2
  21. package/dist/tool-DeOeMNlK.js +618 -0
  22. package/dist/tool.d.ts +2 -2
  23. package/dist/tools/discovery.d.ts +8 -2
  24. package/dist/tools/groups-admin.d.ts +25 -0
  25. package/dist/tools/groups-admission.d.ts +56 -0
  26. package/dist/tools/groups-list.d.ts +21 -0
  27. package/dist/tools/groups-resolve.d.ts +80 -0
  28. package/dist/tools/groups.d.ts +18 -14
  29. package/dist/tools/index.d.ts +5 -3
  30. package/dist/tools/index.js +3 -3
  31. package/dist/tools/messaging.d.ts +13 -11
  32. package/dist/tools-CQDZG-qN.js +1149 -0
  33. package/dist/types.d.ts +2 -1
  34. package/dist/webhook.d.ts +8 -1
  35. package/dist/webhook.js +33 -13
  36. package/package.json +3 -3
  37. package/dist/scaffold-3cEUy3jD.js +0 -147
  38. package/dist/tool-xlLdY8kn.js +0 -276
  39. package/dist/tools-BhkhV3Mv.js +0 -595
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The 5 admission + membership-exit group tool factories:
3
+ * `rine_group_requests`, `rine_group_vote`, `rine_group_leave`,
4
+ * `rine_group_sync`, `rine_group_reclaim`.
5
+ *
6
+ * Split from `tools/groups.ts` (which holds the six create/invite/inspect/join
7
+ * factories) so both files stay inside the ~200-LOC budget. Same idiom: one
8
+ * exported factory per tool, the SDK does the work, the tool renders.
9
+ *
10
+ * `rine_group_leave` is a distinct verb rather than a mode of
11
+ * `rine_group_remove`, which keeps its own "name your own agent to leave"
12
+ * behaviour: a leave destroys THIS host's key material, a removal acts on a
13
+ * third party, and one wrong argument should not turn one into the other.
14
+ */
15
+ import { type RineToolOpts } from "../tool.js";
16
+ /** `rine_group_requests` — list a group's outstanding admissions. */
17
+ export declare function rineGroupRequestsTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
18
+ /** `rine_group_vote` — approve or deny one pending join request. */
19
+ export declare function rineGroupVoteTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
20
+ /** `rine_group_leave` — leave a group this agent is a member of. */
21
+ export declare function rineGroupLeaveTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
22
+ /** `rine_group_sync` — catch this host's MLS state up with the group. */
23
+ export declare function rineGroupSyncTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
24
+ /** `rine_group_reclaim` — seat the unseated, then retire the orphaned leaves. */
25
+ export declare function rineGroupReclaimTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * What an admission did, rendered for a model.
3
+ *
4
+ * A roster on `rine_group_create`, a batch on `rine_group_invite` and a single
5
+ * `agentToInvite` are the same operation at three entry points, so they answer
6
+ * in the same vocabulary. The two plural ones report one outcome per requested
7
+ * agent, in the order they were named: a batch never fails whole — naming 32
8
+ * agents and having one of them revoked costs that one agent its seat, not the
9
+ * other 31 theirs — which is only useful if the caller is told which one.
10
+ *
11
+ * Two reports, deliberately not merged. The server's says whether an
12
+ * **invitation** was minted; the MLS one says whether a ratchet-tree **leaf**
13
+ * was. An agent can be `invited` in the first and `no_key_package` in the
14
+ * second: it may join, and it will not be able to read a word until a leaf
15
+ * exists for it. Collapsing them into one number is how that goes unreported.
16
+ *
17
+ * On a `majority` or `unanimity` group the server's answer is `nominated`
18
+ * rather than `invited`: the invite files a join request the electorate
19
+ * decides, and no leaf is minted for it. So a nomination has no MLS report at
20
+ * all — the vote seats the member, and seating is what grants the key.
21
+ *
22
+ * The shapes and the reason→sentence maps are `@rine-network/core`'s, so this
23
+ * module is the rendering and nothing else. A skip used to print the raw wire
24
+ * token, which read as a refusal on exactly the groups it is not one for: an
25
+ * open group mints no invitation because it needs none, and `not_applicable`
26
+ * said nothing about that to a model deciding what to do next.
27
+ */
28
+ import { type GroupAdmissionReport, type MlsAdmissionResult } from "@rine-network/core";
29
+ /** The refusal when a caller names both invite targets, or neither. */
30
+ export declare const INVITE_TARGET_REQUIRED = "Name exactly one of agentToInvite (one invitation) or agentsToInvite (a batch).";
31
+ /**
32
+ * What one `agentToInvite` produced, told from the row's own status.
33
+ *
34
+ * The singular route answers one row rather than a per-agent report, so the
35
+ * status word is all a caller has to go on — and `Invited X (status pending)`
36
+ * both claims something that did not happen and hands a model a word no other
37
+ * outcome of this tool uses. `invited` and `pending` are therefore named, and
38
+ * any other status still prints itself rather than being read as one of them.
39
+ *
40
+ * `invited` covers two shapes and the sentence names both. A closed group mints
41
+ * a real invitation row that occupies a ratchet-tree seat until it is accepted
42
+ * or expires; an open group answers `invited` having minted nothing at all,
43
+ * because nobody needs an invitation to join one — and it runs sender keys, so
44
+ * there is no ratchet tree for a seat to sit in.
45
+ */
46
+ export declare function renderSingularInvite(agentRef: string, groupRef: string, status: string): string;
47
+ /** Per-agent invitation outcomes, one line each, in the order they were named. */
48
+ export declare function renderAdmission(report: GroupAdmissionReport): string;
49
+ /**
50
+ * What the MLS admission seated, and who is still without a leaf.
51
+ *
52
+ * `already_in_group` is filtered out of the unseated list: an agent that
53
+ * already holds a leaf is what a resumed admission looks like when it has
54
+ * nothing left to do, not a failure to report.
55
+ */
56
+ export declare function renderMlsAdmission(mls: MlsAdmissionResult): string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The group domain's three READ verbs: `rine_groups` (the groups this agent's
3
+ * ORG belongs to), `rine_discover_groups` (the public directory) and
4
+ * `rine_group_roster` (who is in one group).
5
+ *
6
+ * A third group module beside `groups.ts` (the six founding/admission verbs)
7
+ * and `groups-admin.ts` (the five admission and exit verbs), so all three hold
8
+ * the ~200-LOC budget.
9
+ *
10
+ * Nothing here mutates anything, so none of them carries an approval gate.
11
+ * `rine_discover_groups` reads the public directory and needs no membership at
12
+ * all — it answers for `public`-visibility groups across every org, and returns
13
+ * no roster for any of them.
14
+ */
15
+ import { type RineToolOpts } from "../tool.js";
16
+ /** `rine_groups` — the groups this agent's ORG belongs to. */
17
+ export declare function rineGroupsTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
18
+ /** `rine_discover_groups` — search the public group directory. */
19
+ export declare function rineDiscoverGroupsTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
20
+ /** `rine_group_roster` — who is in one group, and since when. */
21
+ export declare function rineGroupRosterTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Handle → UUID resolution for the group tools.
3
+ *
4
+ * What is left here is the AGENT half. The group half moved out entirely: the
5
+ * SDK's `groups.resolveRef` is now the one ladder for a group reference, and
6
+ * it answers with the group's whole record — id, handle, the caller's own
7
+ * spelling, and the row the resolve already read — so a verb that reads the
8
+ * group before it writes spends no `GET /groups/{id}` of its own. This package
9
+ * used to search `groups.list()` and match locally, which is a second copy of a
10
+ * ladder the SDK, the CLI and the MCP server all reach through one function; a
11
+ * refusal that differed per surface is what that copy was.
12
+ *
13
+ * Agents still resolve here, and differently on purpose: `resolveToUuid` is a
14
+ * WebFinger lookup, so an agent that this org has never messaged resolves too.
15
+ *
16
+ * `join` is the exception and does NOT resolve through `resolveRef`: it is the
17
+ * one group verb whose target is by definition a group this org is not in, so
18
+ * the org's seats are the one set it cannot be found in. It delegates to the
19
+ * SDK's join ladder (`resolveRefForJoin`), which walks the org's seats, this
20
+ * agent's invitations and the public directory. A bare UUID always passes
21
+ * through unchanged.
22
+ *
23
+ * Split out of `tools/groups.ts` so that file holds its six tool factories and
24
+ * nothing else; `tools/registry.ts` — which is what the shipped-surface gate
25
+ * reads for tool names — is untouched by the move.
26
+ */
27
+ import type { AsyncRineClient } from "@rine-network/sdk";
28
+ /**
29
+ * A tool's answer, led by the item-18 completion notice when there is one.
30
+ *
31
+ * 🔴 `resolveToUuid` completes a short handle before it reaches WebFinger —
32
+ * `kofi@acme` is looked up as `kofi@acme.rine.network` — and answers with the
33
+ * resolved UUID, never the handle it resolved. The model named one agent and
34
+ * the call may have invited, removed or seated another, with nothing in the
35
+ * answer saying so.
36
+ *
37
+ * 🔴 A LINE, not a key, and that is this surface's shape rather than a choice:
38
+ * every tool here declares `STRING_OUTPUT`, so there is no object to hang a
39
+ * field on. `@rine-network/mcp` returns objects and rides the same sentence as
40
+ * a `handle_completion` key; the CLI writes it to stderr. The BYTES are
41
+ * {@link handleCompletionNotes}' in `@rine-network/core` and are retyped by
42
+ * none of the three.
43
+ *
44
+ * It leads rather than trails because a model reads the head of a tool result
45
+ * and acts on it — a caveat about which agent was actually touched is worth
46
+ * nothing underneath the report of touching them.
47
+ */
48
+ export declare function withHandleCompletionLine(answer: string, spellings: readonly string[]): string;
49
+ /** Resolve an agent handle/UUID to its `AgentUuid` (UUIDs pass through). */
50
+ export declare function resolveAgentUuid(apiUrl: string, target: string): Promise<import("@rine-network/sdk").AgentUuid>;
51
+ /**
52
+ * Resolve a batch of agent handles/UUIDs, **in the order they were named**.
53
+ *
54
+ * Order is load-bearing: the server answers one admission entry per requested
55
+ * id in request order, so a report read against a re-ordered list names the
56
+ * wrong agents. Duplicates are dropped case-insensitively rather than sent
57
+ * twice, because the second copy of an id comes back `already_invited` and
58
+ * reads as a failure the caller did not cause.
59
+ */
60
+ export declare function resolveAgentUuids(apiUrl: string, targets: string[]): Promise<import("@rine-network/sdk").AgentUuid[]>;
61
+ /**
62
+ * Resolve a group handle/UUID to its `GroupUuid` for `rine_group_join`.
63
+ *
64
+ * 🔴 The SDK's own join ladder, not a copy of one. This package used to search
65
+ * `groups.listInvites()` alone, which answered for a group that had invited
66
+ * this agent and for nothing else — so the commonest join there is, a handle
67
+ * read straight off `rine_discover_groups`, was refused here with the server
68
+ * never having been asked. `resolveRefForJoin` walks the org's seats, then this
69
+ * agent's invitations, then the public directory, matching the handle exactly at
70
+ * every rung. What this package could always do it still does: a BARE name
71
+ * resolves against this agent's own pending invitations — and against nothing
72
+ * else, because that list is the only set bounded to groups that have already
73
+ * asked for this agent, and a join cannot be taken back.
74
+ *
75
+ * The refusals it throws lead with `Group not found`, which is the phrase
76
+ * `formatError` (`../errors.ts`) keys on to append this surface's own discover
77
+ * verbs — the old `No pending invite` wording matched none of its three
78
+ * spellings, so a refused join carried no remedy at all.
79
+ */
80
+ export declare function resolveJoinGroupUuid(client: AsyncRineClient, target: string): Promise<import("@rine-network/sdk").GroupUuid>;
@@ -1,24 +1,28 @@
1
1
  /**
2
- * The 6 group tool factories: `rine_group_create`, `rine_group_invite`,
3
- * `rine_group_remove`, `rine_group_inspect`, `rine_group_join`,
4
- * `rine_group_invites`. Groups are MLS-by-default.
2
+ * 6 of the group domain's 13 tool factories: `rine_group_create`,
3
+ * `rine_group_invite`, `rine_group_remove`, `rine_group_inspect`,
4
+ * `rine_group_join`, `rine_group_invites`. The four admission and exit verbs —
5
+ * `rine_group_requests`, `rine_group_vote`, `rine_group_leave`,
6
+ * `rine_group_sync` — live in `groups-admin.ts`, so both files hold the
7
+ * ~200-LOC budget. Groups are MLS-by-default.
5
8
  *
6
- * The TS SDK's `groups.invite`/`removeMember` take BRANDED UUIDs positionally, so
7
- * invite/remove/inspect PRE-RESOLVE handle→UUID here:
8
- * - a group `groups.list()` + local match (`findGroup`),
9
- * - an agent `resolveToUuid` (WebFinger) its UUID (or pass a UUID through),
10
- * so unlisted agents resolve too.
11
- * `join` resolves a handle the same way but against the caller's PENDING
12
- * INVITES (`groups.listInvites()`) an invitee isn't a member yet, so it can't
13
- * appear in `groups.list()`. A bare UUID always passes through unchanged (the
14
- * path for a publicly discovered open-enrollment group with no invite record).
9
+ * `visibility` has no default here or anywhere else — see `schemas-groups.ts`.
10
+ *
11
+ * Admission is plural on both write verbs. `members` on create and
12
+ * `agentsToInvite` on invite each take a batch and report one outcome per
13
+ * agent, because a batch drops what it cannot admit rather than refusing
14
+ * everyone, and on an MLS group it mints every new leaf in one commit instead
15
+ * of one commit each.
16
+ *
17
+ * Handle→UUID resolution lives in `groups-resolve.ts` and the admission
18
+ * rendering in `groups-admission.ts`, so this file is those six factories.
15
19
  */
16
20
  import { type RineToolOpts } from "../tool.js";
17
21
  /** `rine_group_create` — create an MLS-by-default coordination group. */
18
22
  export declare function rineGroupCreateTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
19
- /** `rine_group_invite` — invite an agent into a group (handle→UUID pre-resolved). */
23
+ /** `rine_group_invite` — invite one agent or a batch (handle→UUID pre-resolved). */
20
24
  export declare function rineGroupInviteTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
21
- /** `rine_group_remove` — remove a member; group keys rotate (handle→UUID pre-resolved). */
25
+ /** `rine_group_remove` — evict a member, or leave (handle→UUID pre-resolved). */
22
26
  export declare function rineGroupRemoveTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
23
27
  /** `rine_group_inspect` — report a group's E2EE mode + policy. */
24
28
  export declare function rineGroupInspectTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The 16 rine tool factories, re-exported for `@rine-network/eve/tools`.
2
+ * The 25 rine tool factories, re-exported for `@rine-network/eve/tools`.
3
3
  *
4
4
  * Eve discovers tools by file: each lives as a default-export in
5
5
  * `agent/tools/<name>.ts`, and the filename slug IS the tool name. The `init`
@@ -9,8 +9,10 @@
9
9
  */
10
10
  import type { RineToolOpts } from "../tool.js";
11
11
  import { type RineToolMeta } from "./registry.js";
12
- export { rineCheckInboxTool, rineReadTool, rineReplyTool, rineSendAndWaitTool, rineSendTool, rineThreadTool, } from "./messaging.js";
13
- export { rineDiscoverTool, rineInspectTool } from "./discovery.js";
12
+ export { rineInboxTool, rineReadTool, rineReplyTool, rineSendAndWaitTool, rineSendTool, rineThreadTool, } from "./messaging.js";
13
+ export { rineDiscoverTool, rineInspectTool, rineWhoamiTool, } from "./discovery.js";
14
+ export { rineGroupLeaveTool, rineGroupReclaimTool, rineGroupRequestsTool, rineGroupSyncTool, rineGroupVoteTool, } from "./groups-admin.js";
15
+ export { rineDiscoverGroupsTool, rineGroupRosterTool, rineGroupsTool, } from "./groups-list.js";
14
16
  export { rineGroupCreateTool, rineGroupInspectTool, rineGroupInviteTool, rineGroupInvitesTool, rineGroupJoinTool, rineGroupRemoveTool, } from "./groups.js";
15
17
  export { rineFulfillTool, rinePayTool } from "./payments.js";
16
18
  export { RINE_TOOL_META, type RineToolMeta, type RineToolDomain, } from "./registry.js";
@@ -1,3 +1,3 @@
1
- import { _ as rineInspectTool, a as rineReadTool, c as rineSendTool, d as rineGroupInspectTool, f as rineGroupInviteTool, g as rineDiscoverTool, h as rineGroupRemoveTool, i as rineCheckInboxTool, l as rineThreadTool, m as rineGroupJoinTool, n as rineFulfillTool, o as rineReplyTool, p as rineGroupInvitesTool, r as rinePayTool, s as rineSendAndWaitTool, t as RINE_TOOLS, u as rineGroupCreateTool } from "../tools-BhkhV3Mv.js";
2
- import { t as RINE_TOOL_META } from "../registry-Bn4EqPcp.js";
3
- export { RINE_TOOLS, RINE_TOOL_META, rineCheckInboxTool, rineDiscoverTool, rineFulfillTool, rineGroupCreateTool, rineGroupInspectTool, rineGroupInviteTool, rineGroupInvitesTool, rineGroupJoinTool, rineGroupRemoveTool, rineInspectTool, rinePayTool, rineReadTool, rineReplyTool, rineSendAndWaitTool, rineSendTool, rineThreadTool };
1
+ import { C as rineGroupVoteTool, E as rineWhoamiTool, S as rineGroupSyncTool, T as rineInspectTool, _ as rineGroupRosterTool, a as rineReadTool, b as rineGroupReclaimTool, c as rineSendTool, d as rineGroupInspectTool, f as rineGroupInviteTool, g as rineDiscoverGroupsTool, h as rineGroupRemoveTool, i as rineInboxTool, l as rineThreadTool, m as rineGroupJoinTool, n as rineFulfillTool, o as rineReplyTool, p as rineGroupInvitesTool, r as rinePayTool, s as rineSendAndWaitTool, t as RINE_TOOLS, u as rineGroupCreateTool, v as rineGroupsTool, w as rineDiscoverTool, x as rineGroupRequestsTool, y as rineGroupLeaveTool } from "../tools-CQDZG-qN.js";
2
+ import { t as RINE_TOOL_META } from "../registry-DsU13KY3.js";
3
+ export { RINE_TOOLS, RINE_TOOL_META, rineDiscoverGroupsTool, rineDiscoverTool, rineFulfillTool, rineGroupCreateTool, rineGroupInspectTool, rineGroupInviteTool, rineGroupInvitesTool, rineGroupJoinTool, rineGroupLeaveTool, rineGroupReclaimTool, rineGroupRemoveTool, rineGroupRequestsTool, rineGroupRosterTool, rineGroupSyncTool, rineGroupVoteTool, rineGroupsTool, rineInboxTool, rineInspectTool, rinePayTool, rineReadTool, rineReplyTool, rineSendAndWaitTool, rineSendTool, rineThreadTool, rineWhoamiTool };
@@ -1,25 +1,27 @@
1
1
  /**
2
- * The 5 messaging tool factories: `rine_send`, `rine_send_and_wait`,
3
- * `rine_check_inbox`, `rine_read`, `rine_reply`. Each returns an Eve `defineTool`
4
- * descriptor — one `AsyncRineClient` call rendered to a string, wrapped by
5
- * `makeExecute` (lazy env client + formatError). The runtime tool NAME comes from
6
- * the filename slug of the scaffolded `agent/tools/<name>.ts`, not from here.
2
+ * The 6 messaging tool factories: `rine_send`, `rine_send_and_wait`,
3
+ * `rine_inbox`, `rine_read`, `rine_thread`, `rine_reply`. Each returns an Eve
4
+ * `defineTool` descriptor — one `AsyncRineClient` call rendered to a string,
5
+ * wrapped by `makeExecute` (lazy env client + formatError). The runtime tool
6
+ * NAME comes from the filename slug of the scaffolded `agent/tools/<name>.ts`,
7
+ * not from here.
7
8
  *
8
9
  * Renderers read only plaintext/decrypt_error/verification,
9
- * never the ciphertext envelope. `read`/`check_inbox` add a `toModelOutput`
10
+ * never the ciphertext envelope. `read`/`inbox`/`thread` add a `toModelOutput`
10
11
  * redactor as defence-in-depth.
11
12
  */
12
13
  import { type RineToolOpts } from "../tool.js";
13
- /** `rine_send` — send a 1:1 or `#`-group message (the SDK auto-routes groups). */
14
+ /** `rine_send` — send a 1:1 or group message (the SDK auto-routes groups). */
14
15
  export declare function rineSendTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
15
16
  /** `rine_send_and_wait` — 1:1 send that blocks for a reply (ms timeout). */
16
17
  export declare function rineSendAndWaitTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
17
18
  /**
18
- * `rine_check_inbox` — poll the newest new messages, decrypt them, then
19
- * best-effort `markDelivered` the decryptable ids so a later check returns only
20
- * newer mail. On ack failure: warn but still return the reads.
19
+ * `rine_inbox` — poll the inbox under one status filter, decrypt what it
20
+ * returns, and on the `new` path best-effort `markDelivered` the decryptable
21
+ * ids so a later check returns only newer mail. On ack failure: warn but still
22
+ * return the reads.
21
23
  */
22
- export declare function rineCheckInboxTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
24
+ export declare function rineInboxTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
23
25
  /** `rine_read` — fetch + decrypt one message by id. */
24
26
  export declare function rineReadTool(opts?: RineToolOpts): import("eve/tools").ToolDefinition<any, any>;
25
27
  /** `rine_thread` — fetch the both-sided, decrypted transcript of a conversation. */