replicas-engine 0.1.577 → 0.1.578

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 CHANGED
@@ -125,7 +125,7 @@ Credential files expected/used by provider CLIs:
125
125
  The engine calls monolith with:
126
126
 
127
127
  - `Authorization: Bearer <REPLICAS_ENGINE_SECRET>`
128
- - `X-Workspace-Id: <WORKSPACE_ID>`
128
+ - `X-Workspace-Id: <REPLICAS_WORKSPACE_ID>`
129
129
 
130
130
  Outgoing endpoints:
131
131
 
package/dist/src/index.js CHANGED
@@ -725,6 +725,18 @@ var WORKSPACE_SIZES = ["small", "large"];
725
725
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
726
726
 
727
727
  // ../shared/src/runtime-env.ts
728
+ var REPLICAS_RUNTIME_ENV_ALIASES = {
729
+ monolithUrl: ["REPLICAS_MONOLITH_URL", "MONOLITH_URL"],
730
+ workspaceId: ["REPLICAS_WORKSPACE_ID", "WORKSPACE_ID"],
731
+ linearSessionId: ["REPLICAS_LINEAR_SESSION_ID", "LINEAR_SESSION_ID"],
732
+ linearAccessToken: ["REPLICAS_LINEAR_ACCESS_TOKEN", "LINEAR_ACCESS_TOKEN"],
733
+ slackBotToken: ["REPLICAS_SLACK_BOT_TOKEN", "SLACK_BOT_TOKEN"],
734
+ slackChannelId: ["REPLICAS_SLACK_CHANNEL_ID", "SLACK_CHANNEL_ID"],
735
+ slackThreadTs: ["REPLICAS_SLACK_THREAD_TS", "SLACK_THREAD_TS"]
736
+ };
737
+ function readReplicasRuntimeEnv(readEnv2, [namespacedKey, legacyKey]) {
738
+ return readEnv2(namespacedKey) ?? readEnv2(legacyKey);
739
+ }
728
740
  function shellQuotePosix(value) {
729
741
  return `'${value.split("'").join("'\\''")}'`;
730
742
  }
@@ -1581,9 +1593,9 @@ The integration is configured at the org or user level by the Replicas admin. Fr
1581
1593
  Quick check that the integration is connected:
1582
1594
 
