@oneie/sdk 0.14.0 → 0.14.1
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 +299 -10
- package/dist/receivers.d.ts.map +1 -1
- package/dist/receivers.js +291 -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",
|
|
@@ -1294,6 +1430,13 @@ export const RECEIVERS = {
|
|
|
1294
1430
|
response: z.object({ products: z.array(z.record(z.string(), z.unknown())).optional(), error: z.string().optional() }),
|
|
1295
1431
|
effect: "ask", cost: "free", reversible: true, idempotent: true, auth: "public",
|
|
1296
1432
|
}),
|
|
1433
|
+
"products:get": receiver({
|
|
1434
|
+
receiver: "products:get",
|
|
1435
|
+
summary: "Get one storefront product with its prices (public, active-only) — the single-record read a data-bound page block resolves through",
|
|
1436
|
+
request: z.object({ slug: z.string(), pid: z.string() }),
|
|
1437
|
+
response: z.object({ product: z.record(z.string(), z.unknown()).nullable().optional(), error: z.string().optional() }),
|
|
1438
|
+
effect: "ask", cost: "free", reversible: true, idempotent: true, auth: "public",
|
|
1439
|
+
}),
|
|
1297
1440
|
"products:archive": receiver({
|
|
1298
1441
|
receiver: "products:archive",
|
|
1299
1442
|
summary: "Archive a product (reversible via products:update)",
|
|
@@ -1319,14 +1462,14 @@ export const RECEIVERS = {
|
|
|
1319
1462
|
"pages:create": receiver({
|
|
1320
1463
|
receiver: "pages:create",
|
|
1321
1464
|
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() }),
|
|
1465
|
+
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
1466
|
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
1467
|
effect: "ask", cost: "free", reversible: true, idempotent: false, auth: "member",
|
|
1325
1468
|
}),
|
|
1326
1469
|
"pages:edit": receiver({
|
|
1327
1470
|
receiver: "pages:edit",
|
|
1328
1471
|
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() }),
|
|
1472
|
+
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
1473
|
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
1474
|
effect: "ask", cost: "free", reversible: true, idempotent: false, auth: "member",
|
|
1332
1475
|
}),
|
|
@@ -1344,6 +1487,20 @@ export const RECEIVERS = {
|
|
|
1344
1487
|
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
1488
|
effect: "ask", cost: "free", reversible: true, idempotent: true, auth: "member",
|
|
1346
1489
|
}),
|
|
1490
|
+
"pages:versions": receiver({
|
|
1491
|
+
receiver: "pages:versions",
|
|
1492
|
+
summary: "List a page's saved version snapshots, newest first",
|
|
1493
|
+
request: z.object({ slug: z.string(), page: z.string() }),
|
|
1494
|
+
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() }),
|
|
1495
|
+
effect: "ask", cost: "free", reversible: true, idempotent: true, auth: "member",
|
|
1496
|
+
}),
|
|
1497
|
+
"pages:restore": receiver({
|
|
1498
|
+
receiver: "pages:restore",
|
|
1499
|
+
summary: "Restore a page to a prior version snapshot (snapshots current state first)",
|
|
1500
|
+
request: z.object({ slug: z.string(), page: z.string(), ts: z.number() }),
|
|
1501
|
+
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() }),
|
|
1502
|
+
effect: "ask", cost: "free", reversible: false, idempotent: false, auth: "member",
|
|
1503
|
+
}),
|
|
1347
1504
|
"settings:write": receiver({
|
|
1348
1505
|
receiver: "settings:write",
|
|
1349
1506
|
summary: "Write a workspace setting value (caller or authorized descendant)",
|
|
@@ -1703,6 +1860,27 @@ export const RECEIVERS = {
|
|
|
1703
1860
|
auth: "manage_workflows",
|
|
1704
1861
|
examples: [{ workflowId: "wf_abc" }],
|
|
1705
1862
|
}),
|
|
1863
|
+
"build:run": receiver({
|
|
1864
|
+
receiver: "build:run",
|
|
1865
|
+
summary: "Start a build cycle — gates on credits (funding-of), spawns the BuildRun DO, runs the stub W1 wave, returns a runId",
|
|
1866
|
+
request: z.object({
|
|
1867
|
+
goal: z.string(),
|
|
1868
|
+
mode: z.enum(["local", "remote"]).optional(),
|
|
1869
|
+
idempotencyKey: z.string().optional(),
|
|
1870
|
+
}),
|
|
1871
|
+
response: z.object({ runId: z.string(), status: z.string(), error: z.string().optional() }),
|
|
1872
|
+
effect: "ask", cost: "variable", reversible: false, idempotent: true, simulatable: false, settles: "none",
|
|
1873
|
+
auth: "manage_workflows",
|
|
1874
|
+
examples: [{ goal: "add a health endpoint", mode: "local" }],
|
|
1875
|
+
}),
|
|
1876
|
+
"build:resume": receiver({
|
|
1877
|
+
receiver: "build:resume",
|
|
1878
|
+
summary: "Advance a parked build run by one wave — re-validates the run against the caller's workspace",
|
|
1879
|
+
request: z.object({ runId: z.string() }),
|
|
1880
|
+
response: z.object({ ok: z.boolean(), status: z.string().optional(), error: z.string().optional() }),
|
|
1881
|
+
effect: "ask", cost: "free", idempotent: true, simulatable: false, auth: "manage_workflows",
|
|
1882
|
+
examples: [{ runId: "run_1" }],
|
|
1883
|
+
}),
|
|
1706
1884
|
"human:resolve": receiver({
|
|
1707
1885
|
receiver: "human:resolve",
|
|
1708
1886
|
summary: "Resolve a suspended human step — carries { runId, stepId, decision | formPayload } to the run DO",
|
|
@@ -2213,6 +2391,114 @@ export const RECEIVERS = {
|
|
|
2213
2391
|
response: z.object({ ok: z.boolean() }),
|
|
2214
2392
|
effect: "signal", cost: "variable", reversible: false, idempotent: false, auth: "write",
|
|
2215
2393
|
}),
|
|
2394
|
+
// ── Send Link — actor-bound tracked URL (CRM personalisation) ──────────────
|
|
2395
|
+
"links:create": receiver({
|
|
2396
|
+
receiver: "links:create",
|
|
2397
|
+
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.",
|
|
2398
|
+
request: z.object({
|
|
2399
|
+
actorId: z.string().describe("Contact (actor) the link is bound to — must belong to the caller's workspace or a descendant"),
|
|
2400
|
+
destination: z.string().optional().describe("Path the click lands on (must start with '/'); default '/'"),
|
|
2401
|
+
context: z.string().optional().describe("Extra context injected into the agent's system prompt for this session"),
|
|
2402
|
+
greeting: z.string().optional().describe("Override the chat agent's opening line"),
|
|
2403
|
+
campaignId: z.string().optional().describe("Group clicks under a campaign for the learning loop"),
|
|
2404
|
+
expiresInDays: z.number().optional().describe("Link TTL in days; omitted = never expires"),
|
|
2405
|
+
}),
|
|
2406
|
+
response: z.object({ id: z.string(), sig: z.string(), url: z.string() }),
|
|
2407
|
+
effect: "ask", cost: "free", reversible: false, idempotent: false, auth: "member",
|
|
2408
|
+
examples: [{ actorId: "u-123", destination: "/pricing", expiresInDays: 90 }],
|
|
2409
|
+
}),
|
|
2410
|
+
"links:bulk-create": receiver({
|
|
2411
|
+
receiver: "links:bulk-create",
|
|
2412
|
+
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.",
|
|
2413
|
+
request: z.object({
|
|
2414
|
+
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"),
|
|
2415
|
+
destination: z.string().optional().describe("Shared destination path (must start with '/'); default '/'"),
|
|
2416
|
+
campaignId: z.string().optional().describe("Group all clicks under one campaign for the learning loop"),
|
|
2417
|
+
expiresInDays: z.number().optional(),
|
|
2418
|
+
}),
|
|
2419
|
+
response: z.object({
|
|
2420
|
+
ok: z.boolean(),
|
|
2421
|
+
created: z.number().optional(),
|
|
2422
|
+
denied: z.number().optional(),
|
|
2423
|
+
links: z.array(z.object({ actorId: z.string(), url: z.string() })).optional(),
|
|
2424
|
+
error: z.string().optional(),
|
|
2425
|
+
}),
|
|
2426
|
+
effect: "ask", cost: "free", reversible: false, idempotent: false, auth: "member",
|
|
2427
|
+
examples: [{ actorIds: ["u-1", "u-2"], destination: "/launch", campaignId: "q3" }],
|
|
2428
|
+
}),
|
|
2429
|
+
// ── fn: family — typed substrate function calls (C5) ──────────────────────
|
|
2430
|
+
"fn:run": receiver({
|
|
2431
|
+
receiver: "fn:run",
|
|
2432
|
+
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.",
|
|
2433
|
+
request: z.object({
|
|
2434
|
+
fn: z.string().describe("Function name from FN_MAP (e.g. 'optimal_route', 'actionable_hypotheses')"),
|
|
2435
|
+
args: z.record(z.string(), z.unknown()).optional().describe("Named arguments matching the function's param list"),
|
|
2436
|
+
workspace: z.string().optional().describe("Workspace slug for authority context"),
|
|
2437
|
+
}),
|
|
2438
|
+
response: z.object({
|
|
2439
|
+
ok: z.boolean(),
|
|
2440
|
+
fn: z.string(),
|
|
2441
|
+
rows: z.array(z.record(z.string(), z.unknown())),
|
|
2442
|
+
error: z.string().optional(),
|
|
2443
|
+
}),
|
|
2444
|
+
effect: "ask", cost: "variable", reversible: false, idempotent: true, auth: "member",
|
|
2445
|
+
examples: [{ fn: "optimal_route", args: { $from: "actor-123", $skill: "writing" }, workspace: "acme" }],
|
|
2446
|
+
}),
|
|
2447
|
+
// ── rag: family — OO-Brain hybrid vector+BM25 search ──────────────────────
|
|
2448
|
+
"rag:search": receiver({
|
|
2449
|
+
receiver: "rag:search",
|
|
2450
|
+
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.",
|
|
2451
|
+
request: z.object({
|
|
2452
|
+
query: z.string().describe("Natural-language query. Full sentence beats keywords."),
|
|
2453
|
+
k: z.number().int().min(1).max(20).optional().default(5).describe("Chunks to return (1–20, default 5)."),
|
|
2454
|
+
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."),
|
|
2455
|
+
vault: z.enum(["oo-brain", "agency-operator", "personal-brain", "all"]).optional().default("all"),
|
|
2456
|
+
filter_path_prefix: z.string().optional(),
|
|
2457
|
+
filter_tags: z.array(z.string()).optional(),
|
|
2458
|
+
}),
|
|
2459
|
+
response: z.object({
|
|
2460
|
+
ok: z.boolean(),
|
|
2461
|
+
query_id: z.string().nullable().describe("UUID to pass to rag:mark. Null when no chunks matched."),
|
|
2462
|
+
chunks: z.array(z.object({
|
|
2463
|
+
id: z.string().optional(),
|
|
2464
|
+
vault_name: z.string(),
|
|
2465
|
+
file_path: z.string(),
|
|
2466
|
+
chunk_content: z.string(),
|
|
2467
|
+
contextual_blurb: z.string().optional(),
|
|
2468
|
+
rrf_score: z.number().optional(),
|
|
2469
|
+
frontmatter: z.record(z.string(), z.unknown()).optional(),
|
|
2470
|
+
})),
|
|
2471
|
+
query: z.string(),
|
|
2472
|
+
vault: z.string(),
|
|
2473
|
+
}),
|
|
2474
|
+
effect: "ask", auth: "read_corpus", cost: { fixed: 1 }, reversible: false, idempotent: true,
|
|
2475
|
+
}),
|
|
2476
|
+
"rag:list": receiver({
|
|
2477
|
+
receiver: "rag:list",
|
|
2478
|
+
summary: "List the knowledge corpora you may search (@-pointers), resolved by the workspace authority walk. The platform corpus @oo-brain is always included.",
|
|
2479
|
+
request: z.object({}),
|
|
2480
|
+
response: z.object({
|
|
2481
|
+
ok: z.boolean(),
|
|
2482
|
+
corpora: z.array(z.string()).describe("@-pointers the caller may read, e.g. ['@oo-brain']."),
|
|
2483
|
+
}),
|
|
2484
|
+
effect: "ask", auth: "read_corpus", cost: "free", reversible: false, idempotent: true,
|
|
2485
|
+
}),
|
|
2486
|
+
"rag:mark": receiver({
|
|
2487
|
+
receiver: "rag:mark",
|
|
2488
|
+
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.",
|
|
2489
|
+
request: z.object({
|
|
2490
|
+
query_id: z.string().uuid(),
|
|
2491
|
+
outcome: z.enum(["mark", "warn", "unsure"]),
|
|
2492
|
+
notes: z.string().optional(),
|
|
2493
|
+
corpus: z.string().optional().default("@oo-brain").describe("The corpus the query_id belongs to (@-pointer). Authority-walked; omit for the platform default."),
|
|
2494
|
+
}),
|
|
2495
|
+
response: z.object({
|
|
2496
|
+
ok: z.boolean(),
|
|
2497
|
+
query_id: z.string(),
|
|
2498
|
+
outcome: z.string(),
|
|
2499
|
+
}),
|
|
2500
|
+
effect: "signal", auth: "read_corpus", cost: "free", reversible: false, idempotent: false,
|
|
2501
|
+
}),
|
|
2216
2502
|
};
|
|
2217
2503
|
/**
|
|
2218
2504
|
* RECIPES — the four agent journeys as typed, ordered receiver sequences (C6).
|
|
@@ -2231,5 +2517,7 @@ export const RECIPES = {
|
|
|
2231
2517
|
transact: ["market:bounty", "pay:weight"],
|
|
2232
2518
|
/** SOP: define a workflow → shape it with a diff → run it. */
|
|
2233
2519
|
sop: ["workflow:create", "workflow:apply-diff", "workflow:run"],
|
|
2520
|
+
/** A2A: negotiate a deal → escrow → deliver → verify → settle (or dispute + refund). */
|
|
2521
|
+
a2a: ["market:offer", "market:counter", "market:accept", "market:escrow", "market:deliver", "market:verify", "market:settle", "market:dispute"],
|
|
2234
2522
|
};
|
|
2235
2523
|
//# sourceMappingURL=receivers.js.map
|