@ganju/utils 0.0.9 → 0.0.10

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/index.d.ts CHANGED
@@ -14,16 +14,18 @@ import type { CustomCodeTokenPayload } from './customCodeToken';
14
14
  import type { ContainmentTokenPayload } from './containmentToken';
15
15
  import type { OAuthProviderConfig } from './oauthProviders';
16
16
  import type { ExposableResource } from './exposedResource';
17
+ import type { SyncableResource, ResourceSyncProvider } from './syncableResource';
17
18
  import type { CustomCodeProject, ProjectPathIssue } from './customCodeProject';
18
19
  import type { AttachmentResource, ResolvedAttachment, ResolveAttachmentResult } from './attachment';
19
20
  import type { MintedAccessToken } from './accessToken';
20
21
  import type { CatalogGroup, CatalogTool, CatalogToolDescriptor, ToolGroupKey, ToolKey } from './toolCatalog';
21
22
  import type { Separator, ChunkMetadata, PreparedChunk } from './chunking';
23
+ import type { RerankAiBinding } from './resourceRerank';
22
24
  import type { RateLimitRetryOptions } from './retry';
23
25
  import type { QueueBatchLike, QueueMessageLike, ProcessQueueBatchHandlers } from './processQueueBatch';
24
26
  import type { ExtractedDocument, ExtractedDocumentMetadata, ExtractedDocumentSource } from './extractedDocument';
25
27
  import type { ChannelNotifier, ToolStatusEvent } from './channelNotifier';
26
- import type { BufferedChannelMessage, ChannelBufferEnvelope, ChannelBufferFlush } from './channelDebounce';
28
+ import type { BufferedChannelMessage, BufferedChannelCommand, ChannelBufferEnvelope, ChannelBufferFlush } from './channelDebounce';
27
29
  import type { Source, ResourceUrlContext, SourceButton } from './sources';
28
30
  import { OAuthReauthRequiredError } from './oauth';
29
31
  import type { RefreshOAuthTokenInput, RefreshedOAuthToken } from './oauth';
@@ -355,18 +357,6 @@ export declare const utils: {
355
357
  organizationId: import("zod").ZodUUID;
356
358
  }, import("zod/v4/core").$strip>;
