@fonoster/apiserver 0.52.0 → 0.53.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.
@@ -22,6 +22,7 @@ declare function createGetFnUtil(prisma: Prisma): (ref: string) => Promise<{
22
22
  createdAt: Date;
23
23
  updatedAt: Date;
24
24
  recording: string | null;
25
+ filters: import("@prisma/client/runtime/library").JsonValue | null;
25
26
  silenceTimeoutMs: number | null;
26
27
  patience: string | null;
27
28
  protocol: string | null;
@@ -30,7 +31,6 @@ declare function createGetFnUtil(prisma: Prisma): (ref: string) => Promise<{
30
31
  fallbackMessage: string | null;
31
32
  listeners: import("@prisma/client/runtime/library").JsonValue | null;
32
33
  amd: boolean;
33
- filters: import("@prisma/client/runtime/library").JsonValue | null;
34
34
  signingSecret: string | null;
35
35
  speechLanguage: string | null;
36
36
  speechSpeed: number | null;
@@ -60,7 +60,6 @@ export declare const sessionAppInputSchema: z.ZodObject<{
60
60
  recording: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
61
61
  on: "on";
62
62
  off: "off";
63
- consent: "consent";
64
63
  }>>, unknown>;
65
64
  amd: z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
66
65
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -112,7 +111,7 @@ export declare function toAppColumns(db: AppsDb, request: Record<string, unknown
112
111
  }[];
113
112
  fallbackAppRef: string;
114
113
  fallbackMessage: string;
115
- recording: "on" | "off" | "consent";
114
+ recording: "on" | "off";
116
115
  amd: boolean;
117
116
  amdWindowMs: number;
118
117
  filters: AudioFilters.AudioFilterConfig[];
@@ -121,7 +121,7 @@ exports.sessionAppInputSchema = zod_1.z.object({
121
121
  tracks: zod_1.z.preprocess(blank, zod_1.z.enum(["inbound", "outbound", "both"]).default("both"))
122
122
  }))
123
123
  .max(4, "at most 4 listeners")),
124
- recording: optional(zod_1.z.enum(["off", "on", "consent"])),
124
+ recording: optional(zod_1.z.enum(["off", "on"])),
125
125
  // AO-B1: answering-machine detection; absent (or enabled false) is off.
