@squidcloud/twilio-client 1.0.503 → 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.
@@ -7,6 +7,7 @@ import { DocumentExtractionMethod } from './extraction.public-types';
7
7
  import { IntegrationType } from './integration.public-types';
8
8
  import { JobId } from './job.public-types';
9
9
  import { SecretKey } from './secret.public-types';
10
+ import { UpsertSessionRequest } from './session.public-types';
10
11
  /**
11
12
  * @category AI
12
13
  */
@@ -653,6 +654,9 @@ export interface BaseAiChatOptions {
653
654
  * conversation, not only the one that fell back — tuning meant for one model is not evidence of
654
655
  * what another should use.
655
656
  *
657
+ * A turn the primary's safety classifier declines outright — no text at all came back — falls
658
+ * back the same way, since another model may well answer the same prompt.
659
+ *
656
660
  * Applies to models served through Squid's own provider SDKs — the vendor models and
657
661
  * `openai_compatible`, Bedrock and Vertex integrations. A model you serve yourself from backend
658
662
  * code reports its failures as plain errors that carry no provider status, so a turn on one is
@@ -863,6 +867,19 @@ export interface AiChatRequestCredentials {
863
867
  */
864
868
  integrationAccessTokens?: Record<IntegrationId, string>;
865
869
  }
870
+ /**
871
+ * The session (`squid.sessions()`) a chat request runs in. It is part of the request only: never stored with the agent.
872
+ * @category AI
873
+ */
874
+ export interface AiChatRequestSession {
875
+ /**
876
+ * Every AI function the request calls gets the session as `context.session`. With the app API key, the request
877
+ * creates the session or updates the one with the same id. Without it, a new id creates the session with its data
878
+ * and a live one is attached as it is; the agent's `@secureAiAgent` rules see both and can refuse them. A call that
879
+ * skips the rules, to a public agent or with the agent's API key, cannot attach one.
880
+ */
881
+ session?: UpsertSessionRequest;
882
+ }
866
883
  /**
867
884
  * Configuration for exposing an AI agent as an MCP server at `/mcp/<agentId>`.
868
885
  * @category AI
@@ -1279,6 +1296,14 @@ export type BaseAiContextOptions = {
1279
1296
  ragType?: AiRagType;
1280
1297
  /** Amount of chunk overlap, in characters. */
1281
1298
  chunkOverlap?: number;
1299
+ /**
1300
+ * Contextual RAG only. On a re-upsert, a chunk whose text is unchanged keeps its stored blurb and
1301
+ * embedding, and only chunks with new text are sent to the LLM; with GraphRAG it also keeps its graph
1302
+ * entities and is not extracted again. A chunk that carries an image is always written anew. A reused blurb
1303
+ * was written against the previous version of the document; set false when an edit can change the meaning
1304
+ * of text elsewhere in it. Defaults to true.
1305
+ */
1306
+ reuseChunkContext?: boolean;
1282
1307
  };
1283
1308
  /**
1284
1309
  * @category AI
@@ -1331,8 +1356,9 @@ export type AiPiiOptions = {
1331
1356
  /** App-specific PII in plain language, e.g. `'internal case numbers like CASE-12345'`. */
1332
1357
  customRules?: Array<string>;
1333
1358
  /**
1334
- * Model performing the screening. Defaults to {@link DEFAULT_PII_CLASSIFIER_MODEL}. Each attempt is
1335
- * bounded at a minute, so an override has to answer within it.
1359
+ * Model performing the screening. Defaults to {@link DEFAULT_PII_CLASSIFIER_MODEL}, or the app's best
1360
+ * available model when that one is unavailable. Each attempt is bounded at a minute, so an override has
1361
+ * to answer within it.
1336
1362
  */
1337
1363
  classifierModel?: AiChatModelSelection;
1338
1364
  /** Literal values that never count as PII, e.g. a shared support address. */
@@ -51,7 +51,7 @@ export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-
51
51
  * Public Gemini chat model names (active models only).
52
52
  * @category AI
53
53
  */
54
- export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemini-3.8-flash", "gemini-3.5-flash-lite"];
54
+ export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-4-argon", "gemini-3.8-flash", "gemini-3.5-flash-lite"];
55
55
  /**
56
56
  * Public Grok chat model names (active models only).
57
57
  * @category AI
@@ -61,12 +61,12 @@ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.6", "grok-4-1-fast
61
61
  * Public Anthropic chat model names (active models only).
62
62
  * @category AI
63
63
  */
64
- export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5-5"];
64
+ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-fable-5", "claude-fable-5-1", "claude-haiku-5-5", "claude-opus-5-5", "claude-sonnet-5-5"];
65
65
  /**
66
66
  * The supported AI model names.
67
67
  * @category AI
68
68
  */
