@ninedeploy/schemas 0.16.14 → 0.16.15

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/dist/ai.d.ts CHANGED
@@ -1,17 +1,37 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * AI failure diagnosis (BYO-key) configuration. The API key never lives
4
- * here — it is stored separately, encrypted at rest — and this shape only
5
- * carries the OpenAI-compatible endpoint and model to call.
3
+ * 0.16.15: who answers. `openai` is any OpenAI-compatible chat-completions
4
+ * endpoint (OpenAI, Azure gateways, Ollama, LM Studio, …) and what every
5
+ * configuration stored before 0.16.15 means; `anthropic` is Claude through
6
+ * the Anthropic Messages API.
7
+ */
8
+ export declare const AI_PROVIDERS: readonly ['openai', 'anthropic'];
9
+ export type AiProvider = (typeof AI_PROVIDERS)[number];
10
+ /** The Anthropic API, used when an `anthropic` configuration names no base URL. */
11
+ export declare const ANTHROPIC_DEFAULT_BASE_URL = "https://api.anthropic.com";
12
+ /** What the settings form offers for `anthropic` before a model is chosen. */
13
+ export declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-5-5";
14
+ /**
15
+ * AI (BYO-key) configuration. The API key never lives here — it is stored
16
+ * separately, encrypted at rest — and this shape only carries the provider,
17
+ * the endpoint and the model to call.
6
18
  */
7
19
  export declare const aiConfig: z.ZodObject<{
8
- baseUrl: z.ZodString;
20
+ provider: z.ZodOptional<z.ZodEnum<{
21
+ anthropic: "anthropic";
22
+ openai: "openai";
23
+ }>>;
24
+ baseUrl: z.ZodOptional<z.ZodString>;
9
25
  model: z.ZodString;
10
26
  }, z.core.$strip>;
11
27
  export type AiConfig = z.infer<typeof aiConfig>;
12
- /** PUT /v1/ai/config body — the key is optional so base URL/model can change without re-entering it. */
28
+ /** PUT /v1/ai/config body — the key is optional so the provider, base URL or model can change without re-entering it. */
13
29
  export declare const aiConfigUpdate: z.ZodObject<{
14
- baseUrl: z.ZodString;
30
+ provider: z.ZodOptional<z.ZodEnum<{
31
+ anthropic: "anthropic";
32
+ openai: "openai";
33
+ }>>;
34
+ baseUrl: z.ZodOptional<z.ZodString>;
15
35
  model: z.ZodString;
16
36
  apiKey: z.ZodOptional<z.ZodString>;
17
37
  }, z.core.$strip>;
@@ -19,9 +39,20 @@ export type AiConfigUpdate = z.infer<typeof aiConfigUpdate>;
19
39
  /** GET /v1/ai/config response — never carries key material. */
20
40
  export declare const aiConfigStatus: z.ZodObject<{
21
41
  configured: z.ZodBoolean;
42
+ provider: z.ZodOptional<z.ZodEnum<{
43
+ anthropic: "anthropic";
44
+ openai: "openai";
45
+ }>>;
22
46
  baseUrl: z.ZodNullable<z.ZodString>;
23
47
  model: z.ZodNullable<z.ZodString>;
24
48
  hasApiKey: z.ZodBoolean;
25
49
  }, z.core.$strip>;
50
+ /** 0.16.15: `POST /v1/ai/services/:id/logs/analyze` — what the model made of a service's recent runtime logs. */
51
+ export declare const runtimeLogAnalysis: z.ZodObject<{
52
+ analysis: z.ZodString;
53
+ model: z.ZodString;
54
+ lines: z.ZodNumber;
55
+ }, z.core.$strip>;
56
+ export type RuntimeLogAnalysis = z.infer<typeof runtimeLogAnalysis>;
26
57
  export type AiConfigStatus = z.infer<typeof aiConfigStatus>;
27
58
  //# sourceMappingURL=ai.d.ts.map
package/dist/ai.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;iBAKnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,wGAAwG;AACxG,eAAO,MAAM,cAAc;;;;iBAEzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,+DAA+D;AAC/D,eAAO,MAAM,cAAc;;;;;iBAKzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,YAAY,YAAI,QAAQ,EAAE,WAAW,CAAU,CAAC;AAC7D,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,mFAAmF;AACnF,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AACtE,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;;;;;iBAYjB,CAAC;AAEL,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,yHAAyH;AACzH,eAAO,MAAM,cAAc;;;;;;;;iBAUvB,CAAC;AAEL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,+DAA+D;AAC/D,eAAO,MAAM,cAAc;;;;;;;;;iBAOzB,CAAC;AAEH,iHAAiH;AACjH,eAAO,MAAM,kBAAkB;;;;iBAK7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
package/dist/ai.js CHANGED
@@ -1,24 +1,59 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * AI failure diagnosis (BYO-key) configuration. The API key never lives
4
- * here — it is stored separately, encrypted at rest — and this shape only
5
- * carries the OpenAI-compatible endpoint and model to call.
3
+ * 0.16.15: who answers. `openai` is any OpenAI-compatible chat-completions
4
+ * endpoint (OpenAI, Azure gateways, Ollama, LM Studio, …) and what every
5
+ * configuration stored before 0.16.15 means; `anthropic` is Claude through
6
+ * the Anthropic Messages API.
6
7
  */
