replicas-engine 0.1.624 → 0.1.626

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/src/index.js CHANGED
@@ -2101,6 +2101,8 @@ Use this when:
2101
2101
  - The user asks for ClickHouse analytics or PostHog product data
2102
2102
  - The user asks to invoke a connected Modal function
2103
2103
  - The user asks to query or update a connected turbopuffer namespace
2104
+ - The user asks for PlanetScale organizations, databases, branches, or Insights data
2105
+ - The user asks to analyze text with Pangram
2104
2106
  - The user asks for Stripe customers, payments, invoices, subscriptions, or balances`;
2105
2107
  var REFERENCE9 = `# Plugins
2106
2108
 
@@ -2155,6 +2157,17 @@ const results = await Promise.all(customerIds.map((customer) =>
2155
2157
 
2156
2158
  Never attempt to import Composio, create a session, manage a connection, or call a provider with raw credentials. Those operations are intentionally unavailable inside the workspace.
2157
2159
 
2160
+ ## PlanetScale
2161
+
2162
+ PlanetScale is a native OAuth integration. Pass a relative path from the PlanetScale v1 API; Replicas refreshes access tokens server-side:
2163
+
2164
+ \`\`\`ts
2165
+ const organizations = await replicas.planetscale.request('/organizations');
2166
+ const databases = await replicas.planetscale.request('/organizations/acme/databases');
2167
+ \`\`\`
2168
+
2169
+ OAuth scopes control permitted operations. Confirm mutations before using POST, PUT, PATCH, or DELETE.
2170
+
2158
2171
  ## Modal
2159
2172
 
2160
2173
  Modal is a native integration and uses its official JavaScript SDK behind the Replicas gateway. Invoke a deployed function by name:
@@ -2183,6 +2196,17 @@ const results = await replicas.turbopuffer.query('products', {
2183
2196
  \`\`\`
2184
2197
 
2185
2198
  \`write\` mutates namespace data. Confirm the requested change before calling it.
2199
+
2200
+ ## Pangram
2201
+
2202
+ Pangram is a native integration. Text sent to either method is processed by Pangram and consumes the connected account's credits:
2203
+
2204
+ \`\`\`ts
2205
+ const detection = await replicas.pangram.detect({ text });
2206
+ const plagiarism = await replicas.pangram.plagiarism(text);
2207
+ \`\`\`
2208
+
2209
+ Do not send private or sensitive text without the user's authorization.
2186
2210
  `;
2187
2211
  var PLUGINS_ABILITY = {
2188
2212
  label: "Plugins",
@@ -10948,7 +10972,7 @@ var DEFAULT_CODEX_ARGS = [
10948
10972
  var MIN_CODEX_CLI_VERSION = "0.144.6";
10949
10973
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
10950
10974
  var codexCliVersionEnsured = null;
10951
- var ENGINE_PACKAGE_VERSION = "0.1.624";
10975
+ var ENGINE_PACKAGE_VERSION = "0.1.626";
10952
10976
  var INITIALIZE_METHOD = "initialize";
10953
10977
  var INITIALIZED_NOTIFICATION = "initialized";
10954
10978
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.624",
3
+ "version": "0.1.626",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -45,6 +45,20 @@ function providerPath(path) {
45
45
  return path;
46
46
  }
47
47
 
48
+ function providerClient(endpoint, extraOptions = () => ({})) {
49
+ return {
50
+ request: (path, options = {}) => request(endpoint, {
51
+ method: 'POST',
52
+ body: {
53
+ path: providerPath(path),
54
+ method: options.method,
55
+ body: options.body,
56
+ ...extraOptions(options),
57
+ },
58
+ }),
59
+ };
60
+ }
61
+
48
62
  const integrations = {
49
63
  list: () => request('/v1/engine/integrations'),
50
64
  };
@@ -79,26 +93,9 @@ const slack = {
79
93
  }),
80
94
  };
81
95
 
82
- const github = {
83
- request: (path, options = {}) =>
84
- request('/v1/engine/github/api', {
85
- method: 'POST',
86
- body: { path: providerPath(path), method: options.method, body: options.body },
87
- }),
88
- };
96
+ const github = providerClient('/v1/engine/github/api');
89
97
 
90
- const gitlab = {
91
- request: (path, options = {}) =>
92
- request('/v1/engine/gitlab/api', {
93
- method: 'POST',
94
- body: {
95
- path: providerPath(path),
96
- method: options.method,
97
- body: options.body,
98
- host: options.host,
99
- },
100
- }),
101
- };
98
+ const gitlab = providerClient('/v1/engine/gitlab/api', (options) => ({ host: options.host }));
102
99
 
103
100
  const sentry = {
104
101
  request: (path) => request('/v1/engine/sentry/api', { method: 'POST', body: { path } }),
@@ -117,5 +114,14 @@ const turbopuffer = {
117
114
  write: (namespace, params) => turbopufferRequest('write', namespace, params),
118
115
  };
119
116
 
120
- export const replicas = { integrations, plugins, linear, slack, github, gitlab, sentry, modal, turbopuffer };
117
+ const planetscale = providerClient('/v1/engine/planetscale/api');
118
+
119
+ const pangramRequest = (operation, input) =>
120
+ request('/v1/engine/pangram', { method: 'POST', body: { operation, ...input } });
121
+ const pangram = {
122
+ detect: (input) => pangramRequest('detect', input),
123
+ plagiarism: (text) => pangramRequest('plagiarism', { text }),
124
+ };
125
+
126
+ export const replicas = { integrations, plugins, linear, slack, github, gitlab, sentry, modal, pangram, planetscale, turbopuffer };
121
127
  export default replicas;
@@ -137,4 +137,50 @@ describe('@replicas/sdk', () => {
137
137
  server.stop(true);
138
138
  }
139
139
  });
140
+
141
+ test('calls PlanetScale through the workspace gateway', async () => {
142
+ let observed: { path: string; body: unknown } | null = null;
143
+ const server = Bun.serve({
144
+ port: 0,
145
+ async fetch(request) {
146
+ observed = { path: new URL(request.url).pathname, body: await request.json() };
147
+ return Response.json({ data: [] });
148
+ },
149
+ });
150
+ process.env.REPLICAS_MONOLITH_URL = server.url.toString().replace(/\/$/, '');
151
+ process.env.REPLICAS_ENGINE_SECRET = 'engine-secret';
152
+ process.env.REPLICAS_WORKSPACE_ID = 'workspace-1';
153
+ try {
154
+ await replicas.planetscale.request('/organizations');
155
+ expect(observed).toEqual({
156
+ path: '/v1/engine/planetscale/api',
157
+ body: { path: '/organizations' },
158
+ });
159
+ } finally {
160
+ server.stop(true);
161
+ }
162
+ });
140
163
  });
