@ashdev/codex-plugin-sdk 1.9.3 → 1.10.1
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/README.md +0 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +87 -11
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +296 -260
- package/dist/server.js.map +1 -1
- package/dist/storage.d.ts +148 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +196 -0
- package/dist/storage.js.map +1 -0
- package/dist/types/capabilities.d.ts +85 -15
- package/dist/types/capabilities.d.ts.map +1 -1
- package/dist/types/capabilities.js +2 -3
- package/dist/types/capabilities.js.map +1 -1
- package/dist/types/index.d.ts +6 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/manifest.d.ts +60 -13
- package/dist/types/manifest.d.ts.map +1 -1
- package/dist/types/manifest.js +10 -0
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/protocol.d.ts +22 -0
- package/dist/types/protocol.d.ts.map +1 -1
- package/dist/types/recommendations.d.ts +133 -0
- package/dist/types/recommendations.d.ts.map +1 -0
- package/dist/types/recommendations.js +20 -0
- package/dist/types/recommendations.js.map +1 -0
- package/dist/types/sync.d.ts +175 -0
- package/dist/types/sync.d.ts.map +1 -0
- package/dist/types/sync.js +26 -0
- package/dist/types/sync.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
*/
|
|
55
55
|
export { ApiError, AuthError, ConfigError, NotFoundError, PluginError, RateLimitError, } from "./errors.js";
|
|
56
56
|
export { createLogger, Logger, type LoggerOptions, type LogLevel } from "./logger.js";
|
|
57
|
-
export { createMetadataPlugin,
|
|
57
|
+
export { createMetadataPlugin, createRecommendationPlugin, createSyncPlugin, type InitializeParams, type MetadataPluginOptions, type RecommendationPluginOptions, type SyncPluginOptions, } from "./server.js";
|
|
58
|
+
export { PluginStorage, type StorageClearResponse, type StorageDeleteResponse, StorageError, type StorageGetResponse, type StorageKeyEntry, type StorageListResponse, type StorageSetResponse, } from "./storage.js";
|
|
58
59
|
export * from "./types/index.js";
|
|
59
60
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGtF,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,cAAc,CAAC;AAGtB,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -57,11 +57,9 @@ export { ApiError, AuthError, ConfigError, NotFoundError, PluginError, RateLimit
|
|
|
57
57
|
// Logger
|
|
58
58
|
export { createLogger, Logger } from "./logger.js";
|
|
59
59
|
// Server
|
|
60
|
-
export {
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
//
|
|
64
|
-
createSeriesMetadataPlugin, } from "./server.js";
|
|
65
|
-
// Types
|
|
60
|
+
export { createMetadataPlugin, createRecommendationPlugin, createSyncPlugin, } from "./server.js";
|
|
61
|
+
// Storage
|
|
62
|
+
export { PluginStorage, StorageError, } from "./storage.js";
|
|
63
|
+
// Types (all types re-exported from barrel)
|
|
66
64
|
export * from "./types/index.js";
|
|
67
65
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,SAAS;AACT,OAAO,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,SAAS;AACT,OAAO,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,aAAa,CAAC;AAEtF,SAAS;AACT,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,GAKjB,MAAM,aAAa,CAAC;AAErB,UAAU;AACV,OAAO,EACL,aAAa,EAGb,YAAY,GAKb,MAAM,cAAc,CAAC;AAEtB,4CAA4C;AAC5C,cAAc,kBAAkB,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Plugin server - handles JSON-RPC communication over stdio
|
|
3
|
+
*
|
|
4
|
+
* Provides factory functions for creating different plugin types.
|
|
5
|
+
* All plugin types share a common base server that handles:
|
|
6
|
+
* - stdin readline parsing
|
|
7
|
+
* - JSON-RPC error handling
|
|
8
|
+
* - initialize/ping/shutdown lifecycle methods
|
|
9
|
+
*
|
|
10
|
+
* Each plugin type adds its own method routing on top.
|
|
3
11
|
*/
|
|
4
|
-
import
|
|
12
|
+
import { PluginStorage } from "./storage.js";
|
|
13
|
+
import type { BookMetadataProvider, MetadataContentType, MetadataProvider, RecommendationProvider, SyncProvider } from "./types/capabilities.js";
|
|
5
14
|
import type { PluginManifest } from "./types/manifest.js";
|
|
6
15
|
/**
|
|
7
16
|
* Initialize parameters received from Codex
|
|
8
17
|
*/
|
|
9
18
|
export interface InitializeParams {
|
|
10
|
-
/**
|
|
11
|
-
|
|
19
|
+
/** Admin-level plugin configuration (from plugin settings) */
|
|
20
|
+
adminConfig?: Record<string, unknown>;
|
|
21
|
+
/** Per-user plugin configuration (from user plugin settings) */
|
|
22
|
+
userConfig?: Record<string, unknown>;
|
|
12
23
|
/** Plugin credentials (API keys, tokens, etc.) */
|
|
13
24
|
credentials?: Record<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* Per-user key-value storage client.
|
|
27
|
+
*
|
|
28
|
+
* Use this to persist data across plugin restarts (e.g., dismissed IDs,
|
|
29
|
+
* cached profiles, user preferences). Storage is scoped per user-plugin
|
|
30
|
+
* instance — the host resolves the user context automatically.
|
|
31
|
+
*/
|
|
32
|
+
storage: PluginStorage;
|
|
14
33
|
}
|
|
15
34
|
/**
|
|
16
35
|
* Options for creating a metadata plugin
|
|
@@ -82,24 +101,81 @@ export interface MetadataPluginOptions {
|
|
|
82
101
|
*/
|
|
83
102
|
export declare function createMetadataPlugin(options: MetadataPluginOptions): void;
|
|
84
103
|
/**
|
|
85
|
-
*
|
|
104
|
+
* Options for creating a sync provider plugin
|
|
105
|
+
*/
|
|
106
|
+
export interface SyncPluginOptions {
|
|
107
|
+
/** Plugin manifest - must have capabilities.userReadSync: true */
|
|
108
|
+
manifest: PluginManifest & {
|
|
109
|
+
capabilities: {
|
|
110
|
+
userReadSync: true;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/** SyncProvider implementation */
|
|
114
|
+
provider: SyncProvider;
|
|
115
|
+
/** Called when plugin receives initialize with credentials/config */
|
|
116
|
+
onInitialize?: (params: InitializeParams) => void | Promise<void>;
|
|
117
|
+
/** Log level (default: "info") */
|
|
118
|
+
logLevel?: "debug" | "info" | "warn" | "error";
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create and run a sync provider plugin
|
|
122
|
+
*
|
|
123
|
+
* Creates a plugin server that handles JSON-RPC communication over stdio
|
|
124
|
+
* for sync operations (push/pull reading progress with external services).
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* import { createSyncPlugin, type SyncProvider } from "@ashdev/codex-plugin-sdk";
|
|
129
|
+
*
|
|
130
|
+
* const provider: SyncProvider = {
|
|
131
|
+
* async getUserInfo() {
|
|
132
|
+
* return { externalId: "123", username: "user" };
|
|
133
|
+
* },
|
|
134
|
+
* async pushProgress(params) {
|
|
135
|
+
* return { success: [], failed: [] };
|
|
136
|
+
* },
|
|
137
|
+
* async pullProgress(params) {
|
|
138
|
+
* return { entries: [], hasMore: false };
|
|
139
|
+
* },
|
|
140
|
+
* };
|
|
141
|
+
*
|
|
142
|
+
* createSyncPlugin({
|
|
143
|
+
* manifest: {
|
|
144
|
+
* name: "my-sync-plugin",
|
|
145
|
+
* displayName: "My Sync Plugin",
|
|
146
|
+
* version: "1.0.0",
|
|
147
|
+
* description: "Syncs reading progress",
|
|
148
|
+
* author: "Me",
|
|
149
|
+
* protocolVersion: "1.0",
|
|
150
|
+
* capabilities: { userReadSync: true },
|
|
151
|
+
* },
|
|
152
|
+
* provider,
|
|
153
|
+
* });
|
|
154
|
+
* ```
|
|
86
155
|
*/
|
|
87
|
-
export declare function
|
|
156
|
+
export declare function createSyncPlugin(options: SyncPluginOptions): void;
|
|
88
157
|
/**
|
|
89
|
-
*
|
|
158
|
+
* Options for creating a recommendation provider plugin
|
|
90
159
|
*/
|
|
91
|
-
export interface
|
|
92
|
-
/** Plugin manifest - must have capabilities.
|
|
160
|
+
export interface RecommendationPluginOptions {
|
|
161
|
+
/** Plugin manifest - must have capabilities.userRecommendationProvider: true */
|
|
93
162
|
manifest: PluginManifest & {
|
|
94
163
|
capabilities: {
|
|
95
|
-
|
|
164
|
+
userRecommendationProvider: true;
|
|
96
165
|
};
|
|
97
166
|
};
|
|
98
|
-
/**
|
|
99
|
-
provider:
|
|
167
|
+
/** RecommendationProvider implementation */
|
|
168
|
+
provider: RecommendationProvider;
|
|
100
169
|
/** Called when plugin receives initialize with credentials/config */
|
|
101
170
|
onInitialize?: (params: InitializeParams) => void | Promise<void>;
|
|
102
171
|
/** Log level (default: "info") */
|
|
103
172
|
logLevel?: "debug" | "info" | "warn" | "error";
|
|
104
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Create and run a recommendation provider plugin
|
|
176
|
+
*
|
|
177
|
+
* Creates a plugin server that handles JSON-RPC communication over stdio
|
|
178
|
+
* for recommendation operations (get recommendations, update profile, dismiss).
|
|
179
|
+
*/
|
|
180
|
+
export declare function createRecommendationPlugin(options: RecommendationPluginOptions): void;
|
|
105
181
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA0H1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC;;;;;;OAMG;IACH,OAAO,EAAE,aAAa,CAAC;CACxB;AAkOD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mFAAmF;IACnF,QAAQ,EAAE,cAAc,GAAG;QACzB,YAAY,EAAE;YAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAA;SAAE,CAAC;KAC3D,CAAC;IACF,wFAAwF;IACxF,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,oFAAoF;IACpF,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,kCA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