@rizom/ops 0.2.0-alpha.350 → 0.2.0-alpha.352

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.
@@ -1,87 +1,97 @@
1
1
  import type { FetchLike } from "@brains/deploy-support/origin-ca";
2
2
  import { z } from "@brains/utils/zod";
3
- export type DirectorySyncStressProfile = "regression" | "load" | "stress";
4
- export type DirectorySyncStressOperation = "add" | "update" | "rename" | "delete";
5
- export interface DirectorySyncStressPhase {
6
- id: string;
7
- operation: DirectorySyncStressOperation;
8
- count: number;
9
- targetProbeCount: number;
10
- settleMs: number;
11
- }
12
- export interface DirectorySyncStressPlan {
13
- profile: DirectorySyncStressProfile;
14
- maximumProbeCount: number;
15
- maximumExternalAiCalls?: number | undefined;
16
- phases: DirectorySyncStressPhase[];
17
- }
18
- export interface StressBaseline {
19
- entities: number;
20
- notes: number;
21
- version: string;
22
- }
23
- export interface StressHealthSample {
24
- timestamp: string;
25
- endpoint: string;
26
- status: number;
27
- durationMs: number;
28
- ok: boolean;
29
- error?: string | undefined;
30
- }
31
- export interface StressRuntimeSample {
32
- timestamp: string;
33
- cpuPercent: number;
34
- memoryPercent: number;
35
- pids: number;
36
- }
37
- export interface StressPhaseResult {
38
- id: string;
39
- operation: DirectorySyncStressOperation;
40
- count: number;
41
- success: boolean;
42
- commitLatencyMs?: number | undefined;
43
- persistenceLatencyMs?: number | undefined;
44
- error?: string | undefined;
45
- }
46
- export interface StressCleanupResult {
47
- success: boolean;
48
- probesRemaining: number;
49
- finalEntities?: number | undefined;
50
- finalNotes?: number | undefined;
51
- contentTreeRestored?: boolean | undefined;
52
- error?: string | undefined;
53
- }
54
- export interface StressContainerState {
55
- status: string;
56
- restartCount: number;
57
- oomKilled: boolean;
58
- }
59
- export interface StressMetrics {
60
- health: StressHealthSample[];
61
- runtime: StressRuntimeSample[];
62
- externalAiCalls?: number | undefined;
63
- container?: StressContainerState | undefined;
64
- }
65
- export interface DirectorySyncStressReport {
66
- profile: DirectorySyncStressProfile;
67
- success: boolean;
68
- baseline: StressBaseline;
69
- phases: StressPhaseResult[];
70
- cleanup: StressCleanupResult;
71
- metrics: StressMetrics;
72
- failure?: string | undefined;
73
- }
74
- export declare const directorySyncStressProfileSchema: z.ZodType<DirectorySyncStressProfile>;
75
- export declare const directorySyncStressOperationSchema: z.ZodType<DirectorySyncStressOperation>;
76
- export declare const directorySyncStressPhaseSchema: z.ZodType<DirectorySyncStressPhase>;
77
- export declare const directorySyncStressPlanSchema: z.ZodType<DirectorySyncStressPlan>;
78
- export declare const stressBaselineSchema: z.ZodType<StressBaseline>;
79
- export declare const stressHealthSampleSchema: z.ZodType<StressHealthSample>;
80
- export declare const stressRuntimeSampleSchema: z.ZodType<StressRuntimeSample>;
81
- export declare const stressPhaseResultSchema: z.ZodType<StressPhaseResult>;
82
- export declare const stressCleanupResultSchema: z.ZodType<StressCleanupResult>;
83
- export declare const stressMetricsSchema: z.ZodType<StressMetrics>;
84
- export declare const directorySyncStressReportSchema: z.ZodType<DirectorySyncStressReport>;
3
+ export declare const directorySyncStressProfileSchema: z.ZodEnum<{
4
+ regression: "regression";
5
+ load: "load";
6
+ stress: "stress";
7
+ }>;
8
+ export type DirectorySyncStressProfile = z.output<typeof directorySyncStressProfileSchema>;
9
+ export declare const directorySyncStressOperationSchema: z.ZodEnum<{
10
+ add: "add";
11
+ update: "update";
12
+ rename: "rename";
13
+ delete: "delete";
14
+ }>;
15
+ export type DirectorySyncStressOperation = z.output<typeof directorySyncStressOperationSchema>;
16
+ export declare const directorySyncStressPhaseSchema: z.ZodObject<{
17
+ id: z.ZodString;
18
+ operation: typeof directorySyncStressOperationSchema;
19
+ count: z.ZodNumber;
20
+ targetProbeCount: z.ZodNumber;
21
+ settleMs: z.ZodNumber;
22
+ }>;
23
+ export type DirectorySyncStressPhase = z.output<typeof directorySyncStressPhaseSchema>;
24
+ export declare const directorySyncStressPlanSchema: z.ZodObject<{
25
+ profile: typeof directorySyncStressProfileSchema;
26
+ maximumProbeCount: z.ZodNumber;
27
+ maximumExternalAiCalls: z.ZodOptional<z.ZodNumber>;
28
+ phases: z.ZodArray<typeof directorySyncStressPhaseSchema>;
29
+ }>;
30
+ export type DirectorySyncStressPlan = z.output<typeof directorySyncStressPlanSchema>;
31
+ export declare const stressBaselineSchema: z.ZodObject<{
32
+ entities: z.ZodNumber;
33
+ notes: z.ZodNumber;
34
+ version: z.ZodString;
35
+ }>;
36
+ export type StressBaseline = z.output<typeof stressBaselineSchema>;
37
+ export declare const stressHealthSampleSchema: z.ZodObject<{
38
+ timestamp: z.ZodISODateTime;
39
+ endpoint: z.ZodString;
40
+ status: z.ZodNumber;
41
+ durationMs: z.ZodNumber;
42
+ ok: z.ZodBoolean;
43
+ error: z.ZodOptional<z.ZodString>;
44
+ }>;
45
+ export type StressHealthSample = z.output<typeof stressHealthSampleSchema>;
46
+ export declare const stressRuntimeSampleSchema: z.ZodObject<{
47
+ timestamp: z.ZodISODateTime;
48
+ cpuPercent: z.ZodNumber;
49
+ memoryPercent: z.ZodNumber;
50
+ pids: z.ZodNumber;
51
+ }>;
52
+ export type StressRuntimeSample = z.output<typeof stressRuntimeSampleSchema>;
53
+ export declare const stressPhaseResultSchema: z.ZodObject<{
54
+ id: z.ZodString;
55
+ operation: typeof directorySyncStressOperationSchema;
56
+ count: z.ZodNumber;
57
+ success: z.ZodBoolean;
58
+ commitLatencyMs: z.ZodOptional<z.ZodNumber>;
59
+ persistenceLatencyMs: z.ZodOptional<z.ZodNumber>;
60
+ error: z.ZodOptional<z.ZodString>;
61
+ }>;
62
+ export type StressPhaseResult = z.output<typeof stressPhaseResultSchema>;
63
+ export declare const stressCleanupResultSchema: z.ZodObject<{
64
+ success: z.ZodBoolean;
65
+ probesRemaining: z.ZodNumber;
66
+ finalEntities: z.ZodOptional<z.ZodNumber>;
67
+ finalNotes: z.ZodOptional<z.ZodNumber>;
68
+ contentTreeRestored: z.ZodOptional<z.ZodBoolean>;
69
+ error: z.ZodOptional<z.ZodString>;
70
+ }>;
71
+ export type StressCleanupResult = z.output<typeof stressCleanupResultSchema>;
72
+ export declare const stressContainerStateSchema: z.ZodObject<{
73
+ status: z.ZodString;
74
+ restartCount: z.ZodNumber;
75
+ oomKilled: z.ZodBoolean;
76
+ }>;
77
+ export type StressContainerState = z.output<typeof stressContainerStateSchema>;
78
+ export declare const stressMetricsSchema: z.ZodObject<{
79
+ health: z.ZodArray<typeof stressHealthSampleSchema>;
80
+ runtime: z.ZodArray<typeof stressRuntimeSampleSchema>;
81
+ externalAiCalls: z.ZodOptional<z.ZodNumber>;
82
+ container: z.ZodOptional<typeof stressContainerStateSchema>;
83
+ }>;
84
+ export type StressMetrics = z.output<typeof stressMetricsSchema>;
85
+ export declare const directorySyncStressReportSchema: z.ZodObject<{
86
+ profile: typeof directorySyncStressProfileSchema;
87
+ success: z.ZodBoolean;
88
+ baseline: typeof stressBaselineSchema;
89
+ phases: z.ZodArray<typeof stressPhaseResultSchema>;
90
+ cleanup: typeof stressCleanupResultSchema;
91
+ metrics: typeof stressMetricsSchema;
92
+ failure: z.ZodOptional<z.ZodString>;
93
+ }>;
94
+ export type DirectorySyncStressReport = z.output<typeof directorySyncStressReportSchema>;
85
95
  export interface DirectorySyncStressTarget {
86
96
  handle: string;
87
97
  domain: string;
@@ -1,3 +1,3 @@
1
1
  export { readJsonResponse, parseEnvFile, parseEnvSchema, parseEnvSchemaFile, requireEnv, writeGitHubOutput, writeGitHubEnv, } from "@brains/deploy-support";
2
2
  export type { EnvSchemaEntry } from "@brains/deploy-support";
3
- export { siteImageTag, sitePackagesFor, requiredImages, resolveImageBuilds, runResolveMissingImages, type ImageRequirementSource, type RequiredImage, type ResolveImageBuildsOptions, type RunResolveMissingImagesOptions, } from "../images";
3
+ export { runtimeImageTag, sitePackagesFor, requiredImages, resolveImageBuilds, runResolveMissingImages, type ImageRequirementSource, type RequiredImage, type ResolveImageBuildsOptions, type RunResolveMissingImagesOptions, } from "../images";
package/dist/images.d.ts CHANGED
@@ -1,20 +1,13 @@
1
1
  import { type ResolvedSiteOverride } from "./load-registry";
2
2
  import { type RunCommand } from "./run-subprocess";
3
3
  /**
4
- * Resolve a fleet image tag as a pure function of a single instance's own
5
- * config. This is the shared contract between the build (which tags the image
6
- * it pushes) and the deploy (which waits for and runs that tag), so both must
7
- * import this — never recompute it independently.
8
- *
9
- * The default path is deliberately untouched: an instance with no site packages
10
- * resolves to the plain `brain-{version}` tag every other fleet instance uses.
11
- * A site override is a per-instance opt-in that hashes only *that instance's*
12
- * package set into a distinct `brain-{version}-sites-{hash}` image, so it can
13
- * never collide with — or leak into — the shared default image.
4
+ * Resolve the immutable runtime image shared by every fleet instance on one
5
+ * Brain version. Build and Deploy both import this function so their tags can
6
+ * never disagree.
14
7
  */
15
- export declare function siteImageTag(brainVersion: string, sitePackages: string[]): string;
8
+ export declare function runtimeImageTag(brainVersion: string): string;
16
9
  /**
17
- * The npm packages a site override installs into its per-instance image.
10
+ * The npm packages a site override contributes to its version's shared image.
18
11
  * A @rizom-scoped theme is independently published and installs at its own
19
12
  * explicit version; @brains/* themes are bundled inside @rizom/brain and must
20
13
  * not be npm-installed.
@@ -28,15 +21,13 @@ export interface ImageRequirementSource {
28
21
  export interface RequiredImage {
29
22
  tag: string;
30
23
  brainVersion: string;
31
- /** Sorted, deduped — build args for the image, empty for the default. */
24
+ /** Sorted, deduped package specs installed into this runtime image. */
32
25
  sitePackages: string[];
33
26
  }
