runline 0.11.2 → 0.11.4

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.
Files changed (31) hide show
  1. package/dist/plugin/loader.js +5 -0
  2. package/dist/plugins/googleDocs/src/documents.js +91 -0
  3. package/dist/plugins/googleDocs/src/formatting.js +126 -0
  4. package/dist/plugins/googleDocs/src/images.js +66 -0
  5. package/dist/plugins/googleDocs/src/index.js +45 -1008
  6. package/dist/plugins/googleDocs/src/shared.js +110 -0
  7. package/dist/plugins/googleDocs/src/structure.js +392 -0
  8. package/dist/plugins/googleDocs/src/tables.js +390 -0
  9. package/dist/plugins/googleDocs/src/tabs.js +77 -0
  10. package/dist/plugins/googleDocs/src/text.js +313 -0
  11. package/dist/plugins/linear/src/attachments.js +36 -12
  12. package/dist/plugins/linear/src/comments.js +20 -8
  13. package/dist/plugins/linear/src/cycles.js +22 -8
  14. package/dist/plugins/linear/src/initiatives.js +59 -19
  15. package/dist/plugins/linear/src/issues.js +123 -41
  16. package/dist/plugins/linear/src/labels.js +31 -11
  17. package/dist/plugins/linear/src/organization.js +1 -1
  18. package/dist/plugins/linear/src/projects.js +171 -57
  19. package/dist/plugins/linear/src/shared.js +16 -5
  20. package/dist/plugins/linear/src/states.js +14 -6
  21. package/dist/plugins/linear/src/teams.js +35 -12
  22. package/dist/plugins/linear/src/users.js +7 -3
  23. package/dist/plugins/linear/src/views.js +29 -10
  24. package/dist/plugins/linear/src/webhooks.js +39 -13
  25. package/dist/plugins/salesforce/src/index.js +33 -219
  26. package/dist/plugins/salesforce/src/metadata.js +50 -0
  27. package/dist/plugins/salesforce/src/query.js +52 -0
  28. package/dist/plugins/salesforce/src/queryResult.js +4 -0
  29. package/dist/plugins/salesforce/src/shared.js +122 -0
  30. package/dist/plugins/salesforce/src/sobjects.js +152 -0
  31. package/package.json +1 -1
@@ -55,6 +55,9 @@ export async function loadPluginFromPath(path) {
55
55
  : mod;
56
56
  return resolvePluginExport(pluginExport, pluginId);
57
57
  }
58
+ function isPrivatePluginDirectory(entry) {
59
+ return entry.startsWith("_") || entry.startsWith(".");
60
+ }
58
61
  async function loadFromDirectory(dir) {
59
62
  const plugins = [];
60
63
  if (!existsSync(dir))
@@ -75,6 +78,8 @@ async function loadFromDirectory(dir) {
75
78
  }
76
79
  }