7
- export const aiConfig = z.object({
8
- /** OpenAI-compatible chat-completions base URL (e.g. https://api.openai.com/v1). */
9
- baseUrl: z.string().trim().url().max(300),
10
- /** Model name as the upstream expects it (e.g. gpt-4o-mini, llama3.1). */
8
+ export const AI_PROVIDERS = ['openai', 'anthropic'];
9
+ /** The Anthropic API, used when an `anthropic` configuration names no base URL. */
10
+ export const ANTHROPIC_DEFAULT_BASE_URL = 'https://api.anthropic.com';
11
+ /** What the settings form offers for `anthropic` before a model is chosen. */
12
+ export const ANTHROPIC_DEFAULT_MODEL = 'claude-sonnet-5-5';
13
+ /**
14
+ * AI (BYO-key) configuration. The API key never lives here — it is stored
15
+ * separately, encrypted at rest — and this shape only carries the provider,
16
+ * the endpoint and the model to call.
17
+ */
18
+ export const aiConfig = z
19
+ .object({
20
+ /** 0.16.15; absent means `openai`, as every earlier configuration does. */
21
+ provider: z.enum(AI_PROVIDERS).optional(),
22
+ /** OpenAI-compatible base URL (e.g. https://api.openai.com/v1); optional for `anthropic`. */
23
+ baseUrl: z.string().trim().url().max(300).optional(),
24
+ /** Model name as the upstream expects it (e.g. gpt-4o-mini, llama3.1, claude-sonnet-5-5). */
11
25
  model: z.string().trim().min(1).max(120),
26
+ })
27
+ .refine((c) => (c.provider ?? 'openai') !== 'openai' || !!c.baseUrl, {
28
+ message: 'An OpenAI-compatible provider needs its base URL',
29
+ path: ['baseUrl'],
12
30
  });
13
- /** PUT /v1/ai/config body — the key is optional so base URL/model can change without re-entering it. */
14
- export const aiConfigUpdate = aiConfig.extend({
31
+ /** PUT /v1/ai/config body — the key is optional so the provider, base URL or model can change without re-entering it. */
32
+ export const aiConfigUpdate = z
33
+ .object({
34
+ provider: z.enum(AI_PROVIDERS).optional(),
35
+ baseUrl: z.string().trim().url().max(300).optional(),
36
+ model: z.string().trim().min(1).max(120),
15
37
  apiKey: z.string().trim().min(8).max(400).optional(),
38
+ })
39
+ .refine((c) => (c.provider ?? 'openai') !== 'openai' || !!c.baseUrl, {
40
+ message: 'An OpenAI-compatible provider needs its base URL',
41
+ path: ['baseUrl'],
16
42
  });
17
43
  /** GET /v1/ai/config response — never carries key material. */
18
44
  export const aiConfigStatus = z.object({
19
45
  configured: z.boolean(),
46
+ /** 0.16.15 (absent on older panels, which only speak `openai`). */
47
+ provider: z.enum(AI_PROVIDERS).optional(),
20
48
  baseUrl: z.string().nullable(),
21
49
  model: z.string().nullable(),
22
50
  hasApiKey: z.boolean(),
23
51
  });
52
+ /** 0.16.15: `POST /v1/ai/services/:id/logs/analyze` — what the model made of a service's recent runtime logs. */
53
+ export const runtimeLogAnalysis = z.object({
54
+ analysis: z.string(),
55
+ model: z.string(),
56
+ /** How many log lines were sent (after sanitizing), so a reader knows what the analysis saw. */
57
+ lines: z.number().int(),
58
+ });
24
59
  //# sourceMappingURL=ai.js.map
package/dist/ai.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,oFAAoF;IACpF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;IACzC,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACzC,CAAC,CAAC;AAIH,wGAAwG;AACxG,MAAM,CAAC,MAAM,cAAc,GAAG,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C,YAAY,CAAC,CAAC,QAAQ,EAAE;IACzC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAC;AAEH,iHAAiH;AACjH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,gGAAgG;IAChG,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;CACxB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninedeploy/schemas",
3
- "version": "0.16.14",
3
+ "version": "0.16.15",
4
4
  "description": "Shared Zod schemas and validation types for NineDeploy",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/ai.ts CHANGED
@@ -1,32 +1,72 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * AI failure diagnosis (BYO-key) configuration. The API key never lives
5
- * here — it is stored separately, encrypted at rest — and this shape only
6
- * carries the OpenAI-compatible endpoint and model to call.
4
+ * 0.16.15: who answers. `openai` is any OpenAI-compatible chat-completions
5
+ * endpoint (OpenAI, Azure gateways, Ollama, LM Studio, …) and what every
6
+ * configuration stored before 0.16.15 means; `anthropic` is Claude through
7
+ * the Anthropic Messages API.
7
8
  */
8
- export const aiConfig = z.object({
9
- /** OpenAI-compatible chat-completions base URL (e.g. https://api.openai.com/v1). */
10
- baseUrl: z.string().trim().url().max(300),
11
- /** Model name as the upstream expects it (e.g. gpt-4o-mini, llama3.1). */
12
- model: z.string().trim().min(1).max(120),
13
- });
9
+ export const AI_PROVIDERS = ['openai', 'anthropic'] as const;
10
+ export type AiProvider = (typeof AI_PROVIDERS)[number];
11
+
12
+ /** The Anthropic API, used when an `anthropic` configuration names no base URL. */
13
+ export const ANTHROPIC_DEFAULT_BASE_URL = 'https://api.anthropic.com';
14
+ /** What the settings form offers for `anthropic` before a model is chosen. */
15
+ export const ANTHROPIC_DEFAULT_MODEL = 'claude-sonnet-5-5';
16
+
17
+ /**
18
+ * AI (BYO-key) configuration. The API key never lives here — it is stored
19
+ * separately, encrypted at rest — and this shape only carries the provider,
20
+ * the endpoint and the model to call.
21
+ */
22
+ export const aiConfig = z
23
+ .object({
24
+ /** 0.16.15; absent means `openai`, as every earlier configuration does. */
25
+ provider: z.enum(AI_PROVIDERS).optional(),
26
+ /** OpenAI-compatible base URL (e.g. https://api.openai.com/v1); optional for `anthropic`. */
27
+ baseUrl: z.string().trim().url().max(300).optional(),
28
+ /** Model name as the upstream expects it (e.g. gpt-4o-mini, llama3.1, claude-sonnet-5-5). */
29
+ model: z.string().trim().min(1).max(120),
30
+ })
31
+ .refine((c) => (c.provider ?? 'openai') !== 'openai' || !!c.baseUrl, {
32
+ message: 'An OpenAI-compatible provider needs its base URL',
33
+ path: ['baseUrl'],
34
+ });
14
35
 
15
36
  export type AiConfig = z.infer<typeof aiConfig>;
16
37
 
17
- /** PUT /v1/ai/config body — the key is optional so base URL/model can change without re-entering it. */
18
- export const aiConfigUpdate = aiConfig.extend({
19
- apiKey: z.string().trim().min(8).max(400).optional(),
20
- });
38
+ /** PUT /v1/ai/config body — the key is optional so the provider, base URL or model can change without re-entering it. */
39
+ export const aiConfigUpdate = z
40
+ .object({
41
+ provider: z.enum(AI_PROVIDERS).optional(),
42
+ baseUrl: z.string().trim().url().max(300).optional(),
43
+ model: z.string().trim().min(1).max(120),
44
+ apiKey: z.string().trim().min(8).max(400).optional(),
45
+ })
46
+ .refine((c) => (c.provider ?? 'openai') !== 'openai' || !!c.baseUrl, {
47
+ message: 'An OpenAI-compatible provider needs its base URL',
48
+ path: ['baseUrl'],
49
+ });
21
50
 
22
51
  export type AiConfigUpdate = z.infer<typeof aiConfigUpdate>;
23
52
 
24
53
  /** GET /v1/ai/config response — never carries key material. */
25
54
  export const aiConfigStatus = z.object({
26
55
  configured: z.boolean(),
56
+ /** 0.16.15 (absent on older panels, which only speak `openai`). */
57
+ provider: z.enum(AI_PROVIDERS).optional(),
27
58
  baseUrl: z.string().nullable(),
28
59
  model: z.string().nullable(),
29
60
  hasApiKey: z.boolean(),
30
61
  });
31
62
 
63
+ /** 0.16.15: `POST /v1/ai/services/:id/logs/analyze` — what the model made of a service's recent runtime logs. */
64
+ export const runtimeLogAnalysis = z.object({
65
+ analysis: z.string(),
66
+ model: z.string(),
67
+ /** How many log lines were sent (after sanitizing), so a reader knows what the analysis saw. */
68
+ lines: z.number().int(),
69
+ });
70
+ export type RuntimeLogAnalysis = z.infer<typeof runtimeLogAnalysis>;
71
+
32
72
  export type AiConfigStatus = z.infer<typeof aiConfigStatus>;