126
126
  amd: zod_1.z.preprocess((v) => v !== null && v !== void 0 ? v : undefined, zod_1.z
127
127
  .object({
@@ -136,7 +136,7 @@ function subscribeRegistryUsage(nc, db) {
136
136
  */
137
137
  function listWarnings(db_1, accessKeyId_1) {
138
138
  return __awaiter(this, arguments, void 0, function* (db, accessKeyId, now = new Date()) {
139
- var _a, _b, _c, _d, _e;
139
+ var _a, _b, _c, _d;
140
140
  const notActive = { state: { not: "ACTIVE" } };
141
141
  const [providers, models, voices, apps, notices] = yield Promise.all([
142
142
  db.registryProvider.findMany({ where: notActive }),
@@ -203,8 +203,7 @@ function listWarnings(db_1, accessKeyId_1) {
203
203
  [app.speechVoice, "app", "voice"],
204
204
  [app.speechTtsModel, "app", "ttsModel"],
205
205
  [app.speechSttModel, "app", "sttModel"],
206
- [(_a = agent === null || agent === void 0 ? void 0 : agent.languageModel) === null || _a === void 0 ? void 0 : _a.model, "agent", "llm"],
207
- [(_b = agent === null || agent === void 0 ? void 0 : agent.conversationSettings) === null || _b === void 0 ? void 0 : _b.voice, "agent", "voice"]
206
+ [(_a = agent === null || agent === void 0 ? void 0 : agent.languageModel) === null || _a === void 0 ? void 0 : _a.model, "agent", "llm"]
208
207
  ];
209
208
  for (const [id, kind, field] of refs) {
210
209
  if (!id)
@@ -218,15 +217,15 @@ function listWarnings(db_1, accessKeyId_1) {
218
217
  const since = now.getTime() - exports.RUNTIME_WARNING_DAYS * 24 * 3600 * 1000;
219
218
  for (const n of notices) {
220
219
  const d = n.data;
221
- const last = Date.parse(String((_c = d.lastSeenAt) !== null && _c !== void 0 ? _c : ""));
220
+ const last = Date.parse(String((_b = d.lastSeenAt) !== null && _b !== void 0 ? _b : ""));
222
221
  if (!(last >= since))
223
222
  continue;
224
223
  for (const e of flagged(String(d.id))) {
225
224
  const w = warning(e);
226
225
  w.runtimeApps = [
227
- ...new Set([...w.runtimeApps, ...((_d = d.apps) !== null && _d !== void 0 ? _d : [])])
226
+ ...new Set([...w.runtimeApps, ...((_c = d.apps) !== null && _c !== void 0 ? _c : [])])
228
227
  ];
229
- w.runtimeSessions += Number((_e = d.sessions) !== null && _e !== void 0 ? _e : 0);
228
+ w.runtimeSessions += Number((_d = d.sessions) !== null && _d !== void 0 ? _d : 0);
230
229
  if (!w.lastUsedAt || String(d.lastSeenAt) > w.lastUsedAt)
231
230
  w.lastUsedAt = String(d.lastSeenAt);
232
231
  }
@@ -31,6 +31,7 @@ exports.createConfigSync = createConfigSync;
31
31
  * See the License for the specific language governing permissions and
32
32
  * limitations under the License.
33
33
  */
34
+ const common_1 = require("@fonoster/common");
34
35
  const logger_1 = require("@fonoster/logger");
35
36
  const types_1 = require("./types");
36
37
  const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
@@ -50,23 +51,30 @@ function catalogUse(apps, agents) {
50
51
  var _a, _b, _c, _d;
51
52
  const ids = new Set();
52
53
  const usedBy = new Map();
53
- const use = (id, by) => {
54
- if (!id)
55
- return;
56
- ids.add(id);
57
- const provider = providerOf(id);
54
+ const need = (provider, by) => {
58
55
  if (!provider)
59
56
  return;
60
57
  if (!usedBy.has(provider))
61
58
  usedBy.set(provider, new Set());
62
59
  usedBy.get(provider).add(by);
63
60
  };
61
+ const use = (id, by) => {
62
+ if (!id)
63
+ return;
64
+ ids.add(id);
65
+ need(providerOf(id), by);
66
+ };
64
67
  for (const app of apps) {
65
68
  const name = String((_a = app.name) !== null && _a !== void 0 ? _a : app.ref);
66
69
  use(app.speechVoice || exports.DEFAULT_SPEECH.voice, name);
67
70
  use(app.speechSttModel || exports.DEFAULT_SPEECH.sttModel, name);
68
71
  if (app.speechTtsModel)
69
72
  use(app.speechTtsModel, name);
73
+ // A noise-cancelling filter runs with its `nc` provider's key, which the cell must hold too.
74
+ const filters = Array.isArray(app.filters) ? app.filters : [];
75
+ filters.forEach((f) => need(typeof (f === null || f === void 0 ? void 0 : f.name) === "string"
76
+ ? common_1.AudioFilters.providerOfFilter(f.name)
77
+ : undefined, name));
70
78
  }
71
79
  for (const a of agents) {
72
80
  const app = apps.find((x) => x.ref === a.appRef);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/apiserver",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "description": "APIServer for Fonoster",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -23,14 +23,14 @@
23
23
  "fonoster-owner": "./dist/bin/owner.js"
24
24
  },
25
25
  "dependencies": {
26
- "@fonoster/authz": "^0.52.0",
27
- "@fonoster/autopilot": "^0.52.0",
28
- "@fonoster/callrecord": "^0.52.0",
29
- "@fonoster/common": "^0.52.0",
30
- "@fonoster/identity": "^0.52.0",
31
- "@fonoster/logger": "^0.52.0",
32
- "@fonoster/sipnet": "^0.52.0",
33
- "@fonoster/types": "^0.52.0",
26
+ "@fonoster/authz": "^0.53.0",
27
+ "@fonoster/autopilot": "^0.53.0",
28
+ "@fonoster/callrecord": "^0.53.0",
29
+ "@fonoster/common": "^0.53.0",
30
+ "@fonoster/identity": "^0.53.0",
31
+ "@fonoster/logger": "^0.53.0",
32
+ "@fonoster/sipnet": "^0.53.0",
33
+ "@fonoster/types": "^0.53.0",
34
34
  "@grpc/grpc-js": "~1.14.6",
35
35
  "@prisma/client": "^6.19.1",
36
36
  "@routr/common": "^2.24.0",
@@ -62,13 +62,13 @@
62
62
  "url": "https://github.com/fonoster/fonoster/issues"
63
63
  },
64
64
  "devDependencies": {
65
- "@fonoster/ops": "^0.52.0",
65
+ "@fonoster/ops": "^0.53.0",
66
66
  "@types/express": "^5.0.6",
67
67
  "@types/jsonwebtoken": "^9.0.10",
68
68
  "@types/uuid": "^10.0.0",
69
69
  "@types/validator": "^13.15.10"
70
70
  },
71
- "gitHead": "31d7905a659fa8d5fe1c30e2717362764a730726",
71
+ "gitHead": "473eaef2f3847eaa15ff0f80fe84eea7eedfe4b9",
72
72
  "prisma": {
73
73
  "seed": "tsx src/core/seed.ts"
74
74
  }