@rine-network/mastra 0.3.0 → 0.6.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/AGENTS.md +12 -11
- package/MASTRA.md +85 -58
- package/README.md +20 -9
- package/dist/_zod.d.ts +2 -2
- package/dist/client.d.ts +6 -4
- package/dist/context.d.ts +4 -3
- package/dist/discovery.d.ts +9 -3
- package/dist/drivers.d.ts +5 -4
- package/dist/errors.d.ts +12 -5
- package/dist/format-groups-list.d.ts +143 -0
- package/dist/format-groups.d.ts +81 -0
- package/dist/format.d.ts +56 -18
- package/dist/groups-admin.d.ts +25 -0
- package/dist/groups-admission.d.ts +56 -0
- package/dist/groups-list.d.ts +21 -0
- package/dist/groups-resolve.d.ts +81 -0
- package/dist/groups.d.ts +28 -14
- package/dist/inbound.d.ts +15 -7
- package/dist/index.d.ts +11 -9
- package/dist/index.js +0 -0
- package/dist/lifecycle.d.ts +11 -9
- package/dist/messaging.d.ts +14 -12
- package/dist/onboard.d.ts +3 -3
- package/dist/onboard.js +5 -5
- package/dist/payments.d.ts +2 -2
- package/dist/schemas-discovery.d.ts +46 -0
- package/dist/schemas-groups-list.d.ts +29 -0
- package/dist/schemas-groups.d.ts +98 -12
- package/dist/schemas-payments.d.ts +2 -1
- package/dist/schemas.d.ts +28 -34
- package/dist/threadmap.d.ts +2 -2
- package/dist/tool.d.ts +15 -12
- package/dist/tools.d.ts +6 -5
- package/dist/types.d.ts +3 -1
- package/package.json +3 -3
package/dist/tool.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared `createTool` plumbing every rine tool reuses (no duplicated logic):
|
|
3
|
-
* identity injection (
|
|
4
|
-
* try/catch → `formatError` wrapper
|
|
3
|
+
* identity injection (a lazily built client, and no credentials in any
|
|
4
|
+
* model-visible schema) and the try/catch → `formatError` wrapper that turns
|
|
5
|
+
* every error into a readable string instead of a rejected promise.
|
|
5
6
|
*
|
|
6
7
|
* A tool's per-tool body is just `(client, inputData) => string`; this helper
|
|
7
8
|
* supplies the surrounding contract:
|
|
8
9
|
* 1. read the acting agent + config-dir/api-url overrides from
|
|
9
10
|
* `ctx.requestContext` (NEVER `inputSchema`), falling back to the
|
|
10
11
|
* `rineToolkit(opts)` overrides closed over at factory time,
|
|
11
|
-
* 2. lazily build/get the shared `AsyncRineClient` (
|
|
12
|
+
* 2. lazily build/get the shared `AsyncRineClient` (first call only, so that
|
|
13
|
+
* importing the package builds nothing),
|
|
12
14
|
* 3. run the body, and on any thrown SDK error return `formatError(err)` so
|
|
13
|
-
* the tool RESOLVES a readable string and never rejects
|
|
15
|
+
* the tool RESOLVES a readable string and never rejects.
|
|
14
16
|
*
|
|
15
17
|
* `createTool` from `@mastra/core/tools` is invoked by each domain module; this
|
|
16
18
|
* file only builds the `execute` closure and the shared option/ctx types.
|
|
@@ -22,11 +24,11 @@ import { type RineToolContext } from "./context.js";
|
|
|
22
24
|
/**
|
|
23
25
|
* Per-factory overrides threaded from `rineToolkit(opts)` / an individual
|
|
24
26
|
* `createRine<X>Tool(opts)` call. A live `client` may be passed so every tool in
|
|
25
|
-
* one `rineToolkit(...)` call shares ONE lazily-built client
|
|
27
|
+
* one `rineToolkit(...)` call shares ONE lazily-built client; when
|
|
26
28
|
* omitted, each tool resolves its own client lazily on first `execute`.
|
|
27
29
|
*/
|
|
28
30
|
export interface RineToolOpts extends RineClientOpts {
|
|
29
|
-
/** A shared client to reuse
|
|
31
|
+
/** A shared client to reuse, set by `rineToolkit` so all its tools share one. */
|
|
30
32
|
client?: AsyncRineClient;
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
@@ -38,7 +40,7 @@ export interface RineToolOpts extends RineClientOpts {
|
|
|
38
40
|
*/
|
|
39
41
|
export interface RinePaymentToolOpts extends RineToolOpts {
|
|
40
42
|
/**
|
|
41
|
-
*
|
|
43
|
+
* Auto-pay default (default OFF). When true, `rine_pay` defaults to paying
|
|
42
44
|
* ONLY quotes at/below the policy's `autoPayThreshold`; a per-call `autoPay`
|
|
43
45
|
* input still overrides it. Caps + deny-by-default + reserve-lock bound it
|
|
44
46
|
* regardless.
|
|
@@ -57,7 +59,7 @@ export interface RinePaymentToolOpts extends RineToolOpts {
|
|
|
57
59
|
* Resolve the effective `AsyncRineClient` for one `execute` call: prefer a
|
|
58
60
|
* shared client from the toolkit, else build one from the ctx-injected identity
|
|
59
61
|
* layered over the factory defaults. Lazy by construction — only runs inside
|
|
60
|
-
* `execute
|
|
62
|
+
* `execute`, never at import or in a factory body.
|
|
61
63
|
*/
|
|
62
64
|
export declare function resolveClient(opts: RineToolOpts, ctx: RineToolContext | undefined): AsyncRineClient;
|
|
63
65
|
/**
|
|
@@ -69,7 +71,7 @@ export declare function resolveClient(opts: RineToolOpts, ctx: RineToolContext |
|
|
|
69
71
|
export declare function resolveApiUrlFor(opts: RineToolOpts, ctx: RineToolContext | undefined): string;
|
|
70
72
|
/**
|
|
71
73
|
* The recipient union `client.send`/`sendAndWait` accept. The model supplies a
|
|
72
|
-
* free-form `to` string (a `name@org` handle, a `#
|
|
74
|
+
* free-form `to` string (a `name@org` handle, a `#logistics@acme.rine.network` handle, or a UUID);
|
|
73
75
|
* the SDK normalizes + validates it at runtime, so this brands the string once,
|
|
74
76
|
* in one documented place, rather than scattering casts.
|
|
75
77
|
*/
|
|
@@ -77,9 +79,10 @@ type Recipient = AgentHandle | AgentUuid | GroupHandle | GroupUuid;
|
|
|
77
79
|
/** Brand a model-supplied recipient string for the SDK send surface. */
|
|
78
80
|
export declare function asRecipient(to: string): Recipient;
|
|
79
81
|
/**
|
|
80
|
-
*
|
|
81
|
-
* `
|
|
82
|
-
*
|
|
82
|
+
* The third and last defence against ciphertext reaching the model: a
|
|
83
|
+
* belt-and-suspenders redactor for `read` / `inbox` / `thread`. The first two —
|
|
84
|
+
* plaintext-only renderers, and `outputSchema: z.string()` so no structured
|
|
85
|
+
* field can carry an envelope — already guarantee the `execute` return is a
|
|
83
86
|
* redacted string; this coerces ANY value to plain text content before it can
|
|
84
87
|
* reach the model, so even a regression that returned a richer object containing
|
|
85
88
|
* ciphertext could not surface it. Returns Mastra's default text-content shape.
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `rineToolkit(opts)` — the aggregator
|
|
2
|
+
* `rineToolkit(opts)` — the aggregator. Returns a plain keyed
|
|
3
3
|
* `Record<string, Tool>` (Mastra has no `BaseToolkit` class). The object KEY is
|
|
4
4
|
* the model-facing tool name, so each entry is keyed by its `id`
|
|
5
5
|
* (`toolName === id`). Drop the record straight into a Mastra `Agent`'s
|
|
6
6
|
* `tools: {}` map.
|
|
7
7
|
*
|
|
8
|
-
* `include` curates the surface: `"all"` (
|
|
8
|
+
* `include` curates the surface: `"all"` (25), one domain
|
|
9
9
|
* (`"messaging"`/`"discovery"`/`"groups"`/`"payments"`), or an array union of
|
|
10
10
|
* domains. The `"payments"` domain (`rine_pay`, `rine_fulfill`) moves funds —
|
|
11
|
-
* bounded by the on-disk spend policy (deny-by-default) and
|
|
11
|
+
* bounded by the on-disk spend policy (deny-by-default) and by auto-pay, OFF
|
|
12
|
+
* unless the toolkit turns it on.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* Shared client: ONE lazily-built `AsyncRineClient` is created per
|
|
14
15
|
* `rineToolkit(...)` call and threaded into every tool's `opts.client`, so all
|
|
15
16
|
* tools share a client (and the warm OAuth token cache). Per-acting-agent
|
|
16
17
|
* variants derive cheaply via `client.withAgent(...)` inside each `execute`.
|
|
@@ -28,7 +29,7 @@ export type RineToolDomain = "messaging" | "discovery" | "groups" | "payments";
|
|
|
28
29
|
* OFF, marker ON) and a facilitator is only needed to `rine_fulfill`.
|
|
29
30
|
*/
|
|
30
31
|
export interface RinePaymentsConfig {
|
|
31
|
-
/**
|
|
32
|
+
/** Auto-pay default (default OFF). See {@link RinePaymentToolOpts.autoPay}. */
|
|
32
33
|
autoPay?: RinePaymentToolOpts["autoPay"];
|
|
33
34
|
/** Facilitator for `rine_fulfill`. See {@link RinePaymentToolOpts.facilitator}. */
|
|
34
35
|
facilitator?: RinePaymentToolOpts["facilitator"];
|
package/dist/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* type-only re-derivations; runtime tool schemas are authored with the host
|
|
9
9
|
* `zod` in `schemas.ts`.
|
|
10
10
|
*/
|
|
11
|
-
import type { AgentProfileSchema, AgentSummarySchema, DecryptedMessageSchema, GroupReadSchema, InviteResultSchema, MessageReadSchema } from "@rine-network/sdk";
|
|
11
|
+
import type { AgentProfileSchema, AgentSummarySchema, DecryptedMessageSchema, GroupReadSchema, InviteResultSchema, JoinRequestReadSchema, MessageReadSchema, VoteResponseSchema } from "@rine-network/sdk";
|
|
12
12
|
/** Project a Zod schema's output type without importing the SDK's `z` instance. */
|
|
13
13
|
type Infer<S> = S extends {
|
|
14
14
|
_output: infer O;
|
|
@@ -19,4 +19,6 @@ export type GroupRead = Infer<typeof GroupReadSchema>;
|
|
|
19
19
|
export type InviteResult = Infer<typeof InviteResultSchema>;
|
|
20
20
|
export type AgentSummary = Infer<typeof AgentSummarySchema>;
|
|
21
21
|
export type AgentProfile = Infer<typeof AgentProfileSchema>;
|
|
22
|
+
export type JoinRequestRead = Infer<typeof JoinRequestReadSchema>;
|
|
23
|
+
export type VoteResponse = Infer<typeof VoteResponseSchema>;
|
|
22
24
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rine-network/mastra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Native Mastra.ai tools for the rine network \u2014 E2E-encrypted (HPKE 1:1, MLS groups, PQ-hybrid) agent-to-agent messaging, discovery, and coordination as createTool tools, a toolkit aggregator, a lifecycle bridge, a Tier-3 workflow-resume bridge, and a setup CLI.",
|
|
5
5
|
"author": "mmmbs <mmmbs@proton.me>",
|
|
6
6
|
"license": "EUPL-1.2",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@libsql/client": "^0.15.0",
|
|
45
|
-
"@rine-network/core": "^0.
|
|
46
|
-
"@rine-network/sdk": "^0.
|
|
45
|
+
"@rine-network/core": "^0.14.0",
|
|
46
|
+
"@rine-network/sdk": "^0.11.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@mastra/core": ">=1.0.0 <2.0.0",
|