1583
1595
  \`\`\`bash
1584
- curl -s -X GET "$MONOLITH_URL/v1/gdrive/credentials" \\
1596
+ curl -s -X GET "$REPLICAS_MONOLITH_URL/v1/gdrive/credentials" \\
1585
1597
  -H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
1586
- -H "X-Workspace-Id: $WORKSPACE_ID"
1598
+ -H "X-Workspace-Id: $REPLICAS_WORKSPACE_ID"
1587
1599
  \`\`\`
1588
1600
 
1589
1601
  - If \`hasCredentials\` is \`true\`: you're good to go.
@@ -1593,13 +1605,13 @@ Standard auth headers used by every call below:
1593
1605
 
1594
1606
  \`\`\`
1595
1607
  Authorization: Bearer $REPLICAS_ENGINE_SECRET
1596
- X-Workspace-Id: $WORKSPACE_ID
1608
+ X-Workspace-Id: $REPLICAS_WORKSPACE_ID
1597
1609
  \`\`\`
1598
1610
 
1599
1611
  For brevity the examples below use a shell variable:
1600
1612
 
1601
1613
  \`\`\`bash
1602
- GDRIVE_AUTH=(-H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" -H "X-Workspace-Id: $WORKSPACE_ID")
1614
+ GDRIVE_AUTH=(-H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" -H "X-Workspace-Id: $REPLICAS_WORKSPACE_ID")
1603
1615
  \`\`\`
1604
1616
 
1605
1617
  ## Important constraint: drive.file scope
@@ -1617,7 +1629,7 @@ If the user asks you to edit an existing doc that Replicas didn't create, tell t
1617
1629
  ### Create a new doc
1618
1630
 
1619
1631
  \`\`\`bash
1620
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/docs" "\${GDRIVE_AUTH[@]}" \\
1632
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/docs" "\${GDRIVE_AUTH[@]}" \\
1621
1633
  -H "Content-Type: application/json" \\
1622
1634
  -d '{"title":"Meeting notes 2026-05-14"}'
1623
1635
  \`\`\`
@@ -1627,7 +1639,7 @@ Returns the full Doc object; grab \`.documentId\` for follow-up calls.
1627
1639
  ### Read a doc
1628
1640
 
1629
1641
  \`\`\`bash
1630
- curl -s "$MONOLITH_URL/v1/gdrive/docs/$DOC_ID" "\${GDRIVE_AUTH[@]}"
1642
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/docs/$DOC_ID" "\${GDRIVE_AUTH[@]}"
1631
1643
  \`\`\`
1632
1644
 
1633
1645
  Returns the full document structure \u2014 \`body.content\` is an ordered list of structural elements (paragraphs, tables, etc.) with character indexes you can target for edits.
@@ -1637,7 +1649,7 @@ Returns the full document structure \u2014 \`body.content\` is an ordered list o
1637
1649
  The Docs API edits use a list of [structural requests](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request). Insert text, then style it; or insert tables, images, page breaks, etc.
1638
1650
 
1639
1651
  \`\`\`bash
1640
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/docs/$DOC_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
1652
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/docs/$DOC_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
1641
1653
  -H "Content-Type: application/json" \\
1642
1654
  -d '{
1643
1655
  "requests": [
@@ -1664,7 +1676,7 @@ Edits are verbose but powerful. Prefer batching many requests into a single \`ba
1664
1676
  ### Create a new spreadsheet
1665
1677
 
1666
1678
  \`\`\`bash
1667
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/sheets" "\${GDRIVE_AUTH[@]}" \\
1679
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/sheets" "\${GDRIVE_AUTH[@]}" \\
1668
1680
  -H "Content-Type: application/json" \\
1669
1681
  -d '{"title":"Q2 metrics"}'
1670
1682
  \`\`\`
@@ -1675,7 +1687,7 @@ Returns the full Spreadsheet object; grab \`.spreadsheetId\`.
1675
1687
 
1676
1688
  \`\`\`bash
1677
1689
  # Range is in A1 notation, e.g. "Sheet1!A1:C10"
1678
- curl -s "$MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/values/$(printf %s 'Sheet1!A1:C10' | jq -sRr @uri)" \\
1690
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/values/$(printf %s 'Sheet1!A1:C10' | jq -sRr @uri)" \\
1679
1691
  "\${GDRIVE_AUTH[@]}"
1680
1692
  \`\`\`
1681
1693
 
@@ -1683,7 +1695,7 @@ curl -s "$MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/values/$(printf %s 'Sheet1!A1:
1683
1695
 
1684
1696
  \`\`\`bash
1685
1697
  curl -s -X PUT \\
1686
- "$MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/values/$(printf %s 'Sheet1!A1:B2' | jq -sRr @uri)?valueInputOption=USER_ENTERED" \\
1698
+ "$REPLICAS_MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/values/$(printf %s 'Sheet1!A1:B2' | jq -sRr @uri)?valueInputOption=USER_ENTERED" \\
1687
1699
  "\${GDRIVE_AUTH[@]}" \\
1688
1700
  -H "Content-Type: application/json" \\
1689
1701
  -d '{
@@ -1701,7 +1713,7 @@ curl -s -X PUT \\
1701
1713
  ### Bulk operations (formatting, charts, new tabs, etc.)
1702
1714
 
1703
1715
  \`\`\`bash
1704
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
1716
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
1705
1717
  -H "Content-Type: application/json" \\
1706
1718
  -d '{ "requests": [ { "addSheet": { "properties": { "title": "Raw data" } } } ] }'
1707
1719
  \`\`\`
@@ -1713,7 +1725,7 @@ curl -s -X POST "$MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/batchUpdate" "\${GDRIV
1713
1725
  ### Create a new form
1714
1726
 
1715
1727
  \`\`\`bash
1716
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/forms" "\${GDRIVE_AUTH[@]}" \\
1728
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/forms" "\${GDRIVE_AUTH[@]}" \\
1717
1729
  -H "Content-Type: application/json" \\
1718
1730
  -d '{"title":"Customer feedback"}'
1719
1731
  \`\`\`
@@ -1725,7 +1737,7 @@ Returns the form. Grab \`.formId\`.
1725
1737
  The Forms API uses its own \`batchUpdate\`:
1726
1738
 
1727
1739
  \`\`\`bash
1728
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/forms/$FORM_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
1740
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/forms/$FORM_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
1729
1741
  -H "Content-Type: application/json" \\
1730
1742
  -d '{
1731
1743
  "requests": [
@@ -1752,7 +1764,7 @@ See the [Forms API Request reference](https://developers.google.com/workspace/fo
1752
1764
  ### Read responses
1753
1765
 
1754
1766
  \`\`\`bash
1755
- curl -s "$MONOLITH_URL/v1/gdrive/forms/$FORM_ID/responses" "\${GDRIVE_AUTH[@]}"
1767
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/forms/$FORM_ID/responses" "\${GDRIVE_AUTH[@]}"
1756
1768
  \`\`\`
1757
1769
 
1758
1770
  Pagination: pass \`?pageToken=...&pageSize=...\` to walk through responses.
@@ -1762,7 +1774,7 @@ Pagination: pass \`?pageToken=...&pageSize=...\` to walk through responses.
1762
1774
  ### Share a file with a person
1763
1775
 
1764
1776
  \`\`\`bash
1765
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}" \\
1777
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}" \\
1766
1778
  -H "Content-Type: application/json" \\
1767
1779
  -d '{
1768
1780
  "type": "user",
@@ -1777,7 +1789,7 @@ Roles: \`reader\`, \`commenter\`, \`writer\`. Types: \`user\`, \`group\`, \`doma
1777
1789
  ### Make a file viewable by anyone with the link
1778
1790
 
1779
1791
  \`\`\`bash
1780
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}" \\
1792
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}" \\
1781
1793
  -H "Content-Type: application/json" \\
1782
1794
  -d '{ "type": "anyone", "role": "reader" }'
1783
1795
  \`\`\`
@@ -1785,13 +1797,13 @@ curl -s -X POST "$MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_
1785
1797
  ### List existing permissions
1786
1798
 
1787
1799
  \`\`\`bash
1788
- curl -s "$MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}"
1800
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}"
1789
1801
  \`\`\`
1790
1802
 
1791
1803
  ### Rename / move a file
1792
1804
 
1793
1805
  \`\`\`bash
1794
- curl -s -X PATCH "$MONOLITH_URL/v1/gdrive/files/$FILE_ID" "\${GDRIVE_AUTH[@]}" \\
1806
+ curl -s -X PATCH "$REPLICAS_MONOLITH_URL/v1/gdrive/files/$FILE_ID" "\${GDRIVE_AUTH[@]}" \\
1795
1807
  -H "Content-Type: application/json" \\
1796
1808
  -d '{"name":"Final report.docx"}'
1797
1809
  \`\`\`
@@ -1801,7 +1813,7 @@ To move into a folder, also pass \`addParents\` and \`removeParents\` as query p
1801
1813
  ### Get file metadata
1802
1814
 
1803
1815
  \`\`\`bash
1804
- curl -s "$MONOLITH_URL/v1/gdrive/files/$FILE_ID?fields=id,name,mimeType,webViewLink,parents,modifiedTime" \\
1816
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/files/$FILE_ID?fields=id,name,mimeType,webViewLink,parents,modifiedTime" \\
1805
1817
  "\${GDRIVE_AUTH[@]}"
1806
1818
  \`\`\`
1807
1819
 
@@ -1810,13 +1822,13 @@ curl -s "$MONOLITH_URL/v1/gdrive/files/$FILE_ID?fields=id,name,mimeType,webViewL
1810
1822
  ### Delete a file
1811
1823
 
1812
1824
  \`\`\`bash
1813
- curl -s -X DELETE "$MONOLITH_URL/v1/gdrive/files/$FILE_ID" "\${GDRIVE_AUTH[@]}"
1825
+ curl -s -X DELETE "$REPLICAS_MONOLITH_URL/v1/gdrive/files/$FILE_ID" "\${GDRIVE_AUTH[@]}"
1814
1826
  \`\`\`
1815
1827
 
1816
1828
  ### List Replicas-created files
1817
1829
 
1818
1830
  \`\`\`bash
1819
- curl -s "$MONOLITH_URL/v1/gdrive/files?pageSize=50" "\${GDRIVE_AUTH[@]}"
1831
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/files?pageSize=50" "\${GDRIVE_AUTH[@]}"
1820
1832
  \`\`\`
1821
1833
 
1822
1834
  Pass \`?q=...\` to filter using [Drive API search syntax](https://developers.google.com/workspace/drive/api/guides/search-files). Only files the app created or was granted access to will appear.
@@ -1830,20 +1842,20 @@ Property identifiers must be URL-encoded as query parameters. URL-prefix propert
1830
1842
  ### List accessible properties
1831
1843
 
1832
1844
  \`\`\`bash
1833
- curl -s "$MONOLITH_URL/v1/gdrive/search-console/sites" "\${GDRIVE_AUTH[@]}"
1845
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/search-console/sites" "\${GDRIVE_AUTH[@]}"
1834
1846
  \`\`\`
1835
1847
 
1836
1848
  ### Get a property
1837
1849
 
1838
1850
  \`\`\`bash
1839
1851
  SITE_URL=$(printf %s 'sc-domain:example.com' | jq -sRr @uri)
1840
- curl -s "$MONOLITH_URL/v1/gdrive/search-console/site?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}"
1852
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/search-console/site?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}"
1841
1853
  \`\`\`
1842
1854
 
1843
1855
  ### Query search performance
1844
1856
 
1845
1857
  \`\`\`bash
1846
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/search-console/search-analytics/query?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}" \\
1858
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/search-console/search-analytics/query?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}" \\
1847
1859
  -H "Content-Type: application/json" \\
1848
1860
  -d '{
1849
1861
  "startDate": "2026-06-01",
@@ -1858,7 +1870,7 @@ Results contain clicks, impressions, CTR, and average position. Use \`startRow\`
1858
1870
  ### List sitemaps
1859
1871
 
1860
1872
  \`\`\`bash
1861
- curl -s "$MONOLITH_URL/v1/gdrive/search-console/sitemaps?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}"
1873
+ curl -s "$REPLICAS_MONOLITH_URL/v1/gdrive/search-console/sitemaps?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}"
1862
1874
  \`\`\`
1863
1875
 
1864
1876
  Pass a URL-encoded \`sitemapIndex\` query parameter to list sitemaps referenced by a sitemap index. To fetch one sitemap, call \`/v1/gdrive/search-console/sitemap\` with URL-encoded \`siteUrl\` and \`feedpath\` query parameters.
@@ -1866,7 +1878,7 @@ Pass a URL-encoded \`sitemapIndex\` query parameter to list sitemaps referenced
1866
1878
  ### Inspect an indexed URL
1867
1879
 
1868
1880
  \`\`\`bash
1869
- curl -s -X POST "$MONOLITH_URL/v1/gdrive/search-console/url-inspection" "\${GDRIVE_AUTH[@]}" \\
1881
+ curl -s -X POST "$REPLICAS_MONOLITH_URL/v1/gdrive/search-console/url-inspection" "\${GDRIVE_AUTH[@]}" \\
1870
1882
  -H "Content-Type: application/json" \\
1871
1883
  -d '{
1872
1884
  "inspectionUrl": "https://example.com/page",
@@ -1937,7 +1949,7 @@ This guide covers how to interact with Linear from within your Replicas workspac
1937
1949
  Check that the workspace has the Replicas engine credentials needed to proxy Linear requests:
1938
1950
 
1939
1951
  \`\`\`bash
1940
- test -n "$MONOLITH_URL" && test -n "$REPLICAS_ENGINE_SECRET" && test -n "$WORKSPACE_ID" && echo set
1952
+ test -n "$REPLICAS_MONOLITH_URL" && test -n "$REPLICAS_ENGINE_SECRET" && test -n "$REPLICAS_WORKSPACE_ID" && echo set
1941
1953
  \`\`\`
1942
1954
 
1943
1955
  - If **set**: Use the Replicas Linear proxy below. It refreshes Linear OAuth tokens for you.
@@ -1946,9 +1958,9 @@ test -n "$MONOLITH_URL" && test -n "$REPLICAS_ENGINE_SECRET" && test -n "$WORKSP
1946
1958
  Then verify Linear is connected:
1947
1959
 
1948
1960
  \`\`\`bash
1949
- curl -fsS -X POST "$MONOLITH_URL/v1/engine/linear/refresh-token" \\
1961
+ curl -fsS -X POST "$REPLICAS_MONOLITH_URL/v1/engine/linear/refresh-token" \\
1950
1962
  -H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
1951
- -H "X-Workspace-Id: $WORKSPACE_ID" \\
1963
+ -H "X-Workspace-Id: $REPLICAS_WORKSPACE_ID" \\
1952
1964
  -H "Content-Type: application/json" \\
1953
1965
  -d '{}' >/dev/null
1954
1966
  \`\`\`
@@ -1961,9 +1973,9 @@ Linear uses a GraphQL API. Always call it through Replicas so the access token s
1961
1973
 
1962
1974
  \`\`\`bash
1963
1975
  linear_graphql() {
1964
- curl -sS -X POST "$MONOLITH_URL/v1/engine/linear/graphql" \\
1976
+ curl -sS -X POST "$REPLICAS_MONOLITH_URL/v1/engine/linear/graphql" \\
1965
1977
  -H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
1966
- -H "X-Workspace-Id: $WORKSPACE_ID" \\
1978
+ -H "X-Workspace-Id: $REPLICAS_WORKSPACE_ID" \\
1967
1979
  -H "Content-Type: application/json" \\
1968
1980
  --data-binary @-
1969
1981
  }
@@ -2200,9 +2212,9 @@ ISSUE_UUID=... # the Linear issue's UUID
2200
2212
  MEDIA_ID=... # the media ID printed by \`replicas media upload\`
2201
2213
 
2202
2214
  linear_graphql() {
2203
- curl -sS -X POST "$MONOLITH_URL/v1/engine/linear/graphql" \\
2215
+ curl -sS -X POST "$REPLICAS_MONOLITH_URL/v1/engine/linear/graphql" \\
2204
2216
  -H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
2205
- -H "X-Workspace-Id: $WORKSPACE_ID" \\
2217
+ -H "X-Workspace-Id: $REPLICAS_WORKSPACE_ID" \\
2206
2218
  -H "Content-Type: application/json" \\
2207
2219
  --data-binary @-
2208
2220
  }
@@ -2233,7 +2245,7 @@ curl -s -X PUT "$UPLOAD_URL" \\
2233
2245
 
2234
2246
  # 3. Reference assetUrl inline in the comment body, alongside the dashboard link.
2235
2247
  BODY=$(printf '![screenshot](%s)\\n\\n[View in Replicas](https://tryreplicas.com/workspaces/%s?media=%s)' \\
2236
- "$ASSET_URL" "$WORKSPACE_ID" "$MEDIA_ID")
2248
+ "$ASSET_URL" "$REPLICAS_WORKSPACE_ID" "$MEDIA_ID")
2237
2249
 
2238
2250
  jq -n \\
2239
2251
  --arg issueId "$ISSUE_UUID" \\
@@ -2739,7 +2751,7 @@ replicas list
2739
2751
  replicas slack thread switch <workspace-id-or-name> --channel <channel-id> --thread-ts <thread-root-ts>
2740
2752
  \`\`\`
2741
2753
 
2742
- The channel and thread flags default to \`SLACK_CHANNEL_ID\` and \`SLACK_THREAD_TS\` for a Slack-triggered workspace. Workspace-authenticated agents may target only their current workspace; switching to a different workspace requires running the command with user authentication outside agent mode. If that restriction applies, give the user the exact command to run rather than claiming the switch succeeded.
2754
+ The channel and thread flags default to \`REPLICAS_SLACK_CHANNEL_ID\` and \`REPLICAS_SLACK_THREAD_TS\` for a Slack-triggered workspace. Workspace-authenticated agents may target only their current workspace; switching to a different workspace requires running the command with user authentication outside agent mode. If that restriction applies, give the user the exact command to run rather than claiming the switch succeeded.
2743
2755
 
2744
2756
  ### Searching Messages
2745
2757
 
@@ -5667,17 +5679,20 @@ function loadEngineEnv() {
5667
5679
  // Defined: always available
5668
5680
  REPLICAS_ENGINE_SECRET: requireDefined(readEnv("REPLICAS_ENGINE_SECRET"), "REPLICAS_ENGINE_SECRET"),
5669
5681
  REPLICAS_ENGINE_PORT: parsePort(readEnv("REPLICAS_ENGINE_PORT")),
5670
- MONOLITH_URL: requireValidURL(requireDefined(readEnv("MONOLITH_URL"), "MONOLITH_URL"), "MONOLITH_URL"),
5682
+ REPLICAS_MONOLITH_URL: requireValidURL(
5683
+ requireDefined(readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.monolithUrl), "REPLICAS_MONOLITH_URL"),
5684
+ "REPLICAS_MONOLITH_URL"
5685
+ ),
5671
5686
  HOME_DIR,
5672
5687
  WORKSPACE_ROOT: join2(HOME_DIR, "workspaces"),
5673
5688
  REPLICAS_SANDBOX_IMAGE_VERSION: readEnv("REPLICAS_SANDBOX_IMAGE_VERSION") ?? "development",
5674
5689
  // Runtime: may not be set during warming
5675
- WORKSPACE_ID: readEnv("WORKSPACE_ID"),
5676
- LINEAR_SESSION_ID: readEnv("LINEAR_SESSION_ID"),
5677
- LINEAR_ACCESS_TOKEN: readEnv("LINEAR_ACCESS_TOKEN"),
5678
- REPLICAS_SLACK_BOT_TOKEN: readEnv("REPLICAS_SLACK_BOT_TOKEN") ?? readEnv("SLACK_BOT_TOKEN"),
5679
- SLACK_CHANNEL_ID: readEnv("SLACK_CHANNEL_ID"),
5680
- SLACK_THREAD_TS: readEnv("SLACK_THREAD_TS"),
5690
+ REPLICAS_WORKSPACE_ID: readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.workspaceId),
5691
+ REPLICAS_LINEAR_SESSION_ID: readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.linearSessionId),
5692
+ REPLICAS_LINEAR_ACCESS_TOKEN: readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.linearAccessToken),
5693
+ REPLICAS_SLACK_BOT_TOKEN: readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.slackBotToken),
5694
+ REPLICAS_SLACK_CHANNEL_ID: readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.slackChannelId),
5695
+ REPLICAS_SLACK_THREAD_TS: readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.slackThreadTs),
5681
5696
  ANTHROPIC_API_KEY: readEnv("ANTHROPIC_API_KEY"),
5682
5697
  OPENAI_API_KEY: readEnv("OPENAI_API_KEY"),
5683
5698
  CURSOR_API_KEY: readEnv("CURSOR_API_KEY"),
@@ -5694,8 +5709,8 @@ function loadEngineEnv() {
5694
5709
  REPLICAS_DISABLE_AUTO_START_HOOKS: readEnv("REPLICAS_DISABLE_AUTO_START_HOOKS")?.toLowerCase() === "true",
5695
5710
  REPLICAS_ENGINE_DEFER_INITIALIZATION: readEnv("REPLICAS_ENGINE_DEFER_INITIALIZATION")?.toLowerCase() === "true"
5696
5711
  };
5697
- if (!IS_WARMING_MODE && !env.WORKSPACE_ID) {
5698
- console.error("WORKSPACE_ID is not set \u2014 this is required in normal (non-warming) mode");
5712
+ if (!IS_WARMING_MODE && !env.REPLICAS_WORKSPACE_ID) {
5713
+ console.error("REPLICAS_WORKSPACE_ID is not set \u2014 this is required in normal (non-warming) mode");
5699
5714
  }
5700
5715
  return env;
5701
5716
  }
@@ -5781,12 +5796,12 @@ var BaseRefreshManager = class {
5781
5796
  return this.intervalMs;
5782
5797
  }
5783
5798
  getRuntimeConfig() {
5784
- if (!ENGINE_ENV.WORKSPACE_ID) {
5799
+ if (!ENGINE_ENV.REPLICAS_WORKSPACE_ID) {
5785
5800
  return null;
5786
5801
  }
5787
5802
  return {
5788
- monolithUrl: ENGINE_ENV.MONOLITH_URL,
5789
- workspaceId: ENGINE_ENV.WORKSPACE_ID,
5803
+ monolithUrl: ENGINE_ENV.REPLICAS_MONOLITH_URL,
5804
+ workspaceId: ENGINE_ENV.REPLICAS_WORKSPACE_ID,
5790
5805
  engineSecret: ENGINE_ENV.REPLICAS_ENGINE_SECRET
5791
5806
  };
5792
5807
  }
@@ -5824,16 +5839,16 @@ var BaseRefreshManager = class {
5824
5839
 
5825
5840
  // src/services/monolith-service.ts
5826
5841
  async function monolithRequest(path6, init = {}) {
5827
- if (!ENGINE_ENV.WORKSPACE_ID) {
5828
- throw new Error("WORKSPACE_ID is not set; cannot call monolith");
5842
+ if (!ENGINE_ENV.REPLICAS_WORKSPACE_ID) {
5843
+ throw new Error("REPLICAS_WORKSPACE_ID is not set; cannot call monolith");
5829
5844
  }
5830
5845
  const isFormData = init.body instanceof FormData;
5831
5846
  const headers = {
5832
5847
  Authorization: `Bearer ${ENGINE_ENV.REPLICAS_ENGINE_SECRET}`,
5833
- "X-Workspace-Id": ENGINE_ENV.WORKSPACE_ID
5848
+ "X-Workspace-Id": ENGINE_ENV.REPLICAS_WORKSPACE_ID
5834
5849
  };
5835
5850
  if (!isFormData) headers["Content-Type"] = "application/json";
5836
- return fetch(`${ENGINE_ENV.MONOLITH_URL}${path6}`, {
5851
+ return fetch(`${ENGINE_ENV.REPLICAS_MONOLITH_URL}${path6}`, {
5837
5852
  method: init.method ?? "POST",
5838
5853
  headers,
5839
5854
  body: init.body === void 0 ? void 0 : isFormData ? init.body : JSON.stringify(init.body),
@@ -5866,7 +5881,7 @@ var MonolithService = class {
5866
5881
  }
5867
5882
  }
5868
5883
  async sendEvent(event) {
5869
- if (!ENGINE_ENV.WORKSPACE_ID) {
5884
+ if (!ENGINE_ENV.REPLICAS_WORKSPACE_ID) {
5870
5885
  return;
5871
5886
  }
5872
5887
  try {
@@ -7311,7 +7326,9 @@ var EnvironmentDetailsService = class {
7311
7326
  details.githubCredentialsConfigured = ghConfigured;
7312
7327
  details.gitlabAccessConfigured = gitlabAccessConfigured;
7313
7328
  details.gitlabCredentialsConfigured = gitlabAccessConfigured;
7314
- details.linearAccessConfigured = Boolean(ENGINE_ENV.LINEAR_SESSION_ID || ENGINE_ENV.LINEAR_ACCESS_TOKEN);
7329
+ details.linearAccessConfigured = Boolean(
7330
+ ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID || ENGINE_ENV.REPLICAS_LINEAR_ACCESS_TOKEN
7331
+ );
7315
7332
  details.slackAccessConfigured = Boolean(ENGINE_ENV.REPLICAS_SLACK_BOT_TOKEN);
7316
7333
  const freshRepos = repositories.map((repo) => ({
7317
7334
  repositoryName: repo.name,
@@ -8038,7 +8055,7 @@ async function attemptRegistration() {
8038
8055
  }
8039
8056
  }
8040
8057
  async function registerDesktopPreview() {
8041
- if (IS_WARMING_MODE || !ENGINE_ENV.WORKSPACE_ID) {
8058
+ if (IS_WARMING_MODE || !ENGINE_ENV.REPLICAS_WORKSPACE_ID) {
8042
8059
  return;
8043
8060
  }
8044
8061
  const deadline = Date.now() + REGISTRATION_TIMEOUT_MS;
@@ -8480,13 +8497,13 @@ async function getLinearAccessToken() {
8480
8497
  const response = await monolithRequest("/v1/engine/linear/refresh-token");
8481
8498
  if (!response.ok) {
8482
8499
  console.warn(`[ImageUtils] Failed to refresh Linear token: ${response.status} ${await response.text()}`);
8483
- return ENGINE_ENV.LINEAR_ACCESS_TOKEN;
8500
+ return ENGINE_ENV.REPLICAS_LINEAR_ACCESS_TOKEN;
8484
8501
  }
8485
8502
  const data = await response.json();
8486
8503
  return data.token;
8487
8504
  } catch (error) {
8488
8505
  console.warn("[ImageUtils] Failed to refresh Linear token:", error);
8489
- return ENGINE_ENV.LINEAR_ACCESS_TOKEN;
8506
+ return ENGINE_ENV.REPLICAS_LINEAR_ACCESS_TOKEN;
8490
8507
  }
8491
8508
  }
8492
8509
  function isLinearUploadUrl(url) {
@@ -8913,7 +8930,7 @@ var CodingAgentManager = class {
8913
8930
  };
8914
8931
  }
8915
8932
  emitInterruptedQueueEvent(queue) {
8916
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
8933
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
8917
8934
  if (!linearSessionId || queue.length === 0) {
8918
8935
  return;
8919
8936
  }
@@ -10255,7 +10272,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
10255
10272
  this.activeSessionSignature = signature;
10256
10273
  this.activeSessionModel = claudeCodeModel;
10257
10274
  this.activeSessionPermissionMode = resolvedPermissionMode;
10258
- this.sessionLinearForwarder = new LinearEventForwarder(ENGINE_ENV.LINEAR_SESSION_ID);
10275
+ this.sessionLinearForwarder = new LinearEventForwarder(ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID);
10259
10276
  this.activeBackgroundTasks.clear();
10260
10277
  this.clearBackgroundContinuationTimer();
10261
10278
  resetClaudeSessionActivity(this.sessionActivity);
@@ -10269,7 +10286,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
10269
10286
  });
10270
10287
  }
10271
10288
  async runSessionLoop(response) {
10272
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
10289
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
10273
10290
  const iterator = response[Symbol.asyncIterator]();
10274
10291
  let loopError = null;
10275
10292
  let suppressLinearResponseFlush = false;
@@ -10862,7 +10879,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
10862
10879
  var MIN_CODEX_CLI_VERSION = "0.144.6";
10863
10880
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
10864
10881
  var codexCliVersionEnsured = null;
10865
- var ENGINE_PACKAGE_VERSION = "0.1.577";
10882
+ var ENGINE_PACKAGE_VERSION = "0.1.578";
10866
10883
  var INITIALIZE_METHOD = "initialize";
10867
10884
  var INITIALIZED_NOTIFICATION = "initialized";
10868
10885
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -12329,7 +12346,7 @@ var CodexAspManager = class extends CodingAgentManager {
12329
12346
  let goalContinuationTimer = null;
12330
12347
  const completedItems = [];
12331
12348
  const agentMessageDeltas = /* @__PURE__ */ new Map();
12332
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
12349
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
12333
12350
  const model = request.model ?? DEFAULT_MODEL;
12334
12351
  let tempImagePaths = [];
12335
12352
  const linearForwarder = new LinearEventForwarder(linearSessionId);
@@ -13282,7 +13299,7 @@ var CursorManager = class extends CodingAgentManager {
13282
13299
  const aborted = new Promise((resolve4) => {
13283
13300
  this.abortActiveTurn = () => resolve4(TURN_ABORTED);
13284
13301
  });
13285
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
13302
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
13286
13303
  const linearForwarder = new LinearEventForwarder(linearSessionId);
13287
13304
  try {
13288
13305
  const includeInstructions = !this.initialSessionId && !this.instructionsDelivered;
@@ -13981,7 +13998,7 @@ var OpencodeManager = class extends CodingAgentManager {
13981
13998
  async processMessageInternal(request) {
13982
13999
  const provider = await getOpencodeProvider();
13983
14000
  const controller = new AbortController();
13984
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
14001
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
13985
14002
  const linearForwarder = new LinearEventForwarder(linearSessionId);
13986
14003
  this.activeAbortController = controller;
13987
14004
  this.activeLinearForwarder = linearForwarder;
@@ -14280,7 +14297,7 @@ var OpencodeManager = class extends CodingAgentManager {
14280
14297
  return false;
14281
14298
  }
14282
14299
  forwardOpencodePartToLinear(part) {
14283
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
14300
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
14284
14301
  if (!linearSessionId || !this.activeLinearForwarder) return;
14285
14302
  const event = convertOpencodePart(part, linearSessionId);
14286
14303
  if (!event) return;
@@ -15414,7 +15431,7 @@ var KeepAliveService = class _KeepAliveService {
15414
15431
  await this.ping();
15415
15432
  }
15416
15433
  async ping() {
15417
- if (!ENGINE_ENV.MONOLITH_URL || !ENGINE_ENV.REPLICAS_ENGINE_SECRET || !ENGINE_ENV.WORKSPACE_ID) {
15434
+ if (!ENGINE_ENV.REPLICAS_MONOLITH_URL || !ENGINE_ENV.REPLICAS_ENGINE_SECRET || !ENGINE_ENV.REPLICAS_WORKSPACE_ID) {
15418
15435
  return;
15419
15436
  }
15420
15437
  try {
@@ -16749,7 +16766,7 @@ var ChatService = class {
16749
16766
  gitlabTokenManager.refreshOnce().catch(() => {
16750
16767
  })
16751
16768
  ]);
16752
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
16769
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
16753
16770
  const observedBranches = chat.observedBranchesByRepo;
16754
16771
  chat.observedBranchesByRepo = /* @__PURE__ */ new Map();
16755
16772
  const errors = chat.persisted.parentChatId === null ? chat.lastTurnErrors : null;
@@ -18513,7 +18530,7 @@ var HeartbeatService = class _HeartbeatService {
18513
18530
  static HEARTBEAT_INTERVAL_MS = 15e3;
18514
18531
  static REQUEST_TIMEOUT_MS = 5e3;
18515
18532
  start(bootTimeMs2) {
18516
- if (IS_WARMING_MODE || !ENGINE_ENV.WORKSPACE_ID || this.interval) return;
18533
+ if (IS_WARMING_MODE || !ENGINE_ENV.REPLICAS_WORKSPACE_ID || this.interval) return;
18517
18534
  this.bootTimeMs = bootTimeMs2;
18518
18535
  void this.ping();
18519
18536
  this.interval = setInterval(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.577",
3
+ "version": "0.1.578",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",