@superinterface/server 1.0.20 → 1.0.22

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.
Files changed (128) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/eslint/.cache_btwyo7 +1 -1
  5. package/.next/fallback-build-manifest.json +2 -2
  6. package/.next/server/app/_not-found.html +1 -1
  7. package/.next/server/app/_not-found.rsc +1 -1
  8. package/.next/server/app/index.html +1 -1
  9. package/.next/server/app/index.rsc +1 -1
  10. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
  11. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
  12. package/.next/server/chunks/[root-of-the-server]__228bff78._.js +10 -10
  13. package/.next/server/chunks/[root-of-the-server]__228bff78._.js.map +1 -1
  14. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
  15. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
  16. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +1 -1
  17. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +1 -1
  18. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
  19. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
  20. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
  21. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
  22. package/.next/server/chunks/[root-of-the-server]__29b43490._.js +1 -1
  23. package/.next/server/chunks/[root-of-the-server]__29b43490._.js.map +1 -1
  24. package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
  25. package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
  26. package/.next/server/chunks/[root-of-the-server]__3307123c._.js +10 -10
  27. package/.next/server/chunks/[root-of-the-server]__3307123c._.js.map +1 -1
  28. package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
  29. package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
  30. package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
  31. package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
  32. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
  33. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
  34. package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js +10 -10
  35. package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js.map +1 -1
  36. package/.next/server/chunks/[root-of-the-server]__51977f30._.js +1 -1
  37. package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +1 -1
  38. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
  39. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
  40. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
  41. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
  42. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
  43. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
  44. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
  45. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
  46. package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js +10 -10
  47. package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js.map +1 -1
  48. package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
  49. package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
  50. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
  51. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
  52. package/.next/server/chunks/[root-of-the-server]__a135e388._.js +1 -1
  53. package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +1 -1
  54. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
  55. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
  56. package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
  57. package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
  58. package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js +1 -1
  59. package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js.map +1 -1
  60. package/.next/server/chunks/[root-of-the-server]__e7819e95._.js +10 -10
  61. package/.next/server/chunks/[root-of-the-server]__e7819e95._.js.map +1 -1
  62. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
  63. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
  64. package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js +10 -10
  65. package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js.map +1 -1
  66. package/.next/server/chunks/[root-of-the-server]__ff90af03._.js +10 -10
  67. package/.next/server/chunks/[root-of-the-server]__ff90af03._.js.map +1 -1
  68. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js +1 -1
  69. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js.map +1 -1
  70. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js +1 -1
  71. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js.map +1 -1
  72. package/.next/server/pages/404.html +1 -1
  73. package/.next/server/pages/500.html +1 -1
  74. package/.next/trace +1 -1
  75. package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
  76. package/dist/app/api/api-keys/[apiKeyId]/route.js +4 -4
  77. package/dist/app/api/api-keys/route.d.ts.map +1 -1
  78. package/dist/app/api/api-keys/route.js +3 -3
  79. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
  80. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +4 -4
  81. package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
  82. package/dist/app/api/assistants/[assistantId]/functions/route.js +3 -3
  83. package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
  84. package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +3 -3
  85. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts.map +1 -1
  86. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +4 -4
  87. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
  88. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +3 -3
  89. package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
  90. package/dist/app/api/assistants/[assistantId]/route.js +4 -4
  91. package/dist/app/api/assistants/route.d.ts.map +1 -1
  92. package/dist/app/api/assistants/route.js +3 -3
  93. package/dist/app/api/files/[fileId]/contents/route.js +2 -2
  94. package/dist/app/api/files/route.d.ts.map +1 -1
  95. package/dist/app/api/files/route.js +2 -2
  96. package/dist/app/api/messages/route.d.ts.map +1 -1
  97. package/dist/app/api/messages/route.js +3 -3
  98. package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
  99. package/dist/app/api/providers/[modelProviderId]/assistants/route.js +2 -2
  100. package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
  101. package/dist/app/api/providers/[modelProviderId]/models/route.js +2 -2
  102. package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
  103. package/dist/app/api/providers/[modelProviderId]/route.js +4 -4
  104. package/dist/app/api/providers/route.d.ts.map +1 -1
  105. package/dist/app/api/providers/route.js +3 -3
  106. package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
  107. package/dist/app/api/tasks/[taskId]/route.js +4 -4
  108. package/dist/app/api/tasks/callback/route.js +2 -2
  109. package/dist/app/api/tasks/route.d.ts.map +1 -1
  110. package/dist/app/api/tasks/route.js +3 -3
  111. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts.map +1 -1
  112. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.js +2 -2
  113. package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
  114. package/dist/app/api/workspaces/[workspaceId]/route.js +3 -3
  115. package/dist/app/api/workspaces/route.d.ts.map +1 -1
  116. package/dist/app/api/workspaces/route.js +3 -3
  117. package/dist/lib/functions/handleFunction/handleAssistant.d.ts.map +1 -1
  118. package/dist/lib/functions/handleFunction/handleAssistant.js +1 -0
  119. package/dist/lib/prisma/index.d.ts +2 -2
  120. package/dist/lib/prisma/index.d.ts.map +1 -1
  121. package/dist/lib/prisma/index.js +45 -6
  122. package/dist/lib/toolCalls/streamOutput.d.ts +3 -1
  123. package/dist/lib/toolCalls/streamOutput.d.ts.map +1 -1
  124. package/dist/lib/toolCalls/streamOutput.js +1 -2
  125. package/package.json +2 -1
  126. /package/.next/static/{Ggpv5PXa7pPyxP1NXVbh6 → ImVeJObVDbb-MHLkfrFb1}/_buildManifest.js +0 -0
  127. /package/.next/static/{Ggpv5PXa7pPyxP1NXVbh6 → ImVeJObVDbb-MHLkfrFb1}/_clientMiddlewareManifest.json +0 -0
  128. /package/.next/static/{Ggpv5PXa7pPyxP1NXVbh6 → ImVeJObVDbb-MHLkfrFb1}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/workspaces/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE3E,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,QAAA,MAAM,qBAAqB;;;;;;EAEzB,CAAA;AAEF,eAAO,MAAM,QAAQ,GAClB,aAA0B;IAAE,MAAM,CA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,OAAO,qBAAqB,CAAC,CAAA;QACjD,YAAY,EAAE,YAAY,CAAA;QAC1B,MAAM,EAAE,YAAY,CAAA;KACrB,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;CACpB,MACC,SAAS,WAAW;;;;;;;;;GAuD1B,CAAA;AAEH,eAAO,MAAM,IAAI,YAzDC,WAAW;;;;;;;;;GAyDI,CAAA;AAEjC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
