replicas-engine 0.1.627 → 0.1.629

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.
Files changed (2) hide show
  1. package/dist/src/index.js +87 -62
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -797,6 +797,56 @@ var SANDBOX_PATHS = {
797
797
  var WORKSPACE_SIZES = ["small", "large"];
798
798
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
799
799
 
800
+ // ../shared/src/egress.ts
801
+ var EGRESS_CIPHER = "aes-256-gcm";
802
+ var EGRESS_SHADOWSOCKS_MODE = "tcp_and_udp";
803
+ var EGRESS_SHADOWSOCKS_VERSION = "1.24.0";
804
+ var EGRESS_SHADOWSOCKS_SHA256 = "0d84f5f350ec99396867d718f146fc3810975b2a7cd06192f158d96bdef460e7";
805
+ var EGRESS_PORT_RANGE_START = 8400;
806
+ var EGRESS_PORT_RANGE_END = 8499;
807
+ var EGRESS_EXIT_IP_ENDPOINTS = [
808
+ "https://checkip.amazonaws.com",
809
+ "https://api.ipify.org",
810
+ "https://icanhazip.com"
811
+ ];
812
+ var EGRESS_DIRECT_ROUTES = [
813
+ "10.0.0.0/8",
814
+ "172.16.0.0/12",
815
+ "192.168.0.0/16",
816
+ "169.254.0.0/16",
817
+ "100.64.0.0/10"
818
+ ];
819
+ var EGRESS_SHELL_CONFIG = [
820
+ `EGRESS_PORT_RANGE_START=${EGRESS_PORT_RANGE_START}`,
821
+ `EGRESS_PORT_RANGE_END=${EGRESS_PORT_RANGE_END}`,
822
+ `EGRESS_SHADOWSOCKS_VERSION=${EGRESS_SHADOWSOCKS_VERSION}`,
823
+ `EGRESS_SHADOWSOCKS_SHA256=${EGRESS_SHADOWSOCKS_SHA256}`,
824
+ `EGRESS_CIPHER=${EGRESS_CIPHER}`,
825
+ `EGRESS_MODE=${EGRESS_SHADOWSOCKS_MODE}`,
826
+ `EGRESS_EXIT_IP_ENDPOINTS="${EGRESS_EXIT_IP_ENDPOINTS.join(" ")}"`,
827
+ `EGRESS_DIRECT_ROUTES="${EGRESS_DIRECT_ROUTES.join(" ")}"`
828
+ ].join("\n");
829
+ var EGRESS_TUNNEL_SERVICE = "replicas-egress.service";
830
+ var EGRESS_TUNNEL_INTERFACE = "rpxtun0";
831
+ var EGRESS_DNS_SERVERS = ["1.1.1.1", "8.8.8.8"];
832
+ var EGRESS_PATHS = {
833
+ CONFIG_DIR: "/etc/replicas/egress",
834
+ /** Root-only (0600). Holds the customer's proxy password — never baked into the image. */
835
+ CONFIG_FILE: "/etc/replicas/egress/config.json",
836
+ RESOLV_BACKUP: "/etc/replicas/egress/resolv.conf.orig",
837
+ UNIT_FILE: `/etc/systemd/system/${EGRESS_TUNNEL_SERVICE}`,
838
+ UP_SCRIPT: "/usr/local/lib/replicas-egress-up",
839
+ DOWN_SCRIPT: "/usr/local/lib/replicas-egress-down"
840
+ };
841
+ var EGRESS_WORKSPACE_CONFIG_FILE = "/opt/replicas/egress-config.env";
842
+ var EGRESS_WORKSPACE_SHELL_VARS = {
843
+ EGRESS_WORKSPACE_CONFIG_FILE,
844
+ EGRESS_TUNNEL_SERVICE,
845
+ EGRESS_TUNNEL_INTERFACE,
846
+ EGRESS_DNS_SERVERS: EGRESS_DNS_SERVERS.join(" "),
847
+ EGRESS_EXIT_IP_ENDPOINTS: EGRESS_EXIT_IP_ENDPOINTS.join(" ")
848
+ };
849
+
800
850
  // ../shared/src/runtime-env.ts
801
851
  var REPLICAS_RUNTIME_ENV_ALIASES = {
802
852
  monolithUrl: ["REPLICAS_MONOLITH_URL", "MONOLITH_URL"],
@@ -1586,35 +1636,8 @@ var GITLAB_ABILITY = {
1586
1636
  referenceFile: { name: "GITLAB.md", content: REFERENCE4 }
1587
1637
  };
1588
1638
 
1589
- // ../shared/src/default-skills/replicas-agent/abilities/learnings.ts
1590
- var SECTION5 = `### Learnings
1591
- Propose additions, updates, or deletions to curated organization knowledge.
1592
-
1593
- **Reference:** \`references/LEARNINGS.md\``;
1594
- var REFERENCE5 = `# Learnings
1595
-
1596
- Learnings are curated, human-approved knowledge entries your organization maintains: conventions, gotchas, environment facts, and process rules.
1597
-
1598
- All writes are proposals: a human reviews them in the dashboard, and nothing takes effect until approved.
1599
-
1600
- Use \`replicas learnings --help\` and subcommand help such as \`replicas learnings add --help\`, \`replicas learnings update --help\`, or \`replicas learnings delete --help\` for current command syntax.
1601
-
1602
- A human approves every proposal before it takes effect, so don't agonize over borderline calls \u2014 but keep proposals genuinely useful rather than reflexive.
1603
-
1604
- - Propose \`add\` for anything repeatable and org-useful: user corrections and preferences, hard-won environment or process knowledge, conventions and decisions worth following, and gotchas that would waste time again. If you learned it the hard way this task, capture it.
1605
- - Never store task-specific details that won't recur, facts trivially derivable by reading the repo, or secrets/credentials.
1606
- - Propose \`update\` or \`delete\` when a learning is contradicted by the current code or docs, especially if the outdated guidance would affect future repeated work.
1607
- - Write narrow triggers describing when the entry should surface (e.g. "UI/UX work on the admin panel"), not vague topics.`;
1608
- var LEARNINGS_ABILITY = {
1609
- label: "Learnings",
1610
- description: "Propose changes to curated org knowledge for human review.",
1611
- bullet: "- Proposing changes to organization Learnings (curated, human-approved knowledge)",
1612
- section: SECTION5,
1613
- referenceFile: { name: "LEARNINGS.md", content: REFERENCE5 }
1614
- };
1615
-
1616
1639
  // ../shared/src/default-skills/replicas-agent/abilities/linear.ts
1617
- var SECTION6 = `### Linear
1640
+ var SECTION5 = `### Linear
1618
1641
  Fetch issues, update state, add comments, and search through the workspace-scoped TypeScript SDK.
1619
1642
 
1620
1643
  **Reference:** \`references/LINEAR.md\`
@@ -1623,7 +1646,7 @@ Use this when:
1623
1646
  - You encounter a Linear issue link and need to understand the task
1624
1647
  - You need to update an issue's state or add a comment
1625
1648
  - You need to search Linear issues`;
1626
- var REFERENCE6 = `# Linear Integration
1649
+ var REFERENCE5 = `# Linear Integration
1627
1650
 
1628
1651
  Use \`@replicas/sdk\`; never request or handle a Linear OAuth token. Replicas refreshes the organization credential behind the gateway.
1629
1652
 
@@ -1673,12 +1696,12 @@ var LINEAR_ABILITY = {
1673
1696
  label: "Linear",
1674
1697
  description: "Fetch issues, comment, and update state through @replicas/sdk.",
1675
1698
  bullet: "- Interacting with Linear (fetching issues, updating state, commenting, etc.)",
1676
- section: SECTION6,
1677
- referenceFile: { name: "LINEAR.md", content: REFERENCE6 }
1699
+ section: SECTION5,
1700
+ referenceFile: { name: "LINEAR.md", content: REFERENCE5 }
1678
1701
  };
1679
1702
 
1680
1703
  // ../shared/src/default-skills/replicas-agent/abilities/media.ts
1681
- var SECTION7 = `### Media
1704
+ var SECTION6 = `### Media
1682
1705
  Share screenshots, screen recordings, generated diagrams, audio clips, and self-contained HTML pages through Replicas and external messages.
1683
1706
 
1684
1707
  **Reference:** \`references/MEDIA.md\`
@@ -1688,7 +1711,7 @@ Use this when:
1688
1711
  - You produce a self-contained HTML report that should be linked from a pull request
1689
1712
  - You record video output (browser automation, screen capture) \u2014 including the recommended aspect ratio and FPS
1690
1713
  - You need to embed media in a Slack/Linear/GitHub message AND keep a referenceable copy in the Replicas dashboard`;
1691
- var REFERENCE7 = `# Media (Screenshots, Recordings, Audio, HTML)
1714
+ var REFERENCE6 = `# Media (Screenshots, Recordings, Audio, HTML)
1692
1715
 
1693
1716
  This guide covers how to share screenshots, screen recordings, generated diagrams, audio clips, and self-contained HTML pages through Replicas and external surfaces (Slack, Linear, GitHub).
1694
1717
 
@@ -1994,12 +2017,12 @@ var MEDIA_ABILITY = {
1994
2017
  label: "Media",
1995
2018
  description: "Share screenshots, recordings, generated images, audio clips, and HTML pages.",
1996
2019
  bullet: "- Producing or showing the user any media \u2014 screenshots, screen recordings, generated images or diagrams, audio clips, or HTML recap pages \u2014 including in your Replicas chat reply, PR descriptions/comments, and other external platforms",
1997
- section: SECTION7,
1998
- referenceFile: { name: "MEDIA.md", content: REFERENCE7 }
2020
+ section: SECTION6,
2021
+ referenceFile: { name: "MEDIA.md", content: REFERENCE6 }
1999
2022
  };
2000
2023
 
2001
2024
  // ../shared/src/default-skills/replicas-agent/abilities/previews.ts
2002
- var SECTION8 = `### Previews
2025
+ var SECTION7 = `### Previews
2003
2026
  Expose locally running services (web apps, APIs, databases) as public preview URLs so humans can interact with them directly.
2004
2027
 
2005
2028
  **Reference:** \`references/PREVIEWS.md\`
@@ -2008,7 +2031,7 @@ Use this when:
2008
2031
  - You need to start a service that a human should view or interact with
2009
2032
  - The task involves UI work that benefits from human review
2010
2033
  - You are verifying frontend/backend integrations visually`;
2011
- var REFERENCE8 = `# Preview URLs
2034
+ var REFERENCE7 = `# Preview URLs
2012
2035
 
2013
2036
  When you run services on ports \u2014 such as a web app, API server, or database \u2014 humans may want to interact with them directly. You can expose your locally running services as public preview URLs.
2014
2037
 
@@ -2084,12 +2107,12 @@ var PREVIEWS_ABILITY = {
2084
2107
  label: "Previews",
2085
2108
  description: "Expose locally running services on public preview URLs for humans.",
2086
2109
  bullet: "- Creating preview URLs for locally running services",
2087
- section: SECTION8,
2088
- referenceFile: { name: "PREVIEWS.md", content: REFERENCE8 }
2110
+ section: SECTION7,
2111
+ referenceFile: { name: "PREVIEWS.md", content: REFERENCE7 }
2089
2112
  };
2090
2113
 
2091
2114
  // ../shared/src/default-skills/replicas-agent/abilities/plugins.ts
2092
- var SECTION9 = `### Plugins
2115
+ var SECTION8 = `### Plugins
2093
2116
  Discover and execute installed marketplace tools through the workspace-scoped TypeScript SDK.
2094
2117
 
2095
2118
  **Reference:** \`references/PLUGINS.md\`
@@ -2104,7 +2127,7 @@ Use this when:
2104
2127
  - The user asks for PlanetScale organizations, databases, branches, or Insights data
2105
2128
  - The user asks to analyze text with Pangram
2106
2129
  - The user asks for Stripe customers, payments, invoices, subscriptions, or balances`;
2107
- var REFERENCE9 = `# Plugins
2130
+ var REFERENCE8 = `# Plugins
2108
2131
 
2109
2132
  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.
2110
2133
 
@@ -2212,12 +2235,12 @@ var PLUGINS_ABILITY = {
2212
2235
  label: "Plugins",
2213
2236
  description: "Use installed marketplace tools through @replicas/sdk.",
2214
2237
  bullet: "- Interacting with installed marketplace plugins through TypeScript",
2215
- section: SECTION9,
2216
- referenceFile: { name: "PLUGINS.md", content: REFERENCE9 }
2238
+ section: SECTION8,
2239
+ referenceFile: { name: "PLUGINS.md", content: REFERENCE8 }
2217
2240
  };
2218
2241
 
2219
2242
  // ../shared/src/default-skills/replicas-agent/abilities/replicas.ts
2220
- var SECTION10 = `### Replicas (in-workspace CLI)
2243
+ var SECTION9 = `### Replicas (in-workspace CLI)
2221
2244
  Take action *with* Replicas itself \u2014 manage automations, environments (variables, files), repos, and \`replicas.json\` config \u2014 using the pre-installed, pre-authenticated \`replicas\` CLI.
2222
2245
 
2223
2246
  **Reference:** \`references/REPLICAS.md\`
@@ -2228,7 +2251,7 @@ Use this when:
2228
2251
  - The user asks "what envs / repos / automations do I have?"
2229
2252
  - The user asks you to scaffold a \`replicas.json\` / \`replicas.yaml\` in a repo
2230
2253
  - You need to run a long-lived service (dev server, daemon) \u2014 always use \`replicas service start\` so it survives workspace sleep/wake`;
2231
- var REFERENCE10 = `# Replicas (in-workspace CLI)
2254
+ var REFERENCE9 = `# Replicas (in-workspace CLI)
2232
2255
 
2233
2256
  This guide covers how to take action *with* Replicas itself from inside a Replicas workspace \u2014 managing automations, environments (and their variables/files), repos, previews, and the user's \`replicas.json\` config \u2014 using the pre-installed \`replicas\` CLI.
2234
2257
 
@@ -2455,13 +2478,13 @@ var REPLICAS_ABILITY = {
2455
2478
  description: "Teach the agent about Replicas itself \u2014 automations, environments, the in-workspace CLI.",
2456
2479
  // No bullet — help_instructions covers the `replicas` CLI surface in detail.
2457
2480
  bullet: "",
2458
- section: SECTION10,
2459
- referenceFile: { name: "REPLICAS.md", content: REFERENCE10 },
2481
+ section: SECTION9,
2482
+ referenceFile: { name: "REPLICAS.md", content: REFERENCE9 },
2460
2483
  locked: true
2461
2484
  };
2462
2485
 
2463
2486
  // ../shared/src/default-skills/replicas-agent/abilities/sentry.ts
2464
- var SECTION11 = `### Sentry
2487
+ var SECTION10 = `### Sentry
2465
2488
  Read issues and project data through the workspace-scoped TypeScript SDK.
2466
2489
 
2467
2490
  **Reference:** \`references/SENTRY.md\`
@@ -2469,7 +2492,7 @@ Read issues and project data through the workspace-scoped TypeScript SDK.
2469
2492
  Use this when:
2470
2493
  - You need to inspect Sentry projects or issues
2471
2494
  - A user asks for error-monitoring context outside a webhook-triggered task`;
2472
- var REFERENCE11 = `# Sentry Integration
2495
+ var REFERENCE10 = `# Sentry Integration
2473
2496
 
2474
2497
  Use \`@replicas/sdk\`; never request or read a Sentry token. Sentry access is organization-scoped and read-only.
2475
2498
 
@@ -2488,12 +2511,12 @@ var SENTRY_ABILITY = {
2488
2511
  label: "Sentry",
2489
2512
  description: "Read Sentry projects and issues through @replicas/sdk.",
2490
2513
  bullet: "- Interacting with Sentry (reading projects, issues, and error context)",
2491
- section: SECTION11,
2492
- referenceFile: { name: "SENTRY.md", content: REFERENCE11 }
2514
+ section: SECTION10,
2515
+ referenceFile: { name: "SENTRY.md", content: REFERENCE10 }
2493
2516
  };
2494
2517
 
2495
2518
  // ../shared/src/default-skills/replicas-agent/abilities/slack.ts
2496
- var SECTION12 = `### Slack
2519
+ var SECTION11 = `### Slack
2497
2520
  Send messages, read threads, search conversations, and upload files through the workspace-scoped TypeScript SDK.
2498
2521
 
2499
2522
  **Reference:** \`references/SLACK.md\`
@@ -2502,7 +2525,7 @@ Use this when:
2502
2525
  - You need to send a message to a Slack channel or thread
2503
2526
  - You need to read or search Slack conversations
2504
2527
  - You encounter a Slack message link and need its full thread`;
2505
- var REFERENCE12 = `# Slack Integration
2528
+ var REFERENCE11 = `# Slack Integration
2506
2529
 
2507
2530
  Use \`@replicas/sdk\`; never read or send a Slack token directly. The SDK calls Replicas, which selects only this workspace's organization connection.
2508
2531
 
@@ -2575,8 +2598,8 @@ var SLACK_ABILITY = {
2575
2598
  label: "Slack",
2576
2599
  description: "Send messages, read threads, and search through @replicas/sdk.",
2577
2600
  bullet: "- Interacting with Slack (sending messages, reading threads, etc.)",
2578
- section: SECTION12,
2579
- referenceFile: { name: "SLACK.md", content: REFERENCE12 }
2601
+ section: SECTION11,
2602
+ referenceFile: { name: "SLACK.md", content: REFERENCE11 }
2580
2603
  };
2581
2604
 
2582
2605
  // ../shared/src/default-skills/replicas-agent/registry.ts
@@ -2586,7 +2609,6 @@ var REPLICAS_AGENT_ABILITY_REGISTRY = {
2586
2609
  docker: DOCKER_ABILITY,
2587
2610
  github: GITHUB_ABILITY,
2588
2611
  gitlab: GITLAB_ABILITY,
2589
- learnings: LEARNINGS_ABILITY,
2590
2612
  linear: LINEAR_ABILITY,
2591
2613
  media: MEDIA_ABILITY,
2592
2614
  plugins: PLUGINS_ABILITY,
@@ -3315,7 +3337,8 @@ var workspaceChangedEventSchema = z2.discriminatedUnion("type", [
3315
3337
  workspaceId: z2.string(),
3316
3338
  completion: z2.object({
3317
3339
  workspaceName: z2.string(),
3318
- completedAt: z2.string()
3340
+ completedAt: z2.string(),
3341
+ processing: z2.boolean().optional()
3319
3342
  }).optional(),
3320
3343
  ts: z2.string()
3321
3344
  }),
@@ -11029,7 +11052,7 @@ var DEFAULT_CODEX_ARGS = [
11029
11052
  var MIN_CODEX_CLI_VERSION = "0.144.6";
11030
11053
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
11031
11054
  var codexCliVersionEnsured = null;
11032
- var ENGINE_PACKAGE_VERSION = "0.1.627";
11055
+ var ENGINE_PACKAGE_VERSION = "0.1.629";
11033
11056
  var INITIALIZE_METHOD = "initialize";
11034
11057
  var INITIALIZED_NOTIFICATION = "initialized";
11035
11058
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -17092,17 +17115,18 @@ var ChatService = class {
17092
17115
  chat.activeMessageId = null;
17093
17116
  this.agentChatActivityTrackerService.noteTurnEnded(chatId);
17094
17117
  const completedAt = (/* @__PURE__ */ new Date()).toISOString();
17118
+ const processing = chat.provider.getQueue().length > 0;
17095
17119
  this.publish({
17096
17120
  type: "chat.turn.completed",
17097
17121
  payload: {
17098
17122
  chatId,
17099
17123
  isComplete: true,
17100
- processing: false,
17124
+ processing,
17101
17125
  completedAt
17102
17126
  }
17103
17127
  }).catch(() => {
17104
17128
  });
17105
- monolithService.sendEvent({ type: "agent_response_complete", payload: { completedAt } }).catch(() => {
17129
+ monolithService.sendEvent({ type: "agent_response_complete", payload: { completedAt, processing } }).catch(() => {
17106
17130
  });
17107
17131
  uploadChatTranscript(
17108
17132
  chatId,
@@ -17114,7 +17138,7 @@ var ChatService = class {
17114
17138
  flushAllCanvasItems().catch((err) => {
17115
17139
  console.error("[ChatService] Failed to upload canvas items:", { chatId, err });
17116
17140
  });
17117
- await this.publishAgentTurnCompleteWebhook(chat, completedAt);
17141
+ await this.publishAgentTurnCompleteWebhook(chat, completedAt, processing);
17118
17142
  }
17119
17143
  getRuntimeChat(chatId) {
17120
17144
  const chat = this.chats.get(chatId) ?? null;
@@ -17196,7 +17220,7 @@ var ChatService = class {
17196
17220
  } catch {
17197
17221
  }
17198
17222
  }
17199
- async publishAgentTurnCompleteWebhook(chat, completedAt) {
17223
+ async publishAgentTurnCompleteWebhook(chat, completedAt, processing = false) {
17200
17224
  await Promise.all([
17201
17225
  githubTokenManager.refreshOnce().catch(() => {
17202
17226
  }),
@@ -17229,6 +17253,7 @@ var ChatService = class {
17229
17253
  const payload = {
17230
17254
  ...linearSessionId ? { linearSessionId } : {},
17231
17255
  ...completedAt ? { completedAt } : {},
17256
+ processing,
17232
17257
  repoStatuses,
17233
17258
  ...errors?.length ? { errors } : {},
17234
17259
  ...errors?.length && errorNotificationTarget ? { errorNotificationTarget } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.627",
3
+ "version": "0.1.629",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",