lucid-extension-sdk 0.0.202 → 0.0.204

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/commandtypes.d.ts CHANGED
@@ -56,6 +56,7 @@ export declare const enum CommandName {
56
56
  ElementExists = "ee",
57
57
  ExecuteFormula = "ef",
58
58
  FindAvailableSpace = "fas",
59
+ FireBeaconEvent = "fbe",
59
60
  GetOAuthClientId = "goci",
60
61
  GetConnectedLines = "gcl",
61
62
  GetCurrentPage = "gcp",
@@ -67,6 +68,7 @@ export declare const enum CommandName {
67
68
  GetEnvironmentConfig = "gec",
68
69
  GetItemPageId = "gip",
69
70
  GetItemsAt = "gia",
71
+ GetLLMContextFromItems = "llm",
70
72
  GetOAuthToken = "got",
71
73
  GetPackageSettings = "gps",
72
74
  GetProduct = "gpr",
@@ -282,6 +284,10 @@ export type CommandArgs = {
282
284
  query: FindAvailableSpaceQuery;
283
285
  result: FindAvailableSpaceResult;
284
286
  };
287
+ [CommandName.FireBeaconEvent]: {
288
+ query: FireBeaconEventQuery;
289
+ result: FireBeaconEventResult;
290
+ };
285
291
  [CommandName.GetOAuthClientId]: {
286
292
  query: GetOAuthClientIdQuery;
287
293
  result: GetOAuthClientIdResult;
@@ -326,6 +332,10 @@ export type CommandArgs = {
326
332
  query: GetItemsAtQuery;
327
333
  result: GetItemsAtResult;
328
334
  };
335
+ [CommandName.GetLLMContextFromItems]: {
336
+ query: GetLLMContextFromItemsQuery;
337
+ result: GetLLMContextFromItemsResult;
338
+ };
329
339
  [CommandName.GetOAuthToken]: {
330
340
  query: GetOAuthTokenQuery;
331
341
  result: GetOAuthTokenResult;
@@ -952,6 +962,11 @@ export type FindAvailableSpaceResult = {
952
962
  /** Origin of the rectangle of empty space */
953
963
  'y': number;
954
964
  };
965
+ export type FireBeaconEventQuery = {
966
+ /** the beacon event to be sent */
967
+ 'e': string;
968
+ };
969
+ export type FireBeaconEventResult = void;
955
970
  export type AnimateViewportQuery = {
956
971
  /** ID of the page to view */
957
972
  'p': string;
@@ -1013,6 +1028,17 @@ export type GetItemsAtQuery = {
1013
1028
  };
1014
1029
  /** IDs of the items found */
1015
1030
  export type GetItemsAtResult = string[];
1031
+ export type GetLLMContextFromItemsQuery = {
1032
+ /** Page ID to find closely-related items */
1033
+ 'p': string;
1034
+ /** List of item IDs to return LLM-readable context for */
1035
+ 'i': string[];
1036
+ };
1037
+ /**
1038
+ * A string in a format that LLMs like ChatGPT can easily understand, representing the content
1039
+ * of the items specified as well as their immediate context if necessary
1040
+ */
1041
+ export type GetLLMContextFromItemsResult = string;
1016
1042
  export type GetReferenceKeyQuery = {
1017
1043
  /** ID of the LucidElement to read a reference key from, or undefined to read from the LucidDocument */
1018
1044
  'id'?: string | undefined;
package/commandtypes.js CHANGED
@@ -34,6 +34,7 @@ exports.commandTitles = new Map([
34
34
  ["ee" /* CommandName.ElementExists */, 'ElementExists'],
35
35
  ["ef" /* CommandName.ExecuteFormula */, 'ExecuteFormula'],
36
36
  ["fas" /* CommandName.FindAvailableSpace */, 'FindAvailableSpace'],
37
+ ["fbe" /* CommandName.FireBeaconEvent */, 'FireBeaconEvent'],
37
38
  ["goci" /* CommandName.GetOAuthClientId */, 'GetOAuthClientId'],
38
39
  ["gcl" /* CommandName.GetConnectedLines */, 'GetConnectedLines'],
39
40
  ["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
@@ -45,6 +46,7 @@ exports.commandTitles = new Map([
45
46
  ["gec" /* CommandName.GetEnvironmentConfig */, 'GetEnvironmentConfig'],
46
47
  ["gip" /* CommandName.GetItemPageId */, 'GetItemPageId'],
47
48
  ["gia" /* CommandName.GetItemsAt */, 'GetItemsAt'],
49
+ ["llm" /* CommandName.GetLLMContextFromItems */, 'GetLLMContextFromItems'],
48
50
  ["got" /* CommandName.GetOAuthToken */, 'GetOAuthToken'],
49
51
  ["gps" /* CommandName.GetPackageSettings */, 'GetPackageSettings'],
50
52
  ["gpr" /* CommandName.GetProduct */, 'GetProduct'],
@@ -7,6 +7,7 @@ import { RuleProxy } from './documentelement/ruleproxy';
7
7
  import { ElementProxy } from './elementproxy';
8
8
  import { GroupProxy } from './groupproxy';
9
9
  import { ImageDefinition } from './imagedefinition';
10
+ import { ItemProxy } from './itemproxy';
10
11
  import { LineDefinition } from './linedefinition';
11
12
  import { LineProxy } from './lineproxy';
12
13
  import { MapProxy } from './mapproxy';
@@ -107,4 +108,10 @@ export declare class PageProxy extends ElementProxy {
107
108
  * @param links links to be imported onto the canvas as link unfurl blocks
108
109
  */
109
110
  importLinks(links: string[]): Promise<void>;
111
+ /**
112
+ * @param items
113
+ * @returns A string representing the content of the items provided, including immediate surrounding context if
114
+ * necessary, in a format that is easily understandable by LLMs like ChatGPT.
115
+ */
116
+ getLLMContextForItems(items: ItemProxy[]): string;
110
117
  }
@@ -162,5 +162,18 @@ class PageProxy extends elementproxy_1.ElementProxy {
162
162
  async importLinks(links) {
163
163
  return await this.client.sendCommand("il" /* CommandName.ImportLinks */, { 'p': this.id, 'l': links });
164
164
  }
165
+ /**
166
+ * @param items
167
+ * @returns A string representing the content of the items provided, including immediate surrounding context if
168
+ * necessary, in a format that is easily understandable by LLMs like ChatGPT.
169
+ */
170
+ getLLMContextForItems(items) {
171
+ //We don't check that the items are on this page here; that is done in the implementation
172
+ //of the API command. It would be a lot of extra API calls for no benefit.
173
+ return this.client.sendCommand("llm" /* CommandName.GetLLMContextFromItems */, {
174
+ 'p': this.id,
175
+ 'i': items.map((item) => item.id),
176
+ });
177
+ }
165
178
  }
166
179
  exports.PageProxy = PageProxy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.202",
3
+ "version": "0.0.204",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",