@opengeni/api-router 0.4.0 → 0.5.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/LICENSE +190 -0
- package/dist/app.js +1 -1
- package/dist/{chunk-I2EDWHVF.js → chunk-DQ5TIRDZ.js} +2229 -616
- package/dist/chunk-DQ5TIRDZ.js.map +1 -0
- package/dist/index.js +53 -8
- package/dist/index.js.map +1 -1
- package/package.json +12 -18
- package/src/app.ts +106 -7
- package/src/http/auth.ts +7 -1
- package/src/index.ts +9 -4
- package/src/integrations/oauth-client.ts +899 -0
- package/src/mcp/documents.ts +124 -20
- package/src/mcp/server.ts +37 -2
- package/src/mcp/toolspace.ts +627 -0
- package/src/observability.ts +31 -0
- package/src/routes/billing.ts +19 -1
- package/src/routes/connections.ts +179 -0
- package/src/routes/documents.ts +87 -3
- package/src/routes/enrollments.ts +1 -0
- package/src/sandbox/auth-callout.ts +5 -1
- package/src/sandbox/channel-a.ts +1 -1
- package/src/sandbox/machines.ts +2 -0
- package/src/sandbox/metrics-ingestion.ts +41 -10
- package/src/sandbox/viewer.ts +1 -1
- package/dist/chunk-I2EDWHVF.js.map +0 -1
package/src/http/auth.ts
CHANGED
|
@@ -46,6 +46,12 @@ function isAuthExempt(c: Context, settings: Settings): boolean {
|
|
|
46
46
|
) {
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
|
+
if (
|
|
50
|
+
path === "/v1/integrations/oauth/callback" ||
|
|
51
|
+
path === "/v1/integrations/oauth/client-metadata.json"
|
|
52
|
+
) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
49
55
|
// Browser entry for MCP-issued GitHub install links: opened in a browser
|
|
50
56
|
// that holds no API credentials, like the callbacks above. The route itself
|
|
51
57
|
// verifies the signed workspace-bound state before doing anything.
|
|
@@ -58,7 +64,7 @@ function isAuthExempt(c: Context, settings: Settings): boolean {
|
|
|
58
64
|
if (installExactPaths.has(path) || isInstallRedirectPath(path)) {
|
|
59
65
|
return true;
|
|
60
66
|
}
|
|
61
|
-
if (settings.authAllowHealth && path === "/healthz") {
|
|
67
|
+
if (settings.authAllowHealth && (path === "/healthz" || path === "/readyz")) {
|
|
62
68
|
return true;
|
|
63
69
|
}
|
|
64
70
|
if (settings.authAllowMetrics && path === "/metrics") {
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { createObservability, logStartupDependencyRetry } from "@opengeni/observ
|
|
|
6
6
|
import { Connection, Client as TemporalClient, ScheduleNotFoundError, ScheduleOverlapPolicy, WorkflowExecutionAlreadyStartedError } from "@temporalio/client";
|
|
7
7
|
import type { ScheduleOptions, ScheduleSpec, ScheduleUpdateOptions } from "@temporalio/client";
|
|
8
8
|
import { createApp, type DocumentIndexClient, type SessionWorkflowClient } from "./app";
|
|
9
|
+
import { observabilityEventLogger } from "./observability";
|
|
9
10
|
import { startAuthCalloutResponder } from "./sandbox/auth-callout";
|
|
10
11
|
import { startHelloIngestion, startMetricsIngestion } from "./sandbox/metrics-ingestion";
|
|
11
12
|
|
|
@@ -92,7 +93,7 @@ export async function createTemporalWorkflowClient(settings: ReturnType<typeof g
|
|
|
92
93
|
deleteScheduledTaskSchedule: async ({ temporalScheduleId }) => {
|
|
93
94
|
await temporal.schedule.getHandle(temporalScheduleId).delete().catch(() => undefined);
|
|
94
95
|
},
|
|
95
|
-
|
|
96
|
+
triggerScheduledTask: async ({ task, agentRunUsageIdempotencyKey, triggerWorkflowId }) => {
|
|
96
97
|
// Deterministic workflowId (derived from the trigger token by the
|
|
97
98
|
// caller) + REJECT_DUPLICATE makes a retried manual trigger idempotent:
|
|
98
99
|
// the second start collides on the id and is rejected instead of
|
|
@@ -117,9 +118,12 @@ export async function createTemporalWorkflowClient(settings: ReturnType<typeof g
|
|
|
117
118
|
if (isWorkflowAlreadyStarted(error)) {
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
check: async () => {
|
|
125
|
+
await connection.workflowService.getSystemInfo({});
|
|
126
|
+
},
|
|
123
127
|
};
|
|
124
128
|
const documentIndexer: DocumentIndexClient = {
|
|
125
129
|
indexDocument: async ({ accountId, workspaceId, documentId }) => {
|
|
@@ -166,6 +170,7 @@ export async function startApi() {
|
|
|
166
170
|
createNatsEventBus(
|
|
167
171
|
settings.natsUrl,
|
|
168
172
|
controlPlaneAuth ? { user: controlPlaneAuth.user, pass: controlPlaneAuth.password } : undefined,
|
|
173
|
+
{ logger: observabilityEventLogger(observability) },
|
|
169
174
|
),
|
|
170
175
|
{
|
|
171
176
|
...retryOptions,
|