77
80
  else if (stat.isDirectory()) {
81
+ if (isPrivatePluginDirectory(entry))
82
+ continue;
78
83
  const candidates = [
79
84
  join(fullPath, "index.ts"),
80
85
  join(fullPath, "index.js"),
@@ -0,0 +1,91 @@
1
+ import { DRIVE_BASE, docsRequest, extractDocumentId, flattenBodyText, } from "./shared.js";
2
+ export function registerDocumentsActions(rl) {
3
+ rl.registerAction("document.create", {
4
+ description: "Create a new Google Doc, optionally in a specific Drive folder (goes through the Drive API; needs drive.file scope).",
5
+ inputSchema: {
6
+ title: { type: "string", required: true },
7
+ folderId: {
8
+ type: "string",
9
+ required: false,
10
+ description: "Parent folder in Drive. Omit to place in My Drive root.",
11
+ },
12
+ },
13
+ async execute(input, ctx) {
14
+ const p = (input ?? {});
15
+ const body = {
16
+ name: p.title,
17
+ mimeType: "application/vnd.google-apps.document",
18
+ };
19
+ if (p.folderId) {
20
+ body.parents = [p.folderId];
21
+ }
22
+ return docsRequest(ctx, "POST", "/files", body, undefined, DRIVE_BASE);
23
+ },
24
+ });
25
+ rl.registerAction("document.createBlank", {
26
+ description: "Create a blank Google Doc through the native Docs API. Use document.create when you need Drive folder placement.",
27
+ inputSchema: {
28
+ title: { type: "string", required: true },
29
+ },
30
+ async execute(input, ctx) {
31
+ const p = (input ?? {});
32
+ return docsRequest(ctx, "POST", "/documents", { title: p.title });
33
+ },
34
+ });
35
+ rl.registerAction("document.get", {
36
+ description: "Get a document. Accepts a bare ID or a docs.google.com URL. `simple=true` collapses the body to plain text.",
37
+ inputSchema: {
38
+ document: {
39
+ type: "string",
40
+ required: true,
41
+ description: "Document ID or URL",
42
+ },
43
+ simple: { type: "boolean", required: false },
44
+ suggestionsViewMode: {
45
+ type: "string",
46
+ required: false,
47
+ description: "DEFAULT_FOR_CURRENT_ACCESS | SUGGESTIONS_INLINE | PREVIEW_SUGGESTIONS_ACCEPTED | PREVIEW_WITHOUT_SUGGESTIONS",
48
+ },
49
+ includeTabsContent: {
50
+ type: "boolean",
51
+ required: false,
52
+ description: "Return content for all tabs in document.tabs instead of only first-tab legacy fields.",
53
+ },
54
+ },
55
+ async execute(input, ctx) {
56
+ const p = (input ?? {});
57
+ const documentId = extractDocumentId(p.document);
58
+ const qs = {};
59
+ if (p.suggestionsViewMode)
60
+ qs.suggestionsViewMode = p.suggestionsViewMode;
61
+ if (p.includeTabsContent !== undefined)
62
+ qs.includeTabsContent = p.includeTabsContent;
63
+ const res = (await docsRequest(ctx, "GET", `/documents/${documentId}`, undefined, qs));
64
+ if (!p.simple)
65
+ return res;
66
+ return { documentId, content: flattenBodyText(res.body) };
67
+ },
68
+ });
69
+ rl.registerAction("document.batchUpdate", {
70
+ description: "Raw passthrough to documents.batchUpdate — pass a full `requests` array for atomic multi-edit operations.",
71
+ inputSchema: {
72
+ document: { type: "string", required: true },
73
+ requests: { type: "array", required: true },
74
+ writeControl: {
75
+ type: "object",
76
+ required: false,
77
+ description: "{requiredRevisionId} | {targetRevisionId}",
78
+ },
79
+ },
80
+ async execute(input, ctx) {
81
+ const p = (input ?? {});
82
+ const documentId = extractDocumentId(p.document);
83
+ const body = {
84
+ requests: p.requests,
85
+ };
86
+ if (p.writeControl)
87
+ body.writeControl = p.writeControl;
88
+ return docsRequest(ctx, "POST", `/documents/${documentId}:batchUpdate`, body);
89
+ },
90
+ });
91
+ }
@@ -0,0 +1,126 @@
1
+ import { compact, extractDocumentId, runBatchUpdate } from "./shared.js";
2
+ export function registerFormattingActions(rl) {
3
+ rl.registerAction("document.updateParagraphStyle", {
4
+ description: "Apply paragraph styling (alignment, named style, indents, spacing, direction) to the paragraphs intersecting the range.",
5
+ inputSchema: {
6
+ document: { type: "string", required: true },
7
+ startIndex: { type: "number", required: true },
8
+ endIndex: { type: "number", required: true },
9
+ alignment: {
10
+ type: "string",
11
+ required: false,
12
+ description: "START | CENTER | END | JUSTIFIED",
13
+ },
14
+ namedStyleType: {
15
+ type: "string",
16
+ required: false,
17
+ description: "NORMAL_TEXT | TITLE | SUBTITLE | HEADING_1 .. HEADING_6",
18
+ },
19
+ direction: {
20
+ type: "string",
21
+ required: false,
22
+ description: "LEFT_TO_RIGHT | RIGHT_TO_LEFT",
23
+ },
24
+ indentFirstLinePt: { type: "number", required: false },
25
+ indentStartPt: { type: "number", required: false },
26
+ indentEndPt: { type: "number", required: false },
27
+ spaceAbovePt: { type: "number", required: false },
28
+ spaceBelowPt: { type: "number", required: false },
29
+ lineSpacing: {
30
+ type: "number",
31
+ required: false,
32
+ description: "Percentage; 100 = single, 150 = 1.5x.",
33
+ },
34
+ segmentId: { type: "string", required: false },
35
+ tabId: { type: "string", required: false },
36
+ },
37
+ async execute(input, ctx) {
38
+ const p = (input ?? {});
39
+ const documentId = extractDocumentId(p.document);
40
+ const ps = {};
41
+ const fields = [];
42
+ const pt = (n) => ({ magnitude: n, unit: "PT" });
43
+ if (p.alignment) {
44
+ ps.alignment = p.alignment;
45
+ fields.push("alignment");
46
+ }
47
+ if (p.namedStyleType) {
48
+ ps.namedStyleType = p.namedStyleType;
49
+ fields.push("namedStyleType");
50
+ }
51
+ if (p.direction) {
52
+ ps.direction = p.direction;
53
+ fields.push("direction");
54
+ }
55
+ if (p.indentFirstLinePt !== undefined) {
56
+ ps.indentFirstLine = pt(p.indentFirstLinePt);
57
+ fields.push("indentFirstLine");
58
+ }
59
+ if (p.indentStartPt !== undefined) {
60
+ ps.indentStart = pt(p.indentStartPt);
61
+ fields.push("indentStart");
62
+ }
63
+ if (p.indentEndPt !== undefined) {
64
+ ps.indentEnd = pt(p.indentEndPt);
65
+ fields.push("indentEnd");
66
+ }
67
+ if (p.spaceAbovePt !== undefined) {
68
+ ps.spaceAbove = pt(p.spaceAbovePt);
69
+ fields.push("spaceAbove");
70
+ }
71
+ if (p.spaceBelowPt !== undefined) {
72
+ ps.spaceBelow = pt(p.spaceBelowPt);
73
+ fields.push("spaceBelow");
74
+ }
75
+ if (p.lineSpacing !== undefined) {
76
+ ps.lineSpacing = p.lineSpacing;
77
+ fields.push("lineSpacing");
78
+ }
79
+ if (fields.length === 0) {
80
+ throw new Error("googleDocs.document.updateParagraphStyle: at least one property required");
81
+ }
82
+ return runBatchUpdate(ctx, documentId, [
83
+ {
84
+ updateParagraphStyle: {
85
+ range: compact({
86
+ startIndex: p.startIndex,
87
+ endIndex: p.endIndex,
88
+ segmentId: p.segmentId,
89
+ tabId: p.tabId,
90
+ }),
91
+ paragraphStyle: ps,
92
+ fields: fields.join(","),
93
+ },
94
+ },
95
+ ]);
96
+ },
97
+ });
98
+ rl.registerAction("document.updateNamedStyle", {
99
+ description: "Update a named style such as NORMAL_TEXT, TITLE, or HEADING_1 using a Docs API NamedStyle object.",
100
+ inputSchema: {
101
+ document: { type: "string", required: true },
102
+ namedStyle: {
103
+ type: "object",
104
+ required: true,
105
+ description: "Docs API NamedStyle object. Must include namedStyleType.",
106
+ },
107
+ fields: {
108
+ type: "string",
109
+ required: true,
110
+ description: "Field mask such as textStyle.bold or paragraphStyle.alignment.",
111
+ },
112
+ tabId: { type: "string", required: false },
113
+ },
114
+ async execute(input, ctx) {
115
+ const p = (input ?? {});
116
+ const documentId = extractDocumentId(p.document);
117
+ return runBatchUpdate(ctx, documentId, {
118
+ updateNamedStyle: compact({
119
+ namedStyle: p.namedStyle,
120
+ fields: p.fields,
121
+ tabId: p.tabId,
122
+ }),
123
+ });
124
+ },
125
+ });
126
+ }
@@ -0,0 +1,66 @@
1
+ import { buildLocation, extractDocumentId, runBatchUpdate } from "./shared.js";
2
+ export function registerImagesActions(rl) {
3
+ rl.registerAction("document.insertInlineImage", {
4
+ description: "Insert an inline image at the given location. `uri` must point to a publicly fetchable image.",
5
+ inputSchema: {
6
+ document: { type: "string", required: true },
7
+ locationKind: {
8
+ type: "string",
9
+ required: false,
10
+ description: "location (default; requires index) | endOfSegmentLocation",
11
+ },
12
+ index: { type: "number", required: false },
13
+ uri: { type: "string", required: true },
14
+ widthPt: { type: "number", required: false },
15
+ heightPt: { type: "number", required: false },
16
+ segmentId: { type: "string", required: false },
17
+ tabId: { type: "string", required: false },
18
+ },
19
+ async execute(input, ctx) {
20
+ const p = (input ?? {});
21
+ const documentId = extractDocumentId(p.document);
22
+ const pt = (n) => ({ magnitude: n, unit: "PT" });
23
+ const kind = p.locationKind ?? "location";
24
+ const req = {
25
+ ...buildLocation(kind, p.segmentId, p.index, p.tabId),
26
+ uri: p.uri,
27
+ };
28
+ if (p.widthPt !== undefined || p.heightPt !== undefined) {
29
+ req.objectSize = {};
30
+ if (p.widthPt !== undefined)
31
+ req.objectSize.width = pt(p.widthPt);
32
+ if (p.heightPt !== undefined)
33
+ req.objectSize.height = pt(p.heightPt);
34
+ }
35
+ return runBatchUpdate(ctx, documentId, [{ insertInlineImage: req }]);
36
+ },
37
+ });
38
+ rl.registerAction("document.replaceImage", {
39
+ description: "Replace an existing image (identified by its inline-object id) with a new image from a publicly fetchable URI.",
40
+ inputSchema: {
41
+ document: { type: "string", required: true },
42
+ imageObjectId: { type: "string", required: true },
43
+ uri: { type: "string", required: true },
44
+ imageReplaceMethod: {
45
+ type: "string",
46
+ required: false,
47
+ description: "CENTER_CROP (default) | (others as Docs API adds them)",
48
+ },
49
+ tabId: { type: "string", required: false },
50
+ },
51
+ async execute(input, ctx) {
52
+ const p = (input ?? {});
53
+ const documentId = extractDocumentId(p.document);
54
+ return runBatchUpdate(ctx, documentId, [
55
+ {
56
+ replaceImage: {
57
+ imageObjectId: p.imageObjectId,
58
+ uri: p.uri,
59
+ imageReplaceMethod: p.imageReplaceMethod ?? "CENTER_CROP",
60
+ ...(p.tabId ? { tabId: p.tabId } : {}),
61
+ },
62
+ },
63
+ ]);
64
+ },
65
+ });
66
+ }