replicas-cli 0.2.475 → 0.2.477
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.mjs +49 -13
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9325,7 +9325,7 @@ LENGTH=$(stat -c%s "$FILE" 2>/dev/null || stat -f%z "$FILE")
|
|
|
9325
9325
|
|
|
9326
9326
|
# 1. Reserve an upload URL + file ID.
|
|
9327
9327
|
RESERVE=$(curl -s -G "https://slack.com/api/files.getUploadURLExternal" \\
|
|
9328
|
-
-H "Authorization: Bearer
|
|
9328
|
+
-H "Authorization: Bearer \${REPLICAS_SLACK_BOT_TOKEN:-$SLACK_BOT_TOKEN}" \\
|
|
9329
9329
|
--data-urlencode "filename=$FILENAME" \\
|
|
9330
9330
|
--data-urlencode "length=$LENGTH")
|
|
9331
9331
|
UPLOAD_URL=$(echo "$RESERVE" | jq -r '.upload_url')
|
|
@@ -9340,7 +9340,7 @@ curl -s -X POST "$UPLOAD_URL" \\
|
|
|
9340
9340
|
|
|
9341
9341
|
# 3. Complete the upload, sharing it into the channel/thread with the dashboard link.
|
|
9342
9342
|
curl -s -X POST "https://slack.com/api/files.completeUploadExternal" \\
|
|
9343
|
-
-H "Authorization: Bearer
|
|
9343
|
+
-H "Authorization: Bearer \${REPLICAS_SLACK_BOT_TOKEN:-$SLACK_BOT_TOKEN}" \\
|
|
9344
9344
|
-H "Content-Type: application/json; charset=utf-8" \\
|
|
9345
9345
|
-d "{
|
|
9346
9346
|
\\"files\\": [{\\"id\\": \\"$FILE_ID\\", \\"title\\": \\"Screenshot\\"}],
|
|
@@ -9851,10 +9851,10 @@ This guide covers how to interact with Slack from within your Replicas workspace
|
|
|
9851
9851
|
|
|
9852
9852
|
## Prerequisites
|
|
9853
9853
|
|
|
9854
|
-
Check if the
|
|
9854
|
+
Check if the namespaced or legacy Slack token environment variable is set:
|
|
9855
9855
|
|
|
9856
9856
|
\`\`\`bash
|
|
9857
|
-
|
|
9857
|
+
if [ -n "\${REPLICAS_SLACK_BOT_TOKEN:-$SLACK_BOT_TOKEN}" ]; then echo set; fi
|
|
9858
9858
|
\`\`\`
|
|
9859
9859
|
|
|
9860
9860
|
- If **set**: Your workspace has Slack access. You can use the Slack Web API as described below.
|
|
@@ -9862,7 +9862,7 @@ echo "\${REPLICAS_SLACK_BOT_TOKEN:+set}"
|
|
|
9862
9862
|
|
|
9863
9863
|
## Using the Slack API
|
|
9864
9864
|
|
|
9865
|
-
All requests
|
|
9865
|
+
All requests prefer \`$REPLICAS_SLACK_BOT_TOKEN\` and fall back to \`$SLACK_BOT_TOKEN\` for compatibility with older workspaces.
|
|
9866
9866
|
|
|
9867
9867
|
### Fetching a Thread from a Slack Link
|
|
9868
9868
|
|
|
@@ -9873,14 +9873,14 @@ If you encounter a Slack message link (e.g. \`https://team.slack.com/archives/C0
|
|
|
9873
9873
|
|
|
9874
9874
|
\`\`\`bash
|
|
9875
9875
|
curl -s "https://slack.com/api/conversations.replies?channel=CHANNEL_ID&ts=THREAD_TS" \\
|
|
9876
|
-
-H "Authorization: Bearer
|
|
9876
|
+
-H "Authorization: Bearer \${REPLICAS_SLACK_BOT_TOKEN:-$SLACK_BOT_TOKEN}"
|
|
9877
9877
|
\`\`\`
|
|
9878
9878
|
|
|
9879
9879
|
### Sending a Message
|
|
9880
9880
|
|
|
9881
9881
|
\`\`\`bash
|
|
9882
9882
|
curl -s -X POST "https://slack.com/api/chat.postMessage" \\
|
|
9883
|
-
-H "Authorization: Bearer
|
|
9883
|
+
-H "Authorization: Bearer \${REPLICAS_SLACK_BOT_TOKEN:-$SLACK_BOT_TOKEN}" \\
|
|
9884
9884
|
-H "Content-Type: application/json" \\
|
|
9885
9885
|
-d '{
|
|
9886
9886
|
"channel": "CHANNEL_ID",
|
|
@@ -9919,7 +9919,7 @@ The channel and thread flags default to \`SLACK_CHANNEL_ID\` and \`SLACK_THREAD_
|
|
|
9919
9919
|
|
|
9920
9920
|
\`\`\`bash
|
|
9921
9921
|
curl -s "https://slack.com/api/search.messages?query=YOUR_SEARCH_QUERY" \\
|
|
9922
|
-
-H "Authorization: Bearer
|
|
9922
|
+
-H "Authorization: Bearer \${REPLICAS_SLACK_BOT_TOKEN:-$SLACK_BOT_TOKEN}"
|
|
9923
9923
|
\`\`\`
|
|
9924
9924
|
|
|
9925
9925
|
### Uploading Files
|
|
@@ -9933,7 +9933,7 @@ LENGTH=$(stat -c%s "$FILE" 2>/dev/null || stat -f%z "$FILE")
|
|
|
9933
9933
|
|
|
9934
9934
|
# 1. Reserve an upload URL + file ID.
|
|
9935
9935
|
RESERVE=$(curl -s -G "https://slack.com/api/files.getUploadURLExternal" \\
|
|
9936
|
-
-H "Authorization: Bearer
|
|
9936
|
+
-H "Authorization: Bearer \${REPLICAS_SLACK_BOT_TOKEN:-$SLACK_BOT_TOKEN}" \\
|
|
9937
9937
|
--data-urlencode "filename=$FILENAME" \\
|
|
9938
9938
|
--data-urlencode "length=$LENGTH")
|
|
9939
9939
|
UPLOAD_URL=$(echo "$RESERVE" | jq -r '.upload_url')
|
|
@@ -9948,7 +9948,7 @@ curl -s -X POST "$UPLOAD_URL" \\
|
|
|
9948
9948
|
|
|
9949
9949
|
# 3. Complete the upload and share into a channel (and optionally a thread).
|
|
9950
9950
|
curl -s -X POST "https://slack.com/api/files.completeUploadExternal" \\
|
|
9951
|
-
-H "Authorization: Bearer
|
|
9951
|
+
-H "Authorization: Bearer \${REPLICAS_SLACK_BOT_TOKEN:-$SLACK_BOT_TOKEN}" \\
|
|
9952
9952
|
-H "Content-Type: application/json; charset=utf-8" \\
|
|
9953
9953
|
-d "{
|
|
9954
9954
|
\\"files\\": [{\\"id\\": \\"$FILE_ID\\", \\"title\\": \\"File title\\"}],
|
|
@@ -10084,7 +10084,7 @@ function formatTurnElapsed(ms) {
|
|
|
10084
10084
|
}
|
|
10085
10085
|
|
|
10086
10086
|
// ../shared/src/cli-version.ts
|
|
10087
|
-
var CLI_VERSION = "0.2.
|
|
10087
|
+
var CLI_VERSION = "0.2.477";
|
|
10088
10088
|
|
|
10089
10089
|
// ../shared/src/version.ts
|
|
10090
10090
|
function compareVersions(v1, v2) {
|
|
@@ -26759,12 +26759,48 @@ function mergeCodexAspDisplayMessages(primary, supplemental) {
|
|
|
26759
26759
|
}
|
|
26760
26760
|
function parseCodexAspTranscript(transcript) {
|
|
26761
26761
|
const messages = [];
|
|
26762
|
-
const orderedItems = transcript.turns.map((turn, turnIndex) => ({ turn, turnIndex })).flatMap(({ turn, turnIndex }) => turn.items.map((item, itemIndex) => ({ item, turnIndex, itemIndex }))).sort((a, b) => {
|
|
26762
|
+
const orderedItems = transcript.turns.map((turn, turnIndex) => ({ turn, turnIndex })).flatMap(({ turn, turnIndex }) => turn.items.map((item, itemIndex) => ({ item, turn, turnIndex, itemIndex }))).sort((a, b) => {
|
|
26763
26763
|
const aSequence = a.item.sequence ?? Number.MAX_SAFE_INTEGER;
|
|
26764
26764
|
const bSequence = b.item.sequence ?? Number.MAX_SAFE_INTEGER;
|
|
26765
26765
|
return aSequence - bSequence || parseTimestampMs(a.item.timestamp) - parseTimestampMs(b.item.timestamp) || a.turnIndex - b.turnIndex || a.itemIndex - b.itemIndex;
|
|
26766
26766
|
});
|
|
26767
|
-
|
|
26767
|
+
const reasoningByTurnId = /* @__PURE__ */ new Map();
|
|
26768
|
+
for (const { item, turn } of orderedItems) {
|
|
26769
|
+
if (item.type !== "reasoning" || !item.text.trim()) continue;
|
|
26770
|
+
const reasoning = reasoningByTurnId.get(turn.id) ?? [];
|
|
26771
|
+
reasoning.push(item);
|
|
26772
|
+
reasoningByTurnId.set(turn.id, reasoning);
|
|
26773
|
+
}
|
|
26774
|
+
const emittedReasoningTurnIds = /* @__PURE__ */ new Set();
|
|
26775
|
+
const coalescedItems = orderedItems.flatMap((entry) => {
|
|
26776
|
+
if (entry.item.type !== "reasoning") return [entry];
|
|
26777
|
+
const reasoning = reasoningByTurnId.get(entry.turn.id);
|
|
26778
|
+
if (!reasoning || emittedReasoningTurnIds.has(entry.turn.id)) return [];
|
|
26779
|
+
emittedReasoningTurnIds.add(entry.turn.id);
|
|
26780
|
+
return [{
|
|
26781
|
+
...entry,
|
|
26782
|
+
item: {
|
|
26783
|
+
type: "reasoning",
|
|
26784
|
+
id: entry.turn.id,
|
|
26785
|
+
text: reasoning.map(({ text }) => text.trim()).join("\n\n"),
|
|
26786
|
+
timestamp: entry.turn.startedAt,
|
|
26787
|
+
status: reasoning.at(-1)?.status ?? "completed",
|
|
26788
|
+
sequence: entry.item.sequence
|
|
26789
|
+
}
|
|
26790
|
+
}];
|
|
26791
|
+
});
|
|
26792
|
+
for (const turn of transcript.turns) {
|
|
26793
|
+
const reasoningIndex = coalescedItems.findIndex(({ item, turn: itemTurn }) => itemTurn.id === turn.id && item.type === "reasoning");
|
|
26794
|
+
if (reasoningIndex === -1) continue;
|
|
26795
|
+
let finalAnswerIndex = coalescedItems.findIndex(({ item, turn: itemTurn }) => itemTurn.id === turn.id && item.type === "agentMessage" && item.phase === "final_answer");
|
|
26796
|
+
if (finalAnswerIndex === -1 && normalizeCodexAspTranscriptStatus(turn.status) !== "in_progress") {
|
|
26797
|
+
finalAnswerIndex = coalescedItems.findLastIndex(({ item, turn: itemTurn }) => itemTurn.id === turn.id && item.type === "agentMessage");
|
|
26798
|
+
}
|
|
26799
|
+
if (finalAnswerIndex === -1 || reasoningIndex < finalAnswerIndex) continue;
|
|
26800
|
+
const [reasoning] = coalescedItems.splice(reasoningIndex, 1);
|
|
26801
|
+
coalescedItems.splice(finalAnswerIndex, 0, reasoning);
|
|
26802
|
+
}
|
|
26803
|
+
for (const { item } of coalescedItems) {
|
|
26768
26804
|
const message = messageForItem(item);
|
|
26769
26805
|
if (message) {
|
|
26770
26806
|
messages.push(message);
|