replicas-engine 0.1.622 → 0.1.624

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
@@ -2099,10 +2099,12 @@ Use this when:
2099
2099
  - The user asks to manage Calendly events, invitees, or scheduling links
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
+ - The user asks to invoke a connected Modal function
2103
+ - The user asks to query or update a connected turbopuffer namespace
2102
2104
  - The user asks for Stripe customers, payments, invoices, subscriptions, or balances`;
2103
2105
  var REFERENCE9 = `# Plugins
2104
2106
 
2105
- Plugins are TypeScript libraries, not MCP servers. Import \`@replicas/sdk\`; Replicas authenticates the workspace and selects only the owner\u2019s personal connection or the organization fallback. Composio credentials, sessions, and project keys are never exposed.
2107
+ Plugins are TypeScript libraries, not MCP servers. Import \`@replicas/sdk\`; Replicas authenticates the workspace and selects only the owner\u2019s personal connection or the organization fallback. Provider credentials, sessions, and project keys are never exposed.
2106
2108
 
2107
2109
  Plugin tools may read or write provider data according to the connected account's permissions. Only execute write or destructive tools when they match the user's request.
2108
2110
 
@@ -2152,6 +2154,35 @@ const results = await Promise.all(customerIds.map((customer) =>
2152
2154
  \`\`\`
2153
2155
 
2154
2156
  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
+
2158
+ ## Modal
2159
+
2160
+ Modal is a native integration and uses its official JavaScript SDK behind the Replicas gateway. Invoke a deployed function by name:
2161
+
2162
+ \`\`\`ts
2163
+ const result = await replicas.modal.call({
2164
+ app: 'my-app',
2165
+ function: 'my-function',
2166
+ args: ['input'],
2167
+ environment: 'main',
2168
+ });
2169
+ \`\`\`
2170
+
2171
+ Function calls execute with the connected Modal token and may mutate external state. Confirm the requested action before invoking a function with side effects.
2172
+
2173
+ ## turbopuffer
2174
+
2175
+ turbopuffer is a native integration backed by its official TypeScript SDK. Use the provider-shaped helpers:
2176
+
2177
+ \`\`\`ts
2178
+ const namespaces = await replicas.turbopuffer.namespaces({ prefix: 'products' });
2179
+ const results = await replicas.turbopuffer.query('products', {
2180
+ rank_by: ['text', 'BM25', 'wireless headphones'],
2181
+ top_k: 10,
2182
+ });
2183
+ \`\`\`
2184
+
2185
+ \`write\` mutates namespace data. Confirm the requested change before calling it.
2155
2186
  `;
2156
2187
  var PLUGINS_ABILITY = {
2157
2188
  label: "Plugins",
@@ -10917,7 +10948,7 @@ var DEFAULT_CODEX_ARGS = [
10917
10948
  var MIN_CODEX_CLI_VERSION = "0.144.6";
10918
10949
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
10919
10950
  var codexCliVersionEnsured = null;
10920
- var ENGINE_PACKAGE_VERSION = "0.1.622";
10951
+ var ENGINE_PACKAGE_VERSION = "0.1.624";
10921
10952
  var INITIALIZE_METHOD = "initialize";
10922
10953
  var INITIALIZED_NOTIFICATION = "initialized";
10923
10954
  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.622",
3
+ "version": "0.1.624",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -104,5 +104,18 @@ const sentry = {
104
104
  request: (path) => request('/v1/engine/sentry/api', { method: 'POST', body: { path } }),
105
105
  };
106
106
 
107
- export const replicas = { integrations, plugins, linear, slack, github, gitlab, sentry };
107
+ const modal = {
108
+ call: (input) => request('/v1/engine/modal/call', { method: 'POST', body: input }),
109
+ };
110
+
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
+ export const replicas = { integrations, plugins, linear, slack, github, gitlab, sentry, modal, turbopuffer };
108
121
  export default replicas;
@@ -85,10 +85,56 @@ describe('@replicas/sdk', () => {
85
85
  }
86
86
  });
87
87
 
88
+ test('invokes Modal through the workspace gateway', async () => {
89
+ let observed: { path: string; body: unknown } | null = null;
90
+ const server = Bun.serve({
91
+ port: 0,
92
+ async fetch(request) {
93
+ observed = { path: new URL(request.url).pathname, body: await request.json() };
94
+ return Response.json({ ok: true });
95
+ },
96
+ });
97
+ process.env.REPLICAS_MONOLITH_URL = server.url.toString().replace(/\/$/, '');
98
+ process.env.REPLICAS_ENGINE_SECRET = 'engine-secret';
99
+ process.env.REPLICAS_WORKSPACE_ID = 'workspace-1';
100
+ try {
101
+ await replicas.modal.call({ app: 'example', function: 'run', args: ['input'] });
102
+ expect(observed).toEqual({
103
+ path: '/v1/engine/modal/call',
104
+ body: { app: 'example', function: 'run', args: ['input'] },
105
+ });
106
+ } finally {
107
+ server.stop(true);
108
+ }
109
+ });
110
+
88
111
  test('rejects provider URLs that can escape the allowed origin', async () => {
89
112
  process.env.REPLICAS_MONOLITH_URL = 'https://api.example.com';
90
113
  process.env.REPLICAS_ENGINE_SECRET = 'engine-secret';
91
114
  process.env.REPLICAS_WORKSPACE_ID = 'workspace-1';
92
115
  expect(() => replicas.github.request('//attacker.example/path')).toThrow('relative');
93
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
+ });
94
140
  });