69
- export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "gpt-6-luna", "gpt-6.1-sol", "claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5-5", "gemini-3.1-pro", "gemini-3.8-flash", "gemini-3.5-flash-lite", "grok-4.6", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
69
+ export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "gpt-6-luna", "gpt-6.1-sol", "claude-fable-5", "claude-fable-5-1", "claude-haiku-5-5", "claude-opus-5-5", "claude-sonnet-5-5", "gemini-4-argon", "gemini-3.8-flash", "gemini-3.5-flash-lite", "grok-4.6", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
70
70
  /** Checks if the given model name is a global AI chat model name. */
71
71
  export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
72
72
  /**
@@ -220,6 +220,13 @@ export interface AiKnowledgeBaseGraphConfig {
220
220
  extractionModel?: AiChatModelSelection;
221
221
  /** Optional domain taxonomy hint (entity types) injected into the extraction prompt. */
222
222
  entityTypes?: string[];
223
+ /**
224
+ * How hard per-chunk extraction works. `'thorough'` allows about 40 entities per chunk instead of 15 and runs
225
+ * at high reasoning effort on OpenAI extraction models: more entities and relationships, a bigger graph (a
226
+ * listing yields ~40 entities per chunk) and about 1.5x the extraction cost. Like `extractionModel`, a change
227
+ * reaches already-indexed content on the next `full` rebuild. Defaults to `'standard'`.
228
+ */
229
+ extractionDepth?: 'standard' | 'thorough';
223
230
  /**
224
231
  * Quiet window (milliseconds) after the last graph activity before the sweep auto-builds the
225
232
  * structure. Must be a positive integer, and is floored at 3 seconds — a shorter window is not
@@ -528,6 +535,11 @@ export interface AiKnowledgeBaseContext {
528
535
  * carry none; their reupsert takes the defaults.
529
536
  */
530
537
  requestConfig?: AiKnowledgeBaseContextRequestConfig;
538
+ /**
539
+ * Set on an attachment of a OneNote section or email that the knowledge base indexed as its own context: the
540
+ * id of that container. Such contexts are managed with their container and left out of context listings.
541
+ */
542
+ parentContextId?: string;
531
543
  }
532
544
  /**
533
545
  * The ingestion request's options only. Everything else a reupsert needs lives on the context itself —
@@ -709,6 +721,14 @@ export type BaseAiKnowledgeBaseContextOptions = {
709
721
  ragType?: AiRagType;
710
722
  /** Amount of chunk overlap, in characters. */
711
723
  chunkOverlap?: number;
724
+ /**
725
+ * Contextual RAG only. On a re-upsert, a chunk whose text is unchanged keeps its stored blurb and
726
+ * embedding, and only chunks with new text are sent to the LLM; with GraphRAG it also keeps its graph
727
+ * entities and is not extracted again. A chunk that carries an image is always written anew. A reused blurb
728
+ * was written against the previous version of the document; set false when an edit can change the meaning
729
+ * of text elsewhere in it. Defaults to true.
730
+ */
731
+ reuseChunkContext?: boolean;
712
732
  };
713
733
  /**
714
734
  * Specific options for the AI knowledgebase search method.
@@ -795,9 +815,10 @@ export interface UpsertKnowledgeBaseContextResponse {
795
815
  /** List of the upsert status of each item sent in the request. */
796
816
  failure?: UpsertContextStatusError;
797
817
  /**
798
- * Set when the context was stored (and is fully searchable via vector/keyword) but NOT graph-indexed
799
- * because the knowledge base is over its per-KB graph chunk cap. Only GraphRAG coverage is absent; the
800
- * singular counterpart of {@link UpsertKnowledgeBaseContextsResponse.graphIndexingSkippedContextIds}.
818
+ * Set when the context was stored (and is fully searchable via vector/keyword) but NOT graph-indexed by
819
+ * this upsert: the knowledge base is over its per-KB graph chunk cap, or its stale graph data could not be
820
+ * pruned, which a later graph rebuild repairs. Only GraphRAG coverage is absent; the singular counterpart
821
+ * of {@link UpsertKnowledgeBaseContextsResponse.graphIndexingSkippedContextIds}.
801
822
  */
802
823
  graphIndexingSkipped?: boolean;
803
824
  /**
@@ -838,9 +859,10 @@ export interface UpsertKnowledgeBaseContextsResponse {
838
859
  */
839
860
  contextIds?: Array<AiContextId>;
