@vellumai/assistant 0.4.30 → 0.4.32
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/ARCHITECTURE.md +1 -1
- package/Dockerfile +14 -8
- package/README.md +2 -2
- package/docs/architecture/memory.md +28 -29
- package/docs/runbook-trusted-contacts.md +1 -4
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/ipc-snapshot.test.ts.snap +0 -7
- package/src/__tests__/anthropic-provider.test.ts +86 -1
- package/src/__tests__/assistant-feature-flags-integration.test.ts +2 -2
- package/src/__tests__/checker.test.ts +37 -98
- package/src/__tests__/commit-message-enrichment-service.test.ts +15 -4
- package/src/__tests__/config-schema.test.ts +6 -14
- package/src/__tests__/conflict-policy.test.ts +76 -0
- package/src/__tests__/conflict-store.test.ts +14 -20
- package/src/__tests__/contacts-tools.test.ts +8 -61
- package/src/__tests__/contradiction-checker.test.ts +5 -1
- package/src/__tests__/credential-security-invariants.test.ts +1 -0
- package/src/__tests__/daemon-server-session-init.test.ts +1 -19
- package/src/__tests__/followup-tools.test.ts +0 -30
- package/src/__tests__/gemini-provider.test.ts +79 -1
- package/src/__tests__/guardian-decision-primitive-canonical.test.ts +5 -3
- package/src/__tests__/guardian-routing-invariants.test.ts +6 -4
- package/src/__tests__/ipc-snapshot.test.ts +0 -4
- package/src/__tests__/managed-proxy-context.test.ts +163 -0
- package/src/__tests__/memory-lifecycle-e2e.test.ts +13 -12
- package/src/__tests__/memory-regressions.test.ts +6 -6
- package/src/__tests__/openai-provider.test.ts +82 -0
- package/src/__tests__/provider-fail-open-selection.test.ts +134 -1
- package/src/__tests__/provider-managed-proxy-integration.test.ts +269 -0
- package/src/__tests__/recurrence-types.test.ts +0 -15
- package/src/__tests__/registry.test.ts +0 -10
- package/src/__tests__/schedule-tools.test.ts +28 -44
- package/src/__tests__/script-proxy-session-runtime.test.ts +6 -1
- package/src/__tests__/session-agent-loop.test.ts +0 -2
- package/src/__tests__/session-conflict-gate.test.ts +243 -388
- package/src/__tests__/session-profile-injection.test.ts +0 -2
- package/src/__tests__/session-runtime-assembly.test.ts +2 -3
- package/src/__tests__/session-skill-tools.test.ts +0 -49
- package/src/__tests__/session-workspace-cache-state.test.ts +0 -1
- package/src/__tests__/session-workspace-injection.test.ts +0 -1
- package/src/__tests__/session-workspace-tool-tracking.test.ts +0 -1
- package/src/__tests__/skill-feature-flags.test.ts +2 -2
- package/src/__tests__/task-management-tools.test.ts +111 -0
- package/src/__tests__/tool-grant-request-escalation.test.ts +2 -1
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +2 -1
- package/src/__tests__/twilio-config.test.ts +0 -3
- package/src/amazon/session.ts +30 -91
- package/src/approvals/guardian-decision-primitive.ts +11 -7
- package/src/approvals/guardian-request-resolvers.ts +5 -3
- package/src/calls/call-controller.ts +423 -571
- package/src/calls/finalize-call.ts +20 -0
- package/src/calls/relay-access-wait.ts +340 -0
- package/src/calls/relay-server.ts +269 -899
- package/src/calls/relay-setup-router.ts +307 -0
- package/src/calls/relay-verification.ts +280 -0
- package/src/calls/twilio-config.ts +1 -8
- package/src/calls/voice-control-protocol.ts +184 -0
- package/src/calls/voice-session-bridge.ts +1 -8
- package/src/config/agent-schema.ts +1 -1
- package/src/config/bundled-skills/contacts/SKILL.md +7 -18
- package/src/config/bundled-skills/contacts/TOOLS.json +4 -20
- package/src/config/bundled-skills/contacts/tools/contact-merge.ts +2 -4
- package/src/config/bundled-skills/contacts/tools/contact-search.ts +6 -12
- package/src/config/bundled-skills/contacts/tools/contact-upsert.ts +3 -24
- package/src/config/bundled-skills/followups/TOOLS.json +0 -4
- package/src/config/bundled-skills/schedule/SKILL.md +1 -1
- package/src/config/bundled-skills/schedule/TOOLS.json +2 -10
- package/src/config/bundled-tool-registry.ts +0 -5
- package/src/config/core-schema.ts +1 -1
- package/src/config/env.ts +0 -10
- package/src/config/feature-flag-registry.json +1 -1
- package/src/config/loader.ts +19 -0
- package/src/config/memory-schema.ts +0 -10
- package/src/config/schema.ts +2 -2
- package/src/config/system-prompt.ts +6 -0
- package/src/contacts/contact-store.ts +36 -62
- package/src/contacts/contacts-write.ts +14 -3
- package/src/contacts/types.ts +9 -4
- package/src/daemon/handlers/config-heartbeat.ts +1 -2
- package/src/daemon/handlers/contacts.ts +2 -2
- package/src/daemon/handlers/guardian-actions.ts +1 -1
- package/src/daemon/handlers/session-history.ts +398 -0
- package/src/daemon/handlers/session-user-message.ts +982 -0
- package/src/daemon/handlers/sessions.ts +9 -1337
- package/src/daemon/ipc-contract/contacts.ts +2 -2
- package/src/daemon/ipc-contract/sessions.ts +0 -6
- package/src/daemon/ipc-contract-inventory.json +0 -1
- package/src/daemon/lifecycle.ts +0 -29
- package/src/daemon/session-agent-loop.ts +1 -45
- package/src/daemon/session-conflict-gate.ts +21 -82
- package/src/daemon/session-memory.ts +7 -52
- package/src/daemon/session-process.ts +3 -1
- package/src/daemon/session-runtime-assembly.ts +18 -35
- package/src/heartbeat/heartbeat-service.ts +5 -1
- package/src/home-base/app-link-store.ts +0 -7
- package/src/memory/conflict-intent.ts +3 -6
- package/src/memory/conflict-policy.ts +34 -0
- package/src/memory/conflict-store.ts +10 -18
- package/src/memory/contradiction-checker.ts +2 -2
- package/src/memory/conversation-attention-store.ts +1 -1
- package/src/memory/conversation-store.ts +0 -51
- package/src/memory/db-init.ts +8 -0
- package/src/memory/job-handlers/conflict.ts +24 -7
- package/src/memory/migrations/105-contacts-and-triage.ts +4 -7
- package/src/memory/migrations/134-contacts-notes-column.ts +68 -0
- package/src/memory/migrations/135-backfill-contact-interaction-stats.ts +31 -0
- package/src/memory/migrations/index.ts +2 -0
- package/src/memory/migrations/registry.ts +6 -0
- package/src/memory/recall-cache.ts +0 -5
- package/src/memory/schema/calls.ts +274 -0
- package/src/memory/schema/contacts.ts +125 -0
- package/src/memory/schema/conversations.ts +129 -0
- package/src/memory/schema/guardian.ts +172 -0
- package/src/memory/schema/index.ts +8 -0
- package/src/memory/schema/infrastructure.ts +205 -0
- package/src/memory/schema/memory-core.ts +196 -0
- package/src/memory/schema/notifications.ts +191 -0
- package/src/memory/schema/tasks.ts +78 -0
- package/src/memory/schema.ts +1 -1402
- package/src/memory/slack-thread-store.ts +0 -69
- package/src/messaging/index.ts +0 -1
- package/src/messaging/types.ts +0 -38
- package/src/notifications/decisions-store.ts +2 -105
- package/src/notifications/deliveries-store.ts +0 -11
- package/src/notifications/preferences-store.ts +1 -58
- package/src/permissions/checker.ts +6 -17
- package/src/providers/anthropic/client.ts +6 -2
- package/src/providers/gemini/client.ts +13 -2
- package/src/providers/managed-proxy/constants.ts +55 -0
- package/src/providers/managed-proxy/context.ts +77 -0
- package/src/providers/registry.ts +112 -0
- package/src/runtime/auth/__tests__/guard-tests.test.ts +51 -23
- package/src/runtime/guardian-action-service.ts +3 -2
- package/src/runtime/guardian-outbound-actions.ts +3 -3
- package/src/runtime/guardian-reply-router.ts +4 -4
- package/src/runtime/http-server.ts +83 -710
- package/src/runtime/http-types.ts +0 -16
- package/src/runtime/middleware/auth.ts +0 -12
- package/src/runtime/routes/app-routes.ts +33 -0
- package/src/runtime/routes/approval-routes.ts +32 -0
- package/src/runtime/routes/approval-strategies/guardian-callback-strategy.ts +6 -3
- package/src/runtime/routes/attachment-routes.ts +32 -0
- package/src/runtime/routes/brain-graph-routes.ts +27 -0
- package/src/runtime/routes/call-routes.ts +41 -0
- package/src/runtime/routes/channel-readiness-routes.ts +20 -0
- package/src/runtime/routes/channel-routes.ts +70 -0
- package/src/runtime/routes/contact-routes.ts +371 -29
- package/src/runtime/routes/conversation-attention-routes.ts +15 -0
- package/src/runtime/routes/conversation-routes.ts +192 -194
- package/src/runtime/routes/debug-routes.ts +15 -0
- package/src/runtime/routes/events-routes.ts +16 -0
- package/src/runtime/routes/global-search-routes.ts +17 -2
- package/src/runtime/routes/guardian-action-routes.ts +23 -1
- package/src/runtime/routes/guardian-approval-interception.ts +2 -1
- package/src/runtime/routes/guardian-bootstrap-routes.ts +26 -1
- package/src/runtime/routes/guardian-refresh-routes.ts +20 -0
- package/src/runtime/routes/identity-routes.ts +20 -0
- package/src/runtime/routes/inbound-message-handler.ts +8 -0
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +5 -1
- package/src/runtime/routes/inbound-stages/guardian-reply-intercept.ts +2 -1
- package/src/runtime/routes/integration-routes.ts +83 -0
- package/src/runtime/routes/invite-routes.ts +31 -0
- package/src/runtime/routes/migration-routes.ts +47 -17
- package/src/runtime/routes/pairing-routes.ts +18 -0
- package/src/runtime/routes/secret-routes.ts +20 -0
- package/src/runtime/routes/surface-action-routes.ts +26 -0
- package/src/runtime/routes/trust-rules-routes.ts +31 -0
- package/src/runtime/routes/twilio-routes.ts +79 -0
- package/src/schedule/recurrence-types.ts +1 -11
- package/src/tools/followups/followup_create.ts +9 -3
- package/src/tools/mcp/mcp-tool-factory.ts +0 -17
- package/src/tools/memory/definitions.ts +0 -6
- package/src/tools/network/script-proxy/session-manager.ts +38 -3
- package/src/tools/schedule/create.ts +1 -3
- package/src/tools/schedule/update.ts +9 -6
- package/src/twitter/session.ts +29 -77
- package/src/util/cookie-session.ts +114 -0
- package/src/workspace/git-service.ts +6 -4
- package/src/__tests__/conversation-routes.test.ts +0 -99
- package/src/__tests__/get-weather.test.ts +0 -393
- package/src/__tests__/task-tools.test.ts +0 -685
- package/src/__tests__/weather-skill-regression.test.ts +0 -276
- package/src/autonomy/autonomy-resolver.ts +0 -62
- package/src/autonomy/autonomy-store.ts +0 -138
- package/src/autonomy/disposition-mapper.ts +0 -31
- package/src/autonomy/index.ts +0 -11
- package/src/autonomy/types.ts +0 -43
- package/src/config/bundled-skills/weather/SKILL.md +0 -38
- package/src/config/bundled-skills/weather/TOOLS.json +0 -36
- package/src/config/bundled-skills/weather/icon.svg +0 -24
- package/src/config/bundled-skills/weather/tools/get-weather.ts +0 -12
- package/src/contacts/startup-migration.ts +0 -21
- package/src/messaging/triage-engine.ts +0 -344
- package/src/tools/weather/service.ts +0 -712
|
@@ -132,20 +132,6 @@ export type MessageProcessor = (
|
|
|
132
132
|
sourceInterface?: InterfaceId,
|
|
133
133
|
) => Promise<{ messageId: string }>;
|
|
134
134
|
|
|
135
|
-
/**
|
|
136
|
-
* Non-blocking message processor that persists the user message and
|
|
137
|
-
* starts the agent loop in the background, returning the messageId
|
|
138
|
-
* immediately.
|
|
139
|
-
*/
|
|
140
|
-
export type NonBlockingMessageProcessor = (
|
|
141
|
-
conversationId: string,
|
|
142
|
-
content: string,
|
|
143
|
-
attachmentIds?: string[],
|
|
144
|
-
options?: RuntimeMessageSessionOptions,
|
|
145
|
-
sourceChannel?: ChannelId,
|
|
146
|
-
sourceInterface?: InterfaceId,
|
|
147
|
-
) => Promise<{ messageId: string }>;
|
|
148
|
-
|
|
149
135
|
/**
|
|
150
136
|
* Dependencies for the POST /v1/messages handler.
|
|
151
137
|
*
|
|
@@ -171,8 +157,6 @@ export interface RuntimeHttpServerOptions {
|
|
|
171
157
|
/** Legacy shared secret for pairing routes (not used for delivery or auth). */
|
|
172
158
|
bearerToken?: string;
|
|
173
159
|
processMessage?: MessageProcessor;
|
|
174
|
-
/** Non-blocking processor for POST /messages (persists + fires agent loop). */
|
|
175
|
-
persistAndProcessMessage?: NonBlockingMessageProcessor;
|
|
176
160
|
/** Root directory for interface files on disk. */
|
|
177
161
|
interfacesDir?: string;
|
|
178
162
|
/** Daemon-injected generator for approval copy (provider-backed). */
|
|
@@ -3,18 +3,6 @@
|
|
|
3
3
|
* and gateway-origin verification.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { timingSafeEqual } from "node:crypto";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Constant-time comparison of two bearer tokens to prevent timing attacks.
|
|
10
|
-
*/
|
|
11
|
-
export function verifyBearerToken(provided: string, expected: string): boolean {
|
|
12
|
-
const a = Buffer.from(provided);
|
|
13
|
-
const b = Buffer.from(expected);
|
|
14
|
-
if (a.length !== b.length) return false;
|
|
15
|
-
return timingSafeEqual(a, b);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
6
|
/**
|
|
19
7
|
* Check if a hostname is a loopback address.
|
|
20
8
|
*/
|
|
@@ -12,6 +12,7 @@ import { getApp } from "../../memory/app-store.js";
|
|
|
12
12
|
import * as sharedAppLinksStore from "../../memory/shared-app-links-store.js";
|
|
13
13
|
import { getLogger } from "../../util/logger.js";
|
|
14
14
|
import { httpError } from "../http-errors.js";
|
|
15
|
+
import type { RouteDefinition } from "../http-router.js";
|
|
15
16
|
|
|
16
17
|
const log = getLogger("runtime-http");
|
|
17
18
|
|
|
@@ -199,3 +200,35 @@ export function handleDeleteSharedApp(shareToken: string): Response {
|
|
|
199
200
|
}
|
|
200
201
|
return Response.json({ success: true });
|
|
201
202
|
}
|
|
203
|
+
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
// Route definitions
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
|
|
208
|
+
export function appRouteDefinitions(): RouteDefinition[] {
|
|
209
|
+
return [
|
|
210
|
+
{
|
|
211
|
+
endpoint: "apps/share",
|
|
212
|
+
method: "POST",
|
|
213
|
+
handler: async ({ req }) => handleShareApp(req),
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
endpoint: "apps/shared/:token/metadata",
|
|
217
|
+
method: "GET",
|
|
218
|
+
policyKey: "apps/shared/metadata",
|
|
219
|
+
handler: ({ params }) => handleGetSharedAppMetadata(params.token),
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
endpoint: "apps/shared/:token",
|
|
223
|
+
method: "GET",
|
|
224
|
+
policyKey: "apps/shared",
|
|
225
|
+
handler: ({ params }) => handleDownloadSharedApp(params.token),
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
endpoint: "apps/shared/:token",
|
|
229
|
+
method: "DELETE",
|
|
230
|
+
policyKey: "apps/shared",
|
|
231
|
+
handler: ({ params }) => handleDeleteSharedApp(params.token),
|
|
232
|
+
},
|
|
233
|
+
];
|
|
234
|
+
}
|
|
@@ -16,6 +16,7 @@ import { getLogger } from "../../util/logger.js";
|
|
|
16
16
|
import { requireBoundGuardian } from "../auth/require-bound-guardian.js";
|
|
17
17
|
import type { AuthContext } from "../auth/types.js";
|
|
18
18
|
import { httpError } from "../http-errors.js";
|
|
19
|
+
import type { RouteDefinition } from "../http-router.js";
|
|
19
20
|
import * as pendingInteractions from "../pending-interactions.js";
|
|
20
21
|
|
|
21
22
|
const log = getLogger("approval-routes");
|
|
@@ -317,3 +318,34 @@ export function handleListPendingInteractions(
|
|
|
317
318
|
: null,
|
|
318
319
|
});
|
|
319
320
|
}
|
|
321
|
+
|
|
322
|
+
// ---------------------------------------------------------------------------
|
|
323
|
+
// Route definitions
|
|
324
|
+
// ---------------------------------------------------------------------------
|
|
325
|
+
|
|
326
|
+
export function approvalRouteDefinitions(): RouteDefinition[] {
|
|
327
|
+
return [
|
|
328
|
+
{
|
|
329
|
+
endpoint: "confirm",
|
|
330
|
+
method: "POST",
|
|
331
|
+
handler: async ({ req, authContext }) => handleConfirm(req, authContext),
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
endpoint: "secret",
|
|
335
|
+
method: "POST",
|
|
336
|
+
handler: async ({ req, authContext }) => handleSecret(req, authContext),
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
endpoint: "trust-rules",
|
|
340
|
+
method: "POST",
|
|
341
|
+
handler: async ({ req, authContext }) =>
|
|
342
|
+
handleTrustRule(req, authContext),
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
endpoint: "pending-interactions",
|
|
346
|
+
method: "GET",
|
|
347
|
+
handler: ({ url, authContext }) =>
|
|
348
|
+
handleListPendingInteractions(url, authContext),
|
|
349
|
+
},
|
|
350
|
+
];
|
|
351
|
+
}
|
|
@@ -297,7 +297,8 @@ async function handleCallbackDecision(params: {
|
|
|
297
297
|
const result = applyGuardianDecision({
|
|
298
298
|
approval: guardianApproval,
|
|
299
299
|
decision: callbackDecision,
|
|
300
|
-
|
|
300
|
+
actorPrincipalId: undefined, // Callback path — principal not available at this layer
|
|
301
|
+
actorExternalUserId: actorExternalId, // Channel-native ID (Telegram user ID, phone, etc.)
|
|
301
302
|
actorChannel: sourceChannel,
|
|
302
303
|
});
|
|
303
304
|
|
|
@@ -491,7 +492,8 @@ async function handleConversationalDecision(params: {
|
|
|
491
492
|
const result = applyGuardianDecision({
|
|
492
493
|
approval: targetApproval,
|
|
493
494
|
decision: engineDecision,
|
|
494
|
-
|
|
495
|
+
actorPrincipalId: undefined, // Callback path — principal not available at this layer
|
|
496
|
+
actorExternalUserId: actorExternalId, // Channel-native ID (Telegram user ID, phone, etc.)
|
|
495
497
|
actorChannel: sourceChannel,
|
|
496
498
|
});
|
|
497
499
|
|
|
@@ -675,7 +677,8 @@ async function handleLegacyDecision(params: {
|
|
|
675
677
|
const result = applyGuardianDecision({
|
|
676
678
|
approval: targetLegacyApproval,
|
|
677
679
|
decision: legacyGuardianDecision,
|
|
678
|
-
|
|
680
|
+
actorPrincipalId: undefined, // Callback path — principal not available at this layer
|
|
681
|
+
actorExternalUserId: actorExternalId, // Channel-native ID (Telegram user ID, phone, etc.)
|
|
679
682
|
actorChannel: sourceChannel,
|
|
680
683
|
});
|
|
681
684
|
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
validateAttachmentUpload,
|
|
11
11
|
} from "../../memory/attachments-store.js";
|
|
12
12
|
import { httpError } from "../http-errors.js";
|
|
13
|
+
import type { RouteDefinition } from "../http-router.js";
|
|
13
14
|
|
|
14
15
|
/** 30 MB — base64-encoded 20 MB attachment ≈ 27 MB plus JSON wrapper overhead. */
|
|
15
16
|
const MAX_UPLOAD_BODY_BYTES = 30 * 1024 * 1024;
|
|
@@ -220,3 +221,34 @@ export function handleGetAttachmentContent(
|
|
|
220
221
|
},
|
|
221
222
|
});
|
|
222
223
|
}
|
|
224
|
+
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
// Route definitions
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
|
|
229
|
+
export function attachmentRouteDefinitions(): RouteDefinition[] {
|
|
230
|
+
return [
|
|
231
|
+
{
|
|
232
|
+
endpoint: "attachments",
|
|
233
|
+
method: "POST",
|
|
234
|
+
handler: async ({ req }) => handleUploadAttachment(req),
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
endpoint: "attachments",
|
|
238
|
+
method: "DELETE",
|
|
239
|
+
handler: async ({ req }) => handleDeleteAttachment(req),
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
endpoint: "attachments/:id/content",
|
|
243
|
+
method: "GET",
|
|
244
|
+
policyKey: "attachments/content",
|
|
245
|
+
handler: ({ req, params }) => handleGetAttachmentContent(params.id, req),
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
endpoint: "attachments/:id",
|
|
249
|
+
method: "GET",
|
|
250
|
+
policyKey: "attachments",
|
|
251
|
+
handler: ({ params }) => handleGetAttachment(params.id),
|
|
252
|
+
},
|
|
253
|
+
];
|
|
254
|
+
}
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
memoryItems,
|
|
18
18
|
} from "../../memory/schema.js";
|
|
19
19
|
import { resolveBundledDir } from "../../util/bundled-asset.js";
|
|
20
|
+
import type { RouteDefinition } from "../http-router.js";
|
|
20
21
|
|
|
21
22
|
function getLobeRegion(entityType: string): string {
|
|
22
23
|
switch (entityType) {
|
|
@@ -236,3 +237,29 @@ export function handleServeBrainGraphUI(bearerToken?: string): Response {
|
|
|
236
237
|
);
|
|
237
238
|
}
|
|
238
239
|
}
|
|
240
|
+
|
|
241
|
+
// ---------------------------------------------------------------------------
|
|
242
|
+
// Route definitions
|
|
243
|
+
// ---------------------------------------------------------------------------
|
|
244
|
+
|
|
245
|
+
export function brainGraphRouteDefinitions(deps: {
|
|
246
|
+
mintUiPageToken: () => string;
|
|
247
|
+
}): RouteDefinition[] {
|
|
248
|
+
return [
|
|
249
|
+
{
|
|
250
|
+
endpoint: "brain-graph",
|
|
251
|
+
method: "GET",
|
|
252
|
+
handler: () => handleGetBrainGraph(),
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
endpoint: "brain-graph-ui",
|
|
256
|
+
method: "GET",
|
|
257
|
+
handler: () => handleServeBrainGraphUI(deps.mintUiPageToken()),
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
endpoint: "home-base-ui",
|
|
261
|
+
method: "GET",
|
|
262
|
+
handler: () => handleServeHomeBaseUI(deps.mintUiPageToken()),
|
|
263
|
+
},
|
|
264
|
+
];
|
|
265
|
+
}
|
|
@@ -19,6 +19,7 @@ import { getConfig } from "../../config/loader.js";
|
|
|
19
19
|
import { VALID_CALLER_IDENTITY_MODES } from "../../config/schema.js";
|
|
20
20
|
import { DAEMON_INTERNAL_ASSISTANT_ID } from "../assistant-scope.js";
|
|
21
21
|
import { httpError, httpErrorCodeFromStatus } from "../http-errors.js";
|
|
22
|
+
import type { RouteDefinition } from "../http-router.js";
|
|
22
23
|
|
|
23
24
|
// ── Idempotency cache ─────────────────────────────────────────────────────────
|
|
24
25
|
// Stores serialized 201 responses keyed by idempotencyKey for 5 minutes so
|
|
@@ -275,3 +276,43 @@ export async function handleInstructionCall(
|
|
|
275
276
|
|
|
276
277
|
return Response.json({ ok: true });
|
|
277
278
|
}
|
|
279
|
+
|
|
280
|
+
// ---------------------------------------------------------------------------
|
|
281
|
+
// Route definitions
|
|
282
|
+
// ---------------------------------------------------------------------------
|
|
283
|
+
|
|
284
|
+
export function callRouteDefinitions(deps: {
|
|
285
|
+
assistantId: string;
|
|
286
|
+
}): RouteDefinition[] {
|
|
287
|
+
return [
|
|
288
|
+
{
|
|
289
|
+
endpoint: "calls/start",
|
|
290
|
+
method: "POST",
|
|
291
|
+
handler: async ({ req }) => handleStartCall(req, deps.assistantId),
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
endpoint: "calls/:id/cancel",
|
|
295
|
+
method: "POST",
|
|
296
|
+
policyKey: "calls/cancel",
|
|
297
|
+
handler: async ({ req, params }) => handleCancelCall(req, params.id),
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
endpoint: "calls/:id/answer",
|
|
301
|
+
method: "POST",
|
|
302
|
+
policyKey: "calls/answer",
|
|
303
|
+
handler: async ({ req, params }) => handleAnswerCall(req, params.id),
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
endpoint: "calls/:id/instruction",
|
|
307
|
+
method: "POST",
|
|
308
|
+
policyKey: "calls/instruction",
|
|
309
|
+
handler: async ({ req, params }) => handleInstructionCall(req, params.id),
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
endpoint: "calls/:id",
|
|
313
|
+
method: "GET",
|
|
314
|
+
policyKey: "calls",
|
|
315
|
+
handler: ({ params }) => handleGetCallStatus(params.id),
|
|
316
|
+
},
|
|
317
|
+
];
|
|
318
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import type { ChannelId } from "../../channels/types.js";
|
|
9
9
|
import { getReadinessService } from "../../daemon/handlers/config-channels.js";
|
|
10
|
+
import type { RouteDefinition } from "../http-router.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* GET /v1/channels/readiness
|
|
@@ -75,3 +76,22 @@ export async function handleRefreshChannelReadiness(
|
|
|
75
76
|
})),
|
|
76
77
|
});
|
|
77
78
|
}
|
|
79
|
+
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Route definitions
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
|
|
84
|
+
export function channelReadinessRouteDefinitions(): RouteDefinition[] {
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
endpoint: "channels/readiness",
|
|
88
|
+
method: "GET",
|
|
89
|
+
handler: async ({ url }) => handleGetChannelReadiness(url),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
endpoint: "channels/readiness/refresh",
|
|
93
|
+
method: "POST",
|
|
94
|
+
handler: async ({ req }) => handleRefreshChannelReadiness(req),
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
}
|
|
@@ -7,6 +7,25 @@
|
|
|
7
7
|
* - channel-delivery-routes.ts — delivery ack, dead letters, reply delivery
|
|
8
8
|
* - channel-guardian-routes.ts — guardian approval interception, expiry sweep
|
|
9
9
|
*/
|
|
10
|
+
|
|
11
|
+
import type { RouteDefinition } from "../http-router.js";
|
|
12
|
+
import type {
|
|
13
|
+
ApprovalConversationGenerator,
|
|
14
|
+
ApprovalCopyGenerator,
|
|
15
|
+
GuardianActionCopyGenerator,
|
|
16
|
+
GuardianFollowUpConversationGenerator,
|
|
17
|
+
MessageProcessor,
|
|
18
|
+
} from "../http-types.js";
|
|
19
|
+
import {
|
|
20
|
+
handleChannelDeliveryAck as _handleChannelDeliveryAck,
|
|
21
|
+
handleListDeadLetters as _handleListDeadLetters,
|
|
22
|
+
handleReplayDeadLetters as _handleReplayDeadLetters,
|
|
23
|
+
} from "./channel-delivery-routes.js";
|
|
24
|
+
import {
|
|
25
|
+
handleChannelInbound as _handleChannelInbound,
|
|
26
|
+
handleDeleteConversation as _handleDeleteConversation,
|
|
27
|
+
} from "./channel-inbound-routes.js";
|
|
28
|
+
|
|
10
29
|
export {
|
|
11
30
|
handleChannelDeliveryAck,
|
|
12
31
|
handleListDeadLetters,
|
|
@@ -25,3 +44,54 @@ export {
|
|
|
25
44
|
_setTestPollMaxWait,
|
|
26
45
|
type DenialReason,
|
|
27
46
|
} from "./channel-route-shared.js";
|
|
47
|
+
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Route definitions
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
export function channelRouteDefinitions(deps: {
|
|
53
|
+
assistantId: string;
|
|
54
|
+
processMessage?: MessageProcessor;
|
|
55
|
+
approvalCopyGenerator?: ApprovalCopyGenerator;
|
|
56
|
+
approvalConversationGenerator?: ApprovalConversationGenerator;
|
|
57
|
+
guardianActionCopyGenerator?: GuardianActionCopyGenerator;
|
|
58
|
+
guardianFollowUpConversationGenerator?: GuardianFollowUpConversationGenerator;
|
|
59
|
+
}): RouteDefinition[] {
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
endpoint: "channels/conversation",
|
|
63
|
+
method: "DELETE",
|
|
64
|
+
handler: async ({ req }) =>
|
|
65
|
+
_handleDeleteConversation(req, deps.assistantId),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
endpoint: "channels/inbound",
|
|
69
|
+
method: "POST",
|
|
70
|
+
handler: async ({ req }) =>
|
|
71
|
+
_handleChannelInbound(
|
|
72
|
+
req,
|
|
73
|
+
deps.processMessage,
|
|
74
|
+
deps.assistantId,
|
|
75
|
+
deps.approvalCopyGenerator,
|
|
76
|
+
deps.approvalConversationGenerator,
|
|
77
|
+
deps.guardianActionCopyGenerator,
|
|
78
|
+
deps.guardianFollowUpConversationGenerator,
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
endpoint: "channels/delivery-ack",
|
|
83
|
+
method: "POST",
|
|
84
|
+
handler: async ({ req }) => _handleChannelDeliveryAck(req),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
endpoint: "channels/dead-letters",
|
|
88
|
+
method: "GET",
|
|
89
|
+
handler: () => _handleListDeadLetters(),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
endpoint: "channels/replay",
|
|
93
|
+
method: "POST",
|
|
94
|
+
handler: async ({ req }) => _handleReplayDeadLetters(req),
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
}
|