replicas-engine 0.1.509 → 0.1.510

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 +61 -11
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -611,7 +611,7 @@ var WORKSPACE_SIZES = ["small", "large"];
611
611
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
612
612
 
613
613
  // ../shared/src/e2b.ts
614
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-26-v2";
614
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-27-v1";
615
615
 
616
616
  // ../shared/src/runtime-env.ts
617
617
  function shellQuotePosix(value) {
@@ -1293,37 +1293,86 @@ This guide covers how to work with GitLab-hosted repositories from within your R
1293
1293
  Git credentials for the workspace's GitLab hosts are pre-configured in \`~/.git-credentials\` and refreshed automatically. Plain \`git fetch\` / \`git pull\` / \`git push\` over HTTPS work with no additional setup.
1294
1294
 
1295
1295
  - Never ask the user for a GitLab token or PAT \u2014 credentials are already wired. If a push fails with an authentication error, report it to the user instead of working around it.
1296
+ - A workspace can hold credentials for several GitLab hosts, and \`origin\` is whatever the repo says it is. Always select the token by the host you are about to call, as the snippets below do. Grabbing the first entry in \`~/.git-credentials\` can send one host's token to another.
1296
1297
  - There is no \`glab\` CLI in the workspace, and \`gh\` only works for GitHub remotes. Check a repo's host with \`git remote get-url origin\` before choosing the GitHub or GitLab workflow.
1297
1298
 
1299
+ ### Reading the credential for a repo
1300
+
1301
+ A workspace can hold tokens for several GitLab hosts, so always ask git for the
1302
+ credential belonging to the host you are about to call. Never grep
1303
+ \`~/.git-credentials\` yourself: taking the first line sends one instance's token to
1304
+ another, and interpolating a host into a grep pattern makes it a regular
1305
+ expression. \`git credential fill\` matches the host exactly and returns nothing
1306
+ when there is no credential for it:
1307
+
1308
+ \`\`\`bash
1309
+ HOST=$(git remote get-url origin | sed -E 's#^[a-z]+://##; s#^[^@/]*@##; s#/.*##; s#:[^0-9].*##')
1310
+ TOKEN=$(printf 'protocol=https\\nhost=%s\\n\\n' "$HOST" | GIT_TERMINAL_PROMPT=0 git credential fill | sed -n 's/^password=//p')
1311
+ [ -n "$TOKEN" ] || { echo "no credential for $HOST"; exit 1; }
1312
+ \`\`\`
1313
+
1314
+ Every recipe below repeats these two lines so each block runs on its own, and
1315
+ every one calls \`https://$HOST\`, so the token only ever reaches the host it
1316
+ belongs to. Run them inside the repo whose API you are calling. An empty
1317
+ \`$TOKEN\` means the workspace has no credential for that host. Report that rather
1318
+ than reaching for another one.
1319
+
1298
1320
  ## Merge Requests
1299
1321
 
1300
1322
  Create a merge request directly from a push using push options:
1301
1323
 
1302
1324
  \`\`\`bash
1303
- git push -o merge_request.create -o merge_request.target=<default-branch> origin HEAD
1325
+ git push -o merge_request.create -o merge_request.target=<default-branch> -o merge_request.title="Title" origin HEAD
1304
1326
  \`\`\`
1305
1327
 
1306
1328
  Useful options:
1307
1329
 
1308
1330
  \`\`\`bash
1309
- -o merge_request.title="Title"
1310
- -o merge_request.description="Description"
1311
1331
  -o merge_request.draft # open as draft
1312
1332
  -o merge_request.remove_source_branch # delete branch on merge
1313
1333
  \`\`\`
1314
1334
 
1315
1335
  GitLab prints the MR URL in the push output \u2014 include it in your reply to the user.
1316
1336
 
1337
+ ### Setting the description
1338
+
1339
+ Do **not** pass the description as a push option. Push option values are shell
1340
+ arguments on one line, so a real description \u2014 headings, lists, the Replicas
1341
+ footer HTML \u2014 gets mangled or truncated. Write the body to a file and PUT it as
1342
+ JSON instead, which preserves it exactly:
1343
+
1344
+ \`\`\`bash
1345
+ HOST=$(git remote get-url origin | sed -E 's#^[a-z]+://##; s#^[^@/]*@##; s#/.*##; s#:[^0-9].*##')
1346
+ TOKEN=$(printf 'protocol=https\\nhost=%s\\n\\n' "$HOST" | GIT_TERMINAL_PROMPT=0 git credential fill | sed -n 's/^password=//p')
1347
+ PROJECT=$(python3 -c 'import urllib.parse; print(urllib.parse.quote("group/project", safe=""))')
1348
+ cat > /tmp/mr-body.md <<'EOF'
1349
+ ## Summary
1350
+ ...your full description, ending with the Replicas footer...
1351
+ EOF
1352
+ jq -Rs '{description: .}' /tmp/mr-body.md > /tmp/mr-body.json
1353
+ curl -sS --request PUT \\
1354
+ --header "Authorization: Bearer $TOKEN" \\
1355
+ --header "Content-Type: application/json" \\
1356
+ --data @/tmp/mr-body.json \\
1357
+ "https://$HOST/api/v4/projects/$PROJECT/merge_requests/<iid>"
1358
+ \`\`\`
1359
+
1360
+ Use the same command to edit a description later. Editing replaces the whole
1361
+ body, so re-include the Replicas footer every time \u2014 it is how merge requests
1362
+ opened through Replicas are counted.
1363
+
1317
1364
  ## GitLab API (advanced)
1318
1365
 
1319
1366
  For operations with no git equivalent (commenting on MRs, reading pipelines), call the REST API with the workspace credential:
1320
1367
 
1321
1368
  \`\`\`bash
1322
- TOKEN=$(grep -m1 '://oauth2:' ~/.git-credentials | sed -E 's#https://oauth2:([^@]+)@.*#\\1#')
1323
- curl -s -H "Authorization: Bearer $TOKEN" "https://gitlab.com/api/v4/projects/<url-encoded-path>/merge_requests"
1369
+ HOST=$(git remote get-url origin | sed -E 's#^[a-z]+://##; s#^[^@/]*@##; s#/.*##; s#:[^0-9].*##')
1370
+ TOKEN=$(printf 'protocol=https\\nhost=%s\\n\\n' "$HOST" | GIT_TERMINAL_PROMPT=0 git credential fill | sed -n 's/^password=//p')
1371
+ curl -s -H "Authorization: Bearer $TOKEN" "https://$HOST/api/v4/projects/<url-encoded-path>/merge_requests"
1324
1372
  \`\`\`
1325
1373
 
1326
- Use the repo's own host in the API base URL for self-managed instances.
1374
+ This works for gitlab.com and self-managed instances alike, because the base URL
1375
+ and the token both come from the repo's own host.
1327
1376
 
1328
1377
  ## Inline media in merge requests
1329
1378
 
@@ -1331,16 +1380,17 @@ GitLab provides a supported project Markdown uploads API. Upload media to Replic
1331
1380
 
1332
1381
  \`\`\`bash
1333
1382
  FILE=/abs/path/to/screenshot.png
1383
+ HOST=$(git remote get-url origin | sed -E 's#^[a-z]+://##; s#^[^@/]*@##; s#/.*##; s#:[^0-9].*##')
1334
1384
  PROJECT=$(python3 -c 'import urllib.parse; print(urllib.parse.quote("group/project", safe=""))')
1335
- TOKEN=$(grep -m1 '://oauth2:' ~/.git-credentials | sed -E 's#https://oauth2:([^@]+)@.*#\\1#')
1385
+ TOKEN=$(printf 'protocol=https\\nhost=%s\\n\\n' "$HOST" | GIT_TERMINAL_PROMPT=0 git credential fill | sed -n 's/^password=//p')
1336
1386
  UPLOAD=$(curl -sS --request POST \\
1337
1387
  --header "Authorization: Bearer $TOKEN" \\
1338
1388
  --form "file=@$FILE" \\
1339
- "https://gitlab.com/api/v4/projects/$PROJECT/uploads")
1389
+ "https://$HOST/api/v4/projects/$PROJECT/uploads")
1340
1390
  echo "$UPLOAD" | jq -r .markdown
1341
1391
  \`\`\`
1342
1392
 
1343
- Use the repository's own host for self-managed GitLab. Insert the returned \`markdown\` into the merge request description or comment and add the media's **View in Replicas** dashboard link. Images render inline; MP4, MOV, and WebM render as inline video players. Do not create a public Replicas forge share when this native upload succeeds.
1393
+ Insert the returned \`markdown\` into the merge request description or comment and add the media's **View in Replicas** dashboard link. Images render inline; MP4, MOV, and WebM render as inline video players. Do not create a public Replicas forge share when this native upload succeeds.
1344
1394
  `;
1345
1395
  var GITLAB_ABILITY = {
1346
1396
  label: "GitLab",
@@ -10031,7 +10081,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
10031
10081
  var MIN_CODEX_CLI_VERSION = "0.144.6";
10032
10082
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
10033
10083
  var codexCliVersionEnsured = null;
10034
- var ENGINE_PACKAGE_VERSION = "0.1.509";
10084
+ var ENGINE_PACKAGE_VERSION = "0.1.510";
10035
10085
  var INITIALIZE_METHOD = "initialize";
10036
10086
  var INITIALIZED_NOTIFICATION = "initialized";
10037
10087
  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.509",
3
+ "version": "0.1.510",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",