@cello-protocol/cli 0.0.305 → 0.0.307
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/.claude-plugin/marketplace.json +15 -0
- package/README.md +107 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +564 -0
- package/dist/daemon/account-page-assets.d.ts +4 -0
- package/dist/daemon/account-page-assets.js +160 -0
- package/dist/daemon/account-page.d.ts +14 -0
- package/dist/daemon/account-page.js +104 -0
- package/dist/daemon/address.d.ts +10 -0
- package/dist/daemon/address.js +34 -0
- package/dist/daemon/away.d.ts +31 -0
- package/dist/daemon/away.js +65 -0
- package/dist/daemon/channel-store.d.ts +112 -0
- package/dist/daemon/channel-store.js +284 -0
- package/dist/daemon/channels.d.ts +46 -0
- package/dist/daemon/channels.js +1049 -0
- package/dist/daemon/contacts.d.ts +26 -0
- package/dist/daemon/contacts.js +74 -0
- package/dist/daemon/engine.d.ts +80 -0
- package/dist/daemon/engine.js +2882 -0
- package/dist/daemon/errors.d.ts +5 -0
- package/dist/daemon/errors.js +16 -0
- package/dist/daemon/governance.d.ts +66 -0
- package/dist/daemon/governance.js +514 -0
- package/dist/daemon/guards.d.ts +36 -0
- package/dist/daemon/guards.js +140 -0
- package/dist/daemon/issuer-client.d.ts +56 -0
- package/dist/daemon/issuer-client.js +143 -0
- package/dist/daemon/link.d.ts +30 -0
- package/dist/daemon/link.js +191 -0
- package/dist/daemon/log.d.ts +1 -0
- package/dist/daemon/log.js +4 -0
- package/dist/daemon/main.d.ts +1 -0
- package/dist/daemon/main.js +511 -0
- package/dist/daemon/paths.d.ts +6 -0
- package/dist/daemon/paths.js +21 -0
- package/dist/daemon/pii.d.ts +24 -0
- package/dist/daemon/pii.js +146 -0
- package/dist/daemon/policy-cadence.d.ts +33 -0
- package/dist/daemon/policy-cadence.js +59 -0
- package/dist/daemon/policy-proposals.d.ts +41 -0
- package/dist/daemon/policy-proposals.js +83 -0
- package/dist/daemon/policy-store.d.ts +47 -0
- package/dist/daemon/policy-store.js +144 -0
- package/dist/daemon/presented.d.ts +36 -0
- package/dist/daemon/presented.js +94 -0
- package/dist/daemon/rate-limit.d.ts +17 -0
- package/dist/daemon/rate-limit.js +44 -0
- package/dist/daemon/reach.d.ts +63 -0
- package/dist/daemon/reach.js +207 -0
- package/dist/daemon/screening.d.ts +97 -0
- package/dist/daemon/screening.js +362 -0
- package/dist/daemon/settings.d.ts +125 -0
- package/dist/daemon/settings.js +73 -0
- package/dist/daemon/signal-rules.d.ts +55 -0
- package/dist/daemon/signal-rules.js +127 -0
- package/dist/daemon/signal-store.d.ts +53 -0
- package/dist/daemon/signal-store.js +114 -0
- package/dist/daemon/store.d.ts +188 -0
- package/dist/daemon/store.js +474 -0
- package/dist/daemon/tiers.d.ts +14 -0
- package/dist/daemon/tiers.js +9 -0
- package/dist/daemon/wallet.d.ts +73 -0
- package/dist/daemon/wallet.js +428 -0
- package/dist/daemon/who-label.d.ts +3 -0
- package/dist/daemon/who-label.js +11 -0
- package/dist/guidance.d.ts +39 -0
- package/dist/guidance.js +98 -0
- package/dist/hermes-bridge.d.ts +26 -0
- package/dist/hermes-bridge.js +180 -0
- package/dist/install-mcp.d.ts +6 -0
- package/dist/install-mcp.js +77 -0
- package/dist/ipc/client.d.ts +18 -0
- package/dist/ipc/client.js +107 -0
- package/dist/ipc/operations.d.ts +30 -0
- package/dist/ipc/operations.js +835 -0
- package/dist/ipc/protocol.d.ts +21 -0
- package/dist/ipc/protocol.js +1 -0
- package/dist/issuer-list-sign.d.ts +12 -0
- package/dist/issuer-list-sign.js +43 -0
- package/dist/local-operations.d.ts +2 -0
- package/dist/local-operations.js +73 -0
- package/dist/mcp-tools.d.ts +14 -0
- package/dist/mcp-tools.js +45 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +155 -0
- package/dist/protocol/aead.d.ts +4 -0
- package/dist/protocol/aead.js +35 -0
- package/dist/protocol/cbor.d.ts +40 -0
- package/dist/protocol/cbor.js +106 -0
- package/dist/protocol/chain.d.ts +44 -0
- package/dist/protocol/chain.js +126 -0
- package/dist/protocol/channel.d.ts +153 -0
- package/dist/protocol/channel.js +298 -0
- package/dist/protocol/encode.d.ts +6 -0
- package/dist/protocol/encode.js +21 -0
- package/dist/protocol/identity.d.ts +27 -0
- package/dist/protocol/identity.js +94 -0
- package/dist/protocol/issuer-list.d.ts +56 -0
- package/dist/protocol/issuer-list.js +193 -0
- package/dist/protocol/issuer-roots.d.ts +6 -0
- package/dist/protocol/issuer-roots.js +10 -0
- package/dist/protocol/key-agreement.d.ts +20 -0
- package/dist/protocol/key-agreement.js +88 -0
- package/dist/protocol/merkle.d.ts +16 -0
- package/dist/protocol/merkle.js +166 -0
- package/dist/protocol/ml-dsa.d.ts +28 -0
- package/dist/protocol/ml-dsa.js +58 -0
- package/dist/protocol/ml-kem.d.ts +14 -0
- package/dist/protocol/ml-kem.js +57 -0
- package/dist/protocol/pq-errors.d.ts +9 -0
- package/dist/protocol/pq-errors.js +23 -0
- package/dist/protocol/pq-warnings.d.ts +1 -0
- package/dist/protocol/pq-warnings.js +18 -0
- package/dist/protocol/presented-signals.d.ts +17 -0
- package/dist/protocol/presented-signals.js +92 -0
- package/dist/protocol/salt.d.ts +5 -0
- package/dist/protocol/salt.js +47 -0
- package/dist/protocol/seal.d.ts +58 -0
- package/dist/protocol/seal.js +220 -0
- package/dist/protocol/signal.d.ts +54 -0
- package/dist/protocol/signal.js +266 -0
- package/dist/protocol/status.d.ts +41 -0
- package/dist/protocol/status.js +64 -0
- package/dist/protocol/structures.d.ts +359 -0
- package/dist/protocol/structures.js +296 -0
- package/dist/protocol/transcript.d.ts +61 -0
- package/dist/protocol/transcript.js +319 -0
- package/dist/protocol/wire.d.ts +212 -0
- package/dist/protocol/wire.js +161 -0
- package/dist/require-node.d.ts +1 -0
- package/dist/require-node.js +10 -0
- package/dist/screener/affordance.d.ts +1 -0
- package/dist/screener/affordance.js +2 -0
- package/dist/screener/classifier-selfcheck.d.ts +29 -0
- package/dist/screener/classifier-selfcheck.js +56 -0
- package/dist/screener/exfil.d.ts +11 -0
- package/dist/screener/exfil.js +45 -0
- package/dist/screener/gitleaks-rules.d.ts +9 -0
- package/dist/screener/gitleaks-rules.js +226 -0
- package/dist/screener/inbound.d.ts +25 -0
- package/dist/screener/inbound.js +102 -0
- package/dist/screener/injection-classifier-onnx.d.ts +20 -0
- package/dist/screener/injection-classifier-onnx.js +89 -0
- package/dist/screener/injection-classifier-wasm.d.ts +2 -0
- package/dist/screener/injection-classifier-wasm.js +97 -0
- package/dist/screener/injection-patterns.d.ts +8 -0
- package/dist/screener/injection-patterns.js +48 -0
- package/dist/screener/injection-windows.d.ts +9 -0
- package/dist/screener/injection-windows.js +37 -0
- package/dist/screener/language.d.ts +15 -0
- package/dist/screener/language.js +71 -0
- package/dist/screener/linear-regex.d.ts +8 -0
- package/dist/screener/linear-regex.js +27 -0
- package/dist/screener/model-installer.d.ts +14 -0
- package/dist/screener/model-installer.js +61 -0
- package/dist/screener/outbound.d.ts +19 -0
- package/dist/screener/outbound.js +62 -0
- package/dist/screener/sanitize.d.ts +44 -0
- package/dist/screener/sanitize.js +361 -0
- package/dist/screener/scan-variants.d.ts +5 -0
- package/dist/screener/scan-variants.js +146 -0
- package/dist/screener/screener-model-manifest.d.ts +16 -0
- package/dist/screener/screener-model-manifest.js +20 -0
- package/dist/screener/screener-state.d.ts +29 -0
- package/dist/screener/screener-state.js +119 -0
- package/dist/screener/secrets.d.ts +18 -0
- package/dist/screener/secrets.js +84 -0
- package/dist/screener/worker.d.ts +6 -0
- package/dist/screener/worker.js +83 -0
- package/dist/setup.d.ts +9 -0
- package/dist/setup.js +252 -0
- package/dist/shipped-issuer-list.d.ts +1 -0
- package/dist/shipped-issuer-list.js +3 -0
- package/dist/signals-text.d.ts +46 -0
- package/dist/signals-text.js +81 -0
- package/dist/verify-seal.d.ts +9 -0
- package/dist/verify-seal.js +30 -0
- package/hermes/plugin/__init__.py +1040 -0
- package/hermes/plugin/plugin.yaml +30 -0
- package/hermes/skills/cello-bridge-setup/SKILL.md +38 -0
- package/hermes/skills/cello-policy/SKILL.md +44 -0
- package/package.json +48 -16
- package/plugins/cello/.claude-plugin/plugin.json +19 -0
- package/plugins/cello/.mcp.json +7 -0
- package/plugins/cello/skills/cello/SKILL.md +117 -0
- package/dist/arg-parse.d.ts +0 -19
- package/dist/arg-parse.d.ts.map +0 -1
- package/dist/arg-parse.js +0 -29
- package/dist/arg-parse.js.map +0 -1
- package/dist/bin/cello.d.ts +0 -15
- package/dist/bin/cello.d.ts.map +0 -1
- package/dist/bin/cello.js +0 -110
- package/dist/bin/cello.js.map +0 -1
- package/dist/cli-args.d.ts +0 -62
- package/dist/cli-args.d.ts.map +0 -1
- package/dist/cli-args.js +0 -129
- package/dist/cli-args.js.map +0 -1
- package/dist/commands.d.ts +0 -196
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -1544
- package/dist/commands.js.map +0 -1
- package/dist/hermes/assets.d.ts +0 -41
- package/dist/hermes/assets.d.ts.map +0 -1
- package/dist/hermes/assets.js +0 -2281
- package/dist/hermes/assets.js.map +0 -1
- package/dist/hermes/install-hermes.d.ts +0 -50
- package/dist/hermes/install-hermes.d.ts.map +0 -1
- package/dist/hermes/install-hermes.js +0 -232
- package/dist/hermes/install-hermes.js.map +0 -1
- package/dist/json-out.d.ts +0 -41
- package/dist/json-out.d.ts.map +0 -1
- package/dist/json-out.js +0 -59
- package/dist/json-out.js.map +0 -1
- package/dist/node-runtime-guard-init.d.ts +0 -6
- package/dist/node-runtime-guard-init.d.ts.map +0 -1
- package/dist/node-runtime-guard-init.js +0 -7
- package/dist/node-runtime-guard-init.js.map +0 -1
- package/dist/node-runtime-guard.d.ts +0 -48
- package/dist/node-runtime-guard.d.ts.map +0 -1
- package/dist/node-runtime-guard.js +0 -79
- package/dist/node-runtime-guard.js.map +0 -1
- package/dist/parity-commands.d.ts +0 -427
- package/dist/parity-commands.d.ts.map +0 -1
- package/dist/parity-commands.js +0 -953
- package/dist/parity-commands.js.map +0 -1
- package/dist/registry.d.ts +0 -120
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -2169
- package/dist/registry.js.map +0 -1
- package/dist/screener-commands.d.ts +0 -85
- package/dist/screener-commands.d.ts.map +0 -1
- package/dist/screener-commands.js +0 -313
- package/dist/screener-commands.js.map +0 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// What this daemon holds so signals can travel sealed with a call: each agent's encryption keys, and the signals the other side presented.
|
|
2
|
+
// Both live in the encrypted database. A key's seed is as private as the agent's own seeds beside it.
|
|
3
|
+
import { mlKemGenerateSeed, mlKemKeypairFromSeed } from "../protocol/ml-kem.js";
|
|
4
|
+
import { encryptionKeyBytes } from "../protocol/structures.js";
|
|
5
|
+
import { signedEncryptionKey } from "../protocol/wire.js";
|
|
6
|
+
import { logEvent } from "./log.js";
|
|
7
|
+
export function ensurePresentedSchema(db) {
|
|
8
|
+
db.exec(`
|
|
9
|
+
CREATE TABLE IF NOT EXISTS encryption_keys (
|
|
10
|
+
agent_id BLOB NOT NULL REFERENCES agents(agent_id),
|
|
11
|
+
revision INTEGER NOT NULL,
|
|
12
|
+
kem_seed BLOB NOT NULL,
|
|
13
|
+
signed TEXT NOT NULL,
|
|
14
|
+
published INTEGER NOT NULL DEFAULT 0,
|
|
15
|
+
created_at INTEGER NOT NULL,
|
|
16
|
+
PRIMARY KEY (agent_id, revision)
|
|
17
|
+
);
|
|
18
|
+
-- The signals one side showed with a call, kept as the signed files they came as, so each is checked again whenever it is read.
|
|
19
|
+
-- side is who presented them: caller or callee.
|
|
20
|
+
CREATE TABLE IF NOT EXISTS presented_signals (
|
|
21
|
+
agent_id BLOB NOT NULL,
|
|
22
|
+
session_id BLOB NOT NULL,
|
|
23
|
+
side TEXT NOT NULL CHECK (side IN ('caller', 'callee')),
|
|
24
|
+
ord INTEGER NOT NULL,
|
|
25
|
+
file BLOB NOT NULL,
|
|
26
|
+
received_at INTEGER NOT NULL,
|
|
27
|
+
PRIMARY KEY (agent_id, session_id, side, ord)
|
|
28
|
+
);
|
|
29
|
+
-- What came with a call that couldn't be used at all, so "nothing was sent" and "something was sent that didn't open" read differently.
|
|
30
|
+
CREATE TABLE IF NOT EXISTS presented_unreadable (
|
|
31
|
+
agent_id BLOB NOT NULL,
|
|
32
|
+
session_id BLOB NOT NULL,
|
|
33
|
+
side TEXT NOT NULL CHECK (side IN ('caller', 'callee')),
|
|
34
|
+
PRIMARY KEY (agent_id, session_id, side)
|
|
35
|
+
);`);
|
|
36
|
+
}
|
|
37
|
+
export class EncryptionKeys {
|
|
38
|
+
#db;
|
|
39
|
+
constructor(store) {
|
|
40
|
+
this.#db = store.raw();
|
|
41
|
+
}
|
|
42
|
+
latest(agentId) {
|
|
43
|
+
return this.#db.get("SELECT * FROM encryption_keys WHERE agent_id = ? ORDER BY revision DESC LIMIT 1", [agentId]);
|
|
44
|
+
}
|
|
45
|
+
// Newest first, because a caller may have sealed to a key since replaced, and an old one is kept to open what was sealed to it.
|
|
46
|
+
seeds(agentId) {
|
|
47
|
+
return this.#db.all("SELECT kem_seed FROM encryption_keys WHERE agent_id = ? ORDER BY revision DESC", [agentId]).map((row) => new Uint8Array(row.kem_seed));
|
|
48
|
+
}
|
|
49
|
+
// The agent's first key, or the next revision. Not published until the server has taken it.
|
|
50
|
+
async make(agent) {
|
|
51
|
+
const previous = this.latest(agent.signer.id);
|
|
52
|
+
const revision = (previous?.revision ?? 0) + 1;
|
|
53
|
+
const seed = mlKemGenerateSeed();
|
|
54
|
+
const { publicKey } = await mlKemKeypairFromSeed(seed);
|
|
55
|
+
const fields = { agentId: agent.signer.id, mlKemPublic: publicKey, revision, issuedAt: Date.now() };
|
|
56
|
+
const signature = await agent.signer.sign("cello-agent-encryption-key", encryptionKeyBytes(fields));
|
|
57
|
+
const signed = JSON.stringify(signedEncryptionKey.encode({ fields, signature }));
|
|
58
|
+
this.#db.run("INSERT INTO encryption_keys (agent_id, revision, kem_seed, signed, published, created_at) VALUES (?, ?, ?, ?, 0, ?)", [agent.signer.id, revision, seed, signed, Date.now()]);
|
|
59
|
+
logEvent("encryption_key.made", { revision });
|
|
60
|
+
return this.latest(agent.signer.id);
|
|
61
|
+
}
|
|
62
|
+
// The latest key if the server doesn't hold it yet, making the first one if the agent has none.
|
|
63
|
+
async unpublished(agent) {
|
|
64
|
+
const row = this.latest(agent.signer.id) ?? await this.make(agent);
|
|
65
|
+
return row.published === 1 ? null : { revision: row.revision, wire: JSON.parse(row.signed) };
|
|
66
|
+
}
|
|
67
|
+
markPublished(agentId, revision) {
|
|
68
|
+
this.#db.run("UPDATE encryption_keys SET published = 1 WHERE agent_id = ? AND revision = ?", [agentId, revision]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export class PresentedStore {
|
|
72
|
+
#db;
|
|
73
|
+
constructor(store) {
|
|
74
|
+
this.#db = store.raw();
|
|
75
|
+
}
|
|
76
|
+
// One write per session and side: a repeat leaves what was kept.
|
|
77
|
+
put(agentId, sessionId, side, files) {
|
|
78
|
+
if (files === "unreadable") {
|
|
79
|
+
this.#db.run("INSERT OR IGNORE INTO presented_unreadable (agent_id, session_id, side) VALUES (?, ?, ?)", [agentId, sessionId, side]);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this.#db.get("SELECT 1 AS one FROM presented_signals WHERE agent_id = ? AND session_id = ? AND side = ?", [agentId, sessionId, side]))
|
|
83
|
+
return;
|
|
84
|
+
files.forEach((file, ord) => {
|
|
85
|
+
this.#db.run("INSERT OR IGNORE INTO presented_signals (agent_id, session_id, side, ord, file, received_at) VALUES (?, ?, ?, ?, ?, ?)", [agentId, sessionId, side, ord, file, Date.now()]);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
files(agentId, sessionId, side) {
|
|
89
|
+
return this.#db.all("SELECT file FROM presented_signals WHERE agent_id = ? AND session_id = ? AND side = ? ORDER BY ord", [agentId, sessionId, side]).map((row) => new Uint8Array(row.file));
|
|
90
|
+
}
|
|
91
|
+
unreadable(agentId, sessionId, side) {
|
|
92
|
+
return this.#db.get("SELECT 1 AS one FROM presented_unreadable WHERE agent_id = ? AND session_id = ? AND side = ?", [agentId, sessionId, side]) !== undefined;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface RateLimitConfig {
|
|
2
|
+
maxPerWindow: number;
|
|
3
|
+
windowMs: number;
|
|
4
|
+
}
|
|
5
|
+
export interface RateLimitVerdict {
|
|
6
|
+
limited: boolean;
|
|
7
|
+
reason?: "rate_limited";
|
|
8
|
+
guidance?: string;
|
|
9
|
+
retryAfterMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class OutboundRateLimiter {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(config: RateLimitConfig, now?: () => number);
|
|
14
|
+
peek(agentIdentity: string): RateLimitVerdict;
|
|
15
|
+
record(agentIdentity: string): void;
|
|
16
|
+
check(agentIdentity: string): RateLimitVerdict;
|
|
17
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export class OutboundRateLimiter {
|
|
2
|
+
#config;
|
|
3
|
+
#now;
|
|
4
|
+
#sends = new Map();
|
|
5
|
+
constructor(config, now = () => Date.now()) {
|
|
6
|
+
this.#config = config;
|
|
7
|
+
this.#now = now;
|
|
8
|
+
}
|
|
9
|
+
#live(agentIdentity, now) {
|
|
10
|
+
const all = this.#sends.get(agentIdentity);
|
|
11
|
+
return all ? all.filter((t) => t > now - this.#config.windowMs) : [];
|
|
12
|
+
}
|
|
13
|
+
peek(agentIdentity) {
|
|
14
|
+
const now = this.#now();
|
|
15
|
+
const live = this.#live(agentIdentity, now);
|
|
16
|
+
if (live.length >= this.#config.maxPerWindow) {
|
|
17
|
+
const oldest = live[0];
|
|
18
|
+
const retryAfterMs = Math.max(1, oldest + this.#config.windowMs - now);
|
|
19
|
+
return {
|
|
20
|
+
limited: true,
|
|
21
|
+
reason: "rate_limited",
|
|
22
|
+
guidance: `Outbound rate limit reached for this agent (${this.#config.maxPerWindow} messages per ` +
|
|
23
|
+
`${Math.round(this.#config.windowMs / 1000)}s). This message was not sent. ` +
|
|
24
|
+
`WHAT YOU CAN DO NOW: wait about ${Math.ceil(retryAfterMs / 1000)}s and retry — the window ` +
|
|
25
|
+
`slides as older messages age out, so this clears itself.\n` +
|
|
26
|
+
"To allow more, a person runs: cello config-set rate_max_per_window <higher number>",
|
|
27
|
+
retryAfterMs,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return { limited: false };
|
|
31
|
+
}
|
|
32
|
+
record(agentIdentity) {
|
|
33
|
+
const now = this.#now();
|
|
34
|
+
const live = this.#live(agentIdentity, now);
|
|
35
|
+
live.push(now);
|
|
36
|
+
this.#sends.set(agentIdentity, live);
|
|
37
|
+
}
|
|
38
|
+
check(agentIdentity) {
|
|
39
|
+
const v = this.peek(agentIdentity);
|
|
40
|
+
if (!v.limited)
|
|
41
|
+
this.record(agentIdentity);
|
|
42
|
+
return v;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Store } from "./store.ts";
|
|
2
|
+
import { type SettableTier } from "./tiers.ts";
|
|
3
|
+
export declare const CALLING_RAISES_KEY = "contacts.calling_raises_to_known";
|
|
4
|
+
export declare const CHECK_BELOW_KEY = "calling.check_below";
|
|
5
|
+
interface AgentSetting {
|
|
6
|
+
default: string;
|
|
7
|
+
kind: "number" | "text" | "switch" | "tier";
|
|
8
|
+
neutral?: boolean;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
loosensWhen?: "higher" | "lower";
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const AGENT_SETTINGS: Record<string, AgentSetting>;
|
|
15
|
+
export interface TierRow {
|
|
16
|
+
tier: SettableTier;
|
|
17
|
+
max_sessions: number;
|
|
18
|
+
max_bytes: number;
|
|
19
|
+
not_accepting: number;
|
|
20
|
+
away_text: string | null;
|
|
21
|
+
bytes_reset_minutes: number;
|
|
22
|
+
}
|
|
23
|
+
export interface Limits {
|
|
24
|
+
max_sessions: number;
|
|
25
|
+
max_bytes: number;
|
|
26
|
+
shut: boolean;
|
|
27
|
+
bytes_reset_minutes: number;
|
|
28
|
+
}
|
|
29
|
+
export type Direction = "loosen" | "tighten" | "neutral";
|
|
30
|
+
export interface SettingChange {
|
|
31
|
+
direction: Direction;
|
|
32
|
+
from: string;
|
|
33
|
+
to: string;
|
|
34
|
+
apply(): void;
|
|
35
|
+
}
|
|
36
|
+
export declare class Reach {
|
|
37
|
+
#private;
|
|
38
|
+
constructor(store: Store);
|
|
39
|
+
writeDefaults(agentId: Uint8Array): void;
|
|
40
|
+
tiers(agentId: Uint8Array): TierRow[];
|
|
41
|
+
limitsFor(agentId: Uint8Array, tier: number): Limits;
|
|
42
|
+
setting(agentId: Uint8Array, key: string): string;
|
|
43
|
+
number(agentId: Uint8Array, key: string): number;
|
|
44
|
+
settings(agentId: Uint8Array): {
|
|
45
|
+
key: string;
|
|
46
|
+
value: string;
|
|
47
|
+
default: string;
|
|
48
|
+
description: string;
|
|
49
|
+
}[];
|
|
50
|
+
plan(agentId: Uint8Array, key: string, raw: string | null): SettingChange;
|
|
51
|
+
addRefusal(agentId: Uint8Array, contactId: Uint8Array, reason: string, tells: boolean, cooldownMs: number): boolean;
|
|
52
|
+
offeredName(agentId: Uint8Array): string | undefined;
|
|
53
|
+
setOfferedName(agentId: Uint8Array, name: string): void;
|
|
54
|
+
refusals(agentId: Uint8Array): {
|
|
55
|
+
contact_id: Uint8Array;
|
|
56
|
+
first_refused_at: number;
|
|
57
|
+
last_refused_at: number;
|
|
58
|
+
times: number;
|
|
59
|
+
last_reason: string;
|
|
60
|
+
}[];
|
|
61
|
+
forgetRefusal(agentId: Uint8Array, contactId: Uint8Array): void;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// How reachable an agent is to each tier, and its other per-agent settings. Every default is written to the database when
|
|
2
|
+
// the agent is created, so moving the database moves all of it. Blocked is fixed at nothing, and takes no settings.
|
|
3
|
+
import { LocalError } from "./errors.js";
|
|
4
|
+
import { SETTABLE_TIERS, TIER, tierName } from "./tiers.js";
|
|
5
|
+
const MIB = 1024 * 1024;
|
|
6
|
+
const SCHEMA = `
|
|
7
|
+
CREATE TABLE IF NOT EXISTS tier_settings (
|
|
8
|
+
agent_id BLOB NOT NULL REFERENCES agents(agent_id),
|
|
9
|
+
tier TEXT NOT NULL CHECK (tier IN ('unknown', 'known', 'whitelisted', 'vip')),
|
|
10
|
+
max_sessions INTEGER NOT NULL CHECK (max_sessions >= 1),
|
|
11
|
+
max_bytes INTEGER NOT NULL CHECK (max_bytes >= 1),
|
|
12
|
+
not_accepting INTEGER NOT NULL DEFAULT 0,
|
|
13
|
+
away_text TEXT,
|
|
14
|
+
-- A byte count starts again after this many minutes of quiet. 0 means it never does.
|
|
15
|
+
bytes_reset_minutes INTEGER NOT NULL DEFAULT 0,
|
|
16
|
+
PRIMARY KEY (agent_id, tier)
|
|
17
|
+
);
|
|
18
|
+
CREATE TABLE IF NOT EXISTS agent_settings (
|
|
19
|
+
agent_id BLOB NOT NULL REFERENCES agents(agent_id),
|
|
20
|
+
key TEXT NOT NULL,
|
|
21
|
+
value TEXT NOT NULL,
|
|
22
|
+
updated_at INTEGER NOT NULL,
|
|
23
|
+
PRIMARY KEY (agent_id, key)
|
|
24
|
+
);
|
|
25
|
+
CREATE TABLE IF NOT EXISTS refused_callers (
|
|
26
|
+
agent_id BLOB NOT NULL REFERENCES agents(agent_id),
|
|
27
|
+
contact_id BLOB NOT NULL,
|
|
28
|
+
first_refused_at INTEGER NOT NULL,
|
|
29
|
+
last_refused_at INTEGER NOT NULL,
|
|
30
|
+
times INTEGER NOT NULL,
|
|
31
|
+
last_reason TEXT NOT NULL,
|
|
32
|
+
last_alarm_at INTEGER NOT NULL DEFAULT 0,
|
|
33
|
+
PRIMARY KEY (agent_id, contact_id)
|
|
34
|
+
);
|
|
35
|
+
`;
|
|
36
|
+
const TIER_DEFAULTS = {
|
|
37
|
+
unknown: { max_sessions: 3, max_bytes: 25 * MIB, bytes_reset_minutes: 0 },
|
|
38
|
+
known: { max_sessions: 5, max_bytes: 100 * MIB, bytes_reset_minutes: 120 },
|
|
39
|
+
whitelisted: { max_sessions: 20, max_bytes: 500 * MIB, bytes_reset_minutes: 120 },
|
|
40
|
+
vip: { max_sessions: 50, max_bytes: 2048 * MIB, bytes_reset_minutes: 120 },
|
|
41
|
+
};
|
|
42
|
+
export const CALLING_RAISES_KEY = "contacts.calling_raises_to_known";
|
|
43
|
+
export const CHECK_BELOW_KEY = "calling.check_below";
|
|
44
|
+
export const AGENT_SETTINGS = {
|
|
45
|
+
// Ruled off on 4 November: a lure could get itself raised just by persuading an agent to dial it.
|
|
46
|
+
[CALLING_RAISES_KEY]: { default: "false", kind: "switch", description: "Whether this agent calling a stranger raises it to known. Replying to one always does." },
|
|
47
|
+
// Unknown turns the check off, because only a block sits below it, and a block has its own stop.
|
|
48
|
+
[CHECK_BELOW_KEY]: { default: "known", kind: "tier", loosensWhen: "lower", description: "Calling an agent below this tier stops with a warning to check its public signals first, unless the call says --anyway. unknown turns it off. known catches every stranger." },
|
|
49
|
+
"limits.stranger_pool": { default: "50", kind: "number", min: 1, max: 100_000, loosensWhen: "higher", description: "Open sessions all strangers together can have with this agent." },
|
|
50
|
+
"limits.quiet_minutes": { default: "120", kind: "number", min: 1, max: 5_256_000, loosensWhen: "lower", description: "A session stops counting toward its caller's limit after this long with nothing new. It stays open." },
|
|
51
|
+
"limits.cap_alarm_minutes": { default: "10", kind: "number", min: 0, max: 100_000, description: "The shortest gap between two notices that one caller keeps hitting a limit." },
|
|
52
|
+
"away.answering": { default: "true", kind: "switch", neutral: true, description: "Whether a call nobody is reachable for gets a greeting, and its first message ends the visit. Off, such a call just waits." },
|
|
53
|
+
"away.default": { default: "", kind: "text", description: "This agent's own away text, for any tier without its own." },
|
|
54
|
+
"away.system.stranger": { default: "Dispatched.", kind: "text", description: "The away text of last resort, for a stranger." },
|
|
55
|
+
"away.system.known": { default: "{name} is currently away. Leave a message (send with signal: wrap to close) and it will be read when they return.", kind: "text", description: "The away text of last resort, for a known caller. {name} is this agent's name." },
|
|
56
|
+
"away.max_chars": { default: "2048", kind: "number", min: 1, max: 100_000, description: "The longest away text allowed." },
|
|
57
|
+
"policy.text_max": { default: "2000", kind: "number", min: 1, max: 100_000, description: "The longest written policy allowed." },
|
|
58
|
+
"policy.every_n": { default: "10", kind: "number", min: 1, max: 100_000, description: "A conduct policy rides on a delivery again after this many messages, unless the policy says otherwise." },
|
|
59
|
+
"policy.proposal_hours": { default: "24", kind: "number", min: 1, max: 100_000, description: "How long a proposed policy waits for approval before it's dropped." },
|
|
60
|
+
};
|
|
61
|
+
const FIELDS = ["max_sessions", "max_bytes", "not_accepting", "bytes_reset_minutes"];
|
|
62
|
+
const byMagnitude = (from, to) => (to > from ? "loosen" : to < from ? "tighten" : "neutral");
|
|
63
|
+
// 0 never resets, the tightest. Otherwise a shorter wait gives the sender room back sooner.
|
|
64
|
+
function resetDirection(from, to) {
|
|
65
|
+
const wait = (minutes) => (minutes === 0 ? Infinity : minutes);
|
|
66
|
+
return wait(to) < wait(from) ? "loosen" : wait(to) > wait(from) ? "tighten" : "neutral";
|
|
67
|
+
}
|
|
68
|
+
function parseKey(key) {
|
|
69
|
+
const parts = key.split(".");
|
|
70
|
+
if (parts[0] === "bounds" && parts.length === 3 && SETTABLE_TIERS.includes(parts[1]) && FIELDS.includes(parts[2]))
|
|
71
|
+
return { tier: parts[1], field: parts[2] };
|
|
72
|
+
if (parts[0] === "away" && parts[1] === "tier" && parts.length === 3 && SETTABLE_TIERS.includes(parts[2]))
|
|
73
|
+
return { tier: parts[2], field: "away" };
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
export class Reach {
|
|
77
|
+
#store;
|
|
78
|
+
constructor(store) {
|
|
79
|
+
this.#store = store;
|
|
80
|
+
store.exec(SCHEMA);
|
|
81
|
+
}
|
|
82
|
+
writeDefaults(agentId) {
|
|
83
|
+
const now = Date.now();
|
|
84
|
+
this.#store.transaction(() => {
|
|
85
|
+
for (const tier of SETTABLE_TIERS) {
|
|
86
|
+
const d = TIER_DEFAULTS[tier];
|
|
87
|
+
this.#store.prepare("INSERT OR IGNORE INTO tier_settings (agent_id, tier, max_sessions, max_bytes, bytes_reset_minutes) VALUES (?, ?, ?, ?, ?)").run(agentId, tier, d.max_sessions, d.max_bytes, d.bytes_reset_minutes);
|
|
88
|
+
}
|
|
89
|
+
for (const [key, setting] of Object.entries(AGENT_SETTINGS)) {
|
|
90
|
+
this.#store.prepare("INSERT OR IGNORE INTO agent_settings (agent_id, key, value, updated_at) VALUES (?, ?, ?, ?)").run(agentId, key, setting.default, now);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
tiers(agentId) {
|
|
95
|
+
return this.#store.prepare("SELECT tier, max_sessions, max_bytes, not_accepting, away_text, bytes_reset_minutes FROM tier_settings WHERE agent_id = ? ORDER BY max_sessions").all(agentId);
|
|
96
|
+
}
|
|
97
|
+
#row(agentId, tier) {
|
|
98
|
+
const row = this.#store.prepare("SELECT tier, max_sessions, max_bytes, not_accepting, away_text, bytes_reset_minutes FROM tier_settings WHERE agent_id = ? AND tier = ?").get(agentId, tier);
|
|
99
|
+
if (!row)
|
|
100
|
+
throw new LocalError("settings_missing", `this agent has no settings for the ${tier} tier`);
|
|
101
|
+
return row;
|
|
102
|
+
}
|
|
103
|
+
// What holds for a caller at this tier right now. A shut tier and a block are both nothing at all, whatever numbers are stored.
|
|
104
|
+
limitsFor(agentId, tier) {
|
|
105
|
+
if (tier === TIER.BLOCKED)
|
|
106
|
+
return { max_sessions: 0, max_bytes: 0, shut: true, bytes_reset_minutes: 0 };
|
|
107
|
+
const row = this.#row(agentId, tierName(tier));
|
|
108
|
+
if (row.not_accepting === 1)
|
|
109
|
+
return { max_sessions: 0, max_bytes: 0, shut: true, bytes_reset_minutes: 0 };
|
|
110
|
+
return { max_sessions: row.max_sessions, max_bytes: row.max_bytes, shut: false, bytes_reset_minutes: row.bytes_reset_minutes };
|
|
111
|
+
}
|
|
112
|
+
setting(agentId, key) {
|
|
113
|
+
const row = this.#store.prepare("SELECT value FROM agent_settings WHERE agent_id = ? AND key = ?").get(agentId, key);
|
|
114
|
+
if (!row)
|
|
115
|
+
throw new LocalError("settings_missing", `this agent has no setting named ${key}`);
|
|
116
|
+
return row.value;
|
|
117
|
+
}
|
|
118
|
+
number(agentId, key) {
|
|
119
|
+
return Number(this.setting(agentId, key));
|
|
120
|
+
}
|
|
121
|
+
settings(agentId) {
|
|
122
|
+
return Object.entries(AGENT_SETTINGS).map(([key, s]) => ({ key, value: this.setting(agentId, key), default: s.default, description: s.description }));
|
|
123
|
+
}
|
|
124
|
+
// Works out what a change would do, and does nothing until apply is called. A clear goes back to the default, and is judged the same.
|
|
125
|
+
plan(agentId, key, raw) {
|
|
126
|
+
const parsed = parseKey(key);
|
|
127
|
+
if (parsed)
|
|
128
|
+
return this.#planTier(agentId, parsed.tier, parsed.field, key, raw);
|
|
129
|
+
const setting = AGENT_SETTINGS[key];
|
|
130
|
+
if (!setting)
|
|
131
|
+
throw new LocalError("bad_setting", `there's no setting named ${key}. They're listed by: cello settings --agent <name>`);
|
|
132
|
+
const to = raw ?? setting.default;
|
|
133
|
+
const from = this.setting(agentId, key);
|
|
134
|
+
const write = () => { this.#store.prepare("UPDATE agent_settings SET value = ?, updated_at = ? WHERE agent_id = ? AND key = ?").run(to, Date.now(), agentId, key); };
|
|
135
|
+
if (setting.kind === "switch") {
|
|
136
|
+
if (to !== "true" && to !== "false")
|
|
137
|
+
throw new LocalError("bad_setting", `${key} must be exactly "true" or "false"`);
|
|
138
|
+
return { direction: from === to || setting.neutral ? "neutral" : to === "true" ? "loosen" : "tighten", from, to, apply: write };
|
|
139
|
+
}
|
|
140
|
+
if (setting.kind === "tier") {
|
|
141
|
+
if (!SETTABLE_TIERS.includes(to))
|
|
142
|
+
throw new LocalError("bad_setting", `${key} must be one of ${SETTABLE_TIERS.join(", ")}, not ${to}`);
|
|
143
|
+
const by = byMagnitude(SETTABLE_TIERS.indexOf(from), SETTABLE_TIERS.indexOf(to));
|
|
144
|
+
return { direction: by === "loosen" ? "tighten" : by === "tighten" ? "loosen" : "neutral", from, to, apply: write };
|
|
145
|
+
}
|
|
146
|
+
if (setting.kind === "number") {
|
|
147
|
+
const value = Number(to);
|
|
148
|
+
if (!Number.isInteger(value) || value < setting.min || value > setting.max)
|
|
149
|
+
throw new LocalError("bad_setting", `${key} must be a whole number from ${setting.min} to ${setting.max}, not ${to}`);
|
|
150
|
+
}
|
|
151
|
+
else if (key.startsWith("away.") && to.length > this.number(agentId, "away.max_chars")) {
|
|
152
|
+
throw new LocalError("bad_setting", `an away message must be ${this.setting(agentId, "away.max_chars")} characters or fewer`);
|
|
153
|
+
}
|
|
154
|
+
const by = byMagnitude(Number(from), Number(to));
|
|
155
|
+
const direction = setting.loosensWhen === "higher" ? by : setting.loosensWhen === "lower" ? (by === "loosen" ? "tighten" : by === "tighten" ? "loosen" : "neutral") : "neutral";
|
|
156
|
+
return { direction, from, to, apply: write };
|
|
157
|
+
}
|
|
158
|
+
#planTier(agentId, tier, field, key, raw) {
|
|
159
|
+
const row = this.#row(agentId, tier);
|
|
160
|
+
const write = (column, value) => { this.#store.prepare(`UPDATE tier_settings SET ${column} = ? WHERE agent_id = ? AND tier = ?`).run(value, agentId, tier); };
|
|
161
|
+
if (field === "away") {
|
|
162
|
+
const text = raw === null || raw.trim() === "" ? null : raw;
|
|
163
|
+
if (text && text.length > this.number(agentId, "away.max_chars"))
|
|
164
|
+
throw new LocalError("bad_setting", `an away message must be ${this.setting(agentId, "away.max_chars")} characters or fewer`);
|
|
165
|
+
return { direction: "neutral", from: row.away_text ?? "", to: text ?? "", apply: () => write("away_text", text) };
|
|
166
|
+
}
|
|
167
|
+
if (field === "not_accepting") {
|
|
168
|
+
const to = raw ?? "false";
|
|
169
|
+
if (to !== "true" && to !== "false")
|
|
170
|
+
throw new LocalError("bad_setting", `${key} must be exactly "true" (shut this tier) or "false" (re-open it)`);
|
|
171
|
+
const was = row.not_accepting === 1;
|
|
172
|
+
const shut = to === "true";
|
|
173
|
+
return { direction: was && !shut ? "loosen" : !was && shut ? "tighten" : "neutral", from: String(was), to, apply: () => write("not_accepting", shut ? 1 : 0) };
|
|
174
|
+
}
|
|
175
|
+
const to = raw ?? String(TIER_DEFAULTS[tier][field]);
|
|
176
|
+
if (field === "bytes_reset_minutes") {
|
|
177
|
+
if (!/^(0|[1-9][0-9]*)$/.test(to) || Number(to) > Number.MAX_SAFE_INTEGER)
|
|
178
|
+
throw new LocalError("bad_setting", `${key} must be a whole number of minutes, or 0 for never`);
|
|
179
|
+
return { direction: resetDirection(row[field], Number(to)), from: String(row[field]), to, apply: () => write(field, Number(to)) };
|
|
180
|
+
}
|
|
181
|
+
if (!/^[1-9][0-9]*$/.test(to) || Number(to) > Number.MAX_SAFE_INTEGER) {
|
|
182
|
+
throw new LocalError("bad_setting", `a limit must be a positive whole number. To shut this tier, set bounds.${tier}.not_accepting to true, and every caller it refuses is told the agent isn't accepting connections.`);
|
|
183
|
+
}
|
|
184
|
+
return { direction: byMagnitude(row[field], Number(to)), from: String(row[field]), to, apply: () => write(field, Number(to)) };
|
|
185
|
+
}
|
|
186
|
+
// Says whether the owner is due a notice about this caller. The cooldown is stored here, so a restart doesn't repeat one.
|
|
187
|
+
// A refusal that tells nobody doesn't start the clock, or the owner would miss the limit that follows it.
|
|
188
|
+
addRefusal(agentId, contactId, reason, tells, cooldownMs) {
|
|
189
|
+
const now = Date.now();
|
|
190
|
+
const last = this.#store.prepare("SELECT last_alarm_at FROM refused_callers WHERE agent_id = ? AND contact_id = ?").get(agentId, contactId)?.last_alarm_at ?? 0;
|
|
191
|
+
const due = tells && now - last >= cooldownMs;
|
|
192
|
+
this.#store.prepare("INSERT INTO refused_callers (agent_id, contact_id, first_refused_at, last_refused_at, times, last_reason, last_alarm_at) VALUES (?, ?, ?, ?, 1, ?, ?) ON CONFLICT (agent_id, contact_id) DO UPDATE SET last_refused_at = excluded.last_refused_at, times = times + 1, last_reason = excluded.last_reason, last_alarm_at = excluded.last_alarm_at").run(agentId, contactId, now, now, reason, due ? now : last);
|
|
193
|
+
return due;
|
|
194
|
+
}
|
|
195
|
+
offeredName(agentId) {
|
|
196
|
+
return this.#store.prepare("SELECT value FROM agent_settings WHERE agent_id = ? AND key = 'self.offered_name'").get(agentId)?.value;
|
|
197
|
+
}
|
|
198
|
+
setOfferedName(agentId, name) {
|
|
199
|
+
this.#store.prepare("INSERT INTO agent_settings (agent_id, key, value, updated_at) VALUES (?, 'self.offered_name', ?, ?) ON CONFLICT (agent_id, key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at").run(agentId, name, Date.now());
|
|
200
|
+
}
|
|
201
|
+
refusals(agentId) {
|
|
202
|
+
return this.#store.prepare("SELECT contact_id, first_refused_at, last_refused_at, times, last_reason FROM refused_callers WHERE agent_id = ? ORDER BY last_refused_at DESC").all(agentId);
|
|
203
|
+
}
|
|
204
|
+
forgetRefusal(agentId, contactId) {
|
|
205
|
+
this.#store.prepare("DELETE FROM refused_callers WHERE agent_id = ? AND contact_id = ?").run(agentId, contactId);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { InboundVerdict } from "../screener/inbound.ts";
|
|
2
|
+
import type { OutboundVerdict } from "../screener/outbound.ts";
|
|
3
|
+
import type { Settings } from "./settings.ts";
|
|
4
|
+
export type ScreeningLevel = "full" | "deterministic" | "off";
|
|
5
|
+
export interface LanguageGuard {
|
|
6
|
+
enforce: boolean;
|
|
7
|
+
allow: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface PiiGuard {
|
|
10
|
+
whitelist: string[];
|
|
11
|
+
email: boolean;
|
|
12
|
+
phone: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ScreenJob {
|
|
15
|
+
entryId: number;
|
|
16
|
+
agentHex: string;
|
|
17
|
+
sessionHex: string;
|
|
18
|
+
position: number;
|
|
19
|
+
senderHex: string;
|
|
20
|
+
bytes: number;
|
|
21
|
+
arrived: number;
|
|
22
|
+
channelText?: {
|
|
23
|
+
bytes: Uint8Array;
|
|
24
|
+
done(verdict: InboundVerdict): void;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface Running extends ScreenJob {
|
|
28
|
+
id: number;
|
|
29
|
+
lane: "short" | "long";
|
|
30
|
+
started: boolean;
|
|
31
|
+
slot: Slot | undefined;
|
|
32
|
+
steps: number;
|
|
33
|
+
windows: number | null;
|
|
34
|
+
attempts: number;
|
|
35
|
+
told: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface ModelFact {
|
|
38
|
+
state: string;
|
|
39
|
+
running: boolean;
|
|
40
|
+
backend: string | null;
|
|
41
|
+
reason: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface ScreeningEvents {
|
|
44
|
+
load(job: ScreenJob): {
|
|
45
|
+
body: Uint8Array;
|
|
46
|
+
level: ScreeningLevel;
|
|
47
|
+
language: LanguageGuard;
|
|
48
|
+
} | null;
|
|
49
|
+
verdict(job: ScreenJob, verdict: InboundVerdict): void;
|
|
50
|
+
delayed(job: ScreenJob, aboutSeconds: number): void;
|
|
51
|
+
workerCrashed(message: string, waiting: number): void;
|
|
52
|
+
modelChecked(model: ModelFact): void;
|
|
53
|
+
}
|
|
54
|
+
export declare class ScreeningQueue {
|
|
55
|
+
#private;
|
|
56
|
+
readonly settings: Settings;
|
|
57
|
+
restarts: number;
|
|
58
|
+
lastCrash: string | null;
|
|
59
|
+
model: ModelFact | null;
|
|
60
|
+
constructor(events: ScreeningEvents, settings: Settings);
|
|
61
|
+
onModel(model: ModelFact): void;
|
|
62
|
+
start(): void;
|
|
63
|
+
stop(): void;
|
|
64
|
+
get stopped(): boolean;
|
|
65
|
+
add(job: ScreenJob): void;
|
|
66
|
+
reload(): void;
|
|
67
|
+
pending(): {
|
|
68
|
+
short: number;
|
|
69
|
+
long: number;
|
|
70
|
+
};
|
|
71
|
+
waiting(agentHex: string, sessionHex: string): {
|
|
72
|
+
position: number;
|
|
73
|
+
about_seconds: number;
|
|
74
|
+
} | null;
|
|
75
|
+
pump(): void;
|
|
76
|
+
onStepped(job: Running, measured: number | undefined, ms: number): void;
|
|
77
|
+
onDone(job: Running, verdict: InboundVerdict): void;
|
|
78
|
+
onFailed(job: Running, message: string): void;
|
|
79
|
+
onCrash(slot: Slot, message: string): void;
|
|
80
|
+
}
|
|
81
|
+
declare class Slot {
|
|
82
|
+
#private;
|
|
83
|
+
ready: boolean;
|
|
84
|
+
job: Running | undefined;
|
|
85
|
+
constructor(queue: ScreeningQueue);
|
|
86
|
+
spawn(): void;
|
|
87
|
+
stop(): void;
|
|
88
|
+
start(job: Running, body: Uint8Array, level: "full" | "deterministic", language: LanguageGuard): void;
|
|
89
|
+
step(job: Running): void;
|
|
90
|
+
}
|
|
91
|
+
export declare class OutboundScreen {
|
|
92
|
+
#private;
|
|
93
|
+
start(): void;
|
|
94
|
+
stop(): void;
|
|
95
|
+
screen(text: string, keys: readonly string[], pii: PiiGuard): Promise<OutboundVerdict>;
|
|
96
|
+
}
|
|
97
|
+
export {};
|