deepline 0.3.212 → 0.3.214

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 (30) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +137 -32
  2. package/dist/bundling-sources/sdk/src/compat.ts +2 -0
  3. package/dist/bundling-sources/sdk/src/deployment-protection.ts +19 -0
  4. package/dist/bundling-sources/sdk/src/http.ts +3 -7
  5. package/dist/bundling-sources/sdk/src/index.ts +7 -0
  6. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  7. package/dist/bundling-sources/sdk/src/types.ts +25 -0
  8. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  9. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +33 -7
  11. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +11 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +3 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +53 -1
  14. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +187 -6
  15. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +67 -37
  16. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +12 -3
  17. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +5 -2
  18. package/dist/bundling-sources/shared_libs/plays/settings-contract.ts +176 -0
  19. package/dist/cli/index.js +572 -92
  20. package/dist/cli/index.mjs +572 -92
  21. package/dist/index.d.mts +191 -3
  22. package/dist/index.d.ts +191 -3
  23. package/dist/index.js +67 -35
  24. package/dist/index.mjs +67 -35
  25. package/dist/install-integrity.json +2 -0
  26. package/dist/release.d.mts +1 -1
  27. package/dist/release.d.ts +1 -1
  28. package/dist/release.js +1 -1
  29. package/dist/release.mjs +1 -1
  30. package/package.json +3 -2