840
861
  /**
841
- * Contexts that were stored (and are fully searchable via vector/keyword) but NOT graph-indexed because
842
- * the knowledge base is over its per-KB graph chunk cap. Only GraphRAG coverage is absent; surfaced so a
843
- * caller can report the graph-coverage gap. Absent/empty when nothing was skipped or graph is disabled.
862
+ * Contexts that were stored (and are fully searchable via vector/keyword) but NOT graph-indexed by this
863
+ * upsert: the knowledge base is over its per-KB graph chunk cap, or their stale graph data could not be
864
+ * pruned, which a later graph rebuild repairs. Only GraphRAG coverage is absent; surfaced so a caller can
865
+ * report the graph-coverage gap. Absent/empty when nothing was skipped or graph is disabled.
844
866
  */
845
867
  graphIndexingSkippedContextIds?: Array<AiContextId>;
846
868
  /**
@@ -1549,8 +1571,8 @@ export interface KnowledgeBaseGraphFacetValueStatus {
1549
1571
  * documents into topics/facets.
1550
1572
  * - `'full'` — wipes the graph and re-extracts entities/relationships from every chunk with an LLM,
1551
1573
  * then rebuilds the concept layer. The expensive deep-clean: re-extraction dominates its cost.
1552
- * Only needed when the extraction itself must be redone, e.g. after changing `entityTypes` or
1553
- * `extractionModel`.
1574
+ * Only needed when the extraction itself must be redone, e.g. after changing `entityTypes`,
1575
+ * `extractionModel` or `extractionDepth`.
1554
1576
  * @category AI
1555
1577
  */
1556
1578
  export type KnowledgeBaseGraphRebuildMode = 'full' | 'structural';
@@ -1,5 +1,6 @@
1
1
  import type { AllAiAgentChatOptions } from './ai-agent.public-types';
2
2
  import type { AiAgentId, IntegrationId } from './communication.public-types';
3
+ import type { UpsertSessionRequest } from './session.public-types';
3
4
  /**
4
5
  * Providers that put a Squid agent on a phone call. `twilio` relays the call to Squid over a WebSocket
5
6
  * Squid serves; `openai` is an OpenAI Realtime call Squid answers itself, see
@@ -48,6 +49,11 @@ export interface CreateAiVoiceSessionRequest {
48
49
  connectTimeoutSeconds?: number;
49
50
  /** Public base URL of the application when it differs from the default, such as a tunnel in local development. */
50
51
  relayBaseUrl?: string;
52
+ /**
53
+ * The session (`squid.sessions()`) the call runs in: the AI functions of every turn get it as `context.session`.
54
+ * Attached once, when the call starts.
55
+ */
56
+ session?: UpsertSessionRequest;
51
57
  }
52
58
  /**
53
59
  * The opened voice session.
@@ -94,6 +100,11 @@ export interface AnswerOpenAiVoiceCallRequest {
94
100
  chatOptions?: AllAiAgentChatOptions;
95
101
  /** Free-form data echoed on every session event, for the caller's own bookkeeping. */
96
102
  metadata?: Record<string, unknown>;
103
+ /**
104
+ * The session (`squid.sessions()`) the call runs in: the AI functions of every turn get it as `context.session`.
105
+ * Attached once, when the call starts.
106
+ */
107
+ session?: UpsertSessionRequest;
97
108
  }
98
109
  /**
99
110
  * The answered OpenAI call.
@@ -148,6 +159,11 @@ export interface StartOpenAiWebVoiceCallRequest {
148
159
  chatOptions?: AllAiAgentChatOptions;
149
160
  /** Free-form data echoed on every session event, for the caller's own bookkeeping. */
150
161
  metadata?: Record<string, unknown>;
162
+ /**
163
+ * The session (`squid.sessions()`) the call runs in: the AI functions of every turn get it as `context.session`.
164
+ * Attached once, when the call starts.
165
+ */
166
+ session?: UpsertSessionRequest;
151
167
  }
152
168
  /**
153
169
  * The started browser call.
@@ -399,7 +399,7 @@ export interface DocumentMetadata {
399
399
  docModifiedAt?: string;
400
400
  /**
401
401
  * Source document type: `pdf` | `docx` | `doc` | `pptx` | `ppt` | `xlsx` | `xlsm` | `xls` | `xlsb` |
402
- * `eml` | `msg` | `csv` | `tsv` | `md` | `html` | `txt`.
402
+ * `eml` | `msg` | `one` | `csv` | `tsv` | `md` | `html` | `txt`.
403
403
  */
404
404
  docType?: string;
405
405
  }
@@ -1,6 +1,6 @@
1
1
  import { IntegrationId } from './communication.public-types';
2
2
  /** List of all integration types supported by Squid. */
