@plotday/twister 0.47.0 → 0.49.0
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/bin/commands/generate.js +5 -5
- package/bin/commands/generate.js.map +1 -1
- package/bin/templates/AGENTS.template.md +8 -2
- package/bin/utils/bundle.js +14 -0
- package/bin/utils/bundle.js.map +1 -1
- package/cli/templates/AGENTS.template.md +8 -2
- package/dist/connector.d.ts +67 -7
- package/dist/connector.d.ts.map +1 -1
- package/dist/connector.js +15 -5
- package/dist/connector.js.map +1 -1
- package/dist/docs/assets/hierarchy.js +1 -1
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/index.Connector.html +58 -49
- package/dist/docs/classes/index.Imap.html +1 -1
- package/dist/docs/classes/index.Options.html +1 -1
- package/dist/docs/classes/index.Smtp.html +1 -1
- package/dist/docs/classes/tools_ai.AI.html +1 -1
- package/dist/docs/classes/tools_callbacks.Callbacks.html +1 -1
- package/dist/docs/classes/tools_integrations.Integrations.html +21 -5
- package/dist/docs/classes/tools_network.Network.html +1 -1
- package/dist/docs/classes/tools_plot.Plot.html +1 -1
- package/dist/docs/classes/tools_store.Store.html +1 -1
- package/dist/docs/classes/tools_tasks.Tasks.html +1 -1
- package/dist/docs/classes/tools_twists.Twists.html +1 -1
- package/dist/docs/classes/twist.Twist.html +28 -28
- package/dist/docs/documents/Building_Connectors.html +8 -1
- package/dist/docs/documents/CLI_Reference.html +6 -4
- package/dist/docs/enums/tag.Tag.html +11 -1
- package/dist/docs/enums/tools_integrations.AuthProvider.html +14 -12
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/media/AGENTS.md +298 -775
- package/dist/docs/media/MULTI_USER_AUTH.md +6 -4
- package/dist/docs/media/SYNC_STRATEGIES.md +20 -14
- package/dist/docs/modules/index.html +1 -1
- package/dist/docs/types/index.CreateLinkDraft.html +7 -12
- package/dist/docs/types/index.NoteWriteBackResult.html +38 -0
- package/dist/docs/types/tools_integrations.ArchiveLinkFilter.html +5 -5
- package/dist/docs/types/tools_integrations.AuthToken.html +4 -4
- package/dist/docs/types/tools_integrations.Authorization.html +4 -4
- package/dist/llm-docs/connector.d.ts +1 -1
- package/dist/llm-docs/connector.d.ts.map +1 -1
- package/dist/llm-docs/connector.js +1 -1
- package/dist/llm-docs/connector.js.map +1 -1
- package/dist/llm-docs/tag.d.ts +1 -1
- package/dist/llm-docs/tag.d.ts.map +1 -1
- package/dist/llm-docs/tag.js +1 -1
- package/dist/llm-docs/tag.js.map +1 -1
- package/dist/llm-docs/tools/integrations.d.ts +1 -1
- package/dist/llm-docs/tools/integrations.d.ts.map +1 -1
- package/dist/llm-docs/tools/integrations.js +1 -1
- package/dist/llm-docs/tools/integrations.js.map +1 -1
- package/dist/llm-docs/twist-guide-template.d.ts +1 -1
- package/dist/llm-docs/twist-guide-template.d.ts.map +1 -1
- package/dist/llm-docs/twist-guide-template.js +1 -1
- package/dist/llm-docs/twist-guide-template.js.map +1 -1
- package/dist/llm-docs/twist.d.ts +1 -1
- package/dist/llm-docs/twist.d.ts.map +1 -1
- package/dist/llm-docs/twist.js +1 -1
- package/dist/llm-docs/twist.js.map +1 -1
- package/dist/tag.d.ts +11 -1
- package/dist/tag.d.ts.map +1 -1
- package/dist/tag.js +10 -0
- package/dist/tag.js.map +1 -1
- package/dist/tools/integrations.d.ts +25 -1
- package/dist/tools/integrations.d.ts.map +1 -1
- package/dist/tools/integrations.js +2 -0
- package/dist/tools/integrations.js.map +1 -1
- package/dist/twist-guide.d.ts +1 -1
- package/dist/twist-guide.d.ts.map +1 -1
- package/dist/twist.d.ts +2 -1
- package/dist/twist.d.ts.map +1 -1
- package/dist/twist.js.map +1 -1
- package/dist/utils/markdown.d.ts +27 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/markdown.js +82 -0
- package/dist/utils/markdown.js.map +1 -0
- package/package.json +7 -1
- package/src/connector.ts +427 -0
- package/src/creator-docs.ts +29 -0
- package/src/index.ts +10 -0
- package/src/llm-docs/connector.ts +8 -0
- package/src/llm-docs/index.ts +48 -0
- package/src/llm-docs/options.ts +8 -0
- package/src/llm-docs/plot.ts +8 -0
- package/src/llm-docs/schedule.ts +8 -0
- package/src/llm-docs/tag.ts +8 -0
- package/src/llm-docs/tool.ts +8 -0
- package/src/llm-docs/tools/ai.ts +8 -0
- package/src/llm-docs/tools/callbacks.ts +8 -0
- package/src/llm-docs/tools/imap.ts +8 -0
- package/src/llm-docs/tools/integrations.ts +8 -0
- package/src/llm-docs/tools/network.ts +8 -0
- package/src/llm-docs/tools/plot.ts +8 -0
- package/src/llm-docs/tools/smtp.ts +8 -0
- package/src/llm-docs/tools/store.ts +8 -0
- package/src/llm-docs/tools/tasks.ts +8 -0
- package/src/llm-docs/tools/twists.ts +8 -0
- package/src/llm-docs/twist-guide-template.ts +8 -0
- package/src/llm-docs/twist.ts +8 -0
- package/src/options.ts +115 -0
- package/src/plot.ts +1068 -0
- package/src/schedule.ts +203 -0
- package/src/tag.ts +54 -0
- package/src/tool.ts +377 -0
- package/src/tools/ai.ts +845 -0
- package/src/tools/callbacks.ts +134 -0
- package/src/tools/imap.ts +266 -0
- package/src/tools/index.ts +10 -0
- package/src/tools/integrations.ts +352 -0
- package/src/tools/network.ts +240 -0
- package/src/tools/plot.ts +692 -0
- package/src/tools/smtp.ts +166 -0
- package/src/tools/store.ts +149 -0
- package/src/tools/tasks.ts +137 -0
- package/src/tools/twists.ts +228 -0
- package/src/twist-guide.ts +9 -0
- package/src/twist.ts +436 -0
- package/src/utils/hash.ts +8 -0
- package/src/utils/markdown.ts +94 -0
- package/src/utils/serializable.ts +54 -0
- package/src/utils/types.ts +130 -0
- package/src/utils/uuid.ts +9 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal type utilities for SDK implementation.
|
|
3
|
+
*
|
|
4
|
+
* This file contains advanced TypeScript type utilities used internally
|
|
5
|
+
* by the SDK to provide type-safe APIs. Most developers don't need to
|
|
6
|
+
* reference these types directly - they work behind the scenes to power
|
|
7
|
+
* the Twist and Tool APIs.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
import type { Options, OptionsSchema, ResolvedOptions } from "../options";
|
|
12
|
+
import type { Callbacks } from "../tools/callbacks";
|
|
13
|
+
import type { Store } from "../tools/store";
|
|
14
|
+
import type { Tasks } from "../tools/tasks";
|
|
15
|
+
|
|
16
|
+
export type { Serializable } from "./serializable";
|
|
17
|
+
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Type utilities for twist.ts
|
|
20
|
+
// ============================================================================
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Unwraps Promise types to their resolved values.
|
|
24
|
+
* Converts { foo: Promise<string> } to { foo: string }
|
|
25
|
+
*/
|
|
26
|
+
export type PromiseValues<T> = {
|
|
27
|
+
[K in keyof T]: T[K] extends Promise<infer U> ? U : T[K];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Extracts the return type from an instance build method.
|
|
32
|
+
*/
|
|
33
|
+
export type ExtractBuildReturn<T> = T extends {
|
|
34
|
+
build: (...args: any[]) => infer R;
|
|
35
|
+
}
|
|
36
|
+
? R
|
|
37
|
+
: {};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Built-in tools available to all twists and tools.
|
|
41
|
+
*/
|
|
42
|
+
export type BuiltInTools = {
|
|
43
|
+
callbacks: Callbacks;
|
|
44
|
+
store: Store;
|
|
45
|
+
tasks: Tasks;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Infers the complete set of tools available to an twist or tool,
|
|
50
|
+
* combining tools declared in build with built-in tools.
|
|
51
|
+
*/
|
|
52
|
+
export type InferTools<T> = PromiseValues<ExtractBuildReturn<T>> & BuiltInTools;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Infers the options type from a constructor's second parameter.
|
|
56
|
+
*/
|
|
57
|
+
export type InferOptions<T> = T extends {
|
|
58
|
+
Options: infer O;
|
|
59
|
+
}
|
|
60
|
+
? O
|
|
61
|
+
: unknown;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Function type for building tool dependencies.
|
|
65
|
+
* Used in build methods to request tool instances.
|
|
66
|
+
*/
|
|
67
|
+
export type ToolBuilder = {
|
|
68
|
+
<T extends OptionsSchema>(
|
|
69
|
+
ToolClass: typeof Options,
|
|
70
|
+
schema: T
|
|
71
|
+
): Promise<ResolvedOptions<T>>;
|
|
72
|
+
<TC extends abstract new (...args: any) => any>(
|
|
73
|
+
ToolClass: TC,
|
|
74
|
+
options?: InferOptions<TC>
|
|
75
|
+
): Promise<InstanceType<TC>>;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Interface for managing tool initialization and lifecycle.
|
|
80
|
+
* Implemented by the twist runtime to provide tools to twists and tools.
|
|
81
|
+
*/
|
|
82
|
+
export interface ToolShed {
|
|
83
|
+
/**
|
|
84
|
+
* Build function for requesting tool dependencies
|
|
85
|
+
*/
|
|
86
|
+
build: ToolBuilder;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Whether tools are ready (all promises resolved)
|
|
90
|
+
*/
|
|
91
|
+
readonly ready: boolean;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Wait for all tool promises to resolve
|
|
95
|
+
*/
|
|
96
|
+
waitForReady(): Promise<void>;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get resolved tools (throws if not ready)
|
|
100
|
+
*/
|
|
101
|
+
getTools<T>(): T;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ============================================================================
|
|
105
|
+
// Type utilities for callbacks.ts
|
|
106
|
+
// ============================================================================
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Represents a valid JSON value.
|
|
110
|
+
*
|
|
111
|
+
* This type ensures type safety for data that needs to be serialized to JSON,
|
|
112
|
+
* such as metadata fields, webhook payloads, and stored data.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const meta: JSONValue = {
|
|
117
|
+
* name: "Example",
|
|
118
|
+
* count: 42,
|
|
119
|
+
* tags: ["foo", "bar"],
|
|
120
|
+
* nested: { value: true }
|
|
121
|
+
* };
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export type JSONValue =
|
|
125
|
+
| string
|
|
126
|
+
| number
|
|
127
|
+
| boolean
|
|
128
|
+
| null
|
|
129
|
+
| { [key: string]: JSONValue }
|
|
130
|
+
| JSONValue[];
|