@generacy-ai/control-plane 0.0.0-preview-20260507200146
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 +191 -0
- package/README.md +66 -0
- package/dist/bin/control-plane.d.ts +3 -0
- package/dist/bin/control-plane.d.ts.map +1 -0
- package/dist/bin/control-plane.js +36 -0
- package/dist/bin/control-plane.js.map +1 -0
- package/dist/src/context.d.ts +8 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +20 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/errors.d.ts +16 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +37 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/relay-events.d.ts +5 -0
- package/dist/src/relay-events.d.ts.map +1 -0
- package/dist/src/relay-events.js +9 -0
- package/dist/src/relay-events.js.map +1 -0
- package/dist/src/router.d.ts +4 -0
- package/dist/src/router.d.ts.map +1 -0
- package/dist/src/router.js +83 -0
- package/dist/src/router.js.map +1 -0
- package/dist/src/routes/audit.d.ts +10 -0
- package/dist/src/routes/audit.d.ts.map +1 -0
- package/dist/src/routes/audit.js +38 -0
- package/dist/src/routes/audit.js.map +1 -0
- package/dist/src/routes/credentials.d.ts +5 -0
- package/dist/src/routes/credentials.d.ts.map +1 -0
- package/dist/src/routes/credentials.js +23 -0
- package/dist/src/routes/credentials.js.map +1 -0
- package/dist/src/routes/lifecycle.d.ts +4 -0
- package/dist/src/routes/lifecycle.d.ts.map +1 -0
- package/dist/src/routes/lifecycle.js +80 -0
- package/dist/src/routes/lifecycle.js.map +1 -0
- package/dist/src/routes/roles.d.ts +5 -0
- package/dist/src/routes/roles.d.ts.map +1 -0
- package/dist/src/routes/roles.js +20 -0
- package/dist/src/routes/roles.js.map +1 -0
- package/dist/src/routes/state.d.ts +4 -0
- package/dist/src/routes/state.d.ts.map +1 -0
- package/dist/src/routes/state.js +17 -0
- package/dist/src/routes/state.js.map +1 -0
- package/dist/src/routes/status.d.ts +4 -0
- package/dist/src/routes/status.d.ts.map +1 -0
- package/dist/src/routes/status.js +29 -0
- package/dist/src/routes/status.js.map +1 -0
- package/dist/src/schemas.d.ts +314 -0
- package/dist/src/schemas.d.ts.map +1 -0
- package/dist/src/schemas.js +94 -0
- package/dist/src/schemas.js.map +1 -0
- package/dist/src/server.d.ts +9 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +70 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/services/code-server-manager.d.ts +44 -0
- package/dist/src/services/code-server-manager.d.ts.map +1 -0
- package/dist/src/services/code-server-manager.js +164 -0
- package/dist/src/services/code-server-manager.js.map +1 -0
- package/dist/src/services/default-role-writer.d.ts +7 -0
- package/dist/src/services/default-role-writer.d.ts.map +1 -0
- package/dist/src/services/default-role-writer.js +44 -0
- package/dist/src/services/default-role-writer.js.map +1 -0
- package/dist/src/services/peer-repo-cloner.d.ts +12 -0
- package/dist/src/services/peer-repo-cloner.d.ts.map +1 -0
- package/dist/src/services/peer-repo-cloner.js +80 -0
- package/dist/src/services/peer-repo-cloner.js.map +1 -0
- package/dist/src/services/tunnel-handler.d.ts +30 -0
- package/dist/src/services/tunnel-handler.d.ts.map +1 -0
- package/dist/src/services/tunnel-handler.js +110 -0
- package/dist/src/services/tunnel-handler.js.map +1 -0
- package/dist/src/state.d.ts +8 -0
- package/dist/src/state.d.ts.map +1 -0
- package/dist/src/state.js +39 -0
- package/dist/src/state.js.map +1 -0
- package/dist/src/types.d.ts +12 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/util/read-body.d.ts +3 -0
- package/dist/src/util/read-body.d.ts.map +1 -0
- package/dist/src/util/read-body.js +9 -0
- package/dist/src/util/read-body.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/routes/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,eAAe,CAAC;AAGhE,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,CAAC,eAAe,EAC1B,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { requireActor } from '../context.js';
|
|
2
|
+
import { readBody } from '../util/read-body.js';
|
|
3
|
+
export async function handleGetCredential(_req, res, _actor, params) {
|
|
4
|
+
const body = {
|
|
5
|
+
id: params['id'] ?? 'unknown',
|
|
6
|
+
type: 'api-key',
|
|
7
|
+
backend: 'env',
|
|
8
|
+
backendKey: 'API_KEY',
|
|
9
|
+
status: 'active',
|
|
10
|
+
createdAt: new Date().toISOString(),
|
|
11
|
+
};
|
|
12
|
+
res.setHeader('Content-Type', 'application/json');
|
|
13
|
+
res.writeHead(200);
|
|
14
|
+
res.end(JSON.stringify(body));
|
|
15
|
+
}
|
|
16
|
+
export async function handlePutCredential(req, res, actor, _params) {
|
|
17
|
+
requireActor(actor);
|
|
18
|
+
await readBody(req);
|
|
19
|
+
res.setHeader('Content-Type', 'application/json');
|
|
20
|
+
res.writeHead(200);
|
|
21
|
+
res.end(JSON.stringify({ ok: true }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../src/routes/credentials.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAA0B,EAC1B,GAAwB,EACxB,MAAoB,EACpB,MAA8B;IAE9B,MAAM,IAAI,GAAG;QACX,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,SAAS;QAC7B,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;IAEF,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAClD,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAyB,EACzB,GAAwB,EACxB,KAAmB,EACnB,OAA+B;IAE/B,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEpB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAClD,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type http from 'node:http';
|
|
2
|
+
import { type ActorContext } from '../context.js';
|
|
3
|
+
export declare function handlePostLifecycle(req: http.IncomingMessage, res: http.ServerResponse, actor: ActorContext, params: Record<string, string>): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/routes/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,eAAe,CAAC;AAQhE,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CAkFf"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { requireActor } from '../context.js';
|
|
2
|
+
import { LifecycleActionSchema, ClonePeerReposBodySchema, SetDefaultRoleBodySchema } from '../schemas.js';
|
|
3
|
+
import { ControlPlaneError } from '../errors.js';
|
|
4
|
+
import { getCodeServerManager } from '../services/code-server-manager.js';
|
|
5
|
+
import { readBody } from '../util/read-body.js';
|
|
6
|
+
import { setDefaultRole } from '../services/default-role-writer.js';
|
|
7
|
+
import { clonePeerRepos } from '../services/peer-repo-cloner.js';
|
|
8
|
+
export async function handlePostLifecycle(req, res, actor, params) {
|
|
9
|
+
requireActor(actor);
|
|
10
|
+
const action = params['action'] ?? '';
|
|
11
|
+
const parsed = LifecycleActionSchema.safeParse(action);
|
|
12
|
+
if (!parsed.success) {
|
|
13
|
+
throw new ControlPlaneError('UNKNOWN_ACTION', `Unknown lifecycle action: ${action}`);
|
|
14
|
+
}
|
|
15
|
+
res.setHeader('Content-Type', 'application/json');
|
|
16
|
+
if (parsed.data === 'code-server-start') {
|
|
17
|
+
const manager = getCodeServerManager();
|
|
18
|
+
let result;
|
|
19
|
+
try {
|
|
20
|
+
result = await manager.start();
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
throw new ControlPlaneError('SERVICE_UNAVAILABLE', err instanceof Error ? err.message : 'Failed to start code-server');
|
|
24
|
+
}
|
|
25
|
+
res.writeHead(200);
|
|
26
|
+
res.end(JSON.stringify(result));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (parsed.data === 'code-server-stop') {
|
|
30
|
+
const manager = getCodeServerManager();
|
|
31
|
+
await manager.stop();
|
|
32
|
+
res.writeHead(200);
|
|
33
|
+
res.end(JSON.stringify({ accepted: true, action: parsed.data }));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (parsed.data === 'set-default-role') {
|
|
37
|
+
const raw = await readBody(req);
|
|
38
|
+
let body;
|
|
39
|
+
try {
|
|
40
|
+
body = JSON.parse(raw);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
throw new ControlPlaneError('INVALID_REQUEST', 'Invalid JSON body');
|
|
44
|
+
}
|
|
45
|
+
const bodyResult = SetDefaultRoleBodySchema.safeParse(body);
|
|
46
|
+
if (!bodyResult.success) {
|
|
47
|
+
throw new ControlPlaneError('INVALID_REQUEST', 'Invalid set-default-role body', {
|
|
48
|
+
errors: bodyResult.error.issues.map((i) => i.message),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
await setDefaultRole({ role: bodyResult.data.role });
|
|
52
|
+
res.writeHead(200);
|
|
53
|
+
res.end(JSON.stringify({ accepted: true, action: parsed.data }));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (parsed.data === 'clone-peer-repos') {
|
|
57
|
+
const raw = await readBody(req);
|
|
58
|
+
let body;
|
|
59
|
+
try {
|
|
60
|
+
body = JSON.parse(raw);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
throw new ControlPlaneError('INVALID_REQUEST', 'Invalid JSON body');
|
|
64
|
+
}
|
|
65
|
+
const bodyResult = ClonePeerReposBodySchema.safeParse(body);
|
|
66
|
+
if (!bodyResult.success) {
|
|
67
|
+
throw new ControlPlaneError('INVALID_REQUEST', 'Invalid clone-peer-repos body', {
|
|
68
|
+
errors: bodyResult.error.issues.map((i) => i.message),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
await clonePeerRepos({ repos: bodyResult.data.repos, token: bodyResult.data.token });
|
|
72
|
+
res.writeHead(200);
|
|
73
|
+
res.end(JSON.stringify({ accepted: true, action: parsed.data }));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// 'stop' — stub for v1.5
|
|
77
|
+
res.writeHead(200);
|
|
78
|
+
res.end(JSON.stringify({ accepted: true, action: parsed.data }));
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../src/routes/lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAyB,EACzB,GAAwB,EACxB,KAAmB,EACnB,MAA8B;IAE9B,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,MAAM,GAAG,MAAM,CAA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tE,CAAC;QAED,MAAM,UAAU,GAAG,wBAAwB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACxB,MAAM,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,+BAA+B,EAAE;gBAC9E,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;aACtD,CAAC,CAAC;QACL,CAAC;QAED,MAAM,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACrF,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACjE,OAAO;IACT,CAAC;IAED,yBAAyB;IACzB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type http from 'node:http';
|
|
2
|
+
import { type ActorContext } from '../context.js';
|
|
3
|
+
export declare function handleGetRole(_req: http.IncomingMessage, res: http.ServerResponse, _actor: ActorContext, params: Record<string, string>): Promise<void>;
|
|
4
|
+
export declare function handlePutRole(req: http.IncomingMessage, res: http.ServerResponse, actor: ActorContext, _params: Record<string, string>): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../src/routes/roles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,eAAe,CAAC;AAGhE,wBAAsB,aAAa,CACjC,IAAI,EAAE,IAAI,CAAC,eAAe,EAC1B,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wBAAsB,aAAa,CACjC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { requireActor } from '../context.js';
|
|
2
|
+
import { readBody } from '../util/read-body.js';
|
|
3
|
+
export async function handleGetRole(_req, res, _actor, params) {
|
|
4
|
+
const body = {
|
|
5
|
+
id: params['id'] ?? 'unknown',
|
|
6
|
+
description: 'Stub role',
|
|
7
|
+
credentials: [],
|
|
8
|
+
};
|
|
9
|
+
res.setHeader('Content-Type', 'application/json');
|
|
10
|
+
res.writeHead(200);
|
|
11
|
+
res.end(JSON.stringify(body));
|
|
12
|
+
}
|
|
13
|
+
export async function handlePutRole(req, res, actor, _params) {
|
|
14
|
+
requireActor(actor);
|
|
15
|
+
await readBody(req);
|
|
16
|
+
res.setHeader('Content-Type', 'application/json');
|
|
17
|
+
res.writeHead(200);
|
|
18
|
+
res.end(JSON.stringify({ ok: true }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../../src/routes/roles.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAA0B,EAC1B,GAAwB,EACxB,MAAoB,EACpB,MAA8B;IAE9B,MAAM,IAAI,GAAG;QACX,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,SAAS;QAC7B,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,EAAE;KAChB,CAAC;IAEF,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAClD,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAyB,EACzB,GAAwB,EACxB,KAAmB,EACnB,OAA+B;IAE/B,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEpB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAClD,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type http from 'node:http';
|
|
2
|
+
import type { ActorContext } from '../context.js';
|
|
3
|
+
export declare function handleGetState(_req: http.IncomingMessage, res: http.ServerResponse, _actor: ActorContext, _params: Record<string, string>): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/routes/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,CAAC,eAAe,EAC1B,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getClusterState } from '../state.js';
|
|
2
|
+
export async function handleGetState(_req, res, _actor, _params) {
|
|
3
|
+
const state = getClusterState();
|
|
4
|
+
const body = {
|
|
5
|
+
status: state.status,
|
|
6
|
+
deploymentMode: state.deploymentMode,
|
|
7
|
+
variant: state.variant,
|
|
8
|
+
lastSeen: state.lastSeen,
|
|
9
|
+
};
|
|
10
|
+
if (state.statusReason !== undefined) {
|
|
11
|
+
body.statusReason = state.statusReason;
|
|
12
|
+
}
|
|
13
|
+
res.setHeader('Content-Type', 'application/json');
|
|
14
|
+
res.writeHead(200);
|
|
15
|
+
res.end(JSON.stringify(body));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/routes/state.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAA0B,EAC1B,GAAwB,EACxB,MAAoB,EACpB,OAA+B;IAE/B,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,MAAM,IAAI,GAA4B;QACpC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC;IAEF,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IACzC,CAAC;IAED,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAClD,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type http from 'node:http';
|
|
2
|
+
import type { ActorContext } from '../context.js';
|
|
3
|
+
export declare function handlePostStatus(req: http.IncomingMessage, res: http.ServerResponse, _actor: ActorContext, _params: Record<string, string>): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/routes/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAMlD,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ControlPlaneError } from '../errors.js';
|
|
2
|
+
import { readBody } from '../util/read-body.js';
|
|
3
|
+
import { StatusUpdateSchema } from '../schemas.js';
|
|
4
|
+
import { updateClusterStatus } from '../state.js';
|
|
5
|
+
export async function handlePostStatus(req, res, _actor, _params) {
|
|
6
|
+
const raw = await readBody(req);
|
|
7
|
+
let parsed;
|
|
8
|
+
try {
|
|
9
|
+
parsed = JSON.parse(raw);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
throw new ControlPlaneError('INVALID_REQUEST', 'Invalid JSON body');
|
|
13
|
+
}
|
|
14
|
+
const result = StatusUpdateSchema.safeParse(parsed);
|
|
15
|
+
if (!result.success) {
|
|
16
|
+
throw new ControlPlaneError('INVALID_REQUEST', 'Invalid status update', {
|
|
17
|
+
errors: result.error.issues.map((i) => i.message),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
updateClusterStatus(result.data.status, result.data.statusReason);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
throw new ControlPlaneError('INVALID_REQUEST', err instanceof Error ? err.message : 'Invalid state transition');
|
|
25
|
+
}
|
|
26
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
27
|
+
res.end(JSON.stringify({ ok: true }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/routes/status.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAyB,EACzB,GAAwB,EACxB,MAAoB,EACpB,OAA+B;IAE/B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,MAAM,GAAG,kBAAkB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,uBAAuB,EAAE;YACtE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;SAClD,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC;QACH,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,iBAAiB,CACzB,iBAAiB,EACjB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAChE,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { CredentialEntrySchema, type CredentialEntry, RoleConfigSchema, type RoleConfig, RoleCredentialRefSchema, type RoleCredentialRef, } from '@generacy-ai/credhelper';
|
|
3
|
+
export declare const ClusterStatusSchema: z.ZodEnum<["bootstrapping", "ready", "degraded", "error"]>;
|
|
4
|
+
export type ClusterStatus = z.infer<typeof ClusterStatusSchema>;
|
|
5
|
+
export declare const DeploymentModeSchema: z.ZodEnum<["local", "cloud"]>;
|
|
6
|
+
export type DeploymentMode = z.infer<typeof DeploymentModeSchema>;
|
|
7
|
+
export declare const ClusterVariantSchema: z.ZodEnum<["cluster-base", "cluster-microservices"]>;
|
|
8
|
+
export type ClusterVariant = z.infer<typeof ClusterVariantSchema>;
|
|
9
|
+
export declare const ClusterStateSchema: z.ZodObject<{
|
|
10
|
+
status: z.ZodEnum<["bootstrapping", "ready", "degraded", "error"]>;
|
|
11
|
+
deploymentMode: z.ZodEnum<["local", "cloud"]>;
|
|
12
|
+
variant: z.ZodEnum<["cluster-base", "cluster-microservices"]>;
|
|
13
|
+
lastSeen: z.ZodString;
|
|
14
|
+
statusReason: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
status: "bootstrapping" | "ready" | "degraded" | "error";
|
|
17
|
+
deploymentMode: "local" | "cloud";
|
|
18
|
+
variant: "cluster-base" | "cluster-microservices";
|
|
19
|
+
lastSeen: string;
|
|
20
|
+
statusReason?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
status: "bootstrapping" | "ready" | "degraded" | "error";
|
|
23
|
+
deploymentMode: "local" | "cloud";
|
|
24
|
+
variant: "cluster-base" | "cluster-microservices";
|
|
25
|
+
lastSeen: string;
|
|
26
|
+
statusReason?: string | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export type ClusterState = z.infer<typeof ClusterStateSchema>;
|
|
29
|
+
export declare const StatusUpdateSchema: z.ZodObject<{
|
|
30
|
+
status: z.ZodEnum<["bootstrapping", "ready", "degraded", "error"]>;
|
|
31
|
+
statusReason: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
status: "bootstrapping" | "ready" | "degraded" | "error";
|
|
34
|
+
statusReason?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
status: "bootstrapping" | "ready" | "degraded" | "error";
|
|
37
|
+
statusReason?: string | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
export type StatusUpdate = z.infer<typeof StatusUpdateSchema>;
|
|
40
|
+
export declare const LifecycleActionSchema: z.ZodEnum<["clone-peer-repos", "set-default-role", "code-server-start", "code-server-stop", "stop"]>;
|
|
41
|
+
export type LifecycleAction = z.infer<typeof LifecycleActionSchema>;
|
|
42
|
+
export declare const ClonePeerReposBodySchema: z.ZodObject<{
|
|
43
|
+
repos: z.ZodArray<z.ZodString, "many">;
|
|
44
|
+
token: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
repos: string[];
|
|
47
|
+
token?: string | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
repos: string[];
|
|
50
|
+
token?: string | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
export type ClonePeerReposBody = z.infer<typeof ClonePeerReposBodySchema>;
|
|
53
|
+
export declare const SetDefaultRoleBodySchema: z.ZodObject<{
|
|
54
|
+
role: z.ZodString;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
role: string;
|
|
57
|
+
}, {
|
|
58
|
+
role: string;
|
|
59
|
+
}>;
|
|
60
|
+
export type SetDefaultRoleBody = z.infer<typeof SetDefaultRoleBodySchema>;
|
|
61
|
+
export declare const LifecycleResponseSchema: z.ZodObject<{
|
|
62
|
+
accepted: z.ZodLiteral<true>;
|
|
63
|
+
action: z.ZodEnum<["clone-peer-repos", "set-default-role", "code-server-start", "code-server-stop", "stop"]>;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
accepted: true;
|
|
66
|
+
action: "clone-peer-repos" | "set-default-role" | "code-server-start" | "code-server-stop" | "stop";
|
|
67
|
+
}, {
|
|
68
|
+
accepted: true;
|
|
69
|
+
action: "clone-peer-repos" | "set-default-role" | "code-server-start" | "code-server-stop" | "stop";
|
|
70
|
+
}>;
|
|
71
|
+
export type LifecycleResponse = z.infer<typeof LifecycleResponseSchema>;
|
|
72
|
+
export declare const CodeServerStartResponseSchema: z.ZodObject<{
|
|
73
|
+
status: z.ZodEnum<["starting", "running"]>;
|
|
74
|
+
socket_path: z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
status: "starting" | "running";
|
|
77
|
+
socket_path: string;
|
|
78
|
+
}, {
|
|
79
|
+
status: "starting" | "running";
|
|
80
|
+
socket_path: string;
|
|
81
|
+
}>;
|
|
82
|
+
export type CodeServerStartResponse = z.infer<typeof CodeServerStartResponseSchema>;
|
|
83
|
+
export declare const CredentialStubResponseSchema: z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
type: z.ZodString;
|
|
86
|
+
backend: z.ZodString;
|
|
87
|
+
backendKey: z.ZodString;
|
|
88
|
+
status: z.ZodEnum<["active", "pending", "error"]>;
|
|
89
|
+
createdAt: z.ZodString;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
type: string;
|
|
92
|
+
status: "error" | "active" | "pending";
|
|
93
|
+
id: string;
|
|
94
|
+
backend: string;
|
|
95
|
+
backendKey: string;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
}, {
|
|
98
|
+
type: string;
|
|
99
|
+
status: "error" | "active" | "pending";
|
|
100
|
+
id: string;
|
|
101
|
+
backend: string;
|
|
102
|
+
backendKey: string;
|
|
103
|
+
createdAt: string;
|
|
104
|
+
}>;
|
|
105
|
+
export type CredentialStubResponse = z.infer<typeof CredentialStubResponseSchema>;
|
|
106
|
+
export declare const AuditActionSchema: z.ZodEnum<["session.begin", "session.end", "credential.mint", "credential.resolve", "credential.refresh", "exposure.render", "proxy.docker", "proxy.localhost"]>;
|
|
107
|
+
export declare const AuditEntrySchema: z.ZodObject<{
|
|
108
|
+
timestamp: z.ZodString;
|
|
109
|
+
action: z.ZodEnum<["session.begin", "session.end", "credential.mint", "credential.resolve", "credential.refresh", "exposure.render", "proxy.docker", "proxy.localhost"]>;
|
|
110
|
+
actor: z.ZodObject<{
|
|
111
|
+
workerId: z.ZodString;
|
|
112
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
workerId: string;
|
|
115
|
+
sessionId?: string | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
workerId: string;
|
|
118
|
+
sessionId?: string | undefined;
|
|
119
|
+
}>;
|
|
120
|
+
clusterId: z.ZodString;
|
|
121
|
+
credentialId: z.ZodOptional<z.ZodString>;
|
|
122
|
+
role: z.ZodOptional<z.ZodString>;
|
|
123
|
+
pluginId: z.ZodOptional<z.ZodString>;
|
|
124
|
+
success: z.ZodBoolean;
|
|
125
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
126
|
+
exposureKind: z.ZodOptional<z.ZodString>;
|
|
127
|
+
proxy: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
method: z.ZodString;
|
|
129
|
+
path: z.ZodString;
|
|
130
|
+
decision: z.ZodEnum<["allow", "deny"]>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
path: string;
|
|
133
|
+
method: string;
|
|
134
|
+
decision: "allow" | "deny";
|
|
135
|
+
}, {
|
|
136
|
+
path: string;
|
|
137
|
+
method: string;
|
|
138
|
+
decision: "allow" | "deny";
|
|
139
|
+
}>>;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
action: "session.begin" | "session.end" | "credential.mint" | "credential.resolve" | "credential.refresh" | "exposure.render" | "proxy.docker" | "proxy.localhost";
|
|
142
|
+
timestamp: string;
|
|
143
|
+
actor: {
|
|
144
|
+
workerId: string;
|
|
145
|
+
sessionId?: string | undefined;
|
|
146
|
+
};
|
|
147
|
+
clusterId: string;
|
|
148
|
+
success: boolean;
|
|
149
|
+
role?: string | undefined;
|
|
150
|
+
credentialId?: string | undefined;
|
|
151
|
+
pluginId?: string | undefined;
|
|
152
|
+
errorCode?: string | undefined;
|
|
153
|
+
exposureKind?: string | undefined;
|
|
154
|
+
proxy?: {
|
|
155
|
+
path: string;
|
|
156
|
+
method: string;
|
|
157
|
+
decision: "allow" | "deny";
|
|
158
|
+
} | undefined;
|
|
159
|
+
}, {
|
|
160
|
+
action: "session.begin" | "session.end" | "credential.mint" | "credential.resolve" | "credential.refresh" | "exposure.render" | "proxy.docker" | "proxy.localhost";
|
|
161
|
+
timestamp: string;
|
|
162
|
+
actor: {
|
|
163
|
+
workerId: string;
|
|
164
|
+
sessionId?: string | undefined;
|
|
165
|
+
};
|
|
166
|
+
clusterId: string;
|
|
167
|
+
success: boolean;
|
|
168
|
+
role?: string | undefined;
|
|
169
|
+
credentialId?: string | undefined;
|
|
170
|
+
pluginId?: string | undefined;
|
|
171
|
+
errorCode?: string | undefined;
|
|
172
|
+
exposureKind?: string | undefined;
|
|
173
|
+
proxy?: {
|
|
174
|
+
path: string;
|
|
175
|
+
method: string;
|
|
176
|
+
decision: "allow" | "deny";
|
|
177
|
+
} | undefined;
|
|
178
|
+
}>;
|
|
179
|
+
export declare const AuditBatchSchema: z.ZodObject<{
|
|
180
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
181
|
+
timestamp: z.ZodString;
|
|
182
|
+
action: z.ZodEnum<["session.begin", "session.end", "credential.mint", "credential.resolve", "credential.refresh", "exposure.render", "proxy.docker", "proxy.localhost"]>;
|
|
183
|
+
actor: z.ZodObject<{
|
|
184
|
+
workerId: z.ZodString;
|
|
185
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
workerId: string;
|
|
188
|
+
sessionId?: string | undefined;
|
|
189
|
+
}, {
|
|
190
|
+
workerId: string;
|
|
191
|
+
sessionId?: string | undefined;
|
|
192
|
+
}>;
|
|
193
|
+
clusterId: z.ZodString;
|
|
194
|
+
credentialId: z.ZodOptional<z.ZodString>;
|
|
195
|
+
role: z.ZodOptional<z.ZodString>;
|
|
196
|
+
pluginId: z.ZodOptional<z.ZodString>;
|
|
197
|
+
success: z.ZodBoolean;
|
|
198
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
199
|
+
exposureKind: z.ZodOptional<z.ZodString>;
|
|
200
|
+
proxy: z.ZodOptional<z.ZodObject<{
|
|
201
|
+
method: z.ZodString;
|
|
202
|
+
path: z.ZodString;
|
|
203
|
+
decision: z.ZodEnum<["allow", "deny"]>;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
path: string;
|
|
206
|
+
method: string;
|
|
207
|
+
decision: "allow" | "deny";
|
|
208
|
+
}, {
|
|
209
|
+
path: string;
|
|
210
|
+
method: string;
|
|
211
|
+
decision: "allow" | "deny";
|
|
212
|
+
}>>;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
action: "session.begin" | "session.end" | "credential.mint" | "credential.resolve" | "credential.refresh" | "exposure.render" | "proxy.docker" | "proxy.localhost";
|
|
215
|
+
timestamp: string;
|
|
216
|
+
actor: {
|
|
217
|
+
workerId: string;
|
|
218
|
+
sessionId?: string | undefined;
|
|
219
|
+
};
|
|
220
|
+
clusterId: string;
|
|
221
|
+
success: boolean;
|
|
222
|
+
role?: string | undefined;
|
|
223
|
+
credentialId?: string | undefined;
|
|
224
|
+
pluginId?: string | undefined;
|
|
225
|
+
errorCode?: string | undefined;
|
|
226
|
+
exposureKind?: string | undefined;
|
|
227
|
+
proxy?: {
|
|
228
|
+
path: string;
|
|
229
|
+
method: string;
|
|
230
|
+
decision: "allow" | "deny";
|
|
231
|
+
} | undefined;
|
|
232
|
+
}, {
|
|
233
|
+
action: "session.begin" | "session.end" | "credential.mint" | "credential.resolve" | "credential.refresh" | "exposure.render" | "proxy.docker" | "proxy.localhost";
|
|
234
|
+
timestamp: string;
|
|
235
|
+
actor: {
|
|
236
|
+
workerId: string;
|
|
237
|
+
sessionId?: string | undefined;
|
|
238
|
+
};
|
|
239
|
+
clusterId: string;
|
|
240
|
+
success: boolean;
|
|
241
|
+
role?: string | undefined;
|
|
242
|
+
credentialId?: string | undefined;
|
|
243
|
+
pluginId?: string | undefined;
|
|
244
|
+
errorCode?: string | undefined;
|
|
245
|
+
exposureKind?: string | undefined;
|
|
246
|
+
proxy?: {
|
|
247
|
+
path: string;
|
|
248
|
+
method: string;
|
|
249
|
+
decision: "allow" | "deny";
|
|
250
|
+
} | undefined;
|
|
251
|
+
}>, "many">;
|
|
252
|
+
droppedSinceLastBatch: z.ZodNumber;
|
|
253
|
+
}, "strip", z.ZodTypeAny, {
|
|
254
|
+
entries: {
|
|
255
|
+
action: "session.begin" | "session.end" | "credential.mint" | "credential.resolve" | "credential.refresh" | "exposure.render" | "proxy.docker" | "proxy.localhost";
|
|
256
|
+
timestamp: string;
|
|
257
|
+
actor: {
|
|
258
|
+
workerId: string;
|
|
259
|
+
sessionId?: string | undefined;
|
|
260
|
+
};
|
|
261
|
+
clusterId: string;
|
|
262
|
+
success: boolean;
|
|
263
|
+
role?: string | undefined;
|
|
264
|
+
credentialId?: string | undefined;
|
|
265
|
+
pluginId?: string | undefined;
|
|
266
|
+
errorCode?: string | undefined;
|
|
267
|
+
exposureKind?: string | undefined;
|
|
268
|
+
proxy?: {
|
|
269
|
+
path: string;
|
|
270
|
+
method: string;
|
|
271
|
+
decision: "allow" | "deny";
|
|
272
|
+
} | undefined;
|
|
273
|
+
}[];
|
|
274
|
+
droppedSinceLastBatch: number;
|
|
275
|
+
}, {
|
|
276
|
+
entries: {
|
|
277
|
+
action: "session.begin" | "session.end" | "credential.mint" | "credential.resolve" | "credential.refresh" | "exposure.render" | "proxy.docker" | "proxy.localhost";
|
|
278
|
+
timestamp: string;
|
|
279
|
+
actor: {
|
|
280
|
+
workerId: string;
|
|
281
|
+
sessionId?: string | undefined;
|
|
282
|
+
};
|
|
283
|
+
clusterId: string;
|
|
284
|
+
success: boolean;
|
|
285
|
+
role?: string | undefined;
|
|
286
|
+
credentialId?: string | undefined;
|
|
287
|
+
pluginId?: string | undefined;
|
|
288
|
+
errorCode?: string | undefined;
|
|
289
|
+
exposureKind?: string | undefined;
|
|
290
|
+
proxy?: {
|
|
291
|
+
path: string;
|
|
292
|
+
method: string;
|
|
293
|
+
decision: "allow" | "deny";
|
|
294
|
+
} | undefined;
|
|
295
|
+
}[];
|
|
296
|
+
droppedSinceLastBatch: number;
|
|
297
|
+
}>;
|
|
298
|
+
export type AuditEntry = z.infer<typeof AuditEntrySchema>;
|
|
299
|
+
export type AuditBatch = z.infer<typeof AuditBatchSchema>;
|
|
300
|
+
export declare const ErrorResponseSchema: z.ZodObject<{
|
|
301
|
+
error: z.ZodString;
|
|
302
|
+
code: z.ZodString;
|
|
303
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
304
|
+
}, "strip", z.ZodTypeAny, {
|
|
305
|
+
error: string;
|
|
306
|
+
code: string;
|
|
307
|
+
details?: unknown;
|
|
308
|
+
}, {
|
|
309
|
+
error: string;
|
|
310
|
+
code: string;
|
|
311
|
+
details?: unknown;
|
|
312
|
+
}>;
|
|
313
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
314
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,qBAAqB,EACrB,KAAK,eAAe,EACpB,gBAAgB,EAChB,KAAK,UAAU,EACf,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,yBAAyB,CAAC;AAGjC,eAAO,MAAM,mBAAmB,4DAA0D,CAAC;AAC3F,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB,+BAA6B,CAAC;AAC/D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB,sDAAoD,CAAC;AACtF,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