copilotz 1.0.0-rc.21 → 1.0.0-rc.23
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/CHANGELOG.md +320 -1
- package/README.md +217 -87
- package/hosts/orgs/mod.d.ts +33 -13
- package/hosts/orgs/mod.js +183 -84
- package/hosts/web/address.d.ts +11 -0
- package/hosts/web/address.js +46 -0
- package/hosts/web/assets.js +11 -5
- package/hosts/web/entrances.d.ts +250 -0
- package/hosts/web/entrances.js +362 -0
- package/hosts/web/host.d.ts +15 -3
- package/hosts/web/host.js +31 -18
- package/hosts/web/mod.d.ts +4 -2
- package/hosts/web/mod.js +6 -0
- package/hosts/web/node/bundle.d.ts +5 -0
- package/hosts/web/node/bundle.js +1 -1
- package/hosts/web/node/mod.d.ts +6 -4
- package/hosts/web/node/mod.js +6 -4
- package/hosts/web/node/serve.d.ts +20 -23
- package/hosts/web/node/serve.js +10 -21
- package/hosts/web/routes.d.ts +23 -17
- package/hosts/web/routes.js +56 -32
- package/hosts/web/server.d.ts +89 -44
- package/hosts/web/server.js +208 -108
- package/hosts/web/signin.d.ts +7 -10
- package/hosts/web/signin.js +6 -3
- package/hosts/web/surface.d.ts +20 -0
- package/hosts/web/surface.js +42 -0
- package/hosts/web/theme/css.d.ts +2 -1
- package/hosts/web/theme/css.js +9 -2
- package/hosts/web/tickets.d.ts +14 -1
- package/hosts/web/tickets.js +30 -7
- package/hosts/web/widget.d.ts +31 -0
- package/hosts/web/widget.js +429 -0
- package/hosts/web/widgets.d.ts +43 -0
- package/hosts/web/widgets.js +117 -0
- package/package.json +5 -1
- package/plugins/access/contacts/actions/forget.js +3 -1
- package/plugins/access/contacts/actions/start.js +18 -8
- package/plugins/access/contacts/collections/contact.d.ts +2 -2
- package/plugins/access/contacts/collections/contact.js +1 -1
- package/plugins/access/contacts/contract.d.ts +5 -5
- package/plugins/access/contacts/contract.js +5 -5
- package/plugins/access/contacts/mod.d.ts +4 -0
- package/plugins/access/contacts/mod.js +4 -0
- package/plugins/access/contacts/views/contact.js +1 -0
- package/plugins/access/dev/actions/sign-in.d.ts +1 -0
- package/plugins/access/dev/actions/sign-in.js +38 -0
- package/plugins/access/dev/mod.d.ts +17 -0
- package/plugins/access/dev/mod.js +31 -0
- package/plugins/access/dev/shared/nearby.d.ts +2 -0
- package/plugins/access/dev/shared/nearby.js +27 -0
- package/plugins/access/directory/actions/invite.js +2 -2
- package/plugins/access/directory/actions/org.js +11 -8
- package/plugins/access/directory/collections/credit-code.d.ts +1 -1
- package/plugins/access/google/actions/sign-in.js +2 -0
- package/plugins/access/google/mod.d.ts +4 -2
- package/plugins/access/google/mod.js +15 -2
- package/plugins/access/identity/actions/session.js +5 -3
- package/plugins/access/identity/mod.d.ts +4 -2
- package/plugins/access/identity/mod.js +17 -2
- package/plugins/access/mod.d.ts +7 -0
- package/plugins/access/mod.js +1 -0
- package/plugins/access/spaces/shared/declared.d.ts +1 -1
- package/plugins/access/spaces/shared/rules.d.ts +16 -5
- package/plugins/access/spaces/shared/rules.js +74 -6
- package/plugins/agents/chat/actions/send.d.ts +21 -0
- package/plugins/agents/chat/actions/send.js +72 -13
- package/plugins/agents/chat/collections/file.d.ts +15 -0
- package/plugins/agents/chat/collections/file.js +12 -3
- package/plugins/agents/chat/collections/live.d.ts +11 -0
- package/plugins/agents/chat/collections/live.js +11 -1
- package/plugins/agents/chat/collections/message.d.ts +1 -1
- package/plugins/agents/chat/collections/wait.d.ts +1 -1
- package/plugins/agents/chat/contract.d.ts +3 -2
- package/plugins/agents/chat/contract.js +1 -0
- package/plugins/agents/chat/mod.d.ts +9 -3
- package/plugins/agents/chat/mod.js +28 -7
- package/plugins/agents/chat/processors/failed.js +8 -3
- package/plugins/agents/chat/processors/turn.js +6 -3
- package/plugins/agents/chat/shared/agents.js +11 -2
- package/plugins/agents/chat/shared/live.d.ts +4 -2
- package/plugins/agents/chat/shared/live.js +2 -1
- package/plugins/agents/chat/shared/types.d.ts +8 -0
- package/plugins/agents/history/collections/outline.d.ts +2 -2
- package/plugins/agents/openapi/shared/files.js +2 -0
- package/plugins/agents/routines/collections/routine.d.ts +1 -1
- package/plugins/billing/credits/collections/plan.d.ts +2 -2
- package/plugins/billing/credits/collections/room.d.ts +1 -1
- package/plugins/billing/usage/collections/rollup.d.ts +2 -2
- package/plugins/billing/usage/collections/usage.d.ts +2 -2
- package/plugins/compute/cloud/actions/pool.js +2 -0
- package/plugins/compute/cloud/actions/remote.js +4 -2
- package/plugins/compute/cloud/actions/vms.js +2 -0
- package/plugins/compute/cloud/collections/pool-vm.d.ts +1 -1
- package/plugins/compute/computers/actions/admit.js +2 -0
- package/plugins/compute/computers/actions/code.js +2 -0
- package/plugins/compute/computers/actions/enrollment.js +2 -0
- package/plugins/compute/computers/actions/work.js +3 -0
- package/plugins/compute/computers/program/version.d.ts +1 -1
- package/plugins/compute/computers/program/version.js +1 -1
- package/plugins/compute/computers/resources/downloads.js +1 -1
- package/plugins/compute/computers/resources/previews.js +5 -2
- package/plugins/interfaces/maintenance/mod.d.ts +3 -1
- package/plugins/interfaces/maintenance/mod.js +3 -1
- package/plugins/interfaces/mcp/actions/call.d.ts +4 -0
- package/plugins/interfaces/mcp/actions/call.js +120 -18
- package/plugins/interfaces/mcp/actions/conversation.d.ts +1 -0
- package/plugins/interfaces/mcp/actions/conversation.js +49 -0
- package/plugins/interfaces/mcp/actions/prune.js +5 -3
- package/plugins/interfaces/mcp/collections/opening.d.ts +24 -0
- package/plugins/interfaces/mcp/collections/opening.js +28 -0
- package/plugins/interfaces/mcp/mod.d.ts +27 -3
- package/plugins/interfaces/mcp/mod.js +42 -7
- package/plugins/interfaces/mcp/resources/server.d.ts +13 -4
- package/plugins/interfaces/mcp/resources/server.js +163 -21
- package/plugins/interfaces/mcp/resources/tools.d.ts +88 -12
- package/plugins/interfaces/mcp/resources/tools.js +113 -19
- package/plugins/interfaces/mcp/resources/widgets.d.ts +161 -0
- package/plugins/interfaces/mcp/resources/widgets.js +246 -0
- package/plugins/interfaces/mcp/shared/keys.d.ts +25 -19
- package/plugins/interfaces/mcp/shared/keys.js +55 -9
- package/plugins/interfaces/mcp/shared/settings.d.ts +70 -37
- package/plugins/interfaces/mcp/shared/settings.js +64 -39
- package/plugins/interfaces/mcp/views/offered.d.ts +1 -1
- package/plugins/interfaces/mod.d.ts +2 -1
- package/plugins/interfaces/mod.js +2 -1
- package/plugins/interfaces/voice/collections/blocked.d.ts +2 -2
- package/plugins/interfaces/voice/collections/call.d.ts +3 -3
- package/plugins/interfaces/voice/contract.d.ts +1 -1
- package/plugins/interfaces/voice/mod.d.ts +3 -3
- package/plugins/interfaces/voice/mod.js +3 -3
- package/plugins/interfaces/voice/resources/relay.d.ts +5 -3
- package/plugins/interfaces/voice/resources/relay.js +17 -6
- package/plugins/interfaces/voice/resources/tools.js +2 -0
- package/plugins/interfaces/voice/shared/settings.d.ts +5 -0
- package/plugins/interfaces/voice/views/call.d.ts +18 -11
- package/plugins/interfaces/voice/views/call.js +15 -3
- package/plugins/interfaces/voice/views/message.d.ts +1 -1
- package/plugins/interfaces/web/actions/arrive.d.ts +1 -0
- package/plugins/interfaces/web/actions/arrive.js +120 -0
- package/plugins/interfaces/web/actions/prune.d.ts +1 -0
- package/plugins/interfaces/web/actions/prune.js +51 -0
- package/plugins/interfaces/web/actions/sending.d.ts +1 -0
- package/plugins/interfaces/web/actions/sending.js +222 -0
- package/plugins/interfaces/web/actions/spent.d.ts +2 -0
- package/plugins/interfaces/web/actions/spent.js +59 -0
- package/plugins/interfaces/web/collections/rate.d.ts +122 -0
- package/plugins/interfaces/web/collections/rate.js +37 -0
- package/plugins/interfaces/web/collections/visitor.d.ts +110 -0
- package/plugins/interfaces/web/collections/visitor.js +64 -0
- package/plugins/interfaces/web/contract.d.ts +4 -0
- package/plugins/interfaces/web/contract.js +1 -0
- package/plugins/interfaces/web/lines.d.ts +36 -0
- package/plugins/interfaces/web/lines.js +78 -0
- package/plugins/interfaces/web/processors/forget.d.ts +10 -0
- package/plugins/interfaces/web/processors/forget.js +14 -0
- package/plugins/interfaces/web/resources/entrance.d.ts +47 -0
- package/plugins/interfaces/web/resources/entrance.js +83 -0
- package/plugins/interfaces/web/resources/spend.d.ts +2 -0
- package/plugins/interfaces/web/resources/spend.js +62 -0
- package/plugins/interfaces/web/shared/budget.d.ts +65 -0
- package/plugins/interfaces/web/shared/budget.js +134 -0
- package/plugins/interfaces/web/shared/lines.d.ts +158 -0
- package/plugins/interfaces/web/shared/lines.js +156 -0
- package/plugins/interfaces/web/shared/secret.d.ts +33 -0
- package/plugins/interfaces/web/shared/secret.js +86 -0
- package/plugins/interfaces/whatsapp/collections/phone.d.ts +1 -1
- package/plugins/interfaces/whatsapp/mod.d.ts +1 -1
- package/plugins/interfaces/whatsapp/mod.js +1 -1
- package/plugins/interfaces/whatsapp/views/message.d.ts +1 -1
- package/plugins/models/contract.d.ts +1 -1
- package/plugins/models/shared/generate.js +13 -4
- package/plugins/models/shared/transcribe.js +7 -1
- package/plugins/models/shared/use.d.ts +16 -2
- package/plugins/models/shared/use.js +20 -0
- package/runtime/browsers.d.ts +153 -17
- package/runtime/browsers.js +336 -30
- package/runtime/cache.js +25 -5
- package/runtime/caller.d.ts +117 -0
- package/runtime/caller.js +215 -0
- package/runtime/client.d.ts +47 -3
- package/runtime/client.js +132 -42
- package/runtime/define.d.ts +30 -9
- package/runtime/executor.js +7 -6
- package/runtime/expiring.d.ts +23 -0
- package/runtime/expiring.js +64 -0
- package/runtime/links.d.ts +27 -4
- package/runtime/links.js +49 -11
- package/runtime/memory.js +102 -15
- package/runtime/mod.d.ts +3 -1
- package/runtime/mod.js +3 -1
- package/runtime/mongo.d.ts +12 -0
- package/runtime/mongo.js +44 -0
- package/runtime/observe.js +82 -9
- package/runtime/ops.d.ts +9 -1
- package/runtime/owner.d.ts +14 -1
- package/runtime/owner.js +78 -23
- package/runtime/reads.js +2 -2
- package/runtime/registry.js +9 -3
- package/runtime/runtime.d.ts +7 -0
- package/runtime/runtime.js +1 -0
- package/runtime/timers.js +2 -0
- package/runtime/views.d.ts +1 -1
- package/runtime/views.js +2 -2
- package/runtime/wire.d.ts +1 -1
- package/stores/sql/postgres/maintenance.d.ts +8 -1
- package/stores/sql/postgres/maintenance.js +76 -9
- package/stores/sql/postgres/mod.d.ts +12 -4
- package/stores/sql/postgres/mod.js +21 -8
- package/plugins/interfaces/mcp/shared/caller.d.ts +0 -45
- package/plugins/interfaces/mcp/shared/caller.js +0 -99
package/runtime/browsers.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { failure as refusal } from "./errors.js";
|
|
2
|
+
import { expiring } from "./expiring.js";
|
|
3
|
+
import { scaleOf } from "./caller.js";
|
|
4
|
+
import { CONNECTION_BUDGET } from "oxianjs/http";
|
|
1
5
|
import { decode, encode, failure } from "./wire.js";
|
|
2
6
|
/** A browser connection's provider id, set at admission. */
|
|
3
7
|
export const BROWSER = "core.browser";
|
|
@@ -41,16 +45,210 @@ export function readView(remote, ctx) {
|
|
|
41
45
|
.value;
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
|
-
|
|
48
|
+
/**
|
|
49
|
+
* A failure as a browser is told it: a person, all of it; a contact, its
|
|
50
|
+
* words only when they're for anyone (`public`), else that it failed, and
|
|
51
|
+
* its code.
|
|
52
|
+
*/
|
|
53
|
+
export function toldTo(actor, error) {
|
|
54
|
+
const said = failure(error);
|
|
55
|
+
if (actor?.kind !== "contact" || said.public)
|
|
56
|
+
return said;
|
|
57
|
+
return { message: "Something went wrong.", ...(said.code ? { code: said.code } : {}) };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One read, answered as an actor outside any connection (a widget's, through the app's MCP
|
|
61
|
+
* line; a snapshot of what a View reads): a query they may run (its `allow`, under the rules,
|
|
62
|
+
* without private fields), its failure as they may be told it. A direct read of a collection is
|
|
63
|
+
* refused: from there, an actor reads through queries.
|
|
64
|
+
*/
|
|
65
|
+
export async function answeredAs(runtime, actor, key, read) {
|
|
66
|
+
if (!("query" in read) || typeof read.collection !== "string" || typeof read.query !== "string") {
|
|
67
|
+
return { key, error: { message: "Read through a query", code: "forbidden" } };
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const value = await runtime.query(`${read.collection}.${read.query}`, read.params ?? null, {
|
|
71
|
+
actor,
|
|
72
|
+
});
|
|
73
|
+
return { key, value: value ?? null };
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return { key, error: toldTo(actor, error) };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const answer = (output, actor) => output.status === "failed" ? { error: toldTo(actor, output.error) } : {
|
|
45
80
|
value: output.value ?? null,
|
|
46
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* The most WebSockets one listener holds (Oxian's Node adapter's budget):
|
|
84
|
+
* people, contacts, routes' sockets and, on the orgs host, every org's.
|
|
85
|
+
*/
|
|
86
|
+
export const LISTENER = CONNECTION_BUDGET;
|
|
87
|
+
/** The most bytes of JSON a contact's read says: its filter and options, or a query's params. */
|
|
88
|
+
export const CONTACT_READ = 2_048;
|
|
89
|
+
/** A pool of contacts' connections for runtimes on one listener (see `ContactsPool`). */
|
|
90
|
+
export const contactsPool = (most = Math.floor(LISTENER * 0.4)) => ({
|
|
91
|
+
held: new Set(),
|
|
92
|
+
most,
|
|
93
|
+
});
|
|
94
|
+
/** What's wrong with browser limits, if anything (checked as the runtime starts). */
|
|
95
|
+
export function limitsProblem(limits) {
|
|
96
|
+
if (!limits)
|
|
97
|
+
return undefined;
|
|
98
|
+
const counts = [
|
|
99
|
+
["sockets", limits.sockets],
|
|
100
|
+
["watches", limits.watches],
|
|
101
|
+
["resumes", limits.resumes],
|
|
102
|
+
["contact.sockets", limits.contact?.sockets],
|
|
103
|
+
["contact.watches", limits.contact?.watches],
|
|
104
|
+
["network", limits.network],
|
|
105
|
+
["line", limits.line],
|
|
106
|
+
["contacts", limits.contacts],
|
|
107
|
+
];
|
|
108
|
+
for (const [name, value] of counts) {
|
|
109
|
+
if (value !== undefined && !(Number.isInteger(value) && value > 0)) {
|
|
110
|
+
return `browsers.${name} is a whole number over 0`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const contacts = limits.contacts ?? Math.floor(LISTENER * 0.4);
|
|
114
|
+
if (contacts >= LISTENER || (limits.line ?? 0) >= LISTENER) {
|
|
115
|
+
return `browsers: contacts take fewer connections than a listener holds (${LISTENER}), ` +
|
|
116
|
+
"so people always find room";
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
/** Who an actor is, for counting what they hold. */
|
|
121
|
+
const whoOf = (actor) => `${actor.kind}:${actor.id}`;
|
|
122
|
+
/**
|
|
123
|
+
* The pools a contact's connections are counted in with others' (none for
|
|
124
|
+
* anyone else): every contact's here, its web line's, each network's it came from.
|
|
125
|
+
*/
|
|
126
|
+
const poolsOf = (actor) => {
|
|
127
|
+
if (actor.kind !== "contact")
|
|
128
|
+
return [];
|
|
129
|
+
const from = Array.isArray(actor.from) ? actor.from.filter((t) => typeof t === "string") : [];
|
|
130
|
+
return [
|
|
131
|
+
"contacts",
|
|
132
|
+
...(typeof actor.web === "string" ? [`line:${actor.web}`] : []),
|
|
133
|
+
...from.map((tag) => `from:${tag}`),
|
|
134
|
+
];
|
|
135
|
+
};
|
|
136
|
+
/** A read's filter, where it names one (find, findOne, count). */
|
|
137
|
+
const filterOf = (remote) => "op" in remote && "filter" in remote.op ? remote.op.filter : undefined;
|
|
138
|
+
/** What a read says beyond its collection: its filter and options, or a query's params. */
|
|
139
|
+
const sizeOf = (remote) => JSON.stringify("query" in remote
|
|
140
|
+
? remote.params ?? null
|
|
141
|
+
: [remote.op.filter, remote.op.options])?.length ?? 0;
|
|
47
142
|
export function createBrowsers(env) {
|
|
143
|
+
const limits = {
|
|
144
|
+
sockets: 16,
|
|
145
|
+
watches: 512,
|
|
146
|
+
resumes: 16,
|
|
147
|
+
network: 16,
|
|
148
|
+
line: Math.floor(LISTENER * 0.3),
|
|
149
|
+
contacts: Math.floor(LISTENER * 0.4),
|
|
150
|
+
...env.limits,
|
|
151
|
+
contact: { sockets: 2, watches: 32, ...env.limits?.contact },
|
|
152
|
+
};
|
|
153
|
+
const { pool } = limits;
|
|
154
|
+
/** Ready connections, by worker id: their session streams and reads. */
|
|
48
155
|
const connections = new Map();
|
|
49
|
-
/**
|
|
50
|
-
const
|
|
156
|
+
/** Every connection let in, ready or not, by its transport connection. */
|
|
157
|
+
const places = new Map();
|
|
158
|
+
/** Each actor's places, by worker id (a browser), each its connections. */
|
|
159
|
+
const held = new Map();
|
|
160
|
+
/** Contacts' places in each pool (`poolsOf`). */
|
|
161
|
+
const pools = new Map();
|
|
162
|
+
/** The most connections a pool holds. */
|
|
163
|
+
const mostIn = (name) => name === "contacts"
|
|
164
|
+
? limits.contacts
|
|
165
|
+
: name.startsWith("line:")
|
|
166
|
+
? limits.line
|
|
167
|
+
: limits.network * scaleOf(name.slice("from:".length));
|
|
168
|
+
/** The most one actor holds: browsers, and reads watched on each connection. */
|
|
169
|
+
const own = (actor) => actor.kind === "contact" ? limits.contact : limits;
|
|
51
170
|
const DAY = 24 * 60 * 60 * 1000;
|
|
171
|
+
/** What a browser shows to reconnect without a new ticket: once, for its worker id, for a day. */
|
|
172
|
+
const resumes = expiring(DAY);
|
|
173
|
+
/** Each actor's resume credentials, oldest first. */
|
|
174
|
+
const lately = expiring(DAY);
|
|
175
|
+
/** How many times someone was ended; and when each was last (that count), for a day. */
|
|
176
|
+
let ends = 0;
|
|
177
|
+
const ended = expiring(DAY);
|
|
178
|
+
/** Whether an actor was ended after `since` (a count of ends). */
|
|
179
|
+
const endedSince = (actor, since) => (ended.get(whoOf(actor)) ?? 0) > since;
|
|
180
|
+
/** Why a browser can't come in on `workerId` now (a refusal to throw), if it can't. */
|
|
181
|
+
const full = (actor, workerId, since) => {
|
|
182
|
+
if (endedSince(actor, since))
|
|
183
|
+
return refusal("forbidden", "Signed out: sign in again");
|
|
184
|
+
const theirs = held.get(whoOf(actor));
|
|
185
|
+
const same = theirs?.get(workerId);
|
|
186
|
+
const most = own(actor).sockets;
|
|
187
|
+
// A tab already on two connections (one maybe half-open, after a network flap) isn't
|
|
188
|
+
// refused: `take` closes its oldest, and Oxian replaces the older at Ready anyway.
|
|
189
|
+
if (!same && (theirs?.size ?? 0) >= most) {
|
|
190
|
+
return refusal("too_many", `Connected ${most} times already, the most anyone may: close a tab first`, { public: true });
|
|
191
|
+
}
|
|
192
|
+
const named = poolsOf(actor);
|
|
193
|
+
const crowded = named.find((name) => (pools.get(name)?.size ?? 0) >= mostIn(name)) ??
|
|
194
|
+
(named.length && pool && pool.held.size >= pool.most ? "contacts" : undefined);
|
|
195
|
+
if (!crowded)
|
|
196
|
+
return undefined;
|
|
197
|
+
return refusal("too_many", crowded.startsWith("from:")
|
|
198
|
+
? "Too many connections from here: close a tab, or try again later"
|
|
199
|
+
: "This chat is busy right now: try again in a few minutes", { public: true });
|
|
200
|
+
};
|
|
201
|
+
/** A connection let in takes its place: as its actor's (its browser's), and in its pools. */
|
|
202
|
+
const take = (place) => {
|
|
203
|
+
const who = whoOf(place.actor);
|
|
204
|
+
// A tab on two connections already gives up its oldest (never ready after this: refused there).
|
|
205
|
+
const old = held.get(who)?.get(place.workerId);
|
|
206
|
+
while (old && old.size >= 2)
|
|
207
|
+
release(old.values().next().value);
|
|
208
|
+
places.set(place.via, place);
|
|
209
|
+
if (!held.has(who))
|
|
210
|
+
held.set(who, new Map());
|
|
211
|
+
const theirs = held.get(who);
|
|
212
|
+
if (!theirs.has(place.workerId))
|
|
213
|
+
theirs.set(place.workerId, new Set());
|
|
214
|
+
theirs.get(place.workerId).add(place);
|
|
215
|
+
for (const name of poolsOf(place.actor)) {
|
|
216
|
+
if (!pools.has(name))
|
|
217
|
+
pools.set(name, new Set());
|
|
218
|
+
pools.get(name).add(place);
|
|
219
|
+
}
|
|
220
|
+
if (place.actor.kind === "contact")
|
|
221
|
+
pool?.held.add(place);
|
|
222
|
+
};
|
|
223
|
+
/** A connection gone gives its place back. */
|
|
224
|
+
const release = (place) => {
|
|
225
|
+
if (places.get(place.via) !== place)
|
|
226
|
+
return;
|
|
227
|
+
places.delete(place.via);
|
|
228
|
+
const who = whoOf(place.actor);
|
|
229
|
+
const theirs = held.get(who);
|
|
230
|
+
const same = theirs?.get(place.workerId);
|
|
231
|
+
same?.delete(place);
|
|
232
|
+
if (same && !same.size)
|
|
233
|
+
theirs.delete(place.workerId);
|
|
234
|
+
if (theirs && !theirs.size)
|
|
235
|
+
held.delete(who);
|
|
236
|
+
for (const name of poolsOf(place.actor)) {
|
|
237
|
+
const there = pools.get(name);
|
|
238
|
+
there?.delete(place);
|
|
239
|
+
if (there && !there.size)
|
|
240
|
+
pools.delete(name);
|
|
241
|
+
}
|
|
242
|
+
pool?.held.delete(place);
|
|
243
|
+
};
|
|
52
244
|
/** A ready browser: its session stream opens, and its reads may come. */
|
|
53
|
-
const ready = (workerId,
|
|
245
|
+
const ready = (workerId, via) => {
|
|
246
|
+
const place = places.get(via);
|
|
247
|
+
// Ended since it came in (signed out, erased), or never let in here: it isn't anyone's.
|
|
248
|
+
if (!place || place.workerId !== workerId || endedSince(place.actor, place.since)) {
|
|
249
|
+
throw refusal("forbidden", "Signed out: sign in again");
|
|
250
|
+
}
|
|
251
|
+
const { actor } = place;
|
|
54
252
|
connections.get(workerId)?.close();
|
|
55
253
|
const encoder = new TextEncoder();
|
|
56
254
|
let lines;
|
|
@@ -92,6 +290,17 @@ export function createBrowsers(env) {
|
|
|
92
290
|
};
|
|
93
291
|
/** A read, watched: its first result now, and each new one pushed. */
|
|
94
292
|
const watch = (connection, key, remote) => {
|
|
293
|
+
// Checked and taken at once, nothing awaited between: a batch can't overrun it.
|
|
294
|
+
const most = own(connection.actor).watches;
|
|
295
|
+
if (!connection.watches.has(key) && connection.watches.size >= most) {
|
|
296
|
+
return Promise.resolve({
|
|
297
|
+
error: {
|
|
298
|
+
message: `This connection watches ${most} reads, the most it may: ` +
|
|
299
|
+
"stop watching some first",
|
|
300
|
+
code: "too_many",
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
}
|
|
95
304
|
const first = Promise.withResolvers();
|
|
96
305
|
// Asked again: the new watch replaces the old, whose first answer, if still due, is the new one's.
|
|
97
306
|
connection.watches.get(key)?.close(first.promise);
|
|
@@ -101,7 +310,7 @@ export function createBrowsers(env) {
|
|
|
101
310
|
const output = observation.get();
|
|
102
311
|
if (output.status === "loading")
|
|
103
312
|
return;
|
|
104
|
-
const now = answer(output);
|
|
313
|
+
const now = answer(output, connection.actor);
|
|
105
314
|
const text = JSON.stringify(now);
|
|
106
315
|
if (last === undefined)
|
|
107
316
|
first.resolve(now);
|
|
@@ -131,6 +340,10 @@ export function createBrowsers(env) {
|
|
|
131
340
|
// A key asked twice in one batch is one read.
|
|
132
341
|
const once = [...new Map(reads.map((r) => [r.key, r])).values()];
|
|
133
342
|
return await Promise.all(once.map(async ({ key, read }) => {
|
|
343
|
+
// A contact's read is small: each one is matched against every change it might see.
|
|
344
|
+
if (actor.kind === "contact" && sizeOf(read) > CONTACT_READ) {
|
|
345
|
+
return refused(key, `A contact's read says ${CONTACT_READ} bytes at most: name what of its own it reads`);
|
|
346
|
+
}
|
|
134
347
|
// A named query runs when it lets the person (its own reads keep to the rules);
|
|
135
348
|
// read directly, a collection must be one the rules speak for.
|
|
136
349
|
if ("query" in read) {
|
|
@@ -138,9 +351,23 @@ export function createBrowsers(env) {
|
|
|
138
351
|
return refused(key, `${actor.kind} ${actor.id} may not run "${read.collection}.${read.query}".`);
|
|
139
352
|
}
|
|
140
353
|
}
|
|
141
|
-
else if ("collection" in read.op
|
|
142
|
-
|
|
143
|
-
|
|
354
|
+
else if ("collection" in read.op) {
|
|
355
|
+
// A contact's would run again on every change to the collection: theirs aren't these.
|
|
356
|
+
if (actor.kind === "contact" && !["find", "findOne", "count"].includes(read.op.op)) {
|
|
357
|
+
return refused(key, `A contact reads "${read.op.collection}" directly only with find, findOne or ` +
|
|
358
|
+
"count, naming what of its own it reads");
|
|
359
|
+
}
|
|
360
|
+
let ruled;
|
|
361
|
+
try {
|
|
362
|
+
ruled = await env.ruled(actor, read.op.collection, filterOf(read));
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
return { key, error: { ...toldTo(actor, error), code: "forbidden" } };
|
|
366
|
+
}
|
|
367
|
+
if (!ruled) {
|
|
368
|
+
return refused(key, `No rule lets a browser read "${read.op.collection}" directly: ` +
|
|
369
|
+
"read it through one of its queries");
|
|
370
|
+
}
|
|
144
371
|
}
|
|
145
372
|
return { key, ...await watch(connection, key, read) };
|
|
146
373
|
}));
|
|
@@ -159,41 +386,120 @@ export function createBrowsers(env) {
|
|
|
159
386
|
}
|
|
160
387
|
};
|
|
161
388
|
return {
|
|
162
|
-
/** How many browsers are connected. */
|
|
389
|
+
/** How many browsers are connected (ready). */
|
|
163
390
|
count: () => connections.size,
|
|
164
|
-
/**
|
|
165
|
-
|
|
391
|
+
/**
|
|
392
|
+
* Ends every browser's session stream (closing the runtime doesn't wait
|
|
393
|
+
* them out), gives back every place (a pool shared with other runtimes
|
|
394
|
+
* keeps none of this one's), and forgets every resume credential.
|
|
395
|
+
*/
|
|
396
|
+
close: () => {
|
|
166
397
|
for (const connection of [...connections.values()])
|
|
167
398
|
connection.close();
|
|
399
|
+
for (const place of [...places.values()])
|
|
400
|
+
release(place);
|
|
401
|
+
resumes.close();
|
|
402
|
+
lately.close();
|
|
403
|
+
ended.close();
|
|
168
404
|
},
|
|
169
|
-
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
405
|
+
/**
|
|
406
|
+
* How many times someone was ended so far: a browser coming in now is
|
|
407
|
+
* let in after those (`since`), and an end after refuses it.
|
|
408
|
+
*/
|
|
409
|
+
ends: () => ends,
|
|
410
|
+
/** A connection's provider config at admission: who it is, and when it came in (`ends`). */
|
|
411
|
+
config: (actor, since) => ({
|
|
412
|
+
actor: actor,
|
|
413
|
+
since,
|
|
414
|
+
}),
|
|
415
|
+
/**
|
|
416
|
+
* Refuses (thrown) a browser coming in as `actor` on `workerId` now: as
|
|
417
|
+
* many browsers as they may (`too_many`), a pool it's in full; or ended since it began coming in
|
|
418
|
+
* (`forbidden`). Only checks: `take` takes its place.
|
|
419
|
+
*/
|
|
420
|
+
room: (actor, workerId, since) => {
|
|
421
|
+
const refused = full(actor, workerId, since);
|
|
422
|
+
if (refused)
|
|
423
|
+
throw refused;
|
|
424
|
+
},
|
|
425
|
+
/**
|
|
426
|
+
* Oxian's handshake hook, as a browser is let in (before Welcome): it
|
|
427
|
+
* takes its place, or is refused as `room` says (thrown). It keeps it
|
|
428
|
+
* until it goes (`gone`), ready or not.
|
|
429
|
+
*/
|
|
430
|
+
take: (workerId, via, config) => {
|
|
431
|
+
const actor = config.actor;
|
|
432
|
+
const since = Number(config.since);
|
|
433
|
+
const refused = full(actor, workerId, since);
|
|
434
|
+
if (refused)
|
|
435
|
+
throw refused;
|
|
436
|
+
take({ actor, workerId, via, since });
|
|
437
|
+
},
|
|
438
|
+
/**
|
|
439
|
+
* A resume credential for a browser just admitted on `workerId`: it works
|
|
440
|
+
* once, on that worker id. A new one drops their oldest past 16.
|
|
441
|
+
*/
|
|
442
|
+
resume: (actor, workerId) => {
|
|
177
443
|
const secret = crypto.randomUUID() + crypto.randomUUID();
|
|
178
|
-
resumes.set(secret, { actor,
|
|
444
|
+
resumes.set(secret, { actor, workerId });
|
|
445
|
+
const who = whoOf(actor);
|
|
446
|
+
const theirs = (lately.get(who) ?? []).filter((kept) => resumes.get(kept));
|
|
447
|
+
theirs.push(secret);
|
|
448
|
+
while (theirs.length > limits.resumes)
|
|
449
|
+
resumes.delete(theirs.shift());
|
|
450
|
+
lately.set(who, theirs);
|
|
179
451
|
return {
|
|
180
452
|
credential: { kind: "resume", capability: secret },
|
|
181
|
-
expiresAtMs: now + DAY,
|
|
453
|
+
expiresAtMs: Date.now() + DAY,
|
|
182
454
|
};
|
|
183
455
|
},
|
|
184
|
-
/**
|
|
185
|
-
|
|
456
|
+
/**
|
|
457
|
+
* Who a resume credential is, shown by `workerId`, once: it's used up
|
|
458
|
+
* either way, and someone else's (another worker id) is no one.
|
|
459
|
+
*/
|
|
460
|
+
resumed: (secret, workerId) => {
|
|
186
461
|
const kept = resumes.get(secret);
|
|
187
|
-
|
|
462
|
+
resumes.delete(secret);
|
|
463
|
+
return kept?.workerId === workerId ? kept.actor : undefined;
|
|
188
464
|
},
|
|
189
|
-
/** Oxian's ready hook, for a browser's connection (`via`, the transport connection it came on). */
|
|
190
|
-
ready: (workerId, config, via) => ready(workerId, config.actor, via),
|
|
191
465
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* is
|
|
466
|
+
* Ends an actor's browsers (signed out, erased): their resume credentials
|
|
467
|
+
* go; each ready connection, by worker id, is given to `drain`, which
|
|
468
|
+
* ends it; one let in but not yet ready is refused when it says it is. A
|
|
469
|
+
* browser comes back only with a new ticket, which only a cookie that's
|
|
470
|
+
* still someone gets. How many connections it had.
|
|
471
|
+
*/
|
|
472
|
+
end: (actor, drain) => {
|
|
473
|
+
const who = whoOf(actor);
|
|
474
|
+
ended.set(who, ++ends);
|
|
475
|
+
for (const secret of lately.get(who) ?? [])
|
|
476
|
+
resumes.delete(secret);
|
|
477
|
+
lately.delete(who);
|
|
478
|
+
const theirs = [...held.get(who)?.values() ?? []].flatMap((same) => [...same]);
|
|
479
|
+
for (const workerId of new Set(theirs.map((place) => place.workerId))) {
|
|
480
|
+
const connection = connections.get(workerId);
|
|
481
|
+
if (!connection)
|
|
482
|
+
continue;
|
|
483
|
+
connection.close();
|
|
484
|
+
drain(workerId);
|
|
485
|
+
}
|
|
486
|
+
return theirs.length;
|
|
487
|
+
},
|
|
488
|
+
/**
|
|
489
|
+
* Oxian's ready hook, for a browser's connection (`via`, the transport
|
|
490
|
+
* connection it came on): refused (thrown) when it wasn't let in here, or
|
|
491
|
+
* its actor was ended since.
|
|
492
|
+
*/
|
|
493
|
+
ready: (workerId, via) => ready(workerId, via),
|
|
494
|
+
/**
|
|
495
|
+
* Oxian's disconnect hook: its place is given back, and its reads stop
|
|
496
|
+
* being watched. Only the connection that went: a browser back on a new
|
|
497
|
+
* one before the old one is noticed gone keeps its new stream.
|
|
195
498
|
*/
|
|
196
499
|
gone: (workerId, via) => {
|
|
500
|
+
const place = places.get(via);
|
|
501
|
+
if (place)
|
|
502
|
+
release(place);
|
|
197
503
|
const connection = connections.get(workerId);
|
|
198
504
|
if (connection?.via === via)
|
|
199
505
|
connection.close();
|
|
@@ -212,7 +518,7 @@ export function createBrowsers(env) {
|
|
|
212
518
|
return encode({ value: await ask(context.workload, await decode(input), connection) });
|
|
213
519
|
}
|
|
214
520
|
catch (error) {
|
|
215
|
-
return encode({ error:
|
|
521
|
+
return encode({ error: toldTo(connection?.actor, error) });
|
|
216
522
|
}
|
|
217
523
|
};
|
|
218
524
|
},
|
package/runtime/cache.js
CHANGED
|
@@ -13,8 +13,20 @@
|
|
|
13
13
|
* A change made beside the collections (maintenance SQL) can't be followed:
|
|
14
14
|
* the owner then forgets everything (`clear`).
|
|
15
15
|
*/
|
|
16
|
-
import { compareBy, get, matches } from "./mongo.js";
|
|
16
|
+
import { compareBy, get, matches, namedBy, valuesAt } from "./mongo.js";
|
|
17
17
|
import { canonical } from "./registry.js";
|
|
18
|
+
const nameOf = (filter) => {
|
|
19
|
+
const by = namedBy(filter);
|
|
20
|
+
return by && { field: by.field, values: new Set(by.values) };
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The changes that could concern a query: to a document that has what it
|
|
24
|
+
* names, before or after (one it matched, or matches now, has it). Every
|
|
25
|
+
* other leaves its result as it is, so it isn't matched against them.
|
|
26
|
+
*/
|
|
27
|
+
const concerning = (named, changes) => named
|
|
28
|
+
? changes.filter(({ before, after }) => [before, after].some((doc) => doc && valuesAt(doc, named.field).some((v) => named.values.has(v))))
|
|
29
|
+
: changes;
|
|
18
30
|
/** Filters the cache can evaluate exactly like every store does. */
|
|
19
31
|
function evaluable(filter) {
|
|
20
32
|
if (Array.isArray(filter))
|
|
@@ -105,7 +117,13 @@ export function createCache(options = {}) {
|
|
|
105
117
|
remember(collection, null, id);
|
|
106
118
|
}
|
|
107
119
|
if (!options.skip && supported(filter)) {
|
|
108
|
-
touch(finds, key, {
|
|
120
|
+
touch(finds, key, {
|
|
121
|
+
collection,
|
|
122
|
+
filter,
|
|
123
|
+
options,
|
|
124
|
+
docs: [...docs],
|
|
125
|
+
named: nameOf(filter),
|
|
126
|
+
}, maxQueries);
|
|
109
127
|
}
|
|
110
128
|
return docs;
|
|
111
129
|
},
|
|
@@ -123,7 +141,7 @@ export function createCache(options = {}) {
|
|
|
123
141
|
const before = generation(collection);
|
|
124
142
|
const count = await load();
|
|
125
143
|
if (generation(collection) === before && supported(filter)) {
|
|
126
|
-
touch(counts, key, { collection, filter, count }, maxQueries);
|
|
144
|
+
touch(counts, key, { collection, filter, count, named: nameOf(filter) }, maxQueries);
|
|
127
145
|
}
|
|
128
146
|
return count;
|
|
129
147
|
},
|
|
@@ -157,13 +175,15 @@ export function createCache(options = {}) {
|
|
|
157
175
|
for (const change of changes)
|
|
158
176
|
remember(collection, change.after, change._id);
|
|
159
177
|
for (const [key, query] of finds) {
|
|
160
|
-
if (query.collection
|
|
178
|
+
if (query.collection !== collection)
|
|
179
|
+
continue;
|
|
180
|
+
if (!update(query, concerning(query.named, changes)))
|
|
161
181
|
finds.delete(key);
|
|
162
182
|
}
|
|
163
183
|
for (const query of counts.values()) {
|
|
164
184
|
if (query.collection !== collection)
|
|
165
185
|
continue;
|
|
166
|
-
for (const { before, after } of changes) {
|
|
186
|
+
for (const { before, after } of concerning(query.named, changes)) {
|
|
167
187
|
query.count += Number(Boolean(after && matches(after, query.filter))) -
|
|
168
188
|
Number(Boolean(before && matches(before, query.filter)));
|
|
169
189
|
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who's calling, as far as the network says: the caller's address, from the
|
|
3
|
+
* header the app's front sets, believed only through the front. What a
|
|
4
|
+
* plugin that limits callers by address reads them with (MCP's lines, the
|
|
5
|
+
* the web lines), each from its own settings (`CallerSettings`).
|
|
6
|
+
*
|
|
7
|
+
* - **With `front`** (the front's secret): a request without it came around
|
|
8
|
+
* the front, straight to the app: it's refused (`refused`).
|
|
9
|
+
* - **With `hops`:** the entry that many from the end of the header's list,
|
|
10
|
+
* the one the app's own proxy appended.
|
|
11
|
+
* - **An address that can't be read** (none, garbled, too few entries) is
|
|
12
|
+
* no address of its own: it's counted with every other such call, in one
|
|
13
|
+
* tight bucket (`unvouched`), never let through unlimited.
|
|
14
|
+
* - **How it's counted:** an IPv4 address by itself (also written as IPv6,
|
|
15
|
+
* `::ffff:a.b.c.d`); an IPv6 address by its /64 (one customer's network
|
|
16
|
+
* has billions of addresses).
|
|
17
|
+
* - **Exempt ranges** (a shared proxy's: OpenAI's) apply only to an address
|
|
18
|
+
* read this way, never to one the caller claims.
|
|
19
|
+
*
|
|
20
|
+
* Nothing here is kept: what limits count is the plugin's to keep.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Where a caller's address is, when the app's front says it: the header
|
|
24
|
+
* the front sets (`cf-connecting-ip`; `x-forwarded-for`, a list), and why
|
|
25
|
+
* it's believed. A header anyone may send is believed only from the front:
|
|
26
|
+
*
|
|
27
|
+
* - `front`: the front's secret, which it sends in `x-copilotz-front` (the
|
|
28
|
+
* web host's own front header). A request without it came around the
|
|
29
|
+
* front, straight to the app: it's refused.
|
|
30
|
+
* - `hops`: for a list the app's own proxies append to (`x-forwarded-for`:
|
|
31
|
+
* Cloud Run's appends the address it saw), the entry that many from the
|
|
32
|
+
* end. A list header needs it: its first entries are the caller's to say.
|
|
33
|
+
*
|
|
34
|
+
* Callers in `exempt` (CIDR ranges: a shared proxy such as OpenAI's, every
|
|
35
|
+
* ChatGPT user's calls behind a few addresses) aren't limited by address;
|
|
36
|
+
* the plugin's other limits still hold. An address that can't be read is
|
|
37
|
+
* counted with every other such call, as one caller. Without settings, no
|
|
38
|
+
* limit goes by address.
|
|
39
|
+
*
|
|
40
|
+
* **To verify on each deployment** (a wrong setting lets callers choose
|
|
41
|
+
* their address):
|
|
42
|
+
* - with a Cloudflare worker as the front (`front`): that it sets
|
|
43
|
+
* `cf-connecting-ip` to the address Cloudflare saw, overwriting any the
|
|
44
|
+
* caller sent, and that it sends its secret only to the app;
|
|
45
|
+
* - with `x-forwarded-for` (`hops`): how many proxies the app runs behind
|
|
46
|
+
* that each append to it (Cloud Run's front end: 1; a load balancer
|
|
47
|
+
* before it: 2). Too few hops counts a caller's own entry; too many, a
|
|
48
|
+
* proxy's address, every caller's.
|
|
49
|
+
*/
|
|
50
|
+
export type CallerSettings = {
|
|
51
|
+
header: string;
|
|
52
|
+
front?: string;
|
|
53
|
+
hops?: number;
|
|
54
|
+
exempt?: string[];
|
|
55
|
+
};
|
|
56
|
+
/** Who calls: refused (around the front), or what to count them by and whether they're exempt. */
|
|
57
|
+
export type Caller = "refused" | {
|
|
58
|
+
counted: string;
|
|
59
|
+
exempt: boolean;
|
|
60
|
+
};
|
|
61
|
+
/** Calls whose address can't be read, all counted as one. */
|
|
62
|
+
export declare const UNVOUCHED = "unvouched";
|
|
63
|
+
/** Who calls, by the app's `caller` settings; undefined without them (nothing goes by address). */
|
|
64
|
+
export declare function callerFrom(request: Request, caller: CallerSettings | undefined): Caller | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* What an address the network gave (a socket's peer, as the listener saw it)
|
|
67
|
+
* is counted as, as `callerFrom` counts a front's: IPv4 by itself, IPv6 by
|
|
68
|
+
* its /64. Undefined when it isn't an address.
|
|
69
|
+
*/
|
|
70
|
+
export declare function countedOf(address: string): string | undefined;
|
|
71
|
+
/** One network a caller is counted in: its name, its prefix's length, and how many callers it counts as. */
|
|
72
|
+
export type Network = {
|
|
73
|
+
network: string;
|
|
74
|
+
bits: number;
|
|
75
|
+
scale: number;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* How many callers' worth each network counts as, by its prefix's length:
|
|
79
|
+
* an IPv4 address and an IPv6 /64 are one caller; an IPv4 /24 eight (a
|
|
80
|
+
* mobile carrier's addresses are many people's); an IPv6 /56 four (one
|
|
81
|
+
* home's), a /48 eight (one site's, which a tunnel broker hands out free:
|
|
82
|
+
* more than a home, but well under what a line takes from everyone). One
|
|
83
|
+
* that can't be read (`unvouched`, 0) is one.
|
|
84
|
+
*/
|
|
85
|
+
export declare const SCALE: Readonly<Record<number, number>>;
|
|
86
|
+
/**
|
|
87
|
+
* The networks a caller counted as `counted` (`callerFrom`, `countedOf`) is
|
|
88
|
+
* in, narrowest first, so a limit by address holds for its neighbours too:
|
|
89
|
+
* an IPv4 address, then its /24; an IPv6 /64, then its /56 and its /48. Calls
|
|
90
|
+
* whose address can't be read are one network of their own.
|
|
91
|
+
*/
|
|
92
|
+
export declare function networksOf(counted: string): Network[];
|
|
93
|
+
/**
|
|
94
|
+
* How many callers a network's tag counts as: a tag is `<bits>-<…>` (the
|
|
95
|
+
* the web lines tag each network a visitor came from that way, an
|
|
96
|
+
* HMAC after the dash: never the address). One, for anything else.
|
|
97
|
+
*/
|
|
98
|
+
export declare const scaleOf: (tag: string) => number;
|
|
99
|
+
type Bits = {
|
|
100
|
+
bits: bigint;
|
|
101
|
+
size: 32 | 128;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* An address as bits: IPv4 in 32; IPv6 in 128, unless it's an IPv4 address
|
|
105
|
+
* written as one (`::ffff:a.b.c.d`, `::ffff:cb00:7163`), which is IPv4.
|
|
106
|
+
* Undefined when it isn't an address. A zone (`%eth0`) or brackets aren't taken.
|
|
107
|
+
*/
|
|
108
|
+
export declare function addressOf(text: string): Bits | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Whether an address (a socket's peer) is this machine's or a private
|
|
111
|
+
* network's: loopback, RFC 1918, link-local, shared (100.64/10), unique
|
|
112
|
+
* local. A caller seen there is most likely a proxy before the app.
|
|
113
|
+
*/
|
|
114
|
+
export declare function privateAddress(text: string): boolean;
|
|
115
|
+
/** What's wrong with how a plugin reads who's calling, if anything (checked when the app starts). */
|
|
116
|
+
export declare function callerProblem(caller: CallerSettings | undefined): string | undefined;
|
|
117
|
+
export {};
|