@applica-software-guru/persona-chat-sdk 0.1.108 → 0.1.113

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 (44) hide show
  1. package/dist/bundle.cjs.js +13 -13
  2. package/dist/bundle.cjs.js.map +1 -1
  3. package/dist/bundle.es.js +2029 -1998
  4. package/dist/bundle.es.js.map +1 -1
  5. package/dist/bundle.iife.js +13 -13
  6. package/dist/bundle.iife.js.map +1 -1
  7. package/dist/bundle.umd.js +14 -14
  8. package/dist/bundle.umd.js.map +1 -1
  9. package/dist/messages.d.ts.map +1 -1
  10. package/dist/protocol/base.d.ts +1 -1
  11. package/dist/protocol/base.d.ts.map +1 -1
  12. package/dist/protocol/rest.d.ts +1 -1
  13. package/dist/protocol/rest.d.ts.map +1 -1
  14. package/dist/protocol/transaction.d.ts +4 -4
  15. package/dist/protocol/transaction.d.ts.map +1 -1
  16. package/dist/runtime/context.d.ts +5 -0
  17. package/dist/runtime/context.d.ts.map +1 -1
  18. package/dist/runtime/file-attachment-adapter.d.ts +1 -1
  19. package/dist/runtime/file-attachment-adapter.d.ts.map +1 -1
  20. package/dist/runtime/threads.d.ts +2 -1
  21. package/dist/runtime/threads.d.ts.map +1 -1
  22. package/dist/runtime.d.ts +1 -1
  23. package/dist/runtime.d.ts.map +1 -1
  24. package/dist/storage/base.d.ts +1 -0
  25. package/dist/storage/base.d.ts.map +1 -1
  26. package/dist/storage/persona.d.ts +1 -0
  27. package/dist/storage/persona.d.ts.map +1 -1
  28. package/dist/tools.d.ts.map +1 -1
  29. package/dist/types.d.ts +3 -2
  30. package/dist/types.d.ts.map +1 -1
  31. package/package.json +4 -1
  32. package/src/messages.ts +22 -3
  33. package/src/protocol/base.ts +2 -1
  34. package/src/protocol/rest.ts +1 -1
  35. package/src/protocol/transaction.ts +7 -5
  36. package/src/runtime/context.ts +12 -0
  37. package/src/runtime/file-attachment-adapter.ts +2 -1
  38. package/src/runtime/protocols.ts +1 -1
  39. package/src/runtime/threads.ts +9 -0
  40. package/src/runtime.tsx +13 -1
  41. package/src/storage/base.ts +2 -0
  42. package/src/storage/persona.ts +20 -12
  43. package/src/tools.ts +9 -1
  44. package/src/types.ts +4 -2
package/src/tools.ts CHANGED
@@ -35,6 +35,7 @@ export interface ToolDefinition {
35
35
  timeout?: number;
36
36
  parameters: Record<string, ToolParameter>;
37
37
  output: Record<string, ToolParameter>;
38
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
39
  implementation: (...args: any[]) => any;
39
40
  }
40
41
 
@@ -62,7 +63,8 @@ export function createParameter(
62
63
  */
63
64
  export function generateToolSchema(definition: ToolDefinition): ToolSchema {
64
65
  const requiredParams = Object.entries(definition.parameters)
65
- .filter(([_, param]) => param.required)
66
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
67
+ .filter(([_name, param]) => param.required)
66
68
  .map(([name]) => name);
67
69
 
68
70
  return {
@@ -86,6 +88,7 @@ export function generateToolSchema(definition: ToolDefinition): ToolSchema {
86
88
  };
87
89
  }
88
90
 
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
92
  export type ToolInstance = { schema: ToolSchema; implementation: (...args: any[]) => any };
90
93
 
91
94
  /**
@@ -102,9 +105,11 @@ export function createTool(definition: ToolDefinition): ToolInstance {
102
105
  * Extract function signature and generate schema from a JavaScript function
103
106
  * This is a utility to help convert existing functions to tool schemas
104
107
  */
108
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
109
  export function createToolFromFunction(
106
110
  name: string,
107
111
  description: string,
112
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
108
113
  fn: (...args: any[]) => any,
109
114
  parameterTypes: Record<string, ToolParameter>,
110
115
  outputTypes: Record<string, ToolParameter>,
@@ -166,9 +171,11 @@ export const navigateToToolExample = createTool({
166
171
  // Helper function to create multiple tools at once
167
172
  export function createToolRegistry(tools: ToolDefinition[]): {
168
173
  schemas: ToolSchema[];
174
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
169
175
  implementations: Record<string, (...args: any[]) => any>;
170
176
  } {
171
177
  const schemas: ToolSchema[] = [];
178
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
179
  const implementations: Record<string, (...args: any[]) => any> = {};
173
180
 
174
181
  tools.forEach((tool) => {
@@ -181,6 +188,7 @@ export function createToolRegistry(tools: ToolDefinition[]): {
181
188
  }
182
189
 
183
190
  // Utility to validate tool parameters at runtime
191
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
184
192
  export function validateToolParameters(parameters: Record<string, any>, schema: ToolSchema): boolean {
185
193
  const { required, properties } = schema.config.parameters;
186
194
 
package/src/types.ts CHANGED
@@ -18,8 +18,8 @@ export type FunctionCall = {
18
18
 
19
19
  export type FunctionResponse = {
20
20
  name: string;
21
- result: unknown;
22
- function_call_id: string;
21
+ result?: ToolResultItem | ToolResultItem[] | null;
22
+ functionCallId?: string;
23
23
  };
24
24
 
25
25
  export type PersonaFile = {
@@ -85,6 +85,8 @@ export type PersonaImage = {
85
85
  contentType: string;
86
86
  };
87
87
 
88
+ export type ToolResultItem = string | PersonaFile | PersonaImage | ReadonlyJSONObject;
89
+
88
90
  export type PersonaSourceChunk = {
89
91
  start: number;
90
92
  end: number;