357
359
  ARTIFACT_CREATE_RESOURCE_VIEW: import("zod").ZodObject<{
358
- content: import("zod").ZodOptional<import("zod").ZodString>;
359
- type: import("zod").ZodDefault<import("zod").ZodEnum<{
360
- static: "static";
361
- template: "template";
362
- }>>;
363
- description: import("zod").ZodOptional<import("zod").ZodString>;
364
- title: import("zod").ZodString;
365
- uri: import("zod").ZodString;
366
- crawlConfig: import("zod").ZodOptional<import("zod").ZodObject<{
367
- maxPages: import("zod").ZodDefault<import("zod").ZodNumber>;
368
- maxDepth: import("zod").ZodDefault<import("zod").ZodNumber>;
369
- }, import("zod/v4/core").$strip>>;
370
360
  mimeType: import("zod").ZodEnum<{
371
361
  "text/plain": "text/plain";
372
362
  "text/csv": "text/csv";
@@ -407,6 +397,19 @@ export declare const utils: {
407
397
  "application/x-perl": "application/x-perl";
408
398
  "application/octet-stream": "application/octet-stream";
409
399
  }>;
400
+ fileName: import("zod").ZodOptional<import("zod").ZodString>;
401
+ content: import("zod").ZodOptional<import("zod").ZodString>;
402
+ type: import("zod").ZodDefault<import("zod").ZodEnum<{
403
+ static: "static";
404
+ template: "template";
405
+ }>>;
406
+ description: import("zod").ZodOptional<import("zod").ZodString>;
407
+ title: import("zod").ZodString;
408
+ uri: import("zod").ZodString;
409
+ crawlConfig: import("zod").ZodOptional<import("zod").ZodObject<{
410
+ maxPages: import("zod").ZodDefault<import("zod").ZodNumber>;
411
+ maxDepth: import("zod").ZodDefault<import("zod").ZodNumber>;
412
+ }, import("zod/v4/core").$strip>>;
410
413
  size: import("zod").ZodOptional<import("zod").ZodNumber>;
411
414
  sourceType: import("zod").ZodDefault<import("zod").ZodEnum<{
412
415
  FILE: "FILE";
@@ -417,7 +420,6 @@ export declare const utils: {
417
420
  }>>;
418
421
  encoding: import("zod").ZodOptional<import("zod").ZodString>;
419
422
  fileKey: import("zod").ZodOptional<import("zod").ZodString>;
420
- fileName: import("zod").ZodOptional<import("zod").ZodString>;
421
423
  annotations: import("zod").ZodOptional<import("zod").ZodObject<{
422
424
  audience: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEnum<{
423
425
  user: "user";
@@ -616,14 +618,6 @@ export declare const utils: {
616
618
  organizationId: import("zod").ZodUUID;
617
619
  }, import("zod/v4/core").$strip>;
618
620
  ARTIFACT_UPDATE_RESOURCE_VIEW: import("zod").ZodObject<{
619
- content: import("zod").ZodOptional<import("zod").ZodString>;
620
- type: import("zod").ZodDefault<import("zod").ZodEnum<{
621
- static: "static";
622
- template: "template";
623
- }>>;
624
- description: import("zod").ZodOptional<import("zod").ZodString>;
625
- title: import("zod").ZodString;
626
- uri: import("zod").ZodString;
627
621
  mimeType: import("zod").ZodEnum<{
628
622
  "text/plain": "text/plain";
629
623
  "text/csv": "text/csv";
@@ -664,6 +658,15 @@ export declare const utils: {
664
658
  "application/x-perl": "application/x-perl";
665
659
  "application/octet-stream": "application/octet-stream";
666
660
  }>;
661
+ fileName: import("zod").ZodOptional<import("zod").ZodString>;
662
+ content: import("zod").ZodOptional<import("zod").ZodString>;
663
+ type: import("zod").ZodDefault<import("zod").ZodEnum<{
664
+ static: "static";
665
+ template: "template";
666
+ }>>;
667
+ description: import("zod").ZodOptional<import("zod").ZodString>;
668
+ title: import("zod").ZodString;
669
+ uri: import("zod").ZodString;
667
670
  size: import("zod").ZodOptional<import("zod").ZodNumber>;
668
671
  sourceType: import("zod").ZodDefault<import("zod").ZodEnum<{
669
672
  FILE: "FILE";
@@ -674,7 +677,6 @@ export declare const utils: {
674
677
  }>>;
675
678
  encoding: import("zod").ZodOptional<import("zod").ZodString>;
676
679
  fileKey: import("zod").ZodOptional<import("zod").ZodString>;
677
- fileName: import("zod").ZodOptional<import("zod").ZodString>;
678
680
  annotations: import("zod").ZodOptional<import("zod").ZodObject<{
679
681
  audience: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEnum<{
680
682
  user: "user";
@@ -981,6 +983,23 @@ export declare const utils: {
981
983
  userId: import("zod").ZodUUID;
982
984
  organizationId: import("zod").ZodUUID;
983
985
  }, import("zod/v4/core").$strip>;
986
+ ARTIFACT_UPDATE_RESOURCE_SYNC_INTERVAL: import("zod").ZodObject<{
987
+ resourceId: import("zod").ZodUUID;
988
+ syncInterval: import("zod").ZodEnum<{
989
+ off: "off";
990
+ daily: "daily";
991
+ weekly: "weekly";
992
+ }>;
993
+ projectId: import("zod").ZodUUID;
994
+ userId: import("zod").ZodUUID;
995
+ organizationId: import("zod").ZodUUID;
996
+ }, import("zod/v4/core").$strip>;
997
+ ARTIFACT_SYNC_RESOURCE: import("zod").ZodObject<{
998
+ resourceId: import("zod").ZodUUID;
999
+ projectId: import("zod").ZodUUID;
1000
+ userId: import("zod").ZodUUID;
1001
+ organizationId: import("zod").ZodUUID;
1002
+ }, import("zod/v4/core").$strip>;
984
1003
  HTTP_ENDPOINT_CONFIG: import("zod").ZodPipe<import("zod").ZodObject<{
985
1004
  name: import("zod").ZodString;
986
1005
  title: import("zod").ZodOptional<import("zod").ZodString>;
@@ -1813,6 +1832,7 @@ export declare const utils: {
1813
1832
  PLAN_FEATURE_EMBEDDED_STORAGE: "embeddedStorage";
1814
1833
  PLAN_FEATURE_MESSAGE: "message";
1815
1834
  PLAN_FEATURE_TOOL_CALL: "toolCall";
1835
+ PLAN_FEATURE_RESOURCE_SYNC: "resourceSync";
1816
1836
  PLAN_LIMIT_ERROR_CODE: string;
1817
1837
  BILLING_METER_MESSAGES: string;
1818
1838
  BILLING_METER_SHARED_MESSAGES: string;
@@ -2018,6 +2038,17 @@ export declare const utils: {
2018
2038
  RESOURCE_SOURCE_TYPE_ONE_DRIVE_FOLDER: "ONE_DRIVE_FOLDER";
2019
2039
  RESOURCE_SOURCE_TYPE_CUSTOM_CODE: "CUSTOM_CODE";
2020
2040
  RESOURCE_SOURCE_TYPES: ("FILE" | "WEBSITE" | "GOOGLE_DRIVE_FOLDER" | "ONE_DRIVE_FOLDER" | "CUSTOM_CODE")[];
2041
+ RESOURCE_SYNC_INTERVAL_OFF: "off";
2042
+ RESOURCE_SYNC_INTERVAL_DAILY: "daily";
2043
+ RESOURCE_SYNC_INTERVAL_WEEKLY: "weekly";
2044
+ RESOURCE_SYNC_INTERVALS: readonly ["off", "daily", "weekly"];
2045
+ RESOURCE_SYNC_INTERVAL_DEFAULT: "weekly";
2046
+ RESOURCE_SYNC_INTERVAL_MS: {
2047
+ readonly daily: number;
2048
+ readonly weekly: number;
2049
+ };
2050
+ RESOURCE_SYNC_BATCH_SIZE: number;
2051
+ RESOURCE_SYNC_MANUAL_COOLDOWN_MS: number;
2021
2052
  CRAWL_RENDERER_CHEERIO: "cheerio";
2022
2053
  CRAWL_RENDERER_PLAYWRIGHT: "playwright";
2023
2054
  CRAWL_RENDERERS: ("cheerio" | "playwright")[];
@@ -2143,6 +2174,12 @@ export declare const utils: {
2143
2174
  CHUNK_TARGET_CHARS: number;
2144
2175
  CHUNK_OVERLAP_CHARS: number;
2145
2176
  EMBED_BATCH_SIZE: number;
2177
+ RESOURCE_SEARCH_CANDIDATES: number;
2178
+ RESOURCE_SEARCH_RRF_K: number;
2179
+ RESOURCE_SEARCH_COMMON_TERM_DIVISOR: number;
2180
+ RESOURCE_SEARCH_COMMON_TERM_MIN: number;
2181
+ RESOURCE_SEARCH_RERANK_CANDIDATES: number;
2182
+ RESOURCE_SEARCH_RERANK_MODEL: string;
2146
2183
  RESOURCE_HANDLER_SLEEP_AFTER: string;
2147
2184
  DOCS_URL: string;
2148
2185
  BASE64_DATA_URI_RE: RegExp;
@@ -2420,6 +2457,8 @@ export declare const utils: {
2420
2457
  oauthProviders: Record<string, OAuthProviderConfig>;
2421
2458
  resolveAttachment: (resource: AttachmentResource, readObject: (key: string) => Promise<ArrayBuffer | null>, verb?: "attach" | "upload") => Promise<ResolveAttachmentResult>;
2422
2459
  isExposedResource: (resource: ExposableResource) => boolean;
2460
+ isSyncableResource: (resource: SyncableResource) => boolean;
2461
+ resourceSyncProvider: (resource: SyncableResource) => ResourceSyncProvider | null;
2423
2462
  describeVendorError: (body: unknown, fallback: string) => string;
2424
2463
  withDeadline: <T>(work: Promise<T>, ms: number) => Promise<T>;
2425
2464
  isDeadlineError: (error: unknown) => boolean;
@@ -2789,7 +2828,7 @@ export declare const utils: {
2789
2828
  }, {
2790
2829
  readonly key: "search-resources";
2791
2830
  readonly title: "Search Resources";
2792
- readonly description: "Find the resources most relevant to a question using semantic search.";
2831
+ readonly description: "Find the resources most relevant to a question, by meaning and by exact keywords.";
2793
2832
  readonly requiredScopes: null;
2794
2833
  }, {
2795
2834
  readonly key: "send-resource";
@@ -2879,9 +2918,12 @@ export declare const utils: {
2879
2918
  prepareChunks: (header: string, documents: ExtractedDocument[] | null, fallbackContent: string | null, options?: {
2880
2919
  targetChars?: number;
2881
2920
  overlapChars?: number;
2921
+ mimeType?: string | null;
2922
+ fileName?: string | null;
2882
2923
  }) => PreparedChunk[];
2883
2924
  isEmbeddableMimeType: (mimeType: string) => boolean;
2884
2925
  l2Normalize: (values: number[]) => number[];
2926
+ createResourceReranker: (source: EnvSource) => ((query: string, documents: string[]) => Promise<number[] | null>) | undefined;
2885
2927
  sleep: (ms: number) => Promise<void>;
2886
2928
  isRateLimitError: (err: unknown) => boolean;
2887
2929
  withRateLimitRetry: <T>(fn: () => Promise<T>, options?: RateLimitRetryOptions) => Promise<T>;
@@ -2889,6 +2931,7 @@ export declare const utils: {
2889
2931
  getToolStatusMessage: (toolName: string) => string | null;
2890
2932
  resolveDebounceMs: (config: unknown) => number;
2891
2933
  channelBufferKey: (channelId: string, externalConversationId: string, externalParticipantId: string) => string;
2934
+ batchCommand: (messages: BufferedChannelMessage[]) => BufferedChannelCommand | null;
2892
2935
  joinBufferedMessages: (messages: Array<{
2893
2936
  text: string;
2894
2937
  }>) => string;
@@ -2916,5 +2959,5 @@ export declare const utils: {
2916
2959
  PlanLimitError: typeof PlanLimitError;
2917
2960
  isPlanLimitError: (error: unknown) => error is PlanLimitError;
2918
2961
  };
2919
- export type { MintedAccessToken, CustomCodeProject, ProjectPathIssue, CatalogGroup, CatalogTool, CatalogToolDescriptor, ToolGroupKey, ToolKey, CalendarConfigField, JsonSchema, SchemaViolation, MimeAttachment, MimeMessageInput, GmailOperation, GmailSendRequest, GmailSendResponse, OutlookOperation, OutlookSendRequest, OutlookSendResponse, SlackOperation, SlackSendRequest, SlackSendResponse, SlackSendRemoteResourceRequest, TelegramSendRequest, TelegramSendResponse, TelegramSendRemoteResourceRequest, DiscordSendRequest, DiscordSendResponse, DiscordSendRemoteResourceRequest, WhatsappSendRequest, WhatsappSendResponse, WhatsappSendRemoteResourceRequest, EnvSource, Separator, ChunkMetadata, PreparedChunk, ExtractedDocument, ExtractedDocumentMetadata, ExtractedDocumentSource, RateLimitRetryOptions, QueueBatchLike, QueueMessageLike, ProcessQueueBatchHandlers, ChannelNotifier, ToolStatusEvent, BufferedChannelMessage, ChannelBufferEnvelope, ChannelBufferFlush, Source, ResourceUrlContext, SourceButton, RefreshOAuthTokenInput, RefreshedOAuthToken, HttpEndpointToolConfig, McpProxyToolConfig, McpProxyDiscoveredTool, McpProxyDiscoveredResource, McpProxyDiscoveredPrompt, McpProxyDiscovery, CustomCodeToolConfig, CustomCodeToolManifest, CustomCodeManifest, CustomCodeSendFile, CustomCodeCreateResource, CustomCodeTokenPayload, ContainmentTokenPayload, OAuthProviderConfig, AttachmentResource, ResolvedAttachment, ResolveAttachmentResult, ExposableResource, PlanLimitDetails, PlanLimits };
2962
+ export type { MintedAccessToken, CustomCodeProject, ProjectPathIssue, CatalogGroup, CatalogTool, CatalogToolDescriptor, ToolGroupKey, ToolKey, CalendarConfigField, JsonSchema, SchemaViolation, MimeAttachment, MimeMessageInput, GmailOperation, GmailSendRequest, GmailSendResponse, OutlookOperation, OutlookSendRequest, OutlookSendResponse, SlackOperation, SlackSendRequest, SlackSendResponse, SlackSendRemoteResourceRequest, TelegramSendRequest, TelegramSendResponse, TelegramSendRemoteResourceRequest, DiscordSendRequest, DiscordSendResponse, DiscordSendRemoteResourceRequest, WhatsappSendRequest, WhatsappSendResponse, WhatsappSendRemoteResourceRequest, EnvSource, Separator, ChunkMetadata, PreparedChunk, ExtractedDocument, ExtractedDocumentMetadata, ExtractedDocumentSource, RateLimitRetryOptions, RerankAiBinding, QueueBatchLike, QueueMessageLike, ProcessQueueBatchHandlers, ChannelNotifier, ToolStatusEvent, BufferedChannelMessage, BufferedChannelCommand, ChannelBufferEnvelope, ChannelBufferFlush, Source, ResourceUrlContext, SourceButton, RefreshOAuthTokenInput, RefreshedOAuthToken, HttpEndpointToolConfig, McpProxyToolConfig, McpProxyDiscoveredTool, McpProxyDiscoveredResource, McpProxyDiscoveredPrompt, McpProxyDiscovery, CustomCodeToolConfig, CustomCodeToolManifest, CustomCodeManifest, CustomCodeSendFile, CustomCodeCreateResource, CustomCodeTokenPayload, ContainmentTokenPayload, OAuthProviderConfig, AttachmentResource, ResolvedAttachment, ResolveAttachmentResult, ExposableResource, SyncableResource, ResourceSyncProvider, PlanLimitDetails, PlanLimits };
2920
2963
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAyCvD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAA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,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACX,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAyCvD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,gCAAgC,EACjC,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,mBAAmB,EACnB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sB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACX,CAAC"}
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ const containmentToken_1 = require("./containmentToken");
22
22
  const oauthProviders_1 = require("./oauthProviders");
23
23
  const attachment_1 = require("./attachment");
24
24
  const exposedResource_1 = require("./exposedResource");
25
+ const syncableResource_1 = require("./syncableResource");
25
26
  const vendorError_1 = require("./vendorError");
26
27
  const deadline_1 = require("./deadline");
27
28
  const customCodeProject_1 = require("./customCodeProject");
@@ -41,6 +42,7 @@ const sanitize_1 = require("./sanitize");
41
42
  const chunking_1 = require("./chunking");
42
43
  const embeddable_1 = require("./embeddable");
43
44
  const l2Normalize_1 = require("./l2Normalize");
45
+ const resourceRerank_1 = require("./resourceRerank");
44
46
  const retry_1 = require("./retry");
45
47
  const processQueueBatch_1 = require("./processQueueBatch");
46
48
  const channelNotifier_1 = require("./channelNotifier");
@@ -100,6 +102,8 @@ exports.utils = {
100
102
  oauthProviders: oauthProviders_1.oauthProviders,
101
103
  resolveAttachment: attachment_1.resolveAttachment,
102
104
  isExposedResource: exposedResource_1.isExposedResource,
105
+ isSyncableResource: syncableResource_1.isSyncableResource,
106
+ resourceSyncProvider: syncableResource_1.resourceSyncProvider,
103
107
  describeVendorError: vendorError_1.describeVendorError,
104
108
  withDeadline: deadline_1.withDeadline,
105
109
  isDeadlineError: deadline_1.isDeadlineError,
@@ -146,6 +150,7 @@ exports.utils = {
146
150
  prepareChunks: chunking_1.prepareChunks,
147
151
  isEmbeddableMimeType: embeddable_1.isEmbeddableMimeType,
148
152
  l2Normalize: l2Normalize_1.l2Normalize,
153
+ createResourceReranker: resourceRerank_1.createResourceReranker,
149
154
  sleep: retry_1.sleep,
150
155
  isRateLimitError: retry_1.isRateLimitError,
151
156
  withRateLimitRetry: retry_1.withRateLimitRetry,
@@ -153,6 +158,7 @@ exports.utils = {
153
158
  getToolStatusMessage: channelNotifier_1.getToolStatusMessage,
154
159
  resolveDebounceMs: channelDebounce_1.resolveDebounceMs,
155
160
  channelBufferKey: channelDebounce_1.channelBufferKey,
161
+ batchCommand: channelDebounce_1.batchCommand,
156
162
  joinBufferedMessages: channelDebounce_1.joinBufferedMessages,
157
163
  isResourceSourceEnabled: sources_1.isResourceSourceEnabled,
158
164
  isDownloadableSource: sources_1.isDownloadableSource,
@@ -0,0 +1,20 @@
1
+ import type { EnvSource } from './getEnv';
2
+ export interface RerankAiBinding {
3
+ run(model: string, input: {
4
+ query: string;
5
+ contexts: Array<{
6
+ text: string;
7
+ }>;
8
+ top_k?: number;
9
+ }): Promise<unknown>;
10
+ }
11
+ /**
12
+ * The cross-encoder second stage for resource search, or undefined when the
13
+ * Worker has no `AI` binding — local dev without Workers AI keeps plain fusion.
14
+ *
15
+ * Returns one score per document, in input order. A response that doesn't
16
+ * cover every document returns null, which keeps the fused order — a partial
17
+ * ranking would silently drop the chunks it left out.
18
+ */
19
+ export declare const createResourceReranker: (source: EnvSource) => ((query: string, documents: string[]) => Promise<number[] | null>) | undefined;
20
+ //# sourceMappingURL=resourceRerank.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceRerank.d.ts","sourceRoot":"","sources":["../src/resourceRerank.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C,MAAM,WAAW,eAAe;IAC9B,GAAG,CACD,KAAK,EAAE,MAAM,EACb,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1E,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,KAEf,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,GAClE,SAyBH,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createResourceReranker = void 0;
4
+ const constants_1 = require("./constants");
5
+ /**
6
+ * The cross-encoder second stage for resource search, or undefined when the
7
+ * Worker has no `AI` binding — local dev without Workers AI keeps plain fusion.
8
+ *
9
+ * Returns one score per document, in input order. A response that doesn't
10
+ * cover every document returns null, which keeps the fused order — a partial
11
+ * ranking would silently drop the chunks it left out.
12
+ */
13
+ const createResourceReranker = (source) => {
14
+ const ai = source.env?.AI;
15
+ if (!ai)
16
+ return undefined;
17
+ return async (query, documents) => {
18
+ const result = (await ai.run(constants_1.constants.RESOURCE_SEARCH_RERANK_MODEL, {
19
+ query,
20
+ contexts: documents.map(text => ({ text })),
21
+ top_k: documents.length
22
+ }));
23
+ const scores = new Array(documents.length);
24
+ for (const item of result?.response ?? []) {
25
+ if (typeof item.id === 'number' &&
26
+ typeof item.score === 'number' &&
27
+ item.id >= 0 &&
28
+ item.id < documents.length) {
29
+ scores[item.id] = item.score;
30
+ }
31
+ }
32
+ if (scores.some(score => score === undefined))
33
+ return null;
34
+ return scores;
35
+ };
36
+ };
37
+ exports.createResourceReranker = createResourceReranker;
package/dist/schema.d.ts CHANGED
@@ -740,18 +740,6 @@ export declare const Schema: {
740
740
  organizationId: z.ZodUUID;
741
741
  }, z.core.$strip>;
742
742
  ARTIFACT_CREATE_RESOURCE_VIEW: z.ZodObject<{
743
- content: z.ZodOptional<z.ZodString>;
744
- type: z.ZodDefault<z.ZodEnum<{
745
- static: "static";
746
- template: "template";
747
- }>>;
748
- description: z.ZodOptional<z.ZodString>;
749
- title: z.ZodString;
750
- uri: z.ZodString;
751
- crawlConfig: z.ZodOptional<z.ZodObject<{
752
- maxPages: z.ZodDefault<z.ZodNumber>;
753
- maxDepth: z.ZodDefault<z.ZodNumber>;
754
- }, z.core.$strip>>;
755
743
  mimeType: z.ZodEnum<{
756
744
  "text/plain": "text/plain";
757
745
  "text/csv": "text/csv";
@@ -792,6 +780,19 @@ export declare const Schema: {
792
780
  "application/x-perl": "application/x-perl";
793
781
  "application/octet-stream": "application/octet-stream";
794
782
  }>;
783
+ fileName: z.ZodOptional<z.ZodString>;
784
+ content: z.ZodOptional<z.ZodString>;
785
+ type: z.ZodDefault<z.ZodEnum<{
786
+ static: "static";
787
+ template: "template";
788
+ }>>;
789
+ description: z.ZodOptional<z.ZodString>;
790
+ title: z.ZodString;
791
+ uri: z.ZodString;
792
+ crawlConfig: z.ZodOptional<z.ZodObject<{
793
+ maxPages: z.ZodDefault<z.ZodNumber>;
794
+ maxDepth: z.ZodDefault<z.ZodNumber>;
795
+ }, z.core.$strip>>;
795
796
  size: z.ZodOptional<z.ZodNumber>;
796
797
  sourceType: z.ZodDefault<z.ZodEnum<{
797
798
  FILE: "FILE";
@@ -802,7 +803,6 @@ export declare const Schema: {
802
803
  }>>;
803
804
  encoding: z.ZodOptional<z.ZodString>;
804
805
  fileKey: z.ZodOptional<z.ZodString>;
805
- fileName: z.ZodOptional<z.ZodString>;
806
806
  annotations: z.ZodOptional<z.ZodObject<{
807
807
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
808
808
  user: "user";
@@ -1001,14 +1001,6 @@ export declare const Schema: {
1001
1001
  organizationId: z.ZodUUID;
1002
1002
  }, z.core.$strip>;
1003
1003
  ARTIFACT_UPDATE_RESOURCE_VIEW: z.ZodObject<{
1004
- content: z.ZodOptional<z.ZodString>;
1005
- type: z.ZodDefault<z.ZodEnum<{
1006
- static: "static";
1007
- template: "template";
1008
- }>>;
1009
- description: z.ZodOptional<z.ZodString>;
1010
- title: z.ZodString;
1011
- uri: z.ZodString;
1012
1004
  mimeType: z.ZodEnum<{
1013
1005
  "text/plain": "text/plain";
1014
1006
  "text/csv": "text/csv";
@@ -1049,6 +1041,15 @@ export declare const Schema: {
1049
1041
  "application/x-perl": "application/x-perl";
1050
1042
  "application/octet-stream": "application/octet-stream";
1051
1043
  }>;
1044
+ fileName: z.ZodOptional<z.ZodString>;
1045
+ content: z.ZodOptional<z.ZodString>;
1046
+ type: z.ZodDefault<z.ZodEnum<{
1047
+ static: "static";
1048
+ template: "template";
1049
+ }>>;
1050
+ description: z.ZodOptional<z.ZodString>;
1051
+ title: z.ZodString;
1052
+ uri: z.ZodString;
1052
1053
  size: z.ZodOptional<z.ZodNumber>;
1053
1054
  sourceType: z.ZodDefault<z.ZodEnum<{
1054
1055
  FILE: "FILE";
@@ -1059,7 +1060,6 @@ export declare const Schema: {
1059
1060
  }>>;
1060
1061
  encoding: z.ZodOptional<z.ZodString>;
1061
1062
  fileKey: z.ZodOptional<z.ZodString>;
1062
- fileName: z.ZodOptional<z.ZodString>;
1063
1063
  annotations: z.ZodOptional<z.ZodObject<{
1064
1064
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1065
1065
  user: "user";
@@ -1366,6 +1366,23 @@ export declare const Schema: {
1366
1366
  userId: z.ZodUUID;
1367
1367
  organizationId: z.ZodUUID;
1368
1368
  }, z.core.$strip>;
1369
+ ARTIFACT_UPDATE_RESOURCE_SYNC_INTERVAL: z.ZodObject<{
1370
+ resourceId: z.ZodUUID;
1371
+ syncInterval: z.ZodEnum<{
1372
+ off: "off";
1373
+ daily: "daily";
1374
+ weekly: "weekly";
1375
+ }>;
1376
+ projectId: z.ZodUUID;
1377
+ userId: z.ZodUUID;
1378
+ organizationId: z.ZodUUID;
1379
+ }, z.core.$strip>;
1380
+ ARTIFACT_SYNC_RESOURCE: z.ZodObject<{
1381
+ resourceId: z.ZodUUID;
1382
+ projectId: z.ZodUUID;
1383
+ userId: z.ZodUUID;
1384
+ organizationId: z.ZodUUID;
1385
+ }, z.core.$strip>;
1369
1386
  HTTP_ENDPOINT_CONFIG: z.ZodPipe<z.ZodObject<{
1370
1387
  name: z.ZodString;
1371
1388
  title: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAixBxB,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FrB,CAAC;AAyDN,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;iBAmCpB,CAAC;AAWH,QAAA,MAAM,kBAAkB;;;;;;;;;;iBA+CtB,CAAC;AAiCH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAapB,CAAC;AAYH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgCxB,CAAC;AA4LH,QAAA,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4DpC,CAAC;AA4BL,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAkDzB,CAAC;AAwGH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAO,CAAC;CACtB;AAKD,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAC1E;AAMD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACtC"}
package/dist/schema.js CHANGED
@@ -1263,6 +1263,19 @@ const ARTIFACT_UPDATE_RESOURCE_SHOW_SOURCE = zod_1.z.object({
1263
1263
  userId: zod_1.z.uuid(),
1264
1264
  organizationId: zod_1.z.uuid()
1265
1265
  });
1266
+ const ARTIFACT_UPDATE_RESOURCE_SYNC_INTERVAL = zod_1.z.object({
1267
+ resourceId: zod_1.z.uuid(),
1268
+ syncInterval: zod_1.z.enum(constants_1.constants.RESOURCE_SYNC_INTERVALS),
1269
+ projectId: zod_1.z.uuid(),
1270
+ userId: zod_1.z.uuid(),
1271
+ organizationId: zod_1.z.uuid()
1272
+ });
1273
+ const ARTIFACT_SYNC_RESOURCE = zod_1.z.object({
1274
+ resourceId: zod_1.z.uuid(),
1275
+ projectId: zod_1.z.uuid(),
1276
+ userId: zod_1.z.uuid(),
1277
+ organizationId: zod_1.z.uuid()
1278
+ });
1266
1279
  const ARTIFACT_GET = zod_1.z.object({
1267
1280
  projectId: zod_1.z.uuid(),
1268
1281
  userId: zod_1.z.uuid(),
@@ -1425,6 +1438,8 @@ exports.Schema = {
1425
1438
  CHANNEL_LIST_CONVERSATIONS,
1426
1439
  CHANNEL_LIST_MESSAGES,
1427
1440
  ARTIFACT_UPDATE_RESOURCE_SHOW_SOURCE,
1441
+ ARTIFACT_UPDATE_RESOURCE_SYNC_INTERVAL,
1442
+ ARTIFACT_SYNC_RESOURCE,
1428
1443
  HTTP_ENDPOINT_CONFIG,
1429
1444
  HTTP_ENDPOINT_CONFIG_WRITE,
1430
1445
  MCP_PROXY_CONFIG,
@@ -0,0 +1,9 @@
1
+ export interface SyncableResource {
2
+ sourceType?: string | null;
3
+ parentResourceId?: string | null;
4
+ metadata?: unknown;
5
+ }
6
+ export type ResourceSyncProvider = 'website' | 'google-drive' | 'one-drive';
7
+ export declare const resourceSyncProvider: (resource: SyncableResource) => ResourceSyncProvider | null;
8
+ export declare const isSyncableResource: (resource: SyncableResource) => boolean;
9
+ //# sourceMappingURL=syncableResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncableResource.d.ts","sourceRoot":"","sources":["../src/syncableResource.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,cAAc,GAAG,WAAW,CAAC;AAE5E,eAAO,MAAM,oBAAoB,GAC/B,UAAU,gBAAgB,KACzB,oBAAoB,GAAG,IAqBzB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,UAAU,gBAAgB,KAAG,OACvB,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSyncableResource = exports.resourceSyncProvider = void 0;
4
+ const constants_1 = require("./constants");
5
+ const resourceSyncProvider = (resource) => {
6
+ if (resource.parentResourceId)
7
+ return null;
8
+ switch (resource.sourceType) {
9
+ case constants_1.constants.RESOURCE_SOURCE_TYPE_WEBSITE:
10
+ return 'website';
11
+ case constants_1.constants.RESOURCE_SOURCE_TYPE_GOOGLE_DRIVE_FOLDER:
12
+ return 'google-drive';
13
+ case constants_1.constants.RESOURCE_SOURCE_TYPE_ONE_DRIVE_FOLDER:
14
+ return 'one-drive';
15
+ case constants_1.constants.RESOURCE_SOURCE_TYPE_FILE: {
16
+ const meta = resource.metadata && typeof resource.metadata === 'object'
17
+ ? resource.metadata
18
+ : null;
19
+ if (typeof meta?.driveFileId === 'string')
20
+ return 'google-drive';
21
+ if (typeof meta?.oneDriveItemId === 'string')
22
+ return 'one-drive';
23
+ return null;
24
+ }
25
+ default:
26
+ return null;
27
+ }
28
+ };
29
+ exports.resourceSyncProvider = resourceSyncProvider;
30
+ const isSyncableResource = (resource) => (0, exports.resourceSyncProvider)(resource) !== null;
31
+ exports.isSyncableResource = isSyncableResource;
@@ -350,7 +350,7 @@ export declare const TOOL_CATALOG: readonly [{
350
350
  }, {
351
351
  readonly key: "search-resources";
352
352
  readonly title: "Search Resources";
353
- readonly description: "Find the resources most relevant to a question using semantic search.";
353
+ readonly description: "Find the resources most relevant to a question, by meaning and by exact keywords.";
354
354
  readonly requiredScopes: null;
355
355
  }, {
356
356
  readonly key: "send-resource";
@@ -431,7 +431,7 @@ exports.TOOL_CATALOG = [
431
431
  {
432
432
  key: 'search-resources',
433
433
  title: 'Search Resources',
434
- description: 'Find the resources most relevant to a question using semantic search.',
434
+ description: 'Find the resources most relevant to a question, by meaning and by exact keywords.',
435
435
  requiredScopes: null
436
436
  },
437
437
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganju/utils",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Shared constants, schemas and helpers for Ganju",
5
5
  "license": "Apache-2.0",
6
6
  "author": "MontoyaAndres <andresmontoyafcb@gmail.com>",
@@ -12,8 +12,41 @@ export interface BufferedChannelMessage {
12
12
  text: string;
13
13
  externalMessageId: string | null;
14
14
  receivedAt: number;
15
+ // Answer without waiting for the burst to settle: an explicit command, or a
16
+ // message on a channel with buffering turned off. It still goes through the
17
+ // buffer — that is what runs the turn under a caller patient enough for a
18
+ // long answer — it just flushes at once, taking any pending text with it.
19
+ immediate?: boolean;
20
+ // The prompt this message invoked, when it was a slash command.
21
+ command?: BufferedChannelCommand | null;
22
+ // Where this message must be answered, when that isn't the envelope's
23
+ // `delivery` — a Discord interaction waiting on its deferred response. Kept
24
+ // on the message because the envelope is replaced by every newer push, and a
25
+ // plain message typed a moment later must not orphan the interaction.
26
+ reply?: Record<string, unknown> | null;
15
27
  }
16
28
 
29
+ // A resolved slash-command prompt, carried with the message that invoked it so
30
+ // the flush can run it exactly as the webhook would have.
31
+ export interface BufferedChannelCommand {
32
+ promptId: string;
33
+ artifactPromptId: string | null;
34
+ promptTitle: string;
35
+ args: Record<string, string>;
36
+ }
37
+
38
+ // The prompt a batch runs: the newest command in it, since that is the one the
39
+ // participant asked for last. Null for a batch of plain text.
40
+ export const batchCommand = (
41
+ messages: BufferedChannelMessage[]
42
+ ): BufferedChannelCommand | null => {
43
+ for (let i = messages.length - 1; i >= 0; i--) {
44
+ const command = messages[i].command;
45
+ if (command) return command;
46
+ }
47
+ return null;
48
+ };
49
+
17
50
  // Everything the flush needs to run the turn and deliver the reply, minus the
18
51
  // message texts themselves. The newest push wins: a display name or thread id
19
52
  // can change mid-burst, and the freshest is the one to answer against.
@@ -35,6 +68,9 @@ export interface ChannelBufferEnvelope {
35
68
  export interface ChannelBufferFlush {
36
69
  envelope: ChannelBufferEnvelope;
37
70
  messages: BufferedChannelMessage[];
71
+ // Stable across every hand-off of the same batch, so the worker can tell a
72
+ // retry of a turn it already answered from a new one.
73
+ batchId: string;
38
74
  }
39
75
 
40
76
  // Read the channel's debounce window off its `config`, clamped to the supported