@vypdev/copilot 3.9.3 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/action.yml +5 -0
- package/build/api/index.js +208 -52
- package/build/api/src/data/model/application_error.d.ts +18 -1
- package/build/api/src/domain/bugbot/context.d.ts +2 -0
- package/build/api/src/domain/bugbot/finding.d.ts +11 -7
- package/build/cli/index.js +1952 -127
- package/build/github_action/index.js +2286 -116
- package/build/web/assets/{index-CsboG2sG.js → index-CNXf8Vmj.js} +1 -1
- package/build/web/index.html +1 -1
- package/package.json +2 -1
- package/setup/actions/copilot-verification-setup/action.yml +13 -0
- package/setup/workflows/copilot_commit.yml +2 -0
- package/setup/workflows/copilot_issue.yml +2 -0
- package/setup/workflows/copilot_issue_comment.yml +20 -106
- package/setup/workflows/copilot_pull_request.yml +2 -0
- package/setup/workflows/copilot_pull_request_comment.yml +20 -106
- package/setup/workflows/copilot_pull_request_review_state.yml +2 -0
- package/setup/workflows/hotfix_workflow.yml +1 -0
- package/setup/workflows/release_workflow.yml +1 -0
|
@@ -36897,6 +36897,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36897
36897
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
36898
36898
|
exports.runGitHubAction = runGitHubAction;
|
|
36899
36899
|
exports.runGitHubActionEntry = runGitHubActionEntry;
|
|
36900
|
+
const native_verification_controller_1 = __nccwpck_require__(71046);
|
|
36900
36901
|
const issue_completion_composition_root_1 = __nccwpck_require__(63719);
|
|
36901
36902
|
const core = __importStar(__nccwpck_require__(75855));
|
|
36902
36903
|
const github = __importStar(__nccwpck_require__(78227));
|
|
@@ -37081,7 +37082,16 @@ async function runGitHubActionEntry(run = runGitHubAction) {
|
|
|
37081
37082
|
catch (cause) {
|
|
37082
37083
|
const semanticError = (0, application_error_1.toApplicationError)(cause, 'workflow.failed', 'GitHub Action execution failed.');
|
|
37083
37084
|
(0, logger_1.logError)(semanticError);
|
|
37084
|
-
|
|
37085
|
+
const message = earlyGithubActionErrorMessage();
|
|
37086
|
+
core.setFailed((0, application_error_presentation_policy_1.renderApplicationErrorText)(semanticError, message));
|
|
37087
|
+
if (semanticError.recovery?.id.startsWith('stored-configuration-')) {
|
|
37088
|
+
try {
|
|
37089
|
+
await (0, github_action_summary_composition_root_1.createGithubActionSummaryCompositionRoot)().publish((0, application_error_presentation_policy_1.renderApplicationErrorMarkdown)(semanticError, message));
|
|
37090
|
+
}
|
|
37091
|
+
catch (summaryCause) {
|
|
37092
|
+
(0, logger_1.logError)((0, application_error_1.toApplicationError)(summaryCause, 'provider.unavailable', 'Unable to publish the configuration failure summary.'));
|
|
37093
|
+
}
|
|
37094
|
+
}
|
|
37085
37095
|
}
|
|
37086
37096
|
});
|
|
37087
37097
|
}
|
|
@@ -37097,7 +37107,7 @@ function earlyGithubActionErrorMessage() {
|
|
|
37097
37107
|
// Only auto-run when executed as the action entry (not when imported by tests)
|
|
37098
37108
|
/* istanbul ignore next -- the bundled production entry is covered by the Action smoke path. */
|
|
37099
37109
|
if (typeof process.env.JEST_WORKER_ID === 'undefined') {
|
|
37100
|
-
void runGitHubActionEntry();
|
|
37110
|
+
void runGitHubActionEntry(() => (0, native_verification_controller_1.runNativeVerificationEntry)(runGitHubActionEntry));
|
|
37101
37111
|
}
|
|
37102
37112
|
|
|
37103
37113
|
|
|
@@ -37522,6 +37532,7 @@ async function buildGithubActionExecution(input) {
|
|
|
37522
37532
|
commitPrefixBuilder: getCommitPrefixBuilder(getInput),
|
|
37523
37533
|
issue: (0, configuration_builders_1.buildIssue)((0, input_boolean_policy_1.parseIssueWorkflowBoolean)(getInput(input_keys_1.INPUT_KEYS.ISSUE_MANAGED_BRANCHES), input_keys_1.INPUT_KEYS.ISSUE_MANAGED_BRANCHES, true), (0, input_boolean_policy_1.isEnabledInput)(getInput(input_keys_1.INPUT_KEYS.REOPEN_ISSUE_ON_PUSH)), (0, input_number_policy_1.parseIntegerInput)(getInput(input_keys_1.INPUT_KEYS.DESIRED_ASSIGNEES_COUNT), 0), eventInputs),
|
|
37524
37534
|
preBranchSdd: (0, input_boolean_policy_1.parseIssueWorkflowBoolean)(getInput(input_keys_1.INPUT_KEYS.PRE_BRANCH_SDD), input_keys_1.INPUT_KEYS.PRE_BRANCH_SDD, false),
|
|
37535
|
+
verificationSetup: (0, input_boolean_policy_1.parseIssueWorkflowBoolean)(getInput(input_keys_1.INPUT_KEYS.VERIFICATION_SETUP), input_keys_1.INPUT_KEYS.VERIFICATION_SETUP, false),
|
|
37525
37536
|
pullRequest: (0, configuration_builders_1.buildPullRequest)((0, input_number_policy_1.parseIntegerInput)(getInput(input_keys_1.INPUT_KEYS.PULL_REQUEST_DESIRED_ASSIGNEES_COUNT), 0), (0, input_number_policy_1.parseIntegerInput)(getInput(input_keys_1.INPUT_KEYS.PULL_REQUEST_DESIRED_REVIEWERS_COUNT), 0), eventInputs),
|
|
37526
37537
|
emoji: (0, configuration_builders_1.buildEmoji)(getInput(input_keys_1.INPUT_KEYS.EMOJI_LABELED_TITLE) === 'true', getInput(input_keys_1.INPUT_KEYS.BRANCH_MANAGEMENT_EMOJI)),
|
|
37527
37538
|
tokens: (0, configuration_builders_1.buildTokens)(token),
|
|
@@ -38737,6 +38748,7 @@ exports.INPUT_KEYS = {
|
|
|
38737
38748
|
// Issue
|
|
38738
38749
|
ISSUE_MANAGED_BRANCHES: 'issue-managed-branches',
|
|
38739
38750
|
PRE_BRANCH_SDD: 'pre-branch-sdd',
|
|
38751
|
+
VERIFICATION_SETUP: 'verification-setup',
|
|
38740
38752
|
REOPEN_ISSUE_ON_PUSH: 'reopen-issue-on-push',
|
|
38741
38753
|
DESIRED_ASSIGNEES_COUNT: 'desired-assignees-count',
|
|
38742
38754
|
// Pull Request
|
|
@@ -38857,6 +38869,46 @@ function approvalDiagnosticError(diagnostic) {
|
|
|
38857
38869
|
}
|
|
38858
38870
|
|
|
38859
38871
|
|
|
38872
|
+
/***/ }),
|
|
38873
|
+
|
|
38874
|
+
/***/ 82937:
|
|
38875
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
38876
|
+
|
|
38877
|
+
"use strict";
|
|
38878
|
+
|
|
38879
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
38880
|
+
exports.BugbotMutationError = void 0;
|
|
38881
|
+
exports.bugbotMutationError = bugbotMutationError;
|
|
38882
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
38883
|
+
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
38884
|
+
class BugbotMutationError extends application_error_1.ApplicationError {
|
|
38885
|
+
constructor(diagnostic) {
|
|
38886
|
+
super(diagnostic.errorCode, `Bugbot ${diagnostic.stage} failed: operation=${diagnostic.operation}; finding=${diagnostic.findingId}; affected=${diagnostic.affectedCount}; ${diagnostic.providerStatus}; provider-reference=${diagnostic.providerReference}. Completed effects are retained; correct the named cause and recheck the same target.`);
|
|
38887
|
+
this.diagnostic = diagnostic;
|
|
38888
|
+
}
|
|
38889
|
+
}
|
|
38890
|
+
exports.BugbotMutationError = BugbotMutationError;
|
|
38891
|
+
function bugbotMutationError(cause, stage, findingIds, fallback, affectedCount = findingIds.length) {
|
|
38892
|
+
if (cause instanceof BugbotMutationError)
|
|
38893
|
+
return cause;
|
|
38894
|
+
const provider = cause instanceof pull_request_review_errors_1.PullRequestReviewOperationError ? cause : undefined;
|
|
38895
|
+
const status = provider?.providerStatus;
|
|
38896
|
+
const errorCode = status === 401 ? 'authorization.credential-invalid' : status === 403 ? 'authorization.denied'
|
|
38897
|
+
: status === 404 ? 'provider.not-found' : status === 409 ? 'provider.conflict'
|
|
38898
|
+
: status === 429 ? 'provider.rate-limited'
|
|
38899
|
+
: status === 408 || status === 425 ? 'provider.unavailable'
|
|
38900
|
+
: status && status < 500 ? 'provider.contract-invalid' : 'provider.unavailable';
|
|
38901
|
+
const first = findingIds[0];
|
|
38902
|
+
return new BugbotMutationError(Object.freeze({
|
|
38903
|
+
stage, operation: provider?.operation ?? fallback,
|
|
38904
|
+
findingId: typeof first === 'string' && /^[A-Za-z0-9_./:-]{1,200}$/.test(first) ? first : 'unavailable',
|
|
38905
|
+
affectedCount: Math.min(affectedCount, 10000),
|
|
38906
|
+
providerStatus: status ? `http-${status}` : 'http-unavailable',
|
|
38907
|
+
providerReference: provider?.providerReference ?? 'unavailable', errorCode,
|
|
38908
|
+
}));
|
|
38909
|
+
}
|
|
38910
|
+
|
|
38911
|
+
|
|
38860
38912
|
/***/ }),
|
|
38861
38913
|
|
|
38862
38914
|
/***/ 12183:
|
|
@@ -40666,7 +40718,26 @@ const SPANISH_CONTENT = Object.freeze({
|
|
|
40666
40718
|
retainedState: PRESERVED_STATE_ES,
|
|
40667
40719
|
}),
|
|
40668
40720
|
});
|
|
40721
|
+
const STORED_CONFIGURATION_ACTION_EN = 'A maintainer must review {recoveryGuide}. Preserve a copy before removing only a verified obsolete unmanaged block. If managed branch, release, hotfix or orchestration state may exist, stop and restore verified supported state with a maintainer. Do not just add a schema version or delete managed state. Correct the configuration before rerunning; retrying unchanged state will fail again.';
|
|
40722
|
+
const STORED_CONFIGURATION_ACTION_ES = 'Un mantenedor debe revisar {recoveryGuide}. Conserva una copia antes de retirar solo un bloque obsoleto confirmado como no gestionado. Si puede existir estado gestionado de ramas, releases, hotfixes u orquestación, detente y restaura estado compatible verificado con un mantenedor. No añadas simplemente una versión de esquema ni borres estado gestionado. Corrige la configuración antes de reejecutar; el mismo estado volverá a fallar.';
|
|
40723
|
+
const STORED_CONFIGURATION_RETAINED_EN = 'The issue/PR description and stored configuration were not changed by this read.';
|
|
40724
|
+
const STORED_CONFIGURATION_RETAINED_ES = 'Esta lectura no modificó la descripción de la issue/PR ni su configuración almacenada.';
|
|
40669
40725
|
const ENGLISH_RECOVERY_CONTENT = Object.freeze({
|
|
40726
|
+
'stored-configuration-schema-missing': Object.freeze({
|
|
40727
|
+
impact: 'Automation stopped for issue/PR #{issueNumber}: the stored configuration has no schema version; version {expectedVersion} is required.',
|
|
40728
|
+
action: STORED_CONFIGURATION_ACTION_EN,
|
|
40729
|
+
retainedState: STORED_CONFIGURATION_RETAINED_EN,
|
|
40730
|
+
}),
|
|
40731
|
+
'stored-configuration-schema-unsupported': Object.freeze({
|
|
40732
|
+
impact: 'Automation stopped for issue/PR #{issueNumber}: stored schema version {actualVersion} is unsupported; version {expectedVersion} is required.',
|
|
40733
|
+
action: STORED_CONFIGURATION_ACTION_EN,
|
|
40734
|
+
retainedState: STORED_CONFIGURATION_RETAINED_EN,
|
|
40735
|
+
}),
|
|
40736
|
+
'stored-configuration-invalid': Object.freeze({
|
|
40737
|
+
impact: 'Automation stopped for issue/PR #{issueNumber}: the stored configuration, markers or schema value are malformed; valid schema version {expectedVersion} is required.',
|
|
40738
|
+
action: STORED_CONFIGURATION_ACTION_EN,
|
|
40739
|
+
retainedState: STORED_CONFIGURATION_RETAINED_EN,
|
|
40740
|
+
}),
|
|
40670
40741
|
'closed-issue-reconciliation-failed': Object.freeze({
|
|
40671
40742
|
impact: 'Issue cleanup remains unverified: {resultId}, phase {phase}; native state {state}, reason {reason}.',
|
|
40672
40743
|
action: 'Inspect the closed-issue or merged-PR run and current native state. Retry cleanup only if the issue is still closed with the intended reason; leave reopened work open. Resolve the named failure before retrying.',
|
|
@@ -40682,6 +40753,26 @@ const ENGLISH_RECOVERY_CONTENT = Object.freeze({
|
|
|
40682
40753
|
action: 'Inspect the rejected paths in the workflow and correct the workspace before retrying.',
|
|
40683
40754
|
retainedState: 'The normal commit and push steps were skipped. Verify the current state before retrying.',
|
|
40684
40755
|
}),
|
|
40756
|
+
'sdd-draft-case-identity-invalid': Object.freeze({
|
|
40757
|
+
impact: 'SDD publication stopped after one automatic repair: case IDs collide with an owning SDD or are ambiguous.',
|
|
40758
|
+
action: 'Review the draft tables; use distinct fully qualified case IDs and preserve the baseline inventory. Retry the same issue workflow.',
|
|
40759
|
+
retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
|
|
40760
|
+
}),
|
|
40761
|
+
'sdd-draft-case-budget-invalid': Object.freeze({
|
|
40762
|
+
impact: 'SDD publication stopped after one automatic repair: per-area allocations disagree with the distinct case inventory.',
|
|
40763
|
+
action: 'Review the draft tables; reconcile each area and the total with the enumerated cases. Retry the same issue workflow.',
|
|
40764
|
+
retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
|
|
40765
|
+
}),
|
|
40766
|
+
'sdd-draft-requirement-mapping-invalid': Object.freeze({
|
|
40767
|
+
impact: 'SDD publication stopped after one automatic repair: requirements and case mappings are incomplete or inconsistent.',
|
|
40768
|
+
action: 'Review the draft tables; map every requirement to defined cases and match the reverse links. Retry the same issue workflow.',
|
|
40769
|
+
retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
|
|
40770
|
+
}),
|
|
40771
|
+
'sdd-draft-repository-path-invalid': Object.freeze({
|
|
40772
|
+
impact: 'SDD publication stopped after one automatic repair: cited repository paths cannot be verified at the immutable base.',
|
|
40773
|
+
action: 'Review the draft tables; correct existing paths or explicitly declare intended new files. Retry the same issue workflow.',
|
|
40774
|
+
retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
|
|
40775
|
+
}),
|
|
40685
40776
|
'sdd-draft-format-invalid': Object.freeze({
|
|
40686
40777
|
impact: 'SDD preparation stopped because the draft still lacked required headings or a numeric test budget after one automatic repair.',
|
|
40687
40778
|
action: 'Retry SDD preparation with the canonical specification template and the explicit acceptance requirements.',
|
|
@@ -40744,6 +40835,21 @@ const ENGLISH_RECOVERY_CONTENT = Object.freeze({
|
|
|
40744
40835
|
}),
|
|
40745
40836
|
});
|
|
40746
40837
|
const SPANISH_RECOVERY_CONTENT = Object.freeze({
|
|
40838
|
+
'stored-configuration-schema-missing': Object.freeze({
|
|
40839
|
+
impact: 'La automatización se detuvo para la issue/PR #{issueNumber}: la configuración almacenada no tiene versión de esquema; se requiere la versión {expectedVersion}.',
|
|
40840
|
+
action: STORED_CONFIGURATION_ACTION_ES,
|
|
40841
|
+
retainedState: STORED_CONFIGURATION_RETAINED_ES,
|
|
40842
|
+
}),
|
|
40843
|
+
'stored-configuration-schema-unsupported': Object.freeze({
|
|
40844
|
+
impact: 'La automatización se detuvo para la issue/PR #{issueNumber}: la versión de esquema almacenada {actualVersion} no es compatible; se requiere la versión {expectedVersion}.',
|
|
40845
|
+
action: STORED_CONFIGURATION_ACTION_ES,
|
|
40846
|
+
retainedState: STORED_CONFIGURATION_RETAINED_ES,
|
|
40847
|
+
}),
|
|
40848
|
+
'stored-configuration-invalid': Object.freeze({
|
|
40849
|
+
impact: 'La automatización se detuvo para la issue/PR #{issueNumber}: la configuración almacenada, sus delimitadores o el valor del esquema no son válidos; se requiere un esquema válido de versión {expectedVersion}.',
|
|
40850
|
+
action: STORED_CONFIGURATION_ACTION_ES,
|
|
40851
|
+
retainedState: STORED_CONFIGURATION_RETAINED_ES,
|
|
40852
|
+
}),
|
|
40747
40853
|
'closed-issue-reconciliation-failed': Object.freeze({
|
|
40748
40854
|
impact: 'La limpieza de la issue sigue sin verificarse: {resultId}, fase {phase}; estado nativo {state}, motivo {reason}.',
|
|
40749
40855
|
action: 'Revisa la ejecución de cierre o de la PR fusionada y el estado nativo actual. Reintenta la limpieza solo si la issue sigue cerrada con el motivo previsto; conserva abierto el trabajo reabierto. Resuelve el fallo indicado antes de reintentar.',
|
|
@@ -40759,6 +40865,26 @@ const SPANISH_RECOVERY_CONTENT = Object.freeze({
|
|
|
40759
40865
|
action: 'Revisa las rutas rechazadas en la ejecución y corrige el espacio de trabajo antes de reintentar.',
|
|
40760
40866
|
retainedState: 'Se omitieron los pasos normales de commit y push. Comprueba el estado actual antes de reintentar.',
|
|
40761
40867
|
}),
|
|
40868
|
+
'sdd-draft-case-identity-invalid': Object.freeze({
|
|
40869
|
+
impact: 'La publicación del SDD se detuvo tras un intento automático de corrección: los identificadores de casos coinciden con un SDD existente o son ambiguos.',
|
|
40870
|
+
action: 'Revisa las tablas del borrador; usa identificadores completos y distintos y conserva el inventario original. Reintenta el workflow de la misma incidencia.',
|
|
40871
|
+
retainedState: 'Se conservaron las respuestas y los SDD publicados; no se publicó ningún borrador. Estas comprobaciones no demuestran la aceptación en ejecución.',
|
|
40872
|
+
}),
|
|
40873
|
+
'sdd-draft-case-budget-invalid': Object.freeze({
|
|
40874
|
+
impact: 'La publicación del SDD se detuvo tras un intento automático de corrección: las asignaciones por área no coinciden con el inventario de casos distintos.',
|
|
40875
|
+
action: 'Revisa las tablas del borrador; reconcilia cada área y el total con los casos enumerados. Reintenta el workflow de la misma incidencia.',
|
|
40876
|
+
retainedState: 'Se conservaron las respuestas y los SDD publicados; no se publicó ningún borrador. Estas comprobaciones no demuestran la aceptación en ejecución.',
|
|
40877
|
+
}),
|
|
40878
|
+
'sdd-draft-requirement-mapping-invalid': Object.freeze({
|
|
40879
|
+
impact: 'La publicación del SDD se detuvo tras un intento automático de corrección: los requisitos y sus casos están incompletos o son inconsistentes.',
|
|
40880
|
+
action: 'Revisa las tablas del borrador; vincula cada requisito a casos definidos y comprueba los enlaces inversos. Reintenta el workflow de la misma incidencia.',
|
|
40881
|
+
retainedState: 'Se conservaron las respuestas y los SDD publicados; no se publicó ningún borrador. Estas comprobaciones no demuestran la aceptación en ejecución.',
|
|
40882
|
+
}),
|
|
40883
|
+
'sdd-draft-repository-path-invalid': Object.freeze({
|
|
40884
|
+
impact: 'La publicación del SDD se detuvo tras un intento automático de corrección: no se pueden verificar las rutas citadas en la revisión base inmutable.',
|
|
40885
|
+
action: 'Revisa las tablas del borrador; corrige las rutas existentes o declara explícitamente los archivos nuevos previstos. Reintenta el workflow de la misma incidencia.',
|
|
40886
|
+
retainedState: 'Se conservaron las respuestas y los SDD publicados; no se publicó ningún borrador. Estas comprobaciones no demuestran la aceptación en ejecución.',
|
|
40887
|
+
}),
|
|
40762
40888
|
'sdd-draft-format-invalid': Object.freeze({
|
|
40763
40889
|
impact: 'La preparación del SDD se detuvo porque seguían faltando secciones obligatorias o un presupuesto numérico de pruebas tras un intento automático de corrección.',
|
|
40764
40890
|
action: 'Reintenta la preparación del SDD con la plantilla canónica y los criterios de aceptación explícitos.',
|
|
@@ -40873,12 +40999,16 @@ exports.buildApplicationErrorPresentation = buildApplicationErrorPresentation;
|
|
|
40873
40999
|
exports.renderApplicationErrorText = renderApplicationErrorText;
|
|
40874
41000
|
exports.renderApplicationErrorMarkdown = renderApplicationErrorMarkdown;
|
|
40875
41001
|
const application_error_message_catalog_1 = __nccwpck_require__(64809);
|
|
41002
|
+
// This trusted destination is inserted after localization, never supplied by a body or translation.
|
|
41003
|
+
const STORED_CONFIGURATION_RECOVERY_URL = 'https://docs.page/vypdev/copilot/security-operations/operations/troubleshooting#unsupported-stored-configuration';
|
|
40876
41004
|
/** Shared semantic view model for terminal, GitHub, and API presentation. */
|
|
40877
41005
|
function buildApplicationErrorPresentation(error, message = application_error_message_catalog_1.readEnglishApplicationErrorMessage) {
|
|
40878
41006
|
const descriptor = error.recovery
|
|
40879
41007
|
? `error.recovery.${error.recovery.id}`
|
|
40880
41008
|
: `error.${error.code}`;
|
|
40881
|
-
const variables = error.recovery?.
|
|
41009
|
+
const variables = error.recovery?.id.startsWith('stored-configuration-')
|
|
41010
|
+
? { ...error.recovery.variables, recoveryGuide: STORED_CONFIGURATION_RECOVERY_URL }
|
|
41011
|
+
: error.recovery?.variables;
|
|
40882
41012
|
return {
|
|
40883
41013
|
impact: message(`${descriptor}.impact`, variables),
|
|
40884
41014
|
code: error.code,
|
|
@@ -41920,6 +42050,7 @@ exports.BUGBOT_MESSAGE_IDS = Object.freeze([
|
|
|
41920
42050
|
'bugbot.overflow.body',
|
|
41921
42051
|
'bugbot.common.more',
|
|
41922
42052
|
'bugbot.diagnostic.operationFailed',
|
|
42053
|
+
'bugbot.diagnostic.findingMutationFailed',
|
|
41923
42054
|
'bugbot.diagnostic.identityUnavailable',
|
|
41924
42055
|
'bugbot.diagnostic.pullRequestCommentsFailed',
|
|
41925
42056
|
'bugbot.diagnostic.reviewThreadsFailed',
|
|
@@ -42005,6 +42136,7 @@ const ENGLISH_MESSAGES = Object.freeze({
|
|
|
42005
42136
|
'bugbot.overflow.heading': 'More findings (comment limit)',
|
|
42006
42137
|
'bugbot.overflow.body': Object.freeze({ one: 'There is {count} more finding that was not published as an individual comment. Review locally or in the full diff to see the list.', other: 'There are {count} more findings that were not published as individual comments. Review locally or in the full diff to see the list.' }),
|
|
42007
42138
|
'bugbot.common.more': Object.freeze({ one: 'and {count} more.', other: 'and {count} more.' }),
|
|
42139
|
+
'bugbot.diagnostic.findingMutationFailed': 'Finding mutation failed: stage={stage}; operation={operation}; finding={findingId}; affected={affectedCount}; {providerStatus}; provider reference={providerReference}. Completed effects are retained. Correct access/contract errors before retrying; for transient failures restore provider availability, then recheck the same PR. Recheck reconciles existing reviews and threads.',
|
|
42008
42140
|
'bugbot.diagnostic.operationFailed': 'Bugbot could not complete one or more finding mutations.',
|
|
42009
42141
|
'bugbot.diagnostic.identityUnavailable': 'The authenticated Bugbot identity is unavailable.',
|
|
42010
42142
|
'bugbot.diagnostic.pullRequestCommentsFailed': 'Unable to re-read pull request review comments.',
|
|
@@ -42094,6 +42226,7 @@ const SPANISH_MESSAGES = Object.freeze({
|
|
|
42094
42226
|
'bugbot.overflow.heading': 'Más hallazgos (límite de comentarios)',
|
|
42095
42227
|
'bugbot.overflow.body': Object.freeze({ one: 'Hay {count} hallazgo más que no se publicó como comentario individual. Revísalo localmente o en el diff completo para consultar la lista.', many: 'Hay {count} hallazgos más que no se publicaron como comentarios individuales. Revísalos localmente o en el diff completo para consultar la lista.', other: 'Hay {count} hallazgos más que no se publicaron como comentarios individuales. Revísalos localmente o en el diff completo para consultar la lista.' }),
|
|
42096
42228
|
'bugbot.common.more': Object.freeze({ one: 'y {count} más.', many: 'y {count} más.', other: 'y {count} más.' }),
|
|
42229
|
+
'bugbot.diagnostic.findingMutationFailed': 'Falló una mutación: fase={stage}; operación={operation}; hallazgo={findingId}; afectados={affectedCount}; {providerStatus}; referencia del proveedor={providerReference}. Se conservan los efectos completados. Corrige acceso/contrato antes de reintentar; para fallos transitorios restaura el proveedor y revisa la misma PR. La revisión reconcilia comentarios e hilos existentes.',
|
|
42097
42230
|
'bugbot.diagnostic.operationFailed': 'Bugbot no pudo completar una o más mutaciones de hallazgos.',
|
|
42098
42231
|
'bugbot.diagnostic.identityUnavailable': 'La identidad autenticada de Bugbot no está disponible.',
|
|
42099
42232
|
'bugbot.diagnostic.pullRequestCommentsFailed': 'No se pudieron volver a leer los comentarios del review del pull request.',
|
|
@@ -42133,6 +42266,7 @@ async function resolveBugbotCatalog(locale, configuration, resolver) {
|
|
|
42133
42266
|
}
|
|
42134
42267
|
function renderBugbotDiagnostic(diagnostic, catalog) {
|
|
42135
42268
|
switch (diagnostic.code) {
|
|
42269
|
+
case 'finding-mutation-failed': return catalog.message('bugbot.diagnostic.findingMutationFailed', { ...diagnostic.mutation });
|
|
42136
42270
|
case 'operation-failed': return catalog.message('bugbot.diagnostic.operationFailed');
|
|
42137
42271
|
case 'identity-unavailable': return catalog.message('bugbot.diagnostic.identityUnavailable');
|
|
42138
42272
|
case 'snapshot-pull-request-comments-failed': return catalog.message('bugbot.diagnostic.pullRequestCommentsFailed');
|
|
@@ -42760,6 +42894,10 @@ function renderBugbotStatusCard(projection, catalogOrLocale, links) {
|
|
|
42760
42894
|
facts.push(catalog.message('bugbot.coverage.omitted', { count: source.omittedItems }));
|
|
42761
42895
|
if (source.truncatedItems > 0)
|
|
42762
42896
|
facts.push(catalog.message('bugbot.coverage.truncated', { count: source.truncatedItems }));
|
|
42897
|
+
const truncatedIds = source.truncatedItemIds?.slice(0, 50)
|
|
42898
|
+
.filter(id => /^(?:issue:[0-9]+|review:[A-Za-z0-9_=-]+)$/.test(id) && id.length <= 160);
|
|
42899
|
+
if (truncatedIds?.length)
|
|
42900
|
+
facts.push(`truncated-source-ids=${truncatedIds.join(', ')}`);
|
|
42763
42901
|
if (source.providerLimitReached)
|
|
42764
42902
|
facts.push(catalog.message('bugbot.coverage.providerLimit'));
|
|
42765
42903
|
return `- ${source.source}: ${source.status}; ${facts.join(', ')}`;
|
|
@@ -42849,9 +42987,21 @@ function normalizeHistoricalSnapshot(originalBody, analyzedHeadSha, catalog) {
|
|
|
42849
42987
|
function renderFindingRow(finding) {
|
|
42850
42988
|
const label = (0, github_comment_publication_policy_1.sanitizeAgentMarkdown)(finding.title || finding.id, 500).replace(/[\r\n]+/gu, ' ');
|
|
42851
42989
|
const state = stateLabel(finding.state);
|
|
42990
|
+
const identity = finding.state === 'unknown'
|
|
42991
|
+
? ` — ${renderFindingId(finding.id)}`
|
|
42992
|
+
: '';
|
|
42852
42993
|
return finding.url
|
|
42853
|
-
? `- ${state} — [${label}](${finding.url})`
|
|
42854
|
-
: `- ${state} — ${label}`;
|
|
42994
|
+
? `- ${state} — [${label}](${finding.url})${identity}`
|
|
42995
|
+
: `- ${state} — ${label}${identity}`;
|
|
42996
|
+
}
|
|
42997
|
+
function renderFindingId(value) {
|
|
42998
|
+
const id = (0, github_comment_publication_policy_1.sanitizeAgentMarkdown)(value, 200).replace(/[\r\n]+/gu, ' ');
|
|
42999
|
+
// A delimiter longer than every embedded backtick run keeps links, images
|
|
43000
|
+
// and HTML inert even when the marker permits arbitrary Markdown punctuation.
|
|
43001
|
+
let delimiter = '`';
|
|
43002
|
+
while (id.includes(delimiter))
|
|
43003
|
+
delimiter += '`';
|
|
43004
|
+
return `${delimiter} ${id} ${delimiter}`;
|
|
42855
43005
|
}
|
|
42856
43006
|
function stateLabel(state) {
|
|
42857
43007
|
return `[ ] ${state}`;
|
|
@@ -47706,6 +47856,8 @@ The setup runner profile selects placement; it does not install the project's la
|
|
|
47706
47856
|
|
|
47707
47857
|
Declare reviewed version prefixes in \`.copilot/verification-prerequisites.json\` (schemaVersion 1, runtimes such as java 17, node 24, pnpm 10). Copilot checks declared versions in the credential-free verification environment before each configured verification command; a missing or incompatible runtime blocks publication. Without this optional declaration, existing verification behavior remains and no language is inferred. Java provisioning may use \`actions/setup-java\`; \`JAVA_HOME\` and \`PATH\` survive isolation, while agent credentials and tool-option injection variables do not. Do not add an unreviewed bootstrap or weaken verification to work around a missing runtime. Read [verification prerequisites and same-job setup](https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-verification-prerequisites).
|
|
47708
47858
|
|
|
47859
|
+
The optional repository-owned composite action prepares each candidate before verification. Setup creates .github/actions/copilot-verification-setup/action.yml only if missing and preserves an existing consumer action and its assets. The shared terminal/web assistant offers explicit activation, disabled by default. Customize the generated failing placeholder before enabling; setup generation and installer PRs do not prove runtime readiness. Review \`.github/actions/copilot-verification-setup/action.yml\` and its assets onto trusted main, update generated workflows, then enable \`VERIFICATION_SETUP=true\` (Action input \`verification-setup\`, disabled by default). GitHub Actions executes the trusted snapshot before each command with a fresh private HOME; candidate changes cannot replace it. Native post steps finish before profile cleanup. Setup failure blocks verification and commit/push. The local CLI cannot execute composite actions and fails closed when opted in. Read [repository-owned setup](https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-owned-setup).
|
|
47860
|
+
|
|
47709
47861
|
For the full contributor flow, read [repository collaboration](https://github.com/vypdev/copilot/blob/master/docs/agents/repository-collaboration.mdx). For drift and recovery, read [guidance troubleshooting](https://github.com/vypdev/copilot/blob/master/docs/agents/repository-guidance-troubleshooting.mdx).
|
|
47710
47862
|
`;
|
|
47711
47863
|
}
|
|
@@ -47925,6 +48077,40 @@ function calculateReviewersStillNeeded(desiredCount, currentCount, confirmedCoun
|
|
|
47925
48077
|
}
|
|
47926
48078
|
|
|
47927
48079
|
|
|
48080
|
+
/***/ }),
|
|
48081
|
+
|
|
48082
|
+
/***/ 81053:
|
|
48083
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
48084
|
+
|
|
48085
|
+
"use strict";
|
|
48086
|
+
|
|
48087
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
48088
|
+
exports.sddAnalysisStatusMarker = sddAnalysisStatusMarker;
|
|
48089
|
+
exports.renderSddAnalysisStatus = renderSddAnalysisStatus;
|
|
48090
|
+
function sddAnalysisStatusMarker(issueNumber) {
|
|
48091
|
+
return `<!-- copilot:sdd-analysis-status:v1 issue="${issueNumber}" -->`;
|
|
48092
|
+
}
|
|
48093
|
+
const reasons = {
|
|
48094
|
+
'update-owner-mismatch': ['The update path does not belong to the selected catalog owner.', 'La ruta de actualización no pertenece al propietario seleccionado del catálogo.'],
|
|
48095
|
+
'companion-owner-unknown': ['The companion owner is absent from the catalog.', 'El propietario del SDD complementario no existe en el catálogo.'],
|
|
48096
|
+
'companion-path-registered': ['The companion path is already registered in the catalog.', 'La ruta del SDD complementario ya está registrada en el catálogo.'],
|
|
48097
|
+
'new-owner-registered': ['The proposed new capability already exists in the catalog.', 'La capacidad propuesta como nueva ya existe en el catálogo.'],
|
|
48098
|
+
'new-path-registered': ['The proposed new SDD path is already registered in the catalog.', 'La ruta propuesta como nueva ya está registrada en el catálogo.'],
|
|
48099
|
+
};
|
|
48100
|
+
/** Stateless diagnostic, deliberately separate from the validated readiness record. */
|
|
48101
|
+
function renderSddAnalysisStatus(issueNumber, locale, reason) {
|
|
48102
|
+
const spanish = /^es(?:-|$)/i.test(locale ?? '');
|
|
48103
|
+
const marker = sddAnalysisStatusMarker(issueNumber);
|
|
48104
|
+
if (!reason)
|
|
48105
|
+
return spanish
|
|
48106
|
+
? `## Estado del análisis del SDD\n\nEl análisis posterior ha validado la propiedad. La publicación y la preparación de la rama siguen pendientes de sus comprobaciones.\n\n${marker}`
|
|
48107
|
+
: `## SDD analysis status\n\nA subsequent analysis validated ownership. Publication and branch readiness remain subject to their checks.\n\n${marker}`;
|
|
48108
|
+
return spanish
|
|
48109
|
+
? `## Estado del SDD: análisis bloqueado\n\nNo se ha preparado ningún borrador ni publicación nueva. ${reasons[reason][1]}\n\n**Acción de mantenimiento:** Aclara en la misma issue el ID de capacidad del catálogo y la ruta: una actualización usa una ruta de ese propietario; un complemento usa un propietario existente y una ruta nueva; una capacidad nueva necesita ID y ruta sin registrar. Después vuelve a ejecutar el workflow original. Cada ejecución hace un solo análisis; no hay reparación ni reintento automático. Se conservan las respuestas, los SDD y las publicaciones anteriores.\n\n**Diagnóstico:** \`${reason}\`. La decisión rechazada no autoriza una rama ni la etiqueta de preparación.\n\n${marker}`
|
|
48110
|
+
: `## SDD work status: analysis blocked\n\nNo draft or new publication was prepared. ${reasons[reason][0]}\n\n**Maintainer action:** Clarify the catalog capability ID and path in this same issue: an update uses a path owned by that capability; a companion uses an existing owner and a new path; a new capability needs an unregistered ID and path. Then rerun the original workflow. Each invocation performs one analysis; there is no automatic repair or retry. Existing answers, SDDs and publications are retained.\n\n**Diagnostic:** \`${reason}\`. The rejected decision authorizes no branch or readiness label.\n\n${marker}`;
|
|
48111
|
+
}
|
|
48112
|
+
|
|
48113
|
+
|
|
47928
48114
|
/***/ }),
|
|
47929
48115
|
|
|
47930
48116
|
/***/ 2230:
|
|
@@ -48876,6 +49062,7 @@ exports.isSetupBatchInstallationReceipt = isSetupBatchInstallationReceipt;
|
|
|
48876
49062
|
exports.parseSetupBatchOperation = parseSetupBatchOperation;
|
|
48877
49063
|
exports.validSetupBatchAssetPath = validSetupBatchAssetPath;
|
|
48878
49064
|
const setup_batch_1 = __nccwpck_require__(88308);
|
|
49065
|
+
const setup_verification_action_1 = __nccwpck_require__(33156);
|
|
48879
49066
|
const uuid = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;
|
|
48880
49067
|
const sha = /^[a-f0-9]{40}$/u;
|
|
48881
49068
|
const digest = /^[a-f0-9]{64}$/u;
|
|
@@ -48981,6 +49168,7 @@ function validSetupBatchAssetPath(path) {
|
|
|
48981
49168
|
if (path.length > 240 || path.split('/').some(part => !part || part === '.' || part === '..') || /[^A-Za-z0-9_./-]/u.test(path))
|
|
48982
49169
|
return false;
|
|
48983
49170
|
return path === 'AGENTS.md' || path === '.agents/skills/copilot-repository-workflow/SKILL.md'
|
|
49171
|
+
|| path === setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH
|
|
48984
49172
|
|| /^\.github\/(?:workflows|ISSUE_TEMPLATE)\/[A-Za-z0-9_.-]+\.(?:yml|yaml)$/u.test(path)
|
|
48985
49173
|
|| path === '.github/pull_request_template.md' || /^\.copilot\/(?:repository-profile|setup-manifest|runner-profile)\.json$/u.test(path)
|
|
48986
49174
|
|| path === '.copilot/AGENT_GUIDE.md' || path.startsWith('.copilot/setup-backups/');
|
|
@@ -49087,6 +49275,7 @@ function createDefaultSetupConfiguration() {
|
|
|
49087
49275
|
choreTree: 'chore',
|
|
49088
49276
|
issueManagedBranches: true,
|
|
49089
49277
|
preBranchSdd: false,
|
|
49278
|
+
verificationSetup: false,
|
|
49090
49279
|
reopenIssueOnPush: true,
|
|
49091
49280
|
desiredAssigneesCount: 1,
|
|
49092
49281
|
desiredReviewersCount: 1,
|
|
@@ -49243,6 +49432,7 @@ Object.defineProperty(exports, "buildSetupCredentialRequirements", ({ enumerable
|
|
|
49243
49432
|
const locale_1 = __nccwpck_require__(15386);
|
|
49244
49433
|
const issue_workflow_profile_1 = __nccwpck_require__(26744);
|
|
49245
49434
|
const setup_issue_workflow_policy_1 = __nccwpck_require__(81182);
|
|
49435
|
+
const setup_verification_action_1 = __nccwpck_require__(33156);
|
|
49246
49436
|
const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
|
|
49247
49437
|
function buildSetupPlan(configuration, mergeQueueReadiness = [], approvalReadiness = []) {
|
|
49248
49438
|
const workflowFiles = (0, setup_workflow_catalog_1.enabledSetupWorkflowFiles)((0, setup_issue_workflow_policy_1.effectiveIssueWorkflowFeatures)(configuration))
|
|
@@ -49254,6 +49444,7 @@ function buildSetupPlan(configuration, mergeQueueReadiness = [], approvalReadine
|
|
|
49254
49444
|
.filter(file => configuration.features.release !== false || file !== 'release.yml')
|
|
49255
49445
|
.filter(file => configuration.features.hotfix !== false || file !== 'hotfix.yml');
|
|
49256
49446
|
const selectedFiles = [
|
|
49447
|
+
setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH,
|
|
49257
49448
|
...(configuration.runners && configuration.runners.mode !== 'retain' ? ['.copilot/runner-profile.json'] : []),
|
|
49258
49449
|
...workflowFiles.map(file => `workflows/${file}`),
|
|
49259
49450
|
...issueTemplateFiles.map(file => `ISSUE_TEMPLATE/${file}`),
|
|
@@ -49354,6 +49545,7 @@ function buildSetupRepositoryVariables(configuration) {
|
|
|
49354
49545
|
add('CHORE_TREE', repository.choreTree);
|
|
49355
49546
|
add('ISSUE_MANAGED_BRANCHES', repository.issueManagedBranches);
|
|
49356
49547
|
add('PRE_BRANCH_SDD', repository.preBranchSdd);
|
|
49548
|
+
add('VERIFICATION_SETUP', repository.verificationSetup ?? false);
|
|
49357
49549
|
add('REOPEN_ISSUE_ON_PUSH', repository.reopenIssueOnPush);
|
|
49358
49550
|
add('DESIRED_ASSIGNEES_COUNT', repository.desiredAssigneesCount);
|
|
49359
49551
|
add('DESIRED_REVIEWERS_COUNT', repository.desiredReviewersCount);
|
|
@@ -49416,6 +49608,7 @@ function buildSetupActionInputs(configuration) {
|
|
|
49416
49608
|
'chore-tree': repository.choreTree,
|
|
49417
49609
|
'issue-managed-branches': String(repository.issueManagedBranches),
|
|
49418
49610
|
'pre-branch-sdd': String(repository.preBranchSdd),
|
|
49611
|
+
'verification-setup': String(repository.verificationSetup ?? false),
|
|
49419
49612
|
'reopen-issue-on-push': String(repository.reopenIssueOnPush),
|
|
49420
49613
|
'desired-assignees-count': String(repository.desiredAssigneesCount),
|
|
49421
49614
|
'desired-reviewers-count': String(repository.desiredReviewersCount),
|
|
@@ -49861,6 +50054,9 @@ function validateSetupConfiguration(configuration, options = {}) {
|
|
|
49861
50054
|
|| typeof configuration.repository.preBranchSdd !== 'boolean') {
|
|
49862
50055
|
errors.push('issue-managed-branches and pre-branch-sdd must be boolean values.');
|
|
49863
50056
|
}
|
|
50057
|
+
if (configuration.repository.verificationSetup !== undefined && typeof configuration.repository.verificationSetup !== 'boolean') {
|
|
50058
|
+
errors.push('verification-setup must be a boolean value.');
|
|
50059
|
+
}
|
|
49864
50060
|
if (configuration.repository.preBranchSdd && !configuration.repository.issueManagedBranches) {
|
|
49865
50061
|
errors.push('pre-branch-sdd requires issue-managed-branches.');
|
|
49866
50062
|
}
|
|
@@ -50263,6 +50459,7 @@ const repositoryFields = [
|
|
|
50263
50459
|
['HOTFIX_TREE', 'hotfixTree'], ['RELEASE_TREE', 'releaseTree'],
|
|
50264
50460
|
['DOCS_TREE', 'docsTree'], ['CHORE_TREE', 'choreTree'],
|
|
50265
50461
|
['ISSUE_MANAGED_BRANCHES', 'issueManagedBranches'], ['PRE_BRANCH_SDD', 'preBranchSdd'],
|
|
50462
|
+
['VERIFICATION_SETUP', 'verificationSetup'],
|
|
50266
50463
|
['REOPEN_ISSUE_ON_PUSH', 'reopenIssueOnPush'], ['DESIRED_ASSIGNEES_COUNT', 'desiredAssigneesCount'],
|
|
50267
50464
|
['DESIRED_REVIEWERS_COUNT', 'desiredReviewersCount'], ['INACTIVITY_THRESHOLD_HOURS', 'inactivityThresholdHours'],
|
|
50268
50465
|
['REPOSITORY_LOCALE', 'repositoryLocale'], ['ISSUES_LOCALE', 'issueLocale'],
|
|
@@ -50993,6 +51190,58 @@ function verificationRuntimeMatches(required, observed) {
|
|
|
50993
51190
|
}
|
|
50994
51191
|
|
|
50995
51192
|
|
|
51193
|
+
/***/ }),
|
|
51194
|
+
|
|
51195
|
+
/***/ 65326:
|
|
51196
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
51197
|
+
|
|
51198
|
+
"use strict";
|
|
51199
|
+
|
|
51200
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51201
|
+
exports.VerificationSetupError = exports.VERIFICATION_SETUP_HELP = exports.VERIFICATION_SETUP_LIMITS = exports.VERIFICATION_SETUP_PATH = exports.VERIFICATION_SETUP_DIRECTORY = void 0;
|
|
51202
|
+
exports.parseVerificationSetupResult = parseVerificationSetupResult;
|
|
51203
|
+
exports.VERIFICATION_SETUP_DIRECTORY = '.github/actions/copilot-verification-setup';
|
|
51204
|
+
exports.VERIFICATION_SETUP_PATH = `${exports.VERIFICATION_SETUP_DIRECTORY}/action.yml`;
|
|
51205
|
+
exports.VERIFICATION_SETUP_LIMITS = Object.freeze({ timeoutMs: 300000, resultBytes: 16384, scriptBytes: 65536, snapshotBytes: 262144, files: 32, requests: 20 });
|
|
51206
|
+
exports.VERIFICATION_SETUP_HELP = 'https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-owned-setup';
|
|
51207
|
+
/** Closed facts only. Provider/helper output and raw exception causes never cross this boundary. */
|
|
51208
|
+
class VerificationSetupError extends Error {
|
|
51209
|
+
constructor(reason, sourceSha, exitCode) {
|
|
51210
|
+
const sha = sourceSha && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(sourceSha) ? sourceSha : 'unavailable';
|
|
51211
|
+
const exit = Number.isInteger(exitCode) && exitCode >= 0 && exitCode <= 255 ? ` Exit status: ${exitCode}.` : '';
|
|
51212
|
+
const action = reason === 'native-workflow-required'
|
|
51213
|
+
? 'Update the generated Copilot workflows and run this operation in GitHub Actions; the local CLI cannot execute composite actions.'
|
|
51214
|
+
: `Review ${exports.VERIFICATION_SETUP_PATH} on the trusted main branch and rerun.`;
|
|
51215
|
+
super(`Repository setup blocked verification (${reason}). ${action} Trusted source SHA: ${sha}.${exit} Verification, commit and push are withheld. Help: ${exports.VERIFICATION_SETUP_HELP}`);
|
|
51216
|
+
this.reason = reason;
|
|
51217
|
+
this.exitCode = exitCode;
|
|
51218
|
+
this.name = 'VerificationSetupError';
|
|
51219
|
+
}
|
|
51220
|
+
}
|
|
51221
|
+
exports.VerificationSetupError = VerificationSetupError;
|
|
51222
|
+
function record(value) {
|
|
51223
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
51224
|
+
}
|
|
51225
|
+
function pathString(value) {
|
|
51226
|
+
return typeof value === 'string' && value.length > 0 && value.length <= 2048
|
|
51227
|
+
&& ![...value].some(character => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127);
|
|
51228
|
+
}
|
|
51229
|
+
/** Filesystem containment is checked by the adapter, after this closed schema is parsed. */
|
|
51230
|
+
function parseVerificationSetupResult(value) {
|
|
51231
|
+
if (!record(value) || value.schemaVersion !== 1 || Object.keys(value).some(key => !['schemaVersion', 'path', 'environment'].includes(key))) {
|
|
51232
|
+
throw new VerificationSetupError('result-invalid');
|
|
51233
|
+
}
|
|
51234
|
+
const paths = value.path === undefined ? [] : value.path;
|
|
51235
|
+
const environment = value.environment === undefined ? {} : value.environment;
|
|
51236
|
+
if (!Array.isArray(paths) || paths.length > 8 || !paths.every(pathString) || new Set(paths).size !== paths.length
|
|
51237
|
+
|| !record(environment) || Object.keys(environment).some(key => key !== 'JAVA_HOME')
|
|
51238
|
+
|| ('JAVA_HOME' in environment && !pathString(environment.JAVA_HOME))) {
|
|
51239
|
+
throw new VerificationSetupError('result-invalid');
|
|
51240
|
+
}
|
|
51241
|
+
return Object.freeze({ path: Object.freeze([...paths]), ...(environment.JAVA_HOME ? { javaHome: environment.JAVA_HOME } : {}) });
|
|
51242
|
+
}
|
|
51243
|
+
|
|
51244
|
+
|
|
50996
51245
|
/***/ }),
|
|
50997
51246
|
|
|
50998
51247
|
/***/ 43193:
|
|
@@ -51158,6 +51407,13 @@ class PullRequestReviewOperationError extends Error {
|
|
|
51158
51407
|
super(buildMessage(operation, context));
|
|
51159
51408
|
this.name = "PullRequestReviewOperationError";
|
|
51160
51409
|
this.operation = operation;
|
|
51410
|
+
const status = context?.providerStatus;
|
|
51411
|
+
if (typeof status === 'number' && Number.isInteger(status) && status >= 400 && status <= 599) {
|
|
51412
|
+
this.providerStatus = status;
|
|
51413
|
+
}
|
|
51414
|
+
if (typeof context?.providerReference === 'string' && /^[A-Za-z0-9:-]{1,64}$/.test(context.providerReference)) {
|
|
51415
|
+
this.providerReference = context.providerReference;
|
|
51416
|
+
}
|
|
51161
51417
|
}
|
|
51162
51418
|
}
|
|
51163
51419
|
exports.PullRequestReviewOperationError = PullRequestReviewOperationError;
|
|
@@ -51198,6 +51454,18 @@ function bindSddEvidenceReadPorts(ports) {
|
|
|
51198
51454
|
}
|
|
51199
51455
|
|
|
51200
51456
|
|
|
51457
|
+
/***/ }),
|
|
51458
|
+
|
|
51459
|
+
/***/ 26509:
|
|
51460
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
51461
|
+
|
|
51462
|
+
"use strict";
|
|
51463
|
+
|
|
51464
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51465
|
+
exports.DISABLED_VERIFICATION_SETUP = void 0;
|
|
51466
|
+
exports.DISABLED_VERIFICATION_SETUP = Object.freeze({ kind: 'disabled' });
|
|
51467
|
+
|
|
51468
|
+
|
|
51201
51469
|
/***/ }),
|
|
51202
51470
|
|
|
51203
51471
|
/***/ 84387:
|
|
@@ -53108,6 +53376,7 @@ async function runInitialSetupWorkflow(request, dependencies) {
|
|
|
53108
53376
|
}
|
|
53109
53377
|
(0, logging_ports_1.logInfo)('📋 Ensuring .github and copying setup files...');
|
|
53110
53378
|
const workspaceSelection = {
|
|
53379
|
+
...(request.verificationActionState ? { verificationActionState: request.verificationActionState } : {}),
|
|
53111
53380
|
features: setupConfiguration?.features,
|
|
53112
53381
|
setupConfiguration,
|
|
53113
53382
|
...(request.workflowUpdates.length > 0 ? {
|
|
@@ -53119,6 +53388,8 @@ async function runInitialSetupWorkflow(request, dependencies) {
|
|
|
53119
53388
|
const filesResult = dependencies.setupWorkspacePort.prepare(workspaceSelection);
|
|
53120
53389
|
mark('files', filesResult.copied > 0 ? 'completed' : 'skipped');
|
|
53121
53390
|
steps.push(`✅ Setup files: ${filesResult.copied} copied, ${filesResult.skipped} already existed`);
|
|
53391
|
+
if (request.verificationActionState)
|
|
53392
|
+
steps.push(`✅ Verification setup action ${request.verificationActionState === 'create' ? 'created' : 'preserved'}; VERIFICATION_SETUP=${setupConfiguration?.repository.verificationSetup ?? false}. Customize and review on MAIN_BRANCH, then run a real verification.`);
|
|
53122
53393
|
if (setupConfiguration?.manageRepositorySecrets && secretValues > 0)
|
|
53123
53394
|
mark('secrets', 'in-progress');
|
|
53124
53395
|
const secrets = await (0, setup_resource_provisioning_1.ensureRepositorySecrets)(request, dependencies, setupConfiguration, remoteConfiguration);
|
|
@@ -58131,6 +58402,8 @@ function projectInitialSetupContext(source) {
|
|
|
58131
58402
|
...(credentials ? { setupCredentials: deepFreezeCopy(credentials) } : {}),
|
|
58132
58403
|
...(remote ? { setupRemoteConfiguration: deepFreezeCopy(remote) } : {}),
|
|
58133
58404
|
workflowUpdates: Object.freeze(asStringArray(source.inputs?.setupWorkflowUpdates)),
|
|
58405
|
+
...(source.inputs?.setupVerificationActionState === 'create' || source.inputs?.setupVerificationActionState === 'preserve'
|
|
58406
|
+
? { verificationActionState: source.inputs.setupVerificationActionState } : {}),
|
|
58134
58407
|
});
|
|
58135
58408
|
}
|
|
58136
58409
|
function projectIssueCommentActionContext(source) {
|
|
@@ -58636,6 +58909,7 @@ exports.draftSddMarkdown = draftSddMarkdown;
|
|
|
58636
58909
|
const application_error_1 = __nccwpck_require__(75999);
|
|
58637
58910
|
const pre_branch_sdd_1 = __nccwpck_require__(34730);
|
|
58638
58911
|
const agent_response_length_failure_1 = __nccwpck_require__(28528);
|
|
58912
|
+
const sdd_draft_consistency_1 = __nccwpck_require__(27910);
|
|
58639
58913
|
/** Size and typed format failures share one regeneration; the writer still validates every candidate. */
|
|
58640
58914
|
async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
|
|
58641
58915
|
const maximum = plan.action === 'update' ? pre_branch_sdd_1.SDD_MAX_UPDATE_CHARACTERS : pre_branch_sdd_1.SDD_MAX_DRAFT_CHARACTERS;
|
|
@@ -58647,13 +58921,13 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
|
|
|
58647
58921
|
};
|
|
58648
58922
|
let problem = 'size';
|
|
58649
58923
|
let formatReason = 'required-heading';
|
|
58650
|
-
const contractPrompt = `${prompt}\n\nDraft contract: keep the complete draft within ${maximum} characters; aim for ${target} characters. Preserve the same owner, decisions and requirements. Include these literal canonical heading prefixes as Markdown headings, with the shown capitalization:\n${pre_branch_sdd_1.SDD_REQUIRED_HEADINGS.join('\n')}\nUse the canonical numeric test-budget table in section 14: Area | Minimum distinct cases | Behaviors/risks covered. Every allocation and the Total must be a positive integer, and the Total must equal the sum of the allocations.
|
|
58924
|
+
const contractPrompt = `${prompt}\n\nDraft contract: keep the complete draft within ${maximum} characters; aim for ${target} characters. Preserve the same owner, decisions and requirements. Include these literal canonical heading prefixes as Markdown headings, with the shown capitalization:\n${pre_branch_sdd_1.SDD_REQUIRED_HEADINGS.join('\n')}\nUse the canonical numeric test-budget table in section 14: Area | Minimum distinct cases | Behaviors/risks covered. Every allocation and the Total must be a positive integer, and the Total must equal the sum of the allocations. Return only the required JSON.`;
|
|
58651
58925
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
58652
58926
|
let value;
|
|
58653
58927
|
try {
|
|
58654
58928
|
value = await agent.query({
|
|
58655
58929
|
configuration, agentId: 'pre-branch-sdd-draft',
|
|
58656
|
-
prompt: attempt === 0 ? contractPrompt : `${contractPrompt}\n\n${problem === 'size' ? `The previous response exceeded the ${maximum}-character draft limit.` : `The previous response failed the required SDD ${formatReason} contract.`} Regenerate a concise complete draft for this same owner and plan. Use the exact numbered canonical headings from the supplied template. Preserve all resolved requirements, architecture, documentation and acceptance. Do not change ownership or truncate a requirement
|
|
58930
|
+
prompt: `${attempt === 0 ? contractPrompt : `${contractPrompt}\n\n${problem === 'size' ? `The previous response exceeded the ${maximum}-character draft limit.` : `The previous response failed the required SDD ${formatReason} contract.`} Regenerate a concise complete draft for this same owner and plan. Use the exact numbered canonical headings from the supplied template. Preserve all resolved requirements, architecture, documentation and acceptance. Do not change ownership or truncate a requirement.`}\n\n${sdd_draft_consistency_1.SDD_CONSISTENCY_PROMPT}`,
|
|
58657
58931
|
options: { expectJson: true, schemaName: 'pre_branch_sdd_draft', schema },
|
|
58658
58932
|
});
|
|
58659
58933
|
}
|
|
@@ -58687,12 +58961,21 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
|
|
|
58687
58961
|
}
|
|
58688
58962
|
if (problem === 'format')
|
|
58689
58963
|
throw new application_error_1.ApplicationError('validation.invalid-input', `The SDD draft still violates its ${formatReason} format contract after one bounded repair.`, {
|
|
58690
|
-
recovery: { id:
|
|
58964
|
+
recovery: { id: consistencyRecovery(formatReason), variables: {} },
|
|
58691
58965
|
});
|
|
58692
58966
|
throw new application_error_1.ApplicationError('validation.invalid-input', 'The SDD draft exceeded its size limit after one bounded repair.', {
|
|
58693
58967
|
recovery: { id: 'sdd-draft-size-exceeded', variables: {} },
|
|
58694
58968
|
});
|
|
58695
58969
|
}
|
|
58970
|
+
function consistencyRecovery(reason) {
|
|
58971
|
+
switch (reason) {
|
|
58972
|
+
case 'case-identity': return 'sdd-draft-case-identity-invalid';
|
|
58973
|
+
case 'case-budget': return 'sdd-draft-case-budget-invalid';
|
|
58974
|
+
case 'requirement-mapping': return 'sdd-draft-requirement-mapping-invalid';
|
|
58975
|
+
case 'repository-path': return 'sdd-draft-repository-path-invalid';
|
|
58976
|
+
default: return 'sdd-draft-format-invalid';
|
|
58977
|
+
}
|
|
58978
|
+
}
|
|
58696
58979
|
|
|
58697
58980
|
|
|
58698
58981
|
/***/ }),
|
|
@@ -58710,8 +58993,10 @@ const issue_start_policy_1 = __nccwpck_require__(90332);
|
|
|
58710
58993
|
const pre_branch_sdd_1 = __nccwpck_require__(34730);
|
|
58711
58994
|
const recommendation_policy_1 = __nccwpck_require__(39410);
|
|
58712
58995
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
58996
|
+
const sdd_analysis_status_policy_1 = __nccwpck_require__(81053);
|
|
58713
58997
|
const application_error_1 = __nccwpck_require__(75999);
|
|
58714
58998
|
const pre_branch_sdd_draft_workflow_1 = __nccwpck_require__(93454);
|
|
58999
|
+
const sdd_draft_consistency_1 = __nccwpck_require__(27910);
|
|
58715
59000
|
const ANALYSIS_SCHEMA = {
|
|
58716
59001
|
type: 'object',
|
|
58717
59002
|
properties: {
|
|
@@ -58832,11 +59117,21 @@ class PreBranchSddGateUseCase {
|
|
|
58832
59117
|
});
|
|
58833
59118
|
const analysisValue = asRecord(analysis);
|
|
58834
59119
|
const owners = new Map(snapshot.capabilities.map(capability => [capability.id, capability.specs]));
|
|
58835
|
-
|
|
59120
|
+
let plan;
|
|
59121
|
+
try {
|
|
59122
|
+
plan = (0, pre_branch_sdd_1.parseSddPlan)(analysisValue, owners);
|
|
59123
|
+
}
|
|
59124
|
+
catch (error) {
|
|
59125
|
+
if (!(error instanceof pre_branch_sdd_1.SddOwnershipFailure))
|
|
59126
|
+
throw error;
|
|
59127
|
+
await this.writeAnalysisStatus(context, allComments, error.reason);
|
|
59128
|
+
throw new application_error_1.ApplicationError('provider.contract-invalid', `${error.message} Clarify the catalog owner/path in the same issue and rerun the original workflow. No automatic retry was attempted.`);
|
|
59129
|
+
}
|
|
58836
59130
|
if (card?.record.branchName && (plan.action !== 'update'
|
|
58837
59131
|
|| plan.path !== card.record.plan.path || plan.capabilityId !== card.record.plan.capabilityId)) {
|
|
58838
59132
|
throw new Error('An existing linked branch can only revise its owning SDD on the same path.');
|
|
58839
59133
|
}
|
|
59134
|
+
await this.writeAnalysisStatus(context, allComments);
|
|
58840
59135
|
const round = publicationRetry ? card.record.round
|
|
58841
59136
|
: card?.record.phase === 'awaiting-answer' && card.record.issueDigest === digest && !staleAwaiting
|
|
58842
59137
|
? card.record.round + (plan.questions.length > 0 ? 1 : 0) : 1;
|
|
@@ -58856,9 +59151,19 @@ class PreBranchSddGateUseCase {
|
|
|
58856
59151
|
const currentSdd = plan.action === 'update' ? await this.workspace.readSdd(snapshot.baseSha, plan.path) : undefined;
|
|
58857
59152
|
if (plan.action === 'update' && !currentSdd)
|
|
58858
59153
|
throw new Error('The catalogued SDD owner is missing from the selected base.');
|
|
59154
|
+
const ownerDocuments = [];
|
|
59155
|
+
for (const path of snapshot.capabilities.find(capability => capability.id === plan.capabilityId)?.specs ?? []) {
|
|
59156
|
+
const markdown = path === plan.path && currentSdd ? currentSdd : await this.workspace.readSdd(snapshot.baseSha, path);
|
|
59157
|
+
if (!markdown)
|
|
59158
|
+
throw new Error('A catalogued owning SDD is unavailable at the selected immutable base.');
|
|
59159
|
+
ownerDocuments.push({ path, markdown });
|
|
59160
|
+
}
|
|
59161
|
+
const reservedCases = JSON.stringify((0, sdd_draft_consistency_1.reservedSddCaseIds)(ownerDocuments));
|
|
59162
|
+
if (reservedCases.length > 30000)
|
|
59163
|
+
throw new Error('The owning SDD case inventory exceeds the bounded drafting context; maintainer review is required.');
|
|
58859
59164
|
const newCapability = plan.action === 'new' ? parseNewCapability(analysisValue.newCapability, plan) : undefined;
|
|
58860
59165
|
let prepared;
|
|
58861
|
-
await (0, pre_branch_sdd_draft_workflow_1.draftSddMarkdown)(this.agent, context.agentConfiguration, plan, buildDraftPrompt(context, snapshot, plan, answers, currentSdd)
|
|
59166
|
+
await (0, pre_branch_sdd_draft_workflow_1.draftSddMarkdown)(this.agent, context.agentConfiguration, plan, `${buildDraftPrompt(context, snapshot, plan, answers, currentSdd)}\n\nCase IDs reserved across every owning SDD at ${snapshot.baseSha}:\n${reservedCases}`, async (markdown) => {
|
|
58862
59167
|
prepared = await this.workspace.validateDraft(snapshot, plan, markdown, newCapability);
|
|
58863
59168
|
});
|
|
58864
59169
|
if (!prepared)
|
|
@@ -58948,6 +59253,20 @@ class PreBranchSddGateUseCase {
|
|
|
58948
59253
|
else
|
|
58949
59254
|
await this.comments.updateComment(issueNumber, cardId, body);
|
|
58950
59255
|
}
|
|
59256
|
+
async writeAnalysisStatus(context, comments, reason) {
|
|
59257
|
+
const marker = (0, sdd_analysis_status_policy_1.sddAnalysisStatusMarker)(context.issueNumber);
|
|
59258
|
+
const prior = comments.filter(comment => comment.user?.login?.toLowerCase() === context.tokenUser.toLowerCase()
|
|
59259
|
+
&& comment.body?.includes(marker)).sort((a, b) => b.id - a.id)[0];
|
|
59260
|
+
if (!reason && !prior)
|
|
59261
|
+
return;
|
|
59262
|
+
const body = (0, sdd_analysis_status_policy_1.renderSddAnalysisStatus)(context.issueNumber, context.issueLocale, reason);
|
|
59263
|
+
if (prior) {
|
|
59264
|
+
if (prior.body !== body)
|
|
59265
|
+
await this.comments.updateComment(context.issueNumber, prior.id, body);
|
|
59266
|
+
}
|
|
59267
|
+
else
|
|
59268
|
+
await this.comments.addComment(context.issueNumber, body);
|
|
59269
|
+
}
|
|
58951
59270
|
async assertFresh(context, expectedBaseSha, sourceBranch) {
|
|
58952
59271
|
const [liveBody, liveTitle, snapshot] = await Promise.all([
|
|
58953
59272
|
this.descriptions.getDescription(context.issueNumber),
|
|
@@ -59708,7 +60027,7 @@ function partitionFailureCategory(error) {
|
|
|
59708
60027
|
return error instanceof Error ? error.name : 'unknown';
|
|
59709
60028
|
}
|
|
59710
60029
|
function suppressDismissedFindings(execution, context, prepared) {
|
|
59711
|
-
const activeFindings = (prepared.activeFindings ?? prepared.toPublish).filter((finding) => {
|
|
60030
|
+
const activeFindings = (0, finding_1.retainExistingFindingIds)(prepared.activeFindings ?? prepared.toPublish, context.existingByFindingId).filter((finding) => {
|
|
59712
60031
|
const existing = (0, finding_1.findExistingFindingInfo)(context.existingByFindingId, finding);
|
|
59713
60032
|
return existing?.issue?.resolution !== 'dismissed' && existing?.pullRequest?.resolution !== 'dismissed';
|
|
59714
60033
|
});
|
|
@@ -59728,6 +60047,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
59728
60047
|
exports.applyDetectedFindings = applyDetectedFindings;
|
|
59729
60048
|
const mark_findings_resolved_use_case_1 = __nccwpck_require__(96963);
|
|
59730
60049
|
const publish_findings_use_case_1 = __nccwpck_require__(88442);
|
|
60050
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
59731
60051
|
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
59732
60052
|
async function applyDetectedFindings(operation, context, prepared, publicationPorts, resolutionPorts, catalog) {
|
|
59733
60053
|
try {
|
|
@@ -59743,7 +60063,7 @@ async function applyDetectedFindings(operation, context, prepared, publicationPo
|
|
|
59743
60063
|
});
|
|
59744
60064
|
}
|
|
59745
60065
|
catch (error) {
|
|
59746
|
-
const publicationError = error instanceof pull_request_review_errors_1.PullRequestReviewOperationError
|
|
60066
|
+
const publicationError = error instanceof bugbot_mutation_error_1.BugbotMutationError || error instanceof pull_request_review_errors_1.PullRequestReviewOperationError
|
|
59747
60067
|
? error
|
|
59748
60068
|
: new Error("Unable to publish findings.");
|
|
59749
60069
|
return [publicationError];
|
|
@@ -60294,6 +60614,7 @@ function buildPreviousFindingsContext(previousFindings) {
|
|
|
60294
60614
|
`;
|
|
60295
60615
|
const suffix = `
|
|
60296
60616
|
**Your task 2:** For each finding above, analyze the current code and decide:
|
|
60617
|
+
- Trace the original failure precondition through current callers, validation helpers and effective configuration, including modules outside the original anchor. A retained finding is not proof that its old explanation is still true. Reuse its exact id if reporting the same defect again; do not create a second report for it.
|
|
60297
60618
|
- If the problem **still exists** (same code or same issue present): do **not** include it in \`resolved_findings\`.
|
|
60298
60619
|
- If the problem **no longer applies** (e.g. that code was removed or refactored away): include \`{ "id": "<exact id>", "resolution": "obsolete" }\` in \`resolved_findings\`.
|
|
60299
60620
|
- If the problem **has been fixed** (code was changed and the issue is resolved): include \`{ "id": "<exact id>", "resolution": "fixed" }\` in \`resolved_findings\`.
|
|
@@ -60413,6 +60734,10 @@ function buildReviewConversationContext(issueComments, commentsByPullRequest, bo
|
|
|
60413
60734
|
omitted,
|
|
60414
60735
|
truncated: chronological.filter((entry) => entry.truncated).length,
|
|
60415
60736
|
retained: chronological.length,
|
|
60737
|
+
...(chronological.some(entry => entry.truncated) ? {
|
|
60738
|
+
truncatedItemIds: chronological.filter(entry => entry.truncated)
|
|
60739
|
+
.map(entry => entry.providerId).filter(id => /^(?:issue:[0-9]+|review:[A-Za-z0-9_=-]+)$/.test(id) && id.length <= 160),
|
|
60740
|
+
} : {}),
|
|
60416
60741
|
};
|
|
60417
60742
|
}
|
|
60418
60743
|
function appendConversationEntry(entries, author, kind, body, createdAt, providerId) {
|
|
@@ -61904,6 +62229,7 @@ async function loadBugbotContext(request, ports, resolvedPreflight) {
|
|
|
61904
62229
|
itemsFetched: conversationContext.retained + conversationContext.omitted,
|
|
61905
62230
|
omittedItems: conversationContext.omitted,
|
|
61906
62231
|
truncatedItems: conversationContext.truncated,
|
|
62232
|
+
...(conversationContext.truncatedItemIds ? { truncatedItemIds: conversationContext.truncatedItemIds } : {}),
|
|
61907
62233
|
limitReached: conversationContext.omitted > 0 || conversationContext.truncated > 0,
|
|
61908
62234
|
},
|
|
61909
62235
|
{
|
|
@@ -62105,11 +62431,11 @@ Object.defineProperty(exports, "markFindingsResolved", ({ enumerable: true, get:
|
|
|
62105
62431
|
|
|
62106
62432
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
62107
62433
|
exports.markFindingsResolved = markFindingsResolved;
|
|
62108
|
-
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
62109
62434
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
62110
62435
|
const resolve_issue_finding_1 = __nccwpck_require__(35300);
|
|
62111
62436
|
const resolve_pull_request_finding_1 = __nccwpck_require__(64567);
|
|
62112
62437
|
const review_state_1 = __nccwpck_require__(79200);
|
|
62438
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
62113
62439
|
const application_error_1 = __nccwpck_require__(75999);
|
|
62114
62440
|
async function markFindingsResolved(param) {
|
|
62115
62441
|
const errors = [];
|
|
@@ -62137,8 +62463,8 @@ async function repairExistingPullRequestFinding(ports, operation, findingId, des
|
|
|
62137
62463
|
try {
|
|
62138
62464
|
await ports.pullRequestComments.unresolvePullRequestReviewThread(destination.pullRequestNumber, destination.commentIdentity);
|
|
62139
62465
|
}
|
|
62140
|
-
catch {
|
|
62141
|
-
addResolutionError(errors, 'pull request');
|
|
62466
|
+
catch (cause) {
|
|
62467
|
+
addResolutionError(errors, 'pull request', findingId, cause);
|
|
62142
62468
|
}
|
|
62143
62469
|
}
|
|
62144
62470
|
}
|
|
@@ -62152,7 +62478,7 @@ async function resolveIssueIfNeeded(param, findingId, destination, errors) {
|
|
|
62152
62478
|
return;
|
|
62153
62479
|
const comment = param.context.issueComments.find(item => item.id === destination.commentId);
|
|
62154
62480
|
if (comment?.body == null) {
|
|
62155
|
-
addResolutionError(errors, 'issue');
|
|
62481
|
+
addResolutionError(errors, 'issue', findingId);
|
|
62156
62482
|
return;
|
|
62157
62483
|
}
|
|
62158
62484
|
try {
|
|
@@ -62163,8 +62489,8 @@ async function resolveIssueIfNeeded(param, findingId, destination, errors) {
|
|
|
62163
62489
|
resolution: param.resolvedFindingResolutions?.get(findingId),
|
|
62164
62490
|
}, param.catalog);
|
|
62165
62491
|
}
|
|
62166
|
-
catch {
|
|
62167
|
-
addResolutionError(errors, 'issue');
|
|
62492
|
+
catch (cause) {
|
|
62493
|
+
addResolutionError(errors, 'issue', findingId, cause);
|
|
62168
62494
|
}
|
|
62169
62495
|
}
|
|
62170
62496
|
async function tryResolvePullRequestFinding(ports, findingId, destination, errors, resolution, catalog) {
|
|
@@ -62176,17 +62502,14 @@ async function tryResolvePullRequestFinding(ports, findingId, destination, error
|
|
|
62176
62502
|
resolution,
|
|
62177
62503
|
}, catalog);
|
|
62178
62504
|
}
|
|
62179
|
-
catch {
|
|
62180
|
-
addResolutionError(errors, 'pull request');
|
|
62505
|
+
catch (cause) {
|
|
62506
|
+
addResolutionError(errors, 'pull request', findingId, cause);
|
|
62181
62507
|
}
|
|
62182
62508
|
}
|
|
62183
|
-
function addResolutionError(errors, destination) {
|
|
62184
|
-
const
|
|
62185
|
-
?
|
|
62186
|
-
: new
|
|
62187
|
-
const semanticError = new application_error_1.ApplicationError('provider.unavailable', destination === 'pull request'
|
|
62188
|
-
? 'Unable to mark a pull request finding as resolved.'
|
|
62189
|
-
: 'Unable to mark an issue finding as resolved.', { cause });
|
|
62509
|
+
function addResolutionError(errors, destination, findingId, cause) {
|
|
62510
|
+
const semanticError = destination === 'pull request'
|
|
62511
|
+
? (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'resolution', [findingId], 'mark-resolved')
|
|
62512
|
+
: new application_error_1.ApplicationError('provider.unavailable', 'Unable to mark an issue finding as resolved.');
|
|
62190
62513
|
(0, logging_ports_1.logError)(semanticError);
|
|
62191
62514
|
errors.push(semanticError);
|
|
62192
62515
|
}
|
|
@@ -62439,6 +62762,7 @@ function isRecord(value) {
|
|
|
62439
62762
|
*/
|
|
62440
62763
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
62441
62764
|
exports.publishFindings = publishFindings;
|
|
62765
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
62442
62766
|
const finding_1 = __nccwpck_require__(31011);
|
|
62443
62767
|
const publish_issue_finding_comment_1 = __nccwpck_require__(84950);
|
|
62444
62768
|
const publish_pr_review_comments_1 = __nccwpck_require__(50352);
|
|
@@ -62457,12 +62781,17 @@ async function publishFindings(param) {
|
|
|
62457
62781
|
catalog,
|
|
62458
62782
|
})
|
|
62459
62783
|
: undefined;
|
|
62460
|
-
for (const finding of findings) {
|
|
62784
|
+
for (const finding of (0, finding_1.retainExistingFindingIds)(findings, existingByFindingId)) {
|
|
62461
62785
|
if (operation.target.issueNumber > 0 && !reviewPublisher) {
|
|
62462
62786
|
await (0, publish_issue_finding_comment_1.publishIssueFindingComment)(ports.issueComments, operation.target.issueNumber, finding, (0, finding_1.findExistingFindingInfo)(existingByFindingId, finding), commitSha, catalog);
|
|
62463
62787
|
}
|
|
62464
62788
|
if (reviewPublisher) {
|
|
62465
|
-
|
|
62789
|
+
try {
|
|
62790
|
+
await reviewPublisher.publish(finding, (0, finding_1.findExistingFindingInfo)(existingByFindingId, finding));
|
|
62791
|
+
}
|
|
62792
|
+
catch (cause) {
|
|
62793
|
+
throw (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'publication', [finding.id], 'publish-comments');
|
|
62794
|
+
}
|
|
62466
62795
|
}
|
|
62467
62796
|
}
|
|
62468
62797
|
await reviewPublisher?.flush(overflowCount, overflowTitles);
|
|
@@ -62534,6 +62863,7 @@ ${catalog.message('bugbot.overflow.body', { count: `**${overflowCount}**` }, ove
|
|
|
62534
62863
|
|
|
62535
62864
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
62536
62865
|
exports.PullRequestReviewCommentPublisher = void 0;
|
|
62866
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
62537
62867
|
const bugbot_finding_marker_policy_1 = __nccwpck_require__(98024);
|
|
62538
62868
|
const path_validation_1 = __nccwpck_require__(70124);
|
|
62539
62869
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
@@ -62605,11 +62935,16 @@ class PullRequestReviewCommentPublisher {
|
|
|
62605
62935
|
if (this.findingsToCreate.length === 0 && overflowCount === 0)
|
|
62606
62936
|
return;
|
|
62607
62937
|
const { repository, operation, openPrNumber, prContext } = this.options;
|
|
62608
|
-
|
|
62609
|
-
|
|
62610
|
-
|
|
62611
|
-
|
|
62612
|
-
|
|
62938
|
+
try {
|
|
62939
|
+
await repository.createReviewWithComments(openPrNumber, prContext.prHeadSha, buildReviewSummary(this.findingsToCreate, this.commentsToCreate.length, this.unanchoredBodies, overflowCount, overflowTitles, operation.analysis.reviewConfiguration.traceRules
|
|
62940
|
+
? this.options.ruleSources ?? []
|
|
62941
|
+
: [], operation.analysis.reviewConfiguration.traceRules
|
|
62942
|
+
? this.options.omittedRuleCount ?? 0
|
|
62943
|
+
: 0, prContext.prHeadSha, this.catalog), this.commentsToCreate);
|
|
62944
|
+
}
|
|
62945
|
+
catch (cause) {
|
|
62946
|
+
throw (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'publication', this.findingsToCreate.map(finding => finding.id), 'publish-comments', this.findingsToCreate.length + overflowCount);
|
|
62947
|
+
}
|
|
62613
62948
|
}
|
|
62614
62949
|
get catalog() {
|
|
62615
62950
|
return this.options.catalog ?? (0, bugbot_message_catalog_1.resolveStaticBugbotCatalog)(this.options.operation.locale.pullRequest);
|
|
@@ -62765,6 +63100,8 @@ async function queryBugbotPartitionFindings(repository, configuration, prompt, t
|
|
|
62765
63100
|
|
|
62766
63101
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
62767
63102
|
exports.reconcileBugbotReviewState = reconcileBugbotReviewState;
|
|
63103
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
63104
|
+
const finding_1 = __nccwpck_require__(31011);
|
|
62768
63105
|
const review_projection_1 = __nccwpck_require__(80859);
|
|
62769
63106
|
const bugbot_reconciliation_policy_1 = __nccwpck_require__(78128);
|
|
62770
63107
|
const bugbot_provider_projection_policy_1 = __nccwpck_require__(85821);
|
|
@@ -62795,11 +63132,12 @@ async function reconcileBugbotReviewState(input) {
|
|
|
62795
63132
|
};
|
|
62796
63133
|
}
|
|
62797
63134
|
const snapshot = snapshotResult.snapshot;
|
|
63135
|
+
const activeFindings = (0, finding_1.retainExistingFindingIds)(input.activeFindings, input.loadedContext.existingByFindingId);
|
|
63136
|
+
const expectedPublishedFindings = (0, finding_1.retainExistingFindingIds)(input.expectedPublishedFindings ?? input.activeFindings, input.loadedContext.existingByFindingId);
|
|
62798
63137
|
const diagnostics = [
|
|
62799
|
-
...(input.mutationErrors ?? []).map((error) =>
|
|
62800
|
-
code: '
|
|
62801
|
-
operatorMessage: toSafeOperationMessage(error),
|
|
62802
|
-
})),
|
|
63138
|
+
...(input.mutationErrors ?? []).map((error) => error instanceof bugbot_mutation_error_1.BugbotMutationError
|
|
63139
|
+
? { code: 'finding-mutation-failed', mutation: error.diagnostic }
|
|
63140
|
+
: { code: 'operation-failed', operatorMessage: toSafeOperationMessage(error) }),
|
|
62803
63141
|
...(!input.target.trustedAuthorLogin?.trim()
|
|
62804
63142
|
? [{ code: 'identity-unavailable' }]
|
|
62805
63143
|
: []),
|
|
@@ -62808,7 +63146,7 @@ async function reconcileBugbotReviewState(input) {
|
|
|
62808
63146
|
const providerProjection = (0, bugbot_provider_projection_policy_1.projectBugbotProviderEvidence)({
|
|
62809
63147
|
snapshot,
|
|
62810
63148
|
trustedAuthorLogin: input.target.trustedAuthorLogin,
|
|
62811
|
-
activeFindings
|
|
63149
|
+
activeFindings,
|
|
62812
63150
|
existingByFindingId: input.loadedContext.existingByFindingId,
|
|
62813
63151
|
});
|
|
62814
63152
|
const plan = (0, bugbot_reconciliation_policy_1.buildBugbotReconciliationPlan)({
|
|
@@ -62818,8 +63156,8 @@ async function reconcileBugbotReviewState(input) {
|
|
|
62818
63156
|
id,
|
|
62819
63157
|
(0, bugbot_finding_marker_policy_1.extractTitleFromBody)(fullBody) || id,
|
|
62820
63158
|
])),
|
|
62821
|
-
activeFindings
|
|
62822
|
-
expectedPublishedFindings
|
|
63159
|
+
activeFindings,
|
|
63160
|
+
expectedPublishedFindings,
|
|
62823
63161
|
diagnostics,
|
|
62824
63162
|
coverage: input.loadedContext.coverage,
|
|
62825
63163
|
});
|
|
@@ -63323,14 +63661,16 @@ function toPresentationFailure(diagnostic) {
|
|
|
63323
63661
|
const message = (0, bugbot_message_catalog_1.bugbotDiagnosticOperatorMessage)(diagnostic);
|
|
63324
63662
|
return {
|
|
63325
63663
|
diagnostic,
|
|
63326
|
-
error: diagnostic.code === '
|
|
63327
|
-
? new application_error_1.ApplicationError(
|
|
63328
|
-
|
|
63329
|
-
|
|
63330
|
-
|
|
63331
|
-
|
|
63332
|
-
|
|
63333
|
-
|
|
63664
|
+
error: diagnostic.code === 'finding-mutation-failed'
|
|
63665
|
+
? new application_error_1.ApplicationError(diagnostic.mutation.errorCode, message)
|
|
63666
|
+
: diagnostic.code === 'review-updates-pending'
|
|
63667
|
+
? new application_error_1.ApplicationError('workflow.presentation-pending', message, {
|
|
63668
|
+
recovery: {
|
|
63669
|
+
id: 'bugbot-review-blocks-pending',
|
|
63670
|
+
variables: { pendingCount: diagnostic.count },
|
|
63671
|
+
},
|
|
63672
|
+
})
|
|
63673
|
+
: new Error(message),
|
|
63334
63674
|
};
|
|
63335
63675
|
}
|
|
63336
63676
|
function report(projection, reviewUpdates, pendingReviewUpdates, statusCardOperation, errors) {
|
|
@@ -63443,6 +63783,7 @@ exports.runVerifyCommands = runVerifyCommands;
|
|
|
63443
63783
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
63444
63784
|
const verify_command_policy_1 = __nccwpck_require__(96031);
|
|
63445
63785
|
const verification_runtime_policy_1 = __nccwpck_require__(89347);
|
|
63786
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
63446
63787
|
async function runVerifyCommands(commands, execute) {
|
|
63447
63788
|
for (const command of commands) {
|
|
63448
63789
|
const result = await executeVerifyCommand(command, execute);
|
|
@@ -63462,7 +63803,7 @@ async function executeVerifyCommand(command, execute) {
|
|
|
63462
63803
|
: { success: false, failedCommand: formatCommandForDiagnostics(parsed) };
|
|
63463
63804
|
}
|
|
63464
63805
|
catch (error) {
|
|
63465
|
-
if (error instanceof verification_runtime_policy_1.VerificationPrerequisiteError) {
|
|
63806
|
+
if (error instanceof verification_runtime_policy_1.VerificationPrerequisiteError || error instanceof verification_setup_policy_1.VerificationSetupError) {
|
|
63466
63807
|
return { success: false, failedCommand: formatCommandForDiagnostics(parsed),
|
|
63467
63808
|
error: `${error.message} Verification command: ${formatCommandForDiagnostics(parsed)}.` };
|
|
63468
63809
|
}
|
|
@@ -68785,9 +69126,16 @@ exports.APPLICATION_ERROR_RECOVERY_IDS = Object.freeze([
|
|
|
68785
69126
|
'branch-sync-resolution-invalid',
|
|
68786
69127
|
'sdd-draft-size-exceeded',
|
|
68787
69128
|
'sdd-draft-format-invalid',
|
|
69129
|
+
'sdd-draft-case-identity-invalid',
|
|
69130
|
+
'sdd-draft-case-budget-invalid',
|
|
69131
|
+
'sdd-draft-requirement-mapping-invalid',
|
|
69132
|
+
'sdd-draft-repository-path-invalid',
|
|
68788
69133
|
'workspace-changes-rejected',
|
|
68789
69134
|
'closed-issue-reconciliation-failed',
|
|
68790
69135
|
'approval-evidence-read-failed',
|
|
69136
|
+
'stored-configuration-schema-missing',
|
|
69137
|
+
'stored-configuration-schema-unsupported',
|
|
69138
|
+
'stored-configuration-invalid',
|
|
68791
69139
|
]);
|
|
68792
69140
|
const PRESERVED_STATE = 'Existing persisted state and completed external effects were preserved.';
|
|
68793
69141
|
const UNCHANGED_STATE = 'No new state or external effect was created.';
|
|
@@ -68979,6 +69327,9 @@ class ApplicationError extends Error {
|
|
|
68979
69327
|
exports.ApplicationError = ApplicationError;
|
|
68980
69328
|
_ApplicationError_cause = new WeakMap();
|
|
68981
69329
|
const RECOVERY_VARIABLE_KEYS = Object.freeze({
|
|
69330
|
+
'stored-configuration-schema-missing': Object.freeze(['issueNumber', 'expectedVersion']),
|
|
69331
|
+
'stored-configuration-schema-unsupported': Object.freeze(['issueNumber', 'expectedVersion', 'actualVersion']),
|
|
69332
|
+
'stored-configuration-invalid': Object.freeze(['issueNumber', 'expectedVersion']),
|
|
68982
69333
|
'closed-issue-reconciliation-failed': Object.freeze(['resultId', 'phase', 'state', 'reason', 'changed', 'remaining']),
|
|
68983
69334
|
'approval-evidence-read-failed': Object.freeze(['operation', 'reason', 'permission']),
|
|
68984
69335
|
'pull-request-link-restored': Object.freeze([]),
|
|
@@ -68993,6 +69344,10 @@ const RECOVERY_VARIABLE_KEYS = Object.freeze({
|
|
|
68993
69344
|
'branch-sync-resolution-invalid': Object.freeze(['validationCode', 'command']),
|
|
68994
69345
|
'sdd-draft-size-exceeded': Object.freeze([]),
|
|
68995
69346
|
'sdd-draft-format-invalid': Object.freeze([]),
|
|
69347
|
+
'sdd-draft-case-identity-invalid': Object.freeze([]),
|
|
69348
|
+
'sdd-draft-case-budget-invalid': Object.freeze([]),
|
|
69349
|
+
'sdd-draft-requirement-mapping-invalid': Object.freeze([]),
|
|
69350
|
+
'sdd-draft-repository-path-invalid': Object.freeze([]),
|
|
68996
69351
|
'workspace-changes-rejected': Object.freeze([]),
|
|
68997
69352
|
});
|
|
68998
69353
|
function normalizeApplicationErrorRecovery(recovery) {
|
|
@@ -69008,6 +69363,13 @@ function normalizeApplicationErrorRecovery(recovery) {
|
|
|
69008
69363
|
|| actualKeys.some((key, index) => key !== expectedKeys[index])) {
|
|
69009
69364
|
throw new TypeError(`Application error recovery variables are invalid for ${recovery.id}.`);
|
|
69010
69365
|
}
|
|
69366
|
+
if (recovery.id.startsWith('stored-configuration-')
|
|
69367
|
+
&& (![variables.issueNumber, variables.expectedVersion].every(value => typeof value === 'number' && Number.isSafeInteger(value) && value > 0)
|
|
69368
|
+
|| (recovery.id === 'stored-configuration-schema-unsupported'
|
|
69369
|
+
&& !(typeof variables.actualVersion === 'number'
|
|
69370
|
+
&& Number.isSafeInteger(variables.actualVersion) && variables.actualVersion >= 0)))) {
|
|
69371
|
+
throw new TypeError('Stored configuration diagnostic is invalid.');
|
|
69372
|
+
}
|
|
69011
69373
|
if (recovery.id === 'managed-branch-enrichment-failed'
|
|
69012
69374
|
&& (typeof variables.branchName !== 'string'
|
|
69013
69375
|
|| !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,254}$/u.test(variables.branchName))) {
|
|
@@ -69389,6 +69751,7 @@ class Execution {
|
|
|
69389
69751
|
this.currentIssueWorkflowAdmission = components.issueWorkflowAdmission;
|
|
69390
69752
|
this.currentConfiguration.issueWorkflowProfileDigest = components.issueWorkflowProfileDigest;
|
|
69391
69753
|
this.preBranchSdd = components.preBranchSdd ?? false;
|
|
69754
|
+
this.verificationSetup = components.verificationSetup ?? false;
|
|
69392
69755
|
}
|
|
69393
69756
|
}
|
|
69394
69757
|
exports.Execution = Execution;
|
|
@@ -74451,6 +74814,7 @@ function combineOrganizationAccess(secrets, variables) {
|
|
|
74451
74814
|
|
|
74452
74815
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
74453
74816
|
exports.isGithubAlreadyExists = exports.isGithubPermissionDenied = exports.isGithubRateLimited = exports.isGithubNotFound = exports.getGithubErrorStatus = void 0;
|
|
74817
|
+
exports.githubReadErrorCode = githubReadErrorCode;
|
|
74454
74818
|
const getGithubErrorStatus = (error) => {
|
|
74455
74819
|
if (typeof error !== "object" || error === null)
|
|
74456
74820
|
return undefined;
|
|
@@ -74460,6 +74824,23 @@ const getGithubErrorStatus = (error) => {
|
|
|
74460
74824
|
exports.getGithubErrorStatus = getGithubErrorStatus;
|
|
74461
74825
|
const isGithubNotFound = (error) => (0, exports.getGithubErrorStatus)(error) === 404;
|
|
74462
74826
|
exports.isGithubNotFound = isGithubNotFound;
|
|
74827
|
+
/** Maps failed metadata reads without copying untrusted provider text. */
|
|
74828
|
+
function githubReadErrorCode(error) {
|
|
74829
|
+
const status = (0, exports.getGithubErrorStatus)(error);
|
|
74830
|
+
if (status === 401)
|
|
74831
|
+
return 'authorization.credential-invalid';
|
|
74832
|
+
if ((0, exports.isGithubRateLimited)(error))
|
|
74833
|
+
return 'provider.rate-limited';
|
|
74834
|
+
if (status === 403)
|
|
74835
|
+
return 'authorization.denied';
|
|
74836
|
+
if (status === 404)
|
|
74837
|
+
return 'provider.not-found';
|
|
74838
|
+
if (status === 409 || status === 412)
|
|
74839
|
+
return 'provider.conflict';
|
|
74840
|
+
if (status === 400 || status === 422)
|
|
74841
|
+
return 'provider.contract-invalid';
|
|
74842
|
+
return 'provider.unavailable';
|
|
74843
|
+
}
|
|
74463
74844
|
const isGithubRateLimited = (error) => {
|
|
74464
74845
|
const status = (0, exports.getGithubErrorStatus)(error);
|
|
74465
74846
|
if (status === 429)
|
|
@@ -75170,8 +75551,9 @@ class IssueContentRepository {
|
|
|
75170
75551
|
return issue.body ?? '';
|
|
75171
75552
|
}
|
|
75172
75553
|
catch (error) {
|
|
75173
|
-
(0,
|
|
75174
|
-
|
|
75554
|
+
const semanticError = (0, application_error_1.toApplicationError)(error, (0, github_error_policy_1.githubReadErrorCode)(error), 'Unable to read the issue or pull-request description.');
|
|
75555
|
+
(0, logger_1.logError)(semanticError);
|
|
75556
|
+
throw semanticError;
|
|
75175
75557
|
}
|
|
75176
75558
|
};
|
|
75177
75559
|
this.getIssueDescription = async (owner, repository, issueNumber, token) => {
|
|
@@ -77533,8 +77915,8 @@ function collectDiagnostic(diagnostics, cause) {
|
|
|
77533
77915
|
|
|
77534
77916
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77535
77917
|
exports.PullRequestChangesRepository = void 0;
|
|
77918
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
77536
77919
|
const logger_1 = __nccwpck_require__(91151);
|
|
77537
|
-
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
77538
77920
|
const github_pagination_policy_1 = __nccwpck_require__(44812);
|
|
77539
77921
|
const application_error_1 = __nccwpck_require__(75999);
|
|
77540
77922
|
class PullRequestChangesRepository {
|
|
@@ -77547,7 +77929,7 @@ class PullRequestChangesRepository {
|
|
|
77547
77929
|
}
|
|
77548
77930
|
catch (error) {
|
|
77549
77931
|
(0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request review diff.'));
|
|
77550
|
-
throw (0,
|
|
77932
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-files');
|
|
77551
77933
|
}
|
|
77552
77934
|
};
|
|
77553
77935
|
this.getBoundedBugbotReviewDiffSnapshot = async (owner, repository, pullNumber, token) => {
|
|
@@ -77589,7 +77971,7 @@ class PullRequestChangesRepository {
|
|
|
77589
77971
|
}
|
|
77590
77972
|
catch (error) {
|
|
77591
77973
|
(0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request review diff.'));
|
|
77592
|
-
throw (0,
|
|
77974
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-files');
|
|
77593
77975
|
}
|
|
77594
77976
|
};
|
|
77595
77977
|
/** Head commit SHA of the PR (for creating review). */
|
|
@@ -77608,7 +77990,7 @@ class PullRequestChangesRepository {
|
|
|
77608
77990
|
}
|
|
77609
77991
|
catch (error) {
|
|
77610
77992
|
(0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request head SHA.'));
|
|
77611
|
-
throw (0,
|
|
77993
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "get-head-sha");
|
|
77612
77994
|
}
|
|
77613
77995
|
};
|
|
77614
77996
|
}
|
|
@@ -77951,6 +78333,7 @@ function toBugbotPullRequestIdentity(value) {
|
|
|
77951
78333
|
|
|
77952
78334
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77953
78335
|
exports.PullRequestReviewCommentCommandRepository = void 0;
|
|
78336
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
77954
78337
|
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
77955
78338
|
const github_pagination_policy_1 = __nccwpck_require__(44812);
|
|
77956
78339
|
class PullRequestReviewCommentCommandRepository {
|
|
@@ -78019,7 +78402,7 @@ class PullRequestReviewCommentCommandRepository {
|
|
|
78019
78402
|
const context = comments.length > 0
|
|
78020
78403
|
? { failedCount: comments.length, totalCount: comments.length }
|
|
78021
78404
|
: undefined;
|
|
78022
|
-
throw (0,
|
|
78405
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "publish-comments", context);
|
|
78023
78406
|
}
|
|
78024
78407
|
}
|
|
78025
78408
|
async updatePullRequestReview(owner, repository, pullRequestNumber, reviewIdentity, body, token) {
|
|
@@ -78040,7 +78423,7 @@ class PullRequestReviewCommentCommandRepository {
|
|
|
78040
78423
|
throw new pull_request_review_errors_1.PullRequestReviewOperationError('update-review');
|
|
78041
78424
|
}
|
|
78042
78425
|
catch (error) {
|
|
78043
|
-
throw (0,
|
|
78426
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'update-review');
|
|
78044
78427
|
}
|
|
78045
78428
|
}
|
|
78046
78429
|
async updatePullRequestReviewComment(_owner, _repository, commentIdentity, body, token) {
|
|
@@ -78059,7 +78442,7 @@ class PullRequestReviewCommentCommandRepository {
|
|
|
78059
78442
|
}
|
|
78060
78443
|
}
|
|
78061
78444
|
catch (error) {
|
|
78062
|
-
throw (0,
|
|
78445
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "update-comment");
|
|
78063
78446
|
}
|
|
78064
78447
|
}
|
|
78065
78448
|
}
|
|
@@ -78075,7 +78458,7 @@ exports.PullRequestReviewCommentCommandRepository = PullRequestReviewCommentComm
|
|
|
78075
78458
|
|
|
78076
78459
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78077
78460
|
exports.PullRequestReviewCommentQueryRepository = void 0;
|
|
78078
|
-
const
|
|
78461
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
78079
78462
|
const github_pagination_policy_1 = __nccwpck_require__(44812);
|
|
78080
78463
|
function toReviewComment(comment) {
|
|
78081
78464
|
if (typeof comment.node_id !== "string" || comment.node_id.length === 0) {
|
|
@@ -78131,7 +78514,7 @@ class PullRequestReviewCommentQueryRepository {
|
|
|
78131
78514
|
return comments;
|
|
78132
78515
|
}
|
|
78133
78516
|
catch (error) {
|
|
78134
|
-
throw (0,
|
|
78517
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-comments");
|
|
78135
78518
|
}
|
|
78136
78519
|
}
|
|
78137
78520
|
async listBugbotPullRequestReviewCommentsBounded(owner, repository, pullRequestNumber, token) {
|
|
@@ -78174,7 +78557,7 @@ class PullRequestReviewCommentQueryRepository {
|
|
|
78174
78557
|
};
|
|
78175
78558
|
}
|
|
78176
78559
|
catch (error) {
|
|
78177
|
-
throw (0,
|
|
78560
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-comments");
|
|
78178
78561
|
}
|
|
78179
78562
|
}
|
|
78180
78563
|
async listPullRequestReviews(owner, repository, pullRequestNumber, token) {
|
|
@@ -78188,7 +78571,7 @@ class PullRequestReviewCommentQueryRepository {
|
|
|
78188
78571
|
return reviews;
|
|
78189
78572
|
}
|
|
78190
78573
|
catch (error) {
|
|
78191
|
-
throw (0,
|
|
78574
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-reviews');
|
|
78192
78575
|
}
|
|
78193
78576
|
}
|
|
78194
78577
|
async getPullRequestReviewCommentBody(owner, repository, _pullRequestNumber, commentId, token) {
|
|
@@ -78202,13 +78585,37 @@ class PullRequestReviewCommentQueryRepository {
|
|
|
78202
78585
|
return data.body ?? null;
|
|
78203
78586
|
}
|
|
78204
78587
|
catch (error) {
|
|
78205
|
-
throw (0,
|
|
78588
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "get-comment");
|
|
78206
78589
|
}
|
|
78207
78590
|
}
|
|
78208
78591
|
}
|
|
78209
78592
|
exports.PullRequestReviewCommentQueryRepository = PullRequestReviewCommentQueryRepository;
|
|
78210
78593
|
|
|
78211
78594
|
|
|
78595
|
+
/***/ }),
|
|
78596
|
+
|
|
78597
|
+
/***/ 54354:
|
|
78598
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
78599
|
+
|
|
78600
|
+
"use strict";
|
|
78601
|
+
|
|
78602
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78603
|
+
exports.toPullRequestReviewOperationError = toPullRequestReviewOperationError;
|
|
78604
|
+
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
78605
|
+
/** Only safe HTTP metadata crosses the provider boundary; provider prose never does. */
|
|
78606
|
+
function toPullRequestReviewOperationError(error, operation, context) {
|
|
78607
|
+
if (!error || typeof error !== 'object')
|
|
78608
|
+
return (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, operation, context);
|
|
78609
|
+
const record = error;
|
|
78610
|
+
return (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, operation, {
|
|
78611
|
+
...context,
|
|
78612
|
+
...(typeof record.status === 'number' ? { providerStatus: record.status } : {}),
|
|
78613
|
+
...(typeof record.response?.headers?.['x-github-request-id'] === 'string'
|
|
78614
|
+
? { providerReference: record.response.headers['x-github-request-id'] } : {}),
|
|
78615
|
+
});
|
|
78616
|
+
}
|
|
78617
|
+
|
|
78618
|
+
|
|
78212
78619
|
/***/ }),
|
|
78213
78620
|
|
|
78214
78621
|
/***/ 2307:
|
|
@@ -78319,6 +78726,7 @@ function nextConnectionCursor(pageInfo, seenCursors) {
|
|
|
78319
78726
|
|
|
78320
78727
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78321
78728
|
exports.PullRequestReviewThreadRepository = void 0;
|
|
78729
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
78322
78730
|
const logger_1 = __nccwpck_require__(91151);
|
|
78323
78731
|
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
78324
78732
|
const pull_request_review_thread_locator_1 = __nccwpck_require__(2307);
|
|
@@ -78366,7 +78774,7 @@ class PullRequestReviewThreadRepository {
|
|
|
78366
78774
|
return states;
|
|
78367
78775
|
}
|
|
78368
78776
|
catch (error) {
|
|
78369
|
-
throw (0,
|
|
78777
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-threads');
|
|
78370
78778
|
}
|
|
78371
78779
|
};
|
|
78372
78780
|
this.listBugbotPullRequestReviewThreadStatesBounded = async (owner, repository, pullNumber, token) => {
|
|
@@ -78435,7 +78843,7 @@ class PullRequestReviewThreadRepository {
|
|
|
78435
78843
|
};
|
|
78436
78844
|
}
|
|
78437
78845
|
catch (error) {
|
|
78438
|
-
throw (0,
|
|
78846
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-threads');
|
|
78439
78847
|
}
|
|
78440
78848
|
};
|
|
78441
78849
|
this.resolvePullRequestReviewThread = async (owner, repository, pullNumber, commentIdentity, token) => {
|
|
@@ -78459,7 +78867,7 @@ class PullRequestReviewThreadRepository {
|
|
|
78459
78867
|
(0, logger_1.logDebugInfo)('Resolved pull request review thread.');
|
|
78460
78868
|
}
|
|
78461
78869
|
catch (error) {
|
|
78462
|
-
throw (0,
|
|
78870
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'resolve-thread');
|
|
78463
78871
|
}
|
|
78464
78872
|
};
|
|
78465
78873
|
this.unresolvePullRequestReviewThread = async (owner, repository, pullNumber, commentIdentity, token) => {
|
|
@@ -78483,7 +78891,7 @@ class PullRequestReviewThreadRepository {
|
|
|
78483
78891
|
(0, logger_1.logDebugInfo)('Reopened pull request review thread.');
|
|
78484
78892
|
}
|
|
78485
78893
|
catch (error) {
|
|
78486
|
-
throw (0,
|
|
78894
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'unresolve-thread');
|
|
78487
78895
|
}
|
|
78488
78896
|
};
|
|
78489
78897
|
}
|
|
@@ -78500,7 +78908,7 @@ exports.PullRequestReviewThreadRepository = PullRequestReviewThreadRepository;
|
|
|
78500
78908
|
|
|
78501
78909
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78502
78910
|
exports.PullRequestReviewerRepository = void 0;
|
|
78503
|
-
const
|
|
78911
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
78504
78912
|
const github_pagination_policy_1 = __nccwpck_require__(44812);
|
|
78505
78913
|
const COMPLETED_REVIEW_STATES = new Set([
|
|
78506
78914
|
"APPROVED",
|
|
@@ -78533,7 +78941,7 @@ class PullRequestReviewerRepository {
|
|
|
78533
78941
|
return [...reviewers.values()];
|
|
78534
78942
|
}
|
|
78535
78943
|
catch (error) {
|
|
78536
|
-
throw (0,
|
|
78944
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-reviewers");
|
|
78537
78945
|
}
|
|
78538
78946
|
}
|
|
78539
78947
|
async addReviewersToPullRequest(owner, repository, pullRequestNumber, reviewers, token) {
|
|
@@ -78558,7 +78966,7 @@ class PullRequestReviewerRepository {
|
|
|
78558
78966
|
return [...confirmed.values()];
|
|
78559
78967
|
}
|
|
78560
78968
|
catch (error) {
|
|
78561
|
-
throw (0,
|
|
78969
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "request-reviewers");
|
|
78562
78970
|
}
|
|
78563
78971
|
}
|
|
78564
78972
|
async listRequestedReviewers(client, parameters) {
|
|
@@ -79976,10 +80384,15 @@ function matchesConstrainedHead(target, candidate) {
|
|
|
79976
80384
|
/***/ }),
|
|
79977
80385
|
|
|
79978
80386
|
/***/ 31011:
|
|
79979
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
80387
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
79980
80388
|
|
|
79981
80389
|
"use strict";
|
|
79982
80390
|
|
|
80391
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80392
|
+
exports.isExistingFindingFullyResolved = isExistingFindingFullyResolved;
|
|
80393
|
+
exports.findExistingFindingInfo = findExistingFindingInfo;
|
|
80394
|
+
exports.findExistingFindingMatch = findExistingFindingMatch;
|
|
80395
|
+
exports.retainExistingFindingIds = retainExistingFindingIds;
|
|
79983
80396
|
/**
|
|
79984
80397
|
* Provider-neutral Bugbot finding and durable identity contracts.
|
|
79985
80398
|
*
|
|
@@ -79987,9 +80400,7 @@ function matchesConstrainedHead(target, candidate) {
|
|
|
79987
80400
|
* them in the domain prevents policies from depending on a particular use-case
|
|
79988
80401
|
* folder and gives every adapter one stable semantic vocabulary.
|
|
79989
80402
|
*/
|
|
79990
|
-
|
|
79991
|
-
exports.isExistingFindingFullyResolved = isExistingFindingFullyResolved;
|
|
79992
|
-
exports.findExistingFindingInfo = findExistingFindingInfo;
|
|
80403
|
+
const finding_identity_1 = __nccwpck_require__(91853);
|
|
79993
80404
|
function isExistingFindingFullyResolved(finding) {
|
|
79994
80405
|
const destinations = [finding.issue, finding.pullRequest].filter((destination) => destination != null);
|
|
79995
80406
|
return (destinations.length > 0 &&
|
|
@@ -79997,21 +80408,62 @@ function isExistingFindingFullyResolved(finding) {
|
|
|
79997
80408
|
finding.pullRequest?.verificationRequired !== true);
|
|
79998
80409
|
}
|
|
79999
80410
|
function findExistingFindingInfo(existingByFindingId, finding) {
|
|
80411
|
+
return findExistingFindingMatch(existingByFindingId, finding)?.info;
|
|
80412
|
+
}
|
|
80413
|
+
/** A match carries its durable key so updating a comment cannot re-key it. */
|
|
80414
|
+
function findExistingFindingMatch(existingByFindingId, finding) {
|
|
80000
80415
|
const direct = existingByFindingId[finding.id];
|
|
80001
80416
|
if (direct && identitiesAreCompatible(direct, finding))
|
|
80002
|
-
return direct;
|
|
80003
|
-
const candidates = Object.
|
|
80417
|
+
return { id: finding.id, info: direct };
|
|
80418
|
+
const candidates = Object.entries(existingByFindingId);
|
|
80004
80419
|
if (finding.fingerprint) {
|
|
80005
|
-
const
|
|
80420
|
+
const locationMatches = candidates.filter(([, candidate]) => candidate.issue?.fingerprint === finding.fingerprint
|
|
80006
80421
|
|| candidate.pullRequest?.fingerprint === finding.fingerprint);
|
|
80007
|
-
if (
|
|
80008
|
-
return
|
|
80422
|
+
if (locationMatches.length > 0)
|
|
80423
|
+
return uniqueFindingMatch(locationMatches);
|
|
80009
80424
|
}
|
|
80010
80425
|
if (!finding.semanticFingerprint)
|
|
80011
80426
|
return undefined;
|
|
80012
|
-
const semanticMatches = candidates.filter((candidate) => candidate.issue?.semanticFingerprint === finding.semanticFingerprint
|
|
80427
|
+
const semanticMatches = candidates.filter(([, candidate]) => candidate.issue?.semanticFingerprint === finding.semanticFingerprint
|
|
80013
80428
|
|| candidate.pullRequest?.semanticFingerprint === finding.semanticFingerprint);
|
|
80014
|
-
return semanticMatches
|
|
80429
|
+
return uniqueFindingMatch(semanticMatches);
|
|
80430
|
+
}
|
|
80431
|
+
/**
|
|
80432
|
+
* Preserve trusted IDs across title/location changes, before limits, publication
|
|
80433
|
+
* and final projection. Multiple reports of one uniquely matched durable finding
|
|
80434
|
+
* share one record; unmatched or ambiguous reports remain independent evidence.
|
|
80435
|
+
*/
|
|
80436
|
+
function retainExistingFindingIds(findings, existingByFindingId) {
|
|
80437
|
+
const retained = new Set();
|
|
80438
|
+
const durableIds = new Set(Object.keys(existingByFindingId));
|
|
80439
|
+
// Reserve the whole input up front so a generated ID cannot take another
|
|
80440
|
+
// report's ID, including one that occurs later in the response.
|
|
80441
|
+
const reservedIds = new Set([...durableIds, ...findings.map((finding) => finding.id)]);
|
|
80442
|
+
const emittedIds = new Set();
|
|
80443
|
+
return findings.flatMap((finding) => {
|
|
80444
|
+
const match = findExistingFindingMatch(existingByFindingId, finding);
|
|
80445
|
+
if (!match) {
|
|
80446
|
+
let id = finding.id;
|
|
80447
|
+
if (durableIds.has(id) || emittedIds.has(id)) {
|
|
80448
|
+
const base = `candidate-${(0, finding_identity_1.buildFindingFingerprint)(finding)}`;
|
|
80449
|
+
id = base;
|
|
80450
|
+
let suffix = 0;
|
|
80451
|
+
while (reservedIds.has(id))
|
|
80452
|
+
id = `${base}-${++suffix}`;
|
|
80453
|
+
reservedIds.add(id);
|
|
80454
|
+
}
|
|
80455
|
+
emittedIds.add(id);
|
|
80456
|
+
return [id === finding.id ? finding : { ...finding, id }];
|
|
80457
|
+
}
|
|
80458
|
+
if (retained.has(match.id))
|
|
80459
|
+
return [];
|
|
80460
|
+
retained.add(match.id);
|
|
80461
|
+
emittedIds.add(match.id);
|
|
80462
|
+
return [finding.id === match.id ? finding : { ...finding, id: match.id }];
|
|
80463
|
+
});
|
|
80464
|
+
}
|
|
80465
|
+
function uniqueFindingMatch(matches) {
|
|
80466
|
+
return matches.length === 1 ? { id: matches[0][0], info: matches[0][1] } : undefined;
|
|
80015
80467
|
}
|
|
80016
80468
|
function identitiesAreCompatible(existing, finding) {
|
|
80017
80469
|
const existingFingerprints = [
|
|
@@ -80553,6 +81005,63 @@ function isCopilotCommentRequest(commentBody, botLogin) {
|
|
|
80553
81005
|
}
|
|
80554
81006
|
|
|
80555
81007
|
|
|
81008
|
+
/***/ }),
|
|
81009
|
+
|
|
81010
|
+
/***/ 33430:
|
|
81011
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
81012
|
+
|
|
81013
|
+
"use strict";
|
|
81014
|
+
|
|
81015
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
81016
|
+
exports.COPILOT_COMMENT_REMOTE_WORKFLOW = exports.COPILOT_COMMENT_SELF_WORKFLOW = exports.COPILOT_COMMENT_RUNTIME = void 0;
|
|
81017
|
+
exports.isCopilotCommentWorkflow = isCopilotCommentWorkflow;
|
|
81018
|
+
exports.isCopilotCommentRunner = isCopilotCommentRunner;
|
|
81019
|
+
exports.copilotCommentRunner = copilotCommentRunner;
|
|
81020
|
+
/** The comment coordinator is a versioned Copilot workflow, not an arbitrary reusable job. */
|
|
81021
|
+
exports.COPILOT_COMMENT_RUNTIME = 'copilot_comment_runtime.yml';
|
|
81022
|
+
exports.COPILOT_COMMENT_SELF_WORKFLOW = `$/.github/workflows/${exports.COPILOT_COMMENT_RUNTIME}`;
|
|
81023
|
+
exports.COPILOT_COMMENT_REMOTE_WORKFLOW = `vypdev/copilot/.github/workflows/${exports.COPILOT_COMMENT_RUNTIME}@v3`;
|
|
81024
|
+
function isCopilotCommentWorkflow(value) {
|
|
81025
|
+
return typeof value === 'string' && (value === exports.COPILOT_COMMENT_SELF_WORKFLOW
|
|
81026
|
+
|| /^vypdev\/copilot\/\.github\/workflows\/copilot_comment_runtime\.yml@(?:v3(?:\.[0-9]+\.[0-9]+)?|[a-f0-9]{40})$/u.test(value));
|
|
81027
|
+
}
|
|
81028
|
+
const literal = (value) => typeof value === 'string' && value.length > 0 && value.length <= 100
|
|
81029
|
+
&& value === value.trim() && !/[\p{Cc}\p{Cf}${}<>]/u.test(value);
|
|
81030
|
+
const labels = (value) => literal(value) || Array.isArray(value) && value.length > 0 && value.length <= 10
|
|
81031
|
+
&& value.every(literal) && new Set(value.map(label => label.toLowerCase())).size === value.length;
|
|
81032
|
+
/** Runner routing is literal data; expressions need their original full workflow reviewed. */
|
|
81033
|
+
function isCopilotCommentRunner(value) {
|
|
81034
|
+
if (labels(value))
|
|
81035
|
+
return true;
|
|
81036
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
81037
|
+
return false;
|
|
81038
|
+
const route = value;
|
|
81039
|
+
const keys = Object.keys(route);
|
|
81040
|
+
return keys.length > 0 && (route.group !== undefined || route.labels !== undefined)
|
|
81041
|
+
&& keys.every(key => key === 'group' || key === 'labels')
|
|
81042
|
+
&& (route.group === undefined || literal(route.group))
|
|
81043
|
+
&& (route.labels === undefined || labels(route.labels));
|
|
81044
|
+
}
|
|
81045
|
+
function copilotCommentRunner(job) {
|
|
81046
|
+
if (!job || !isCopilotCommentWorkflow(job.uses))
|
|
81047
|
+
return job?.['runs-on'];
|
|
81048
|
+
const inputs = job.with;
|
|
81049
|
+
if (typeof inputs?.['runs-on'] !== 'string')
|
|
81050
|
+
throw new Error('Comment workflow runner JSON is unavailable; review the workflow separately.');
|
|
81051
|
+
try {
|
|
81052
|
+
if (inputs['runs-on'].length > 16000)
|
|
81053
|
+
throw new Error('Runner JSON exceeds its bound.');
|
|
81054
|
+
const route = JSON.parse(inputs['runs-on']);
|
|
81055
|
+
if (!isCopilotCommentRunner(route))
|
|
81056
|
+
throw new Error('Unsupported execution route.');
|
|
81057
|
+
return route;
|
|
81058
|
+
}
|
|
81059
|
+
catch {
|
|
81060
|
+
throw new Error('Comment workflow runner JSON is invalid; review the workflow separately.');
|
|
81061
|
+
}
|
|
81062
|
+
}
|
|
81063
|
+
|
|
81064
|
+
|
|
80556
81065
|
/***/ }),
|
|
80557
81066
|
|
|
80558
81067
|
/***/ 72418:
|
|
@@ -82357,7 +82866,7 @@ function parsePositiveSafeInteger(value) {
|
|
|
82357
82866
|
"use strict";
|
|
82358
82867
|
|
|
82359
82868
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
82360
|
-
exports.SDD_REQUIRED_HEADINGS = exports.SddOwnerFormatFailure = exports.SddDraftFormatFailure = exports.SDD_MAX_UPDATE_CHARACTERS = exports.SDD_MAX_DRAFT_CHARACTERS = exports.SDD_MIN_DRAFT_CHARACTERS = exports.SDD_GATE_MARKER = void 0;
|
|
82869
|
+
exports.SDD_REQUIRED_HEADINGS = exports.SddOwnerFormatFailure = exports.SddDraftFormatFailure = exports.SddOwnershipFailure = exports.SDD_MAX_UPDATE_CHARACTERS = exports.SDD_MAX_DRAFT_CHARACTERS = exports.SDD_MIN_DRAFT_CHARACTERS = exports.SDD_GATE_MARKER = void 0;
|
|
82361
82870
|
exports.retainSddAnswers = retainSddAnswers;
|
|
82362
82871
|
exports.normalizeSddIssueTitle = normalizeSddIssueTitle;
|
|
82363
82872
|
exports.isSafeSddPath = isSafeSddPath;
|
|
@@ -82368,6 +82877,7 @@ exports.isSddAnswerComment = isSddAnswerComment;
|
|
|
82368
82877
|
exports.parseSddAnswer = parseSddAnswer;
|
|
82369
82878
|
exports.validateSddMarkdown = validateSddMarkdown;
|
|
82370
82879
|
exports.composeSddUpdate = composeSddUpdate;
|
|
82880
|
+
exports.recoverSddUpdate = recoverSddUpdate;
|
|
82371
82881
|
exports.SDD_GATE_MARKER = 'copilot:sdd-gate:v1';
|
|
82372
82882
|
exports.SDD_MIN_DRAFT_CHARACTERS = 1800;
|
|
82373
82883
|
exports.SDD_MAX_DRAFT_CHARACTERS = 70000;
|
|
@@ -82395,6 +82905,15 @@ function normalizeSddIssueTitle(title) {
|
|
|
82395
82905
|
function isSafeSddPath(path) {
|
|
82396
82906
|
return SDD_PATH.test(path) && !['specs/CATALOG.md', 'specs/_template.md'].includes(path);
|
|
82397
82907
|
}
|
|
82908
|
+
/** Closed diagnostics contain no model-selected identifiers or provider text. */
|
|
82909
|
+
class SddOwnershipFailure extends Error {
|
|
82910
|
+
constructor(reason) {
|
|
82911
|
+
super(`SDD ownership analysis rejected (${reason}).`);
|
|
82912
|
+
this.reason = reason;
|
|
82913
|
+
this.name = 'SddOwnershipFailure';
|
|
82914
|
+
}
|
|
82915
|
+
}
|
|
82916
|
+
exports.SddOwnershipFailure = SddOwnershipFailure;
|
|
82398
82917
|
/** The agent may propose ownership but cannot invent a catalogued owner or arbitrary path. */
|
|
82399
82918
|
function parseSddPlan(value, catalog) {
|
|
82400
82919
|
if (!isRecord(value))
|
|
@@ -82412,14 +82931,16 @@ function parseSddPlan(value, catalog) {
|
|
|
82412
82931
|
const ownerPaths = catalog.get(capabilityId);
|
|
82413
82932
|
const registered = [...catalog.values()].some(paths => paths.includes(path));
|
|
82414
82933
|
if (action === 'update' && (!ownerPaths?.includes(path) || !registered)) {
|
|
82415
|
-
throw new
|
|
82416
|
-
}
|
|
82417
|
-
if (action === 'companion' &&
|
|
82418
|
-
throw new
|
|
82419
|
-
|
|
82420
|
-
|
|
82421
|
-
|
|
82422
|
-
|
|
82934
|
+
throw new SddOwnershipFailure('update-owner-mismatch');
|
|
82935
|
+
}
|
|
82936
|
+
if (action === 'companion' && !ownerPaths)
|
|
82937
|
+
throw new SddOwnershipFailure('companion-owner-unknown');
|
|
82938
|
+
if (action === 'companion' && registered)
|
|
82939
|
+
throw new SddOwnershipFailure('companion-path-registered');
|
|
82940
|
+
if (action === 'new' && ownerPaths)
|
|
82941
|
+
throw new SddOwnershipFailure('new-owner-registered');
|
|
82942
|
+
if (action === 'new' && registered)
|
|
82943
|
+
throw new SddOwnershipFailure('new-path-registered');
|
|
82423
82944
|
if (!Array.isArray(value.questions) || value.questions.length > 8) {
|
|
82424
82945
|
throw new Error('The SDD analysis must contain at most eight blocking questions.');
|
|
82425
82946
|
}
|
|
@@ -82660,8 +83181,24 @@ function composeSddUpdate(existing, change) {
|
|
|
82660
83181
|
validateSddMarkdown(change);
|
|
82661
83182
|
if (change.length > exports.SDD_MAX_UPDATE_CHARACTERS)
|
|
82662
83183
|
throw new Error('An SDD update appendix exceeds 18000 characters; use a proportional change or a companion SDD.');
|
|
83184
|
+
const appendix = shiftSddHeadings(change, 1);
|
|
83185
|
+
const merged = `${existing.trimEnd()}\n\n${appendix.trim()}\n`;
|
|
83186
|
+
validateSddMarkdown(merged);
|
|
83187
|
+
return merged;
|
|
83188
|
+
}
|
|
83189
|
+
/** Recovery validates the original candidate, not a second copy of its retained baseline. */
|
|
83190
|
+
function recoverSddUpdate(existing, published) {
|
|
83191
|
+
const prefix = `${existing.trimEnd()}\n\n`;
|
|
83192
|
+
if (!published.startsWith(prefix))
|
|
83193
|
+
return undefined;
|
|
83194
|
+
// Composition normalizes outer whitespace and adds a publication newline.
|
|
83195
|
+
// Reconstruct an equivalent candidate inside the original size bounds.
|
|
83196
|
+
const change = shiftSddHeadings(published.slice(prefix.length), -1).trim().padEnd(exports.SDD_MIN_DRAFT_CHARACTERS, '\n');
|
|
83197
|
+
return composeSddUpdate(existing, change) === published ? change : undefined;
|
|
83198
|
+
}
|
|
83199
|
+
function shiftSddHeadings(source, direction) {
|
|
82663
83200
|
let fence;
|
|
82664
|
-
|
|
83201
|
+
return source.split('\n').map(line => {
|
|
82665
83202
|
const boundary = line.match(/^\s*(`{3,}|~{3,})/);
|
|
82666
83203
|
if (boundary) {
|
|
82667
83204
|
if (!fence)
|
|
@@ -82670,11 +83207,11 @@ function composeSddUpdate(existing, change) {
|
|
|
82670
83207
|
fence = undefined;
|
|
82671
83208
|
return line;
|
|
82672
83209
|
}
|
|
82673
|
-
|
|
83210
|
+
if (fence)
|
|
83211
|
+
return line;
|
|
83212
|
+
return direction === 1 ? (/^#{1,5} /.test(line) ? `#${line}` : line)
|
|
83213
|
+
: (/^#{2,6} /.test(line) ? line.slice(1) : line);
|
|
82674
83214
|
}).join('\n');
|
|
82675
|
-
const merged = `${existing.trimEnd()}\n\n${appendix.trim()}\n`;
|
|
82676
|
-
validateSddMarkdown(merged);
|
|
82677
|
-
return merged;
|
|
82678
83215
|
}
|
|
82679
83216
|
function serializeSddGateValue(value) {
|
|
82680
83217
|
// Human answer text must never terminate its hidden state comment.
|
|
@@ -83271,6 +83808,254 @@ function replyRequestBodyDigest(body) {
|
|
|
83271
83808
|
}
|
|
83272
83809
|
|
|
83273
83810
|
|
|
83811
|
+
/***/ }),
|
|
83812
|
+
|
|
83813
|
+
/***/ 27910:
|
|
83814
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
83815
|
+
|
|
83816
|
+
"use strict";
|
|
83817
|
+
|
|
83818
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
83819
|
+
exports.SDD_CONSISTENCY_PROMPT = void 0;
|
|
83820
|
+
exports.reservedSddCaseIds = reservedSddCaseIds;
|
|
83821
|
+
exports.validateSddDraftConsistency = validateSddDraftConsistency;
|
|
83822
|
+
const pre_branch_sdd_1 = __nccwpck_require__(34730);
|
|
83823
|
+
const CASE = /\b(?:[A-Za-z][A-Za-z0-9]*-)+C\d+\b/gu;
|
|
83824
|
+
const CASE_ID = /^(?:[A-Za-z][A-Za-z0-9]*-)+C\d+$/u;
|
|
83825
|
+
const REQUIREMENT_ID = /^[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+$/u;
|
|
83826
|
+
/** Generated candidates use visible tables; retained legacy owners are never reformatted. */
|
|
83827
|
+
exports.SDD_CONSISTENCY_PROMPT = `Consistency contract for the proposed draft/appendix (not the retained owner):
|
|
83828
|
+
In section 4 include one table: Requirement | Behavior. Give every goal a stable requirement ID.
|
|
83829
|
+
In section 14 include one budget table: Area | Minimum distinct cases | Behaviors/risks covered; positive integers and one Total.
|
|
83830
|
+
Also in section 14 include one inventory table: Case ID | Area | Requirements | Scenario.
|
|
83831
|
+
Each row is one distinct executable case with a fully qualified ID such as capability-change-C01, one exact budget area, comma-separated requirement IDs and an observable scenario. Never use shorthand C01, ranges or redefine an ID found in any owning SDD. Reference retained baseline cases in prose using their full IDs; count only the new inventory.
|
|
83832
|
+
In section 17 include one table: Requirement | Cases. List comma-separated full case IDs for every requirement. Its links must exactly match the case inventory in both directions, with no undefined or generic documentation checks.
|
|
83833
|
+
In section 15 include one table: Path | Change. Change is update, reference or create. Include the selected SDD path itself with update for an existing SDD or create for a new/companion SDD. Use existing immutable-base files for update/reference. Only explicitly proposed new files may use create; never mark a missing current document as an existing artifact. Cite repository files as full repository-relative paths in backticks, or relative Markdown file links. Put every planned new file in this table. These tables are publication consistency checks, not runtime/security acceptance.`;
|
|
83834
|
+
function fail(reason) {
|
|
83835
|
+
// Closed diagnostics: rejected Markdown and repository text never become repair instructions.
|
|
83836
|
+
throw new pre_branch_sdd_1.SddDraftFormatFailure(reason, `The SDD draft violates its ${reason} consistency contract.`);
|
|
83837
|
+
}
|
|
83838
|
+
/** Excludes examples and hidden records from the contract. */
|
|
83839
|
+
function visible(source) {
|
|
83840
|
+
let fence;
|
|
83841
|
+
let comment = false;
|
|
83842
|
+
return source.replace(/\r\n/gu, '\n').split('\n').map(line => {
|
|
83843
|
+
const boundary = /^\s*(`{3,}|~{3,})/u.exec(line);
|
|
83844
|
+
if (fence) {
|
|
83845
|
+
// Comment syntax inside code is literal; only the original line can close it.
|
|
83846
|
+
if (boundary && boundary[1][0] === fence[0] && boundary[1].length >= fence.length
|
|
83847
|
+
&& /^ {0,3}(?:`+|~+)[ \t]*$/u.test(line))
|
|
83848
|
+
fence = undefined;
|
|
83849
|
+
return '';
|
|
83850
|
+
}
|
|
83851
|
+
if (!comment && boundary) {
|
|
83852
|
+
fence = boundary[1];
|
|
83853
|
+
return '';
|
|
83854
|
+
}
|
|
83855
|
+
let result = '';
|
|
83856
|
+
let offset = 0;
|
|
83857
|
+
while (offset < line.length) {
|
|
83858
|
+
const marker = comment ? '-->' : '<!--';
|
|
83859
|
+
const next = line.indexOf(marker, offset);
|
|
83860
|
+
if (next < 0)
|
|
83861
|
+
return result + (comment ? '' : line.slice(offset));
|
|
83862
|
+
if (!comment)
|
|
83863
|
+
result += line.slice(offset, next) + ' ';
|
|
83864
|
+
offset = next + marker.length;
|
|
83865
|
+
comment = !comment;
|
|
83866
|
+
}
|
|
83867
|
+
return result;
|
|
83868
|
+
}).join('\n');
|
|
83869
|
+
}
|
|
83870
|
+
function clean(value) { return value.trim().replace(/^(?:\*\*|__|`)(.*?)(?:\*\*|__|`)$/u, '$1').trim(); }
|
|
83871
|
+
function table(source, section, headers, reason) {
|
|
83872
|
+
const sections = [...source.matchAll(/^## (\d+)\. [^\n]*$/gmu)];
|
|
83873
|
+
const matches = sections.filter(heading => Number(heading[1]) === section);
|
|
83874
|
+
if (matches.length !== 1)
|
|
83875
|
+
return fail(reason);
|
|
83876
|
+
const start = matches[0];
|
|
83877
|
+
const end = sections.find(heading => heading.index > start.index)?.index ?? source.length;
|
|
83878
|
+
const lines = source.slice(start.index + start[0].length, end).split('\n');
|
|
83879
|
+
const found = [];
|
|
83880
|
+
for (let index = 0; index < lines.length; index++) {
|
|
83881
|
+
if (!/^\s*\|/u.test(lines[index]))
|
|
83882
|
+
continue;
|
|
83883
|
+
const cells = (line) => line.trim().replace(/^\||\|$/gu, '').split('|').map(clean);
|
|
83884
|
+
const header = cells(lines[index]);
|
|
83885
|
+
if (!headers.every((value, position) => header[position] === value) || header.length !== headers.length)
|
|
83886
|
+
continue;
|
|
83887
|
+
const separator = cells(lines[++index] ?? '');
|
|
83888
|
+
if (separator.length !== headers.length || !separator.every(cell => /^:?-{3,}:?$/u.test(cell)))
|
|
83889
|
+
return fail(reason);
|
|
83890
|
+
const rows = [];
|
|
83891
|
+
while (++index < lines.length && /^\s*\|/u.test(lines[index])) {
|
|
83892
|
+
const row = cells(lines[index]);
|
|
83893
|
+
if (row.length !== headers.length || row.some(cell => !cell))
|
|
83894
|
+
return fail(reason);
|
|
83895
|
+
rows.push(row);
|
|
83896
|
+
}
|
|
83897
|
+
if (!rows.length)
|
|
83898
|
+
return fail(reason);
|
|
83899
|
+
found.push(rows);
|
|
83900
|
+
}
|
|
83901
|
+
return found.length === 1 ? found[0] : fail(reason);
|
|
83902
|
+
}
|
|
83903
|
+
function ids(value, pattern, reason) {
|
|
83904
|
+
const values = value.split(/\s*,\s*/u);
|
|
83905
|
+
if (!values.every(id => pattern.test(id)) || new Set(values).size !== values.length)
|
|
83906
|
+
return fail(reason);
|
|
83907
|
+
return values;
|
|
83908
|
+
}
|
|
83909
|
+
function reservedSddCaseIds(documents) {
|
|
83910
|
+
const reserved = new Set();
|
|
83911
|
+
for (const document of documents) {
|
|
83912
|
+
const source = visible(document.markdown);
|
|
83913
|
+
const qualified = source.match(CASE) ?? [];
|
|
83914
|
+
const namespaces = new Set(qualified.map(id => id.slice(0, id.lastIndexOf('-C') + 2)));
|
|
83915
|
+
for (const id of qualified)
|
|
83916
|
+
reserved.add(id);
|
|
83917
|
+
// Legacy inventories often qualify C01 and abbreviate the remaining rows.
|
|
83918
|
+
// Reserve every plausible namespace instead of silently assigning an alias a new meaning.
|
|
83919
|
+
for (const match of source.matchAll(/(?<![\w-])C(\d+)\b/gu)) {
|
|
83920
|
+
for (const namespace of namespaces)
|
|
83921
|
+
reserved.add(`${namespace}${match[1]}`);
|
|
83922
|
+
}
|
|
83923
|
+
for (const match of source.matchAll(/\bC(\d+)\s*[-–—]\s*C?(\d+)\b/gu)) {
|
|
83924
|
+
const start = Number(match[1]);
|
|
83925
|
+
const end = Number(match[2]);
|
|
83926
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || end < start || end - start > 1000) {
|
|
83927
|
+
throw new Error('An owning SDD case range cannot be reconciled within the fixed bound; review the baseline before retrying.');
|
|
83928
|
+
}
|
|
83929
|
+
for (let number = start; number <= end; number++) {
|
|
83930
|
+
for (const namespace of namespaces)
|
|
83931
|
+
reserved.add(`${namespace}${String(number).padStart(match[1].length, '0')}`);
|
|
83932
|
+
}
|
|
83933
|
+
}
|
|
83934
|
+
}
|
|
83935
|
+
return [...reserved].sort();
|
|
83936
|
+
}
|
|
83937
|
+
function validateSddDraftConsistency(markdown, owners, inventory, sddPath) {
|
|
83938
|
+
const source = visible(markdown);
|
|
83939
|
+
const requirements = table(source, 4, ['Requirement', 'Behavior'], 'requirement-mapping');
|
|
83940
|
+
const requirementIds = requirements.map(row => row[0]);
|
|
83941
|
+
if (new Set(requirementIds).size !== requirementIds.length || !requirementIds.every(id => REQUIREMENT_ID.test(id)))
|
|
83942
|
+
fail('requirement-mapping');
|
|
83943
|
+
const cases = table(source, 14, ['Case ID', 'Area', 'Requirements', 'Scenario'], 'case-identity');
|
|
83944
|
+
const caseIds = cases.map(row => row[0]);
|
|
83945
|
+
const reserved = new Set(reservedSddCaseIds(owners));
|
|
83946
|
+
if (new Set(caseIds).size !== caseIds.length || caseIds.some(id => !CASE_ID.test(id) || reserved.has(id))
|
|
83947
|
+
|| /(?<![\w-])C\d+\b/u.test(source))
|
|
83948
|
+
fail('case-identity');
|
|
83949
|
+
// References to existing owner cases are allowed, but cannot count as newly defined cases.
|
|
83950
|
+
if ([...source.matchAll(CASE)].some(([id]) => !caseIds.includes(id) && !reserved.has(id)))
|
|
83951
|
+
fail('case-identity');
|
|
83952
|
+
const budget = table(source, 14, ['Area', 'Minimum distinct cases', 'Behaviors/risks covered'], 'case-budget');
|
|
83953
|
+
const counts = new Map();
|
|
83954
|
+
let total;
|
|
83955
|
+
for (const [area, value] of budget) {
|
|
83956
|
+
const count = /^[1-9]\d*$/u.test(value) ? Number(value) : NaN;
|
|
83957
|
+
if (!Number.isSafeInteger(count) || counts.has(area) || total !== undefined)
|
|
83958
|
+
fail('case-budget');
|
|
83959
|
+
if (area === 'Total')
|
|
83960
|
+
total = count;
|
|
83961
|
+
else
|
|
83962
|
+
counts.set(area, count);
|
|
83963
|
+
}
|
|
83964
|
+
if (!counts.size || total !== caseIds.length || [...counts.values()].reduce((sum, count) => sum + count, 0) !== total
|
|
83965
|
+
|| cases.some(row => !counts.has(row[1])))
|
|
83966
|
+
fail('case-budget');
|
|
83967
|
+
for (const [area, count] of counts)
|
|
83968
|
+
if (cases.filter(row => row[1] === area).length !== count)
|
|
83969
|
+
fail('case-budget');
|
|
83970
|
+
const edges = new Map(requirementIds.map(id => [id, new Set()]));
|
|
83971
|
+
for (const [id, , links] of cases) {
|
|
83972
|
+
for (const requirement of ids(links, REQUIREMENT_ID, 'requirement-mapping')) {
|
|
83973
|
+
const linked = edges.get(requirement);
|
|
83974
|
+
if (!linked)
|
|
83975
|
+
fail('requirement-mapping');
|
|
83976
|
+
linked.add(id);
|
|
83977
|
+
}
|
|
83978
|
+
}
|
|
83979
|
+
const traceability = table(source, 17, ['Requirement', 'Cases'], 'requirement-mapping');
|
|
83980
|
+
const seen = new Set();
|
|
83981
|
+
for (const [requirement, links] of traceability) {
|
|
83982
|
+
const expected = edges.get(requirement);
|
|
83983
|
+
const actual = ids(links, CASE_ID, 'requirement-mapping');
|
|
83984
|
+
if (!expected || seen.has(requirement) || expected.size !== actual.length || actual.some(id => !expected.has(id)))
|
|
83985
|
+
fail('requirement-mapping');
|
|
83986
|
+
seen.add(requirement);
|
|
83987
|
+
}
|
|
83988
|
+
if (seen.size !== edges.size || [...edges.values()].some(links => links.size === 0))
|
|
83989
|
+
fail('requirement-mapping');
|
|
83990
|
+
validatePaths(source, inventory, sddPath);
|
|
83991
|
+
}
|
|
83992
|
+
function safePath(value) {
|
|
83993
|
+
return value.length > 0 && !/[\\:*?"<>|\p{Cc}]/u.test(value)
|
|
83994
|
+
&& value.split('/').every(segment => segment && segment !== '.' && segment !== '..' && segment.toLowerCase() !== '.git');
|
|
83995
|
+
}
|
|
83996
|
+
function validatePaths(source, inventory, sddPath) {
|
|
83997
|
+
const rows = table(source, 15, ['Path', 'Change'], 'repository-path');
|
|
83998
|
+
const expectedChange = inventory.files.has(sddPath) ? 'update' : 'create';
|
|
83999
|
+
if (!rows.some(([file, change]) => file === sddPath && change === expectedChange))
|
|
84000
|
+
fail('repository-path');
|
|
84001
|
+
const proposed = new Set();
|
|
84002
|
+
const seen = new Set();
|
|
84003
|
+
for (const [file, change] of rows) {
|
|
84004
|
+
if (!safePath(file) || seen.has(file) || inventory.blocked.has(file))
|
|
84005
|
+
fail('repository-path');
|
|
84006
|
+
seen.add(file);
|
|
84007
|
+
if (change === 'create') {
|
|
84008
|
+
if (inventory.files.has(file) || inventory.directories.has(file))
|
|
84009
|
+
fail('repository-path');
|
|
84010
|
+
if ([...proposed].some(other => file.startsWith(`${other}/`) || other.startsWith(`${file}/`)))
|
|
84011
|
+
fail('repository-path');
|
|
84012
|
+
const segments = file.split('/');
|
|
84013
|
+
if (segments.some((_, index) => inventory.files.has(segments.slice(0, index + 1).join('/')) || inventory.blocked.has(segments.slice(0, index + 1).join('/'))))
|
|
84014
|
+
fail('repository-path');
|
|
84015
|
+
proposed.add(file);
|
|
84016
|
+
}
|
|
84017
|
+
else if (!['update', 'reference'].includes(change) || !inventory.files.has(file))
|
|
84018
|
+
fail('repository-path');
|
|
84019
|
+
}
|
|
84020
|
+
const check = (file) => {
|
|
84021
|
+
if (!safePath(file) || (!inventory.files.has(file) && !inventory.directories.has(file) && !proposed.has(file)))
|
|
84022
|
+
fail('repository-path');
|
|
84023
|
+
};
|
|
84024
|
+
// Relative Markdown file links resolve against the selected SDD, never the current checkout.
|
|
84025
|
+
for (const match of source.matchAll(/\]\(([^\s)]+)\)/gu)) {
|
|
84026
|
+
const href = match[1].split(/[?#]/u)[0];
|
|
84027
|
+
if (!href || /^(?:[a-z][a-z0-9+.-]*:|\/)/iu.test(href))
|
|
84028
|
+
continue;
|
|
84029
|
+
let decoded;
|
|
84030
|
+
try {
|
|
84031
|
+
decoded = decodeURIComponent(href);
|
|
84032
|
+
}
|
|
84033
|
+
catch {
|
|
84034
|
+
return fail('repository-path');
|
|
84035
|
+
}
|
|
84036
|
+
const parts = sddPath.split('/').slice(0, -1);
|
|
84037
|
+
for (const part of decoded.split('/')) {
|
|
84038
|
+
if (part === '..') {
|
|
84039
|
+
if (!parts.length)
|
|
84040
|
+
fail('repository-path');
|
|
84041
|
+
parts.pop();
|
|
84042
|
+
}
|
|
84043
|
+
else if (part !== '.')
|
|
84044
|
+
parts.push(part);
|
|
84045
|
+
}
|
|
84046
|
+
check(parts.join('/'));
|
|
84047
|
+
}
|
|
84048
|
+
for (const match of source.matchAll(/`([^`\n]+)`/gu)) {
|
|
84049
|
+
const value = match[1];
|
|
84050
|
+
if (value.includes('/') && !/^(?:[a-z][a-z0-9+.-]*:|\/)/iu.test(value) && !/\s/u.test(value))
|
|
84051
|
+
check(value.replace(/\/$/u, ''));
|
|
84052
|
+
}
|
|
84053
|
+
const prose = source.replace(/\]\([^\s)]+\)/gu, ']()').replace(/[a-z][a-z0-9+.-]*:\/\/[^\s)>]+/giu, '');
|
|
84054
|
+
for (const match of prose.matchAll(/(?<![\w./:-])([A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)+\.[A-Za-z0-9]+)(?![\w/-])/gu))
|
|
84055
|
+
check(match[1]);
|
|
84056
|
+
}
|
|
84057
|
+
|
|
84058
|
+
|
|
83274
84059
|
/***/ }),
|
|
83275
84060
|
|
|
83276
84061
|
/***/ 47122:
|
|
@@ -83454,6 +84239,20 @@ exports.DEFAULT_SETUP_RUNNERS = Object.freeze({
|
|
|
83454
84239
|
});
|
|
83455
84240
|
|
|
83456
84241
|
|
|
84242
|
+
/***/ }),
|
|
84243
|
+
|
|
84244
|
+
/***/ 33156:
|
|
84245
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
84246
|
+
|
|
84247
|
+
"use strict";
|
|
84248
|
+
|
|
84249
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
84250
|
+
exports.SETUP_VERIFICATION_ACTION_PARENTS = exports.SETUP_VERIFICATION_ACTION_PATH = void 0;
|
|
84251
|
+
/** Fixed consumer-owned asset: setup may create it, never regenerate or retire it. */
|
|
84252
|
+
exports.SETUP_VERIFICATION_ACTION_PATH = '.github/actions/copilot-verification-setup/action.yml';
|
|
84253
|
+
exports.SETUP_VERIFICATION_ACTION_PARENTS = ['.github', '.github/actions', '.github/actions/copilot-verification-setup'];
|
|
84254
|
+
|
|
84255
|
+
|
|
83457
84256
|
/***/ }),
|
|
83458
84257
|
|
|
83459
84258
|
/***/ 24596:
|
|
@@ -86280,12 +87079,14 @@ function createDeploymentOrchestrationUseCase(issueDescriptionQueryPort, publica
|
|
|
86280
87079
|
});
|
|
86281
87080
|
}
|
|
86282
87081
|
const copilot_history_port_factory_1 = __nccwpck_require__(12321);
|
|
86283
|
-
|
|
87082
|
+
const verification_setup_snapshot_1 = __nccwpck_require__(62148);
|
|
87083
|
+
const verification_setup_ports_1 = __nccwpck_require__(26509);
|
|
87084
|
+
function createIssueCommentUseCaseCompositionRoot(binding, setup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
|
|
86284
87085
|
const bugbot = (0, bugbot_composition_root_1.createBugbotCompositionRoot)(binding);
|
|
86285
87086
|
const findings = (0, agent_capability_composition_root_1.createFindingsQueryPort)();
|
|
86286
87087
|
const language = (0, agent_capability_composition_root_1.createLanguageQueryPort)();
|
|
86287
87088
|
const fixer = (0, agent_capability_composition_root_1.createFixerQueryPort)();
|
|
86288
|
-
const gitCommit = new git_commit_adapter_1.GitCommitAdapter();
|
|
87089
|
+
const gitCommit = new git_commit_adapter_1.GitCommitAdapter(undefined, undefined, setup);
|
|
86289
87090
|
const authenticatedUser = (0, authenticated_user_composition_root_1.createAuthenticatedUserCompositionRoot)();
|
|
86290
87091
|
const bugbotGit = new bound_bugbot_git_mutation_adapter_1.BoundBugbotGitMutationAdapter(gitCommit, authenticatedUser, binding.token);
|
|
86291
87092
|
const pullRequestDescription = new update_pull_request_description_use_case_1.UpdatePullRequestDescriptionUseCase((0, lifecycle_capability_port_binding_1.bindPullRequestDescription)(new pull_request_lifecycle_repository_1.PullRequestLifecycleRepository((0, github_pull_request_client_factory_1.createPullRequestLifecycleClient)()), binding, new pull_request_changes_repository_1.PullRequestChangesRepository((0, github_pull_request_client_factory_1.createPullRequestChangesClient)())), (0, shared_capability_port_binding_1.bindIssueDescriptionQuery)((0, issue_content_composition_root_1.createIssueContentCompositionRoot)(), binding), (0, shared_capability_port_binding_1.bindOrganizationMembers)((0, organization_members_composition_root_1.createOrganizationMembersCompositionRoot)(), binding), (0, agent_capability_composition_root_1.createFindingsQueryPort)());
|
|
@@ -86296,12 +87097,12 @@ function createIssueCommentUseCaseCompositionRoot(binding) {
|
|
|
86296
87097
|
catalogResolver: new resolve_message_catalog_use_case_1.ResolveMessageCatalogUseCase(language),
|
|
86297
87098
|
}), new detect_potential_problems_use_case_1.DetectPotentialProblemsUseCase(findings, bugbot.scm, bugbot.telemetry, new resolve_message_catalog_use_case_1.ResolveMessageCatalogUseCase(language)), pullRequestDescription, new remember_bugbot_rule_use_case_1.RememberBugbotRuleUseCase(bugbot.rules), branchSync, (0, issue_use_case_composition_root_1.createIssueUseCaseCompositionRoot)(binding), rememberBranchPorts(binding, bugbot.scm.context), (0, pull_request_status_composition_root_1.createPullRequestStatusReadPorts)(binding, bugbot.scm.context), (0, copilot_history_port_factory_1.createCopilotHistoryReadPort)(bugbot.scm.context, process.env.GITHUB_SERVER_URL ?? 'https://github.com'), (0, sdd_evidence_composition_root_1.createSddEvidenceQueryPort)(binding, bugbot.scm.context), (0, sdd_diff_composition_root_1.createSddDiffQueryPort)(binding, bugbot.scm.context), (0, issue_completion_composition_root_2.createNativeStatusReadPort)(binding), (0, github_runtime_doctor_composition_root_1.createGithubRuntimeDoctorPorts)(binding, bugbot.scm.context));
|
|
86298
87099
|
}
|
|
86299
|
-
function createPullRequestReviewCommentUseCaseCompositionRoot(binding) {
|
|
87100
|
+
function createPullRequestReviewCommentUseCaseCompositionRoot(binding, setup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
|
|
86300
87101
|
const bugbot = (0, bugbot_composition_root_1.createBugbotCompositionRoot)(binding);
|
|
86301
87102
|
const findings = (0, agent_capability_composition_root_1.createFindingsQueryPort)();
|
|
86302
87103
|
const language = (0, agent_capability_composition_root_1.createLanguageQueryPort)();
|
|
86303
87104
|
const fixer = (0, agent_capability_composition_root_1.createFixerQueryPort)();
|
|
86304
|
-
const gitCommit = new git_commit_adapter_1.GitCommitAdapter();
|
|
87105
|
+
const gitCommit = new git_commit_adapter_1.GitCommitAdapter(undefined, undefined, setup);
|
|
86305
87106
|
const authenticatedUser = (0, authenticated_user_composition_root_1.createAuthenticatedUserCompositionRoot)();
|
|
86306
87107
|
const bugbotGit = new bound_bugbot_git_mutation_adapter_1.BoundBugbotGitMutationAdapter(gitCommit, authenticatedUser, binding.token);
|
|
86307
87108
|
const pullRequestDescription = new update_pull_request_description_use_case_1.UpdatePullRequestDescriptionUseCase((0, lifecycle_capability_port_binding_1.bindPullRequestDescription)(new pull_request_lifecycle_repository_1.PullRequestLifecycleRepository((0, github_pull_request_client_factory_1.createPullRequestLifecycleClient)()), binding, new pull_request_changes_repository_1.PullRequestChangesRepository((0, github_pull_request_client_factory_1.createPullRequestChangesClient)())), (0, shared_capability_port_binding_1.bindIssueDescriptionQuery)((0, issue_content_composition_root_1.createIssueContentCompositionRoot)(), binding), (0, shared_capability_port_binding_1.bindOrganizationMembers)((0, organization_members_composition_root_1.createOrganizationMembersCompositionRoot)(), binding), (0, agent_capability_composition_root_1.createFindingsQueryPort)());
|
|
@@ -86328,7 +87129,7 @@ function createMainRunRouteCompositionRoot(projectBoardCommandPort, surface, set
|
|
|
86328
87129
|
return singleAction.invoke(execution);
|
|
86329
87130
|
},
|
|
86330
87131
|
"issue-comment": async (execution) => {
|
|
86331
|
-
issueComment ?? (issueComment = createIssueCommentUseCaseCompositionRoot(bugbotBinding(execution)));
|
|
87132
|
+
issueComment ?? (issueComment = createIssueCommentUseCaseCompositionRoot(bugbotBinding(execution), (0, verification_setup_snapshot_1.captureVerificationSetup)(execution.verificationSetup, execution.branches.main)));
|
|
86332
87133
|
return issueComment.invoke(execution);
|
|
86333
87134
|
},
|
|
86334
87135
|
issue: async (execution) => {
|
|
@@ -86336,7 +87137,7 @@ function createMainRunRouteCompositionRoot(projectBoardCommandPort, surface, set
|
|
|
86336
87137
|
return issue.invoke(execution);
|
|
86337
87138
|
},
|
|
86338
87139
|
"pull-request-review-comment": async (execution) => {
|
|
86339
|
-
pullRequestReviewComment ?? (pullRequestReviewComment = createPullRequestReviewCommentUseCaseCompositionRoot(bugbotBinding(execution)));
|
|
87140
|
+
pullRequestReviewComment ?? (pullRequestReviewComment = createPullRequestReviewCommentUseCaseCompositionRoot(bugbotBinding(execution), (0, verification_setup_snapshot_1.captureVerificationSetup)(execution.verificationSetup, execution.branches.main)));
|
|
86340
87141
|
return pullRequestReviewComment.invoke(execution);
|
|
86341
87142
|
},
|
|
86342
87143
|
"pull-request": async (execution) => {
|
|
@@ -87273,23 +88074,28 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
87273
88074
|
})();
|
|
87274
88075
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
87275
88076
|
exports.GitCommitAdapter = void 0;
|
|
88077
|
+
const verification_executable_1 = __nccwpck_require__(20878);
|
|
88078
|
+
const native_verification_profiles_1 = __nccwpck_require__(22290);
|
|
87276
88079
|
const exec = __importStar(__nccwpck_require__(18538));
|
|
87277
88080
|
const git_authentication_environment_1 = __nccwpck_require__(16535);
|
|
87278
88081
|
const untrusted_command_environment_1 = __nccwpck_require__(2304);
|
|
87279
88082
|
const git_hook_isolation_1 = __nccwpck_require__(39764);
|
|
87280
88083
|
const verification_runtime_preflight_1 = __nccwpck_require__(23100);
|
|
88084
|
+
const verification_setup_ports_1 = __nccwpck_require__(26509);
|
|
88085
|
+
const verification_setup_runner_1 = __nccwpck_require__(11709);
|
|
87281
88086
|
class GitCommitAdapter {
|
|
87282
88087
|
constructor(executeCommand = (program, args, options) => options
|
|
87283
|
-
? exec.exec(program, args, {
|
|
88088
|
+
? exec.exec(options.resolveFromEnvironment && options.env ? (0, verification_executable_1.verificationExecutable)(program, options.env) : program, args, {
|
|
87284
88089
|
// Captured Git reads can contain NUL-delimited records that
|
|
87285
88090
|
// hide subsequent lines in GitHub's Actions log viewer.
|
|
87286
88091
|
...(options.stdout ? { silent: true } : {}),
|
|
87287
88092
|
...(options.stdout ? { listeners: { stdout: options.stdout } } : {}),
|
|
87288
88093
|
...(options.env ? { env: options.env } : {}),
|
|
87289
88094
|
})
|
|
87290
|
-
: exec.exec(program, args), checkPrerequisites = verification_runtime_preflight_1.assertVerificationRuntimePrerequisites) {
|
|
88095
|
+
: exec.exec(program, args), checkPrerequisites = verification_runtime_preflight_1.assertVerificationRuntimePrerequisites, verificationSetup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
|
|
87291
88096
|
this.executeCommand = executeCommand;
|
|
87292
88097
|
this.checkPrerequisites = checkPrerequisites;
|
|
88098
|
+
this.verificationSetup = verificationSetup;
|
|
87293
88099
|
}
|
|
87294
88100
|
async execute(program, args, options) {
|
|
87295
88101
|
if (options?.verifyRuntimePrerequisites && !options.untrusted)
|
|
@@ -87300,15 +88106,19 @@ class GitCommitAdapter {
|
|
|
87300
88106
|
throw new Error('Untrusted command execution does not accept a caller-supplied environment.');
|
|
87301
88107
|
const runtime = (0, untrusted_command_environment_1.prepareUntrustedCommandEnvironment)();
|
|
87302
88108
|
try {
|
|
87303
|
-
if (options.verifyRuntimePrerequisites)
|
|
88109
|
+
if (options.verifyRuntimePrerequisites) {
|
|
88110
|
+
await (0, verification_setup_runner_1.prepareRepositoryVerification)(this.verificationSetup, runtime.environment);
|
|
87304
88111
|
this.checkPrerequisites(runtime.environment);
|
|
88112
|
+
}
|
|
87305
88113
|
return await this.executeCommand(program, args, {
|
|
87306
88114
|
...(options.stdout ? { stdout: options.stdout } : {}),
|
|
87307
88115
|
env: runtime.environment,
|
|
88116
|
+
...(options.verifyRuntimePrerequisites && this.verificationSetup.kind === 'ready' ? { resolveFromEnvironment: true } : {}),
|
|
87308
88117
|
});
|
|
87309
88118
|
}
|
|
87310
88119
|
finally {
|
|
87311
|
-
runtime.
|
|
88120
|
+
if (!(0, native_verification_profiles_1.nativeVerificationRetainsProfile)(runtime.environment.HOME))
|
|
88121
|
+
runtime.cleanup();
|
|
87312
88122
|
}
|
|
87313
88123
|
}
|
|
87314
88124
|
async configureAuthor(name, email) {
|
|
@@ -88004,6 +88814,659 @@ class LoggerWorkflowPollingObserverAdapter {
|
|
|
88004
88814
|
exports.LoggerWorkflowPollingObserverAdapter = LoggerWorkflowPollingObserverAdapter;
|
|
88005
88815
|
|
|
88006
88816
|
|
|
88817
|
+
/***/ }),
|
|
88818
|
+
|
|
88819
|
+
/***/ 18883:
|
|
88820
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
88821
|
+
|
|
88822
|
+
"use strict";
|
|
88823
|
+
|
|
88824
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
88825
|
+
exports.verificationCandidateIdentity = verificationCandidateIdentity;
|
|
88826
|
+
const node_child_process_1 = __nccwpck_require__(17718);
|
|
88827
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
88828
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
88829
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
88830
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
88831
|
+
/** Bind setup to the exact HEAD, branch, index, tracked edits and publishable untracked files. */
|
|
88832
|
+
function verificationCandidateIdentity(workspace, environment) {
|
|
88833
|
+
const hash = (0, node_crypto_1.createHash)('sha256');
|
|
88834
|
+
const git = (...args) => {
|
|
88835
|
+
const result = (0, node_child_process_1.spawnSync)('git', ['--no-replace-objects', ...args], { cwd: workspace, env: environment, shell: false,
|
|
88836
|
+
windowsHide: true, timeout: 10000, maxBuffer: 16 * 1024 * 1024 });
|
|
88837
|
+
if (result.error || result.status !== 0)
|
|
88838
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
88839
|
+
hash.update(result.stdout).update('\0');
|
|
88840
|
+
return result.stdout;
|
|
88841
|
+
};
|
|
88842
|
+
git('rev-parse', '--verify', 'HEAD');
|
|
88843
|
+
git('rev-parse', '--symbolic-full-name', 'HEAD');
|
|
88844
|
+
git('ls-files', '--stage', '-z');
|
|
88845
|
+
git('diff', '--no-ext-diff', '--no-textconv', '--binary', 'HEAD', '--');
|
|
88846
|
+
const paths = git('ls-files', '--others', '--exclude-standard', '-z').toString('utf8').split('\0').filter(Boolean);
|
|
88847
|
+
let total = 0;
|
|
88848
|
+
if (paths.length > 256)
|
|
88849
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
88850
|
+
for (const path of paths) {
|
|
88851
|
+
const file = (0, node_path_1.join)(workspace, path);
|
|
88852
|
+
const stat = (0, node_fs_1.lstatSync)(file);
|
|
88853
|
+
total += stat.size;
|
|
88854
|
+
if (total > 16 * 1024 * 1024)
|
|
88855
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
88856
|
+
hash.update(path).update('\0');
|
|
88857
|
+
if (stat.isSymbolicLink())
|
|
88858
|
+
hash.update('120000\0').update((0, node_fs_1.readlinkSync)(file));
|
|
88859
|
+
else if (stat.isFile())
|
|
88860
|
+
hash.update(stat.mode & 0o100 ? '100755\0' : '100644\0').update((0, node_fs_1.readFileSync)(file));
|
|
88861
|
+
else
|
|
88862
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
88863
|
+
hash.update('\0');
|
|
88864
|
+
}
|
|
88865
|
+
return hash.digest('hex');
|
|
88866
|
+
}
|
|
88867
|
+
|
|
88868
|
+
|
|
88869
|
+
/***/ }),
|
|
88870
|
+
|
|
88871
|
+
/***/ 71046:
|
|
88872
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
88873
|
+
|
|
88874
|
+
"use strict";
|
|
88875
|
+
|
|
88876
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
88877
|
+
if (k2 === undefined) k2 = k;
|
|
88878
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
88879
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
88880
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
88881
|
+
}
|
|
88882
|
+
Object.defineProperty(o, k2, desc);
|
|
88883
|
+
}) : (function(o, m, k, k2) {
|
|
88884
|
+
if (k2 === undefined) k2 = k;
|
|
88885
|
+
o[k2] = m[k];
|
|
88886
|
+
}));
|
|
88887
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
88888
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
88889
|
+
}) : function(o, v) {
|
|
88890
|
+
o["default"] = v;
|
|
88891
|
+
});
|
|
88892
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
88893
|
+
var ownKeys = function(o) {
|
|
88894
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
88895
|
+
var ar = [];
|
|
88896
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
88897
|
+
return ar;
|
|
88898
|
+
};
|
|
88899
|
+
return ownKeys(o);
|
|
88900
|
+
};
|
|
88901
|
+
return function (mod) {
|
|
88902
|
+
if (mod && mod.__esModule) return mod;
|
|
88903
|
+
var result = {};
|
|
88904
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
88905
|
+
__setModuleDefault(result, mod);
|
|
88906
|
+
return result;
|
|
88907
|
+
};
|
|
88908
|
+
})();
|
|
88909
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
88910
|
+
exports.drainNativeWorkerLog = drainNativeWorkerLog;
|
|
88911
|
+
exports.awaitNativeBoundary = awaitNativeBoundary;
|
|
88912
|
+
exports.continueNativeVerification = continueNativeVerification;
|
|
88913
|
+
exports.cleanupNativeVerification = cleanupNativeVerification;
|
|
88914
|
+
exports.runNativeVerificationEntry = runNativeVerificationEntry;
|
|
88915
|
+
const native_verification_source_runtime_1 = __nccwpck_require__(85290);
|
|
88916
|
+
const verification_executable_1 = __nccwpck_require__(20878);
|
|
88917
|
+
const native_verification_redaction_1 = __nccwpck_require__(27632);
|
|
88918
|
+
const native_verification_profiles_1 = __nccwpck_require__(22290);
|
|
88919
|
+
const core = __importStar(__nccwpck_require__(75855));
|
|
88920
|
+
const node_child_process_1 = __nccwpck_require__(17718);
|
|
88921
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
88922
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
88923
|
+
const agent_private_install_root_1 = __nccwpck_require__(44640);
|
|
88924
|
+
const agent_trusted_system_tools_1 = __nccwpck_require__(76049);
|
|
88925
|
+
const github_action_input_1 = __nccwpck_require__(57581);
|
|
88926
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
88927
|
+
const native_verification_protocol_1 = __nccwpck_require__(88709);
|
|
88928
|
+
const native_verification_staging_1 = __nccwpck_require__(63587);
|
|
88929
|
+
const verification_setup_snapshot_1 = __nccwpck_require__(62148);
|
|
88930
|
+
function emitWorkerOutput(root) {
|
|
88931
|
+
const file = (0, node_path_1.join)(root, 'worker-output');
|
|
88932
|
+
if (process.env.GITHUB_OUTPUT && (0, node_fs_1.existsSync)(file))
|
|
88933
|
+
(0, node_fs_1.appendFileSync)(process.env.GITHUB_OUTPUT, requireRead(file));
|
|
88934
|
+
const summary = (0, node_path_1.join)(root, 'worker-summary');
|
|
88935
|
+
if (process.env.GITHUB_STEP_SUMMARY && (0, node_fs_1.existsSync)(summary) && !(0, native_verification_protocol_1.readNativeRecord)(root, 'summary-emitted.json')) {
|
|
88936
|
+
(0, node_fs_1.appendFileSync)(process.env.GITHUB_STEP_SUMMARY, requireRead(summary, 1048576));
|
|
88937
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'summary-emitted.json', { emitted: true });
|
|
88938
|
+
}
|
|
88939
|
+
}
|
|
88940
|
+
function requireRead(file, limit = 262144) {
|
|
88941
|
+
const fd = (0, node_fs_1.openSync)(file, 'r');
|
|
88942
|
+
try {
|
|
88943
|
+
const size = (0, node_fs_1.statSync)(file).size;
|
|
88944
|
+
if (size > limit)
|
|
88945
|
+
throw new verification_setup_policy_1.VerificationSetupError('output-limit');
|
|
88946
|
+
const data = Buffer.alloc(size);
|
|
88947
|
+
(0, node_fs_1.readSync)(fd, data, 0, data.length, 0);
|
|
88948
|
+
return data;
|
|
88949
|
+
}
|
|
88950
|
+
finally {
|
|
88951
|
+
(0, node_fs_1.closeSync)(fd);
|
|
88952
|
+
}
|
|
88953
|
+
}
|
|
88954
|
+
/** Drain complete lines so runner masking and workflow commands keep their native framing. */
|
|
88955
|
+
function drainNativeWorkerLog(root, flush = false) {
|
|
88956
|
+
const file = (0, node_path_1.join)(root, 'worker-log');
|
|
88957
|
+
if (!(0, node_fs_1.existsSync)(file))
|
|
88958
|
+
return;
|
|
88959
|
+
const cursor = (0, native_verification_protocol_1.readNativeRecord)(root, 'log-cursor.json')?.offset ?? 0;
|
|
88960
|
+
const fd = (0, node_fs_1.openSync)(file, 'r');
|
|
88961
|
+
let offset = cursor;
|
|
88962
|
+
try {
|
|
88963
|
+
const buffer = Buffer.alloc(65536);
|
|
88964
|
+
let pending = Buffer.alloc(0);
|
|
88965
|
+
let size;
|
|
88966
|
+
while ((size = (0, node_fs_1.readSync)(fd, buffer, 0, buffer.length, offset + pending.length))) {
|
|
88967
|
+
pending = Buffer.concat([pending, buffer.subarray(0, size)]);
|
|
88968
|
+
const lastLine = pending.lastIndexOf(10);
|
|
88969
|
+
if (lastLine >= 0) {
|
|
88970
|
+
const complete = pending.subarray(0, lastLine + 1);
|
|
88971
|
+
process.stdout.write(complete);
|
|
88972
|
+
offset += complete.length;
|
|
88973
|
+
pending = pending.subarray(lastLine + 1);
|
|
88974
|
+
}
|
|
88975
|
+
// Existing action logs may contain long lines; retain framing without unbounded buffering.
|
|
88976
|
+
if (pending.length > 1048576)
|
|
88977
|
+
throw new verification_setup_policy_1.VerificationSetupError('output-limit');
|
|
88978
|
+
}
|
|
88979
|
+
if (flush && pending.length) {
|
|
88980
|
+
process.stdout.write(pending);
|
|
88981
|
+
offset += pending.length;
|
|
88982
|
+
}
|
|
88983
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'log-cursor.json', { offset });
|
|
88984
|
+
}
|
|
88985
|
+
finally {
|
|
88986
|
+
(0, node_fs_1.closeSync)(fd);
|
|
88987
|
+
}
|
|
88988
|
+
}
|
|
88989
|
+
async function awaitNativeBoundary(root, timeoutMs = 7200000) {
|
|
88990
|
+
const deadline = Date.now() + timeoutMs;
|
|
88991
|
+
while (true) {
|
|
88992
|
+
drainNativeWorkerLog(root);
|
|
88993
|
+
const done = (0, native_verification_protocol_1.readNativeRecord)(root, 'done.json');
|
|
88994
|
+
if (done) {
|
|
88995
|
+
drainNativeWorkerLog(root, true);
|
|
88996
|
+
emitWorkerOutput(root);
|
|
88997
|
+
core.setOutput('verification-setup-pending', 'false');
|
|
88998
|
+
if (done.exitCode !== 0)
|
|
88999
|
+
core.setFailed('Copilot execution failed; inspect the preceding operation result.');
|
|
89000
|
+
return;
|
|
89001
|
+
}
|
|
89002
|
+
const request = (0, native_verification_protocol_1.readNativeRecord)(root, 'request.json', 32768);
|
|
89003
|
+
if (request) {
|
|
89004
|
+
if (!/^[a-f0-9-]{36}$/u.test(request.id) || !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(request.sourceSha)
|
|
89005
|
+
|| !/^[a-f0-9]{64}$/u.test(request.digest) || !request.environment || typeof request.environment.HOME !== 'string')
|
|
89006
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89007
|
+
core.setOutput('verification-request', request.id);
|
|
89008
|
+
core.setOutput('verification-source', request.sourceSha);
|
|
89009
|
+
core.setOutput('verification-digest', request.digest);
|
|
89010
|
+
core.saveState('native-verification-digest', request.digest);
|
|
89011
|
+
core.saveState('native-verification-source', request.sourceSha);
|
|
89012
|
+
for (const key of ['HOME', 'USERPROFILE', 'APPDATA', 'LOCALAPPDATA', 'PATH', 'JAVA_HOME', 'TMP', 'TEMP', 'TMPDIR']) {
|
|
89013
|
+
const value = request.environment[key] ?? '';
|
|
89014
|
+
if (typeof value !== 'string' || /[\r\n\0]/u.test(value))
|
|
89015
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89016
|
+
core.setOutput(`verification-${key.toLowerCase()}`, value);
|
|
89017
|
+
}
|
|
89018
|
+
core.setOutput('verification-setup-pending', 'true');
|
|
89019
|
+
return;
|
|
89020
|
+
}
|
|
89021
|
+
if (Date.now() >= deadline)
|
|
89022
|
+
throw new verification_setup_policy_1.VerificationSetupError('timeout');
|
|
89023
|
+
const session = (0, native_verification_protocol_1.nativeSession)(root);
|
|
89024
|
+
try {
|
|
89025
|
+
process.kill(session.pid, 0);
|
|
89026
|
+
}
|
|
89027
|
+
catch {
|
|
89028
|
+
throw new verification_setup_policy_1.VerificationSetupError('process-failed');
|
|
89029
|
+
}
|
|
89030
|
+
await (0, native_verification_protocol_1.nativePause)(100);
|
|
89031
|
+
}
|
|
89032
|
+
}
|
|
89033
|
+
async function continueNativeVerification(root, id, outcome, environment = process.env) {
|
|
89034
|
+
(0, native_verification_protocol_1.nativeSession)(root);
|
|
89035
|
+
const request = (0, native_verification_protocol_1.readNativeRecord)(root, 'request.json', 32768);
|
|
89036
|
+
if (!request || request.id !== id || !/^[a-f0-9-]{36}$/u.test(id)
|
|
89037
|
+
|| (0, node_fs_1.existsSync)((0, node_path_1.join)(root, `response-${id}.json`)))
|
|
89038
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89039
|
+
const response = { id, success: outcome === 'success', path: environment.PATH ?? '',
|
|
89040
|
+
...(environment.JAVA_HOME ? { javaHome: environment.JAVA_HOME } : {}) };
|
|
89041
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(root, 'request.json'));
|
|
89042
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, `response-${id}.json`, response);
|
|
89043
|
+
await awaitNativeBoundary(root);
|
|
89044
|
+
}
|
|
89045
|
+
async function cleanupNativeVerification(root, waitMs = 10000, deferProfileCleanup = false) {
|
|
89046
|
+
if (!(0, node_fs_1.existsSync)(root))
|
|
89047
|
+
return;
|
|
89048
|
+
const session = (0, native_verification_protocol_1.nativeSession)(root);
|
|
89049
|
+
if (!(0, native_verification_protocol_1.readNativeRecord)(root, 'done.json')) {
|
|
89050
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'cancel.json', { cancelled: true });
|
|
89051
|
+
const deadline = Date.now() + waitMs;
|
|
89052
|
+
while (!(0, native_verification_protocol_1.readNativeRecord)(root, 'done.json') && Date.now() < deadline)
|
|
89053
|
+
await (0, native_verification_protocol_1.nativePause)(100);
|
|
89054
|
+
if (!(0, native_verification_protocol_1.readNativeRecord)(root, 'done.json')) {
|
|
89055
|
+
try {
|
|
89056
|
+
if (process.platform === 'win32')
|
|
89057
|
+
(0, node_child_process_1.spawnSync)((0, agent_trusted_system_tools_1.trustedWindowsSystemTool)('taskkill.exe'), ['/PID', String(session.pid), '/T', '/F'], { windowsHide: true, shell: false, timeout: 5000, stdio: 'ignore' });
|
|
89058
|
+
else
|
|
89059
|
+
process.kill(-session.pid, 'SIGKILL');
|
|
89060
|
+
}
|
|
89061
|
+
catch { /* Worker may have exited while cancellation completed. */ }
|
|
89062
|
+
}
|
|
89063
|
+
}
|
|
89064
|
+
if (!deferProfileCleanup)
|
|
89065
|
+
(0, native_verification_staging_1.cleanupNativeVerificationAction)(root, session.workspace);
|
|
89066
|
+
drainNativeWorkerLog(root, true);
|
|
89067
|
+
if (!deferProfileCleanup) {
|
|
89068
|
+
(0, native_verification_profiles_1.removeNativeVerificationProfiles)(root);
|
|
89069
|
+
(0, node_fs_1.rmSync)(root, { recursive: true, force: true });
|
|
89070
|
+
}
|
|
89071
|
+
}
|
|
89072
|
+
async function startNativeVerification() {
|
|
89073
|
+
for (const secret of (0, native_verification_redaction_1.nativeWorkerSecrets)(process.env))
|
|
89074
|
+
core.setSecret(secret);
|
|
89075
|
+
const git = (0, verification_executable_1.verificationExecutable)('git', { PATH: process.env.PATH ?? '', PATHEXT: process.env.PATHEXT ?? '.EXE;.CMD;.BAT;.COM' });
|
|
89076
|
+
core.saveState('native-verification-git', git);
|
|
89077
|
+
core.setOutput('verification-git', git);
|
|
89078
|
+
const root = (0, node_fs_1.realpathSync)((0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)());
|
|
89079
|
+
for (const name of ['worker-output', 'worker-env', 'worker-path', 'worker-log', 'worker-summary'])
|
|
89080
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(root, name), '', { flag: 'wx', mode: 0o600 });
|
|
89081
|
+
const log = (0, node_fs_1.openSync)((0, node_path_1.join)(root, 'worker-log'), 'a');
|
|
89082
|
+
try {
|
|
89083
|
+
const worker = (0, node_child_process_1.spawn)(process.execPath, [process.argv[1]], { cwd: process.cwd(), detached: true, windowsHide: true,
|
|
89084
|
+
stdio: ['ignore', log, log], env: { ...process.env, COPILOT_NATIVE_PHASE: '', COPILOT_NATIVE_WORKER_SESSION: root,
|
|
89085
|
+
GITHUB_STEP_SUMMARY: (0, node_path_1.join)(root, 'worker-summary'), GITHUB_OUTPUT: (0, node_path_1.join)(root, 'worker-output'), GITHUB_ENV: (0, node_path_1.join)(root, 'worker-env'), GITHUB_PATH: (0, node_path_1.join)(root, 'worker-path') } });
|
|
89086
|
+
await new Promise((resolve, reject) => { worker.once('spawn', resolve); worker.once('error', reject); });
|
|
89087
|
+
worker.unref();
|
|
89088
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'session.json', { schemaVersion: 1, workspace: (0, node_fs_1.realpathSync)(process.cwd()), run: process.env.GITHUB_RUN_ID ?? '',
|
|
89089
|
+
attempt: process.env.GITHUB_RUN_ATTEMPT ?? '', job: process.env.GITHUB_JOB ?? '', pid: worker.pid });
|
|
89090
|
+
core.saveState('native-verification-ticket', root);
|
|
89091
|
+
core.saveState('native-verification-owner', 'true');
|
|
89092
|
+
core.setOutput('verification-ticket', root);
|
|
89093
|
+
await awaitNativeBoundary(root);
|
|
89094
|
+
}
|
|
89095
|
+
catch (error) {
|
|
89096
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(root, 'session.json')))
|
|
89097
|
+
await cleanupNativeVerification(root);
|
|
89098
|
+
else
|
|
89099
|
+
(0, node_fs_1.rmSync)(root, { recursive: true, force: true });
|
|
89100
|
+
throw error;
|
|
89101
|
+
}
|
|
89102
|
+
finally {
|
|
89103
|
+
(0, node_fs_1.closeSync)(log);
|
|
89104
|
+
}
|
|
89105
|
+
}
|
|
89106
|
+
/** Native phases are runner-only control messages; no credentials or agent operations are replayed. */
|
|
89107
|
+
async function runNativeVerificationEntry(run) {
|
|
89108
|
+
const post = core.getState('copilot-native-post');
|
|
89109
|
+
if (post === 'true') {
|
|
89110
|
+
const root = core.getState('native-verification-ticket');
|
|
89111
|
+
if (root && core.getState('native-verification-owner') === 'true')
|
|
89112
|
+
await cleanupNativeVerification(root);
|
|
89113
|
+
else if (root && (0, node_fs_1.existsSync)(root) && core.getState('native-verification-source')) {
|
|
89114
|
+
const session = (0, native_verification_protocol_1.nativeSession)(root);
|
|
89115
|
+
try {
|
|
89116
|
+
const snapshot = (0, verification_setup_snapshot_1.captureVerificationSetupAtCommit)(core.getState('native-verification-source'), session.workspace, core.getState('native-verification-git'));
|
|
89117
|
+
if (snapshot.kind !== 'ready' || (0, verification_setup_snapshot_1.verificationSetupDigest)(snapshot) !== core.getState('native-verification-digest'))
|
|
89118
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
89119
|
+
(0, native_verification_staging_1.stageNativeVerificationAction)(snapshot, root);
|
|
89120
|
+
}
|
|
89121
|
+
catch {
|
|
89122
|
+
// A later native post must fail to load rather than execute candidate-modified metadata.
|
|
89123
|
+
(0, native_verification_staging_1.cleanupNativeVerificationAction)(root, session.workspace);
|
|
89124
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
89125
|
+
}
|
|
89126
|
+
}
|
|
89127
|
+
const sourceRuntime = core.getState('native-source-runtime');
|
|
89128
|
+
if (sourceRuntime)
|
|
89129
|
+
(0, native_verification_source_runtime_1.cleanupNativeSourceRuntime)(sourceRuntime, (0, node_fs_1.realpathSync)(process.cwd()));
|
|
89130
|
+
return;
|
|
89131
|
+
}
|
|
89132
|
+
core.saveState('copilot-native-post', 'true');
|
|
89133
|
+
if (process.env.COPILOT_NATIVE_PHASE === 'prepare' && process.env.COPILOT_NATIVE_RUNTIME_CACHE)
|
|
89134
|
+
core.saveState('native-source-runtime', process.env.COPILOT_NATIVE_RUNTIME_CACHE);
|
|
89135
|
+
const worker = process.env.COPILOT_NATIVE_WORKER_SESSION;
|
|
89136
|
+
if (worker) {
|
|
89137
|
+
const deadline = Date.now() + 30000;
|
|
89138
|
+
while (!(0, native_verification_protocol_1.readNativeRecord)(worker, 'session.json')) {
|
|
89139
|
+
if (Date.now() >= deadline)
|
|
89140
|
+
throw new verification_setup_policy_1.VerificationSetupError('timeout');
|
|
89141
|
+
await (0, native_verification_protocol_1.nativePause)(10);
|
|
89142
|
+
}
|
|
89143
|
+
if ((0, native_verification_protocol_1.nativeSession)(worker).pid !== process.pid)
|
|
89144
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89145
|
+
const restoreLog = (0, native_verification_redaction_1.redactNativeWorkerLogs)();
|
|
89146
|
+
try {
|
|
89147
|
+
await run();
|
|
89148
|
+
}
|
|
89149
|
+
finally {
|
|
89150
|
+
restoreLog();
|
|
89151
|
+
(0, native_verification_protocol_1.writeNativeRecord)(worker, 'done.json', { exitCode: Number(process.exitCode ?? 0) });
|
|
89152
|
+
}
|
|
89153
|
+
return;
|
|
89154
|
+
}
|
|
89155
|
+
const phase = process.env.COPILOT_NATIVE_PHASE;
|
|
89156
|
+
if (!phase || phase === 'prepare' && (0, github_action_input_1.getGithubActionInput)('verification-setup') !== 'true') {
|
|
89157
|
+
await run();
|
|
89158
|
+
return;
|
|
89159
|
+
}
|
|
89160
|
+
if (process.env.GITHUB_ACTIONS !== 'true')
|
|
89161
|
+
throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required');
|
|
89162
|
+
if (phase === 'prepare') {
|
|
89163
|
+
await startNativeVerification();
|
|
89164
|
+
return;
|
|
89165
|
+
}
|
|
89166
|
+
const root = process.env.COPILOT_NATIVE_TICKET;
|
|
89167
|
+
if (!root)
|
|
89168
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89169
|
+
(0, native_verification_protocol_1.nativeSession)(root);
|
|
89170
|
+
core.saveState('native-verification-ticket', root);
|
|
89171
|
+
core.saveState('native-verification-source', process.env.COPILOT_NATIVE_SOURCE ?? '');
|
|
89172
|
+
core.saveState('native-verification-digest', process.env.COPILOT_NATIVE_DIGEST ?? '');
|
|
89173
|
+
core.saveState('native-verification-git', process.env.COPILOT_NATIVE_GIT ?? '');
|
|
89174
|
+
if (phase === 'continue') {
|
|
89175
|
+
await continueNativeVerification(root, process.env.COPILOT_NATIVE_REQUEST ?? '', process.env.COPILOT_NATIVE_OUTCOME ?? '');
|
|
89176
|
+
return;
|
|
89177
|
+
}
|
|
89178
|
+
if (phase === 'finish') {
|
|
89179
|
+
(0, native_verification_protocol_1.nativeSession)(root);
|
|
89180
|
+
const done = (0, native_verification_protocol_1.readNativeRecord)(root, 'done.json');
|
|
89181
|
+
if (done) {
|
|
89182
|
+
emitWorkerOutput(root);
|
|
89183
|
+
if (done.exitCode !== 0)
|
|
89184
|
+
core.setFailed('Copilot execution failed.');
|
|
89185
|
+
}
|
|
89186
|
+
else
|
|
89187
|
+
core.setFailed(`Repository setup did not complete within ${verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.requests} native verification boundaries. Pending verification and subsequent publication are blocked; inspect earlier operation results for completed effects.`);
|
|
89188
|
+
await cleanupNativeVerification(root, 10000, true);
|
|
89189
|
+
return;
|
|
89190
|
+
}
|
|
89191
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89192
|
+
}
|
|
89193
|
+
|
|
89194
|
+
|
|
89195
|
+
/***/ }),
|
|
89196
|
+
|
|
89197
|
+
/***/ 22290:
|
|
89198
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89199
|
+
|
|
89200
|
+
"use strict";
|
|
89201
|
+
|
|
89202
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89203
|
+
exports.nativeVerificationProfilePaths = nativeVerificationProfilePaths;
|
|
89204
|
+
exports.registerNativeVerificationProfile = registerNativeVerificationProfile;
|
|
89205
|
+
exports.nativeVerificationRetainsProfile = nativeVerificationRetainsProfile;
|
|
89206
|
+
exports.removeNativeVerificationProfiles = removeNativeVerificationProfiles;
|
|
89207
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
89208
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
89209
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89210
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
89211
|
+
const native_verification_protocol_1 = __nccwpck_require__(88709);
|
|
89212
|
+
function nativeVerificationProfilePaths(root) {
|
|
89213
|
+
const stored = (0, native_verification_protocol_1.readNativeRecord)(root, 'profiles.json', 65536);
|
|
89214
|
+
const paths = stored === undefined ? [] : stored;
|
|
89215
|
+
if (!Array.isArray(paths) || paths.length > 20 || new Set(paths).size !== paths.length || paths.some(path => typeof path !== 'string'
|
|
89216
|
+
|| (0, node_path_1.dirname)(path) !== (0, node_path_1.dirname)(root) || !/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(path)) || path === root))
|
|
89217
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89218
|
+
return paths;
|
|
89219
|
+
}
|
|
89220
|
+
/** Native actions may have post steps. Preserve dependency-only profiles until those steps finish. */
|
|
89221
|
+
function registerNativeVerificationProfile(root, profile) {
|
|
89222
|
+
const previous = nativeVerificationProfilePaths(root);
|
|
89223
|
+
if (previous.length >= 20 || previous.includes(profile) || (0, node_path_1.dirname)(profile) !== (0, node_path_1.dirname)(root)
|
|
89224
|
+
|| profile === root || !/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(profile))
|
|
89225
|
+
|| (0, node_fs_1.realpathSync)(profile) !== profile || !(0, node_fs_1.lstatSync)(profile).isDirectory() || (0, node_fs_1.lstatSync)(profile).isSymbolicLink())
|
|
89226
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89227
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(profile, 'native-session-owner'), (0, node_crypto_1.createHash)('sha256').update(root).digest('hex'), { mode: 0o600, flag: 'wx' });
|
|
89228
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'profiles.json', [...previous, profile]);
|
|
89229
|
+
}
|
|
89230
|
+
function nativeVerificationRetainsProfile(profile) {
|
|
89231
|
+
const root = process.env.COPILOT_NATIVE_WORKER_SESSION;
|
|
89232
|
+
return !!root && nativeVerificationProfilePaths(root).includes(profile);
|
|
89233
|
+
}
|
|
89234
|
+
function removeNativeVerificationProfiles(root) {
|
|
89235
|
+
for (const path of nativeVerificationProfilePaths(root)) {
|
|
89236
|
+
let stat;
|
|
89237
|
+
try {
|
|
89238
|
+
stat = (0, node_fs_1.lstatSync)(path);
|
|
89239
|
+
}
|
|
89240
|
+
catch (error) {
|
|
89241
|
+
if (error.code === 'ENOENT')
|
|
89242
|
+
continue;
|
|
89243
|
+
throw error;
|
|
89244
|
+
}
|
|
89245
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || (0, node_fs_1.realpathSync)(path) !== path || (0, node_fs_1.readFileSync)((0, node_path_1.join)(path, 'native-session-owner'), 'utf8') !== (0, node_crypto_1.createHash)('sha256').update(root).digest('hex'))
|
|
89246
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89247
|
+
(0, node_fs_1.rmSync)(path, { recursive: true, force: true });
|
|
89248
|
+
}
|
|
89249
|
+
}
|
|
89250
|
+
|
|
89251
|
+
|
|
89252
|
+
/***/ }),
|
|
89253
|
+
|
|
89254
|
+
/***/ 88709:
|
|
89255
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89256
|
+
|
|
89257
|
+
"use strict";
|
|
89258
|
+
|
|
89259
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89260
|
+
exports.nativePause = void 0;
|
|
89261
|
+
exports.writeNativeRecord = writeNativeRecord;
|
|
89262
|
+
exports.readNativeRecord = readNativeRecord;
|
|
89263
|
+
exports.nativeSession = nativeSession;
|
|
89264
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
89265
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89266
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
89267
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
89268
|
+
function writeNativeRecord(root, name, value) {
|
|
89269
|
+
const temporary = (0, node_path_1.join)(root, `${(0, node_crypto_1.randomUUID)()}.tmp`);
|
|
89270
|
+
(0, node_fs_1.writeFileSync)(temporary, JSON.stringify(value), { mode: 0o600, flag: 'wx' });
|
|
89271
|
+
(0, node_fs_1.renameSync)(temporary, (0, node_path_1.join)(root, name));
|
|
89272
|
+
}
|
|
89273
|
+
function readNativeRecord(root, name, limit = 16384) {
|
|
89274
|
+
const file = (0, node_path_1.join)(root, name);
|
|
89275
|
+
let descriptor;
|
|
89276
|
+
try {
|
|
89277
|
+
const before = (0, node_fs_1.lstatSync)(file, { bigint: true });
|
|
89278
|
+
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n || before.size > BigInt(limit))
|
|
89279
|
+
throw new Error();
|
|
89280
|
+
descriptor = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
|
|
89281
|
+
const after = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
|
|
89282
|
+
if (after.dev !== before.dev || after.ino !== before.ino || after.size !== before.size || after.mtimeNs !== before.mtimeNs)
|
|
89283
|
+
throw new Error();
|
|
89284
|
+
const data = (0, node_fs_1.readFileSync)(descriptor);
|
|
89285
|
+
const final = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
|
|
89286
|
+
if (data.length > limit || final.size !== after.size || final.mtimeNs !== after.mtimeNs)
|
|
89287
|
+
throw new Error();
|
|
89288
|
+
return JSON.parse(data.toString('utf8'));
|
|
89289
|
+
}
|
|
89290
|
+
catch (error) {
|
|
89291
|
+
if (error.code === 'ENOENT')
|
|
89292
|
+
return undefined;
|
|
89293
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89294
|
+
}
|
|
89295
|
+
finally {
|
|
89296
|
+
if (descriptor !== undefined)
|
|
89297
|
+
(0, node_fs_1.closeSync)(descriptor);
|
|
89298
|
+
}
|
|
89299
|
+
}
|
|
89300
|
+
function nativeSession(root, environment = process.env) {
|
|
89301
|
+
if (!/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(root)) || (0, node_fs_1.realpathSync)(root) !== root
|
|
89302
|
+
|| !(0, node_fs_1.lstatSync)(root).isDirectory() || (0, node_fs_1.lstatSync)(root).isSymbolicLink())
|
|
89303
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89304
|
+
if (process.platform !== 'win32' && ((0, node_fs_1.lstatSync)(root).mode & 0o077) !== 0)
|
|
89305
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89306
|
+
const session = readNativeRecord(root, 'session.json');
|
|
89307
|
+
if (session?.schemaVersion !== 1 || session.workspace !== (0, node_fs_1.realpathSync)(process.cwd())
|
|
89308
|
+
|| session.run !== (environment.GITHUB_RUN_ID ?? '') || session.attempt !== (environment.GITHUB_RUN_ATTEMPT ?? '')
|
|
89309
|
+
|| session.job !== (environment.GITHUB_JOB ?? '') || !Number.isSafeInteger(session.pid) || session.pid <= 0)
|
|
89310
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89311
|
+
return session;
|
|
89312
|
+
}
|
|
89313
|
+
const nativePause = (milliseconds) => new Promise(resolve => setTimeout(resolve, milliseconds));
|
|
89314
|
+
exports.nativePause = nativePause;
|
|
89315
|
+
|
|
89316
|
+
|
|
89317
|
+
/***/ }),
|
|
89318
|
+
|
|
89319
|
+
/***/ 27632:
|
|
89320
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89321
|
+
|
|
89322
|
+
"use strict";
|
|
89323
|
+
|
|
89324
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89325
|
+
exports.nativeWorkerSecrets = nativeWorkerSecrets;
|
|
89326
|
+
exports.redactNativeWorkerLogs = redactNativeWorkerLogs;
|
|
89327
|
+
const node_string_decoder_1 = __nccwpck_require__(76915);
|
|
89328
|
+
const SECRET_KEY = /(?:TOKEN|SECRET|API_KEY|PASSWORD|AUTH_JSON)/iu;
|
|
89329
|
+
function nativeWorkerSecrets(environment) {
|
|
89330
|
+
const values = Object.entries(environment).filter(([key, value]) => SECRET_KEY.test(key) && value).map(([, value]) => value);
|
|
89331
|
+
if (environment.INPUT_VARS_JSON) {
|
|
89332
|
+
try {
|
|
89333
|
+
const inputs = JSON.parse(environment.INPUT_VARS_JSON);
|
|
89334
|
+
for (const [key, value] of Object.entries(inputs))
|
|
89335
|
+
if (SECRET_KEY.test(key) && typeof value === 'string')
|
|
89336
|
+
values.push(value);
|
|
89337
|
+
}
|
|
89338
|
+
catch { /* The existing input parser reports invalid configuration without raw values. */ }
|
|
89339
|
+
}
|
|
89340
|
+
return [...new Set(values.flatMap(value => [value, ...value.split(/[\r\n]/u)]).filter(value => value.length >= 3))].sort((a, b) => b.length - a.length);
|
|
89341
|
+
}
|
|
89342
|
+
/** Secrets are removed before bytes reach a private log file, not merely masked in the runner UI. */
|
|
89343
|
+
function redactNativeWorkerLogs(environment = process.env) {
|
|
89344
|
+
const secrets = nativeWorkerSecrets(environment);
|
|
89345
|
+
const restores = [];
|
|
89346
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
89347
|
+
const original = stream.write;
|
|
89348
|
+
const decoder = new node_string_decoder_1.StringDecoder('utf8');
|
|
89349
|
+
let pending = '';
|
|
89350
|
+
const emit = (line) => {
|
|
89351
|
+
const command = /^::add-mask::(.*?)(?:\r?\n)?$/u.exec(line);
|
|
89352
|
+
if (command) {
|
|
89353
|
+
const value = command[1].replace(/%0D/gu, '\r').replace(/%0A/gu, '\n').replace(/%25/gu, '%');
|
|
89354
|
+
secrets.push(...value.split(/[\r\n]/u).filter(part => part.length >= 3));
|
|
89355
|
+
return;
|
|
89356
|
+
}
|
|
89357
|
+
for (const secret of secrets)
|
|
89358
|
+
line = line.split(secret).join('[REDACTED]');
|
|
89359
|
+
original.call(stream, line);
|
|
89360
|
+
};
|
|
89361
|
+
stream.write = ((chunk, encoding, callback) => {
|
|
89362
|
+
pending += typeof chunk === 'string' ? chunk : decoder.write(Buffer.from(chunk));
|
|
89363
|
+
let end;
|
|
89364
|
+
while ((end = pending.indexOf('\n')) >= 0) {
|
|
89365
|
+
const line = pending.slice(0, end + 1);
|
|
89366
|
+
pending = pending.slice(end + 1);
|
|
89367
|
+
emit(line);
|
|
89368
|
+
}
|
|
89369
|
+
if (pending.length > 1048576)
|
|
89370
|
+
throw new Error('Copilot worker log line exceeded its fixed limit.');
|
|
89371
|
+
if (typeof encoding === 'function')
|
|
89372
|
+
encoding();
|
|
89373
|
+
else
|
|
89374
|
+
callback?.();
|
|
89375
|
+
return true;
|
|
89376
|
+
});
|
|
89377
|
+
restores.push(() => { pending += decoder.end(); if (pending)
|
|
89378
|
+
emit(pending); stream.write = original; });
|
|
89379
|
+
}
|
|
89380
|
+
return () => { for (const restore of restores)
|
|
89381
|
+
restore(); };
|
|
89382
|
+
}
|
|
89383
|
+
|
|
89384
|
+
|
|
89385
|
+
/***/ }),
|
|
89386
|
+
|
|
89387
|
+
/***/ 85290:
|
|
89388
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89389
|
+
|
|
89390
|
+
"use strict";
|
|
89391
|
+
|
|
89392
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89393
|
+
exports.cleanupNativeSourceRuntime = cleanupNativeSourceRuntime;
|
|
89394
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
89395
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89396
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
89397
|
+
/** Only source workflows use this snapshot; installed remote Actions already live outside the candidate. */
|
|
89398
|
+
function cleanupNativeSourceRuntime(root, workspace) {
|
|
89399
|
+
if (!root || !(0, node_fs_1.existsSync)(root))
|
|
89400
|
+
return;
|
|
89401
|
+
const allowed = ['.copilot-native-runtime', '.copilot-native-fixture-runtime'].map(name => (0, node_path_1.join)((0, node_path_1.dirname)(workspace), name));
|
|
89402
|
+
if (!allowed.includes(root) || (0, node_fs_1.lstatSync)(root).isSymbolicLink() || (0, node_fs_1.realpathSync)(root) !== root)
|
|
89403
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89404
|
+
let receipt;
|
|
89405
|
+
try {
|
|
89406
|
+
receipt = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(root, '.copilot-runtime-snapshot.json'), 'utf8'));
|
|
89407
|
+
}
|
|
89408
|
+
catch {
|
|
89409
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89410
|
+
}
|
|
89411
|
+
if (receipt?.kind !== 'copilot-native-runtime' || receipt.workspace !== workspace)
|
|
89412
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89413
|
+
(0, node_fs_1.rmSync)(root, { recursive: true, force: true });
|
|
89414
|
+
}
|
|
89415
|
+
|
|
89416
|
+
|
|
89417
|
+
/***/ }),
|
|
89418
|
+
|
|
89419
|
+
/***/ 63587:
|
|
89420
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89421
|
+
|
|
89422
|
+
"use strict";
|
|
89423
|
+
|
|
89424
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89425
|
+
exports.NATIVE_VERIFICATION_ACTION = void 0;
|
|
89426
|
+
exports.stageNativeVerificationAction = stageNativeVerificationAction;
|
|
89427
|
+
exports.cleanupNativeVerificationAction = cleanupNativeVerificationAction;
|
|
89428
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
89429
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89430
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
89431
|
+
const native_verification_protocol_1 = __nccwpck_require__(88709);
|
|
89432
|
+
exports.NATIVE_VERIFICATION_ACTION = '.git/copilot-verification-setup';
|
|
89433
|
+
function targetPath(workspace) {
|
|
89434
|
+
const metadata = (0, node_path_1.join)(workspace, '.git');
|
|
89435
|
+
const stat = (0, node_fs_1.lstatSync)(metadata);
|
|
89436
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || (0, node_fs_1.realpathSync)(metadata) !== metadata)
|
|
89437
|
+
throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required');
|
|
89438
|
+
return (0, node_path_1.join)(workspace, exports.NATIVE_VERIFICATION_ACTION);
|
|
89439
|
+
}
|
|
89440
|
+
/** Native composite metadata must remain available until its deferred post steps have finished. */
|
|
89441
|
+
function stageNativeVerificationAction(setup, session) {
|
|
89442
|
+
const target = targetPath(setup.workspace);
|
|
89443
|
+
const record = (0, native_verification_protocol_1.readNativeRecord)(session, 'staging.json');
|
|
89444
|
+
if (record && record.target !== target || !record && !!(0, node_fs_1.lstatSync)(target, { throwIfNoEntry: false }))
|
|
89445
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89446
|
+
(0, native_verification_protocol_1.writeNativeRecord)(session, 'staging.json', { target });
|
|
89447
|
+
(0, node_fs_1.rmSync)(target, { recursive: true, force: true });
|
|
89448
|
+
(0, node_fs_1.mkdirSync)(target, { mode: 0o700 });
|
|
89449
|
+
for (const file of setup.files) {
|
|
89450
|
+
const destination = (0, node_path_1.join)(target, file.path);
|
|
89451
|
+
const remainder = (0, node_path_1.relative)(target, destination);
|
|
89452
|
+
if (!remainder || remainder.startsWith(`..${node_path_1.sep}`) || remainder === '..')
|
|
89453
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
89454
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(destination), { recursive: true, mode: 0o700 });
|
|
89455
|
+
(0, node_fs_1.writeFileSync)(destination, Buffer.from(file.base64, 'base64'), { mode: file.executable ? 0o700 : 0o600, flag: 'wx' });
|
|
89456
|
+
}
|
|
89457
|
+
}
|
|
89458
|
+
function cleanupNativeVerificationAction(session, workspace) {
|
|
89459
|
+
const record = (0, native_verification_protocol_1.readNativeRecord)(session, 'staging.json');
|
|
89460
|
+
if (!record)
|
|
89461
|
+
return;
|
|
89462
|
+
const target = targetPath(workspace);
|
|
89463
|
+
if (record.target !== target)
|
|
89464
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89465
|
+
(0, node_fs_1.rmSync)(target, { recursive: true, force: true });
|
|
89466
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(session, 'staging.json'), { force: true });
|
|
89467
|
+
}
|
|
89468
|
+
|
|
89469
|
+
|
|
88007
89470
|
/***/ }),
|
|
88008
89471
|
|
|
88009
89472
|
/***/ 35849:
|
|
@@ -88053,6 +89516,7 @@ const node_crypto_1 = __nccwpck_require__(6005);
|
|
|
88053
89516
|
const node_child_process_1 = __nccwpck_require__(17718);
|
|
88054
89517
|
const node_util_1 = __nccwpck_require__(47261);
|
|
88055
89518
|
const pre_branch_sdd_1 = __nccwpck_require__(34730);
|
|
89519
|
+
const sdd_draft_consistency_1 = __nccwpck_require__(27910);
|
|
88056
89520
|
const git_authentication_environment_1 = __nccwpck_require__(16535);
|
|
88057
89521
|
const git_hook_isolation_1 = __nccwpck_require__(39764);
|
|
88058
89522
|
const runFile = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
@@ -88126,6 +89590,17 @@ class PreBranchSddWorkspaceAdapter {
|
|
|
88126
89590
|
if (fs.existsSync(target) !== (plan.action === 'update')) {
|
|
88127
89591
|
throw new Error('The SDD owner changed since analysis; restart clarification.');
|
|
88128
89592
|
}
|
|
89593
|
+
const owners = [];
|
|
89594
|
+
const inventory = await this.inventoryAt(snapshot.baseSha);
|
|
89595
|
+
for (const file of snapshot.capabilities.find(capability => capability.id === plan.capabilityId)?.specs ?? []) {
|
|
89596
|
+
if (!(0, pre_branch_sdd_1.isSafeSddPath)(file))
|
|
89597
|
+
throw new Error('An owning SDD path is unsafe.');
|
|
89598
|
+
if (!inventory.files.has(file))
|
|
89599
|
+
throw new Error('An owning SDD is not a regular file at the immutable base.');
|
|
89600
|
+
assertRegularSpecFile(path.join(root, file));
|
|
89601
|
+
owners.push({ path: file, markdown: await this.git(['show', `${snapshot.baseSha}:${file}`]) });
|
|
89602
|
+
}
|
|
89603
|
+
(0, sdd_draft_consistency_1.validateSddDraftConsistency)(markdown, owners, inventory, plan.path);
|
|
88129
89604
|
if (plan.action === 'update') {
|
|
88130
89605
|
assertRegularSpecFile(target);
|
|
88131
89606
|
const owner = await this.git(['show', `${snapshot.baseSha}:${plan.path}`]);
|
|
@@ -88264,7 +89739,13 @@ class PreBranchSddWorkspaceAdapter {
|
|
|
88264
89739
|
const raw = await this.git(['show', `${first}:specs/catalog.json`]);
|
|
88265
89740
|
newCapability = JSON.parse(raw).capabilities.find(capability => capability.id === prepared.plan.capabilityId);
|
|
88266
89741
|
}
|
|
88267
|
-
const
|
|
89742
|
+
const candidate = prepared.plan.action === 'update'
|
|
89743
|
+
? (0, pre_branch_sdd_1.recoverSddUpdate)(await this.git(['show', `${prepared.baseSha}:${prepared.plan.path}`]), content) : content;
|
|
89744
|
+
if (!candidate)
|
|
89745
|
+
return undefined;
|
|
89746
|
+
const recovered = await this.validateDraft(snapshot, prepared.plan, candidate, newCapability);
|
|
89747
|
+
if (recovered.markdown !== content)
|
|
89748
|
+
return undefined;
|
|
88268
89749
|
const committedPaths = (await this.git(['diff-tree', '--no-commit-id', '--name-only', '-r', first])).trim().split('\n').filter(Boolean).sort();
|
|
88269
89750
|
if (committedPaths.join('\n') !== recovered.changedPaths.join('\n'))
|
|
88270
89751
|
return undefined;
|
|
@@ -88299,6 +89780,25 @@ class PreBranchSddWorkspaceAdapter {
|
|
|
88299
89780
|
const output = await this.git(['status', '--porcelain', '--untracked-files=all'], root);
|
|
88300
89781
|
return output.split('\n').filter(Boolean).map(line => line.slice(3)).sort();
|
|
88301
89782
|
}
|
|
89783
|
+
async inventoryAt(sha) {
|
|
89784
|
+
const files = new Set();
|
|
89785
|
+
const directories = new Set();
|
|
89786
|
+
const blocked = new Set();
|
|
89787
|
+
const tree = await this.git(['ls-tree', '-rz', '--full-tree', sha]);
|
|
89788
|
+
for (const entry of tree.split('\0').filter(Boolean)) {
|
|
89789
|
+
const tab = entry.indexOf('\t');
|
|
89790
|
+
const file = entry.slice(tab + 1);
|
|
89791
|
+
const mode = entry.slice(0, 6);
|
|
89792
|
+
if (mode === '100644' || mode === '100755')
|
|
89793
|
+
files.add(file);
|
|
89794
|
+
else
|
|
89795
|
+
blocked.add(file);
|
|
89796
|
+
const parts = file.split('/');
|
|
89797
|
+
for (let index = 1; index < parts.length; index++)
|
|
89798
|
+
directories.add(parts.slice(0, index).join('/'));
|
|
89799
|
+
}
|
|
89800
|
+
return { files, directories, blocked };
|
|
89801
|
+
}
|
|
88302
89802
|
async addDetachedWorktree(sha) {
|
|
88303
89803
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'copilot-sdd-'));
|
|
88304
89804
|
try {
|
|
@@ -88405,6 +89905,190 @@ function writeSpecFile(target, content, exists) {
|
|
|
88405
89905
|
}
|
|
88406
89906
|
|
|
88407
89907
|
|
|
89908
|
+
/***/ }),
|
|
89909
|
+
|
|
89910
|
+
/***/ 12471:
|
|
89911
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
89912
|
+
|
|
89913
|
+
"use strict";
|
|
89914
|
+
|
|
89915
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
89916
|
+
if (k2 === undefined) k2 = k;
|
|
89917
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
89918
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
89919
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
89920
|
+
}
|
|
89921
|
+
Object.defineProperty(o, k2, desc);
|
|
89922
|
+
}) : (function(o, m, k, k2) {
|
|
89923
|
+
if (k2 === undefined) k2 = k;
|
|
89924
|
+
o[k2] = m[k];
|
|
89925
|
+
}));
|
|
89926
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
89927
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
89928
|
+
}) : function(o, v) {
|
|
89929
|
+
o["default"] = v;
|
|
89930
|
+
});
|
|
89931
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
89932
|
+
var ownKeys = function(o) {
|
|
89933
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
89934
|
+
var ar = [];
|
|
89935
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
89936
|
+
return ar;
|
|
89937
|
+
};
|
|
89938
|
+
return ownKeys(o);
|
|
89939
|
+
};
|
|
89940
|
+
return function (mod) {
|
|
89941
|
+
if (mod && mod.__esModule) return mod;
|
|
89942
|
+
var result = {};
|
|
89943
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
89944
|
+
__setModuleDefault(result, mod);
|
|
89945
|
+
return result;
|
|
89946
|
+
};
|
|
89947
|
+
})();
|
|
89948
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89949
|
+
exports.inspectSetupVerificationActionPath = inspectSetupVerificationActionPath;
|
|
89950
|
+
exports.readSetupVerificationActionStarter = readSetupVerificationActionStarter;
|
|
89951
|
+
exports.createSetupVerificationAction = createSetupVerificationAction;
|
|
89952
|
+
const fs = __importStar(__nccwpck_require__(87561));
|
|
89953
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89954
|
+
const setup_verification_action_1 = __nccwpck_require__(33156);
|
|
89955
|
+
const unsafe = () => new Error(`${setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH}: setup requires real parent directories and a regular action file. Inspect the path and remove unsafe links or collisions, then review setup again. Existing contents were preserved.`);
|
|
89956
|
+
const stale = () => new Error(`${setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH}: the path changed after review. No existing action was replaced. Review a fresh setup plan.`);
|
|
89957
|
+
const sameDirectory = (left, right) => left.ino > 0n
|
|
89958
|
+
&& left.dev === right.dev && left.ino === right.ino;
|
|
89959
|
+
const directoryFlags = fs.constants.O_RDONLY | (fs.constants.O_DIRECTORY ?? 0)
|
|
89960
|
+
| (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0);
|
|
89961
|
+
function entry(path) {
|
|
89962
|
+
try {
|
|
89963
|
+
return fs.lstatSync(path, { bigint: true });
|
|
89964
|
+
}
|
|
89965
|
+
catch (error) {
|
|
89966
|
+
if (error.code === 'ENOENT')
|
|
89967
|
+
return undefined;
|
|
89968
|
+
throw error;
|
|
89969
|
+
}
|
|
89970
|
+
}
|
|
89971
|
+
/** Inspect metadata only: consumer action contents and auxiliary files are never read. */
|
|
89972
|
+
function inspectSetupVerificationActionPath(root) {
|
|
89973
|
+
for (const parent of setup_verification_action_1.SETUP_VERIFICATION_ACTION_PARENTS) {
|
|
89974
|
+
const info = entry((0, node_path_1.join)(root, parent));
|
|
89975
|
+
if (!info)
|
|
89976
|
+
return 'create';
|
|
89977
|
+
if (!info.isDirectory() || info.isSymbolicLink())
|
|
89978
|
+
throw unsafe();
|
|
89979
|
+
}
|
|
89980
|
+
const info = entry((0, node_path_1.join)(root, setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH));
|
|
89981
|
+
if (!info)
|
|
89982
|
+
return 'create';
|
|
89983
|
+
if (!info.isFile() || info.isSymbolicLink())
|
|
89984
|
+
throw unsafe();
|
|
89985
|
+
return 'preserve';
|
|
89986
|
+
}
|
|
89987
|
+
/** Resolve the package-controlled starter, independently of workflow test overrides. */
|
|
89988
|
+
function readSetupVerificationActionStarter() {
|
|
89989
|
+
return fs.readFileSync((0, node_path_1.join)(__dirname, '..', '..', 'setup/actions/copilot-verification-setup/action.yml'), 'utf8');
|
|
89990
|
+
}
|
|
89991
|
+
/** Exclusive creation cannot truncate a file that wins the Apply race. */
|
|
89992
|
+
function createSetupVerificationAction(root, expected) {
|
|
89993
|
+
const state = inspectSetupVerificationActionPath(root);
|
|
89994
|
+
if (expected && expected !== state)
|
|
89995
|
+
throw stale();
|
|
89996
|
+
if (state === 'preserve')
|
|
89997
|
+
return { copied: 0, skipped: 1 };
|
|
89998
|
+
const content = readSetupVerificationActionStarter();
|
|
89999
|
+
const absoluteRoot = fs.realpathSync(root);
|
|
90000
|
+
const previousDirectory = fs.realpathSync('.');
|
|
90001
|
+
// Node has no portable openat. Pin each validated directory as the OS cwd,
|
|
90002
|
+
// then use only single-component relative operations. On POSIX this retains
|
|
90003
|
+
// the directory even if renamed; Windows locks the current directory.
|
|
90004
|
+
// This critical section is synchronous: never await or invoke user callbacks
|
|
90005
|
+
// here. The installer owns this main-thread section and always restores cwd.
|
|
90006
|
+
try {
|
|
90007
|
+
enterPinnedDirectory(absoluteRoot);
|
|
90008
|
+
for (const segment of ['.github', 'actions', 'copilot-verification-setup']) {
|
|
90009
|
+
try {
|
|
90010
|
+
fs.mkdirSync(segment);
|
|
90011
|
+
}
|
|
90012
|
+
catch (error) {
|
|
90013
|
+
if (error.code !== 'EEXIST')
|
|
90014
|
+
throw error;
|
|
90015
|
+
}
|
|
90016
|
+
enterPinnedDirectory(segment);
|
|
90017
|
+
}
|
|
90018
|
+
// Detect a relocated route before creation as well as after writing. A
|
|
90019
|
+
// replacement after this check cannot redirect the cwd-relative open.
|
|
90020
|
+
inspectSetupVerificationActionPath(absoluteRoot);
|
|
90021
|
+
writeStarterInPinnedDirectory(absoluteRoot, content);
|
|
90022
|
+
}
|
|
90023
|
+
finally {
|
|
90024
|
+
process.chdir(previousDirectory);
|
|
90025
|
+
}
|
|
90026
|
+
return { copied: 1, skipped: 0 };
|
|
90027
|
+
}
|
|
90028
|
+
function enterPinnedDirectory(path) {
|
|
90029
|
+
let descriptor;
|
|
90030
|
+
try {
|
|
90031
|
+
descriptor = fs.openSync(path, directoryFlags);
|
|
90032
|
+
}
|
|
90033
|
+
catch (error) {
|
|
90034
|
+
if (['ELOOP', 'ENOTDIR'].includes(error.code))
|
|
90035
|
+
throw unsafe();
|
|
90036
|
+
throw error;
|
|
90037
|
+
}
|
|
90038
|
+
try {
|
|
90039
|
+
// Keep the directory handle open until cwd is pinned, preventing inode reuse.
|
|
90040
|
+
const bound = fs.fstatSync(descriptor, { bigint: true });
|
|
90041
|
+
const observed = fs.lstatSync(path, { bigint: true });
|
|
90042
|
+
if (!bound.isDirectory() || !observed.isDirectory() || observed.isSymbolicLink())
|
|
90043
|
+
throw unsafe();
|
|
90044
|
+
if (!sameDirectory(bound, observed))
|
|
90045
|
+
throw stale();
|
|
90046
|
+
process.chdir(path);
|
|
90047
|
+
if (!sameDirectory(bound, fs.lstatSync('.', { bigint: true })))
|
|
90048
|
+
throw stale();
|
|
90049
|
+
}
|
|
90050
|
+
finally {
|
|
90051
|
+
fs.closeSync(descriptor);
|
|
90052
|
+
}
|
|
90053
|
+
}
|
|
90054
|
+
function writeStarterInPinnedDirectory(root, content) {
|
|
90055
|
+
const destination = 'action.yml';
|
|
90056
|
+
let descriptor;
|
|
90057
|
+
try {
|
|
90058
|
+
descriptor = fs.openSync(destination, 'wx', 0o644);
|
|
90059
|
+
}
|
|
90060
|
+
catch (error) {
|
|
90061
|
+
if (error.code === 'EEXIST')
|
|
90062
|
+
throw stale();
|
|
90063
|
+
throw error;
|
|
90064
|
+
}
|
|
90065
|
+
let created;
|
|
90066
|
+
try {
|
|
90067
|
+
try {
|
|
90068
|
+
created = fs.fstatSync(descriptor, { bigint: true });
|
|
90069
|
+
fs.writeFileSync(descriptor, content, 'utf8');
|
|
90070
|
+
if (inspectSetupVerificationActionPath(root) !== 'preserve')
|
|
90071
|
+
throw stale();
|
|
90072
|
+
if (!sameDirectory(fs.lstatSync('.', { bigint: true }), fs.lstatSync((0, node_path_1.join)(root, setup_verification_action_1.SETUP_VERIFICATION_ACTION_PARENTS[2]), { bigint: true })))
|
|
90073
|
+
throw stale();
|
|
90074
|
+
}
|
|
90075
|
+
finally {
|
|
90076
|
+
fs.closeSync(descriptor);
|
|
90077
|
+
}
|
|
90078
|
+
}
|
|
90079
|
+
catch (error) {
|
|
90080
|
+
// Remove only our incomplete file, never a concurrent replacement.
|
|
90081
|
+
try {
|
|
90082
|
+
const current = entry(destination);
|
|
90083
|
+
if (created && current?.dev === created.dev && current.ino === created.ino)
|
|
90084
|
+
fs.unlinkSync(destination);
|
|
90085
|
+
}
|
|
90086
|
+
catch { /* Preserve the original failure; an incomplete asset needs inspection. */ }
|
|
90087
|
+
throw error;
|
|
90088
|
+
}
|
|
90089
|
+
}
|
|
90090
|
+
|
|
90091
|
+
|
|
88408
90092
|
/***/ }),
|
|
88409
90093
|
|
|
88410
90094
|
/***/ 5729:
|
|
@@ -88434,6 +90118,7 @@ class SetupWorkspaceMutationAdapter {
|
|
|
88434
90118
|
updateExistingWorkflows: selection?.updateExistingWorkflows,
|
|
88435
90119
|
approvedWorkflowFiles: selection?.approvedWorkflowFiles,
|
|
88436
90120
|
setupConfiguration: selection?.setupConfiguration,
|
|
90121
|
+
verificationActionState: selection.verificationActionState,
|
|
88437
90122
|
});
|
|
88438
90123
|
}
|
|
88439
90124
|
hasValidToken(tokenOverride) {
|
|
@@ -88648,7 +90333,7 @@ const ALLOWED_VARIABLES = [
|
|
|
88648
90333
|
* credentials or paths to local agent authentication stores.
|
|
88649
90334
|
*/
|
|
88650
90335
|
function prepareUntrustedCommandEnvironment(source = process.env, platform = process.platform) {
|
|
88651
|
-
const runtimeHome = (0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)();
|
|
90336
|
+
const runtimeHome = (0, node_fs_1.realpathSync)((0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)());
|
|
88652
90337
|
const environment = { HOME: runtimeHome };
|
|
88653
90338
|
for (const variable of ALLOWED_VARIABLES) {
|
|
88654
90339
|
const value = source[variable];
|
|
@@ -88676,6 +90361,39 @@ function prepareUntrustedCommandEnvironment(source = process.env, platform = pro
|
|
|
88676
90361
|
}
|
|
88677
90362
|
|
|
88678
90363
|
|
|
90364
|
+
/***/ }),
|
|
90365
|
+
|
|
90366
|
+
/***/ 20878:
|
|
90367
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
90368
|
+
|
|
90369
|
+
"use strict";
|
|
90370
|
+
|
|
90371
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90372
|
+
exports.verificationExecutable = verificationExecutable;
|
|
90373
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
90374
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
90375
|
+
/** @actions/exec resolves basenames against its own process PATH; native tools belong to the verifier PATH. */
|
|
90376
|
+
function verificationExecutable(program, environment, platform = process.platform) {
|
|
90377
|
+
const explicit = (0, node_path_1.isAbsolute)(program) || /[\\/]/u.test(program);
|
|
90378
|
+
const candidates = explicit ? [(0, node_path_1.resolve)(program)] : (environment.PATH ?? '').split(node_path_1.delimiter).filter(Boolean).map(directory => (0, node_path_1.resolve)((0, node_path_1.join)(directory, program)));
|
|
90379
|
+
const windowsExtensions = (environment.PATHEXT || '.COM;.EXE;.BAT;.CMD').split(';').filter(Boolean);
|
|
90380
|
+
const hasWindowsExtension = windowsExtensions.some(extension => program.toLowerCase().endsWith(extension.toLowerCase()));
|
|
90381
|
+
const extensions = platform === 'win32' && !hasWindowsExtension ? windowsExtensions : [''];
|
|
90382
|
+
for (const candidate of candidates)
|
|
90383
|
+
for (const extension of extensions) {
|
|
90384
|
+
const file = candidate + extension;
|
|
90385
|
+
try {
|
|
90386
|
+
if ((0, node_fs_1.statSync)(file).isFile()) {
|
|
90387
|
+
(0, node_fs_1.accessSync)(file, node_fs_1.constants.X_OK);
|
|
90388
|
+
return file;
|
|
90389
|
+
}
|
|
90390
|
+
}
|
|
90391
|
+
catch { /* Try only the next executable in the isolated PATH. */ }
|
|
90392
|
+
}
|
|
90393
|
+
throw new Error('Verification executable is unavailable in the isolated PATH.');
|
|
90394
|
+
}
|
|
90395
|
+
|
|
90396
|
+
|
|
88679
90397
|
/***/ }),
|
|
88680
90398
|
|
|
88681
90399
|
/***/ 91053:
|
|
@@ -88802,6 +90520,267 @@ function checkRuntime(requirement, environment, run, platform, job) {
|
|
|
88802
90520
|
}
|
|
88803
90521
|
|
|
88804
90522
|
|
|
90523
|
+
/***/ }),
|
|
90524
|
+
|
|
90525
|
+
/***/ 23358:
|
|
90526
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
90527
|
+
|
|
90528
|
+
"use strict";
|
|
90529
|
+
|
|
90530
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90531
|
+
exports.applyVerificationSetupResult = applyVerificationSetupResult;
|
|
90532
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
90533
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
90534
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
90535
|
+
function contained(root, path) {
|
|
90536
|
+
const remainder = (0, node_path_1.relative)(root, path);
|
|
90537
|
+
return remainder === '' || (remainder !== '..' && !remainder.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(remainder));
|
|
90538
|
+
}
|
|
90539
|
+
/** Accept only existing contained directories, checking both lexical paths and symlink targets. */
|
|
90540
|
+
function approvedDirectory(value, roots) {
|
|
90541
|
+
if (!(0, node_path_1.isAbsolute)(value) || value.includes(node_path_1.delimiter) || value.split(/[\\/]/u).includes('..')
|
|
90542
|
+
|| !roots.some(root => contained(root, value)))
|
|
90543
|
+
throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
|
|
90544
|
+
const actual = (0, node_fs_1.realpathSync)(value);
|
|
90545
|
+
if (!roots.some(root => contained(root, actual)) || !(0, node_fs_1.lstatSync)(actual).isDirectory())
|
|
90546
|
+
throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
|
|
90547
|
+
return actual;
|
|
90548
|
+
}
|
|
90549
|
+
function applyVerificationSetupResult(file, environment, roots) {
|
|
90550
|
+
let descriptor;
|
|
90551
|
+
try {
|
|
90552
|
+
let before;
|
|
90553
|
+
try {
|
|
90554
|
+
before = (0, node_fs_1.lstatSync)(file, { bigint: true });
|
|
90555
|
+
}
|
|
90556
|
+
catch (error) {
|
|
90557
|
+
if (error.code === 'ENOENT')
|
|
90558
|
+
return;
|
|
90559
|
+
throw error;
|
|
90560
|
+
}
|
|
90561
|
+
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n || before.size > BigInt(verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes))
|
|
90562
|
+
throw new Error();
|
|
90563
|
+
descriptor = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
|
|
90564
|
+
const opened = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
|
|
90565
|
+
if (!opened.isFile() || opened.nlink !== 1n || opened.dev !== before.dev || opened.ino !== before.ino
|
|
90566
|
+
|| opened.size !== before.size || opened.mtimeNs !== before.mtimeNs)
|
|
90567
|
+
throw new Error();
|
|
90568
|
+
const bytes = Buffer.alloc(verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes + 1);
|
|
90569
|
+
const size = (0, node_fs_1.readSync)(descriptor, bytes, 0, bytes.length, 0);
|
|
90570
|
+
if (size > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes)
|
|
90571
|
+
throw new Error();
|
|
90572
|
+
const after = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
|
|
90573
|
+
if (after.size !== opened.size || after.mtimeNs !== opened.mtimeNs)
|
|
90574
|
+
throw new Error();
|
|
90575
|
+
const result = (0, verification_setup_policy_1.parseVerificationSetupResult)(JSON.parse(bytes.subarray(0, size).toString('utf8')));
|
|
90576
|
+
const paths = result.path.map(value => approvedDirectory(value, roots));
|
|
90577
|
+
const javaHome = result.javaHome ? approvedDirectory(result.javaHome, roots) : undefined;
|
|
90578
|
+
if (paths.length)
|
|
90579
|
+
environment.PATH = [...paths, ...(environment.PATH ? [environment.PATH] : [])].join(node_path_1.delimiter);
|
|
90580
|
+
if (javaHome)
|
|
90581
|
+
environment.JAVA_HOME = javaHome;
|
|
90582
|
+
}
|
|
90583
|
+
catch {
|
|
90584
|
+
throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
|
|
90585
|
+
}
|
|
90586
|
+
finally {
|
|
90587
|
+
if (descriptor !== undefined)
|
|
90588
|
+
(0, node_fs_1.closeSync)(descriptor);
|
|
90589
|
+
}
|
|
90590
|
+
}
|
|
90591
|
+
|
|
90592
|
+
|
|
90593
|
+
/***/ }),
|
|
90594
|
+
|
|
90595
|
+
/***/ 11709:
|
|
90596
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
90597
|
+
|
|
90598
|
+
"use strict";
|
|
90599
|
+
|
|
90600
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90601
|
+
exports.prepareRepositoryVerification = prepareRepositoryVerification;
|
|
90602
|
+
const verification_setup_snapshot_1 = __nccwpck_require__(62148);
|
|
90603
|
+
const native_verification_profiles_1 = __nccwpck_require__(22290);
|
|
90604
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
90605
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
90606
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
90607
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
90608
|
+
const verification_setup_result_1 = __nccwpck_require__(23358);
|
|
90609
|
+
const logging_ports_1 = __nccwpck_require__(6152);
|
|
90610
|
+
const native_verification_protocol_1 = __nccwpck_require__(88709);
|
|
90611
|
+
const native_verification_staging_1 = __nccwpck_require__(63587);
|
|
90612
|
+
const native_verification_candidate_1 = __nccwpck_require__(18883);
|
|
90613
|
+
/** The runner executes YAML. This adapter pauses the admitted call stack at its verification boundary. */
|
|
90614
|
+
async function prepareRepositoryVerification(setup, environment) {
|
|
90615
|
+
if (setup.kind === 'disabled')
|
|
90616
|
+
return;
|
|
90617
|
+
if (setup.kind === 'blocked')
|
|
90618
|
+
throw new verification_setup_policy_1.VerificationSetupError(setup.reason, setup.sourceSha);
|
|
90619
|
+
const session = process.env.COPILOT_NATIVE_WORKER_SESSION;
|
|
90620
|
+
if (!session)
|
|
90621
|
+
throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required', setup.sourceSha);
|
|
90622
|
+
let requestCreated = false;
|
|
90623
|
+
try {
|
|
90624
|
+
(0, native_verification_protocol_1.nativeSession)(session);
|
|
90625
|
+
const requests = (0, native_verification_protocol_1.readNativeRecord)(session, 'request-count.json')?.count ?? 0;
|
|
90626
|
+
if (requests >= verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.requests)
|
|
90627
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
90628
|
+
(0, native_verification_protocol_1.writeNativeRecord)(session, 'request-count.json', { count: requests + 1 });
|
|
90629
|
+
if ((0, node_fs_1.realpathSync)(process.cwd()) !== setup.workspace)
|
|
90630
|
+
throw new verification_setup_policy_1.VerificationSetupError('workspace-changed');
|
|
90631
|
+
(0, native_verification_profiles_1.registerNativeVerificationProfile)(session, environment.HOME);
|
|
90632
|
+
const identity = (0, native_verification_candidate_1.verificationCandidateIdentity)(setup.workspace, environment);
|
|
90633
|
+
(0, native_verification_staging_1.stageNativeVerificationAction)(setup, session);
|
|
90634
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
90635
|
+
(0, native_verification_protocol_1.writeNativeRecord)(session, 'request.json', { id, sourceSha: setup.sourceSha, digest: (0, verification_setup_snapshot_1.verificationSetupDigest)(setup), environment });
|
|
90636
|
+
requestCreated = true;
|
|
90637
|
+
(0, logging_ports_1.logInfo)(`Preparing repository verification (${verification_setup_policy_1.VERIFICATION_SETUP_PATH}; trusted source SHA: ${setup.sourceSha}).`);
|
|
90638
|
+
const deadline = Date.now() + verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.timeoutMs;
|
|
90639
|
+
let response;
|
|
90640
|
+
while (!(response = (0, native_verification_protocol_1.readNativeRecord)(session, `response-${id}.json`))) {
|
|
90641
|
+
if ((0, native_verification_protocol_1.readNativeRecord)(session, 'cancel.json'))
|
|
90642
|
+
throw new verification_setup_policy_1.VerificationSetupError('cancelled');
|
|
90643
|
+
if (Date.now() >= deadline)
|
|
90644
|
+
throw new verification_setup_policy_1.VerificationSetupError('timeout');
|
|
90645
|
+
await (0, native_verification_protocol_1.nativePause)(100);
|
|
90646
|
+
}
|
|
90647
|
+
if (response.id !== id || response.success !== true)
|
|
90648
|
+
throw new verification_setup_policy_1.VerificationSetupError('process-failed');
|
|
90649
|
+
if ((0, native_verification_candidate_1.verificationCandidateIdentity)(setup.workspace, environment) !== identity)
|
|
90650
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
90651
|
+
if (typeof response.path !== 'string' || response.path.length > 16384 || response.javaHome !== undefined && typeof response.javaHome !== 'string')
|
|
90652
|
+
throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
|
|
90653
|
+
const original = new Set((environment.PATH ?? '').split(node_path_1.delimiter));
|
|
90654
|
+
const previousProfiles = (0, native_verification_profiles_1.nativeVerificationProfilePaths)(session).filter(profile => profile !== environment.HOME);
|
|
90655
|
+
const fromPreviousProfile = (path) => previousProfiles.some(profile => {
|
|
90656
|
+
const part = (0, node_path_1.relative)(profile, path);
|
|
90657
|
+
return part === '' || part !== '..' && !part.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(part);
|
|
90658
|
+
});
|
|
90659
|
+
const additions = [...new Set(response.path.split(node_path_1.delimiter).filter(path => path && !original.has(path) && !fromPreviousProfile(path)))];
|
|
90660
|
+
const result = (0, node_path_1.join)(environment.HOME, 'native-setup-result.json');
|
|
90661
|
+
(0, node_fs_1.writeFileSync)(result, JSON.stringify({ schemaVersion: 1, path: additions,
|
|
90662
|
+
environment: response.javaHome && response.javaHome !== environment.JAVA_HOME ? { JAVA_HOME: response.javaHome } : {} }), { mode: 0o600, flag: 'wx' });
|
|
90663
|
+
(0, verification_setup_result_1.applyVerificationSetupResult)(result, environment, [setup.workspace, environment.HOME, ...(setup.toolRoot ? [setup.toolRoot] : [])]);
|
|
90664
|
+
(0, logging_ports_1.logInfo)('Repository setup completed; runtime preflight and verification may proceed.');
|
|
90665
|
+
}
|
|
90666
|
+
catch (error) {
|
|
90667
|
+
throw new verification_setup_policy_1.VerificationSetupError(error instanceof verification_setup_policy_1.VerificationSetupError ? error.reason : 'handoff-invalid', setup.sourceSha);
|
|
90668
|
+
}
|
|
90669
|
+
finally {
|
|
90670
|
+
if (requestCreated)
|
|
90671
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(session, 'request.json'), { force: true });
|
|
90672
|
+
}
|
|
90673
|
+
}
|
|
90674
|
+
|
|
90675
|
+
|
|
90676
|
+
/***/ }),
|
|
90677
|
+
|
|
90678
|
+
/***/ 62148:
|
|
90679
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
90680
|
+
|
|
90681
|
+
"use strict";
|
|
90682
|
+
|
|
90683
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90684
|
+
exports.verificationSetupDigest = verificationSetupDigest;
|
|
90685
|
+
exports.captureVerificationSetup = captureVerificationSetup;
|
|
90686
|
+
exports.captureVerificationSetupAtCommit = captureVerificationSetupAtCommit;
|
|
90687
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
90688
|
+
const node_child_process_1 = __nccwpck_require__(17718);
|
|
90689
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
90690
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
90691
|
+
const js_yaml_1 = __nccwpck_require__(783);
|
|
90692
|
+
const verification_setup_ports_1 = __nccwpck_require__(26509);
|
|
90693
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
90694
|
+
const untrusted_command_environment_1 = __nccwpck_require__(2304);
|
|
90695
|
+
/** Only immutable Git objects are read. Errors remain deferred on non-verifying routes. */
|
|
90696
|
+
function verificationSetupDigest(setup) {
|
|
90697
|
+
return (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(setup.files)).digest('hex');
|
|
90698
|
+
}
|
|
90699
|
+
function captureVerificationSetup(enabled, mainBranch, root = process.cwd()) {
|
|
90700
|
+
return capture(enabled, mainBranch, root);
|
|
90701
|
+
}
|
|
90702
|
+
/** Post steps use the already pinned commit from runner state, never a mutable branch ref. */
|
|
90703
|
+
function captureVerificationSetupAtCommit(commit, root = process.cwd(), gitExecutable) {
|
|
90704
|
+
return capture(true, '', root, commit, gitExecutable);
|
|
90705
|
+
}
|
|
90706
|
+
function capture(enabled, mainBranch, root, pinned, gitExecutable) {
|
|
90707
|
+
if (!enabled)
|
|
90708
|
+
return verification_setup_ports_1.DISABLED_VERIFICATION_SETUP;
|
|
90709
|
+
let sourceSha;
|
|
90710
|
+
let runtime;
|
|
90711
|
+
let snapshot;
|
|
90712
|
+
try {
|
|
90713
|
+
runtime = (0, untrusted_command_environment_1.prepareUntrustedCommandEnvironment)();
|
|
90714
|
+
const environment = runtime.environment;
|
|
90715
|
+
if (!pinned && (!/^[A-Za-z0-9][A-Za-z0-9._/-]{0,200}$/u.test(mainBranch) || mainBranch.includes('..')
|
|
90716
|
+
|| mainBranch.includes('//') || mainBranch.endsWith('/') || mainBranch.endsWith('.lock')))
|
|
90717
|
+
throw new Error();
|
|
90718
|
+
if (gitExecutable !== undefined && !(0, node_path_1.isAbsolute)(gitExecutable))
|
|
90719
|
+
throw new Error();
|
|
90720
|
+
const workspace = (0, node_fs_1.realpathSync)(root);
|
|
90721
|
+
const git = (...args) => {
|
|
90722
|
+
const result = (0, node_child_process_1.spawnSync)(gitExecutable ?? 'git', ['--no-replace-objects', ...args], { cwd: workspace, env: environment,
|
|
90723
|
+
shell: false, windowsHide: true, timeout: 5000, maxBuffer: verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.snapshotBytes + 4096 });
|
|
90724
|
+
if (result.error || result.status !== 0)
|
|
90725
|
+
throw new Error();
|
|
90726
|
+
return result.stdout;
|
|
90727
|
+
};
|
|
90728
|
+
const sha = pinned ?? git('rev-parse', '--verify', `refs/remotes/origin/${mainBranch}^{commit}`).toString('utf8').trim();
|
|
90729
|
+
if (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(sha))
|
|
90730
|
+
throw new Error();
|
|
90731
|
+
sourceSha = sha;
|
|
90732
|
+
const entries = git('ls-tree', '-rz', sourceSha, '--', verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY).toString('utf8').split('\0').filter(Boolean);
|
|
90733
|
+
if (!entries.length || entries.length > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.files)
|
|
90734
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90735
|
+
let total = 0;
|
|
90736
|
+
const files = entries.map(entry => {
|
|
90737
|
+
const match = /^(100644|100755) blob ([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(entry);
|
|
90738
|
+
if (!match || !match[3].startsWith(`${verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY}/`))
|
|
90739
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90740
|
+
const path = match[3].slice(verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY.length + 1);
|
|
90741
|
+
if (!/^[A-Za-z0-9_./-]{1,200}$/u.test(path) || path.split('/').some(part => !part || part === '.' || part === '..' || part.endsWith('.') || /^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])(?:\.|$)/iu.test(part)))
|
|
90742
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90743
|
+
const bytes = git('cat-file', 'blob', match[2]);
|
|
90744
|
+
total += bytes.length;
|
|
90745
|
+
const digest = (0, node_crypto_1.createHash)(match[2].length === 40 ? 'sha1' : 'sha256').update(`blob ${bytes.length}\0`).update(bytes).digest('hex');
|
|
90746
|
+
if (bytes.length > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.scriptBytes || total > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.snapshotBytes || digest !== match[2])
|
|
90747
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90748
|
+
return Object.freeze({ path, base64: bytes.toString('base64'), executable: match[1] === '100755' });
|
|
90749
|
+
});
|
|
90750
|
+
const manifest = files.find(file => file.path === 'action.yml');
|
|
90751
|
+
if (!manifest)
|
|
90752
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90753
|
+
const bytes = Buffer.from(manifest.base64, 'base64');
|
|
90754
|
+
const text = bytes.toString('utf8');
|
|
90755
|
+
if (!bytes.length || !bytes.equals(Buffer.from(text)) || text.includes('\0'))
|
|
90756
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90757
|
+
let action;
|
|
90758
|
+
try {
|
|
90759
|
+
action = (0, js_yaml_1.load)(text);
|
|
90760
|
+
}
|
|
90761
|
+
catch {
|
|
90762
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90763
|
+
}
|
|
90764
|
+
if (action?.runs?.using !== 'composite' || !Array.isArray(action.runs.steps) || !action.runs.steps.length || action.runs.steps.length > 32)
|
|
90765
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90766
|
+
if (action.runs.steps.some(step => !step || typeof step !== 'object' || 'uses' in step && typeof step.uses === 'string' && step.uses.startsWith('./')))
|
|
90767
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90768
|
+
const toolRoot = environment.RUNNER_TOOL_CACHE ? (0, node_fs_1.realpathSync)(environment.RUNNER_TOOL_CACHE) : undefined;
|
|
90769
|
+
snapshot = Object.freeze({ kind: 'ready', files: Object.freeze(files), sourceSha, workspace, ...(toolRoot ? { toolRoot } : {}) });
|
|
90770
|
+
}
|
|
90771
|
+
catch (error) {
|
|
90772
|
+
snapshot = Object.freeze({ kind: 'blocked', reason: error instanceof verification_setup_policy_1.VerificationSetupError ? error.reason : 'source-unavailable', ...(sourceSha ? { sourceSha } : {}) });
|
|
90773
|
+
}
|
|
90774
|
+
try {
|
|
90775
|
+
runtime?.cleanup();
|
|
90776
|
+
}
|
|
90777
|
+
catch {
|
|
90778
|
+
snapshot = Object.freeze({ kind: 'blocked', reason: 'source-unavailable', ...(sourceSha ? { sourceSha } : {}) });
|
|
90779
|
+
}
|
|
90780
|
+
return snapshot;
|
|
90781
|
+
}
|
|
90782
|
+
|
|
90783
|
+
|
|
88805
90784
|
/***/ }),
|
|
88806
90785
|
|
|
88807
90786
|
/***/ 92540:
|
|
@@ -88959,26 +90938,64 @@ const logger_1 = __nccwpck_require__(91151);
|
|
|
88959
90938
|
const issue_content_interface_1 = __nccwpck_require__(60608);
|
|
88960
90939
|
const configuration_payload_policy_1 = __nccwpck_require__(58043);
|
|
88961
90940
|
const application_error_1 = __nccwpck_require__(75999);
|
|
90941
|
+
const configuration_markers_1 = __nccwpck_require__(4586);
|
|
88962
90942
|
class ConfigurationHandler extends issue_content_interface_1.IssueContentInterface {
|
|
88963
90943
|
constructor() {
|
|
88964
90944
|
super(...arguments);
|
|
90945
|
+
this.getContent = (description) => {
|
|
90946
|
+
const block = (0, configuration_markers_1.readConfigurationBlock)(description);
|
|
90947
|
+
return block.kind === 'present' ? block.content : undefined;
|
|
90948
|
+
};
|
|
90949
|
+
this.updateContent = (description, content) => {
|
|
90950
|
+
if (description === undefined || content === undefined)
|
|
90951
|
+
return undefined;
|
|
90952
|
+
const updated = (0, configuration_markers_1.writeConfigurationBlock)(description, content);
|
|
90953
|
+
if (updated === undefined)
|
|
90954
|
+
(0, logger_1.logError)('The content has a problem with open-close tags: stored configuration.');
|
|
90955
|
+
return updated;
|
|
90956
|
+
};
|
|
88965
90957
|
this.update = async (query, context) => {
|
|
88966
90958
|
const storedRaw = await this.internalGetter(query);
|
|
88967
90959
|
return this.internalUpdate(query, (0, configuration_payload_policy_1.buildConfigurationPayload)(context, storedRaw));
|
|
88968
90960
|
};
|
|
88969
90961
|
this.get = async (query) => {
|
|
90962
|
+
let description;
|
|
90963
|
+
try {
|
|
90964
|
+
description = await this.issueDescriptionPort.getDescription(query.owner, query.repository, query.issueNumber, query.token);
|
|
90965
|
+
}
|
|
90966
|
+
catch (cause) {
|
|
90967
|
+
const semanticError = (0, application_error_1.toApplicationError)(cause, 'provider.unavailable', 'Unable to read issue configuration.');
|
|
90968
|
+
(0, logger_1.logError)(semanticError);
|
|
90969
|
+
throw semanticError;
|
|
90970
|
+
}
|
|
90971
|
+
const variables = { issueNumber: query.issueNumber, expectedVersion: config_1.CONFIG_SCHEMA_VERSION };
|
|
90972
|
+
let recovery = { id: 'stored-configuration-invalid', variables };
|
|
88970
90973
|
try {
|
|
88971
|
-
const description = await this.issueDescriptionPort.getDescription(query.owner, query.repository, query.issueNumber, query.token);
|
|
88972
90974
|
const config = this.getContent(description);
|
|
88973
90975
|
if (config === undefined) {
|
|
90976
|
+
if ((0, configuration_markers_1.readConfigurationBlock)(description).kind === 'invalid') {
|
|
90977
|
+
throw new Error('Stored configuration markers are inconsistent.');
|
|
90978
|
+
}
|
|
88974
90979
|
return undefined;
|
|
88975
90980
|
}
|
|
88976
|
-
const
|
|
90981
|
+
const parsed = JSON.parse(config);
|
|
90982
|
+
if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
90983
|
+
const version = parsed.schemaVersion;
|
|
90984
|
+
if (version === undefined) {
|
|
90985
|
+
recovery = { id: 'stored-configuration-schema-missing', variables };
|
|
90986
|
+
}
|
|
90987
|
+
else if (typeof version === 'number' && Number.isSafeInteger(version)
|
|
90988
|
+
&& version >= 0 && version !== config_1.CONFIG_SCHEMA_VERSION) {
|
|
90989
|
+
recovery = { id: 'stored-configuration-schema-unsupported', variables: { ...variables, actualVersion: version } };
|
|
90990
|
+
}
|
|
90991
|
+
}
|
|
90992
|
+
const branchConfig = (0, config_1.requireCurrentConfigurationPayload)(parsed);
|
|
88977
90993
|
return new config_1.Config(branchConfig);
|
|
88978
90994
|
}
|
|
88979
|
-
catch (
|
|
88980
|
-
|
|
88981
|
-
|
|
90995
|
+
catch (cause) {
|
|
90996
|
+
const semanticError = (0, application_error_1.toApplicationError)(cause, 'configuration.invalid', 'Stored issue/PR configuration is invalid.', { recovery });
|
|
90997
|
+
(0, logger_1.logError)(semanticError);
|
|
90998
|
+
throw semanticError;
|
|
88982
90999
|
}
|
|
88983
91000
|
};
|
|
88984
91001
|
}
|
|
@@ -88992,6 +91009,96 @@ class ConfigurationHandler extends issue_content_interface_1.IssueContentInterfa
|
|
|
88992
91009
|
exports.ConfigurationHandler = ConfigurationHandler;
|
|
88993
91010
|
|
|
88994
91011
|
|
|
91012
|
+
/***/ }),
|
|
91013
|
+
|
|
91014
|
+
/***/ 4586:
|
|
91015
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
91016
|
+
|
|
91017
|
+
"use strict";
|
|
91018
|
+
|
|
91019
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
91020
|
+
exports.CONFIGURATION_END = exports.CONFIGURATION_START = void 0;
|
|
91021
|
+
exports.readConfigurationBlock = readConfigurationBlock;
|
|
91022
|
+
exports.writeConfigurationBlock = writeConfigurationBlock;
|
|
91023
|
+
exports.CONFIGURATION_START = '<!-- copilot-configuration-start';
|
|
91024
|
+
exports.CONFIGURATION_END = 'copilot-configuration-end -->';
|
|
91025
|
+
/** Owned delimiters begin a line; ordinary mentions are not state. Complete legacy fenced records remain readable. */
|
|
91026
|
+
function readConfigurationBlock(description) {
|
|
91027
|
+
if (description === undefined)
|
|
91028
|
+
return { kind: 'absent' };
|
|
91029
|
+
let fence;
|
|
91030
|
+
let fencedMarker = false;
|
|
91031
|
+
let fencedStart;
|
|
91032
|
+
let nestedFencedStart = false;
|
|
91033
|
+
let start;
|
|
91034
|
+
let contentStart = 0;
|
|
91035
|
+
let block;
|
|
91036
|
+
let offset = 0;
|
|
91037
|
+
for (const line of description.match(/[^\n]*(?:\n|$)/gu) ?? []) {
|
|
91038
|
+
const text = line.replace(/\r?\n$/u, '');
|
|
91039
|
+
const starts = /^ {0,3}<!-- copilot-configuration-start(?:[ \t]|$)/u.test(text);
|
|
91040
|
+
const ends = /^ {0,3}copilot-configuration-end -->[ \t]*$/u.test(text);
|
|
91041
|
+
const boundary = /^ {0,3}(`{3,}|~{3,})(.*)$/u.exec(text);
|
|
91042
|
+
if (fence) {
|
|
91043
|
+
fencedMarker || (fencedMarker = starts || ends);
|
|
91044
|
+
if (starts) {
|
|
91045
|
+
if (fencedStart !== undefined)
|
|
91046
|
+
nestedFencedStart = true;
|
|
91047
|
+
else
|
|
91048
|
+
fencedStart = offset + text.indexOf(exports.CONFIGURATION_START);
|
|
91049
|
+
}
|
|
91050
|
+
const end = text.indexOf(exports.CONFIGURATION_END);
|
|
91051
|
+
if (fencedStart !== undefined && end >= 0 && !text.slice(end + exports.CONFIGURATION_END.length).trim()) {
|
|
91052
|
+
if (block || nestedFencedStart)
|
|
91053
|
+
return { kind: 'invalid' };
|
|
91054
|
+
block = { kind: 'present', start: fencedStart, end: offset + end + exports.CONFIGURATION_END.length,
|
|
91055
|
+
content: description.slice(fencedStart + exports.CONFIGURATION_START.length, offset + end) };
|
|
91056
|
+
fencedStart = undefined;
|
|
91057
|
+
}
|
|
91058
|
+
if (boundary && boundary[1][0] === fence[0] && boundary[1].length >= fence.length && !boundary[2].trim()) {
|
|
91059
|
+
fence = undefined;
|
|
91060
|
+
fencedMarker = false;
|
|
91061
|
+
fencedStart = undefined;
|
|
91062
|
+
nestedFencedStart = false;
|
|
91063
|
+
}
|
|
91064
|
+
}
|
|
91065
|
+
else if (start !== undefined || starts) {
|
|
91066
|
+
if (starts) {
|
|
91067
|
+
if (start !== undefined || block)
|
|
91068
|
+
return { kind: 'invalid' };
|
|
91069
|
+
start = offset + text.indexOf(exports.CONFIGURATION_START);
|
|
91070
|
+
contentStart = start + exports.CONFIGURATION_START.length;
|
|
91071
|
+
}
|
|
91072
|
+
const end = text.indexOf(exports.CONFIGURATION_END);
|
|
91073
|
+
if (end >= 0 && !text.slice(end + exports.CONFIGURATION_END.length).trim()) {
|
|
91074
|
+
block = { kind: 'present', start: start, end: offset + end + exports.CONFIGURATION_END.length,
|
|
91075
|
+
content: description.slice(contentStart, offset + end) };
|
|
91076
|
+
start = undefined;
|
|
91077
|
+
}
|
|
91078
|
+
}
|
|
91079
|
+
else if (ends)
|
|
91080
|
+
return { kind: 'invalid' };
|
|
91081
|
+
else if (boundary && (boundary[1][0] !== '`' || !boundary[2].includes('`')))
|
|
91082
|
+
fence = boundary[1];
|
|
91083
|
+
offset += line.length;
|
|
91084
|
+
}
|
|
91085
|
+
// A legacy block behind an unclosed fence is ambiguous: never silently discard its state.
|
|
91086
|
+
if (start !== undefined || fence && fencedMarker)
|
|
91087
|
+
return { kind: 'invalid' };
|
|
91088
|
+
return block ?? { kind: 'absent', ...(fence ? { closingFence: fence } : {}) };
|
|
91089
|
+
}
|
|
91090
|
+
function writeConfigurationBlock(description, content) {
|
|
91091
|
+
const block = readConfigurationBlock(description);
|
|
91092
|
+
if (block.kind === 'invalid')
|
|
91093
|
+
return undefined;
|
|
91094
|
+
const replacement = `${exports.CONFIGURATION_START}\n${content}\n${exports.CONFIGURATION_END}`;
|
|
91095
|
+
if (block.kind === 'present')
|
|
91096
|
+
return description.slice(0, block.start) + replacement + description.slice(block.end);
|
|
91097
|
+
// Closing an otherwise empty dangling example preserves its rendered text and keeps new state outside it.
|
|
91098
|
+
return `${description}\n\n${block.closingFence ? `${block.closingFence}\n\n` : ''}${replacement}`;
|
|
91099
|
+
}
|
|
91100
|
+
|
|
91101
|
+
|
|
88995
91102
|
/***/ }),
|
|
88996
91103
|
|
|
88997
91104
|
/***/ 58043:
|
|
@@ -89121,11 +91228,13 @@ function getBranchSyncConflictsPrompt(params) {
|
|
|
89121
91228
|
"use strict";
|
|
89122
91229
|
|
|
89123
91230
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
91231
|
+
exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION = void 0;
|
|
89124
91232
|
exports.getBugbotPrompt = getBugbotPrompt;
|
|
89125
91233
|
/**
|
|
89126
91234
|
* Prompt for Bugbot detection (detect potential problems on push).
|
|
89127
91235
|
*/
|
|
89128
91236
|
const fill_1 = __nccwpck_require__(2559);
|
|
91237
|
+
exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION = 'Before returning a finding, try to disprove it against the exact reviewed source. Read effective repository configuration and inherited library/protocol defaults before inferring behavior from a missing command flag. Trace short-circuit guards, validation helpers and the actual caller/render path before claiming that an unsafe branch is reachable or that separate call sites coexist. Recompute arithmetic and check cited line numbers against the current file/diff. If your evidence refutes the alleged defect, withdraw the finding entirely; do not publish a contradictory or self-refuting report. These checks apply equally to low/info severity. Report a confirmed failure when those protections are absent; do not assume they exist.';
|
|
89129
91238
|
const TEMPLATE = `You are analyzing the latest code changes for potential bugs and issues.
|
|
89130
91239
|
|
|
89131
91240
|
Write every human-readable finding title, description, evidence, and suggestion in {{targetLocale}}. Preserve identifiers, code, symbols, paths, refs, commands, and URLs verbatim. Echo \`outputLocale\` exactly as \`{{targetLocale}}\`.
|
|
@@ -89161,6 +91270,8 @@ For every finding:
|
|
|
89161
91270
|
- include the nearest stable \`symbol\` and a minimal exact \`codeSnippet\` when available so the finding can survive rebases, line movement, and file renames.
|
|
89162
91271
|
- when a fix is a safe replacement of exactly the reported line range, include only the replacement text in \`suggestedCode\`; otherwise omit it.
|
|
89163
91272
|
|
|
91273
|
+
${exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION}
|
|
91274
|
+
|
|
89164
91275
|
Return every finding field required by the response schema. Use null for file, line, endLine, severity, confidence, category, evidence, suggestion, symbol, codeSnippet, or suggestedCode when that value does not safely apply. Only include files outside the ignore list.
|
|
89165
91276
|
{{previousBlock}}
|
|
89166
91277
|
|
|
@@ -90638,11 +92749,13 @@ const setup_approval_workflow_1 = __nccwpck_require__(9512);
|
|
|
90638
92749
|
const setup_workflow_upgrade_1 = __nccwpck_require__(85493);
|
|
90639
92750
|
const setup_installation_review_1 = __nccwpck_require__(23799);
|
|
90640
92751
|
const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
|
|
92752
|
+
const setup_verification_action_1 = __nccwpck_require__(12471);
|
|
90641
92753
|
/**
|
|
90642
92754
|
* Ensure .github, .github/workflows and .github/ISSUE_TEMPLATE exist; create them if missing.
|
|
90643
92755
|
* @param cwd - Directory (repo root)
|
|
90644
92756
|
*/
|
|
90645
92757
|
function ensureGitHubDirs(cwd) {
|
|
92758
|
+
(0, setup_verification_action_1.inspectSetupVerificationActionPath)(cwd);
|
|
90646
92759
|
const githubDir = path.join(cwd, '.github');
|
|
90647
92760
|
const workflowsDir = path.join(cwd, '.github', 'workflows');
|
|
90648
92761
|
const issueTemplateDir = path.join(cwd, '.github', 'ISSUE_TEMPLATE');
|
|
@@ -90675,6 +92788,7 @@ function copySetupFiles(cwd, setupDirOverride, features, options = {}) {
|
|
|
90675
92788
|
const installationReview = options.setupConfiguration && (0, setup_installation_review_1.inspectSetupInstallation)(cwd, options.setupConfiguration, setupDir);
|
|
90676
92789
|
if (installationReview?.blockers.length)
|
|
90677
92790
|
throw new Error(installationReview.blockers.join(' '));
|
|
92791
|
+
const verificationAction = (0, setup_verification_action_1.createSetupVerificationAction)(cwd, options.verificationActionState);
|
|
90678
92792
|
const preserveSourceGuidance = installationReview?.assets.some(asset => asset.path === repository_agent_guidance_policy_1.REPOSITORY_AGENT_GUIDE_PATH && asset.status === 'source-only');
|
|
90679
92793
|
const sourceInstallation = installationReview?.assets.some(asset => asset.path.startsWith('.github/workflows/') && asset.status === 'source-only');
|
|
90680
92794
|
const snapshotContent = options.setupConfiguration && (0, setup_installation_review_1.renderSetupRunnerSnapshot)(options.setupConfiguration);
|
|
@@ -90729,7 +92843,7 @@ function copySetupFiles(cwd, setupDirOverride, features, options = {}) {
|
|
|
90729
92843
|
snapshot.copied++;
|
|
90730
92844
|
}
|
|
90731
92845
|
}
|
|
90732
|
-
return [retired, workflows, approvalWorkflow, issueTemplates, pullRequestTemplate, guidance, snapshot].reduce((total, current) => ({
|
|
92846
|
+
return [verificationAction, retired, workflows, approvalWorkflow, issueTemplates, pullRequestTemplate, guidance, snapshot].reduce((total, current) => ({
|
|
90733
92847
|
copied: total.copied + current.copied,
|
|
90734
92848
|
skipped: total.skipped + current.skipped,
|
|
90735
92849
|
}), { copied: 0, skipped: 0 });
|
|
@@ -90943,6 +93057,9 @@ const setup_workflow_upgrade_1 = __nccwpck_require__(85493);
|
|
|
90943
93057
|
const setup_approval_workflow_1 = __nccwpck_require__(9512);
|
|
90944
93058
|
const sensitive_text_1 = __nccwpck_require__(47122);
|
|
90945
93059
|
const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
|
|
93060
|
+
const setup_verification_action_1 = __nccwpck_require__(33156);
|
|
93061
|
+
const setup_verification_action_2 = __nccwpck_require__(12471);
|
|
93062
|
+
const copilot_comment_workflow_1 = __nccwpck_require__(33430);
|
|
90946
93063
|
exports.SETUP_RUNNER_SNAPSHOT = '.copilot/runner-profile.json';
|
|
90947
93064
|
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
90948
93065
|
? value : undefined;
|
|
@@ -90984,6 +93101,22 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
|
|
|
90984
93101
|
const jobs = [];
|
|
90985
93102
|
const changes = [];
|
|
90986
93103
|
const blockers = [];
|
|
93104
|
+
let action;
|
|
93105
|
+
try {
|
|
93106
|
+
action = (0, setup_verification_action_2.inspectSetupVerificationActionPath)(root);
|
|
93107
|
+
}
|
|
93108
|
+
catch (error) {
|
|
93109
|
+
action = 'blocked';
|
|
93110
|
+
blockers.push(error instanceof Error ? error.message : 'Verification setup path could not be inspected.');
|
|
93111
|
+
}
|
|
93112
|
+
const verificationSetup = { action, enabled: configuration.repository.verificationSetup ?? false,
|
|
93113
|
+
mainBranch: configuration.repository.mainBranch };
|
|
93114
|
+
assets.push({ path: setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH, enabled: verificationSetup.enabled,
|
|
93115
|
+
status: action === 'create' ? 'missing' : action === 'preserve' ? 'customized' : 'incompatible' });
|
|
93116
|
+
if (action === 'blocked')
|
|
93117
|
+
return { assets, jobs, changes, blockers, verificationSetup };
|
|
93118
|
+
if (action === 'create')
|
|
93119
|
+
changes.push({ path: setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH, before: null, after: (0, setup_verification_action_2.readSetupVerificationActionStarter)() });
|
|
90987
93120
|
const addJobs = (file, content, retained) => {
|
|
90988
93121
|
const documents = (0, js_yaml_1.loadAll)(content);
|
|
90989
93122
|
if (documents.length !== 1)
|
|
@@ -90992,7 +93125,7 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
|
|
|
90992
93125
|
if (!parsedJobs)
|
|
90993
93126
|
throw new Error('Workflow jobs are unavailable for review.');
|
|
90994
93127
|
for (const [job, raw] of Object.entries(parsedJobs)) {
|
|
90995
|
-
const runsOn = object(raw)
|
|
93128
|
+
const runsOn = (0, copilot_comment_workflow_1.copilotCommentRunner)(object(raw));
|
|
90996
93129
|
if (runsOn === undefined)
|
|
90997
93130
|
continue; // reusable workflow calls have no runner
|
|
90998
93131
|
jobs.push({ file, job, role: (0, setup_runner_policy_1.setupRunnerRole)(file, job) ?? 'validation',
|
|
@@ -91080,7 +93213,7 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
|
|
|
91080
93213
|
before: before === undefined ? null : (0, sensitive_text_1.redactSensitiveText)(before), after: (0, sensitive_text_1.redactSensitiveText)(after) });
|
|
91081
93214
|
if (after !== undefined && before !== undefined && !compatibleSetupRunnerSnapshot(before))
|
|
91082
93215
|
blockers.push('Runner snapshot is incompatible. Retain it or restore a supported version before replacing routing.');
|
|
91083
|
-
return { assets, jobs, changes, blockers };
|
|
93216
|
+
return { assets, jobs, changes, blockers, verificationSetup };
|
|
91084
93217
|
}
|
|
91085
93218
|
|
|
91086
93219
|
|
|
@@ -91099,6 +93232,7 @@ const js_yaml_1 = __nccwpck_require__(783);
|
|
|
91099
93232
|
const node_util_1 = __nccwpck_require__(47261);
|
|
91100
93233
|
const setup_runner_policy_1 = __nccwpck_require__(91027);
|
|
91101
93234
|
const action_types_1 = __nccwpck_require__(19625);
|
|
93235
|
+
const copilot_comment_workflow_1 = __nccwpck_require__(33430);
|
|
91102
93236
|
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
|
|
91103
93237
|
const document = (value) => {
|
|
91104
93238
|
try {
|
|
@@ -91120,6 +93254,8 @@ const runner = (value) => labels(value) || !!object(value)
|
|
|
91120
93254
|
&& (object(value).labels === undefined || labels(object(value).labels));
|
|
91121
93255
|
const copilotCommands = new Set(Object.values(action_types_1.ACTIONS));
|
|
91122
93256
|
const callsRootAction = (jobs) => !!jobs && Object.values(jobs).some(job => {
|
|
93257
|
+
if (object(job)?.uses === copilot_comment_workflow_1.COPILOT_COMMENT_SELF_WORKFLOW)
|
|
93258
|
+
return true;
|
|
91123
93259
|
const steps = object(job)?.steps;
|
|
91124
93260
|
return Array.isArray(steps) && steps.some(step => {
|
|
91125
93261
|
const invocation = object(step);
|
|
@@ -91182,6 +93318,32 @@ function renderSetupWorkflowUpgrade(template, existing, selection) {
|
|
|
91182
93318
|
const templateJobs = object(document(template)?.jobs);
|
|
91183
93319
|
if (!previousJobs || !templateJobs)
|
|
91184
93320
|
throw new Error('Workflow jobs cannot be inspected; review the workflow separately.');
|
|
93321
|
+
if (Object.values(templateJobs).some(job => (0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(object(job)?.uses))) {
|
|
93322
|
+
const parsed = document(template);
|
|
93323
|
+
const jobs = object(parsed.jobs);
|
|
93324
|
+
let changed = false;
|
|
93325
|
+
for (const [name, value] of Object.entries(jobs)) {
|
|
93326
|
+
const job = object(value);
|
|
93327
|
+
if (!(0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(job.uses))
|
|
93328
|
+
throw new Error('Mixed comment workflow jobs require separate workflow review before setup.');
|
|
93329
|
+
const previousJob = object(previousJobs[name]);
|
|
93330
|
+
if (Array.isArray(previousJob?.steps) && previousJob.steps.some(raw => {
|
|
93331
|
+
const uses = object(raw)?.uses;
|
|
93332
|
+
return typeof uses !== 'string' || !(uses.startsWith('actions/checkout@')
|
|
93333
|
+
|| /^vypdev\/copilot@[^\s]+$/u.test(uses) || uses === './.git/copilot-verification-setup');
|
|
93334
|
+
}))
|
|
93335
|
+
throw new Error('Custom comment job steps require migration to the reviewed repository verification setup action before switching to the reusable workflow. Review the workflow separately.');
|
|
93336
|
+
const retained = (0, setup_runner_policy_1.selectedSetupRunsOn)(selection?.runners, selection && (0, setup_runner_policy_1.setupRunnerRole)(selection.file, name))
|
|
93337
|
+
?? (0, copilot_comment_workflow_1.copilotCommentRunner)(previousJob) ?? (0, copilot_comment_workflow_1.copilotCommentRunner)(job);
|
|
93338
|
+
if (!runner(retained))
|
|
93339
|
+
throw new Error('Existing runner selection is invalid; review the workflow separately.');
|
|
93340
|
+
if (JSON.stringify(retained).includes('${{') && existing !== template)
|
|
93341
|
+
throw new Error('Dynamic runner selection requires separate workflow review before setup.');
|
|
93342
|
+
changed || (changed = !(0, node_util_1.isDeepStrictEqual)(retained, (0, copilot_comment_workflow_1.copilotCommentRunner)(job)));
|
|
93343
|
+
job.with = { ...object(job.with), 'runs-on': JSON.stringify(retained) };
|
|
93344
|
+
}
|
|
93345
|
+
return changed ? (0, js_yaml_1.dump)(parsed, { noRefs: true, lineWidth: -1 }) : template;
|
|
93346
|
+
}
|
|
91185
93347
|
const lines = template.split('\n');
|
|
91186
93348
|
let job = '';
|
|
91187
93349
|
let insideJobs = false;
|
|
@@ -91557,6 +93719,14 @@ module.exports = require("node:stream");
|
|
|
91557
93719
|
|
|
91558
93720
|
/***/ }),
|
|
91559
93721
|
|
|
93722
|
+
/***/ 76915:
|
|
93723
|
+
/***/ ((module) => {
|
|
93724
|
+
|
|
93725
|
+
"use strict";
|
|
93726
|
+
module.exports = require("node:string_decoder");
|
|
93727
|
+
|
|
93728
|
+
/***/ }),
|
|
93729
|
+
|
|
91560
93730
|
/***/ 31764:
|
|
91561
93731
|
/***/ ((module) => {
|
|
91562
93732
|
|