@ailu-ai/contracts 2.0.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 +201 -0
- package/dist/admin.d.ts +99 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +59 -0
- package/dist/admin.js.map +1 -0
- package/dist/admin.test.d.ts +2 -0
- package/dist/admin.test.d.ts.map +1 -0
- package/dist/admin.test.js +42 -0
- package/dist/admin.test.js.map +1 -0
- package/dist/approvals.d.ts +58 -0
- package/dist/approvals.d.ts.map +1 -0
- package/dist/approvals.js +28 -0
- package/dist/approvals.js.map +1 -0
- package/dist/artifacts.d.ts +22 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +9 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/catalog.d.ts +626 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +69 -0
- package/dist/catalog.js.map +1 -0
- package/dist/catalog.test.d.ts +2 -0
- package/dist/catalog.test.d.ts.map +1 -0
- package/dist/catalog.test.js +98 -0
- package/dist/catalog.test.js.map +1 -0
- package/dist/compliance.d.ts +428 -0
- package/dist/compliance.d.ts.map +1 -0
- package/dist/compliance.js +80 -0
- package/dist/compliance.js.map +1 -0
- package/dist/connectors.d.ts +161 -0
- package/dist/connectors.d.ts.map +1 -0
- package/dist/connectors.js +49 -0
- package/dist/connectors.js.map +1 -0
- package/dist/error-envelope.d.ts +16 -0
- package/dist/error-envelope.d.ts.map +1 -0
- package/dist/error-envelope.js +7 -0
- package/dist/error-envelope.js.map +1 -0
- package/dist/eval.d.ts +144 -0
- package/dist/eval.d.ts.map +1 -0
- package/dist/eval.js +36 -0
- package/dist/eval.js.map +1 -0
- package/dist/events.d.ts +359 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +134 -0
- package/dist/events.js.map +1 -0
- package/dist/fleet.d.ts +147 -0
- package/dist/fleet.d.ts.map +1 -0
- package/dist/fleet.js +34 -0
- package/dist/fleet.js.map +1 -0
- package/dist/fs-policy.d.ts +101 -0
- package/dist/fs-policy.d.ts.map +1 -0
- package/dist/fs-policy.js +36 -0
- package/dist/fs-policy.js.map +1 -0
- package/dist/fs-policy.test.d.ts +2 -0
- package/dist/fs-policy.test.d.ts.map +1 -0
- package/dist/fs-policy.test.js +35 -0
- package/dist/fs-policy.test.js.map +1 -0
- package/dist/fs.d.ts +182 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +59 -0
- package/dist/fs.js.map +1 -0
- package/dist/fs.test.d.ts +2 -0
- package/dist/fs.test.d.ts.map +1 -0
- package/dist/fs.test.js +35 -0
- package/dist/fs.test.js.map +1 -0
- package/dist/graphs.d.ts +951 -0
- package/dist/graphs.d.ts.map +1 -0
- package/dist/graphs.js +94 -0
- package/dist/graphs.js.map +1 -0
- package/dist/graphs.test.d.ts +2 -0
- package/dist/graphs.test.d.ts.map +1 -0
- package/dist/graphs.test.js +65 -0
- package/dist/graphs.test.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +9 -0
- package/dist/index.test.js.map +1 -0
- package/dist/knowledge.d.ts +315 -0
- package/dist/knowledge.d.ts.map +1 -0
- package/dist/knowledge.js +111 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/knowledge.test.d.ts +2 -0
- package/dist/knowledge.test.d.ts.map +1 -0
- package/dist/knowledge.test.js +22 -0
- package/dist/knowledge.test.js.map +1 -0
- package/dist/node-metadata.d.ts +3096 -0
- package/dist/node-metadata.d.ts.map +1 -0
- package/dist/node-metadata.js +184 -0
- package/dist/node-metadata.js.map +1 -0
- package/dist/node-metadata.test.d.ts +2 -0
- package/dist/node-metadata.test.d.ts.map +1 -0
- package/dist/node-metadata.test.js +126 -0
- package/dist/node-metadata.test.js.map +1 -0
- package/dist/observability.d.ts +154 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.js +34 -0
- package/dist/observability.js.map +1 -0
- package/dist/pii.d.ts +88 -0
- package/dist/pii.d.ts.map +1 -0
- package/dist/pii.js +42 -0
- package/dist/pii.js.map +1 -0
- package/dist/principal.d.ts +81 -0
- package/dist/principal.d.ts.map +1 -0
- package/dist/principal.js +48 -0
- package/dist/principal.js.map +1 -0
- package/dist/principal.test.d.ts +2 -0
- package/dist/principal.test.d.ts.map +1 -0
- package/dist/principal.test.js +44 -0
- package/dist/principal.test.js.map +1 -0
- package/dist/registries.d.ts +26 -0
- package/dist/registries.d.ts.map +1 -0
- package/dist/registries.js +11 -0
- package/dist/registries.js.map +1 -0
- package/dist/router.d.ts +48 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +22 -0
- package/dist/router.js.map +1 -0
- package/dist/runs.d.ts +270 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +108 -0
- package/dist/runs.js.map +1 -0
- package/dist/runs.test.d.ts +2 -0
- package/dist/runs.test.d.ts.map +1 -0
- package/dist/runs.test.js +79 -0
- package/dist/runs.test.js.map +1 -0
- package/dist/search.d.ts +88 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +23 -0
- package/dist/search.js.map +1 -0
- package/dist/skills.d.ts +208 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +63 -0
- package/dist/skills.js.map +1 -0
- package/dist/tenant.d.ts +204 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +46 -0
- package/dist/tenant.js.map +1 -0
- package/package.json +33 -0
package/dist/pii.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* PII redaction DTOs (ADR 0008). A per-namespace policy decides whether personal data is
|
|
4
|
+
* detected, redacted before reaching a model, or blocks the operation. Mirrors the router
|
|
5
|
+
* policy shape.
|
|
6
|
+
*/
|
|
7
|
+
export const PiiLevelSchema = z.enum(["off", "detect", "redact", "block"]);
|
|
8
|
+
/** Body for PUT /pii/namespace/:ns/policy (owner-only). */
|
|
9
|
+
export const SetPiiPolicyDtoSchema = z.object({
|
|
10
|
+
level: PiiLevelSchema.optional(),
|
|
11
|
+
entities: z.array(z.string()).optional(),
|
|
12
|
+
threshold: z.number().min(0).max(1).optional()
|
|
13
|
+
});
|
|
14
|
+
/** The resolved policy for a namespace. */
|
|
15
|
+
export const PiiPolicyDtoSchema = z.object({
|
|
16
|
+
namespace: z.string(),
|
|
17
|
+
level: PiiLevelSchema,
|
|
18
|
+
entities: z.array(z.string()),
|
|
19
|
+
threshold: z.number(),
|
|
20
|
+
canWrite: z.boolean()
|
|
21
|
+
});
|
|
22
|
+
/** A single detection (entity type, confidence, span). */
|
|
23
|
+
export const PiiFindingDtoSchema = z.object({
|
|
24
|
+
entity: z.string(),
|
|
25
|
+
score: z.number(),
|
|
26
|
+
start: z.number().int(),
|
|
27
|
+
end: z.number().int()
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Wire contract for the native gateway seam (ADR 0008 phase 2). The Rust engine POSTs the
|
|
31
|
+
* outbound LLM texts (system + messages) to the control plane, which returns them redacted in
|
|
32
|
+
* the same order. Same length in, same length out.
|
|
33
|
+
*/
|
|
34
|
+
export const PiiRedactBatchDtoSchema = z.object({
|
|
35
|
+
texts: z.array(z.string())
|
|
36
|
+
});
|
|
37
|
+
/** `blocked` is true when a `block`-level policy matched — the engine then fails the call. */
|
|
38
|
+
export const PiiRedactBatchResultDtoSchema = z.object({
|
|
39
|
+
texts: z.array(z.string()),
|
|
40
|
+
blocked: z.boolean()
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=pii.js.map
|
package/dist/pii.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pii.js","sourceRoot":"","sources":["../src/pii.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAA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AE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC3B,CAAC,CAAC;AAGH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Authentication / principal DTOs shared across the API↔Studio boundary.
|
|
4
|
+
*
|
|
5
|
+
* These are plain wire shapes — they carry NO auth machinery (no hashing, no sessions,
|
|
6
|
+
* no guards) and the engine never imports them for execution. A control plane
|
|
7
|
+
* owns all of that; contracts only describes what crosses the wire.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Role a principal holds WITHIN a tenant (RBAC). It is TENANT-SCOPED and resolved
|
|
11
|
+
* SERVER-SIDE on every request — it is never read from a JWT claim or a client-supplied
|
|
12
|
+
* header. The wire carries it only as an enrichment of the principal for the current
|
|
13
|
+
* tenant (so the Studio can gate UI cosmetically); the server's 403 remains the only
|
|
14
|
+
* authority.
|
|
15
|
+
*
|
|
16
|
+
* `admin`/`billing`/`member` are the ADR 0056 P3 org-role vocabulary (Organization > Team
|
|
17
|
+
* tenancy + granular rights); `approver`/`viewer` are the pre-P3 vocabulary, kept valid here
|
|
18
|
+
* so the schema stays parseable across the rollout window (a control-plane deploy that
|
|
19
|
+
* ships the new vocabulary and its own DB backfill migration are two separate, sequenced
|
|
20
|
+
* steps — this schema must never reject a role value either side of that migration has
|
|
21
|
+
* legitimately in flight). A future ADR-tracked cleanup may narrow this back down once no
|
|
22
|
+
* `approver`/`viewer` row is ever written or read anywhere.
|
|
23
|
+
*/
|
|
24
|
+
export declare const TenantRoleSchema: z.ZodEnum<["owner", "approver", "viewer", "admin", "billing", "member"]>;
|
|
25
|
+
/** The authenticated principal, as returned by `GET /auth/me`. Never includes secrets. */
|
|
26
|
+
export declare const PrincipalDtoSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
email: z.ZodString;
|
|
29
|
+
displayName: z.ZodNullable<z.ZodString>;
|
|
30
|
+
/** The principal's role in the CURRENT tenant, resolved server-side (never from the JWT). */
|
|
31
|
+
currentTenantRole: z.ZodEnum<["owner", "approver", "viewer", "admin", "billing", "member"]>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
id: string;
|
|
34
|
+
email: string;
|
|
35
|
+
displayName: string | null;
|
|
36
|
+
currentTenantRole: "owner" | "approver" | "viewer" | "admin" | "billing" | "member";
|
|
37
|
+
}, {
|
|
38
|
+
id: string;
|
|
39
|
+
email: string;
|
|
40
|
+
displayName: string | null;
|
|
41
|
+
currentTenantRole: "owner" | "approver" | "viewer" | "admin" | "billing" | "member";
|
|
42
|
+
}>;
|
|
43
|
+
/** Login credentials posted to `POST /auth/login`. */
|
|
44
|
+
export declare const LoginDtoSchema: z.ZodObject<{
|
|
45
|
+
email: z.ZodString;
|
|
46
|
+
password: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
email: string;
|
|
49
|
+
password: string;
|
|
50
|
+
}, {
|
|
51
|
+
email: string;
|
|
52
|
+
password: string;
|
|
53
|
+
}>;
|
|
54
|
+
/** Accept an invitation: the signed invite token + the password the new member chooses. */
|
|
55
|
+
export declare const AcceptInviteDtoSchema: z.ZodObject<{
|
|
56
|
+
token: z.ZodString;
|
|
57
|
+
password: z.ZodString;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
password: string;
|
|
60
|
+
token: string;
|
|
61
|
+
}, {
|
|
62
|
+
password: string;
|
|
63
|
+
token: string;
|
|
64
|
+
}>;
|
|
65
|
+
/** Issued session: the bearer token plus its absolute expiry (ISO 8601). */
|
|
66
|
+
export declare const SessionDtoSchema: z.ZodObject<{
|
|
67
|
+
token: z.ZodString;
|
|
68
|
+
expiresAt: z.ZodString;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
token: string;
|
|
71
|
+
expiresAt: string;
|
|
72
|
+
}, {
|
|
73
|
+
token: string;
|
|
74
|
+
expiresAt: string;
|
|
75
|
+
}>;
|
|
76
|
+
export type TenantRole = z.infer<typeof TenantRoleSchema>;
|
|
77
|
+
export type PrincipalDto = z.infer<typeof PrincipalDtoSchema>;
|
|
78
|
+
export type LoginDto = z.infer<typeof LoginDtoSchema>;
|
|
79
|
+
export type AcceptInviteDto = z.infer<typeof AcceptInviteDtoSchema>;
|
|
80
|
+
export type SessionDto = z.infer<typeof SessionDtoSchema>;
|
|
81
|
+
//# sourceMappingURL=principal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principal.d.ts","sourceRoot":"","sources":["../src/principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,0EAAwE,CAAC;AAEtG,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB;;;;IAI7B,6FAA6F;;;;;;;;;;;;EAE7F,CAAC;AAEH,sDAAsD;AACtD,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AAEH,2FAA2F;AAC3F,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Authentication / principal DTOs shared across the API↔Studio boundary.
|
|
4
|
+
*
|
|
5
|
+
* These are plain wire shapes — they carry NO auth machinery (no hashing, no sessions,
|
|
6
|
+
* no guards) and the engine never imports them for execution. A control plane
|
|
7
|
+
* owns all of that; contracts only describes what crosses the wire.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Role a principal holds WITHIN a tenant (RBAC). It is TENANT-SCOPED and resolved
|
|
11
|
+
* SERVER-SIDE on every request — it is never read from a JWT claim or a client-supplied
|
|
12
|
+
* header. The wire carries it only as an enrichment of the principal for the current
|
|
13
|
+
* tenant (so the Studio can gate UI cosmetically); the server's 403 remains the only
|
|
14
|
+
* authority.
|
|
15
|
+
*
|
|
16
|
+
* `admin`/`billing`/`member` are the ADR 0056 P3 org-role vocabulary (Organization > Team
|
|
17
|
+
* tenancy + granular rights); `approver`/`viewer` are the pre-P3 vocabulary, kept valid here
|
|
18
|
+
* so the schema stays parseable across the rollout window (a control-plane deploy that
|
|
19
|
+
* ships the new vocabulary and its own DB backfill migration are two separate, sequenced
|
|
20
|
+
* steps — this schema must never reject a role value either side of that migration has
|
|
21
|
+
* legitimately in flight). A future ADR-tracked cleanup may narrow this back down once no
|
|
22
|
+
* `approver`/`viewer` row is ever written or read anywhere.
|
|
23
|
+
*/
|
|
24
|
+
export const TenantRoleSchema = z.enum(["owner", "approver", "viewer", "admin", "billing", "member"]);
|
|
25
|
+
/** The authenticated principal, as returned by `GET /auth/me`. Never includes secrets. */
|
|
26
|
+
export const PrincipalDtoSchema = z.object({
|
|
27
|
+
id: z.string().min(1),
|
|
28
|
+
email: z.string().email(),
|
|
29
|
+
displayName: z.string().min(1).nullable(),
|
|
30
|
+
/** The principal's role in the CURRENT tenant, resolved server-side (never from the JWT). */
|
|
31
|
+
currentTenantRole: TenantRoleSchema
|
|
32
|
+
});
|
|
33
|
+
/** Login credentials posted to `POST /auth/login`. */
|
|
34
|
+
export const LoginDtoSchema = z.object({
|
|
35
|
+
email: z.string().email(),
|
|
36
|
+
password: z.string().min(1)
|
|
37
|
+
});
|
|
38
|
+
/** Accept an invitation: the signed invite token + the password the new member chooses. */
|
|
39
|
+
export const AcceptInviteDtoSchema = z.object({
|
|
40
|
+
token: z.string().min(1),
|
|
41
|
+
password: z.string().min(8)
|
|
42
|
+
});
|
|
43
|
+
/** Issued session: the bearer token plus its absolute expiry (ISO 8601). */
|
|
44
|
+
export const SessionDtoSchema = z.object({
|
|
45
|
+
token: z.string().min(1),
|
|
46
|
+
expiresAt: z.string().datetime()
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=principal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principal.js","sourceRoot":"","sources":["../src/principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEtG,0FAA0F;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzC,6FAA6F;IAC7F,iBAAiB,EAAE,gBAAgB;CACpC,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC;AAEH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principal.test.d.ts","sourceRoot":"","sources":["../src/principal.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { LoginDtoSchema, PrincipalDtoSchema, SessionDtoSchema, TenantRoleSchema } from "./principal.js";
|
|
3
|
+
describe("principal contracts", () => {
|
|
4
|
+
it("accepts a valid principal", () => {
|
|
5
|
+
const parsed = PrincipalDtoSchema.parse({
|
|
6
|
+
id: "user-1",
|
|
7
|
+
email: "a@b.com",
|
|
8
|
+
displayName: "Alice",
|
|
9
|
+
currentTenantRole: "owner"
|
|
10
|
+
});
|
|
11
|
+
expect(parsed.email).toBe("a@b.com");
|
|
12
|
+
expect(parsed.currentTenantRole).toBe("owner");
|
|
13
|
+
});
|
|
14
|
+
it("allows a null displayName", () => {
|
|
15
|
+
const parsed = PrincipalDtoSchema.parse({
|
|
16
|
+
id: "user-1",
|
|
17
|
+
email: "a@b.com",
|
|
18
|
+
displayName: null,
|
|
19
|
+
currentTenantRole: "viewer"
|
|
20
|
+
});
|
|
21
|
+
expect(parsed.displayName).toBeNull();
|
|
22
|
+
});
|
|
23
|
+
it("requires a current tenant role (resolved server-side) on the principal", () => {
|
|
24
|
+
expect(() => PrincipalDtoSchema.parse({ id: "user-1", email: "a@b.com", displayName: "Alice" })).toThrow();
|
|
25
|
+
});
|
|
26
|
+
it("constrains the tenant role to the RBAC enum", () => {
|
|
27
|
+
expect(TenantRoleSchema.parse("approver")).toBe("approver");
|
|
28
|
+
expect(() => TenantRoleSchema.parse("superuser")).toThrow();
|
|
29
|
+
});
|
|
30
|
+
it("accepts the ADR 0056 P3 org-role vocabulary alongside the pre-P3 one", () => {
|
|
31
|
+
for (const role of ["owner", "approver", "viewer", "admin", "billing", "member"]) {
|
|
32
|
+
expect(TenantRoleSchema.parse(role)).toBe(role);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
it("rejects a malformed email on login", () => {
|
|
36
|
+
expect(() => LoginDtoSchema.parse({ email: "nope", password: "x" })).toThrow();
|
|
37
|
+
});
|
|
38
|
+
it("requires an ISO expiry on a session", () => {
|
|
39
|
+
expect(() => SessionDtoSchema.parse({ token: "t", expiresAt: "not-a-date" })).toThrow();
|
|
40
|
+
const ok = SessionDtoSchema.parse({ token: "t", expiresAt: new Date().toISOString() });
|
|
41
|
+
expect(ok.token).toBe("t");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=principal.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const NodeTypesDtoSchema: z.ZodObject<{
|
|
3
|
+
items: z.ZodArray<z.ZodString, "many">;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
items: string[];
|
|
6
|
+
}, {
|
|
7
|
+
items: string[];
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ConditionNamesDtoSchema: z.ZodObject<{
|
|
10
|
+
items: z.ZodArray<z.ZodString, "many">;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
items: string[];
|
|
13
|
+
}, {
|
|
14
|
+
items: string[];
|
|
15
|
+
}>;
|
|
16
|
+
export declare const AgentTypesDtoSchema: z.ZodObject<{
|
|
17
|
+
items: z.ZodArray<z.ZodString, "many">;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
items: string[];
|
|
20
|
+
}, {
|
|
21
|
+
items: string[];
|
|
22
|
+
}>;
|
|
23
|
+
export type NodeTypesDto = z.infer<typeof NodeTypesDtoSchema>;
|
|
24
|
+
export type ConditionNamesDto = z.infer<typeof ConditionNamesDtoSchema>;
|
|
25
|
+
export type AgentTypesDto = z.infer<typeof AgentTypesDtoSchema>;
|
|
26
|
+
//# sourceMappingURL=registries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../src/registries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;EAE9B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const NodeTypesDtoSchema = z.object({
|
|
3
|
+
items: z.array(z.string())
|
|
4
|
+
});
|
|
5
|
+
export const ConditionNamesDtoSchema = z.object({
|
|
6
|
+
items: z.array(z.string())
|
|
7
|
+
});
|
|
8
|
+
export const AgentTypesDtoSchema = z.object({
|
|
9
|
+
items: z.array(z.string())
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=registries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registries.js","sourceRoot":"","sources":["../src/registries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC3B,CAAC,CAAC"}
|
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The LLM router's decision for a (knowledge base, capability tier, caller) triple. */
|
|
3
|
+
export declare const RouterDecisionDtoSchema: z.ZodObject<{
|
|
4
|
+
namespace: z.ZodString;
|
|
5
|
+
tier: z.ZodString;
|
|
6
|
+
/** Resolved provider + model (a per-base pin overrides the tier default). */
|
|
7
|
+
provider: z.ZodString;
|
|
8
|
+
model: z.ZodString;
|
|
9
|
+
/** True when the model came from the recommended per-tier default (not a pin/override). */
|
|
10
|
+
recommended: z.ZodBoolean;
|
|
11
|
+
/** True when a per-namespace model pin was applied. */
|
|
12
|
+
pinned: z.ZodBoolean;
|
|
13
|
+
/** Caller's effective permissions on this knowledge base. */
|
|
14
|
+
canRead: z.ZodBoolean;
|
|
15
|
+
canWrite: z.ZodBoolean;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
provider: string;
|
|
18
|
+
tier: string;
|
|
19
|
+
model: string;
|
|
20
|
+
namespace: string;
|
|
21
|
+
canRead: boolean;
|
|
22
|
+
canWrite: boolean;
|
|
23
|
+
recommended: boolean;
|
|
24
|
+
pinned: boolean;
|
|
25
|
+
}, {
|
|
26
|
+
provider: string;
|
|
27
|
+
tier: string;
|
|
28
|
+
model: string;
|
|
29
|
+
namespace: string;
|
|
30
|
+
canRead: boolean;
|
|
31
|
+
canWrite: boolean;
|
|
32
|
+
recommended: boolean;
|
|
33
|
+
pinned: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
/** Body for pinning a namespace's model/provider (omit a field to leave it tier-resolved). */
|
|
36
|
+
export declare const SetModelPolicyDtoSchema: z.ZodObject<{
|
|
37
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
38
|
+
model: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
provider?: string | undefined;
|
|
41
|
+
model?: string | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
provider?: string | undefined;
|
|
44
|
+
model?: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type RouterDecisionDto = z.infer<typeof RouterDecisionDtoSchema>;
|
|
47
|
+
export type SetModelPolicyDto = z.infer<typeof SetModelPolicyDtoSchema>;
|
|
48
|
+
//# sourceMappingURL=router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wFAAwF;AACxF,eAAO,MAAM,uBAAuB;;;IAGlC,6EAA6E;;;IAG7E,2FAA2F;;IAE3F,uDAAuD;;IAEvD,6DAA6D;;;;;;;;;;;;;;;;;;;;;EAG7D,CAAC;AAEH,8FAA8F;AAC9F,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
package/dist/router.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The LLM router's decision for a (knowledge base, capability tier, caller) triple. */
|
|
3
|
+
export const RouterDecisionDtoSchema = z.object({
|
|
4
|
+
namespace: z.string().min(1),
|
|
5
|
+
tier: z.string(),
|
|
6
|
+
/** Resolved provider + model (a per-base pin overrides the tier default). */
|
|
7
|
+
provider: z.string(),
|
|
8
|
+
model: z.string(),
|
|
9
|
+
/** True when the model came from the recommended per-tier default (not a pin/override). */
|
|
10
|
+
recommended: z.boolean(),
|
|
11
|
+
/** True when a per-namespace model pin was applied. */
|
|
12
|
+
pinned: z.boolean(),
|
|
13
|
+
/** Caller's effective permissions on this knowledge base. */
|
|
14
|
+
canRead: z.boolean(),
|
|
15
|
+
canWrite: z.boolean()
|
|
16
|
+
});
|
|
17
|
+
/** Body for pinning a namespace's model/provider (omit a field to leave it tier-resolved). */
|
|
18
|
+
export const SetModelPolicyDtoSchema = z.object({
|
|
19
|
+
provider: z.string().min(1).optional(),
|
|
20
|
+
model: z.string().min(1).optional()
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wFAAwF;AACxF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,6EAA6E;IAC7E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,2FAA2F;IAC3F,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;IACxB,uDAAuD;IACvD,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,6DAA6D;IAC7D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;CACtB,CAAC,CAAC;AAEH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC"}
|
package/dist/runs.d.ts
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CreateRunDtoSchema: z.ZodObject<{
|
|
3
|
+
graphId: z.ZodString;
|
|
4
|
+
initialData: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
graphId: string;
|
|
7
|
+
initialData: Record<string, unknown>;
|
|
8
|
+
}, {
|
|
9
|
+
graphId: string;
|
|
10
|
+
initialData?: Record<string, unknown> | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const RunDtoSchema: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
graphId: z.ZodString;
|
|
15
|
+
status: z.ZodEnum<["idle", "running", "suspended", "completed", "failed", "rejected", "cancelled"]>;
|
|
16
|
+
currentNodeId: z.ZodOptional<z.ZodString>;
|
|
17
|
+
channels: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
18
|
+
version: z.ZodNumber;
|
|
19
|
+
checkpointId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
/** Owning tenant (tenancy). Optional for pre-tenancy rows backfilled to `default`. */
|
|
21
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
/** Id of the principal who started the run. */
|
|
23
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
24
|
+
createdAt: z.ZodString;
|
|
25
|
+
updatedAt: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
28
|
+
id: string;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
version: number;
|
|
31
|
+
channels: Record<string, unknown>;
|
|
32
|
+
graphId: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
tenantId?: string | undefined;
|
|
35
|
+
createdBy?: string | undefined;
|
|
36
|
+
currentNodeId?: string | undefined;
|
|
37
|
+
checkpointId?: string | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
40
|
+
id: string;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
version: number;
|
|
43
|
+
channels: Record<string, unknown>;
|
|
44
|
+
graphId: string;
|
|
45
|
+
updatedAt: string;
|
|
46
|
+
tenantId?: string | undefined;
|
|
47
|
+
createdBy?: string | undefined;
|
|
48
|
+
currentNodeId?: string | undefined;
|
|
49
|
+
checkpointId?: string | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
/** Lightweight row for the runs list — no channels, cheap to query at scale. */
|
|
52
|
+
export declare const RunSummaryDtoSchema: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
graphId: z.ZodString;
|
|
55
|
+
status: z.ZodEnum<["idle", "running", "suspended", "completed", "failed", "rejected", "cancelled"]>;
|
|
56
|
+
currentNodeId: z.ZodNullable<z.ZodString>;
|
|
57
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
59
|
+
createdAt: z.ZodString;
|
|
60
|
+
updatedAt: z.ZodString;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
63
|
+
id: string;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
graphId: string;
|
|
66
|
+
currentNodeId: string | null;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
tenantId?: string | undefined;
|
|
69
|
+
createdBy?: string | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
72
|
+
id: string;
|
|
73
|
+
createdAt: string;
|
|
74
|
+
graphId: string;
|
|
75
|
+
currentNodeId: string | null;
|
|
76
|
+
updatedAt: string;
|
|
77
|
+
tenantId?: string | undefined;
|
|
78
|
+
createdBy?: string | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
export declare const RunListDtoSchema: z.ZodObject<{
|
|
81
|
+
items: z.ZodArray<z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
graphId: z.ZodString;
|
|
84
|
+
status: z.ZodEnum<["idle", "running", "suspended", "completed", "failed", "rejected", "cancelled"]>;
|
|
85
|
+
currentNodeId: z.ZodNullable<z.ZodString>;
|
|
86
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
87
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
88
|
+
createdAt: z.ZodString;
|
|
89
|
+
updatedAt: z.ZodString;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
92
|
+
id: string;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
graphId: string;
|
|
95
|
+
currentNodeId: string | null;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
tenantId?: string | undefined;
|
|
98
|
+
createdBy?: string | undefined;
|
|
99
|
+
}, {
|
|
100
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
101
|
+
id: string;
|
|
102
|
+
createdAt: string;
|
|
103
|
+
graphId: string;
|
|
104
|
+
currentNodeId: string | null;
|
|
105
|
+
updatedAt: string;
|
|
106
|
+
tenantId?: string | undefined;
|
|
107
|
+
createdBy?: string | undefined;
|
|
108
|
+
}>, "many">;
|
|
109
|
+
total: z.ZodNumber;
|
|
110
|
+
limit: z.ZodNumber;
|
|
111
|
+
offset: z.ZodNumber;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
items: {
|
|
114
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
115
|
+
id: string;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
graphId: string;
|
|
118
|
+
currentNodeId: string | null;
|
|
119
|
+
updatedAt: string;
|
|
120
|
+
tenantId?: string | undefined;
|
|
121
|
+
createdBy?: string | undefined;
|
|
122
|
+
}[];
|
|
123
|
+
total: number;
|
|
124
|
+
limit: number;
|
|
125
|
+
offset: number;
|
|
126
|
+
}, {
|
|
127
|
+
items: {
|
|
128
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
129
|
+
id: string;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
graphId: string;
|
|
132
|
+
currentNodeId: string | null;
|
|
133
|
+
updatedAt: string;
|
|
134
|
+
tenantId?: string | undefined;
|
|
135
|
+
createdBy?: string | undefined;
|
|
136
|
+
}[];
|
|
137
|
+
total: number;
|
|
138
|
+
limit: number;
|
|
139
|
+
offset: number;
|
|
140
|
+
}>;
|
|
141
|
+
/** Query params arrive as strings over HTTP — coerce numerics. */
|
|
142
|
+
export declare const ListRunsQueryDtoSchema: z.ZodObject<{
|
|
143
|
+
status: z.ZodOptional<z.ZodEnum<["idle", "running", "suspended", "completed", "failed", "rejected", "cancelled"]>>;
|
|
144
|
+
graphId: z.ZodOptional<z.ZodString>;
|
|
145
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
146
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
limit: number;
|
|
149
|
+
offset: number;
|
|
150
|
+
status?: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled" | undefined;
|
|
151
|
+
graphId?: string | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
status?: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled" | undefined;
|
|
154
|
+
graphId?: string | undefined;
|
|
155
|
+
limit?: number | undefined;
|
|
156
|
+
offset?: number | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
export declare const InterruptRunDtoSchema: z.ZodObject<{
|
|
159
|
+
nodeId: z.ZodString;
|
|
160
|
+
when: z.ZodEnum<["before", "after"]>;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
nodeId: string;
|
|
163
|
+
when: "before" | "after";
|
|
164
|
+
}, {
|
|
165
|
+
nodeId: string;
|
|
166
|
+
when: "before" | "after";
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Channel keys the runtime governance machinery owns: `__approvedTools` carries the
|
|
170
|
+
* human-granted tools an agent may run past an approval gate, and `__approvalIds`
|
|
171
|
+
* carries the pending ApprovalEngine request ids. Allowing a client to PATCH these
|
|
172
|
+
* directly would be a self-approval back door (forge an unlock, or erase the pending
|
|
173
|
+
* ids that the resume gate checks), so they are rejected by the patch DTO below. The
|
|
174
|
+
* literals mirror `@ailu-ai/graph-sdk`'s `APPROVED_TOOLS_CHANNEL` / `APPROVAL_IDS_CHANNEL`;
|
|
175
|
+
* contracts stays dependency-free of the SDK, so they are duplicated as constants here.
|
|
176
|
+
*/
|
|
177
|
+
export declare const RESERVED_PATCH_CHANNELS: readonly ["__approvedTools", "__approvalIds"];
|
|
178
|
+
export declare const PatchRunStateDtoSchema: z.ZodObject<{
|
|
179
|
+
patch: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>;
|
|
180
|
+
resumeFrom: z.ZodOptional<z.ZodString>;
|
|
181
|
+
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
patch: Record<string, unknown>;
|
|
183
|
+
resumeFrom?: string | undefined;
|
|
184
|
+
}, {
|
|
185
|
+
patch: Record<string, unknown>;
|
|
186
|
+
resumeFrom?: string | undefined;
|
|
187
|
+
}>;
|
|
188
|
+
export declare const ReplayRunDtoSchema: z.ZodObject<{
|
|
189
|
+
checkpointId: z.ZodString;
|
|
190
|
+
}, "strip", z.ZodTypeAny, {
|
|
191
|
+
checkpointId: string;
|
|
192
|
+
}, {
|
|
193
|
+
checkpointId: string;
|
|
194
|
+
}>;
|
|
195
|
+
export declare const CheckpointDtoSchema: z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
runId: z.ZodString;
|
|
198
|
+
graphState: z.ZodObject<{
|
|
199
|
+
runId: z.ZodString;
|
|
200
|
+
graphId: z.ZodString;
|
|
201
|
+
currentNodeId: z.ZodString;
|
|
202
|
+
status: z.ZodEnum<["idle", "running", "suspended", "completed", "failed", "rejected", "cancelled"]>;
|
|
203
|
+
channels: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
204
|
+
version: z.ZodNumber;
|
|
205
|
+
checkpointId: z.ZodOptional<z.ZodString>;
|
|
206
|
+
createdAt: z.ZodString;
|
|
207
|
+
updatedAt: z.ZodString;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
210
|
+
runId: string;
|
|
211
|
+
createdAt: string;
|
|
212
|
+
version: number;
|
|
213
|
+
channels: Record<string, unknown>;
|
|
214
|
+
graphId: string;
|
|
215
|
+
currentNodeId: string;
|
|
216
|
+
updatedAt: string;
|
|
217
|
+
checkpointId?: string | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
220
|
+
runId: string;
|
|
221
|
+
createdAt: string;
|
|
222
|
+
version: number;
|
|
223
|
+
channels: Record<string, unknown>;
|
|
224
|
+
graphId: string;
|
|
225
|
+
currentNodeId: string;
|
|
226
|
+
updatedAt: string;
|
|
227
|
+
checkpointId?: string | undefined;
|
|
228
|
+
}>;
|
|
229
|
+
createdAt: z.ZodString;
|
|
230
|
+
}, "strip", z.ZodTypeAny, {
|
|
231
|
+
id: string;
|
|
232
|
+
runId: string;
|
|
233
|
+
createdAt: string;
|
|
234
|
+
graphState: {
|
|
235
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
236
|
+
runId: string;
|
|
237
|
+
createdAt: string;
|
|
238
|
+
version: number;
|
|
239
|
+
channels: Record<string, unknown>;
|
|
240
|
+
graphId: string;
|
|
241
|
+
currentNodeId: string;
|
|
242
|
+
updatedAt: string;
|
|
243
|
+
checkpointId?: string | undefined;
|
|
244
|
+
};
|
|
245
|
+
}, {
|
|
246
|
+
id: string;
|
|
247
|
+
runId: string;
|
|
248
|
+
createdAt: string;
|
|
249
|
+
graphState: {
|
|
250
|
+
status: "rejected" | "running" | "completed" | "failed" | "idle" | "suspended" | "cancelled";
|
|
251
|
+
runId: string;
|
|
252
|
+
createdAt: string;
|
|
253
|
+
version: number;
|
|
254
|
+
channels: Record<string, unknown>;
|
|
255
|
+
graphId: string;
|
|
256
|
+
currentNodeId: string;
|
|
257
|
+
updatedAt: string;
|
|
258
|
+
checkpointId?: string | undefined;
|
|
259
|
+
};
|
|
260
|
+
}>;
|
|
261
|
+
export type CreateRunDto = z.infer<typeof CreateRunDtoSchema>;
|
|
262
|
+
export type RunDto = z.infer<typeof RunDtoSchema>;
|
|
263
|
+
export type RunSummaryDto = z.infer<typeof RunSummaryDtoSchema>;
|
|
264
|
+
export type RunListDto = z.infer<typeof RunListDtoSchema>;
|
|
265
|
+
export type ListRunsQueryDto = z.infer<typeof ListRunsQueryDtoSchema>;
|
|
266
|
+
export type InterruptRunDto = z.infer<typeof InterruptRunDtoSchema>;
|
|
267
|
+
export type PatchRunStateDto = z.infer<typeof PatchRunStateDtoSchema>;
|
|
268
|
+
export type ReplayRunDto = z.infer<typeof ReplayRunDtoSchema>;
|
|
269
|
+
export type CheckpointDto = z.infer<typeof CheckpointDtoSchema>;
|
|
270
|
+
//# sourceMappingURL=runs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../src/runs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyBxB,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;IAQvB,sFAAsF;;IAEtF,+CAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI/C,CAAC;AAEH,gFAAgF;AAChF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS9B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;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