@oneie/sdk 0.14.0 → 0.14.2
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 +81 -13
- package/README.md +3 -3
- package/dist/brain.d.ts +2 -0
- package/dist/brain.d.ts.map +1 -1
- package/dist/brain.js +8 -0
- package/dist/brain.js.map +1 -1
- package/dist/client.d.ts +46 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +67 -5
- package/dist/client.js.map +1 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +6 -3
- package/dist/compile.js.map +1 -1
- package/dist/errors.d.ts +8 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +16 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/fn-map.d.ts +15 -0
- package/dist/generated/fn-map.d.ts.map +1 -0
- package/dist/generated/fn-map.js +1170 -0
- package/dist/generated/fn-map.js.map +1 -0
- package/dist/generated/schemas/index.d.ts +241 -0
- package/dist/generated/schemas/index.d.ts.map +1 -0
- package/dist/generated/schemas/index.js +129 -0
- package/dist/generated/schemas/index.js.map +1 -0
- package/dist/generated/schemas.d.ts +804 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +643 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/skins/engineering.d.ts +37 -0
- package/dist/generated/skins/engineering.d.ts.map +1 -0
- package/dist/generated/skins/engineering.js +33 -0
- package/dist/generated/skins/engineering.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin-build.d.ts +18 -0
- package/dist/plugin-build.d.ts.map +1 -0
- package/dist/plugin-build.js +15 -0
- package/dist/plugin-build.js.map +1 -0
- package/dist/receivers.d.ts +316 -10
- package/dist/receivers.d.ts.map +1 -1
- package/dist/receivers.js +320 -3
- package/dist/receivers.js.map +1 -1
- package/dist/schemas.d.ts +2 -2
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +33 -2
- package/dist/templates.js.map +1 -1
- package/dist/trail.d.ts +25 -0
- package/dist/trail.d.ts.map +1 -0
- package/dist/trail.js +25 -0
- package/dist/trail.js.map +1 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -1
- package/package.json +10 -3
package/dist/receivers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AgentActionResponseSchema, AgentStatusResponseSchema, CapabilityItemSchema, PayResponseSchema, RegisterResponseSchema, StatsSchema, StepKind, WorkflowDiffSchema, } from "./schemas.js";
|
|
3
3
|
import { FieldSchema, ResourceTypeSchema } from "./types.js";
|
|
4
|
+
import { GroupEntitySchema } from "./generated/schemas/index.js";
|
|
4
5
|
/**
|
|
5
6
|
* Declare a receiver contract. Identity at runtime — its only job is to pin the
|
|
6
7
|
* `Req`/`Res` generics so the catalog infers payload + outcome types.
|
|
@@ -26,6 +27,42 @@ export const RECEIVERS = {
|
|
|
26
27
|
response: z.object({ ok: z.literal(true), actorId: z.string(), slug: z.string(), apiKey: z.string(), credits: z.number() }),
|
|
27
28
|
effect: "ask", auth: "public", reversible: false, idempotent: false,
|
|
28
29
|
}),
|
|
30
|
+
"agent:own-link": receiver({
|
|
31
|
+
receiver: "agent:own-link",
|
|
32
|
+
summary: "Generate a signed ownership invitation link for a registered agent; optionally deliver it as a native button on Telegram or Discord",
|
|
33
|
+
request: z.object({
|
|
34
|
+
agent_id: z.string().describe("The agent's actor ID (aid from world_actors / actorId from auth.md registration)"),
|
|
35
|
+
channel_group: z.string().optional().describe("Optional delivery channel: tg-<chat_id> / dc-<channel_id> / web-<group>"),
|
|
36
|
+
workspace: z.string().optional().describe("Workspace slug for credential lookup when channel_group is set"),
|
|
37
|
+
}),
|
|
38
|
+
response: z.object({
|
|
39
|
+
ok: z.literal(true),
|
|
40
|
+
adopt_url: z.string(),
|
|
41
|
+
expires_in: z.number(),
|
|
42
|
+
agent_id: z.string(),
|
|
43
|
+
delivered: z.boolean().optional(),
|
|
44
|
+
}),
|
|
45
|
+
effect: "ask", auth: "owner", reversible: false, idempotent: false,
|
|
46
|
+
}),
|
|
47
|
+
"agent:provision": receiver({
|
|
48
|
+
receiver: "agent:provision",
|
|
49
|
+
summary: "Zero-to-live in one unauthenticated call — register + workspace + publish agent + import skills + invite owner",
|
|
50
|
+
request: z.object({
|
|
51
|
+
name: z.string().optional(),
|
|
52
|
+
agentName: z.string().optional(),
|
|
53
|
+
content: z.string().optional(),
|
|
54
|
+
skills: z.array(z.string()).optional(),
|
|
55
|
+
invite: z.object({ email: z.string().email().optional(), role: z.string().optional() }).optional(),
|
|
56
|
+
live: z.boolean().optional(),
|
|
57
|
+
}),
|
|
58
|
+
response: z.object({
|
|
59
|
+
uid: z.string(),
|
|
60
|
+
workspace: z.string(),
|
|
61
|
+
apiKey: z.string(),
|
|
62
|
+
inviteUrl: z.string().optional(),
|
|
63
|
+
}),
|
|
64
|
+
effect: "ask", auth: "none", reversible: false, idempotent: false,
|
|
65
|
+
}),
|
|
29
66
|
"agent:bootstrap": receiver({
|
|
30
67
|
receiver: "agent:bootstrap",
|
|
31
68
|
summary: "Atomically provision a workspace + actor + scoped key; optionally invite an initial human owner",
|
|
@@ -168,7 +205,12 @@ export const RECEIVERS = {
|
|
|
168
205
|
"world:create-group": receiver({
|
|
169
206
|
receiver: "world:create-group",
|
|
170
207
|
summary: "Create a group in the caller's workspace",
|
|
171
|
-
request: z.object({
|
|
208
|
+
request: z.object({
|
|
209
|
+
name: z.string(),
|
|
210
|
+
// "group" is the D1 group_type for campaigns/collections; absent from the TypeDB enum
|
|
211
|
+
type: GroupEntitySchema.shape["group-type"].or(z.literal("group")),
|
|
212
|
+
tags: z.array(z.string()).optional(),
|
|
213
|
+
}),
|
|
172
214
|
response: z.object({ gid: z.string() }), effect: "ask", auth: "manage_groups",
|
|
173
215
|
}),
|
|
174
216
|
"world:update-group": receiver({
|
|
@@ -409,6 +451,33 @@ export const RECEIVERS = {
|
|
|
409
451
|
response: z.object({ outcome: z.literal("granted"), id: z.string(), grantee: z.string(), scope: z.string() }),
|
|
410
452
|
effect: "ask", auth: "mint_capability", reversible: false,
|
|
411
453
|
}),
|
|
454
|
+
// ── model router (C3/C4 — do-metabolism) ──
|
|
455
|
+
"world:pick-model": receiver({
|
|
456
|
+
receiver: "world:pick-model",
|
|
457
|
+
summary: "Return the best proven model for a task shape (warmed/cold/toxic-escalate/fallback-unreachable)",
|
|
458
|
+
request: z.object({ shape: z.string().min(1) }),
|
|
459
|
+
response: z.object({
|
|
460
|
+
ok: z.boolean(),
|
|
461
|
+
model: z.string().optional(),
|
|
462
|
+
effort: z.string().optional(),
|
|
463
|
+
reason: z.enum(['warmed', 'cold', 'toxic-escalate', 'fallback-unreachable']).optional(),
|
|
464
|
+
}),
|
|
465
|
+
effect: "ask", auth: "none", reversible: true,
|
|
466
|
+
}),
|
|
467
|
+
"world:seed-router": receiver({
|
|
468
|
+
receiver: "world:seed-router",
|
|
469
|
+
summary: "Seed initial shape→model capability rows (platform-gated, idempotent)",
|
|
470
|
+
request: z.object({ shapes: z.array(z.string()).optional() }),
|
|
471
|
+
response: z.object({ ok: z.boolean(), seeded: z.number().optional() }),
|
|
472
|
+
effect: "ask", auth: "platform", reversible: true,
|
|
473
|
+
}),
|
|
474
|
+
"attention:follow": receiver({
|
|
475
|
+
receiver: "attention:follow",
|
|
476
|
+
summary: "Subscribe to a do-event axis; writes ws-scoped mark so fan-out stays tenant-isolated",
|
|
477
|
+
request: z.object({ axis: z.string().min(1) }),
|
|
478
|
+
response: z.object({ ok: z.boolean(), target: z.string().optional() }),
|
|
479
|
+
effect: "ask", auth: "session", reversible: true,
|
|
480
|
+
}),
|
|
412
481
|
// ════════════════════════════════════════════════════════════════════════
|
|
413
482
|
// C4 — remaining families (sequenced by recipe: identity → groups → BUILD
|
|
414
483
|
// → TRADE → TRANSACT → reads). Request schemas mirror the exact client.ts
|
|
@@ -492,6 +561,41 @@ export const RECEIVERS = {
|
|
|
492
561
|
response: ok,
|
|
493
562
|
effect: "signal", idempotent: true,
|
|
494
563
|
}),
|
|
564
|
+
"world:announce": receiver({
|
|
565
|
+
receiver: "world:announce",
|
|
566
|
+
summary: "Broadcast a tagged signal; the world fans it to every subscriber whose follow-tags intersect",
|
|
567
|
+
request: z.object({
|
|
568
|
+
tags: z.array(z.string()),
|
|
569
|
+
content: z.string().optional(),
|
|
570
|
+
}),
|
|
571
|
+
response: z.object({ ok: z.boolean(), matched: z.number().optional(), actors: z.array(z.string()).optional() }),
|
|
572
|
+
effect: "ask",
|
|
573
|
+
}),
|
|
574
|
+
"tasks:announce": receiver({
|
|
575
|
+
receiver: "tasks:announce",
|
|
576
|
+
summary: "Announce a task into the world by its tags — the first caller of world:announce",
|
|
577
|
+
request: z.object({
|
|
578
|
+
taskId: z.string(),
|
|
579
|
+
tags: z.array(z.string()),
|
|
580
|
+
}),
|
|
581
|
+
response: z.object({ ok: z.boolean(), taskId: z.string().optional(), matched: z.number().optional(), actors: z.array(z.string()).optional() }),
|
|
582
|
+
effect: "ask",
|
|
583
|
+
}),
|
|
584
|
+
"tasks:mine": receiver({
|
|
585
|
+
receiver: "tasks:mine",
|
|
586
|
+
summary: "My work queue: the open tasks whose words match what I subscribed to, ranked by learned weight (context-strength), not static priority",
|
|
587
|
+
request: z.object({ limit: z.number().optional() }),
|
|
588
|
+
response: z.object({
|
|
589
|
+
ok: z.boolean(),
|
|
590
|
+
tasks: z.array(z.object({
|
|
591
|
+
id: z.string(),
|
|
592
|
+
name: z.string(),
|
|
593
|
+
tags: z.array(z.string()),
|
|
594
|
+
weight: z.number(),
|
|
595
|
+
})),
|
|
596
|
+
}),
|
|
597
|
+
effect: "ask", idempotent: true,
|
|
598
|
+
}),
|
|
495
599
|
// ── agents (TRADE / lifecycle) ──
|
|
496
600
|
"agents:register": receiver({
|
|
497
601
|
receiver: "agents:register",
|
|
@@ -543,6 +647,22 @@ export const RECEIVERS = {
|
|
|
543
647
|
response: PayResponseSchema,
|
|
544
648
|
effect: "ask", cost: "variable", settles: "onchain", reversible: false, simulatable: true,
|
|
545
649
|
}),
|
|
650
|
+
"tasks:stake": receiver({
|
|
651
|
+
receiver: "tasks:stake",
|
|
652
|
+
summary: "Stake SUI against a task on-chain to raise its priority weight. 0.1 SUI = +1 weight unit. Irreversible — conviction signal, not a deposit.",
|
|
653
|
+
request: z.object({
|
|
654
|
+
taskObjectId: z.string().regex(/^0x[a-fA-F0-9]{64}$/, "Sui object ID"),
|
|
655
|
+
units: z.number().int().positive().default(1),
|
|
656
|
+
}),
|
|
657
|
+
response: z.object({
|
|
658
|
+
ok: z.boolean(),
|
|
659
|
+
digest: z.string().optional(),
|
|
660
|
+
weightBefore: z.number().optional(),
|
|
661
|
+
weightAfter: z.number().optional(),
|
|
662
|
+
suiSpent: z.number().optional(),
|
|
663
|
+
}),
|
|
664
|
+
effect: "ask", cost: "variable", settles: "onchain", reversible: false, simulatable: false,
|
|
665
|
+
}),
|
|
546
666
|
// ── market (A2A negotiation, C2) ──
|
|
547
667
|
"market:offer": receiver({
|
|
548
668
|
receiver: "market:offer",
|
|
@@ -808,6 +928,22 @@ export const RECEIVERS = {
|
|
|
808
928
|
}),
|
|
809
929
|
effect: "ask", cost: "free", idempotent: true,
|
|
810
930
|
}),
|
|
931
|
+
"meta:reputation": receiver({
|
|
932
|
+
receiver: "meta:reputation",
|
|
933
|
+
summary: "Read an actor's reputation score — weighted commend/flag balance from claw_paths + vote counts from reputation_votes",
|
|
934
|
+
request: z.object({ uid: z.string().describe("The actor's slug or aid to look up") }),
|
|
935
|
+
response: z.object({
|
|
936
|
+
uid: z.string(),
|
|
937
|
+
score: z.number().describe("Normalised 0–1 float: strength / (strength + resistance)"),
|
|
938
|
+
commend_count: z.number(),
|
|
939
|
+
flag_count: z.number(),
|
|
940
|
+
strength: z.number(),
|
|
941
|
+
resistance: z.number(),
|
|
942
|
+
why: z.array(z.string()).describe("Plain-English summary of the score"),
|
|
943
|
+
howToRaise: z.array(z.string()).describe("Actionable hints for improving score"),
|
|
944
|
+
}),
|
|
945
|
+
effect: "ask", cost: "free", idempotent: true,
|
|
946
|
+
}),
|
|
811
947
|
"meta:types": receiver({
|
|
812
948
|
receiver: "meta:types",
|
|
813
949
|
summary: "Read the resource-type manifest for the caller's workspace, plus the built-in industry templates",
|
|
@@ -833,6 +969,35 @@ export const RECEIVERS = {
|
|
|
833
969
|
effect: "ask", cost: "free", idempotent: true,
|
|
834
970
|
examples: [{ feature: "premium" }],
|
|
835
971
|
}),
|
|
972
|
+
"plugins:list": receiver({
|
|
973
|
+
receiver: "plugins:list",
|
|
974
|
+
summary: "List all available ONE plugins with their feature key, price, and description",
|
|
975
|
+
request: z.object({}),
|
|
976
|
+
response: z.object({
|
|
977
|
+
plugins: z.array(z.object({
|
|
978
|
+
name: z.string(),
|
|
979
|
+
feature: z.string(),
|
|
980
|
+
title: z.string(),
|
|
981
|
+
description: z.string(),
|
|
982
|
+
price_usd: z.number(),
|
|
983
|
+
})),
|
|
984
|
+
}),
|
|
985
|
+
effect: "ask", cost: "free", idempotent: true,
|
|
986
|
+
examples: [{}],
|
|
987
|
+
}),
|
|
988
|
+
"plugins:source": receiver({
|
|
989
|
+
receiver: "plugins:source",
|
|
990
|
+
summary: "Get the install reference for a plugin — 402 when the workspace is not entitled. Use meta:entitlements to check first; this doubles as the delivery gate.",
|
|
991
|
+
request: z.object({ feature: z.string() }),
|
|
992
|
+
response: z.object({
|
|
993
|
+
plugin: z.string(),
|
|
994
|
+
source: z.string(),
|
|
995
|
+
version: z.string(),
|
|
996
|
+
install: z.string(),
|
|
997
|
+
}),
|
|
998
|
+
effect: "ask", cost: "free", idempotent: true,
|
|
999
|
+
examples: [{ feature: "shop" }],
|
|
1000
|
+
}),
|
|
836
1001
|
// ── actor discovery + messaging ──────────────────────────────────────────
|
|
837
1002
|
"actors:find": receiver({
|
|
838
1003
|
receiver: "actors:find",
|
|
@@ -1294,6 +1459,13 @@ export const RECEIVERS = {
|
|
|
1294
1459
|
response: z.object({ products: z.array(z.record(z.string(), z.unknown())).optional(), error: z.string().optional() }),
|
|
1295
1460
|
effect: "ask", cost: "free", reversible: true, idempotent: true, auth: "public",
|
|
1296
1461
|
}),
|
|
1462
|
+
"products:get": receiver({
|
|
1463
|
+
receiver: "products:get",
|
|
1464
|
+
summary: "Get one storefront product with its prices (public, active-only) — the single-record read a data-bound page block resolves through",
|
|
1465
|
+
request: z.object({ slug: z.string(), pid: z.string() }),
|
|
1466
|
+
response: z.object({ product: z.record(z.string(), z.unknown()).nullable().optional(), error: z.string().optional() }),
|
|
1467
|
+
effect: "ask", cost: "free", reversible: true, idempotent: true, auth: "public",
|
|
1468
|
+
}),
|
|
1297
1469
|
"products:archive": receiver({
|
|
1298
1470
|
receiver: "products:archive",
|
|
1299
1471
|
summary: "Archive a product (reversible via products:update)",
|
|
@@ -1319,14 +1491,14 @@ export const RECEIVERS = {
|
|
|
1319
1491
|
"pages:create": receiver({
|
|
1320
1492
|
receiver: "pages:create",
|
|
1321
1493
|
summary: "Create a workspace page (draft) from a title + sections",
|
|
1322
|
-
request: z.object({ slug: z.string(), title: z.string(), sections: z.record(z.string(), z.unknown()), pageSlug: z.string().optional() }),
|
|
1494
|
+
request: z.object({ slug: z.string(), title: z.string(), sections: z.array(z.object({ component: z.string(), props: z.record(z.string(), z.unknown()) })), pageSlug: z.string().optional() }),
|
|
1323
1495
|
response: z.object({ ok: z.boolean(), slug: z.string().optional(), title: z.string().optional(), url: z.string().optional(), status: z.string().optional(), error: z.string().optional() }),
|
|
1324
1496
|
effect: "ask", cost: "free", reversible: true, idempotent: false, auth: "member",
|
|
1325
1497
|
}),
|
|
1326
1498
|
"pages:edit": receiver({
|
|
1327
1499
|
receiver: "pages:edit",
|
|
1328
1500
|
summary: "Edit a workspace page's title or sections",
|
|
1329
|
-
request: z.object({ slug: z.string(), page: z.string(), title: z.string().optional(), sections: z.record(z.string(), z.unknown()).optional() }),
|
|
1501
|
+
request: z.object({ slug: z.string(), page: z.string(), title: z.string().optional(), sections: z.array(z.object({ component: z.string(), props: z.record(z.string(), z.unknown()) })).optional() }),
|
|
1330
1502
|
response: z.object({ ok: z.boolean(), slug: z.string().optional(), title: z.string().optional(), url: z.string().optional(), status: z.string().optional(), error: z.string().optional() }),
|
|
1331
1503
|
effect: "ask", cost: "free", reversible: true, idempotent: false, auth: "member",
|
|
1332
1504
|
}),
|
|
@@ -1344,6 +1516,20 @@ export const RECEIVERS = {
|
|
|
1344
1516
|
response: z.object({ ok: z.boolean(), slug: z.string().optional(), title: z.string().optional(), url: z.string().optional(), status: z.string().optional(), error: z.string().optional() }),
|
|
1345
1517
|
effect: "ask", cost: "free", reversible: true, idempotent: true, auth: "member",
|
|
1346
1518
|
}),
|
|
1519
|
+
"pages:versions": receiver({
|
|
1520
|
+
receiver: "pages:versions",
|
|
1521
|
+
summary: "List a page's saved version snapshots, newest first",
|
|
1522
|
+
request: z.object({ slug: z.string(), page: z.string() }),
|
|
1523
|
+
response: z.object({ ok: z.boolean(), slug: z.string().optional(), versions: z.array(z.object({ ts: z.number(), bytes: z.number(), key: z.string() })).optional(), error: z.string().optional() }),
|
|
1524
|
+
effect: "ask", cost: "free", reversible: true, idempotent: true, auth: "member",
|
|
1525
|
+
}),
|
|
1526
|
+
"pages:restore": receiver({
|
|
1527
|
+
receiver: "pages:restore",
|
|
1528
|
+
summary: "Restore a page to a prior version snapshot (snapshots current state first)",
|
|
1529
|
+
request: z.object({ slug: z.string(), page: z.string(), ts: z.number() }),
|
|
1530
|
+
response: z.object({ ok: z.boolean(), slug: z.string().optional(), title: z.string().optional(), url: z.string().optional(), status: z.string().optional(), restoredTs: z.number().optional(), error: z.string().optional() }),
|
|
1531
|
+
effect: "ask", cost: "free", reversible: false, idempotent: false, auth: "member",
|
|
1532
|
+
}),
|
|
1347
1533
|
"settings:write": receiver({
|
|
1348
1534
|
receiver: "settings:write",
|
|
1349
1535
|
summary: "Write a workspace setting value (caller or authorized descendant)",
|
|
@@ -1703,6 +1889,27 @@ export const RECEIVERS = {
|
|
|
1703
1889
|
auth: "manage_workflows",
|
|
1704
1890
|
examples: [{ workflowId: "wf_abc" }],
|
|
1705
1891
|
}),
|
|
1892
|
+
"build:run": receiver({
|
|
1893
|
+
receiver: "build:run",
|
|
1894
|
+
summary: "Start a build cycle — gates on credits (funding-of), spawns the BuildRun DO, runs the stub W1 wave, returns a runId",
|
|
1895
|
+
request: z.object({
|
|
1896
|
+
goal: z.string(),
|
|
1897
|
+
mode: z.enum(["local", "remote"]).optional(),
|
|
1898
|
+
idempotencyKey: z.string().optional(),
|
|
1899
|
+
}),
|
|
1900
|
+
response: z.object({ runId: z.string(), status: z.string(), error: z.string().optional() }),
|
|
1901
|
+
effect: "ask", cost: "variable", reversible: false, idempotent: true, simulatable: false, settles: "none",
|
|
1902
|
+
auth: "manage_workflows",
|
|
1903
|
+
examples: [{ goal: "add a health endpoint", mode: "local" }],
|
|
1904
|
+
}),
|
|
1905
|
+
"build:resume": receiver({
|
|
1906
|
+
receiver: "build:resume",
|
|
1907
|
+
summary: "Advance a parked build run by one wave — re-validates the run against the caller's workspace",
|
|
1908
|
+
request: z.object({ runId: z.string() }),
|
|
1909
|
+
response: z.object({ ok: z.boolean(), status: z.string().optional(), error: z.string().optional() }),
|
|
1910
|
+
effect: "ask", cost: "free", idempotent: true, simulatable: false, auth: "manage_workflows",
|
|
1911
|
+
examples: [{ runId: "run_1" }],
|
|
1912
|
+
}),
|
|
1706
1913
|
"human:resolve": receiver({
|
|
1707
1914
|
receiver: "human:resolve",
|
|
1708
1915
|
summary: "Resolve a suspended human step — carries { runId, stepId, decision | formPayload } to the run DO",
|
|
@@ -2213,6 +2420,114 @@ export const RECEIVERS = {
|
|
|
2213
2420
|
response: z.object({ ok: z.boolean() }),
|
|
2214
2421
|
effect: "signal", cost: "variable", reversible: false, idempotent: false, auth: "write",
|
|
2215
2422
|
}),
|
|
2423
|
+
// ── Send Link — actor-bound tracked URL (CRM personalisation) ──────────────
|
|
2424
|
+
"links:create": receiver({
|
|
2425
|
+
receiver: "links:create",
|
|
2426
|
+
summary: "Create an actor-bound tracked link. On click `/go/:id` elevates the contact to rung-4 identity, pre-warms their snapshot, and personalises the page + chat. Creation is gated: the caller must hold authority over the target contact's workspace; `createdBy` is stamped from the attested session, never the body.",
|
|
2427
|
+
request: z.object({
|
|
2428
|
+
actorId: z.string().describe("Contact (actor) the link is bound to — must belong to the caller's workspace or a descendant"),
|
|
2429
|
+
destination: z.string().optional().describe("Path the click lands on (must start with '/'); default '/'"),
|
|
2430
|
+
context: z.string().optional().describe("Extra context injected into the agent's system prompt for this session"),
|
|
2431
|
+
greeting: z.string().optional().describe("Override the chat agent's opening line"),
|
|
2432
|
+
campaignId: z.string().optional().describe("Group clicks under a campaign for the learning loop"),
|
|
2433
|
+
expiresInDays: z.number().optional().describe("Link TTL in days; omitted = never expires"),
|
|
2434
|
+
}),
|
|
2435
|
+
response: z.object({ id: z.string(), sig: z.string(), url: z.string() }),
|
|
2436
|
+
effect: "ask", cost: "free", reversible: false, idempotent: false, auth: "member",
|
|
2437
|
+
examples: [{ actorId: "u-123", destination: "/pricing", expiresInDays: 90 }],
|
|
2438
|
+
}),
|
|
2439
|
+
"links:bulk-create": receiver({
|
|
2440
|
+
receiver: "links:bulk-create",
|
|
2441
|
+
summary: "Create one actor-bound tracked link per contact for a selected segment (the segment-campaign send). Authority is walked PER contact — any the caller can't reach is skipped (counted in `denied`), never failing the batch. Capped at 200.",
|
|
2442
|
+
request: z.object({
|
|
2443
|
+
actorIds: z.array(z.string()).min(1).max(200).describe("Contacts to mint a link for — each must belong to the caller's workspace or a descendant"),
|
|
2444
|
+
destination: z.string().optional().describe("Shared destination path (must start with '/'); default '/'"),
|
|
2445
|
+
campaignId: z.string().optional().describe("Group all clicks under one campaign for the learning loop"),
|
|
2446
|
+
expiresInDays: z.number().optional(),
|
|
2447
|
+
}),
|
|
2448
|
+
response: z.object({
|
|
2449
|
+
ok: z.boolean(),
|
|
2450
|
+
created: z.number().optional(),
|
|
2451
|
+
denied: z.number().optional(),
|
|
2452
|
+
links: z.array(z.object({ actorId: z.string(), url: z.string() })).optional(),
|
|
2453
|
+
error: z.string().optional(),
|
|
2454
|
+
}),
|
|
2455
|
+
effect: "ask", cost: "free", reversible: false, idempotent: false, auth: "member",
|
|
2456
|
+
examples: [{ actorIds: ["u-1", "u-2"], destination: "/launch", campaignId: "q3" }],
|
|
2457
|
+
}),
|
|
2458
|
+
// ── fn: family — typed substrate function calls (C5) ──────────────────────
|
|
2459
|
+
"fn:run": receiver({
|
|
2460
|
+
receiver: "fn:run",
|
|
2461
|
+
summary: "Execute an allowlisted TypeDB function by name. Returns the function's result rows. Not public — caller must be authenticated; the resolver re-walks authority before executing.",
|
|
2462
|
+
request: z.object({
|
|
2463
|
+
fn: z.string().describe("Function name from FN_MAP (e.g. 'optimal_route', 'actionable_hypotheses')"),
|
|
2464
|
+
args: z.record(z.string(), z.unknown()).optional().describe("Named arguments matching the function's param list"),
|
|
2465
|
+
workspace: z.string().optional().describe("Workspace slug for authority context"),
|
|
2466
|
+
}),
|
|
2467
|
+
response: z.object({
|
|
2468
|
+
ok: z.boolean(),
|
|
2469
|
+
fn: z.string(),
|
|
2470
|
+
rows: z.array(z.record(z.string(), z.unknown())),
|
|
2471
|
+
error: z.string().optional(),
|
|
2472
|
+
}),
|
|
2473
|
+
effect: "ask", cost: "variable", reversible: false, idempotent: true, auth: "member",
|
|
2474
|
+
examples: [{ fn: "optimal_route", args: { $from: "actor-123", $skill: "writing" }, workspace: "acme" }],
|
|
2475
|
+
}),
|
|
2476
|
+
// ── rag: family — OO-Brain hybrid vector+BM25 search ──────────────────────
|
|
2477
|
+
"rag:search": receiver({
|
|
2478
|
+
receiver: "rag:search",
|
|
2479
|
+
summary: "Search the OO-Brain knowledge corpus (Supabase pgvector). Hybrid retrieval: vector cosine + tsvector BM25 fused with RRF. Returns top-k chunks + a query_id. Always follow with rag:mark to close the quality loop.",
|
|
2480
|
+
request: z.object({
|
|
2481
|
+
query: z.string().describe("Natural-language query. Full sentence beats keywords."),
|
|
2482
|
+
k: z.number().int().min(1).max(20).optional().default(5).describe("Chunks to return (1–20, default 5)."),
|
|
2483
|
+
corpus: z.string().optional().default("@oo-brain").describe("Which imported brain (@-pointer, e.g. '@oo-brain'). Authority-walked against your workspace; omit for the platform default."),
|
|
2484
|
+
vault: z.enum(["oo-brain", "agency-operator", "personal-brain", "all"]).optional().default("all"),
|
|
2485
|
+
filter_path_prefix: z.string().optional(),
|
|
2486
|
+
filter_tags: z.array(z.string()).optional(),
|
|
2487
|
+
}),
|
|
2488
|
+
response: z.object({
|
|
2489
|
+
ok: z.boolean(),
|
|
2490
|
+
query_id: z.string().nullable().describe("UUID to pass to rag:mark. Null when no chunks matched."),
|
|
2491
|
+
chunks: z.array(z.object({
|
|
2492
|
+
id: z.string().optional(),
|
|
2493
|
+
vault_name: z.string(),
|
|
2494
|
+
file_path: z.string(),
|
|
2495
|
+
chunk_content: z.string(),
|
|
2496
|
+
contextual_blurb: z.string().optional(),
|
|
2497
|
+
rrf_score: z.number().optional(),
|
|
2498
|
+
frontmatter: z.record(z.string(), z.unknown()).optional(),
|
|
2499
|
+
})),
|
|
2500
|
+
query: z.string(),
|
|
2501
|
+
vault: z.string(),
|
|
2502
|
+
}),
|
|
2503
|
+
effect: "ask", auth: "read_corpus", cost: { fixed: 1 }, reversible: false, idempotent: true,
|
|
2504
|
+
}),
|
|
2505
|
+
"rag:list": receiver({
|
|
2506
|
+
receiver: "rag:list",
|
|
2507
|
+
summary: "List the knowledge corpora you may search (@-pointers), resolved by the workspace authority walk. The platform corpus @oo-brain is always included.",
|
|
2508
|
+
request: z.object({}),
|
|
2509
|
+
response: z.object({
|
|
2510
|
+
ok: z.boolean(),
|
|
2511
|
+
corpora: z.array(z.string()).describe("@-pointers the caller may read, e.g. ['@oo-brain']."),
|
|
2512
|
+
}),
|
|
2513
|
+
effect: "ask", auth: "read_corpus", cost: "free", reversible: false, idempotent: true,
|
|
2514
|
+
}),
|
|
2515
|
+
"rag:mark": receiver({
|
|
2516
|
+
receiver: "rag:mark",
|
|
2517
|
+
summary: "Close the quality loop on a rag:search call. Call before the turn ends. 'mark' = chunks helped; 'warn' = chunks didn't help; 'unsure' = can't assess.",
|
|
2518
|
+
request: z.object({
|
|
2519
|
+
query_id: z.string().uuid(),
|
|
2520
|
+
outcome: z.enum(["mark", "warn", "unsure"]),
|
|
2521
|
+
notes: z.string().optional(),
|
|
2522
|
+
corpus: z.string().optional().default("@oo-brain").describe("The corpus the query_id belongs to (@-pointer). Authority-walked; omit for the platform default."),
|
|
2523
|
+
}),
|
|
2524
|
+
response: z.object({
|
|
2525
|
+
ok: z.boolean(),
|
|
2526
|
+
query_id: z.string(),
|
|
2527
|
+
outcome: z.string(),
|
|
2528
|
+
}),
|
|
2529
|
+
effect: "signal", auth: "read_corpus", cost: "free", reversible: false, idempotent: false,
|
|
2530
|
+
}),
|
|
2216
2531
|
};
|
|
2217
2532
|
/**
|
|
2218
2533
|
* RECIPES — the four agent journeys as typed, ordered receiver sequences (C6).
|
|
@@ -2231,5 +2546,7 @@ export const RECIPES = {
|
|
|
2231
2546
|
transact: ["market:bounty", "pay:weight"],
|
|
2232
2547
|
/** SOP: define a workflow → shape it with a diff → run it. */
|
|
2233
2548
|
sop: ["workflow:create", "workflow:apply-diff", "workflow:run"],
|
|
2549
|
+
/** A2A: negotiate a deal → escrow → deliver → verify → settle (or dispute + refund). */
|
|
2550
|
+
a2a: ["market:offer", "market:counter", "market:accept", "market:escrow", "market:deliver", "market:verify", "market:settle", "market:dispute"],
|
|
2234
2551
|
};
|
|
2235
2552
|
//# sourceMappingURL=receivers.js.map
|