replicas-engine 0.1.623 → 0.1.625

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
@@ -2100,6 +2100,8 @@ Use this when:
2100
2100
  - The user asks to read or change Google Ads, Docs, Drive, Search Console, or Sheets data
2101
2101
  - The user asks for ClickHouse analytics or PostHog product data
2102
2102
  - The user asks to invoke a connected Modal function
2103
+ - The user asks to query or update a connected turbopuffer namespace
2104
+ - The user asks to analyze text with Pangram
2103
2105
  - The user asks for Stripe customers, payments, invoices, subscriptions, or balances`;
2104
2106
  var REFERENCE9 = `# Plugins
2105
2107
 
@@ -2168,6 +2170,31 @@ const result = await replicas.modal.call({
2168
2170
  \`\`\`
2169
2171
 
2170
2172
  Function calls execute with the connected Modal token and may mutate external state. Confirm the requested action before invoking a function with side effects.
2173
+
2174
+ ## turbopuffer
2175
+
2176
+ turbopuffer is a native integration backed by its official TypeScript SDK. Use the provider-shaped helpers:
2177
+
2178
+ \`\`\`ts
2179
+ const namespaces = await replicas.turbopuffer.namespaces({ prefix: 'products' });
2180
+ const results = await replicas.turbopuffer.query('products', {
2181
+ rank_by: ['text', 'BM25', 'wireless headphones'],
2182
+ top_k: 10,
2183
+ });
2184
+ \`\`\`
2185
+
2186
+ \`write\` mutates namespace data. Confirm the requested change before calling it.
2187
+
2188
+ ## Pangram
2189
+
2190
+ Pangram is a native integration. Text sent to either method is processed by Pangram and consumes the connected account's credits:
2191
+
2192
+ \`\`\`ts
2193
+ const detection = await replicas.pangram.detect({ text });
2194
+ const plagiarism = await replicas.pangram.plagiarism(text);
2195
+ \`\`\`
2196
+
2197
+ Do not send private or sensitive text without the user's authorization.
2171
2198
  `;
2172
2199
  var PLUGINS_ABILITY = {
2173
2200
  label: "Plugins",
@@ -10933,7 +10960,7 @@ var DEFAULT_CODEX_ARGS = [
10933
10960
  var MIN_CODEX_CLI_VERSION = "0.144.6";
10934
10961
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
10935
10962
  var codexCliVersionEnsured = null;
10936
- var ENGINE_PACKAGE_VERSION = "0.1.623";
10963
+ var ENGINE_PACKAGE_VERSION = "0.1.625";
10937
10964
  var INITIALIZE_METHOD = "initialize";
10938
10965
  var INITIALIZED_NOTIFICATION = "initialized";
10939
10966
  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.623",
3
+ "version": "0.1.625",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -108,5 +108,21 @@ const modal = {
108
108
  call: (input) => request('/v1/engine/modal/call', { method: 'POST', body: input }),
109
109
  };
110
110
 
111
- export const replicas = { integrations, plugins, linear, slack, github, gitlab, sentry, modal };
111
+ const turbopufferRequest = (operation, namespace, params) =>
112
+ request('/v1/engine/turbopuffer', { method: 'POST', body: { operation, namespace, params } });
113
+ const turbopuffer = {
114
+ namespaces: (params) => turbopufferRequest('namespaces', undefined, params),
115
+ metadata: (namespace, params) => turbopufferRequest('metadata', namespace, params),
116
+ query: (namespace, params) => turbopufferRequest('query', namespace, params),
117
+ write: (namespace, params) => turbopufferRequest('write', namespace, params),
118
+ };
119
+
120
+ const pangramRequest = (operation, input) =>
121
+ request('/v1/engine/pangram', { method: 'POST', body: { operation, ...input } });
122
+ const pangram = {
123
+ detect: (input) => pangramRequest('detect', input),
124
+ plagiarism: (text) => pangramRequest('plagiarism', { text }),
125
+ };
126
+
127
+ export const replicas = { integrations, plugins, linear, slack, github, gitlab, sentry, modal, turbopuffer, pangram };
112
128
  export default replicas;
@@ -114,4 +114,50 @@ describe('@replicas/sdk', () => {
114
114
  process.env.REPLICAS_WORKSPACE_ID = 'workspace-1';
115
115
  expect(() => replicas.github.request('//attacker.example/path')).toThrow('relative');
116
116
  });
117
+
118
+ test('queries turbopuffer through the workspace gateway', async () => {
119
+ let observed: { path: string; body: unknown } | null = null;
120
+ const server = Bun.serve({
121
+ port: 0,
122
+ async fetch(request) {
123
+ observed = { path: new URL(request.url).pathname, body: await request.json() };
124
+ return Response.json({ rows: [] });
125
+ },
126
+ });
127
+ process.env.REPLICAS_MONOLITH_URL = server.url.toString().replace(/\/$/, '');
128
+ process.env.REPLICAS_ENGINE_SECRET = 'engine-secret';
129
+ process.env.REPLICAS_WORKSPACE_ID = 'workspace-1';
130
+ try {
131
+ await replicas.turbopuffer.query('products', { top_k: 10 });
132
+ expect(observed).toEqual({
133
+ path: '/v1/engine/turbopuffer',
134
+ body: { operation: 'query', namespace: 'products', params: { top_k: 10 } },
135
+ });
136
+ } finally {
137
+ server.stop(true);
138
+ }
139
+ });
117
140
  });
141
+
142
+ test('analyzes text with Pangram through the workspace gateway', async () => {
143
+ let observed: { path: string; body: unknown } | null = null;
144
+ const server = Bun.serve({
145
+ port: 0,
146
+ async fetch(request) {
147
+ observed = { path: new URL(request.url).pathname, body: await request.json() };
148
+ return Response.json({ prediction_short: 'Human' });
149
+ },
150
+ });
151
+ process.env.REPLICAS_MONOLITH_URL = server.url.toString().replace(/\/$/, '');
152
+ process.env.REPLICAS_ENGINE_SECRET = 'engine-secret';
153
+ process.env.REPLICAS_WORKSPACE_ID = 'workspace-1';
154
+ try {
155
+ await replicas.pangram.detect({ text: 'Example text' });
156
+ expect(observed).toEqual({
157
+ path: '/v1/engine/pangram',
158
+ body: { operation: 'detect', text: 'Example text' },
159
+ });
160
+ } finally {
161
+ server.stop(true);
162
+ }
163
+ });
@@ -98,6 +98,13 @@ export declare const PLUGIN_CATALOG: readonly [{
98
98
  readonly category: "business";
99
99
  readonly name: "Stripe";
100
100
  readonly description: "Manage customers, payments, invoices, subscriptions, and balances.";
101
+ }, {
102
+ readonly id: "pangram";
103
+ readonly toolkit: "pangram";
104
+ readonly authType: "api_key";
105
+ readonly category: "data";
106
+ readonly name: "Pangram";
107
+ readonly description: "Analyze text for AI generation and plagiarism signals.";
101
108
  }, {
102
109
  readonly id: "vercel";
103
110
  readonly toolkit: "vercel";
@@ -105,6 +112,13 @@ export declare const PLUGIN_CATALOG: readonly [{
105
112
  readonly category: "data";
106
113
  readonly name: "Vercel";
107
114
  readonly description: "Manage projects, deployments, logs, domains, and infrastructure.";
115
+ }, {
116
+ readonly id: "turbopuffer";
117
+ readonly toolkit: "turbopuffer";
118
+ readonly authType: "api_key";
119
+ readonly category: "data";
120
+ readonly name: "turbopuffer";
121
+ readonly description: "Query and manage turbopuffer namespaces.";
108
122
  }];
109
123
  export type PluginId = (typeof PLUGIN_CATALOG)[number]['id'];
110
124
  export type PluginScope = 'organization' | 'personal';
@@ -156,7 +170,13 @@ export interface PluginConnectModalRequest {
156
170
  tokenId: string;
157
171
  tokenSecret: string;
158
172
  }
159
- export type PluginConnectRequest = PluginConnectPostHogRequest | PluginConnectClickHouseRequest | PluginConnectApiKeyRequest | PluginConnectModalRequest;
173
+ export declare const TURBOPUFFER_REGIONS: readonly ["aws-us-east-1", "aws-us-west-2", "gcp-us-central1", "gcp-europe-west3"];
174
+ export type TurbopufferRegion = (typeof TURBOPUFFER_REGIONS)[number];
175
+ export interface PluginConnectTurbopufferRequest {
176
+ apiKey: string;
177
+ region: TurbopufferRegion;
178
+ }
179
+ export type PluginConnectRequest = PluginConnectPostHogRequest | PluginConnectClickHouseRequest | PluginConnectApiKeyRequest | PluginConnectModalRequest | PluginConnectTurbopufferRequest;
160
180
  export interface ModalCallRequest {
161
181
  app: string;
162
182
  function: string;
@@ -164,12 +184,21 @@ export interface ModalCallRequest {
164
184
  kwargs?: Record<string, unknown>;
165
185
  environment?: string;
166
186
  }
187
+ export interface TurbopufferOperationRequest {
188
+ operation: 'namespaces' | 'metadata' | 'query' | 'write';
189
+ namespace?: string;
190
+ params?: Record<string, unknown>;
191
+ }
167
192
  export interface PluginConnectResponse {
168
193
  success: true;
169
194
  }
170
195
  export interface PluginConnectionDeleteResponse {
171
196
  success: boolean;
172
197
  }
198
+ export interface PangramAnalyzeRequest {
199
+ text: string;
200
+ publicDashboardLink?: boolean;
201
+ }
173
202
  export interface WorkspacePluginSummary extends PluginCatalogItem {
174
203
  connected: boolean;
175
204
  scope?: PluginScope;
@@ -51,4 +51,14 @@ export interface ReplicasSdk {
51
51
  modal: {
52
52
  call<T = unknown>(input: import('./routes/plugins').ModalCallRequest): Promise<T>;
53
53
  };
54
+ turbopuffer: {
55
+ namespaces<T = unknown>(params?: Record<string, unknown>): Promise<T>;
56
+ metadata<T = unknown>(namespace: string, params?: Record<string, unknown>): Promise<T>;
57
+ query<T = unknown>(namespace: string, params: Record<string, unknown>): Promise<T>;
58
+ write<T = unknown>(namespace: string, params: Record<string, unknown>): Promise<T>;
59
+ };
60
+ pangram: {
61
+ detect<T = unknown>(input: import('./routes/plugins').PangramAnalyzeRequest): Promise<T>;
62
+ plagiarism<T = unknown>(text: string): Promise<T>;
63
+ };
54
64
  }