replicas-cli 0.2.672 → 0.2.674
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +48 -52
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22818,12 +22818,20 @@ function coerceAuthFallbackPayload(payload) {
|
|
|
22818
22818
|
|
|
22819
22819
|
// ../shared/src/engine/v1.ts
|
|
22820
22820
|
var CHAT_STREAM_RESYNC_EVENT_TYPE = "chat.stream.resync";
|
|
22821
|
+
var CHAT_STREAM_READY_EVENT_TYPE = "chat.stream.ready";
|
|
22822
|
+
var chatEventSubscriptionsSchema = external_exports.object({
|
|
22823
|
+
chats: external_exports.array(external_exports.object({
|
|
22824
|
+
workspaceId: external_exports.string().uuid(),
|
|
22825
|
+
chatId: external_exports.string().min(1).max(256),
|
|
22826
|
+
after: external_exports.string().regex(/^\d+-\d+$/)
|
|
22827
|
+
})).min(1).max(256)
|
|
22828
|
+
});
|
|
22821
22829
|
function isChatStreamEvent(value) {
|
|
22822
22830
|
return isRecord(value) && typeof value.id === "string" && typeof value.ts === "string" && typeof value.type === "string" && value.type.startsWith("chat.") && isRecord(value.payload);
|
|
22823
22831
|
}
|
|
22824
22832
|
var ENGINE_CHAT_EVENTS_PUSH_MAX_EVENTS = 500;
|
|
22825
22833
|
var chatScopedEngineEventSchema = external_exports.custom(
|
|
22826
|
-
(value) => isChatStreamEvent(value) && value.type !== CHAT_STREAM_RESYNC_EVENT_TYPE
|
|
22834
|
+
(value) => isChatStreamEvent(value) && value.type !== CHAT_STREAM_RESYNC_EVENT_TYPE && value.type !== CHAT_STREAM_READY_EVENT_TYPE
|
|
22827
22835
|
);
|
|
22828
22836
|
var engineChatEventsPushRequestSchema = external_exports.object({
|
|
22829
22837
|
epoch: external_exports.string().min(1).max(64),
|
|
@@ -23576,7 +23584,7 @@ gh pr review 123 --request-changes --body "Changes needed"
|
|
|
23576
23584
|
|
|
23577
23585
|
## Media in GitHub workflows
|
|
23578
23586
|
|
|
23579
|
-
Media delivery is owned by \`references/MEDIA.md\`. Read its GitHub section before adding screenshots, recordings, diagrams, or HTML reports to a pull request, issue, review comment, or commit; it covers
|
|
23587
|
+
Media delivery is owned by \`references/MEDIA.md\`. Read its GitHub section before adding screenshots, recordings, diagrams, or HTML reports to a pull request, issue, review comment, or commit; it covers public Forge embeds for images and recording previews, organization-only HTML links, and the required **View in Replicas** link.
|
|
23580
23588
|
`;
|
|
23581
23589
|
var GITHUB_ABILITY = {
|
|
23582
23590
|
label: "GitHub",
|
|
@@ -23779,7 +23787,7 @@ Upload to Replicas in these cases \u2014 and **only** these cases:
|
|
|
23779
23787
|
|
|
23780
23788
|
1. **Media you produce.** Any screenshot, screen recording, generated diagram, audio clip, or HTML page you create that the user might want to see. Upload before doing anything else with the file (analyzing, deleting, sending elsewhere). This applies even when you're also sending the file to Slack, Linear, GitHub, or GitLab.
|
|
23781
23789
|
2. **Files the user explicitly asks you to upload.** If the user sends or points at a file (image, video, audio, HTML) and asks you to upload it, run \`replicas media upload\`. Otherwise leave it alone \u2014 files in the workspace the user did not ask about should not be auto-uploaded as media.
|
|
23782
|
-
3. **Anything you plan to share externally (Slack, Linear, GitHub, GitLab, etc.).** Upload to Replicas
|
|
23790
|
+
3. **Anything you plan to share externally (Slack, Linear, GitHub, GitLab, etc.).** Upload to Replicas first, then follow the destination's delivery path below.
|
|
23783
23791
|
|
|
23784
23792
|
If none of these apply, don't upload.
|
|
23785
23793
|
|
|
@@ -23789,9 +23797,9 @@ If none of these apply, don't upload.
|
|
|
23789
23797
|
|
|
23790
23798
|
1. First, run \`replicas media upload\` with the original file. Do not begin any destination upload until the command succeeds. This creates the canonical dashboard copy and prints a chat embed plus a per-file dashboard link. With public access, the printed Forge embed is the chat embed and is also safe to use on GitHub.
|
|
23791
23799
|
2. Include the printed embed line in the Replicas chat reply, followed by the matching **View in Replicas** link. HTML uses its printed page link instead of an image embed.
|
|
23792
|
-
3. Identify every destination in the task and
|
|
23800
|
+
3. Identify every destination in the task and use its inline representation from the table below. Slack, Linear, and GitLab require an upload of the same original bytes; GitHub uses the public Forge embed.
|
|
23793
23801
|
4. Put the **View in Replicas** dashboard link next to the destination embed as a secondary link.
|
|
23794
|
-
5. Check each destination response. If
|
|
23802
|
+
5. Check each destination response. If its upload or Forge share fails, say so explicitly and keep the dashboard link; never claim that a dashboard link is an inline embed.
|
|
23795
23803
|
|
|
23796
23804
|
| Destination | Required file delivery | Inline result |
|
|
23797
23805
|
|---|---|---|
|
|
@@ -23799,9 +23807,9 @@ If none of these apply, don't upload.
|
|
|
23799
23807
|
| Slack | \`files.getUploadURLExternal\` \u2192 raw-byte POST \u2192 \`files.completeUploadExternal\` | Uploaded file in the channel or thread |
|
|
23800
23808
|
| Linear | \`fileUpload\` mutation \u2192 presigned upload \u2192 issue/comment mutation | Returned \`assetUrl\` in Markdown |
|
|
23801
23809
|
| GitLab | Project \`/uploads\` endpoint with the original bytes | Returned GitLab Markdown |
|
|
23802
|
-
| GitHub |
|
|
23810
|
+
| GitHub | Replicas public Forge share for an image or recording poster | Printed Forge embed, linked to the recording when needed |
|
|
23803
23811
|
|
|
23804
|
-
The dashboard link is the subtitle and jump-back path. It is never a substitute for the destination
|
|
23812
|
+
The dashboard link is the subtitle and jump-back path. It is never a substitute for the destination embed.
|
|
23805
23813
|
|
|
23806
23814
|
## Uploading to Replicas
|
|
23807
23815
|
|
|
@@ -23830,7 +23838,7 @@ Names are normalized to hyphen-case (spaces become hyphens, e.g. \`Login page\`
|
|
|
23830
23838
|
For each media file, the CLI prints an embed line and a dashboard link:
|
|
23831
23839
|
|
|
23832
23840
|
1. Default and organization access print \`Replicas chat embed: \`; this authenticated URL renders inline in Replicas chat **only** \u2014 see below.
|
|
23833
|
-
2. Public access (\`--access public\` or \`--share\`) prints \`\` as the Forge embed instead. This is the public, stable bearer URL
|
|
23841
|
+
2. Public access (\`--access public\` or \`--share\`) prints \`\` as the Forge embed instead. This is the public, stable bearer URL to paste into GitHub when sharing is authorized.
|
|
23834
23842
|
3. \`View in Replicas: <deep-link>\` is a per-file dashboard URL of the form \`https://app.replicas.dev/workspaces/<workspace-id>?media=<media-id>\` that opens directly to that specific file.
|
|
23835
23843
|
|
|
23836
23844
|
Match each "View in Replicas" line to the embed line directly above it \u2014 that's the deep link for that file.
|
|
@@ -23859,7 +23867,7 @@ replicas media upload screenshot.png --name "Login page" --access public
|
|
|
23859
23867
|
|---|---|---|
|
|
23860
23868
|
| \`https://api.replicas.dev/v1/media/<id>\` (inside \`\`) | Authenticated API redirect to a presigned blob \u2014 requires the Replicas chat session | **Only** in the Replicas chat reply. Nowhere else. |
|
|
23861
23869
|
| \`https://replicas.dev/organizations/<organization-id>/media/<media-id>\` | Organization-only page printed by \`--access organization\` | Pull requests and other places where every viewer belongs to the Replicas organization. |
|
|
23862
|
-
| \`https://api.replicas.dev/v1/media/public/<id>/<token>\` | Opt-in public bearer URL printed by \`--access public\` or \`--share\` | The Replicas chat reply and GitHub
|
|
23870
|
+
| \`https://api.replicas.dev/v1/media/public/<id>/<token>\` | Opt-in public bearer URL printed by \`--access public\` or \`--share\` | The Replicas chat reply and GitHub embeds, for image, video, or audio media. |
|
|
23863
23871
|
| \`https://app.replicas.dev/workspaces/<workspace-id>?media=<media-id>\` | Authenticated dashboard deep link that opens the media file in the workspace | Everywhere external: Slack, GitHub, GitLab, Linear, PR bodies, comments, emails. |
|
|
23864
23872
|
|
|
23865
23873
|
### NEVER link the API redirect URL outside the Replicas chat reply
|
|
@@ -23898,12 +23906,12 @@ After (or alongside) the embeds, include a \`[View in Replicas](<deep-link>)\` h
|
|
|
23898
23906
|
|
|
23899
23907
|
After \`replicas media upload\` succeeds, external delivery has two required follow-up steps for every file:
|
|
23900
23908
|
|
|
23901
|
-
1. **
|
|
23909
|
+
1. **Use the destination's inline representation:** upload the raw bytes to Slack, Linear, or GitLab; embed a public Forge share on GitHub.
|
|
23902
23910
|
2. **Link the Replicas dashboard deep link** (\`?media=<id>\` form) so the user can jump straight to the file in the workspace.
|
|
23903
23911
|
|
|
23904
|
-
A link alone is not enough. An
|
|
23912
|
+
A dashboard link alone is not enough. An embed without the dashboard link is not enough. Do both.
|
|
23905
23913
|
|
|
23906
|
-
Slack, Linear, and GitLab receive the original bytes through their native upload APIs. GitHub
|
|
23914
|
+
Slack, Linear, and GitLab receive the original bytes through their native upload APIs. GitHub uses a Replicas public Forge share for screenshots and recording previews.
|
|
23907
23915
|
|
|
23908
23916
|
### Slack \u2014 embed natively via the 3-step external file upload flow
|
|
23909
23917
|
|
|
@@ -24004,44 +24012,28 @@ The same flow works for issue bodies (use \`issueCreate\` / \`issueUpdate\` with
|
|
|
24004
24012
|
|
|
24005
24013
|
Never paste the \`api.replicas.dev/v1/media/<id>\` URL into a Linear body or comment \u2014 it will render as a broken image to anyone outside your Replicas chat.
|
|
24006
24014
|
|
|
24007
|
-
### GitHub:
|
|
24008
|
-
|
|
24009
|
-
GitHub CLI v2.99.0+ supports a repeatable \`--attach\` flag on \`gh pr create\`, \`gh pr edit\`, and \`gh pr comment\` for GitHub.com and GitHub Enterprise Cloud. It uploads local images and videos to GitHub and writes the resulting attachment URL into the PR body or comment; it requires push access to the repository. GitHub Enterprise Server and unsupported media kinds are not covered by this path. See [GitHub's attachment guide](https://docs.github.com/en/github-cli/github-cli/attaching-files-with-github-cli).
|
|
24015
|
+
### GitHub: inline images and recording previews via Forge
|
|
24010
24016
|
|
|
24011
|
-
|
|
24017
|
+
Replicas authenticates GitHub with GitHub App tokens, which native GitHub CLI attachment uploads do not support. Do not use \`gh --attach\` for media. Use a public Forge share for images in PR descriptions, issues, and comments.
|
|
24012
24018
|
|
|
24013
|
-
|
|
24014
|
-
2. Put each local file path in the Markdown body where the attachment should appear, and place its dashboard link next to it.
|
|
24015
|
-
3. Pass the same original path once with \`--attach\`. GitHub CLI rewrites a matching local reference in place, preserving its alt text; an unreferenced attachment is appended to the body.
|
|
24019
|
+
Create a public share only for a public repository or after explicit consent to publish media from a private repository. If sharing is not authorized, keep the media private and include its **View in Replicas** link, explaining that inline GitHub images require a public share.
|
|
24016
24020
|
|
|
24017
|
-
|
|
24018
|
-
Before the change:
|
|
24019
|
-
|
|
24020
|
-

|
|
24021
|
-
[View in Replicas](https://app.replicas.dev/workspaces/<workspace-id>?media=<before-media-id>)
|
|
24022
|
-
\`\`\`
|
|
24021
|
+
1. Upload the image with public access. This creates both the Replicas dashboard copy and the Forge share:
|
|
24023
24022
|
|
|
24024
24023
|
\`\`\`bash
|
|
24025
|
-
|
|
24026
|
-
--title "Describe the change" \\
|
|
24027
|
-
--body-file /tmp/pr-body.md \\
|
|
24028
|
-
--attach /tmp/before.png
|
|
24029
|
-
|
|
24030
|
-
gh pr edit 456 --body-file /tmp/pr-body.md --attach /tmp/after.png
|
|
24031
|
-
gh pr comment 456 --body-file /tmp/comment.md --attach /tmp/result.mp4
|
|
24024
|
+
replicas media upload /tmp/screenshot.png --name "PR screenshot" --access public
|
|
24032
24025
|
\`\`\`
|
|
24033
24026
|
|
|
24034
|
-
|
|
24035
|
-
|
|
24036
|
-
### GitHub attachment fallback
|
|
24037
|
-
|
|
24038
|
-
If \`--attach\` is unavailable, the target is GitHub Enterprise Server, the file is not an image or video, or the native upload fails, keep the Replicas dashboard link and report the limitation. For an inline screenshot or video poster, create a Replicas public forge share only for a public repository or after explicit consent to publish media from a private repository, then use the printed \`Forge embed\` Markdown:
|
|
24027
|
+
2. Copy the printed \`\` Forge embed into the body file, followed by the matching **View in Replicas** link. Use the printed public URL verbatim; never use a local file path, the authenticated API URL, or an expiring storage URL.
|
|
24028
|
+
3. Create or update the PR using the body file:
|
|
24039
24029
|
|
|
24040
24030
|
\`\`\`bash
|
|
24041
|
-
|
|
24031
|
+
gh pr create --title "Describe the change" --body-file /tmp/pr-body.md
|
|
24032
|
+
gh pr edit 456 --body-file /tmp/pr-body.md
|
|
24033
|
+
gh pr comment 456 --body-file /tmp/comment.md
|
|
24042
24034
|
\`\`\`
|
|
24043
24035
|
|
|
24044
|
-
For a
|
|
24036
|
+
GitHub does not reliably render external videos as inline players. For a recording preview, upload the MP4 normally, generate a poster with \`ffmpeg -i /tmp/demo.mp4 -frames:v 1 /tmp/demo-poster.png\`, upload the poster with \`--access public\`, and link its Forge embed to the recording's **View in Replicas** URL:
|
|
24045
24037
|
|
|
24046
24038
|
\`\`\`markdown
|
|
24047
24039
|
[](<recording-dashboard-url>)
|
|
@@ -27288,7 +27280,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
|
|
|
27288
27280
|
});
|
|
27289
27281
|
|
|
27290
27282
|
// ../shared/src/cli-version.ts
|
|
27291
|
-
var CLI_VERSION = "0.2.
|
|
27283
|
+
var CLI_VERSION = "0.2.674";
|
|
27292
27284
|
|
|
27293
27285
|
// ../shared/src/version.ts
|
|
27294
27286
|
function compareVersions(v1, v2) {
|
|
@@ -27919,18 +27911,22 @@ async function readSseStream(body, onEvent, shouldContinue = () => true) {
|
|
|
27919
27911
|
const reader = body.getReader();
|
|
27920
27912
|
const decoder2 = new TextDecoder();
|
|
27921
27913
|
let buffer = "";
|
|
27922
|
-
|
|
27923
|
-
|
|
27924
|
-
|
|
27925
|
-
|
|
27926
|
-
|
|
27927
|
-
|
|
27928
|
-
|
|
27929
|
-
|
|
27930
|
-
|
|
27931
|
-
|
|
27932
|
-
|
|
27933
|
-
|
|
27914
|
+
try {
|
|
27915
|
+
while (shouldContinue()) {
|
|
27916
|
+
const { done, value } = await reader.read();
|
|
27917
|
+
if (done) break;
|
|
27918
|
+
buffer += decoder2.decode(value, { stream: true });
|
|
27919
|
+
const chunks = buffer.split("\n\n");
|
|
27920
|
+
buffer = chunks.pop() ?? "";
|
|
27921
|
+
for (const chunk of chunks) {
|
|
27922
|
+
if (!shouldContinue()) break;
|
|
27923
|
+
const parsed = parseSseChunk(chunk);
|
|
27924
|
+
if (!parsed) continue;
|
|
27925
|
+
await onEvent(parsed.event, parsed.id);
|
|
27926
|
+
}
|
|
27927
|
+
}
|
|
27928
|
+
} finally {
|
|
27929
|
+
await reader.cancel().catch(() => void 0);
|
|
27934
27930
|
}
|
|
27935
27931
|
}
|
|
27936
27932
|
|