@inkeep/agents-api 0.46.0 → 0.47.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/.well-known/workflow/v1/manifest.debug.json +5 -5
- package/dist/.well-known/workflow/v1/step.cjs +41 -43
- package/dist/createApp.d.ts +2 -2
- package/dist/createApp.js +1 -3
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/services/EvaluationService.js +1 -2
- package/dist/domains/evals/workflow/routes.d.ts +2 -2
- package/dist/domains/manage/index.js +4 -2
- package/dist/domains/manage/routes/availableAgents.d.ts +2 -2
- package/dist/domains/manage/routes/availableAgents.js +2 -2
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/invitations.d.ts +2 -2
- package/dist/domains/manage/routes/invitations.js +59 -0
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/{userOrganizations.d.ts → passwordResetLinks.d.ts} +3 -3
- package/dist/domains/manage/routes/passwordResetLinks.js +61 -0
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/users.d.ts +10 -0
- package/dist/domains/manage/routes/users.js +78 -0
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/run/a2a/client.d.ts +0 -2
- package/dist/domains/run/a2a/client.js +5 -7
- package/dist/domains/run/agents/Agent.d.ts +41 -15
- package/dist/domains/run/agents/Agent.js +127 -281
- package/dist/domains/run/agents/generateTaskHandler.js +10 -5
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/agents/relationTools.js +1 -3
- package/dist/domains/run/agents/types.d.ts +2 -1
- package/dist/domains/run/agents/versions/v1/{Phase1Config.d.ts → PromptConfig.d.ts} +5 -4
- package/dist/domains/run/agents/versions/v1/{Phase1Config.js → PromptConfig.js} +36 -19
- package/dist/domains/run/handlers/executionHandler.js +8 -12
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/factory.d.ts +59 -25
- package/dist/index.d.ts +128 -94
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +2 -2
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/templates/v1/prompt/system-prompt.js +5 -0
- package/dist/templates/v1/{phase1 → prompt}/tool.js +1 -1
- package/dist/templates/v1/shared/artifact-retrieval-guidance.js +1 -1
- package/dist/templates/v1/{phase2 → shared}/data-component.js +1 -1
- package/dist/templates/v1/{phase2 → shared}/data-components.js +1 -1
- package/package.json +6 -6
- package/dist/domains/manage/routes/userOrganizations.js +0 -29
- package/dist/domains/run/agents/versions/v1/Phase2Config.d.ts +0 -33
- package/dist/domains/run/agents/versions/v1/Phase2Config.js +0 -341
- package/dist/templates/v1/phase1/system-prompt.js +0 -5
- package/dist/templates/v1/phase1/thinking-preparation.js +0 -5
- package/dist/templates/v1/phase2/system-prompt.js +0 -5
- package/dist/utils/in-process-fetch.d.ts +0 -22
- package/dist/utils/in-process-fetch.js +0 -32
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"workflows": {
|
|
44
|
-
"src/domains/evals/workflow/functions/evaluateConversation.ts": {
|
|
45
|
-
"_evaluateConversationWorkflow": {
|
|
46
|
-
"workflowId": "workflow//src/domains/evals/workflow/functions/evaluateConversation.ts//_evaluateConversationWorkflow"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
44
|
"src/domains/evals/workflow/functions/runDatasetItem.ts": {
|
|
50
45
|
"_runDatasetItemWorkflow": {
|
|
51
46
|
"workflowId": "workflow//src/domains/evals/workflow/functions/runDatasetItem.ts//_runDatasetItemWorkflow"
|
|
52
47
|
}
|
|
48
|
+
},
|
|
49
|
+
"src/domains/evals/workflow/functions/evaluateConversation.ts": {
|
|
50
|
+
"_evaluateConversationWorkflow": {
|
|
51
|
+
"workflowId": "workflow//src/domains/evals/workflow/functions/evaluateConversation.ts//_evaluateConversationWorkflow"
|
|
52
|
+
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -117228,32 +117228,6 @@ var schemaValidationDefaults = {
|
|
|
117228
117228
|
CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 1e4
|
|
117229
117229
|
};
|
|
117230
117230
|
|
|
117231
|
-
// ../packages/agents-core/dist/types/utility.js
|
|
117232
|
-
var TOOL_STATUS_VALUES = [
|
|
117233
|
-
"healthy",
|
|
117234
|
-
"unhealthy",
|
|
117235
|
-
"unknown",
|
|
117236
|
-
"needs_auth",
|
|
117237
|
-
"unavailable"
|
|
117238
|
-
];
|
|
117239
|
-
var VALID_RELATION_TYPES = [
|
|
117240
|
-
"transfer",
|
|
117241
|
-
"delegate"
|
|
117242
|
-
];
|
|
117243
|
-
var MCPTransportType = {
|
|
117244
|
-
streamableHttp: "streamable_http",
|
|
117245
|
-
sse: "sse"
|
|
117246
|
-
};
|
|
117247
|
-
var MCPServerType = {
|
|
117248
|
-
nango: "nango",
|
|
117249
|
-
generic: "generic"
|
|
117250
|
-
};
|
|
117251
|
-
var CredentialStoreType = {
|
|
117252
|
-
memory: "memory",
|
|
117253
|
-
keychain: "keychain",
|
|
117254
|
-
nango: "nango"
|
|
117255
|
-
};
|
|
117256
|
-
|
|
117257
117231
|
// ../packages/agents-core/dist/_virtual/rolldown_runtime.js
|
|
117258
117232
|
var __defProp2 = Object.defineProperty;
|
|
117259
117233
|
var __exportAll = /* @__PURE__ */ __name((all3, symbols) => {
|
|
@@ -121233,6 +121207,10 @@ function index(name18) {
|
|
|
121233
121207
|
return new IndexBuilderOn(false, name18);
|
|
121234
121208
|
}
|
|
121235
121209
|
__name(index, "index");
|
|
121210
|
+
function uniqueIndex(name18) {
|
|
121211
|
+
return new IndexBuilderOn(true, name18);
|
|
121212
|
+
}
|
|
121213
|
+
__name(uniqueIndex, "uniqueIndex");
|
|
121236
121214
|
|
|
121237
121215
|
// ../node_modules/.pnpm/drizzle-orm@0.44.7_@electric-sql+pglite@0.3.14_@opentelemetry+api@1.9.0_@types+pg@8.16._05619ac069f36c30135eeb6e4342bbf4/node_modules/drizzle-orm/casing.js
|
|
121238
121216
|
function toSnakeCase(input) {
|
|
@@ -126222,7 +126200,9 @@ var organization = pgTable("organization", {
|
|
|
126222
126200
|
logo: text("logo"),
|
|
126223
126201
|
createdAt: timestamp("created_at").notNull(),
|
|
126224
126202
|
metadata: text("metadata")
|
|
126225
|
-
})
|
|
126203
|
+
}, (table) => [
|
|
126204
|
+
uniqueIndex("organization_slug_uidx").on(table.slug)
|
|
126205
|
+
]);
|
|
126226
126206
|
var member = pgTable("member", {
|
|
126227
126207
|
id: text("id").primaryKey(),
|
|
126228
126208
|
organizationId: text("organization_id").notNull().references(() => organization.id, {
|
|
@@ -126249,7 +126229,8 @@ var invitation = pgTable("invitation", {
|
|
|
126249
126229
|
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
126250
126230
|
inviterId: text("inviter_id").notNull().references(() => user.id, {
|
|
126251
126231
|
onDelete: "cascade"
|
|
126252
|
-
})
|
|
126232
|
+
}),
|
|
126233
|
+
authMethod: text("auth_method")
|
|
126253
126234
|
}, (table) => [
|
|
126254
126235
|
index("invitation_organizationId_idx").on(table.organizationId),
|
|
126255
126236
|
index("invitation_email_idx").on(table.email)
|
|
@@ -127187,6 +127168,32 @@ var workAppGitHubMcpToolRepositoryAccessRelations = relations(workAppGitHubMcpTo
|
|
|
127187
127168
|
})
|
|
127188
127169
|
}));
|
|
127189
127170
|
|
|
127171
|
+
// ../packages/agents-core/dist/types/utility.js
|
|
127172
|
+
var TOOL_STATUS_VALUES = [
|
|
127173
|
+
"healthy",
|
|
127174
|
+
"unhealthy",
|
|
127175
|
+
"unknown",
|
|
127176
|
+
"needs_auth",
|
|
127177
|
+
"unavailable"
|
|
127178
|
+
];
|
|
127179
|
+
var VALID_RELATION_TYPES = [
|
|
127180
|
+
"transfer",
|
|
127181
|
+
"delegate"
|
|
127182
|
+
];
|
|
127183
|
+
var MCPTransportType = {
|
|
127184
|
+
streamableHttp: "streamable_http",
|
|
127185
|
+
sse: "sse"
|
|
127186
|
+
};
|
|
127187
|
+
var MCPServerType = {
|
|
127188
|
+
nango: "nango",
|
|
127189
|
+
generic: "generic"
|
|
127190
|
+
};
|
|
127191
|
+
var CredentialStoreType = {
|
|
127192
|
+
memory: "memory",
|
|
127193
|
+
keychain: "keychain",
|
|
127194
|
+
nango: "nango"
|
|
127195
|
+
};
|
|
127196
|
+
|
|
127190
127197
|
// ../node_modules/.pnpm/@hono+zod-openapi@1.2.0_hono@4.11.7_zod@4.3.6/node_modules/@hono/zod-openapi/dist/index.js
|
|
127191
127198
|
var import_zod_to_openapi = __toESM(require_dist(), 1);
|
|
127192
127199
|
|
|
@@ -144316,6 +144323,7 @@ var FetchDefinitionSchema = external_exports.object({
|
|
|
144316
144323
|
}),
|
|
144317
144324
|
credential: CredentialReferenceApiInsertSchema.optional()
|
|
144318
144325
|
}).openapi("FetchDefinition");
|
|
144326
|
+
var HeadersSchema = external_exports.record(external_exports.string(), external_exports.string("All header values must be strings"), "Must be valid JSON object");
|
|
144319
144327
|
var ContextConfigSelectSchema = createSelectSchema2(contextConfigs).extend({
|
|
144320
144328
|
headersSchema: external_exports.any().optional().openapi({
|
|
144321
144329
|
type: "object",
|
|
@@ -147102,7 +147110,10 @@ var envSchema = external_exports.object({
|
|
|
147102
147110
|
INKEEP_AGENTS_MANAGE_UI_URL: external_exports.string().optional().describe("URL where the management UI is hosted"),
|
|
147103
147111
|
INKEEP_AGENTS_API_URL: external_exports.string().optional().describe("URL where the agents management API is running"),
|
|
147104
147112
|
AUTH_COOKIE_DOMAIN: external_exports.string().optional().describe("Explicit cookie domain for cross-subdomain auth (e.g., .inkeep.com). Required when the API and UI do not share a common 3-part parent domain."),
|
|
147105
|
-
GITHUB_MCP_API_KEY: external_exports.string().optional().describe("API key for the GitHub MCP")
|
|
147113
|
+
GITHUB_MCP_API_KEY: external_exports.string().optional().describe("API key for the GitHub MCP"),
|
|
147114
|
+
SPICEDB_ENDPOINT: external_exports.string().optional().describe("SpiceDB endpoint"),
|
|
147115
|
+
SPICEDB_PRESHARED_KEY: external_exports.string().optional().describe("SpiceDB pre-shared key"),
|
|
147116
|
+
SPICEDB_TLS_ENABLED: external_exports.coerce.boolean().optional().describe("SpiceDB TLS enabled")
|
|
147106
147117
|
});
|
|
147107
147118
|
var parseEnv = /* @__PURE__ */ __name(() => {
|
|
147108
147119
|
try {
|
|
@@ -228857,19 +228868,6 @@ var runDbClient = createAgentsRunDatabaseClient({
|
|
|
228857
228868
|
});
|
|
228858
228869
|
var runDbClient_default = runDbClient;
|
|
228859
228870
|
|
|
228860
|
-
// src/utils/in-process-fetch.ts
|
|
228861
|
-
var _appFetch;
|
|
228862
|
-
function getInProcessFetch() {
|
|
228863
|
-
if (!_appFetch) {
|
|
228864
|
-
if (process.env.ENVIRONMENT === "test") {
|
|
228865
|
-
return fetch;
|
|
228866
|
-
}
|
|
228867
|
-
throw new Error("[in-process-fetch] App fetch not registered. Call registerAppFetch() during app initialization before handling requests.");
|
|
228868
|
-
}
|
|
228869
|
-
return _appFetch;
|
|
228870
|
-
}
|
|
228871
|
-
__name(getInProcessFetch, "getInProcessFetch");
|
|
228872
|
-
|
|
228873
228871
|
// src/domains/evals/services/EvaluationService.ts
|
|
228874
228872
|
var logger21 = getLogger("EvaluationService");
|
|
228875
228873
|
var EvaluationService = class {
|
|
@@ -228964,7 +228962,7 @@ var EvaluationService = class {
|
|
|
228964
228962
|
datasetRunId,
|
|
228965
228963
|
conversationId
|
|
228966
228964
|
}, "Running dataset item through chat API");
|
|
228967
|
-
const response = await
|
|
228965
|
+
const response = await fetch(chatUrl, {
|
|
228968
228966
|
method: "POST",
|
|
228969
228967
|
headers: headers2,
|
|
228970
228968
|
body: JSON.stringify(chatPayload)
|
package/dist/createApp.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AppConfig } from "./types/app.js";
|
|
2
2
|
import "./types/index.js";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
|
-
import * as
|
|
4
|
+
import * as hono_types0 from "hono/types";
|
|
5
5
|
|
|
6
6
|
//#region src/createApp.d.ts
|
|
7
7
|
declare const isWebhookRoute: (path: string) => boolean;
|
|
8
|
-
declare function createAgentsHono(config: AppConfig): Hono<
|
|
8
|
+
declare function createAgentsHono(config: AppConfig): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { createAgentsHono, isWebhookRoute };
|
package/dist/createApp.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "./logger.js";
|
|
2
2
|
import { env } from "./env.js";
|
|
3
|
-
import { getInProcessFetch, registerAppFetch } from "./utils/in-process-fetch.js";
|
|
4
3
|
import { evalRoutes } from "./domains/evals/index.js";
|
|
5
4
|
import { workflowRoutes } from "./domains/evals/workflow/routes.js";
|
|
6
5
|
import { sessionAuth, sessionContext } from "./middleware/sessionAuth.js";
|
|
@@ -182,7 +181,7 @@ function createAgentsHono(config) {
|
|
|
182
181
|
headers: new Headers(c.req.raw.headers),
|
|
183
182
|
body: bodyBuffer
|
|
184
183
|
});
|
|
185
|
-
return
|
|
184
|
+
return fetch(forwardedRequest);
|
|
186
185
|
});
|
|
187
186
|
app.route("/evals", evalRoutes);
|
|
188
187
|
app.route("/work-apps/github", githubRoutes);
|
|
@@ -194,7 +193,6 @@ function createAgentsHono(config) {
|
|
|
194
193
|
});
|
|
195
194
|
const base = new Hono();
|
|
196
195
|
base.route("/", app);
|
|
197
|
-
registerAppFetch(base.request.bind(base));
|
|
198
196
|
return base;
|
|
199
197
|
}
|
|
200
198
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono14 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono14.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono15 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono15.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -3,7 +3,6 @@ import { env } from "../../../env.js";
|
|
|
3
3
|
import manageDbClient_default from "../../../data/db/manageDbClient.js";
|
|
4
4
|
import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
5
5
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
6
|
-
import { getInProcessFetch } from "../../../utils/in-process-fetch.js";
|
|
7
6
|
import { ModelFactory, createEvaluationResult, createEvaluationRun, filterConversationsForJob, generateId, getConversationHistory, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluatorById, getFullAgent, getProjectScopedRef, resolveRef, updateEvaluationResult, withRef } from "@inkeep/agents-core";
|
|
8
7
|
import { generateObject, generateText } from "ai";
|
|
9
8
|
import { z } from "zod";
|
|
@@ -87,7 +86,7 @@ var EvaluationService = class {
|
|
|
87
86
|
datasetRunId,
|
|
88
87
|
conversationId
|
|
89
88
|
}, "Running dataset item through chat API");
|
|
90
|
-
const response = await
|
|
89
|
+
const response = await fetch(chatUrl, {
|
|
91
90
|
method: "POST",
|
|
92
91
|
headers: headers$1,
|
|
93
92
|
body: JSON.stringify(chatPayload)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types5 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/workflow/routes.d.ts
|
|
5
|
-
declare const workflowRoutes: Hono<
|
|
5
|
+
declare const workflowRoutes: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { workflowRoutes };
|
|
@@ -6,20 +6,22 @@ import invitations_default from "./routes/invitations.js";
|
|
|
6
6
|
import mcp_default from "./routes/mcp.js";
|
|
7
7
|
import mcpToolGithubAccess_default from "./routes/mcpToolGithubAccess.js";
|
|
8
8
|
import oauth_default from "./routes/oauth.js";
|
|
9
|
+
import passwordResetLinks_default from "./routes/passwordResetLinks.js";
|
|
9
10
|
import playgroundToken_default from "./routes/playgroundToken.js";
|
|
10
11
|
import projectFull_default from "./routes/projectFull.js";
|
|
11
12
|
import projectGithubAccess_default from "./routes/projectGithubAccess.js";
|
|
12
13
|
import signoz_default from "./routes/signoz.js";
|
|
13
|
-
import
|
|
14
|
+
import users_default from "./routes/users.js";
|
|
14
15
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
15
16
|
|
|
16
17
|
//#region src/domains/manage/index.ts
|
|
17
18
|
function createManageRoutes() {
|
|
18
19
|
const app = new OpenAPIHono();
|
|
19
|
-
app.route("/api/users
|
|
20
|
+
app.route("/api/users", users_default);
|
|
20
21
|
app.route("/api/cli", cliAuth_default);
|
|
21
22
|
app.route("/api/invitations", invitations_default);
|
|
22
23
|
app.route("/tenants/:tenantId", routes_default);
|
|
24
|
+
app.route("/tenants/:tenantId/password-reset-links", passwordResetLinks_default);
|
|
23
25
|
app.route("/tenants/:tenantId/playground/token", playgroundToken_default);
|
|
24
26
|
app.route("/tenants/:tenantId/signoz", signoz_default);
|
|
25
27
|
app.route("/tenants/:tenantId/github", github_default);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono17 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/availableAgents.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono17.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -2,7 +2,7 @@ import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
|
2
2
|
import { env } from "../../../env.js";
|
|
3
3
|
import manageDbClient_default from "../../../data/db/manageDbClient.js";
|
|
4
4
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
5
|
-
import { createApiError,
|
|
5
|
+
import { createApiError, listAgentsAcrossProjectMainBranches, listUsableProjectIds, verifyTempToken } from "@inkeep/agents-core";
|
|
6
6
|
|
|
7
7
|
//#region src/domains/manage/routes/availableAgents.ts
|
|
8
8
|
const logger = getLogger$1("availableAgents");
|
|
@@ -77,7 +77,7 @@ app.openapi(createRoute({
|
|
|
77
77
|
const { userId, tenantId } = user;
|
|
78
78
|
const projectIds = await listUsableProjectIds({ userId });
|
|
79
79
|
if (projectIds.length === 0) return c.json({ data: [] });
|
|
80
|
-
const agents = await
|
|
80
|
+
const agents = await listAgentsAcrossProjectMainBranches(manageDbClient_default, {
|
|
81
81
|
tenantId,
|
|
82
82
|
projectIds
|
|
83
83
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono18 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono18.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono16 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono16.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types8 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/invitations.d.ts
|
|
6
6
|
declare const invitationsRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types8.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { invitationsRoutes as default };
|
|
@@ -2,9 +2,68 @@ import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
|
2
2
|
import { sessionAuth } from "../../../middleware/sessionAuth.js";
|
|
3
3
|
import { createApiError, getPendingInvitationsByEmail } from "@inkeep/agents-core";
|
|
4
4
|
import { Hono } from "hono";
|
|
5
|
+
import { HTTPException } from "hono/http-exception";
|
|
5
6
|
|
|
6
7
|
//#region src/domains/manage/routes/invitations.ts
|
|
7
8
|
const invitationsRoutes = new Hono();
|
|
9
|
+
/**
|
|
10
|
+
* GET /api/invitations/verify?email=user@example.com&id=xxx
|
|
11
|
+
*
|
|
12
|
+
* Unauthenticated endpoint to validate an invitation exists and get preview info.
|
|
13
|
+
* Used by the accept-invitation page to pre-populate signup forms.
|
|
14
|
+
*
|
|
15
|
+
* Returns limited info: email, organizationName, organizationId, role, expiresAt
|
|
16
|
+
*/
|
|
17
|
+
invitationsRoutes.get("/verify", async (c) => {
|
|
18
|
+
const email = c.req.query("email");
|
|
19
|
+
const invitationId = c.req.query("id");
|
|
20
|
+
if (!email) throw createApiError({
|
|
21
|
+
code: "bad_request",
|
|
22
|
+
message: "Email parameter is required"
|
|
23
|
+
});
|
|
24
|
+
if (!invitationId) throw createApiError({
|
|
25
|
+
code: "bad_request",
|
|
26
|
+
message: "Invitation ID parameter is required"
|
|
27
|
+
});
|
|
28
|
+
const auth = c.get("auth");
|
|
29
|
+
if (!auth) throw createApiError({
|
|
30
|
+
code: "internal_server_error",
|
|
31
|
+
message: "Auth not configured"
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
const invitations = await auth.api.listUserInvitations({ query: { email } });
|
|
35
|
+
const invitation = Array.isArray(invitations) ? invitations.find((inv) => inv.id === invitationId) : null;
|
|
36
|
+
if (!invitation) throw createApiError({
|
|
37
|
+
code: "not_found",
|
|
38
|
+
message: "Invitation not found"
|
|
39
|
+
});
|
|
40
|
+
const expiresAt = invitation.expiresAt ? new Date(invitation.expiresAt) : null;
|
|
41
|
+
const isExpired = expiresAt && expiresAt < /* @__PURE__ */ new Date();
|
|
42
|
+
if (!(invitation.status === "pending")) throw createApiError({
|
|
43
|
+
code: "not_found",
|
|
44
|
+
message: "Invitation is no longer valid"
|
|
45
|
+
});
|
|
46
|
+
if (isExpired) throw createApiError({
|
|
47
|
+
code: "not_found",
|
|
48
|
+
message: "Invitation has expired"
|
|
49
|
+
});
|
|
50
|
+
return c.json({
|
|
51
|
+
valid: true,
|
|
52
|
+
email: invitation.email,
|
|
53
|
+
organizationName: invitation.organizationName || null,
|
|
54
|
+
organizationId: invitation.organizationId,
|
|
55
|
+
role: invitation.role,
|
|
56
|
+
expiresAt: invitation.expiresAt
|
|
57
|
+
});
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (error instanceof HTTPException) throw error;
|
|
60
|
+
console.error("[invitations/verify] Error fetching invitation:", error);
|
|
61
|
+
throw createApiError({
|
|
62
|
+
code: "internal_server_error",
|
|
63
|
+
message: "Failed to validate invitation"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
8
67
|
invitationsRoutes.use("*", sessionAuth());
|
|
9
68
|
invitationsRoutes.get("/pending", async (c) => {
|
|
10
69
|
const email = c.req.query("email");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types9 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types9.BlankEnv, hono_types9.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -2,9 +2,9 @@ import { ManageAppVariables } from "../../../types/app.js";
|
|
|
2
2
|
import { Hono } from "hono";
|
|
3
3
|
import * as hono_types11 from "hono/types";
|
|
4
4
|
|
|
5
|
-
//#region src/domains/manage/routes/
|
|
6
|
-
declare const
|
|
5
|
+
//#region src/domains/manage/routes/passwordResetLinks.d.ts
|
|
6
|
+
declare const passwordResetLinksRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
8
|
}, hono_types11.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
|
-
export {
|
|
10
|
+
export { passwordResetLinksRoutes as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { env } from "../../../env.js";
|
|
2
|
+
import { sessionAuth } from "../../../middleware/sessionAuth.js";
|
|
3
|
+
import { OrgRoles, createApiError, waitForPasswordResetLink } from "@inkeep/agents-core";
|
|
4
|
+
import { Hono } from "hono";
|
|
5
|
+
|
|
6
|
+
//#region src/domains/manage/routes/passwordResetLinks.ts
|
|
7
|
+
const passwordResetLinksRoutes = new Hono();
|
|
8
|
+
passwordResetLinksRoutes.use("*", sessionAuth());
|
|
9
|
+
passwordResetLinksRoutes.post("/", async (c) => {
|
|
10
|
+
const tenantId = c.req.param("tenantId");
|
|
11
|
+
const { email } = await c.req.json().catch(() => ({}));
|
|
12
|
+
const userId = c.get("userId");
|
|
13
|
+
if (!tenantId) throw createApiError({
|
|
14
|
+
code: "bad_request",
|
|
15
|
+
message: "Tenant ID is required"
|
|
16
|
+
});
|
|
17
|
+
if (!userId) throw createApiError({
|
|
18
|
+
code: "unauthorized",
|
|
19
|
+
message: "Authentication required"
|
|
20
|
+
});
|
|
21
|
+
if (!email) throw createApiError({
|
|
22
|
+
code: "bad_request",
|
|
23
|
+
message: "Email is required"
|
|
24
|
+
});
|
|
25
|
+
const tenantRole = c.get("tenantRole");
|
|
26
|
+
if (!tenantRole || tenantRole !== OrgRoles.ADMIN && tenantRole !== OrgRoles.OWNER) throw createApiError({
|
|
27
|
+
code: "forbidden",
|
|
28
|
+
message: "Admin access required"
|
|
29
|
+
});
|
|
30
|
+
const auth = c.get("auth");
|
|
31
|
+
if (!auth) throw createApiError({
|
|
32
|
+
code: "internal_server_error",
|
|
33
|
+
message: "Auth not configured"
|
|
34
|
+
});
|
|
35
|
+
if (!(await auth.api.listMembers({
|
|
36
|
+
query: { organizationId: tenantId },
|
|
37
|
+
headers: c.req.raw.headers
|
|
38
|
+
})).members.some((m) => m.user.email === email)) throw createApiError({
|
|
39
|
+
code: "forbidden",
|
|
40
|
+
message: "User is not a member of this organization"
|
|
41
|
+
});
|
|
42
|
+
const redirectTo = `${env.INKEEP_AGENTS_MANAGE_UI_URL || "http://localhost:3000"}/reset-password`;
|
|
43
|
+
const linkPromise = waitForPasswordResetLink(email);
|
|
44
|
+
await auth.api.requestPasswordReset({ body: {
|
|
45
|
+
email,
|
|
46
|
+
redirectTo
|
|
47
|
+
} });
|
|
48
|
+
try {
|
|
49
|
+
const link = await linkPromise;
|
|
50
|
+
return c.json({ url: link.url });
|
|
51
|
+
} catch {
|
|
52
|
+
throw createApiError({
|
|
53
|
+
code: "internal_server_error",
|
|
54
|
+
message: "Reset link not available"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
var passwordResetLinks_default = passwordResetLinksRoutes;
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { passwordResetLinks_default as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types7 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/signoz.d.ts
|
|
6
6
|
declare const app: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types7.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { app as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import * as hono_types12 from "hono/types";
|
|
4
|
+
|
|
5
|
+
//#region src/domains/manage/routes/users.d.ts
|
|
6
|
+
declare const usersRoutes: Hono<{
|
|
7
|
+
Variables: ManageAppVariables;
|
|
8
|
+
}, hono_types12.BlankSchema, "/">;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { usersRoutes as default };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
|
+
import { sessionAuth } from "../../../middleware/sessionAuth.js";
|
|
3
|
+
import { OrgRoles, createApiError, getUserOrganizationsFromDb, getUserProvidersFromDb } from "@inkeep/agents-core";
|
|
4
|
+
import { Hono } from "hono";
|
|
5
|
+
|
|
6
|
+
//#region src/domains/manage/routes/users.ts
|
|
7
|
+
const usersRoutes = new Hono();
|
|
8
|
+
usersRoutes.use("*", sessionAuth());
|
|
9
|
+
/**
|
|
10
|
+
* GET /api/users/:userId/organizations
|
|
11
|
+
*
|
|
12
|
+
* List all organizations for a user.
|
|
13
|
+
* Only allows querying own organizations.
|
|
14
|
+
*/
|
|
15
|
+
usersRoutes.get("/:userId/organizations", async (c) => {
|
|
16
|
+
const userId = c.req.param("userId");
|
|
17
|
+
const authenticatedUserId = c.get("userId");
|
|
18
|
+
if (!userId) throw createApiError({
|
|
19
|
+
code: "bad_request",
|
|
20
|
+
message: "User ID is required"
|
|
21
|
+
});
|
|
22
|
+
if (userId !== authenticatedUserId) throw createApiError({
|
|
23
|
+
code: "forbidden",
|
|
24
|
+
message: "Cannot access another user's organizations"
|
|
25
|
+
});
|
|
26
|
+
const userOrganizations = (await getUserOrganizationsFromDb(runDbClient_default)(userId)).map((org) => ({
|
|
27
|
+
...org,
|
|
28
|
+
createdAt: org.createdAt.toISOString()
|
|
29
|
+
}));
|
|
30
|
+
return c.json(userOrganizations);
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* POST /api/users/providers
|
|
34
|
+
*
|
|
35
|
+
* Get authentication providers for a list of users.
|
|
36
|
+
* Returns which providers each user has (e.g., 'credential', 'google', 'auth0').
|
|
37
|
+
* Restricted to org admins/owners querying members of their organization.
|
|
38
|
+
*
|
|
39
|
+
* Body: { userIds: string[], organizationId: string }
|
|
40
|
+
* Response: UserProviderInfo[]
|
|
41
|
+
*/
|
|
42
|
+
usersRoutes.post("/providers", async (c) => {
|
|
43
|
+
const { userIds, organizationId } = await c.req.json();
|
|
44
|
+
const authenticatedUserId = c.get("userId");
|
|
45
|
+
if (!organizationId) throw createApiError({
|
|
46
|
+
code: "bad_request",
|
|
47
|
+
message: "organizationId is required"
|
|
48
|
+
});
|
|
49
|
+
if (!userIds || !Array.isArray(userIds)) throw createApiError({
|
|
50
|
+
code: "bad_request",
|
|
51
|
+
message: "userIds array is required"
|
|
52
|
+
});
|
|
53
|
+
if (userIds.length === 0) return c.json([]);
|
|
54
|
+
const orgAccess = (await getUserOrganizationsFromDb(runDbClient_default)(authenticatedUserId)).find((org) => org.organizationId === organizationId);
|
|
55
|
+
if (!orgAccess) throw createApiError({
|
|
56
|
+
code: "forbidden",
|
|
57
|
+
message: "Access denied to this organization"
|
|
58
|
+
});
|
|
59
|
+
const role = orgAccess.role;
|
|
60
|
+
if (role !== OrgRoles.ADMIN && role !== OrgRoles.OWNER) throw createApiError({
|
|
61
|
+
code: "forbidden",
|
|
62
|
+
message: "Admin access required"
|
|
63
|
+
});
|
|
64
|
+
try {
|
|
65
|
+
const providers = await getUserProvidersFromDb(runDbClient_default)(userIds);
|
|
66
|
+
return c.json(providers);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("[users/providers] Error fetching providers:", error);
|
|
69
|
+
throw createApiError({
|
|
70
|
+
code: "internal_server_error",
|
|
71
|
+
message: "Failed to fetch user providers"
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
var users_default = usersRoutes;
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { users_default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types13 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/mcp/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types13.BlankEnv, hono_types13.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -20,7 +20,6 @@ interface A2AClientOptions {
|
|
|
20
20
|
retryConfig?: RetryConfig;
|
|
21
21
|
ref?: ResolvedRef;
|
|
22
22
|
headers?: Record<string, string>;
|
|
23
|
-
fetchFn?: typeof fetch;
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
26
25
|
* A2AClient is a TypeScript HTTP client for interacting with A2A-compliant agents.
|
|
@@ -65,7 +64,6 @@ declare class A2AClient {
|
|
|
65
64
|
private requestIdCounter;
|
|
66
65
|
private serviceEndpointUrl?;
|
|
67
66
|
private options;
|
|
68
|
-
private fetchFn;
|
|
69
67
|
/**
|
|
70
68
|
* Constructs an A2AClient instance.
|
|
71
69
|
* It initiates fetching the agent card from the provided agent baseUrl.
|