@layer-ai/core 0.8.2 → 0.8.4

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 +1 @@
1
- {"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/gates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAQpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA0bpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/gates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAQpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA4cpC,eAAe,MAAM,CAAC"}
@@ -118,7 +118,7 @@ router.patch('/name/:name', async (req, res) => {
118
118
  return;
119
119
  }
120
120
  try {
121
- const { description, taskType, model, systemPrompt, allowOverrides, temperature, maxTokens, topP, tags, routingStrategy, fallbackModels, costWeight, latencyWeight, qualityWeight, reanalysisPeriod, taskAnalysis } = req.body;
121
+ const { description, taskType, model, systemPrompt, allowOverrides, temperature, maxTokens, topP, tags, routingStrategy, fallbackModels, costWeight, latencyWeight, qualityWeight, analysisMethod, reanalysisPeriod, taskAnalysis } = req.body;
122
122
  const existing = await db.getGateByUserAndName(req.userId, req.params.name);
123
123
  if (!existing) {
124
124
  res.status(404).json({ error: 'not_found', message: 'Gate not found' });
@@ -128,6 +128,8 @@ router.patch('/name/:name', async (req, res) => {
128
128
  res.status(400).json({ error: 'bad_request', message: `Unsupported model: ${model}` });
129
129
  return;
130
130
  }
131
+ // Create history snapshot before update
132
+ await db.createGateHistory(existing.id, existing, 'user');
131
133
  const updated = await db.updateGate(existing.id, {
132
134
  description,
133
135
  taskType,
@@ -143,9 +145,14 @@ router.patch('/name/:name', async (req, res) => {
143
145
  costWeight,
144
146
  latencyWeight,
145
147
  qualityWeight,
148
+ analysisMethod,
146
149
  reanalysisPeriod,
147
150
  taskAnalysis,
148
151
  });
152
+ // Log manual update activity
153
+ await db.createActivityLog(existing.id, req.userId, 'manual_update', {
154
+ changedFields: Object.keys(req.body)
155
+ });
149
156
  await cache.invalidateGate(req.userId, existing.name);
150
157
  res.json(updated);
151
158
  }
@@ -161,7 +168,7 @@ router.patch('/:id', async (req, res) => {
161
168
  return;
162
169
  }
163
170
  try {
164
- const { description, taskType, model, systemPrompt, allowOverrides, temperature, maxTokens, topP, tags, routingStrategy, fallbackModels, costWeight, latencyWeight, qualityWeight, reanalysisPeriod, taskAnalysis } = req.body;
171
+ const { description, taskType, model, systemPrompt, allowOverrides, temperature, maxTokens, topP, tags, routingStrategy, fallbackModels, costWeight, latencyWeight, qualityWeight, analysisMethod, reanalysisPeriod, taskAnalysis } = req.body;
165
172
  const existing = await db.getGateById(req.params.id);
166
173
  if (!existing) {
167
174
  res.status(404).json({ error: 'not_found', message: 'Gate not found' });
@@ -175,6 +182,8 @@ router.patch('/:id', async (req, res) => {
175
182
  res.status(400).json({ error: 'bad_request', message: `Unsupported model: ${model}` });
176
183
  return;
177
184
  }
185
+ // Create history snapshot before update
186
+ await db.createGateHistory(req.params.id, existing, 'user');
178
187
  const updated = await db.updateGate(req.params.id, {
179
188
  description,
180
189
  taskType,
@@ -190,9 +199,14 @@ router.patch('/:id', async (req, res) => {
190
199
  costWeight,
191
200
  latencyWeight,
192
201
  qualityWeight,
202
+ analysisMethod,
193
203
  reanalysisPeriod,
194
204
  taskAnalysis,
195
205
  });
206
+ // Log manual update activity
207
+ await db.createActivityLog(req.params.id, req.userId, 'manual_update', {
208
+ changedFields: Object.keys(req.body)
209
+ });
196
210
  await cache.invalidateGate(req.userId, existing.name);
197
211
  res.json(updated);
198
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layer-ai/core",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Core API routes and services for Layer AI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",