Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit23b16d2

Browse files
committed
scripts/triage.sh: fix prompting over SSH, keep agentapi around
1 parent5b44347 commit23b16d2

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

‎scripts/traiage.sh‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
55
source"${SCRIPT_DIR}/lib.sh"
66

77
CODER_BIN=${CODER_BIN:-"$(which coder)"}
8+
AGENTAPI_SLUG=${AGENTAPI_SLUG:-""}
89

910
[[-n${VERBOSE:-} ]]&&set -x
1011
set -euo pipefail
@@ -28,8 +29,45 @@ create() {
2829
}
2930

3031
prompt() {
32+
if [[-z"${AGENTAPI_SLUG}" ]];then
33+
prompt_ssh
34+
else
35+
prompt_agentapi
36+
fi
37+
}
38+
39+
prompt_ssh() {
3140
requiredenvs CODER_URL CODER_SESSION_TOKEN WORKSPACE_NAME PROMPT
3241

42+
# For sanity, use OpenSSH with coder config-ssh.
43+
OPENSSH_CONFIG_FILE=/tmp/coder-ssh.config
44+
"${CODER_BIN}" \
45+
config-ssh \
46+
--url"${CODER_URL}" \
47+
--token"${CODER_SESSION_TOKEN}" \
48+
--ssh-config-file="${OPENSSH_CONFIG_FILE}" \
49+
--yes
50+
51+
# Write prompt to a file in the workspace
52+
ssh \
53+
-F /tmp/coder-ssh.config \
54+
"${WORKSPACE_NAME}.coder" \
55+
-- \
56+
"cat > /tmp/prompt.txt"<<<"${PROMPT}"
57+
58+
# Execute claude over SSH
59+
# Note: use of cat to work around claude-code#7357
60+
ssh \
61+
-F /tmp/coder-ssh.config \
62+
"${WORKSPACE_NAME}.coder" \
63+
-- \
64+
"cat /tmp/prompt.txt |\"\${HOME}\"/.local/bin/claude --print --verbose --output-format=stream-json"
65+
exit 0
66+
}
67+
68+
prompt_agentapi() {
69+
requiredenvs CODER_URL CODER_SESSION_TOKEN WORKSPACE_NAME AGENTAPI_SLUG PROMPT
70+
3371
wait
3472

3573
username=$(curl \
@@ -54,7 +92,7 @@ prompt() {
5492
--request POST \
5593
--show-error \
5694
--silent \
57-
"${CODER_URL}/@${username}/${WORKSPACE_NAME}/apps/agentapi/message"| jq -r'.ok')
95+
"${CODER_URL}/@${username}/${WORKSPACE_NAME}/apps/${AGENTAPI_SLUG}/message"| jq -r'.ok')
5896
if [["${response}"!="true" ]];then
5997
echo"Failed to send prompt"
6098
exit 1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp