@vibesdotdev/infra-core 0.0.2 → 1.0.0-rc.5
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 +18 -0
- package/README.md +27 -1
- package/dist/bootstrap/seed.descriptor.d.ts +1 -1
- package/dist/bootstrap/seed.descriptor.d.ts.map +1 -1
- package/dist/bootstrap/seed.descriptor.js +1 -1
- package/dist/bootstrap/seed.descriptor.js.map +1 -1
- package/dist/bootstrap/seed.impl-shape.d.ts +1 -1
- package/dist/bootstrap/seed.impl-shape.d.ts.map +1 -1
- package/dist/bootstrap/seed.kind.d.ts +1 -3
- package/dist/bootstrap/seed.kind.d.ts.map +1 -1
- package/dist/bootstrap/seed.kind.js +17 -4
- package/dist/bootstrap/seed.kind.js.map +1 -1
- package/dist/bootstrap/seed.runner.d.ts +9 -2
- package/dist/bootstrap/seed.runner.d.ts.map +1 -1
- package/dist/bootstrap/seed.runner.js +37 -18
- package/dist/bootstrap/seed.runner.js.map +1 -1
- package/dist/capped-id.d.ts +19 -0
- package/dist/capped-id.d.ts.map +1 -0
- package/dist/capped-id.js +64 -0
- package/dist/capped-id.js.map +1 -0
- package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts +23 -0
- package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js +33 -0
- package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js.map +1 -0
- package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts +24 -0
- package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/generate/artifact/artifact.cli-command.impl.js +73 -0
- package/dist/cli/generate/artifact/artifact.cli-command.impl.js.map +1 -0
- package/dist/cli/generate/context.d.ts +17 -0
- package/dist/cli/generate/context.d.ts.map +1 -0
- package/dist/cli/generate/context.js +24 -0
- package/dist/cli/generate/context.js.map +1 -0
- package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts +30 -0
- package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/generate/generate/generate.cli-command.descriptor.js +25 -0
- package/dist/cli/generate/generate/generate.cli-command.descriptor.js.map +1 -0
- package/dist/cli/generate/generate/generate.cli-command.impl.d.ts +25 -0
- package/dist/cli/generate/generate/generate.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/generate/generate/generate.cli-command.impl.js +64 -0
- package/dist/cli/generate/generate/generate.cli-command.impl.js.map +1 -0
- package/dist/cli/generate/generate-core.d.ts +51 -0
- package/dist/cli/generate/generate-core.d.ts.map +1 -0
- package/dist/cli/generate/generate-core.js +172 -0
- package/dist/cli/generate/generate-core.js.map +1 -0
- package/dist/cli/generate/index.d.ts +5 -0
- package/dist/cli/generate/index.d.ts.map +1 -0
- package/dist/cli/generate/index.js +5 -0
- package/dist/cli/generate/index.js.map +1 -0
- package/dist/credentials/resolve.d.ts +82 -22
- package/dist/credentials/resolve.d.ts.map +1 -1
- package/dist/credentials/resolve.js +251 -77
- package/dist/credentials/resolve.js.map +1 -1
- package/dist/deployment-environment.d.ts +30 -0
- package/dist/deployment-environment.d.ts.map +1 -0
- package/dist/deployment-environment.js +53 -0
- package/dist/deployment-environment.js.map +1 -0
- package/dist/deployment.d.ts +8 -4
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +30 -0
- package/dist/deployment.js.map +1 -1
- package/dist/doks/cloud/base.d.ts +49 -0
- package/dist/doks/cloud/base.d.ts.map +1 -0
- package/dist/doks/cloud/base.js +138 -0
- package/dist/doks/cloud/base.js.map +1 -0
- package/dist/doks/cloud/factory.d.ts +18 -0
- package/dist/doks/cloud/factory.d.ts.map +1 -0
- package/dist/doks/cloud/factory.js +22 -0
- package/dist/doks/cloud/factory.js.map +1 -0
- package/dist/doks/cloud/index.d.ts +5 -0
- package/dist/doks/cloud/index.d.ts.map +1 -0
- package/dist/doks/cloud/index.js +4 -0
- package/dist/doks/cloud/index.js.map +1 -0
- package/dist/doks/types.d.ts +95 -0
- package/dist/doks/types.d.ts.map +1 -0
- package/dist/doks/types.js +14 -0
- package/dist/doks/types.js.map +1 -0
- package/dist/generate/index.d.ts +29 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +28 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/generate/infra-generate.plugin.d.ts +3 -0
- package/dist/generate/infra-generate.plugin.d.ts.map +1 -0
- package/dist/generate/infra-generate.plugin.js +23 -0
- package/dist/generate/infra-generate.plugin.js.map +1 -0
- package/dist/generate/plugin.d.ts +2 -0
- package/dist/generate/plugin.d.ts.map +1 -0
- package/dist/generate/plugin.js +2 -0
- package/dist/generate/plugin.js.map +1 -0
- package/dist/heartbeat/cron-heartbeat.d.ts +97 -0
- package/dist/heartbeat/cron-heartbeat.d.ts.map +1 -0
- package/dist/heartbeat/cron-heartbeat.js +200 -0
- package/dist/heartbeat/cron-heartbeat.js.map +1 -0
- package/dist/index.d.ts +35 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -14
- package/dist/index.js.map +1 -1
- package/dist/infra.plugin.d.ts +1 -1
- package/dist/infra.plugin.d.ts.map +1 -1
- package/dist/infra.plugin.js +62 -12
- package/dist/infra.plugin.js.map +1 -1
- package/dist/kinds/alerts.kind.d.ts +64 -25
- package/dist/kinds/alerts.kind.d.ts.map +1 -1
- package/dist/kinds/alerts.kind.js +43 -16
- package/dist/kinds/alerts.kind.js.map +1 -1
- package/dist/kinds/artifact.kind.d.ts +58 -10
- package/dist/kinds/artifact.kind.d.ts.map +1 -1
- package/dist/kinds/artifact.kind.js +26 -9
- package/dist/kinds/artifact.kind.js.map +1 -1
- package/dist/kinds/billing.kind.d.ts +88 -0
- package/dist/kinds/billing.kind.d.ts.map +1 -0
- package/dist/kinds/billing.kind.js +48 -0
- package/dist/kinds/billing.kind.js.map +1 -0
- package/dist/kinds/build-job.kind.d.ts +381 -0
- package/dist/kinds/build-job.kind.d.ts.map +1 -0
- package/dist/kinds/build-job.kind.js +216 -0
- package/dist/kinds/build-job.kind.js.map +1 -0
- package/dist/kinds/cache.kind.d.ts +39 -92
- package/dist/kinds/cache.kind.d.ts.map +1 -1
- package/dist/kinds/cache.kind.js +26 -51
- package/dist/kinds/cache.kind.js.map +1 -1
- package/dist/kinds/cluster.kind.d.ts +154 -0
- package/dist/kinds/cluster.kind.d.ts.map +1 -0
- package/dist/kinds/cluster.kind.js +99 -0
- package/dist/kinds/cluster.kind.js.map +1 -0
- package/dist/kinds/compute-source.kind.d.ts +138 -0
- package/dist/kinds/compute-source.kind.d.ts.map +1 -0
- package/dist/kinds/compute-source.kind.js +145 -0
- package/dist/kinds/compute-source.kind.js.map +1 -0
- package/dist/kinds/compute-sources.descriptors.d.ts +45 -0
- package/dist/kinds/compute-sources.descriptors.d.ts.map +1 -0
- package/dist/kinds/compute-sources.descriptors.js +93 -0
- package/dist/kinds/compute-sources.descriptors.js.map +1 -0
- package/dist/kinds/container-registry.kind.d.ts +62 -0
- package/dist/kinds/container-registry.kind.d.ts.map +1 -0
- package/dist/kinds/container-registry.kind.js +47 -0
- package/dist/kinds/container-registry.kind.js.map +1 -0
- package/dist/kinds/database-migrator.kind.d.ts +6 -0
- package/dist/kinds/database-migrator.kind.d.ts.map +1 -0
- package/dist/kinds/database-migrator.kind.js +28 -0
- package/dist/kinds/database-migrator.kind.js.map +1 -0
- package/dist/kinds/database.kind.d.ts +114 -93
- package/dist/kinds/database.kind.d.ts.map +1 -1
- package/dist/kinds/database.kind.js +93 -54
- package/dist/kinds/database.kind.js.map +1 -1
- package/dist/kinds/deployment-provider.kind.d.ts +5 -0
- package/dist/kinds/deployment-provider.kind.d.ts.map +1 -0
- package/dist/kinds/deployment-provider.kind.js +11 -0
- package/dist/kinds/deployment-provider.kind.js.map +1 -0
- package/dist/kinds/discovery.d.ts +5 -12
- package/dist/kinds/discovery.d.ts.map +1 -1
- package/dist/kinds/discovery.js +5 -17
- package/dist/kinds/discovery.js.map +1 -1
- package/dist/kinds/dns.kind.d.ts +162 -0
- package/dist/kinds/dns.kind.d.ts.map +1 -0
- package/dist/kinds/dns.kind.js +54 -0
- package/dist/kinds/dns.kind.js.map +1 -0
- package/dist/kinds/drift.kind.d.ts +115 -0
- package/dist/kinds/drift.kind.d.ts.map +1 -0
- package/dist/kinds/drift.kind.js +60 -0
- package/dist/kinds/drift.kind.js.map +1 -0
- package/dist/kinds/edge-tls.kind.d.ts +194 -0
- package/dist/kinds/edge-tls.kind.d.ts.map +1 -0
- package/dist/kinds/edge-tls.kind.js +58 -0
- package/dist/kinds/edge-tls.kind.js.map +1 -0
- package/dist/kinds/firewall.kind.d.ts +92 -0
- package/dist/kinds/firewall.kind.d.ts.map +1 -0
- package/dist/kinds/firewall.kind.js +59 -0
- package/dist/kinds/firewall.kind.js.map +1 -0
- package/dist/kinds/git-hosting.kind.d.ts +36 -38
- package/dist/kinds/git-hosting.kind.d.ts.map +1 -1
- package/dist/kinds/git-hosting.kind.js +21 -32
- package/dist/kinds/git-hosting.kind.js.map +1 -1
- package/dist/kinds/index.d.ts +40 -15
- package/dist/kinds/index.d.ts.map +1 -1
- package/dist/kinds/index.js +39 -14
- package/dist/kinds/index.js.map +1 -1
- package/dist/kinds/inventory.kind.d.ts +327 -0
- package/dist/kinds/inventory.kind.d.ts.map +1 -0
- package/dist/kinds/inventory.kind.js +188 -0
- package/dist/kinds/inventory.kind.js.map +1 -0
- package/dist/kinds/load-balancer.kind.d.ts +135 -0
- package/dist/kinds/load-balancer.kind.d.ts.map +1 -0
- package/dist/kinds/load-balancer.kind.js +71 -0
- package/dist/kinds/load-balancer.kind.js.map +1 -0
- package/dist/kinds/logs.kind.d.ts +74 -3
- package/dist/kinds/logs.kind.d.ts.map +1 -1
- package/dist/kinds/logs.kind.js +26 -17
- package/dist/kinds/logs.kind.js.map +1 -1
- package/dist/kinds/nfs.kind.d.ts +67 -0
- package/dist/kinds/nfs.kind.d.ts.map +1 -0
- package/dist/kinds/nfs.kind.js +45 -0
- package/dist/kinds/nfs.kind.js.map +1 -0
- package/dist/kinds/node-pool.kind.d.ts +134 -0
- package/dist/kinds/node-pool.kind.d.ts.map +1 -0
- package/dist/kinds/node-pool.kind.js +88 -0
- package/dist/kinds/node-pool.kind.js.map +1 -0
- package/dist/kinds/object-storage.kind.d.ts +50 -24
- package/dist/kinds/object-storage.kind.d.ts.map +1 -1
- package/dist/kinds/object-storage.kind.js +40 -23
- package/dist/kinds/object-storage.kind.js.map +1 -1
- package/dist/kinds/observability.kind.d.ts +104 -6
- package/dist/kinds/observability.kind.d.ts.map +1 -1
- package/dist/kinds/observability.kind.js +67 -9
- package/dist/kinds/observability.kind.js.map +1 -1
- package/dist/kinds/package-registry.kind.d.ts +139 -33
- package/dist/kinds/package-registry.kind.d.ts.map +1 -1
- package/dist/kinds/package-registry.kind.js +55 -25
- package/dist/kinds/package-registry.kind.js.map +1 -1
- package/dist/kinds/queue.kind.d.ts +67 -63
- package/dist/kinds/queue.kind.d.ts.map +1 -1
- package/dist/kinds/queue.kind.js +55 -33
- package/dist/kinds/queue.kind.js.map +1 -1
- package/dist/kinds/read-descriptor.d.ts +15 -0
- package/dist/kinds/read-descriptor.d.ts.map +1 -0
- package/dist/kinds/read-descriptor.js +11 -0
- package/dist/kinds/read-descriptor.js.map +1 -0
- package/dist/kinds/rum.kind.d.ts +36 -6
- package/dist/kinds/rum.kind.d.ts.map +1 -1
- package/dist/kinds/rum.kind.js +6 -7
- package/dist/kinds/rum.kind.js.map +1 -1
- package/dist/kinds/sandbox.kind.d.ts +136 -36
- package/dist/kinds/sandbox.kind.d.ts.map +1 -1
- package/dist/kinds/sandbox.kind.js +80 -34
- package/dist/kinds/sandbox.kind.js.map +1 -1
- package/dist/kinds/select-compute-source.d.ts +72 -0
- package/dist/kinds/select-compute-source.d.ts.map +1 -0
- package/dist/kinds/select-compute-source.js +170 -0
- package/dist/kinds/select-compute-source.js.map +1 -0
- package/dist/kinds/service-release.kind.d.ts +771 -0
- package/dist/kinds/service-release.kind.d.ts.map +1 -0
- package/dist/kinds/service-release.kind.js +676 -0
- package/dist/kinds/service-release.kind.js.map +1 -0
- package/dist/kinds/spend-guard.kind.d.ts +40 -0
- package/dist/kinds/spend-guard.kind.d.ts.map +1 -0
- package/dist/kinds/spend-guard.kind.js +133 -0
- package/dist/kinds/spend-guard.kind.js.map +1 -0
- package/dist/kinds/utilization.kind.d.ts +88 -0
- package/dist/kinds/utilization.kind.d.ts.map +1 -0
- package/dist/kinds/utilization.kind.js +62 -0
- package/dist/kinds/utilization.kind.js.map +1 -0
- package/dist/kinds/volume.kind.d.ts +54 -0
- package/dist/kinds/volume.kind.d.ts.map +1 -0
- package/dist/kinds/volume.kind.js +39 -0
- package/dist/kinds/volume.kind.js.map +1 -0
- package/dist/kinds/vpc.kind.d.ts +61 -0
- package/dist/kinds/vpc.kind.d.ts.map +1 -0
- package/dist/kinds/vpc.kind.js +51 -0
- package/dist/kinds/vpc.kind.js.map +1 -0
- package/dist/kinds/web-app.kind.d.ts +115 -45
- package/dist/kinds/web-app.kind.d.ts.map +1 -1
- package/dist/kinds/web-app.kind.js +69 -42
- package/dist/kinds/web-app.kind.js.map +1 -1
- package/dist/kinds/worker.kind.d.ts +293 -188
- package/dist/kinds/worker.kind.d.ts.map +1 -1
- package/dist/kinds/worker.kind.js +45 -123
- package/dist/kinds/worker.kind.js.map +1 -1
- package/dist/schemas/database-migration.d.ts +173 -0
- package/dist/schemas/database-migration.d.ts.map +1 -0
- package/dist/schemas/database-migration.js +88 -0
- package/dist/schemas/database-migration.js.map +1 -0
- package/dist/schemas/deployment-environment.d.ts +11 -0
- package/dist/schemas/deployment-environment.d.ts.map +1 -0
- package/dist/schemas/deployment-environment.js +9 -0
- package/dist/schemas/deployment-environment.js.map +1 -0
- package/dist/schemas/deployment-provider.d.ts +336 -0
- package/dist/schemas/deployment-provider.d.ts.map +1 -0
- package/dist/schemas/deployment-provider.js +198 -0
- package/dist/schemas/deployment-provider.js.map +1 -0
- package/dist/schemas/log-stream.d.ts +27 -0
- package/dist/schemas/log-stream.d.ts.map +1 -0
- package/dist/schemas/log-stream.js +31 -0
- package/dist/schemas/log-stream.js.map +1 -0
- package/dist/schemas/spend-guard.d.ts +155 -0
- package/dist/schemas/spend-guard.d.ts.map +1 -0
- package/dist/schemas/spend-guard.js +61 -0
- package/dist/schemas/spend-guard.js.map +1 -0
- package/dist/schemas.d.ts +190 -20
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +137 -31
- package/dist/schemas.js.map +1 -1
- package/dist/service.d.ts +87 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +199 -0
- package/dist/service.js.map +1 -0
- package/dist/settle-work.d.ts +20 -0
- package/dist/settle-work.d.ts.map +1 -0
- package/dist/settle-work.js +22 -0
- package/dist/settle-work.js.map +1 -0
- package/dist/web-app-projection.d.ts +132 -0
- package/dist/web-app-projection.d.ts.map +1 -0
- package/dist/web-app-projection.js +93 -0
- package/dist/web-app-projection.js.map +1 -0
- package/package.json +87 -36
- package/src/bootstrap/index.ts +0 -15
- package/src/bootstrap/seed.descriptor.ts +0 -24
- package/src/bootstrap/seed.impl-shape.ts +0 -5
- package/src/bootstrap/seed.kind.ts +0 -26
- package/src/bootstrap/seed.runner.ts +0 -87
- package/src/credentials/resolve.ts +0 -205
- package/src/deployment.ts +0 -57
- package/src/index.ts +0 -149
- package/src/infra.plugin.ts +0 -54
- package/src/kinds/alerts.kind.ts +0 -164
- package/src/kinds/artifact.kind.ts +0 -96
- package/src/kinds/cache.kind.ts +0 -104
- package/src/kinds/database.kind.ts +0 -120
- package/src/kinds/discovery.ts +0 -26
- package/src/kinds/git-hosting.kind.ts +0 -100
- package/src/kinds/index.ts +0 -139
- package/src/kinds/logs.kind.ts +0 -104
- package/src/kinds/object-storage.kind.ts +0 -101
- package/src/kinds/observability.kind.ts +0 -178
- package/src/kinds/package-registry.kind.ts +0 -95
- package/src/kinds/queue.kind.ts +0 -102
- package/src/kinds/rum.kind.ts +0 -135
- package/src/kinds/sandbox.kind.ts +0 -115
- package/src/kinds/web-app.kind.ts +0 -103
- package/src/kinds/worker.kind.ts +0 -203
- package/src/schemas.ts +0 -127
|
@@ -7,15 +7,16 @@
|
|
|
7
7
|
*
|
|
8
8
|
* 1. The CLI can introspect + write settings across the entire fleet
|
|
9
9
|
* without going through deploy.
|
|
10
|
-
* 2. Cross-cutting policies (e.g. "
|
|
11
|
-
*
|
|
10
|
+
* 2. Cross-cutting policies (e.g. "full log capture on every Worker")
|
|
11
|
+
* have a single declarative shape.
|
|
12
12
|
* 3. Provider impls map onto the native control plane (CF Workers
|
|
13
13
|
* Observability, DO Monitoring, Datadog, etc.).
|
|
14
14
|
*
|
|
15
15
|
* CLI surface (`vibes infra observability …`):
|
|
16
16
|
* status [--worker] read current settings
|
|
17
|
-
* set [--worker] --sampling
|
|
18
|
-
* exports list
|
|
17
|
+
* set [--worker] --sampling 1 write new settings
|
|
18
|
+
* exports list read safe export inventory
|
|
19
|
+
* exports add|remove (not yet wired)
|
|
19
20
|
*
|
|
20
21
|
* Production Workers consume settings via their wrangler.jsonc; the CLI
|
|
21
22
|
* writes directly to the provider API for immediate effect. To avoid
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
* path — the CLI here is for ops-time tuning between deploys.
|
|
24
25
|
*/
|
|
25
26
|
import * as z from 'zod/v4';
|
|
27
|
+
import { type InfraAuthorityFingerprint, type InfraProviderFailure } from './inventory.kind.ts';
|
|
26
28
|
declare const ObservabilityScopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
29
|
kind: z.ZodLiteral<"worker">;
|
|
28
30
|
workerName: z.ZodString;
|
|
@@ -72,6 +74,33 @@ declare const ObservabilitySettingsSchema: z.ZodObject<{
|
|
|
72
74
|
}, z.core.$strip>], "kind">>>;
|
|
73
75
|
}, z.core.$strip>;
|
|
74
76
|
export type ObservabilitySettings = z.infer<typeof ObservabilitySettingsSchema>;
|
|
77
|
+
/**
|
|
78
|
+
* Provider-neutral queue health evidence collected from an adapter's live
|
|
79
|
+
* control plane. `oldestMessageAgeMs` is an age, rather than a provider
|
|
80
|
+
* timestamp, so consumers can compare it directly to a declared retention
|
|
81
|
+
* window.
|
|
82
|
+
*/
|
|
83
|
+
export declare const QueueBacklogSchema: z.ZodObject<{
|
|
84
|
+
queueName: z.ZodString;
|
|
85
|
+
backlogCount: z.ZodNumber;
|
|
86
|
+
backlogBytes: z.ZodNumber;
|
|
87
|
+
oldestMessageAgeMs: z.ZodNumber;
|
|
88
|
+
capturedAt: z.ZodString;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export type QueueBacklog = z.infer<typeof QueueBacklogSchema>;
|
|
91
|
+
export interface QueueBacklogAlert {
|
|
92
|
+
alerting: boolean;
|
|
93
|
+
thresholdMs: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A queue is alerting only after its oldest message has consumed more than
|
|
97
|
+
* half of its retention window. Equality is deliberately healthy: the
|
|
98
|
+
* policy is strictly `age > retention / 2`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function evaluateQueueBacklogAlert(queueBacklog: QueueBacklog, retentionMs: number): QueueBacklogAlert;
|
|
101
|
+
export interface QueueBacklogImplementation {
|
|
102
|
+
listQueueBacklogs(): Promise<QueueBacklog[]>;
|
|
103
|
+
}
|
|
75
104
|
declare const ObservabilityBaseSchema: z.ZodObject<{
|
|
76
105
|
id: z.ZodString;
|
|
77
106
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -80,9 +109,19 @@ declare const ObservabilityBaseSchema: z.ZodObject<{
|
|
|
80
109
|
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
110
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
82
111
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
capabilityId: z.ZodOptional<z.ZodString>;
|
|
83
113
|
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
84
114
|
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
85
|
-
config: z.ZodOptional<z.
|
|
115
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
116
|
+
retention: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
117
|
+
maxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
cascadeFrom: z.ZodOptional<z.ZodString>;
|
|
121
|
+
ageField: z.ZodOptional<z.ZodString>;
|
|
122
|
+
reason: z.ZodString;
|
|
123
|
+
enforcedBy: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, z.core.$strip>]>>;
|
|
86
125
|
kind: z.ZodLiteral<"infra/observability">;
|
|
87
126
|
adapter: z.ZodString;
|
|
88
127
|
adapterConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -141,7 +180,62 @@ export interface ObservabilitySnapshot {
|
|
|
141
180
|
settings: ObservabilitySettings;
|
|
142
181
|
/** Last-modified timestamp from the provider, when available. */
|
|
143
182
|
modifiedAt?: string;
|
|
183
|
+
/** Bounded provider-safe evidence when this worker could not be read. */
|
|
184
|
+
failure?: InfraProviderFailure;
|
|
144
185
|
}
|
|
186
|
+
/** Public inventory deliberately excludes destination credentials and URL paths. */
|
|
187
|
+
export declare const ObservabilityExportDestinationSchema: z.ZodObject<{
|
|
188
|
+
id: z.ZodString;
|
|
189
|
+
name: z.ZodString;
|
|
190
|
+
signal: z.ZodEnum<{
|
|
191
|
+
unknown: "unknown";
|
|
192
|
+
logs: "logs";
|
|
193
|
+
traces: "traces";
|
|
194
|
+
}>;
|
|
195
|
+
enabled: z.ZodBoolean;
|
|
196
|
+
endpointOrigin: z.ZodOptional<z.ZodPipe<z.ZodURL, z.ZodTransform<string, string>>>;
|
|
197
|
+
transport: z.ZodEnum<{
|
|
198
|
+
unknown: "unknown";
|
|
199
|
+
http: "http";
|
|
200
|
+
https: "https";
|
|
201
|
+
}>;
|
|
202
|
+
headerNames: z.ZodArray<z.ZodString>;
|
|
203
|
+
lastDeliveredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
204
|
+
lastErrorAt: z.ZodOptional<z.ZodISODateTime>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
export type ObservabilityExportDestination = z.infer<typeof ObservabilityExportDestinationSchema>;
|
|
207
|
+
export declare const ObservabilityExportInventorySchema: z.ZodObject<{
|
|
208
|
+
destinations: z.ZodArray<z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
name: z.ZodString;
|
|
211
|
+
signal: z.ZodEnum<{
|
|
212
|
+
unknown: "unknown";
|
|
213
|
+
logs: "logs";
|
|
214
|
+
traces: "traces";
|
|
215
|
+
}>;
|
|
216
|
+
enabled: z.ZodBoolean;
|
|
217
|
+
endpointOrigin: z.ZodOptional<z.ZodPipe<z.ZodURL, z.ZodTransform<string, string>>>;
|
|
218
|
+
transport: z.ZodEnum<{
|
|
219
|
+
unknown: "unknown";
|
|
220
|
+
http: "http";
|
|
221
|
+
https: "https";
|
|
222
|
+
}>;
|
|
223
|
+
headerNames: z.ZodArray<z.ZodString>;
|
|
224
|
+
lastDeliveredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
225
|
+
lastErrorAt: z.ZodOptional<z.ZodISODateTime>;
|
|
226
|
+
}, z.core.$strip>>;
|
|
227
|
+
workers: z.ZodArray<z.ZodObject<{
|
|
228
|
+
workerName: z.ZodString;
|
|
229
|
+
logs: z.ZodArray<z.ZodString>;
|
|
230
|
+
traces: z.ZodArray<z.ZodString>;
|
|
231
|
+
failure: z.ZodOptional<z.ZodObject<{
|
|
232
|
+
code: z.ZodString;
|
|
233
|
+
message: z.ZodString;
|
|
234
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
235
|
+
}, z.core.$strip>>;
|
|
236
|
+
}, z.core.$strip>>;
|
|
237
|
+
}, z.core.$strip>;
|
|
238
|
+
export type ObservabilityExportInventory = z.infer<typeof ObservabilityExportInventorySchema>;
|
|
145
239
|
export interface SetObservabilityInput {
|
|
146
240
|
scope: ObservabilityScope;
|
|
147
241
|
settings: ObservabilitySettings;
|
|
@@ -164,12 +258,16 @@ export interface SetObservabilityResult {
|
|
|
164
258
|
* Implementation contract every provider implements.
|
|
165
259
|
*/
|
|
166
260
|
export interface ObservabilityImplementation {
|
|
261
|
+
/** Redacted authority used by the latest provider request, when applicable. */
|
|
262
|
+
getAuthority?(): Promise<InfraAuthorityFingerprint>;
|
|
167
263
|
/** Read current settings for a scope. account-wide → one snapshot per Worker. */
|
|
168
264
|
getStatus(scope: ObservabilityScope): Promise<ObservabilitySnapshot[]>;
|
|
265
|
+
/** Read export destinations and worker bindings without proving collector delivery. */
|
|
266
|
+
listExports?(scope: ObservabilityScope): Promise<ObservabilityExportInventory>;
|
|
169
267
|
/** Apply settings to a scope. Returns per-Worker outcome. */
|
|
170
268
|
set(input: SetObservabilityInput): Promise<SetObservabilityResult>;
|
|
171
269
|
}
|
|
172
|
-
export declare const observabilityKind: import("@vibesdotdev/
|
|
270
|
+
export declare const observabilityKind: import("@vibesdotdev/kernel").RuntimeKindDescriptorRecord<ObservabilityImplementation>;
|
|
173
271
|
export type InfraObservabilityKind = InfraObservabilityDescriptor;
|
|
174
272
|
export type InfraObservabilityKindInput = InfraObservabilityDescriptorInput;
|
|
175
273
|
export { ObservabilityBaseSchema as InfraObservabilityDescriptorSchema, ObservabilityScopeSchema, ObservabilitySettingsSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/observability.kind.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"observability.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/observability.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,O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6DAA6D;IAC7D,GAAG,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,iBAAiB,wFAO5B,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAClE,MAAM,MAAM,2BAA2B,GAAG,iCAAiC,CAAC;AAE5E,OAAO,EACN,uBAAuB,IAAI,kCAAkC,EAC7D,wBAAwB,EACxB,2BAA2B,EAC3B,CAAC"}
|
|
@@ -7,15 +7,16 @@
|
|
|
7
7
|
*
|
|
8
8
|
* 1. The CLI can introspect + write settings across the entire fleet
|
|
9
9
|
* without going through deploy.
|
|
10
|
-
* 2. Cross-cutting policies (e.g. "
|
|
11
|
-
*
|
|
10
|
+
* 2. Cross-cutting policies (e.g. "full log capture on every Worker")
|
|
11
|
+
* have a single declarative shape.
|
|
12
12
|
* 3. Provider impls map onto the native control plane (CF Workers
|
|
13
13
|
* Observability, DO Monitoring, Datadog, etc.).
|
|
14
14
|
*
|
|
15
15
|
* CLI surface (`vibes infra observability …`):
|
|
16
16
|
* status [--worker] read current settings
|
|
17
|
-
* set [--worker] --sampling
|
|
18
|
-
* exports list
|
|
17
|
+
* set [--worker] --sampling 1 write new settings
|
|
18
|
+
* exports list read safe export inventory
|
|
19
|
+
* exports add|remove (not yet wired)
|
|
19
20
|
*
|
|
20
21
|
* Production Workers consume settings via their wrangler.jsonc; the CLI
|
|
21
22
|
* writes directly to the provider API for immediate effect. To avoid
|
|
@@ -23,9 +24,11 @@
|
|
|
23
24
|
* path — the CLI here is for ops-time tuning between deploys.
|
|
24
25
|
*/
|
|
25
26
|
import * as z from 'zod/v4';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
27
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
28
|
+
import { createRuntimeKind } from '@vibesdotdev/kernel/factory/kind';
|
|
29
|
+
import { RuntimeDescriptorSchema } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
30
|
+
import { InfraProviderFailureSchema } from "./inventory.kind.js";
|
|
31
|
+
import { INFRA_DISCOVERY_PATTERNS } from "./discovery.js";
|
|
29
32
|
const ObservabilityScopeSchema = z.discriminatedUnion('kind', [
|
|
30
33
|
z.object({
|
|
31
34
|
kind: z.literal('worker'),
|
|
@@ -92,6 +95,36 @@ const ObservabilitySettingsSchema = z.object({
|
|
|
92
95
|
]))
|
|
93
96
|
.optional()
|
|
94
97
|
});
|
|
98
|
+
/**
|
|
99
|
+
* Provider-neutral queue health evidence collected from an adapter's live
|
|
100
|
+
* control plane. `oldestMessageAgeMs` is an age, rather than a provider
|
|
101
|
+
* timestamp, so consumers can compare it directly to a declared retention
|
|
102
|
+
* window.
|
|
103
|
+
*/
|
|
104
|
+
export const QueueBacklogSchema = z.object({
|
|
105
|
+
queueName: z.string().min(1),
|
|
106
|
+
backlogCount: z.number().int().nonnegative(),
|
|
107
|
+
backlogBytes: z.number().int().nonnegative(),
|
|
108
|
+
oldestMessageAgeMs: z.number().int().nonnegative(),
|
|
109
|
+
capturedAt: z.string().datetime()
|
|
110
|
+
});
|
|
111
|
+
/**
|
|
112
|
+
* A queue is alerting only after its oldest message has consumed more than
|
|
113
|
+
* half of its retention window. Equality is deliberately healthy: the
|
|
114
|
+
* policy is strictly `age > retention / 2`.
|
|
115
|
+
*/
|
|
116
|
+
export function evaluateQueueBacklogAlert(queueBacklog, retentionMs) {
|
|
117
|
+
if (!Number.isFinite(retentionMs) || retentionMs <= 0) {
|
|
118
|
+
throw new CapabilityError('Queue backlog retention must be a positive finite number of milliseconds.', 'INVALID_INPUT', {
|
|
119
|
+
reason: 'queue-backlog-retention-invalid'
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const thresholdMs = retentionMs / 2;
|
|
123
|
+
return {
|
|
124
|
+
alerting: queueBacklog.oldestMessageAgeMs > thresholdMs,
|
|
125
|
+
thresholdMs
|
|
126
|
+
};
|
|
127
|
+
}
|
|
95
128
|
const ObservabilityBaseSchema = RuntimeDescriptorSchema.extend({
|
|
96
129
|
kind: z.literal('infra/observability'),
|
|
97
130
|
adapter: z.string().min(1),
|
|
@@ -110,11 +143,36 @@ const ObservabilityBaseSchema = RuntimeDescriptorSchema.extend({
|
|
|
110
143
|
*/
|
|
111
144
|
settings: ObservabilitySettingsSchema.optional()
|
|
112
145
|
});
|
|
146
|
+
/** Public inventory deliberately excludes destination credentials and URL paths. */
|
|
147
|
+
export const ObservabilityExportDestinationSchema = z.object({
|
|
148
|
+
id: z.string().min(1),
|
|
149
|
+
name: z.string(),
|
|
150
|
+
signal: z.enum(['logs', 'traces', 'unknown']),
|
|
151
|
+
enabled: z.boolean(),
|
|
152
|
+
endpointOrigin: z
|
|
153
|
+
.url({ protocol: /^https?$/ })
|
|
154
|
+
.transform((value) => new URL(value).origin)
|
|
155
|
+
.optional(),
|
|
156
|
+
/** URL scheme only; does not certify an OTLP encoding or collector. */
|
|
157
|
+
transport: z.enum(['http', 'https', 'unknown']),
|
|
158
|
+
headerNames: z.array(z.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/)),
|
|
159
|
+
lastDeliveredAt: z.iso.datetime().optional(),
|
|
160
|
+
lastErrorAt: z.iso.datetime().optional()
|
|
161
|
+
});
|
|
162
|
+
export const ObservabilityExportInventorySchema = z.object({
|
|
163
|
+
destinations: z.array(ObservabilityExportDestinationSchema),
|
|
164
|
+
workers: z.array(z.object({
|
|
165
|
+
workerName: z.string().min(1),
|
|
166
|
+
logs: z.array(z.string()),
|
|
167
|
+
traces: z.array(z.string()),
|
|
168
|
+
/** When present, empty lists mean unreadable, not confirmed unconfigured. */
|
|
169
|
+
failure: InfraProviderFailureSchema.optional()
|
|
170
|
+
}))
|
|
171
|
+
});
|
|
113
172
|
export const observabilityKind = createRuntimeKind({
|
|
114
173
|
id: 'infra/observability',
|
|
115
174
|
descriptorSchema: ObservabilityBaseSchema,
|
|
116
|
-
|
|
117
|
-
extractStem
|
|
175
|
+
discoveryPatterns: INFRA_DISCOVERY_PATTERNS
|
|
118
176
|
});
|
|
119
177
|
export { ObservabilityBaseSchema as InfraObservabilityDescriptorSchema, ObservabilityScopeSchema, ObservabilitySettingsSchema };
|
|
120
178
|
//# sourceMappingURL=observability.kind.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability.kind.js","sourceRoot":"","sources":["../../src/kinds/observability.kind.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"observability.kind.js","sourceRoot":"","sources":["../../src/kinds/observability.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EACN,0BAA0B,EAG1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,wBAAwB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7D,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACzB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;KAC7B,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,uEAAuE;QACvE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC7B,CAAC;CACF,CAAC,CAAC;AAIH;;;;GAIG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC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AE,OAAO,EAAE,SAAS,CAAC,CAAC;IAC/C,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACvE,eAAe,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1D,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,oCAAoC,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAC,KAAK,CACf,CAAC,CAAC,MAAM,CAAC;QACR,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC3B,6EAA6E;QAC7E,OAAO,EAAE,0BAA0B,CAAC,QAAQ,EAAE;KAC9C,CAAC,CACF;CACD,CAAC,CAAC;AA8BH,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAGhD;IACD,EAAE,EAAE,qBAAqB;IACzB,gBAAgB,EAAE,uBAAuB;IACzC,iBAAiB,EAAE,wBAAwB;CAC3C,CAAC,CAAC;AAKH,OAAO,EACN,uBAAuB,IAAI,kCAAkC,EAC7D,wBAAwB,EACxB,2BAA2B,EAC3B,CAAC"}
|
|
@@ -11,10 +11,18 @@
|
|
|
11
11
|
* - Adapter-specific fields (dockerImage, storageSize, domain, …)
|
|
12
12
|
* live exclusively under `config`. Each adapter package defines its own
|
|
13
13
|
* concrete schema under its discriminator key.
|
|
14
|
+
* - `publish` is how a release writes to this registry: the Secrets key that
|
|
15
|
+
* holds its credential, the second factor the account asks for, and, for a
|
|
16
|
+
* registry that only ever carries another registry's exact bytes, `mirrorOf`.
|
|
17
|
+
*
|
|
18
|
+
* Every release surface (`vibes infra npm publish`, `vibes infra npm mirror`,
|
|
19
|
+
* Forge's `publish:` step) resolves a registry by id through this kind and
|
|
20
|
+
* calls its implementation ({@link PackageRegistryImplementation}). The adapter
|
|
21
|
+
* named by `config.adapter` registers that implementation per descriptor id;
|
|
22
|
+
* a registry with no registered implementation refuses typed
|
|
23
|
+
* (`package-registry-implementation-missing`), never a silent fallback.
|
|
14
24
|
*/
|
|
15
25
|
import * as z from 'zod/v4';
|
|
16
|
-
import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
|
|
17
|
-
import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
18
26
|
export declare const PackageRegistryTypeSchema: z.ZodEnum<{
|
|
19
27
|
npm: "npm";
|
|
20
28
|
docker: "docker";
|
|
@@ -22,21 +30,23 @@ export declare const PackageRegistryTypeSchema: z.ZodEnum<{
|
|
|
22
30
|
helm: "helm";
|
|
23
31
|
}>;
|
|
24
32
|
export type PackageRegistryType = z.infer<typeof PackageRegistryTypeSchema>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
/** What a release writes with: the credential's Secrets key, the account's second factor, and an exact-bytes source. */
|
|
34
|
+
export declare const PackageRegistryPublishSchema: z.ZodObject<{
|
|
35
|
+
credential: z.ZodObject<{
|
|
36
|
+
secret: z.ZodString;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
secondFactor: z.ZodDefault<z.ZodEnum<{
|
|
39
|
+
web: "web";
|
|
40
|
+
none: "none";
|
|
41
|
+
otp: "otp";
|
|
42
|
+
}>>;
|
|
43
|
+
mirrorOf: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type PackageRegistryPublish = z.infer<typeof PackageRegistryPublishSchema>;
|
|
46
|
+
/** Open adapter config: the adapter package that owns `adapter` validates the rest. */
|
|
47
|
+
export declare const PackageRegistryConfigSchema: z.ZodObject<{
|
|
48
|
+
adapter: z.ZodString;
|
|
49
|
+
}, z.core.$loose>;
|
|
40
50
|
export declare const PackageRegistryDescriptorSchema: z.ZodObject<{
|
|
41
51
|
id: z.ZodString;
|
|
42
52
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -45,10 +55,21 @@ export declare const PackageRegistryDescriptorSchema: z.ZodObject<{
|
|
|
45
55
|
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
56
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
47
57
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
capabilityId: z.ZodOptional<z.ZodString>;
|
|
48
59
|
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
60
|
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
|
+
retention: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
62
|
+
maxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
cascadeFrom: z.ZodOptional<z.ZodString>;
|
|
66
|
+
ageField: z.ZodOptional<z.ZodString>;
|
|
67
|
+
reason: z.ZodString;
|
|
68
|
+
enforcedBy: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>]>>;
|
|
50
70
|
kind: z.ZodLiteral<"infra/package-registry">;
|
|
51
|
-
url: z.ZodString
|
|
71
|
+
url: z.ZodOptional<z.ZodString>;
|
|
72
|
+
service: z.ZodOptional<z.ZodString>;
|
|
52
73
|
registryType: z.ZodDefault<z.ZodEnum<{
|
|
53
74
|
npm: "npm";
|
|
54
75
|
docker: "docker";
|
|
@@ -67,23 +88,108 @@ export declare const PackageRegistryDescriptorSchema: z.ZodObject<{
|
|
|
67
88
|
secret: z.ZodOptional<z.ZodBoolean>;
|
|
68
89
|
description: z.ZodOptional<z.ZodString>;
|
|
69
90
|
storeKey: z.ZodOptional<z.ZodString>;
|
|
91
|
+
storeBinding: z.ZodOptional<z.ZodBoolean>;
|
|
70
92
|
}, z.core.$strip>>>;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
publish: z.ZodOptional<z.ZodObject<{
|
|
94
|
+
credential: z.ZodObject<{
|
|
95
|
+
secret: z.ZodString;
|
|
96
|
+
}, z.core.$strict>;
|
|
97
|
+
secondFactor: z.ZodDefault<z.ZodEnum<{
|
|
98
|
+
web: "web";
|
|
99
|
+
none: "none";
|
|
100
|
+
otp: "otp";
|
|
101
|
+
}>>;
|
|
102
|
+
mirrorOf: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strict>>;
|
|
104
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
adapter: z.ZodString;
|
|
106
|
+
}, z.core.$loose>>;
|
|
79
107
|
}, z.core.$strip>;
|
|
80
108
|
export type PackageRegistryDescriptor = z.infer<typeof PackageRegistryDescriptorSchema>;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
109
|
+
/** One released version as a registry serves it. */
|
|
110
|
+
export type PackageRegistryRelease = {
|
|
111
|
+
version: string;
|
|
112
|
+
integrity: string;
|
|
113
|
+
};
|
|
114
|
+
/** What reading a package's release tag found. */
|
|
115
|
+
export type PackageRegistryReleaseRead = {
|
|
116
|
+
state: 'released';
|
|
117
|
+
release: PackageRegistryRelease;
|
|
118
|
+
}
|
|
119
|
+
/** The registry does not serve the package to this reader. */
|
|
120
|
+
| {
|
|
121
|
+
state: 'absent';
|
|
122
|
+
} | {
|
|
123
|
+
state: 'untagged';
|
|
124
|
+
};
|
|
125
|
+
/** Every release tag a registry serves for one package. */
|
|
126
|
+
export type PackageRegistryReleasesRead = {
|
|
127
|
+
state: 'released';
|
|
128
|
+
tags: Record<string, PackageRegistryRelease>;
|
|
129
|
+
}
|
|
130
|
+
/** The registry does not serve the package to this reader. */
|
|
131
|
+
| {
|
|
132
|
+
state: 'absent';
|
|
133
|
+
};
|
|
134
|
+
/** The second factor a write answers with, as the descriptor's `publish.secondFactor` asks. */
|
|
135
|
+
export type PackageRegistrySecondFactor = {
|
|
136
|
+
kind: 'otp';
|
|
137
|
+
code: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* `announce` shows the approval URL to the account owner; the write waits for the approval.
|
|
141
|
+
* With `retryOnTimeout`, an approval that expires unanswered is asked for again.
|
|
142
|
+
*/
|
|
143
|
+
| {
|
|
144
|
+
kind: 'web';
|
|
145
|
+
announce: (authUrl: string) => void | Promise<void>;
|
|
146
|
+
retryOnTimeout?: boolean;
|
|
147
|
+
};
|
|
148
|
+
/** Exact package bytes to write, with the digests the source recorded for them. */
|
|
149
|
+
export type PackageRegistryPublishInput = {
|
|
150
|
+
bytes: Uint8Array;
|
|
151
|
+
tag: string;
|
|
152
|
+
access?: 'public' | 'restricted';
|
|
153
|
+
dist: {
|
|
154
|
+
integrity: string;
|
|
155
|
+
shasum: string;
|
|
156
|
+
};
|
|
157
|
+
secondFactor?: PackageRegistrySecondFactor;
|
|
158
|
+
};
|
|
159
|
+
/** The release contract every `infra/package-registry` implementation answers. */
|
|
160
|
+
export interface PackageRegistryImplementation {
|
|
161
|
+
readonly config: PackageRegistryDescriptor;
|
|
162
|
+
/** The same registry reading its credential from another Secrets environment. */
|
|
163
|
+
forEnvironment(environment: string): PackageRegistryImplementation;
|
|
164
|
+
/** The registry origin: `url`, or the named service's configured primary origin. */
|
|
165
|
+
origin(): Promise<string>;
|
|
166
|
+
/** The version on `tag`, read as an anonymous caller when `anonymous` (what the public is served). */
|
|
167
|
+
readRelease(name: string, tag: string, options?: {
|
|
168
|
+
anonymous?: boolean;
|
|
169
|
+
}): Promise<PackageRegistryReleaseRead>;
|
|
170
|
+
/** Every release tag of `name`, read as an anonymous caller when `anonymous`. */
|
|
171
|
+
readReleases(name: string, options?: {
|
|
172
|
+
anonymous?: boolean;
|
|
173
|
+
}): Promise<PackageRegistryReleasesRead>;
|
|
174
|
+
/** The package's current dist-tags (tag → version); empty when the registry holds no such package. */
|
|
175
|
+
distTags(name: string): Promise<Record<string, string>>;
|
|
176
|
+
/** Points `tag` at an existing `version`, answered with the second factor the descriptor asks for. */
|
|
177
|
+
setTag(input: {
|
|
178
|
+
name: string;
|
|
179
|
+
tag: string;
|
|
180
|
+
version: string;
|
|
181
|
+
secondFactor?: PackageRegistrySecondFactor;
|
|
182
|
+
}): Promise<void>;
|
|
183
|
+
/** The integrity this registry records for `name@version`, or `undefined` when it holds no such version. */
|
|
184
|
+
versionIntegrity(name: string, version: string): Promise<string | undefined>;
|
|
185
|
+
/** The bytes of `name@version`, refused unless they match `integrity`. */
|
|
186
|
+
tarball(name: string, version: string, integrity: string): Promise<Uint8Array>;
|
|
187
|
+
/** Writes exactly `input.bytes` and returns once the registry accepts them (serving them may lag). */
|
|
188
|
+
publish(input: PackageRegistryPublishInput): Promise<{
|
|
189
|
+
name: string;
|
|
190
|
+
version: string;
|
|
191
|
+
integrity: string;
|
|
192
|
+
}>;
|
|
86
193
|
}
|
|
87
|
-
export declare const packageRegistryKind: RuntimeKindDescriptorRecord<
|
|
88
|
-
export {};
|
|
194
|
+
export declare const packageRegistryKind: import("@vibesdotdev/kernel").RuntimeKindDescriptorRecord<PackageRegistryImplementation>;
|
|
89
195
|
//# sourceMappingURL=package-registry.kind.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-registry.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/package-registry.kind.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"package-registry.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/package-registry.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAU5B,eAAO,MAAM,yBAAyB;;;;;EAA6C,CAAC;AACpF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AA8B5E,wHAAwH;AACxH,eAAO,MAAM,4BAA4B;;;;;;;;;;kBAUvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,uFAAuF;AACvF,eAAO,MAAM,2BAA2B;;iBAAgD,CAAC;AAEzF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,oDAAoD;AACpD,MAAM,MAAM,sBAAsB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E,kDAAkD;AAClD,MAAM,MAAM,0BAA0B,GACnC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,sBAAsB,CAAA;CAAE;AACxD,8DAA8D;GAC5D;IAAE,KAAK,EAAE,QAAQ,CAAA;CAAE,GACnB;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AAEzB,2DAA2D;AAC3D,MAAM,MAAM,2BAA2B,GACpC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CA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,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACpG,sGAAsG;IACtG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,sGAAsG;IACtG,MAAM,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,2BAA2B,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzH,4GAA4G;IAC5G,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7E,0EAA0E;IAC1E,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/E,sGAAsG;IACtG,OAAO,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3G;AAiCD,eAAO,MAAM,mBAAmB,0FAK9B,CAAC"}
|
|
@@ -11,17 +11,31 @@
|
|
|
11
11
|
* - Adapter-specific fields (dockerImage, storageSize, domain, …)
|
|
12
12
|
* live exclusively under `config`. Each adapter package defines its own
|
|
13
13
|
* concrete schema under its discriminator key.
|
|
14
|
+
* - `publish` is how a release writes to this registry: the Secrets key that
|
|
15
|
+
* holds its credential, the second factor the account asks for, and, for a
|
|
16
|
+
* registry that only ever carries another registry's exact bytes, `mirrorOf`.
|
|
17
|
+
*
|
|
18
|
+
* Every release surface (`vibes infra npm publish`, `vibes infra npm mirror`,
|
|
19
|
+
* Forge's `publish:` step) resolves a registry by id through this kind and
|
|
20
|
+
* calls its implementation ({@link PackageRegistryImplementation}). The adapter
|
|
21
|
+
* named by `config.adapter` registers that implementation per descriptor id;
|
|
22
|
+
* a registry with no registered implementation refuses typed
|
|
23
|
+
* (`package-registry-implementation-missing`), never a silent fallback.
|
|
14
24
|
*/
|
|
15
25
|
import * as z from 'zod/v4';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
26
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
27
|
+
import { createRuntimeKind } from '@vibesdotdev/kernel/factory/kind';
|
|
28
|
+
import { RuntimeDescriptorSchema } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
29
|
+
import { readKindDescriptor } from "./read-descriptor.js";
|
|
30
|
+
import { INFRA_DISCOVERY_PATTERNS } from "./discovery.js";
|
|
19
31
|
import { deploymentEnvRequirementSchema } from "../schemas.js";
|
|
20
32
|
export const PackageRegistryTypeSchema = z.enum(['npm', 'docker', 'maven', 'helm']);
|
|
21
33
|
const PackageRegistryBaseSchema = RuntimeDescriptorSchema.extend({
|
|
22
34
|
kind: z.literal('infra/package-registry'),
|
|
23
|
-
/** Primary access URL (e.g. 'https://packages.example.com'). */
|
|
24
|
-
url: z.string().url(),
|
|
35
|
+
/** Primary access URL (e.g. 'https://packages.example.com'); or name the `infra/service` that serves it. */
|
|
36
|
+
url: z.string().url().optional(),
|
|
37
|
+
/** The `infra/service` id whose configured primary origin is this registry (instead of a fixed `url`). */
|
|
38
|
+
service: z.string().min(1).optional(),
|
|
25
39
|
/** Package type this registry serves. */
|
|
26
40
|
registryType: PackageRegistryTypeSchema.default('npm'),
|
|
27
41
|
/** Npm scope this registry owns (e.g. '@vibesdotdev'). */
|
|
@@ -35,44 +49,60 @@ const PackageRegistryBaseSchema = RuntimeDescriptorSchema.extend({
|
|
|
35
49
|
/** Environment variable requirements. */
|
|
36
50
|
env: z.array(deploymentEnvRequirementSchema).optional()
|
|
37
51
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
|
|
52
|
+
/** What a release writes with: the credential's Secrets key, the account's second factor, and an exact-bytes source. */
|
|
53
|
+
export const PackageRegistryPublishSchema = z.strictObject({
|
|
54
|
+
/** The Secrets key holding the publish credential; the value is resolved at publish time and never printed. */
|
|
55
|
+
credential: z.strictObject({ secret: z.string().min(1) }),
|
|
56
|
+
/**
|
|
57
|
+
* The second factor the registry account asks for on writes: `none`, a one-time
|
|
58
|
+
* password the operator supplies (`otp`), or a browser approval (`web`).
|
|
59
|
+
*/
|
|
60
|
+
secondFactor: z.enum(['none', 'otp', 'web']).default('none'),
|
|
61
|
+
/** The registry id whose exact bytes this registry carries; a release never packs for it. */
|
|
62
|
+
mirrorOf: z.string().min(1).optional()
|
|
49
63
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
]);
|
|
64
|
+
/** Open adapter config: the adapter package that owns `adapter` validates the rest. */
|
|
65
|
+
export const PackageRegistryConfigSchema = z.looseObject({ adapter: z.string().min(1) });
|
|
53
66
|
export const PackageRegistryDescriptorSchema = PackageRegistryBaseSchema.extend({
|
|
67
|
+
publish: PackageRegistryPublishSchema.optional(),
|
|
54
68
|
/**
|
|
55
|
-
* Adapter-specific configuration
|
|
56
|
-
* package
|
|
69
|
+
* Adapter-specific configuration, discriminated by `adapter`. Each
|
|
70
|
+
* adapter's integrations package owns its concrete schema.
|
|
57
71
|
*/
|
|
58
72
|
config: PackageRegistryConfigSchema.optional()
|
|
73
|
+
}).refine((descriptor) => (descriptor.url === undefined) !== (descriptor.service === undefined), {
|
|
74
|
+
message: 'a package registry names exactly one of url or service',
|
|
75
|
+
path: ['url']
|
|
59
76
|
});
|
|
77
|
+
/** Without an adapter's implementation, every release call refuses typed, naming the registry and its adapter. */
|
|
60
78
|
class DefaultPackageRegistryImplementation {
|
|
61
79
|
descriptor;
|
|
62
80
|
context;
|
|
81
|
+
/** The descriptor as this kind's schema reads it. */
|
|
82
|
+
config;
|
|
63
83
|
constructor(descriptor, context) {
|
|
64
84
|
this.descriptor = descriptor;
|
|
65
85
|
this.context = context;
|
|
86
|
+
this.config = readKindDescriptor(PackageRegistryDescriptorSchema, descriptor);
|
|
66
87
|
}
|
|
67
|
-
|
|
68
|
-
|
|
88
|
+
missing() {
|
|
89
|
+
const adapter = this.config.config?.adapter;
|
|
90
|
+
return new CapabilityError(`Package registry ${this.config.id} has no registered implementation${adapter === undefined ? '' : ` for adapter ${adapter}`}.`, 'UNAVAILABLE', { reason: 'package-registry-implementation-missing', details: { registry: this.config.id, adapter: adapter ?? null } });
|
|
69
91
|
}
|
|
92
|
+
forEnvironment() { throw this.missing(); }
|
|
93
|
+
async origin() { throw this.missing(); }
|
|
94
|
+
async readRelease() { throw this.missing(); }
|
|
95
|
+
async readReleases() { throw this.missing(); }
|
|
96
|
+
async distTags() { throw this.missing(); }
|
|
97
|
+
async setTag() { throw this.missing(); }
|
|
98
|
+
async versionIntegrity() { throw this.missing(); }
|
|
99
|
+
async tarball() { throw this.missing(); }
|
|
100
|
+
async publish() { throw this.missing(); }
|
|
70
101
|
}
|
|
71
102
|
export const packageRegistryKind = createRuntimeKind({
|
|
72
103
|
id: 'infra/package-registry',
|
|
73
104
|
descriptorSchema: PackageRegistryDescriptorSchema,
|
|
74
105
|
defaultImplementation: DefaultPackageRegistryImplementation,
|
|
75
|
-
|
|
76
|
-
extractStem
|
|
106
|
+
discoveryPatterns: INFRA_DISCOVERY_PATTERNS
|
|
77
107
|
});
|
|
78
108
|
//# sourceMappingURL=package-registry.kind.js.map
|