3
- export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "bedrock", "azure_blob", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "bitbucket", "built_in_azure_blob", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "connected_knowledgebases", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "azure-entra-external-id", "azure-entra-id", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "generic_site_ingester", "github", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jira_jsm", "jwt_hmac", "jwt_rsa", "kafka", "keycloak", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "outlook", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "twilio", "elevenlabs", "openai_voice", "mcp", "a2a", "legend", "teams", "openai_compatible", "openai_compatible_embedding", "sharepoint", "vertex"];
3
+ export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "bedrock", "azure_blob", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "bitbucket", "built_in_azure_blob", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "connected_knowledgebases", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "azure-entra-external-id", "azure-entra-id", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "generic_site_ingester", "github", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jira_jsm", "jwt_hmac", "jwt_rsa", "kafka", "keycloak", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "outlook", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "twilio", "elevenlabs", "openai_voice", "mcp", "a2a", "legend", "teams", "openai_compatible", "openai_compatible_embedding", "bedrock_embedding", "sharepoint", "vertex"];
4
4
  /**
5
5
  * @category Database
6
6
  */
@@ -0,0 +1,82 @@
1
+ /**
2
+ * An app-scoped record of JSON data under an id the app chooses, which expires. See `squid.sessions()`.
3
+ * @category Sessions
4
+ */
5
+ export interface Session {
6
+ /** The id of the session. */
7
+ id: string;
8
+ /** The data of the session. */
9
+ data: Record<string, unknown>;
10
+ /** When the session was created. */
11
+ createdAt: Date;
12
+ /** When the session was last written. */
13
+ updatedAt: Date;
14
+ /** When the session expires, or `null` when it never does. */
15
+ expiresAt: Date | null;
16
+ }
17
+ /**
18
+ * How long a session lives after its last write: a TTL, or `'never'` to keep it until it is deleted.
19
+ * @category Sessions
20
+ */
21
+ export type SessionExpiration = SessionTtl | 'never';
22
+ /**
23
+ * An expiration a fixed time after the session's last write.
24
+ * @category Sessions
25
+ */
26
+ export interface SessionTtl {
27
+ /** Milliseconds from the last write to the expiration. At least 1000. */
28
+ ttlMs: number;
29
+ }
30
+ /**
31
+ * Creates a session, or updates the one with the same id.
32
+ * @category Sessions
33
+ */
34
+ export interface UpsertSessionRequest {
35
+ /** The id of the session: 1-256 characters, without control characters. */
36
+ id: string;
37
+ /** Top-level keys to set; other keys keep their values. The session's data is at most 64 KB. */
38
+ data?: Record<string, unknown>;
39
+ /** Top-level keys to remove. */
40
+ deleteKeys?: string[];
41
+ /** Replaces the session's expiration. A new session expires one day after its last write. */
42
+ expiration?: SessionExpiration;
43
+ }
44
+ /**
45
+ * A value a session listing matches a data key against.
46
+ * @category Sessions
47
+ */
48
+ export type SessionFilterValue = string | number | boolean | null;
49
+ /**
50
+ * Filters of a session listing.
51
+ * @category Sessions
52
+ */
53
+ export interface ListSessionsFilter {
54
+ /** Top-level data keys that must equal the given values. */
55
+ data?: Record<string, SessionFilterValue>;
56
+ /** Only sessions created after this time. */
57
+ createdAfter?: Date;
58
+ /** Only sessions created before this time. */
59
+ createdBefore?: Date;
60
+ }
61
+ /**
62
+ * Asks for a page of sessions, newest first.
63
+ * @category Sessions
64
+ */
65
+ export interface ListSessionsRequest {
66
+ /** The page size: 100 by default, at most 1000. */
67
+ limit?: number;
68
+ /** The `nextCursor` of the previous page. */
69
+ cursor?: string;
70
+ /** Filters of the listing. */
71
+ where?: ListSessionsFilter;
72
+ }
73
+ /**
74
+ * A page of sessions.
75
+ * @category Sessions
76
+ */
77
+ export interface ListSessionsResponse {
78
+ /** The sessions of the page, newest first. */
79
+ sessions: Session[];
80
+ /** Pass it as `cursor` to get the next page. Absent on the last page. */
81
+ nextCursor?: string;
82
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/twilio-client",
3
- "version": "1.0.503",
3
+ "version": "1.0.504",
4
4
  "description": "Squid Twilio Client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/connectors/twilio/twilio-client/src/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "@squidcloud/client": "^1.0.503"
20
+ "@squidcloud/client": "^1.0.504"
21
21
  },
22
22
  "engines": {
23
23
  "node": ">=20.0.0"