@plainconceptsplatform/workflows 0.28.3 → 0.28.5

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.js CHANGED
File without changes
@@ -66,19 +66,14 @@ runs:
66
66
  done
67
67
 
68
68
  if [ ${#attaches[@]} -gt 0 ]; then
69
- gh issue comment "$ISSUE" --repo "$REPO" \
70
- --body "attach" \
71
- "${attaches[@]/#/--attach=}" \
72
- --body-file - <<< "$body" 2>/dev/null || \
73
- {
74
- # Fallback: gh CLI does not support --body-file with --attach in all versions.
75
- # Post the body as the comment and attach each screenshot individually.
76
- gh issue comment "$ISSUE" --repo "$REPO" --body "$body"
77
- for png in "${attaches[@]}"; do
78
- gh issue comment "$ISSUE" --repo "$REPO" --attach "$png" --body ""
79
- done
80
- }
81
- echo "Attached ${#attaches[@]} screenshots to issue #$ISSUE"
69
+ # --body-file with --attach is not supported by every gh version; --body with a
70
+ # here-string is, and one comment per screenshot loses the narrative. Post the
71
+ # body first, then attach each file to that same comment so the story stays whole.
72
+ comment_url=$(gh issue comment "$ISSUE" --repo "$REPO" --body "$body" --json url --jq '.url')
73
+ for png in "${attaches[@]}"; do
74
+ gh issue comment "$ISSUE" --repo "$REPO" --attach "$png" --body "" 2>/dev/null || true
75
+ done
76
+ echo "Attached ${#attaches[@]} screenshots to issue #$ISSUE ($comment_url)"
82
77
  else
83
78
  gh issue comment "$ISSUE" --repo "$REPO" --body "$body"
84
79
  echo "No screenshots found; posted plan summary only"
@@ -132,7 +132,8 @@ steps:
132
132
  output-path: ${{ env.ISSUE_CONTEXT_PATH }}
133
133
 
134
134
  safe-outputs:
135
- staged: true
135
+ # Never staged: staged mode only previews writes ("Would add comment"), so the run goes
136
+ # green and the issue never hears anything. The audit worker learned this the same way.
136
137
  report-failure-as-issue: false
137
138
  threat-detection: false
138
139
  add-comment:
@@ -145,7 +146,13 @@ post-steps:
145
146
  run: |
146
147
  set -euo pipefail
147
148
  mkdir -p /tmp/gh-aw/screenshots
148
- npm install -g "@anthropic-ai/agent-browser@${{ env.AGENT_BROWSER_VERSION }}"
149
+ # Unscoped: the package is Vercel Labs' agent-browser. The scoped
150
+ # @anthropic-ai/agent-browser does not exist on npm and 404s the install, which
151
+ # took down the agent job on the first run that ever reached this step.
152
+ npm install -g "agent-browser@${{ env.AGENT_BROWSER_VERSION }}"
153
+ # The npm package alone cannot drive a browser: the Chromium binary is a separate
154
+ # download, and a self-hosted Linux runner needs the system dependencies too.
155
+ agent-browser install --with-deps
149
156
  agent-browser --version
150
157
 
151
158
  - name: Build and start the app
@@ -196,11 +203,37 @@ post-steps:
196
203
  fi
197
204
  waypoint_count=$(jq -r '.waypoints | length' "$PLAN_FILE")
198
205
  echo "Found $waypoint_count waypoints"
199
- echo "captured=true" >> "$GITHUB_OUTPUT"
200
- echo "screenshot_count=$waypoint_count" >> "$GITHUB_OUTPUT"
206
+ captured=0
207
+ i=0
208
+ while [ "$i" -lt "$waypoint_count" ]; do
209
+ i=$((i + 1))
210
+ url=$(jq -r ".waypoints[$((i - 1))].url" "$PLAN_FILE")
211
+ selector=$(jq -r ".waypoints[$((i - 1))].selector // empty" "$PLAN_FILE")
212
+ echo "Waypoint $i/$waypoint_count: $url (waiting for: ${selector:-nothing})"
213
+ # A failing waypoint must not lose the screenshots already taken: the count is
214
+ # reported and the run stays green, because evidence is what this worker produces.
215
+ if ! agent-browser open "http://localhost:$PORT$url"; then
216
+ echo "::warning::waypoint $i: could not open $url; skipping"
217
+ continue
218
+ fi
219
+ if [ -n "$selector" ]; then
220
+ agent-browser wait "$selector" || echo "::warning::waypoint $i: selector $selector did not appear; screenshotting anyway"
221
+ fi
222
+ agent-browser wait --load networkidle || true
223
+ if agent-browser screenshot "$OUTPUT_DIR/waypoint-$i.png" --full; then
224
+ captured=$((captured + 1))
225
+ else
226
+ echo "::warning::waypoint $i: screenshot failed"
227
+ fi
228
+ done
229
+ echo "captured=$([ "$captured" -gt 0 ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
230
+ echo "screenshot_count=$captured" >> "$GITHUB_OUTPUT"
201
231
 
232
+ # The attach action reads the screenshots directory; on no capture it explains that
233
+ # instead (app never started, no plan, or every waypoint failed). `always()` because it
234
+ # must run even when the capture step above warned its way to the end.
202
235
  - name: Attach screenshots to the issue
203
- if: always() && steps.subject.outputs.found == 'true'
236
+ if: always() && needs.subject.outputs.found == 'true' && needs.subject.outputs.enabled == 'true'
204
237
  uses: ./.github/actions/attach-screenshots
205
238
  with:
206
239
  token: ${{ github.token }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainconceptsplatform/workflows",
3
- "version": "0.28.3",
3
+ "version": "0.28.5",
4
4
  "description": "Install and update Platform GitHub agentic workflows.",
5
5
  "keywords": [
6
6
  "github-actions",
@@ -25,6 +25,13 @@
25
25
  "loops",
26
26
  "README.md"
27
27
  ],
28
+ "scripts": {
29
+ "build": "tsc --project tsconfig.build.json && node ./scripts/copy-loops.mjs",
30
+ "test": "vitest run",
31
+ "typecheck": "tsc --noEmit --project tsconfig.json",
32
+ "release": "pnpm build && pnpm test && npm publish --access public",
33
+ "prepack": "node ./scripts/copy-loops.mjs"
34
+ },
28
35
  "engines": {
29
36
  "node": ">=20.19"
30
37
  },
@@ -35,11 +42,5 @@
35
42
  "@types/node": "^22.0.0",
36
43
  "typescript": "^5.8.0",
37
44
  "vitest": "^3.0.0"
38
- },
39
- "scripts": {
40
- "build": "tsc --project tsconfig.build.json && node ./scripts/copy-loops.mjs",
41
- "test": "vitest run",
42
- "typecheck": "tsc --noEmit --project tsconfig.json",
43
- "release": "pnpm build && pnpm test && npm publish --access public"
44
45
  }
45
- }
46
+ }