@vellumai/assistant 0.12.4 → 0.12.5-dev.202609251017.e467a6c
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/docs/architecture/memory.md +9 -1
- package/docs/architecture/scheduling.md +13 -5
- package/docs/desktop-browser-cli.md +3 -2
- package/docs/guardian-request-flow.md +1 -1
- package/node_modules/@vellumai/avatar-manifest/src/__tests__/notification-avatar.test.ts +48 -4
- package/node_modules/@vellumai/avatar-manifest/src/notification-avatar.ts +12 -8
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
- package/node_modules/@vellumai/gateway-client/src/outbound-contract.ts +2 -4
- package/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
- package/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
- package/openapi.yaml +152 -3
- package/package.json +1 -1
- package/src/__tests__/agent-loop.test.ts +76 -0
- package/src/__tests__/anthropic-error-formatting.test.ts +9 -0
- package/src/__tests__/background-shell-bash.test.ts +34 -0
- package/src/__tests__/background-shell-host-bash.test.ts +98 -1
- package/src/__tests__/background-tool-registry.test.ts +39 -0
- package/src/__tests__/channel-readiness-discord.test.ts +8 -0
- package/src/__tests__/channel-readiness-slack-remote.test.ts +8 -0
- package/src/__tests__/client-os-metadata-persistence.test.ts +4 -20
- package/src/__tests__/conversation-agent-loop.test.ts +529 -1
- package/src/__tests__/conversation-error.test.ts +18 -0
- package/src/__tests__/conversation-pairing.test.ts +69 -0
- package/src/__tests__/conversation-queue.test.ts +257 -4
- package/src/__tests__/conversation-runtime-assembly.test.ts +27 -0
- package/src/__tests__/emit-signal-routing-intent.test.ts +62 -0
- package/src/__tests__/evict-conversations-for-reload.test.ts +21 -0
- package/src/__tests__/gemini-provider.test.ts +9 -0
- package/src/__tests__/host-cu-proxy.test.ts +79 -0
- package/src/__tests__/host-cu-routes-targeted.test.ts +14 -5
- package/src/__tests__/introduction-card-resolver.test.ts +53 -8
- package/src/__tests__/job-handler-registration-guard.test.ts +1 -0
- package/src/__tests__/non-member-access-request.test.ts +48 -0
- package/src/__tests__/notification-events-source-context-probe.test.ts +48 -1
- package/src/__tests__/notification-platform-adapter.test.ts +97 -0
- package/src/__tests__/notification-vellum-adapter.test.ts +103 -3
- package/src/__tests__/platform-callback-registration.test.ts +46 -1
- package/src/__tests__/plugin-import-boundary-guard.test.ts +3 -0
- package/src/__tests__/scaffold-managed-skill-tool.test.ts +116 -66
- package/src/__tests__/scheduler-disk-pressure.test.ts +1 -0
- package/src/__tests__/scheduler-result-notification.test.ts +521 -7
- package/src/__tests__/scheduler-wake.test.ts +1 -0
- package/src/__tests__/skill-load-inline-command.test.ts +35 -0
- package/src/__tests__/subagent-cron-run-attribution.test.ts +41 -2
- package/src/__tests__/subagent-manager-notify.test.ts +48 -0
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +6 -6
- package/src/__tests__/usage-attribution.test.ts +31 -0
- package/src/__tests__/wake-schedule-escalation.test.ts +1 -0
- package/src/agent/loop.ts +23 -0
- package/src/api/ask-question-tool.ts +50 -0
- package/src/api/events/generation-handoff.ts +4 -0
- package/src/api/events/message-complete.ts +4 -0
- package/src/api/events/tool-result.ts +11 -0
- package/src/api/index.ts +11 -0
- package/src/api/requests/guardian-actions.test.ts +45 -0
- package/src/api/requests/guardian-actions.ts +20 -0
- package/src/api/responses/conversation-message.ts +4 -0
- package/src/api/responses/home.ts +27 -0
- package/src/approvals/guardian-decision-primitive.ts +6 -4
- package/src/approvals/guardian-request-resolvers.ts +35 -30
- package/src/avatar/notification-avatar.test.ts +42 -34
- package/src/avatar/notification-avatar.ts +1 -0
- package/src/calls/__tests__/call-controller.test.ts +18 -0
- package/src/calls/__tests__/voice-control-protocol.test.ts +6 -1
- package/src/calls/__tests__/voice-leg-coordinator.test.ts +70 -0
- package/src/calls/__tests__/voice-session-bridge.test.ts +116 -4
- package/src/calls/__tests__/voice-triage-escalate.test.ts +77 -11
- package/src/calls/call-controller.ts +3 -1
- package/src/calls/voice-control-protocol.ts +12 -4
- package/src/calls/voice-escalation-judge.ts +2 -2
- package/src/calls/voice-leg-coordinator.ts +23 -5
- package/src/calls/voice-screen-annotation.ts +44 -0
- package/src/calls/voice-session-bridge.ts +63 -20
- package/src/calls/voice-triage-escalate.ts +82 -27
- package/src/cli/commands/__tests__/conversations-clear.test.ts +156 -0
- package/src/cli/commands/conversations.help.ts +7 -2
- package/src/cli/commands/conversations.ts +36 -30
- package/src/cli/commands/oauth/index.help.ts +8 -2
- package/src/cli/commands/oauth/request.test.ts +32 -0
- package/src/cli/commands/platform/index.help.ts +2 -1
- package/src/cli/commands/platform/index.ts +8 -2
- package/src/cli/lib/__tests__/plugin-catalog-cache.test.ts +60 -0
- package/src/cli/lib/__tests__/plugin-catalog-platform.test.ts +66 -2
- package/src/cli/lib/bundled-marketplace.json +35 -0
- package/src/cli/lib/bundled-plugin-packages.json +21 -0
- package/src/cli/lib/plugin-catalog-cache.ts +17 -2
- package/src/cli/lib/plugin-catalog-platform.ts +48 -9
- package/src/config/__tests__/default-profile-catalog.test.ts +28 -0
- package/src/config/__tests__/platform-identity.test.ts +59 -0
- package/src/config/__tests__/profile-order.test.ts +19 -0
- package/src/config/__tests__/sync-gated-profiles.test.ts +71 -0
- package/src/config/bundled-skills/computer-use/SKILL.md +20 -0
- package/src/config/bundled-skills/computer-use/TOOLS.json +11 -11
- package/src/config/bundled-skills/screen-annotation/SKILL.md +41 -29
- package/src/config/bundled-skills/screen-annotation/TOOLS.json +5 -5
- package/src/config/call-site-defaults.ts +6 -0
- package/src/config/default-profile-catalog.ts +30 -1
- package/src/config/default-profile-names.ts +36 -2
- package/src/config/feature-flag-registry.json +9 -1
- package/src/config/platform-identity.ts +22 -5
- package/src/config/profile-order.ts +7 -1
- package/src/config/schemas/call-site-catalog.ts +7 -0
- package/src/config/schemas/llm.ts +21 -5
- package/src/config/sync-gated-profiles.ts +96 -44
- package/src/daemon/__tests__/abort-null-controller.test.ts +135 -1
- package/src/daemon/__tests__/auto-profile-router.test.ts +380 -0
- package/src/daemon/__tests__/turn-tail-assistant-reply-notify.test.ts +16 -0
- package/src/daemon/activity-trail.test.ts +206 -0
- package/src/daemon/activity-trail.ts +190 -0
- package/src/daemon/auto-profile-router.ts +431 -0
- package/src/daemon/computer-use-observation.test.ts +81 -0
- package/src/daemon/computer-use-observation.ts +23 -0
- package/src/daemon/conversation-agent-loop-handlers.ts +11 -0
- package/src/daemon/conversation-agent-loop.ts +157 -32
- package/src/daemon/conversation-error.ts +19 -0
- package/src/daemon/conversation-lifecycle.ts +70 -7
- package/src/daemon/conversation-media-retry.ts +1 -2
- package/src/daemon/conversation-messaging.ts +31 -2
- package/src/daemon/conversation-process.ts +107 -16
- package/src/daemon/conversation-queue-manager.ts +7 -0
- package/src/daemon/conversation-runtime-assembly.ts +1 -0
- package/src/daemon/conversation-turn-finalize.ts +14 -0
- package/src/daemon/conversation.ts +25 -6
- package/src/daemon/event-loop-watchdog.test.ts +201 -2
- package/src/daemon/event-loop-watchdog.ts +182 -6
- package/src/daemon/host-cu-proxy.ts +34 -3
- package/src/daemon/pkb-reminder-builder.test.ts +10 -3
- package/src/daemon/pkb-reminder-builder.ts +1 -1
- package/src/daemon/wake-conversation-ops.ts +4 -2
- package/src/desktop/desktop-computer-use.test.ts +14 -4
- package/src/home/feed-types.ts +2 -0
- package/src/inbound/platform-callback-registration.ts +19 -6
- package/src/live-voice/__tests__/live-voice-agent-turn.test.ts +27 -0
- package/src/live-voice/__tests__/live-voice-flux-turn-end.test.ts +83 -0
- package/src/live-voice/__tests__/live-voice-triage-escalate.test.ts +48 -1
- package/src/live-voice/__tests__/live-voice-vad.test.ts +34 -2
- package/src/live-voice/__tests__/protocol.test.ts +22 -0
- package/src/live-voice/continuation-judge.ts +1 -1
- package/src/live-voice/live-voice-session.ts +25 -19
- package/src/live-voice/protocol.ts +16 -5
- package/src/messaging/providers/discord/withdraw.ts +4 -5
- package/src/messaging/providers/gmail/client.ts +4 -0
- package/src/messaging/providers/slack/withdraw.ts +5 -5
- package/src/messaging/providers/telegram-bot/withdraw.ts +4 -5
- package/src/monitoring/__tests__/proc-fixtures.ts +28 -0
- package/src/monitoring/__tests__/proc-wait-state.test.ts +232 -0
- package/src/monitoring/__tests__/process-usage.test.ts +243 -0
- package/src/monitoring/proc-wait-state.ts +366 -0
- package/src/monitoring/process-memory.ts +4 -3
- package/src/monitoring/process-usage.ts +215 -0
- package/src/monitoring/resource-sample-types.ts +8 -0
- package/src/monitoring/resource-sampler.ts +17 -2
- package/src/monitoring/stall-capture.ts +12 -0
- package/src/notifications/README.md +88 -9
- package/src/notifications/__tests__/assistant-reply-producer.test.ts +390 -119
- package/src/notifications/__tests__/background-result-producer.test.ts +1272 -0
- package/src/notifications/__tests__/broadcaster.test.ts +292 -1
- package/src/notifications/__tests__/completion-policy.test.ts +243 -0
- package/src/notifications/__tests__/decision-engine.test.ts +51 -4
- package/src/notifications/__tests__/has-pending-background-work.test.ts +281 -0
- package/src/notifications/__tests__/home-feed-side-effect.test.ts +161 -3
- package/src/notifications/__tests__/resolve-visible-in-source.test.ts +110 -1
- package/src/notifications/__tests__/schedule-result-producer.test.ts +11 -4
- package/src/notifications/adapters/macos.ts +24 -12
- package/src/notifications/adapters/platform.ts +16 -5
- package/src/notifications/assistant-reply-producer.ts +96 -71
- package/src/notifications/background-result-producer.ts +369 -0
- package/src/notifications/broadcaster.ts +28 -8
- package/src/notifications/completion-policy.ts +115 -0
- package/src/notifications/completion-work.ts +46 -0
- package/src/notifications/conversation-pairing.ts +32 -13
- package/src/notifications/decision-engine.ts +18 -24
- package/src/notifications/emit-signal.ts +16 -1
- package/src/notifications/events-store.ts +4 -0
- package/src/notifications/has-pending-background-work.ts +91 -0
- package/src/notifications/home-feed-mirror.ts +44 -0
- package/src/notifications/home-feed-side-effect.ts +54 -28
- package/src/notifications/resolve-visible-in-source.ts +56 -2
- package/src/notifications/result-output.ts +154 -0
- package/src/notifications/schedule-result-producer.ts +6 -187
- package/src/notifications/types.ts +2 -0
- package/src/oauth/AGENTS.md +9 -1
- package/src/oauth/byo-connection.test.ts +28 -0
- package/src/persistence/__tests__/recent-conversation-messages.test.ts +41 -0
- package/src/persistence/conversation-crud.ts +26 -0
- package/src/persistence/conversation-types.ts +15 -37
- package/src/persistence/embeddings/__tests__/embedding-local-lifecycle.test.ts +85 -14
- package/src/persistence/jobs-store.ts +229 -0
- package/src/persistence/migrations/383-normalize-opencode-host-connections.ts +44 -0
- package/src/persistence/migrations/__tests__/383-normalize-opencode-host-connections.test.ts +102 -0
- package/src/persistence/steps.ts +12 -0
- package/src/platform/sync-avatar.test.ts +29 -0
- package/src/plugins/defaults/memory/AGENTS.md +5 -3
- package/src/plugins/defaults/memory/__tests__/skill-update-receipt-boundary-guard.test.ts +45 -0
- package/src/plugins/defaults/memory/__tests__/skill-update-receipt-job.test.ts +580 -0
- package/src/plugins/defaults/memory/__tests__/turn-retrieval.test.ts +21 -0
- package/src/plugins/defaults/memory/graph/tools.ts +9 -5
- package/src/plugins/defaults/memory/hooks/conversation-deleted.ts +4 -0
- package/src/plugins/defaults/memory/hooks/user-prompt-submit.ts +7 -3
- package/src/plugins/defaults/memory/job-handlers.ts +8 -2
- package/src/plugins/defaults/memory/skill-update-receipt-job.ts +334 -0
- package/src/plugins/defaults/memory/tools.test.ts +17 -0
- package/src/plugins/defaults/memory/turn-retrieval.ts +8 -0
- package/src/plugins/defaults/memory/v3/__tests__/injection.test.ts +24 -0
- package/src/plugins/defaults/memory/v3/injector.ts +4 -4
- package/src/plugins/types.ts +2 -0
- package/src/providers/__tests__/search-provider-catalog.test.ts +8 -0
- package/src/providers/anthropic/client.ts +4 -0
- package/src/providers/gemini/client.ts +7 -1
- package/src/providers/inference/auth.ts +25 -0
- package/src/providers/inference/profile-probe.ts +1 -0
- package/src/{calls/__tests__/typesafe-noul.test.ts → providers/jev/ask.test.ts} +4 -4
- package/src/{calls/typesafe-noul.ts → providers/jev/ask.ts} +67 -34
- package/src/providers/openai/__tests__/api-error-normalization.test.ts +12 -0
- package/src/providers/openai/api-error-normalization.ts +4 -0
- package/src/providers/retry.ts +2 -0
- package/src/providers/search-provider-catalog.ts +10 -0
- package/src/providers/types.ts +7 -0
- package/src/providers/usage-tracking.ts +5 -3
- package/src/runtime/__tests__/agent-wake.test.ts +308 -0
- package/src/runtime/access-request-helper.ts +16 -9
- package/src/runtime/agent-wake-queue.ts +52 -0
- package/src/runtime/agent-wake.ts +111 -18
- package/src/runtime/channel-approval-types.ts +6 -38
- package/src/runtime/channel-approvals.ts +4 -5
- package/src/runtime/http-server.ts +4 -1
- package/src/runtime/introduction-policy.test.ts +17 -1
- package/src/runtime/introduction-policy.ts +25 -7
- package/src/runtime/migrations/vbundle-builder.ts +9 -0
- package/src/runtime/routes/__tests__/inference-profiles-routes.test.ts +21 -1
- package/src/runtime/routes/__tests__/inference-provider-connection-routes.test.ts +60 -0
- package/src/runtime/routes/__tests__/oauth-proxy-routes.test.ts +61 -3
- package/src/runtime/routes/auto-profile-routes.ts +83 -0
- package/src/runtime/routes/conversation-management-routes.ts +1 -3
- package/src/runtime/routes/conversation-routes.ts +9 -0
- package/src/runtime/routes/guardian-action-routes.ts +8 -23
- package/src/runtime/routes/host-cu-routes.ts +3 -1
- package/src/runtime/routes/index.ts +2 -0
- package/src/runtime/routes/inference-profiles-routes.ts +5 -2
- package/src/runtime/routes/inference-provider-connection-routes.ts +25 -8
- package/src/runtime/routes/migration-routes.ts +8 -2
- package/src/runtime/routes/oauth-proxy-passthrough.test.ts +32 -0
- package/src/runtime/routes/platform-routes.ts +6 -1
- package/src/runtime/routes/user-route-dispatcher.ts +1 -2
- package/src/runtime/web-presence.ts +3 -4
- package/src/schedule/schedule-store.ts +10 -0
- package/src/schedule/scheduler.ts +92 -24
- package/src/subagent/manager.ts +32 -12
- package/src/telegram/__tests__/webhook-health.test.ts +8 -0
- package/src/telemetry/telemetry-wire-source.json +1 -1
- package/src/telemetry/telemetry-wire.generated.ts +1 -0
- package/src/tools/background-tool-registry.ts +30 -3
- package/src/tools/browser/cdp-client/local-cdp-client.ts +1 -2
- package/src/tools/host-terminal/host-shell.ts +7 -0
- package/src/tools/network/__tests__/web-fetch-firecrawl.test.ts +28 -1
- package/src/tools/network/__tests__/web-fetch-metadata.test.ts +34 -0
- package/src/tools/network/__tests__/web-fetch-tinyfish.test.ts +35 -1
- package/src/tools/network/__tests__/web-search.test.ts +96 -0
- package/src/tools/network/web-fetch.ts +30 -9
- package/src/tools/network/web-search.ts +235 -4
- package/src/tools/skills/load.ts +13 -17
- package/src/tools/skills/scaffold-managed.ts +86 -71
- package/src/tools/terminal/shell-launch.test.ts +27 -1
- package/src/tools/terminal/shell.ts +4 -0
- package/src/tools/workspace-tools/loader.ts +1 -2
- package/src/usage/attribution.ts +18 -1
- package/src/util/abort-reasons.ts +2 -0
- package/src/util/errors.ts +1 -0
- package/src/util/oauth-request-body.test.ts +5 -1
- package/src/util/provider-error-patterns.ts +11 -0
- package/src/util/single-flight.test.ts +6 -0
- package/src/util/single-flight.ts +2 -0
- package/src/util/worker-pipe.test.ts +56 -10
- package/src/util/worker-pipe.ts +9 -4
- package/src/workspace/git-service.ts +6 -1
- package/src/workspace/migrations/158-repoint-opencode-host-provider-fragments.ts +163 -0
- package/src/workspace/migrations/__tests__/158-repoint-opencode-host-provider-fragments.test.ts +188 -0
- package/src/workspace/migrations/registry.ts +2 -0
|
@@ -108,9 +108,13 @@ const providerLookups: string[] = [];
|
|
|
108
108
|
mock.module("../../../oauth/oauth-store.js", () => ({
|
|
109
109
|
getProvider: (provider: string) => {
|
|
110
110
|
providerLookups.push(provider);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
if (provider === "stripe_link") {
|
|
112
|
+
return { provider, baseUrl: "https://api.link.com" };
|
|
113
|
+
}
|
|
114
|
+
if (provider === "google") {
|
|
115
|
+
return { provider, baseUrl: "https://www.googleapis.com" };
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
114
118
|
},
|
|
115
119
|
}));
|
|
116
120
|
|
|
@@ -455,6 +459,60 @@ describe("body passthrough", () => {
|
|
|
455
459
|
await callProxy({ method: "POST", body: "" });
|
|
456
460
|
expect(requireCaptured().body).toBeUndefined();
|
|
457
461
|
});
|
|
462
|
+
|
|
463
|
+
test("forwards a Gmail rfc822 media upload path, query, and body", async () => {
|
|
464
|
+
const rfc822 =
|
|
465
|
+
"From: user@example.com\r\nTo: user@example.com\r\nSubject: Draft\r\n\r\nHello\r\n";
|
|
466
|
+
|
|
467
|
+
const response = await callProxy({
|
|
468
|
+
method: "POST",
|
|
469
|
+
segment: "google",
|
|
470
|
+
path: "upload/gmail/v1/users/me/drafts",
|
|
471
|
+
search: "?uploadType=media",
|
|
472
|
+
subject: "local:self:oauth-proxy.google",
|
|
473
|
+
headers: { "content-type": "message/rfc822" },
|
|
474
|
+
body: rfc822,
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
expect(response.status).toBe(200);
|
|
478
|
+
const req = requireCaptured();
|
|
479
|
+
expect(req.path).toBe("/upload/gmail/v1/users/me/drafts");
|
|
480
|
+
expect(req.query).toEqual({ uploadType: "media" });
|
|
481
|
+
expect(req.rawQuery).toBe("?uploadType=media");
|
|
482
|
+
expect(req.baseUrl).toBeUndefined();
|
|
483
|
+
expect(req.headers?.["content-type"]).toBe("message/rfc822");
|
|
484
|
+
expect((req.body as Buffer).toString("utf8")).toBe(rfc822);
|
|
485
|
+
expect(providerLookups).toContain("google");
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
test("forwards a Gmail multipart/related upload with the boundary intact", async () => {
|
|
489
|
+
const boundary = "boundary_cas159";
|
|
490
|
+
const body =
|
|
491
|
+
`--${boundary}\r\n` +
|
|
492
|
+
"Content-Type: application/json; charset=UTF-8\r\n\r\n" +
|
|
493
|
+
'{"message":{"threadId":"thread-1"}}\r\n' +
|
|
494
|
+
`--${boundary}\r\n` +
|
|
495
|
+
"Content-Type: message/rfc822\r\n\r\n" +
|
|
496
|
+
"From: user@example.com\r\nSubject: Draft\r\n\r\nHi\r\n" +
|
|
497
|
+
`--${boundary}--`;
|
|
498
|
+
const contentType = `multipart/related; boundary=${boundary}`;
|
|
499
|
+
|
|
500
|
+
await callProxy({
|
|
501
|
+
method: "POST",
|
|
502
|
+
segment: "google",
|
|
503
|
+
path: "upload/gmail/v1/users/me/drafts",
|
|
504
|
+
search: "?uploadType=multipart",
|
|
505
|
+
subject: "local:self:oauth-proxy.google",
|
|
506
|
+
headers: { "content-type": contentType },
|
|
507
|
+
body,
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
const req = requireCaptured();
|
|
511
|
+
expect(req.path).toBe("/upload/gmail/v1/users/me/drafts");
|
|
512
|
+
expect(req.query).toEqual({ uploadType: "multipart" });
|
|
513
|
+
expect(req.headers?.["content-type"]).toBe(contentType);
|
|
514
|
+
expect((req.body as Buffer).toString("utf8")).toBe(body);
|
|
515
|
+
});
|
|
458
516
|
});
|
|
459
517
|
|
|
460
518
|
// ── Headers ─────────────────────────────────────────────────────────────────
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto profile routes.
|
|
3
|
+
*
|
|
4
|
+
* POST /v1/auto-profile/preview — which default profile the Auto profile
|
|
5
|
+
* would pick for a draft the user has not sent yet.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
import { previewAutoProfile } from "../../daemon/auto-profile-router.js";
|
|
10
|
+
import { ACTOR_PRINCIPALS } from "../auth/route-policy.js";
|
|
11
|
+
import { BadRequestError } from "./errors.js";
|
|
12
|
+
import type { RouteDefinition, RouteHandlerArgs } from "./types.js";
|
|
13
|
+
|
|
14
|
+
const MAX_DRAFT_CHARS = 20_000;
|
|
15
|
+
|
|
16
|
+
const previewRequestSchema = z.object({
|
|
17
|
+
text: z.string().min(1).max(MAX_DRAFT_CHARS),
|
|
18
|
+
conversationId: z
|
|
19
|
+
.string()
|
|
20
|
+
.describe(
|
|
21
|
+
"Conversation the draft belongs to, for recent history. Omit for a new chat.",
|
|
22
|
+
)
|
|
23
|
+
.optional(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const previewResponseSchema = z.object({
|
|
27
|
+
/** The default profile key the draft would run on; null when the Auto
|
|
28
|
+
* profile is not available on this install. */
|
|
29
|
+
profile: z.string().nullable(),
|
|
30
|
+
outcome: z.enum(["routed", "unavailable", "timeout", "error", "fallback"]),
|
|
31
|
+
confidence: z.number().optional(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
async function handlePreviewAutoProfile(
|
|
35
|
+
args: RouteHandlerArgs,
|
|
36
|
+
): Promise<z.infer<typeof previewResponseSchema>> {
|
|
37
|
+
const parsed = previewRequestSchema.safeParse(args.body ?? {});
|
|
38
|
+
if (!parsed.success) {
|
|
39
|
+
throw new BadRequestError(
|
|
40
|
+
`text must be a non-empty string of at most ${MAX_DRAFT_CHARS} characters`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
// The composer aborts a preview the moment the draft changes; carrying the
|
|
44
|
+
// abort through stops the retired Jev call and keeps its late answer out
|
|
45
|
+
// of the reuse cache.
|
|
46
|
+
const route = await previewAutoProfile({
|
|
47
|
+
text: parsed.data.text,
|
|
48
|
+
...(parsed.data.conversationId
|
|
49
|
+
? { conversationId: parsed.data.conversationId }
|
|
50
|
+
: {}),
|
|
51
|
+
...(args.abortSignal ? { signal: args.abortSignal } : {}),
|
|
52
|
+
});
|
|
53
|
+
if (!route) {
|
|
54
|
+
return { profile: null, outcome: "unavailable" };
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
profile: route.profile,
|
|
58
|
+
outcome: route.outcome,
|
|
59
|
+
...(route.confidence !== undefined ? { confidence: route.confidence } : {}),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const ROUTES: RouteDefinition[] = [
|
|
64
|
+
{
|
|
65
|
+
operationId: "previewAutoProfile",
|
|
66
|
+
endpoint: "auto-profile/preview",
|
|
67
|
+
method: "POST",
|
|
68
|
+
policy: {
|
|
69
|
+
requiredScopes: ["chat.write"],
|
|
70
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
71
|
+
},
|
|
72
|
+
summary: "Preview the Auto profile's pick for a draft",
|
|
73
|
+
description:
|
|
74
|
+
"Ask the Auto profile which default profile a draft message would run on, " +
|
|
75
|
+
"using the conversation's recent history when one is given. The pick is " +
|
|
76
|
+
"kept briefly so the turn that sends the same text reuses it. Spends one " +
|
|
77
|
+
"Jev call per request.",
|
|
78
|
+
tags: ["conversations"],
|
|
79
|
+
requestBody: previewRequestSchema,
|
|
80
|
+
responseBody: previewResponseSchema,
|
|
81
|
+
handler: handlePreviewAutoProfile,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
@@ -413,15 +413,13 @@ async function handleSetInferenceProfile({
|
|
|
413
413
|
throw new BadRequestError("profile must be a non-empty string or null");
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
|
|
416
|
+
return setInferenceProfileSession({
|
|
417
417
|
conversationId: pathParams.id!,
|
|
418
418
|
profile: body.profile as string | null,
|
|
419
419
|
ttlSeconds: body.ttlSeconds as number | null | undefined,
|
|
420
420
|
sessionId: body.sessionId as string | undefined,
|
|
421
421
|
originClientId: headers?.["x-vellum-client-id"]?.trim() || undefined,
|
|
422
422
|
});
|
|
423
|
-
|
|
424
|
-
return result;
|
|
425
423
|
}
|
|
426
424
|
|
|
427
425
|
async function handleUpdateConversationEnabledPlugins({
|
|
@@ -142,6 +142,7 @@ import {
|
|
|
142
142
|
import { listConversationModeSessionsByIds } from "../../persistence/conversation-mode-sessions.js";
|
|
143
143
|
import { searchConversations } from "../../persistence/conversation-queries.js";
|
|
144
144
|
import {
|
|
145
|
+
AUTO_ROUTED_PROFILE_METADATA_KEY,
|
|
145
146
|
computerUseScreenshotAttachmentIdsFromMetadata,
|
|
146
147
|
isNoResponseMetadata,
|
|
147
148
|
messageMetadataIsAmbientSightKeep,
|
|
@@ -1110,6 +1111,7 @@ export async function handleListMessages({
|
|
|
1110
1111
|
let backgroundToolCompletion: ConversationMessage["backgroundToolCompletion"];
|
|
1111
1112
|
let systemCard: boolean | undefined;
|
|
1112
1113
|
let noResponse: boolean | undefined;
|
|
1114
|
+
let autoRoutedProfile: string | undefined;
|
|
1113
1115
|
const cameraFrame = messageMetadataIsAmbientSightKeep(msg.metadata)
|
|
1114
1116
|
? true
|
|
1115
1117
|
: undefined;
|
|
@@ -1130,6 +1132,9 @@ export async function handleListMessages({
|
|
|
1130
1132
|
if (isNoResponseMetadata(meta)) {
|
|
1131
1133
|
noResponse = true;
|
|
1132
1134
|
}
|
|
1135
|
+
if (typeof meta[AUTO_ROUTED_PROFILE_METADATA_KEY] === "string") {
|
|
1136
|
+
autoRoutedProfile = meta[AUTO_ROUTED_PROFILE_METADATA_KEY];
|
|
1137
|
+
}
|
|
1133
1138
|
// Channel facts live in the row's provider envelope. A reaction row,
|
|
1134
1139
|
// either direction, projects its structured fact so clients never
|
|
1135
1140
|
// render the stored "[reaction]" sentinel; a row deleted on its
|
|
@@ -1212,6 +1217,7 @@ export async function handleListMessages({
|
|
|
1212
1217
|
backgroundToolCompletion,
|
|
1213
1218
|
systemCard,
|
|
1214
1219
|
noResponse,
|
|
1220
|
+
autoRoutedProfile,
|
|
1215
1221
|
cameraFrame,
|
|
1216
1222
|
reaction,
|
|
1217
1223
|
providerError,
|
|
@@ -1451,6 +1457,9 @@ export async function handleListMessages({
|
|
|
1451
1457
|
: {}),
|
|
1452
1458
|
...(m.systemCard ? { systemCard: true } : {}),
|
|
1453
1459
|
...(m.noResponse ? { noResponse: true } : {}),
|
|
1460
|
+
...(m.autoRoutedProfile
|
|
1461
|
+
? { autoRoutedProfile: m.autoRoutedProfile }
|
|
1462
|
+
: {}),
|
|
1454
1463
|
...(m.cameraFrame ? { cameraFrame: true as const } : {}),
|
|
1455
1464
|
// The row's own marker, so a client gates per-row presentation on what
|
|
1456
1465
|
// this row was written with rather than on the live flag.
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
|
|
16
|
+
import { GuardianActionDecisionRequestSchema } from "../../api/requests/guardian-actions.js";
|
|
16
17
|
import {
|
|
17
18
|
type GuardianRequestWire,
|
|
18
19
|
listPendingRequestsByScope,
|
|
@@ -25,6 +26,7 @@ import type { GuardianDecisionPrompt } from "../guardian-decision-types.js";
|
|
|
25
26
|
import { buildOneTimeDecisionActions } from "../guardian-decision-types.js";
|
|
26
27
|
import { findLocalGuardianPrincipalId } from "../local-actor-identity.js";
|
|
27
28
|
import { BadRequestError, NotFoundError } from "./errors.js";
|
|
29
|
+
import { parseBody } from "./parse-body.js";
|
|
28
30
|
import type { RouteDefinition, RouteHandlerArgs } from "./types.js";
|
|
29
31
|
|
|
30
32
|
// ---------------------------------------------------------------------------
|
|
@@ -55,23 +57,10 @@ async function handleGuardianActionDecision({
|
|
|
55
57
|
body,
|
|
56
58
|
headers = {},
|
|
57
59
|
}: RouteHandlerArgs) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const { requestId, action, conversationId } = body as {
|
|
63
|
-
requestId?: string;
|
|
64
|
-
action?: string;
|
|
65
|
-
conversationId?: string;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
if (!requestId || typeof requestId !== "string") {
|
|
69
|
-
throw new BadRequestError("requestId is required");
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (!action || typeof action !== "string") {
|
|
73
|
-
throw new BadRequestError("action is required");
|
|
74
|
-
}
|
|
60
|
+
const { requestId, action, conversationId } = parseBody(
|
|
61
|
+
GuardianActionDecisionRequestSchema,
|
|
62
|
+
body,
|
|
63
|
+
);
|
|
75
64
|
|
|
76
65
|
// Resolve the actor's guardian principal ID. The HTTP adapter injects it
|
|
77
66
|
// from the AuthContext via the x-vellum-actor-principal-id header.
|
|
@@ -258,13 +247,9 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
258
247
|
},
|
|
259
248
|
requireGuardian: true,
|
|
260
249
|
summary: "Submit guardian decision",
|
|
261
|
-
description: "Submit a guardian
|
|
250
|
+
description: "Submit a guardian decision on a pending request.",
|
|
262
251
|
tags: ["guardian"],
|
|
263
|
-
requestBody:
|
|
264
|
-
requestId: z.string().describe("Guardian request ID"),
|
|
265
|
-
action: z.string().describe("Decision action"),
|
|
266
|
-
conversationId: z.string().describe("Conversation ID").optional(),
|
|
267
|
-
}),
|
|
252
|
+
requestBody: GuardianActionDecisionRequestSchema,
|
|
268
253
|
responseBody: z.object({
|
|
269
254
|
applied: z.boolean(),
|
|
270
255
|
requestId: z.string(),
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
|
|
9
|
+
import { prepareComputerUseObservation } from "../../daemon/computer-use-observation.js";
|
|
9
10
|
import { findConversation } from "../../daemon/conversation-registry.js";
|
|
10
11
|
import { ACTOR_PRINCIPALS } from "../auth/route-policy.js";
|
|
11
12
|
import { SAME_ACTOR_FORBIDDEN_DESCRIPTION } from "../auth/same-actor.js";
|
|
@@ -112,7 +113,7 @@ async function handleHostCuResult({ body, headers }: RouteHandlerArgs) {
|
|
|
112
113
|
throw new NotFoundError("No host CU proxy for conversation");
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
const observation = await prepareComputerUseObservation({
|
|
116
117
|
axTree,
|
|
117
118
|
axDiff,
|
|
118
119
|
screenshot,
|
|
@@ -126,6 +127,7 @@ async function handleHostCuResult({ body, headers }: RouteHandlerArgs) {
|
|
|
126
127
|
userGuidance,
|
|
127
128
|
timings,
|
|
128
129
|
});
|
|
130
|
+
conversation.hostCuProxy.processObservation(requestId, observation);
|
|
129
131
|
|
|
130
132
|
return { accepted: true };
|
|
131
133
|
}
|
|
@@ -25,6 +25,7 @@ import { ROUTES as ATTACHMENT_ROUTES } from "./attachment-routes.js";
|
|
|
25
25
|
import { ROUTES as AUDIO_ROUTES } from "./audio-routes.js";
|
|
26
26
|
import { ROUTES as AUDIT_ROUTES } from "./audit-routes.js";
|
|
27
27
|
import { ROUTES as AUTH_ROUTES } from "./auth-routes.js";
|
|
28
|
+
import { ROUTES as AUTO_PROFILE_ROUTES } from "./auto-profile-routes.js";
|
|
28
29
|
import { ROUTES as AVATAR_ROUTES } from "./avatar-routes.js";
|
|
29
30
|
import { ROUTES as BACKGROUND_TOOL_ROUTES } from "./background-tool-routes.js";
|
|
30
31
|
import { ROUTES as BACKGROUND_WAKE_ROUTES } from "./background-wake-routes.js";
|
|
@@ -217,6 +218,7 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
217
218
|
...CONVERSATION_QUERY_ROUTES,
|
|
218
219
|
...CONVERSATION_STARTER_ROUTES,
|
|
219
220
|
...ACTIVATION_ROUTES,
|
|
221
|
+
...AUTO_PROFILE_ROUTES,
|
|
220
222
|
...DEBUG_ROUTES,
|
|
221
223
|
...DEFAULT_PROVIDER_ROUTES,
|
|
222
224
|
...DESKTOP_SETUP_ROUTES,
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
getConfigReadOnly,
|
|
30
30
|
loadRawConfig,
|
|
31
31
|
} from "../../config/loader.js";
|
|
32
|
+
import { orderProfileKeys } from "../../config/profile-order.js";
|
|
32
33
|
import {
|
|
33
34
|
nonTextConversationProfileMessage,
|
|
34
35
|
profileSupportsTextGeneration,
|
|
@@ -527,9 +528,11 @@ async function handleListProfiles() {
|
|
|
527
528
|
config.llm.profiles,
|
|
528
529
|
config.llm.defaultProvider ?? null,
|
|
529
530
|
);
|
|
531
|
+
// Presentation order, the same one the pickers use, rather than the
|
|
532
|
+
// on-disk insertion order of `llm.profiles`.
|
|
530
533
|
const profiles = await Promise.all(
|
|
531
|
-
|
|
532
|
-
const record =
|
|
534
|
+
orderProfileKeys(effective, config.llm.profileOrder).map(async (name) => {
|
|
535
|
+
const record = effective[name] as Record<string, unknown>;
|
|
533
536
|
const configIssue = profileConfigIssue(record);
|
|
534
537
|
return {
|
|
535
538
|
name,
|
|
@@ -24,8 +24,10 @@ import {
|
|
|
24
24
|
CHATGPT_SUBSCRIPTION_CONNECTION_NAME,
|
|
25
25
|
type ConnectionModel,
|
|
26
26
|
ConnectionModelSchema,
|
|
27
|
+
type ConnectionProvider,
|
|
27
28
|
ConnectionProviderSchema,
|
|
28
29
|
deriveAuthForProvider,
|
|
30
|
+
normalizeConnectionProvider,
|
|
29
31
|
ProviderConnectionSchema,
|
|
30
32
|
PROVIDERS_ALLOWING_CUSTOM_BASE_URL,
|
|
31
33
|
VALID_CONNECTION_PROVIDERS,
|
|
@@ -379,8 +381,15 @@ async function handleCreateConnection({ body = {} }: RouteHandlerArgs) {
|
|
|
379
381
|
`Provider "chatgpt" is reserved for the "${CHATGPT_SUBSCRIPTION_CONNECTION_NAME}" connection. Run the ChatGPT sign-in flow to connect a subscription.`,
|
|
380
382
|
);
|
|
381
383
|
}
|
|
384
|
+
// Resolved before auth derivation so an opencode.ai endpoint is held to
|
|
385
|
+
// OpenCode's keyed auth rather than the keyless option the generic
|
|
386
|
+
// provider allows.
|
|
387
|
+
const resolvedProvider = normalizeConnectionProvider(
|
|
388
|
+
providerResult.data,
|
|
389
|
+
body.base_url,
|
|
390
|
+
) as ConnectionProvider;
|
|
382
391
|
const authResult = AuthSchema.safeParse(
|
|
383
|
-
auth ?? deriveConnectionAuth(
|
|
392
|
+
auth ?? deriveConnectionAuth(resolvedProvider, body.credential),
|
|
384
393
|
);
|
|
385
394
|
if (!authResult.success) {
|
|
386
395
|
throw new BadRequestError(`Invalid auth: ${authResult.error.message}`);
|
|
@@ -388,7 +397,7 @@ async function handleCreateConnection({ body = {} }: RouteHandlerArgs) {
|
|
|
388
397
|
// Asserted on derived auth as well: derivation pairs every provider
|
|
389
398
|
// correctly except the chatgpt identity, whose fallthrough would mint
|
|
390
399
|
// api_key auth from a bare credential.
|
|
391
|
-
assertAuthMatchesProvider(
|
|
400
|
+
assertAuthMatchesProvider(resolvedProvider, authResult.data);
|
|
392
401
|
|
|
393
402
|
const labelRaw = body.label;
|
|
394
403
|
if (
|
|
@@ -401,18 +410,15 @@ async function handleCreateConnection({ body = {} }: RouteHandlerArgs) {
|
|
|
401
410
|
);
|
|
402
411
|
}
|
|
403
412
|
|
|
404
|
-
const customFields = await parseCustomProviderFields(
|
|
405
|
-
body,
|
|
406
|
-
providerResult.data,
|
|
407
|
-
);
|
|
413
|
+
const customFields = await parseCustomProviderFields(body, resolvedProvider);
|
|
408
414
|
|
|
409
415
|
// Same event-loop turn as the write: no await separates this check from
|
|
410
416
|
// createConnection, so concurrent requests cannot both pass it.
|
|
411
|
-
assertValidCustomProviderIdentity(
|
|
417
|
+
assertValidCustomProviderIdentity(resolvedProvider, labelRaw, name);
|
|
412
418
|
|
|
413
419
|
const result = createConnection(getDb(), {
|
|
414
420
|
name,
|
|
415
|
-
provider:
|
|
421
|
+
provider: resolvedProvider,
|
|
416
422
|
auth: authResult.data,
|
|
417
423
|
...(labelRaw !== undefined ? { label: labelRaw as string | null } : {}),
|
|
418
424
|
...customFields,
|
|
@@ -525,6 +531,17 @@ async function handleUpdateConnection({
|
|
|
525
531
|
);
|
|
526
532
|
}
|
|
527
533
|
const customFields = await parseCustomProviderFields(body, existing.provider);
|
|
534
|
+
// Provider is immutable on PATCH, and profiles bound to this row under the
|
|
535
|
+
// legacy `{provider, provider_connection}` shape declare its kind, so the
|
|
536
|
+
// row cannot be repointed at an endpoint that needs a different kind.
|
|
537
|
+
if (
|
|
538
|
+
normalizeConnectionProvider(existing.provider, customFields.baseUrl) !==
|
|
539
|
+
existing.provider
|
|
540
|
+
) {
|
|
541
|
+
throw new BadRequestError(
|
|
542
|
+
`base_url points at OpenCode, which needs an "opencode" connection. Create a new connection with provider "opencode" instead of repointing "${name}".`,
|
|
543
|
+
);
|
|
544
|
+
}
|
|
528
545
|
|
|
529
546
|
// Only a CHANGED label is validated: keeping a stored label — whatever it
|
|
530
547
|
// is — must never block unrelated edits (key rotation, models).
|
|
@@ -25,6 +25,7 @@ import { z } from "zod";
|
|
|
25
25
|
|
|
26
26
|
import { invalidateConfigCache } from "../../config/loader.js";
|
|
27
27
|
import { resolvePlatformAssistantId } from "../../config/platform-identity.js";
|
|
28
|
+
import { trackDaemonActivity } from "../../daemon/activity-trail.js";
|
|
28
29
|
import { getAssistantName } from "../../daemon/identity-helpers.js";
|
|
29
30
|
import { ipcCallPersistent } from "../../ipc/gateway-client.js";
|
|
30
31
|
import { runAsyncSqlite } from "../../persistence/db-async-query.js";
|
|
@@ -1950,7 +1951,9 @@ export async function handleMigrationImportFromGcs({ body }: RouteHandlerArgs) {
|
|
|
1950
1951
|
|
|
1951
1952
|
try {
|
|
1952
1953
|
const job = migrationJobs.startJob("import", async (jobRecord) =>
|
|
1953
|
-
|
|
1954
|
+
trackDaemonActivity({ kind: "vbundle_import" }, () =>
|
|
1955
|
+
runGcsImport(bundle_url, jobRecord.id),
|
|
1956
|
+
),
|
|
1954
1957
|
);
|
|
1955
1958
|
return {
|
|
1956
1959
|
job_id: job.id,
|
|
@@ -2444,7 +2447,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
2444
2447
|
manifest: z.object({}).passthrough(),
|
|
2445
2448
|
warnings: z.array(z.unknown()),
|
|
2446
2449
|
}),
|
|
2447
|
-
handler:
|
|
2450
|
+
handler: (args) =>
|
|
2451
|
+
trackDaemonActivity({ kind: "vbundle_import" }, () =>
|
|
2452
|
+
handleMigrationImport(args),
|
|
2453
|
+
),
|
|
2448
2454
|
},
|
|
2449
2455
|
{
|
|
2450
2456
|
operationId: "migrations_exporttogcs_post",
|
|
@@ -44,6 +44,38 @@ describe("route constants", () => {
|
|
|
44
44
|
expect(url.pathname).toBe(`${PROXY_PATH_PREFIX}stripe_link/v1/items`);
|
|
45
45
|
expect(extractProxyRemainder(url)).toBe("v1/items");
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
test("keeps Gmail's /upload/gmail remainder including the query on the raw URL", () => {
|
|
49
|
+
const url = proxyUrl(
|
|
50
|
+
"google/upload/gmail/v1/users/me/drafts?uploadType=media",
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(extractProxyRemainder(url)).toBe(
|
|
54
|
+
"upload/gmail/v1/users/me/drafts",
|
|
55
|
+
);
|
|
56
|
+
expect(url.search).toBe("?uploadType=media");
|
|
57
|
+
expect(normalizeProxyPath("upload/gmail/v1/users/me/drafts")).toBe(
|
|
58
|
+
"/upload/gmail/v1/users/me/drafts",
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("the catch-all route pattern matches a multi-segment Gmail upload path", () => {
|
|
63
|
+
const regexSource = PROXY_ROUTE_ENDPOINT.split("/")
|
|
64
|
+
.map((segment) => {
|
|
65
|
+
if (segment.startsWith(":")) {
|
|
66
|
+
return segment.endsWith("*") ? "(.+)" : "([^/]+)";
|
|
67
|
+
}
|
|
68
|
+
return RegExp.escape(segment);
|
|
69
|
+
})
|
|
70
|
+
.join("\\/");
|
|
71
|
+
const regex = new RegExp(`^${regexSource}$`);
|
|
72
|
+
const match = "oauth/proxy/google/upload/gmail/v1/users/me/drafts".match(
|
|
73
|
+
regex,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
expect(match?.[1]).toBe("google");
|
|
77
|
+
expect(match?.[2]).toBe("upload/gmail/v1/users/me/drafts");
|
|
78
|
+
});
|
|
47
79
|
});
|
|
48
80
|
|
|
49
81
|
describe("provider segment", () => {
|
|
@@ -90,7 +90,12 @@ const PlatformStatusResponseSchema = z.object({
|
|
|
90
90
|
isPlatform: z.boolean(),
|
|
91
91
|
baseUrl: z.string(),
|
|
92
92
|
assistantId: z.string(),
|
|
93
|
-
hasAssistantApiKey: z
|
|
93
|
+
hasAssistantApiKey: z
|
|
94
|
+
.boolean()
|
|
95
|
+
.nullable()
|
|
96
|
+
.describe(
|
|
97
|
+
"Whether a managed assistant API key is stored. Null when the credential store could not be read, which is not evidence that no key is stored.",
|
|
98
|
+
),
|
|
94
99
|
hasWebhookSecret: z.boolean(),
|
|
95
100
|
clientInstallationId: z.string().nullable(),
|
|
96
101
|
available: z.boolean(),
|
|
@@ -334,7 +334,7 @@ export class UserRouteDispatcher {
|
|
|
334
334
|
routePath: string,
|
|
335
335
|
): Promise<Response> {
|
|
336
336
|
try {
|
|
337
|
-
|
|
337
|
+
return await Promise.race([
|
|
338
338
|
Promise.resolve(
|
|
339
339
|
handler(request, buildDeprecatedRouteContext(routePath)),
|
|
340
340
|
),
|
|
@@ -345,7 +345,6 @@ export class UserRouteDispatcher {
|
|
|
345
345
|
),
|
|
346
346
|
),
|
|
347
347
|
]);
|
|
348
|
-
return result;
|
|
349
348
|
} catch (err) {
|
|
350
349
|
if (err instanceof Error && err.message === "Handler timed out") {
|
|
351
350
|
log.error(
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Answers exactly one question for notification producers: is the user
|
|
5
5
|
* demonstrably looking at this specific conversation in a browser tab or a
|
|
6
|
-
* desktop app window right now? Producers use the answer to
|
|
7
|
-
*
|
|
6
|
+
* desktop app window right now? Producers use the answer to suppress a
|
|
7
|
+
* notification for a result the user can already see.
|
|
8
8
|
*
|
|
9
9
|
* Fails open by design, the same posture as desktop presence
|
|
10
10
|
* (`runtime/desktop-presence.ts`): presence is in-memory, best-effort, and
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
* Deliberately separate from desktop presence: a web report is scoped to one
|
|
17
17
|
* conversation (the client's focused thread), not the whole app, and it is
|
|
18
18
|
* consulted for every turn rather than only a desktop-originated one.
|
|
19
|
-
*
|
|
20
|
-
* while the `isDesktopAttended()` read beside it is `clientOs`-gated. The
|
|
19
|
+
* Completion producers scope the read to their intended recipient. The
|
|
21
20
|
* Electron desktop renderer registers as a `web` client and reports here too
|
|
22
21
|
* (`hooks/use-web-presence-report.ts` in the web client), which is what lets
|
|
23
22
|
* a desktop window already showing the conversation suppress a push for a
|
|
@@ -1444,6 +1444,16 @@ export async function createScheduleRun(
|
|
|
1444
1444
|
return id;
|
|
1445
1445
|
}
|
|
1446
1446
|
|
|
1447
|
+
export function getScheduleRunStatus(
|
|
1448
|
+
runId: string,
|
|
1449
|
+
): ScheduleRun["status"] | undefined {
|
|
1450
|
+
return getDb()
|
|
1451
|
+
.select({ status: scheduleRuns.status })
|
|
1452
|
+
.from(scheduleRuns)
|
|
1453
|
+
.where(eq(scheduleRuns.id, runId))
|
|
1454
|
+
.get()?.status;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1447
1457
|
/** Currently-running schedule runs with their job names, oldest first. */
|
|
1448
1458
|
export function listRunningScheduleRuns(): Array<{
|
|
1449
1459
|
runId: string;
|