@squidcloud/backend 1.0.288 → 1.0.290
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,4 +1,5 @@
|
|
|
1
1
|
import { AiChatbotMutationType, AiChatbotResourceType } from '@squidcloud/client';
|
|
2
|
+
import { AiAgentId } from '@squidcloud/client';
|
|
2
3
|
/** A context provided to the security rules of an AI Chatbot mutation. */
|
|
3
4
|
export declare class AiChatbotMutationContext {
|
|
4
5
|
readonly type: AiChatbotMutationType;
|
|
@@ -6,10 +7,21 @@ export declare class AiChatbotMutationContext {
|
|
|
6
7
|
readonly profileId: string;
|
|
7
8
|
readonly payload: any;
|
|
8
9
|
}
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Context object passed as a second parameter to every AI function call,
|
|
12
|
+
* providing both agent-specific and function-specific context.
|
|
13
|
+
*/
|
|
14
|
+
export interface AiFunctionContext<AgentContextType = unknown, FunctionContextType = unknown> {
|
|
15
|
+
/** Unique identifier for the AI agent making the call. */
|
|
16
|
+
agentId?: AiAgentId;
|
|
17
|
+
/**
|
|
18
|
+
* Persistent context for the specific AI agent.
|
|
19
|
+
* Remains constant across all AI functions used by this agent.
|
|
20
|
+
*/
|
|
21
|
+
agentContext: AgentContextType;
|
|
22
|
+
/**
|
|
23
|
+
* Context specific to each individual AI function call.
|
|
24
|
+
* Can contain parameters or data unique to the current function invocation.
|
|
25
|
+
*/
|
|
26
|
+
functionContext: FunctionContextType;
|
|
15
27
|
}
|
|
@@ -9,7 +9,7 @@ import { ClientId, SquidDocId } from '@squidcloud/client';
|
|
|
9
9
|
import { TopicReadContext, TopicWriteContext } from './topic.public-context';
|
|
10
10
|
import { DistributedLockContext } from './distributed-lock.public-context';
|
|
11
11
|
import { GraphqlContext } from './graphql.public-context';
|
|
12
|
-
import { AiChatbotMutationContext } from './ai-chatbot.public-context';
|
|
12
|
+
import { AiChatbotMutationContext, AiFunctionContext } from './ai-chatbot.public-context';
|
|
13
13
|
import { StorageContext } from '@squidcloud/client';
|
|
14
14
|
import { NativeQueryContext } from './native-query.public-context';
|
|
15
15
|
import { AiChatbotChatContext } from '@squidcloud/client';
|
|
@@ -25,7 +25,7 @@ export type SecureGraphQLAction = ((context: GraphqlContext) => boolean | Promis
|
|
|
25
25
|
export type SecureAiChatbotAction<T extends AiChatbotActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'chat' ? ((context: AiChatbotChatContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: AiChatbotMutationContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
26
26
|
export type ClientConnectionStateChangeAction = (clientId: ClientId, clientConnectionState: ClientConnectionState) => Promise<void> | void;
|
|
27
27
|
export type ExecutableAction = (...args: any[]) => any;
|
|
28
|
-
export type AiFunctionAction<T extends Record<string, any> = any> = (params: T) => any;
|
|
28
|
+
export type AiFunctionAction<T extends Record<string, any> = any> = (params: T, context: AiFunctionContext) => any;
|
|
29
29
|
export type TriggerAction = ((request: TriggerRequest) => void | Promise<void>) | (() => void | Promise<void>);
|
|
30
30
|
/** The context provided to a trigger function. */
|
|
31
31
|
export interface TriggerRequest<T extends DocumentData = any> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/backend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.290",
|
|
4
4
|
"description": "Squid Cloud's backend SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/backend/src/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"graphql": "^16.9.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@squidcloud/client": "^1.0.
|
|
29
|
+
"@squidcloud/client": "^1.0.290"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=20.0.0"
|