164
+
165
+ test('analyzes text with Pangram through the workspace gateway', async () => {
166
+ let observed: { path: string; body: unknown } | null = null;
167
+ const server = Bun.serve({
168
+ port: 0,
169
+ async fetch(request) {
170
+ observed = { path: new URL(request.url).pathname, body: await request.json() };
171
+ return Response.json({ prediction_short: 'Human' });
172
+ },
173
+ });
174
+ process.env.REPLICAS_MONOLITH_URL = server.url.toString().replace(/\/$/, '');
175
+ process.env.REPLICAS_ENGINE_SECRET = 'engine-secret';
176
+ process.env.REPLICAS_WORKSPACE_ID = 'workspace-1';
177
+ try {
178
+ await replicas.pangram.detect({ text: 'Example text' });
179
+ expect(observed).toEqual({
180
+ path: '/v1/engine/pangram',
181
+ body: { operation: 'detect', text: 'Example text' },
182
+ });
183
+ } finally {
184
+ server.stop(true);
185
+ }
186
+ });
@@ -91,6 +91,14 @@ export declare const PLUGIN_CATALOG: readonly [{
91
91
  readonly category: "data";
92
92
  readonly name: "PostHog";
93
93
  readonly description: "Manage projects, events, insights, dashboards, flags, and recordings.";
94
+ }, {
95
+ readonly id: "planetscale";
96
+ readonly toolkit: "planetscale";
97
+ readonly source: "native";
98
+ readonly authType: "oauth";
99
+ readonly category: "data";
100
+ readonly name: "PlanetScale";
101
+ readonly description: "Manage organizations, databases, branches, deploy requests, and Insights.";
94
102
  }, {
95
103
  readonly id: "stripe";
96
104
  readonly toolkit: "stripe";
@@ -98,6 +106,13 @@ export declare const PLUGIN_CATALOG: readonly [{
98
106
  readonly category: "business";
99
107
  readonly name: "Stripe";
100
108
  readonly description: "Manage customers, payments, invoices, subscriptions, and balances.";
109
+ }, {
110
+ readonly id: "pangram";
111
+ readonly toolkit: "pangram";
112
+ readonly authType: "api_key";
113
+ readonly category: "data";
114
+ readonly name: "Pangram";
115
+ readonly description: "Analyze text for AI generation and plagiarism signals.";
101
116
  }, {
102
117
  readonly id: "vercel";
103
118
  readonly toolkit: "vercel";
@@ -114,6 +129,10 @@ export declare const PLUGIN_CATALOG: readonly [{
114
129
  readonly description: "Query and manage turbopuffer namespaces.";
115
130
  }];
116
131
  export type PluginId = (typeof PLUGIN_CATALOG)[number]['id'];
132
+ export type NativePluginId = Extract<(typeof PLUGIN_CATALOG)[number], {
133
+ source: 'native';
134
+ }>['id'];
135
+ export type ComposioPluginId = Exclude<PluginId, NativePluginId>;
117
136
  export type PluginScope = 'organization' | 'personal';
118
137
  export type PluginAuthType = (typeof PLUGIN_CATALOG)[number]['authType'];
119
138
  export type PluginCategory = (typeof PLUGIN_CATALOG)[number]['category'];
@@ -126,6 +145,7 @@ export interface PluginCatalogItem {
126
145
  category: PluginCategory;
127
146
  name: string;
128
147
  description: string;
148
+ source?: 'native';
129
149
  }
130
150
  export interface PluginConnectionSummary {
131
151
  id: string;
@@ -188,6 +208,10 @@ export interface PluginConnectResponse {
188
208
  export interface PluginConnectionDeleteResponse {
189
209
  success: boolean;
190
210
  }
211
+ export interface PangramAnalyzeRequest {
212
+ text: string;
213
+ publicDashboardLink?: boolean;
214
+ }
191
215
  export interface WorkspacePluginSummary extends PluginCatalogItem {
192
216
  connected: boolean;
193
217
  scope?: PluginScope;
@@ -199,7 +223,7 @@ export interface WorkspaceIntegrationsResponse {
199
223
  native: WorkspaceNativeIntegrationStatus;
200
224
  }
201
225
  export interface PluginSearchRequest {
202
- plugin: PluginId;
226
+ plugin: ComposioPluginId;
203
227
  query: string;
204
228
  }
205
229
  export interface PluginToolSchema {
@@ -213,14 +237,14 @@ export interface PluginSearchResponse {
213
237
  tools: PluginToolSchema[];
214
238
  }
215
239
  export interface PluginDescribeRequest {
216
- plugin: PluginId;
240
+ plugin: ComposioPluginId;
217
241
  tools: string[];
218
242
  }
219
243
  export interface PluginDescribeResponse {
220
244
  tools: PluginToolSchema[];
221
245
  }
222
246
  export interface PluginExecuteRequest {
223
- plugin: PluginId;
247
+ plugin: ComposioPluginId;
224
248
  tool: string;
225
249
  arguments?: Record<string, unknown>;
226
250
  }
@@ -229,4 +253,5 @@ export interface PluginExecuteResponse {
229
253
  logId: string;
230
254
  }
231
255
  export declare function isPluginId(value: string): value is PluginId;
256
+ export declare function isComposioPluginId(value: string): value is ComposioPluginId;
232
257
  export declare function isPluginConnectionStatus(value: string): value is PluginConnectionStatus;
@@ -57,4 +57,11 @@ export interface ReplicasSdk {
57
57
  query<T = unknown>(namespace: string, params: Record<string, unknown>): Promise<T>;
58
58
  write<T = unknown>(namespace: string, params: Record<string, unknown>): Promise<T>;
59
59
  };
60
+ planetscale: {
61
+ request<T = unknown>(path: string, options?: ProviderRequestOptions): Promise<T>;
62
+ };
63
+ pangram: {
64
+ detect<T = unknown>(input: import('./routes/plugins').PangramAnalyzeRequest): Promise<T>;
65
+ plagiarism<T = unknown>(text: string): Promise<T>;
66
+ };
60
67
  }