@inkeep/agents-core 0.58.12 → 0.58.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth-schema.d.ts +85 -85
- package/dist/auth/auth-validation-schemas.d.ts +152 -152
- package/dist/auth/auth.d.ts +9 -9
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/data-access/index.d.ts +3 -1
- package/dist/data-access/index.js +3 -1
- package/dist/data-access/manage/agents.d.ts +26 -26
- package/dist/data-access/manage/artifactComponents.d.ts +12 -12
- package/dist/data-access/manage/audit-queries.d.ts +29 -0
- package/dist/data-access/manage/audit-queries.js +29 -0
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/functionTools.d.ts +16 -16
- package/dist/data-access/manage/skills.d.ts +14 -14
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +28 -28
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgents.d.ts +18 -18
- package/dist/data-access/manage/tools.d.ts +24 -24
- package/dist/data-access/manage/triggers.d.ts +2 -2
- package/dist/data-access/runtime/apiKeys.d.ts +16 -16
- package/dist/data-access/runtime/apps.d.ts +8 -8
- package/dist/data-access/runtime/audit-queries.d.ts +41 -0
- package/dist/data-access/runtime/audit-queries.js +37 -0
- package/dist/data-access/runtime/conversations.d.ts +31 -31
- package/dist/data-access/runtime/messages.d.ts +12 -12
- package/dist/data-access/runtime/tasks.d.ts +9 -9
- package/dist/data-reconciliation/audit.d.ts +6 -0
- package/dist/data-reconciliation/audit.js +37 -0
- package/dist/data-reconciliation/index.d.ts +4 -0
- package/dist/data-reconciliation/index.js +5 -0
- package/dist/data-reconciliation/reconcile.d.ts +6 -0
- package/dist/data-reconciliation/reconcile.js +58 -0
- package/dist/data-reconciliation/types.d.ts +116 -0
- package/dist/data-reconciliation/types.js +7 -0
- package/dist/db/manage/manage-schema.d.ts +453 -453
- package/dist/db/runtime/runtime-schema.d.ts +332 -332
- package/dist/index.d.ts +7 -1
- package/dist/index.js +6 -1
- package/dist/setup/setup.d.ts +1 -0
- package/dist/setup/setup.js +25 -8
- package/dist/utils/service-token-auth.d.ts +9 -0
- package/dist/utils/service-token-auth.js +4 -1
- package/dist/validation/dolt-schemas.d.ts +1 -1
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas.d.ts +1963 -1966
- package/dist/validation/schemas.js +5 -1
- package/package.json +1 -1
package/dist/setup/setup.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { loadEnvironmentFiles } from "../env.js";
|
|
2
|
-
import { copyFileSync, existsSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { copyFileSync, existsSync, openSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
3
5
|
import dotenv from "dotenv";
|
|
4
6
|
import { generateKeyPairSync, randomBytes } from "node:crypto";
|
|
5
7
|
import { promisify } from "node:util";
|
|
@@ -304,7 +306,7 @@ async function waitForDockerHealth(composeFile, serviceName, composeCmd, timeout
|
|
|
304
306
|
} catch (error) {
|
|
305
307
|
lastError = error;
|
|
306
308
|
}
|
|
307
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
309
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, 1e3));
|
|
308
310
|
}
|
|
309
311
|
const errorMsg = lastError instanceof Error ? lastError.message : String(lastError);
|
|
310
312
|
throw new Error(`${serviceName} not healthy after ${timeout}ms${lastError ? ` (last error: ${errorMsg})` : ""}`);
|
|
@@ -418,7 +420,7 @@ async function waitForServerReady(url, timeout = 18e4) {
|
|
|
418
420
|
if (error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError")) lastError = "fetch timeout (>5s per attempt)";
|
|
419
421
|
else lastError = error instanceof Error ? error.message : String(error);
|
|
420
422
|
}
|
|
421
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
423
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, 1e3));
|
|
422
424
|
}
|
|
423
425
|
throw new Error(`Server not ready at ${url} after ${timeout}ms. Last error: ${lastError}`);
|
|
424
426
|
}
|
|
@@ -433,8 +435,14 @@ async function startServersIfNeeded(config) {
|
|
|
433
435
|
if (await checkServerRunning(config.apiHealthUrl)) logSuccess("API server already running");
|
|
434
436
|
else if (config.devApiCommand) {
|
|
435
437
|
logInfo("Starting API server temporarily...");
|
|
438
|
+
const apiLogPath = join(tmpdir(), `setup-dev-api-${Date.now()}.log`);
|
|
439
|
+
const apiLogFd = openSync(apiLogPath, "a");
|
|
436
440
|
const proc = spawn("sh", ["-c", config.devApiCommand], {
|
|
437
|
-
stdio:
|
|
441
|
+
stdio: [
|
|
442
|
+
"ignore",
|
|
443
|
+
apiLogFd,
|
|
444
|
+
apiLogFd
|
|
445
|
+
],
|
|
438
446
|
detached: true,
|
|
439
447
|
cwd: process.cwd()
|
|
440
448
|
});
|
|
@@ -442,13 +450,20 @@ async function startServersIfNeeded(config) {
|
|
|
442
450
|
result.startedApi = true;
|
|
443
451
|
result.apiPid = proc.pid ?? null;
|
|
444
452
|
logSuccess(`API server process started (PID: ${proc.pid})`);
|
|
453
|
+
logInfo(`API server logs: ${apiLogPath}`);
|
|
445
454
|
}
|
|
446
455
|
if (config.uiHealthUrl) {
|
|
447
456
|
if (await checkServerRunning(config.uiHealthUrl)) logSuccess("Dashboard already running");
|
|
448
457
|
else if (config.devUiCommand) {
|
|
449
458
|
logInfo("Starting Dashboard temporarily...");
|
|
459
|
+
const uiLogPath = join(tmpdir(), `setup-dev-ui-${Date.now()}.log`);
|
|
460
|
+
const uiLogFd = openSync(uiLogPath, "a");
|
|
450
461
|
const proc = spawn("sh", ["-c", config.devUiCommand], {
|
|
451
|
-
stdio:
|
|
462
|
+
stdio: [
|
|
463
|
+
"ignore",
|
|
464
|
+
uiLogFd,
|
|
465
|
+
uiLogFd
|
|
466
|
+
],
|
|
452
467
|
detached: true,
|
|
453
468
|
cwd: process.cwd(),
|
|
454
469
|
env: process.env
|
|
@@ -457,6 +472,7 @@ async function startServersIfNeeded(config) {
|
|
|
457
472
|
result.startedUi = true;
|
|
458
473
|
result.uiPid = proc.pid ?? null;
|
|
459
474
|
logSuccess(`Dashboard process started (PID: ${proc.pid})`);
|
|
475
|
+
logInfo(`Dashboard logs: ${uiLogPath}`);
|
|
460
476
|
}
|
|
461
477
|
}
|
|
462
478
|
const waitPromises = [];
|
|
@@ -497,10 +513,11 @@ async function pushProject(pushConfig) {
|
|
|
497
513
|
...process.env,
|
|
498
514
|
INKEEP_CI: "true",
|
|
499
515
|
INKEEP_API_KEY: pushConfig.apiKey,
|
|
500
|
-
INKEEP_TENANT_ID: process.env.INKEEP_TENANT_ID || "default"
|
|
516
|
+
INKEEP_TENANT_ID: process.env.INKEEP_TENANT_ID || "default",
|
|
517
|
+
...pushConfig.apiUrl ? { INKEEP_AGENTS_API_URL: pushConfig.apiUrl } : {}
|
|
501
518
|
} : { ...process.env };
|
|
502
519
|
try {
|
|
503
|
-
const { stdout } = await execAsync(`pnpm inkeep push --project ${pushConfig.projectPath} --config ${pushConfig.configPath}`, {
|
|
520
|
+
const { stdout } = await execAsync(`pnpm exec inkeep push --project ${pushConfig.projectPath} --config ${pushConfig.configPath}`, {
|
|
504
521
|
env: pushEnv,
|
|
505
522
|
cwd: process.cwd()
|
|
506
523
|
});
|
|
@@ -513,7 +530,7 @@ async function pushProject(pushConfig) {
|
|
|
513
530
|
if (err.stdout?.trim()) console.error(`${colors.dim} stdout:\n${err.stdout.trim()}${colors.reset}`);
|
|
514
531
|
if (err.stderr?.trim()) console.error(`${colors.dim} stderr:\n${err.stderr.trim()}${colors.reset}`);
|
|
515
532
|
logWarning("The project may not have been seeded. You can manually run:");
|
|
516
|
-
logInfo(` pnpm inkeep push --project ${pushConfig.projectPath} --config ${pushConfig.configPath}`);
|
|
533
|
+
logInfo(` pnpm exec inkeep push --project ${pushConfig.projectPath} --config ${pushConfig.configPath}`);
|
|
517
534
|
return false;
|
|
518
535
|
}
|
|
519
536
|
}
|
|
@@ -16,6 +16,11 @@ interface ServiceTokenPayload {
|
|
|
16
16
|
tenantId: string;
|
|
17
17
|
/** Project ID - must match for both origin and target agents */
|
|
18
18
|
projectId: string;
|
|
19
|
+
/** Original initiator of the request (propagated through delegation chain) */
|
|
20
|
+
initiatedBy?: {
|
|
21
|
+
type: 'user' | 'api_key';
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
19
24
|
/** Issued at timestamp */
|
|
20
25
|
iat: number;
|
|
21
26
|
/** Expiration timestamp (5 minutes from issue) */
|
|
@@ -29,6 +34,10 @@ interface GenerateServiceTokenParams {
|
|
|
29
34
|
projectId: string;
|
|
30
35
|
originAgentId: string;
|
|
31
36
|
targetAgentId: string;
|
|
37
|
+
initiatedBy?: {
|
|
38
|
+
type: 'user' | 'api_key';
|
|
39
|
+
id: string;
|
|
40
|
+
};
|
|
32
41
|
}
|
|
33
42
|
/**
|
|
34
43
|
* Result of verifying a service token
|
|
@@ -17,7 +17,8 @@ async function generateServiceToken(params) {
|
|
|
17
17
|
expiresIn: "1h",
|
|
18
18
|
claims: {
|
|
19
19
|
tenantId: params.tenantId,
|
|
20
|
-
projectId: params.projectId
|
|
20
|
+
projectId: params.projectId,
|
|
21
|
+
...params.initiatedBy ? { initiatedBy: params.initiatedBy } : {}
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
logger.debug({
|
|
@@ -51,12 +52,14 @@ async function verifyServiceToken(token) {
|
|
|
51
52
|
error: "Invalid token: missing required claims"
|
|
52
53
|
};
|
|
53
54
|
}
|
|
55
|
+
const initiatedBy = payload.initiatedBy;
|
|
54
56
|
const validPayload = {
|
|
55
57
|
iss: payload.iss,
|
|
56
58
|
aud: payload.aud,
|
|
57
59
|
sub: payload.sub,
|
|
58
60
|
tenantId: payload.tenantId,
|
|
59
61
|
projectId: payload.projectId,
|
|
62
|
+
...initiatedBy ? { initiatedBy } : {},
|
|
60
63
|
iat: payload.iat,
|
|
61
64
|
exp: payload.exp
|
|
62
65
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as drizzle_zod15 from "drizzle-zod";
|
|
3
3
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
4
4
|
|
|
5
5
|
//#region src/validation/drizzle-schema-helpers.d.ts
|
|
6
|
-
declare function createSelectSchemaWithModifiers<T extends AnySQLiteTable>(table: T, overrides?: Partial<Record<keyof T['_']['columns'], (schema: z.ZodTypeAny) => z.ZodTypeAny>>):
|
|
7
|
-
declare function createInsertSchemaWithModifiers<T extends AnySQLiteTable>(table: T, overrides?: Partial<Record<keyof T['_']['columns'], (schema: z.ZodTypeAny) => z.ZodTypeAny>>):
|
|
6
|
+
declare function createSelectSchemaWithModifiers<T extends AnySQLiteTable>(table: T, overrides?: Partial<Record<keyof T['_']['columns'], (schema: z.ZodTypeAny) => z.ZodTypeAny>>): drizzle_zod15.BuildSchema<"select", T["_"]["columns"], drizzle_zod15.BuildRefine<T["_"]["columns"], undefined>, undefined>;
|
|
7
|
+
declare function createInsertSchemaWithModifiers<T extends AnySQLiteTable>(table: T, overrides?: Partial<Record<keyof T['_']['columns'], (schema: z.ZodTypeAny) => z.ZodTypeAny>>): drizzle_zod15.BuildSchema<"insert", T["_"]["columns"], drizzle_zod15.BuildRefine<Pick<T["_"]["columns"], keyof T["$inferInsert"]>, undefined>, undefined>;
|
|
8
8
|
declare const createSelectSchema: typeof createSelectSchemaWithModifiers;
|
|
9
9
|
declare const createInsertSchema: typeof createInsertSchemaWithModifiers;
|
|
10
10
|
/**
|