@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.
Files changed (129) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +1 -6
  3. package/dist/audit/access-log-policy.d.ts +97 -0
  4. package/dist/audit/access-log-policy.js +195 -0
  5. package/dist/audit/activity.d.ts +156 -0
  6. package/dist/audit/activity.js +175 -0
  7. package/dist/audit/retention-policy.d.ts +157 -0
  8. package/dist/audit/retention-policy.js +364 -0
  9. package/dist/bundler/index.d.ts +3 -0
  10. package/dist/bundler/index.js +3 -0
  11. package/dist/bundler/rolldown-config.d.ts +41 -0
  12. package/dist/bundler/rolldown-config.js +40 -0
  13. package/dist/chunk-gOLHoazu.js +4 -0
  14. package/dist/env/environment-allowlist.d.ts +45 -0
  15. package/dist/env/environment-allowlist.js +69 -0
  16. package/dist/environment/index.d.ts +3 -0
  17. package/dist/environment/index.js +3 -0
  18. package/dist/environment/scope-resolver.d.ts +35 -0
  19. package/dist/environment/scope-resolver.js +77 -0
  20. package/dist/environment/types.d.ts +98 -0
  21. package/dist/environment/types.js +2 -0
  22. package/dist/index.d.ts +54 -0
  23. package/dist/index.js +45 -0
  24. package/dist/labels.d.ts +106 -0
  25. package/dist/labels.js +162 -0
  26. package/dist/metrics/metric-catalog.generated.d.ts +400 -0
  27. package/dist/metrics/metric-catalog.generated.js +510 -0
  28. package/dist/protocol/dashboard-global-workflows.d.ts +9 -0
  29. package/dist/protocol/dashboard-global-workflows.js +3 -0
  30. package/dist/protocol/event-log-payload.d.ts +16 -0
  31. package/dist/protocol/event-log-payload.js +21 -0
  32. package/dist/protocol/messages/access-log.d.ts +545 -0
  33. package/dist/protocol/messages/access-log.js +175 -0
  34. package/dist/protocol/messages/actor.d.ts +100 -0
  35. package/dist/protocol/messages/actor.js +139 -0
  36. package/dist/protocol/messages/auth.d.ts +25 -0
  37. package/dist/protocol/messages/auth.js +36 -0
  38. package/dist/protocol/messages/browser.d.ts +369 -0
  39. package/dist/protocol/messages/browser.js +225 -0
  40. package/dist/protocol/messages/capabilities.d.ts +46 -0
  41. package/dist/protocol/messages/capabilities.js +42 -0
  42. package/dist/protocol/messages/common.d.ts +53 -0
  43. package/dist/protocol/messages/common.js +55 -0
  44. package/dist/protocol/messages/dashboard-global-workflows.d.ts +166 -0
  45. package/dist/protocol/messages/dashboard-global-workflows.js +80 -0
  46. package/dist/protocol/messages/dashboard.d.ts +4068 -0
  47. package/dist/protocol/messages/dashboard.js +1237 -0
  48. package/dist/protocol/messages/event-log.d.ts +49 -0
  49. package/dist/protocol/messages/event-log.js +45 -0
  50. package/dist/protocol/messages/execution-status.d.ts +164 -0
  51. package/dist/protocol/messages/execution-status.js +166 -0
  52. package/dist/protocol/messages/join.d.ts +18 -0
  53. package/dist/protocol/messages/join.js +28 -0
  54. package/dist/protocol/messages/log-pull.d.ts +27 -0
  55. package/dist/protocol/messages/log-pull.js +36 -0
  56. package/dist/protocol/messages/observe.d.ts +75 -0
  57. package/dist/protocol/messages/observe.js +70 -0
  58. package/dist/protocol/messages/orchestrator-agent.d.ts +606 -0
  59. package/dist/protocol/messages/orchestrator-agent.js +481 -0
  60. package/dist/protocol/messages/peer.d.ts +795 -0
  61. package/dist/protocol/messages/peer.js +372 -0
  62. package/dist/protocol/messages/platform-orchestrator.d.ts +1888 -0
  63. package/dist/protocol/messages/platform-orchestrator.js +379 -0
  64. package/dist/protocol/messages/run-events.d.ts +155 -0
  65. package/dist/protocol/messages/run-events.js +115 -0
  66. package/dist/protocol/messages/saas-orchestrator.d.ts +2179 -0
  67. package/dist/protocol/messages/source-registration.d.ts +103 -0
  68. package/dist/protocol/messages/source-registration.js +109 -0
  69. package/dist/protocol/messages/test-run.d.ts +59 -0
  70. package/dist/protocol/messages/test-run.js +52 -0
  71. package/dist/protocol/version.d.ts +12 -0
  72. package/dist/protocol/version.js +17 -0
  73. package/dist/provider/changed-files-fetcher.d.ts +24 -0
  74. package/dist/provider/changed-files-fetcher.js +2 -0
  75. package/dist/provider/check-run-conclusion.d.ts +15 -0
  76. package/dist/provider/check-run-conclusion.js +19 -0
  77. package/dist/provider/check-status-poster.d.ts +15 -0
  78. package/dist/provider/check-status-poster.js +2 -0
  79. package/dist/provider/clone-token-provider.d.ts +58 -0
  80. package/dist/provider/clone-token-provider.js +2 -0
  81. package/dist/provider/contributor-resolver.d.ts +22 -0
  82. package/dist/provider/contributor-resolver.js +2 -0
  83. package/dist/provider/index.d.ts +23 -0
  84. package/dist/provider/index.js +3 -0
  85. package/dist/provider/lock-file-fetcher.d.ts +24 -0
  86. package/dist/provider/lock-file-fetcher.js +2 -0
  87. package/dist/provider/repo-url-builder.d.ts +35 -0
  88. package/dist/provider/repo-url-builder.js +2 -0
  89. package/dist/provider/types.d.ts +9 -0
  90. package/dist/provider/types.js +2 -0
  91. package/dist/provider/webhook-normalizer.d.ts +163 -0
  92. package/dist/provider/webhook-normalizer.js +2 -0
  93. package/dist/registration/registerable-trigger-type.d.ts +52 -0
  94. package/dist/registration/registerable-trigger-type.js +56 -0
  95. package/dist/scaler/resource-types.d.ts +90 -0
  96. package/dist/scaler/resource-types.js +99 -0
  97. package/dist/scaler/scaler-backend-type.d.ts +16 -0
  98. package/dist/scaler/scaler-backend-type.js +20 -0
  99. package/dist/secrets/index.d.ts +7 -0
  100. package/dist/secrets/index.js +2 -0
  101. package/dist/secrets/types.d.ts +138 -0
  102. package/dist/secrets/types.js +2 -0
  103. package/dist/state-machine/index.d.ts +2 -0
  104. package/dist/state-machine/index.js +3 -0
  105. package/dist/state-machine/machine.d.ts +34 -0
  106. package/dist/state-machine/machine.js +103 -0
  107. package/dist/state-machine/types.d.ts +34 -0
  108. package/dist/state-machine/types.js +15 -0
  109. package/dist/trigger/decision-trace.d.ts +41 -0
  110. package/dist/trigger/decision-trace.js +30 -0
  111. package/dist/trigger/jsonpath-matcher.d.ts +27 -0
  112. package/dist/trigger/jsonpath-matcher.js +92 -0
  113. package/dist/trigger/matcher.d.ts +29 -0
  114. package/dist/trigger/matcher.js +704 -0
  115. package/dist/trigger/trigger-event-type.d.ts +14 -0
  116. package/dist/trigger/trigger-event-type.js +66 -0
  117. package/dist/trigger/types.d.ts +524 -0
  118. package/dist/trigger/types.js +48 -0
  119. package/dist/webhook/signature.d.ts +15 -0
  120. package/dist/webhook/signature.js +32 -0
  121. package/dist/ws/close-codes.d.ts +28 -0
  122. package/dist/ws/close-codes.js +33 -0
  123. package/dist/ws/rate-limiter.d.ts +86 -0
  124. package/dist/ws/rate-limiter.js +136 -0
  125. package/dist/ws/ws-like.d.ts +12 -0
  126. package/dist/ws/ws-like.js +2 -0
  127. package/package.json +54 -6
  128. package/sbom.spdx.json +202 -0
  129. package/index.js +0 -3
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Maximum decompressed WebSocket frame size accepted by every KiCI WS endpoint
4
+ * (Platform, orchestrator, agent — both server-side and client-side).
5
+ *
6
+ * Bounds per-frame memory allocation against `permessage-deflate`
7
+ * compression-bomb DoS. Without this cap, `ws@8.x` defaults to 100 MiB,
8
+ * which an unauthenticated attacker can exhaust on the Platform's
9
+ * `/ws` endpoint pre-auth via a single crafted compressed frame.
10
+ *
11
+ * 25 MiB matches `WEBHOOK_RELAY_MAX_BODY_BYTES` (and GitHub's own webhook
12
+ * payload cap). The chunked webhook-relay protocol breaks bodies into ~85 KiB
13
+ * frames anyway, so this leaves orders-of-magnitude headroom for every other
14
+ * legitimate WS frame in the system (log.chunk, state.replay, dashboard
15
+ * proxy responses, etc.).
16
+ *
17
+ * MUST be passed as `maxPayload` on every `new WebSocket(...)` constructor and
18
+ * on every `WebSocketServer` `options` object across the three packages.
19
+ */
20
+ export declare const WS_MAX_PAYLOAD_BYTES: number;
21
+ /**
22
+ * Heartbeat message sent periodically to keep WebSocket alive.
23
+ *
24
+ * FAST-PATHED: A manual validator exists in
25
+ * packages/orchestrator/src/ws/agent-handler.ts (isValidHeartbeat).
26
+ * If you change this schema, update the manual validator in the same commit.
27
+ * See CLAUDE.md rule: "Zod fast-path sync invariant".
28
+ */
29
+ export declare const heartbeatSchema: z.ZodObject<{
30
+ type: z.ZodLiteral<"heartbeat">;
31
+ timestamp: z.ZodNumber;
32
+ }, z.core.$strip>;
33
+ /** Acknowledgment of a received message. */
34
+ export declare const ackSchema: z.ZodObject<{
35
+ type: z.ZodLiteral<"ack">;
36
+ messageId: z.ZodString;
37
+ }, z.core.$strip>;
38
+ /** Negative acknowledgment - message received but could not be processed. */
39
+ export declare const nackSchema: z.ZodObject<{
40
+ type: z.ZodLiteral<"nack">;
41
+ messageId: z.ZodString;
42
+ reason: z.ZodString;
43
+ }, z.core.$strip>;
44
+ /** Protocol-level error message. */
45
+ export declare const errorSchema: z.ZodObject<{
46
+ type: z.ZodLiteral<"error">;
47
+ code: z.ZodString;
48
+ message: z.ZodString;
49
+ }, z.core.$strip>;
50
+ /** Inferred types from schemas. */
51
+ export type Heartbeat = z.infer<typeof heartbeatSchema>;
52
+ export type Ack = z.infer<typeof ackSchema>;
53
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1,55 @@
1
+ import "../../chunk-gOLHoazu.js";
2
+ import { z } from "zod";
3
+ //#region src/protocol/messages/common.ts
4
+ /**
5
+ * Maximum decompressed WebSocket frame size accepted by every KiCI WS endpoint
6
+ * (Platform, orchestrator, agent — both server-side and client-side).
7
+ *
8
+ * Bounds per-frame memory allocation against `permessage-deflate`
9
+ * compression-bomb DoS. Without this cap, `ws@8.x` defaults to 100 MiB,
10
+ * which an unauthenticated attacker can exhaust on the Platform's
11
+ * `/ws` endpoint pre-auth via a single crafted compressed frame.
12
+ *
13
+ * 25 MiB matches `WEBHOOK_RELAY_MAX_BODY_BYTES` (and GitHub's own webhook
14
+ * payload cap). The chunked webhook-relay protocol breaks bodies into ~85 KiB
15
+ * frames anyway, so this leaves orders-of-magnitude headroom for every other
16
+ * legitimate WS frame in the system (log.chunk, state.replay, dashboard
17
+ * proxy responses, etc.).
18
+ *
19
+ * MUST be passed as `maxPayload` on every `new WebSocket(...)` constructor and
20
+ * on every `WebSocketServer` `options` object across the three packages.
21
+ */
22
+ const WS_MAX_PAYLOAD_BYTES = 25 * 1024 * 1024;
23
+ /**
24
+ * Heartbeat message sent periodically to keep WebSocket alive.
25
+ *
26
+ * FAST-PATHED: A manual validator exists in
27
+ * packages/orchestrator/src/ws/agent-handler.ts (isValidHeartbeat).
28
+ * If you change this schema, update the manual validator in the same commit.
29
+ * See CLAUDE.md rule: "Zod fast-path sync invariant".
30
+ */
31
+ const heartbeatSchema = z.object({
32
+ type: z.literal("heartbeat"),
33
+ timestamp: z.number()
34
+ });
35
+ /** Acknowledgment of a received message. */
36
+ const ackSchema = z.object({
37
+ type: z.literal("ack"),
38
+ messageId: z.string()
39
+ });
40
+ /** Negative acknowledgment - message received but could not be processed. */
41
+ const nackSchema = z.object({
42
+ type: z.literal("nack"),
43
+ messageId: z.string(),
44
+ reason: z.string()
45
+ });
46
+ /** Protocol-level error message. */
47
+ const errorSchema = z.object({
48
+ type: z.literal("error"),
49
+ code: z.string(),
50
+ message: z.string()
51
+ });
52
+ //#endregion
53
+ export { WS_MAX_PAYLOAD_BYTES, ackSchema, errorSchema, heartbeatSchema, nackSchema };
54
+
55
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Dashboard REST-over-WS protocol messages for org-level global workflow settings.
3
+ *
4
+ * Platform forwards these requests over the coordinator WS to the orchestrator,
5
+ * which owns the `org_settings` table. The orchestrator responds with the
6
+ * current (or patched) row projected into the shape below.
7
+ *
8
+ * Exposed via the `@kici-dev/engine/protocol/dashboard-global-workflows` subpath
9
+ * export (not the barrel) so server consumers can import without pulling
10
+ * anything unrelated into the dashboard bundle.
11
+ *
12
+ * Each repo-list entry is a `{routingKey?, pattern}` object. When
13
+ * `routingKey` is absent, the entry applies to events / workflows from any
14
+ * source in the org. When present, it qualifies the entry to a single
15
+ * webhook source (e.g., `github:42` vs `generic:org:abcd`).
16
+ *
17
+ * Three independent policy axes (see GlobalWorkflowPolicy in the orchestrator):
18
+ * - `allowedRepos` restricts which repos may AUTHOR global workflows.
19
+ * - `deniedRepos` blocks global dispatches for events FROM these SOURCE repos.
20
+ * - `elevatedRepos` lists workflow-author repos with access to source secrets.
21
+ */
22
+ import { z } from 'zod';
23
+ /**
24
+ * One entry in any of the three repo-pattern lists. `routingKey` is the
25
+ * source-qualifier; when absent the entry applies to any source in the org.
26
+ */
27
+ export declare const repoPatternEntrySchema: z.ZodObject<{
28
+ routingKey: z.ZodOptional<z.ZodString>;
29
+ pattern: z.ZodString;
30
+ }, z.core.$strip>;
31
+ export type RepoPatternEntry = z.infer<typeof repoPatternEntrySchema>;
32
+ /** Projected org-level global workflow settings. */
33
+ export declare const globalWorkflowSettingsSchema: z.ZodObject<{
34
+ customerId: z.ZodString;
35
+ enabled: z.ZodBoolean;
36
+ allowedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
37
+ routingKey: z.ZodOptional<z.ZodString>;
38
+ pattern: z.ZodString;
39
+ }, z.core.$strip>>>;
40
+ deniedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
41
+ routingKey: z.ZodOptional<z.ZodString>;
42
+ pattern: z.ZodString;
43
+ }, z.core.$strip>>>;
44
+ elevatedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
45
+ routingKey: z.ZodOptional<z.ZodString>;
46
+ pattern: z.ZodString;
47
+ }, z.core.$strip>>>;
48
+ createdAt: z.ZodNullable<z.ZodString>;
49
+ updatedAt: z.ZodNullable<z.ZodString>;
50
+ }, z.core.$strip>;
51
+ export type GlobalWorkflowSettings = z.infer<typeof globalWorkflowSettingsSchema>;
52
+ /** Request the current global-workflow settings row. */
53
+ export declare const globalWorkflowsGetRequestSchema: z.ZodObject<{
54
+ type: z.ZodLiteral<"dashboard.global-workflows.get">;
55
+ requestId: z.ZodString;
56
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
57
+ type: z.ZodLiteral<"user">;
58
+ sub: z.ZodString;
59
+ }, z.core.$strip>, z.ZodObject<{
60
+ type: z.ZodLiteral<"api_key">;
61
+ keyId: z.ZodString;
62
+ ownerSub: z.ZodString;
63
+ }, z.core.$strip>, z.ZodObject<{
64
+ type: z.ZodLiteral<"service_account">;
65
+ id: z.ZodString;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ type: z.ZodLiteral<"platform_operator">;
68
+ sub: z.ZodString;
69
+ reason: z.ZodString;
70
+ }, z.core.$strip>, z.ZodObject<{
71
+ type: z.ZodLiteral<"system">;
72
+ component: z.ZodString;
73
+ }, z.core.$strip>], "type">;
74
+ }, z.core.$strip>;
75
+ /**
76
+ * Patch the global-workflow settings row (upserts if missing).
77
+ *
78
+ * Every field is optional. `null` clears the corresponding list column
79
+ * (e.g., `allowedRepos: null` means "all repos pass the allow-list").
80
+ */
81
+ export declare const globalWorkflowsUpdateRequestSchema: z.ZodObject<{
82
+ type: z.ZodLiteral<"dashboard.global-workflows.update">;
83
+ requestId: z.ZodString;
84
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
85
+ type: z.ZodLiteral<"user">;
86
+ sub: z.ZodString;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ type: z.ZodLiteral<"api_key">;
89
+ keyId: z.ZodString;
90
+ ownerSub: z.ZodString;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ type: z.ZodLiteral<"service_account">;
93
+ id: z.ZodString;
94
+ }, z.core.$strip>, z.ZodObject<{
95
+ type: z.ZodLiteral<"platform_operator">;
96
+ sub: z.ZodString;
97
+ reason: z.ZodString;
98
+ }, z.core.$strip>, z.ZodObject<{
99
+ type: z.ZodLiteral<"system">;
100
+ component: z.ZodString;
101
+ }, z.core.$strip>], "type">;
102
+ enabled: z.ZodOptional<z.ZodBoolean>;
103
+ allowedRepos: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
104
+ routingKey: z.ZodOptional<z.ZodString>;
105
+ pattern: z.ZodString;
106
+ }, z.core.$strip>>>>;
107
+ deniedRepos: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
108
+ routingKey: z.ZodOptional<z.ZodString>;
109
+ pattern: z.ZodString;
110
+ }, z.core.$strip>>>>;
111
+ elevatedRepos: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
112
+ routingKey: z.ZodOptional<z.ZodString>;
113
+ pattern: z.ZodString;
114
+ }, z.core.$strip>>>>;
115
+ }, z.core.$strip>;
116
+ export declare const globalWorkflowsGetResponseSchema: z.ZodObject<{
117
+ type: z.ZodLiteral<"dashboard.global-workflows.get.response">;
118
+ requestId: z.ZodString;
119
+ settings: z.ZodOptional<z.ZodObject<{
120
+ customerId: z.ZodString;
121
+ enabled: z.ZodBoolean;
122
+ allowedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
123
+ routingKey: z.ZodOptional<z.ZodString>;
124
+ pattern: z.ZodString;
125
+ }, z.core.$strip>>>;
126
+ deniedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
127
+ routingKey: z.ZodOptional<z.ZodString>;
128
+ pattern: z.ZodString;
129
+ }, z.core.$strip>>>;
130
+ elevatedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
131
+ routingKey: z.ZodOptional<z.ZodString>;
132
+ pattern: z.ZodString;
133
+ }, z.core.$strip>>>;
134
+ createdAt: z.ZodNullable<z.ZodString>;
135
+ updatedAt: z.ZodNullable<z.ZodString>;
136
+ }, z.core.$strip>>;
137
+ error: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strip>;
139
+ export declare const globalWorkflowsUpdateResponseSchema: z.ZodObject<{
140
+ type: z.ZodLiteral<"dashboard.global-workflows.update.response">;
141
+ requestId: z.ZodString;
142
+ settings: z.ZodOptional<z.ZodObject<{
143
+ customerId: z.ZodString;
144
+ enabled: z.ZodBoolean;
145
+ allowedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
146
+ routingKey: z.ZodOptional<z.ZodString>;
147
+ pattern: z.ZodString;
148
+ }, z.core.$strip>>>;
149
+ deniedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
150
+ routingKey: z.ZodOptional<z.ZodString>;
151
+ pattern: z.ZodString;
152
+ }, z.core.$strip>>>;
153
+ elevatedRepos: z.ZodNullable<z.ZodArray<z.ZodObject<{
154
+ routingKey: z.ZodOptional<z.ZodString>;
155
+ pattern: z.ZodString;
156
+ }, z.core.$strip>>>;
157
+ createdAt: z.ZodNullable<z.ZodString>;
158
+ updatedAt: z.ZodNullable<z.ZodString>;
159
+ }, z.core.$strip>>;
160
+ error: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>;
162
+ export type GlobalWorkflowsGetRequest = z.infer<typeof globalWorkflowsGetRequestSchema>;
163
+ export type GlobalWorkflowsUpdateRequest = z.infer<typeof globalWorkflowsUpdateRequestSchema>;
164
+ export type GlobalWorkflowsGetResponse = z.infer<typeof globalWorkflowsGetResponseSchema>;
165
+ export type GlobalWorkflowsUpdateResponse = z.infer<typeof globalWorkflowsUpdateResponseSchema>;
166
+ //# sourceMappingURL=dashboard-global-workflows.d.ts.map
@@ -0,0 +1,80 @@
1
+ import "../../chunk-gOLHoazu.js";
2
+ import { actorPrincipalSchema } from "./actor.js";
3
+ import { z } from "zod";
4
+ //#region src/protocol/messages/dashboard-global-workflows.ts
5
+ /**
6
+ * Dashboard REST-over-WS protocol messages for org-level global workflow settings.
7
+ *
8
+ * Platform forwards these requests over the coordinator WS to the orchestrator,
9
+ * which owns the `org_settings` table. The orchestrator responds with the
10
+ * current (or patched) row projected into the shape below.
11
+ *
12
+ * Exposed via the `@kici-dev/engine/protocol/dashboard-global-workflows` subpath
13
+ * export (not the barrel) so server consumers can import without pulling
14
+ * anything unrelated into the dashboard bundle.
15
+ *
16
+ * Each repo-list entry is a `{routingKey?, pattern}` object. When
17
+ * `routingKey` is absent, the entry applies to events / workflows from any
18
+ * source in the org. When present, it qualifies the entry to a single
19
+ * webhook source (e.g., `github:42` vs `generic:org:abcd`).
20
+ *
21
+ * Three independent policy axes (see GlobalWorkflowPolicy in the orchestrator):
22
+ * - `allowedRepos` restricts which repos may AUTHOR global workflows.
23
+ * - `deniedRepos` blocks global dispatches for events FROM these SOURCE repos.
24
+ * - `elevatedRepos` lists workflow-author repos with access to source secrets.
25
+ */
26
+ /**
27
+ * One entry in any of the three repo-pattern lists. `routingKey` is the
28
+ * source-qualifier; when absent the entry applies to any source in the org.
29
+ */
30
+ const repoPatternEntrySchema = z.object({
31
+ routingKey: z.string().min(1).optional(),
32
+ pattern: z.string().min(1)
33
+ });
34
+ /** Projected org-level global workflow settings. */
35
+ const globalWorkflowSettingsSchema = z.object({
36
+ customerId: z.string(),
37
+ enabled: z.boolean(),
38
+ allowedRepos: z.array(repoPatternEntrySchema).nullable(),
39
+ deniedRepos: z.array(repoPatternEntrySchema).nullable(),
40
+ elevatedRepos: z.array(repoPatternEntrySchema).nullable(),
41
+ createdAt: z.string().nullable(),
42
+ updatedAt: z.string().nullable()
43
+ });
44
+ /** Request the current global-workflow settings row. */
45
+ const globalWorkflowsGetRequestSchema = z.object({
46
+ type: z.literal("dashboard.global-workflows.get"),
47
+ requestId: z.string(),
48
+ actor: actorPrincipalSchema
49
+ });
50
+ /**
51
+ * Patch the global-workflow settings row (upserts if missing).
52
+ *
53
+ * Every field is optional. `null` clears the corresponding list column
54
+ * (e.g., `allowedRepos: null` means "all repos pass the allow-list").
55
+ */
56
+ const globalWorkflowsUpdateRequestSchema = z.object({
57
+ type: z.literal("dashboard.global-workflows.update"),
58
+ requestId: z.string(),
59
+ actor: actorPrincipalSchema,
60
+ enabled: z.boolean().optional(),
61
+ allowedRepos: z.array(repoPatternEntrySchema).nullable().optional(),
62
+ deniedRepos: z.array(repoPatternEntrySchema).nullable().optional(),
63
+ elevatedRepos: z.array(repoPatternEntrySchema).nullable().optional()
64
+ });
65
+ const globalWorkflowsGetResponseSchema = z.object({
66
+ type: z.literal("dashboard.global-workflows.get.response"),
67
+ requestId: z.string(),
68
+ settings: globalWorkflowSettingsSchema.optional(),
69
+ error: z.string().optional()
70
+ });
71
+ const globalWorkflowsUpdateResponseSchema = z.object({
72
+ type: z.literal("dashboard.global-workflows.update.response"),
73
+ requestId: z.string(),
74
+ settings: globalWorkflowSettingsSchema.optional(),
75
+ error: z.string().optional()
76
+ });
77
+ //#endregion
78
+ export { globalWorkflowSettingsSchema, globalWorkflowsGetRequestSchema, globalWorkflowsGetResponseSchema, globalWorkflowsUpdateRequestSchema, globalWorkflowsUpdateResponseSchema, repoPatternEntrySchema };
79
+
80
+ //# sourceMappingURL=dashboard-global-workflows.js.map