fauna-api 0.0.0-stage → 1.0.676
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/dist/brands.d.ts +2 -0
- package/dist/brands.js +2 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +121 -0
- package/dist/src/ant/chat.d.ts +130 -0
- package/dist/src/ant/chat.js +467 -0
- package/dist/src/ant/format.d.ts +40 -0
- package/dist/src/ant/format.js +143 -0
- package/dist/src/ant/graph.d.ts +130 -0
- package/dist/src/ant/graph.js +449 -0
- package/dist/src/ant/index.d.ts +16 -0
- package/dist/src/ant/index.js +61 -0
- package/dist/src/ant/persona.d.ts +151 -0
- package/dist/src/ant/persona.js +136 -0
- package/dist/src/ant/timeline.d.ts +283 -0
- package/dist/src/ant/timeline.js +1025 -0
- package/dist/src/authentification.d.ts +45 -0
- package/dist/src/authentification.js +194 -0
- package/dist/src/billing.d.ts +135 -0
- package/dist/src/billing.js +128 -0
- package/dist/src/calendar.d.ts +83 -0
- package/dist/src/calendar.js +133 -0
- package/dist/src/chats.d.ts +113 -0
- package/dist/src/chats.js +100 -0
- package/dist/src/cicada/contacts.d.ts +31 -0
- package/dist/src/cicada/contacts.js +28 -0
- package/dist/src/cicada/conversations.d.ts +73 -0
- package/dist/src/cicada/conversations.js +236 -0
- package/dist/src/cicada/inboxes.d.ts +48 -0
- package/dist/src/cicada/inboxes.js +82 -0
- package/dist/src/cicada/index.d.ts +16 -0
- package/dist/src/cicada/index.js +61 -0
- package/dist/src/cicada/phone.d.ts +48 -0
- package/dist/src/cicada/phone.js +306 -0
- package/dist/src/drive.d.ts +80 -0
- package/dist/src/drive.js +472 -0
- package/dist/src/extensions/index.d.ts +4 -0
- package/dist/src/extensions/index.js +5 -0
- package/dist/src/extensions/web/index.d.ts +6 -0
- package/dist/src/extensions/web/index.js +7 -0
- package/dist/src/extensions/web/session.d.ts +106 -0
- package/dist/src/extensions/web/session.js +469 -0
- package/dist/src/extensions/web/tools.d.ts +13 -0
- package/dist/src/extensions/web/tools.js +72 -0
- package/dist/src/friends.d.ts +39 -0
- package/dist/src/friends.js +119 -0
- package/dist/src/groups.d.ts +82 -0
- package/dist/src/groups.js +269 -0
- package/dist/src/inbox.d.ts +11 -0
- package/dist/src/inbox.js +35 -0
- package/dist/src/integrations.d.ts +52 -0
- package/dist/src/integrations.js +205 -0
- package/dist/src/magpie/explorer.d.ts +14 -0
- package/dist/src/magpie/explorer.js +36 -0
- package/dist/src/magpie/index.d.ts +16 -0
- package/dist/src/magpie/index.js +61 -0
- package/dist/src/magpie/portfolio.d.ts +52 -0
- package/dist/src/magpie/portfolio.js +179 -0
- package/dist/src/magpie/quotes.d.ts +35 -0
- package/dist/src/magpie/quotes.js +47 -0
- package/dist/src/magpie/room.d.ts +61 -0
- package/dist/src/magpie/room.js +238 -0
- package/dist/src/maps.d.ts +159 -0
- package/dist/src/maps.js +171 -0
- package/dist/src/marmot/browser.d.ts +139 -0
- package/dist/src/marmot/browser.js +389 -0
- package/dist/src/marmot/index.d.ts +20 -0
- package/dist/src/marmot/index.js +65 -0
- package/dist/src/marmot/media.d.ts +56 -0
- package/dist/src/marmot/media.js +265 -0
- package/dist/src/marmot/research.d.ts +337 -0
- package/dist/src/marmot/research.js +1138 -0
- package/dist/src/marmot/scraper.d.ts +59 -0
- package/dist/src/marmot/scraper.js +94 -0
- package/dist/src/marmot/web.d.ts +402 -0
- package/dist/src/marmot/web.js +2586 -0
- package/dist/src/marmot/workspace.d.ts +81 -0
- package/dist/src/marmot/workspace.js +263 -0
- package/dist/src/parrot/agent.d.ts +53 -0
- package/dist/src/parrot/agent.js +93 -0
- package/dist/src/parrot/chat.d.ts +84 -0
- package/dist/src/parrot/chat.js +237 -0
- package/dist/src/parrot/format.d.ts +128 -0
- package/dist/src/parrot/format.js +639 -0
- package/dist/src/parrot/generative.d.ts +261 -0
- package/dist/src/parrot/generative.js +185 -0
- package/dist/src/parrot/index.d.ts +22 -0
- package/dist/src/parrot/index.js +67 -0
- package/dist/src/parrot/room.d.ts +225 -0
- package/dist/src/parrot/room.js +466 -0
- package/dist/src/parrot/routing.d.ts +90 -0
- package/dist/src/parrot/routing.js +78 -0
- package/dist/src/parrot/share.d.ts +126 -0
- package/dist/src/parrot/share.js +261 -0
- package/dist/src/parrot/socket.d.ts +41 -0
- package/dist/src/parrot/socket.js +478 -0
- package/dist/src/payments.d.ts +73 -0
- package/dist/src/payments.js +107 -0
- package/dist/src/private/cards.css +75 -0
- package/dist/src/rooms.d.ts +76 -0
- package/dist/src/rooms.js +168 -0
- package/dist/src/shared/schema.d.ts +24 -0
- package/dist/src/shared/schema.js +1 -0
- package/dist/src/shared/server.d.ts +65 -0
- package/dist/src/shared/server.js +302 -0
- package/dist/src/termite/environment.d.ts +110 -0
- package/dist/src/termite/environment.js +263 -0
- package/dist/src/termite/index.d.ts +14 -0
- package/dist/src/termite/index.js +59 -0
- package/dist/src/termite/os.d.ts +326 -0
- package/dist/src/termite/os.js +572 -0
- package/dist/src/termite/versioning.d.ts +94 -0
- package/dist/src/termite/versioning.js +217 -0
- package/dist/src/tickets.d.ts +43 -0
- package/dist/src/tickets.js +138 -0
- package/dist/src/travel.d.ts +85 -0
- package/dist/src/travel.js +44 -0
- package/dist/src/ui/authentification.d.ts +24 -0
- package/dist/src/ui/authentification.js +177 -0
- package/dist/src/ui/brands.css +11 -0
- package/dist/src/ui/brands.d.ts +7 -0
- package/dist/src/ui/brands.js +14 -0
- package/dist/src/ui/browser.d.ts +74 -0
- package/dist/src/ui/browser.js +470 -0
- package/dist/src/ui/chat.d.ts +183 -0
- package/dist/src/ui/chat.js +2379 -0
- package/dist/src/ui/chatPanel.d.ts +109 -0
- package/dist/src/ui/chatPanel.js +768 -0
- package/dist/src/ui/chatSequence.d.ts +36 -0
- package/dist/src/ui/chatSequence.js +42 -0
- package/dist/src/ui/crown.d.ts +19 -0
- package/dist/src/ui/crown.js +199 -0
- package/dist/src/ui/cursor.d.ts +73 -0
- package/dist/src/ui/cursor.js +175 -0
- package/dist/src/ui/device.d.ts +33 -0
- package/dist/src/ui/device.js +49 -0
- package/dist/src/ui/drive.d.ts +69 -0
- package/dist/src/ui/drive.js +1243 -0
- package/dist/src/ui/generative.d.ts +39 -0
- package/dist/src/ui/generative.js +313 -0
- package/dist/src/ui/hover.d.ts +6 -0
- package/dist/src/ui/hover.js +210 -0
- package/dist/src/ui/index.d.ts +42 -0
- package/dist/src/ui/index.js +87 -0
- package/dist/src/ui/integrations.d.ts +13 -0
- package/dist/src/ui/integrations.js +175 -0
- package/dist/src/ui/maps.d.ts +87 -0
- package/dist/src/ui/maps.js +547 -0
- package/dist/src/ui/roster.d.ts +32 -0
- package/dist/src/ui/roster.js +163 -0
- package/dist/src/ui/talk.d.ts +12 -0
- package/dist/src/ui/talk.js +560 -0
- package/dist/src/ui/tickets.d.ts +13 -0
- package/dist/src/ui/tickets.js +966 -0
- package/dist/src/ui/toast.d.ts +7 -0
- package/dist/src/ui/toast.js +258 -0
- package/dist/src/ui/tokenText.d.ts +18 -0
- package/dist/src/ui/tokenText.js +96 -0
- package/dist/src/ui/tokenized.d.ts +42 -0
- package/dist/src/ui/tokenized.js +622 -0
- package/dist/src/ui/ui.css +4763 -0
- package/dist/src/ui/view.d.ts +23 -0
- package/dist/src/ui/view.js +584 -0
- package/dist/src/view.d.ts +113 -0
- package/dist/src/view.js +386 -0
- package/dist/src/webhooks.d.ts +66 -0
- package/dist/src/webhooks.js +78 -0
- package/dist/ui.d.ts +1 -0
- package/dist/ui.js +1 -0
- package/package.json +89 -6
- package/README.md +0 -3
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { ApiKey, Credentials } from "../authentification.js";
|
|
2
|
+
import { Group } from "../groups.js";
|
|
3
|
+
export declare enum Sex {
|
|
4
|
+
MALE = "MALE",
|
|
5
|
+
FEMALE = "FEMALE"
|
|
6
|
+
}
|
|
7
|
+
export declare enum Race {
|
|
8
|
+
WHITE = "WHITE",
|
|
9
|
+
BLACK = "BLACK",
|
|
10
|
+
NATIVE_AMERICAN = "NATIVE_AMERICAN",
|
|
11
|
+
ALASKAN_NATIVE = "ALASKAN_NATIVE",
|
|
12
|
+
HAWAIIAN = "HAWAIIAN",
|
|
13
|
+
ASIAN = "ASIAN",
|
|
14
|
+
PACIFIC_ISLANDER = "PACIFIC_ISLANDER",
|
|
15
|
+
HISPANIC = "HISPANIC"
|
|
16
|
+
}
|
|
17
|
+
export declare enum Ethnicity {
|
|
18
|
+
ITALIAN = "ITALIAN",
|
|
19
|
+
IRISH = "IRISH",
|
|
20
|
+
GERMAN = "GERMAN",
|
|
21
|
+
FRENCH = "FRENCH",
|
|
22
|
+
SPANISH = "SPANISH",
|
|
23
|
+
PORTUGUESE = "PORTUGUESE",
|
|
24
|
+
POLISH = "POLISH",
|
|
25
|
+
SCOTTISH = "SCOTTISH",
|
|
26
|
+
NORWEGIAN = "NORWEGIAN",
|
|
27
|
+
DANISH = "DANISH",
|
|
28
|
+
SWEDISH = "SWEDISH",
|
|
29
|
+
FINNISH = "FINNISH",
|
|
30
|
+
ICELANDIC = "ICELANDIC",
|
|
31
|
+
DUTCH = "DUTCH",
|
|
32
|
+
UKRAINIAN = "UKRAINIAN",
|
|
33
|
+
MEXICAN = "MEXICAN",
|
|
34
|
+
JEWISH = "JEWISH",
|
|
35
|
+
KOREAN = "KOREAN",
|
|
36
|
+
CHINESE = "CHINESE",
|
|
37
|
+
JAPANESE = "JAPANESE",
|
|
38
|
+
FILIPINO = "FILIPINO",
|
|
39
|
+
VIETNAMESE = "VIETNAMESE",
|
|
40
|
+
INDIAN = "INDIAN",
|
|
41
|
+
TAMIL = "TAMIL",
|
|
42
|
+
PERSIAN = "PERSIAN",
|
|
43
|
+
ARAB = "ARAB",
|
|
44
|
+
ARMENIAN = "ARMENIAN",
|
|
45
|
+
RUSSIAN = "RUSSIAN",
|
|
46
|
+
GREEK = "GREEK",
|
|
47
|
+
BRAZILIAN = "BRAZILIAN",
|
|
48
|
+
PUERTO_RICAN = "PUERTO_RICAN",
|
|
49
|
+
HAITIAN = "HAITIAN"
|
|
50
|
+
}
|
|
51
|
+
export declare enum Religion {
|
|
52
|
+
CHRISTIAN = "CHRISTIAN",
|
|
53
|
+
JEWISH = "JEWISH",
|
|
54
|
+
MUSLIM = "MUSLIM",
|
|
55
|
+
HINDU = "HINDU",
|
|
56
|
+
BUDDHIST = "BUDDHIST",
|
|
57
|
+
SIKH = "SIKH",
|
|
58
|
+
SPIRITUAL = "SPIRITUAL",
|
|
59
|
+
AGNOSTIC = "AGNOSTIC",
|
|
60
|
+
ATHEIST = "ATHEIST",
|
|
61
|
+
NONE = "NONE"
|
|
62
|
+
}
|
|
63
|
+
export declare enum MaritalStatus {
|
|
64
|
+
MARRIED = "MARRIED",
|
|
65
|
+
SEPERATED = "SEPERATED",
|
|
66
|
+
DIVORCED = "DIVORCED",
|
|
67
|
+
WIDOWED = "WIDOWED",
|
|
68
|
+
NEVER_MARRIED = "NEVER_MARRIED"
|
|
69
|
+
}
|
|
70
|
+
export declare enum Education {
|
|
71
|
+
DOCTORAL = "DOCTORAL",
|
|
72
|
+
PROFESSIONAL = "PROFESSIONAL",
|
|
73
|
+
MASTER = "MASTER",
|
|
74
|
+
BACHELOR = "BACHELOR",
|
|
75
|
+
ASSOCIATE = "ASSOCIATE",
|
|
76
|
+
SOME_COLLEGE = "SOME_COLLEGE",
|
|
77
|
+
HIGHSCHOOL = "HIGH_SCHOOL",
|
|
78
|
+
NONE = "NONE"
|
|
79
|
+
}
|
|
80
|
+
export type Demographic = {
|
|
81
|
+
age: number;
|
|
82
|
+
sex: Sex;
|
|
83
|
+
race: Race;
|
|
84
|
+
ethnicity: Ethnicity[];
|
|
85
|
+
religion: Religion;
|
|
86
|
+
birthplace: [number, number];
|
|
87
|
+
location: [number, number];
|
|
88
|
+
marital: MaritalStatus;
|
|
89
|
+
education: Education;
|
|
90
|
+
occupation: string;
|
|
91
|
+
income: number;
|
|
92
|
+
};
|
|
93
|
+
export type Identity = {
|
|
94
|
+
id: string;
|
|
95
|
+
demographic: Demographic;
|
|
96
|
+
background: string;
|
|
97
|
+
dialect: string;
|
|
98
|
+
};
|
|
99
|
+
export declare function all(authorization: Credentials | ApiKey, opts?: {
|
|
100
|
+
group?: Group;
|
|
101
|
+
}): Promise<string[]>;
|
|
102
|
+
export declare function get(authorization: Credentials | ApiKey, id: string, opts?: {
|
|
103
|
+
group?: Group;
|
|
104
|
+
}): Promise<Identity>;
|
|
105
|
+
export type DemographicQuery = Partial<{
|
|
106
|
+
age: number;
|
|
107
|
+
sex: Sex;
|
|
108
|
+
race: Race | Race[];
|
|
109
|
+
location: [number, number];
|
|
110
|
+
occupation: string;
|
|
111
|
+
income: number;
|
|
112
|
+
interests: string[];
|
|
113
|
+
}>;
|
|
114
|
+
export type DemographicFilters = {
|
|
115
|
+
sex?: string[];
|
|
116
|
+
race?: string[];
|
|
117
|
+
age?: {
|
|
118
|
+
min: number;
|
|
119
|
+
max: number;
|
|
120
|
+
};
|
|
121
|
+
income?: {
|
|
122
|
+
min: number;
|
|
123
|
+
max: number;
|
|
124
|
+
};
|
|
125
|
+
occupation?: string;
|
|
126
|
+
};
|
|
127
|
+
/** Catalog browse (filters plus cursor and max) or weighted seed (slices, where max is the sample size). */
|
|
128
|
+
export declare function queryPersonas(authorization: Credentials | ApiKey, opts: {
|
|
129
|
+
cursor: number;
|
|
130
|
+
max: number;
|
|
131
|
+
filters?: DemographicFilters;
|
|
132
|
+
slices?: {
|
|
133
|
+
weight: number;
|
|
134
|
+
demographic: DemographicQuery;
|
|
135
|
+
}[];
|
|
136
|
+
group?: Group;
|
|
137
|
+
}): Promise<Identity[]>;
|
|
138
|
+
export type PriorReason = "hnsw" | "occupation" | "demo";
|
|
139
|
+
export type PriorEdge = {
|
|
140
|
+
to: string;
|
|
141
|
+
weight: number;
|
|
142
|
+
reasons: PriorReason[];
|
|
143
|
+
};
|
|
144
|
+
export type Prior = {
|
|
145
|
+
embedder: string;
|
|
146
|
+
k: number;
|
|
147
|
+
edges: PriorEdge[];
|
|
148
|
+
};
|
|
149
|
+
export declare function prior(authorization: Credentials | ApiKey, id: string, opts?: {
|
|
150
|
+
group?: Group;
|
|
151
|
+
}): Promise<Prior>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Ant } from "./index.js";
|
|
2
|
+
export var Sex;
|
|
3
|
+
(function (Sex) {
|
|
4
|
+
Sex["MALE"] = "MALE";
|
|
5
|
+
Sex["FEMALE"] = "FEMALE";
|
|
6
|
+
})(Sex || (Sex = {}));
|
|
7
|
+
export var Race;
|
|
8
|
+
(function (Race) {
|
|
9
|
+
Race["WHITE"] = "WHITE";
|
|
10
|
+
Race["BLACK"] = "BLACK";
|
|
11
|
+
Race["NATIVE_AMERICAN"] = "NATIVE_AMERICAN";
|
|
12
|
+
Race["ALASKAN_NATIVE"] = "ALASKAN_NATIVE";
|
|
13
|
+
Race["HAWAIIAN"] = "HAWAIIAN";
|
|
14
|
+
Race["ASIAN"] = "ASIAN";
|
|
15
|
+
Race["PACIFIC_ISLANDER"] = "PACIFIC_ISLANDER";
|
|
16
|
+
Race["HISPANIC"] = "HISPANIC";
|
|
17
|
+
})(Race || (Race = {}));
|
|
18
|
+
export var Ethnicity;
|
|
19
|
+
(function (Ethnicity) {
|
|
20
|
+
Ethnicity["ITALIAN"] = "ITALIAN";
|
|
21
|
+
Ethnicity["IRISH"] = "IRISH";
|
|
22
|
+
Ethnicity["GERMAN"] = "GERMAN";
|
|
23
|
+
Ethnicity["FRENCH"] = "FRENCH";
|
|
24
|
+
Ethnicity["SPANISH"] = "SPANISH";
|
|
25
|
+
Ethnicity["PORTUGUESE"] = "PORTUGUESE";
|
|
26
|
+
Ethnicity["POLISH"] = "POLISH";
|
|
27
|
+
Ethnicity["SCOTTISH"] = "SCOTTISH";
|
|
28
|
+
Ethnicity["NORWEGIAN"] = "NORWEGIAN";
|
|
29
|
+
Ethnicity["DANISH"] = "DANISH";
|
|
30
|
+
Ethnicity["SWEDISH"] = "SWEDISH";
|
|
31
|
+
Ethnicity["FINNISH"] = "FINNISH";
|
|
32
|
+
Ethnicity["ICELANDIC"] = "ICELANDIC";
|
|
33
|
+
Ethnicity["DUTCH"] = "DUTCH";
|
|
34
|
+
Ethnicity["UKRAINIAN"] = "UKRAINIAN";
|
|
35
|
+
Ethnicity["MEXICAN"] = "MEXICAN";
|
|
36
|
+
Ethnicity["JEWISH"] = "JEWISH";
|
|
37
|
+
Ethnicity["KOREAN"] = "KOREAN";
|
|
38
|
+
Ethnicity["CHINESE"] = "CHINESE";
|
|
39
|
+
Ethnicity["JAPANESE"] = "JAPANESE";
|
|
40
|
+
Ethnicity["FILIPINO"] = "FILIPINO";
|
|
41
|
+
Ethnicity["VIETNAMESE"] = "VIETNAMESE";
|
|
42
|
+
Ethnicity["INDIAN"] = "INDIAN";
|
|
43
|
+
Ethnicity["TAMIL"] = "TAMIL";
|
|
44
|
+
Ethnicity["PERSIAN"] = "PERSIAN";
|
|
45
|
+
Ethnicity["ARAB"] = "ARAB";
|
|
46
|
+
Ethnicity["ARMENIAN"] = "ARMENIAN";
|
|
47
|
+
Ethnicity["RUSSIAN"] = "RUSSIAN";
|
|
48
|
+
Ethnicity["GREEK"] = "GREEK";
|
|
49
|
+
Ethnicity["BRAZILIAN"] = "BRAZILIAN";
|
|
50
|
+
Ethnicity["PUERTO_RICAN"] = "PUERTO_RICAN";
|
|
51
|
+
Ethnicity["HAITIAN"] = "HAITIAN";
|
|
52
|
+
})(Ethnicity || (Ethnicity = {}));
|
|
53
|
+
export var Religion;
|
|
54
|
+
(function (Religion) {
|
|
55
|
+
Religion["CHRISTIAN"] = "CHRISTIAN";
|
|
56
|
+
Religion["JEWISH"] = "JEWISH";
|
|
57
|
+
Religion["MUSLIM"] = "MUSLIM";
|
|
58
|
+
Religion["HINDU"] = "HINDU";
|
|
59
|
+
Religion["BUDDHIST"] = "BUDDHIST";
|
|
60
|
+
Religion["SIKH"] = "SIKH";
|
|
61
|
+
Religion["SPIRITUAL"] = "SPIRITUAL";
|
|
62
|
+
Religion["AGNOSTIC"] = "AGNOSTIC";
|
|
63
|
+
Religion["ATHEIST"] = "ATHEIST";
|
|
64
|
+
Religion["NONE"] = "NONE";
|
|
65
|
+
})(Religion || (Religion = {}));
|
|
66
|
+
export var MaritalStatus;
|
|
67
|
+
(function (MaritalStatus) {
|
|
68
|
+
MaritalStatus["MARRIED"] = "MARRIED";
|
|
69
|
+
MaritalStatus["SEPERATED"] = "SEPERATED";
|
|
70
|
+
MaritalStatus["DIVORCED"] = "DIVORCED";
|
|
71
|
+
MaritalStatus["WIDOWED"] = "WIDOWED";
|
|
72
|
+
MaritalStatus["NEVER_MARRIED"] = "NEVER_MARRIED";
|
|
73
|
+
})(MaritalStatus || (MaritalStatus = {}));
|
|
74
|
+
export var Education;
|
|
75
|
+
(function (Education) {
|
|
76
|
+
Education["DOCTORAL"] = "DOCTORAL";
|
|
77
|
+
Education["PROFESSIONAL"] = "PROFESSIONAL";
|
|
78
|
+
Education["MASTER"] = "MASTER";
|
|
79
|
+
Education["BACHELOR"] = "BACHELOR";
|
|
80
|
+
Education["ASSOCIATE"] = "ASSOCIATE";
|
|
81
|
+
Education["SOME_COLLEGE"] = "SOME_COLLEGE";
|
|
82
|
+
Education["HIGHSCHOOL"] = "HIGH_SCHOOL";
|
|
83
|
+
Education["NONE"] = "NONE";
|
|
84
|
+
})(Education || (Education = {}));
|
|
85
|
+
export async function all(authorization, opts) {
|
|
86
|
+
const response = await fetch(`${Ant.getURL()}/personas`, {
|
|
87
|
+
method: "GET",
|
|
88
|
+
headers: {
|
|
89
|
+
"Authorization": 'email' in authorization ? `Token ${authorization.token}` : `ApiKey ${authorization.id}`,
|
|
90
|
+
...(opts?.group ? { Group: opts.group.id } : {}),
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return await response.json();
|
|
94
|
+
}
|
|
95
|
+
export async function get(authorization, id, opts) {
|
|
96
|
+
const response = await fetch(`${Ant.getURL()}/personas/${encodeURIComponent(id)}`, {
|
|
97
|
+
method: "GET",
|
|
98
|
+
headers: {
|
|
99
|
+
"Authorization": 'email' in authorization ? `Token ${authorization.token}` : `ApiKey ${authorization.id}`,
|
|
100
|
+
...(opts?.group ? { Group: opts.group.id } : {}),
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return await response.json();
|
|
104
|
+
}
|
|
105
|
+
/** Catalog browse (filters plus cursor and max) or weighted seed (slices, where max is the sample size). */
|
|
106
|
+
export async function queryPersonas(authorization, opts) {
|
|
107
|
+
const response = await fetch(`${Ant.getURL()}/persona/query`, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: {
|
|
110
|
+
"Content-Type": "application/json",
|
|
111
|
+
"Authorization": "email" in authorization ? `Token ${authorization.token}` : `ApiKey ${authorization.id}`,
|
|
112
|
+
...(opts.group ? { Group: opts.group.id } : {}),
|
|
113
|
+
},
|
|
114
|
+
body: JSON.stringify({
|
|
115
|
+
cursor: opts.cursor,
|
|
116
|
+
max: opts.max,
|
|
117
|
+
...(opts.filters ? { filters: opts.filters } : {}),
|
|
118
|
+
...(opts.slices ? { slices: opts.slices } : {}),
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
if (!response.ok)
|
|
122
|
+
throw new Error(await response.text());
|
|
123
|
+
return await response.json();
|
|
124
|
+
}
|
|
125
|
+
export async function prior(authorization, id, opts) {
|
|
126
|
+
const response = await fetch(`${Ant.getURL()}/persona/prior/${encodeURIComponent(id)}`, {
|
|
127
|
+
method: "GET",
|
|
128
|
+
headers: {
|
|
129
|
+
"Authorization": "email" in authorization ? `Token ${authorization.token}` : `ApiKey ${authorization.id}`,
|
|
130
|
+
...(opts?.group ? { Group: opts.group.id } : {}),
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
if (!response.ok)
|
|
134
|
+
throw new Error(await response.text());
|
|
135
|
+
return await response.json();
|
|
136
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Identity } from "./persona.js";
|
|
2
|
+
import { Format } from "../parrot/format.js";
|
|
3
|
+
import { GraphEdge, GraphNode, type Stimuli } from "./graph.js";
|
|
4
|
+
export { GraphNode, StartNode, TextNode, WebsiteNode, FileNode, XNode, LinkedInNode, GraphEdge, type Stimuli, type GraphNodeWire, } from "./graph.js";
|
|
5
|
+
import { ApiKey, Credentials } from "../authentification.js";
|
|
6
|
+
import { Group } from "../groups.js";
|
|
7
|
+
import { Authorization, Presence, Room, Hooks as ServerHooks } from "../shared/server.js";
|
|
8
|
+
import { ChatRoom, RoomHooks } from "../parrot/room.js";
|
|
9
|
+
import { StreamEvent, type Content, type Tool } from "../parrot/generative.js";
|
|
10
|
+
import * as Drive from "../drive.js";
|
|
11
|
+
import { Memory } from "../parrot/agent.js";
|
|
12
|
+
import type { Repository } from "../termite/versioning.js";
|
|
13
|
+
export declare function listTimelines(authorization: Credentials | ApiKey, opts?: {
|
|
14
|
+
group?: Group;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
name: string;
|
|
17
|
+
id: string;
|
|
18
|
+
}[]>;
|
|
19
|
+
/** Create a timeline. `repository` (the owner's) is the computer its personas start from. */
|
|
20
|
+
export declare function createTimeline(authorization: Credentials | ApiKey, name: string, opts?: {
|
|
21
|
+
group?: Group;
|
|
22
|
+
audience?: string[];
|
|
23
|
+
repository?: Repository;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
name: string;
|
|
26
|
+
id: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function deleteTimeline(authorization: Credentials | ApiKey, id: string, opts?: {
|
|
29
|
+
group?: Group;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
export declare function renameTimeline(authorization: Credentials | ApiKey, id: string, name: string, opts?: {
|
|
32
|
+
group?: Group;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
export declare function getTrust(authorization: Credentials | ApiKey, timelineId: string, opts?: {
|
|
35
|
+
group?: Group;
|
|
36
|
+
accessCode?: string;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
edges: {
|
|
39
|
+
from: string;
|
|
40
|
+
to: string;
|
|
41
|
+
weight: number;
|
|
42
|
+
updatedAt?: number;
|
|
43
|
+
}[];
|
|
44
|
+
}>;
|
|
45
|
+
export type TrustEdge = {
|
|
46
|
+
from: string;
|
|
47
|
+
to: string;
|
|
48
|
+
weight: number;
|
|
49
|
+
updatedAt?: number;
|
|
50
|
+
};
|
|
51
|
+
type FileAccessCodeMeta = {
|
|
52
|
+
code: string;
|
|
53
|
+
name: string;
|
|
54
|
+
contentType: string;
|
|
55
|
+
};
|
|
56
|
+
export declare class Poll {
|
|
57
|
+
readonly id: string;
|
|
58
|
+
goal: string;
|
|
59
|
+
query: Format<any>[];
|
|
60
|
+
results: unknown;
|
|
61
|
+
constructor(id: string, goal: string, query: Format<any>[], results?: unknown);
|
|
62
|
+
static fromJSON(json: any): Poll;
|
|
63
|
+
toJSON(): {
|
|
64
|
+
id: string;
|
|
65
|
+
goal: string;
|
|
66
|
+
query: any[];
|
|
67
|
+
results: unknown;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export declare class Run {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
pollId: string;
|
|
73
|
+
iteration: number;
|
|
74
|
+
status: "QUEUED" | "RUNNING" | "DONE" | "ABORTED" | "FAILED";
|
|
75
|
+
trajectories: {
|
|
76
|
+
id: string;
|
|
77
|
+
nodes: {
|
|
78
|
+
id: string;
|
|
79
|
+
kind: string;
|
|
80
|
+
title: string;
|
|
81
|
+
}[];
|
|
82
|
+
reflections?: {
|
|
83
|
+
agentId: string;
|
|
84
|
+
text: string;
|
|
85
|
+
to?: string;
|
|
86
|
+
error?: string;
|
|
87
|
+
}[];
|
|
88
|
+
thread?: {
|
|
89
|
+
post: string;
|
|
90
|
+
comments: {
|
|
91
|
+
agentId: string;
|
|
92
|
+
text: string;
|
|
93
|
+
to?: string;
|
|
94
|
+
error?: string;
|
|
95
|
+
}[];
|
|
96
|
+
};
|
|
97
|
+
forwards?: {
|
|
98
|
+
agentId: string;
|
|
99
|
+
text: string;
|
|
100
|
+
to?: string;
|
|
101
|
+
error?: string;
|
|
102
|
+
}[];
|
|
103
|
+
}[];
|
|
104
|
+
polls?: unknown;
|
|
105
|
+
progress?: {
|
|
106
|
+
activeNodeIds: string[];
|
|
107
|
+
activeEdgeIds: string[];
|
|
108
|
+
clusterHits: Record<string, number>;
|
|
109
|
+
clusterRequired: Record<string, number>;
|
|
110
|
+
byStimulus: Record<string, {
|
|
111
|
+
stimulusLabel: string;
|
|
112
|
+
phase: "browse" | "reflect" | "discuss" | "forward" | "answer";
|
|
113
|
+
done: number;
|
|
114
|
+
total: number;
|
|
115
|
+
browsers?: Record<string, {
|
|
116
|
+
url: string;
|
|
117
|
+
reference: string;
|
|
118
|
+
code: string;
|
|
119
|
+
}>;
|
|
120
|
+
feed?: {
|
|
121
|
+
id: string;
|
|
122
|
+
agentId: string;
|
|
123
|
+
text: string;
|
|
124
|
+
}[];
|
|
125
|
+
}>;
|
|
126
|
+
};
|
|
127
|
+
agentIds: string[];
|
|
128
|
+
reach?: Record<string, string[]>;
|
|
129
|
+
startedAt: number;
|
|
130
|
+
finishedAt?: number;
|
|
131
|
+
error?: string;
|
|
132
|
+
constructor(wire: any);
|
|
133
|
+
}
|
|
134
|
+
export declare function runIsActive(status: Run["status"] | string | undefined): boolean;
|
|
135
|
+
export declare class Agent {
|
|
136
|
+
readonly parent: TimelineRoom;
|
|
137
|
+
readonly id: string;
|
|
138
|
+
persona: Identity;
|
|
139
|
+
/** A repository picked in this agent's own chat, used directly; null when it follows the timeline's. */
|
|
140
|
+
repository: number | null;
|
|
141
|
+
constructor(parent: TimelineRoom, id: string, persona: Identity, repository?: number | null);
|
|
142
|
+
static fromJSON(json: any, parent: TimelineRoom): Agent;
|
|
143
|
+
/** Pick a repository for this agent's chats (used directly), or null to follow the timeline's again. */
|
|
144
|
+
setRepository(repository: Repository | null): void;
|
|
145
|
+
/** Lazily mint/open this agent's Parrot ChatRoom. */
|
|
146
|
+
getChat(hooks?: RoomHooks): Promise<{
|
|
147
|
+
room: ChatRoom;
|
|
148
|
+
self: Presence;
|
|
149
|
+
chatId: string;
|
|
150
|
+
}>;
|
|
151
|
+
observe(content: string): Promise<Memory>;
|
|
152
|
+
/** Stream a reply as this agent, under the room's own authorization. `tools` answer the persona's calls to them. */
|
|
153
|
+
generate(messages: Content[], opts?: {
|
|
154
|
+
signal?: AbortSignal;
|
|
155
|
+
tools?: Tool[];
|
|
156
|
+
}): AsyncGenerator<StreamEvent>;
|
|
157
|
+
toJSON(): {
|
|
158
|
+
id: string;
|
|
159
|
+
persona: Identity;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
export declare class TimelineRoom extends Room {
|
|
163
|
+
/** Client-facing timeline id within the current principal. */
|
|
164
|
+
timelineId: string;
|
|
165
|
+
name: string;
|
|
166
|
+
agents: Map<string, Agent>;
|
|
167
|
+
polls: Map<string, Poll>;
|
|
168
|
+
runs: Map<string, Run>;
|
|
169
|
+
nodes: Map<string, GraphNode>;
|
|
170
|
+
edges: Map<string, GraphEdge>;
|
|
171
|
+
/** Short-lived Drive codes for file nodes (hydrate + upload + remint). */
|
|
172
|
+
fileAccessCodes: Map<string, FileAccessCodeMeta>;
|
|
173
|
+
trustEdges: Map<string, TrustEdge>;
|
|
174
|
+
status: string;
|
|
175
|
+
/** Set when the timeline is deleted while this room is open. */
|
|
176
|
+
removed: boolean;
|
|
177
|
+
/** The owner's Termite repository personas start from, by id; null when it has none. */
|
|
178
|
+
repository: number | null;
|
|
179
|
+
/** Who owns the timeline: `credentials:{id}` or `group:{id}`. */
|
|
180
|
+
owner: string;
|
|
181
|
+
private readonly repositoryWatchers;
|
|
182
|
+
constructor(endpoint: string, ws: WebSocket, authorization: Authorization, id: string);
|
|
183
|
+
/** The group that owns the timeline, whose repositories it takes; undefined for a person's. */
|
|
184
|
+
get group(): Group | undefined;
|
|
185
|
+
/** Attach one of the owner's repositories, or null to detach. Personas' chat forks of the old one are deleted. */
|
|
186
|
+
setRepository(repository: Repository | null): Promise<void>;
|
|
187
|
+
/** Hear about every repository change, from anyone in the room. Returns a function that stops listening. */
|
|
188
|
+
watchRepository(listener: (repository: number | null) => void): () => void;
|
|
189
|
+
private applyRepository;
|
|
190
|
+
/**
|
|
191
|
+
* The trust graph a run ended with: the timeline's graph as the run started,
|
|
192
|
+
* plus everything it changed. `trustEdges` is the graph every run starts from.
|
|
193
|
+
*/
|
|
194
|
+
runTrust(runId: string): Promise<TrustEdge[]>;
|
|
195
|
+
hydrate(state: any): void;
|
|
196
|
+
private attachDriveFile;
|
|
197
|
+
handleEvent(packet: any): void | Promise<void>;
|
|
198
|
+
upsertGraphNode(node: GraphNode): GraphNode;
|
|
199
|
+
removeGraphNode(id: string): void;
|
|
200
|
+
upsertGraphEdge(edge: GraphEdge): GraphEdge;
|
|
201
|
+
removeGraphEdge(id: string): void;
|
|
202
|
+
/** Upload bytes to the host drive and create/update a durable file node. */
|
|
203
|
+
uploadFileNode(file: Blob | ArrayBuffer | Uint8Array, opts: {
|
|
204
|
+
name: string;
|
|
205
|
+
contentType?: string;
|
|
206
|
+
x: number;
|
|
207
|
+
y: number;
|
|
208
|
+
nodeId?: string;
|
|
209
|
+
kind?: Stimuli;
|
|
210
|
+
}): Promise<{
|
|
211
|
+
node: GraphNode;
|
|
212
|
+
accessCode: FileAccessCodeMeta;
|
|
213
|
+
}>;
|
|
214
|
+
remintFileAccessCode(nodeId: string): Promise<FileAccessCodeMeta>;
|
|
215
|
+
/** Build a Drive.File handle for a graph file node (remints if needed). */
|
|
216
|
+
fileForNode(nodeId: string): Promise<Drive.File>;
|
|
217
|
+
/** Remint if needed and return the short-lived Drive access code for a file node.
|
|
218
|
+
* Viewer URL opening stays in the app layer (avoids importing Fauna into ant/). */
|
|
219
|
+
openGraphFile(nodeId: string): Promise<FileAccessCodeMeta>;
|
|
220
|
+
upsertAgent(identity: Identity): Agent;
|
|
221
|
+
removeAgent(id: string): void;
|
|
222
|
+
upsertPoll(goal: string, query: Format<any>[]): Poll;
|
|
223
|
+
removePoll(id: string): void;
|
|
224
|
+
/** Create the poll and queue its run in one request. Resolves the run id;
|
|
225
|
+
* the run itself arrives through the room's `upsert-run` delta. */
|
|
226
|
+
startRun(goal: string, query: Format<any>[]): Promise<string>;
|
|
227
|
+
abortRun(runId: string): Promise<void>;
|
|
228
|
+
/** Lazily mint/open the architect Parrot ChatRoom. */
|
|
229
|
+
getChat(hooks?: RoomHooks): Promise<{
|
|
230
|
+
room: ChatRoom;
|
|
231
|
+
self: Presence;
|
|
232
|
+
chatId: string;
|
|
233
|
+
}>;
|
|
234
|
+
/**
|
|
235
|
+
* Ensure a Parrot chat (architect when `agentId` is empty) and connect live.
|
|
236
|
+
* Timeline members join by reference (non-guest); access-code guests use the
|
|
237
|
+
* short-lived code so leave/reap semantics stay correct.
|
|
238
|
+
*/
|
|
239
|
+
openChat(agentId: string, hooks?: RoomHooks): Promise<{
|
|
240
|
+
room: ChatRoom;
|
|
241
|
+
self: Presence;
|
|
242
|
+
chatId: string;
|
|
243
|
+
}>;
|
|
244
|
+
/**
|
|
245
|
+
* Connect to an owned timeline.
|
|
246
|
+
* Principal is resolved server-side from auth (+ optional Group).
|
|
247
|
+
* `Server` carries only the timeline id for own/group; grant joins may
|
|
248
|
+
* pass a full `principalId:timelineId` via opts.server when needed.
|
|
249
|
+
*/
|
|
250
|
+
static connect(authorization: Credentials | ApiKey, target: {
|
|
251
|
+
id: string;
|
|
252
|
+
}, opts?: {
|
|
253
|
+
group?: Group;
|
|
254
|
+
hooks?: ServerHooks;
|
|
255
|
+
server?: string;
|
|
256
|
+
}): Promise<{
|
|
257
|
+
room: TimelineRoom;
|
|
258
|
+
self: Presence;
|
|
259
|
+
}>;
|
|
260
|
+
static join(authorization: Credentials | ApiKey, target: {
|
|
261
|
+
accessCode: string;
|
|
262
|
+
}, hooks?: ServerHooks): Promise<{
|
|
263
|
+
room: TimelineRoom;
|
|
264
|
+
self: Presence;
|
|
265
|
+
}>;
|
|
266
|
+
}
|
|
267
|
+
/** Write a standalone fact onto this agent's Parrot graph (`ant/timelines/…/memory`). */
|
|
268
|
+
export declare function observeAgent(authorization: Credentials | ApiKey, timelineId: string, agentId: string, content: string, opts?: {
|
|
269
|
+
group?: Group;
|
|
270
|
+
accessCode?: string;
|
|
271
|
+
}): Promise<Memory>;
|
|
272
|
+
/**
|
|
273
|
+
* Stream a persona reply for one agent (Gemini Flash + medium thinking + memories).
|
|
274
|
+
* Parrot-compatible StreamEvents for UI.Chat generate mode, plus `tool` and
|
|
275
|
+
* `tool-result` events for the persona's own tools. `tools` are answered here
|
|
276
|
+
* when the persona calls them, like `use_desktop` asking for a computer.
|
|
277
|
+
*/
|
|
278
|
+
export declare function generateAgent(authorization: Credentials | ApiKey, timelineId: string, agentId: string, messages: Content[], opts?: {
|
|
279
|
+
group?: Group;
|
|
280
|
+
accessCode?: string;
|
|
281
|
+
signal?: AbortSignal;
|
|
282
|
+
tools?: Tool[];
|
|
283
|
+
}): AsyncGenerator<StreamEvent>;
|