@squidcloud/client 1.0.502 → 1.0.504
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.
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +28 -2
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +3 -3
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +30 -8
- package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +5 -0
- package/dist/internal-common/src/public-types/ai-voice.public-types.d.ts +16 -0
- package/dist/internal-common/src/public-types/context.public-types.d.ts +2 -0
- package/dist/internal-common/src/public-types/extraction.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/langgraph.public-types.d.ts +86 -0
- package/dist/internal-common/src/public-types/session.public-types.d.ts +82 -0
- package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +4 -4
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +1 -1
- package/dist/typescript-client/src/index.d.ts +1 -0
- package/dist/typescript-client/src/langgraph-client.d.ts +23 -1
- package/dist/typescript-client/src/public-types.d.ts +1 -0
- package/dist/typescript-client/src/session-client.d.ts +21 -0
- package/dist/typescript-client/src/squid.d.ts +12 -0
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/internal-common/src/ai/system-openai-compatible.d.ts +0 -35
- package/dist/internal-common/src/metric-name.d.ts +0 -5
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -30
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +0 -161
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -75
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -193
- package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -304
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +0 -798
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -19
- package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
- package/dist/internal-common/src/types/communication.types.d.ts +0 -1
- package/dist/internal-common/src/types/document.types.d.ts +0 -1
- package/dist/internal-common/src/types/file.types.d.ts +0 -6
- package/dist/internal-common/src/types/headers.types.d.ts +0 -45
- package/dist/internal-common/src/types/management-api-key.types.d.ts +0 -92
- package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
- package/dist/internal-common/src/types/notification.types.d.ts +0 -19
- package/dist/internal-common/src/types/observability.types.d.ts +0 -296
- package/dist/internal-common/src/types/query.types.d.ts +0 -21
- package/dist/internal-common/src/types/secret.types.d.ts +0 -7
- package/dist/internal-common/src/types/socket.types.d.ts +0 -1
- package/dist/internal-common/src/types/stage.d.ts +0 -9
- package/dist/internal-common/src/types/time-units.d.ts +0 -1
- package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -45
- package/dist/internal-common/src/utils/array.d.ts +0 -7
- package/dist/internal-common/src/utils/connector-path-status.d.ts +0 -27
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/file-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
- package/dist/internal-common/src/utils/http-utils.d.ts +0 -15
- package/dist/internal-common/src/utils/http.d.ts +0 -4
- package/dist/internal-common/src/utils/integration-access-tokens.d.ts +0 -15
- package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
- package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
- package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
- package/dist/internal-common/src/utils/object.d.ts +0 -93
- package/dist/internal-common/src/utils/serialization.d.ts +0 -30
- package/dist/internal-common/src/utils/squid.constants.d.ts +0 -3
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +0 -1
- package/dist/internal-common/src/utils/validation.d.ts +0 -21
- package/dist/internal-common/src/websocket.impl.d.ts +0 -26
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { MmEntity, MmMatchMaker } from '../public-types/ai-matchmaking.public-types';
|
|
2
|
-
/**
|
|
3
|
-
* Internal-only matchmaking request shapes. Every other request/response of the matchmaking wire
|
|
4
|
-
* contract is declared in `ai-matchmaking.public-types` and imported directly from there.
|
|
5
|
-
*/
|
|
6
|
-
export interface MmCreateMatchMakerRequest {
|
|
7
|
-
matchMaker: MmMatchMaker;
|
|
8
|
-
}
|
|
9
|
-
export interface MmGetMatchMakerRequest {
|
|
10
|
-
matchMakerId: string;
|
|
11
|
-
}
|
|
12
|
-
export interface MmInsertEntityRequest {
|
|
13
|
-
matchMakerId: string;
|
|
14
|
-
entity: MmEntity;
|
|
15
|
-
}
|
|
16
|
-
export interface MmGetEntityRequest {
|
|
17
|
-
matchMakerId: string;
|
|
18
|
-
entityId: string;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ChatId = string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/** HTTP header names used by Squid for request metadata. */
|
|
2
|
-
export declare const SquidHeaders: {
|
|
3
|
-
/** Correlates logs and spans across distributed calls. */
|
|
4
|
-
readonly TRACE_ID: "x-squid-traceid";
|
|
5
|
-
/** Shared secret header for internal authentication. */
|
|
6
|
-
readonly SECRET: "x-squid-secret";
|
|
7
|
-
/** API key provided by the calling application. */
|
|
8
|
-
readonly APP_API_KEY: "x-app-api-key";
|
|
9
|
-
/** Unique identifier of the client application. */
|
|
10
|
-
readonly APP_ID: "x-squid-appid";
|
|
11
|
-
/** Unique identifier of the end user or service client. */
|
|
12
|
-
readonly CLIENT_ID: "x-squid-clientid";
|
|
13
|
-
/** Version string of the Squid client library. */
|
|
14
|
-
readonly CLIENT_VERSION: "x-squid-client-version";
|
|
15
|
-
/**
|
|
16
|
-
* Access tokens the caller supplies for the request's integrations, as a JSON object keyed by
|
|
17
|
-
* integration ID. An integration type that runs with one takes it in place of its stored secret.
|
|
18
|
-
* The header stays in the cores and never reaches tenant code.
|
|
19
|
-
*/
|
|
20
|
-
readonly INTEGRATION_ACCESS_TOKENS: "x-squid-integration-access-tokens";
|
|
21
|
-
/**
|
|
22
|
-
* Response-only: IP of the tenant pod that served the request, i.e. the address to reach it at
|
|
23
|
-
* again. Core records it to route subsequent affinity-keyed calls to the same pod. Absent when the
|
|
24
|
-
* pod does not know its own IP.
|
|
25
|
-
*/
|
|
26
|
-
readonly POD_IP: "x-squid-pod-ip";
|
|
27
|
-
/**
|
|
28
|
-
* Response-only: identity of the tenant process that served the request. Distinct from
|
|
29
|
-
* {@link POD_IP}, which is an address and is reused: Kubernetes hands the IP of a deleted pod to a
|
|
30
|
-
* new one, so only this value tells core whether it is still talking to the same instance.
|
|
31
|
-
*/
|
|
32
|
-
readonly INSTANCE_ID: "x-squid-instance-id";
|
|
33
|
-
/**
|
|
34
|
-
* Request-only: the {@link INSTANCE_ID} core believes it is calling, sent when routing directly to a
|
|
35
|
-
* pinned pod instead of through the tenant service. The receiving instance refuses the request when
|
|
36
|
-
* the value is not its own — the pod at that address may have been replaced, possibly by a pod of a
|
|
37
|
-
* different application.
|
|
38
|
-
*/
|
|
39
|
-
readonly EXPECTED_INSTANCE_ID: "x-squid-expected-instance-id";
|
|
40
|
-
/**
|
|
41
|
-
* Response-only: key of the tenant worker that served the request, reported separately from
|
|
42
|
-
* {@link POD_IP} so core alone decides whether to pin at pod or at worker granularity.
|
|
43
|
-
*/
|
|
44
|
-
readonly WORKER_KEY: "x-squid-worker-key";
|
|
45
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Status lifecycle for management API keys.
|
|
3
|
-
* Keys must be suspended before they can be deleted.
|
|
4
|
-
* @category ManagementApiKey
|
|
5
|
-
*/
|
|
6
|
-
export type ManagementApiKeyStatus = 'active' | 'suspended' | 'deleted';
|
|
7
|
-
/**
|
|
8
|
-
* Prefix for all management API keys.
|
|
9
|
-
* Used to identify and validate management keys.
|
|
10
|
-
* @category ManagementApiKey
|
|
11
|
-
*/
|
|
12
|
-
export declare const MANAGEMENT_API_KEY_PREFIX = "squid_mgmt_";
|
|
13
|
-
/**
|
|
14
|
-
* Represents a user-level management API key.
|
|
15
|
-
* These keys provide programmatic access to manage organizations and applications
|
|
16
|
-
* where the user is an admin.
|
|
17
|
-
* @category ManagementApiKey
|
|
18
|
-
*/
|
|
19
|
-
export interface ManagementApiKey {
|
|
20
|
-
/** Unique identifier for the API key */
|
|
21
|
-
id: string;
|
|
22
|
-
/** The user ID who owns this key */
|
|
23
|
-
userId: string;
|
|
24
|
-
/** Optional description for the key */
|
|
25
|
-
description?: string;
|
|
26
|
-
/** Current status of the key */
|
|
27
|
-
status: ManagementApiKeyStatus;
|
|
28
|
-
/** Timestamp when the key was created */
|
|
29
|
-
createdAt: Date;
|
|
30
|
-
/** Timestamp when the key was last updated */
|
|
31
|
-
updatedAt: Date;
|
|
32
|
-
/** Timestamp when the key was last used, if ever */
|
|
33
|
-
lastUsedAt?: Date;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Request to create a new management API key.
|
|
37
|
-
* @category ManagementApiKey
|
|
38
|
-
*/
|
|
39
|
-
export interface CreateManagementApiKeyRequest {
|
|
40
|
-
/** Optional description for the key */
|
|
41
|
-
description?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Response when creating a new management API key.
|
|
45
|
-
* The keyValue is only returned once during creation.
|
|
46
|
-
* @category ManagementApiKey
|
|
47
|
-
*/
|
|
48
|
-
export interface CreateManagementApiKeyResponse {
|
|
49
|
-
/** The created key metadata */
|
|
50
|
-
key: ManagementApiKey;
|
|
51
|
-
/** The raw key value (only returned once during creation) */
|
|
52
|
-
keyValue: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Request to update a management API key's status.
|
|
56
|
-
* @category ManagementApiKey
|
|
57
|
-
*/
|
|
58
|
-
export interface UpdateManagementApiKeyRequest {
|
|
59
|
-
/** The ID of the key to update */
|
|
60
|
-
keyId: string;
|
|
61
|
-
/** New status (can only toggle between active and suspended) */
|
|
62
|
-
status: 'active' | 'suspended';
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Request to delete a management API key.
|
|
66
|
-
* The key must be suspended before deletion.
|
|
67
|
-
* @category ManagementApiKey
|
|
68
|
-
*/
|
|
69
|
-
export interface DeleteManagementApiKeyRequest {
|
|
70
|
-
/** The ID of the key to delete */
|
|
71
|
-
keyId: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Response containing a list of user's management API keys.
|
|
75
|
-
* @category ManagementApiKey
|
|
76
|
-
*/
|
|
77
|
-
export interface ListManagementApiKeysResponse {
|
|
78
|
-
/** List of management API keys (without key values) */
|
|
79
|
-
keys: ManagementApiKey[];
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Response from validating a management API key.
|
|
83
|
-
* @category ManagementApiKey
|
|
84
|
-
*/
|
|
85
|
-
export interface ValidateManagementApiKeyResponse {
|
|
86
|
-
/** Whether the key is valid and active */
|
|
87
|
-
valid: boolean;
|
|
88
|
-
/** The user ID associated with the key (if valid) */
|
|
89
|
-
userId?: string;
|
|
90
|
-
/** The key ID (if valid) */
|
|
91
|
-
keyId?: string;
|
|
92
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ClientId } from '../public-types/communication.public-types';
|
|
2
|
-
import { AiStatusMessageToClient, NotificationMessageToClient } from './socket.types';
|
|
3
|
-
export interface PublishNotificationRequest {
|
|
4
|
-
clientIds: Array<ClientId>;
|
|
5
|
-
payload: unknown;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Body of `/notification/publishSystemNotification`: the payload is a ready-made socket message.
|
|
9
|
-
*
|
|
10
|
-
* Deliberately narrower than the `MessageToClient` union: the endpoint exists to carry an AI status
|
|
11
|
-
* update from the backend SDK, or the same message its sibling `publishNotification` produces, and
|
|
12
|
-
* both are read defensively by their consumers. The protocol variants are not accepted — their
|
|
13
|
-
* handlers do structural work on the payload (the SDK's mutation dispatcher iterates it, for
|
|
14
|
-
* example), so admitting them would let a caller hand its own clients a message that throws.
|
|
15
|
-
*/
|
|
16
|
-
export interface PublishSystemNotificationRequest {
|
|
17
|
-
clientIds: Array<ClientId>;
|
|
18
|
-
payload: AiStatusMessageToClient | NotificationMessageToClient;
|
|
19
|
-
}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { MetricName } from '../metric-name';
|
|
2
|
-
import { AppId } from '../public-types/communication.public-types';
|
|
3
|
-
import { JobId } from '../public-types/job.public-types';
|
|
4
|
-
export interface ObservableNameMetrics {
|
|
5
|
-
count: MetricName;
|
|
6
|
-
time: MetricName;
|
|
7
|
-
}
|
|
8
|
-
export declare const ObservableNames: {
|
|
9
|
-
readonly nativeQuery: ObservableNameMetrics;
|
|
10
|
-
readonly registerQuery: ObservableNameMetrics;
|
|
11
|
-
readonly query: ObservableNameMetrics;
|
|
12
|
-
readonly mutate: ObservableNameMetrics;
|
|
13
|
-
readonly functionExecution: ObservableNameMetrics;
|
|
14
|
-
readonly codeInitialization: ObservableNameMetrics;
|
|
15
|
-
readonly getAiChatbotProfiles: ObservableNameMetrics;
|
|
16
|
-
readonly aiImageGeneration: ObservableNameMetrics;
|
|
17
|
-
readonly aiRemoveBackground: ObservableNameMetrics;
|
|
18
|
-
readonly aiAudioTranscribe: ObservableNameMetrics;
|
|
19
|
-
readonly aiAudioCreateSpeech: ObservableNameMetrics;
|
|
20
|
-
readonly aiVoiceCreateSession: ObservableNameMetrics;
|
|
21
|
-
readonly aiVoiceAnswerOpenAiCall: ObservableNameMetrics;
|
|
22
|
-
readonly aiVoiceStartOpenAiWebCall: ObservableNameMetrics;
|
|
23
|
-
readonly aiOpenAiChatCompletions: ObservableNameMetrics;
|
|
24
|
-
readonly discoverGraphQLConnectionSchema: ObservableNameMetrics;
|
|
25
|
-
readonly discoverOpenApiSchema: ObservableNameMetrics;
|
|
26
|
-
readonly discoverOpenApiSchemaFromFile: ObservableNameMetrics;
|
|
27
|
-
readonly graphqlQuery: ObservableNameMetrics;
|
|
28
|
-
readonly testGraphQLConnection: ObservableNameMetrics;
|
|
29
|
-
readonly testAgentProtocolConnection: ObservableNameMetrics;
|
|
30
|
-
readonly graphql: ObservableNameMetrics;
|
|
31
|
-
readonly acquireLock: ObservableNameMetrics;
|
|
32
|
-
readonly releaseLock: ObservableNameMetrics;
|
|
33
|
-
/**
|
|
34
|
-
* Timing and count for '/observability/metrics' endpoint calls used to report batch of metrics.
|
|
35
|
-
*/
|
|
36
|
-
readonly metricReport: ObservableNameMetrics;
|
|
37
|
-
/**
|
|
38
|
-
* Timing and count for '/observability/metrics/query' endpoint calls used to query metrics.
|
|
39
|
-
*/
|
|
40
|
-
readonly metricQuery: ObservableNameMetrics;
|
|
41
|
-
readonly storageUploadFile: ObservableNameMetrics;
|
|
42
|
-
readonly storageGetFileMetadata: ObservableNameMetrics;
|
|
43
|
-
readonly storageGetDownloadUrl: ObservableNameMetrics;
|
|
44
|
-
readonly storageDeleteFiles: ObservableNameMetrics;
|
|
45
|
-
readonly storageListDirectoryContents: ObservableNameMetrics;
|
|
46
|
-
readonly produceTopicMessage: ObservableNameMetrics;
|
|
47
|
-
readonly subscribeToTopic: ObservableNameMetrics;
|
|
48
|
-
readonly queueMessageHandler: ObservableNameMetrics;
|
|
49
|
-
readonly schedulerJob: ObservableNameMetrics;
|
|
50
|
-
readonly eventHandler: ObservableNameMetrics;
|
|
51
|
-
readonly webhook: ObservableNameMetrics;
|
|
52
|
-
readonly openapi: ObservableNameMetrics;
|
|
53
|
-
readonly executeBackendFunction: ObservableNameMetrics;
|
|
54
|
-
readonly apiControllerCall: ObservableNameMetrics;
|
|
55
|
-
};
|
|
56
|
-
export type ObservableName = keyof typeof ObservableNames;
|
|
57
|
-
export interface MetricEvent {
|
|
58
|
-
appId: AppId;
|
|
59
|
-
name: MetricName;
|
|
60
|
-
tags: Record<string, string>;
|
|
61
|
-
timestamp: Date;
|
|
62
|
-
value: number;
|
|
63
|
-
isExposedToUser: boolean;
|
|
64
|
-
}
|
|
65
|
-
export interface LogEvent {
|
|
66
|
-
message: string;
|
|
67
|
-
level: string;
|
|
68
|
-
tags: Record<string, string>;
|
|
69
|
-
timestamp: Date;
|
|
70
|
-
isExposedToUser: boolean;
|
|
71
|
-
host: string;
|
|
72
|
-
source?: string;
|
|
73
|
-
service?: string;
|
|
74
|
-
}
|
|
75
|
-
export declare const AUDIT_LOG_EVENT_NAMES: readonly ["ai_agent"];
|
|
76
|
-
export type AuditLogEventName = (typeof AUDIT_LOG_EVENT_NAMES)[number];
|
|
77
|
-
export interface AuditLogEvent {
|
|
78
|
-
appId: AppId;
|
|
79
|
-
name: AuditLogEventName;
|
|
80
|
-
timestamp: Date;
|
|
81
|
-
context: {
|
|
82
|
-
clientId?: string;
|
|
83
|
-
userId: string;
|
|
84
|
-
};
|
|
85
|
-
tags: Record<string, string>;
|
|
86
|
-
}
|
|
87
|
-
/** Agent audit log entry - one per agent invocation */
|
|
88
|
-
export interface AgentAuditLogEvent {
|
|
89
|
-
appId: AppId;
|
|
90
|
-
/** Agent ID (nullable for query-with-AI operations without an agent) */
|
|
91
|
-
agentId?: string;
|
|
92
|
-
jobId: string;
|
|
93
|
-
prompt: string;
|
|
94
|
-
/** Fully assembled system instructions sent to the LLM; set only when the agent enables auditLogFullContext. */
|
|
95
|
-
systemInstructions?: string;
|
|
96
|
-
tags: Record<string, string>;
|
|
97
|
-
createdAt: Date;
|
|
98
|
-
/** Integration ID for query-with-AI operations (nullable, used when not invoked via agent) */
|
|
99
|
-
integrationId?: string;
|
|
100
|
-
}
|
|
101
|
-
export type AgentAuditLogUpdateType = 'statusUpdate' | 'response';
|
|
102
|
-
/** Usage metric for AI model input/output — either token count or character count depending on provider. */
|
|
103
|
-
export interface AiUsageMetric {
|
|
104
|
-
unit: 'tokens' | 'characters';
|
|
105
|
-
value: number;
|
|
106
|
-
}
|
|
107
|
-
/** Agent audit log update entry - status updates and responses for agent invocations */
|
|
108
|
-
export interface AgentAuditLogUpdateEvent {
|
|
109
|
-
appId: AppId;
|
|
110
|
-
/** Agent ID (nullable for query-with-AI operations without an agent) */
|
|
111
|
-
agentId?: string;
|
|
112
|
-
jobId: string;
|
|
113
|
-
statusUpdateId: string;
|
|
114
|
-
title: string;
|
|
115
|
-
parentStatusUpdateId?: string;
|
|
116
|
-
tags: Record<string, string>;
|
|
117
|
-
body: string;
|
|
118
|
-
type: AgentAuditLogUpdateType;
|
|
119
|
-
createdAt: Date;
|
|
120
|
-
/** Integration ID for query-with-AI operations (nullable, used when not invoked via agent) */
|
|
121
|
-
integrationId?: string;
|
|
122
|
-
/** Input usage metric (tokens or characters depending on provider). */
|
|
123
|
-
inputUsage?: AiUsageMetric;
|
|
124
|
-
/** Output usage metric (tokens or characters depending on provider). */
|
|
125
|
-
outputUsage?: AiUsageMetric;
|
|
126
|
-
/** Reasoning tokens consumed (where the provider reports them separately from output tokens). */
|
|
127
|
-
reasoningTokens?: number;
|
|
128
|
-
/** Number of input tokens served from the provider's prompt cache (read hits). */
|
|
129
|
-
cacheReadInputTokens?: number;
|
|
130
|
-
/** Number of input tokens written into the provider's prompt cache (cache misses that created new entries). */
|
|
131
|
-
cacheWriteInputTokens?: number;
|
|
132
|
-
}
|
|
133
|
-
/** The lane a knowledge-base search arrived through, recorded on its audit entry. */
|
|
134
|
-
export declare const KB_SEARCH_AUDIT_SOURCES: readonly ["sdk", "agent-context", "agent-tool", "internal", "context-search"];
|
|
135
|
-
/** One of {@link KB_SEARCH_AUDIT_SOURCES}. */
|
|
136
|
-
export type KbSearchAuditSource = (typeof KB_SEARCH_AUDIT_SOURCES)[number];
|
|
137
|
-
/**
|
|
138
|
-
* Maximum UTF-8 bytes of any free-text audit payload (agent instructions, retrieved content, tool
|
|
139
|
-
* results, KB query text). Keeps the entry under Kafka's ~1MB message limit with headroom for the rest
|
|
140
|
-
* of the event and JSON escaping.
|
|
141
|
-
*/
|
|
142
|
-
export declare const MAX_AUDIT_TEXT_BYTES = 500000;
|
|
143
|
-
/** Truncates a free-text audit payload to {@link MAX_AUDIT_TEXT_BYTES}, marking the cut. */
|
|
144
|
-
export declare function truncateAuditText(text: string): string;
|
|
145
|
-
/**
|
|
146
|
-
* Maximum scopes / contextIds kept on a KB search audit entry. When exceeded, the list is cut and
|
|
147
|
-
* `__truncated` is appended as the final element — the `__` prefix is Squid's reserved scope
|
|
148
|
-
* namespace, so the sentinel can never collide with a real scope or context id from a resolver.
|
|
149
|
-
*/
|
|
150
|
-
export declare const MAX_KB_AUDIT_LIST_ENTRIES = 1000;
|
|
151
|
-
/** Final element of a capped scopes/contextIds list on a KB search audit entry. */
|
|
152
|
-
export declare const KB_AUDIT_TRUNCATED_SENTINEL = "__truncated";
|
|
153
|
-
/** Caps an audited scopes/contextIds list, appending the sentinel when entries were dropped. */
|
|
154
|
-
export declare function capKbAuditList(values: ReadonlyArray<string>): Array<string>;
|
|
155
|
-
/**
|
|
156
|
-
* KB retrieval audit entry — one per search of an access-enforced knowledge base, across every
|
|
157
|
-
* search lane. Records what the caller asked, the access scopes they held, and which contexts
|
|
158
|
-
* (documents) the search returned. Only searches on a knowledge base with
|
|
159
|
-
* `accessControl.mode: 'enforced'` produce entries.
|
|
160
|
-
*/
|
|
161
|
-
export interface KbSearchAuditLogEvent {
|
|
162
|
-
appId: AppId;
|
|
163
|
-
knowledgeBaseId: string;
|
|
164
|
-
/** The search lane the query arrived through. */
|
|
165
|
-
source: KbSearchAuditSource;
|
|
166
|
-
/** The agent the search ran for; absent outside agent jobs. */
|
|
167
|
-
agentId?: string;
|
|
168
|
-
/** The agent job the search ran in; absent outside agent jobs. */
|
|
169
|
-
jobId?: JobId;
|
|
170
|
-
/** The query text, truncated to {@link MAX_AUDIT_TEXT_BYTES}. */
|
|
171
|
-
prompt: string;
|
|
172
|
-
/** Effective retrieval mode (`hybrid` | `vector` | `keyword`; `graph` is refused under enforcement). */
|
|
173
|
-
searchMode: string;
|
|
174
|
-
/** Access scopes the caller held for this search (the resolver's output), capped. */
|
|
175
|
-
scopes: Array<string>;
|
|
176
|
-
/** Unique context ids of the documents returned to the caller, capped. */
|
|
177
|
-
contextIds: Array<string>;
|
|
178
|
-
/** Number of chunks returned (post-limit). */
|
|
179
|
-
chunkCount: number;
|
|
180
|
-
durationMs: number;
|
|
181
|
-
/** Identity tags of the caller: {@link AUDIT_TAG_USER_ID} / auth type / client id / source IP. */
|
|
182
|
-
tags: Record<string, string>;
|
|
183
|
-
createdAt: Date;
|
|
184
|
-
}
|
|
185
|
-
/** Tag for metric events. Value: '0' - not an error, '1' - is an error. */
|
|
186
|
-
export declare const O11Y_TAG_IS_ERROR = "isError";
|
|
187
|
-
/** Tag naming the organization an application belongs to. */
|
|
188
|
-
export declare const O11Y_TAG_ORG_ID = "organizationId";
|
|
189
|
-
/** Tag for log events. Metrics have an explicit appId field. */
|
|
190
|
-
export declare const O11Y_TAG_APP_ID = "appId";
|
|
191
|
-
/** Tag for metric and log events. */
|
|
192
|
-
export declare const O11Y_TAG_INTEGRATION_ID = "integrationId";
|
|
193
|
-
/** The integration's own type, which per-type metrics are grouped by. */
|
|
194
|
-
export declare const O11Y_TAG_INTEGRATION_TYPE = "integrationType";
|
|
195
|
-
/** Whether the query also registered a subscription for its result. */
|
|
196
|
-
export declare const O11Y_TAG_SUBSCRIBE = "subscribe";
|
|
197
|
-
/** Tag for AI events. */
|
|
198
|
-
export declare const O11Y_TAG_AI_MODEL = "aiModel";
|
|
199
|
-
export declare const O11Y_TAG_AI_PROFILE = "aiProfile";
|
|
200
|
-
/** Tag for AI KnowledgeBase events */
|
|
201
|
-
export declare const O11Y_TAG_AI_KNOWLEDGE_BASE_MODEL = "aiKnowledgeBaseModel";
|
|
202
|
-
export declare const O11Y_TAG_API_KEY_SOURCE = "apiKeySource";
|
|
203
|
-
/**
|
|
204
|
-
* Whose provider key paid for a call: Squid's own key from Vault, or one the application configured
|
|
205
|
-
* for itself. The axis the AI spend report is built around — left undefined by a caller that cannot
|
|
206
|
-
* tell, never guessed.
|
|
207
|
-
*/
|
|
208
|
-
export type AiApiKeySource = 'system' | 'user';
|
|
209
|
-
export declare const O11Y_TAG_AI_JOB_ID = "aiJobId";
|
|
210
|
-
/**
|
|
211
|
-
* Tags for the AI spend ledger (`squid_aiSpend*`). `operation` is the entry path that spent the
|
|
212
|
-
* money (the fixed AiOperation enum), `provider` names who bills for it, and `billingTier` the rate
|
|
213
|
-
* it was charged at — the last of these is an input to the cost calculation, not just a breakdown,
|
|
214
|
-
* since a discounted lane bills at a fraction of the standard list price.
|
|
215
|
-
*/
|
|
216
|
-
export declare const O11Y_TAG_AI_OPERATION = "operation";
|
|
217
|
-
export declare const O11Y_TAG_AI_PROVIDER = "provider";
|
|
218
|
-
export declare const O11Y_TAG_AI_BILLING_TIER = "billingTier";
|
|
219
|
-
/**
|
|
220
|
-
* Which population the spend came from: a customer's production app, its dev environment, a
|
|
221
|
-
* developer's sandbox, or a test run. The ledger's own `appId` cannot answer this — it keeps the
|
|
222
|
-
* environment suffix but drops the developer id, so a sandbox and a dev environment arrive under
|
|
223
|
-
* the same app.
|
|
224
|
-
*/
|
|
225
|
-
export declare const O11Y_TAG_AI_TRAFFIC_KIND = "trafficKind";
|
|
226
|
-
/**
|
|
227
|
-
* Which stage of a multi-stage lane spent the money, and which pass of its loop produced the call.
|
|
228
|
-
* Set by the query lanes, whose stages re-send the results gathered so far: without them one
|
|
229
|
-
* operation's bill cannot be attributed to the stage that carries the tokens. `iteration` is set
|
|
230
|
-
* only by a lane that loops.
|
|
231
|
-
*/
|
|
232
|
-
export declare const O11Y_TAG_AI_SPEND_STAGE = "stage";
|
|
233
|
-
export declare const O11Y_TAG_AI_SPEND_ITERATION = "iteration";
|
|
234
|
-
/** The stages one `query_api` run reports under {@link O11Y_TAG_AI_SPEND_STAGE}. */
|
|
235
|
-
export type AiQueryApiSpendStage = 'endpoint_select' | 'body_create' | 'response_analyze' | 'explanation';
|
|
236
|
-
/** The stages one `query_data` run reports under {@link O11Y_TAG_AI_SPEND_STAGE}. */
|
|
237
|
-
export type AiQueryDataSpendStage = 'select_tables' | 'generate_query' | 'regenerate_queries' | 'clarification' | 'validate_queries' | 'interpreter_check' | 'interpreter_run' | 'results_analysis' | 'raw_result_purpose' | 'readonly_check' | 'spreadsheet_action';
|
|
238
|
-
/**
|
|
239
|
-
* Every stage value the ledger accepts. Enumerated rather than left free-form because the report
|
|
240
|
-
* groups by it: a typo would open a second bucket silently instead of failing to compile.
|
|
241
|
-
*/
|
|
242
|
-
export type AiSpendStage = AiQueryApiSpendStage | AiQueryDataSpendStage;
|
|
243
|
-
/**
|
|
244
|
-
* Whether a billed page reached the document it was extracted for. Page-billed spend only: the
|
|
245
|
-
* provider charges for a stale attempt too, so the pages are recorded either way and this separates
|
|
246
|
-
* what was paid for from what was used.
|
|
247
|
-
*/
|
|
248
|
-
export declare const O11Y_TAG_AI_PAGES_APPLIED = "pagesApplied";
|
|
249
|
-
/** Tag prefix for client-provided metric annotations (see BaseAiChatOptions.metricAnnotations). */
|
|
250
|
-
export declare const O11Y_TAG_METRIC_ANNOTATION_PREFIX = "annotation.";
|
|
251
|
-
/** Maximum number of AI usage annotation entries kept per call; extra entries are dropped. */
|
|
252
|
-
export declare const MAX_METRIC_ANNOTATIONS = 10;
|
|
253
|
-
/** Maximum length of an AI usage annotation key; longer keys are dropped. */
|
|
254
|
-
export declare const MAX_METRIC_ANNOTATION_KEY_LENGTH = 64;
|
|
255
|
-
/** Maximum length of an AI usage annotation value; longer values are truncated. */
|
|
256
|
-
export declare const MAX_METRIC_ANNOTATION_VALUE_LENGTH = 256;
|
|
257
|
-
/**
|
|
258
|
-
* Sanitizes client-provided metric annotations: caps the number of entries, drops empty or
|
|
259
|
-
* oversized keys, and truncates oversized values. Returns undefined when nothing valid remains.
|
|
260
|
-
*/
|
|
261
|
-
export declare function sanitizeMetricAnnotations(annotations: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
262
|
-
/** Tag for metric and log events. Value: '0' - not a tenant originated, '1' - is a tenant originated. */
|
|
263
|
-
export declare const O11Y_TAG_IS_TENANT_ORIGINATED = "isTenantOriginated";
|
|
264
|
-
/** Contains a full (with a service name) function name for backend functions. */
|
|
265
|
-
export declare const O11Y_TAG_FUNCTION_NAME = "functionName";
|
|
266
|
-
/** Contains a type of the function name for backend functions (See ExecuteFunctionAnnotationType.). */
|
|
267
|
-
export declare const O11Y_TAG_FUNCTION_TYPE = "functionType";
|
|
268
|
-
/** Tag for the trace ID. Used in logs. */
|
|
269
|
-
export declare const O11Y_TAG_TRACE_ID = "trace_id";
|
|
270
|
-
/** Tag for the span ID. Used in logs. */
|
|
271
|
-
export declare const O11Y_TAG_SPAN_ID = "span_id";
|
|
272
|
-
/**
|
|
273
|
-
* Tag carrying Squid's own correlation id (the `n_`/`c_` short id minted by
|
|
274
|
-
* `generateTraceId`). Distinct from `trace_id`/`span_id`, which hold the W3C ids from OTel.
|
|
275
|
-
* Rides W3C baggage under the same key on internal hops; attached to spans and logs.
|
|
276
|
-
*/
|
|
277
|
-
export declare const O11Y_TAG_SQUID_TRACE_ID = "squid_tid";
|
|
278
|
-
/** How the caller of an audited agent action authenticated; `anonymous` is an unauthenticated request. */
|
|
279
|
-
export type AuditLogAuthType = 'bearer' | 'apiKey' | 'agentApiKey' | 'internal' | 'anonymous';
|
|
280
|
-
/**
|
|
281
|
-
* Agent audit log tag: subject of the caller's bearer token (the application's end user); absent for API-key,
|
|
282
|
-
* agent-key, internal and anonymous callers.
|
|
283
|
-
*/
|
|
284
|
-
export declare const AUDIT_TAG_USER_ID = "userId";
|
|
285
|
-
/** Agent audit log tag: {@link AuditLogAuthType} of the caller. */
|
|
286
|
-
export declare const AUDIT_TAG_AUTH_TYPE = "authType";
|
|
287
|
-
/** Agent audit log tag: id of the Squid client that initiated the request. */
|
|
288
|
-
export declare const AUDIT_TAG_CLIENT_ID = "clientId";
|
|
289
|
-
/**
|
|
290
|
-
* Agent audit log tag: IP address the request originated from. Persisted per prompt in the audit log, so it
|
|
291
|
-
* is subject to the same retention as the prompts themselves.
|
|
292
|
-
*/
|
|
293
|
-
export declare const AUDIT_TAG_SOURCE_IP = "sourceIp";
|
|
294
|
-
export declare function getBooleanMetricTagValue(value: boolean): string;
|
|
295
|
-
export declare const COUNT_METRIC_SUFFIXES: string[];
|
|
296
|
-
export declare const GAUGE_METRIC_SUFFIXES: string[];
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Condition, DocIdCondition, SimpleCondition } from '../public-types/query.public-types';
|
|
2
|
-
/**
|
|
3
|
-
* Whether a LIKE pattern has a backslash before anything but `%`, `_` or another backslash, which is not
|
|
4
|
-
* a valid escape. Executors disagree on what it matches: PostgreSQL reads `\d` as `d`, while Mongo and
|
|
5
|
-
* the local matcher pass it to a regex as a digit.
|
|
6
|
-
*/
|
|
7
|
-
export declare function hasInvalidLikeEscape(pattern: string): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Generates the regex pattern, handling special characters as follows:
|
|
10
|
-
* - `_` is replaced with a `.`
|
|
11
|
-
* - `%` is replaced with `[\s\S]*`.
|
|
12
|
-
* - The above characters can be escaped with \, eg. `\_` is replaced with `_` and `\%` with `%`.
|
|
13
|
-
* - All special characters in regex (-, /, \, ^, $, *, +, ?, ., (, ), |, [, ], {, }) get escaped with \
|
|
14
|
-
*
|
|
15
|
-
* Exported for testing purposes.
|
|
16
|
-
* */
|
|
17
|
-
export declare function replaceSpecialCharacters(input: string): string;
|
|
18
|
-
/** Returns true if the condition is a 'SimpleCondition' or false otherwise. */
|
|
19
|
-
export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
|
|
20
|
-
/** Returns true if the condition is a 'DocIdCondition' or false otherwise. */
|
|
21
|
-
export declare function isDocIdCondition(condition: Condition): condition is DocIdCondition;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ApiKeyEntry } from '../public-types/secret.public-types';
|
|
2
|
-
export declare const BACKEND_API_KEY = "_BACKEND_API_KEY";
|
|
3
|
-
export declare const APP_API_KEY = "APP_API_KEY";
|
|
4
|
-
export declare const AGENT_API_HEADER = "x-squid-agent-api-key";
|
|
5
|
-
export interface AgentSecrets {
|
|
6
|
-
apiKey: ApiKeyEntry | undefined;
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SOCKET_RECONNECT_TIMEOUT: number;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stage of the Squid deployment:
|
|
3
|
-
* - 'local' - Squid is run locally.
|
|
4
|
-
* - 'prod' - Production environment (https://console.getsquid.ai).
|
|
5
|
-
* - 'sandbox' - One of the sandbox environments (https://console.sandbox.getsquid.ai).
|
|
6
|
-
* - 'staging' - One of the staging environments (https://console.staging.getsquid.ai).
|
|
7
|
-
*/
|
|
8
|
-
export declare const STAGES: readonly ["local", "prod", "sandbox", "staging"];
|
|
9
|
-
export type Stage = (typeof STAGES)[number];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { AppId } from '../public-types/communication.public-types';
|
|
2
|
-
/**
|
|
3
|
-
* Request to create a shortened URL.
|
|
4
|
-
*/
|
|
5
|
-
export interface ShortUrlRequest {
|
|
6
|
-
/** The URL to shorten. It must be a valid URL and should include the protocol (start with http:// or https://). */
|
|
7
|
-
url: string;
|
|
8
|
-
/** The application ID that will own this shortened URL. */
|
|
9
|
-
appId: AppId;
|
|
10
|
-
/** Seconds to live for the shortened URL. If set to 0, the URL will never expire. Defaults to 1 day. */
|
|
11
|
-
secondsToLive?: number;
|
|
12
|
-
/** Optional file extension to include in the shortened URL ID (e.g., 'pdf', 'html'). The extension becomes part of the ID, so 'abc123.pdf' and 'abc123.jpg' are distinct URLs. */
|
|
13
|
-
fileExtension?: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Request to create shortened URLs.
|
|
17
|
-
*/
|
|
18
|
-
export interface ShortUrlBulkRequest {
|
|
19
|
-
/** The URLs to shorten. They must be valid URLs and should include the protocol (start with http:// or https://). */
|
|
20
|
-
urls: string[];
|
|
21
|
-
/** The application ID that will own these shortened URLs. */
|
|
22
|
-
appId: AppId;
|
|
23
|
-
/** Seconds to live for all shortened URLs. If set to 0, the URLs will never expire. Defaults to 1 day. */
|
|
24
|
-
secondsToLive?: number;
|
|
25
|
-
/** Optional file extension to include in all shortened URL IDs (e.g., 'pdf', 'html'). The extension becomes part of each ID, so 'abc123.pdf' and 'abc123.jpg' are distinct URLs. */
|
|
26
|
-
fileExtension?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Request to delete a shortened URL.
|
|
30
|
-
*/
|
|
31
|
-
export interface ShortUrlDeleteRequest {
|
|
32
|
-
/** The ID of the shortened URL to delete. */
|
|
33
|
-
id: string;
|
|
34
|
-
/** The application ID that owns the shortened URL. */
|
|
35
|
-
appId: AppId;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Request to delete a shortened URL.
|
|
39
|
-
*/
|
|
40
|
-
export interface ShortUrlBulkDeleteRequest {
|
|
41
|
-
/** The IDs of the shortened URLs to delete. */
|
|
42
|
-
ids: string[];
|
|
43
|
-
/** The application ID that owns the shortened URLs. */
|
|
44
|
-
appId: AppId;
|
|
45
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare function truncateOrPadArray(arr: number[], length: number): number[];
|
|
2
|
-
/**
|
|
3
|
-
* Computes a single “recommended” chunk size so that if you loop
|
|
4
|
-
* `for (let i = 0; i < length; i += chunkSize)`,
|
|
5
|
-
* no slice will exceed `maxChunkSize` and all chunk sizes are 'almost' equal.
|
|
6
|
-
*/
|
|
7
|
-
export declare function computeRecommendedChunkSize(length: number, maxChunkSize: number): number;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The registry of connectors that support path-status search, plus the shared dispatch logic that
|
|
3
|
-
* calls the right one by integration type. `ExecuteFunctionLike` duck-types the subset of
|
|
4
|
-
* `@squidcloud/client`'s `Squid` this needs; see `SquidServiceLike` in `./squid-service.utils` for
|
|
5
|
-
* the same pattern.
|
|
6
|
-
*/
|
|
7
|
-
import { IntegrationId } from '../public-types/communication.public-types';
|
|
8
|
-
import { ConnectorPathStatusResult } from '../public-types/connector.public-types';
|
|
9
|
-
import { IntegrationType } from '../public-types/integration.public-types';
|
|
10
|
-
/** How to call one connector's `get<X>PathStatus` executable: its name and its calling convention. */
|
|
11
|
-
export interface PathStatusExecutable {
|
|
12
|
-
functionName: string;
|
|
13
|
-
buildArgs: (integrationId: IntegrationId, path: string) => Array<unknown>;
|
|
14
|
-
}
|
|
15
|
-
/** Absent for a type ⇒ that connector doesn't track file/folder hierarchy beyond the KB ledger. */
|
|
16
|
-
export declare const PATH_STATUS_EXECUTABLE_BY_TYPE: Partial<Record<IntegrationType, PathStatusExecutable>>;
|
|
17
|
-
/** The subset of `Squid` (`@squidcloud/client`) this dispatch needs. */
|
|
18
|
-
export interface ExecuteFunctionLike {
|
|
19
|
-
executeFunction<T>(functionName: string, ...args: Array<unknown>): Promise<T>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Searches a connector's own record of files/folders at a path, for connectors registered in
|
|
23
|
-
* {@link PATH_STATUS_EXECUTABLE_BY_TYPE}. Returns `{ supported: false }` when `integrationType` isn't
|
|
24
|
-
* registered — most integration types don't support this, and that's not an error. The caller (e.g.
|
|
25
|
-
* `IntegrationClient.getPathStatus`) already has the integration, so this doesn't re-fetch it.
|
|
26
|
-
*/
|
|
27
|
-
export declare function getConnectorPathStatus(executor: ExecuteFunctionLike, integrationType: IntegrationType, integrationId: IntegrationId, path: string): Promise<ConnectorPathStatusResult>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ObjectAssertion } from 'assertic';
|
|
2
|
-
import { HttpStatusCode } from '../public-types/http-status.public-types';
|
|
3
|
-
export type HttpQueryParams = Record<string, string | number | boolean>;
|
|
4
|
-
/**
|
|
5
|
-
* Asserts that a value is truthy. Throws a {@link ValidationError} with the given HTTP status code if it is not.
|
|
6
|
-
* Narrows the type of `value` to exclude `null`, `undefined`, `false`, `0`, and `''`.
|
|
7
|
-
*/
|
|
8
|
-
export declare function assertHttp<T>(value: T, message: string, status: HttpStatusCode): asserts value is NonNullable<T> & (T extends false | 0 | '' ? never : T);
|
|
9
|
-
/**
|
|
10
|
-
* Asserts that an object matches the given ObjectAssertion.
|
|
11
|
-
* Re-throws any non-ValidationError as BAD_REQUEST.
|
|
12
|
-
*/
|
|
13
|
-
export declare function assertHttpInput<T>(value: T, assertion: ObjectAssertion<T>): asserts value is T;
|
|
14
|
-
/** Builds a query string from the record of key-value pairs. */
|
|
15
|
-
export declare function buildHttpQueryString(queryParams: HttpQueryParams): string;
|