replicas-engine 0.1.577 → 0.1.579

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) {
@@ -8581,8 +8598,11 @@ var MessageQueueService = class {
8581
8598
  processing = false;
8582
8599
  messageIdCounter = 0;
8583
8600
  processMessage;
8584
- constructor(processMessage) {
8601
+ onProcessingChanged;
8602
+ constructor(processMessage, onProcessingChanged = () => {
8603
+ }) {
8585
8604
  this.processMessage = processMessage;
8605
+ this.onProcessingChanged = onProcessingChanged;
8586
8606
  }
8587
8607
  generateMessageId() {
8588
8608
  return `msg_${Date.now()}_${++this.messageIdCounter}`;
@@ -8638,12 +8658,16 @@ var MessageQueueService = class {
8638
8658
  }
8639
8659
  async startProcessing(queuedMessage) {
8640
8660
  this.processing = true;
8661
+ this.onProcessingChanged(true);
8641
8662
  try {
8642
8663
  await this.processMessage(queuedMessage);
8643
8664
  } catch (error) {
8644
8665
  console.error("[MessageQueue] Error processing message:", error);
8645
8666
  } finally {
8646
8667
  this.processing = false;
8668
+ if (this.queue.length === 0) {
8669
+ this.onProcessingChanged(false);
8670
+ }
8647
8671
  await this.processNextInQueue();
8648
8672
  }
8649
8673
  }
@@ -8750,6 +8774,7 @@ var CodingAgentManager = class {
8750
8774
  onSaveSessionId;
8751
8775
  onEvent;
8752
8776
  hostOnTurnComplete;
8777
+ onProcessingChanged;
8753
8778
  compacting = false;
8754
8779
  constructor(options) {
8755
8780
  this.workingDirectory = options.workingDirectory ?? ENGINE_ENV.WORKSPACE_ROOT;
@@ -8757,6 +8782,8 @@ var CodingAgentManager = class {
8757
8782
  this.onSaveSessionId = options.onSaveSessionId;
8758
8783
  this.onEvent = options.onEvent;
8759
8784
  this.hostOnTurnComplete = options.onTurnComplete;
8785
+ this.onProcessingChanged = options.onProcessingChanged ?? (() => {
8786
+ });
8760
8787
  }
8761
8788
  onTurnComplete = async () => {
8762
8789
  if (this.compacting) {
@@ -8798,7 +8825,7 @@ var CodingAgentManager = class {
8798
8825
  historyFile.append(event);
8799
8826
  }
8800
8827
  initializeManager(processMessage) {
8801
- this.messageQueue = new MessageQueueService(processMessage);
8828
+ this.messageQueue = new MessageQueueService(processMessage, this.onProcessingChanged);
8802
8829
  this.initialized = this.initialize();
8803
8830
  }
8804
8831
  async interrupt() {
@@ -8913,7 +8940,7 @@ var CodingAgentManager = class {
8913
8940
  };
8914
8941
  }
8915
8942
  emitInterruptedQueueEvent(queue) {
8916
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
8943
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
8917
8944
  if (!linearSessionId || queue.length === 0) {
8918
8945
  return;
8919
8946
  }
@@ -9709,8 +9736,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
9709
9736
  }
9710
9737
  async interruptActiveTurn() {
9711
9738
  this.pendingInterrupt = true;
9712
- if (this.activeQuery) {
9713
- await this.activeQuery.interrupt();
9739
+ const query2 = this.activeQuery;
9740
+ if (query2) {
9741
+ const taskIds = [...this.activeBackgroundTasks];
9742
+ await Promise.allSettled(taskIds.map((taskId) => query2.stopTask(taskId)));
9743
+ await query2.interrupt();
9714
9744
  }
9715
9745
  await this.abortAllPendingToolInputs();
9716
9746
  }
@@ -9734,7 +9764,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
9734
9764
  return this.authRetrying;
9735
9765
  }
9736
9766
  isProcessing() {
9737
- return super.isProcessing() || isClaudeSessionActive(this.sessionActivity);
9767
+ return super.isProcessing() || isClaudeSessionActive(this.sessionActivity) || this.activeBackgroundTasks.size > 0;
9738
9768
  }
9739
9769
  hasActiveBackgroundTasks() {
9740
9770
  return this.activeBackgroundTasks.size > 0;
@@ -10255,7 +10285,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
10255
10285
  this.activeSessionSignature = signature;
10256
10286
  this.activeSessionModel = claudeCodeModel;
10257
10287
  this.activeSessionPermissionMode = resolvedPermissionMode;
10258
- this.sessionLinearForwarder = new LinearEventForwarder(ENGINE_ENV.LINEAR_SESSION_ID);
10288
+ this.sessionLinearForwarder = new LinearEventForwarder(ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID);
10259
10289
  this.activeBackgroundTasks.clear();
10260
10290
  this.clearBackgroundContinuationTimer();
10261
10291
  resetClaudeSessionActivity(this.sessionActivity);
@@ -10269,7 +10299,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
10269
10299
  });
10270
10300
  }
10271
10301
  async runSessionLoop(response) {
10272
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
10302
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
10273
10303
  const iterator = response[Symbol.asyncIterator]();
10274
10304
  let loopError = null;
10275
10305
  let suppressLinearResponseFlush = false;
@@ -10420,6 +10450,10 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
10420
10450
  }
10421
10451
  static updateBackgroundTaskState(message, activeTasks) {
10422
10452
  if (message.type !== "system") return;
10453
+ if (message.subtype === "session_state_changed" && message.state === "idle") {
10454
+ activeTasks.clear();
10455
+ return;
10456
+ }
10423
10457
  if (message.subtype === "background_tasks_changed") {
10424
10458
  activeTasks.clear();
10425
10459
  for (const task of message.tasks) {
@@ -10862,7 +10896,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
10862
10896
  var MIN_CODEX_CLI_VERSION = "0.144.6";
10863
10897
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
10864
10898
  var codexCliVersionEnsured = null;
10865
- var ENGINE_PACKAGE_VERSION = "0.1.577";
10899
+ var ENGINE_PACKAGE_VERSION = "0.1.579";
10866
10900
  var INITIALIZE_METHOD = "initialize";
10867
10901
  var INITIALIZED_NOTIFICATION = "initialized";
10868
10902
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -12329,7 +12363,7 @@ var CodexAspManager = class extends CodingAgentManager {
12329
12363
  let goalContinuationTimer = null;
12330
12364
  const completedItems = [];
12331
12365
  const agentMessageDeltas = /* @__PURE__ */ new Map();
12332
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
12366
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
12333
12367
  const model = request.model ?? DEFAULT_MODEL;
12334
12368
  let tempImagePaths = [];
12335
12369
  const linearForwarder = new LinearEventForwarder(linearSessionId);
@@ -13282,7 +13316,7 @@ var CursorManager = class extends CodingAgentManager {
13282
13316
  const aborted = new Promise((resolve4) => {
13283
13317
  this.abortActiveTurn = () => resolve4(TURN_ABORTED);
13284
13318
  });
13285
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
13319
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
13286
13320
  const linearForwarder = new LinearEventForwarder(linearSessionId);
13287
13321
  try {
13288
13322
  const includeInstructions = !this.initialSessionId && !this.instructionsDelivered;
@@ -13981,7 +14015,7 @@ var OpencodeManager = class extends CodingAgentManager {
13981
14015
  async processMessageInternal(request) {
13982
14016
  const provider = await getOpencodeProvider();
13983
14017
  const controller = new AbortController();
13984
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
14018
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
13985
14019
  const linearForwarder = new LinearEventForwarder(linearSessionId);
13986
14020
  this.activeAbortController = controller;
13987
14021
  this.activeLinearForwarder = linearForwarder;
@@ -14280,7 +14314,7 @@ var OpencodeManager = class extends CodingAgentManager {
14280
14314
  return false;
14281
14315
  }
14282
14316
  forwardOpencodePartToLinear(part) {
14283
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
14317
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
14284
14318
  if (!linearSessionId || !this.activeLinearForwarder) return;
14285
14319
  const event = convertOpencodePart(part, linearSessionId);
14286
14320
  if (!event) return;
@@ -15414,7 +15448,7 @@ var KeepAliveService = class _KeepAliveService {
15414
15448
  await this.ping();
15415
15449
  }
15416
15450
  async ping() {
15417
- if (!ENGINE_ENV.MONOLITH_URL || !ENGINE_ENV.REPLICAS_ENGINE_SECRET || !ENGINE_ENV.WORKSPACE_ID) {
15451
+ if (!ENGINE_ENV.REPLICAS_MONOLITH_URL || !ENGINE_ENV.REPLICAS_ENGINE_SECRET || !ENGINE_ENV.REPLICAS_WORKSPACE_ID) {
15418
15452
  return;
15419
15453
  }
15420
15454
  try {
@@ -15970,9 +16004,12 @@ function acceptedEventInCodexTranscript(acceptedEvent, transcript) {
15970
16004
  }
15971
16005
  var LAST_MESSAGE_PREVIEW_MAX = 200;
15972
16006
  var MAX_ACCEPTED_SEND_RESPONSES = 50;
15973
- function isChatActive(chat) {
16007
+ function hasActiveAgentWork(chat) {
15974
16008
  return chat.provider.isProcessing() || (chat.provider.hasActiveBackgroundTasks?.() ?? false);
15975
16009
  }
16010
+ function hasActiveChatTurn(chat) {
16011
+ return chat.hasActiveTurn || chat.pendingMessageIds.length > 0;
16012
+ }
15976
16013
  function isPersistedChat(value) {
15977
16014
  if (!isRecord4(value)) {
15978
16015
  return false;
@@ -16013,7 +16050,7 @@ var ChatService = class {
16013
16050
  this.workingDirectory = workingDirectory;
16014
16051
  this.analyticsService = analyticsService2;
16015
16052
  keepAliveService.setActivityCheck(
16016
- () => [...this.chats.values()].some((chat) => !chat.persisted.deletedAt && isChatActive(chat))
16053
+ () => [...this.chats.values()].some((chat) => !chat.persisted.deletedAt && hasActiveAgentWork(chat))
16017
16054
  );
16018
16055
  }
16019
16056
  workingDirectory;
@@ -16256,7 +16293,7 @@ var ChatService = class {
16256
16293
  const chat = this.requireChat(chatId);
16257
16294
  return {
16258
16295
  chatId,
16259
- processing: chat.provider.isProcessing(),
16296
+ processing: hasActiveChatTurn(chat),
16260
16297
  queue: chat.provider.getQueue()
16261
16298
  };
16262
16299
  }
@@ -16392,7 +16429,7 @@ var ChatService = class {
16392
16429
  getProcessingCount() {
16393
16430
  let count = 0;
16394
16431
  for (const chat of this.chats.values()) {
16395
- if (!chat.persisted.deletedAt && isChatActive(chat)) {
16432
+ if (!chat.persisted.deletedAt && hasActiveAgentWork(chat)) {
16396
16433
  count += 1;
16397
16434
  }
16398
16435
  }
@@ -16434,6 +16471,16 @@ var ChatService = class {
16434
16471
  const onProviderEvent = (event) => {
16435
16472
  this.handleTurnEvent(persisted.id, event);
16436
16473
  };
16474
+ const onProcessingChanged = (processing) => {
16475
+ if (processing) return;
16476
+ const chat = this.getRuntimeChat(persisted.id);
16477
+ if (!chat) return;
16478
+ this.publish({
16479
+ type: "chat.updated",
16480
+ payload: { chat: this.toSummary(chat) }
16481
+ }).catch(() => {
16482
+ });
16483
+ };
16437
16484
  if (persisted.parentChatId === void 0) {
16438
16485
  persisted.parentChatId = null;
16439
16486
  }
@@ -16445,7 +16492,8 @@ var ChatService = class {
16445
16492
  initialSessionId: persisted.providerSessionId,
16446
16493
  onSaveSessionId: saveSession,
16447
16494
  onTurnComplete: onProviderTurnComplete,
16448
- onEvent: onProviderEvent
16495
+ onEvent: onProviderEvent,
16496
+ onProcessingChanged
16449
16497
  });
16450
16498
  } else if (persisted.provider === "relay") {
16451
16499
  provider = new RelayManager({
@@ -16455,6 +16503,7 @@ var ChatService = class {
16455
16503
  onSaveSessionId: saveSession,
16456
16504
  onTurnComplete: onProviderTurnComplete,
16457
16505
  onEvent: onProviderEvent,
16506
+ onProcessingChanged,
16458
16507
  chatId: persisted.id,
16459
16508
  codexAvailable: isCodexAvailable(),
16460
16509
  opencodeAvailable: isOpencodeAvailable(),
@@ -16468,7 +16517,8 @@ var ChatService = class {
16468
16517
  initialSessionId: persisted.providerSessionId,
16469
16518
  onSaveSessionId: saveSession,
16470
16519
  onTurnComplete: onProviderTurnComplete,
16471
- onEvent: onProviderEvent
16520
+ onEvent: onProviderEvent,
16521
+ onProcessingChanged
16472
16522
  });
16473
16523
  } else if (persisted.provider === "opencode") {
16474
16524
  provider = new OpencodeManager({
@@ -16477,7 +16527,8 @@ var ChatService = class {
16477
16527
  initialSessionId: persisted.providerSessionId,
16478
16528
  onSaveSessionId: saveSession,
16479
16529
  onTurnComplete: onProviderTurnComplete,
16480
- onEvent: onProviderEvent
16530
+ onEvent: onProviderEvent,
16531
+ onProcessingChanged
16481
16532
  });
16482
16533
  } else if (persisted.provider === "pi") {
16483
16534
  provider = new PiManager({
@@ -16486,7 +16537,8 @@ var ChatService = class {
16486
16537
  initialSessionId: persisted.providerSessionId,
16487
16538
  onSaveSessionId: saveSession,
16488
16539
  onTurnComplete: onProviderTurnComplete,
16489
- onEvent: onProviderEvent
16540
+ onEvent: onProviderEvent,
16541
+ onProcessingChanged
16490
16542
  });
16491
16543
  } else {
16492
16544
  provider = new CodexAspManager({
@@ -16495,7 +16547,8 @@ var ChatService = class {
16495
16547
  initialSessionId: persisted.providerSessionId,
16496
16548
  onSaveSessionId: saveSession,
16497
16549
  onTurnComplete: onProviderTurnComplete,
16498
- onEvent: onProviderEvent
16550
+ onEvent: onProviderEvent,
16551
+ onProcessingChanged
16499
16552
  });
16500
16553
  }
16501
16554
  return {
@@ -16524,7 +16577,8 @@ var ChatService = class {
16524
16577
  title: chat.persisted.title,
16525
16578
  createdAt: chat.persisted.createdAt,
16526
16579
  updatedAt: chat.persisted.updatedAt,
16527
- processing: isChatActive(chat),
16580
+ processing: hasActiveChatTurn(chat),
16581
+ activityTrackingVersion: 1,
16528
16582
  awaitingInput: chat.provider.isAwaitingInput?.() ?? false,
16529
16583
  isCompacting: chat.provider.isCompacting?.() ?? false,
16530
16584
  isAuthRetrying: chat.provider.isAuthRetrying?.() ?? false,
@@ -16643,7 +16697,7 @@ var ChatService = class {
16643
16697
  payload: {
16644
16698
  chatId,
16645
16699
  isComplete: true,
16646
- processing: chat.provider.hasActiveBackgroundTasks?.() ?? false,
16700
+ processing: false,
16647
16701
  completedAt
16648
16702
  }
16649
16703
  }).catch(() => {
@@ -16749,7 +16803,7 @@ var ChatService = class {
16749
16803
  gitlabTokenManager.refreshOnce().catch(() => {
16750
16804
  })
16751
16805
  ]);
16752
- const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
16806
+ const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
16753
16807
  const observedBranches = chat.observedBranchesByRepo;
16754
16808
  chat.observedBranchesByRepo = /* @__PURE__ */ new Map();
16755
16809
  const errors = chat.persisted.parentChatId === null ? chat.lastTurnErrors : null;
@@ -18513,7 +18567,7 @@ var HeartbeatService = class _HeartbeatService {
18513
18567
  static HEARTBEAT_INTERVAL_MS = 15e3;
18514
18568
  static REQUEST_TIMEOUT_MS = 5e3;
18515
18569
  start(bootTimeMs2) {
18516
- if (IS_WARMING_MODE || !ENGINE_ENV.WORKSPACE_ID || this.interval) return;
18570
+ if (IS_WARMING_MODE || !ENGINE_ENV.REPLICAS_WORKSPACE_ID || this.interval) return;
18517
18571
  this.bootTimeMs = bootTimeMs2;
18518
18572
  void this.ping();
18519
18573
  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.579",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",