@kici-dev/engine 0.0.0 → 0.1.1
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 +661 -0
- package/README.md +1 -6
- package/dist/audit/access-log-policy.d.ts +97 -0
- package/dist/audit/access-log-policy.js +195 -0
- package/dist/audit/activity.d.ts +156 -0
- package/dist/audit/activity.js +175 -0
- package/dist/audit/retention-policy.d.ts +157 -0
- package/dist/audit/retention-policy.js +364 -0
- package/dist/bundler/index.d.ts +3 -0
- package/dist/bundler/index.js +3 -0
- package/dist/bundler/rolldown-config.d.ts +41 -0
- package/dist/bundler/rolldown-config.js +40 -0
- package/dist/chunk-gOLHoazu.js +4 -0
- package/dist/env/environment-allowlist.d.ts +45 -0
- package/dist/env/environment-allowlist.js +69 -0
- package/dist/environment/index.d.ts +3 -0
- package/dist/environment/index.js +3 -0
- package/dist/environment/scope-resolver.d.ts +35 -0
- package/dist/environment/scope-resolver.js +77 -0
- package/dist/environment/types.d.ts +98 -0
- package/dist/environment/types.js +2 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +45 -0
- package/dist/labels.d.ts +106 -0
- package/dist/labels.js +162 -0
- package/dist/metrics/metric-catalog.generated.d.ts +400 -0
- package/dist/metrics/metric-catalog.generated.js +510 -0
- package/dist/protocol/dashboard-global-workflows.d.ts +9 -0
- package/dist/protocol/dashboard-global-workflows.js +3 -0
- package/dist/protocol/event-log-payload.d.ts +16 -0
- package/dist/protocol/event-log-payload.js +21 -0
- package/dist/protocol/messages/access-log.d.ts +545 -0
- package/dist/protocol/messages/access-log.js +175 -0
- package/dist/protocol/messages/actor.d.ts +100 -0
- package/dist/protocol/messages/actor.js +139 -0
- package/dist/protocol/messages/auth.d.ts +25 -0
- package/dist/protocol/messages/auth.js +36 -0
- package/dist/protocol/messages/browser.d.ts +369 -0
- package/dist/protocol/messages/browser.js +225 -0
- package/dist/protocol/messages/capabilities.d.ts +46 -0
- package/dist/protocol/messages/capabilities.js +42 -0
- package/dist/protocol/messages/common.d.ts +53 -0
- package/dist/protocol/messages/common.js +55 -0
- package/dist/protocol/messages/dashboard-global-workflows.d.ts +166 -0
- package/dist/protocol/messages/dashboard-global-workflows.js +80 -0
- package/dist/protocol/messages/dashboard.d.ts +4068 -0
- package/dist/protocol/messages/dashboard.js +1237 -0
- package/dist/protocol/messages/event-log.d.ts +49 -0
- package/dist/protocol/messages/event-log.js +45 -0
- package/dist/protocol/messages/execution-status.d.ts +164 -0
- package/dist/protocol/messages/execution-status.js +166 -0
- package/dist/protocol/messages/join.d.ts +18 -0
- package/dist/protocol/messages/join.js +28 -0
- package/dist/protocol/messages/log-pull.d.ts +27 -0
- package/dist/protocol/messages/log-pull.js +36 -0
- package/dist/protocol/messages/observe.d.ts +75 -0
- package/dist/protocol/messages/observe.js +70 -0
- package/dist/protocol/messages/orchestrator-agent.d.ts +606 -0
- package/dist/protocol/messages/orchestrator-agent.js +481 -0
- package/dist/protocol/messages/peer.d.ts +795 -0
- package/dist/protocol/messages/peer.js +372 -0
- package/dist/protocol/messages/platform-orchestrator.d.ts +1888 -0
- package/dist/protocol/messages/platform-orchestrator.js +379 -0
- package/dist/protocol/messages/run-events.d.ts +155 -0
- package/dist/protocol/messages/run-events.js +115 -0
- package/dist/protocol/messages/saas-orchestrator.d.ts +2179 -0
- package/dist/protocol/messages/source-registration.d.ts +103 -0
- package/dist/protocol/messages/source-registration.js +109 -0
- package/dist/protocol/messages/test-run.d.ts +59 -0
- package/dist/protocol/messages/test-run.js +52 -0
- package/dist/protocol/version.d.ts +12 -0
- package/dist/protocol/version.js +17 -0
- package/dist/provider/changed-files-fetcher.d.ts +24 -0
- package/dist/provider/changed-files-fetcher.js +2 -0
- package/dist/provider/check-run-conclusion.d.ts +15 -0
- package/dist/provider/check-run-conclusion.js +19 -0
- package/dist/provider/check-status-poster.d.ts +15 -0
- package/dist/provider/check-status-poster.js +2 -0
- package/dist/provider/clone-token-provider.d.ts +58 -0
- package/dist/provider/clone-token-provider.js +2 -0
- package/dist/provider/contributor-resolver.d.ts +22 -0
- package/dist/provider/contributor-resolver.js +2 -0
- package/dist/provider/index.d.ts +23 -0
- package/dist/provider/index.js +3 -0
- package/dist/provider/lock-file-fetcher.d.ts +24 -0
- package/dist/provider/lock-file-fetcher.js +2 -0
- package/dist/provider/repo-url-builder.d.ts +35 -0
- package/dist/provider/repo-url-builder.js +2 -0
- package/dist/provider/types.d.ts +9 -0
- package/dist/provider/types.js +2 -0
- package/dist/provider/webhook-normalizer.d.ts +163 -0
- package/dist/provider/webhook-normalizer.js +2 -0
- package/dist/registration/registerable-trigger-type.d.ts +52 -0
- package/dist/registration/registerable-trigger-type.js +56 -0
- package/dist/scaler/resource-types.d.ts +90 -0
- package/dist/scaler/resource-types.js +99 -0
- package/dist/scaler/scaler-backend-type.d.ts +16 -0
- package/dist/scaler/scaler-backend-type.js +20 -0
- package/dist/secrets/index.d.ts +7 -0
- package/dist/secrets/index.js +2 -0
- package/dist/secrets/types.d.ts +138 -0
- package/dist/secrets/types.js +2 -0
- package/dist/state-machine/index.d.ts +2 -0
- package/dist/state-machine/index.js +3 -0
- package/dist/state-machine/machine.d.ts +34 -0
- package/dist/state-machine/machine.js +103 -0
- package/dist/state-machine/types.d.ts +34 -0
- package/dist/state-machine/types.js +15 -0
- package/dist/trigger/decision-trace.d.ts +41 -0
- package/dist/trigger/decision-trace.js +30 -0
- package/dist/trigger/jsonpath-matcher.d.ts +27 -0
- package/dist/trigger/jsonpath-matcher.js +92 -0
- package/dist/trigger/matcher.d.ts +29 -0
- package/dist/trigger/matcher.js +704 -0
- package/dist/trigger/trigger-event-type.d.ts +14 -0
- package/dist/trigger/trigger-event-type.js +66 -0
- package/dist/trigger/types.d.ts +524 -0
- package/dist/trigger/types.js +48 -0
- package/dist/webhook/signature.d.ts +15 -0
- package/dist/webhook/signature.js +32 -0
- package/dist/ws/close-codes.d.ts +28 -0
- package/dist/ws/close-codes.js +33 -0
- package/dist/ws/rate-limiter.d.ts +86 -0
- package/dist/ws/rate-limiter.js +136 -0
- package/dist/ws/ws-like.d.ts +12 -0
- package/dist/ws/ws-like.js +2 -0
- package/package.json +54 -6
- package/sbom.spdx.json +202 -0
- package/index.js +0 -3
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Fine-grained source subtype, used by the dashboard (and any future filtering /
|
|
4
|
+
* grouping logic) to render an icon and friendly label for each source.
|
|
5
|
+
*
|
|
6
|
+
* Distinct from `provider` (which collapses universal-git, generic_webhook, and
|
|
7
|
+
* internal into the single value `'generic'`): subtype keeps the "what kind of
|
|
8
|
+
* orchestrator-side wiring is this?" distinction visible all the way through
|
|
9
|
+
* the API and UI.
|
|
10
|
+
*
|
|
11
|
+
* - `github_app` — orchestrator-side `sources` row with `provider='github'`
|
|
12
|
+
* (a GitHub App registration).
|
|
13
|
+
* - `generic_webhook` — `generic_webhook_sources` row with `provider_type='generic'`.
|
|
14
|
+
* - `universal_git` — `generic_webhook_sources` row with a non-null `git_config`
|
|
15
|
+
* (universal-git provider — gitea, gitlab, forgejo, etc.).
|
|
16
|
+
* - `internal` — `generic_webhook_sources` row with `provider_type='internal'`
|
|
17
|
+
* (E2E / staging stg-ha smoke-test plumbing).
|
|
18
|
+
*/
|
|
19
|
+
export declare const SourceSubtype: z.ZodEnum<{
|
|
20
|
+
github_app: "github_app";
|
|
21
|
+
generic_webhook: "generic_webhook";
|
|
22
|
+
universal_git: "universal_git";
|
|
23
|
+
internal: "internal";
|
|
24
|
+
}>;
|
|
25
|
+
export type SourceSubtype = z.infer<typeof SourceSubtype>;
|
|
26
|
+
/**
|
|
27
|
+
* Source provider family used by Platform's webhook router. Coarser-grained
|
|
28
|
+
* than `SourceSubtype` — every universal-git / generic_webhook / internal row
|
|
29
|
+
* collapses to `'generic'` here because Platform routes them through the same
|
|
30
|
+
* generic webhook ingress.
|
|
31
|
+
*/
|
|
32
|
+
export declare const SourceProvider: z.ZodEnum<{
|
|
33
|
+
github: "github";
|
|
34
|
+
gitlab: "gitlab";
|
|
35
|
+
bitbucket: "bitbucket";
|
|
36
|
+
generic: "generic";
|
|
37
|
+
}>;
|
|
38
|
+
export type SourceProvider = z.infer<typeof SourceProvider>;
|
|
39
|
+
/** Source registration sent by orchestrator to Platform after auth.success. */
|
|
40
|
+
export declare const sourceRegistrationSchema: z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"source.register">;
|
|
42
|
+
messageId: z.ZodString;
|
|
43
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
44
|
+
provider: z.ZodEnum<{
|
|
45
|
+
github: "github";
|
|
46
|
+
gitlab: "gitlab";
|
|
47
|
+
bitbucket: "bitbucket";
|
|
48
|
+
generic: "generic";
|
|
49
|
+
}>;
|
|
50
|
+
routingKey: z.ZodString;
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
subtype: z.ZodEnum<{
|
|
53
|
+
github_app: "github_app";
|
|
54
|
+
generic_webhook: "generic_webhook";
|
|
55
|
+
universal_git: "universal_git";
|
|
56
|
+
internal: "internal";
|
|
57
|
+
}>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
60
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
version: z.ZodOptional<z.ZodString>;
|
|
62
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
63
|
+
platform: "platform";
|
|
64
|
+
hybrid: "hybrid";
|
|
65
|
+
independent: "independent";
|
|
66
|
+
}>>;
|
|
67
|
+
scalerBackends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
s3LogAccess: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
queueTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
/** Platform acknowledgment of source registration. */
|
|
72
|
+
export declare const sourceRegistrationAckSchema: z.ZodObject<{
|
|
73
|
+
type: z.ZodLiteral<"source.register.ack">;
|
|
74
|
+
messageId: z.ZodString;
|
|
75
|
+
accepted: z.ZodArray<z.ZodString>;
|
|
76
|
+
rejected: z.ZodArray<z.ZodObject<{
|
|
77
|
+
routingKey: z.ZodString;
|
|
78
|
+
reason: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
peers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
81
|
+
connectionId: z.ZodString;
|
|
82
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
83
|
+
address: z.ZodNullable<z.ZodString>;
|
|
84
|
+
routingKeys: z.ZodArray<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
/** Source deregistration sent by orchestrator to Platform at runtime (e.g., after config reload removes an app). */
|
|
88
|
+
export declare const sourceDeregisterSchema: z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"source.deregister">;
|
|
90
|
+
messageId: z.ZodString;
|
|
91
|
+
routingKeys: z.ZodArray<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
/** Platform acknowledgment of source deregistration. */
|
|
94
|
+
export declare const sourceDeregisterAckSchema: z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"source.deregister.ack">;
|
|
96
|
+
messageId: z.ZodString;
|
|
97
|
+
removed: z.ZodArray<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export type SourceRegistration = z.infer<typeof sourceRegistrationSchema>;
|
|
100
|
+
export type SourceRegistrationAck = z.infer<typeof sourceRegistrationAckSchema>;
|
|
101
|
+
export type SourceDeregister = z.infer<typeof sourceDeregisterSchema>;
|
|
102
|
+
export type SourceDeregisterAck = z.infer<typeof sourceDeregisterAckSchema>;
|
|
103
|
+
//# sourceMappingURL=source-registration.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import "../../chunk-gOLHoazu.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/protocol/messages/source-registration.ts
|
|
4
|
+
/**
|
|
5
|
+
* Fine-grained source subtype, used by the dashboard (and any future filtering /
|
|
6
|
+
* grouping logic) to render an icon and friendly label for each source.
|
|
7
|
+
*
|
|
8
|
+
* Distinct from `provider` (which collapses universal-git, generic_webhook, and
|
|
9
|
+
* internal into the single value `'generic'`): subtype keeps the "what kind of
|
|
10
|
+
* orchestrator-side wiring is this?" distinction visible all the way through
|
|
11
|
+
* the API and UI.
|
|
12
|
+
*
|
|
13
|
+
* - `github_app` — orchestrator-side `sources` row with `provider='github'`
|
|
14
|
+
* (a GitHub App registration).
|
|
15
|
+
* - `generic_webhook` — `generic_webhook_sources` row with `provider_type='generic'`.
|
|
16
|
+
* - `universal_git` — `generic_webhook_sources` row with a non-null `git_config`
|
|
17
|
+
* (universal-git provider — gitea, gitlab, forgejo, etc.).
|
|
18
|
+
* - `internal` — `generic_webhook_sources` row with `provider_type='internal'`
|
|
19
|
+
* (E2E / staging stg-ha smoke-test plumbing).
|
|
20
|
+
*/
|
|
21
|
+
const SourceSubtype = z.enum([
|
|
22
|
+
"github_app",
|
|
23
|
+
"generic_webhook",
|
|
24
|
+
"universal_git",
|
|
25
|
+
"internal"
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* Source provider family used by Platform's webhook router. Coarser-grained
|
|
29
|
+
* than `SourceSubtype` — every universal-git / generic_webhook / internal row
|
|
30
|
+
* collapses to `'generic'` here because Platform routes them through the same
|
|
31
|
+
* generic webhook ingress.
|
|
32
|
+
*/
|
|
33
|
+
const SourceProvider = z.enum([
|
|
34
|
+
"github",
|
|
35
|
+
"gitlab",
|
|
36
|
+
"bitbucket",
|
|
37
|
+
"generic"
|
|
38
|
+
]);
|
|
39
|
+
/** Source registration sent by orchestrator to Platform after auth.success. */
|
|
40
|
+
const sourceRegistrationSchema = z.object({
|
|
41
|
+
type: z.literal("source.register"),
|
|
42
|
+
messageId: z.string(),
|
|
43
|
+
sources: z.array(z.object({
|
|
44
|
+
provider: SourceProvider,
|
|
45
|
+
routingKey: z.string(),
|
|
46
|
+
/**
|
|
47
|
+
* Human-readable source name (e.g. "Production GitHub App",
|
|
48
|
+
* "Internal staging webhook"). Required — orchestrators always have a
|
|
49
|
+
* name in their local `sources` / `generic_webhook_sources` row.
|
|
50
|
+
*/
|
|
51
|
+
name: z.string(),
|
|
52
|
+
/**
|
|
53
|
+
* Fine-grained source subtype. See {@link SourceSubtype} for the full
|
|
54
|
+
* mapping. Required — pre-release, no backward-compat shims.
|
|
55
|
+
*/
|
|
56
|
+
subtype: SourceSubtype
|
|
57
|
+
})),
|
|
58
|
+
/** Orchestrator cluster instance ID for peer correlation. */
|
|
59
|
+
instanceId: z.string().optional(),
|
|
60
|
+
/** Reachable address for peer-to-peer connections (from KICI_CLUSTER_ADDRESS env var). */
|
|
61
|
+
address: z.string().nullable().optional(),
|
|
62
|
+
/** Orchestrator version (e.g. "0.0.1"). Optional for backward compatibility with older orchestrators. */
|
|
63
|
+
version: z.string().optional(),
|
|
64
|
+
/** Orchestrator config mode. Optional for backward compatibility. */
|
|
65
|
+
mode: z.enum([
|
|
66
|
+
"platform",
|
|
67
|
+
"hybrid",
|
|
68
|
+
"independent"
|
|
69
|
+
]).optional(),
|
|
70
|
+
/** Scaler backends configured on this orchestrator (e.g. ["container", "firecracker"]). */
|
|
71
|
+
scalerBackends: z.array(z.string()).optional(),
|
|
72
|
+
/** Whether this orchestrator has S3 log storage configured. Used for multi-orch pool validation. */
|
|
73
|
+
s3LogAccess: z.boolean().optional(),
|
|
74
|
+
/** Queue timeout in ms. Platform uses this (with margin) for safety-net GC of stale queued jobs. */
|
|
75
|
+
queueTimeoutMs: z.number().optional()
|
|
76
|
+
});
|
|
77
|
+
/** Platform acknowledgment of source registration. */
|
|
78
|
+
const sourceRegistrationAckSchema = z.object({
|
|
79
|
+
type: z.literal("source.register.ack"),
|
|
80
|
+
messageId: z.string(),
|
|
81
|
+
accepted: z.array(z.string()),
|
|
82
|
+
rejected: z.array(z.object({
|
|
83
|
+
routingKey: z.string(),
|
|
84
|
+
reason: z.string()
|
|
85
|
+
})),
|
|
86
|
+
/** Other orchestrators sharing overlapping routing keys (peer discovery). */
|
|
87
|
+
peers: z.array(z.object({
|
|
88
|
+
connectionId: z.string(),
|
|
89
|
+
instanceId: z.string().optional(),
|
|
90
|
+
address: z.string().nullable(),
|
|
91
|
+
routingKeys: z.array(z.string())
|
|
92
|
+
})).optional()
|
|
93
|
+
});
|
|
94
|
+
/** Source deregistration sent by orchestrator to Platform at runtime (e.g., after config reload removes an app). */
|
|
95
|
+
const sourceDeregisterSchema = z.object({
|
|
96
|
+
type: z.literal("source.deregister"),
|
|
97
|
+
messageId: z.string(),
|
|
98
|
+
routingKeys: z.array(z.string())
|
|
99
|
+
});
|
|
100
|
+
/** Platform acknowledgment of source deregistration. */
|
|
101
|
+
const sourceDeregisterAckSchema = z.object({
|
|
102
|
+
type: z.literal("source.deregister.ack"),
|
|
103
|
+
messageId: z.string(),
|
|
104
|
+
removed: z.array(z.string())
|
|
105
|
+
});
|
|
106
|
+
//#endregion
|
|
107
|
+
export { SourceProvider, SourceSubtype, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=source-registration.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Simulated event shape embedded in test trigger messages. */
|
|
3
|
+
export declare const testEventSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodString;
|
|
5
|
+
action: z.ZodOptional<z.ZodString>;
|
|
6
|
+
targetBranch: z.ZodString;
|
|
7
|
+
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
8
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
9
|
+
changedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
/** Test trigger sent by CLI to orchestrator to initiate a test run. */
|
|
12
|
+
export declare const testTriggerSchema: z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"test.trigger">;
|
|
14
|
+
messageId: z.ZodString;
|
|
15
|
+
fixtureId: z.ZodString;
|
|
16
|
+
event: z.ZodObject<{
|
|
17
|
+
type: z.ZodString;
|
|
18
|
+
action: z.ZodOptional<z.ZodString>;
|
|
19
|
+
targetBranch: z.ZodString;
|
|
20
|
+
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
21
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
22
|
+
changedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
uploadId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
routingKey: z.ZodString;
|
|
26
|
+
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
27
|
+
workflowName: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
/** Test trigger response from orchestrator to CLI. */
|
|
30
|
+
export declare const testTriggerResponseSchema: z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"test.trigger.response">;
|
|
32
|
+
messageId: z.ZodString;
|
|
33
|
+
runId: z.ZodString;
|
|
34
|
+
observeUrl: z.ZodString;
|
|
35
|
+
status: z.ZodEnum<{
|
|
36
|
+
accepted: "accepted";
|
|
37
|
+
rejected: "rejected";
|
|
38
|
+
}>;
|
|
39
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
/** Test cancel request sent by CLI to orchestrator. */
|
|
42
|
+
export declare const testCancelSchema: z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"test.cancel">;
|
|
44
|
+
messageId: z.ZodString;
|
|
45
|
+
runId: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
/** Test cancel response from orchestrator to CLI. */
|
|
48
|
+
export declare const testCancelResponseSchema: z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"test.cancel.response">;
|
|
50
|
+
messageId: z.ZodString;
|
|
51
|
+
status: z.ZodEnum<{
|
|
52
|
+
cancelled: "cancelled";
|
|
53
|
+
not_found: "not_found";
|
|
54
|
+
already_complete: "already_complete";
|
|
55
|
+
}>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type TestTriggerResponse = z.infer<typeof testTriggerResponseSchema>;
|
|
58
|
+
export type TestCancelResponse = z.infer<typeof testCancelResponseSchema>;
|
|
59
|
+
//# sourceMappingURL=test-run.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "../../chunk-gOLHoazu.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/protocol/messages/test-run.ts
|
|
4
|
+
/** Simulated event shape embedded in test trigger messages. */
|
|
5
|
+
const testEventSchema = z.object({
|
|
6
|
+
type: z.string(),
|
|
7
|
+
action: z.string().optional(),
|
|
8
|
+
targetBranch: z.string(),
|
|
9
|
+
sourceBranch: z.string().optional(),
|
|
10
|
+
payload: z.record(z.string(), z.unknown()),
|
|
11
|
+
changedFiles: z.array(z.string()).optional()
|
|
12
|
+
});
|
|
13
|
+
/** Test trigger sent by CLI to orchestrator to initiate a test run. */
|
|
14
|
+
const testTriggerSchema = z.object({
|
|
15
|
+
type: z.literal("test.trigger"),
|
|
16
|
+
messageId: z.string(),
|
|
17
|
+
fixtureId: z.string(),
|
|
18
|
+
event: testEventSchema,
|
|
19
|
+
uploadId: z.string().optional(),
|
|
20
|
+
routingKey: z.string(),
|
|
21
|
+
secrets: z.record(z.string(), z.string()).optional(),
|
|
22
|
+
workflowName: z.string().optional()
|
|
23
|
+
});
|
|
24
|
+
/** Test trigger response from orchestrator to CLI. */
|
|
25
|
+
const testTriggerResponseSchema = z.object({
|
|
26
|
+
type: z.literal("test.trigger.response"),
|
|
27
|
+
messageId: z.string(),
|
|
28
|
+
runId: z.string(),
|
|
29
|
+
observeUrl: z.string(),
|
|
30
|
+
status: z.enum(["accepted", "rejected"]),
|
|
31
|
+
reason: z.string().optional()
|
|
32
|
+
});
|
|
33
|
+
/** Test cancel request sent by CLI to orchestrator. */
|
|
34
|
+
const testCancelSchema = z.object({
|
|
35
|
+
type: z.literal("test.cancel"),
|
|
36
|
+
messageId: z.string(),
|
|
37
|
+
runId: z.string()
|
|
38
|
+
});
|
|
39
|
+
/** Test cancel response from orchestrator to CLI. */
|
|
40
|
+
const testCancelResponseSchema = z.object({
|
|
41
|
+
type: z.literal("test.cancel.response"),
|
|
42
|
+
messageId: z.string(),
|
|
43
|
+
status: z.enum([
|
|
44
|
+
"cancelled",
|
|
45
|
+
"not_found",
|
|
46
|
+
"already_complete"
|
|
47
|
+
])
|
|
48
|
+
});
|
|
49
|
+
//#endregion
|
|
50
|
+
export { testCancelResponseSchema, testCancelSchema, testEventSchema, testTriggerResponseSchema, testTriggerSchema };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=test-run.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol version. Sent during WebSocket handshake.
|
|
3
|
+
* Increment on breaking changes to message schemas.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PROTOCOL_VERSION = 1;
|
|
6
|
+
/**
|
|
7
|
+
* Minimum protocol version accepted.
|
|
8
|
+
* Connections below this are rejected.
|
|
9
|
+
* Capabilities handle per-feature negotiation above this baseline.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MIN_PROTOCOL_VERSION = 1;
|
|
12
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
//#region src/protocol/version.ts
|
|
3
|
+
/**
|
|
4
|
+
* Protocol version. Sent during WebSocket handshake.
|
|
5
|
+
* Increment on breaking changes to message schemas.
|
|
6
|
+
*/
|
|
7
|
+
const PROTOCOL_VERSION = 1;
|
|
8
|
+
/**
|
|
9
|
+
* Minimum protocol version accepted.
|
|
10
|
+
* Connections below this are rejected.
|
|
11
|
+
* Capabilities handle per-feature negotiation above this baseline.
|
|
12
|
+
*/
|
|
13
|
+
const MIN_PROTOCOL_VERSION = 1;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { MIN_PROTOCOL_VERSION, PROTOCOL_VERSION };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChangedFilesFetcher interface.
|
|
3
|
+
*
|
|
4
|
+
* Retrieves the list of files changed in a webhook event from the provider's API.
|
|
5
|
+
* Used by the orchestrator for path-based trigger filtering.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderType } from './types.js';
|
|
8
|
+
export interface ChangedFilesFetcher {
|
|
9
|
+
readonly provider: ProviderType;
|
|
10
|
+
/**
|
|
11
|
+
* Get changed files for a webhook event.
|
|
12
|
+
*
|
|
13
|
+
* For PRs: files changed in the pull/merge request.
|
|
14
|
+
* For pushes: files changed across the pushed commits.
|
|
15
|
+
*
|
|
16
|
+
* @param repoIdentifier - Provider-specific repo identifier (e.g., "owner/repo" for GitHub)
|
|
17
|
+
* @param eventType - Normalized event type ("pull_request" or "push")
|
|
18
|
+
* @param payload - Raw webhook payload (provider-specific)
|
|
19
|
+
* @param credentials - Provider-specific auth credentials
|
|
20
|
+
* @returns Array of changed file paths (relative to repo root)
|
|
21
|
+
*/
|
|
22
|
+
getChangedFiles(repoIdentifier: string, eventType: string, payload: unknown, credentials: unknown): Promise<string[]>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=changed-files-fetcher.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* GitHub check run conclusion values.
|
|
4
|
+
*
|
|
5
|
+
* Used when posting commit status / check-run results back to the provider.
|
|
6
|
+
* Access values: CheckRunConclusion.enum.success, CheckRunConclusion.enum.failure, etc.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CheckRunConclusion: z.ZodEnum<{
|
|
9
|
+
success: "success";
|
|
10
|
+
cancelled: "cancelled";
|
|
11
|
+
failure: "failure";
|
|
12
|
+
timed_out: "timed_out";
|
|
13
|
+
}>;
|
|
14
|
+
export type CheckRunConclusion = z.infer<typeof CheckRunConclusion>;
|
|
15
|
+
//# sourceMappingURL=check-run-conclusion.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/provider/check-run-conclusion.ts
|
|
4
|
+
/**
|
|
5
|
+
* GitHub check run conclusion values.
|
|
6
|
+
*
|
|
7
|
+
* Used when posting commit status / check-run results back to the provider.
|
|
8
|
+
* Access values: CheckRunConclusion.enum.success, CheckRunConclusion.enum.failure, etc.
|
|
9
|
+
*/
|
|
10
|
+
const CheckRunConclusion = z.enum([
|
|
11
|
+
"success",
|
|
12
|
+
"failure",
|
|
13
|
+
"cancelled",
|
|
14
|
+
"timed_out"
|
|
15
|
+
]);
|
|
16
|
+
//#endregion
|
|
17
|
+
export { CheckRunConclusion };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=check-run-conclusion.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CheckStatusPoster interface for posting check statuses to git providers.
|
|
3
|
+
*
|
|
4
|
+
* Used by the CI security system to post approval/hold status checks
|
|
5
|
+
* on PRs, enabling visibility into trust-tier gating decisions.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderType } from './types.js';
|
|
8
|
+
/** Status values for a check run. */
|
|
9
|
+
export type CheckStatus = 'pending' | 'success' | 'failure' | 'neutral';
|
|
10
|
+
/** Posts check statuses to a git hosting provider. */
|
|
11
|
+
export interface CheckStatusPoster {
|
|
12
|
+
readonly provider: ProviderType;
|
|
13
|
+
postCheckStatus(repoIdentifier: string, commitSha: string, status: CheckStatus, title: string, summary: string, credentials: unknown): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=check-status-poster.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CloneTokenProvider interface.
|
|
3
|
+
*
|
|
4
|
+
* Creates short-lived authentication tokens for agent repo clone operations.
|
|
5
|
+
* Each provider has its own auth model for generating temporary access.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderType } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Structured auth material returned by `issueGitAuth()`.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors the shape of `gitAuthSchema` on the orchestrator-agent protocol —
|
|
12
|
+
* declared here in a browser-safe form (no Zod import) so provider modules
|
|
13
|
+
* can stay on the barrel export. The protocol module validates dispatch
|
|
14
|
+
* messages using the Zod version.
|
|
15
|
+
*/
|
|
16
|
+
export interface ProviderGitAuth {
|
|
17
|
+
kind: 'basic' | 'ssh';
|
|
18
|
+
/** Basic-auth username. Omit for SSH. */
|
|
19
|
+
user?: string;
|
|
20
|
+
/** Basic-auth password/PAT, or PEM-encoded SSH private key. */
|
|
21
|
+
secret: string;
|
|
22
|
+
/** SSH-only. `accept-new` (default) or `pinned`. */
|
|
23
|
+
sshHostKeyPolicy?: 'accept-new' | 'pinned';
|
|
24
|
+
/** SSH-only, required when `sshHostKeyPolicy === 'pinned'`. */
|
|
25
|
+
sshKnownHostsPem?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CloneTokenProvider {
|
|
28
|
+
readonly provider: ProviderType;
|
|
29
|
+
/**
|
|
30
|
+
* Create a short-lived token for cloning a repo.
|
|
31
|
+
*
|
|
32
|
+
* The token is passed to the agent for git clone authentication.
|
|
33
|
+
* Token format and lifetime are provider-specific:
|
|
34
|
+
* - GitHub: installation access token (1 hour)
|
|
35
|
+
* - GitLab: project/group access token or OAuth token
|
|
36
|
+
* - Bitbucket: app password or OAuth token
|
|
37
|
+
*
|
|
38
|
+
* @param repoIdentifier - Provider-specific repo identifier
|
|
39
|
+
* @param credentials - Provider-specific credentials (e.g., GitHub App key + installation ID)
|
|
40
|
+
* @returns Token string for git clone auth, or null if public repo / no auth needed
|
|
41
|
+
*/
|
|
42
|
+
createCloneToken(repoIdentifier: string, credentials: unknown): Promise<string | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Issue structured clone auth for the dispatch protocol's `sourceAuth` /
|
|
45
|
+
* `workflowAuth` fields. Optional — when a provider implements it, the
|
|
46
|
+
* orchestrator prefers this over `createCloneToken` so it can carry the
|
|
47
|
+
* auth `kind` (basic vs ssh) and username alongside the secret material.
|
|
48
|
+
*
|
|
49
|
+
* Providers that only support HTTPS Basic auth (e.g. GitHub App install
|
|
50
|
+
* tokens) can safely omit this — the orchestrator synthesizes
|
|
51
|
+
* `{ kind: 'basic', user: 'x-access-token', secret: <token> }` from
|
|
52
|
+
* `createCloneToken`'s return value as a fallback.
|
|
53
|
+
*
|
|
54
|
+
* @returns Structured auth, or null when the provider has no credential.
|
|
55
|
+
*/
|
|
56
|
+
issueGitAuth?(repoIdentifier: string, credentials: unknown): Promise<ProviderGitAuth | null>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=clone-token-provider.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContributorResolver interface for determining contributor permissions.
|
|
3
|
+
*
|
|
4
|
+
* Used by the CI security system to check a contributor's permission level
|
|
5
|
+
* on a repository, enabling trust-tier decisions for PR execution gating.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderType } from './types.js';
|
|
8
|
+
/** Contributor's permission level on a repository. */
|
|
9
|
+
export type ContributorPermission = 'admin' | 'write' | 'read' | 'none';
|
|
10
|
+
/** Information about a contributor and their relationship to a PR. */
|
|
11
|
+
export interface ContributorInfo {
|
|
12
|
+
username: string;
|
|
13
|
+
permission: ContributorPermission;
|
|
14
|
+
/** Whether the PR comes from a fork */
|
|
15
|
+
isForkPR: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Resolves contributor information from a git hosting provider. */
|
|
18
|
+
export interface ContributorResolver {
|
|
19
|
+
readonly provider: ProviderType;
|
|
20
|
+
resolveContributor(repoIdentifier: string, username: string, credentials: unknown): Promise<ContributorInfo>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=contributor-resolver.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider abstraction interfaces for KiCI.
|
|
3
|
+
*
|
|
4
|
+
* Composable interfaces that define the contract between the engine
|
|
5
|
+
* and provider-specific implementations (GitHub, GitLab, Bitbucket).
|
|
6
|
+
*
|
|
7
|
+
* Each interface covers a distinct capability:
|
|
8
|
+
* - WebhookNormalizer: Webhook ingestion and event normalization
|
|
9
|
+
* - LockFileFetcher: Repository API access for lock files
|
|
10
|
+
* - ChangedFilesFetcher: Repository API access for changed files
|
|
11
|
+
* - CloneTokenProvider: Auth token generation for agent clone
|
|
12
|
+
* - RepoUrlBuilder: Provider-specific URL construction
|
|
13
|
+
*/
|
|
14
|
+
export type { ProviderType } from './types.js';
|
|
15
|
+
export type { WebhookNormalizer, AccessCacheInvalidation } from './webhook-normalizer.js';
|
|
16
|
+
export type { LockFileFetcher } from './lock-file-fetcher.js';
|
|
17
|
+
export type { ChangedFilesFetcher } from './changed-files-fetcher.js';
|
|
18
|
+
export type { CloneTokenProvider, ProviderGitAuth } from './clone-token-provider.js';
|
|
19
|
+
export type { RepoUrlBuilder } from './repo-url-builder.js';
|
|
20
|
+
export type { ContributorResolver, ContributorInfo, ContributorPermission, } from './contributor-resolver.js';
|
|
21
|
+
export type { CheckStatusPoster, CheckStatus } from './check-status-poster.js';
|
|
22
|
+
export * from './check-run-conclusion.js';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LockFileFetcher interface.
|
|
3
|
+
*
|
|
4
|
+
* Fetches kici.lock.json from a provider's repository API.
|
|
5
|
+
* Used by the orchestrator to evaluate triggers without cloning the repo.
|
|
6
|
+
*/
|
|
7
|
+
import type { LockFile } from '../trigger/types.js';
|
|
8
|
+
import type { ProviderType } from './types.js';
|
|
9
|
+
export interface LockFileFetcher {
|
|
10
|
+
readonly provider: ProviderType;
|
|
11
|
+
/**
|
|
12
|
+
* Fetch the lock file content for a repo at a specific ref.
|
|
13
|
+
*
|
|
14
|
+
* Implementation details (API client, caching, auth) are internal
|
|
15
|
+
* to each provider. The interface only cares about the result.
|
|
16
|
+
*
|
|
17
|
+
* @param repoIdentifier - Provider-specific repo identifier (e.g., "owner/repo" for GitHub)
|
|
18
|
+
* @param ref - Git ref (branch name, tag, or SHA)
|
|
19
|
+
* @param credentials - Provider-specific auth credentials
|
|
20
|
+
* @returns Parsed lock file, or null if not found
|
|
21
|
+
*/
|
|
22
|
+
fetchLockFile(repoIdentifier: string, ref: string, credentials: unknown): Promise<LockFile | null>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=lock-file-fetcher.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RepoUrlBuilder interface.
|
|
3
|
+
*
|
|
4
|
+
* Constructs provider-specific URLs for repository operations.
|
|
5
|
+
* Used for git clone URLs and raw file access URLs in job dispatch.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderType } from './types.js';
|
|
8
|
+
export interface RepoUrlBuilder {
|
|
9
|
+
readonly provider: ProviderType;
|
|
10
|
+
/**
|
|
11
|
+
* Build the HTTPS clone URL for a repo.
|
|
12
|
+
*
|
|
13
|
+
* Examples:
|
|
14
|
+
* - GitHub: https://github.com/owner/repo.git
|
|
15
|
+
* - GitLab: https://gitlab.com/namespace/project.git
|
|
16
|
+
* - Bitbucket: https://bitbucket.org/workspace/repo.git
|
|
17
|
+
*
|
|
18
|
+
* @param repoIdentifier - Provider-specific repo identifier
|
|
19
|
+
* @returns HTTPS clone URL
|
|
20
|
+
*/
|
|
21
|
+
buildCloneUrl(repoIdentifier: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Build the raw file URL for a file at a specific ref.
|
|
24
|
+
*
|
|
25
|
+
* Used for lockFileUrl in job dispatch, allowing the agent to
|
|
26
|
+
* fetch the lock file without a full clone.
|
|
27
|
+
*
|
|
28
|
+
* @param repoIdentifier - Provider-specific repo identifier
|
|
29
|
+
* @param ref - Git ref (branch, tag, SHA)
|
|
30
|
+
* @param path - File path relative to repo root
|
|
31
|
+
* @returns Direct URL to the raw file content
|
|
32
|
+
*/
|
|
33
|
+
buildRawFileUrl(repoIdentifier: string, ref: string, path: string): string;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=repo-url-builder.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common provider types for the KiCI provider abstraction layer.
|
|
3
|
+
*
|
|
4
|
+
* These types are the foundation for all provider interfaces.
|
|
5
|
+
* Keep this minimal -- only types needed by multiple interfaces belong here.
|
|
6
|
+
*/
|
|
7
|
+
/** Identifies a git hosting provider, generic webhook source, or internal test provider. */
|
|
8
|
+
export type ProviderType = 'github' | 'gitlab' | 'bitbucket' | 'generic' | 'internal';
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|