@@ -77,6 +77,13 @@ export declare const PLUGIN_CATALOG: readonly [{
77
77
  readonly category: "business";
78
78
  readonly name: "LinkedIn";
79
79
  readonly description: "Manage profiles, organizations, posts, and professional activity.";
80
+ }, {
81
+ readonly id: "modal";
82
+ readonly toolkit: "modal";
83
+ readonly authType: "basic";
84
+ readonly category: "data";
85
+ readonly name: "Modal";
86
+ readonly description: "Invoke deployed functions through Modal compute.";
80
87
  }, {
81
88
  readonly id: "posthog";
82
89
  readonly toolkit: "posthog";
@@ -98,6 +105,13 @@ export declare const PLUGIN_CATALOG: readonly [{
98
105
  readonly category: "data";
99
106
  readonly name: "Vercel";
100
107
  readonly description: "Manage projects, deployments, logs, domains, and infrastructure.";
108
+ }, {
109
+ readonly id: "turbopuffer";
110
+ readonly toolkit: "turbopuffer";
111
+ readonly authType: "api_key";
112
+ readonly category: "data";
113
+ readonly name: "turbopuffer";
114
+ readonly description: "Query and manage turbopuffer namespaces.";
101
115
  }];
102
116
  export type PluginId = (typeof PLUGIN_CATALOG)[number]['id'];
103
117
  export type PluginScope = 'organization' | 'personal';
@@ -145,7 +159,29 @@ export interface PluginConnectApiKeyRequest {
145
159
  apiKey: string;
146
160
  }
147
161
  export type PluginConnectCloudflareRequest = PluginConnectApiKeyRequest;
148
- export type PluginConnectRequest = PluginConnectPostHogRequest | PluginConnectClickHouseRequest | PluginConnectApiKeyRequest;
162
+ export interface PluginConnectModalRequest {
163
+ tokenId: string;
164
+ tokenSecret: string;
165
+ }
166
+ export declare const TURBOPUFFER_REGIONS: readonly ["aws-us-east-1", "aws-us-west-2", "gcp-us-central1", "gcp-europe-west3"];
167
+ export type TurbopufferRegion = (typeof TURBOPUFFER_REGIONS)[number];
168
+ export interface PluginConnectTurbopufferRequest {
169
+ apiKey: string;
170
+ region: TurbopufferRegion;
171
+ }
172
+ export type PluginConnectRequest = PluginConnectPostHogRequest | PluginConnectClickHouseRequest | PluginConnectApiKeyRequest | PluginConnectModalRequest | PluginConnectTurbopufferRequest;
173
+ export interface ModalCallRequest {
174
+ app: string;
175
+ function: string;
176
+ args?: unknown[];
177
+ kwargs?: Record<string, unknown>;
178
+ environment?: string;
179
+ }
180
+ export interface TurbopufferOperationRequest {
181
+ operation: 'namespaces' | 'metadata' | 'query' | 'write';
182
+ namespace?: string;
183
+ params?: Record<string, unknown>;
184
+ }
149
185
  export interface PluginConnectResponse {
150
186
  success: true;
151
187
  }
@@ -48,4 +48,13 @@ export interface ReplicasSdk {
48
48
  sentry: {
49
49
  request<T = unknown>(path: string): Promise<T>;
50
50
  };
51
+ modal: {
52
+ call<T = unknown>(input: import('./routes/plugins').ModalCallRequest): Promise<T>;
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
+ };
51
60
  }