anbaric-cloud-hosting 1.40.0 → 1.41.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anbaric-cloud-hosting",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "description": "Anbaric Cloud hosting service: Postgres-backed job persistence and queuing exposed over an HTTP API",
5
5
  "license": "MIT",
6
6
  "author": "chris@anbaric.ai",
@@ -18,18 +18,18 @@
18
18
  "@aws-sdk/client-s3": "^3.1110.0",
19
19
  "@aws-sdk/client-secrets-manager": "^3.700.0",
20
20
  "@aws-sdk/client-servicediscovery": "^3.1110.0",
21
- "anbaric-data-store": "^1.40.0",
22
- "anbaric-plugins": "^1.40.0",
23
- "anbaric-tsapi": "^1.40.0",
24
- "anbaric-web": "^1.40.0",
21
+ "anbaric-data-store": "^1.41.0",
22
+ "anbaric-plugins": "^1.41.0",
23
+ "anbaric-tsapi": "^1.41.0",
24
+ "anbaric-web": "^1.41.0",
25
25
  "esbuild": "^0.28.2",
26
26
  "pg": "^8.16.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^26.2.0",
30
30
  "@types/pg": "^8.15.0",
31
- "anbaric-impl-cloud": "^1.40.0",
32
- "anbaric-state-machine": "^1.40.0",
31
+ "anbaric-impl-cloud": "^1.41.0",
32
+ "anbaric-state-machine": "^1.41.0",
33
33
  "tsx": "^4.20.0",
34
34
  "typescript": "^7.0.2"
35
35
  },
@@ -1,14 +1,13 @@
1
1
  import {Pool} from "pg";
2
2
  import {JsonSchema, Prompt, PromptManager, samePromptContent} from "anbaric-tsapi";
3
3
 
4
- const COLUMNS = "app_id, prompt_id, version, instructions, input_schema, output_schema, created_at";
4
+ const COLUMNS = "app_id, prompt_id, version, instructions, output_schema, created_at";
5
5
 
6
6
  const rowToPrompt = (row : any) : Prompt => ({
7
7
  appId: row.app_id,
8
8
  promptId: row.prompt_id,
9
9
  version: row.version,
10
10
  instructions: row.instructions,
11
- inputSchema: row.input_schema ?? undefined,
12
11
  outputSchema: row.output_schema ?? undefined,
13
12
  createdAt: row.created_at instanceof Date ? row.created_at.toISOString() : String(row.created_at),
14
13
  });
@@ -20,7 +19,7 @@ class PostgresPromptManager implements PromptManager {
20
19
 
21
20
  constructor(private pool : Pool, private appId : string) {}
22
21
 
23
- async save(promptId : string, instructions : string, inputSchema? : JsonSchema, outputSchema? : JsonSchema) : Promise<Prompt> {
22
+ async save(promptId : string, instructions : string, outputSchema? : JsonSchema) : Promise<Prompt> {
24
23
  const client = await this.pool.connect();
25
24
 
26
25
  try {
@@ -30,17 +29,16 @@ class PostgresPromptManager implements PromptManager {
30
29
  ORDER BY version DESC LIMIT 1 FOR UPDATE`, [this.appId, promptId]);
31
30
  const current = latest.rows[0] && rowToPrompt(latest.rows[0]);
32
31
 
33
- if (current && samePromptContent(current, instructions, inputSchema, outputSchema)) {
32
+ if (current && samePromptContent(current, instructions, outputSchema)) {
34
33
  await client.query("COMMIT");
35
34
  return current;
36
35
  }
37
36
 
38
37
  const inserted = await client.query(
39
- `INSERT INTO prompts (app_id, prompt_id, version, instructions, input_schema, output_schema)
40
- VALUES ($1, $2, $3, $4, $5, $6)
38
+ `INSERT INTO prompts (app_id, prompt_id, version, instructions, output_schema)
39
+ VALUES ($1, $2, $3, $4, $5)
41
40
  RETURNING ${COLUMNS}`,
42
41
  [this.appId, promptId, (current?.version ?? 0) + 1, instructions,
43
- inputSchema === undefined ? null : JSON.stringify(inputSchema),
44
42
  outputSchema === undefined ? null : JSON.stringify(outputSchema)]);
45
43
  await client.query("COMMIT");
46
44
  return rowToPrompt(inserted.rows[0]);
@@ -150,12 +150,12 @@ const ensureSchema = async (pool : Pool) : Promise<void> => {
150
150
  prompt_id TEXT NOT NULL,
151
151
  version INTEGER NOT NULL,
152
152
  instructions TEXT NOT NULL,
153
- input_schema JSONB,
154
153
  output_schema JSONB,
155
154
  created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
156
155
  PRIMARY KEY (app_id, prompt_id, version)
157
156
  )
158
157
  `);
158
+ await pool.query("ALTER TABLE prompts DROP COLUMN IF EXISTS input_schema");
159
159
  await pool.query("CREATE SCHEMA IF NOT EXISTS anbaric_system");
160
160
  await pool.query(`
161
161
  CREATE TABLE IF NOT EXISTS anbaric_system.cli_keys (
@@ -23,10 +23,10 @@ class PromptsHandler implements RequestHandler {
23
23
  }
24
24
 
25
25
  private async save(request : Request, manager : PromptManager, promptId : string) : Promise<void> {
26
- const body = await request.body() as { instructions? : string, inputSchema? : object, outputSchema? : object } | undefined;
26
+ const body = await request.body() as { instructions? : string, outputSchema? : object } | undefined;
27
27
  if (typeof body?.instructions !== "string") return request.reply(400, { error: "instructions is required" });
28
28
 
29
- request.reply(200, await manager.save(promptId, body.instructions, body.inputSchema, body.outputSchema));
29
+ request.reply(200, await manager.save(promptId, body.instructions, body.outputSchema));
30
30
  }
31
31
 
32
32
  private async retrieve(request : Request, manager : PromptManager, promptId : string) : Promise<void> {