@coffer-org/server 7.1.0 → 7.3.0
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/auth-api.d.ts +4 -0
- package/dist/auth-api.js +53 -0
- package/dist/auth-store.d.ts +2 -0
- package/dist/auth-store.js +1 -0
- package/dist/background-scheduler.d.ts +1 -0
- package/dist/background-scheduler.js +2 -1
- package/dist/entity-schema.d.ts +2 -0
- package/dist/entity-schema.js +26 -0
- package/dist/identity-link.d.ts +15 -0
- package/dist/identity-link.js +76 -0
- package/dist/index.js +8 -1
- package/dist/mcp-contract/schema.d.ts +34 -1
- package/dist/mcp-contract/schema.js +32 -9
- package/dist/mcp-contract/tools.js +3 -1
- package/dist/mcp-http.js +7 -3
- package/dist/mcp-tools.d.ts +7 -5
- package/dist/mcp-tools.js +95 -91
- package/dist/media/image.d.ts +23 -0
- package/dist/media/image.js +103 -0
- package/dist/media/index.d.ts +1 -0
- package/dist/media/index.js +1 -0
- package/dist/migrations.js +1 -1
- package/dist/orchestrator/agent-capabilities.d.ts +2 -2
- package/dist/orchestrator/agent-capabilities.js +3 -3
- package/dist/orchestrator/allow.d.ts +1 -16
- package/dist/orchestrator/allow.js +3 -53
- package/dist/orchestrator/config.js +0 -1
- package/dist/orchestrator/context-facts.d.ts +27 -0
- package/dist/orchestrator/context-facts.js +89 -0
- package/dist/orchestrator/conversation-access.d.ts +9 -0
- package/dist/orchestrator/conversation-access.js +12 -0
- package/dist/orchestrator/environment.d.ts +1 -0
- package/dist/orchestrator/environment.js +10 -0
- package/dist/orchestrator/file-inspection.d.ts +2 -2
- package/dist/orchestrator/file-inspection.js +41 -19
- package/dist/orchestrator/index.d.ts +16 -9
- package/dist/orchestrator/index.js +14 -7
- package/dist/orchestrator/live-message.d.ts +7 -4
- package/dist/orchestrator/live-message.js +48 -31
- package/dist/orchestrator/pipeline.d.ts +25 -4
- package/dist/orchestrator/pipeline.js +214 -94
- package/dist/orchestrator/registry.d.ts +4 -2
- package/dist/orchestrator/registry.js +10 -1
- package/dist/orchestrator/system-areas.d.ts +12 -0
- package/dist/orchestrator/system-areas.js +63 -0
- package/dist/orchestrator/system-capabilities.js +1 -1
- package/dist/orchestrator/turn-context.d.ts +18 -0
- package/dist/orchestrator/turn-context.js +39 -0
- package/dist/orchestrator/types.d.ts +106 -44
- package/dist/plugin-hooks.d.ts +26 -0
- package/dist/plugin-http-mounts.d.ts +18 -0
- package/dist/plugin-http-mounts.js +94 -0
- package/dist/plugin-runtime.js +2 -2
- package/dist/records-api.js +15 -3
- package/dist/system-settings.js +0 -1
- package/dist/thread-state.d.ts +14 -0
- package/dist/thread-state.js +71 -11
- package/dist/thread-store.d.ts +5 -3
- package/dist/thread-store.js +12 -9
- package/dist/turn-gate.d.ts +8 -0
- package/dist/turn-gate.js +39 -0
- package/package.json +7 -2
|
@@ -12,3 +12,13 @@ function part(now, timeZone, locale, options) {
|
|
|
12
12
|
export function todayDateString(now = new Date(), timeZone = systemTimeZone()) {
|
|
13
13
|
return part(now, timeZone, 'en-CA', { year: 'numeric', month: '2-digit', day: '2-digit' });
|
|
14
14
|
}
|
|
15
|
+
export function currentMoment(now = new Date(), timeZone = systemTimeZone()) {
|
|
16
|
+
return part(now, timeZone, 'en-CA', {
|
|
17
|
+
year: 'numeric',
|
|
18
|
+
month: '2-digit',
|
|
19
|
+
day: '2-digit',
|
|
20
|
+
hour: '2-digit',
|
|
21
|
+
minute: '2-digit',
|
|
22
|
+
hourCycle: 'h23',
|
|
23
|
+
}).replace(', ', ' ');
|
|
24
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AgentToolContentResult, AttachmentRef } from './types.ts';
|
|
2
|
-
export declare function inspectUpload(name: string, ref
|
|
1
|
+
import type { AgentMediaLimits, AgentToolContentResult, AttachmentRef } from './types.ts';
|
|
2
|
+
export declare function inspectUpload(name: string, ref: Pick<AttachmentRef, 'mime' | 'size' | 'label'>, limits: AgentMediaLimits): Promise<AgentToolContentResult>;
|
|
3
3
|
export declare function isAgentToolContentResult(value: unknown): value is AgentToolContentResult;
|
|
@@ -2,15 +2,25 @@ import { readFile, stat } from 'node:fs/promises';
|
|
|
2
2
|
import { basename, join } from 'node:path';
|
|
3
3
|
import { mimeForName } from "../file-fields.js";
|
|
4
4
|
import { uploadsDir } from "../uploads.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
5
|
+
import { normalizeImage, ImageNormalizeError } from "../media/index.js";
|
|
6
|
+
import { getLogger } from '@coffer-org/sdk/logger';
|
|
7
|
+
const log = getLogger('orchestrator');
|
|
8
8
|
const textResult = (text, isError = false) => ({
|
|
9
9
|
__cofferToolContent: true,
|
|
10
10
|
content: [{ type: 'text', text }],
|
|
11
11
|
...(isError ? { isError: true } : {}),
|
|
12
12
|
});
|
|
13
|
-
|
|
13
|
+
function accepts(mime, patterns) {
|
|
14
|
+
return patterns.some((p) => (p.endsWith('/*') ? mime.startsWith(p.slice(0, -1)) : p === mime));
|
|
15
|
+
}
|
|
16
|
+
function human(bytes) {
|
|
17
|
+
if (bytes < 1024)
|
|
18
|
+
return `${bytes} B`;
|
|
19
|
+
if (bytes < 1024 * 1024)
|
|
20
|
+
return `${Math.round(bytes / 1024)} KB`;
|
|
21
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
22
|
+
}
|
|
23
|
+
export async function inspectUpload(name, ref, limits) {
|
|
14
24
|
if (!name || basename(name) !== name)
|
|
15
25
|
return textResult('Invalid upload name.', true);
|
|
16
26
|
const file = join(uploadsDir(), name);
|
|
@@ -22,34 +32,46 @@ export async function inspectUpload(name, ref = {}) {
|
|
|
22
32
|
return textResult(`File is no longer present on the server: ${name}`, true);
|
|
23
33
|
}
|
|
24
34
|
const mime = ref.mime ?? mimeForName(name);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return textResult(`Image is ${size} bytes, above the ${MAX_VISION_BYTES}-byte inspection limit.`, true);
|
|
35
|
+
const label = ref.label ?? name;
|
|
36
|
+
if (mime && accepts(mime, limits.image.accepts)) {
|
|
28
37
|
const bytes = await readFile(file);
|
|
38
|
+
let image;
|
|
39
|
+
try {
|
|
40
|
+
image = await normalizeImage(bytes, limits.image);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
if (err instanceof ImageNormalizeError)
|
|
44
|
+
return textResult(`Image could not be prepared for the agent: ${err.message}`, true);
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
const shape = image.changed
|
|
48
|
+
? `${image.source.width}×${image.source.height} ${human(image.source.bytes)} → ${image.width}×${image.height} ${human(image.bytes.length)}, ${image.mime}`
|
|
49
|
+
: `${image.width}×${image.height}, ${image.mime}, ${human(image.bytes.length)}`;
|
|
50
|
+
if (image.changed)
|
|
51
|
+
log.debug(`normalized ${name}: ${image.source.bytes} → ${image.bytes.length} bytes for the agent`);
|
|
29
52
|
return {
|
|
30
53
|
__cofferToolContent: true,
|
|
31
54
|
content: [
|
|
32
|
-
{ type: 'text', text: `Image: ${
|
|
33
|
-
{ type: 'image', mime, data: bytes.toString('base64') },
|
|
55
|
+
{ type: 'text', text: `Image: ${label} (${shape}).` },
|
|
56
|
+
{ type: 'image', mime: image.mime, data: image.bytes.toString('base64') },
|
|
34
57
|
],
|
|
35
58
|
};
|
|
36
59
|
}
|
|
37
|
-
if (mime
|
|
38
|
-
if (size >
|
|
39
|
-
return textResult(`
|
|
40
|
-
const bytes = await readFile(file);
|
|
60
|
+
if (mime && accepts(mime, limits.document.accepts)) {
|
|
61
|
+
if (size > limits.document.maxBytes)
|
|
62
|
+
return textResult(`Document is ${human(size)}, above the ${human(limits.document.maxBytes)} the agent accepts.`, true);
|
|
41
63
|
return {
|
|
42
64
|
__cofferToolContent: true,
|
|
43
65
|
content: [
|
|
44
|
-
{ type: 'text', text: `PDF: ${
|
|
45
|
-
{ type: 'document', mime: 'application/pdf', data:
|
|
66
|
+
{ type: 'text', text: `PDF: ${label} (${human(size)}).` },
|
|
67
|
+
{ type: 'document', mime: 'application/pdf', data: (await readFile(file)).toString('base64') },
|
|
46
68
|
],
|
|
47
69
|
};
|
|
48
70
|
}
|
|
49
|
-
if (mime
|
|
50
|
-
if (size >
|
|
51
|
-
return textResult(`Text file is
|
|
52
|
-
return textResult(`Text file: ${
|
|
71
|
+
if (mime && accepts(mime, limits.text.accepts)) {
|
|
72
|
+
if (size > limits.text.maxBytes)
|
|
73
|
+
return textResult(`Text file is ${human(size)}, above the ${human(limits.text.maxBytes)} the agent accepts.`, true);
|
|
74
|
+
return textResult(`Text file: ${label}\n\n${(await readFile(file)).toString('utf8')}`);
|
|
53
75
|
}
|
|
54
76
|
return textResult(`This file type cannot be inspected by the agent (${mime ?? 'unknown'}). ` +
|
|
55
77
|
'It can still be attached to a record.', true);
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import type { BackgroundTask } from '../background-scheduler.ts';
|
|
2
2
|
import { listRecentMessageMetrics } from '../msg-log.ts';
|
|
3
3
|
import { listDiagnostics } from './diagnostics.ts';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { type PipelineOptions } from './pipeline.ts';
|
|
5
|
+
import type { Connector, TurnRequest } from './types.ts';
|
|
6
|
+
export declare const handleIncoming: (connector: Connector, turn: TurnRequest, options?: PipelineOptions) => Promise<void>;
|
|
7
|
+
export { registerAgent, resolveAgent, registerConnector, isConnectorRegistered, clearRuntimeRegistries, listRegisteredAgents, listRegisteredConnectors, listLinkableConnectors, connectorLinkUrl, listAgentCatalog, getDefaultAgentId, liveAgentId, } from './registry.ts';
|
|
6
8
|
export { attachmentMaterializer } from './attachments.ts';
|
|
7
9
|
export { makeAttachmentCapabilities } from './agent-capabilities.ts';
|
|
8
10
|
export { makeSystemCapabilities } from './system-capabilities.ts';
|
|
9
|
-
export { makeSuggestionCapabilities } from './suggestion-capabilities.ts';
|
|
10
|
-
export type { SuggestionCapability } from './suggestion-capabilities.ts';
|
|
11
11
|
export { systemTimeZone } from './environment.ts';
|
|
12
|
+
export type { ContextFact } from './context-facts.ts';
|
|
13
|
+
export { CONNECTOR_FACT_NAME } from './context-facts.ts';
|
|
12
14
|
export { inspectUpload, isAgentToolContentResult } from './file-inspection.ts';
|
|
13
|
-
export type {
|
|
15
|
+
export type { PipelineOptions, RunAgentFn } from './pipeline.ts';
|
|
14
16
|
export { buildPolicy, loadGatePolicy, loadAgentId } from './config.ts';
|
|
15
17
|
export { getConversationStarters, refreshSystemStarters } from './starters.ts';
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
18
|
+
export { resolveSpeaker } from './pipeline.ts';
|
|
19
|
+
export { mayRead, mayWrite, mayBePrivate } from './conversation-access.ts';
|
|
20
|
+
export type { ConversationAccess } from './conversation-access.ts';
|
|
21
|
+
export { makeLiveSink, plainRender } from './live-message.ts';
|
|
22
|
+
export type { LiveChannelOps, LiveSinkOpts, RenderFn } from './live-message.ts';
|
|
19
23
|
export { chunk } from './format.ts';
|
|
20
|
-
export
|
|
24
|
+
export { DEFAULT_TASK_TIMEOUT_MS } from '../background-scheduler.ts';
|
|
25
|
+
export type { Connector, TurnEnvelope, ConnectorCapabilities, TurnBody, TurnRequest, SenderIdKind, GatePolicy, TurnEvent, TurnSink, AttachmentRef, AttachmentMaterializer, AgentToolDefinition, AgentToolProvider, ConvMessage, AgentTurn, AgentRuntime, AgentCapabilities, AgentMediaKind, AgentMediaLimits, AgentPreset, AgentDescriptor, AgentCatalogEntry, ConnectorRegistration, AgentToolContentBlock, AgentToolContentResult, } from './types.ts';
|
|
26
|
+
export type { AuthRole } from '../plugin-hooks.ts';
|
|
21
27
|
export declare function startOrchestrator(): void;
|
|
22
28
|
export declare function stopOrchestrator(): void;
|
|
23
29
|
export declare const orchestratorStartersTask: BackgroundTask;
|
|
30
|
+
export declare const linkCodePruneTask: BackgroundTask;
|
|
24
31
|
export declare function orchestratorDiagnostics(): Promise<{
|
|
25
32
|
generatedAt: string;
|
|
26
33
|
agents: string[];
|
|
@@ -6,27 +6,29 @@ import { setLogDb } from "./pipeline.js";
|
|
|
6
6
|
import { refreshSystemStarters } from "./starters.js";
|
|
7
7
|
import { getLogger } from '@coffer-org/sdk/logger';
|
|
8
8
|
const log = getLogger('orchestrator');
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { pruneLinkCodes } from "../identity-link.js";
|
|
10
|
+
import { handleIncoming as handleIncomingImpl } from "./pipeline.js";
|
|
11
|
+
export const handleIncoming = handleIncomingImpl;
|
|
12
|
+
export { registerAgent, resolveAgent, registerConnector, isConnectorRegistered, clearRuntimeRegistries, listRegisteredAgents, listRegisteredConnectors, listLinkableConnectors, connectorLinkUrl, listAgentCatalog, getDefaultAgentId, liveAgentId, } from "./registry.js";
|
|
11
13
|
export { attachmentMaterializer } from "./attachments.js";
|
|
12
14
|
export { makeAttachmentCapabilities } from "./agent-capabilities.js";
|
|
13
15
|
export { makeSystemCapabilities } from "./system-capabilities.js";
|
|
14
|
-
export { makeSuggestionCapabilities } from "./suggestion-capabilities.js";
|
|
15
16
|
export { systemTimeZone } from "./environment.js";
|
|
17
|
+
export { CONNECTOR_FACT_NAME } from "./context-facts.js";
|
|
16
18
|
export { inspectUpload, isAgentToolContentResult } from "./file-inspection.js";
|
|
17
19
|
export { buildPolicy, loadGatePolicy, loadAgentId } from "./config.js";
|
|
18
20
|
export { getConversationStarters, refreshSystemStarters } from "./starters.js";
|
|
19
|
-
export {
|
|
20
|
-
|
|
21
|
-
export {
|
|
21
|
+
export { resolveSpeaker } from "./pipeline.js";
|
|
22
|
+
export { mayRead, mayWrite, mayBePrivate } from "./conversation-access.js";
|
|
23
|
+
export { makeLiveSink, plainRender } from "./live-message.js";
|
|
22
24
|
export { chunk } from "./format.js";
|
|
25
|
+
export { DEFAULT_TASK_TIMEOUT_MS } from "../background-scheduler.js";
|
|
23
26
|
let db;
|
|
24
27
|
const STARTERS_CHECK_INTERVAL_MS = 10 * 60_000;
|
|
25
28
|
function runStartersRefresh() {
|
|
26
29
|
return refreshSystemStarters().catch((err) => log.warn(`system starters: ${String(err)}`));
|
|
27
30
|
}
|
|
28
31
|
export function startOrchestrator() {
|
|
29
|
-
carryLegacyState();
|
|
30
32
|
db = openLogDb();
|
|
31
33
|
setLogDb(db);
|
|
32
34
|
void runStartersRefresh();
|
|
@@ -45,6 +47,11 @@ export const orchestratorStartersTask = {
|
|
|
45
47
|
intervalMs: STARTERS_CHECK_INTERVAL_MS,
|
|
46
48
|
run: runStartersRefresh,
|
|
47
49
|
};
|
|
50
|
+
export const linkCodePruneTask = {
|
|
51
|
+
name: 'core:link-code-prune',
|
|
52
|
+
intervalMs: 86_400_000,
|
|
53
|
+
run: pruneLinkCodes,
|
|
54
|
+
};
|
|
48
55
|
export async function orchestratorDiagnostics() {
|
|
49
56
|
return {
|
|
50
57
|
generatedAt: new Date().toISOString(),
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TurnSink } from './types.ts';
|
|
2
2
|
export interface LiveChannelOps {
|
|
3
3
|
send(text: string): Promise<string | null>;
|
|
4
4
|
edit(msgId: string, text: string): Promise<void>;
|
|
5
5
|
}
|
|
6
|
-
export type RenderFn = (r:
|
|
7
|
-
|
|
6
|
+
export type RenderFn = (r: {
|
|
7
|
+
text: string | null;
|
|
8
|
+
reasoning: string | null;
|
|
9
|
+
}) => string[];
|
|
10
|
+
export interface LiveSinkOpts {
|
|
8
11
|
ops: LiveChannelOps;
|
|
9
12
|
throttleMs: number;
|
|
10
13
|
render: RenderFn;
|
|
11
14
|
maxLength: number;
|
|
12
15
|
}
|
|
13
16
|
export declare function plainRender(max: number): RenderFn;
|
|
14
|
-
export declare function
|
|
17
|
+
export declare function makeLiveSink(o: LiveSinkOpts): TurnSink;
|
|
@@ -13,7 +13,7 @@ async function swallow(fn, fallback, label) {
|
|
|
13
13
|
return fallback;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
export function
|
|
16
|
+
export function makeLiveSink(o) {
|
|
17
17
|
let msgId = null;
|
|
18
18
|
let pending = '';
|
|
19
19
|
let lastSent = '';
|
|
@@ -62,39 +62,56 @@ export function makeLiveChannel(o) {
|
|
|
62
62
|
}, o.throttleMs);
|
|
63
63
|
if (typeof timer.unref === 'function')
|
|
64
64
|
timer.unref();
|
|
65
|
+
async function deliver(r) {
|
|
66
|
+
closed = true;
|
|
67
|
+
clearInterval(timer);
|
|
68
|
+
await inFlight;
|
|
69
|
+
const parts = o.render(r);
|
|
70
|
+
const [head, ...rest] = parts;
|
|
71
|
+
if (msgId && head !== undefined) {
|
|
72
|
+
const id = msgId;
|
|
73
|
+
if (head !== lastSent) {
|
|
74
|
+
await swallow(() => o.ops.edit(id, head), undefined, 'edit(final)');
|
|
75
|
+
lastSent = head;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (head !== undefined) {
|
|
79
|
+
await swallow(() => o.ops.send(head), null, 'send(final)');
|
|
80
|
+
}
|
|
81
|
+
for (const p of rest) {
|
|
82
|
+
await swallow(() => o.ops.send(p), null, 'send(overflow)');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
let finished = Promise.resolve();
|
|
86
|
+
let terminalDelivered = false;
|
|
87
|
+
function deliverTerminal(kind, r) {
|
|
88
|
+
if (terminalDelivered) {
|
|
89
|
+
log.warn(`live-message: a second terminal event (${kind}) after the turn already finished — dropped`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
terminalDelivered = true;
|
|
93
|
+
finished = deliver(r);
|
|
94
|
+
}
|
|
65
95
|
return {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
96
|
+
emit(e) {
|
|
97
|
+
if (e.kind === 'delta')
|
|
98
|
+
pending = e.text;
|
|
99
|
+
else if (e.kind === 'segment') {
|
|
100
|
+
gen++;
|
|
101
|
+
msgId = null;
|
|
102
|
+
pending = '';
|
|
103
|
+
lastSent = '';
|
|
104
|
+
}
|
|
105
|
+
else if (e.kind === 'answer')
|
|
106
|
+
deliverTerminal('answer', { text: e.text, reasoning: e.reasoning });
|
|
107
|
+
else if (e.kind === 'notice')
|
|
108
|
+
deliverTerminal('notice', { text: e.text, reasoning: null });
|
|
109
|
+
else if (e.kind === 'error')
|
|
110
|
+
deliverTerminal('error', { text: null, reasoning: null });
|
|
74
111
|
},
|
|
75
|
-
|
|
76
|
-
closed = true;
|
|
112
|
+
done: () => {
|
|
77
113
|
clearInterval(timer);
|
|
78
|
-
|
|
79
|
-
const parts = o.render(r);
|
|
80
|
-
let last = null;
|
|
81
|
-
const [head, ...rest] = parts;
|
|
82
|
-
if (msgId && head !== undefined) {
|
|
83
|
-
const id = msgId;
|
|
84
|
-
if (head !== lastSent) {
|
|
85
|
-
await swallow(() => o.ops.edit(id, head), undefined, 'edit(final)');
|
|
86
|
-
lastSent = head;
|
|
87
|
-
}
|
|
88
|
-
last = id;
|
|
89
|
-
}
|
|
90
|
-
else if (head !== undefined) {
|
|
91
|
-
last = await swallow(() => o.ops.send(head), null, 'send(final)');
|
|
92
|
-
}
|
|
93
|
-
for (const p of rest) {
|
|
94
|
-
const id = await swallow(() => o.ops.send(p), null, 'send(overflow)');
|
|
95
|
-
last = id ?? last;
|
|
96
|
-
}
|
|
97
|
-
return last;
|
|
114
|
+
return finished;
|
|
98
115
|
},
|
|
99
116
|
};
|
|
100
117
|
}
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
import type { Connector,
|
|
1
|
+
import type { AgentMediaLimits, Connector, TurnRequest, GatePolicy, AgentRuntime } from './types.ts';
|
|
2
2
|
import type { LogDb } from './db.ts';
|
|
3
|
+
import { type AreaWorld, type SystemAreas } from './system-areas.ts';
|
|
4
|
+
import type { AuthUser } from '../auth-store.ts';
|
|
3
5
|
export declare function setLogDb(db: LogDb | undefined): void;
|
|
6
|
+
export declare const NOTICE_THROTTLE: {
|
|
7
|
+
readonly max: 5;
|
|
8
|
+
readonly windowMs: 60000;
|
|
9
|
+
};
|
|
4
10
|
export type RunAgentFn = AgentRuntime['run'];
|
|
5
|
-
export
|
|
11
|
+
export declare function liveWorld(): Promise<AreaWorld>;
|
|
12
|
+
export type UserLookup = (id: number) => Promise<AuthUser | null>;
|
|
13
|
+
export declare function defaultResolveUser(id: string, lookup?: UserLookup): Promise<AuthUser | null>;
|
|
14
|
+
export declare function defaultResolveLinkedUser(connectorId: string, externalId: string, lookup?: UserLookup): Promise<AuthUser | null>;
|
|
15
|
+
export declare function resolveSpeaker(connectorId: string, sender: TurnRequest['sender'], deps?: Pick<PipelineDeps, 'resolveUser' | 'resolveLinkedUser'>): Promise<AuthUser | null>;
|
|
16
|
+
export interface PipelineOptions {
|
|
17
|
+
policy?: GatePolicy;
|
|
18
|
+
}
|
|
19
|
+
export interface PipelineDeps extends PipelineOptions {
|
|
6
20
|
runAgent?: RunAgentFn;
|
|
21
|
+
afterword?: AgentRuntime['afterword'];
|
|
7
22
|
logDb?: LogDb | null;
|
|
8
|
-
policy?: GatePolicy;
|
|
9
23
|
agentBase?: () => Promise<string>;
|
|
24
|
+
media?: AgentMediaLimits;
|
|
25
|
+
resolveUser?: (id: string) => Promise<AuthUser | null>;
|
|
26
|
+
resolveLinkedUser?: (connectorId: string, externalId: string) => Promise<AuthUser | null>;
|
|
27
|
+
now?: () => Date;
|
|
28
|
+
timeZone?: string;
|
|
29
|
+
world?: AreaWorld;
|
|
30
|
+
domainAreas?: () => Promise<SystemAreas>;
|
|
10
31
|
}
|
|
11
|
-
export declare function handleIncoming(connector: Connector,
|
|
32
|
+
export declare function handleIncoming(connector: Connector, turn: TurnRequest, deps?: PipelineDeps): Promise<void>;
|