@@ -2,13 +2,13 @@ import { headers } from 'next/headers';
2
2
  import { NextResponse } from 'next/server';
3
3
  import { z } from 'zod';
4
4
  import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
5
- import { getPrisma } from '../../../lib/prisma';
5
+ import { prisma as defaultPrisma } from '../../../lib/prisma';
6
6
  import { serializeApiWorkspace } from '../../../lib/workspaces/serializeApiWorkspace';
7
7
  import { getOrganizationApiKey } from '../../../lib/organizationApiKeys/getOrganizationApiKey';
8
8
  const createWorkspaceSchema = z.object({
9
9
  name: z.string().optional(),
10
10
  });
11
- export const buildGET = ({ prisma = getPrisma() } = {}) => async () => {
11
+ export const buildGET = ({ prisma = defaultPrisma } = {}) => async () => {
12
12
  const headersList = await headers();
13
13
  const authorization = headersList.get('authorization');
14
14
  if (!authorization) {
@@ -31,7 +31,7 @@ export const buildGET = ({ prisma = getPrisma() } = {}) => async () => {
31
31
  }, { headers: cacheHeaders });
32
32
  };
33
33
  export const GET = buildGET();
34
- export const buildPOST = ({ prisma = getPrisma(), createWorkspace = ({ parsedData, organization, prisma, }) => {
34
+ export const buildPOST = ({ prisma = defaultPrisma, createWorkspace = ({ parsedData, organization, prisma, }) => {
35
35
  var _a;
36
36
  return prisma.workspace.create({
37
37
  data: {
@@ -1 +1 @@
1
- {"version":3,"file":"handleAssistant.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAIhB,SAAS,EACT,MAAM,EACN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAgBvB,eAAO,MAAM,eAAe,GAAU,4GAQnC;IACD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAA;IACjE,UAAU,EAAE,+BAA+B,CAAA;IAC3C,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAA;IACjC,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB;;;EAkXA,CAAA"}
1
+ {"version":3,"file":"handleAssistant.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAIhB,SAAS,EACT,MAAM,EACN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAgBvB,eAAO,MAAM,eAAe,GAAU,4GAQnC;IACD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAA;IACjE,UAAU,EAAE,+BAA+B,CAAA;IAC3C,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAA;IACjC,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB;;;EAmXA,CAAA"}
@@ -335,6 +335,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
335
335
  messageResponse,
336
336
  controller,
337
337
  run,
338
+ prisma,
338
339
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
339
340
  onThreadMessageCompleted: ({ message }) => {
340
341
  messages.push(message);
@@ -2,9 +2,9 @@ import { PrismaClient } from '@prisma/client';
2
2
  declare const prismaClientSingleton: () => PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
3
3
  declare global {
4
4
  var prisma: undefined | ReturnType<typeof prismaClientSingleton>;
5
- var __superinterfaceServerPrisma: undefined | PrismaClient;
6
5
  }
7
6
  export declare const getPrisma: () => PrismaClient;
8
- export declare const prisma: PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
7
+ export declare const prisma: PrismaClient;
8
+ export declare const __setPrismaFactoryForTests: (factory?: () => PrismaClient) => void;
9
9
  export {};
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/prisma/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,QAAA,MAAM,qBAAqB,sIAiB1B,CAAA;AAID,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;IAChE,IAAI,4BAA4B,EAAE,SAAS,GAAG,YAAY,CAAA;CAC3D;AAED,eAAO,MAAM,SAAS,QAAO,YAgB5B,CAAA;AAED,eAAO,MAAM,MAAM,gIAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/prisma/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAW7C,QAAA,MAAM,qBAAqB,sIAqB1B,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;CACjE;AAED,eAAO,MAAM,SAAS,QAAO,YAc5B,CAAA;AAQD,eAAO,MAAM,MAAM,EAsBb,YAAY,CAAA;AAElB,eAAO,MAAM,0BAA0B,GACrC,UAAU,MAAM,YAAY,KAC3B,IASF,CAAA"}
@@ -1,6 +1,11 @@
1
1
  import { PrismaNeon } from '@prisma/adapter-neon';
2
2
  import { PrismaClient } from '@prisma/client';
3
+ const prismaGlobalKey = Symbol.for('superinterface.server.prisma');
4
+ let customPrismaFactory;
3
5
  const prismaClientSingleton = () => {
6
+ if (customPrismaFactory) {
7
+ return customPrismaFactory();
8
+ }
4
9
  const connectionString = `${process.env.DATABASE_URL}`;
5
10
  if (process.env.NODE_ENV === 'test') {
6
11
  return new PrismaClient();
@@ -15,19 +20,53 @@ const prismaClientSingleton = () => {
15
20
  },
16
21
  });
17
22
  };
18
- const globalKey = '__superinterfaceServerPrisma';
19
23
  export const getPrisma = () => {
20
24
  const globalForPrisma = globalThis;
21
- if (globalForPrisma[globalKey])
22
- return globalForPrisma[globalKey];
25
+ if (globalForPrisma[prismaGlobalKey])
26
+ return globalForPrisma[prismaGlobalKey];
23
27
  if (globalForPrisma.prisma) {
24
- globalForPrisma[globalKey] = globalForPrisma.prisma;
28
+ globalForPrisma[prismaGlobalKey] = globalForPrisma.prisma;
25
29
  return globalForPrisma.prisma;
26
30
  }
27
31
  const client = prismaClientSingleton();
28
- globalForPrisma[globalKey] = client;
32
+ globalForPrisma[prismaGlobalKey] = client;
29
33
  if (!globalForPrisma.prisma)
30
34
  globalForPrisma.prisma = client;
31
35
  return client;
32
36
  };
33
- export const prisma = getPrisma();
37
+ const getClient = () => {
38
+ return getPrisma();
39
+ };
40
+ let prismaInstance;
41
+ export const prisma = new Proxy({}, {
42
+ get(_target, prop, receiver) {
43
+ const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
44
+ const value = Reflect.get(client, prop, receiver);
45
+ return typeof value === 'function' ? value.bind(client) : value;
46
+ },
47
+ set(_target, prop, value, receiver) {
48
+ const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
49
+ return Reflect.set(client, prop, value, receiver);
50
+ },
51
+ has(_target, prop) {
52
+ const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
53
+ return Reflect.has(client, prop);
54
+ },
55
+ ownKeys() {
56
+ const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
57
+ return Reflect.ownKeys(client);
58
+ },
59
+ getOwnPropertyDescriptor(_target, prop) {
60
+ const client = prismaInstance !== null && prismaInstance !== void 0 ? prismaInstance : (prismaInstance = getClient());
61
+ return Reflect.getOwnPropertyDescriptor(client, prop);
62
+ },
63
+ });
64
+ export const __setPrismaFactoryForTests = (factory) => {
65
+ customPrismaFactory = factory;
66
+ prismaInstance = undefined;
67
+ const globalForPrisma = globalThis;
68
+ Reflect.deleteProperty(globalForPrisma, prismaGlobalKey);
69
+ if ('prisma' in globalForPrisma) {
70
+ Reflect.deleteProperty(globalForPrisma, 'prisma');
71
+ }
72
+ };
@@ -1,5 +1,6 @@
1
1
  import type OpenAI from 'openai';
2
- export declare const streamOutput: ({ toolCall, run, messageResponse, onThreadMessageCompleted, onThreadRunStepCompleted, controller, }: {
2
+ import type { PrismaClient } from '@prisma/client';
3
+ export declare const streamOutput: ({ toolCall, run, messageResponse, onThreadMessageCompleted, onThreadRunStepCompleted, controller, prisma, }: {
3
4
  toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
4
5
  run: OpenAI.Beta.Threads.Runs.Run;
5
6
  controller: ReadableStreamDefaultController;
@@ -10,5 +11,6 @@ export declare const streamOutput: ({ toolCall, run, messageResponse, onThreadMe
10
11
  onThreadRunStepCompleted?: ({ runStep }: {
11
12
  runStep: any;
12
13
  }) => void;
14
+ prisma: PrismaClient;
13
15
  }) => Promise<void>;
14
16
  //# sourceMappingURL=streamOutput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"streamOutput.d.ts","sourceRoot":"","sources":["../../../src/lib/toolCalls/streamO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AAE,OAAO,EAAE,GAAG,CAAA;KAAE,KAAK,IAAI,CAAA;IAClE,MAAM,EAAE,YAAY,CAAA;CACrB,kBAmEA,CAAA"}
@@ -7,7 +7,6 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
7
7
  };
8
8
  import { validate } from 'uuid';
9
9
  import { enqueueJson } from '@superinterface/react/utils';
10
- import { prisma } from '../../lib/prisma';
11
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
11
  const deltaContent = ({ data }) => {
13
12
  return (data.delta.content
@@ -20,7 +19,7 @@ const deltaContent = ({ data }) => {
20
19
  })
21
20
  .join('\n\n'));
22
21
  };
23
- export const streamOutput = async ({ toolCall, run, messageResponse, onThreadMessageCompleted = () => { }, onThreadRunStepCompleted = () => { }, controller, }) => {
22
+ export const streamOutput = async ({ toolCall, run, messageResponse, onThreadMessageCompleted = () => { }, onThreadRunStepCompleted = () => { }, controller, prisma, }) => {
24
23
  var _a, e_1, _b, _c;
25
24
  var _d, _e, _f;
26
25
  // TODO figure out how to stream non-prisma runs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superinterface/server",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superinterface-server": "./bin/index.cjs"
@@ -141,6 +141,7 @@
141
141
  "start": "next start",
142
142
  "prisma:migrate": "npx prisma migrate dev",
143
143
  "lint": "eslint",
144
+ "test": "node --import tsx --experimental-test-module-mocks --test \"tests/**/*.test.ts\"",
144
145
  "cli": "tsx scripts/cli.ts"
145
146
  },
146
147
  "dependencies": {