@ai-matrx/agents 0.59.232 → 0.59.233

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.
@@ -20,11 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // quick/index.ts
21
21
  var quick_exports = {};
22
22
  __export(quick_exports, {
23
+ LEGACY_LIMITS: () => LEGACY_LIMITS,
24
+ QUICK_AGENT_BOUNDS: () => QUICK_AGENT_BOUNDS,
25
+ QUICK_AGENT_DEFAULT_SETTINGS: () => QUICK_AGENT_DEFAULT_SETTINGS,
23
26
  QUICK_AGENT_KIND: () => QUICK_AGENT_KIND,
24
27
  QUICK_AGENT_KNOBS: () => QUICK_AGENT_KNOBS,
25
28
  QUICK_AGENT_TAG: () => QUICK_AGENT_TAG,
26
29
  clampQuickAgentSettings: () => clampQuickAgentSettings,
30
+ createQuickAgent: () => createQuickAgent,
27
31
  defaultQuickAgentSettings: () => defaultQuickAgentSettings,
32
+ deleteQuickAgent: () => deleteQuickAgent,
28
33
  isQuickAgentSummary: () => isQuickAgentSummary,
29
34
  listMyQuickAgents: () => listMyQuickAgents,
30
35
  listQuickAgents: () => listQuickAgents,
@@ -36,10 +41,57 @@ __export(quick_exports, {
36
41
  readQuickAgent: () => readQuickAgent,
37
42
  resolveQuickAgentLimits: () => resolveQuickAgentLimits,
38
43
  sliderStep: () => sliderStep,
44
+ updateQuickAgent: () => updateQuickAgent,
39
45
  withoutQuickAgents: () => withoutQuickAgents
40
46
  });
41
47
  module.exports = __toCommonJS(quick_exports);
42
48
 
49
+ // quick/legacy.ts
50
+ var QUICK_AGENT_BOUNDS = {
51
+ temperature: { min: 0, max: 2, step: 0.1 },
52
+ topP: { min: 0, max: 1, step: 0.05 },
53
+ maxOutputTokens: { min: 256, max: 32768, step: 256 }
54
+ };
55
+ var QUICK_AGENT_DEFAULT_SETTINGS = Object.freeze({ temperature: 0.7, topP: 1, maxOutputTokens: 4096 });
56
+ var LEGACY_LIMITS = {
57
+ temperature: { ...QUICK_AGENT_BOUNDS.temperature, default: QUICK_AGENT_DEFAULT_SETTINGS.temperature },
58
+ topP: { ...QUICK_AGENT_BOUNDS.topP, default: QUICK_AGENT_DEFAULT_SETTINGS.topP },
59
+ maxOutputTokens: { ...QUICK_AGENT_BOUNDS.maxOutputTokens, default: QUICK_AGENT_DEFAULT_SETTINGS.maxOutputTokens }
60
+ };
61
+ function refuse(def) {
62
+ const problems = quickAgentProblems(def);
63
+ if (problems.length > 0) throw new Error(problems[0]);
64
+ }
65
+ function fail(error) {
66
+ throw new Error(error?.message ?? "The agent could not be saved.");
67
+ }
68
+ var table = (client) => client.schema("agent").from("definition");
69
+ var row = (def) => {
70
+ const f = quickAgentFields(def);
71
+ return { agent_type: "user", name: f.name, description: null, tags: f.tags, is_active: true, is_archived: false, model_id: f.modelId, messages: f.messages, settings: f.settings, tools: [], metadata: { kind: "quick" } };
72
+ };
73
+ async function createQuickAgent(client, def, owner) {
74
+ refuse(def);
75
+ const { data, error } = await table(client).insert({ ...row(def), created_by: owner.userId, organization_id: owner.organizationId }).select().single();
76
+ if (error) fail(error);
77
+ const saved = quickAgentFromRow(data, QUICK_AGENT_DEFAULT_SETTINGS);
78
+ if (!saved) fail(null);
79
+ return saved;
80
+ }
81
+ async function updateQuickAgent(client, id, def) {
82
+ refuse(def);
83
+ const { name, model_id, messages, settings } = row(def);
84
+ const { data, error } = await table(client).update({ name, model_id, messages, settings }).eq("id", id).select().single();
85
+ if (error) fail(error);
86
+ const saved = quickAgentFromRow(data, QUICK_AGENT_DEFAULT_SETTINGS);
87
+ if (!saved) fail(null);
88
+ return saved;
89
+ }
90
+ async function deleteQuickAgent(client, id) {
91
+ const { error } = await table(client).update({ deleted_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", id);
92
+ if (error) fail(error);
93
+ }
94
+
43
95
  // catalog/selectors.ts
44
96
  function memoize1(fn) {
45
97
  let lastA;
@@ -215,6 +267,7 @@ function clamp(value, bound) {
215
267
  return Math.min(bound.max, Math.max(bound.min, value));
216
268
  }
217
269
  function clampQuickAgentSettings(settings, limits) {
270
+ limits ??= LEGACY_LIMITS;
218
271
  return {
219
272
  temperature: clamp(settings.temperature, limits.temperature),
220
273
  topP: clamp(settings.topP, limits.topP),
@@ -249,21 +302,21 @@ function quickAgentFields(def) {
249
302
  function num(value, fallback) {
250
303
  return typeof value === "number" && Number.isFinite(value) ? value : fallback;
251
304
  }
252
- function quickAgentFromRow(row, defaults) {
253
- if (!row) return null;
254
- const metadata = row["metadata"];
255
- const tags = Array.isArray(row["tags"]) ? row["tags"] : [];
305
+ function quickAgentFromRow(row2, defaults) {
306
+ if (!row2) return null;
307
+ const metadata = row2["metadata"];
308
+ const tags = Array.isArray(row2["tags"]) ? row2["tags"] : [];
256
309
  if (metadata?.["kind"] !== QUICK_AGENT_KIND && !tags.includes(QUICK_AGENT_TAG)) return null;
257
- const messages = Array.isArray(row["messages"]) ? row["messages"] : [];
310
+ const messages = Array.isArray(row2["messages"]) ? row2["messages"] : [];
258
311
  const system = messages.find((m) => m["role"] === "system");
259
312
  const parts = Array.isArray(system?.["content"]) ? system?.["content"] : [];
260
313
  const systemPrompt = parts.map((p) => typeof p["text"] === "string" ? p["text"] : "").join("");
261
- const raw = row["settings"] ?? {};
314
+ const raw = row2["settings"] ?? {};
262
315
  return {
263
- id: String(row["id"]),
264
- name: typeof row["name"] === "string" ? row["name"] : "",
316
+ id: String(row2["id"]),
317
+ name: typeof row2["name"] === "string" ? row2["name"] : "",
265
318
  systemPrompt,
266
- modelId: typeof row["model_id"] === "string" ? row["model_id"] : "",
319
+ modelId: typeof row2["model_id"] === "string" ? row2["model_id"] : "",
267
320
  settings: {
268
321
  temperature: num(raw["temperature"], defaults.temperature),
269
322
  topP: num(raw["top_p"], defaults.topP),
@@ -271,14 +324,14 @@ function quickAgentFromRow(row, defaults) {
271
324
  }
272
325
  };
273
326
  }
274
- function isQuickAgentSummary(row) {
275
- return row.tags.includes(QUICK_AGENT_TAG);
327
+ function isQuickAgentSummary(row2) {
328
+ return row2.tags.includes(QUICK_AGENT_TAG);
276
329
  }
277
330
  function listQuickAgents(rows, userId) {
278
- const live = (row) => isQuickAgentSummary(row) && !row.isArchived && row.isActive !== false;
331
+ const live = (row2) => isQuickAgentSummary(row2) && !row2.isArchived && row2.isActive !== false;
279
332
  const user = selectUserTypeAgents(rows).filter(live);
280
- const mine = userId ? user.filter((row) => row.createdBy === userId) : [];
281
- const organization = user.filter((row) => !mine.includes(row));
333
+ const mine = userId ? user.filter((row2) => row2.createdBy === userId) : [];
334
+ const organization = user.filter((row2) => !mine.includes(row2));
282
335
  const system = selectBuiltinTypeAgents(rows).filter(live);
283
336
  return { mine, organization, system };
284
337
  }
@@ -287,11 +340,11 @@ function listMyQuickAgents(rows, userId) {
287
340
  return [...lanes.mine, ...lanes.organization, ...lanes.system];
288
341
  }
289
342
  function withoutQuickAgents(rows) {
290
- return rows.filter((row) => !isQuickAgentSummary(row));
343
+ return rows.filter((row2) => !isQuickAgentSummary(row2));
291
344
  }
292
345
 
293
346
  // quick/reads.ts
294
- async function readQuickAgent(client, id, defaults) {
347
+ async function readQuickAgent(client, id, defaults = QUICK_AGENT_DEFAULT_SETTINGS) {
295
348
  const { data, error } = await client.schema("agent").from("definition").select("id,name,model_id,messages,settings,tags,metadata").eq("id", id).is("deleted_at", null).maybeSingle();
296
349
  if (error) throw new Error(error.message ?? "The agent could not be read.");
297
350
  return quickAgentFromRow(data, defaults);
@@ -109,7 +109,7 @@ declare function resolveQuickAgentLimits(model: ModelSettingRows | null | undefi
109
109
  /** A new agent's settings: every slider at its resting value. */
110
110
  declare function defaultQuickAgentSettings(limits: QuickAgentLimits): QuickAgentSettings;
111
111
  /** Settings pulled inside their limits (a slider can never save a value the model refuses). */
112
- declare function clampQuickAgentSettings(settings: QuickAgentSettings, limits: QuickAgentLimits): QuickAgentSettings;
112
+ declare function clampQuickAgentSettings(settings: QuickAgentSettings, limits?: QuickAgentLimits): QuickAgentSettings;
113
113
  /** What stops a save, in words — empty when the definition is saveable. */
114
114
  declare function quickAgentProblems(def: Pick<QuickAgentDefinition, "name" | "systemPrompt" | "modelId">): string[];
115
115
  interface QuickAgentSystemMessage {
@@ -157,17 +157,47 @@ declare function listMyQuickAgents(rows: readonly AgentSummary[], userId: string
157
157
  /** The big catalogue's view: quick agents leave the general list (a filter, never a delete). */
158
158
  declare function withoutQuickAgents<T extends Pick<AgentSummary, "tags">>(rows: readonly T[]): T[];
159
159
 
160
- /**
161
- * The one READ of a quick agent: its full definition (the catalog row carries no prompt). Reads
162
- * only; every write goes through chat's one agent-definition write path.
163
- */
164
-
165
160
  interface QuickAgentClient {
166
161
  schema(name: "agent"): {
167
162
  from(table: "definition"): any;
168
163
  };
169
164
  }
170
165
  /** One quick agent's full definition; settings the row lacks rest at `defaults`. */
171
- declare function readQuickAgent(client: QuickAgentClient, id: string, defaults: QuickAgentSettings): Promise<QuickAgent | null>;
166
+ declare function readQuickAgent(client: QuickAgentClient, id: string, defaults?: QuickAgentSettings): Promise<QuickAgent | null>;
167
+
168
+ /**
169
+ * TEMPORARY COMPATIBILITY for published `@ai-matrx/chat` <= 0.8.328, which still imports these from
170
+ * `@ai-matrx/agents/quick` (createQuickAgent, updateQuickAgent, deleteQuickAgent, QUICK_AGENT_BOUNDS,
171
+ * QUICK_AGENT_DEFAULT_SETTINGS, the one-argument clamp, a two-argument readQuickAgent). Current chat
172
+ * saves through its own `definition-writes` (the ONE write path; agents cannot import chat), so these
173
+ * exist only so the old chat on npm keeps working. REMOVE this file, its guard allowlist entry and
174
+ * `quick/__tests__/published-consumers.json` once a chat release that no longer imports them is on npm.
175
+ */
176
+
177
+ declare const QUICK_AGENT_BOUNDS: {
178
+ readonly temperature: {
179
+ readonly min: 0;
180
+ readonly max: 2;
181
+ readonly step: 0.1;
182
+ };
183
+ readonly topP: {
184
+ readonly min: 0;
185
+ readonly max: 1;
186
+ readonly step: 0.05;
187
+ };
188
+ readonly maxOutputTokens: {
189
+ readonly min: 256;
190
+ readonly max: 32768;
191
+ readonly step: 256;
192
+ };
193
+ };
194
+ declare const QUICK_AGENT_DEFAULT_SETTINGS: QuickAgentSettings;
195
+ declare const LEGACY_LIMITS: QuickAgentLimits;
196
+ declare function createQuickAgent(client: QuickAgentClient, def: QuickAgentDefinition, owner: {
197
+ organizationId: string;
198
+ userId: string;
199
+ }): Promise<QuickAgent>;
200
+ declare function updateQuickAgent(client: QuickAgentClient, id: string, def: QuickAgentDefinition): Promise<QuickAgent>;
201
+ declare function deleteQuickAgent(client: QuickAgentClient, id: string): Promise<void>;
172
202
 
173
- export { type ModelSettingRow, type ModelSettingRows, QUICK_AGENT_KIND, QUICK_AGENT_KNOBS, QUICK_AGENT_TAG, type QuickAgent, type QuickAgentClient, type QuickAgentDefinition, type QuickAgentKnobValues, type QuickAgentLimits, type QuickAgentSettingLimit, type QuickAgentSettings, type QuickAgentSystemMessage, clampQuickAgentSettings, defaultQuickAgentSettings, isQuickAgentSummary, listMyQuickAgents, listQuickAgents, quickAgentFields, quickAgentFromRow, quickAgentMessages, quickAgentProblems, quickAgentSettingsJson, readQuickAgent, resolveQuickAgentLimits, sliderStep, withoutQuickAgents };
203
+ export { LEGACY_LIMITS, type ModelSettingRow, type ModelSettingRows, QUICK_AGENT_BOUNDS, QUICK_AGENT_DEFAULT_SETTINGS, QUICK_AGENT_KIND, QUICK_AGENT_KNOBS, QUICK_AGENT_TAG, type QuickAgent, type QuickAgentClient, type QuickAgentDefinition, type QuickAgentKnobValues, type QuickAgentLimits, type QuickAgentSettingLimit, type QuickAgentSettings, type QuickAgentSystemMessage, clampQuickAgentSettings, createQuickAgent, defaultQuickAgentSettings, deleteQuickAgent, isQuickAgentSummary, listMyQuickAgents, listQuickAgents, quickAgentFields, quickAgentFromRow, quickAgentMessages, quickAgentProblems, quickAgentSettingsJson, readQuickAgent, resolveQuickAgentLimits, sliderStep, updateQuickAgent, withoutQuickAgents };
@@ -109,7 +109,7 @@ declare function resolveQuickAgentLimits(model: ModelSettingRows | null | undefi
109
109
  /** A new agent's settings: every slider at its resting value. */
110
110
  declare function defaultQuickAgentSettings(limits: QuickAgentLimits): QuickAgentSettings;
111
111
  /** Settings pulled inside their limits (a slider can never save a value the model refuses). */
112
- declare function clampQuickAgentSettings(settings: QuickAgentSettings, limits: QuickAgentLimits): QuickAgentSettings;
112
+ declare function clampQuickAgentSettings(settings: QuickAgentSettings, limits?: QuickAgentLimits): QuickAgentSettings;
113
113
  /** What stops a save, in words — empty when the definition is saveable. */
114
114
  declare function quickAgentProblems(def: Pick<QuickAgentDefinition, "name" | "systemPrompt" | "modelId">): string[];
115
115
  interface QuickAgentSystemMessage {
@@ -157,17 +157,47 @@ declare function listMyQuickAgents(rows: readonly AgentSummary[], userId: string
157
157
  /** The big catalogue's view: quick agents leave the general list (a filter, never a delete). */
158
158
  declare function withoutQuickAgents<T extends Pick<AgentSummary, "tags">>(rows: readonly T[]): T[];
159
159
 
160
- /**
161
- * The one READ of a quick agent: its full definition (the catalog row carries no prompt). Reads
162
- * only; every write goes through chat's one agent-definition write path.
163
- */
164
-
165
160
  interface QuickAgentClient {
166
161
  schema(name: "agent"): {
167
162
  from(table: "definition"): any;
168
163
  };
169
164
  }
170
165
  /** One quick agent's full definition; settings the row lacks rest at `defaults`. */
171
- declare function readQuickAgent(client: QuickAgentClient, id: string, defaults: QuickAgentSettings): Promise<QuickAgent | null>;
166
+ declare function readQuickAgent(client: QuickAgentClient, id: string, defaults?: QuickAgentSettings): Promise<QuickAgent | null>;
167
+
168
+ /**
169
+ * TEMPORARY COMPATIBILITY for published `@ai-matrx/chat` <= 0.8.328, which still imports these from
170
+ * `@ai-matrx/agents/quick` (createQuickAgent, updateQuickAgent, deleteQuickAgent, QUICK_AGENT_BOUNDS,
171
+ * QUICK_AGENT_DEFAULT_SETTINGS, the one-argument clamp, a two-argument readQuickAgent). Current chat
172
+ * saves through its own `definition-writes` (the ONE write path; agents cannot import chat), so these
173
+ * exist only so the old chat on npm keeps working. REMOVE this file, its guard allowlist entry and
174
+ * `quick/__tests__/published-consumers.json` once a chat release that no longer imports them is on npm.
175
+ */
176
+
177
+ declare const QUICK_AGENT_BOUNDS: {
178
+ readonly temperature: {
179
+ readonly min: 0;
180
+ readonly max: 2;
181
+ readonly step: 0.1;
182
+ };
183
+ readonly topP: {
184
+ readonly min: 0;
185
+ readonly max: 1;
186
+ readonly step: 0.05;
187
+ };
188
+ readonly maxOutputTokens: {
189
+ readonly min: 256;
190
+ readonly max: 32768;
191
+ readonly step: 256;
192
+ };
193
+ };
194
+ declare const QUICK_AGENT_DEFAULT_SETTINGS: QuickAgentSettings;
195
+ declare const LEGACY_LIMITS: QuickAgentLimits;
196
+ declare function createQuickAgent(client: QuickAgentClient, def: QuickAgentDefinition, owner: {
197
+ organizationId: string;
198
+ userId: string;
199
+ }): Promise<QuickAgent>;
200
+ declare function updateQuickAgent(client: QuickAgentClient, id: string, def: QuickAgentDefinition): Promise<QuickAgent>;
201
+ declare function deleteQuickAgent(client: QuickAgentClient, id: string): Promise<void>;
172
202
 
173
- export { type ModelSettingRow, type ModelSettingRows, QUICK_AGENT_KIND, QUICK_AGENT_KNOBS, QUICK_AGENT_TAG, type QuickAgent, type QuickAgentClient, type QuickAgentDefinition, type QuickAgentKnobValues, type QuickAgentLimits, type QuickAgentSettingLimit, type QuickAgentSettings, type QuickAgentSystemMessage, clampQuickAgentSettings, defaultQuickAgentSettings, isQuickAgentSummary, listMyQuickAgents, listQuickAgents, quickAgentFields, quickAgentFromRow, quickAgentMessages, quickAgentProblems, quickAgentSettingsJson, readQuickAgent, resolveQuickAgentLimits, sliderStep, withoutQuickAgents };
203
+ export { LEGACY_LIMITS, type ModelSettingRow, type ModelSettingRows, QUICK_AGENT_BOUNDS, QUICK_AGENT_DEFAULT_SETTINGS, QUICK_AGENT_KIND, QUICK_AGENT_KNOBS, QUICK_AGENT_TAG, type QuickAgent, type QuickAgentClient, type QuickAgentDefinition, type QuickAgentKnobValues, type QuickAgentLimits, type QuickAgentSettingLimit, type QuickAgentSettings, type QuickAgentSystemMessage, clampQuickAgentSettings, createQuickAgent, defaultQuickAgentSettings, deleteQuickAgent, isQuickAgentSummary, listMyQuickAgents, listQuickAgents, quickAgentFields, quickAgentFromRow, quickAgentMessages, quickAgentProblems, quickAgentSettingsJson, readQuickAgent, resolveQuickAgentLimits, sliderStep, updateQuickAgent, withoutQuickAgents };
@@ -1,3 +1,49 @@
1
+ // quick/legacy.ts
2
+ var QUICK_AGENT_BOUNDS = {
3
+ temperature: { min: 0, max: 2, step: 0.1 },
4
+ topP: { min: 0, max: 1, step: 0.05 },
5
+ maxOutputTokens: { min: 256, max: 32768, step: 256 }
6
+ };
7
+ var QUICK_AGENT_DEFAULT_SETTINGS = Object.freeze({ temperature: 0.7, topP: 1, maxOutputTokens: 4096 });
8
+ var LEGACY_LIMITS = {
9
+ temperature: { ...QUICK_AGENT_BOUNDS.temperature, default: QUICK_AGENT_DEFAULT_SETTINGS.temperature },
10
+ topP: { ...QUICK_AGENT_BOUNDS.topP, default: QUICK_AGENT_DEFAULT_SETTINGS.topP },
11
+ maxOutputTokens: { ...QUICK_AGENT_BOUNDS.maxOutputTokens, default: QUICK_AGENT_DEFAULT_SETTINGS.maxOutputTokens }
12
+ };
13
+ function refuse(def) {
14
+ const problems = quickAgentProblems(def);
15
+ if (problems.length > 0) throw new Error(problems[0]);
16
+ }
17
+ function fail(error) {
18
+ throw new Error(error?.message ?? "The agent could not be saved.");
19
+ }
20
+ var table = (client) => client.schema("agent").from("definition");
21
+ var row = (def) => {
22
+ const f = quickAgentFields(def);
23
+ return { agent_type: "user", name: f.name, description: null, tags: f.tags, is_active: true, is_archived: false, model_id: f.modelId, messages: f.messages, settings: f.settings, tools: [], metadata: { kind: "quick" } };
24
+ };
25
+ async function createQuickAgent(client, def, owner) {
26
+ refuse(def);
27
+ const { data, error } = await table(client).insert({ ...row(def), created_by: owner.userId, organization_id: owner.organizationId }).select().single();
28
+ if (error) fail(error);
29
+ const saved = quickAgentFromRow(data, QUICK_AGENT_DEFAULT_SETTINGS);
30
+ if (!saved) fail(null);
31
+ return saved;
32
+ }
33
+ async function updateQuickAgent(client, id, def) {
34
+ refuse(def);
35
+ const { name, model_id, messages, settings } = row(def);
36
+ const { data, error } = await table(client).update({ name, model_id, messages, settings }).eq("id", id).select().single();
37
+ if (error) fail(error);
38
+ const saved = quickAgentFromRow(data, QUICK_AGENT_DEFAULT_SETTINGS);
39
+ if (!saved) fail(null);
40
+ return saved;
41
+ }
42
+ async function deleteQuickAgent(client, id) {
43
+ const { error } = await table(client).update({ deleted_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", id);
44
+ if (error) fail(error);
45
+ }
46
+
1
47
  // catalog/selectors.ts
2
48
  function memoize1(fn) {
3
49
  let lastA;
@@ -173,6 +219,7 @@ function clamp(value, bound) {
173
219
  return Math.min(bound.max, Math.max(bound.min, value));
174
220
  }
175
221
  function clampQuickAgentSettings(settings, limits) {
222
+ limits ??= LEGACY_LIMITS;
176
223
  return {
177
224
  temperature: clamp(settings.temperature, limits.temperature),
178
225
  topP: clamp(settings.topP, limits.topP),
@@ -207,21 +254,21 @@ function quickAgentFields(def) {
207
254
  function num(value, fallback) {
208
255
  return typeof value === "number" && Number.isFinite(value) ? value : fallback;
209
256
  }
210
- function quickAgentFromRow(row, defaults) {
211
- if (!row) return null;
212
- const metadata = row["metadata"];
213
- const tags = Array.isArray(row["tags"]) ? row["tags"] : [];
257
+ function quickAgentFromRow(row2, defaults) {
258
+ if (!row2) return null;
259
+ const metadata = row2["metadata"];
260
+ const tags = Array.isArray(row2["tags"]) ? row2["tags"] : [];
214
261
  if (metadata?.["kind"] !== QUICK_AGENT_KIND && !tags.includes(QUICK_AGENT_TAG)) return null;
215
- const messages = Array.isArray(row["messages"]) ? row["messages"] : [];
262
+ const messages = Array.isArray(row2["messages"]) ? row2["messages"] : [];
216
263
  const system = messages.find((m) => m["role"] === "system");
217
264
  const parts = Array.isArray(system?.["content"]) ? system?.["content"] : [];
218
265
  const systemPrompt = parts.map((p) => typeof p["text"] === "string" ? p["text"] : "").join("");
219
- const raw = row["settings"] ?? {};
266
+ const raw = row2["settings"] ?? {};
220
267
  return {
221
- id: String(row["id"]),
222
- name: typeof row["name"] === "string" ? row["name"] : "",
268
+ id: String(row2["id"]),
269
+ name: typeof row2["name"] === "string" ? row2["name"] : "",
223
270
  systemPrompt,
224
- modelId: typeof row["model_id"] === "string" ? row["model_id"] : "",
271
+ modelId: typeof row2["model_id"] === "string" ? row2["model_id"] : "",
225
272
  settings: {
226
273
  temperature: num(raw["temperature"], defaults.temperature),
227
274
  topP: num(raw["top_p"], defaults.topP),
@@ -229,14 +276,14 @@ function quickAgentFromRow(row, defaults) {
229
276
  }
230
277
  };
231
278
  }
232
- function isQuickAgentSummary(row) {
233
- return row.tags.includes(QUICK_AGENT_TAG);
279
+ function isQuickAgentSummary(row2) {
280
+ return row2.tags.includes(QUICK_AGENT_TAG);
234
281
  }
235
282
  function listQuickAgents(rows, userId) {
236
- const live = (row) => isQuickAgentSummary(row) && !row.isArchived && row.isActive !== false;
283
+ const live = (row2) => isQuickAgentSummary(row2) && !row2.isArchived && row2.isActive !== false;
237
284
  const user = selectUserTypeAgents(rows).filter(live);
238
- const mine = userId ? user.filter((row) => row.createdBy === userId) : [];
239
- const organization = user.filter((row) => !mine.includes(row));
285
+ const mine = userId ? user.filter((row2) => row2.createdBy === userId) : [];
286
+ const organization = user.filter((row2) => !mine.includes(row2));
240
287
  const system = selectBuiltinTypeAgents(rows).filter(live);
241
288
  return { mine, organization, system };
242
289
  }
@@ -245,21 +292,26 @@ function listMyQuickAgents(rows, userId) {
245
292
  return [...lanes.mine, ...lanes.organization, ...lanes.system];
246
293
  }
247
294
  function withoutQuickAgents(rows) {
248
- return rows.filter((row) => !isQuickAgentSummary(row));
295
+ return rows.filter((row2) => !isQuickAgentSummary(row2));
249
296
  }
250
297
 
251
298
  // quick/reads.ts
252
- async function readQuickAgent(client, id, defaults) {
299
+ async function readQuickAgent(client, id, defaults = QUICK_AGENT_DEFAULT_SETTINGS) {
253
300
  const { data, error } = await client.schema("agent").from("definition").select("id,name,model_id,messages,settings,tags,metadata").eq("id", id).is("deleted_at", null).maybeSingle();
254
301
  if (error) throw new Error(error.message ?? "The agent could not be read.");
255
302
  return quickAgentFromRow(data, defaults);
256
303
  }
257
304
  export {
305
+ LEGACY_LIMITS,
306
+ QUICK_AGENT_BOUNDS,
307
+ QUICK_AGENT_DEFAULT_SETTINGS,
258
308
  QUICK_AGENT_KIND,
259
309
  QUICK_AGENT_KNOBS,
260
310
  QUICK_AGENT_TAG,
261
311
  clampQuickAgentSettings,
312
+ createQuickAgent,
262
313
  defaultQuickAgentSettings,
314
+ deleteQuickAgent,
263
315
  isQuickAgentSummary,
264
316
  listMyQuickAgents,
265
317
  listQuickAgents,
@@ -271,5 +323,6 @@ export {
271
323
  readQuickAgent,
272
324
  resolveQuickAgentLimits,
273
325
  sliderStep,
326
+ updateQuickAgent,
274
327
  withoutQuickAgents
275
328
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/agents",
3
- "version": "0.59.232",
3
+ "version": "0.59.233",
4
4
  "description": "Portable AI Matrx agent stream protocol, event projection, and safe result-presentation primitives.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -510,13 +510,13 @@
510
510
  "dependencies": {
511
511
  "@ai-matrx/alchemy": "latest",
512
512
  "@ai-matrx/api": "latest",
513
- "@ai-matrx/content-ir": "latest",
514
- "@ai-matrx/design-system": "latest",
515
- "@ai-matrx/data": "latest",
516
513
  "@ai-matrx/associations": "latest",
514
+ "@ai-matrx/data": "latest",
515
+ "@ai-matrx/design-system": "latest",
516
+ "@ai-matrx/content-ir": "latest",
517
517
  "@ai-matrx/diff": "latest",
518
- "@ai-matrx/icons": "latest",
519
- "@ai-matrx/kit": "latest"
518
+ "@ai-matrx/kit": "latest",
519
+ "@ai-matrx/icons": "latest"
520
520
  },
521
521
  "peerDependencies": {
522
522
  "react": ">=18.0.0",
@@ -561,5 +561,5 @@
561
561
  "verify:tarball": "node ./scripts/verify-tarball.mjs",
562
562
  "typegen:self-test": "node scripts/typegen/drop-guard.self-test.mjs && node scripts/typegen/check-api-types-fresh.mjs --self-test"
563
563
  },
564
- "gitHead": "023ace36d238466441ab83616e796aa7a697664d"
564
+ "gitHead": "976e132072571eaf8e301e73396655730a2f2acc"
565
565
  }