@@ -0,0 +1,176 @@
1
+ import { z } from 'zod';
2
+
3
+ /** Keep schema diagnostics readable in both interactive settings and the CLI. */
4
+ export function formatPlaySettingsError(error: unknown): string {
5
+ if (error instanceof z.ZodError)
6
+ return [...new Set(error.issues.map((issue) => issue.message))].join(' ');
7
+ return error instanceof Error ? error.message : String(error);
8
+ }
9
+
10
+ /** Location organizes Plays. Existing workspace permissions still apply. */
11
+ export const PLAY_LOCATION_ROOTS = [
12
+ {
13
+ value: 'person',
14
+ label: 'Personal',
15
+ description:
16
+ 'The creator’s personal root, displayed as their name followed by “’s team”.',
17
+ },
18
+ {
19
+ value: 'team',
20
+ label: 'Team library',
21
+ description:
22
+ 'The shared team library. Publishing moves personal locations here, keeping their folders.',
23
+ },
24
+ ] as const;
25
+
26
+ const folder = z
27
+ .string()
28
+ .min(1)
29
+ .max(128)
30
+ .refine(
31
+ (value) =>
32
+ value === value.trim() &&
33
+ value !== '.' &&
34
+ value !== '..' &&
35
+ !/[\\/\u0000-\u001f\u007f]/u.test(value),
36
+ 'Folder names must be trimmed, cannot be . or .., and cannot contain slashes or control characters.',
37
+ );
38
+ export const playPathSchema = z
39
+ .union([
40
+ z.null(),
41
+ z
42
+ .object({
43
+ root: z.enum(['person', 'team']),
44
+ folders: z.array(folder).max(16).default([]),
45
+ })
46
+ .strict(),
47
+ ])
48
+ .transform((path) =>
49
+ path?.root === 'person' && path.folders.length === 0 ? null : path,
50
+ );
51
+ export type PlayPath = z.output<typeof playPathSchema>;
52
+
53
+ export function parsePlayPath(value: string): PlayPath {
54
+ const [root, ...parts] = value.split('/');
55
+ if (!PLAY_LOCATION_ROOTS.some((option) => option.value === root)) {
56
+ throw new Error(
57
+ 'Path must start with person or team. Example: person/Research/ICP.',
58
+ );
59
+ }
60
+ let folders: string[];
61
+ try {
62
+ folders = parts.map(decodeURIComponent);
63
+ } catch {
64
+ throw new Error(
65
+ 'Path contains an invalid percent escape. Encode a literal % as %25.',
66
+ );
67
+ }
68
+ return playPathSchema.parse({ root, folders });
69
+ }
70
+ export function formatPlayPath(path: PlayPath): string {
71
+ return path === null
72
+ ? 'person'
73
+ : [path.root, ...path.folders.map(encodeURIComponent)].join('/');
74
+ }
75
+ export function personalPlayRootLabel(ownerName?: string | null): string {
76
+ const name = ownerName?.trim();
77
+ return name ? `${name.split(/\s+/)[0]}’s team` : 'Personal';
78
+ }
79
+ export function displayPlayPath(
80
+ path: PlayPath,
81
+ ownerName?: string | null,
82
+ ): string {
83
+ return [
84
+ path?.root === 'team' ? 'Team library' : personalPlayRootLabel(ownerName),
85
+ ...(path?.folders ?? []),
86
+ ].join(' / ');
87
+ }
88
+ export function publishedPlayPath(path: PlayPath): PlayPath {
89
+ return { root: 'team', folders: path?.folders ?? [] };
90
+ }
91
+
92
+ /** One registry drives validation, defaults, CLI keys/help and settings controls. */
93
+ export const PLAY_SETTING_FIELDS = {
94
+ path: {
95
+ schema: playPathSchema
96
+ .default(null)
97
+ .describe(
98
+ 'Play location. Null means the creator’s personal root. Publishing moves it into Team library, preserving folders.',
99
+ ),
100
+ label: 'Location',
101
+ description:
102
+ 'Organize this Play in the creator’s personal root or Team library. Publishing moves it to Team library and keeps its folders. Workspace sharing permissions apply in both roots.',
103
+ get defaultValue(): PlayPath {
104
+ return this.schema.parse(undefined);
105
+ },
106
+ cli: {
107
+ valueSyntax: 'person[/folder/…] | team[/folder/…] | null',
108
+ examples: [
109
+ 'person',
110
+ 'person/Research/ICP',
111
+ 'team',
112
+ 'team/Research',
113
+ 'null',
114
+ ],
115
+ parse: (value: string) =>
116
+ value === 'null' ? null : parsePlayPath(value),
117
+ format: formatPlayPath,
118
+ },
119
+ ui: { control: 'play-location-picker' as const },
120
+ },
121
+ } as const;
122
+ export const playSettingsSchema = z.object(
123
+ Object.fromEntries(
124
+ Object.entries(PLAY_SETTING_FIELDS).map(([key, field]) => [
125
+ key,
126
+ field.schema,
127
+ ]),
128
+ ) as {
129
+ [K in keyof typeof PLAY_SETTING_FIELDS]: (typeof PLAY_SETTING_FIELDS)[K]['schema'];
130
+ },
131
+ ).passthrough();
132
+ export const playSettingsPatchSchema = z
133
+ .object(
134
+ Object.fromEntries(
135
+ Object.entries(PLAY_SETTING_FIELDS).map(([key, field]) => [
136
+ key,
137
+ field.schema.unwrap().optional(),
138
+ ]),
139
+ ) as {
140
+ [K in keyof typeof PLAY_SETTING_FIELDS]: z.ZodOptional<
141
+ ReturnType<(typeof PLAY_SETTING_FIELDS)[K]['schema']['unwrap']>
142
+ >;
143
+ },
144
+ )
145
+ .strict()
146
+ .refine(
147
+ (patch) => Object.keys(patch).length > 0,
148
+ 'Supply at least one setting.',
149
+ );
150
+ export type PlaySettings = {
151
+ [K in keyof typeof PLAY_SETTING_FIELDS]: z.output<
152
+ (typeof PLAY_SETTING_FIELDS)[K]['schema']
153
+ >;
154
+ };
155
+ export type PlaySettingsPatch = z.output<typeof playSettingsPatchSchema>;
156
+ /** Validate registered keys while preserving future keys in stored objects. */
157
+ export function parsePlaySettings(value: unknown): PlaySettings {
158
+ return playSettingsSchema.parse(value) as PlaySettings;
159
+ }
160
+ export const DEFAULT_PLAY_SETTINGS: PlaySettings = parsePlaySettings({});
161
+ export type PlaySettingsResult = {
162
+ playDefinitionId: string;
163
+ ownerUserId: string | null;
164
+ ownerName: string | null;
165
+ settings: PlaySettings;
166
+ };
167
+ export type PlaySettingsPathsPage = {
168
+ paths: Array<{
169
+ path: PlayPath;
170
+ ownerUserId: string | null;
171
+ ownerName: string | null;
172
+ playName: string;
173
+ }>;
174
+ cursor: string | null;
175
+ hasMore: boolean;
176
+ };