@kindgi/api 0.1.4-rc.0 → 0.1.4-rc.2
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/agent-binding.d.ts +20 -2
- package/dist/agent-binding.d.ts.map +1 -1
- package/dist/agent-pins.d.ts.map +1 -1
- package/dist/agent-pins.js +4 -1
- package/dist/agent-pins.js.map +1 -1
- package/dist/app.d.ts +8 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +30 -5
- package/dist/app.js.map +1 -1
- package/dist/deploy-versions.d.ts +10 -5
- package/dist/deploy-versions.d.ts.map +1 -1
- package/dist/deploy-versions.js +4 -10
- package/dist/deploy-versions.js.map +1 -1
- package/dist/derive-agent-version.d.ts +9 -1
- package/dist/derive-agent-version.d.ts.map +1 -1
- package/dist/derive-agent-version.js +11 -1
- package/dist/derive-agent-version.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +26 -0
- package/dist/errors.js.map +1 -1
- package/dist/eval-case-binding.d.ts +10 -0
- package/dist/eval-case-binding.d.ts.map +1 -1
- package/dist/eval-run-binding.d.ts +21 -3
- package/dist/eval-run-binding.d.ts.map +1 -1
- package/dist/eval-run-binding.js.map +1 -1
- package/dist/eval-run-dispatcher.d.ts +3 -0
- package/dist/eval-run-dispatcher.d.ts.map +1 -1
- package/dist/eval-run-dispatcher.js.map +1 -1
- package/dist/flow-binding.d.ts +8 -0
- package/dist/flow-binding.d.ts.map +1 -1
- package/dist/flow-pins.d.ts +20 -7
- package/dist/flow-pins.d.ts.map +1 -1
- package/dist/flow-pins.js +36 -11
- package/dist/flow-pins.js.map +1 -1
- package/dist/gate-policy-binding.d.ts +164 -0
- package/dist/gate-policy-binding.d.ts.map +1 -0
- package/dist/gate-policy-binding.js +12 -0
- package/dist/gate-policy-binding.js.map +1 -0
- package/dist/gate.d.ts +56 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +359 -0
- package/dist/gate.js.map +1 -0
- package/dist/guardrail-binding.d.ts +8 -0
- package/dist/guardrail-binding.d.ts.map +1 -1
- package/dist/handler-binding.d.ts +17 -2
- package/dist/handler-binding.d.ts.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/judged-dispatcher.d.ts +20 -1
- package/dist/judged-dispatcher.d.ts.map +1 -1
- package/dist/judged-dispatcher.js +57 -7
- package/dist/judged-dispatcher.js.map +1 -1
- package/dist/judgment-binding.d.ts +38 -0
- package/dist/judgment-binding.d.ts.map +1 -1
- package/dist/judgment-binding.js +19 -0
- package/dist/judgment-binding.js.map +1 -1
- package/dist/live-version-binding.d.ts +206 -0
- package/dist/live-version-binding.d.ts.map +1 -0
- package/dist/live-version-binding.js +4 -0
- package/dist/live-version-binding.js.map +1 -0
- package/dist/middleware/authorize.d.ts.map +1 -1
- package/dist/middleware/authorize.js +13 -2
- package/dist/middleware/authorize.js.map +1 -1
- package/dist/middleware/project-ref.d.ts +25 -0
- package/dist/middleware/project-ref.d.ts.map +1 -0
- package/dist/middleware/project-ref.js +72 -0
- package/dist/middleware/project-ref.js.map +1 -0
- package/dist/openapi/generate.d.ts.map +1 -1
- package/dist/openapi/generate.js +4 -0
- package/dist/openapi/generate.js.map +1 -1
- package/dist/openapi/operations.d.ts +6 -0
- package/dist/openapi/operations.d.ts.map +1 -1
- package/dist/openapi/operations.js +524 -27
- package/dist/openapi/operations.js.map +1 -1
- package/dist/openapi/schemas.d.ts +43 -0
- package/dist/openapi/schemas.d.ts.map +1 -1
- package/dist/openapi/schemas.js +1050 -7
- package/dist/openapi/schemas.js.map +1 -1
- package/dist/publish-refused.d.ts +18 -0
- package/dist/publish-refused.d.ts.map +1 -0
- package/dist/publish-refused.js +22 -0
- package/dist/publish-refused.js.map +1 -0
- package/dist/registry-read-only.d.ts +32 -0
- package/dist/registry-read-only.d.ts.map +1 -0
- package/dist/registry-read-only.js +22 -0
- package/dist/registry-read-only.js.map +1 -0
- package/dist/retention-binding.d.ts +29 -0
- package/dist/retention-binding.d.ts.map +1 -1
- package/dist/routes/agent-releases.d.ts +40 -0
- package/dist/routes/agent-releases.d.ts.map +1 -0
- package/dist/routes/agent-releases.js +462 -0
- package/dist/routes/agent-releases.js.map +1 -0
- package/dist/routes/agents.d.ts +7 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +38 -4
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/approvals.d.ts.map +1 -1
- package/dist/routes/approvals.js +27 -9
- package/dist/routes/approvals.js.map +1 -1
- package/dist/routes/audit.d.ts.map +1 -1
- package/dist/routes/audit.js +7 -0
- package/dist/routes/audit.js.map +1 -1
- package/dist/routes/auth.js +1 -1
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/blocks.d.ts.map +1 -1
- package/dist/routes/blocks.js +37 -12
- package/dist/routes/blocks.js.map +1 -1
- package/dist/routes/conversations.d.ts +0 -7
- package/dist/routes/conversations.d.ts.map +1 -1
- package/dist/routes/conversations.js +19 -3
- package/dist/routes/conversations.js.map +1 -1
- package/dist/routes/deployments.d.ts +6 -0
- package/dist/routes/deployments.d.ts.map +1 -1
- package/dist/routes/deployments.js +49 -5
- package/dist/routes/deployments.js.map +1 -1
- package/dist/routes/env.d.ts.map +1 -1
- package/dist/routes/env.js +1 -0
- package/dist/routes/env.js.map +1 -1
- package/dist/routes/eval-comparison.d.ts +4 -2
- package/dist/routes/eval-comparison.d.ts.map +1 -1
- package/dist/routes/eval-comparison.js +59 -10
- package/dist/routes/eval-comparison.js.map +1 -1
- package/dist/routes/eval-runs.d.ts +7 -1
- package/dist/routes/eval-runs.d.ts.map +1 -1
- package/dist/routes/eval-runs.js +34 -3
- package/dist/routes/eval-runs.js.map +1 -1
- package/dist/routes/eval-versions.d.ts +25 -0
- package/dist/routes/eval-versions.d.ts.map +1 -0
- package/dist/routes/eval-versions.js +66 -0
- package/dist/routes/eval-versions.js.map +1 -0
- package/dist/routes/flows.d.ts +14 -7
- package/dist/routes/flows.d.ts.map +1 -1
- package/dist/routes/flows.js +14 -8
- package/dist/routes/flows.js.map +1 -1
- package/dist/routes/gate-policies.d.ts +19 -0
- package/dist/routes/gate-policies.d.ts.map +1 -0
- package/dist/routes/gate-policies.js +191 -0
- package/dist/routes/gate-policies.js.map +1 -0
- package/dist/routes/gate-policy-spec.d.ts +17 -0
- package/dist/routes/gate-policy-spec.d.ts.map +1 -0
- package/dist/routes/gate-policy-spec.js +192 -0
- package/dist/routes/gate-policy-spec.js.map +1 -0
- package/dist/routes/gate-policy-wire.d.ts +3 -0
- package/dist/routes/gate-policy-wire.d.ts.map +1 -0
- package/dist/routes/gate-policy-wire.js +18 -0
- package/dist/routes/gate-policy-wire.js.map +1 -0
- package/dist/routes/guardrails.d.ts.map +1 -1
- package/dist/routes/guardrails.js +4 -0
- package/dist/routes/guardrails.js.map +1 -1
- package/dist/routes/hierarchy-errors.d.ts +21 -0
- package/dist/routes/hierarchy-errors.d.ts.map +1 -1
- package/dist/routes/hierarchy-errors.js +21 -0
- package/dist/routes/hierarchy-errors.js.map +1 -1
- package/dist/routes/judged-suites.js +7 -0
- package/dist/routes/judged-suites.js.map +1 -1
- package/dist/routes/judgments.d.ts +4 -1
- package/dist/routes/judgments.d.ts.map +1 -1
- package/dist/routes/judgments.js +92 -19
- package/dist/routes/judgments.js.map +1 -1
- package/dist/routes/live-scope-wire.d.ts +32 -0
- package/dist/routes/live-scope-wire.d.ts.map +1 -0
- package/dist/routes/live-scope-wire.js +71 -0
- package/dist/routes/live-scope-wire.js.map +1 -0
- package/dist/routes/policies.d.ts +6 -3
- package/dist/routes/policies.d.ts.map +1 -1
- package/dist/routes/policies.js +55 -3
- package/dist/routes/policies.js.map +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +59 -9
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/retention.d.ts.map +1 -1
- package/dist/routes/retention.js +18 -2
- package/dist/routes/retention.js.map +1 -1
- package/dist/routes/reviewers.d.ts +8 -1
- package/dist/routes/reviewers.d.ts.map +1 -1
- package/dist/routes/reviewers.js +20 -3
- package/dist/routes/reviewers.js.map +1 -1
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +23 -13
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/secrets.d.ts.map +1 -1
- package/dist/routes/secrets.js +2 -0
- package/dist/routes/secrets.js.map +1 -1
- package/dist/routes/segments.d.ts +17 -0
- package/dist/routes/segments.d.ts.map +1 -0
- package/dist/routes/segments.js +68 -0
- package/dist/routes/segments.js.map +1 -0
- package/dist/routes/teams.d.ts.map +1 -1
- package/dist/routes/teams.js +53 -8
- package/dist/routes/teams.js.map +1 -1
- package/dist/routes/tools.d.ts.map +1 -1
- package/dist/routes/tools.js +4 -0
- package/dist/routes/tools.js.map +1 -1
- package/dist/routes/uuid-param.d.ts +11 -0
- package/dist/routes/uuid-param.d.ts.map +1 -0
- package/dist/routes/uuid-param.js +19 -0
- package/dist/routes/uuid-param.js.map +1 -0
- package/dist/tool-binding.d.ts +8 -0
- package/dist/tool-binding.d.ts.map +1 -1
- package/openapi.json +6484 -2402
- package/package.json +21 -21
- package/src/agent-binding.ts +21 -2
- package/src/agent-pins.ts +3 -1
- package/src/app.ts +47 -4
- package/src/deploy-versions.ts +12 -15
- package/src/derive-agent-version.ts +12 -1
- package/src/errors.ts +26 -0
- package/src/eval-case-binding.ts +7 -0
- package/src/eval-run-binding.ts +31 -3
- package/src/eval-run-dispatcher.ts +3 -0
- package/src/flow-binding.ts +9 -0
- package/src/flow-pins.ts +49 -9
- package/src/gate-policy-binding.ts +171 -0
- package/src/gate.ts +467 -0
- package/src/guardrail-binding.ts +9 -0
- package/src/handler-binding.ts +17 -2
- package/src/index.ts +47 -1
- package/src/judged-dispatcher.ts +100 -9
- package/src/judgment-binding.ts +62 -0
- package/src/live-version-binding.ts +237 -0
- package/src/middleware/authorize.ts +18 -2
- package/src/middleware/project-ref.ts +88 -0
- package/src/openapi/generate.ts +5 -0
- package/src/openapi/operations.ts +664 -27
- package/src/openapi/schemas.ts +1175 -33
- package/src/publish-refused.ts +31 -0
- package/src/registry-read-only.ts +43 -0
- package/src/retention-binding.ts +30 -0
- package/src/routes/agent-releases.ts +581 -0
- package/src/routes/agents.ts +53 -3
- package/src/routes/approvals.ts +36 -8
- package/src/routes/audit.ts +10 -0
- package/src/routes/auth.ts +1 -1
- package/src/routes/blocks.ts +39 -14
- package/src/routes/conversations.ts +31 -3
- package/src/routes/deployments.ts +75 -5
- package/src/routes/env.ts +1 -0
- package/src/routes/eval-comparison.ts +59 -11
- package/src/routes/eval-runs.ts +46 -3
- package/src/routes/eval-versions.ts +110 -0
- package/src/routes/flows.ts +34 -11
- package/src/routes/gate-policies.ts +226 -0
- package/src/routes/gate-policy-spec.ts +229 -0
- package/src/routes/gate-policy-wire.ts +20 -0
- package/src/routes/guardrails.ts +7 -0
- package/src/routes/hierarchy-errors.ts +23 -0
- package/src/routes/judged-suites.ts +5 -0
- package/src/routes/judgments.ts +107 -23
- package/src/routes/live-scope-wire.ts +90 -0
- package/src/routes/policies.ts +61 -3
- package/src/routes/projects.ts +72 -9
- package/src/routes/retention.ts +21 -2
- package/src/routes/reviewers.ts +23 -4
- package/src/routes/runs.ts +34 -20
- package/src/routes/secrets.ts +2 -0
- package/src/routes/segments.ts +75 -0
- package/src/routes/teams.ts +66 -8
- package/src/routes/tools.ts +7 -0
- package/src/routes/uuid-param.ts +28 -0
- package/src/tool-binding.ts +9 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { AgentRegistryBinding } from './agent-binding.js';
|
|
5
|
+
import type { FlowRegistryBinding } from './flow-binding.js';
|
|
6
|
+
import type { GuardrailRegistryBinding } from './guardrail-binding.js';
|
|
7
|
+
import type { ToolRegistryBinding } from './tool-binding.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A deploy's primitive came back from its registry with an outcome other
|
|
11
|
+
* than `ok` or `already-registered` (e.g. `project-not-found`): the deploy
|
|
12
|
+
* stops, what it published is rolled back, and the route answers with
|
|
13
|
+
* that outcome's own status and code (T205). Before, such an outcome was
|
|
14
|
+
* skipped, and the deployment was recorded without that primitive.
|
|
15
|
+
*/
|
|
16
|
+
export class PublishRefused extends Error {
|
|
17
|
+
constructor(
|
|
18
|
+
readonly primitive: 'tool' | 'guardrail' | 'agent' | 'flow',
|
|
19
|
+
readonly id: string,
|
|
20
|
+
readonly code: Exclude<
|
|
21
|
+
| Awaited<ReturnType<ToolRegistryBinding['publish']>>['kind']
|
|
22
|
+
| Awaited<ReturnType<GuardrailRegistryBinding['register']>>['kind']
|
|
23
|
+
| Awaited<ReturnType<AgentRegistryBinding['publish']>>['kind']
|
|
24
|
+
| Awaited<ReturnType<FlowRegistryBinding['publish']>>['kind'],
|
|
25
|
+
'ok' | 'already-registered'
|
|
26
|
+
>,
|
|
27
|
+
) {
|
|
28
|
+
super(`The ${primitive} ${id} wasn't published: ${code}`);
|
|
29
|
+
this.name = 'PublishRefused';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { Context, MiddlewareHandler } from 'hono';
|
|
5
|
+
|
|
6
|
+
import { statusFor, toWireError } from './errors.js';
|
|
7
|
+
import type { AppEnv } from './types.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A registry that takes no writes: it serves its definitions from
|
|
11
|
+
* somewhere else (under `kindgi dev`, the pack's files). A binding that
|
|
12
|
+
* sets it has every write refused before the binding is called:
|
|
13
|
+
* publish, unregister and reinstate (and, for agents, deriving a
|
|
14
|
+
* version), and a deploy that would publish into it. The refusal is
|
|
15
|
+
* `409 registry-read-only` with `reason` as its message.
|
|
16
|
+
*/
|
|
17
|
+
export interface RegistryReadOnly {
|
|
18
|
+
/** Why, and what to do instead, in plain words: the refusal's message. */
|
|
19
|
+
readonly reason: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The refusal of a write to a read-only registry. */
|
|
23
|
+
export function refuseReadOnly(c: Context<AppEnv>, readOnly: RegistryReadOnly) {
|
|
24
|
+
c.status(statusFor('registry-read-only') as never);
|
|
25
|
+
return c.json(
|
|
26
|
+
toWireError({ code: 'registry-read-only', message: readOnly.reason }, c.get('requestId')),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A router's writes (every method but GET and HEAD) are refused while
|
|
32
|
+
* its registry is read-only. Read at request time, so a binding can
|
|
33
|
+
* become writable without a restart.
|
|
34
|
+
*/
|
|
35
|
+
export function refuseWritesWhenReadOnly(
|
|
36
|
+
readOnly: () => RegistryReadOnly | undefined,
|
|
37
|
+
): MiddlewareHandler<AppEnv> {
|
|
38
|
+
return async (c, next) => {
|
|
39
|
+
const marker = readOnly();
|
|
40
|
+
if (marker === undefined || c.req.method === 'GET' || c.req.method === 'HEAD') return next();
|
|
41
|
+
return refuseReadOnly(c, marker);
|
|
42
|
+
};
|
|
43
|
+
}
|
package/src/retention-binding.ts
CHANGED
|
@@ -35,9 +35,12 @@ export interface RetentionBinding {
|
|
|
35
35
|
export interface RetentionScheduledInput {
|
|
36
36
|
readonly tenantId: TenantId;
|
|
37
37
|
readonly domain?: RetentionDomain;
|
|
38
|
+
/** Rows per domain at most: each domain is read up to `limit`. */
|
|
38
39
|
readonly limit: number;
|
|
39
40
|
readonly pastGraceOnly?: boolean;
|
|
40
41
|
readonly now?: Date;
|
|
42
|
+
/** Where a previous page stopped (its `nextCursor`, the runtime's own encoding). */
|
|
43
|
+
readonly cursor?: string;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
export interface RetentionScheduledItem {
|
|
@@ -57,6 +60,31 @@ export interface RetentionScheduledPage {
|
|
|
57
60
|
readonly domainsMissingAdapter: readonly RetentionDomain[];
|
|
58
61
|
/** Domains that have an adapter but no matching policy — tombstones sit forever. */
|
|
59
62
|
readonly unpolicedDomains: readonly RetentionDomain[];
|
|
63
|
+
/** Domains more than one retention policy covers (see `RetentionPolicyConflict`). */
|
|
64
|
+
readonly conflicts?: readonly RetentionPolicyConflict[];
|
|
65
|
+
/**
|
|
66
|
+
* More rows are scheduled than this page holds: some domain stopped at
|
|
67
|
+
* `limit`. A runtime that doesn't say leaves it out, and the route then
|
|
68
|
+
* reports `true` when some domain's rows fill `limit` (there may be more).
|
|
69
|
+
*/
|
|
70
|
+
readonly hasMore?: boolean;
|
|
71
|
+
/** Pass as `cursor` to continue where this page stopped. Absent: nothing more, or no way to continue. */
|
|
72
|
+
readonly nextCursor?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A domain more than one retention policy covers. Publishing refuses a
|
|
77
|
+
* second policy for a domain (`409 policy-scope-taken`), so only policies
|
|
78
|
+
* stored before that rule can do this. The one whose latest version is
|
|
79
|
+
* highest applies, and on equal versions the lower policy id; unregister
|
|
80
|
+
* the others.
|
|
81
|
+
*/
|
|
82
|
+
export interface RetentionPolicyConflict {
|
|
83
|
+
readonly domain: RetentionDomain;
|
|
84
|
+
/** Every policy id that covers the domain, sorted. */
|
|
85
|
+
readonly policyIds: readonly string[];
|
|
86
|
+
/** The one of them that applies. */
|
|
87
|
+
readonly appliedPolicyId: string;
|
|
60
88
|
}
|
|
61
89
|
|
|
62
90
|
export interface RetentionSweepInput {
|
|
@@ -75,4 +103,6 @@ export interface RetentionSweepResult {
|
|
|
75
103
|
readonly missingAdapter?: true;
|
|
76
104
|
}[];
|
|
77
105
|
readonly totalPurged: number;
|
|
106
|
+
/** Domains more than one retention policy covers (see `RetentionPolicyConflict`). */
|
|
107
|
+
readonly conflicts?: readonly RetentionPolicyConflict[];
|
|
78
108
|
}
|