34
27
  /**
35
- * The image set the declared fleet state requires: one default
36
- * `brain-{version}` per distinct brain version in use, plus one
37
- * `brain-{version}-sites-{hash}` per distinct site-override package set.
38
- * Derived purely from resolved users (pass `registry.users`), so CI can build
39
- * exactly what a config push declares — nothing reactive, nothing manual.
28
+ * Derive one immutable image per effective Brain version. Each image contains
29
+ * the union of exact site/theme package pins required by every instance on
30
+ * that version.
40
31
  */
41
32
  export declare function requiredImages(users: ImageRequirementSource[]): RequiredImage[];
42
33
  export interface ResolveImageBuildsOptions {
@@ -67,6 +58,20 @@ export interface RunResolveMissingImagesOptions {
67
58
  writeOutput: (key: string, value: string) => void;
68
59
  log?: (line: string) => void;
69
60
  }
61
+ /**
62
+ * Whether the registry already holds this tag.
63
+ *
64
+ * `docker manifest inspect` exits non-zero when the manifest is unknown, so a
65
+ * command failure is the "absent" answer. A failure to run docker at all is
66
+ * not: answering false there would let resolveImageBuilds past its
67
+ * tag-immutability guard and overwrite a published tag, which is exactly what
68
+ * that guard exists to prevent. Those propagate.
69
+ *
70
+ * A non-zero exit caused by an auth or network problem is still read as
71
+ * absent — docker reports it the same way it reports an unknown manifest, and
72
+ * telling them apart means matching stderr text that shifts between versions.
73
+ */
74
+ export declare function imageTagExists(run: RunCommand, imageRepository: string, tag: string): Promise<boolean>;
70
75
  /**
71
76
  * The Build workflow's resolve step: derive the image set the declared fleet
72
77
  * state (pilot.yaml + cohorts + users) requires, probe the container registry
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { initPilotRepo } from "./init";
2
2
  export { loadPilotRegistry, type LoadPilotRegistryOptions, } from "./load-registry";
3
- export { siteImageTag, sitePackagesFor, requiredImages, resolveImageBuilds, runResolveMissingImages, type ImageRequirementSource, type RequiredImage, type ResolveImageBuildsOptions, type RunResolveMissingImagesOptions, } from "./images";
3
+ export { runtimeImageTag, sitePackagesFor, requiredImages, resolveImageBuilds, runResolveMissingImages, type ImageRequirementSource, type RequiredImage, type ResolveImageBuildsOptions, type RunResolveMissingImagesOptions, } from "./images";
4
4
  export { derivePreviewDomain, type PreviewDomainOptions, } from "./preview-domain";
5
5
  export { writeUsersTable } from "./render-users-table";
6
6
  export { onboardUser } from "./onboard-user";