mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-05 14:10:18 +08:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
842a0cb4f7 |
@@ -5,10 +5,10 @@
|
|||||||
"version": "v9.0.0",
|
"version": "v9.0.0",
|
||||||
"sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3"
|
"sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3"
|
||||||
},
|
},
|
||||||
"github/gh-aw-actions/setup@v1.4.6": {
|
"github/gh-aw-actions/setup@v1.4.5": {
|
||||||
"repo": "github/gh-aw-actions/setup",
|
"repo": "github/gh-aw-actions/setup",
|
||||||
"version": "v1.4.6",
|
"version": "v1.4.5",
|
||||||
"sha": "a2b1229fe98b05bde43bbab67d4985650da08514"
|
"sha": "a83eaf07e756a15e65f669eb32d00787cf5a2569"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"containers": {
|
"containers": {
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Install gh-aw extension
|
- name: Install gh-aw extension
|
||||||
uses: github/gh-aw-actions/setup-cli@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup-cli@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
version: v1.4.6
|
version: v1.4.5
|
||||||
- name: Install Rust Stable
|
- name: Install Rust Stable
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
|
|||||||
+47
-54
@@ -1,6 +1,6 @@
|
|||||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"4ca5835c0c9cd01f3432b873f5a177ca6d3d1dbd6a35939e2058dcb37aa224b4","body_hash":"ca82fafbe18061d7c8bd708dc18e91b9116faf0c921a7fa35be1538d47a2b005","compiler_version":"v1.4.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.115"}}
|
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"4ca5835c0c9cd01f3432b873f5a177ca6d3d1dbd6a35939e2058dcb37aa224b4","body_hash":"ca82fafbe18061d7c8bd708dc18e91b9116faf0c921a7fa35be1538d47a2b005","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce","version":"v7.2.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a2b1229fe98b05bde43bbab67d4985650da08514","version":"v1.4.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","add_labels","noop","remove_labels","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","add_labels","noop","remove_labels","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||||
# This file was automatically generated by gh-aw (v1.4.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||||
#
|
#
|
||||||
# ___ _ _
|
# ___ _ _
|
||||||
# / _ \ | | (_)
|
# / _ \ | | (_)
|
||||||
@@ -42,9 +42,9 @@
|
|||||||
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
# - actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||||
# - github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
#
|
#
|
||||||
# Container images used:
|
# Container images used:
|
||||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||||
@@ -130,7 +130,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -138,7 +138,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -150,9 +150,9 @@ jobs:
|
|||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
||||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AGENT_VERSION: "1.0.115"
|
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_CLI_VERSION: "v1.4.6"
|
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||||
GH_AW_INFO_WORKFLOW_NAME: "PR AI Slop Review"
|
GH_AW_INFO_WORKFLOW_NAME: "PR AI Slop Review"
|
||||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||||
@@ -271,7 +271,7 @@ jobs:
|
|||||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
env:
|
env:
|
||||||
GH_AW_COMPILED_VERSION: "v1.4.6"
|
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||||
GH_AW_WORKFLOW_NAME: "PR AI Slop Review"
|
GH_AW_WORKFLOW_NAME: "PR AI Slop Review"
|
||||||
@@ -558,7 +558,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -567,7 +567,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -614,7 +614,7 @@ jobs:
|
|||||||
script: "const fs = require('fs');\nconst number = process.env.PR_NUMBER;\nif (!/^[1-9][0-9]*$/.test(number)) throw new Error('A PR number is required');\nconst params = { ...context.repo, pull_number: Number(number) };\nconst { data: pr } = await github.rest.pulls.get(params);\nif (process.env.EXPECTED_HEAD && pr.head.sha !== process.env.EXPECTED_HEAD) {\n throw new Error('PR head changed after trigger; await the newer run');\n}\nconst { data: files } = await github.rest.pulls.listFiles({ ...params, per_page: 100 });\nconst body = pr.body || '';\nconst snapshot = {\n repository: `${context.repo.owner}/${context.repo.repo}`,\n number: pr.number, url: pr.html_url, state: pr.state, draft: pr.draft,\n title: pr.title, body: body.slice(0, 12000), body_truncated: body.length > 12000,\n created_at: pr.created_at, author: pr.user.login,\n base_sha: pr.base.sha, head_sha: pr.head.sha,\n head_repository: pr.head.repo?.full_name,\n labels: pr.labels.map(label => label.name),\n changed_files: pr.changed_files, files_truncated: pr.changed_files > files.length,\n files: files.map(({ filename, previous_filename, status, additions, deletions }) =>\n ({ filename, previous_filename, status, additions, deletions })),\n};\nfs.mkdirSync('/tmp/gh-aw/agent', { recursive: true });\nfs.writeFileSync('/tmp/gh-aw/agent/pr-context.json', JSON.stringify(snapshot));\n"
|
script: "const fs = require('fs');\nconst number = process.env.PR_NUMBER;\nif (!/^[1-9][0-9]*$/.test(number)) throw new Error('A PR number is required');\nconst params = { ...context.repo, pull_number: Number(number) };\nconst { data: pr } = await github.rest.pulls.get(params);\nif (process.env.EXPECTED_HEAD && pr.head.sha !== process.env.EXPECTED_HEAD) {\n throw new Error('PR head changed after trigger; await the newer run');\n}\nconst { data: files } = await github.rest.pulls.listFiles({ ...params, per_page: 100 });\nconst body = pr.body || '';\nconst snapshot = {\n repository: `${context.repo.owner}/${context.repo.repo}`,\n number: pr.number, url: pr.html_url, state: pr.state, draft: pr.draft,\n title: pr.title, body: body.slice(0, 12000), body_truncated: body.length > 12000,\n created_at: pr.created_at, author: pr.user.login,\n base_sha: pr.base.sha, head_sha: pr.head.sha,\n head_repository: pr.head.repo?.full_name,\n labels: pr.labels.map(label => label.name),\n changed_files: pr.changed_files, files_truncated: pr.changed_files > files.length,\n files: files.map(({ filename, previous_filename, status, additions, deletions }) =>\n ({ filename, previous_filename, status, additions, deletions })),\n};\nfs.mkdirSync('/tmp/gh-aw/agent', { recursive: true });\nfs.writeFileSync('/tmp/gh-aw/agent/pr-context.json', JSON.stringify(snapshot));\n"
|
||||||
|
|
||||||
- name: Install GitHub Copilot CLI
|
- name: Install GitHub Copilot CLI
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||||
env:
|
env:
|
||||||
GH_HOST: github.com
|
GH_HOST: github.com
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
@@ -1088,7 +1088,7 @@ jobs:
|
|||||||
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
||||||
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
||||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
||||||
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" "${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" "${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
||||||
env:
|
env:
|
||||||
AWF_REFLECT_ENABLED: 1
|
AWF_REFLECT_ENABLED: 1
|
||||||
@@ -1104,7 +1104,7 @@ jobs:
|
|||||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||||
GH_AW_VERSION: v1.4.6
|
GH_AW_VERSION: v1.4.5
|
||||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||||
GITHUB_API_URL: ${{ github.api_url }}
|
GITHUB_API_URL: ${{ github.api_url }}
|
||||||
GITHUB_AW: true
|
GITHUB_AW: true
|
||||||
@@ -1265,7 +1265,6 @@ jobs:
|
|||||||
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
||||||
await main();
|
await main();
|
||||||
- name: Print AWF reflect summary
|
- name: Print AWF reflect summary
|
||||||
id: awf_reflect_summary
|
|
||||||
if: always()
|
if: always()
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
@@ -1315,7 +1314,7 @@ jobs:
|
|||||||
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
||||||
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
||||||
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
||||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/"]'
|
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/","/tmp/gh-aw/sandbox/firewall/awf-reflect.json"]'
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@@ -1396,7 +1395,7 @@ jobs:
|
|||||||
/tmp/gh-aw/awf-resolved-config.json
|
/tmp/gh-aw/awf-resolved-config.json
|
||||||
/tmp/gh-aw/sandbox/firewall/logs/
|
/tmp/gh-aw/sandbox/firewall/logs/
|
||||||
/tmp/gh-aw/sandbox/firewall/audit/
|
/tmp/gh-aw/sandbox/firewall/audit/
|
||||||
${{ steps.awf_reflect_summary.outputs.artifact_ready == 'true' && '/tmp/gh-aw/sandbox/firewall/awf-reflect.json' || '' }}
|
/tmp/gh-aw/sandbox/firewall/awf-reflect.json
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||||
|
|
||||||
@@ -1437,7 +1436,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -1446,7 +1445,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -1553,9 +1552,6 @@ jobs:
|
|||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
@@ -1634,9 +1630,6 @@ jobs:
|
|||||||
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
|
||||||
GH_AW_MAX_AI_CREDITS: "60"
|
GH_AW_MAX_AI_CREDITS: "60"
|
||||||
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
||||||
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
||||||
@@ -1696,6 +1689,10 @@ jobs:
|
|||||||
- name: Collect usage artifact files
|
- name: Collect usage artifact files
|
||||||
if: always()
|
if: always()
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||||
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
||||||
- name: Generate usage activity summary and unified session
|
- name: Generate usage activity summary and unified session
|
||||||
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
||||||
@@ -1704,9 +1701,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
||||||
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
||||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
|
||||||
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
||||||
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
||||||
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
||||||
@@ -1814,8 +1808,6 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
||||||
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
||||||
detection_model_names_unavailable: ${{ steps.parse_detection_token_usage.outputs.model_names_unavailable }}
|
|
||||||
detection_models: ${{ steps.parse_detection_token_usage.outputs.models }}
|
|
||||||
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
||||||
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
||||||
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
||||||
@@ -1823,7 +1815,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -1832,7 +1824,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -1890,7 +1882,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall-audit-logs
|
|
||||||
- name: Download container images
|
- name: Download container images
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||||
- name: Check if detection needed
|
- name: Check if detection needed
|
||||||
@@ -1924,12 +1915,12 @@ jobs:
|
|||||||
id: detection_awf_install
|
id: detection_awf_install
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
- name: Install GitHub Copilot CLI
|
- name: Install GitHub Copilot CLI
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||||
env:
|
env:
|
||||||
GH_HOST: github.com
|
GH_HOST: github.com
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
@@ -1953,7 +1944,7 @@ jobs:
|
|||||||
GH_AW_PHASE: detection
|
GH_AW_PHASE: detection
|
||||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||||
GH_AW_TIMEOUT_MINUTES: 10
|
GH_AW_TIMEOUT_MINUTES: 10
|
||||||
GH_AW_VERSION: v1.4.6
|
GH_AW_VERSION: v1.4.5
|
||||||
GITHUB_API_URL: ${{ github.api_url }}
|
GITHUB_API_URL: ${{ github.api_url }}
|
||||||
GITHUB_AW: true
|
GITHUB_AW: true
|
||||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||||
@@ -1995,7 +1986,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
chmod 755 "$GH_AW_COPILOT_BIN"
|
chmod 755 "$GH_AW_COPILOT_BIN"
|
||||||
|
|
||||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot --stream-transcript || exit 1
|
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot || exit 1
|
||||||
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
||||||
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
||||||
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
||||||
@@ -2032,9 +2023,8 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC1003,SC2016,SC2086
|
# shellcheck disable=SC1003,SC2016,SC2086
|
||||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" --stream-only copilot /tmp/gh-aw/threat-detection/detection.log \
|
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||||
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
|
||||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs'
|
|
||||||
- name: Copy detection firewall logs
|
- name: Copy detection firewall logs
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -2096,14 +2086,20 @@ jobs:
|
|||||||
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
||||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||||
- name: Validate threat detection verdict files
|
- name: Render detection log
|
||||||
id: validate_detection_results
|
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
continue-on-error: true
|
||||||
env:
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
with:
|
||||||
run: '"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/validate_threat_detection_results.cjs" /tmp/gh-aw/threat-detection'
|
script: |
|
||||||
|
const path = require('path');
|
||||||
|
const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
|
||||||
|
const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
|
||||||
|
setupGlobals(core, github, context, exec, io, getOctokit);
|
||||||
|
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||||
|
await main();
|
||||||
- name: Upload threat detection artifact
|
- name: Upload threat detection artifact
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.validate_detection_results.outcome == 'success' && steps.validate_detection_results.outputs.valid == 'true'
|
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||||
with:
|
with:
|
||||||
name: detection
|
name: detection
|
||||||
@@ -2123,7 +2119,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||||
DETECTION_VALIDATION_OUTCOME: ${{ steps.validate_detection_results.outcome }}
|
|
||||||
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
||||||
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
||||||
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
||||||
@@ -2157,8 +2152,6 @@ jobs:
|
|||||||
GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
|
GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
|
||||||
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/pr-ai-slop-review"
|
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/pr-ai-slop-review"
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||||
GH_AW_ENGINE_ID: "copilot"
|
GH_AW_ENGINE_ID: "copilot"
|
||||||
@@ -2194,7 +2187,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -2203,7 +2196,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
GH_AW_SETUP_WORKFLOW_NAME: "PR AI Slop Review"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-ai-slop-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
|
|||||||
Generated
+49
-56
@@ -1,6 +1,6 @@
|
|||||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d6b72464a3766dd7d74aefe4c7dd982ae7ae2db951f8040f978feca9166adb39","body_hash":"deddd98c5fa425a91487fb5f50dc59ac61ae395bdcd4dff6543f1e8e563a7d73","compiler_version":"v1.4.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.115"}}
|
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d6b72464a3766dd7d74aefe4c7dd982ae7ae2db951f8040f978feca9166adb39","body_hash":"deddd98c5fa425a91487fb5f50dc59ac61ae395bdcd4dff6543f1e8e563a7d73","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce","version":"v7.2.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a2b1229fe98b05bde43bbab67d4985650da08514","version":"v1.4.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||||
# This file was automatically generated by gh-aw (v1.4.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||||
#
|
#
|
||||||
# ___ _ _
|
# ___ _ _
|
||||||
# / _ \ | | (_)
|
# / _ \ | | (_)
|
||||||
@@ -41,9 +41,9 @@
|
|||||||
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
# - actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||||
# - github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
#
|
#
|
||||||
# Container images used:
|
# Container images used:
|
||||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||||
@@ -141,7 +141,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -151,7 +151,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -163,9 +163,9 @@ jobs:
|
|||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
||||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AGENT_VERSION: "1.0.115"
|
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_CLI_VERSION: "v1.4.6"
|
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||||
GH_AW_INFO_WORKFLOW_NAME: "Verify Review Fixes"
|
GH_AW_INFO_WORKFLOW_NAME: "Verify Review Fixes"
|
||||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||||
@@ -284,7 +284,7 @@ jobs:
|
|||||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
env:
|
env:
|
||||||
GH_AW_COMPILED_VERSION: "v1.4.6"
|
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||||
GH_AW_WORKFLOW_NAME: "Verify Review Fixes"
|
GH_AW_WORKFLOW_NAME: "Verify Review Fixes"
|
||||||
@@ -596,7 +596,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -605,7 +605,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -656,7 +656,7 @@ jobs:
|
|||||||
script: "const fs = require('fs');\nconst root = '/tmp/gh-aw/agent';\nconst pr = JSON.parse(fs.readFileSync(`${root}/pr-context.json`, 'utf8'));\nconst rules = ['AGENTS.md', 'REVIEW.md', 'CONTRIBUTING.md'];\nfor (const dir of ['src', 'src-tauri']) {\n if (pr.files_truncated || pr.files.some(file =>\n [file.filename, file.previous_filename].some(name => name?.startsWith(`${dir}/`)))) {\n rules.push(`${dir}/AGENTS.md`);\n }\n}\nfor (const path of rules) {\n const { data } = await github.rest.repos.getContent({ ...context.repo, path, ref: pr.base_sha });\n if (data.encoding !== 'base64') throw new Error(`Cannot read base rules: ${path}`);\n const target = `${root}/rules/${path}`;\n fs.mkdirSync(require('path').dirname(target), { recursive: true });\n fs.writeFileSync(target, Buffer.from(data.content, 'base64'));\n}"
|
script: "const fs = require('fs');\nconst root = '/tmp/gh-aw/agent';\nconst pr = JSON.parse(fs.readFileSync(`${root}/pr-context.json`, 'utf8'));\nconst rules = ['AGENTS.md', 'REVIEW.md', 'CONTRIBUTING.md'];\nfor (const dir of ['src', 'src-tauri']) {\n if (pr.files_truncated || pr.files.some(file =>\n [file.filename, file.previous_filename].some(name => name?.startsWith(`${dir}/`)))) {\n rules.push(`${dir}/AGENTS.md`);\n }\n}\nfor (const path of rules) {\n const { data } = await github.rest.repos.getContent({ ...context.repo, path, ref: pr.base_sha });\n if (data.encoding !== 'base64') throw new Error(`Cannot read base rules: ${path}`);\n const target = `${root}/rules/${path}`;\n fs.mkdirSync(require('path').dirname(target), { recursive: true });\n fs.writeFileSync(target, Buffer.from(data.content, 'base64'));\n}"
|
||||||
|
|
||||||
- name: Install GitHub Copilot CLI
|
- name: Install GitHub Copilot CLI
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||||
env:
|
env:
|
||||||
GH_HOST: github.com
|
GH_HOST: github.com
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
@@ -1090,7 +1090,7 @@ jobs:
|
|||||||
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
||||||
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
||||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
||||||
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" "${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" "${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
||||||
env:
|
env:
|
||||||
AWF_REFLECT_ENABLED: 1
|
AWF_REFLECT_ENABLED: 1
|
||||||
@@ -1105,7 +1105,7 @@ jobs:
|
|||||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||||
GH_AW_VERSION: v1.4.6
|
GH_AW_VERSION: v1.4.5
|
||||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||||
GITHUB_API_URL: ${{ github.api_url }}
|
GITHUB_API_URL: ${{ github.api_url }}
|
||||||
GITHUB_AW: true
|
GITHUB_AW: true
|
||||||
@@ -1267,7 +1267,6 @@ jobs:
|
|||||||
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
||||||
await main();
|
await main();
|
||||||
- name: Print AWF reflect summary
|
- name: Print AWF reflect summary
|
||||||
id: awf_reflect_summary
|
|
||||||
if: always()
|
if: always()
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
@@ -1317,7 +1316,7 @@ jobs:
|
|||||||
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
||||||
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
||||||
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
||||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/"]'
|
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/","/tmp/gh-aw/sandbox/firewall/awf-reflect.json"]'
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@@ -1398,7 +1397,7 @@ jobs:
|
|||||||
/tmp/gh-aw/awf-resolved-config.json
|
/tmp/gh-aw/awf-resolved-config.json
|
||||||
/tmp/gh-aw/sandbox/firewall/logs/
|
/tmp/gh-aw/sandbox/firewall/logs/
|
||||||
/tmp/gh-aw/sandbox/firewall/audit/
|
/tmp/gh-aw/sandbox/firewall/audit/
|
||||||
${{ steps.awf_reflect_summary.outputs.artifact_ready == 'true' && '/tmp/gh-aw/sandbox/firewall/awf-reflect.json' || '' }}
|
/tmp/gh-aw/sandbox/firewall/awf-reflect.json
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||||
|
|
||||||
@@ -1439,7 +1438,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -1448,7 +1447,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -1555,9 +1554,6 @@ jobs:
|
|||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
@@ -1636,9 +1632,6 @@ jobs:
|
|||||||
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
|
||||||
GH_AW_MAX_AI_CREDITS: "60"
|
GH_AW_MAX_AI_CREDITS: "60"
|
||||||
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
||||||
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
||||||
@@ -1698,6 +1691,10 @@ jobs:
|
|||||||
- name: Collect usage artifact files
|
- name: Collect usage artifact files
|
||||||
if: always()
|
if: always()
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||||
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
||||||
- name: Generate usage activity summary and unified session
|
- name: Generate usage activity summary and unified session
|
||||||
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
||||||
@@ -1706,9 +1703,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
||||||
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
||||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
|
||||||
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
||||||
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
||||||
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
||||||
@@ -1816,8 +1810,6 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
||||||
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
||||||
detection_model_names_unavailable: ${{ steps.parse_detection_token_usage.outputs.model_names_unavailable }}
|
|
||||||
detection_models: ${{ steps.parse_detection_token_usage.outputs.models }}
|
|
||||||
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
||||||
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
||||||
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
||||||
@@ -1825,7 +1817,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -1834,7 +1826,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -1892,7 +1884,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall-audit-logs
|
|
||||||
- name: Download container images
|
- name: Download container images
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||||
- name: Check if detection needed
|
- name: Check if detection needed
|
||||||
@@ -1926,12 +1917,12 @@ jobs:
|
|||||||
id: detection_awf_install
|
id: detection_awf_install
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
- name: Install GitHub Copilot CLI
|
- name: Install GitHub Copilot CLI
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||||
env:
|
env:
|
||||||
GH_HOST: github.com
|
GH_HOST: github.com
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
@@ -1955,7 +1946,7 @@ jobs:
|
|||||||
GH_AW_PHASE: detection
|
GH_AW_PHASE: detection
|
||||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||||
GH_AW_TIMEOUT_MINUTES: 10
|
GH_AW_TIMEOUT_MINUTES: 10
|
||||||
GH_AW_VERSION: v1.4.6
|
GH_AW_VERSION: v1.4.5
|
||||||
GITHUB_API_URL: ${{ github.api_url }}
|
GITHUB_API_URL: ${{ github.api_url }}
|
||||||
GITHUB_AW: true
|
GITHUB_AW: true
|
||||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||||
@@ -1997,7 +1988,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
chmod 755 "$GH_AW_COPILOT_BIN"
|
chmod 755 "$GH_AW_COPILOT_BIN"
|
||||||
|
|
||||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot --stream-transcript || exit 1
|
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot || exit 1
|
||||||
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
||||||
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
||||||
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
||||||
@@ -2034,9 +2025,8 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC1003,SC2016,SC2086
|
# shellcheck disable=SC1003,SC2016,SC2086
|
||||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" --stream-only copilot /tmp/gh-aw/threat-detection/detection.log \
|
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||||
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
|
||||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs'
|
|
||||||
- name: Copy detection firewall logs
|
- name: Copy detection firewall logs
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -2098,14 +2088,20 @@ jobs:
|
|||||||
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
||||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||||
- name: Validate threat detection verdict files
|
- name: Render detection log
|
||||||
id: validate_detection_results
|
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
continue-on-error: true
|
||||||
env:
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
with:
|
||||||
run: '"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/validate_threat_detection_results.cjs" /tmp/gh-aw/threat-detection'
|
script: |
|
||||||
|
const path = require('path');
|
||||||
|
const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
|
||||||
|
const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
|
||||||
|
setupGlobals(core, github, context, exec, io, getOctokit);
|
||||||
|
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||||
|
await main();
|
||||||
- name: Upload threat detection artifact
|
- name: Upload threat detection artifact
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.validate_detection_results.outcome == 'success' && steps.validate_detection_results.outputs.valid == 'true'
|
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||||
with:
|
with:
|
||||||
name: detection
|
name: detection
|
||||||
@@ -2125,7 +2121,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||||
DETECTION_VALIDATION_OUTCOME: ${{ steps.validate_detection_results.outcome }}
|
|
||||||
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
||||||
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
||||||
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
||||||
@@ -2155,14 +2150,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -2215,8 +2210,6 @@ jobs:
|
|||||||
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/pr-verify-fix"
|
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/pr-verify-fix"
|
||||||
GH_AW_COMMANDS: "[\"verify-fix\"]"
|
GH_AW_COMMANDS: "[\"verify-fix\"]"
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||||
GH_AW_ENGINE_ID: "copilot"
|
GH_AW_ENGINE_ID: "copilot"
|
||||||
@@ -2252,7 +2245,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -2261,7 +2254,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
GH_AW_SETUP_WORKFLOW_NAME: "Verify Review Fixes"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/pr-verify-fix.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
|
|||||||
+47
-54
@@ -1,6 +1,6 @@
|
|||||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e44852fbf56eab99e67b3f6a306f75195603ece6ed130e55652a2467efed1415","body_hash":"7835f25016082d56592b67f4d2bf5b839eb02a6fa8f03d65699ed6bae979c5ad","compiler_version":"v1.4.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.115"}}
|
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e44852fbf56eab99e67b3f6a306f75195603ece6ed130e55652a2467efed1415","body_hash":"7835f25016082d56592b67f4d2bf5b839eb02a6fa8f03d65699ed6bae979c5ad","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce","version":"v7.2.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a2b1229fe98b05bde43bbab67d4985650da08514","version":"v1.4.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||||
# This file was automatically generated by gh-aw (v1.4.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||||
#
|
#
|
||||||
# ___ _ _
|
# ___ _ _
|
||||||
# / _ \ | | (_)
|
# / _ \ | | (_)
|
||||||
@@ -41,9 +41,9 @@
|
|||||||
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
# - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
# - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
# - actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||||
# - github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
#
|
#
|
||||||
# Container images used:
|
# Container images used:
|
||||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||||
@@ -133,7 +133,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -141,7 +141,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -153,9 +153,9 @@ jobs:
|
|||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
|
||||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AGENT_VERSION: "1.0.115"
|
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_CLI_VERSION: "v1.4.6"
|
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||||
GH_AW_INFO_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
GH_AW_INFO_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||||
@@ -274,7 +274,7 @@ jobs:
|
|||||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
env:
|
env:
|
||||||
GH_AW_COMPILED_VERSION: "v1.4.6"
|
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||||
GH_AW_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
GH_AW_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||||
@@ -562,7 +562,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -571,7 +571,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -637,7 +637,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
|
||||||
- name: Install GitHub Copilot CLI
|
- name: Install GitHub Copilot CLI
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||||
env:
|
env:
|
||||||
GH_HOST: github.com
|
GH_HOST: github.com
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
@@ -1078,7 +1078,7 @@ jobs:
|
|||||||
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
|
||||||
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
GH_AW_AWF_ATTEMPT_LOG_NAME=copilot \
|
||||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
|
||||||
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_ENGINE_STEP_TIMEOUT_MINUTES:+--agent-timeout "$GH_AW_ENGINE_STEP_TIMEOUT_MINUTES"} ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull --difc-proxy-host awmg-cli-proxy:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
|
||||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" "${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-tool github --allow-tool safeoutputs --allow-tool shell --allow-tool write --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" "${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs" "${RUNNER_TEMP}/gh-aw/bin/copilot" --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-tool github --allow-tool safeoutputs --allow-tool shell --allow-tool write --deny-tool workflow --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
|
||||||
env:
|
env:
|
||||||
AWF_REFLECT_ENABLED: 1
|
AWF_REFLECT_ENABLED: 1
|
||||||
@@ -1094,7 +1094,7 @@ jobs:
|
|||||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||||
GH_AW_VERSION: v1.4.6
|
GH_AW_VERSION: v1.4.5
|
||||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||||
GITHUB_API_URL: ${{ github.api_url }}
|
GITHUB_API_URL: ${{ github.api_url }}
|
||||||
GITHUB_AW: true
|
GITHUB_AW: true
|
||||||
@@ -1261,7 +1261,6 @@ jobs:
|
|||||||
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
|
||||||
await main();
|
await main();
|
||||||
- name: Print AWF reflect summary
|
- name: Print AWF reflect summary
|
||||||
id: awf_reflect_summary
|
|
||||||
if: always()
|
if: always()
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
@@ -1311,7 +1310,7 @@ jobs:
|
|||||||
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
GH_AW_OBJECT_PACK_MAX_OBJECTS: ${{ vars.GH_AW_OBJECT_PACK_MAX_OBJECTS }}
|
||||||
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
GH_AW_OBJECT_PACK_TIMEOUT_MS: ${{ vars.GH_AW_OBJECT_PACK_TIMEOUT_MS }}
|
||||||
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
GH_AW_OBJECT_PACK_FETCH_DEPTHS: ${{ vars.GH_AW_OBJECT_PACK_FETCH_DEPTHS }}
|
||||||
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/"]'
|
GH_AW_RECOVERY_ADDITIONAL_ROOTS: '["/tmp/gh-aw/aw-prompts/prompt.txt","/tmp/gh-aw/agent_execution.json","/tmp/gh-aw/agent_execution_exit_code.txt","/tmp/gh-aw/agent-session.jsonl","/tmp/gh-aw/agent-errors.jsonl","/tmp/gh-aw/aw-prompts/user.txt","/tmp/gh-aw/aw-prompts/system.txt","/tmp/gh-aw/skill_inventory.json","/tmp/gh-aw/sandbox/agent/logs/","/tmp/gh-aw/redacted-urls.log","/tmp/gh-aw/mcp-logs/","/tmp/gh-aw/proxy-logs/","/tmp/gh-aw/agent_usage.json","/tmp/gh-aw/agent/aw_info.json","/tmp/gh-aw/agent/awf-routing-outcome.json","/tmp/gh-aw/runtime/aw_info.json","/tmp/gh-aw/agent_usage.jsonl","/tmp/gh-aw/agent/model-endpoint-mismatch.json","/tmp/gh-aw/agent/model-resolution.json","/tmp/gh-aw/agent-stdio.log","/tmp/gh-aw/agent/harness_retry.json","/tmp/gh-aw/pre-agent-audit.txt","/tmp/gh-aw/github_rate_limits.jsonl","/tmp/gh-aw/otel.jsonl","/tmp/gh-aw/otlp-export-errors.jsonl","/tmp/gh-aw/safeoutputs.jsonl","/tmp/gh-aw/agent_output.json","/tmp/gh-aw","/tmp/gh-aw","/tmp/gh-aw/awf-config.json","/tmp/gh-aw/awf-resolved-config.json","/tmp/gh-aw/sandbox/firewall/logs/","/tmp/gh-aw/sandbox/firewall/audit/","/tmp/gh-aw/sandbox/firewall/awf-reflect.json"]'
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@@ -1392,7 +1391,7 @@ jobs:
|
|||||||
/tmp/gh-aw/awf-resolved-config.json
|
/tmp/gh-aw/awf-resolved-config.json
|
||||||
/tmp/gh-aw/sandbox/firewall/logs/
|
/tmp/gh-aw/sandbox/firewall/logs/
|
||||||
/tmp/gh-aw/sandbox/firewall/audit/
|
/tmp/gh-aw/sandbox/firewall/audit/
|
||||||
${{ steps.awf_reflect_summary.outputs.artifact_ready == 'true' && '/tmp/gh-aw/sandbox/firewall/awf-reflect.json' || '' }}
|
/tmp/gh-aw/sandbox/firewall/awf-reflect.json
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||||
|
|
||||||
@@ -1433,7 +1432,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -1442,7 +1441,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -1549,9 +1548,6 @@ jobs:
|
|||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
@@ -1630,9 +1626,6 @@ jobs:
|
|||||||
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
GH_AW_DETECTION_ACCEPTED: ${{ needs.detection.result == 'success' && needs.detection.outputs.detection_success == 'true' }}
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
|
|
||||||
GH_AW_MAX_AI_CREDITS: "60"
|
GH_AW_MAX_AI_CREDITS: "60"
|
||||||
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "false"
|
||||||
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
|
||||||
@@ -1692,6 +1685,10 @@ jobs:
|
|||||||
- name: Collect usage artifact files
|
- name: Collect usage artifact files
|
||||||
if: always()
|
if: always()
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
||||||
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
|
||||||
- name: Generate usage activity summary and unified session
|
- name: Generate usage activity summary and unified session
|
||||||
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
if: always() && steps.clear_azure_broker_evidence.outcome == 'success'
|
||||||
@@ -1700,9 +1697,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
|
||||||
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
GH_AW_GRADER_MANIFEST_CHUNKS: '1'
|
||||||
GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
|
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
|
||||||
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
|
||||||
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
|
||||||
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
|
||||||
@@ -1810,8 +1804,6 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
|
||||||
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
|
||||||
detection_model_names_unavailable: ${{ steps.parse_detection_token_usage.outputs.model_names_unavailable }}
|
|
||||||
detection_models: ${{ steps.parse_detection_token_usage.outputs.models }}
|
|
||||||
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
|
||||||
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
detection_success: ${{ steps.detection_conclusion.outputs.success }}
|
||||||
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
detection_threat_kinds: ${{ steps.detection_conclusion.outputs.threat_kinds }}
|
||||||
@@ -1819,7 +1811,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -1828,7 +1820,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
@@ -1886,7 +1878,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
rm -rf /tmp/gh-aw/sandbox/firewall/logs
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
rm -rf /tmp/gh-aw/sandbox/firewall/audit
|
||||||
rm -rf /tmp/gh-aw/sandbox/firewall-audit-logs
|
|
||||||
- name: Download container images
|
- name: Download container images
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||||
- name: Check if detection needed
|
- name: Check if detection needed
|
||||||
@@ -1920,12 +1911,12 @@ jobs:
|
|||||||
id: detection_awf_install
|
id: detection_awf_install
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
- name: Install GitHub Copilot CLI
|
- name: Install GitHub Copilot CLI
|
||||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.115 --checksums-sha256 ed34c70ab8194027aae48a728f80952fc10889bf4d81f21313b359acc8a8d034 --prefer-toolcache --cooldown-days 0
|
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --checksums-sha256 26cd3e4b32cde498e4961fb4d48e7b85d7859fc69af1a645a19201fdd577bdb2 --prefer-toolcache --cooldown-days 0
|
||||||
env:
|
env:
|
||||||
GH_HOST: github.com
|
GH_HOST: github.com
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
@@ -1949,7 +1940,7 @@ jobs:
|
|||||||
GH_AW_PHASE: detection
|
GH_AW_PHASE: detection
|
||||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||||
GH_AW_TIMEOUT_MINUTES: 10
|
GH_AW_TIMEOUT_MINUTES: 10
|
||||||
GH_AW_VERSION: v1.4.6
|
GH_AW_VERSION: v1.4.5
|
||||||
GITHUB_API_URL: ${{ github.api_url }}
|
GITHUB_API_URL: ${{ github.api_url }}
|
||||||
GITHUB_AW: true
|
GITHUB_AW: true
|
||||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||||
@@ -1991,7 +1982,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
chmod 755 "$GH_AW_COPILOT_BIN"
|
chmod 755 "$GH_AW_COPILOT_BIN"
|
||||||
|
|
||||||
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot --stream-transcript || exit 1
|
"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/stage_threat_detection_runtime.cjs" copilot || exit 1
|
||||||
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
|
||||||
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
|
||||||
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^(-1|[0-9]+)$ ]]; then
|
||||||
@@ -2028,9 +2019,8 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC1003,SC2016,SC2086
|
# shellcheck disable=SC1003,SC2016,SC2086
|
||||||
bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" --stream-only copilot /tmp/gh-aw/threat-detection/detection.log \
|
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
||||||
awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GH_AW_RUNTIME_TMP_DIR --exclude-env GH_AW_RUNTIME_TMP_ID --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --exclude-env OTEL_EXPORTER_OTLP_LOGS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_LOGS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_METRICS_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_METRICS_HEADERS --exclude-env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_TRACES_HEADERS --exclude-env TMPDIR --mount /tmp/gh-aw:/tmp/gh-aw:rw --mount /tmp/gh-aw/threat-detection-inputs:/tmp/gh-aw/threat-detection-inputs:ro --mount /tmp/gh-aw/threat-detection:/tmp/gh-aw/threat-detection:rw --log-level info --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --skip-pull \
|
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
|
||||||
-- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/node" "${RUNNER_TEMP}/gh-aw/actions/detect_threats.cjs" --launch-config "${RUNNER_TEMP}/gh-aw/threat-detection-runtime/launch.json" --output /tmp/gh-aw/threat-detection/detection_result.json /tmp/gh-aw/threat-detection-inputs'
|
|
||||||
- name: Copy detection firewall logs
|
- name: Copy detection firewall logs
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -2092,14 +2082,20 @@ jobs:
|
|||||||
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
|
||||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||||
- name: Validate threat detection verdict files
|
- name: Render detection log
|
||||||
id: validate_detection_results
|
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
continue-on-error: true
|
||||||
env:
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
with:
|
||||||
run: '"${GH_AW_NODE:-node}" "${RUNNER_TEMP}/gh-aw/actions/validate_threat_detection_results.cjs" /tmp/gh-aw/threat-detection'
|
script: |
|
||||||
|
const path = require('path');
|
||||||
|
const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
|
||||||
|
const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
|
||||||
|
setupGlobals(core, github, context, exec, io, getOctokit);
|
||||||
|
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||||
|
await main();
|
||||||
- name: Upload threat detection artifact
|
- name: Upload threat detection artifact
|
||||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.validate_detection_results.outcome == 'success' && steps.validate_detection_results.outputs.valid == 'true'
|
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||||
with:
|
with:
|
||||||
name: detection
|
name: detection
|
||||||
@@ -2119,7 +2115,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||||
DETECTION_VALIDATION_OUTCOME: ${{ steps.validate_detection_results.outcome }}
|
|
||||||
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
DETECTION_RESET_OUTCOME: ${{ steps.detection_staging_reset.outcome }}
|
||||||
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
AWF_INSTALL_OUTCOME: ${{ steps.detection_awf_install.outcome }}
|
||||||
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
|
||||||
@@ -2153,8 +2148,6 @@ jobs:
|
|||||||
GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
|
GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
|
||||||
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/renovate-minor-review"
|
GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/renovate-minor-review"
|
||||||
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
|
||||||
GH_AW_DETECTION_MODELS: ${{ needs.detection.outputs.detection_models || '[]' }}
|
|
||||||
GH_AW_DETECTION_MODEL_NAMES_UNAVAILABLE: ${{ needs.detection.outputs.detection_model_names_unavailable || 'false' }}
|
|
||||||
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
|
||||||
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
GH_AW_DETECTION_THREAT_KINDS: ${{ needs.detection.outputs.detection_threat_kinds }}
|
||||||
GH_AW_ENGINE_ID: "copilot"
|
GH_AW_ENGINE_ID: "copilot"
|
||||||
@@ -2190,7 +2183,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
id: setup
|
id: setup
|
||||||
uses: github/gh-aw-actions/setup@a2b1229fe98b05bde43bbab67d4985650da08514 # v1.4.6
|
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||||
with:
|
with:
|
||||||
destination: ${{ runner.temp }}/gh-aw/actions
|
destination: ${{ runner.temp }}/gh-aw/actions
|
||||||
job-name: ${{ github.job }}
|
job-name: ${{ github.job }}
|
||||||
@@ -2199,7 +2192,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
GH_AW_SETUP_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||||
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/renovate-minor-review.lock.yml@${{ github.ref }}
|
||||||
GH_AW_INFO_VERSION: "1.0.115"
|
GH_AW_INFO_VERSION: "1.0.103"
|
||||||
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
GH_AW_INFO_AWF_VERSION: "v0.29.22"
|
||||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||||
|
|||||||
Generated
+63
-115
@@ -381,7 +381,7 @@ dependencies = [
|
|||||||
"dirs 6.0.0",
|
"dirs 6.0.0",
|
||||||
"os_info",
|
"os_info",
|
||||||
"smappservice-rs",
|
"smappservice-rs",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"windows-registry",
|
"windows-registry",
|
||||||
"windows-result 0.4.1",
|
"windows-result 0.4.1",
|
||||||
]
|
]
|
||||||
@@ -664,7 +664,7 @@ dependencies = [
|
|||||||
"tap",
|
"tap",
|
||||||
"temporal_rs",
|
"temporal_rs",
|
||||||
"thin-vec",
|
"thin-vec",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"time",
|
"time",
|
||||||
"timezone_provider",
|
"timezone_provider",
|
||||||
"xsum",
|
"xsum",
|
||||||
@@ -928,7 +928,7 @@ dependencies = [
|
|||||||
"semver 1.0.28",
|
"semver 1.0.28",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1106,19 +1106,16 @@ dependencies = [
|
|||||||
"async-trait",
|
"async-trait",
|
||||||
"backon",
|
"backon",
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
|
"boa_engine",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"clash-verge-backup-archive",
|
"clash-verge-backup-archive",
|
||||||
"clash-verge-config-render",
|
|
||||||
"clash-verge-draft",
|
"clash-verge-draft",
|
||||||
"clash-verge-i18n",
|
"clash-verge-i18n",
|
||||||
"clash-verge-limiter",
|
"clash-verge-limiter",
|
||||||
"clash-verge-logging",
|
"clash-verge-logging",
|
||||||
"clash-verge-media-unlock",
|
"clash-verge-media-unlock",
|
||||||
"clash-verge-profile",
|
"clash-verge-profile",
|
||||||
"clash-verge-profile-script",
|
|
||||||
"clash-verge-proxy-view",
|
|
||||||
"clash-verge-runtime-bundle",
|
|
||||||
"clash-verge-signal",
|
"clash-verge-signal",
|
||||||
"clash-verge-subscription",
|
"clash-verge-subscription",
|
||||||
"clash-verge-task",
|
"clash-verge-task",
|
||||||
@@ -1194,30 +1191,17 @@ dependencies = [
|
|||||||
name = "clash-verge-backup-archive"
|
name = "clash-verge-backup-archive"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"zip",
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clash-verge-config-render"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clash-verge-logging",
|
|
||||||
"log",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"serde_yaml_ng",
|
|
||||||
"tokio",
|
|
||||||
"tristr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clash-verge-draft"
|
name = "clash-verge-draft"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"criterion",
|
"criterion",
|
||||||
"parking_lot 0.13.0",
|
"parking_lot 0.13.0",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1244,7 +1228,7 @@ dependencies = [
|
|||||||
"flexi_logger",
|
"flexi_logger",
|
||||||
"log",
|
"log",
|
||||||
"parking_lot 0.13.0",
|
"parking_lot 0.13.0",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tracing-estuary",
|
"tracing-estuary",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1271,43 +1255,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml_ng",
|
"serde_yaml_ng",
|
||||||
"specta",
|
"specta",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tristr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clash-verge-profile-script"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"boa_engine",
|
|
||||||
"clash-verge-logging",
|
|
||||||
"log",
|
|
||||||
"serde_json",
|
|
||||||
"serde_yaml_ng",
|
|
||||||
"tokio",
|
|
||||||
"tristr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clash-verge-proxy-view"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"specta",
|
|
||||||
"tristr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clash-verge-runtime-bundle"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clash-verge-logging",
|
|
||||||
"hex",
|
|
||||||
"log",
|
|
||||||
"serde_yaml_ng",
|
|
||||||
"sha2 0.11.2",
|
|
||||||
"thiserror 2.0.20",
|
|
||||||
"tokio",
|
|
||||||
"tristr",
|
"tristr",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1327,7 +1275,7 @@ dependencies = [
|
|||||||
"http",
|
"http",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"serde_yaml_ng",
|
"serde_yaml_ng",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2058,7 +2006,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"prost-types",
|
"prost-types",
|
||||||
"ringbuf",
|
"ringbuf",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tonic",
|
"tonic",
|
||||||
@@ -2177,7 +2125,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"option-ext",
|
"option-ext",
|
||||||
"redox_users 0.5.2",
|
"redox_users 0.5.2",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.101.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2556,7 +2504,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"nu-ansi-term",
|
"nu-ansi-term",
|
||||||
"regex",
|
"regex",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2616,9 +2564,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "form_urlencoded"
|
name = "form_urlencoded"
|
||||||
version = "1.2.2"
|
version = "1.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
|
checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
@@ -3013,7 +2961,7 @@ dependencies = [
|
|||||||
"objc2-app-kit",
|
"objc2-app-kit",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
"x11rb",
|
"x11rb",
|
||||||
"xkeysym",
|
"xkeysym",
|
||||||
@@ -3286,9 +3234,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "http"
|
||||||
version = "1.5.0"
|
version = "1.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
|
checksum = "a07dc2d082802d1782faa5b3c8ac252f3a4fc89f51e76c3f37dc2d1a5b857c05"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"itoa",
|
"itoa",
|
||||||
@@ -3883,7 +3831,7 @@ dependencies = [
|
|||||||
"jni-sys 0.4.1",
|
"jni-sys 0.4.1",
|
||||||
"log",
|
"log",
|
||||||
"simd_cesu8",
|
"simd_cesu8",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"windows-link 0.2.1",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
@@ -3959,7 +3907,7 @@ dependencies = [
|
|||||||
"jsonptr",
|
"jsonptr",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4010,7 +3958,7 @@ dependencies = [
|
|||||||
"rand 0.10.2",
|
"rand 0.10.2",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
@@ -4399,7 +4347,7 @@ dependencies = [
|
|||||||
"objc2-foundation",
|
"objc2-foundation",
|
||||||
"png",
|
"png",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4476,7 +4424,7 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5058,7 +5006,7 @@ dependencies = [
|
|||||||
"objc2-osa-kit",
|
"objc2-osa-kit",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5625,7 +5573,7 @@ dependencies = [
|
|||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"rustls",
|
"rustls",
|
||||||
"socket2",
|
"socket2",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"web-time",
|
"web-time",
|
||||||
@@ -5648,7 +5596,7 @@ dependencies = [
|
|||||||
"rustls",
|
"rustls",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"slab",
|
"slab",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
"tracing",
|
"tracing",
|
||||||
"web-time",
|
"web-time",
|
||||||
@@ -5846,7 +5794,7 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.17",
|
"getrandom 0.2.17",
|
||||||
"libredox",
|
"libredox",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6209,9 +6157,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.23.47"
|
version = "0.23.48"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ac0e747c10d93d873fd4c50b26ef47ad92d1bfb48f6922003bb514070f6e88c"
|
checksum = "86c8de8f13bac4bb046743409c751e2343621c0293a805c143ede57c5c95c3f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-rs",
|
"aws-lc-rs",
|
||||||
"log",
|
"log",
|
||||||
@@ -6871,7 +6819,7 @@ dependencies = [
|
|||||||
"objc2",
|
"objc2",
|
||||||
"objc2-foundation",
|
"objc2-foundation",
|
||||||
"objc2-service-management",
|
"objc2-service-management",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7166,7 +7114,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"serde",
|
"serde",
|
||||||
"system-configuration",
|
"system-configuration",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
"which 8.0.5",
|
"which 8.0.5",
|
||||||
@@ -7356,7 +7304,7 @@ dependencies = [
|
|||||||
"tauri-runtime",
|
"tauri-runtime",
|
||||||
"tauri-runtime-wry",
|
"tauri-runtime-wry",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tray-icon",
|
"tray-icon",
|
||||||
@@ -7406,7 +7354,7 @@ dependencies = [
|
|||||||
"sha2 0.11.2",
|
"sha2 0.11.2",
|
||||||
"syn 2.0.119",
|
"syn 2.0.119",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"uuid",
|
"uuid",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
]
|
]
|
||||||
@@ -7452,7 +7400,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7481,7 +7429,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7498,7 +7446,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
"windows-registry",
|
"windows-registry",
|
||||||
@@ -7546,7 +7494,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tauri-plugin-fs",
|
"tauri-plugin-fs",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -7569,7 +7517,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"toml 1.2.1+spec-1.1.0",
|
"toml 1.2.1+spec-1.1.0",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
@@ -7586,7 +7534,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7608,7 +7556,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tauri-plugin-fs",
|
"tauri-plugin-fs",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
"urlpattern",
|
"urlpattern",
|
||||||
@@ -7631,7 +7579,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite",
|
||||||
"ts-rs",
|
"ts-rs",
|
||||||
@@ -7653,7 +7601,7 @@ dependencies = [
|
|||||||
"serde_repr",
|
"serde_repr",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"time",
|
"time",
|
||||||
"url",
|
"url",
|
||||||
"zbus",
|
"zbus",
|
||||||
@@ -7675,7 +7623,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"url",
|
"url",
|
||||||
"windows 0.62.2",
|
"windows 0.62.2",
|
||||||
"zbus",
|
"zbus",
|
||||||
@@ -7699,7 +7647,7 @@ dependencies = [
|
|||||||
"shared_child",
|
"shared_child",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"windows-sys 0.60.2",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
@@ -7730,7 +7678,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
@@ -7760,7 +7708,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"uuid",
|
"uuid",
|
||||||
@@ -7782,7 +7730,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7803,7 +7751,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"url",
|
"url",
|
||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
"webview2-com",
|
"webview2-com",
|
||||||
@@ -7852,7 +7800,7 @@ dependencies = [
|
|||||||
"specta-util",
|
"specta-util",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-specta-macros",
|
"tauri-specta-macros",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7898,7 +7846,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_with",
|
"serde_with",
|
||||||
"swift-rs",
|
"swift-rs",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"toml 1.2.1+spec-1.1.0",
|
"toml 1.2.1+spec-1.1.0",
|
||||||
"url",
|
"url",
|
||||||
"urlpattern",
|
"urlpattern",
|
||||||
@@ -7923,7 +7871,7 @@ version = "0.7.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9ed071c670382e85fc2f48ae706492d8c338f4f89bf72520d32f8abfe880aade"
|
checksum = "9ed071c670382e85fc2f48ae706492d8c338f4f89bf72520d32f8abfe880aade"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"windows 0.61.3",
|
"windows 0.61.3",
|
||||||
"windows-version",
|
"windows-version",
|
||||||
]
|
]
|
||||||
@@ -8047,11 +7995,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "2.0.20"
|
version = "2.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
|
checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl 2.0.20",
|
"thiserror-impl 2.0.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8067,9 +8015,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "2.0.20"
|
version = "2.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
|
checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -8581,7 +8529,7 @@ dependencies = [
|
|||||||
"objc2-foundation",
|
"objc2-foundation",
|
||||||
"png",
|
"png",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -8635,7 +8583,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "756050066659291d47a554a9f558125db17428b073c5ffce1daf5dcb0f7231d8"
|
checksum = "756050066659291d47a554a9f558125db17428b073c5ffce1daf5dcb0f7231d8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"ts-rs-macros",
|
"ts-rs-macros",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -8664,7 +8612,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"rand 0.9.5",
|
"rand 0.9.5",
|
||||||
"sha1 0.10.7",
|
"sha1 0.10.7",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"utf-8",
|
"utf-8",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -8757,9 +8705,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "2.5.8"
|
version = "2.5.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
|
checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"idna",
|
"idna",
|
||||||
@@ -9197,7 +9145,7 @@ version = "0.39.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb"
|
checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"windows 0.62.2",
|
"windows 0.62.2",
|
||||||
"windows-core 0.62.2",
|
"windows-core 0.62.2",
|
||||||
]
|
]
|
||||||
@@ -10061,7 +10009,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"os_pipe",
|
"os_pipe",
|
||||||
"rustix 1.1.4",
|
"rustix 1.1.4",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tree_magic_mini",
|
"tree_magic_mini",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
@@ -10113,7 +10061,7 @@ dependencies = [
|
|||||||
"sha2 0.11.2",
|
"sha2 0.11.2",
|
||||||
"soup3",
|
"soup3",
|
||||||
"tao-macros",
|
"tao-macros",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.21",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
|
|||||||
+1
-12
@@ -10,10 +10,6 @@ members = [
|
|||||||
"crates/clash-verge-i18n",
|
"crates/clash-verge-i18n",
|
||||||
"crates/clash-verge-limiter",
|
"crates/clash-verge-limiter",
|
||||||
"crates/clash-verge-subscription",
|
"crates/clash-verge-subscription",
|
||||||
"crates/clash-verge-runtime-bundle",
|
|
||||||
"crates/clash-verge-config-render",
|
|
||||||
"crates/clash-verge-profile-script",
|
|
||||||
"crates/clash-verge-proxy-view",
|
|
||||||
"crates/clash-verge-profile",
|
"crates/clash-verge-profile",
|
||||||
"crates/clash-verge-backup-archive",
|
"crates/clash-verge-backup-archive",
|
||||||
]
|
]
|
||||||
@@ -60,8 +56,6 @@ muda = { git = "https://github.com/wonfen/muda.git", rev = "547de49352791653fbdf
|
|||||||
tauri-plugin-wdio-webdriver = { git = "https://github.com/Tunglies/desktop-mobile.git", rev = "2745082c7f487c5e0c9568000b5a7ac24234d6e4" }
|
tauri-plugin-wdio-webdriver = { git = "https://github.com/Tunglies/desktop-mobile.git", rev = "2745082c7f487c5e0c9568000b5a7ac24234d6e4" }
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
clash-verge-config-render = { path = "crates/clash-verge-config-render" }
|
|
||||||
clash-verge-profile-script = { path = "crates/clash-verge-profile-script" }
|
|
||||||
clash-verge-draft = { path = "crates/clash-verge-draft" }
|
clash-verge-draft = { path = "crates/clash-verge-draft" }
|
||||||
clash-verge-task = { path = "crates/clash-verge-task" }
|
clash-verge-task = { path = "crates/clash-verge-task" }
|
||||||
clash-verge-media-unlock = { path = "crates/clash-verge-media-unlock" }
|
clash-verge-media-unlock = { path = "crates/clash-verge-media-unlock" }
|
||||||
@@ -70,11 +64,8 @@ clash-verge-signal = { path = "crates/clash-verge-signal" }
|
|||||||
clash-verge-i18n = { path = "crates/clash-verge-i18n" }
|
clash-verge-i18n = { path = "crates/clash-verge-i18n" }
|
||||||
clash-verge-limiter = { path = "crates/clash-verge-limiter" }
|
clash-verge-limiter = { path = "crates/clash-verge-limiter" }
|
||||||
clash-verge-subscription = { path = "crates/clash-verge-subscription" }
|
clash-verge-subscription = { path = "crates/clash-verge-subscription" }
|
||||||
clash-verge-runtime-bundle = { path = "crates/clash-verge-runtime-bundle" }
|
|
||||||
clash-verge-proxy-view = { path = "crates/clash-verge-proxy-view" }
|
|
||||||
clash-verge-profile = { path = "crates/clash-verge-profile" }
|
clash-verge-profile = { path = "crates/clash-verge-profile" }
|
||||||
clash-verge-backup-archive = { path = "crates/clash-verge-backup-archive" }
|
clash-verge-backup-archive = { path = "crates/clash-verge-backup-archive" }
|
||||||
clash_verge_service_ipc = { git = "https://github.com/clash-verge-rev/clash-verge-service-ipc.git", branch = "main", version = "2.8.2", default-features = false }
|
|
||||||
tracing-estuary = { git = "https://github.com/Tunglies/tracing-estuary.git", branch = "main" }
|
tracing-estuary = { git = "https://github.com/Tunglies/tracing-estuary.git", branch = "main" }
|
||||||
tauri-plugin-clash-verge-sysinfo = { path = "crates/tauri-plugin-clash-verge-sysinfo" }
|
tauri-plugin-clash-verge-sysinfo = { path = "crates/tauri-plugin-clash-verge-sysinfo" }
|
||||||
tracing = "0.1.44"
|
tracing = "0.1.44"
|
||||||
@@ -83,9 +74,8 @@ tauri = { version = "2.13.0" }
|
|||||||
tauri-plugin-clipboard-manager = "2.5.0"
|
tauri-plugin-clipboard-manager = "2.5.0"
|
||||||
parking_lot = "0.13.0"
|
parking_lot = "0.13.0"
|
||||||
anyhow = "1.0.105"
|
anyhow = "1.0.105"
|
||||||
thiserror = "2.0.20"
|
thiserror = "2.0.21"
|
||||||
zip = "9.9.0"
|
zip = "9.9.0"
|
||||||
boa_engine = "0.22.0"
|
|
||||||
futures = "0.3.34"
|
futures = "0.3.34"
|
||||||
loom = "0.7.3"
|
loom = "0.7.3"
|
||||||
proptest = "1.12.0"
|
proptest = "1.12.0"
|
||||||
@@ -112,7 +102,6 @@ serde = { version = "1.0.229" }
|
|||||||
tristr = { git = "https://github.com/Tunglies/tristr", rev = "d849e5cff47a570849c2e1bada0a2b6481cf3378", default-features = false, features = ["serde", "specta"] }
|
tristr = { git = "https://github.com/Tunglies/tristr", rev = "d849e5cff47a570849c2e1bada0a2b6481cf3378", default-features = false, features = ["serde", "specta"] }
|
||||||
serde_json = { version = "1.0.154" }
|
serde_json = { version = "1.0.154" }
|
||||||
serde_yaml_ng = { version = "0.10.0" }
|
serde_yaml_ng = { version = "0.10.0" }
|
||||||
sha2 = "0.11.2"
|
|
||||||
specta = "=2.0.0-rc.26"
|
specta = "=2.0.0-rc.26"
|
||||||
socket2 = "0.6.5"
|
socket2 = "0.6.5"
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "clash-verge-config-render"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
clash-verge-logging = { workspace = true }
|
|
||||||
log = { workspace = true }
|
|
||||||
serde = { workspace = true, features = ["derive"] }
|
|
||||||
serde_json = { workspace = true }
|
|
||||||
serde_yaml_ng = { workspace = true }
|
|
||||||
tristr = { workspace = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
tokio = { workspace = true }
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,81 +0,0 @@
|
|||||||
use super::{ResultLog, ScriptOutcome, field::use_lowercase};
|
|
||||||
use serde_yaml_ng::Mapping;
|
|
||||||
use tristr::alias::String;
|
|
||||||
|
|
||||||
type ScriptResult = (Mapping, Vec<String>, ResultLog);
|
|
||||||
|
|
||||||
/// Never fails: exceptions are logged and the input config is returned unchanged.
|
|
||||||
pub(super) async fn use_script<Fut: Future<Output = ScriptOutcome> + Send>(
|
|
||||||
script: String,
|
|
||||||
config: Mapping,
|
|
||||||
name: String,
|
|
||||||
execute: impl FnOnce(String, serde_json::Value, String) -> Fut + Send,
|
|
||||||
) -> ScriptResult {
|
|
||||||
// The template is identity-plus-lowercasing; skip the Boa round-trip.
|
|
||||||
if script == super::ITEM_SCRIPT {
|
|
||||||
return (use_lowercase(config), vec![], vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let json = match serde_json::to_value(&config) {
|
|
||||||
Ok(mut json) => {
|
|
||||||
if let Some(map) = json.as_object_mut() {
|
|
||||||
let mut lowered = serde_json::Map::with_capacity(map.len());
|
|
||||||
for (key, value) in std::mem::take(map) {
|
|
||||||
let mut key = key;
|
|
||||||
key.make_ascii_lowercase();
|
|
||||||
lowered.insert(key, value);
|
|
||||||
}
|
|
||||||
*map = lowered;
|
|
||||||
}
|
|
||||||
json
|
|
||||||
}
|
|
||||||
Err(err) => return (config, vec![], vec![("exception".into(), err.to_string().into())]),
|
|
||||||
};
|
|
||||||
|
|
||||||
let (outcome, mut logs) = execute(script, json, name).await;
|
|
||||||
match outcome {
|
|
||||||
Ok(result) => {
|
|
||||||
let result = use_lowercase(result);
|
|
||||||
// Compared against the config as handed in, not the lowercased copy the script saw.
|
|
||||||
let changed_keys = result
|
|
||||||
.iter()
|
|
||||||
.filter(|(key, value)| config.get(key) != Some(value))
|
|
||||||
.filter_map(|(key, _)| {
|
|
||||||
let mut key: String = key.as_str()?.into();
|
|
||||||
key.make_ascii_lowercase();
|
|
||||||
Some(key)
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
(result, changed_keys, logs)
|
|
||||||
}
|
|
||||||
Err(reason) => {
|
|
||||||
logs.push(("exception".into(), reason.into()));
|
|
||||||
(config, vec![], logs)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use std::future::ready;
|
|
||||||
|
|
||||||
use super::{Mapping, use_script};
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn default_template_skips_the_executor() {
|
|
||||||
let mut called = false;
|
|
||||||
let mut config = Mapping::new();
|
|
||||||
config.insert("MiXeD".into(), true.into());
|
|
||||||
let (config, changed_keys, logs) =
|
|
||||||
use_script(crate::ITEM_SCRIPT.into(), config, "profile".into(), |_, _, _| {
|
|
||||||
called = true;
|
|
||||||
ready((Ok(Mapping::new()), vec![]))
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
|
|
||||||
assert!(!called);
|
|
||||||
assert_eq!(config["mixed"], serde_yaml_ng::Value::Bool(true));
|
|
||||||
assert!(changed_keys.is_empty());
|
|
||||||
assert!(logs.is_empty());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "clash-verge-profile-script"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
boa_engine = { workspace = true }
|
|
||||||
clash-verge-logging = { workspace = true }
|
|
||||||
log = { workspace = true }
|
|
||||||
serde_json = { workspace = true }
|
|
||||||
serde_yaml_ng = { workspace = true }
|
|
||||||
tokio = { workspace = true }
|
|
||||||
tristr = { workspace = true }
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "clash-verge-proxy-view"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
serde = { workspace = true, features = ["derive"] }
|
|
||||||
specta = { workspace = true, features = ["derive"] }
|
|
||||||
tristr = { workspace = true }
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "clash-verge-runtime-bundle"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
thiserror = { workspace = true }
|
|
||||||
clash-verge-logging = { workspace = true }
|
|
||||||
hex = "0.4.3"
|
|
||||||
log = { workspace = true }
|
|
||||||
serde_yaml_ng = { workspace = true }
|
|
||||||
sha2 = { workspace = true }
|
|
||||||
tristr = { workspace = true }
|
|
||||||
tokio = { workspace = true, features = ["fs"] }
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
|
||||||
pub enum RuntimeBundleError {
|
|
||||||
#[error(transparent)]
|
|
||||||
Io(#[from] std::io::Error),
|
|
||||||
#[error("failed to read runtime config {path:?}")]
|
|
||||||
ReadConfig {
|
|
||||||
path: PathBuf,
|
|
||||||
#[source]
|
|
||||||
source: std::io::Error,
|
|
||||||
},
|
|
||||||
#[error("failed to parse runtime config {path:?}")]
|
|
||||||
ParseConfig {
|
|
||||||
path: PathBuf,
|
|
||||||
#[source]
|
|
||||||
source: serde_yaml_ng::Error,
|
|
||||||
},
|
|
||||||
#[error("runtime config has no parent directory")]
|
|
||||||
MissingConfigDirectory,
|
|
||||||
#[error("runtime provider destination {0:?} is declared for two different sources")]
|
|
||||||
DifferentSources(String),
|
|
||||||
#[error("runtime provider destination {0:?} is claimed more than once")]
|
|
||||||
DuplicateDestination(String),
|
|
||||||
#[error("local runtime provider is unavailable: {path:?}")]
|
|
||||||
LocalProviderUnavailable {
|
|
||||||
path: PathBuf,
|
|
||||||
#[source]
|
|
||||||
source: std::io::Error,
|
|
||||||
},
|
|
||||||
#[error("local runtime provider is outside the config root: {0:?}")]
|
|
||||||
LocalProviderOutsideRoot(PathBuf),
|
|
||||||
#[error("runtime provider destination traverses outside the runtime")]
|
|
||||||
DestinationOutsideRuntime,
|
|
||||||
#[error("runtime provider path has no existing ancestor: {0:?}")]
|
|
||||||
MissingAncestor(PathBuf),
|
|
||||||
#[error("runtime provider path is outside the config root: {0:?}")]
|
|
||||||
ProviderOutsideRoot(PathBuf),
|
|
||||||
#[error("local runtime provider destination traverses outside the runtime")]
|
|
||||||
LocalDestinationOutsideRuntime,
|
|
||||||
#[error("local runtime provider destination is empty")]
|
|
||||||
EmptyDestination,
|
|
||||||
}
|
|
||||||
@@ -5,10 +5,10 @@ edition = "2024"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
http = "1"
|
http = "1.6.0"
|
||||||
percent-encoding = "2.3.2"
|
percent-encoding = "2.3.2"
|
||||||
serde_yaml_ng = { workspace = true }
|
serde_yaml_ng = { workspace = true }
|
||||||
url = "2.5"
|
url = "2.5.9"
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|||||||
@@ -37,10 +37,6 @@ clash-verge-logging = { workspace = true }
|
|||||||
clash-verge-i18n = { workspace = true }
|
clash-verge-i18n = { workspace = true }
|
||||||
clash-verge-limiter = { workspace = true }
|
clash-verge-limiter = { workspace = true }
|
||||||
clash-verge-subscription = { workspace = true }
|
clash-verge-subscription = { workspace = true }
|
||||||
clash-verge-runtime-bundle = { workspace = true }
|
|
||||||
clash-verge-config-render = { workspace = true }
|
|
||||||
clash-verge-profile-script = { workspace = true }
|
|
||||||
clash-verge-proxy-view = { workspace = true }
|
|
||||||
clash-verge-profile = { workspace = true }
|
clash-verge-profile = { workspace = true }
|
||||||
clash-verge-backup-archive = { workspace = true }
|
clash-verge-backup-archive = { workspace = true }
|
||||||
tauri-plugin-clash-verge-sysinfo = { workspace = true }
|
tauri-plugin-clash-verge-sysinfo = { workspace = true }
|
||||||
@@ -68,6 +64,7 @@ dirs = "7.0.0"
|
|||||||
dunce = "1.0.5"
|
dunce = "1.0.5"
|
||||||
nanoid = "0.5"
|
nanoid = "0.5"
|
||||||
chrono = { workspace = true }
|
chrono = { workspace = true }
|
||||||
|
boa_engine = "0.22.0"
|
||||||
http-body-util = "0.1.5"
|
http-body-util = "0.1.5"
|
||||||
percent-encoding = "2.3.2"
|
percent-encoding = "2.3.2"
|
||||||
reqwest = { workspace = true }
|
reqwest = { workspace = true }
|
||||||
@@ -86,7 +83,7 @@ flate2 = "1.1.11"
|
|||||||
reqwest_dav = "0.4.0"
|
reqwest_dav = "0.4.0"
|
||||||
aes-gcm = { version = "0.11.1" }
|
aes-gcm = { version = "0.11.1" }
|
||||||
base64 = "0.23.1"
|
base64 = "0.23.1"
|
||||||
sha2 = { workspace = true }
|
sha2 = "0.11.2"
|
||||||
getrandom = "0.4.3"
|
getrandom = "0.4.3"
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
gethostname = "1.1.0"
|
gethostname = "1.1.0"
|
||||||
@@ -97,15 +94,17 @@ tracing = { workspace = true }
|
|||||||
tauri-plugin-devtools = { version = "2.2.3", optional = true }
|
tauri-plugin-devtools = { version = "2.2.3", optional = true }
|
||||||
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo", rev = "7e4fa8642cf6c394ed88b5a969420d8eab60087f" }
|
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo", rev = "7e4fa8642cf6c394ed88b5a969420d8eab60087f" }
|
||||||
async-trait = "0.1.92"
|
async-trait = "0.1.92"
|
||||||
clash_verge_service_ipc = { workspace = true, features = ["client"] }
|
clash_verge_service_ipc = { git = "https://github.com/clash-verge-rev/clash-verge-service-ipc.git", branch = "main", version = "2.8.2", features = [
|
||||||
|
"client",
|
||||||
|
] }
|
||||||
arc-swap = "1.9.5"
|
arc-swap = "1.9.5"
|
||||||
tokio-rustls = "0.26.6"
|
tokio-rustls = "0.26.6"
|
||||||
rustls = { version = "0.23.47", features = ["ring"] }
|
rustls = { version = "0.23.48", features = ["ring"] }
|
||||||
webpki-roots = "1.0.12"
|
webpki-roots = "1.0.12"
|
||||||
dark-light = "3.0.0"
|
dark-light = "3.0.0"
|
||||||
bytes = "1.12.2"
|
bytes = "1.12.2"
|
||||||
tokio-util = { version = "0.7.20", features = ["time"] }
|
tokio-util = { version = "0.7.20", features = ["time"] }
|
||||||
specta = { workspace = true, features = ["derive", "function", "serde_json"] }
|
specta = { version = "=2.0.0-rc.26", features = ["derive", "function", "serde_json"] }
|
||||||
tauri-specta = { version = "=2.0.0-rc.26", features = ["derive", "typescript"] }
|
tauri-specta = { version = "=2.0.0-rc.26", features = ["derive", "typescript"] }
|
||||||
specta-typescript = "=0.0.13"
|
specta-typescript = "=0.0.13"
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use super::{CmdResult, CommandFailure, WithErrorCode as _, proxy_aware_coded_error, proxy_aware_error};
|
use super::{CmdResult, CommandFailure, WithErrorCode as _, proxy_aware_coded_error, proxy_aware_error};
|
||||||
use crate::core::notify::NoticeStatus;
|
use crate::core::notify::NoticeStatus;
|
||||||
use crate::feat;
|
use crate::feat;
|
||||||
use crate::utils::dirs;
|
use crate::utils::{dirs, yaml_emitter};
|
||||||
use crate::{
|
use crate::{
|
||||||
cmd::StringifyErr as _,
|
cmd::StringifyErr as _,
|
||||||
config::{ClashInfo, Config, mihomo_yaml, profiles::save_committed_profiles},
|
config::{ClashInfo, Config, profiles::save_committed_profiles},
|
||||||
constants,
|
constants,
|
||||||
core::{
|
core::{
|
||||||
CoreManager, handle,
|
CoreManager, handle,
|
||||||
@@ -132,7 +132,7 @@ pub async fn save_dns_config(dns_config: crate::ipc::YamlMapping) -> CmdResult {
|
|||||||
|
|
||||||
let dns_path = dirs::app_home_dir().stringify_err()?.join(constants::files::DNS_CONFIG);
|
let dns_path = dirs::app_home_dir().stringify_err()?.join(constants::files::DNS_CONFIG);
|
||||||
|
|
||||||
let yaml_str = mihomo_yaml::serialize_for_export(&dns_config.0).stringify_err()?;
|
let yaml_str = yaml_emitter::to_mihomo_config_string(&dns_config.0).stringify_err()?;
|
||||||
fs::write(&dns_path, yaml_str).await.stringify_err()?;
|
fs::write(&dns_path, yaml_str).await.stringify_err()?;
|
||||||
logging!(info, Type::Config, "DNS config saved to {dns_path:?}");
|
logging!(info, Type::Config, "DNS config saved to {dns_path:?}");
|
||||||
|
|
||||||
|
|||||||
+92
-10
@@ -1,6 +1,14 @@
|
|||||||
use super::CmdResult;
|
use super::CmdResult;
|
||||||
use crate::{cmd::StringifyErr as _, config::Config, core::handle::Handle};
|
use crate::{
|
||||||
use clash_verge_proxy_view::ProxyViewV1;
|
cmd::StringifyErr as _,
|
||||||
|
config::Config,
|
||||||
|
core::{
|
||||||
|
handle::Handle,
|
||||||
|
proxy_view::{GroupScope, ProxyViewBuilder, ProxyViewInput, ProxyViewV1},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
use serde_yaml_ng::Mapping;
|
||||||
|
use std::collections::{BTreeMap, HashSet};
|
||||||
|
|
||||||
/// Merges one selection pair into fresh backend state to avoid stale-list overwrites.
|
/// Merges one selection pair into fresh backend state to avoid stale-list overwrites.
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
@@ -19,16 +27,90 @@ pub async fn switch_proxy_node(group_name: String, proxy_name: String, unfix: bo
|
|||||||
.stringify_err()
|
.stringify_err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn runtime_group_order(config: Option<&Mapping>) -> Vec<String> {
|
||||||
|
let mut seen = HashSet::new();
|
||||||
|
|
||||||
|
config
|
||||||
|
.and_then(|config| config.get("proxy-groups"))
|
||||||
|
.and_then(|groups| groups.as_sequence())
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.filter_map(|group| group.get("name"))
|
||||||
|
.filter_map(|name| name.as_str())
|
||||||
|
.filter(|name| !name.is_empty() && *name != "GLOBAL")
|
||||||
|
.filter(|name| seen.insert(*name))
|
||||||
|
.map(str::to_owned)
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Mirrors Mihomo: `include-all`/`include-all-providers` replace `use` with every provider, sorted.
|
||||||
|
fn runtime_group_scopes(config: Option<&Mapping>) -> BTreeMap<String, GroupScope> {
|
||||||
|
let Some(config) = config else {
|
||||||
|
return BTreeMap::new();
|
||||||
|
};
|
||||||
|
let mut all_providers = config
|
||||||
|
.get("proxy-providers")
|
||||||
|
.and_then(|providers| providers.as_mapping())
|
||||||
|
.into_iter()
|
||||||
|
.flat_map(|providers| providers.keys())
|
||||||
|
.filter_map(|name| name.as_str())
|
||||||
|
.map(str::to_owned)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
all_providers.sort();
|
||||||
|
let flag = |group: &Mapping, key: &str| group.get(key).and_then(|value| value.as_bool()) == Some(true);
|
||||||
|
|
||||||
|
config
|
||||||
|
.get("proxy-groups")
|
||||||
|
.and_then(|groups| groups.as_sequence())
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.filter_map(|group| group.as_mapping())
|
||||||
|
.filter_map(|group| {
|
||||||
|
let name = group.get("name")?.as_str()?.to_owned();
|
||||||
|
let providers = if flag(group, "include-all") || flag(group, "include-all-providers") {
|
||||||
|
all_providers.clone()
|
||||||
|
} else {
|
||||||
|
group
|
||||||
|
.get("use")
|
||||||
|
.and_then(|providers| providers.as_sequence())
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.filter_map(|provider| provider.as_str())
|
||||||
|
.map(str::to_owned)
|
||||||
|
.collect()
|
||||||
|
};
|
||||||
|
let exclude_types = group
|
||||||
|
.get("exclude-type")
|
||||||
|
.and_then(|types| types.as_str())
|
||||||
|
.filter(|types| !types.is_empty())
|
||||||
|
.map_or_default(|types| types.split('|').map(str::to_owned).collect());
|
||||||
|
Some((
|
||||||
|
name,
|
||||||
|
GroupScope {
|
||||||
|
providers,
|
||||||
|
exclude_types,
|
||||||
|
},
|
||||||
|
))
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
#[specta::specta]
|
#[specta::specta]
|
||||||
pub async fn get_proxy_view() -> CmdResult<ProxyViewV1> {
|
pub async fn get_proxy_view() -> CmdResult<ProxyViewV1> {
|
||||||
let runtime = Config::runtime().await.latest_arc();
|
let runtime = Config::runtime().await;
|
||||||
|
let latest_runtime = runtime.latest_arc();
|
||||||
|
let runtime_group_order = runtime_group_order(latest_runtime.config.as_ref());
|
||||||
|
let group_scopes = runtime_group_scopes(latest_runtime.config.as_ref());
|
||||||
|
|
||||||
let mihomo = Handle::mihomo();
|
let mihomo = Handle::mihomo();
|
||||||
crate::feat::proxy_view::load_proxy_view(
|
let (proxies, providers) = tokio::join!(mihomo.get_proxies(), mihomo.get_proxy_providers(),);
|
||||||
runtime.config.as_ref(),
|
let proxies = proxies.stringify_err()?;
|
||||||
mihomo.get_proxies(),
|
|
||||||
mihomo.get_proxy_providers(),
|
Ok(ProxyViewBuilder::build(ProxyViewInput {
|
||||||
)
|
runtime_group_order,
|
||||||
.await
|
group_scopes,
|
||||||
.stringify_err()
|
proxies,
|
||||||
|
providers: providers.ok(),
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
use super::CmdResult;
|
use super::CmdResult;
|
||||||
use crate::{
|
use crate::{cmd::StringifyErr as _, config::Config, core::CoreManager, utils::yaml_emitter};
|
||||||
cmd::StringifyErr as _,
|
|
||||||
config::{Config, mihomo_yaml},
|
|
||||||
core::CoreManager,
|
|
||||||
};
|
|
||||||
use anyhow::{Context as _, anyhow};
|
use anyhow::{Context as _, anyhow};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use tristr::alias::String;
|
use tristr::alias::String;
|
||||||
@@ -28,7 +24,7 @@ pub async fn get_runtime_yaml() -> CmdResult<std::string::String> {
|
|||||||
let config = runtime.config.as_ref();
|
let config = runtime.config.as_ref();
|
||||||
config
|
config
|
||||||
.ok_or_else(|| anyhow!("failed to parse config to yaml file"))
|
.ok_or_else(|| anyhow!("failed to parse config to yaml file"))
|
||||||
.and_then(|config| mihomo_yaml::serialize_for_export(config).context("failed to convert config to yaml"))
|
.and_then(|config| yaml_emitter::to_mihomo_config_string(config).context("failed to convert config to yaml"))
|
||||||
.stringify_err()
|
.stringify_err()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +87,7 @@ pub async fn get_runtime_proxy_chain_config(
|
|||||||
|
|
||||||
config.insert("proxies".into(), proxies_chain);
|
config.insert("proxies".into(), proxies_chain);
|
||||||
|
|
||||||
mihomo_yaml::serialize_for_export(&config)
|
yaml_emitter::to_mihomo_config_string(&config)
|
||||||
.context("YAML generation failed")
|
.context("YAML generation failed")
|
||||||
.stringify_err()
|
.stringify_err()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use super::mihomo_yaml;
|
|
||||||
use crate::constants::{network, tun as tun_const};
|
use crate::constants::{network, tun as tun_const};
|
||||||
use crate::utils::dirs::{path_to_str, sidecar_ipc_path};
|
use crate::utils::dirs::{path_to_str, sidecar_ipc_path};
|
||||||
use crate::utils::{dirs, help};
|
use crate::utils::{dirs, help};
|
||||||
@@ -151,9 +150,7 @@ impl IClashTemp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn save_config(&self) -> Result<()> {
|
pub async fn save_config(&self) -> Result<()> {
|
||||||
let path = dirs::clash_path()?;
|
help::save_yaml(&dirs::clash_path()?, &self.0, Some("# Generated by Clash Verge")).await
|
||||||
let yaml = mihomo_yaml::serialize(&self.0)?;
|
|
||||||
help::save_yaml_str(&path, &yaml, Some("# Generated by Clash Verge")).await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_mixed_port(&self) -> u16 {
|
pub fn get_mixed_port(&self) -> u16 {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use super::{IClashTemp, IProfiles, IVerge, MixedPort, mihomo_yaml};
|
use super::{IClashTemp, IProfiles, IVerge, MixedPort};
|
||||||
use crate::core::notify::NoticeStatus;
|
use crate::core::notify::NoticeStatus;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{
|
config::{
|
||||||
@@ -11,6 +11,7 @@ use crate::{
|
|||||||
CoreManager,
|
CoreManager,
|
||||||
handle::{self, Handle},
|
handle::{self, Handle},
|
||||||
listener::MIXED_PORT_KEY,
|
listener::MIXED_PORT_KEY,
|
||||||
|
runtime_bundle::resolve_provider_path_conflicts,
|
||||||
tray,
|
tray,
|
||||||
validate::CoreConfigValidator,
|
validate::CoreConfigValidator,
|
||||||
},
|
},
|
||||||
@@ -22,7 +23,6 @@ use anyhow::{Result, anyhow};
|
|||||||
use backon::{ExponentialBuilder, Retryable as _};
|
use backon::{ExponentialBuilder, Retryable as _};
|
||||||
use clash_verge_draft::Draft;
|
use clash_verge_draft::Draft;
|
||||||
use clash_verge_logging::{Type, logging, logging_error};
|
use clash_verge_logging::{Type, logging, logging_error};
|
||||||
use clash_verge_runtime_bundle::resolve_provider_path_conflicts;
|
|
||||||
use serde_yaml_ng::{Mapping, Value};
|
use serde_yaml_ng::{Mapping, Value};
|
||||||
use std::{collections::HashSet, path::PathBuf};
|
use std::{collections::HashSet, path::PathBuf};
|
||||||
use tokio::sync::{Mutex, MutexGuard, OnceCell};
|
use tokio::sync::{Mutex, MutexGuard, OnceCell};
|
||||||
@@ -230,7 +230,7 @@ impl Config {
|
|||||||
{
|
{
|
||||||
return Ok(std::sync::Arc::clone(cached));
|
return Ok(std::sync::Arc::clone(cached));
|
||||||
}
|
}
|
||||||
let yaml_str = std::sync::Arc::new(mihomo_yaml::serialize(config)?);
|
let yaml_str = std::sync::Arc::new(serde_yaml_ng::to_string(config)?);
|
||||||
*RUNTIME_YAML_CACHE.lock() = Some((key, std::sync::Arc::clone(&yaml_str)));
|
*RUNTIME_YAML_CACHE.lock() = Some((key, std::sync::Arc::clone(&yaml_str)));
|
||||||
Ok(yaml_str)
|
Ok(yaml_str)
|
||||||
})
|
})
|
||||||
@@ -250,7 +250,7 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn generate_with_profiles(profiles: &IProfiles) -> Result<()> {
|
pub(crate) async fn generate_with_profiles(profiles: &IProfiles) -> Result<()> {
|
||||||
let (mut config, exists_keys, logs, dns_override) = enhance::render_runtime_config(profiles).await?;
|
let (mut config, exists_keys, logs, dns_override) = enhance::enhance(profiles).await?;
|
||||||
|
|
||||||
resolve_provider_path_conflicts(&mut config, &dirs::app_home_dir()?)?;
|
resolve_provider_path_conflicts(&mut config, &dirs::app_home_dir()?)?;
|
||||||
sanitize_tunnels_proxy(&mut config);
|
sanitize_tunnels_proxy(&mut config);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ mod clash;
|
|||||||
mod config;
|
mod config;
|
||||||
pub(crate) mod dns;
|
pub(crate) mod dns;
|
||||||
mod encrypt;
|
mod encrypt;
|
||||||
pub(crate) mod mihomo_yaml;
|
|
||||||
mod mixed_port;
|
mod mixed_port;
|
||||||
mod port;
|
mod port;
|
||||||
mod prfitem;
|
mod prfitem;
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ use serde_yaml_ng::{Mapping, Value};
|
|||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use tristr::alias::String;
|
use tristr::alias::String;
|
||||||
|
|
||||||
|
use crate::enhance::field::use_keys;
|
||||||
|
|
||||||
|
const PATCH_CONFIG_INNER: [&str; 5] = ["allow-lan", "ipv6", "log-level", "unified-delay", "tunnels"];
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
pub struct IRuntime {
|
pub struct IRuntime {
|
||||||
pub config: Option<Mapping>,
|
pub config: Option<Mapping>,
|
||||||
@@ -13,6 +17,39 @@ pub struct IRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl IRuntime {
|
impl IRuntime {
|
||||||
|
#[inline]
|
||||||
|
pub fn patch_config(&mut self, patch: &Mapping) {
|
||||||
|
let config = if let Some(config) = self.config.as_mut() {
|
||||||
|
config
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
for key in PATCH_CONFIG_INNER.iter() {
|
||||||
|
if let Some(value) = patch.get(key) {
|
||||||
|
config.insert((*key).into(), value.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(patch_tun) = patch.get("tun") else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
let tun_key = Value::from("tun");
|
||||||
|
if !matches!(config.get(&tun_key), Some(Value::Mapping(_))) {
|
||||||
|
config.insert(tun_key.clone(), Value::Mapping(Mapping::new()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if let (Some(patch_tun_mapping), Some(Value::Mapping(tun))) = (patch_tun.as_mapping(), config.get_mut(&tun_key))
|
||||||
|
{
|
||||||
|
for key in use_keys(patch_tun_mapping) {
|
||||||
|
if let Some(value) = patch_tun_mapping.get(key.as_str()) {
|
||||||
|
tun.insert(Value::from(key.as_str()), value.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Rebuilds `dialer-proxy` links from an ordered proxy chain, or removes them for `None`.
|
/// Rebuilds `dialer-proxy` links from an ordered proxy chain, or removes them for `None`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn update_proxy_chain_config(&mut self, proxy_chain_config: Option<Value>) {
|
pub fn update_proxy_chain_config(&mut self, proxy_chain_config: Option<Value>) {
|
||||||
|
|||||||
@@ -64,5 +64,22 @@ pub mod files {
|
|||||||
pub mod tun {
|
pub mod tun {
|
||||||
pub const DEFAULT_STACK: &str = "mips";
|
pub const DEFAULT_STACK: &str = "mips";
|
||||||
|
|
||||||
|
pub const DEFAULT_MTU: u16 = 1500;
|
||||||
|
|
||||||
pub const DNS_HIJACK: &[&str] = &["any:53"];
|
pub const DNS_HIJACK: &[&str] = &["any:53"];
|
||||||
|
|
||||||
|
/// Saved dialog fields; `enable` belongs to the verge switch.
|
||||||
|
pub const GUI_KEYS: &[&str] = &[
|
||||||
|
"stack",
|
||||||
|
"device",
|
||||||
|
"auto-route",
|
||||||
|
"route-exclude-address",
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
"auto-redirect",
|
||||||
|
"auto-detect-interface",
|
||||||
|
"dns-hijack",
|
||||||
|
"dns-mode",
|
||||||
|
"strict-route",
|
||||||
|
"mtu",
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use super::{CoreManager, PROFILE_SELECTIONS_PENDING_COMMIT, RunningMode};
|
|||||||
use crate::core::notify::NoticeStatus;
|
use crate::core::notify::NoticeStatus;
|
||||||
use crate::core::service::StageRequest;
|
use crate::core::service::StageRequest;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{Config, IProfiles, mihomo_yaml, profiles::save_profiles, runtime::IRuntime},
|
config::{Config, IProfiles, profiles::save_profiles, runtime::IRuntime},
|
||||||
constants::timing,
|
constants::timing,
|
||||||
core::{
|
core::{
|
||||||
handle,
|
handle,
|
||||||
@@ -170,8 +170,7 @@ impl CoreManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let yaml = mihomo_yaml::serialize(clash_config)?;
|
help::save_yaml(&runtime_path, &clash_config, Some("# Clash Verge Runtime")).await?;
|
||||||
help::save_yaml_str(&runtime_path, &yaml, Some("# Clash Verge Runtime")).await?;
|
|
||||||
handle::Handle::notice(status, message);
|
handle::Handle::notice(status, message);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ pub(super) fn explain_core_occupancy(error: anyhow::Error) -> anyhow::Error {
|
|||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn sidecar_config_without_tun(yaml: &str) -> Result<std::string::String> {
|
fn sidecar_config_without_tun(yaml: &str) -> Result<std::string::String> {
|
||||||
use crate::config::mihomo_yaml;
|
|
||||||
use serde_yaml_ng::{Mapping, Value};
|
use serde_yaml_ng::{Mapping, Value};
|
||||||
|
|
||||||
let mut config: Mapping = serde_yaml_ng::from_str(yaml)?;
|
let mut config: Mapping = serde_yaml_ng::from_str(yaml)?;
|
||||||
@@ -48,7 +47,7 @@ fn sidecar_config_without_tun(yaml: &str) -> Result<std::string::String> {
|
|||||||
tun.as_mapping_mut()
|
tun.as_mapping_mut()
|
||||||
.context("invalid Sidecar TUN configuration")?
|
.context("invalid Sidecar TUN configuration")?
|
||||||
.insert(Value::from("enable"), Value::Bool(false));
|
.insert(Value::from("enable"), Value::Bool(false));
|
||||||
Ok(mihomo_yaml::serialize(&config)?)
|
Ok(serde_yaml_ng::to_string(&config)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
const SIDECAR_READINESS_ATTEMPTS: usize = 30;
|
const SIDECAR_READINESS_ATTEMPTS: usize = 30;
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ pub mod network_watch;
|
|||||||
pub mod notify;
|
pub mod notify;
|
||||||
pub(crate) mod owner_identity;
|
pub(crate) mod owner_identity;
|
||||||
pub mod proxy_control;
|
pub mod proxy_control;
|
||||||
|
pub mod proxy_view;
|
||||||
pub mod runstate;
|
pub mod runstate;
|
||||||
|
pub(crate) mod runtime_bundle;
|
||||||
pub mod service;
|
pub mod service;
|
||||||
pub mod sysopt;
|
pub mod sysopt;
|
||||||
pub mod timer;
|
pub mod timer;
|
||||||
|
|||||||
@@ -1,40 +1,15 @@
|
|||||||
use std::collections::{BTreeMap, BTreeSet, HashMap};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use tristr::alias::String;
|
use tauri_plugin_mihomo::models::{
|
||||||
|
DelayHistory, Proxies, Proxy, ProxyProvider, ProxyProviders, ProxyType, VehicleType,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct ProxyViewInput {
|
pub struct ProxyViewInput {
|
||||||
pub runtime_group_order: Vec<String>,
|
pub runtime_group_order: Vec<String>,
|
||||||
pub group_scopes: BTreeMap<String, GroupScope>,
|
pub group_scopes: BTreeMap<String, GroupScope>,
|
||||||
pub proxies: HashMap<String, ProxySnapshot>,
|
pub proxies: Proxies,
|
||||||
pub providers: Option<BTreeMap<String, ProviderSnapshot>>,
|
pub providers: Option<ProxyProviders>,
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ProxySnapshot {
|
|
||||||
pub name: String,
|
|
||||||
pub proxy_type: String,
|
|
||||||
pub all: Option<Vec<String>>,
|
|
||||||
pub fixed: Option<String>,
|
|
||||||
pub hidden: Option<bool>,
|
|
||||||
pub icon: Option<String>,
|
|
||||||
pub now: Option<String>,
|
|
||||||
pub test_url: Option<String>,
|
|
||||||
pub id: Option<String>,
|
|
||||||
pub history: Vec<DelayHistory>,
|
|
||||||
pub capabilities: ProxyCapabilities,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ProviderSnapshot {
|
|
||||||
pub vehicle_type: ProxyProviderVehicleType,
|
|
||||||
pub proxies: Vec<ProxySnapshot>,
|
|
||||||
pub updated_at: Option<String>,
|
|
||||||
pub subscription_info: Option<ProxySubscriptionInfo>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Serialize, specta::Type)]
|
|
||||||
pub struct DelayHistory {
|
|
||||||
pub time: String,
|
|
||||||
pub delay: u16,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The providers a group draws from (Mihomo order) and its `exclude-type` entries.
|
/// The providers a group draws from (Mihomo order) and its `exclude-type` entries.
|
||||||
@@ -43,6 +18,8 @@ pub struct GroupScope {
|
|||||||
pub exclude_types: Vec<String>,
|
pub exclude_types: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct ProxyViewBuilder;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Serialize, specta::Type)]
|
#[derive(Debug, PartialEq, Eq, Serialize, specta::Type)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ProxyViewV1 {
|
pub struct ProxyViewV1 {
|
||||||
@@ -85,7 +62,8 @@ pub struct ProxyCapabilities {
|
|||||||
pub struct ProxyGroupView {
|
pub struct ProxyGroupView {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub proxy_type: String,
|
#[specta(type = String)]
|
||||||
|
pub proxy_type: ProxyType,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub now: Option<String>,
|
pub now: Option<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
@@ -96,6 +74,7 @@ pub struct ProxyGroupView {
|
|||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub test_url: Option<String>,
|
pub test_url: Option<String>,
|
||||||
|
#[specta(type = Vec<crate::ipc::DelayHistory>)]
|
||||||
pub history: Vec<DelayHistory>,
|
pub history: Vec<DelayHistory>,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub capabilities: ProxyCapabilities,
|
pub capabilities: ProxyCapabilities,
|
||||||
@@ -108,7 +87,9 @@ pub struct ProxyNodeView {
|
|||||||
pub record_id: String,
|
pub record_id: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub proxy_type: String,
|
#[specta(type = String)]
|
||||||
|
pub proxy_type: ProxyType,
|
||||||
|
#[specta(type = Vec<crate::ipc::DelayHistory>)]
|
||||||
pub history: Vec<DelayHistory>,
|
pub history: Vec<DelayHistory>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub id: Option<String>,
|
pub id: Option<String>,
|
||||||
@@ -209,8 +190,8 @@ struct MemberResolver<'a> {
|
|||||||
|
|
||||||
impl<'a> MemberResolver<'a> {
|
impl<'a> MemberResolver<'a> {
|
||||||
/// Same-name records in the order Mihomo lists them in `group`: `use` order, after `exclude-type`.
|
/// Same-name records in the order Mihomo lists them in `group`: `use` order, after `exclude-type`.
|
||||||
fn scoped_candidates(&self, group: &str, candidates: &'a [(String, String)]) -> Vec<&'a String> {
|
fn scoped_candidates(&self, group: &str, name: &str) -> Vec<&'a String> {
|
||||||
let Some(scope) = self.group_scopes.get(group) else {
|
let (Some(scope), Some(candidates)) = (self.group_scopes.get(group), self.provider_candidates.get(name)) else {
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
};
|
};
|
||||||
scope
|
scope
|
||||||
@@ -219,8 +200,7 @@ impl<'a> MemberResolver<'a> {
|
|||||||
.flat_map(|provider| candidates.iter().filter(move |(owner, _)| owner == provider))
|
.flat_map(|provider| candidates.iter().filter(move |(owner, _)| owner == provider))
|
||||||
.map(|(_, record_id)| record_id)
|
.map(|(_, record_id)| record_id)
|
||||||
.filter(|record_id| {
|
.filter(|record_id| {
|
||||||
scope.exclude_types.is_empty()
|
!self.records.get(*record_id).is_some_and(|node| {
|
||||||
|| !self.records.get(*record_id).is_some_and(|node| {
|
|
||||||
scope
|
scope
|
||||||
.exclude_types
|
.exclude_types
|
||||||
.iter()
|
.iter()
|
||||||
@@ -230,12 +210,7 @@ impl<'a> MemberResolver<'a> {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve(
|
fn resolve(&self, name: String, scoped: Option<&String>) -> ProxyMemberRef {
|
||||||
&self,
|
|
||||||
group: &str,
|
|
||||||
name: String,
|
|
||||||
seen: &mut BTreeMap<String, (usize, Vec<&'a String>)>,
|
|
||||||
) -> ProxyMemberRef {
|
|
||||||
if self.group_names.contains(&name) {
|
if self.group_names.contains(&name) {
|
||||||
ProxyMemberRef::Group { name }
|
ProxyMemberRef::Group { name }
|
||||||
} else if let Some(record_id) = self.core_node_ids.get(&name) {
|
} else if let Some(record_id) = self.core_node_ids.get(&name) {
|
||||||
@@ -250,30 +225,16 @@ impl<'a> MemberResolver<'a> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let candidates = self.provider_candidates.get(&name).map_or(&[][..], Vec::as_slice);
|
let candidates = self.provider_candidates.get(&name).map_or(&[][..], Vec::as_slice);
|
||||||
let record_id = match candidates {
|
match (scoped, candidates) {
|
||||||
[(_, record_id)] => Some(record_id),
|
(Some(record_id), _) | (None, [(_, record_id)]) => ProxyMemberRef::Node {
|
||||||
[] => {
|
|
||||||
return ProxyMemberRef::Unresolved {
|
|
||||||
name,
|
|
||||||
reason: ProxyMemberUnresolvedReason::Missing,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
// The n-th occurrence in Mihomo's member list selects the n-th scoped candidate.
|
|
||||||
let (occurrence, scoped) = seen
|
|
||||||
.entry(name.clone())
|
|
||||||
.or_insert_with(|| (0, self.scoped_candidates(group, candidates)));
|
|
||||||
let record_id = scoped.get(*occurrence).or_else(|| scoped.first()).copied();
|
|
||||||
*occurrence += 1;
|
|
||||||
record_id
|
|
||||||
}
|
|
||||||
};
|
|
||||||
match record_id {
|
|
||||||
Some(record_id) => ProxyMemberRef::Node {
|
|
||||||
name,
|
name,
|
||||||
record_id: record_id.clone(),
|
record_id: record_id.clone(),
|
||||||
},
|
},
|
||||||
None => ProxyMemberRef::Unresolved {
|
(None, []) => ProxyMemberRef::Unresolved {
|
||||||
|
name,
|
||||||
|
reason: ProxyMemberUnresolvedReason::Missing,
|
||||||
|
},
|
||||||
|
(None, _) => ProxyMemberRef::Unresolved {
|
||||||
name,
|
name,
|
||||||
reason: ProxyMemberUnresolvedReason::Ambiguous,
|
reason: ProxyMemberUnresolvedReason::Ambiguous,
|
||||||
},
|
},
|
||||||
@@ -282,14 +243,14 @@ impl<'a> MemberResolver<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProxyViewInput {
|
impl ProxyViewBuilder {
|
||||||
pub fn into_view(self) -> ProxyViewV1 {
|
pub fn build(input: ProxyViewInput) -> ProxyViewV1 {
|
||||||
let Self {
|
let ProxyViewInput {
|
||||||
runtime_group_order,
|
runtime_group_order,
|
||||||
group_scopes,
|
group_scopes,
|
||||||
proxies,
|
proxies,
|
||||||
providers,
|
providers,
|
||||||
} = self;
|
} = input;
|
||||||
let provider_state = if providers.is_some() {
|
let provider_state = if providers.is_some() {
|
||||||
ProxyViewProviderState::Ready
|
ProxyViewProviderState::Ready
|
||||||
} else {
|
} else {
|
||||||
@@ -309,7 +270,7 @@ impl ProxyViewInput {
|
|||||||
|
|
||||||
let global = core_groups
|
let global = core_groups
|
||||||
.remove("GLOBAL")
|
.remove("GLOBAL")
|
||||||
.map(|proxy| build_group("GLOBAL".into(), proxy, &resolver));
|
.map(|proxy| build_group("GLOBAL".to_owned(), proxy, &resolver));
|
||||||
let (groups, order_source) = build_ordered_groups(core_groups, runtime_group_order, &resolver);
|
let (groups, order_source) = build_ordered_groups(core_groups, runtime_group_order, &resolver);
|
||||||
let direct = core_node_ids.get("DIRECT").cloned();
|
let direct = core_node_ids.get("DIRECT").cloned();
|
||||||
let standalone = build_standalone(&core_node_ids);
|
let standalone = build_standalone(&core_node_ids);
|
||||||
@@ -328,13 +289,11 @@ impl ProxyViewInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn partition_core(
|
fn partition_core(proxies: Proxies) -> (BTreeMap<String, Proxy>, BTreeMap<String, Proxy>) {
|
||||||
proxies: HashMap<String, ProxySnapshot>,
|
|
||||||
) -> (BTreeMap<String, ProxySnapshot>, BTreeMap<String, ProxySnapshot>) {
|
|
||||||
let mut groups = BTreeMap::new();
|
let mut groups = BTreeMap::new();
|
||||||
let mut nodes = BTreeMap::new();
|
let mut nodes = BTreeMap::new();
|
||||||
|
|
||||||
for (name, proxy) in proxies {
|
for (name, proxy) in proxies.proxies {
|
||||||
if proxy.all.is_some() {
|
if proxy.all.is_some() {
|
||||||
groups.insert(name, proxy);
|
groups.insert(name, proxy);
|
||||||
} else {
|
} else {
|
||||||
@@ -346,13 +305,13 @@ fn partition_core(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_core_records(
|
fn build_core_records(
|
||||||
core_nodes: BTreeMap<String, ProxySnapshot>,
|
core_nodes: BTreeMap<String, Proxy>,
|
||||||
) -> (BTreeMap<String, ProxyNodeView>, BTreeMap<String, String>) {
|
) -> (BTreeMap<String, ProxyNodeView>, BTreeMap<String, String>) {
|
||||||
let mut records = BTreeMap::new();
|
let mut records = BTreeMap::new();
|
||||||
let mut ids = BTreeMap::new();
|
let mut ids = BTreeMap::new();
|
||||||
|
|
||||||
for (index, (name, proxy)) in core_nodes.into_iter().enumerate() {
|
for (index, (name, proxy)) in core_nodes.into_iter().enumerate() {
|
||||||
let record_id: String = format!("c:{index}").into();
|
let record_id = format!("c:{index}");
|
||||||
ids.insert(name.clone(), record_id.clone());
|
ids.insert(name.clone(), record_id.clone());
|
||||||
records.insert(
|
records.insert(
|
||||||
record_id.clone(),
|
record_id.clone(),
|
||||||
@@ -369,24 +328,32 @@ fn build_core_records(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_provider_records(
|
fn build_provider_records(
|
||||||
providers: Option<BTreeMap<String, ProviderSnapshot>>,
|
providers: Option<ProxyProviders>,
|
||||||
records: &mut BTreeMap<String, ProxyNodeView>,
|
records: &mut BTreeMap<String, ProxyNodeView>,
|
||||||
) -> (Vec<ProxyProviderView>, ProviderCandidates) {
|
) -> (Vec<ProxyProviderView>, ProviderCandidates) {
|
||||||
|
let providers = providers.map_or_default(|providers| providers.providers.into_iter().collect::<BTreeMap<_, _>>());
|
||||||
let mut views = Vec::new();
|
let mut views = Vec::new();
|
||||||
let mut candidates = BTreeMap::new();
|
let mut candidates = BTreeMap::new();
|
||||||
|
|
||||||
for (provider_name, provider) in providers.into_iter().flatten() {
|
for (provider_name, provider) in providers {
|
||||||
let ProviderSnapshot {
|
let ProxyProvider {
|
||||||
vehicle_type,
|
vehicle_type,
|
||||||
proxies,
|
proxies,
|
||||||
updated_at,
|
updated_at,
|
||||||
subscription_info,
|
subscription_info,
|
||||||
|
..
|
||||||
} = provider;
|
} = provider;
|
||||||
|
let vehicle_type = match vehicle_type {
|
||||||
|
VehicleType::HTTP => ProxyProviderVehicleType::Http,
|
||||||
|
VehicleType::File => ProxyProviderVehicleType::File,
|
||||||
|
VehicleType::Inline => ProxyProviderVehicleType::Inline,
|
||||||
|
_ => continue,
|
||||||
|
};
|
||||||
let provider_index = views.len();
|
let provider_index = views.len();
|
||||||
let mut proxy_record_ids = Vec::new();
|
let mut proxy_record_ids = Vec::new();
|
||||||
|
|
||||||
for (member_index, proxy) in proxies.into_iter().enumerate() {
|
for (member_index, proxy) in proxies.into_iter().enumerate() {
|
||||||
let record_id: String = format!("p:{provider_index}:{member_index}").into();
|
let record_id = format!("p:{provider_index}:{member_index}");
|
||||||
let proxy_name = proxy.name.clone();
|
let proxy_name = proxy.name.clone();
|
||||||
let node_name = proxy.name.clone();
|
let node_name = proxy.name.clone();
|
||||||
candidates
|
candidates
|
||||||
@@ -412,7 +379,12 @@ fn build_provider_records(
|
|||||||
name: provider_name,
|
name: provider_name,
|
||||||
vehicle_type,
|
vehicle_type,
|
||||||
updated_at,
|
updated_at,
|
||||||
subscription_info,
|
subscription_info: subscription_info.map(|subscription_info| ProxySubscriptionInfo {
|
||||||
|
upload: subscription_info.upload,
|
||||||
|
download: subscription_info.download,
|
||||||
|
total: subscription_info.total,
|
||||||
|
expire: subscription_info.expire,
|
||||||
|
}),
|
||||||
proxy_record_ids,
|
proxy_record_ids,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -420,8 +392,8 @@ fn build_provider_records(
|
|||||||
(views, candidates)
|
(views, candidates)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_group(name: String, proxy: ProxySnapshot, resolver: &MemberResolver<'_>) -> ProxyGroupView {
|
fn build_group(name: String, proxy: Proxy, resolver: &MemberResolver<'_>) -> ProxyGroupView {
|
||||||
let ProxySnapshot {
|
let Proxy {
|
||||||
all,
|
all,
|
||||||
fixed,
|
fixed,
|
||||||
hidden,
|
hidden,
|
||||||
@@ -429,15 +401,27 @@ fn build_group(name: String, proxy: ProxySnapshot, resolver: &MemberResolver<'_>
|
|||||||
now,
|
now,
|
||||||
test_url,
|
test_url,
|
||||||
history,
|
history,
|
||||||
capabilities,
|
udp,
|
||||||
|
xudp,
|
||||||
|
tfo,
|
||||||
|
mptcp,
|
||||||
|
smux,
|
||||||
proxy_type,
|
proxy_type,
|
||||||
..
|
..
|
||||||
} = proxy;
|
} = proxy;
|
||||||
let mut seen = BTreeMap::new();
|
// The n-th occurrence of a name in `all` is the n-th scoped candidate.
|
||||||
|
let mut seen = BTreeMap::<String, (usize, Vec<&String>)>::new();
|
||||||
let members = all
|
let members = all
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|member| resolver.resolve(&name, member, &mut seen))
|
.map(|member| {
|
||||||
|
let (occurrence, scoped) = seen
|
||||||
|
.entry(member.clone())
|
||||||
|
.or_insert_with(|| (0, resolver.scoped_candidates(&name, &member)));
|
||||||
|
let picked = scoped.get(*occurrence).or_else(|| scoped.first()).copied();
|
||||||
|
*occurrence += 1;
|
||||||
|
resolver.resolve(member, picked)
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
ProxyGroupView {
|
ProxyGroupView {
|
||||||
@@ -449,19 +433,29 @@ fn build_group(name: String, proxy: ProxySnapshot, resolver: &MemberResolver<'_>
|
|||||||
icon,
|
icon,
|
||||||
test_url,
|
test_url,
|
||||||
history,
|
history,
|
||||||
capabilities,
|
capabilities: ProxyCapabilities {
|
||||||
|
udp,
|
||||||
|
xudp,
|
||||||
|
tfo,
|
||||||
|
mptcp,
|
||||||
|
smux,
|
||||||
|
},
|
||||||
members,
|
members,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_node(record_id: String, name: String, proxy: ProxySnapshot, source: ProxyNodeSource) -> ProxyNodeView {
|
fn build_node(record_id: String, name: String, proxy: Proxy, source: ProxyNodeSource) -> ProxyNodeView {
|
||||||
let ProxySnapshot {
|
let Proxy {
|
||||||
id,
|
id,
|
||||||
hidden,
|
hidden,
|
||||||
icon,
|
icon,
|
||||||
test_url,
|
test_url,
|
||||||
history,
|
history,
|
||||||
capabilities,
|
udp,
|
||||||
|
xudp,
|
||||||
|
tfo,
|
||||||
|
mptcp,
|
||||||
|
smux,
|
||||||
proxy_type,
|
proxy_type,
|
||||||
..
|
..
|
||||||
} = proxy;
|
} = proxy;
|
||||||
@@ -475,13 +469,19 @@ fn build_node(record_id: String, name: String, proxy: ProxySnapshot, source: Pro
|
|||||||
hidden,
|
hidden,
|
||||||
icon,
|
icon,
|
||||||
test_url,
|
test_url,
|
||||||
capabilities,
|
capabilities: ProxyCapabilities {
|
||||||
|
udp,
|
||||||
|
xudp,
|
||||||
|
tfo,
|
||||||
|
mptcp,
|
||||||
|
smux,
|
||||||
|
},
|
||||||
source,
|
source,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_ordered_groups(
|
fn build_ordered_groups(
|
||||||
mut core_groups: BTreeMap<String, ProxySnapshot>,
|
mut core_groups: BTreeMap<String, Proxy>,
|
||||||
runtime_group_order: Vec<String>,
|
runtime_group_order: Vec<String>,
|
||||||
resolver: &MemberResolver<'_>,
|
resolver: &MemberResolver<'_>,
|
||||||
) -> (Vec<ProxyGroupView>, ProxyViewOrderSource) {
|
) -> (Vec<ProxyGroupView>, ProxyViewOrderSource) {
|
||||||
+125
-196
@@ -1,17 +1,12 @@
|
|||||||
mod error;
|
use anyhow::{Context as _, Result, bail};
|
||||||
|
|
||||||
pub use error::RuntimeBundleError;
|
|
||||||
|
|
||||||
use clash_verge_logging::{Type, logging};
|
use clash_verge_logging::{Type, logging};
|
||||||
|
use clash_verge_service_ipc::{RemoteProvider, RuntimeAsset, RuntimeBundle};
|
||||||
use serde_yaml_ng::{Mapping, Value};
|
use serde_yaml_ng::{Mapping, Value};
|
||||||
use sha2::{Digest as _, Sha256};
|
use sha2::{Digest as _, Sha256};
|
||||||
use std::collections::{BTreeMap, HashSet};
|
use std::collections::{BTreeMap, HashSet};
|
||||||
use std::path::{Component, Path, PathBuf, Prefix};
|
use std::path::{Component, Path, PathBuf, Prefix};
|
||||||
use tristr::TriStr;
|
|
||||||
|
|
||||||
const PROVIDER_SECTIONS: [&str; 2] = ["proxy-providers", "rule-providers"];
|
pub(crate) const GEO_ASSETS: &[&str] = &[
|
||||||
|
|
||||||
pub const GEO_ASSETS: &[&str] = &[
|
|
||||||
"Country.mmdb",
|
"Country.mmdb",
|
||||||
"ASN.mmdb",
|
"ASN.mmdb",
|
||||||
"geoip.dat",
|
"geoip.dat",
|
||||||
@@ -22,62 +17,42 @@ pub const GEO_ASSETS: &[&str] = &[
|
|||||||
|
|
||||||
/// Provider identity used by the runtime config and core API.
|
/// Provider identity used by the runtime config and core API.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct RemoteProviderRef {
|
pub(crate) struct RemoteProviderRef {
|
||||||
pub section: &'static str,
|
pub section: &'static str,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub destination: TriStr,
|
pub provider: RemoteProvider,
|
||||||
pub url: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RuntimeAsset {
|
struct RuntimeParts {
|
||||||
pub source: String,
|
config: Value,
|
||||||
pub destination: TriStr,
|
assets: Vec<RuntimeAsset>,
|
||||||
|
remote_providers: Vec<RemoteProviderRef>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RuntimeBundlePlan {
|
pub(crate) async fn collect_runtime_bundle(config_file: &Path, core_path: &Path) -> Result<RuntimeBundle> {
|
||||||
pub config: Value,
|
|
||||||
pub assets: Vec<RuntimeAsset>,
|
|
||||||
pub remote_providers: Vec<RemoteProviderRef>,
|
|
||||||
}
|
|
||||||
|
|
||||||
type Result<T> = std::result::Result<T, RuntimeBundleError>;
|
|
||||||
|
|
||||||
pub async fn collect_runtime_bundle(config_file: &Path) -> Result<RuntimeBundlePlan> {
|
|
||||||
let yaml = tokio::fs::read_to_string(config_file)
|
let yaml = tokio::fs::read_to_string(config_file)
|
||||||
.await
|
.await
|
||||||
.map_err(|source| RuntimeBundleError::ReadConfig {
|
.with_context(|| format!("failed to read runtime config {config_file:?}"))?;
|
||||||
path: config_file.to_owned(),
|
let config: Value =
|
||||||
source,
|
serde_yaml_ng::from_str(&yaml).with_context(|| format!("failed to parse runtime config {config_file:?}"))?;
|
||||||
})?;
|
let config_root = config_file
|
||||||
let config: Value = serde_yaml_ng::from_str(&yaml).map_err(|source| RuntimeBundleError::ParseConfig {
|
.parent()
|
||||||
path: config_file.to_owned(),
|
.ok_or_else(|| anyhow::anyhow!("runtime config has no parent directory"))?;
|
||||||
source,
|
let parts = collect_runtime_parts(config, config_root)?;
|
||||||
})?;
|
Ok(RuntimeBundle {
|
||||||
let config_root = config_file.parent().ok_or(RuntimeBundleError::MissingConfigDirectory)?;
|
yaml: serde_yaml_ng::to_string(&parts.config).context("failed to serialize service runtime config")?,
|
||||||
collect_runtime_parts(config, config_root)
|
assets: parts.assets,
|
||||||
|
remote_providers: parts
|
||||||
|
.remote_providers
|
||||||
|
.into_iter()
|
||||||
|
.map(|declared| declared.provider)
|
||||||
|
.collect(),
|
||||||
|
core_path: core_path.to_string_lossy().into_owned(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remote_providers_of(config: &Mapping, config_root: &Path) -> Result<Vec<RemoteProviderRef>> {
|
pub(crate) fn remote_providers_of(config: &Mapping, config_root: &Path) -> Result<Vec<RemoteProviderRef>> {
|
||||||
let config_root = std::fs::canonicalize(config_root)?;
|
Ok(collect_runtime_parts(Value::Mapping(config.clone()), config_root)?.remote_providers)
|
||||||
let mut destinations = HashSet::new();
|
|
||||||
let mut remote_providers = Vec::new();
|
|
||||||
for section in PROVIDER_SECTIONS {
|
|
||||||
let Some(providers) = config.get(section).and_then(Value::as_mapping) else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
for (name, provider) in providers {
|
|
||||||
plan_provider(
|
|
||||||
section,
|
|
||||||
name,
|
|
||||||
provider,
|
|
||||||
&config_root,
|
|
||||||
&mut destinations,
|
|
||||||
None,
|
|
||||||
&mut remote_providers,
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(remote_providers)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
@@ -86,11 +61,11 @@ struct ProviderPathOwners {
|
|||||||
local: bool,
|
local: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resolve_provider_path_conflicts(config: &mut Mapping, config_root: &Path) -> Result<()> {
|
pub(crate) fn resolve_provider_path_conflicts(config: &mut Mapping, config_root: &Path) -> Result<()> {
|
||||||
let config_root = std::fs::canonicalize(config_root)?;
|
let config_root = std::fs::canonicalize(config_root)?;
|
||||||
let mut paths = BTreeMap::<TriStr, ProviderPathOwners>::new();
|
let mut paths = BTreeMap::<String, ProviderPathOwners>::new();
|
||||||
let mut reserved: HashSet<TriStr> = GEO_ASSETS.iter().copied().map(TriStr::from).collect();
|
let mut reserved: HashSet<String> = GEO_ASSETS.iter().map(|name| (*name).to_owned()).collect();
|
||||||
for section in PROVIDER_SECTIONS {
|
for section in ["proxy-providers", "rule-providers"] {
|
||||||
let Some(providers) = config.get(section).and_then(Value::as_mapping) else {
|
let Some(providers) = config.get(section).and_then(Value::as_mapping) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
@@ -109,7 +84,6 @@ pub fn resolve_provider_path_conflicts(config: &mut Mapping, config_root: &Path)
|
|||||||
let Ok(destination) = destination else {
|
let Ok(destination) = destination else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let destination = TriStr::from(destination.as_str());
|
|
||||||
reserved.insert(destination.clone());
|
reserved.insert(destination.clone());
|
||||||
let owners = paths.entry(destination).or_default();
|
let owners = paths.entry(destination).or_default();
|
||||||
match (is_remote, provider.get("url").and_then(Value::as_str)) {
|
match (is_remote, provider.get("url").and_then(Value::as_str)) {
|
||||||
@@ -143,12 +117,12 @@ pub fn resolve_provider_path_conflicts(config: &mut Mapping, config_root: &Path)
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn allocate_provider_destination(destination: &str, url: &str, reserved: &mut HashSet<TriStr>) -> String {
|
fn allocate_provider_destination(destination: &str, url: &str, reserved: &mut HashSet<String>) -> String {
|
||||||
let mut digest = Sha256::new();
|
let mut digest = Sha256::new();
|
||||||
digest.update(destination.as_bytes());
|
digest.update(destination.as_bytes());
|
||||||
digest.update([0]);
|
digest.update([0]);
|
||||||
digest.update(url.as_bytes());
|
digest.update(url.as_bytes());
|
||||||
let digest = hex::encode(digest.finalize());
|
let digest: String = crate::utils::help::hex_encode(&digest.finalize());
|
||||||
let path = Path::new(destination);
|
let path = Path::new(destination);
|
||||||
let extension = path
|
let extension = path
|
||||||
.extension()
|
.extension()
|
||||||
@@ -160,7 +134,7 @@ fn allocate_provider_destination(destination: &str, url: &str, reserved: &mut Ha
|
|||||||
.with_file_name(format!("cvr-{digest}{suffix}{extension}"))
|
.with_file_name(format!("cvr-{digest}{suffix}{extension}"))
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.replace('\\', "/");
|
.replace('\\', "/");
|
||||||
if reserved.insert(TriStr::from(candidate.as_str())) {
|
if reserved.insert(candidate.clone()) {
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
sequence += 1;
|
sequence += 1;
|
||||||
@@ -168,34 +142,40 @@ fn allocate_provider_destination(destination: &str, url: &str, reserved: &mut Ha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_runtime_parts(mut config: Value, config_root: &Path) -> Result<RuntimeBundlePlan> {
|
fn collect_runtime_parts(mut config: Value, config_root: &Path) -> Result<RuntimeParts> {
|
||||||
let config_root = std::fs::canonicalize(config_root)?;
|
let config_root = std::fs::canonicalize(config_root)?;
|
||||||
let mut assets = Vec::new();
|
let mut assets = Vec::new();
|
||||||
let mut destinations = HashSet::new();
|
let mut destinations = HashSet::new();
|
||||||
let mut remote_providers = Vec::new();
|
let mut remote_providers = Vec::new();
|
||||||
|
|
||||||
for section in PROVIDER_SECTIONS {
|
|
||||||
collect_provider_assets(
|
collect_provider_assets(
|
||||||
&mut config,
|
&mut config,
|
||||||
section,
|
"proxy-providers",
|
||||||
|
&config_root,
|
||||||
|
&mut destinations,
|
||||||
|
&mut assets,
|
||||||
|
&mut remote_providers,
|
||||||
|
)?;
|
||||||
|
collect_provider_assets(
|
||||||
|
&mut config,
|
||||||
|
"rule-providers",
|
||||||
&config_root,
|
&config_root,
|
||||||
&mut destinations,
|
&mut destinations,
|
||||||
&mut assets,
|
&mut assets,
|
||||||
&mut remote_providers,
|
&mut remote_providers,
|
||||||
)?;
|
)?;
|
||||||
}
|
|
||||||
collect_ssh_private_keys(&mut config, &config_root, &mut destinations, &mut assets);
|
collect_ssh_private_keys(&mut config, &config_root, &mut destinations, &mut assets);
|
||||||
for filename in GEO_ASSETS {
|
for filename in GEO_ASSETS {
|
||||||
let source = config_root.join(filename);
|
let source = config_root.join(filename);
|
||||||
if source.is_file() && destinations.insert(TriStr::from(*filename)) {
|
if source.is_file() && destinations.insert((*filename).to_string()) {
|
||||||
assets.push(RuntimeAsset {
|
assets.push(RuntimeAsset {
|
||||||
source: std::fs::canonicalize(&source)?.to_string_lossy().into_owned(),
|
source: std::fs::canonicalize(&source)?.to_string_lossy().into_owned(),
|
||||||
destination: (*filename).into(),
|
destination: (*filename).to_string(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(RuntimeBundlePlan {
|
Ok(RuntimeParts {
|
||||||
config,
|
config,
|
||||||
assets,
|
assets,
|
||||||
remote_providers,
|
remote_providers,
|
||||||
@@ -208,7 +188,7 @@ fn collect_provider_assets(
|
|||||||
config: &mut Value,
|
config: &mut Value,
|
||||||
section: &'static str,
|
section: &'static str,
|
||||||
config_root: &Path,
|
config_root: &Path,
|
||||||
destinations: &mut HashSet<TriStr>,
|
destinations: &mut HashSet<String>,
|
||||||
assets: &mut Vec<RuntimeAsset>,
|
assets: &mut Vec<RuntimeAsset>,
|
||||||
remote_providers: &mut Vec<RemoteProviderRef>,
|
remote_providers: &mut Vec<RemoteProviderRef>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
@@ -221,61 +201,39 @@ fn collect_provider_assets(
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (name, provider) in providers.iter_mut() {
|
for (name, provider) in providers.iter_mut() {
|
||||||
if let Some(destination) = plan_provider(
|
let Some(provider) = provider.as_mapping_mut() else {
|
||||||
section,
|
continue;
|
||||||
name,
|
};
|
||||||
provider,
|
let Some(raw_path) = provider.get("path").and_then(Value::as_str) else {
|
||||||
config_root,
|
continue;
|
||||||
destinations,
|
|
||||||
Some(assets),
|
|
||||||
remote_providers,
|
|
||||||
)? && let Some(provider) = provider.as_mapping_mut()
|
|
||||||
{
|
|
||||||
provider.insert(Value::String("path".to_owned()), Value::String(destination));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn plan_provider(
|
|
||||||
section: &'static str,
|
|
||||||
name: &Value,
|
|
||||||
provider: &Value,
|
|
||||||
config_root: &Path,
|
|
||||||
destinations: &mut HashSet<TriStr>,
|
|
||||||
assets: Option<&mut Vec<RuntimeAsset>>,
|
|
||||||
remote_providers: &mut Vec<RemoteProviderRef>,
|
|
||||||
) -> Result<Option<String>> {
|
|
||||||
let Some(raw_path) = provider
|
|
||||||
.as_mapping()
|
|
||||||
.and_then(|provider| provider.get("path"))
|
|
||||||
.and_then(Value::as_str)
|
|
||||||
else {
|
|
||||||
return Ok(None);
|
|
||||||
};
|
};
|
||||||
// Match mihomo's `type` classification and leave malformed-but-accepted providers untouched.
|
// Match mihomo's `type` classification and leave malformed-but-accepted providers untouched.
|
||||||
let is_remote = provider.get("type").and_then(Value::as_str) == Some("http");
|
let is_remote = provider.get("type").and_then(Value::as_str) == Some("http");
|
||||||
let url = provider.get("url").and_then(Value::as_str);
|
let url = provider.get("url").and_then(Value::as_str).map(str::to_owned);
|
||||||
let destination = match (is_remote, url) {
|
let destination = match (is_remote, url) {
|
||||||
(true, Some(url)) => {
|
(true, Some(url)) => {
|
||||||
let destination = provider_destination(config_root, raw_path)?;
|
let destination = provider_destination(config_root, raw_path)?;
|
||||||
// Reserve remote destinations too; copied and downloaded files must not collide.
|
// Reserve remote destinations too; copied and downloaded files must not collide.
|
||||||
let reserved = TriStr::from(destination.as_str());
|
match remote_providers
|
||||||
if destinations.insert(reserved.clone()) {
|
.iter()
|
||||||
|
.find(|declared| declared.provider.destination == destination)
|
||||||
|
{
|
||||||
|
Some(declared) if declared.provider.url == url => {}
|
||||||
|
Some(_) => {
|
||||||
|
bail!("runtime provider destination {destination:?} is declared for two different sources")
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
if !destinations.insert(destination.clone()) {
|
||||||
|
bail!("runtime provider destination {destination:?} is claimed more than once");
|
||||||
|
}
|
||||||
remote_providers.push(RemoteProviderRef {
|
remote_providers.push(RemoteProviderRef {
|
||||||
section,
|
section,
|
||||||
name: name.as_str().unwrap_or_default().to_owned(),
|
name: name.as_str().unwrap_or_default().to_owned(),
|
||||||
destination: reserved,
|
provider: RemoteProvider {
|
||||||
url: url.to_owned(),
|
destination: destination.clone(),
|
||||||
|
url,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
match remote_providers
|
|
||||||
.iter()
|
|
||||||
.find(|declared| declared.destination == destination)
|
|
||||||
{
|
|
||||||
Some(declared) if declared.url == url => {}
|
|
||||||
Some(_) => return Err(RuntimeBundleError::DifferentSources(destination)),
|
|
||||||
None => return Err(RuntimeBundleError::DuplicateDestination(destination)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
destination
|
destination
|
||||||
@@ -286,7 +244,7 @@ fn plan_provider(
|
|||||||
Type::Config,
|
Type::Config,
|
||||||
"remote provider {name:?} declares no url; leaving its path to the core"
|
"remote provider {name:?} declares no url; leaving its path to the core"
|
||||||
);
|
);
|
||||||
return Ok(None);
|
continue;
|
||||||
}
|
}
|
||||||
(false, _) => {
|
(false, _) => {
|
||||||
let Ok(source) = local_provider_source(config_root, raw_path) else {
|
let Ok(source) = local_provider_source(config_root, raw_path) else {
|
||||||
@@ -295,31 +253,28 @@ fn plan_provider(
|
|||||||
Type::Config,
|
Type::Config,
|
||||||
"local provider {name:?} is unavailable at {raw_path:?}; leaving its path to the core"
|
"local provider {name:?} is unavailable at {raw_path:?}; leaving its path to the core"
|
||||||
);
|
);
|
||||||
return Ok(None);
|
continue;
|
||||||
};
|
};
|
||||||
let destination = destination_below_root(config_root, &source)?;
|
let destination = destination_below_root(config_root, &source)?;
|
||||||
let reserved = TriStr::from(destination.as_str());
|
if destinations.insert(destination.clone()) {
|
||||||
if destinations.insert(reserved.clone()) {
|
|
||||||
if let Some(assets) = assets {
|
|
||||||
assets.push(RuntimeAsset {
|
assets.push(RuntimeAsset {
|
||||||
source: source.to_string_lossy().into_owned(),
|
source: source.to_string_lossy().into_owned(),
|
||||||
destination: reserved,
|
destination: destination.clone(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if remote_providers.iter().any(|provider| provider.destination == reserved) {
|
|
||||||
return Err(RuntimeBundleError::DuplicateDestination(destination));
|
|
||||||
}
|
|
||||||
destination
|
destination
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ok(Some(destination))
|
provider.insert(Value::String("path".to_owned()), Value::String(destination));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Stages file-based ssh keys, which mihomo resolves against the core home directory.
|
/// Stages file-based ssh keys, which mihomo resolves against the core home directory.
|
||||||
fn collect_ssh_private_keys(
|
fn collect_ssh_private_keys(
|
||||||
config: &mut Value,
|
config: &mut Value,
|
||||||
config_root: &Path,
|
config_root: &Path,
|
||||||
destinations: &mut HashSet<TriStr>,
|
destinations: &mut HashSet<String>,
|
||||||
assets: &mut Vec<RuntimeAsset>,
|
assets: &mut Vec<RuntimeAsset>,
|
||||||
) {
|
) {
|
||||||
let Some(config) = config.as_mapping_mut() else {
|
let Some(config) = config.as_mapping_mut() else {
|
||||||
@@ -370,7 +325,7 @@ fn collect_ssh_private_keys(
|
|||||||
let destination = allocate_provider_destination("ssh-private-key", &source, destinations);
|
let destination = allocate_provider_destination("ssh-private-key", &source, destinations);
|
||||||
assets.push(RuntimeAsset {
|
assets.push(RuntimeAsset {
|
||||||
source,
|
source,
|
||||||
destination: TriStr::from(destination.as_str()),
|
destination: destination.clone(),
|
||||||
});
|
});
|
||||||
proxy.insert(Value::String("private-key".to_owned()), Value::String(destination));
|
proxy.insert(Value::String("private-key".to_owned()), Value::String(destination));
|
||||||
}
|
}
|
||||||
@@ -392,13 +347,10 @@ fn local_provider_source(config_root: &Path, raw_path: &str) -> Result<PathBuf>
|
|||||||
config_root.join(path)
|
config_root.join(path)
|
||||||
};
|
};
|
||||||
let canonical_source =
|
let canonical_source =
|
||||||
std::fs::canonicalize(&source).map_err(|error| RuntimeBundleError::LocalProviderUnavailable {
|
std::fs::canonicalize(&source).with_context(|| format!("local runtime provider is unavailable: {source:?}"))?;
|
||||||
path: source,
|
|
||||||
source: error,
|
|
||||||
})?;
|
|
||||||
canonical_source
|
canonical_source
|
||||||
.strip_prefix(config_root)
|
.strip_prefix(config_root)
|
||||||
.map_err(|_| RuntimeBundleError::LocalProviderOutsideRoot(canonical_source.clone()))?;
|
.map_err(|_| anyhow::anyhow!("local runtime provider is outside the config root: {canonical_source:?}"))?;
|
||||||
Ok(canonical_source)
|
Ok(canonical_source)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +360,7 @@ fn provider_destination(config_root: &Path, raw_path: &str) -> Result<String> {
|
|||||||
.components()
|
.components()
|
||||||
.any(|component| matches!(component, Component::ParentDir))
|
.any(|component| matches!(component, Component::ParentDir))
|
||||||
{
|
{
|
||||||
return Err(RuntimeBundleError::DestinationOutsideRuntime);
|
bail!("runtime provider destination traverses outside the runtime");
|
||||||
}
|
}
|
||||||
if path.is_absolute() {
|
if path.is_absolute() {
|
||||||
let normalized = canonicalize_with_missing_tail(path)?;
|
let normalized = canonicalize_with_missing_tail(path)?;
|
||||||
@@ -424,11 +376,11 @@ fn canonicalize_with_missing_tail(path: &Path) -> Result<PathBuf> {
|
|||||||
while !ancestor.exists() {
|
while !ancestor.exists() {
|
||||||
let name = ancestor
|
let name = ancestor
|
||||||
.file_name()
|
.file_name()
|
||||||
.ok_or_else(|| RuntimeBundleError::MissingAncestor(path.to_owned()))?;
|
.ok_or_else(|| anyhow::anyhow!("runtime provider path has no existing ancestor: {path:?}"))?;
|
||||||
tail.push(name.to_owned());
|
tail.push(name.to_owned());
|
||||||
ancestor = ancestor
|
ancestor = ancestor
|
||||||
.parent()
|
.parent()
|
||||||
.ok_or_else(|| RuntimeBundleError::MissingAncestor(path.to_owned()))?;
|
.ok_or_else(|| anyhow::anyhow!("runtime provider path has no existing ancestor: {path:?}"))?;
|
||||||
}
|
}
|
||||||
let mut normalized = std::fs::canonicalize(ancestor)?;
|
let mut normalized = std::fs::canonicalize(ancestor)?;
|
||||||
for component in tail.iter().rev() {
|
for component in tail.iter().rev() {
|
||||||
@@ -440,60 +392,31 @@ fn canonicalize_with_missing_tail(path: &Path) -> Result<PathBuf> {
|
|||||||
fn destination_below_root(config_root: &Path, path: &Path) -> Result<String> {
|
fn destination_below_root(config_root: &Path, path: &Path) -> Result<String> {
|
||||||
let relative = path
|
let relative = path
|
||||||
.strip_prefix(config_root)
|
.strip_prefix(config_root)
|
||||||
.map_err(|_| RuntimeBundleError::ProviderOutsideRoot(path.to_owned()))?;
|
.map_err(|_| anyhow::anyhow!("runtime provider path is outside the config root: {path:?}"))?;
|
||||||
normalized_destination(relative)
|
normalized_destination(relative)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn normalized_destination(relative: &Path) -> Result<String> {
|
fn normalized_destination(relative: &Path) -> Result<String> {
|
||||||
let mut destination = PathBuf::with_capacity(relative.as_os_str().len());
|
let mut destination = PathBuf::new();
|
||||||
for component in relative.components() {
|
for component in relative.components() {
|
||||||
match component {
|
match component {
|
||||||
Component::Normal(component) => destination.push(component),
|
Component::Normal(component) => destination.push(component),
|
||||||
Component::CurDir => {}
|
Component::CurDir => {}
|
||||||
_ => return Err(RuntimeBundleError::LocalDestinationOutsideRuntime),
|
_ => bail!("local runtime provider destination traverses outside the runtime"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if destination.as_os_str().is_empty() {
|
if destination.as_os_str().is_empty() {
|
||||||
return Err(RuntimeBundleError::EmptyDestination);
|
bail!("local runtime provider destination is empty");
|
||||||
}
|
|
||||||
let destination = destination
|
|
||||||
.into_os_string()
|
|
||||||
.into_string()
|
|
||||||
.unwrap_or_else(|path| path.to_string_lossy().into_owned());
|
|
||||||
if destination.contains('\\') {
|
|
||||||
Ok(destination.replace('\\', "/"))
|
|
||||||
} else {
|
|
||||||
Ok(destination)
|
|
||||||
}
|
}
|
||||||
|
Ok(destination.to_string_lossy().replace('\\', "/"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{collect_runtime_bundle, remote_providers_of, resolve_provider_path_conflicts};
|
use super::{collect_runtime_bundle, remote_providers_of, resolve_provider_path_conflicts};
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn local_and_remote_providers_cannot_claim_the_same_file() -> Result<(), Box<dyn std::error::Error>> {
|
|
||||||
let root = std::env::temp_dir().join(format!("clash-verge-mixed-providers-{}", std::process::id()));
|
|
||||||
std::fs::create_dir_all(&root)?;
|
|
||||||
std::fs::write(root.join("shared.yaml"), "payload: []")?;
|
|
||||||
let local = "type: file, path: ./shared.yaml";
|
|
||||||
let remote = "type: http, url: 'https://example.com/provider', path: shared.yaml";
|
|
||||||
for (proxy, rule) in [(local, remote), (remote, local)] {
|
|
||||||
let config = serde_yaml_ng::from_str(&format!(
|
|
||||||
"proxy-providers: {{a: {{{proxy}}}}}\nrule-providers: {{b: {{{rule}}}}}"
|
|
||||||
))?;
|
|
||||||
assert!(matches!(
|
|
||||||
remote_providers_of(&config, &root),
|
|
||||||
Err(super::RuntimeBundleError::DuplicateDestination(path)) if path == "shared.yaml"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
std::fs::remove_dir_all(root)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn conflicting_sources_get_separate_paths_in_config_bundle_and_readback()
|
async fn conflicting_sources_get_separate_paths_in_config_bundle_and_readback() -> anyhow::Result<()> {
|
||||||
-> std::result::Result<(), Box<dyn std::error::Error>> {
|
|
||||||
let root = std::env::temp_dir().join(format!("clash-verge-provider-paths-{}", std::process::id()));
|
let root = std::env::temp_dir().join(format!("clash-verge-provider-paths-{}", std::process::id()));
|
||||||
std::fs::create_dir_all(&root)?;
|
std::fs::create_dir_all(&root)?;
|
||||||
let mut config: serde_yaml_ng::Mapping = serde_yaml_ng::from_str(
|
let mut config: serde_yaml_ng::Mapping = serde_yaml_ng::from_str(
|
||||||
@@ -510,7 +433,7 @@ mod tests {
|
|||||||
resolve_provider_path_conflicts(&mut config, &root)?;
|
resolve_provider_path_conflicts(&mut config, &root)?;
|
||||||
let config_file = root.join("config.yaml");
|
let config_file = root.join("config.yaml");
|
||||||
std::fs::write(&config_file, serde_yaml_ng::to_string(&config)?)?;
|
std::fs::write(&config_file, serde_yaml_ng::to_string(&config)?)?;
|
||||||
let bundle = collect_runtime_bundle(&config_file).await?;
|
let bundle = collect_runtime_bundle(&config_file, &root.join("mihomo")).await?;
|
||||||
let paths = &config["rule-providers"];
|
let paths = &config["rule-providers"];
|
||||||
assert_ne!(paths["AppleDev"]["path"], paths["mirror"]["path"]);
|
assert_ne!(paths["AppleDev"]["path"], paths["mirror"]["path"]);
|
||||||
resolve_provider_path_conflicts(&mut reordered, &root)?;
|
resolve_provider_path_conflicts(&mut reordered, &root)?;
|
||||||
@@ -525,14 +448,14 @@ mod tests {
|
|||||||
"resolving an already generated config must be idempotent"
|
"resolving an already generated config must be idempotent"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(bundle.config.as_mapping(), Some(&config));
|
assert_eq!(serde_yaml_ng::from_str::<serde_yaml_ng::Mapping>(&bundle.yaml)?, config);
|
||||||
let readback = remote_providers_of(&config, &root)?;
|
let readback = remote_providers_of(&config, &root)?;
|
||||||
assert_eq!(bundle.remote_providers.len(), 2);
|
assert_eq!(bundle.remote_providers.len(), 2);
|
||||||
for declared in readback {
|
for declared in readback {
|
||||||
assert!(bundle.remote_providers.contains(&declared));
|
assert!(bundle.remote_providers.contains(&declared.provider));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
config[declared.section][&declared.name]["path"],
|
config[declared.section][&declared.name]["path"],
|
||||||
declared.destination.as_str()
|
declared.provider.destination
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
config[declared.section][&declared.name]["url"],
|
config[declared.section][&declared.name]["url"],
|
||||||
@@ -544,8 +467,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn allocated_provider_paths_do_not_claim_another_declared_path()
|
fn allocated_provider_paths_do_not_claim_another_declared_path() -> anyhow::Result<()> {
|
||||||
-> std::result::Result<(), Box<dyn std::error::Error>> {
|
|
||||||
let root = std::env::temp_dir();
|
let root = std::env::temp_dir();
|
||||||
let original: serde_yaml_ng::Mapping = serde_yaml_ng::from_str(
|
let original: serde_yaml_ng::Mapping = serde_yaml_ng::from_str(
|
||||||
"proxy-providers:\n a:\n type: http\n url: https://one.example/p.yaml\n path: ./providers/shared.yaml\nrule-providers:\n b:\n type: http\n url: https://two.example/r.yaml\n path: ./providers/shared.yaml\n",
|
"proxy-providers:\n a:\n type: http\n url: https://one.example/p.yaml\n path: ./providers/shared.yaml\nrule-providers:\n b:\n type: http\n url: https://two.example/r.yaml\n path: ./providers/shared.yaml\n",
|
||||||
@@ -567,8 +489,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn provider_path_resolution_leaves_shared_sources_and_local_files_unchanged()
|
fn provider_path_resolution_leaves_shared_sources_and_local_files_unchanged() -> anyhow::Result<()> {
|
||||||
-> std::result::Result<(), Box<dyn std::error::Error>> {
|
|
||||||
let mut config: serde_yaml_ng::Mapping = serde_yaml_ng::from_str(
|
let mut config: serde_yaml_ng::Mapping = serde_yaml_ng::from_str(
|
||||||
"rule-providers:\n a:\n type: http\n url: https://one.example/r.yaml\n path: ./rules/shared.yaml\n b:\n type: http\n url: https://one.example/r.yaml\n path: ./rules/shared.yaml\n local:\n type: file\n path: ./rules/local.yaml\n remote:\n type: http\n url: https://two.example/r.yaml\n path: ./rules/local.yaml\n mirror:\n type: http\n url: https://three.example/r.yaml\n path: ./rules/local.yaml\n",
|
"rule-providers:\n a:\n type: http\n url: https://one.example/r.yaml\n path: ./rules/shared.yaml\n b:\n type: http\n url: https://one.example/r.yaml\n path: ./rules/shared.yaml\n local:\n type: file\n path: ./rules/local.yaml\n remote:\n type: http\n url: https://two.example/r.yaml\n path: ./rules/local.yaml\n mirror:\n type: http\n url: https://three.example/r.yaml\n path: ./rules/local.yaml\n",
|
||||||
)?;
|
)?;
|
||||||
@@ -579,8 +500,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn collects_only_local_providers_and_existing_geo_assets()
|
async fn collects_only_local_providers_and_existing_geo_assets() -> anyhow::Result<()> {
|
||||||
-> std::result::Result<(), Box<dyn std::error::Error>> {
|
|
||||||
let root = std::env::temp_dir().join(format!("clash-verge-runtime-bundle-{}", std::process::id()));
|
let root = std::env::temp_dir().join(format!("clash-verge-runtime-bundle-{}", std::process::id()));
|
||||||
std::fs::create_dir_all(root.join("providers"))?;
|
std::fs::create_dir_all(root.join("providers"))?;
|
||||||
std::fs::write(root.join("providers/local.yaml"), b"proxies: []\n")?;
|
std::fs::write(root.join("providers/local.yaml"), b"proxies: []\n")?;
|
||||||
@@ -596,10 +516,12 @@ mod tests {
|
|||||||
absolute_remote.display()
|
absolute_remote.display()
|
||||||
),
|
),
|
||||||
)?;
|
)?;
|
||||||
|
let core = root.join("mihomo");
|
||||||
|
std::fs::write(&core, b"core")?;
|
||||||
|
|
||||||
let bundle = collect_runtime_bundle(&config).await?;
|
let bundle = collect_runtime_bundle(&config, &core).await?;
|
||||||
|
|
||||||
let bundled_config = &bundle.config;
|
let bundled_config: serde_yaml_ng::Value = serde_yaml_ng::from_str(&bundle.yaml)?;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
bundled_config["proxy-providers"]["local"]["path"].as_str(),
|
bundled_config["proxy-providers"]["local"]["path"].as_str(),
|
||||||
Some("providers/local.yaml")
|
Some("providers/local.yaml")
|
||||||
@@ -608,7 +530,7 @@ mod tests {
|
|||||||
bundled_config["proxy-providers"]["remote"]["path"].as_str(),
|
bundled_config["proxy-providers"]["remote"]["path"].as_str(),
|
||||||
Some("providers/remote.yaml")
|
Some("providers/remote.yaml")
|
||||||
);
|
);
|
||||||
assert!(!serde_yaml_ng::to_string(bundled_config)?.contains(root.to_string_lossy().as_ref()));
|
assert!(!bundle.yaml.contains(&root.to_string_lossy().into_owned()));
|
||||||
assert!(
|
assert!(
|
||||||
bundle
|
bundle
|
||||||
.assets
|
.assets
|
||||||
@@ -638,8 +560,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn two_names_for_one_remote_file_are_folded_rather_than_refused()
|
async fn two_names_for_one_remote_file_are_folded_rather_than_refused() -> anyhow::Result<()> {
|
||||||
-> std::result::Result<(), Box<dyn std::error::Error>> {
|
|
||||||
// Identical repeats are one service-side file and are safe to fold.
|
// Identical repeats are one service-side file and are safe to fold.
|
||||||
let root = std::env::temp_dir().join(format!("clash-verge-bundle-dup-{}", std::process::id()));
|
let root = std::env::temp_dir().join(format!("clash-verge-bundle-dup-{}", std::process::id()));
|
||||||
let _ = std::fs::remove_dir_all(&root);
|
let _ = std::fs::remove_dir_all(&root);
|
||||||
@@ -649,8 +570,10 @@ mod tests {
|
|||||||
&config,
|
&config,
|
||||||
"rule-providers:\n a:\n type: http\n url: https://one.example/x.yaml\n path: ./rules/x.yaml\n b:\n type: http\n url: https://one.example/x.yaml\n path: ./rules/x.yaml\n",
|
"rule-providers:\n a:\n type: http\n url: https://one.example/x.yaml\n path: ./rules/x.yaml\n b:\n type: http\n url: https://one.example/x.yaml\n path: ./rules/x.yaml\n",
|
||||||
)?;
|
)?;
|
||||||
|
let core = root.join("mihomo");
|
||||||
|
std::fs::write(&core, b"core")?;
|
||||||
|
|
||||||
let bundle = collect_runtime_bundle(&config).await?;
|
let bundle = collect_runtime_bundle(&config, &core).await?;
|
||||||
|
|
||||||
assert_eq!(bundle.remote_providers.len(), 1, "one file, declared twice");
|
assert_eq!(bundle.remote_providers.len(), 1, "one file, declared twice");
|
||||||
assert_eq!(bundle.remote_providers[0].destination, "rules/x.yaml");
|
assert_eq!(bundle.remote_providers[0].destination, "rules/x.yaml");
|
||||||
@@ -659,7 +582,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn two_sources_for_one_remote_file_are_refused() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
async fn two_sources_for_one_remote_file_are_refused() -> anyhow::Result<()> {
|
||||||
let root = std::env::temp_dir().join(format!("clash-verge-bundle-conflict-{}", std::process::id()));
|
let root = std::env::temp_dir().join(format!("clash-verge-bundle-conflict-{}", std::process::id()));
|
||||||
let _ = std::fs::remove_dir_all(&root);
|
let _ = std::fs::remove_dir_all(&root);
|
||||||
std::fs::create_dir_all(&root)?;
|
std::fs::create_dir_all(&root)?;
|
||||||
@@ -668,9 +591,11 @@ mod tests {
|
|||||||
&config,
|
&config,
|
||||||
"rule-providers:\n a:\n type: http\n url: https://one.example/x.yaml\n path: ./rules/x.yaml\n b:\n type: http\n url: https://two.example/x.yaml\n path: ./rules/x.yaml\n",
|
"rule-providers:\n a:\n type: http\n url: https://one.example/x.yaml\n path: ./rules/x.yaml\n b:\n type: http\n url: https://two.example/x.yaml\n path: ./rules/x.yaml\n",
|
||||||
)?;
|
)?;
|
||||||
|
let core = root.join("mihomo");
|
||||||
|
std::fs::write(&core, b"core")?;
|
||||||
|
|
||||||
let Err(error) = collect_runtime_bundle(&config).await else {
|
let Err(error) = collect_runtime_bundle(&config, &core).await else {
|
||||||
return Err("two sources cannot own one file".into());
|
anyhow::bail!("two sources cannot own one file");
|
||||||
};
|
};
|
||||||
|
|
||||||
assert!(error.to_string().contains("two different sources"), "{error}");
|
assert!(error.to_string().contains("two different sources"), "{error}");
|
||||||
@@ -679,8 +604,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn an_odd_provider_is_left_alone_instead_of_failing_the_whole_bundle()
|
async fn an_odd_provider_is_left_alone_instead_of_failing_the_whole_bundle() -> anyhow::Result<()> {
|
||||||
-> std::result::Result<(), Box<dyn std::error::Error>> {
|
|
||||||
// Odd providers accepted by mihomo must not block the rest of the bundle.
|
// Odd providers accepted by mihomo must not block the rest of the bundle.
|
||||||
let root = std::env::temp_dir().join(format!("clash-verge-bundle-odd-{}", std::process::id()));
|
let root = std::env::temp_dir().join(format!("clash-verge-bundle-odd-{}", std::process::id()));
|
||||||
let _ = std::fs::remove_dir_all(&root);
|
let _ = std::fs::remove_dir_all(&root);
|
||||||
@@ -690,8 +614,10 @@ mod tests {
|
|||||||
&config,
|
&config,
|
||||||
"rule-providers:\n nourl:\n type: http\n path: ./rules/nourl.yaml\n missing:\n type: inline\n url: https://one.example/i.yaml\n path: ./rules/missing.yaml\n good:\n type: http\n url: https://one.example/g.yaml\n path: ./rules/g.yaml\n",
|
"rule-providers:\n nourl:\n type: http\n path: ./rules/nourl.yaml\n missing:\n type: inline\n url: https://one.example/i.yaml\n path: ./rules/missing.yaml\n good:\n type: http\n url: https://one.example/g.yaml\n path: ./rules/g.yaml\n",
|
||||||
)?;
|
)?;
|
||||||
|
let core = root.join("mihomo");
|
||||||
|
std::fs::write(&core, b"core")?;
|
||||||
|
|
||||||
let bundle = collect_runtime_bundle(&config).await?;
|
let bundle = collect_runtime_bundle(&config, &core).await?;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
bundle.remote_providers.len(),
|
bundle.remote_providers.len(),
|
||||||
@@ -699,8 +625,9 @@ mod tests {
|
|||||||
"only the provider that could be classified is declared"
|
"only the provider that could be classified is declared"
|
||||||
);
|
);
|
||||||
assert_eq!(bundle.remote_providers[0].destination, "rules/g.yaml");
|
assert_eq!(bundle.remote_providers[0].destination, "rules/g.yaml");
|
||||||
|
let reserialized: serde_yaml_ng::Value = serde_yaml_ng::from_str(&bundle.yaml)?;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
bundle.config["rule-providers"]["nourl"]["path"].as_str(),
|
reserialized["rule-providers"]["nourl"]["path"].as_str(),
|
||||||
Some("./rules/nourl.yaml"),
|
Some("./rules/nourl.yaml"),
|
||||||
"an unclassifiable provider keeps the path the core was given"
|
"an unclassifiable provider keeps the path the core was given"
|
||||||
);
|
);
|
||||||
@@ -709,13 +636,13 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn rejects_provider_paths_outside_the_config_root() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
async fn rejects_provider_paths_outside_the_config_root() -> anyhow::Result<()> {
|
||||||
let root = std::env::temp_dir().join(format!("clash-verge-runtime-bundle-outside-{}", std::process::id()));
|
let root = std::env::temp_dir().join(format!("clash-verge-runtime-bundle-outside-{}", std::process::id()));
|
||||||
std::fs::create_dir_all(&root)?;
|
std::fs::create_dir_all(&root)?;
|
||||||
let config = root.join("config.yaml");
|
let config = root.join("config.yaml");
|
||||||
let outside = root
|
let outside = root
|
||||||
.parent()
|
.parent()
|
||||||
.ok_or("test root has no parent")?
|
.ok_or_else(|| anyhow::anyhow!("test root has no parent"))?
|
||||||
.join(format!("outside-{}.yaml", std::process::id()));
|
.join(format!("outside-{}.yaml", std::process::id()));
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
&config,
|
&config,
|
||||||
@@ -724,9 +651,11 @@ mod tests {
|
|||||||
outside.display()
|
outside.display()
|
||||||
),
|
),
|
||||||
)?;
|
)?;
|
||||||
|
let core = root.join("mihomo");
|
||||||
|
std::fs::write(&core, b"core")?;
|
||||||
|
|
||||||
let Err(error) = collect_runtime_bundle(&config).await else {
|
let Err(error) = collect_runtime_bundle(&config, &core).await else {
|
||||||
return Err("outside provider path must be rejected".into());
|
anyhow::bail!("outside provider path must be rejected");
|
||||||
};
|
};
|
||||||
|
|
||||||
assert!(error.to_string().contains("outside the config root"));
|
assert!(error.to_string().contains("outside the config root"));
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use crate::core::notify::NoticeStatus;
|
use crate::core::notify::NoticeStatus;
|
||||||
use crate::utils::dirs;
|
use crate::utils::dirs;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{Config, mihomo_yaml, runtime::IRuntime},
|
config::{Config, runtime::IRuntime},
|
||||||
constants,
|
constants,
|
||||||
core::{
|
core::{
|
||||||
CoreManager,
|
CoreManager,
|
||||||
@@ -13,6 +13,7 @@ use crate::{
|
|||||||
CORE_REJECTED_PREFIX, OwnerRecoveryReason, OwnerSample, OwnerStep, OwnerWatch, PendingAction, RUN_STATE,
|
CORE_REJECTED_PREFIX, OwnerRecoveryReason, OwnerSample, OwnerStep, OwnerWatch, PendingAction, RUN_STATE,
|
||||||
ReadyWaitError, RunState, RunStateEnv, RunStateStore, ServiceHealth,
|
ReadyWaitError, RunState, RunStateEnv, RunStateStore, ServiceHealth,
|
||||||
},
|
},
|
||||||
|
runtime_bundle::{GEO_ASSETS, RemoteProviderRef, collect_runtime_bundle, remote_providers_of},
|
||||||
tray::Tray,
|
tray::Tray,
|
||||||
},
|
},
|
||||||
process::AsyncHandler,
|
process::AsyncHandler,
|
||||||
@@ -20,11 +21,10 @@ use crate::{
|
|||||||
use anyhow::{Context as _, Result, anyhow, bail};
|
use anyhow::{Context as _, Result, anyhow, bail};
|
||||||
use clash_verge_draft::Draft;
|
use clash_verge_draft::Draft;
|
||||||
use clash_verge_logging::{Type, logging};
|
use clash_verge_logging::{Type, logging};
|
||||||
use clash_verge_runtime_bundle::{GEO_ASSETS, RemoteProviderRef, collect_runtime_bundle, remote_providers_of};
|
|
||||||
use clash_verge_service_ipc::{
|
use clash_verge_service_ipc::{
|
||||||
MacosProxyConfig, OwnerCredentials, OwnerIdentity, OwnerSessionProof, ProtocolInfo, ProxyApplyOutcome,
|
MacosProxyConfig, OwnerCredentials, OwnerIdentity, OwnerSessionProof, ProtocolInfo, ProxyApplyOutcome,
|
||||||
RemoteProvider, RuntimeAsset, RuntimeBundle, RuntimeFileOutcome, RuntimeFileRequest, ServiceErrorCode,
|
RuntimeBundle, RuntimeFileOutcome, RuntimeFileRequest, ServiceErrorCode, ServiceStatusSnapshot,
|
||||||
ServiceStatusSnapshot, StageRuntimeOutcome, StartClashRequest, WriterConfig,
|
StageRuntimeOutcome, StartClashRequest, WriterConfig,
|
||||||
};
|
};
|
||||||
use clash_verge_task::scheduled_task::{self, Mailbox, Next, ScheduledTask};
|
use clash_verge_task::scheduled_task::{self, Mailbox, Next, ScheduledTask};
|
||||||
use clash_verge_task::watch_task;
|
use clash_verge_task::watch_task;
|
||||||
@@ -611,27 +611,7 @@ async fn collect_service_runtime_bundle(config_file: &Path) -> Result<RuntimeBun
|
|||||||
|
|
||||||
let bin_ext = if cfg!(windows) { ".exe" } else { "" };
|
let bin_ext = if cfg!(windows) { ".exe" } else { "" };
|
||||||
let bin_path = service_core_path(&clash_core, bin_ext)?;
|
let bin_path = service_core_path(&clash_core, bin_ext)?;
|
||||||
let plan = collect_runtime_bundle(config_file).await?;
|
collect_runtime_bundle(config_file, &bin_path).await
|
||||||
Ok(RuntimeBundle {
|
|
||||||
yaml: mihomo_yaml::serialize(&plan.config).context("failed to serialize service runtime config")?,
|
|
||||||
assets: plan
|
|
||||||
.assets
|
|
||||||
.into_iter()
|
|
||||||
.map(|asset| RuntimeAsset {
|
|
||||||
source: asset.source,
|
|
||||||
destination: asset.destination.into(),
|
|
||||||
})
|
|
||||||
.collect(),
|
|
||||||
remote_providers: plan
|
|
||||||
.remote_providers
|
|
||||||
.into_iter()
|
|
||||||
.map(|provider| RemoteProvider {
|
|
||||||
destination: provider.destination.into(),
|
|
||||||
url: provider.url,
|
|
||||||
})
|
|
||||||
.collect(),
|
|
||||||
core_path: bin_path.to_string_lossy().into_owned(),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A staging response whose refusal code tells callers whether a fresh start can help.
|
/// A staging response whose refusal code tells callers whether a fresh start can help.
|
||||||
@@ -968,7 +948,7 @@ async fn sync_runtime_providers_by_service() -> Result<ProviderSync> {
|
|||||||
let loaded_before = provider_load_times().await;
|
let loaded_before = provider_load_times().await;
|
||||||
let mut fetched = Vec::new();
|
let mut fetched = Vec::new();
|
||||||
for declared in applied_remote_providers(&runtime, &app_dir)? {
|
for declared in applied_remote_providers(&runtime, &app_dir)? {
|
||||||
let (temp, file) = match create_sync_temp(&app_dir.join(declared.destination.as_str())).await {
|
let (temp, file) = match create_sync_temp(&app_dir.join(&declared.provider.destination)).await {
|
||||||
Ok(created) => created,
|
Ok(created) => created,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
logging!(warn, Type::Service, "{error:#}");
|
logging!(warn, Type::Service, "{error:#}");
|
||||||
@@ -976,7 +956,7 @@ async fn sync_runtime_providers_by_service() -> Result<ProviderSync> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match fetch_runtime_file(&credentials, &session, &declared.destination, file).await {
|
match fetch_runtime_file(&credentials, &session, &declared.provider.destination, file).await {
|
||||||
Ok(Fetch::Complete { len, mtime_ns }) => fetched.push(FetchedCache {
|
Ok(Fetch::Complete { len, mtime_ns }) => fetched.push(FetchedCache {
|
||||||
declared,
|
declared,
|
||||||
temp,
|
temp,
|
||||||
@@ -997,7 +977,7 @@ async fn sync_runtime_providers_by_service() -> Result<ProviderSync> {
|
|||||||
warn,
|
warn,
|
||||||
Type::Service,
|
Type::Service,
|
||||||
"failed to read provider cache {} into {}: {error:#}",
|
"failed to read provider cache {} into {}: {error:#}",
|
||||||
declared.destination,
|
declared.provider.destination,
|
||||||
temp.display()
|
temp.display()
|
||||||
);
|
);
|
||||||
outcome.pending += 1;
|
outcome.pending += 1;
|
||||||
@@ -1108,7 +1088,7 @@ async fn sync_runtime_geo(
|
|||||||
fn applied_remote_providers(runtime: &Draft<IRuntime>, app_dir: &Path) -> Result<Vec<RemoteProviderRef>> {
|
fn applied_remote_providers(runtime: &Draft<IRuntime>, app_dir: &Path) -> Result<Vec<RemoteProviderRef>> {
|
||||||
let applied = runtime.data_arc();
|
let applied = runtime.data_arc();
|
||||||
match applied.config.as_ref() {
|
match applied.config.as_ref() {
|
||||||
Some(config) => remote_providers_of(config, app_dir).map_err(Into::into),
|
Some(config) => remote_providers_of(config, app_dir),
|
||||||
None => Ok(Vec::new()),
|
None => Ok(Vec::new()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1137,7 +1117,7 @@ async fn publish_fetched(
|
|||||||
};
|
};
|
||||||
let mut synced = 0;
|
let mut synced = 0;
|
||||||
for cache in fetched {
|
for cache in fetched {
|
||||||
let target = app_dir.join(cache.declared.destination.as_str());
|
let target = app_dir.join(&cache.declared.provider.destination);
|
||||||
if !declared.contains(&cache.declared) || same_contents(&cache.temp, &target).await {
|
if !declared.contains(&cache.declared) || same_contents(&cache.temp, &target).await {
|
||||||
remove_temp(&cache.temp).await;
|
remove_temp(&cache.temp).await;
|
||||||
continue;
|
continue;
|
||||||
@@ -1214,7 +1194,7 @@ async fn recheck_identity(
|
|||||||
cache: &FetchedCache,
|
cache: &FetchedCache,
|
||||||
) -> Result<Fetch> {
|
) -> Result<Fetch> {
|
||||||
let request = RuntimeFileRequest {
|
let request = RuntimeFileRequest {
|
||||||
destination: cache.declared.destination.as_str().to_owned(),
|
destination: cache.declared.provider.destination.to_owned(),
|
||||||
offset: cache.len,
|
offset: cache.len,
|
||||||
};
|
};
|
||||||
Ok(match read_chunk(credentials, session, &request).await? {
|
Ok(match read_chunk(credentials, session, &request).await? {
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use crate::core::handle;
|
|||||||
use crate::singleton;
|
use crate::singleton;
|
||||||
use crate::utils::{dirs, help};
|
use crate::utils::{dirs, help};
|
||||||
use clash_verge_logging::{Type, logging};
|
use clash_verge_logging::{Type, logging};
|
||||||
use clash_verge_profile_script::MainDeclaration;
|
|
||||||
|
|
||||||
const SYNTAX_CHECK_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5);
|
const SYNTAX_CHECK_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5);
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ async fn validation_fingerprint(yaml: &str) -> u64 {
|
|||||||
.into_iter();
|
.into_iter();
|
||||||
// The test run reads geo databases from the app dir; a geo update must revalidate.
|
// The test run reads geo databases from the app dir; a geo update must revalidate.
|
||||||
let geo = dirs::app_home_dir().into_iter().flat_map(|dir| {
|
let geo = dirs::app_home_dir().into_iter().flat_map(|dir| {
|
||||||
clash_verge_runtime_bundle::GEO_ASSETS
|
super::runtime_bundle::GEO_ASSETS
|
||||||
.iter()
|
.iter()
|
||||||
.map(move |asset| dir.join(asset))
|
.map(move |asset| dir.join(asset))
|
||||||
});
|
});
|
||||||
@@ -258,8 +257,22 @@ impl CoreConfigValidator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
logging!(debug, Type::Validate, "验证脚本文件: {}", path);
|
logging!(debug, Type::Validate, "验证脚本文件: {}", path);
|
||||||
let syntax =
|
let has_main =
|
||||||
crate::process::AsyncHandler::spawn_blocking(move || clash_verge_profile_script::validate(&content));
|
content.contains("function main") || content.contains("const main") || content.contains("let main");
|
||||||
|
|
||||||
|
// Boa parsing is pure CPU; keep it off the async worker, with a timeout.
|
||||||
|
let syntax = crate::process::AsyncHandler::spawn_blocking(move || {
|
||||||
|
use boa_engine::{Context, Source};
|
||||||
|
|
||||||
|
let mut context = Context::default();
|
||||||
|
let _ = context.eval(Source::from_bytes(
|
||||||
|
"var console = Object.freeze({log(...data){},info(...data){},error(...data){},debug(...data){}});",
|
||||||
|
));
|
||||||
|
context
|
||||||
|
.eval(Source::from_bytes(&content))
|
||||||
|
.map(|_| ())
|
||||||
|
.map_err(|err| err.to_string())
|
||||||
|
});
|
||||||
let result = match tokio::time::timeout(SYNTAX_CHECK_TIMEOUT, syntax).await {
|
let result = match tokio::time::timeout(SYNTAX_CHECK_TIMEOUT, syntax).await {
|
||||||
Ok(Ok(evaluated)) => evaluated,
|
Ok(Ok(evaluated)) => evaluated,
|
||||||
Ok(Err(join_err)) => Err(format!("syntax check task failed: {join_err}")),
|
Ok(Err(join_err)) => Err(format!("syntax check task failed: {join_err}")),
|
||||||
@@ -267,10 +280,10 @@ impl CoreConfigValidator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(main) => {
|
Ok(()) => {
|
||||||
logging!(debug, Type::Validate, "脚本语法验证通过: {}", path);
|
logging!(debug, Type::Validate, "脚本语法验证通过: {}", path);
|
||||||
|
|
||||||
if main == MainDeclaration::Missing {
|
if !has_main {
|
||||||
let error_msg = "Script must contain a main function";
|
let error_msg = "Script must contain a main function";
|
||||||
logging!(warn, Type::Validate, "脚本缺少main函数: {}", path);
|
logging!(warn, Type::Validate, "脚本缺少main函数: {}", path);
|
||||||
return Ok(ValidationOutcome::invalid_from_message(error_msg));
|
return Ok(ValidationOutcome::invalid_from_message(error_msg));
|
||||||
|
|||||||
@@ -1,14 +1,31 @@
|
|||||||
|
use super::SeqMap;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::PrfItem,
|
config::PrfItem,
|
||||||
utils::{dirs, help},
|
utils::{dirs, help},
|
||||||
};
|
};
|
||||||
use clash_verge_config_render::{ChainItem, ChainType, SeqMap};
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use serde_yaml_ng::Mapping;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::{Arc, LazyLock};
|
use std::sync::{Arc, LazyLock};
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
use tristr::alias::String;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct ChainItem {
|
||||||
|
pub uid: String,
|
||||||
|
pub data: ChainType,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum ChainType {
|
||||||
|
Merge(Mapping),
|
||||||
|
Script(String),
|
||||||
|
Rules(SeqMap),
|
||||||
|
Proxies(SeqMap),
|
||||||
|
Groups(SeqMap),
|
||||||
|
}
|
||||||
|
|
||||||
struct CachedChain {
|
struct CachedChain {
|
||||||
mtime: SystemTime,
|
mtime: SystemTime,
|
||||||
@@ -18,9 +35,16 @@ struct CachedChain {
|
|||||||
|
|
||||||
static CHAIN_CACHE: LazyLock<Mutex<HashMap<PathBuf, CachedChain>>> = LazyLock::new(|| Mutex::new(HashMap::new()));
|
static CHAIN_CACHE: LazyLock<Mutex<HashMap<PathBuf, CachedChain>>> = LazyLock::new(|| Mutex::new(HashMap::new()));
|
||||||
|
|
||||||
pub(super) async fn load_chain_item(item: &PrfItem) -> Option<Arc<ChainItem>> {
|
// Helper trait to allow async conversion
|
||||||
|
pub trait AsyncChainItemFrom {
|
||||||
|
async fn from_async(item: &PrfItem) -> Option<Arc<ChainItem>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsyncChainItemFrom for Option<Arc<ChainItem>> {
|
||||||
|
async fn from_async(item: &PrfItem) -> Self {
|
||||||
let itype = item.itype.as_ref()?.as_str();
|
let itype = item.itype.as_ref()?.as_str();
|
||||||
let file = item.file.as_ref()?;
|
let file = item.file.clone()?;
|
||||||
|
let uid = item.uid.clone().unwrap_or_else(|| "".into());
|
||||||
let path = dirs::app_profiles_dir().ok()?.join(file.as_str());
|
let path = dirs::app_profiles_dir().ok()?.join(file.as_str());
|
||||||
|
|
||||||
let meta = fs::metadata(&path).await.ok()?;
|
let meta = fs::metadata(&path).await.ok()?;
|
||||||
@@ -32,23 +56,26 @@ pub(super) async fn load_chain_item(item: &PrfItem) -> Option<Arc<ChainItem>> {
|
|||||||
return Some(Arc::clone(&cached.item));
|
return Some(Arc::clone(&cached.item));
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = match itype {
|
let loaded = Arc::new(match itype {
|
||||||
"script" => ChainType::Script(fs::read_to_string(&path).await.ok()?.into()),
|
"script" => Some(ChainItem {
|
||||||
"merge" => ChainType::Merge(help::read_mapping(&path).await.ok()?),
|
uid,
|
||||||
|
data: ChainType::Script(fs::read_to_string(&path).await.ok()?.as_str().into()),
|
||||||
|
}),
|
||||||
|
"merge" => Some(ChainItem {
|
||||||
|
uid,
|
||||||
|
data: ChainType::Merge(help::read_mapping(&path).await.ok()?),
|
||||||
|
}),
|
||||||
"rules" | "proxies" | "groups" => {
|
"rules" | "proxies" | "groups" => {
|
||||||
let seq_map = help::read_yaml::<SeqMap>(&path).await.ok()?;
|
let seq_map = help::read_yaml::<SeqMap>(&path).await.ok()?;
|
||||||
match itype {
|
let data = match itype {
|
||||||
"rules" => ChainType::Rules(seq_map),
|
"rules" => ChainType::Rules(seq_map),
|
||||||
"proxies" => ChainType::Proxies(seq_map),
|
"proxies" => ChainType::Proxies(seq_map),
|
||||||
_ => ChainType::Groups(seq_map),
|
_ => ChainType::Groups(seq_map),
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => return None,
|
|
||||||
};
|
};
|
||||||
let loaded = Arc::new(ChainItem {
|
Some(ChainItem { uid, data })
|
||||||
uid: item.uid.clone().unwrap_or_default(),
|
}
|
||||||
data,
|
_ => None,
|
||||||
});
|
}?);
|
||||||
|
|
||||||
CHAIN_CACHE.lock().insert(
|
CHAIN_CACHE.lock().insert(
|
||||||
path,
|
path,
|
||||||
@@ -60,3 +87,4 @@ pub(super) async fn load_chain_item(item: &PrfItem) -> Option<Arc<ChainItem>> {
|
|||||||
);
|
);
|
||||||
Some(loaded)
|
Some(loaded)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,21 +18,19 @@ pub const HANDLE_FIELDS: [&str; 12] = [
|
|||||||
|
|
||||||
pub const DEFAULT_FIELDS: [&str; 5] = ["proxies", "proxy-providers", "proxy-groups", "rule-providers", "rules"];
|
pub const DEFAULT_FIELDS: [&str; 5] = ["proxies", "proxy-providers", "proxy-groups", "rule-providers", "rules"];
|
||||||
|
|
||||||
|
fn lowercase_key(key: &str) -> Value {
|
||||||
|
let mut key = String::from(key);
|
||||||
|
key.make_ascii_lowercase();
|
||||||
|
Value::from(key.as_str())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn use_lowercase(config: Mapping) -> Mapping {
|
pub fn use_lowercase(config: Mapping) -> Mapping {
|
||||||
let mut lowercased = Mapping::new();
|
let mut lowercased = Mapping::new();
|
||||||
|
|
||||||
for (key, value) in config {
|
for (key, value) in config {
|
||||||
let mut key = match key {
|
if let Some(key_str) = key.as_str() {
|
||||||
Value::String(key) => key,
|
lowercased.insert(lowercase_key(key_str), value);
|
||||||
key => {
|
|
||||||
let Some(key) = key.as_str() else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
key.to_owned()
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
key.make_ascii_lowercase();
|
|
||||||
lowercased.insert(Value::String(key), value);
|
|
||||||
}
|
}
|
||||||
lowercased
|
lowercased
|
||||||
}
|
}
|
||||||
@@ -41,7 +39,7 @@ pub fn use_sort(mut config: Mapping) -> Mapping {
|
|||||||
let mut sorted = Mapping::new();
|
let mut sorted = Mapping::new();
|
||||||
HANDLE_FIELDS.into_iter().for_each(|key| {
|
HANDLE_FIELDS.into_iter().for_each(|key| {
|
||||||
let key = Value::from(key);
|
let key = Value::from(key);
|
||||||
if let Some(value) = config.shift_remove(&key) {
|
if let Some(value) = config.remove(&key) {
|
||||||
sorted.insert(key, value);
|
sorted.insert(key, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -68,8 +66,8 @@ pub fn use_sort(mut config: Mapping) -> Mapping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(super) fn lowercase_config_keys(config: &Mapping) -> impl Iterator<Item = String> {
|
pub fn use_keys<'a>(config: &'a Mapping) -> impl Iterator<Item = String> + 'a {
|
||||||
config.keys().filter_map(Value::as_str).map(|s: &str| {
|
config.iter().filter_map(|(key, _)| key.as_str()).map(|s: &str| {
|
||||||
let mut s: String = s.into();
|
let mut s: String = s.into();
|
||||||
s.make_ascii_lowercase();
|
s.make_ascii_lowercase();
|
||||||
s
|
s
|
||||||
@@ -32,7 +32,7 @@ pub fn use_merge(merge: Mapping, mut config: Mapping) -> Mapping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_merge() -> Result<(), serde_yaml_ng::Error> {
|
fn test_merge() -> anyhow::Result<()> {
|
||||||
let merge = r"
|
let merge = r"
|
||||||
prepend-rules:
|
prepend-rules:
|
||||||
- prepend
|
- prepend
|
||||||
+1665
-42
File diff suppressed because it is too large
Load Diff
@@ -1,64 +1,79 @@
|
|||||||
|
use crate::{process::AsyncHandler, utils::tmpl};
|
||||||
|
|
||||||
|
use super::field::use_lowercase;
|
||||||
|
use anyhow::Result;
|
||||||
use boa_engine::{Context, JsString, JsValue, Source, js_string, native_function::NativeFunction, property::Attribute};
|
use boa_engine::{Context, JsString, JsValue, Source, js_string, native_function::NativeFunction, property::Attribute};
|
||||||
use clash_verge_logging::{Type, logging};
|
use clash_verge_logging::{Type, logging};
|
||||||
|
use parking_lot::Mutex;
|
||||||
use serde_yaml_ng::Mapping;
|
use serde_yaml_ng::Mapping;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::sync::Arc;
|
||||||
use std::rc::Rc;
|
|
||||||
use tristr::alias::String;
|
use tristr::alias::String;
|
||||||
|
|
||||||
const MAX_OUTPUTS: usize = 1000;
|
const MAX_OUTPUTS: usize = 1000;
|
||||||
const MAX_OUTPUT_SIZE: usize = 1024 * 1024; // 1MB
|
const MAX_OUTPUT_SIZE: usize = 1024 * 1024; // 1MB
|
||||||
const MAX_PROFILE_NAME_BYTES: usize = 1024;
|
|
||||||
const MAX_JSON_SIZE: usize = 10 * 1024 * 1024; // 10MB
|
const MAX_JSON_SIZE: usize = 10 * 1024 * 1024; // 10MB
|
||||||
const MAX_LOOP_ITERATIONS: u64 = 10_000_000;
|
const MAX_LOOP_ITERATIONS: u64 = 10_000_000;
|
||||||
const SCRIPT_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5);
|
const SCRIPT_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5);
|
||||||
|
|
||||||
/// Script logs are retained when evaluation or result conversion fails.
|
type ScriptResult = (Mapping, Vec<String>, Vec<(String, String)>);
|
||||||
pub type ScriptLogs = Vec<(String, String)>;
|
type EvalOutcome = (Result<Mapping, std::string::String>, Vec<(String, String)>);
|
||||||
|
|
||||||
type EvalOutcome = (Result<Mapping, std::string::String>, ScriptLogs);
|
/// Never fails: exceptions are logged and the input config is returned unchanged.
|
||||||
|
pub(super) async fn use_script(script: String, config: Mapping, name: String) -> ScriptResult {
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
// The template is identity-plus-lowercasing; skip the Boa round-trip.
|
||||||
pub enum MainDeclaration {
|
if script == tmpl::ITEM_SCRIPT {
|
||||||
Present,
|
return (use_lowercase(config), vec![], vec![]);
|
||||||
Missing,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Evaluates the source and checks that the entry point is callable.
|
let json = match serde_json::to_value(&config) {
|
||||||
pub fn validate(source: &str) -> Result<MainDeclaration, std::string::String> {
|
Ok(mut json) => {
|
||||||
let mut context = Context::default();
|
if let Some(map) = json.as_object_mut() {
|
||||||
let _ = context.eval(Source::from_bytes(
|
let mut lowered = serde_json::Map::with_capacity(map.len());
|
||||||
"var console = Object.freeze({log(...data){},info(...data){},error(...data){},debug(...data){},warn(...data){},table(...data){}});",
|
for (key, value) in std::mem::take(map) {
|
||||||
));
|
let mut key = key;
|
||||||
context
|
key.make_ascii_lowercase();
|
||||||
.eval(Source::from_bytes(source))
|
lowered.insert(key, value);
|
||||||
.map_err(|err| err.to_string())?;
|
}
|
||||||
let has_main = context
|
*map = lowered;
|
||||||
.eval(Source::from_bytes("typeof main === 'function'"))
|
}
|
||||||
.map_err(|err| err.to_string())?
|
if json_approx_size(&json) <= MAX_JSON_SIZE {
|
||||||
.to_boolean();
|
json
|
||||||
Ok(if has_main {
|
|
||||||
MainDeclaration::Present
|
|
||||||
} else {
|
} else {
|
||||||
MainDeclaration::Missing
|
let message = "Configuration size exceeds maximum allowed size";
|
||||||
})
|
return (config, vec![], vec![("exception".into(), message.into())]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Err(err) => return (config, vec![], vec![("exception".into(), err.to_string().into())]),
|
||||||
|
};
|
||||||
|
|
||||||
/// Runs one script on the blocking pool. The timeout bounds waiting for its result.
|
let evaluated = AsyncHandler::spawn_blocking(move || eval_script(&script, &json, &name));
|
||||||
pub async fn execute(script: String, config: serde_json::Value, name: String) -> EvalOutcome {
|
let (outcome, mut logs) = match tokio::time::timeout(SCRIPT_TIMEOUT, evaluated).await {
|
||||||
if json_approx_size(&config) > MAX_JSON_SIZE {
|
|
||||||
return (
|
|
||||||
Err("Configuration size exceeds maximum allowed size".to_owned()),
|
|
||||||
vec![],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let evaluated = tokio::task::spawn_blocking(move || eval_script(&script, &config, &name));
|
|
||||||
match tokio::time::timeout(SCRIPT_TIMEOUT, evaluated).await {
|
|
||||||
Ok(Ok(evaluated)) => evaluated,
|
Ok(Ok(evaluated)) => evaluated,
|
||||||
Ok(Err(join_err)) => (Err(format!("script task panicked: {join_err}")), vec![]),
|
Ok(Err(join_err)) => (Err(format!("script task panicked: {join_err}")), vec![]),
|
||||||
Err(_) => (
|
Err(_elapsed) => (
|
||||||
Err(format!("script execution timed out after {SCRIPT_TIMEOUT:?}")),
|
Err(format!("script execution timed out after {SCRIPT_TIMEOUT:?}")),
|
||||||
vec![],
|
vec![],
|
||||||
),
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
match outcome {
|
||||||
|
Ok(result) => {
|
||||||
|
// Compared against the config as handed in, not the lowercased copy the script saw.
|
||||||
|
let changed_keys = result
|
||||||
|
.iter()
|
||||||
|
.filter(|(key, value)| config.get(key) != Some(value))
|
||||||
|
.filter_map(|(key, _)| {
|
||||||
|
let mut key: String = key.as_str()?.into();
|
||||||
|
key.make_ascii_lowercase();
|
||||||
|
Some(key)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
(result, changed_keys, logs)
|
||||||
|
}
|
||||||
|
Err(reason) => {
|
||||||
|
logs.push(("exception".into(), reason.into()));
|
||||||
|
(config, vec![], logs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,11 +85,13 @@ fn eval_script(script: &str, config_json: &serde_json::Value, name: &String) ->
|
|||||||
.runtime_limits_mut()
|
.runtime_limits_mut()
|
||||||
.set_loop_iteration_limit(MAX_LOOP_ITERATIONS);
|
.set_loop_iteration_limit(MAX_LOOP_ITERATIONS);
|
||||||
|
|
||||||
let logs = Rc::new(RefCell::new(Vec::new()));
|
let outputs = Arc::new(Mutex::new(vec![]));
|
||||||
let console_logs = Rc::clone(&logs);
|
let total_size = Arc::new(Mutex::new(0usize));
|
||||||
let logged_bytes = Cell::new(0);
|
|
||||||
let take_logs = || logs.take();
|
let outputs_clone = Arc::clone(&outputs);
|
||||||
let bail = |reason: std::string::String| (Err(reason), take_logs());
|
let total_size_clone = Arc::clone(&total_size);
|
||||||
|
|
||||||
|
let bail = |reason: std::string::String| (Err(reason), outputs.lock().to_vec());
|
||||||
|
|
||||||
let _ = context.register_global_builtin_callable("__verge_log__".into(), 2, unsafe {
|
let _ = context.register_global_builtin_callable("__verge_log__".into(), 2, unsafe {
|
||||||
NativeFunction::from_closure(move |_: &JsValue, args: &[JsValue], context: &mut Context| {
|
NativeFunction::from_closure(move |_: &JsValue, args: &[JsValue], context: &mut Context| {
|
||||||
@@ -94,21 +111,23 @@ fn eval_script(script: &str, config_json: &serde_json::Value, name: &String) ->
|
|||||||
boa_engine::JsError::from_opaque(JsString::from("Failed to convert data to string").into())
|
boa_engine::JsError::from_opaque(JsString::from("Failed to convert data to string").into())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let mut entries = console_logs.borrow_mut();
|
// 检查输出限制
|
||||||
if entries.len() >= MAX_OUTPUTS {
|
if outputs_clone.lock().len() >= MAX_OUTPUTS {
|
||||||
return Err(boa_engine::JsError::from_opaque(
|
return Err(boa_engine::JsError::from_opaque(
|
||||||
JsString::from("Maximum number of log outputs exceeded").into(),
|
JsString::from("Maximum number of log outputs exceeded").into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_size = logged_bytes.get() + level.len() + data.len();
|
let mut size = total_size_clone.lock();
|
||||||
|
let new_size = *size + level.len() + data.len();
|
||||||
if new_size > MAX_OUTPUT_SIZE {
|
if new_size > MAX_OUTPUT_SIZE {
|
||||||
return Err(boa_engine::JsError::from_opaque(
|
return Err(boa_engine::JsError::from_opaque(
|
||||||
JsString::from("Maximum output size exceeded").into(),
|
JsString::from("Maximum output size exceeded").into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
logged_bytes.set(new_size);
|
*size = new_size;
|
||||||
entries.push((level.into(), data.into()));
|
drop(size);
|
||||||
|
outputs_clone.lock().push((level.into(), data.into()));
|
||||||
Ok(JsValue::undefined())
|
Ok(JsValue::undefined())
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -132,14 +151,16 @@ fn eval_script(script: &str, config_json: &serde_json::Value, name: &String) ->
|
|||||||
return bail(format!("failed to bind config for script: {err}"));
|
return bail(format!("failed to bind config for script: {err}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(escaped_profile_name) = escape_profile_name(name) else {
|
// 仅处理 name 参数中的特殊字符
|
||||||
|
let safe_name = escape_js_string_for_single_quote(name);
|
||||||
|
if safe_name.len() > 1024 {
|
||||||
return bail("Name parameter too long".to_owned());
|
return bail("Name parameter too long".to_owned());
|
||||||
};
|
}
|
||||||
|
|
||||||
let code = format!(
|
let code = format!(
|
||||||
r"try{{
|
r"try{{
|
||||||
{script};
|
{script};
|
||||||
main(globalThis.__verge_config__,'{escaped_profile_name}')
|
main(globalThis.__verge_config__,'{safe_name}')
|
||||||
}} catch(err) {{
|
}} catch(err) {{
|
||||||
`__error_flag__ ${{err.toString()}}`
|
`__error_flag__ ${{err.toString()}}`
|
||||||
}}"
|
}}"
|
||||||
@@ -193,7 +214,7 @@ fn eval_script(script: &str, config_json: &serde_json::Value, name: &String) ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
match serde_json::from_value::<Mapping>(result) {
|
match serde_json::from_value::<Mapping>(result) {
|
||||||
Ok(config) => (Ok(config), take_logs()),
|
Ok(config) => (Ok(use_lowercase(config)), outputs.lock().to_vec()),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
logging!(
|
logging!(
|
||||||
error,
|
error,
|
||||||
@@ -214,92 +235,21 @@ fn json_approx_size(value: &serde_json::Value) -> usize {
|
|||||||
.map(|(key, value)| key.len() + 4 + json_approx_size(value))
|
.map(|(key, value)| key.len() + 4 + json_approx_size(value))
|
||||||
.sum(),
|
.sum(),
|
||||||
serde_json::Value::Array(items) => items.iter().map(json_approx_size).sum(),
|
serde_json::Value::Array(items) => items.iter().map(json_approx_size).sum(),
|
||||||
serde_json::Value::Number(n) => {
|
serde_json::Value::Number(n) => n.to_string().len(),
|
||||||
if let Some(n) = n.as_u64() {
|
|
||||||
n.checked_ilog10().unwrap_or(0) as usize + 1
|
|
||||||
} else if let Some(n) = n.as_i64() {
|
|
||||||
n.unsigned_abs().checked_ilog10().unwrap_or(0) as usize + 2
|
|
||||||
} else {
|
|
||||||
n.to_string().len()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
serde_json::Value::Bool(_) | serde_json::Value::Null => 4,
|
serde_json::Value::Bool(_) | serde_json::Value::Null => 4,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn escape_profile_name(name: &str) -> Option<String> {
|
// 安全地转义字符串
|
||||||
if name.len() > MAX_PROFILE_NAME_BYTES {
|
fn escape_js_string_for_single_quote(s: &str) -> String {
|
||||||
return None;
|
// 限制处理的字符串长度
|
||||||
|
if s.len() > 10240 {
|
||||||
|
return s[..10240].replace('\\', "\\\\").replace('\'', "\\'").into();
|
||||||
}
|
}
|
||||||
let escaped = name
|
|
||||||
.replace('\\', "\\\\")
|
s.replace('\\', "\\\\")
|
||||||
.replace('\'', "\\'")
|
.replace('\'', "\\'")
|
||||||
.replace('\n', "\\n")
|
.replace('\n', "\\n") // 添加换行符转义
|
||||||
.replace('\r', "\\r");
|
.replace('\r', "\\r") // 添加回车转义
|
||||||
(escaped.len() <= MAX_PROFILE_NAME_BYTES).then(|| escaped.into())
|
.into()
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::{MainDeclaration, eval_script, validate};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn profile_name_limit_counts_escaped_bytes() {
|
|
||||||
assert!(super::escape_profile_name(&"订阅".repeat(171)).is_none());
|
|
||||||
assert!(super::escape_profile_name(&"'".repeat(512)).is_some());
|
|
||||||
assert!(super::escape_profile_name(&"'".repeat(513)).is_none());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn numeric_size_matches_the_rendered_number() {
|
|
||||||
for number in [
|
|
||||||
0.into(),
|
|
||||||
10.into(),
|
|
||||||
(-10).into(),
|
|
||||||
i64::MIN.into(),
|
|
||||||
u64::MAX.into(),
|
|
||||||
serde_json::json!(1.25),
|
|
||||||
] {
|
|
||||||
assert_eq!(super::json_approx_size(&number), number.to_string().len());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn console_entries_survive_a_script_error() {
|
|
||||||
let (result, logs) = eval_script(
|
|
||||||
"function main() { console.log(1); console.warn(2); throw Error(); }",
|
|
||||||
&serde_json::json!({}),
|
|
||||||
&"profile".into(),
|
|
||||||
);
|
|
||||||
assert!(result.is_err());
|
|
||||||
assert_eq!(logs, [("log".into(), "1".into()), ("warn".into(), "2".into())]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn validation_checks_the_evaluated_main_binding() {
|
|
||||||
assert_eq!(
|
|
||||||
validate("const main = config => config;"),
|
|
||||||
Ok(MainDeclaration::Present)
|
|
||||||
);
|
|
||||||
assert_eq!(validate("// function main goes here"), Ok(MainDeclaration::Missing));
|
|
||||||
assert_eq!(validate("const main = 42;"), Ok(MainDeclaration::Missing));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn validation_supports_console_methods_at_top_level() {
|
|
||||||
assert_eq!(
|
|
||||||
validate("console.warn('setup'); console.table([1]); function main(config) { return config; }"),
|
|
||||||
Ok(MainDeclaration::Present)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn validation_distinguishes_missing_main_from_evaluation_failure() {
|
|
||||||
assert_eq!(
|
|
||||||
validate("console.log('setup'); const main = config => config;"),
|
|
||||||
Ok(MainDeclaration::Present)
|
|
||||||
);
|
|
||||||
assert_eq!(validate("console.log('setup');"), Ok(MainDeclaration::Missing));
|
|
||||||
assert!(validate("throw new Error('setup failed'); function main(config) { return config; }").is_err());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_yaml_ng::{Mapping, Sequence, Value};
|
use serde_yaml_ng::{Mapping, Sequence, Value};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use tristr::TriStr;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||||
pub struct SeqMap {
|
pub struct SeqMap {
|
||||||
@@ -10,12 +9,14 @@ pub struct SeqMap {
|
|||||||
pub delete: Vec<String>,
|
pub delete: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn proxy_name(proxy: &Value) -> Option<&str> {
|
fn collect_proxy_names(seq: &Sequence) -> Vec<String> {
|
||||||
match proxy {
|
seq.iter()
|
||||||
Value::Mapping(proxy) => proxy.get("name").and_then(Value::as_str),
|
.filter_map(|item| match item {
|
||||||
Value::String(name) => Some(name),
|
Value::Mapping(map) => map.get("name").and_then(Value::as_str).map(str::to_owned),
|
||||||
|
Value::String(name) => Some(name.to_owned()),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
})
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_selector_group(group_map: &Mapping) -> bool {
|
fn is_selector_group(group_map: &Mapping) -> bool {
|
||||||
@@ -33,34 +34,41 @@ pub fn use_seq(seq: SeqMap, mut config: Mapping, field: &str) -> Mapping {
|
|||||||
} = seq;
|
} = seq;
|
||||||
|
|
||||||
let added_proxy_names = if field == "proxies" {
|
let added_proxy_names = if field == "proxies" {
|
||||||
prepend
|
let mut names = collect_proxy_names(&prepend);
|
||||||
.iter()
|
names.extend(collect_proxy_names(&append));
|
||||||
.chain(&append)
|
let mut seen = HashSet::new();
|
||||||
.filter_map(proxy_name)
|
names
|
||||||
.map(TriStr::from)
|
.into_iter()
|
||||||
.collect::<Vec<_>>()
|
.filter(|name| seen.insert(name.clone()))
|
||||||
|
.collect::<Vec<String>>()
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut updated_items = match config.remove(field) {
|
let mut updated_items = Sequence::new();
|
||||||
Some(Value::Sequence(items)) => items,
|
updated_items.extend(prepend);
|
||||||
_ => Sequence::new(),
|
|
||||||
};
|
if let Some(Value::Sequence(existing_items)) = config.remove(field) {
|
||||||
if !delete.is_empty() {
|
// Filter out deleted items
|
||||||
updated_items.retain(|item| {
|
let kept_items: Sequence = existing_items
|
||||||
let name = match item {
|
.into_iter()
|
||||||
Value::String(name) => Some(name),
|
.filter(|item| {
|
||||||
Value::Mapping(mapping) => match mapping.get("name") {
|
if let Value::String(s) = item {
|
||||||
Some(Value::String(name)) => Some(name),
|
!delete.contains(s)
|
||||||
_ => None,
|
} else if let Value::Mapping(m) = item {
|
||||||
},
|
if let Some(Value::String(name)) = m.get("name") {
|
||||||
_ => None,
|
!delete.contains(name)
|
||||||
};
|
} else {
|
||||||
name.is_none_or(|name| !delete.contains(name))
|
true
|
||||||
});
|
|
||||||
}
|
}
|
||||||
updated_items.splice(..0, prepend);
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
updated_items.extend(kept_items);
|
||||||
|
}
|
||||||
|
|
||||||
updated_items.extend(append);
|
updated_items.extend(append);
|
||||||
config.insert(Value::String(field.into()), Value::Sequence(updated_items));
|
config.insert(Value::String(field.into()), Value::Sequence(updated_items));
|
||||||
|
|
||||||
@@ -72,23 +80,28 @@ pub fn use_seq(seq: SeqMap, mut config: Mapping, field: &str) -> Mapping {
|
|||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Value::Sequence(mut proxy_groups) = proxy_groups_value else {
|
let Value::Sequence(proxy_groups) = proxy_groups_value else {
|
||||||
config.insert(Value::String("proxy-groups".into()), proxy_groups_value);
|
config.insert(Value::String("proxy-groups".into()), proxy_groups_value);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut updated_groups = Sequence::new();
|
||||||
let mut appended_to_selector = false;
|
let mut appended_to_selector = false;
|
||||||
for group in &mut proxy_groups {
|
for group in proxy_groups {
|
||||||
let Value::Mapping(group_map) = group else {
|
if let Value::Mapping(mut group_map) = group {
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let mut group_proxies = match group_map.remove("proxies") {
|
let mut group_proxies = match group_map.remove("proxies") {
|
||||||
Some(Value::Sequence(mut proxies)) => {
|
Some(Value::Sequence(proxies)) => Some(
|
||||||
if !delete.is_empty() {
|
proxies
|
||||||
proxies.retain(|member| !matches!(member, Value::String(name) if delete.contains(name)));
|
.into_iter()
|
||||||
}
|
.filter(|p| {
|
||||||
Some(proxies)
|
if let Value::String(name) = p {
|
||||||
|
!delete.contains(name)
|
||||||
|
} else {
|
||||||
|
true
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.collect::<Sequence>(),
|
||||||
|
),
|
||||||
Some(value) => {
|
Some(value) => {
|
||||||
group_map.insert(Value::String("proxies".into()), value);
|
group_map.insert(Value::String("proxies".into()), value);
|
||||||
None
|
None
|
||||||
@@ -96,18 +109,18 @@ pub fn use_seq(seq: SeqMap, mut config: Mapping, field: &str) -> Mapping {
|
|||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
if !appended_to_selector && !added_proxy_names.is_empty() && is_selector_group(group_map) {
|
if !appended_to_selector && !added_proxy_names.is_empty() && is_selector_group(&group_map) {
|
||||||
let base_group_proxies = group_proxies.unwrap_or_else(Sequence::new);
|
let base_group_proxies = group_proxies.unwrap_or_else(Sequence::new);
|
||||||
let mut merged_proxies = Sequence::new();
|
let mut merged_proxies = Sequence::new();
|
||||||
let mut seen_proxy_names = HashSet::new();
|
let mut seen_proxy_names = HashSet::new();
|
||||||
for name in &added_proxy_names {
|
for name in &added_proxy_names {
|
||||||
if seen_proxy_names.insert(name.clone()) {
|
if seen_proxy_names.insert(name.clone()) {
|
||||||
merged_proxies.push(Value::String(name.as_str().to_owned()));
|
merged_proxies.push(Value::String(name.clone()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for value in base_group_proxies {
|
for value in base_group_proxies {
|
||||||
if let Value::String(name) = &value
|
if let Value::String(name) = &value
|
||||||
&& !seen_proxy_names.insert(TriStr::from(name.as_str()))
|
&& !seen_proxy_names.insert(name.to_owned())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -121,8 +134,12 @@ pub fn use_seq(seq: SeqMap, mut config: Mapping, field: &str) -> Mapping {
|
|||||||
if let Some(group_proxies) = group_proxies {
|
if let Some(group_proxies) = group_proxies {
|
||||||
group_map.insert(Value::String("proxies".into()), Value::Sequence(group_proxies));
|
group_map.insert(Value::String("proxies".into()), Value::Sequence(group_proxies));
|
||||||
}
|
}
|
||||||
|
updated_groups.push(Value::Mapping(group_map));
|
||||||
|
} else {
|
||||||
|
updated_groups.push(group);
|
||||||
}
|
}
|
||||||
config.insert(Value::String("proxy-groups".into()), Value::Sequence(proxy_groups));
|
}
|
||||||
|
config.insert(Value::String("proxy-groups".into()), Value::Sequence(updated_groups));
|
||||||
|
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,9 @@ pub fn use_tun(mut config: Mapping, enable: bool) -> Mapping {
|
|||||||
revise!(dns_val, "fake-ip-range", "198.18.0.1/16");
|
revise!(dns_val, "fake-ip-range", "198.18.0.1/16");
|
||||||
}
|
}
|
||||||
|
|
||||||
super::ensure_fake_ip_range6(&mut dns_val);
|
if ipv6_val && !dns_val.contains_key(Value::from("fake-ip-range6")) {
|
||||||
|
revise!(dns_val, "fake-ip-range6", "2001:2::0/64");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
revise!(config, "dns", dns_val);
|
revise!(config, "dns", dns_val);
|
||||||
@@ -43,20 +45,3 @@ pub fn use_tun(mut config: Mapping, enable: bool) -> Mapping {
|
|||||||
|
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) const DEFAULT_MTU: u16 = 1500;
|
|
||||||
|
|
||||||
/// Saved dialog fields; `enable` belongs to the verge switch.
|
|
||||||
pub(super) const GUI_KEYS: &[&str] = &[
|
|
||||||
"stack",
|
|
||||||
"device",
|
|
||||||
"auto-route",
|
|
||||||
"route-exclude-address",
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
"auto-redirect",
|
|
||||||
"auto-detect-interface",
|
|
||||||
"dns-hijack",
|
|
||||||
"dns-mode",
|
|
||||||
"strict-route",
|
|
||||||
"mtu",
|
|
||||||
];
|
|
||||||
@@ -9,7 +9,6 @@ mod icon;
|
|||||||
mod listener;
|
mod listener;
|
||||||
mod profile;
|
mod profile;
|
||||||
mod proxy;
|
mod proxy;
|
||||||
pub(crate) mod proxy_view;
|
|
||||||
mod subscription;
|
mod subscription;
|
||||||
mod tun;
|
mod tun;
|
||||||
mod window;
|
mod window;
|
||||||
|
|||||||
@@ -1,170 +0,0 @@
|
|||||||
mod groups;
|
|
||||||
|
|
||||||
use clash_verge_proxy_view::{
|
|
||||||
DelayHistory, ProviderSnapshot, ProxyCapabilities, ProxyProviderVehicleType, ProxySnapshot, ProxySubscriptionInfo,
|
|
||||||
ProxyViewInput, ProxyViewV1,
|
|
||||||
};
|
|
||||||
use serde_yaml_ng::Mapping;
|
|
||||||
use std::future::Future;
|
|
||||||
use tauri_plugin_mihomo::{
|
|
||||||
Result,
|
|
||||||
models::{Proxies, Proxy, ProxyProvider, ProxyProviders, ProxyType, VehicleType},
|
|
||||||
};
|
|
||||||
|
|
||||||
pub(crate) async fn load_proxy_view(
|
|
||||||
config: Option<&Mapping>,
|
|
||||||
proxies: impl Future<Output = Result<Proxies>>,
|
|
||||||
providers: impl Future<Output = Result<ProxyProviders>>,
|
|
||||||
) -> Result<ProxyViewV1> {
|
|
||||||
let (runtime_group_order, group_scopes) = groups::runtime_groups(config);
|
|
||||||
let (proxies, providers) = tokio::join!(proxies, providers);
|
|
||||||
let proxies = proxies?;
|
|
||||||
|
|
||||||
Ok(ProxyViewInput {
|
|
||||||
runtime_group_order,
|
|
||||||
group_scopes,
|
|
||||||
proxies: proxies
|
|
||||||
.proxies
|
|
||||||
.into_iter()
|
|
||||||
.map(|(name, proxy)| (name.into(), proxy_snapshot(proxy)))
|
|
||||||
.collect(),
|
|
||||||
providers: providers.ok().map(|providers| {
|
|
||||||
providers
|
|
||||||
.providers
|
|
||||||
.into_iter()
|
|
||||||
.filter_map(|(name, provider)| provider_snapshot(provider).map(|snapshot| (name.into(), snapshot)))
|
|
||||||
.collect()
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
.into_view())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn proxy_snapshot(proxy: Proxy) -> ProxySnapshot {
|
|
||||||
ProxySnapshot {
|
|
||||||
name: proxy.name.into(),
|
|
||||||
proxy_type: match proxy.proxy_type {
|
|
||||||
ProxyType::Unknown(value) => value.into(),
|
|
||||||
proxy_type => proxy_type.as_str().into(),
|
|
||||||
},
|
|
||||||
all: proxy.all.map(|all| all.into_iter().map(Into::into).collect()),
|
|
||||||
fixed: proxy.fixed.map(Into::into),
|
|
||||||
hidden: proxy.hidden,
|
|
||||||
icon: proxy.icon.map(Into::into),
|
|
||||||
now: proxy.now.map(Into::into),
|
|
||||||
test_url: proxy.test_url.map(Into::into),
|
|
||||||
id: proxy.id.map(Into::into),
|
|
||||||
history: proxy
|
|
||||||
.history
|
|
||||||
.into_iter()
|
|
||||||
.map(|entry| DelayHistory {
|
|
||||||
time: entry.time.into(),
|
|
||||||
delay: entry.delay,
|
|
||||||
})
|
|
||||||
.collect(),
|
|
||||||
capabilities: ProxyCapabilities {
|
|
||||||
udp: proxy.udp,
|
|
||||||
xudp: proxy.xudp,
|
|
||||||
tfo: proxy.tfo,
|
|
||||||
mptcp: proxy.mptcp,
|
|
||||||
smux: proxy.smux,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn provider_snapshot(provider: ProxyProvider) -> Option<ProviderSnapshot> {
|
|
||||||
let vehicle_type = match provider.vehicle_type {
|
|
||||||
VehicleType::HTTP => ProxyProviderVehicleType::Http,
|
|
||||||
VehicleType::File => ProxyProviderVehicleType::File,
|
|
||||||
VehicleType::Inline => ProxyProviderVehicleType::Inline,
|
|
||||||
_ => return None,
|
|
||||||
};
|
|
||||||
|
|
||||||
Some(ProviderSnapshot {
|
|
||||||
vehicle_type,
|
|
||||||
proxies: provider.proxies.into_iter().map(proxy_snapshot).collect(),
|
|
||||||
updated_at: provider.updated_at.map(Into::into),
|
|
||||||
subscription_info: provider.subscription_info.map(|info| ProxySubscriptionInfo {
|
|
||||||
upload: info.upload,
|
|
||||||
download: info.download,
|
|
||||||
total: info.total,
|
|
||||||
expire: info.expire,
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use clash_verge_proxy_view::{
|
|
||||||
ProxyMemberRef, ProxyMemberUnresolvedReason, ProxyNodeSource, ProxyViewProviderState,
|
|
||||||
};
|
|
||||||
use std::future::ready;
|
|
||||||
use tauri_plugin_mihomo::Error;
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn preserves_scoped_members_and_global_when_providers_are_unavailable() -> anyhow::Result<()> {
|
|
||||||
let config = serde_yaml_ng::from_str(
|
|
||||||
"proxy-providers: {z: {}, a: {}}\n\
|
|
||||||
proxy-groups:\n\
|
|
||||||
- {name: GLOBAL}\n\
|
|
||||||
- {name: Select, use: [a]}\n\
|
|
||||||
- {name: Another}\n\
|
|
||||||
- {name: Select, use: [a], include-all-providers: true, exclude-type: Direct}",
|
|
||||||
)?;
|
|
||||||
let proxies = r#"{"proxies":{
|
|
||||||
"GLOBAL":{"type":"Selector","all":["Select"]},
|
|
||||||
"Select":{"type":"Selector","all":["shared"]},
|
|
||||||
"Another":{"type":"Selector","all":[]}
|
|
||||||
}}"#;
|
|
||||||
let providers = serde_json::from_str(
|
|
||||||
r#"{"providers":{
|
|
||||||
"a":{"vehicleType":"HTTP","proxies":[{"name":"shared","type":"Direct"}]},
|
|
||||||
"z":{"vehicleType":"File","proxies":[{"name":"shared","type":"Shadowsocks"}]}
|
|
||||||
}}"#,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
let available = load_proxy_view(
|
|
||||||
Some(&config),
|
|
||||||
ready(Ok(serde_json::from_str(proxies)?)),
|
|
||||||
ready(Ok(providers)),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
let unavailable = load_proxy_view(
|
|
||||||
Some(&config),
|
|
||||||
ready(Ok(serde_json::from_str(proxies)?)),
|
|
||||||
ready(Err(Error::FailedResponse("providers unavailable".into()))),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
for view in [&available, &unavailable] {
|
|
||||||
assert_eq!(
|
|
||||||
view.global.as_ref().map(|global| global.members.as_slice()),
|
|
||||||
Some([ProxyMemberRef::Group { name: "Select".into() }].as_slice())
|
|
||||||
);
|
|
||||||
assert_eq!(view.groups.len(), 2);
|
|
||||||
assert_eq!(view.groups[1].name.as_str(), "Another");
|
|
||||||
assert_eq!(view.groups[0].name.as_str(), "Select");
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_eq!(available.provider_state, ProxyViewProviderState::Ready);
|
|
||||||
let [ProxyMemberRef::Node { record_id, .. }] = available.groups[0].members.as_slice() else {
|
|
||||||
anyhow::bail!("expected the scoped provider member");
|
|
||||||
};
|
|
||||||
assert_eq!(
|
|
||||||
available.records.get(record_id).map(|record| &record.source),
|
|
||||||
Some(&ProxyNodeSource::Provider {
|
|
||||||
provider_name: "z".into(),
|
|
||||||
proxy_name: "shared".into(),
|
|
||||||
})
|
|
||||||
);
|
|
||||||
assert_eq!(unavailable.provider_state, ProxyViewProviderState::Unavailable);
|
|
||||||
assert_eq!(
|
|
||||||
unavailable.groups[0].members,
|
|
||||||
[ProxyMemberRef::Unresolved {
|
|
||||||
name: "shared".into(),
|
|
||||||
reason: ProxyMemberUnresolvedReason::ProviderUnavailable,
|
|
||||||
}]
|
|
||||||
);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
use clash_verge_proxy_view::GroupScope;
|
|
||||||
use serde_yaml_ng::Mapping;
|
|
||||||
use std::collections::BTreeMap;
|
|
||||||
use tristr::alias::String as ViewString;
|
|
||||||
|
|
||||||
pub(super) fn runtime_groups(config: Option<&Mapping>) -> (Vec<ViewString>, BTreeMap<ViewString, GroupScope>) {
|
|
||||||
let mut order = Vec::new();
|
|
||||||
let mut scopes = BTreeMap::new();
|
|
||||||
let Some(config) = config else { return (order, scopes) };
|
|
||||||
let Some(groups) = config.get("proxy-groups").and_then(|groups| groups.as_sequence()) else {
|
|
||||||
return (order, scopes);
|
|
||||||
};
|
|
||||||
let mut all_providers = None;
|
|
||||||
let flag = |group: &Mapping, key: &str| group.get(key).and_then(|value| value.as_bool()) == Some(true);
|
|
||||||
|
|
||||||
for group in groups.iter().filter_map(|group| group.as_mapping()) {
|
|
||||||
let Some(name) = group.get("name").and_then(|name| name.as_str()) else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let name = ViewString::from(name);
|
|
||||||
// Mihomo sorts all providers when either flag replaces the explicit use list.
|
|
||||||
let providers = if flag(group, "include-all") || flag(group, "include-all-providers") {
|
|
||||||
all_providers
|
|
||||||
.get_or_insert_with(|| {
|
|
||||||
let mut names = config
|
|
||||||
.get("proxy-providers")
|
|
||||||
.and_then(|providers| providers.as_mapping())
|
|
||||||
.into_iter()
|
|
||||||
.flat_map(|providers| providers.keys())
|
|
||||||
.filter_map(|name| name.as_str())
|
|
||||||
.map(ViewString::from)
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
names.sort();
|
|
||||||
names
|
|
||||||
})
|
|
||||||
.clone()
|
|
||||||
} else {
|
|
||||||
group
|
|
||||||
.get("use")
|
|
||||||
.and_then(|providers| providers.as_sequence())
|
|
||||||
.into_iter()
|
|
||||||
.flatten()
|
|
||||||
.filter_map(|provider| provider.as_str())
|
|
||||||
.map(ViewString::from)
|
|
||||||
.collect()
|
|
||||||
};
|
|
||||||
let exclude_types = group
|
|
||||||
.get("exclude-type")
|
|
||||||
.and_then(|types| types.as_str())
|
|
||||||
.filter(|types| !types.is_empty())
|
|
||||||
.map_or_default(|types| types.split('|').map(ViewString::from).collect());
|
|
||||||
let scope = GroupScope {
|
|
||||||
providers,
|
|
||||||
exclude_types,
|
|
||||||
};
|
|
||||||
if scopes.insert(name.clone(), scope).is_none() && !name.is_empty() && name != "GLOBAL" {
|
|
||||||
order.push(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(order, scopes)
|
|
||||||
}
|
|
||||||
@@ -165,6 +165,12 @@ impl From<network_interface::NetworkInterface> for NetworkInterfaceView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize, specta::Type)]
|
||||||
|
pub struct DelayHistory {
|
||||||
|
pub time: String,
|
||||||
|
pub delay: u16,
|
||||||
|
}
|
||||||
|
|
||||||
fn platform_types() -> specta::Types {
|
fn platform_types() -> specta::Types {
|
||||||
use specta::datatype::{DataType, Fields};
|
use specta::datatype::{DataType, Fields};
|
||||||
let mut types = specta::Types::default().register::<crate::config::IVerge>();
|
let mut types = specta::Types::default().register::<crate::config::IVerge>();
|
||||||
|
|||||||
@@ -21,3 +21,4 @@ pub mod tmpl;
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub mod tray_speed;
|
pub mod tray_speed;
|
||||||
pub mod window_manager;
|
pub mod window_manager;
|
||||||
|
pub mod yaml_emitter;
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ pub const ITEM_MERGE_EMPTY: &str = "# Profile Enhancement Merge Template for Cla
|
|||||||
|
|
||||||
";
|
";
|
||||||
|
|
||||||
pub use clash_verge_config_render::ITEM_SCRIPT;
|
pub const ITEM_SCRIPT: &str = "// Define main function (script entry)
|
||||||
|
|
||||||
|
function main(config, profileName) {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
";
|
||||||
|
|
||||||
pub const ITEM_RULES: &str = "# Profile Enhancement Rules Template for Clash Verge
|
pub const ITEM_RULES: &str = "# Profile Enhancement Rules Template for Clash Verge
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_yaml_ng::Result;
|
use serde_yaml_ng::Result;
|
||||||
|
|
||||||
pub(crate) use serde_yaml_ng::to_string as serialize;
|
pub fn to_mihomo_config_string<T: Serialize>(data: &T) -> Result<String> {
|
||||||
|
let yaml = serde_yaml_ng::to_string(data)?;
|
||||||
pub(crate) fn serialize_for_export<T: Serialize>(data: &T) -> Result<String> {
|
Ok(quote_fake_ip_filter_wildcards(&yaml))
|
||||||
Ok(quote_fake_ip_filter_wildcards(&serialize(data)?))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn quote_fake_ip_filter_wildcards(yaml: &str) -> String {
|
fn quote_fake_ip_filter_wildcards(yaml: &str) -> String {
|
||||||
@@ -13,7 +12,7 @@ fn quote_fake_ip_filter_wildcards(yaml: &str) -> String {
|
|||||||
let mut fake_ip_filter_indent = 0;
|
let mut fake_ip_filter_indent = 0;
|
||||||
|
|
||||||
for line in yaml.lines() {
|
for line in yaml.lines() {
|
||||||
let indent = line.len() - line.trim_start_matches(' ').len();
|
let indent = leading_spaces(line);
|
||||||
let trimmed = &line[indent..];
|
let trimmed = &line[indent..];
|
||||||
|
|
||||||
if in_fake_ip_filter && indent <= fake_ip_filter_indent && !trimmed.starts_with("- ") {
|
if in_fake_ip_filter && indent <= fake_ip_filter_indent && !trimmed.starts_with("- ") {
|
||||||
@@ -23,47 +22,54 @@ fn quote_fake_ip_filter_wildcards(yaml: &str) -> String {
|
|||||||
if !in_fake_ip_filter && trimmed == "fake-ip-filter:" {
|
if !in_fake_ip_filter && trimmed == "fake-ip-filter:" {
|
||||||
in_fake_ip_filter = true;
|
in_fake_ip_filter = true;
|
||||||
fake_ip_filter_indent = indent;
|
fake_ip_filter_indent = indent;
|
||||||
|
result.push_str(line);
|
||||||
|
result.push('\n');
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if in_fake_ip_filter
|
if in_fake_ip_filter && indent >= fake_ip_filter_indent && trimmed.starts_with("- ") {
|
||||||
&& indent >= fake_ip_filter_indent
|
result.push_str(&line[..indent]);
|
||||||
&& let Some(item) = trimmed.strip_prefix("- ")
|
result.push_str("- ");
|
||||||
&& needs_quotes(item)
|
result.push_str("e_wildcard_item(&trimmed[2..]));
|
||||||
{
|
result.push('\n');
|
||||||
result.push_str(&line[..indent + 2]);
|
continue;
|
||||||
push_quoted(&mut result, item);
|
|
||||||
} else {
|
|
||||||
result.push_str(line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.push_str(line);
|
||||||
result.push('\n');
|
result.push('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn needs_quotes(item: &str) -> bool {
|
fn leading_spaces(line: &str) -> usize {
|
||||||
!item.starts_with(['"', '\'']) && (item.contains('*') || item.starts_with(['+', '.']))
|
line.len() - line.trim_start_matches(' ').len()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn push_quoted(output: &mut String, item: &str) {
|
fn quote_wildcard_item(item: &str) -> String {
|
||||||
output.push('\'');
|
if !item.starts_with('\"') && !item.starts_with('\'') && contains_wildcard(item) {
|
||||||
for (index, part) in item.split('\'').enumerate() {
|
quote_string(item)
|
||||||
if index != 0 {
|
} else {
|
||||||
output.push_str("''");
|
item.to_string()
|
||||||
}
|
}
|
||||||
output.push_str(part);
|
|
||||||
}
|
}
|
||||||
output.push('\'');
|
|
||||||
|
fn quote_string(s: &str) -> String {
|
||||||
|
"\'".to_string() + s.replace('\'', "''").as_str() + "\'"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn contains_wildcard(value: &str) -> bool {
|
||||||
|
value.contains('*') || value.starts_with('+') || value.starts_with('.')
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[allow(clippy::expect_used)]
|
#[allow(clippy::expect_used)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::serialize_for_export;
|
use super::to_mihomo_config_string;
|
||||||
|
|
||||||
fn roundtrip(input: &str) {
|
fn roundtrip(input: &str) {
|
||||||
let value: serde_yaml_ng::Value = serde_yaml_ng::from_str(input).expect("input yaml should parse");
|
let value: serde_yaml_ng::Value = serde_yaml_ng::from_str(input).expect("input yaml should parse");
|
||||||
let output = serialize_for_export(&value).expect("yaml should serialize");
|
let output = to_mihomo_config_string(&value).expect("yaml should serialize");
|
||||||
let reparsed: serde_yaml_ng::Value = serde_yaml_ng::from_str(&output).expect("serialized yaml should parse");
|
let reparsed: serde_yaml_ng::Value = serde_yaml_ng::from_str(&output).expect("serialized yaml should parse");
|
||||||
|
|
||||||
assert_eq!(reparsed, value);
|
assert_eq!(reparsed, value);
|
||||||
@@ -84,7 +90,7 @@ dns:
|
|||||||
roundtrip(input);
|
roundtrip(input);
|
||||||
|
|
||||||
let value: serde_yaml_ng::Value = serde_yaml_ng::from_str(input).expect("input yaml should parse");
|
let value: serde_yaml_ng::Value = serde_yaml_ng::from_str(input).expect("input yaml should parse");
|
||||||
let output = serialize_for_export(&value).expect("yaml should serialize");
|
let output = to_mihomo_config_string(&value).expect("yaml should serialize");
|
||||||
|
|
||||||
assert!(output.contains("- '*.lan'"));
|
assert!(output.contains("- '*.lan'"));
|
||||||
assert!(output.contains("- '+.market.xiaomi.com'"));
|
assert!(output.contains("- '+.market.xiaomi.com'"));
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
"chooseFile": "Escolher arquivo"
|
"chooseFile": "Escolher arquivo"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"home": "Site da assinatura",
|
"home": "Início",
|
||||||
"select": "Selecionar",
|
"select": "Selecionar",
|
||||||
"shareQrCode": "Compartilhar QR Code",
|
"shareQrCode": "Compartilhar QR Code",
|
||||||
"editInfo": "Editar informações",
|
"editInfo": "Editar informações",
|
||||||
|
|||||||
Reference in New Issue
Block a user