@vypdev/copilot 3.9.2 → 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.
@@ -37179,6 +37179,7 @@ function readLocalWorkflowConfiguration(additionalParams, actionInputs) {
37179
37179
  commitPrefixBuilder: read(input_keys_1.INPUT_KEYS.COMMIT_PREFIX_TRANSFORMS) || 'replace-slash',
37180
37180
  issueManagedBranches: (0, input_boolean_policy_1.parseIssueWorkflowBoolean)(read(input_keys_1.INPUT_KEYS.ISSUE_MANAGED_BRANCHES), input_keys_1.INPUT_KEYS.ISSUE_MANAGED_BRANCHES, true),
37181
37181
  preBranchSdd: (0, input_boolean_policy_1.parseIssueWorkflowBoolean)(read(input_keys_1.INPUT_KEYS.PRE_BRANCH_SDD), input_keys_1.INPUT_KEYS.PRE_BRANCH_SDD, false),
37182
+ verificationSetup: (0, input_boolean_policy_1.parseIssueWorkflowBoolean)(read(input_keys_1.INPUT_KEYS.VERIFICATION_SETUP), input_keys_1.INPUT_KEYS.VERIFICATION_SETUP, false),
37182
37183
  reopenIssueOnPush: (0, input_boolean_policy_1.isEnabledInput)(read(input_keys_1.INPUT_KEYS.REOPEN_ISSUE_ON_PUSH)),
37183
37184
  issueDesiredAssigneesCount: (0, input_number_policy_1.parseIntegerInput)(read(input_keys_1.INPUT_KEYS.DESIRED_ASSIGNEES_COUNT), 0),
37184
37185
  pullRequestDesiredAssigneesCount: (0, input_number_policy_1.parseIntegerInput)(read(input_keys_1.INPUT_KEYS.PULL_REQUEST_DESIRED_ASSIGNEES_COUNT), 0),
@@ -37212,7 +37213,7 @@ const configuration_builders_1 = __nccwpck_require__(19094);
37212
37213
  const branches_builder_1 = __nccwpck_require__(30085);
37213
37214
  const size_threshold_builder_1 = __nccwpck_require__(39757);
37214
37215
  function buildLocalActionExecution(configuration, additionalParams) {
37215
- const { debug, singleAction, singleActionIssue, singleActionVersion, singleActionTitle, singleActionChangelog, singleActionMessage, singleActionCommentId, singleActionCommentMode, singleActionOperationId, inactivityThresholdHours, commitPrefixBuilder, issueManagedBranches, preBranchSdd, reopenIssueOnPush, issueDesiredAssigneesCount, pullRequestDesiredAssigneesCount, pullRequestDesiredReviewersCount, titleEmoji, branchManagementEmoji, token, agentModel, aiPullRequestDescriptionMode, aiMembersOnly, aiIgnoreFiles, aiIncludeReasoning, bugbotSeverity, bugbotCommentLimit, bugbotFixVerifyCommands, bugbotReviewConfiguration, agentTasks, bugLabel, bugfixLabel, hotfixLabel, enhancementLabel, featureLabel, releaseLabel, questionLabel, helpLabel, deployLabel, deployedLabel, docsLabel, documentationLabel, choreLabel, maintenanceLabel, priorityHighLabel, priorityMediumLabel, priorityLowLabel, priorityNoneLabel, sizeXxlLabel, sizeXlLabel, sizeLLabel, sizeMLabel, sizeSLabel, sizeXsLabel, lifecycle, issueTypeTask, issueTypeTaskDescription, issueTypeTaskColor, issueTypeBug, issueTypeBugDescription, issueTypeBugColor, issueTypeFeature, issueTypeFeatureDescription, issueTypeFeatureColor, issueTypeDocumentation, issueTypeDocumentationDescription, issueTypeDocumentationColor, issueTypeMaintenance, issueTypeMaintenanceDescription, issueTypeMaintenanceColor, issueTypeHotfix, issueTypeHotfixDescription, issueTypeHotfixColor, issueTypeRelease, issueTypeReleaseDescription, issueTypeReleaseColor, issueTypeQuestion, issueTypeQuestionDescription, issueTypeQuestionColor, issueTypeHelp, issueTypeHelpDescription, issueTypeHelpColor, repositoryLocale, issueLocale, pullRequestLocale, sizeXxlThresholdLines, sizeXxlThresholdFiles, sizeXxlThresholdCommits, sizeXlThresholdLines, sizeXlThresholdFiles, sizeXlThresholdCommits, sizeLThresholdLines, sizeLThresholdFiles, sizeLThresholdCommits, sizeMThresholdLines, sizeMThresholdFiles, sizeMThresholdCommits, sizeSThresholdLines, sizeSThresholdFiles, sizeSThresholdCommits, sizeXsThresholdLines, sizeXsThresholdFiles, sizeXsThresholdCommits, mainBranch, developmentBranch, featureTree, bugfixTree, hotfixTree, releaseTree, docsTree, choreTree, releaseWorkflow, hotfixWorkflow, projects, projectColumnIssueCreated, projectColumnPullRequestCreated, projectColumnIssueInProgress, projectColumnPullRequestInProgress, welcomeTitle, welcomeMessages, deployment, } = configuration;
37216
+ const { debug, singleAction, singleActionIssue, singleActionVersion, singleActionTitle, singleActionChangelog, singleActionMessage, singleActionCommentId, singleActionCommentMode, singleActionOperationId, inactivityThresholdHours, commitPrefixBuilder, issueManagedBranches, preBranchSdd, verificationSetup, reopenIssueOnPush, issueDesiredAssigneesCount, pullRequestDesiredAssigneesCount, pullRequestDesiredReviewersCount, titleEmoji, branchManagementEmoji, token, agentModel, aiPullRequestDescriptionMode, aiMembersOnly, aiIgnoreFiles, aiIncludeReasoning, bugbotSeverity, bugbotCommentLimit, bugbotFixVerifyCommands, bugbotReviewConfiguration, agentTasks, bugLabel, bugfixLabel, hotfixLabel, enhancementLabel, featureLabel, releaseLabel, questionLabel, helpLabel, deployLabel, deployedLabel, docsLabel, documentationLabel, choreLabel, maintenanceLabel, priorityHighLabel, priorityMediumLabel, priorityLowLabel, priorityNoneLabel, sizeXxlLabel, sizeXlLabel, sizeLLabel, sizeMLabel, sizeSLabel, sizeXsLabel, lifecycle, issueTypeTask, issueTypeTaskDescription, issueTypeTaskColor, issueTypeBug, issueTypeBugDescription, issueTypeBugColor, issueTypeFeature, issueTypeFeatureDescription, issueTypeFeatureColor, issueTypeDocumentation, issueTypeDocumentationDescription, issueTypeDocumentationColor, issueTypeMaintenance, issueTypeMaintenanceDescription, issueTypeMaintenanceColor, issueTypeHotfix, issueTypeHotfixDescription, issueTypeHotfixColor, issueTypeRelease, issueTypeReleaseDescription, issueTypeReleaseColor, issueTypeQuestion, issueTypeQuestionDescription, issueTypeQuestionColor, issueTypeHelp, issueTypeHelpDescription, issueTypeHelpColor, repositoryLocale, issueLocale, pullRequestLocale, sizeXxlThresholdLines, sizeXxlThresholdFiles, sizeXxlThresholdCommits, sizeXlThresholdLines, sizeXlThresholdFiles, sizeXlThresholdCommits, sizeLThresholdLines, sizeLThresholdFiles, sizeLThresholdCommits, sizeMThresholdLines, sizeMThresholdFiles, sizeMThresholdCommits, sizeSThresholdLines, sizeSThresholdFiles, sizeSThresholdCommits, sizeXsThresholdLines, sizeXsThresholdFiles, sizeXsThresholdCommits, mainBranch, developmentBranch, featureTree, bugfixTree, hotfixTree, releaseTree, docsTree, choreTree, releaseWorkflow, hotfixWorkflow, projects, projectColumnIssueCreated, projectColumnPullRequestCreated, projectColumnIssueInProgress, projectColumnPullRequestInProgress, welcomeTitle, welcomeMessages, deployment, } = configuration;
37216
37217
  return (0, execution_builder_1.buildExecution)({
37217
37218
  debug,
37218
37219
  inactivityThresholdHours,
@@ -37220,6 +37221,7 @@ function buildLocalActionExecution(configuration, additionalParams) {
37220
37221
  commitPrefixBuilder,
37221
37222
  issue: (0, configuration_builders_1.buildIssue)(issueManagedBranches, reopenIssueOnPush, issueDesiredAssigneesCount, additionalParams),
37222
37223
  preBranchSdd,
37224
+ verificationSetup,
37223
37225
  pullRequest: (0, configuration_builders_1.buildPullRequest)(pullRequestDesiredAssigneesCount, pullRequestDesiredReviewersCount, additionalParams),
37224
37226
  emoji: (0, configuration_builders_1.buildEmoji)(titleEmoji, branchManagementEmoji),
37225
37227
  tokens: (0, configuration_builders_1.buildTokens)(token),
@@ -37982,6 +37984,7 @@ exports.INPUT_KEYS = {
37982
37984
  // Issue
37983
37985
  ISSUE_MANAGED_BRANCHES: 'issue-managed-branches',
37984
37986
  PRE_BRANCH_SDD: 'pre-branch-sdd',
37987
+ VERIFICATION_SETUP: 'verification-setup',
37985
37988
  REOPEN_ISSUE_ON_PUSH: 'reopen-issue-on-push',
37986
37989
  DESIRED_ASSIGNEES_COUNT: 'desired-assignees-count',
37987
37990
  // Pull Request
@@ -38016,6 +38019,7 @@ exports.SETUP_DOCUMENTATION = {
38016
38019
  tutorial: 'https://docs.page/vypdev/copilot/setup-web',
38017
38020
  firstWorkflow: 'https://docs.page/vypdev/copilot/first-workflow',
38018
38021
  recovery: 'https://docs.page/vypdev/copilot/security-operations/operations/troubleshooting',
38022
+ verification: 'https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-owned-setup',
38019
38023
  };
38020
38024
 
38021
38025
 
@@ -38089,6 +38093,95 @@ function runAtApplicationErrorBoundary(operation) {
38089
38093
  }
38090
38094
 
38091
38095
 
38096
+ /***/ }),
38097
+
38098
+ /***/ 50519:
38099
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
38100
+
38101
+ "use strict";
38102
+
38103
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
38104
+ exports.approvalEvidenceError = approvalEvidenceError;
38105
+ exports.approvalDiagnosticError = approvalDiagnosticError;
38106
+ const approval_evidence_diagnostic_1 = __nccwpck_require__(98205);
38107
+ const application_error_1 = __nccwpck_require__(75999);
38108
+ function approvalEvidenceError(operation, reason) {
38109
+ return approvalDiagnosticError({ operation, reason, permission: approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_PERMISSIONS[operation] });
38110
+ }
38111
+ function approvalDiagnosticError(diagnostic) {
38112
+ const reason = diagnostic.reason;
38113
+ const code = reason === 'http-401' ? 'authorization.credential-invalid'
38114
+ : reason === 'http-403' ? 'authorization.denied'
38115
+ : reason === 'http-404' ? 'provider.not-found'
38116
+ : reason === 'http-429' ? 'provider.rate-limited'
38117
+ : reason === 'http-409' ? 'provider.conflict'
38118
+ : reason === 'transport-unavailable' || /^http-50[0234]$/u.test(reason) ? 'provider.unavailable'
38119
+ : 'provider.contract-invalid';
38120
+ return new application_error_1.ApplicationError(code, `Approval evidence read failed (${diagnostic.operation}, ${reason}).`, {
38121
+ recovery: { id: 'approval-evidence-read-failed', variables: diagnostic },
38122
+ });
38123
+ }
38124
+
38125
+
38126
+ /***/ }),
38127
+
38128
+ /***/ 82937:
38129
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
38130
+
38131
+ "use strict";
38132
+
38133
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
38134
+ exports.BugbotMutationError = void 0;
38135
+ exports.bugbotMutationError = bugbotMutationError;
38136
+ const application_error_1 = __nccwpck_require__(75999);
38137
+ const pull_request_review_errors_1 = __nccwpck_require__(46445);
38138
+ class BugbotMutationError extends application_error_1.ApplicationError {
38139
+ constructor(diagnostic) {
38140
+ 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.`);
38141
+ this.diagnostic = diagnostic;
38142
+ }
38143
+ }
38144
+ exports.BugbotMutationError = BugbotMutationError;
38145
+ function bugbotMutationError(cause, stage, findingIds, fallback, affectedCount = findingIds.length) {
38146
+ if (cause instanceof BugbotMutationError)
38147
+ return cause;
38148
+ const provider = cause instanceof pull_request_review_errors_1.PullRequestReviewOperationError ? cause : undefined;
38149
+ const status = provider?.providerStatus;
38150
+ const errorCode = status === 401 ? 'authorization.credential-invalid' : status === 403 ? 'authorization.denied'
38151
+ : status === 404 ? 'provider.not-found' : status === 409 ? 'provider.conflict'
38152
+ : status === 429 ? 'provider.rate-limited'
38153
+ : status === 408 || status === 425 ? 'provider.unavailable'
38154
+ : status && status < 500 ? 'provider.contract-invalid' : 'provider.unavailable';
38155
+ const first = findingIds[0];
38156
+ return new BugbotMutationError(Object.freeze({
38157
+ stage, operation: provider?.operation ?? fallback,
38158
+ findingId: typeof first === 'string' && /^[A-Za-z0-9_./:-]{1,200}$/.test(first) ? first : 'unavailable',
38159
+ affectedCount: Math.min(affectedCount, 10000),
38160
+ providerStatus: status ? `http-${status}` : 'http-unavailable',
38161
+ providerReference: provider?.providerReference ?? 'unavailable', errorCode,
38162
+ }));
38163
+ }
38164
+
38165
+
38166
+ /***/ }),
38167
+
38168
+ /***/ 12183:
38169
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
38170
+
38171
+ "use strict";
38172
+
38173
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
38174
+ exports.closedIssueReconciliationError = closedIssueReconciliationError;
38175
+ const application_error_1 = __nccwpck_require__(75999);
38176
+ /** Public diagnostic is fixed native facts and counters, never label/card/provider text. */
38177
+ function closedIssueReconciliationError(cause, facts) {
38178
+ return new application_error_1.ApplicationError(cause instanceof application_error_1.ApplicationError ? cause.code : 'provider.unavailable', 'Closed issue reconciliation remains unverified.', {
38179
+ ...(cause instanceof application_error_1.ApplicationError ? { correlationId: cause.correlationId, retryable: cause.retryable } : {}),
38180
+ recovery: { id: 'closed-issue-reconciliation-failed', variables: facts },
38181
+ });
38182
+ }
38183
+
38184
+
38092
38185
  /***/ }),
38093
38186
 
38094
38187
  /***/ 72594:
@@ -39264,12 +39357,61 @@ const SPANISH_CONTENT = Object.freeze({
39264
39357
  retainedState: PRESERVED_STATE_ES,
39265
39358
  }),
39266
39359
  });
39360
+ 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.';
39361
+ 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.';
39362
+ const STORED_CONFIGURATION_RETAINED_EN = 'The issue/PR description and stored configuration were not changed by this read.';
39363
+ const STORED_CONFIGURATION_RETAINED_ES = 'Esta lectura no modificó la descripción de la issue/PR ni su configuración almacenada.';
39267
39364
  const ENGLISH_RECOVERY_CONTENT = Object.freeze({
39365
+ 'stored-configuration-schema-missing': Object.freeze({
39366
+ impact: 'Automation stopped for issue/PR #{issueNumber}: the stored configuration has no schema version; version {expectedVersion} is required.',
39367
+ action: STORED_CONFIGURATION_ACTION_EN,
39368
+ retainedState: STORED_CONFIGURATION_RETAINED_EN,
39369
+ }),
39370
+ 'stored-configuration-schema-unsupported': Object.freeze({
39371
+ impact: 'Automation stopped for issue/PR #{issueNumber}: stored schema version {actualVersion} is unsupported; version {expectedVersion} is required.',
39372
+ action: STORED_CONFIGURATION_ACTION_EN,
39373
+ retainedState: STORED_CONFIGURATION_RETAINED_EN,
39374
+ }),
39375
+ 'stored-configuration-invalid': Object.freeze({
39376
+ impact: 'Automation stopped for issue/PR #{issueNumber}: the stored configuration, markers or schema value are malformed; valid schema version {expectedVersion} is required.',
39377
+ action: STORED_CONFIGURATION_ACTION_EN,
39378
+ retainedState: STORED_CONFIGURATION_RETAINED_EN,
39379
+ }),
39380
+ 'closed-issue-reconciliation-failed': Object.freeze({
39381
+ impact: 'Issue cleanup remains unverified: {resultId}, phase {phase}; native state {state}, reason {reason}.',
39382
+ 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.',
39383
+ retainedState: 'Native state was preserved. Confirmed changes: {changed}; remaining required changes in the last verified plan: {remaining}. Unavailable reads do not establish completion.',
39384
+ }),
39385
+ 'approval-evidence-read-failed': Object.freeze({
39386
+ impact: 'Approval evidence could not be verified: {operation} ({reason}).',
39387
+ action: 'Inspect {permission} access for the runtime credential and the named evidence response. Correct authorization, missing-resource or schema errors before rerunning; retry transient failures only after provider recovery or rate-limit reset.',
39388
+ retainedState: 'No approval is authorized by this failed read. Existing PRs, reviews and completed external effects were preserved.',
39389
+ }),
39268
39390
  'workspace-changes-rejected': Object.freeze({
39269
39391
  impact: 'The changes were rejected during workspace verification.',
39270
39392
  action: 'Inspect the rejected paths in the workflow and correct the workspace before retrying.',
39271
39393
  retainedState: 'The normal commit and push steps were skipped. Verify the current state before retrying.',
39272
39394
  }),
39395
+ 'sdd-draft-case-identity-invalid': Object.freeze({
39396
+ impact: 'SDD publication stopped after one automatic repair: case IDs collide with an owning SDD or are ambiguous.',
39397
+ action: 'Review the draft tables; use distinct fully qualified case IDs and preserve the baseline inventory. Retry the same issue workflow.',
39398
+ retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
39399
+ }),
39400
+ 'sdd-draft-case-budget-invalid': Object.freeze({
39401
+ impact: 'SDD publication stopped after one automatic repair: per-area allocations disagree with the distinct case inventory.',
39402
+ action: 'Review the draft tables; reconcile each area and the total with the enumerated cases. Retry the same issue workflow.',
39403
+ retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
39404
+ }),
39405
+ 'sdd-draft-requirement-mapping-invalid': Object.freeze({
39406
+ impact: 'SDD publication stopped after one automatic repair: requirements and case mappings are incomplete or inconsistent.',
39407
+ action: 'Review the draft tables; map every requirement to defined cases and match the reverse links. Retry the same issue workflow.',
39408
+ retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
39409
+ }),
39410
+ 'sdd-draft-repository-path-invalid': Object.freeze({
39411
+ impact: 'SDD publication stopped after one automatic repair: cited repository paths cannot be verified at the immutable base.',
39412
+ action: 'Review the draft tables; correct existing paths or explicitly declare intended new files. Retry the same issue workflow.',
39413
+ retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
39414
+ }),
39273
39415
  'sdd-draft-format-invalid': Object.freeze({
39274
39416
  impact: 'SDD preparation stopped because the draft still lacked required headings or a numeric test budget after one automatic repair.',
39275
39417
  action: 'Retry SDD preparation with the canonical specification template and the explicit acceptance requirements.',
@@ -39332,11 +39474,56 @@ const ENGLISH_RECOVERY_CONTENT = Object.freeze({
39332
39474
  }),
39333
39475
  });
39334
39476
  const SPANISH_RECOVERY_CONTENT = Object.freeze({
39477
+ 'stored-configuration-schema-missing': Object.freeze({
39478
+ 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}.',
39479
+ action: STORED_CONFIGURATION_ACTION_ES,
39480
+ retainedState: STORED_CONFIGURATION_RETAINED_ES,
39481
+ }),
39482
+ 'stored-configuration-schema-unsupported': Object.freeze({
39483
+ 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}.',
39484
+ action: STORED_CONFIGURATION_ACTION_ES,
39485
+ retainedState: STORED_CONFIGURATION_RETAINED_ES,
39486
+ }),
39487
+ 'stored-configuration-invalid': Object.freeze({
39488
+ 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}.',
39489
+ action: STORED_CONFIGURATION_ACTION_ES,
39490
+ retainedState: STORED_CONFIGURATION_RETAINED_ES,
39491
+ }),
39492
+ 'closed-issue-reconciliation-failed': Object.freeze({
39493
+ impact: 'La limpieza de la issue sigue sin verificarse: {resultId}, fase {phase}; estado nativo {state}, motivo {reason}.',
39494
+ 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.',
39495
+ retainedState: 'Se conservó el estado nativo. Cambios confirmados: {changed}; cambios pendientes en el último plan verificado: {remaining}. Una lectura no disponible no demuestra que haya finalizado.',
39496
+ }),
39497
+ 'approval-evidence-read-failed': Object.freeze({
39498
+ impact: 'No se pudo verificar la evidencia de aprobación: {operation} ({reason}).',
39499
+ action: 'Comprueba el acceso {permission} de la credencial de ejecución y la respuesta indicada. Corrige los errores de autorización, recurso o esquema antes de reejecutar; reintenta los fallos transitorios solo tras recuperarse el proveedor o restablecerse el límite.',
39500
+ retainedState: 'Esta lectura fallida no autoriza ninguna aprobación. Se conservaron las PRs, revisiones y efectos externos completados.',
39501
+ }),
39335
39502
  'workspace-changes-rejected': Object.freeze({
39336
39503
  impact: 'Los cambios se rechazaron durante la verificación del espacio de trabajo.',
39337
39504
  action: 'Revisa las rutas rechazadas en la ejecución y corrige el espacio de trabajo antes de reintentar.',
39338
39505
  retainedState: 'Se omitieron los pasos normales de commit y push. Comprueba el estado actual antes de reintentar.',
39339
39506
  }),
39507
+ 'sdd-draft-case-identity-invalid': Object.freeze({
39508
+ 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.',
39509
+ action: 'Revisa las tablas del borrador; usa identificadores completos y distintos y conserva el inventario original. Reintenta el workflow de la misma incidencia.',
39510
+ 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.',
39511
+ }),
39512
+ 'sdd-draft-case-budget-invalid': Object.freeze({
39513
+ 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.',
39514
+ action: 'Revisa las tablas del borrador; reconcilia cada área y el total con los casos enumerados. Reintenta el workflow de la misma incidencia.',
39515
+ 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.',
39516
+ }),
39517
+ 'sdd-draft-requirement-mapping-invalid': Object.freeze({
39518
+ 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.',
39519
+ action: 'Revisa las tablas del borrador; vincula cada requisito a casos definidos y comprueba los enlaces inversos. Reintenta el workflow de la misma incidencia.',
39520
+ 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.',
39521
+ }),
39522
+ 'sdd-draft-repository-path-invalid': Object.freeze({
39523
+ 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.',
39524
+ 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.',
39525
+ 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.',
39526
+ }),
39340
39527
  'sdd-draft-format-invalid': Object.freeze({
39341
39528
  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.',
39342
39529
  action: 'Reintenta la preparación del SDD con la plantilla canónica y los criterios de aceptación explícitos.',
@@ -39451,12 +39638,16 @@ exports.buildApplicationErrorPresentation = buildApplicationErrorPresentation;
39451
39638
  exports.renderApplicationErrorText = renderApplicationErrorText;
39452
39639
  exports.renderApplicationErrorMarkdown = renderApplicationErrorMarkdown;
39453
39640
  const application_error_message_catalog_1 = __nccwpck_require__(64809);
39641
+ // This trusted destination is inserted after localization, never supplied by a body or translation.
39642
+ const STORED_CONFIGURATION_RECOVERY_URL = 'https://docs.page/vypdev/copilot/security-operations/operations/troubleshooting#unsupported-stored-configuration';
39454
39643
  /** Shared semantic view model for terminal, GitHub, and API presentation. */
39455
39644
  function buildApplicationErrorPresentation(error, message = application_error_message_catalog_1.readEnglishApplicationErrorMessage) {
39456
39645
  const descriptor = error.recovery
39457
39646
  ? `error.recovery.${error.recovery.id}`
39458
39647
  : `error.${error.code}`;
39459
- const variables = error.recovery?.variables;
39648
+ const variables = error.recovery?.id.startsWith('stored-configuration-')
39649
+ ? { ...error.recovery.variables, recoveryGuide: STORED_CONFIGURATION_RECOVERY_URL }
39650
+ : error.recovery?.variables;
39460
39651
  return {
39461
39652
  impact: message(`${descriptor}.impact`, variables),
39462
39653
  code: error.code,
@@ -40572,6 +40763,7 @@ exports.BUGBOT_MESSAGE_IDS = Object.freeze([
40572
40763
  'bugbot.overflow.body',
40573
40764
  'bugbot.common.more',
40574
40765
  'bugbot.diagnostic.operationFailed',
40766
+ 'bugbot.diagnostic.findingMutationFailed',
40575
40767
  'bugbot.diagnostic.identityUnavailable',
40576
40768
  'bugbot.diagnostic.pullRequestCommentsFailed',
40577
40769
  'bugbot.diagnostic.reviewThreadsFailed',
@@ -40657,6 +40849,7 @@ const ENGLISH_MESSAGES = Object.freeze({
40657
40849
  'bugbot.overflow.heading': 'More findings (comment limit)',
40658
40850
  '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.' }),
40659
40851
  'bugbot.common.more': Object.freeze({ one: 'and {count} more.', other: 'and {count} more.' }),
40852
+ '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.',
40660
40853
  'bugbot.diagnostic.operationFailed': 'Bugbot could not complete one or more finding mutations.',
40661
40854
  'bugbot.diagnostic.identityUnavailable': 'The authenticated Bugbot identity is unavailable.',
40662
40855
  'bugbot.diagnostic.pullRequestCommentsFailed': 'Unable to re-read pull request review comments.',
@@ -40746,6 +40939,7 @@ const SPANISH_MESSAGES = Object.freeze({
40746
40939
  'bugbot.overflow.heading': 'Más hallazgos (límite de comentarios)',
40747
40940
  '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.' }),
40748
40941
  'bugbot.common.more': Object.freeze({ one: 'y {count} más.', many: 'y {count} más.', other: 'y {count} más.' }),
40942
+ '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.',
40749
40943
  'bugbot.diagnostic.operationFailed': 'Bugbot no pudo completar una o más mutaciones de hallazgos.',
40750
40944
  'bugbot.diagnostic.identityUnavailable': 'La identidad autenticada de Bugbot no está disponible.',
40751
40945
  'bugbot.diagnostic.pullRequestCommentsFailed': 'No se pudieron volver a leer los comentarios del review del pull request.',
@@ -40785,6 +40979,7 @@ async function resolveBugbotCatalog(locale, configuration, resolver) {
40785
40979
  }
40786
40980
  function renderBugbotDiagnostic(diagnostic, catalog) {
40787
40981
  switch (diagnostic.code) {
40982
+ case 'finding-mutation-failed': return catalog.message('bugbot.diagnostic.findingMutationFailed', { ...diagnostic.mutation });
40788
40983
  case 'operation-failed': return catalog.message('bugbot.diagnostic.operationFailed');
40789
40984
  case 'identity-unavailable': return catalog.message('bugbot.diagnostic.identityUnavailable');
40790
40985
  case 'snapshot-pull-request-comments-failed': return catalog.message('bugbot.diagnostic.pullRequestCommentsFailed');
@@ -41412,6 +41607,10 @@ function renderBugbotStatusCard(projection, catalogOrLocale, links) {
41412
41607
  facts.push(catalog.message('bugbot.coverage.omitted', { count: source.omittedItems }));
41413
41608
  if (source.truncatedItems > 0)
41414
41609
  facts.push(catalog.message('bugbot.coverage.truncated', { count: source.truncatedItems }));
41610
+ const truncatedIds = source.truncatedItemIds?.slice(0, 50)
41611
+ .filter(id => /^(?:issue:[0-9]+|review:[A-Za-z0-9_=-]+)$/.test(id) && id.length <= 160);
41612
+ if (truncatedIds?.length)
41613
+ facts.push(`truncated-source-ids=${truncatedIds.join(', ')}`);
41415
41614
  if (source.providerLimitReached)
41416
41615
  facts.push(catalog.message('bugbot.coverage.providerLimit'));
41417
41616
  return `- ${source.source}: ${source.status}; ${facts.join(', ')}`;
@@ -41501,9 +41700,21 @@ function normalizeHistoricalSnapshot(originalBody, analyzedHeadSha, catalog) {
41501
41700
  function renderFindingRow(finding) {
41502
41701
  const label = (0, github_comment_publication_policy_1.sanitizeAgentMarkdown)(finding.title || finding.id, 500).replace(/[\r\n]+/gu, ' ');
41503
41702
  const state = stateLabel(finding.state);
41703
+ const identity = finding.state === 'unknown'
41704
+ ? ` — ${renderFindingId(finding.id)}`
41705
+ : '';
41504
41706
  return finding.url
41505
- ? `- ${state} — [${label}](${finding.url})`
41506
- : `- ${state} — ${label}`;
41707
+ ? `- ${state} — [${label}](${finding.url})${identity}`
41708
+ : `- ${state} — ${label}${identity}`;
41709
+ }
41710
+ function renderFindingId(value) {
41711
+ const id = (0, github_comment_publication_policy_1.sanitizeAgentMarkdown)(value, 200).replace(/[\r\n]+/gu, ' ');
41712
+ // A delimiter longer than every embedded backtick run keeps links, images
41713
+ // and HTML inert even when the marker permits arbitrary Markdown punctuation.
41714
+ let delimiter = '`';
41715
+ while (id.includes(delimiter))
41716
+ delimiter += '`';
41717
+ return `${delimiter} ${id} ${delimiter}`;
41507
41718
  }
41508
41719
  function stateLabel(state) {
41509
41720
  return `[ ] ${state}`;
@@ -46104,6 +46315,8 @@ The setup runner profile selects placement; it does not install the project's la
46104
46315
 
46105
46316
  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).
46106
46317
 
46318
+ 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).
46319
+
46107
46320
  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).
46108
46321
  `;
46109
46322
  }
@@ -46323,6 +46536,40 @@ function calculateReviewersStillNeeded(desiredCount, currentCount, confirmedCoun
46323
46536
  }
46324
46537
 
46325
46538
 
46539
+ /***/ }),
46540
+
46541
+ /***/ 81053:
46542
+ /***/ ((__unused_webpack_module, exports) => {
46543
+
46544
+ "use strict";
46545
+
46546
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
46547
+ exports.sddAnalysisStatusMarker = sddAnalysisStatusMarker;
46548
+ exports.renderSddAnalysisStatus = renderSddAnalysisStatus;
46549
+ function sddAnalysisStatusMarker(issueNumber) {
46550
+ return `<!-- copilot:sdd-analysis-status:v1 issue="${issueNumber}" -->`;
46551
+ }
46552
+ const reasons = {
46553
+ '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.'],
46554
+ 'companion-owner-unknown': ['The companion owner is absent from the catalog.', 'El propietario del SDD complementario no existe en el catálogo.'],
46555
+ 'companion-path-registered': ['The companion path is already registered in the catalog.', 'La ruta del SDD complementario ya está registrada en el catálogo.'],
46556
+ 'new-owner-registered': ['The proposed new capability already exists in the catalog.', 'La capacidad propuesta como nueva ya existe en el catálogo.'],
46557
+ '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.'],
46558
+ };
46559
+ /** Stateless diagnostic, deliberately separate from the validated readiness record. */
46560
+ function renderSddAnalysisStatus(issueNumber, locale, reason) {
46561
+ const spanish = /^es(?:-|$)/i.test(locale ?? '');
46562
+ const marker = sddAnalysisStatusMarker(issueNumber);
46563
+ if (!reason)
46564
+ return spanish
46565
+ ? `## 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}`
46566
+ : `## SDD analysis status\n\nA subsequent analysis validated ownership. Publication and branch readiness remain subject to their checks.\n\n${marker}`;
46567
+ return spanish
46568
+ ? `## 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}`
46569
+ : `## 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}`;
46570
+ }
46571
+
46572
+
46326
46573
  /***/ }),
46327
46574
 
46328
46575
  /***/ 2230:
@@ -47418,6 +47665,7 @@ exports.isSetupBatchInstallationReceipt = isSetupBatchInstallationReceipt;
47418
47665
  exports.parseSetupBatchOperation = parseSetupBatchOperation;
47419
47666
  exports.validSetupBatchAssetPath = validSetupBatchAssetPath;
47420
47667
  const setup_batch_1 = __nccwpck_require__(88308);
47668
+ const setup_verification_action_1 = __nccwpck_require__(33156);
47421
47669
  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;
47422
47670
  const sha = /^[a-f0-9]{40}$/u;
47423
47671
  const digest = /^[a-f0-9]{64}$/u;
@@ -47523,6 +47771,7 @@ function validSetupBatchAssetPath(path) {
47523
47771
  if (path.length > 240 || path.split('/').some(part => !part || part === '.' || part === '..') || /[^A-Za-z0-9_./-]/u.test(path))
47524
47772
  return false;
47525
47773
  return path === 'AGENTS.md' || path === '.agents/skills/copilot-repository-workflow/SKILL.md'
47774
+ || path === setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH
47526
47775
  || /^\.github\/(?:workflows|ISSUE_TEMPLATE)\/[A-Za-z0-9_.-]+\.(?:yml|yaml)$/u.test(path)
47527
47776
  || path === '.github/pull_request_template.md' || /^\.copilot\/(?:repository-profile|setup-manifest|runner-profile)\.json$/u.test(path)
47528
47777
  || path === '.copilot/AGENT_GUIDE.md' || path.startsWith('.copilot/setup-backups/');
@@ -47787,6 +48036,7 @@ function createDefaultSetupConfiguration() {
47787
48036
  choreTree: 'chore',
47788
48037
  issueManagedBranches: true,
47789
48038
  preBranchSdd: false,
48039
+ verificationSetup: false,
47790
48040
  reopenIssueOnPush: true,
47791
48041
  desiredAssigneesCount: 1,
47792
48042
  desiredReviewersCount: 1,
@@ -47943,6 +48193,7 @@ Object.defineProperty(exports, "buildSetupCredentialRequirements", ({ enumerable
47943
48193
  const locale_1 = __nccwpck_require__(15386);
47944
48194
  const issue_workflow_profile_1 = __nccwpck_require__(26744);
47945
48195
  const setup_issue_workflow_policy_1 = __nccwpck_require__(81182);
48196
+ const setup_verification_action_1 = __nccwpck_require__(33156);
47946
48197
  const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
47947
48198
  function buildSetupPlan(configuration, mergeQueueReadiness = [], approvalReadiness = []) {
47948
48199
  const workflowFiles = (0, setup_workflow_catalog_1.enabledSetupWorkflowFiles)((0, setup_issue_workflow_policy_1.effectiveIssueWorkflowFeatures)(configuration))
@@ -47954,6 +48205,7 @@ function buildSetupPlan(configuration, mergeQueueReadiness = [], approvalReadine
47954
48205
  .filter(file => configuration.features.release !== false || file !== 'release.yml')
47955
48206
  .filter(file => configuration.features.hotfix !== false || file !== 'hotfix.yml');
47956
48207
  const selectedFiles = [
48208
+ setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH,
47957
48209
  ...(configuration.runners && configuration.runners.mode !== 'retain' ? ['.copilot/runner-profile.json'] : []),
47958
48210
  ...workflowFiles.map(file => `workflows/${file}`),
47959
48211
  ...issueTemplateFiles.map(file => `ISSUE_TEMPLATE/${file}`),
@@ -48054,6 +48306,7 @@ function buildSetupRepositoryVariables(configuration) {
48054
48306
  add('CHORE_TREE', repository.choreTree);
48055
48307
  add('ISSUE_MANAGED_BRANCHES', repository.issueManagedBranches);
48056
48308
  add('PRE_BRANCH_SDD', repository.preBranchSdd);
48309
+ add('VERIFICATION_SETUP', repository.verificationSetup ?? false);
48057
48310
  add('REOPEN_ISSUE_ON_PUSH', repository.reopenIssueOnPush);
48058
48311
  add('DESIRED_ASSIGNEES_COUNT', repository.desiredAssigneesCount);
48059
48312
  add('DESIRED_REVIEWERS_COUNT', repository.desiredReviewersCount);
@@ -48116,6 +48369,7 @@ function buildSetupActionInputs(configuration) {
48116
48369
  'chore-tree': repository.choreTree,
48117
48370
  'issue-managed-branches': String(repository.issueManagedBranches),
48118
48371
  'pre-branch-sdd': String(repository.preBranchSdd),
48372
+ 'verification-setup': String(repository.verificationSetup ?? false),
48119
48373
  'reopen-issue-on-push': String(repository.reopenIssueOnPush),
48120
48374
  'desired-assignees-count': String(repository.desiredAssigneesCount),
48121
48375
  'desired-reviewers-count': String(repository.desiredReviewersCount),
@@ -48561,6 +48815,9 @@ function validateSetupConfiguration(configuration, options = {}) {
48561
48815
  || typeof configuration.repository.preBranchSdd !== 'boolean') {
48562
48816
  errors.push('issue-managed-branches and pre-branch-sdd must be boolean values.');
48563
48817
  }
48818
+ if (configuration.repository.verificationSetup !== undefined && typeof configuration.repository.verificationSetup !== 'boolean') {
48819
+ errors.push('verification-setup must be a boolean value.');
48820
+ }
48564
48821
  if (configuration.repository.preBranchSdd && !configuration.repository.issueManagedBranches) {
48565
48822
  errors.push('pre-branch-sdd requires issue-managed-branches.');
48566
48823
  }
@@ -49792,6 +50049,7 @@ const repositoryFields = [
49792
50049
  ['HOTFIX_TREE', 'hotfixTree'], ['RELEASE_TREE', 'releaseTree'],
49793
50050
  ['DOCS_TREE', 'docsTree'], ['CHORE_TREE', 'choreTree'],
49794
50051
  ['ISSUE_MANAGED_BRANCHES', 'issueManagedBranches'], ['PRE_BRANCH_SDD', 'preBranchSdd'],
50052
+ ['VERIFICATION_SETUP', 'verificationSetup'],
49795
50053
  ['REOPEN_ISSUE_ON_PUSH', 'reopenIssueOnPush'], ['DESIRED_ASSIGNEES_COUNT', 'desiredAssigneesCount'],
49796
50054
  ['DESIRED_REVIEWERS_COUNT', 'desiredReviewersCount'], ['INACTIVITY_THRESHOLD_HOURS', 'inactivityThresholdHours'],
49797
50055
  ['REPOSITORY_LOCALE', 'repositoryLocale'], ['ISSUES_LOCALE', 'issueLocale'],
@@ -50256,6 +50514,8 @@ function setupQuestionDocumentation(question) {
50256
50514
  return docs.branchManagement;
50257
50515
  if (id === 'repository.preBranchSdd')
50258
50516
  return docs.preBranchSdd;
50517
+ if (id === 'repository.verificationSetup')
50518
+ return { title: 'Repository-owned verification setup', url: 'https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-owned-setup' };
50259
50519
  if (id === 'repository.inactivityThresholdHours' || id === 'features.inactiveIssueClosure')
50260
50520
  return docs.issueLifecycle;
50261
50521
  if (id === 'repository.desiredAssigneesCount' || id === 'repository.desiredReviewersCount')
@@ -50336,6 +50596,7 @@ const section = {
50336
50596
  storage: { summary: 'Choisissez où résident les Variables et Secrets GitHub Actions.', when: 'Ce réglage s’applique quand leur création est activée.', example: 'Le dépôt est le périmètre par défaut le plus simple.', effect: 'Il change la visibilité, les autorisations et l’ordre de priorité.', verify: 'Examinez le périmètre et les avertissements de masquage dans le plan.' },
50337
50597
  };
50338
50598
  const special = {
50599
+ 'repository.verificationSetup': { summary: 'Activez l’action composite du projet avant chaque commande de vérification réelle.', when: 'Gardez cette option désactivée avant de définir et revoir les dépendances sur MAIN_BRANCH.', example: 'Non garde VERIFICATION_SETUP=false ; Oui active le hook sans installer de dépendances maintenant.', effect: 'Setup crée .github/actions/copilot-verification-setup/action.yml seulement si absent et conserve le fichier existant. Le modèle échoue avant personnalisation.', verify: 'Personnalisez, révisez et fusionnez sur MAIN_BRANCH, puis lancez une vraie vérification. Une PR d’installation ne prouve pas le fonctionnement.' },
50339
50600
  'agents.findings.executable': { summary: 'Choisissez la commande de l’agent sur le runner GitHub Actions, pas sur cet ordinateur.', when: 'Ne la changez que si un agent personnalisé est délibérément installé sur le runner.', example: 'Laissez vide pour codex, opencode ou agent selon le fournisseur.', effect: 'Le chemin personnalisé est utilisé pour les tâches choisies et n’est jamais installé automatiquement.', verify: 'Vérifiez que le runner possède exactement cet exécutable avant d’activer le workflow.' },
50340
50601
  'ai.includeReasoning': { summary: 'Demandez des explications supplémentaires si la réponse du fournisseur les contient.', when: 'Réservé aux diagnostics avancés ; le parcours CLI actuel ne fournit pas de parties de raisonnement séparées.', example: 'Laissez désactivé pour une configuration normale.', effect: 'Cela peut ajouter du texte du fournisseur, sans garantir des métadonnées brèves.', verify: 'Inspectez une réponse structurée contrôlée ; ne supposez pas que l’option a produit plus de texte.' },
50341
50602
  'ai.bugbotDryRun': { summary: 'Gardez Bugbot en mode analyse seule pour ses futures exécutions.', when: 'Utile pour une évaluation ; incompatible avec les preuves nécessaires à l’approbation.', example: 'Choisissez Non pour publier les revues normales.', effect: 'Bugbot analyse sans publier de résultat ni modifier le dépôt. Ce n’est pas setup --dry-run.', verify: 'Inspectez le résultat du workflow Bugbot : le mode analyse seule ne publie ni revue ni vérification.' },
@@ -50412,6 +50673,10 @@ const location = {
50412
50673
  storage: { en: 'GitHub Actions stores these resources at repository or organization scope; the scope changes visibility and required PAT grants.', es: 'GitHub Actions guarda estos recursos en el repositorio o la organización; el ámbito cambia la visibilidad y los permisos del PAT.' },
50413
50674
  };
50414
50675
  const special = {
50676
+ 'repository.verificationSetup': {
50677
+ en: { summary: 'Enable the project-owned composite action before each real verification command.', when: 'Leave disabled until your project dependencies are defined and reviewed on the configured MAIN_BRANCH.', example: 'No keeps VERIFICATION_SETUP=false. Yes enables the existing hook; it does not infer or install dependencies now.', effect: 'Setup creates .github/actions/copilot-verification-setup/action.yml only if missing and preserves existing actions. The starter fails until customized.', verify: 'Customize the placeholder, review and merge on MAIN_BRANCH, then run an authorized modification or sync with verification. An installer PR is not runtime proof.' },
50678
+ es: { summary: 'Activa la acción compuesta del proyecto antes de cada comando real de verificación.', when: 'Déjala desactivada hasta definir y revisar las dependencias en la MAIN_BRANCH configurada.', example: 'No conserva VERIFICATION_SETUP=false. Sí activa el hook existente; ahora no se deducen ni instalan dependencias.', effect: 'Setup crea .github/actions/copilot-verification-setup/action.yml solo si falta y conserva las acciones existentes. La plantilla falla hasta personalizarla.', verify: 'Personaliza la plantilla, revisa y fusiona en MAIN_BRANCH y ejecuta una modificación o sincronización autorizada con verificación. Una PR de instalación no demuestra que el entorno funcione.' },
50679
+ },
50415
50680
  'agents.findings.executable': {
50416
50681
  en: { summary: 'Choose the agent command used on the GitHub Actions runner, not on this computer.', when: 'Only change this for a runner with a deliberately installed custom agent binary.', example: 'Leave empty for codex, opencode, or agent according to the provider.', effect: 'A custom path is shared unless a task has its own override; it is never installed automatically.', verify: 'Check the runner has this exact executable before enabling the workflow.' },
50417
50682
  es: { summary: 'Elige el comando del agente en el runner de GitHub Actions, no en este ordenador.', when: 'Cámbialo solo si el runner tiene instalado expresamente otro binario.', example: 'Déjalo vacío para usar codex, opencode o agent según el proveedor.', effect: 'La ruta personalizada se comparte salvo que una tarea tenga su propia excepción; nunca se instala automáticamente.', verify: 'Comprueba que el runner tiene exactamente ese ejecutable.' },
@@ -50562,6 +50827,7 @@ const section = {
50562
50827
  storage: { summary: 'Escolha onde ficam as Variables e Secrets do GitHub Actions.', when: 'Aplica-se quando a sua criação está ativa.', example: 'O âmbito do repositório é a opção predefinida mais simples.', effect: 'Altera visibilidade, permissões e precedência.', verify: 'Confirme o âmbito e os avisos de sobreposição no plano.' },
50563
50828
  };
50564
50829
  const special = {
50830
+ 'repository.verificationSetup': { summary: 'Ative a ação composta do projeto antes de cada comando real de verificação.', when: 'Mantenha desativado até definir e rever as dependências na MAIN_BRANCH configurada.', example: 'Não mantém VERIFICATION_SETUP=false; Sim ativa o hook sem instalar dependências agora.', effect: 'Setup cria .github/actions/copilot-verification-setup/action.yml só se faltar e preserva o existente. O modelo falha até ser personalizado.', verify: 'Personalize, reveja e faça merge na MAIN_BRANCH, depois execute uma verificação real. Uma PR de instalação não comprova o funcionamento.' },
50565
50831
  'agents.findings.executable': { summary: 'Escolha o comando do agente no runner GitHub Actions, não neste computador.', when: 'Altere-o apenas se tiver instalado deliberadamente outro agente no runner.', example: 'Deixe vazio para codex, opencode ou agent, conforme o fornecedor.', effect: 'O caminho personalizado é usado pelas tarefas escolhidas e nunca é instalado automaticamente.', verify: 'Confirme que o runner tem exatamente este executável antes de ativar o fluxo.' },
50566
50832
  'ai.includeReasoning': { summary: 'Peça explicações adicionais se a resposta do fornecedor as disponibilizar.', when: 'Só para diagnóstico avançado; o percurso CLI atual não fornece partes de raciocínio separadas.', example: 'Mantenha desativado numa configuração normal.', effect: 'Pode acrescentar texto do fornecedor, sem garantir metadados breves.', verify: 'Inspecione uma resposta estruturada controlada; não presuma que a opção produziu texto adicional.' },
50567
50833
  'ai.bugbotDryRun': { summary: 'Mantenha o Bugbot em modo apenas de análise nas próximas execuções.', when: 'Útil numa avaliação; incompatível com provas de aprovação.', example: 'Escolha Não para publicar revisões normais.', effect: 'O Bugbot analisa sem publicar resultados nem alterar o repositório. Não é setup --dry-run.', verify: 'Inspecione o resultado do fluxo Bugbot: a simulação não publica revisão nem verificação.' },
@@ -50620,6 +50886,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50620
50886
  exports.questionLabelsFr = void 0;
50621
50887
  /** French presentation labels; semantic question IDs remain unchanged. */
50622
50888
  exports.questionLabelsFr = {
50889
+ 'repository.verificationSetup': 'Préparer les dépendances avec l’action de vérification du dépôt ?',
50623
50890
  'features.issues': 'Automatiser les tickets : branches, étiquettes, projets et cycle de vie',
50624
50891
  'features.pullRequests': 'Automatiser les pull requests : revue, description et cycle de vie',
50625
50892
  'features.commits': 'Automatiser les commits : progression, taille et analyse Bugbot',
@@ -50713,6 +50980,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50713
50980
  exports.questionLabelsPt = void 0;
50714
50981
  /** Portuguese presentation labels; semantic question IDs remain unchanged. */
50715
50982
  exports.questionLabelsPt = {
50983
+ 'repository.verificationSetup': 'Preparar dependências com a ação de verificação do repositório?',
50716
50984
  'features.issues': 'Automatizar questões: ramos, etiquetas, projetos e ciclo de vida',
50717
50985
  'features.pullRequests': 'Automatizar pull requests: revisão, descrição e ciclo de vida',
50718
50986
  'features.commits': 'Automatizar commits: progresso, tamanho e análise do Bugbot',
@@ -50853,6 +51121,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50853
51121
  exports.purposesFr = void 0;
50854
51122
  /** French question-specific purposes. */
50855
51123
  exports.purposesFr = {
51124
+ 'repository.verificationSetup': 'Activez la préparation des dépendances du dépôt avant la vérification ; personnalisez et révisez le modèle sur MAIN_BRANCH au préalable.',
50856
51125
  'issueWorkflows.enabled': 'Choisissez les workflows de ticket que Copilot pourra exécuter ; chacun agit différemment sur les branches, étiquettes et automatisations.',
50857
51126
  'repositoryAgentGuidance.enabled': 'Générez des instructions pour aider les agents IA à travailler en sécurité dans ce projet.',
50858
51127
  'repositoryAgentGuidance.agentsPointer': 'Décidez si le fichier AGENTS.md racine renvoie aux instructions générées, est créé s’il manque, ou reste intact.',
@@ -50914,6 +51183,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50914
51183
  exports.purposesPt = void 0;
50915
51184
  /** Portuguese question-specific purposes. */
50916
51185
  exports.purposesPt = {
51186
+ 'repository.verificationSetup': 'Ative a preparação das dependências antes da verificação; personalize e reveja o modelo na MAIN_BRANCH primeiro.',
50917
51187
  'issueWorkflows.enabled': 'Escolha os fluxos de questões que o Copilot poderá executar; cada um afeta de forma diferente ramos, etiquetas e automatizações.',
50918
51188
  'repositoryAgentGuidance.enabled': 'Gere instruções para ajudar os agentes de IA a trabalhar com segurança neste projeto.',
50919
51189
  'repositoryAgentGuidance.agentsPointer': 'Decida se o AGENTS.md da raiz aponta para as instruções geradas, é criado se faltar ou permanece intacto.',
@@ -51045,6 +51315,7 @@ exports.setupQuestionPurpose = setupQuestionPurpose;
51045
51315
  const setup_runner_guidance_policy_1 = __nccwpck_require__(10741);
51046
51316
  /** Field-specific meaning for choices whose label alone is easy to misinterpret. */
51047
51317
  exports.setupQuestionPurposes = {
51318
+ 'repository.verificationSetup': { en: 'Enable the repository-owned dependency setup before verification. The starter must be customized and reviewed on MAIN_BRANCH first.', es: 'Activa la preparación de dependencias del repositorio antes de verificar. Primero personaliza y revisa la plantilla en MAIN_BRANCH.' },
51048
51319
  'issueWorkflows.enabled': { en: 'Choose the issue workflows Copilot may run; each type has different branch, label and automation effects.', es: 'Elige los flujos de issues que podrá ejecutar Copilot; cada tipo tiene efectos distintos sobre ramas, etiquetas y automatización.' },
51049
51320
  'repositoryAgentGuidance.enabled': { en: 'Generate repository instructions that tell AI agents how to work safely in this project.', es: 'Genera instrucciones para que los agentes de IA trabajen con seguridad en este proyecto.' },
51050
51321
  'repositoryAgentGuidance.agentsPointer': { en: 'Choose whether the root AGENTS.md points to generated instructions, is created if missing, or stays untouched.', es: 'Elige si el AGENTS.md raíz apunta a las instrucciones generadas, se crea si falta o permanece intacto.' },
@@ -51167,6 +51438,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
51167
51438
  exports.spanishQuestionLabels = void 0;
51168
51439
  exports.spanishQuestionLabel = spanishQuestionLabel;
51169
51440
  exports.spanishQuestionLabels = {
51441
+ 'repository.verificationSetup': '¿Preparar dependencias con la acción de verificación del repositorio?',
51170
51442
  'features.issues': 'Automatizar issues: ramas, etiquetas, proyectos y ciclo de vida',
51171
51443
  'features.pullRequests': 'Automatizar pull requests: revisión, descripción y ciclo de vida',
51172
51444
  'features.commits': 'Automatizar commits: progreso, tamaño y análisis de Bugbot',
@@ -51612,6 +51884,7 @@ function repositoryQuestions() {
51612
51884
  ['choreTree', 'Chore branch prefix', 'text'],
51613
51885
  ['issueManagedBranches', 'Let the Action create linked branches after in-progress?', 'boolean'],
51614
51886
  ['preBranchSdd', 'Require an SDD before feature and contract-change branches?', 'boolean'],
51887
+ ['verificationSetup', 'Prepare dependencies with the repository verification setup action?', 'boolean'],
51615
51888
  ['reopenIssueOnPush', 'Reopen closed issues when a related branch receives a push?', 'boolean'],
51616
51889
  ['desiredAssigneesCount', 'Desired issue assignees (0 disables automatic assignment)', 'number'],
51617
51890
  ['desiredReviewersCount', 'Desired pull-request reviewers (0 disables automatic assignment)', 'number'],
@@ -51788,6 +52061,8 @@ function toQuestion(definition, draft, context) {
51788
52061
  }, context);
51789
52062
  }
51790
52063
  function readPath(configuration, path, allowedNames) {
52064
+ if (path === 'repository.verificationSetup')
52065
+ return configuration.repository.verificationSetup ?? false;
51791
52066
  const value = path.split('.').reduce((current, key) => current[key], configuration);
51792
52067
  if (path.endsWith('.overrides')) {
51793
52068
  const overrides = value;
@@ -52182,6 +52457,7 @@ function setupRunnerGuidance(question) {
52182
52457
  Object.defineProperty(exports, "__esModule", ({ value: true }));
52183
52458
  exports.setupRunnerInstallationSummary = setupRunnerInstallationSummary;
52184
52459
  const setup_runner_policy_1 = __nccwpck_require__(91027);
52460
+ const setup_verification_action_summary_policy_1 = __nccwpck_require__(15818);
52185
52461
  function routeBlock(route) {
52186
52462
  const json = JSON.stringify(route, null, 2);
52187
52463
  const longest = (json.match(/`+/g) ?? []).reduce((length, run) => Math.max(length, run.length), 2);
@@ -52205,6 +52481,7 @@ function setupRunnerInstallationSummary(plan) {
52205
52481
  `**Parity:** ${assets.filter(asset => asset.status === 'source-only').length} source extensions; ${assets.filter(asset => asset.status === 'missing').length} missing assets (including disabled optional capabilities); ${assets.filter(asset => asset.status === 'customized').length} customized; ${assets.filter(asset => asset.status === 'incompatible').length} incompatible metadata retained or blocked before regeneration.`,
52206
52482
  'Inspect the complete Files changed view and `.copilot/runner-profile.json`. Any replacements retain setup backups under `.copilot/setup-backups/`.',
52207
52483
  'Runner access, capacity and agent authentication are separate. Selection grants no group access and never falls back to another runner. Human merge and actual trusted workflow verification remain pending.',
52484
+ ...(0, setup_verification_action_summary_policy_1.setupVerificationActionSummary)(review?.verificationSetup),
52208
52485
  ].join('\n');
52209
52486
  }
52210
52487
 
@@ -52956,6 +53233,27 @@ function levelRank(level) {
52956
53233
  }
52957
53234
 
52958
53235
 
53236
+ /***/ }),
53237
+
53238
+ /***/ 15818:
53239
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
53240
+
53241
+ "use strict";
53242
+
53243
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
53244
+ exports.setupVerificationActionSummary = setupVerificationActionSummary;
53245
+ const setup_verification_action_1 = __nccwpck_require__(33156);
53246
+ /** Shared terminal/installation-PR copy contains no repository-controlled Markdown. */
53247
+ function setupVerificationActionSummary(review) {
53248
+ if (!review)
53249
+ return [];
53250
+ const outcomes = { create: 'Create the starter only if missing', preserve: 'Preserve the existing consumer action byte-for-byte', blocked: 'Blocked: inspect the unsafe action path' };
53251
+ return ['Verification setup', `${outcomes[review.action]}: ${setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH}.`,
53252
+ `VERIFICATION_SETUP=${review.enabled ? 'true (enabled)' : 'false (disabled)'}.`,
53253
+ 'The generated placeholder fails until customized. Review and merge project dependency setup onto configured MAIN_BRANCH, then run a real verification. Setup or an installer PR does not establish runtime readiness.'];
53254
+ }
53255
+
53256
+
52959
53257
  /***/ }),
52960
53258
 
52961
53259
  /***/ 3449:
@@ -53187,6 +53485,58 @@ function verificationRuntimeMatches(required, observed) {
53187
53485
  }
53188
53486
 
53189
53487
 
53488
+ /***/ }),
53489
+
53490
+ /***/ 65326:
53491
+ /***/ ((__unused_webpack_module, exports) => {
53492
+
53493
+ "use strict";
53494
+
53495
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
53496
+ exports.VerificationSetupError = exports.VERIFICATION_SETUP_HELP = exports.VERIFICATION_SETUP_LIMITS = exports.VERIFICATION_SETUP_PATH = exports.VERIFICATION_SETUP_DIRECTORY = void 0;
53497
+ exports.parseVerificationSetupResult = parseVerificationSetupResult;
53498
+ exports.VERIFICATION_SETUP_DIRECTORY = '.github/actions/copilot-verification-setup';
53499
+ exports.VERIFICATION_SETUP_PATH = `${exports.VERIFICATION_SETUP_DIRECTORY}/action.yml`;
53500
+ exports.VERIFICATION_SETUP_LIMITS = Object.freeze({ timeoutMs: 300000, resultBytes: 16384, scriptBytes: 65536, snapshotBytes: 262144, files: 32, requests: 20 });
53501
+ exports.VERIFICATION_SETUP_HELP = 'https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-owned-setup';
53502
+ /** Closed facts only. Provider/helper output and raw exception causes never cross this boundary. */
53503
+ class VerificationSetupError extends Error {
53504
+ constructor(reason, sourceSha, exitCode) {
53505
+ const sha = sourceSha && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(sourceSha) ? sourceSha : 'unavailable';
53506
+ const exit = Number.isInteger(exitCode) && exitCode >= 0 && exitCode <= 255 ? ` Exit status: ${exitCode}.` : '';
53507
+ const action = reason === 'native-workflow-required'
53508
+ ? 'Update the generated Copilot workflows and run this operation in GitHub Actions; the local CLI cannot execute composite actions.'
53509
+ : `Review ${exports.VERIFICATION_SETUP_PATH} on the trusted main branch and rerun.`;
53510
+ super(`Repository setup blocked verification (${reason}). ${action} Trusted source SHA: ${sha}.${exit} Verification, commit and push are withheld. Help: ${exports.VERIFICATION_SETUP_HELP}`);
53511
+ this.reason = reason;
53512
+ this.exitCode = exitCode;
53513
+ this.name = 'VerificationSetupError';
53514
+ }
53515
+ }
53516
+ exports.VerificationSetupError = VerificationSetupError;
53517
+ function record(value) {
53518
+ return !!value && typeof value === 'object' && !Array.isArray(value);
53519
+ }
53520
+ function pathString(value) {
53521
+ return typeof value === 'string' && value.length > 0 && value.length <= 2048
53522
+ && ![...value].some(character => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127);
53523
+ }
53524
+ /** Filesystem containment is checked by the adapter, after this closed schema is parsed. */
53525
+ function parseVerificationSetupResult(value) {
53526
+ if (!record(value) || value.schemaVersion !== 1 || Object.keys(value).some(key => !['schemaVersion', 'path', 'environment'].includes(key))) {
53527
+ throw new VerificationSetupError('result-invalid');
53528
+ }
53529
+ const paths = value.path === undefined ? [] : value.path;
53530
+ const environment = value.environment === undefined ? {} : value.environment;
53531
+ if (!Array.isArray(paths) || paths.length > 8 || !paths.every(pathString) || new Set(paths).size !== paths.length
53532
+ || !record(environment) || Object.keys(environment).some(key => key !== 'JAVA_HOME')
53533
+ || ('JAVA_HOME' in environment && !pathString(environment.JAVA_HOME))) {
53534
+ throw new VerificationSetupError('result-invalid');
53535
+ }
53536
+ return Object.freeze({ path: Object.freeze([...paths]), ...(environment.JAVA_HOME ? { javaHome: environment.JAVA_HOME } : {}) });
53537
+ }
53538
+
53539
+
53190
53540
  /***/ }),
53191
53541
 
53192
53542
  /***/ 43193:
@@ -53352,6 +53702,13 @@ class PullRequestReviewOperationError extends Error {
53352
53702
  super(buildMessage(operation, context));
53353
53703
  this.name = "PullRequestReviewOperationError";
53354
53704
  this.operation = operation;
53705
+ const status = context?.providerStatus;
53706
+ if (typeof status === 'number' && Number.isInteger(status) && status >= 400 && status <= 599) {
53707
+ this.providerStatus = status;
53708
+ }
53709
+ if (typeof context?.providerReference === 'string' && /^[A-Za-z0-9:-]{1,64}$/.test(context.providerReference)) {
53710
+ this.providerReference = context.providerReference;
53711
+ }
53355
53712
  }
53356
53713
  }
53357
53714
  exports.PullRequestReviewOperationError = PullRequestReviewOperationError;
@@ -53392,6 +53749,18 @@ function bindSddEvidenceReadPorts(ports) {
53392
53749
  }
53393
53750
 
53394
53751
 
53752
+ /***/ }),
53753
+
53754
+ /***/ 26509:
53755
+ /***/ ((__unused_webpack_module, exports) => {
53756
+
53757
+ "use strict";
53758
+
53759
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
53760
+ exports.DISABLED_VERIFICATION_SETUP = void 0;
53761
+ exports.DISABLED_VERIFICATION_SETUP = Object.freeze({ kind: 'disabled' });
53762
+
53763
+
53395
53764
  /***/ }),
53396
53765
 
53397
53766
  /***/ 84387:
@@ -55302,6 +55671,7 @@ async function runInitialSetupWorkflow(request, dependencies) {
55302
55671
  }
55303
55672
  (0, logging_ports_1.logInfo)('📋 Ensuring .github and copying setup files...');
55304
55673
  const workspaceSelection = {
55674
+ ...(request.verificationActionState ? { verificationActionState: request.verificationActionState } : {}),
55305
55675
  features: setupConfiguration?.features,
55306
55676
  setupConfiguration,
55307
55677
  ...(request.workflowUpdates.length > 0 ? {
@@ -55313,6 +55683,8 @@ async function runInitialSetupWorkflow(request, dependencies) {
55313
55683
  const filesResult = dependencies.setupWorkspacePort.prepare(workspaceSelection);
55314
55684
  mark('files', filesResult.copied > 0 ? 'completed' : 'skipped');
55315
55685
  steps.push(`✅ Setup files: ${filesResult.copied} copied, ${filesResult.skipped} already existed`);
55686
+ if (request.verificationActionState)
55687
+ 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.`);
55316
55688
  if (setupConfiguration?.manageRepositorySecrets && secretValues > 0)
55317
55689
  mark('secrets', 'in-progress');
55318
55690
  const secrets = await (0, setup_resource_provisioning_1.ensureRepositorySecrets)(request, dependencies, setupConfiguration, remoteConfiguration);
@@ -56396,8 +56768,9 @@ function failure(taskId, message, code) {
56396
56768
  Object.defineProperty(exports, "__esModule", ({ value: true }));
56397
56769
  exports.ReconcileClosedIssueMetadataUseCase = void 0;
56398
56770
  const result_1 = __nccwpck_require__(73817);
56399
- const issue_completion_1 = __nccwpck_require__(31147);
56400
56771
  const application_error_1 = __nccwpck_require__(75999);
56772
+ const closed_issue_reconciliation_error_1 = __nccwpck_require__(12183);
56773
+ const reconcile_issue_completion_metadata_1 = __nccwpck_require__(70614);
56401
56774
  /** Selective completion repair from fresh native facts; no native state authority. */
56402
56775
  class ReconcileClosedIssueMetadataUseCase {
56403
56776
  constructor(issues) {
@@ -56405,50 +56778,22 @@ class ReconcileClosedIssueMetadataUseCase {
56405
56778
  this.taskId = 'ReconcileClosedIssueMetadataUseCase';
56406
56779
  }
56407
56780
  async invoke(context) {
56408
- let labelsChanged = 0;
56409
- let nativeClosed = false;
56781
+ const progress = (0, reconcile_issue_completion_metadata_1.completionRepairProgress)();
56410
56782
  try {
56411
56783
  if (!Number.isSafeInteger(context.issueNumber) || context.issueNumber < 1)
56412
56784
  throw stale();
56413
56785
  const target = this.issues.forIssue(context.issueNumber);
56414
- const initial = await target.read();
56415
- nativeClosed = initial.number === context.issueNumber && initial.state === 'closed';
56416
- const initialPlan = (0, issue_completion_1.planIssueCompletion)(initial, context.completionLabels);
56417
- if (!nativeClosed || initialPlan.kind !== 'closed')
56418
- throw stale();
56419
- const fence = async () => {
56420
- const current = await target.read();
56421
- nativeClosed = current.number === context.issueNumber && current.state === 'closed';
56422
- const plan = (0, issue_completion_1.planIssueCompletion)(current, context.completionLabels);
56423
- if (!nativeClosed || plan.kind !== 'closed' || current.reason !== initial.reason)
56424
- throw stale();
56425
- return plan;
56426
- };
56427
- for (const label of initialPlan.remove) {
56428
- if ((await fence()).remove.includes(label)) {
56429
- await target.removeLabel(label);
56430
- labelsChanged++;
56431
- }
56432
- }
56433
- for (const label of initialPlan.add) {
56434
- if ((await fence()).add.includes(label)) {
56435
- await target.addLabel(label);
56436
- labelsChanged++;
56437
- }
56438
- }
56439
- const final = await fence();
56440
- if (final.remove.length || final.add.length)
56441
- throw stale();
56442
- return [new result_1.Result({ id: this.taskId, success: true, executed: labelsChanged > 0,
56786
+ const repaired = await (0, reconcile_issue_completion_metadata_1.reconcileIssueCompletionMetadata)(target, context.issueNumber, context.completionLabels, progress);
56787
+ return [new result_1.Result({ id: this.taskId, success: true, executed: progress.labelsChanged > 0,
56443
56788
  steps: ['The closed issue completion metadata was verified; historical and unrelated labels were retained.'],
56444
- payload: { issueCompletion: { nativeClosed, labelsChanged, reconciled: true, reason: initial.reason } } })];
56789
+ payload: { issueCompletion: { nativeClosed: progress.nativeClosed, labelsChanged: progress.labelsChanged, reconciled: true, ...repaired } } })];
56445
56790
  }
56446
56791
  catch (cause) {
56447
- return [new result_1.Result({ id: this.taskId, success: false, executed: labelsChanged > 0,
56448
- steps: [nativeClosed ? 'The issue remains closed; completion metadata could not be fully verified. Inspect and retry the closed-issue workflow.'
56792
+ return [new result_1.Result({ id: this.taskId, success: false, executed: progress.labelsChanged > 0,
56793
+ steps: [progress.nativeClosed ? 'The issue remains closed; completion metadata could not be fully verified. Inspect and retry the closed-issue workflow.'
56449
56794
  : 'Current native issue closure could not be verified; completion repair stopped without changing native state.'],
56450
- errors: [(0, application_error_1.toApplicationError)(cause, 'provider.unavailable', 'Closed issue completion metadata remains unverified.')],
56451
- payload: { issueCompletion: { nativeClosed, labelsChanged, reconciled: false } } })];
56795
+ errors: [(0, closed_issue_reconciliation_error_1.closedIssueReconciliationError)(cause, { resultId: this.taskId, phase: progress.phase, state: progress.state, reason: progress.reason, changed: progress.labelsChanged, remaining: progress.remaining })],
56796
+ payload: { issueCompletion: { nativeClosed: progress.nativeClosed, labelsChanged: progress.labelsChanged, reconciled: false } } })];
56452
56797
  }
56453
56798
  }
56454
56799
  }
@@ -56481,6 +56826,84 @@ class ReconcileClosedIssueUseCase {
56481
56826
  exports.ReconcileClosedIssueUseCase = ReconcileClosedIssueUseCase;
56482
56827
 
56483
56828
 
56829
+ /***/ }),
56830
+
56831
+ /***/ 70614:
56832
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
56833
+
56834
+ "use strict";
56835
+
56836
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56837
+ exports.completionRepairProgress = void 0;
56838
+ exports.reconcileIssueCompletionMetadata = reconcileIssueCompletionMetadata;
56839
+ const application_error_1 = __nccwpck_require__(75999);
56840
+ const issue_completion_1 = __nccwpck_require__(31147);
56841
+ const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
56842
+ const completionRepairProgress = () => ({ nativeClosed: false, labelsChanged: 0,
56843
+ phase: 'identity', state: 'unavailable', reason: 'unavailable', remaining: 0 });
56844
+ exports.completionRepairProgress = completionRepairProgress;
56845
+ /** At most two bounded selective passes, with fresh native fences before every write. */
56846
+ async function reconcileIssueCompletionMetadata(target, number, configuration, progress, initial) {
56847
+ let expectedReason;
56848
+ let superseded = false;
56849
+ const read = async (phase, snapshot) => {
56850
+ progress.phase = phase;
56851
+ progress.state = 'unavailable';
56852
+ progress.reason = 'unavailable';
56853
+ const facts = snapshot ?? await target.read();
56854
+ progress.nativeClosed = facts?.number === number && facts.state === 'closed';
56855
+ progress.state = facts?.number === number && ['open', 'closed'].includes(facts.state) ? facts.state : 'unavailable';
56856
+ progress.reason = closed_issue_reconciliation_1.CLOSED_ISSUE_REASONS.some(reason => reason === facts?.reason) ? facts.reason : 'unavailable';
56857
+ const plan = (0, issue_completion_1.planIssueCompletion)(facts, configuration);
56858
+ if (!progress.nativeClosed || plan.kind !== 'closed' || expectedReason !== undefined && facts.reason !== expectedReason) {
56859
+ throw new application_error_1.ApplicationError('workflow.stale', 'The native issue identity, state or closure reason changed.');
56860
+ }
56861
+ expectedReason = facts.reason;
56862
+ progress.remaining = plan.remove.length + plan.add.length;
56863
+ return plan;
56864
+ };
56865
+ let plan = await read('read', initial);
56866
+ for (let pass = 0; pass < 2; pass++) {
56867
+ for (const label of plan.remove) {
56868
+ if (!(await read('label-remove')).remove.includes(label)) {
56869
+ superseded = true;
56870
+ continue;
56871
+ }
56872
+ try {
56873
+ await target.removeLabel(label);
56874
+ progress.labelsChanged++;
56875
+ }
56876
+ catch (cause) {
56877
+ if ((await read('label-remove')).remove.includes(label))
56878
+ throw cause;
56879
+ superseded = true;
56880
+ }
56881
+ }
56882
+ for (const label of plan.add) {
56883
+ if (!(await read('label-add')).add.includes(label)) {
56884
+ superseded = true;
56885
+ continue;
56886
+ }
56887
+ try {
56888
+ await target.addLabel(label);
56889
+ progress.labelsChanged++;
56890
+ }
56891
+ catch (cause) {
56892
+ if ((await read('label-add')).add.includes(label))
56893
+ throw cause;
56894
+ superseded = true;
56895
+ }
56896
+ }
56897
+ plan = await read('metadata-verification');
56898
+ if (!progress.remaining)
56899
+ return { reason: plan.reason,
56900
+ outcome: progress.labelsChanged ? 'reconciled' : 'already-converged', superseded };
56901
+ superseded = true;
56902
+ }
56903
+ throw new application_error_1.ApplicationError('provider.conflict', 'Completion metadata remains incomplete after two bounded passes.');
56904
+ }
56905
+
56906
+
56484
56907
  /***/ }),
56485
56908
 
56486
56909
  /***/ 74111:
@@ -56490,7 +56913,9 @@ exports.ReconcileClosedIssueUseCase = ReconcileClosedIssueUseCase;
56490
56913
 
56491
56914
  Object.defineProperty(exports, "__esModule", ({ value: true }));
56492
56915
  exports.RetireBranchSyncUseCase = void 0;
56493
- const reply_request_digest_1 = __nccwpck_require__(47971);
56916
+ const verify_closed_issue_card_retirement_1 = __nccwpck_require__(78813);
56917
+ const closed_issue_reconciliation_error_1 = __nccwpck_require__(12183);
56918
+ const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
56494
56919
  const result_1 = __nccwpck_require__(73817);
56495
56920
  const github_user_policy_1 = __nccwpck_require__(84403);
56496
56921
  const publication_identity_policy_1 = __nccwpck_require__(45403);
@@ -56508,17 +56933,33 @@ class RetireBranchSyncUseCase {
56508
56933
  async invoke(context) {
56509
56934
  let retired = 0;
56510
56935
  let nativeClosed = false;
56936
+ let phase = 'identity';
56937
+ let state = 'unavailable';
56938
+ let reason = 'unavailable';
56939
+ let remaining = 0;
56940
+ let superseded = false;
56511
56941
  try {
56512
56942
  if (!Number.isSafeInteger(context.issueNumber) || context.issueNumber < 1 || !context.trustedBotLogin) {
56513
56943
  return [this.result(retired, nativeClosed)];
56514
56944
  }
56515
- const initial = await this.issues.readIssue(context.issueNumber);
56516
- if (initial.number !== context.issueNumber || !['open', 'closed'].includes(initial.state))
56945
+ const read = async () => {
56946
+ state = 'unavailable';
56947
+ reason = 'unavailable';
56948
+ const facts = await this.issues.readIssue(context.issueNumber);
56949
+ nativeClosed = facts?.number === context.issueNumber && facts.state === 'closed';
56950
+ state = facts?.number === context.issueNumber && ['open', 'closed'].includes(facts.state) ? facts.state : 'unavailable';
56951
+ reason = closed_issue_reconciliation_1.CLOSED_ISSUE_REASONS.some(value => value === facts?.reason) ? facts.reason : 'unavailable';
56952
+ return facts;
56953
+ };
56954
+ phase = 'read';
56955
+ const initial = await read();
56956
+ if (initial.number !== context.issueNumber || !['open', 'closed'].includes(initial.state) || initial.state === 'closed' && !['completed', 'not_planned', 'duplicate', 'unknown'].includes(initial.reason))
56517
56957
  throw stale();
56518
56958
  if (initial.state !== 'closed')
56519
56959
  return [this.result(retired, nativeClosed)];
56520
56960
  nativeClosed = true;
56521
56961
  const messages = (0, branch_sync_message_catalog_1.resolveStaticBranchSyncCatalog)(context.locale);
56962
+ phase = 'card-inventory';
56522
56963
  const cards = (await this.comments.listIssueComments(context.issueNumber)).filter(comment => {
56523
56964
  const marker = (0, publication_identity_policy_1.parsePublicationMarker)(comment.body);
56524
56965
  return marker?.identity.topic === 'branch-sync' && marker.identity.target.kind === 'issue'
@@ -56527,38 +56968,40 @@ class RetireBranchSyncUseCase {
56527
56968
  && Number.isSafeInteger(comment.id) && comment.id > 0
56528
56969
  && Boolean(comment.user?.login && (0, github_user_policy_1.githubUsersMatch)(context.trustedBotLogin, comment.user.login));
56529
56970
  });
56971
+ remaining = Math.min(cards.length, 3000);
56530
56972
  if (cards.length > 20)
56531
56973
  throw stale();
56974
+ const verifyClosed = async () => {
56975
+ phase = 'native-fence';
56976
+ const fresh = await read();
56977
+ if (!nativeClosed || fresh.reason !== initial.reason)
56978
+ throw stale();
56979
+ };
56532
56980
  for (const card of cards) {
56533
56981
  const marker = (0, publication_identity_policy_1.parsePublicationMarker)(card.body);
56534
56982
  const body = (0, branch_sync_notification_policy_1.buildRetiredBranchSyncComment)(marker.identity, messages);
56535
- if (card.body === body)
56536
- continue;
56537
- const witness = Object.freeze({ surface: 'issue-comment', commentId: card.id,
56538
- author: context.trustedBotLogin, target: Object.freeze({ kind: 'issue', number: context.issueNumber }),
56539
- bodyDigest: (0, reply_request_digest_1.replyRequestBodyDigest)(card.body ?? '') });
56540
- if (!await this.cardFreshness.matches(witness))
56541
- throw stale();
56542
- const fresh = await this.issues.readIssue(context.issueNumber);
56543
- nativeClosed = fresh.number === context.issueNumber && fresh.state === 'closed';
56544
- if (!nativeClosed || fresh.reason !== initial.reason)
56545
- throw stale();
56546
- await this.comments.updateComment(context.issueNumber, card.id, body);
56547
- retired++;
56983
+ const verified = await (0, verify_closed_issue_card_retirement_1.verifyClosedIssueCardRetirement)({ issueNumber: context.issueNumber,
56984
+ commentId: card.id, author: context.trustedBotLogin, originalBody: card.body ?? '', finalBody: body,
56985
+ freshness: this.cardFreshness, verifyClosed, onUpdated: () => { retired++; }, phase: value => { phase = value; },
56986
+ update: () => this.comments.updateComment(context.issueNumber, card.id, body) });
56987
+ superseded || (superseded = verified.superseded);
56988
+ remaining--;
56548
56989
  }
56549
- return [this.result(retired, nativeClosed)];
56990
+ await verifyClosed();
56991
+ return [this.result(retired, nativeClosed, superseded)];
56550
56992
  }
56551
56993
  catch (cause) {
56552
56994
  return [new result_1.Result({ id: this.taskId, success: false, executed: retired > 0,
56553
56995
  steps: [nativeClosed ? 'Issue closure is retained; synchronization recommendation retirement could not be fully verified. Retry the closed-issue event or merged-PR operation.' : 'Native issue closure could not be verified; synchronization recommendations were left unchanged.'],
56554
- errors: [(0, application_error_1.toApplicationError)(cause, 'provider.unavailable', 'Unable to retire synchronization recommendations safely.')],
56996
+ errors: [(0, closed_issue_reconciliation_error_1.closedIssueReconciliationError)(cause, { resultId: this.taskId, phase, state, reason, changed: retired, remaining })],
56555
56997
  payload: { nativeClosed, retiredCards: retired, reconciled: false } })];
56556
56998
  }
56557
56999
  }
56558
- result(retired, nativeClosed) {
57000
+ result(retired, nativeClosed, superseded = false) {
56559
57001
  return new result_1.Result({ id: this.taskId, success: true, executed: retired > 0,
56560
57002
  steps: [retired ? 'The closed issue’s synchronization recommendations were retired.' : 'No synchronization recommendation required retirement.'],
56561
- payload: { ...(nativeClosed ? { state: 'closed' } : {}), nativeClosed, retiredCards: retired, reconciled: true } });
57003
+ payload: { ...(nativeClosed ? { state: 'closed' } : {}), nativeClosed, retiredCards: retired, reconciled: true, superseded,
57004
+ outcome: nativeClosed ? retired ? 'reconciled' : 'already-converged' : 'not-applicable' } });
56562
57005
  }
56563
57006
  }
56564
57007
  exports.RetireBranchSyncUseCase = RetireBranchSyncUseCase;
@@ -56599,7 +57042,9 @@ exports.RetireClosedIssueCardsUseCase = RetireClosedIssueCardsUseCase;
56599
57042
 
56600
57043
  Object.defineProperty(exports, "__esModule", ({ value: true }));
56601
57044
  exports.RetireProgressUseCase = void 0;
56602
- const reply_request_digest_1 = __nccwpck_require__(47971);
57045
+ const verify_closed_issue_card_retirement_1 = __nccwpck_require__(78813);
57046
+ const closed_issue_reconciliation_error_1 = __nccwpck_require__(12183);
57047
+ const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
56603
57048
  const result_1 = __nccwpck_require__(73817);
56604
57049
  const github_user_policy_1 = __nccwpck_require__(84403);
56605
57050
  const publication_identity_policy_1 = __nccwpck_require__(45403);
@@ -56616,16 +57061,32 @@ class RetireProgressUseCase {
56616
57061
  async invoke(context) {
56617
57062
  let retired = 0;
56618
57063
  let nativeClosed = false;
57064
+ let phase = 'identity';
57065
+ let state = 'unavailable';
57066
+ let reason = 'unavailable';
57067
+ let remaining = 0;
57068
+ let superseded = false;
56619
57069
  try {
56620
57070
  if (!Number.isSafeInteger(context.issueNumber) || context.issueNumber < 1 || !context.trustedBotLogin) {
56621
57071
  return [this.result(retired, nativeClosed)];
56622
57072
  }
56623
- const initial = await this.issues.readIssue(context.issueNumber);
57073
+ const read = async () => {
57074
+ state = 'unavailable';
57075
+ reason = 'unavailable';
57076
+ const facts = await this.issues.readIssue(context.issueNumber);
57077
+ nativeClosed = facts?.number === context.issueNumber && facts.state === 'closed';
57078
+ state = facts?.number === context.issueNumber && ['open', 'closed'].includes(facts.state) ? facts.state : 'unavailable';
57079
+ reason = closed_issue_reconciliation_1.CLOSED_ISSUE_REASONS.some(value => value === facts?.reason) ? facts.reason : 'unavailable';
57080
+ return facts;
57081
+ };
57082
+ phase = 'read';
57083
+ const initial = await read();
56624
57084
  if (initial.number !== context.issueNumber || !['open', 'closed'].includes(initial.state) || initial.state === 'closed' && !['completed', 'not_planned', 'duplicate', 'unknown'].includes(initial.reason))
56625
57085
  throw stale();
56626
57086
  if (initial.state !== 'closed')
56627
57087
  return [this.result(retired, nativeClosed)];
56628
57088
  nativeClosed = true;
57089
+ phase = 'card-inventory';
56629
57090
  const cards = (await this.comments.listIssueComments(context.issueNumber)).filter(comment => {
56630
57091
  const marker = (0, publication_identity_policy_1.parsePublicationMarker)(comment.body);
56631
57092
  return marker?.identity.topic === 'progress' && marker.identity.target.kind === 'issue'
@@ -56634,37 +57095,39 @@ class RetireProgressUseCase {
56634
57095
  && Number.isSafeInteger(comment.id) && comment.id > 0
56635
57096
  && Boolean(comment.user?.login && (0, github_user_policy_1.githubUsersMatch)(context.trustedBotLogin, comment.user.login));
56636
57097
  });
57098
+ remaining = Math.min(cards.length, 3000);
56637
57099
  if (cards.length > 20)
56638
57100
  throw stale();
56639
- for (const card of cards) {
56640
- const body = (0, retired_progress_presentation_policy_1.buildRetiredProgressComment)(card.body ?? '', context.locale, initial.reason);
56641
- if (card.body === body)
56642
- continue;
56643
- const witness = Object.freeze({ surface: 'issue-comment', commentId: card.id,
56644
- author: context.trustedBotLogin, target: Object.freeze({ kind: 'issue', number: context.issueNumber }),
56645
- bodyDigest: (0, reply_request_digest_1.replyRequestBodyDigest)(card.body ?? '') });
56646
- if (!await this.cardFreshness.matches(witness))
56647
- throw stale();
56648
- const fresh = await this.issues.readIssue(context.issueNumber);
56649
- nativeClosed = fresh.number === context.issueNumber && fresh.state === 'closed';
57101
+ const verifyClosed = async () => {
57102
+ phase = 'native-fence';
57103
+ const fresh = await read();
56650
57104
  if (!nativeClosed || fresh.reason !== initial.reason)
56651
57105
  throw stale();
56652
- await this.comments.updateComment(context.issueNumber, card.id, body);
56653
- retired++;
57106
+ };
57107
+ for (const card of cards) {
57108
+ const body = (0, retired_progress_presentation_policy_1.buildRetiredProgressComment)(card.body ?? '', context.locale, initial.reason);
57109
+ const verified = await (0, verify_closed_issue_card_retirement_1.verifyClosedIssueCardRetirement)({ issueNumber: context.issueNumber,
57110
+ commentId: card.id, author: context.trustedBotLogin, originalBody: card.body ?? '', finalBody: body,
57111
+ freshness: this.cardFreshness, verifyClosed, onUpdated: () => { retired++; }, phase: value => { phase = value; },
57112
+ update: () => this.comments.updateComment(context.issueNumber, card.id, body) });
57113
+ superseded || (superseded = verified.superseded);
57114
+ remaining--;
56654
57115
  }
56655
- return [this.result(retired, nativeClosed)];
57116
+ await verifyClosed();
57117
+ return [this.result(retired, nativeClosed, superseded)];
56656
57118
  }
56657
57119
  catch (cause) {
56658
57120
  return [new result_1.Result({ id: this.taskId, success: false, executed: retired > 0,
56659
57121
  steps: [nativeClosed ? 'Issue closure is retained; progress card retirement could not be fully verified. Retry the closed-issue event or merged-PR operation.' : 'Native issue closure could not be verified; progress cards were left unchanged.'],
56660
- errors: [(0, application_error_1.toApplicationError)(cause, 'provider.unavailable', 'Unable to retire progress cards safely.')],
57122
+ errors: [(0, closed_issue_reconciliation_error_1.closedIssueReconciliationError)(cause, { resultId: this.taskId, phase, state, reason, changed: retired, remaining })],
56661
57123
  payload: { nativeClosed, retiredCards: retired, reconciled: false } })];
56662
57124
  }
56663
57125
  }
56664
- result(retired, nativeClosed) {
57126
+ result(retired, nativeClosed, superseded = false) {
56665
57127
  return new result_1.Result({ id: this.taskId, success: true, executed: retired > 0,
56666
57128
  steps: [retired ? 'The closed issue’s progress cards were retired.' : 'No progress card required retirement.'],
56667
- payload: { ...(nativeClosed ? { state: 'closed' } : {}), nativeClosed, retiredCards: retired, reconciled: true } });
57129
+ payload: { ...(nativeClosed ? { state: 'closed' } : {}), nativeClosed, retiredCards: retired, reconciled: true, superseded,
57130
+ outcome: nativeClosed ? retired ? 'reconciled' : 'already-converged' : 'not-applicable' } });
56668
57131
  }
56669
57132
  }
56670
57133
  exports.RetireProgressUseCase = RetireProgressUseCase;
@@ -57055,6 +57518,48 @@ function sameLabels(left, right) {
57055
57518
  }
57056
57519
 
57057
57520
 
57521
+ /***/ }),
57522
+
57523
+ /***/ 78813:
57524
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
57525
+
57526
+ "use strict";
57527
+
57528
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
57529
+ exports.verifyClosedIssueCardRetirement = verifyClosedIssueCardRetirement;
57530
+ const reply_request_digest_1 = __nccwpck_require__(47971);
57531
+ const application_error_1 = __nccwpck_require__(75999);
57532
+ /** Adopt another invocation only after the exact final owned body and native closure are fresh. */
57533
+ async function verifyClosedIssueCardRetirement(input) {
57534
+ const witness = (body) => Object.freeze({ surface: 'issue-comment',
57535
+ commentId: input.commentId, author: input.author,
57536
+ target: Object.freeze({ kind: 'issue', number: input.issueNumber }), bodyDigest: (0, reply_request_digest_1.replyRequestBodyDigest)(body) });
57537
+ let updated = false;
57538
+ let failedWrite;
57539
+ if (input.originalBody !== input.finalBody) {
57540
+ input.phase('card-freshness');
57541
+ if (await input.freshness.matches(witness(input.originalBody))) {
57542
+ await input.verifyClosed();
57543
+ input.phase('card-update');
57544
+ try {
57545
+ await input.update();
57546
+ updated = true;
57547
+ input.onUpdated();
57548
+ }
57549
+ catch (cause) {
57550
+ failedWrite = cause;
57551
+ }
57552
+ }
57553
+ }
57554
+ input.phase('card-verification');
57555
+ if (!await input.freshness.matches(witness(input.finalBody))) {
57556
+ throw failedWrite ?? new application_error_1.ApplicationError('workflow.stale', 'The required final owned card could not be verified.');
57557
+ }
57558
+ await input.verifyClosed();
57559
+ return { updated, superseded: !updated && input.originalBody !== input.finalBody };
57560
+ }
57561
+
57562
+
57058
57563
  /***/ }),
57059
57564
 
57060
57565
  /***/ 4643:
@@ -59897,6 +60402,8 @@ function projectInitialSetupContext(source) {
59897
60402
  ...(credentials ? { setupCredentials: deepFreezeCopy(credentials) } : {}),
59898
60403
  ...(remote ? { setupRemoteConfiguration: deepFreezeCopy(remote) } : {}),
59899
60404
  workflowUpdates: Object.freeze(asStringArray(source.inputs?.setupWorkflowUpdates)),
60405
+ ...(source.inputs?.setupVerificationActionState === 'create' || source.inputs?.setupVerificationActionState === 'preserve'
60406
+ ? { verificationActionState: source.inputs.setupVerificationActionState } : {}),
59900
60407
  });
59901
60408
  }
59902
60409
  function projectIssueCommentActionContext(source) {
@@ -60402,6 +60909,7 @@ exports.draftSddMarkdown = draftSddMarkdown;
60402
60909
  const application_error_1 = __nccwpck_require__(75999);
60403
60910
  const pre_branch_sdd_1 = __nccwpck_require__(34730);
60404
60911
  const agent_response_length_failure_1 = __nccwpck_require__(28528);
60912
+ const sdd_draft_consistency_1 = __nccwpck_require__(27910);
60405
60913
  /** Size and typed format failures share one regeneration; the writer still validates every candidate. */
60406
60914
  async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
60407
60915
  const maximum = plan.action === 'update' ? pre_branch_sdd_1.SDD_MAX_UPDATE_CHARACTERS : pre_branch_sdd_1.SDD_MAX_DRAFT_CHARACTERS;
@@ -60413,13 +60921,13 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
60413
60921
  };
60414
60922
  let problem = 'size';
60415
60923
  let formatReason = 'required-heading';
60416
- 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. A justified positive integer sentence of distinct tests or cases is also accepted. Return only the required JSON.`;
60924
+ 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.`;
60417
60925
  for (let attempt = 0; attempt < 2; attempt++) {
60418
60926
  let value;
60419
60927
  try {
60420
60928
  value = await agent.query({
60421
60929
  configuration, agentId: 'pre-branch-sdd-draft',
60422
- 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.`,
60930
+ 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}`,
60423
60931
  options: { expectJson: true, schemaName: 'pre_branch_sdd_draft', schema },
60424
60932
  });
60425
60933
  }
@@ -60453,12 +60961,21 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
60453
60961
  }
60454
60962
  if (problem === 'format')
60455
60963
  throw new application_error_1.ApplicationError('validation.invalid-input', `The SDD draft still violates its ${formatReason} format contract after one bounded repair.`, {
60456
- recovery: { id: 'sdd-draft-format-invalid', variables: {} },
60964
+ recovery: { id: consistencyRecovery(formatReason), variables: {} },
60457
60965
  });
60458
60966
  throw new application_error_1.ApplicationError('validation.invalid-input', 'The SDD draft exceeded its size limit after one bounded repair.', {
60459
60967
  recovery: { id: 'sdd-draft-size-exceeded', variables: {} },
60460
60968
  });
60461
60969
  }
60970
+ function consistencyRecovery(reason) {
60971
+ switch (reason) {
60972
+ case 'case-identity': return 'sdd-draft-case-identity-invalid';
60973
+ case 'case-budget': return 'sdd-draft-case-budget-invalid';
60974
+ case 'requirement-mapping': return 'sdd-draft-requirement-mapping-invalid';
60975
+ case 'repository-path': return 'sdd-draft-repository-path-invalid';
60976
+ default: return 'sdd-draft-format-invalid';
60977
+ }
60978
+ }
60462
60979
 
60463
60980
 
60464
60981
  /***/ }),
@@ -60476,8 +60993,10 @@ const issue_start_policy_1 = __nccwpck_require__(90332);
60476
60993
  const pre_branch_sdd_1 = __nccwpck_require__(34730);
60477
60994
  const recommendation_policy_1 = __nccwpck_require__(39410);
60478
60995
  const logging_ports_1 = __nccwpck_require__(6152);
60996
+ const sdd_analysis_status_policy_1 = __nccwpck_require__(81053);
60479
60997
  const application_error_1 = __nccwpck_require__(75999);
60480
60998
  const pre_branch_sdd_draft_workflow_1 = __nccwpck_require__(93454);
60999
+ const sdd_draft_consistency_1 = __nccwpck_require__(27910);
60481
61000
  const ANALYSIS_SCHEMA = {
60482
61001
  type: 'object',
60483
61002
  properties: {
@@ -60598,11 +61117,21 @@ class PreBranchSddGateUseCase {
60598
61117
  });
60599
61118
  const analysisValue = asRecord(analysis);
60600
61119
  const owners = new Map(snapshot.capabilities.map(capability => [capability.id, capability.specs]));
60601
- const plan = (0, pre_branch_sdd_1.parseSddPlan)(analysisValue, owners);
61120
+ let plan;
61121
+ try {
61122
+ plan = (0, pre_branch_sdd_1.parseSddPlan)(analysisValue, owners);
61123
+ }
61124
+ catch (error) {
61125
+ if (!(error instanceof pre_branch_sdd_1.SddOwnershipFailure))
61126
+ throw error;
61127
+ await this.writeAnalysisStatus(context, allComments, error.reason);
61128
+ 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.`);
61129
+ }
60602
61130
  if (card?.record.branchName && (plan.action !== 'update'
60603
61131
  || plan.path !== card.record.plan.path || plan.capabilityId !== card.record.plan.capabilityId)) {
60604
61132
  throw new Error('An existing linked branch can only revise its owning SDD on the same path.');
60605
61133
  }
61134
+ await this.writeAnalysisStatus(context, allComments);
60606
61135
  const round = publicationRetry ? card.record.round
60607
61136
  : card?.record.phase === 'awaiting-answer' && card.record.issueDigest === digest && !staleAwaiting
60608
61137
  ? card.record.round + (plan.questions.length > 0 ? 1 : 0) : 1;
@@ -60622,9 +61151,19 @@ class PreBranchSddGateUseCase {
60622
61151
  const currentSdd = plan.action === 'update' ? await this.workspace.readSdd(snapshot.baseSha, plan.path) : undefined;
60623
61152
  if (plan.action === 'update' && !currentSdd)
60624
61153
  throw new Error('The catalogued SDD owner is missing from the selected base.');
61154
+ const ownerDocuments = [];
61155
+ for (const path of snapshot.capabilities.find(capability => capability.id === plan.capabilityId)?.specs ?? []) {
61156
+ const markdown = path === plan.path && currentSdd ? currentSdd : await this.workspace.readSdd(snapshot.baseSha, path);
61157
+ if (!markdown)
61158
+ throw new Error('A catalogued owning SDD is unavailable at the selected immutable base.');
61159
+ ownerDocuments.push({ path, markdown });
61160
+ }
61161
+ const reservedCases = JSON.stringify((0, sdd_draft_consistency_1.reservedSddCaseIds)(ownerDocuments));
61162
+ if (reservedCases.length > 30000)
61163
+ throw new Error('The owning SDD case inventory exceeds the bounded drafting context; maintainer review is required.');
60625
61164
  const newCapability = plan.action === 'new' ? parseNewCapability(analysisValue.newCapability, plan) : undefined;
60626
61165
  let prepared;
60627
- await (0, pre_branch_sdd_draft_workflow_1.draftSddMarkdown)(this.agent, context.agentConfiguration, plan, buildDraftPrompt(context, snapshot, plan, answers, currentSdd), async (markdown) => {
61166
+ 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) => {
60628
61167
  prepared = await this.workspace.validateDraft(snapshot, plan, markdown, newCapability);
60629
61168
  });
60630
61169
  if (!prepared)
@@ -60714,6 +61253,20 @@ class PreBranchSddGateUseCase {
60714
61253
  else
60715
61254
  await this.comments.updateComment(issueNumber, cardId, body);
60716
61255
  }
61256
+ async writeAnalysisStatus(context, comments, reason) {
61257
+ const marker = (0, sdd_analysis_status_policy_1.sddAnalysisStatusMarker)(context.issueNumber);
61258
+ const prior = comments.filter(comment => comment.user?.login?.toLowerCase() === context.tokenUser.toLowerCase()
61259
+ && comment.body?.includes(marker)).sort((a, b) => b.id - a.id)[0];
61260
+ if (!reason && !prior)
61261
+ return;
61262
+ const body = (0, sdd_analysis_status_policy_1.renderSddAnalysisStatus)(context.issueNumber, context.issueLocale, reason);
61263
+ if (prior) {
61264
+ if (prior.body !== body)
61265
+ await this.comments.updateComment(context.issueNumber, prior.id, body);
61266
+ }
61267
+ else
61268
+ await this.comments.addComment(context.issueNumber, body);
61269
+ }
60717
61270
  async assertFresh(context, expectedBaseSha, sourceBranch) {
60718
61271
  const [liveBody, liveTitle, snapshot] = await Promise.all([
60719
61272
  this.descriptions.getDescription(context.issueNumber),
@@ -64286,7 +64839,7 @@ function partitionFailureCategory(error) {
64286
64839
  return error instanceof Error ? error.name : 'unknown';
64287
64840
  }
64288
64841
  function suppressDismissedFindings(execution, context, prepared) {
64289
- const activeFindings = (prepared.activeFindings ?? prepared.toPublish).filter((finding) => {
64842
+ const activeFindings = (0, finding_1.retainExistingFindingIds)(prepared.activeFindings ?? prepared.toPublish, context.existingByFindingId).filter((finding) => {
64290
64843
  const existing = (0, finding_1.findExistingFindingInfo)(context.existingByFindingId, finding);
64291
64844
  return existing?.issue?.resolution !== 'dismissed' && existing?.pullRequest?.resolution !== 'dismissed';
64292
64845
  });
@@ -64306,6 +64859,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
64306
64859
  exports.applyDetectedFindings = applyDetectedFindings;
64307
64860
  const mark_findings_resolved_use_case_1 = __nccwpck_require__(96963);
64308
64861
  const publish_findings_use_case_1 = __nccwpck_require__(88442);
64862
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
64309
64863
  const pull_request_review_errors_1 = __nccwpck_require__(46445);
64310
64864
  async function applyDetectedFindings(operation, context, prepared, publicationPorts, resolutionPorts, catalog) {
64311
64865
  try {
@@ -64321,7 +64875,7 @@ async function applyDetectedFindings(operation, context, prepared, publicationPo
64321
64875
  });
64322
64876
  }
64323
64877
  catch (error) {
64324
- const publicationError = error instanceof pull_request_review_errors_1.PullRequestReviewOperationError
64878
+ const publicationError = error instanceof bugbot_mutation_error_1.BugbotMutationError || error instanceof pull_request_review_errors_1.PullRequestReviewOperationError
64325
64879
  ? error
64326
64880
  : new Error("Unable to publish findings.");
64327
64881
  return [publicationError];
@@ -64872,6 +65426,7 @@ function buildPreviousFindingsContext(previousFindings) {
64872
65426
  `;
64873
65427
  const suffix = `
64874
65428
  **Your task 2:** For each finding above, analyze the current code and decide:
65429
+ - 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.
64875
65430
  - If the problem **still exists** (same code or same issue present): do **not** include it in \`resolved_findings\`.
64876
65431
  - If the problem **no longer applies** (e.g. that code was removed or refactored away): include \`{ "id": "<exact id>", "resolution": "obsolete" }\` in \`resolved_findings\`.
64877
65432
  - If the problem **has been fixed** (code was changed and the issue is resolved): include \`{ "id": "<exact id>", "resolution": "fixed" }\` in \`resolved_findings\`.
@@ -64991,6 +65546,10 @@ function buildReviewConversationContext(issueComments, commentsByPullRequest, bo
64991
65546
  omitted,
64992
65547
  truncated: chronological.filter((entry) => entry.truncated).length,
64993
65548
  retained: chronological.length,
65549
+ ...(chronological.some(entry => entry.truncated) ? {
65550
+ truncatedItemIds: chronological.filter(entry => entry.truncated)
65551
+ .map(entry => entry.providerId).filter(id => /^(?:issue:[0-9]+|review:[A-Za-z0-9_=-]+)$/.test(id) && id.length <= 160),
65552
+ } : {}),
64994
65553
  };
64995
65554
  }
64996
65555
  function appendConversationEntry(entries, author, kind, body, createdAt, providerId) {
@@ -66482,6 +67041,7 @@ async function loadBugbotContext(request, ports, resolvedPreflight) {
66482
67041
  itemsFetched: conversationContext.retained + conversationContext.omitted,
66483
67042
  omittedItems: conversationContext.omitted,
66484
67043
  truncatedItems: conversationContext.truncated,
67044
+ ...(conversationContext.truncatedItemIds ? { truncatedItemIds: conversationContext.truncatedItemIds } : {}),
66485
67045
  limitReached: conversationContext.omitted > 0 || conversationContext.truncated > 0,
66486
67046
  },
66487
67047
  {
@@ -66683,11 +67243,11 @@ Object.defineProperty(exports, "markFindingsResolved", ({ enumerable: true, get:
66683
67243
 
66684
67244
  Object.defineProperty(exports, "__esModule", ({ value: true }));
66685
67245
  exports.markFindingsResolved = markFindingsResolved;
66686
- const pull_request_review_errors_1 = __nccwpck_require__(46445);
66687
67246
  const logging_ports_1 = __nccwpck_require__(6152);
66688
67247
  const resolve_issue_finding_1 = __nccwpck_require__(35300);
66689
67248
  const resolve_pull_request_finding_1 = __nccwpck_require__(64567);
66690
67249
  const review_state_1 = __nccwpck_require__(79200);
67250
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
66691
67251
  const application_error_1 = __nccwpck_require__(75999);
66692
67252
  async function markFindingsResolved(param) {
66693
67253
  const errors = [];
@@ -66715,8 +67275,8 @@ async function repairExistingPullRequestFinding(ports, operation, findingId, des
66715
67275
  try {
66716
67276
  await ports.pullRequestComments.unresolvePullRequestReviewThread(destination.pullRequestNumber, destination.commentIdentity);
66717
67277
  }
66718
- catch {
66719
- addResolutionError(errors, 'pull request');
67278
+ catch (cause) {
67279
+ addResolutionError(errors, 'pull request', findingId, cause);
66720
67280
  }
66721
67281
  }
66722
67282
  }
@@ -66730,7 +67290,7 @@ async function resolveIssueIfNeeded(param, findingId, destination, errors) {
66730
67290
  return;
66731
67291
  const comment = param.context.issueComments.find(item => item.id === destination.commentId);
66732
67292
  if (comment?.body == null) {
66733
- addResolutionError(errors, 'issue');
67293
+ addResolutionError(errors, 'issue', findingId);
66734
67294
  return;
66735
67295
  }
66736
67296
  try {
@@ -66741,8 +67301,8 @@ async function resolveIssueIfNeeded(param, findingId, destination, errors) {
66741
67301
  resolution: param.resolvedFindingResolutions?.get(findingId),
66742
67302
  }, param.catalog);
66743
67303
  }
66744
- catch {
66745
- addResolutionError(errors, 'issue');
67304
+ catch (cause) {
67305
+ addResolutionError(errors, 'issue', findingId, cause);
66746
67306
  }
66747
67307
  }
66748
67308
  async function tryResolvePullRequestFinding(ports, findingId, destination, errors, resolution, catalog) {
@@ -66754,17 +67314,14 @@ async function tryResolvePullRequestFinding(ports, findingId, destination, error
66754
67314
  resolution,
66755
67315
  }, catalog);
66756
67316
  }
66757
- catch {
66758
- addResolutionError(errors, 'pull request');
67317
+ catch (cause) {
67318
+ addResolutionError(errors, 'pull request', findingId, cause);
66759
67319
  }
66760
67320
  }
66761
- function addResolutionError(errors, destination) {
66762
- const cause = destination === 'pull request'
66763
- ? new pull_request_review_errors_1.PullRequestReviewOperationError('mark-resolved')
66764
- : new Error('Unable to mark an issue finding as resolved.');
66765
- const semanticError = new application_error_1.ApplicationError('provider.unavailable', destination === 'pull request'
66766
- ? 'Unable to mark a pull request finding as resolved.'
66767
- : 'Unable to mark an issue finding as resolved.', { cause });
67321
+ function addResolutionError(errors, destination, findingId, cause) {
67322
+ const semanticError = destination === 'pull request'
67323
+ ? (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'resolution', [findingId], 'mark-resolved')
67324
+ : new application_error_1.ApplicationError('provider.unavailable', 'Unable to mark an issue finding as resolved.');
66768
67325
  (0, logging_ports_1.logError)(semanticError);
66769
67326
  errors.push(semanticError);
66770
67327
  }
@@ -67017,6 +67574,7 @@ function isRecord(value) {
67017
67574
  */
67018
67575
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67019
67576
  exports.publishFindings = publishFindings;
67577
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
67020
67578
  const finding_1 = __nccwpck_require__(31011);
67021
67579
  const publish_issue_finding_comment_1 = __nccwpck_require__(84950);
67022
67580
  const publish_pr_review_comments_1 = __nccwpck_require__(50352);
@@ -67035,12 +67593,17 @@ async function publishFindings(param) {
67035
67593
  catalog,
67036
67594
  })
67037
67595
  : undefined;
67038
- for (const finding of findings) {
67596
+ for (const finding of (0, finding_1.retainExistingFindingIds)(findings, existingByFindingId)) {
67039
67597
  if (operation.target.issueNumber > 0 && !reviewPublisher) {
67040
67598
  await (0, publish_issue_finding_comment_1.publishIssueFindingComment)(ports.issueComments, operation.target.issueNumber, finding, (0, finding_1.findExistingFindingInfo)(existingByFindingId, finding), commitSha, catalog);
67041
67599
  }
67042
67600
  if (reviewPublisher) {
67043
- await reviewPublisher.publish(finding, (0, finding_1.findExistingFindingInfo)(existingByFindingId, finding));
67601
+ try {
67602
+ await reviewPublisher.publish(finding, (0, finding_1.findExistingFindingInfo)(existingByFindingId, finding));
67603
+ }
67604
+ catch (cause) {
67605
+ throw (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'publication', [finding.id], 'publish-comments');
67606
+ }
67044
67607
  }
67045
67608
  }
67046
67609
  await reviewPublisher?.flush(overflowCount, overflowTitles);
@@ -67112,6 +67675,7 @@ ${catalog.message('bugbot.overflow.body', { count: `**${overflowCount}**` }, ove
67112
67675
 
67113
67676
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67114
67677
  exports.PullRequestReviewCommentPublisher = void 0;
67678
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
67115
67679
  const bugbot_finding_marker_policy_1 = __nccwpck_require__(98024);
67116
67680
  const path_validation_1 = __nccwpck_require__(70124);
67117
67681
  const logging_ports_1 = __nccwpck_require__(6152);
@@ -67183,11 +67747,16 @@ class PullRequestReviewCommentPublisher {
67183
67747
  if (this.findingsToCreate.length === 0 && overflowCount === 0)
67184
67748
  return;
67185
67749
  const { repository, operation, openPrNumber, prContext } = this.options;
67186
- await repository.createReviewWithComments(openPrNumber, prContext.prHeadSha, buildReviewSummary(this.findingsToCreate, this.commentsToCreate.length, this.unanchoredBodies, overflowCount, overflowTitles, operation.analysis.reviewConfiguration.traceRules
67187
- ? this.options.ruleSources ?? []
67188
- : [], operation.analysis.reviewConfiguration.traceRules
67189
- ? this.options.omittedRuleCount ?? 0
67190
- : 0, prContext.prHeadSha, this.catalog), this.commentsToCreate);
67750
+ try {
67751
+ await repository.createReviewWithComments(openPrNumber, prContext.prHeadSha, buildReviewSummary(this.findingsToCreate, this.commentsToCreate.length, this.unanchoredBodies, overflowCount, overflowTitles, operation.analysis.reviewConfiguration.traceRules
67752
+ ? this.options.ruleSources ?? []
67753
+ : [], operation.analysis.reviewConfiguration.traceRules
67754
+ ? this.options.omittedRuleCount ?? 0
67755
+ : 0, prContext.prHeadSha, this.catalog), this.commentsToCreate);
67756
+ }
67757
+ catch (cause) {
67758
+ throw (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'publication', this.findingsToCreate.map(finding => finding.id), 'publish-comments', this.findingsToCreate.length + overflowCount);
67759
+ }
67191
67760
  }
67192
67761
  get catalog() {
67193
67762
  return this.options.catalog ?? (0, bugbot_message_catalog_1.resolveStaticBugbotCatalog)(this.options.operation.locale.pullRequest);
@@ -67343,6 +67912,8 @@ async function queryBugbotPartitionFindings(repository, configuration, prompt, t
67343
67912
 
67344
67913
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67345
67914
  exports.reconcileBugbotReviewState = reconcileBugbotReviewState;
67915
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
67916
+ const finding_1 = __nccwpck_require__(31011);
67346
67917
  const review_projection_1 = __nccwpck_require__(80859);
67347
67918
  const bugbot_reconciliation_policy_1 = __nccwpck_require__(78128);
67348
67919
  const bugbot_provider_projection_policy_1 = __nccwpck_require__(85821);
@@ -67373,11 +67944,12 @@ async function reconcileBugbotReviewState(input) {
67373
67944
  };
67374
67945
  }
67375
67946
  const snapshot = snapshotResult.snapshot;
67947
+ const activeFindings = (0, finding_1.retainExistingFindingIds)(input.activeFindings, input.loadedContext.existingByFindingId);
67948
+ const expectedPublishedFindings = (0, finding_1.retainExistingFindingIds)(input.expectedPublishedFindings ?? input.activeFindings, input.loadedContext.existingByFindingId);
67376
67949
  const diagnostics = [
67377
- ...(input.mutationErrors ?? []).map((error) => ({
67378
- code: 'operation-failed',
67379
- operatorMessage: toSafeOperationMessage(error),
67380
- })),
67950
+ ...(input.mutationErrors ?? []).map((error) => error instanceof bugbot_mutation_error_1.BugbotMutationError
67951
+ ? { code: 'finding-mutation-failed', mutation: error.diagnostic }
67952
+ : { code: 'operation-failed', operatorMessage: toSafeOperationMessage(error) }),
67381
67953
  ...(!input.target.trustedAuthorLogin?.trim()
67382
67954
  ? [{ code: 'identity-unavailable' }]
67383
67955
  : []),
@@ -67386,7 +67958,7 @@ async function reconcileBugbotReviewState(input) {
67386
67958
  const providerProjection = (0, bugbot_provider_projection_policy_1.projectBugbotProviderEvidence)({
67387
67959
  snapshot,
67388
67960
  trustedAuthorLogin: input.target.trustedAuthorLogin,
67389
- activeFindings: input.activeFindings,
67961
+ activeFindings,
67390
67962
  existingByFindingId: input.loadedContext.existingByFindingId,
67391
67963
  });
67392
67964
  const plan = (0, bugbot_reconciliation_policy_1.buildBugbotReconciliationPlan)({
@@ -67396,8 +67968,8 @@ async function reconcileBugbotReviewState(input) {
67396
67968
  id,
67397
67969
  (0, bugbot_finding_marker_policy_1.extractTitleFromBody)(fullBody) || id,
67398
67970
  ])),
67399
- activeFindings: input.activeFindings,
67400
- expectedPublishedFindings: input.expectedPublishedFindings ?? input.activeFindings,
67971
+ activeFindings,
67972
+ expectedPublishedFindings,
67401
67973
  diagnostics,
67402
67974
  coverage: input.loadedContext.coverage,
67403
67975
  });
@@ -67901,14 +68473,16 @@ function toPresentationFailure(diagnostic) {
67901
68473
  const message = (0, bugbot_message_catalog_1.bugbotDiagnosticOperatorMessage)(diagnostic);
67902
68474
  return {
67903
68475
  diagnostic,
67904
- error: diagnostic.code === 'review-updates-pending'
67905
- ? new application_error_1.ApplicationError('workflow.presentation-pending', message, {
67906
- recovery: {
67907
- id: 'bugbot-review-blocks-pending',
67908
- variables: { pendingCount: diagnostic.count },
67909
- },
67910
- })
67911
- : new Error(message),
68476
+ error: diagnostic.code === 'finding-mutation-failed'
68477
+ ? new application_error_1.ApplicationError(diagnostic.mutation.errorCode, message)
68478
+ : diagnostic.code === 'review-updates-pending'
68479
+ ? new application_error_1.ApplicationError('workflow.presentation-pending', message, {
68480
+ recovery: {
68481
+ id: 'bugbot-review-blocks-pending',
68482
+ variables: { pendingCount: diagnostic.count },
68483
+ },
68484
+ })
68485
+ : new Error(message),
67912
68486
  };
67913
68487
  }
67914
68488
  function report(projection, reviewUpdates, pendingReviewUpdates, statusCardOperation, errors) {
@@ -68021,6 +68595,7 @@ exports.runVerifyCommands = runVerifyCommands;
68021
68595
  const logging_ports_1 = __nccwpck_require__(6152);
68022
68596
  const verify_command_policy_1 = __nccwpck_require__(96031);
68023
68597
  const verification_runtime_policy_1 = __nccwpck_require__(89347);
68598
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
68024
68599
  async function runVerifyCommands(commands, execute) {
68025
68600
  for (const command of commands) {
68026
68601
  const result = await executeVerifyCommand(command, execute);
@@ -68040,7 +68615,7 @@ async function executeVerifyCommand(command, execute) {
68040
68615
  : { success: false, failedCommand: formatCommandForDiagnostics(parsed) };
68041
68616
  }
68042
68617
  catch (error) {
68043
- if (error instanceof verification_runtime_policy_1.VerificationPrerequisiteError) {
68618
+ if (error instanceof verification_runtime_policy_1.VerificationPrerequisiteError || error instanceof verification_setup_policy_1.VerificationSetupError) {
68044
68619
  return { success: false, failedCommand: formatCommandForDiagnostics(parsed),
68045
68620
  error: `${error.message} Verification command: ${formatCommandForDiagnostics(parsed)}.` };
68046
68621
  }
@@ -70739,6 +71314,8 @@ exports.CheckPriorityIssueSizeUseCase = CheckPriorityIssueSizeUseCase;
70739
71314
 
70740
71315
  Object.defineProperty(exports, "__esModule", ({ value: true }));
70741
71316
  exports.CloseIssueAfterMergingUseCase = void 0;
71317
+ const reconcile_issue_completion_metadata_1 = __nccwpck_require__(70614);
71318
+ const closed_issue_reconciliation_error_1 = __nccwpck_require__(12183);
70742
71319
  const result_1 = __nccwpck_require__(73817);
70743
71320
  const issue_completion_1 = __nccwpck_require__(31147);
70744
71321
  const application_error_1 = __nccwpck_require__(75999);
@@ -70757,7 +71334,7 @@ class CloseIssueAfterMergingUseCase {
70757
71334
  steps: ['No separate safe linked issue and pull request were found; issue closure was skipped.'] })];
70758
71335
  let closedThisRun = false;
70759
71336
  let nativeClosed = false;
70760
- let labelsChanged = 0;
71337
+ const progress = (0, reconcile_issue_completion_metadata_1.completionRepairProgress)();
70761
71338
  try {
70762
71339
  const pull = await this.issues.readPullRequest(pullNumber);
70763
71340
  if (pull.number !== pullNumber || pull.state !== 'closed' || pull.merged !== true)
@@ -70781,44 +71358,21 @@ class CloseIssueAfterMergingUseCase {
70781
71358
  nativeClosed = facts.state === 'closed';
70782
71359
  if (!nativeClosed || closedThisRun && facts.reason !== 'completed')
70783
71360
  throw stale();
70784
- const fence = async () => {
70785
- const freshFacts = await read();
70786
- const freshPlan = (0, issue_completion_1.planIssueCompletion)(freshFacts, param.completionLabels);
70787
- if (freshPlan.kind !== 'closed' || freshFacts.reason !== facts.reason)
70788
- throw stale();
70789
- return freshPlan;
70790
- };
70791
- const plan = (0, issue_completion_1.planIssueCompletion)(facts, param.completionLabels);
70792
- if (plan.kind !== 'closed')
70793
- throw stale();
70794
- for (const label of plan.remove) {
70795
- const fresh = await fence();
70796
- if (fresh.remove.includes(label)) {
70797
- await target.removeLabel(label);
70798
- labelsChanged++;
70799
- }
70800
- }
70801
- for (const label of plan.add) {
70802
- const fresh = await fence();
70803
- if (fresh.add.includes(label)) {
70804
- await target.addLabel(label);
70805
- labelsChanged++;
70806
- }
70807
- }
70808
- const final = await fence();
70809
- if (final.remove.length || final.add.length)
70810
- throw stale();
70811
- return [new result_1.Result({ id: this.taskId, success: true, executed: closedThisRun || labelsChanged > 0,
71361
+ const repaired = await (0, reconcile_issue_completion_metadata_1.reconcileIssueCompletionMetadata)(target, number, param.completionLabels, progress, facts);
71362
+ nativeClosed = progress.nativeClosed;
71363
+ return [new result_1.Result({ id: this.taskId, success: true, executed: closedThisRun || progress.labelsChanged > 0,
70812
71364
  steps: [`Issue #${number} is closed and its completion metadata was verified after PR #${pullNumber} merged.`],
70813
- payload: { issueCompletion: Object.freeze({ number, nativeClosed, closedThisRun, labelsChanged, reason: facts.reason, reconciled: true }) } })];
71365
+ payload: { issueCompletion: Object.freeze({ number, nativeClosed, closedThisRun, labelsChanged: progress.labelsChanged, ...repaired, reconciled: true }) } })];
70814
71366
  }
70815
71367
  catch (error) {
70816
- const semanticError = (0, application_error_1.toApplicationError)(error, 'provider.unavailable', nativeClosed
70817
- ? 'The issue is closed, but completion metadata could not be fully verified. Retry the verified merged-PR operation.'
70818
- : 'Native issue completion could not be verified. Inspect the linked run before retrying.');
70819
- return [new result_1.Result({ id: this.taskId, success: false, executed: closedThisRun || labelsChanged > 0,
71368
+ if (progress.phase !== 'identity')
71369
+ nativeClosed = progress.nativeClosed;
71370
+ const semanticError = (0, closed_issue_reconciliation_error_1.closedIssueReconciliationError)(error, { resultId: this.taskId,
71371
+ phase: progress.phase, state: progress.state, reason: progress.reason,
71372
+ changed: progress.labelsChanged, remaining: progress.remaining });
71373
+ return [new result_1.Result({ id: this.taskId, success: false, executed: closedThisRun || progress.labelsChanged > 0,
70820
71374
  steps: [nativeClosed ? 'The native issue closure was retained; completion metadata remains unverified.' : 'Native issue completion remains unverified.'],
70821
- errors: [semanticError], payload: { issueCompletion: Object.freeze({ number, nativeClosed, closedThisRun, labelsChanged, reconciled: false }) } })];
71375
+ errors: [semanticError], payload: { issueCompletion: Object.freeze({ number, nativeClosed, closedThisRun, labelsChanged: progress.labelsChanged, reconciled: false }) } })];
70822
71376
  }
70823
71377
  }
70824
71378
  }
@@ -73681,7 +74235,7 @@ function registerSetupCommand(program) {
73681
74235
  .option('--update-workflows', 'Allow setup-managed workflows already in the repository to be updated', false)
73682
74236
  .option('--workflow-pat <token>', 'Workflow PAT for the bot account (prefer the hidden interactive prompt)')
73683
74237
  .option('--secret <name=value>', 'Secret value for non-interactive setup; repeat for each API key', setup_command_options_1.collectSecret, {})
73684
- .addHelpText('after', `\nGuides (open only when you choose):\n Web setup tutorial: ${setup_documentation_1.SETUP_DOCUMENTATION.tutorial}\n First issue-to-PR workflow: ${setup_documentation_1.SETUP_DOCUMENTATION.firstWorkflow}\n Troubleshooting: ${setup_documentation_1.SETUP_DOCUMENTATION.recovery}\n\nDuring interactive setup, type ? for question help and :back to revisit an answer.\n`)
74238
+ .addHelpText('after', `\nGuides (open only when you choose):\n Web setup tutorial: ${setup_documentation_1.SETUP_DOCUMENTATION.tutorial}\n First issue-to-PR workflow: ${setup_documentation_1.SETUP_DOCUMENTATION.firstWorkflow}\n Troubleshooting: ${setup_documentation_1.SETUP_DOCUMENTATION.recovery}\n Verification setup: ${setup_documentation_1.SETUP_DOCUMENTATION.verification}\n\nDuring interactive setup, type ? for question help and :back to revisit an answer.\n`)
73685
74239
  .action(setup_execution_1.executeSetupCommand);
73686
74240
  }
73687
74241
 
@@ -73782,6 +74336,7 @@ async function executeSetupCommand(options) {
73782
74336
  let guardedFiles;
73783
74337
  let webApplySnapshot;
73784
74338
  let approvedWorkflowFiles = [];
74339
+ let verificationActionState;
73785
74340
  let credentialsCollection;
73786
74341
  try {
73787
74342
  if (options.confirmUnverifiableWritePermissions) {
@@ -74028,6 +74583,8 @@ async function executeSetupCommand(options) {
74028
74583
  return 'blocked';
74029
74584
  }
74030
74585
  configuration = result.configuration;
74586
+ const reviewedAction = result.plan.installationReview?.verificationSetup?.action;
74587
+ verificationActionState = reviewedAction === 'create' || reviewedAction === 'preserve' ? reviewedAction : undefined;
74031
74588
  remoteConfiguration = result.remoteConfiguration;
74032
74589
  guardedFiles = webBridge ? (0, setup_configuration_plan_1.setupPlanGuardPaths)(result.plan) : undefined;
74033
74590
  webApplySnapshot = guardedFiles ? (0, setup_apply_snapshot_1.captureSetupApplySnapshot)(checkoutRoot, guardedFiles) : undefined;
@@ -74068,7 +74625,7 @@ async function executeSetupCommand(options) {
74068
74625
  },
74069
74626
  apply: async (report) => {
74070
74627
  (0, logger_1.logInfo)('⚙️ Applying the approved setup plan...');
74071
- const params = (0, setup_policy_1.buildSetupParams)(options, gitInfo, token ?? '', configuration, credentialsCollection, approvedWorkflowFiles, remoteConfiguration, configurationSource);
74628
+ const params = (0, setup_policy_1.buildSetupParams)(options, gitInfo, token ?? '', configuration, credentialsCollection, approvedWorkflowFiles, remoteConfiguration, configurationSource, verificationActionState);
74072
74629
  setupMutationStarted = true;
74073
74630
  setupApplyStarted = true;
74074
74631
  const actionResults = await (0, local_action_1.runLocalAction)(params, {
@@ -74146,7 +74703,7 @@ exports.buildSetupParams = buildSetupParams;
74146
74703
  const action_types_1 = __nccwpck_require__(19625);
74147
74704
  const input_keys_1 = __nccwpck_require__(88539);
74148
74705
  const setup_configuration_policy_1 = __nccwpck_require__(56637);
74149
- function buildSetupParams(options, gitInfo, token, configuration, credentials, approvedWorkflowFiles = [], remoteConfiguration, configurationSource) {
74706
+ function buildSetupParams(options, gitInfo, token, configuration, credentials, approvedWorkflowFiles = [], remoteConfiguration, configurationSource, verificationActionState) {
74150
74707
  return {
74151
74708
  ...(configuration ? (0, setup_configuration_policy_1.buildSetupActionInputs)(configuration) : {}),
74152
74709
  [input_keys_1.INPUT_KEYS.DEBUG]: options.debug?.toString() ?? 'false',
@@ -74163,6 +74720,7 @@ function buildSetupParams(options, gitInfo, token, configuration, credentials, a
74163
74720
  ...(remoteConfiguration ? { setupRemoteConfiguration: remoteConfiguration } : {}),
74164
74721
  ...(configurationSource ? { setupConfigurationSource: configurationSource } : {}),
74165
74722
  setupWorkflowUpdates: approvedWorkflowFiles,
74723
+ ...(verificationActionState ? { setupVerificationActionState: verificationActionState } : {}),
74166
74724
  };
74167
74725
  }
74168
74726
 
@@ -74832,7 +75390,7 @@ const REPOSITORY_STRING_KEYS = new Set([
74832
75390
  'orchestrationPresentationMode',
74833
75391
  'orchestrationCommentMode',
74834
75392
  ]);
74835
- const REPOSITORY_BOOLEAN_KEYS = new Set(['issueManagedBranches', 'preBranchSdd', 'reopenIssueOnPush', 'orchestrationDiagrams']);
75393
+ const REPOSITORY_BOOLEAN_KEYS = new Set(['issueManagedBranches', 'preBranchSdd', 'verificationSetup', 'reopenIssueOnPush', 'orchestrationDiagrams']);
74836
75394
  const REPOSITORY_NUMBER_KEYS = new Set(['desiredAssigneesCount', 'desiredReviewersCount', 'inactivityThresholdHours']);
74837
75395
  const REPOSITORY_STRUCTURED_KEYS = new Set(['mergeQueueCheckAttestations']);
74838
75396
  const AI_STRING_KEYS = new Set(['ignoreFiles', 'pullRequestDescriptionMode', 'bugbotSeverity', 'bugbotFixVerifyCommands', 'bugbotEffort', 'bugbotOrganizationRules', 'provisioningMode']);
@@ -75571,8 +76129,11 @@ function doctorCheckLabel(id, catalog = (0, setup_doctor_message_catalog_1.resol
75571
76129
  Object.defineProperty(exports, "__esModule", ({ value: true }));
75572
76130
  exports.renderSetupInstallationReview = renderSetupInstallationReview;
75573
76131
  const setup_terminal_choice_policy_1 = __nccwpck_require__(64662);
76132
+ const setup_verification_action_summary_policy_1 = __nccwpck_require__(15818);
75574
76133
  function renderSetupInstallationReview(review) {
75575
- return ['Runner routing and installation parity',
76134
+ return [...(0, setup_verification_action_summary_policy_1.setupVerificationActionSummary)(review.verificationSetup),
76135
+ ...(review.verificationSetup ? [`Trusted main branch: ${(0, setup_terminal_choice_policy_1.safeTerminalChoiceText)(review.verificationSetup.mainBranch)}`] : []),
76136
+ 'Runner routing and installation parity',
75576
76137
  'Access and capacity are observations, not runner authentication or runtime verification. Unknown access needs administrator verification; busy/offline keeps the route and waits for capacity.',
75577
76138
  ...review.jobs.map(job => ` ${(0, setup_terminal_choice_policy_1.safeTerminalChoiceText)(job.file)} / ${(0, setup_terminal_choice_policy_1.safeTerminalChoiceText)(job.job)}: ${job.role} · ${job.status}${job.retained ? ' · retained' : ''}\n runs-on: ${(0, setup_terminal_choice_policy_1.safeTerminalChoiceText)(JSON.stringify(job.runsOn))}`),
75578
76139
  'Asset inventory (disabled optional capabilities remain visible):',
@@ -75600,6 +76161,7 @@ class ConsoleSetupJourneyPresenter {
75600
76161
  present(view) {
75601
76162
  console.log(renderSetupJourney(view));
75602
76163
  if (view.outcome === 'complete') {
76164
+ console.log(`Verification setup: inspect .github/actions/copilot-verification-setup/action.yml. Setup creates it only if missing and preserves existing actions. Customize and review on MAIN_BRANCH before enabling VERIFICATION_SETUP, then run a real verification: ${setup_documentation_1.SETUP_DOCUMENTATION.verification}`);
75603
76165
  console.log(`Next: install the reviewed files, then verify your first workflow: ${setup_documentation_1.SETUP_DOCUMENTATION.firstWorkflow}`);
75604
76166
  }
75605
76167
  else if (view.outcome === 'blocked' || view.outcome === 'partial') {
@@ -78173,6 +78735,8 @@ var _ApplicationError_cause;
78173
78735
  Object.defineProperty(exports, "__esModule", ({ value: true }));
78174
78736
  exports.ApplicationError = exports.APPLICATION_ERROR_METADATA = exports.APPLICATION_ERROR_RECOVERY_IDS = void 0;
78175
78737
  exports.isApplicationErrorCorrelationId = isApplicationErrorCorrelationId;
78738
+ const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
78739
+ const approval_evidence_diagnostic_1 = __nccwpck_require__(98205);
78176
78740
  const branch_sync_validation_1 = __nccwpck_require__(90981);
78177
78741
  exports.APPLICATION_ERROR_RECOVERY_IDS = Object.freeze([
78178
78742
  'pull-request-link-restored',
@@ -78187,7 +78751,16 @@ exports.APPLICATION_ERROR_RECOVERY_IDS = Object.freeze([
78187
78751
  'branch-sync-resolution-invalid',
78188
78752
  'sdd-draft-size-exceeded',
78189
78753
  'sdd-draft-format-invalid',
78754
+ 'sdd-draft-case-identity-invalid',
78755
+ 'sdd-draft-case-budget-invalid',
78756
+ 'sdd-draft-requirement-mapping-invalid',
78757
+ 'sdd-draft-repository-path-invalid',
78190
78758
  'workspace-changes-rejected',
78759
+ 'closed-issue-reconciliation-failed',
78760
+ 'approval-evidence-read-failed',
78761
+ 'stored-configuration-schema-missing',
78762
+ 'stored-configuration-schema-unsupported',
78763
+ 'stored-configuration-invalid',
78191
78764
  ]);
78192
78765
  const PRESERVED_STATE = 'Existing persisted state and completed external effects were preserved.';
78193
78766
  const UNCHANGED_STATE = 'No new state or external effect was created.';
@@ -78379,6 +78952,11 @@ class ApplicationError extends Error {
78379
78952
  exports.ApplicationError = ApplicationError;
78380
78953
  _ApplicationError_cause = new WeakMap();
78381
78954
  const RECOVERY_VARIABLE_KEYS = Object.freeze({
78955
+ 'stored-configuration-schema-missing': Object.freeze(['issueNumber', 'expectedVersion']),
78956
+ 'stored-configuration-schema-unsupported': Object.freeze(['issueNumber', 'expectedVersion', 'actualVersion']),
78957
+ 'stored-configuration-invalid': Object.freeze(['issueNumber', 'expectedVersion']),
78958
+ 'closed-issue-reconciliation-failed': Object.freeze(['resultId', 'phase', 'state', 'reason', 'changed', 'remaining']),
78959
+ 'approval-evidence-read-failed': Object.freeze(['operation', 'reason', 'permission']),
78382
78960
  'pull-request-link-restored': Object.freeze([]),
78383
78961
  'pull-request-link-base-retained': Object.freeze([]),
78384
78962
  'pull-request-link-reference-retained': Object.freeze([]),
@@ -78391,6 +78969,10 @@ const RECOVERY_VARIABLE_KEYS = Object.freeze({
78391
78969
  'branch-sync-resolution-invalid': Object.freeze(['validationCode', 'command']),
78392
78970
  'sdd-draft-size-exceeded': Object.freeze([]),
78393
78971
  'sdd-draft-format-invalid': Object.freeze([]),
78972
+ 'sdd-draft-case-identity-invalid': Object.freeze([]),
78973
+ 'sdd-draft-case-budget-invalid': Object.freeze([]),
78974
+ 'sdd-draft-requirement-mapping-invalid': Object.freeze([]),
78975
+ 'sdd-draft-repository-path-invalid': Object.freeze([]),
78394
78976
  'workspace-changes-rejected': Object.freeze([]),
78395
78977
  });
78396
78978
  function normalizeApplicationErrorRecovery(recovery) {
@@ -78406,6 +78988,13 @@ function normalizeApplicationErrorRecovery(recovery) {
78406
78988
  || actualKeys.some((key, index) => key !== expectedKeys[index])) {
78407
78989
  throw new TypeError(`Application error recovery variables are invalid for ${recovery.id}.`);
78408
78990
  }
78991
+ if (recovery.id.startsWith('stored-configuration-')
78992
+ && (![variables.issueNumber, variables.expectedVersion].every(value => typeof value === 'number' && Number.isSafeInteger(value) && value > 0)
78993
+ || (recovery.id === 'stored-configuration-schema-unsupported'
78994
+ && !(typeof variables.actualVersion === 'number'
78995
+ && Number.isSafeInteger(variables.actualVersion) && variables.actualVersion >= 0)))) {
78996
+ throw new TypeError('Stored configuration diagnostic is invalid.');
78997
+ }
78409
78998
  if (recovery.id === 'managed-branch-enrichment-failed'
78410
78999
  && (typeof variables.branchName !== 'string'
78411
79000
  || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,254}$/u.test(variables.branchName))) {
@@ -78431,6 +79020,20 @@ function normalizeApplicationErrorRecovery(recovery) {
78431
79020
  && !branch_sync_validation_1.BRANCH_SYNC_VALIDATION_CODES.some(code => code === variables.validationCode)) {
78432
79021
  throw new TypeError('Application error recovery synchronization validation code is invalid.');
78433
79022
  }
79023
+ if (recovery.id === 'closed-issue-reconciliation-failed'
79024
+ && (!closed_issue_reconciliation_1.CLOSED_ISSUE_RESULTS.some(value => value === variables.resultId)
79025
+ || !closed_issue_reconciliation_1.CLOSED_ISSUE_PHASES.some(value => value === variables.phase)
79026
+ || !['open', 'closed', 'unavailable'].includes(variables.state)
79027
+ || !closed_issue_reconciliation_1.CLOSED_ISSUE_REASONS.some(value => value === variables.reason)
79028
+ || ![variables.changed, variables.remaining].every(value => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 && value <= 3000))) {
79029
+ throw new TypeError('Closed issue reconciliation diagnostic is invalid.');
79030
+ }
79031
+ if (recovery.id === 'approval-evidence-read-failed'
79032
+ && (!Object.prototype.hasOwnProperty.call(approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_PERMISSIONS, variables.operation)
79033
+ || !approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_REASONS.some(reason => reason === variables.reason)
79034
+ || approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_PERMISSIONS[variables.operation] !== variables.permission)) {
79035
+ throw new TypeError('Approval evidence diagnostic is invalid.');
79036
+ }
78434
79037
  return Object.freeze({
78435
79038
  id: recovery.id,
78436
79039
  variables: Object.freeze({ ...variables }),
@@ -78773,6 +79376,7 @@ class Execution {
78773
79376
  this.currentIssueWorkflowAdmission = components.issueWorkflowAdmission;
78774
79377
  this.currentConfiguration.issueWorkflowProfileDigest = components.issueWorkflowProfileDigest;
78775
79378
  this.preBranchSdd = components.preBranchSdd ?? false;
79379
+ this.verificationSetup = components.verificationSetup ?? false;
78776
79380
  }
78777
79381
  }
78778
79382
  exports.Execution = Execution;
@@ -83698,6 +84302,7 @@ function combineOrganizationAccess(secrets, variables) {
83698
84302
 
83699
84303
  Object.defineProperty(exports, "__esModule", ({ value: true }));
83700
84304
  exports.isGithubAlreadyExists = exports.isGithubPermissionDenied = exports.isGithubRateLimited = exports.isGithubNotFound = exports.getGithubErrorStatus = void 0;
84305
+ exports.githubReadErrorCode = githubReadErrorCode;
83701
84306
  const getGithubErrorStatus = (error) => {
83702
84307
  if (typeof error !== "object" || error === null)
83703
84308
  return undefined;
@@ -83707,6 +84312,23 @@ const getGithubErrorStatus = (error) => {
83707
84312
  exports.getGithubErrorStatus = getGithubErrorStatus;
83708
84313
  const isGithubNotFound = (error) => (0, exports.getGithubErrorStatus)(error) === 404;
83709
84314
  exports.isGithubNotFound = isGithubNotFound;
84315
+ /** Maps failed metadata reads without copying untrusted provider text. */
84316
+ function githubReadErrorCode(error) {
84317
+ const status = (0, exports.getGithubErrorStatus)(error);
84318
+ if (status === 401)
84319
+ return 'authorization.credential-invalid';
84320
+ if ((0, exports.isGithubRateLimited)(error))
84321
+ return 'provider.rate-limited';
84322
+ if (status === 403)
84323
+ return 'authorization.denied';
84324
+ if (status === 404)
84325
+ return 'provider.not-found';
84326
+ if (status === 409 || status === 412)
84327
+ return 'provider.conflict';
84328
+ if (status === 400 || status === 422)
84329
+ return 'provider.contract-invalid';
84330
+ return 'provider.unavailable';
84331
+ }
83710
84332
  const isGithubRateLimited = (error) => {
83711
84333
  const status = (0, exports.getGithubErrorStatus)(error);
83712
84334
  if (status === 429)
@@ -84417,8 +85039,9 @@ class IssueContentRepository {
84417
85039
  return issue.body ?? '';
84418
85040
  }
84419
85041
  catch (error) {
84420
- (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', `Unable to read issue #${issueNumber} description.`));
84421
- throw error;
85042
+ const semanticError = (0, application_error_1.toApplicationError)(error, (0, github_error_policy_1.githubReadErrorCode)(error), 'Unable to read the issue or pull-request description.');
85043
+ (0, logger_1.logError)(semanticError);
85044
+ throw semanticError;
84422
85045
  }
84423
85046
  };
84424
85047
  this.getIssueDescription = async (owner, repository, issueNumber, token) => {
@@ -86219,6 +86842,41 @@ function parseApprovalCoverageZip(value) {
86219
86842
  }
86220
86843
 
86221
86844
 
86845
+ /***/ }),
86846
+
86847
+ /***/ 9958:
86848
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
86849
+
86850
+ "use strict";
86851
+
86852
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
86853
+ exports.readApprovalEvidence = readApprovalEvidence;
86854
+ const application_error_1 = __nccwpck_require__(75999);
86855
+ const approval_evidence_error_1 = __nccwpck_require__(50519);
86856
+ const approval_evidence_diagnostic_1 = __nccwpck_require__(98205);
86857
+ /** Terminates provider exceptions; even unknown statuses never interpolate provider text. */
86858
+ async function readApprovalEvidence(operation, read) {
86859
+ try {
86860
+ return await read();
86861
+ }
86862
+ catch (cause) {
86863
+ if (cause instanceof application_error_1.ApplicationError && cause.recovery?.id === 'approval-evidence-read-failed')
86864
+ throw cause;
86865
+ const error = cause && typeof cause === 'object' ? cause : undefined;
86866
+ const response = error?.response;
86867
+ const status = error?.status;
86868
+ const rateLimited = status === 403 && (response?.headers?.['x-ratelimit-remaining'] === '0'
86869
+ || typeof response?.headers?.['retry-after'] === 'string' && /^\d{1,8}$/u.test(response.headers['retry-after']));
86870
+ const http = typeof status === 'number' ? `http-${status}` : undefined;
86871
+ const reason = rateLimited ? 'http-429'
86872
+ : approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_REASONS.some(value => value === http) ? http
86873
+ : cause instanceof application_error_1.ApplicationError && cause.code === 'provider.contract-invalid' ? 'invalid-response'
86874
+ : status === undefined ? 'transport-unavailable' : 'invalid-response';
86875
+ throw (0, approval_evidence_error_1.approvalEvidenceError)(operation, reason);
86876
+ }
86877
+ }
86878
+
86879
+
86222
86880
  /***/ }),
86223
86881
 
86224
86882
  /***/ 55165:
@@ -86253,21 +86911,22 @@ exports.BugbotPullRequestRepository = BugbotPullRequestRepository;
86253
86911
  /***/ }),
86254
86912
 
86255
86913
  /***/ 68742:
86256
- /***/ ((__unused_webpack_module, exports) => {
86914
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
86257
86915
 
86258
86916
  "use strict";
86259
86917
 
86260
86918
  Object.defineProperty(exports, "__esModule", ({ value: true }));
86261
86919
  exports.readCurrentBaseRevision = readCurrentBaseRevision;
86920
+ const application_error_1 = __nccwpck_require__(75999);
86262
86921
  /** PR base metadata can lag a parent push; read the exact native branch ref. */
86263
86922
  async function readCurrentBaseRevision(port, target, baseRef) {
86264
86923
  if (typeof baseRef !== 'string' || baseRef.length === 0 || baseRef.length > 1024
86265
86924
  || baseRef.includes('\u0000') || /[\r\n]/u.test(baseRef))
86266
- throw new Error('The PR base ref is invalid.');
86925
+ throw new application_error_1.ApplicationError('provider.contract-invalid', 'The PR base ref is invalid.');
86267
86926
  const { data } = await port.getRef({ owner: target.owner, repo: target.repository, ref: `heads/${baseRef}` });
86268
86927
  if (data?.ref !== `refs/heads/${baseRef}` || data.object?.type !== 'commit' || typeof data.object.sha !== 'string'
86269
86928
  || !/^[a-f0-9]{40}$/u.test(data.object.sha))
86270
- throw new Error('The PR base ref cannot be verified.');
86929
+ throw new application_error_1.ApplicationError('provider.contract-invalid', 'The PR base ref cannot be verified.');
86271
86930
  return data.object.sha;
86272
86931
  }
86273
86932
 
@@ -86315,6 +86974,9 @@ var __importStar = (this && this.__importStar) || (function () {
86315
86974
  Object.defineProperty(exports, "__esModule", ({ value: true }));
86316
86975
  exports.PullRequestApprovalRepository = void 0;
86317
86976
  exports.readEffectiveApprovalPolicy = readEffectiveApprovalPolicy;
86977
+ const approval_evidence_read_1 = __nccwpck_require__(9958);
86978
+ const approval_evidence_error_1 = __nccwpck_require__(50519);
86979
+ const application_error_1 = __nccwpck_require__(75999);
86318
86980
  const current_base_revision_query_1 = __nccwpck_require__(68742);
86319
86981
  const logging_ports_1 = __nccwpck_require__(6152);
86320
86982
  const github = __importStar(__nccwpck_require__(78227));
@@ -86341,40 +87003,64 @@ class PullRequestApprovalRepository {
86341
87003
  }
86342
87004
  }
86343
87005
  async readPolicy(target) {
86344
- return (await this.readEffectivePolicy(target))?.value;
87006
+ return (0, approval_evidence_read_1.readApprovalEvidence)('policy', async () => (await this.readEffectivePolicy(target))?.value);
86345
87007
  }
86346
87008
  async readEffectivePolicy(target) {
86347
87009
  return readEffectiveApprovalPolicy(this.octokit, target);
86348
87010
  }
86349
87011
  async loadEvidence(target) {
86350
- const { data: pull } = await this.octokit.rest.pulls.get({
86351
- owner: target.owner, repo: target.repository, pull_number: target.pullNumber,
87012
+ const diagnostics = [];
87013
+ const { data: pull } = await (0, approval_evidence_read_1.readApprovalEvidence)('pull-request', async () => {
87014
+ const response = await this.octokit.rest.pulls.get({ owner: target.owner, repo: target.repository, pull_number: target.pullNumber });
87015
+ if (!response.data?.head || !response.data?.base || typeof response.data.head.sha !== 'string'
87016
+ || typeof response.data.head.ref !== 'string' || !Number.isSafeInteger(response.data.number)) {
87017
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('pull-request', 'invalid-response');
87018
+ }
87019
+ return response;
86352
87020
  });
86353
87021
  const headSha = pull.head.sha;
86354
87022
  const baseSha = await this.readCurrentBaseSha(target, pull.base.ref);
86355
- const policy = (0, pull_request_approval_policy_1.parsePullRequestApprovalPolicy)(await this.readPolicy(target));
87023
+ const policy = await (0, approval_evidence_read_1.readApprovalEvidence)('policy', async () => {
87024
+ const raw = await this.readPolicy(target);
87025
+ try {
87026
+ return (0, pull_request_approval_policy_1.parsePullRequestApprovalPolicy)(raw);
87027
+ }
87028
+ catch {
87029
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('policy', 'invalid-response');
87030
+ }
87031
+ });
86356
87032
  let testedMergeSha;
86357
87033
  if (pull.mergeable === true && /^[a-f0-9]{40}$/iu.test(pull.merge_commit_sha ?? '')) {
86358
87034
  try {
86359
- const merge = await this.octokit.rest.git.getCommit({
86360
- owner: target.owner, repo: target.repository, commit_sha: pull.merge_commit_sha,
87035
+ const merge = await (0, approval_evidence_read_1.readApprovalEvidence)('merge-commit', async () => {
87036
+ const response = await this.octokit.rest.git.getCommit({ owner: target.owner, repo: target.repository, commit_sha: pull.merge_commit_sha });
87037
+ if (!Array.isArray(response.data?.parents))
87038
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('merge-commit', 'invalid-response');
87039
+ return response;
86361
87040
  });
86362
87041
  if (merge.data.parents[0]?.sha === baseSha && merge.data.parents[1]?.sha === headSha
86363
87042
  && merge.data.parents.length === 2)
86364
87043
  testedMergeSha = pull.merge_commit_sha;
86365
87044
  }
86366
- catch { /* Missing or unreadable merge parentage is non-authorizing. */ }
87045
+ catch (cause) {
87046
+ collectDiagnostic(diagnostics, cause);
87047
+ }
86367
87048
  }
86368
87049
  const [files, reviews, comments, headChecks, mergeChecks, headRuns, mergeRuns, rules, user] = await Promise.all([
86369
- this.allPages(this.octokit.rest.pulls.listFiles, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
86370
- this.allPages(this.octokit.rest.pulls.listReviews, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
86371
- this.allPages(this.octokit.rest.issues.listComments, { owner: target.owner, repo: target.repository, issue_number: target.pullNumber }),
86372
- this.allPages(this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: headSha, filter: 'all' }),
86373
- testedMergeSha ? this.allPages(this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: testedMergeSha, filter: 'all' }) : Promise.resolve([]),
86374
- this.allPages(this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: headSha }),
86375
- testedMergeSha ? this.allPages(this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: testedMergeSha }) : Promise.resolve([]),
86376
- this.effectiveRules(target.owner, target.repository, pull.base.ref),
86377
- this.octokit.rest.users.getAuthenticated(),
87050
+ this.allPages('files', this.octokit.rest.pulls.listFiles, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
87051
+ this.allPages('reviews', this.octokit.rest.pulls.listReviews, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
87052
+ this.allPages('comments', this.octokit.rest.issues.listComments, { owner: target.owner, repo: target.repository, issue_number: target.pullNumber }),
87053
+ this.allPages('head-checks', this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: headSha, filter: 'all' }),
87054
+ testedMergeSha ? this.allPages('merge-checks', this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: testedMergeSha, filter: 'all' }) : Promise.resolve([]),
87055
+ this.allPages('head-runs', this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: headSha }),
87056
+ testedMergeSha ? this.allPages('merge-runs', this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: testedMergeSha }) : Promise.resolve([]),
87057
+ this.effectiveRules(target.owner, target.repository, pull.base.ref, diagnostics),
87058
+ (0, approval_evidence_read_1.readApprovalEvidence)('authenticated-user', async () => {
87059
+ const response = await this.octokit.rest.users.getAuthenticated();
87060
+ if (!Number.isSafeInteger(response.data?.id) || response.data.id < 1)
87061
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('authenticated-user', 'invalid-response');
87062
+ return response;
87063
+ }),
86378
87064
  ]);
86379
87065
  const branch = Object.entries(this.settings.branchPrefixes)
86380
87066
  .find(([, prefix]) => pull.head.ref.startsWith(`${prefix}/`));
@@ -86395,7 +87081,7 @@ class PullRequestApprovalRepository {
86395
87081
  });
86396
87082
  const currentJobs = await Promise.all(latestRuns.map(async (run) => ({
86397
87083
  run,
86398
- jobs: await this.allPages(this.octokit.rest.actions.listJobsForWorkflowRunAttempt, {
87084
+ jobs: await this.allPages('jobs', this.octokit.rest.actions.listJobsForWorkflowRunAttempt, {
86399
87085
  owner: target.owner, repo: target.repository, run_id: run.id, attempt_number: run.run_attempt,
86400
87086
  }),
86401
87087
  })));
@@ -86426,9 +87112,10 @@ class PullRequestApprovalRepository {
86426
87112
  submittedAt: review.submitted_at ?? '',
86427
87113
  }));
86428
87114
  const numericCoverage = policy.coverage.mode === 'numeric'
86429
- ? await this.numericCoverage(target, policy.coverage.artifactWorkflowName, headSha, baseSha, testedMergeSha, workflowRuns)
87115
+ ? await this.numericCoverage(target, policy.coverage.artifactWorkflowName, headSha, baseSha, testedMergeSha, workflowRuns, diagnostics)
86430
87116
  : undefined;
86431
87117
  return {
87118
+ ...(diagnostics.length ? { diagnostics: Object.freeze(diagnostics) } : {}),
86432
87119
  repositoryId: pull.base.repo?.id ?? 0,
86433
87120
  pullNumber: pull.number,
86434
87121
  headSha,
@@ -86462,7 +87149,7 @@ class PullRequestApprovalRepository {
86462
87149
  ...(numericCoverage ? { numericCoverage } : {}),
86463
87150
  };
86464
87151
  }
86465
- async numericCoverage(target, workflowName, headSha, baseSha, testedMergeSha, workflowRuns) {
87152
+ async numericCoverage(target, workflowName, headSha, baseSha, testedMergeSha, workflowRuns, diagnostics) {
86466
87153
  const candidates = workflowRuns.filter(run => run.name === workflowName
86467
87154
  && (run.head_sha === headSha || run.head_sha === testedMergeSha));
86468
87155
  const mergeCandidates = candidates.filter(run => run.head_sha === testedMergeSha);
@@ -86471,25 +87158,27 @@ class PullRequestApprovalRepository {
86471
87158
  if (!run || run.conclusion !== 'success' || run.status !== 'completed')
86472
87159
  return undefined;
86473
87160
  try {
86474
- const artifacts = await this.allPages(this.octokit.rest.actions.listWorkflowRunArtifacts, {
87161
+ const artifacts = await this.allPages('coverage-artifacts', this.octokit.rest.actions.listWorkflowRunArtifacts, {
86475
87162
  owner: target.owner, repo: target.repository, run_id: run.id,
86476
87163
  });
86477
87164
  const matches = artifacts.filter(artifact => artifact.name === 'copilot-diff-coverage-v1' && !artifact.expired);
86478
87165
  if (matches.length !== 1 || matches[0].size_in_bytes > 64 * 1024)
86479
- return undefined;
86480
- const response = await this.octokit.rest.actions.downloadArtifact({
87166
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('coverage-artifacts', 'artifact-unavailable');
87167
+ const response = await (0, approval_evidence_read_1.readApprovalEvidence)('coverage-download', async () => this.octokit.rest.actions.downloadArtifact({
86481
87168
  owner: target.owner, repo: target.repository, artifact_id: matches[0].id, archive_format: 'zip',
86482
- });
87169
+ }));
86483
87170
  const data = response.data;
86484
87171
  const bytes = data instanceof ArrayBuffer ? new Uint8Array(data)
86485
87172
  : data instanceof Uint8Array ? data
86486
87173
  : typeof data === 'string' ? Buffer.from(data, 'binary') : undefined;
86487
87174
  const attestation = bytes ? (0, approval_coverage_artifact_1.parseApprovalCoverageZip)(bytes) : undefined;
86488
- if (!attestation || attestation.repositoryId !== target.repositoryId
87175
+ if (!attestation)
87176
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('coverage-parse', 'artifact-invalid');
87177
+ if (attestation.repositoryId !== target.repositoryId
86489
87178
  || attestation.pullNumber !== target.pullNumber || attestation.headSha !== headSha
86490
87179
  || attestation.baseSha !== baseSha || attestation.workflowRunId !== run.id
86491
87180
  || attestation.workflowRunAttempt !== run.run_attempt)
86492
- return undefined;
87181
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('coverage-parse', 'artifact-mismatch');
86493
87182
  return {
86494
87183
  coveredChangedLines: attestation.coveredChangedLines,
86495
87184
  totalChangedLines: attestation.totalChangedLines,
@@ -86497,7 +87186,8 @@ class PullRequestApprovalRepository {
86497
87186
  baseSha,
86498
87187
  };
86499
87188
  }
86500
- catch {
87189
+ catch (cause) {
87190
+ collectDiagnostic(diagnostics, cause);
86501
87191
  return undefined;
86502
87192
  }
86503
87193
  }
@@ -86523,7 +87213,7 @@ class PullRequestApprovalRepository {
86523
87213
  throw new Error('PR head or base changed before assessment publication.');
86524
87214
  }
86525
87215
  const user = await this.octokit.rest.users.getAuthenticated();
86526
- const comments = await this.allPages(this.octokit.rest.issues.listComments, {
87216
+ const comments = await this.allPages('comments', this.octokit.rest.issues.listComments, {
86527
87217
  owner: target.owner, repo: target.repository, issue_number: target.pullNumber,
86528
87218
  });
86529
87219
  const card = [...comments].reverse().find(comment => comment.user?.id === user.data.id
@@ -86569,24 +87259,26 @@ class PullRequestApprovalRepository {
86569
87259
  }
86570
87260
  }
86571
87261
  async readCurrentBaseSha(target, baseRef) {
86572
- return (0, current_base_revision_query_1.readCurrentBaseRevision)(this.octokit.rest.git, target, baseRef);
87262
+ return (0, approval_evidence_read_1.readApprovalEvidence)('base-ref', () => (0, current_base_revision_query_1.readCurrentBaseRevision)(this.octokit.rest.git, target, baseRef));
86573
87263
  }
86574
- async effectiveRules(owner, repo, branch) {
87264
+ async effectiveRules(owner, repo, branch, diagnostics) {
86575
87265
  try {
86576
- const rulesResponse = await this.octokit.request('GET /repos/{owner}/{repo}/rules/branches/{branch}', { owner, repo, branch });
87266
+ const rulesResponse = await (0, approval_evidence_read_1.readApprovalEvidence)('rules', async () => this.octokit.request('GET /repos/{owner}/{repo}/rules/branches/{branch}', { owner, repo, branch }));
86577
87267
  if (!Array.isArray(rulesResponse.data) || rulesResponse.data.some((rule) => !record(rule)
86578
87268
  || typeof record(rule)?.type !== 'string' || record(rule)?.type === '')) {
86579
- throw new Error('GitHub returned an invalid effective rules inventory.');
87269
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('rules', 'invalid-response');
86580
87270
  }
86581
87271
  const rules = rulesResponse.data;
86582
87272
  let classic;
86583
87273
  try {
86584
87274
  const response = await this.octokit.rest.repos.getBranchProtection({ owner, repo, branch });
87275
+ if (!record(response.data))
87276
+ throw (0, approval_evidence_error_1.approvalEvidenceError)('classic-protection', 'invalid-response');
86585
87277
  classic = response.data;
86586
87278
  }
86587
87279
  catch (error) {
86588
87280
  if (statusOf(error) !== 404)
86589
- throw error;
87281
+ await (0, approval_evidence_read_1.readApprovalEvidence)('classic-protection', async () => { throw error; });
86590
87282
  }
86591
87283
  const reviewRules = rules.filter(rule => rule.type === 'pull_request');
86592
87284
  const classicReview = classic?.required_pull_request_reviews;
@@ -86612,23 +87304,26 @@ class PullRequestApprovalRepository {
86612
87304
  }
86613
87305
  return { readable: true, dismissesStaleReviews: hasStaleRule && allStale, requiredChecks: [...requiredChecks] };
86614
87306
  }
86615
- catch {
87307
+ catch (cause) {
87308
+ collectDiagnostic(diagnostics, cause);
86616
87309
  return { readable: false, dismissesStaleReviews: false, requiredChecks: [] };
86617
87310
  }
86618
87311
  }
86619
- async allPages(method, params) {
86620
- const result = [];
86621
- for await (const response of this.octokit.paginate.iterator(method, { ...params, per_page: 100 })) {
86622
- const page = Array.isArray(response.data) ? response.data
86623
- : record(response.data)?.check_runs ?? record(response.data)?.workflow_runs
86624
- ?? record(response.data)?.artifacts ?? record(response.data)?.jobs;
86625
- if (!Array.isArray(page))
86626
- throw new Error('GitHub pagination returned an invalid page.');
86627
- result.push(...page);
86628
- if (result.length > 3000)
86629
- throw new Error('Approval evidence pagination exceeded the safe bound.');
86630
- }
86631
- return result;
87312
+ async allPages(operation, method, params) {
87313
+ return (0, approval_evidence_read_1.readApprovalEvidence)(operation, async () => {
87314
+ const result = [];
87315
+ for await (const response of this.octokit.paginate.iterator(method, { ...params, per_page: 100 })) {
87316
+ const page = Array.isArray(response.data) ? response.data
87317
+ : record(response.data)?.check_runs ?? record(response.data)?.workflow_runs
87318
+ ?? record(response.data)?.artifacts ?? record(response.data)?.jobs;
87319
+ if (!Array.isArray(page))
87320
+ throw (0, approval_evidence_error_1.approvalEvidenceError)(operation, 'invalid-page');
87321
+ result.push(...page);
87322
+ if (result.length > 3000)
87323
+ throw (0, approval_evidence_error_1.approvalEvidenceError)(operation, 'page-limit');
87324
+ }
87325
+ return result;
87326
+ });
86632
87327
  }
86633
87328
  }
86634
87329
  exports.PullRequestApprovalRepository = PullRequestApprovalRepository;
@@ -86665,7 +87360,7 @@ function array(value) { return Array.isArray(value) ? value : []; }
86665
87360
  async function readEffectiveApprovalPolicy(octokit, target) {
86666
87361
  const admit = (source, value) => {
86667
87362
  if (typeof value !== 'string' || value.length > 65536)
86668
- throw new Error('Approval policy response is malformed or unbounded.');
87363
+ throw new application_error_1.ApplicationError('provider.contract-invalid', 'Approval policy response is malformed or unbounded.');
86669
87364
  return { source, value };
86670
87365
  };
86671
87366
  try {
@@ -86689,6 +87384,14 @@ async function readEffectiveApprovalPolicy(octokit, target) {
86689
87384
  throw error;
86690
87385
  }
86691
87386
  }
87387
+ function collectDiagnostic(diagnostics, cause) {
87388
+ if (cause instanceof application_error_1.ApplicationError && cause.recovery?.id === 'approval-evidence-read-failed') {
87389
+ diagnostics.push(cause.recovery.variables);
87390
+ }
87391
+ else {
87392
+ diagnostics.push((0, approval_evidence_error_1.approvalEvidenceError)('evidence', 'invalid-response').recovery.variables);
87393
+ }
87394
+ }
86692
87395
 
86693
87396
 
86694
87397
  /***/ }),
@@ -86700,8 +87403,8 @@ async function readEffectiveApprovalPolicy(octokit, target) {
86700
87403
 
86701
87404
  Object.defineProperty(exports, "__esModule", ({ value: true }));
86702
87405
  exports.PullRequestChangesRepository = void 0;
87406
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
86703
87407
  const logger_1 = __nccwpck_require__(91151);
86704
- const pull_request_review_errors_1 = __nccwpck_require__(46445);
86705
87408
  const github_pagination_policy_1 = __nccwpck_require__(44812);
86706
87409
  const application_error_1 = __nccwpck_require__(75999);
86707
87410
  class PullRequestChangesRepository {
@@ -86714,7 +87417,7 @@ class PullRequestChangesRepository {
86714
87417
  }
86715
87418
  catch (error) {
86716
87419
  (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request review diff.'));
86717
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-files');
87420
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-files');
86718
87421
  }
86719
87422
  };
86720
87423
  this.getBoundedBugbotReviewDiffSnapshot = async (owner, repository, pullNumber, token) => {
@@ -86756,7 +87459,7 @@ class PullRequestChangesRepository {
86756
87459
  }
86757
87460
  catch (error) {
86758
87461
  (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request review diff.'));
86759
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-files');
87462
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-files');
86760
87463
  }
86761
87464
  };
86762
87465
  /** Head commit SHA of the PR (for creating review). */
@@ -86775,7 +87478,7 @@ class PullRequestChangesRepository {
86775
87478
  }
86776
87479
  catch (error) {
86777
87480
  (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request head SHA.'));
86778
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "get-head-sha");
87481
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "get-head-sha");
86779
87482
  }
86780
87483
  };
86781
87484
  }
@@ -87118,6 +87821,7 @@ function toBugbotPullRequestIdentity(value) {
87118
87821
 
87119
87822
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87120
87823
  exports.PullRequestReviewCommentCommandRepository = void 0;
87824
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
87121
87825
  const pull_request_review_errors_1 = __nccwpck_require__(46445);
87122
87826
  const github_pagination_policy_1 = __nccwpck_require__(44812);
87123
87827
  class PullRequestReviewCommentCommandRepository {
@@ -87186,7 +87890,7 @@ class PullRequestReviewCommentCommandRepository {
87186
87890
  const context = comments.length > 0
87187
87891
  ? { failedCount: comments.length, totalCount: comments.length }
87188
87892
  : undefined;
87189
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "publish-comments", context);
87893
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "publish-comments", context);
87190
87894
  }
87191
87895
  }
87192
87896
  async updatePullRequestReview(owner, repository, pullRequestNumber, reviewIdentity, body, token) {
@@ -87207,7 +87911,7 @@ class PullRequestReviewCommentCommandRepository {
87207
87911
  throw new pull_request_review_errors_1.PullRequestReviewOperationError('update-review');
87208
87912
  }
87209
87913
  catch (error) {
87210
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'update-review');
87914
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'update-review');
87211
87915
  }
87212
87916
  }
87213
87917
  async updatePullRequestReviewComment(_owner, _repository, commentIdentity, body, token) {
@@ -87226,7 +87930,7 @@ class PullRequestReviewCommentCommandRepository {
87226
87930
  }
87227
87931
  }
87228
87932
  catch (error) {
87229
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "update-comment");
87933
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "update-comment");
87230
87934
  }
87231
87935
  }
87232
87936
  }
@@ -87242,7 +87946,7 @@ exports.PullRequestReviewCommentCommandRepository = PullRequestReviewCommentComm
87242
87946
 
87243
87947
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87244
87948
  exports.PullRequestReviewCommentQueryRepository = void 0;
87245
- const pull_request_review_errors_1 = __nccwpck_require__(46445);
87949
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
87246
87950
  const github_pagination_policy_1 = __nccwpck_require__(44812);
87247
87951
  function toReviewComment(comment) {
87248
87952
  if (typeof comment.node_id !== "string" || comment.node_id.length === 0) {
@@ -87298,7 +88002,7 @@ class PullRequestReviewCommentQueryRepository {
87298
88002
  return comments;
87299
88003
  }
87300
88004
  catch (error) {
87301
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "list-comments");
88005
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-comments");
87302
88006
  }
87303
88007
  }
87304
88008
  async listBugbotPullRequestReviewCommentsBounded(owner, repository, pullRequestNumber, token) {
@@ -87341,7 +88045,7 @@ class PullRequestReviewCommentQueryRepository {
87341
88045
  };
87342
88046
  }
87343
88047
  catch (error) {
87344
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "list-comments");
88048
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-comments");
87345
88049
  }
87346
88050
  }
87347
88051
  async listPullRequestReviews(owner, repository, pullRequestNumber, token) {
@@ -87355,7 +88059,7 @@ class PullRequestReviewCommentQueryRepository {
87355
88059
  return reviews;
87356
88060
  }
87357
88061
  catch (error) {
87358
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-reviews');
88062
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-reviews');
87359
88063
  }
87360
88064
  }
87361
88065
  async getPullRequestReviewCommentBody(owner, repository, _pullRequestNumber, commentId, token) {
@@ -87369,13 +88073,37 @@ class PullRequestReviewCommentQueryRepository {
87369
88073
  return data.body ?? null;
87370
88074
  }
87371
88075
  catch (error) {
87372
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "get-comment");
88076
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "get-comment");
87373
88077
  }
87374
88078
  }
87375
88079
  }
87376
88080
  exports.PullRequestReviewCommentQueryRepository = PullRequestReviewCommentQueryRepository;
87377
88081
 
87378
88082
 
88083
+ /***/ }),
88084
+
88085
+ /***/ 54354:
88086
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
88087
+
88088
+ "use strict";
88089
+
88090
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
88091
+ exports.toPullRequestReviewOperationError = toPullRequestReviewOperationError;
88092
+ const pull_request_review_errors_1 = __nccwpck_require__(46445);
88093
+ /** Only safe HTTP metadata crosses the provider boundary; provider prose never does. */
88094
+ function toPullRequestReviewOperationError(error, operation, context) {
88095
+ if (!error || typeof error !== 'object')
88096
+ return (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, operation, context);
88097
+ const record = error;
88098
+ return (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, operation, {
88099
+ ...context,
88100
+ ...(typeof record.status === 'number' ? { providerStatus: record.status } : {}),
88101
+ ...(typeof record.response?.headers?.['x-github-request-id'] === 'string'
88102
+ ? { providerReference: record.response.headers['x-github-request-id'] } : {}),
88103
+ });
88104
+ }
88105
+
88106
+
87379
88107
  /***/ }),
87380
88108
 
87381
88109
  /***/ 2307:
@@ -87486,6 +88214,7 @@ function nextConnectionCursor(pageInfo, seenCursors) {
87486
88214
 
87487
88215
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87488
88216
  exports.PullRequestReviewThreadRepository = void 0;
88217
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
87489
88218
  const logger_1 = __nccwpck_require__(91151);
87490
88219
  const pull_request_review_errors_1 = __nccwpck_require__(46445);
87491
88220
  const pull_request_review_thread_locator_1 = __nccwpck_require__(2307);
@@ -87533,7 +88262,7 @@ class PullRequestReviewThreadRepository {
87533
88262
  return states;
87534
88263
  }
87535
88264
  catch (error) {
87536
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-threads');
88265
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-threads');
87537
88266
  }
87538
88267
  };
87539
88268
  this.listBugbotPullRequestReviewThreadStatesBounded = async (owner, repository, pullNumber, token) => {
@@ -87602,7 +88331,7 @@ class PullRequestReviewThreadRepository {
87602
88331
  };
87603
88332
  }
87604
88333
  catch (error) {
87605
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-threads');
88334
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-threads');
87606
88335
  }
87607
88336
  };
87608
88337
  this.resolvePullRequestReviewThread = async (owner, repository, pullNumber, commentIdentity, token) => {
@@ -87626,7 +88355,7 @@ class PullRequestReviewThreadRepository {
87626
88355
  (0, logger_1.logDebugInfo)('Resolved pull request review thread.');
87627
88356
  }
87628
88357
  catch (error) {
87629
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'resolve-thread');
88358
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'resolve-thread');
87630
88359
  }
87631
88360
  };
87632
88361
  this.unresolvePullRequestReviewThread = async (owner, repository, pullNumber, commentIdentity, token) => {
@@ -87650,7 +88379,7 @@ class PullRequestReviewThreadRepository {
87650
88379
  (0, logger_1.logDebugInfo)('Reopened pull request review thread.');
87651
88380
  }
87652
88381
  catch (error) {
87653
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'unresolve-thread');
88382
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'unresolve-thread');
87654
88383
  }
87655
88384
  };
87656
88385
  }
@@ -87667,7 +88396,7 @@ exports.PullRequestReviewThreadRepository = PullRequestReviewThreadRepository;
87667
88396
 
87668
88397
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87669
88398
  exports.PullRequestReviewerRepository = void 0;
87670
- const pull_request_review_errors_1 = __nccwpck_require__(46445);
88399
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
87671
88400
  const github_pagination_policy_1 = __nccwpck_require__(44812);
87672
88401
  const COMPLETED_REVIEW_STATES = new Set([
87673
88402
  "APPROVED",
@@ -87700,7 +88429,7 @@ class PullRequestReviewerRepository {
87700
88429
  return [...reviewers.values()];
87701
88430
  }
87702
88431
  catch (error) {
87703
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "list-reviewers");
88432
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-reviewers");
87704
88433
  }
87705
88434
  }
87706
88435
  async addReviewersToPullRequest(owner, repository, pullRequestNumber, reviewers, token) {
@@ -87725,7 +88454,7 @@ class PullRequestReviewerRepository {
87725
88454
  return [...confirmed.values()];
87726
88455
  }
87727
88456
  catch (error) {
87728
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "request-reviewers");
88457
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "request-reviewers");
87729
88458
  }
87730
88459
  }
87731
88460
  async listRequestedReviewers(client, parameters) {
@@ -88929,6 +89658,44 @@ class AgentResponseLengthFailure extends Error {
88929
89658
  exports.AgentResponseLengthFailure = AgentResponseLengthFailure;
88930
89659
 
88931
89660
 
89661
+ /***/ }),
89662
+
89663
+ /***/ 98205:
89664
+ /***/ ((__unused_webpack_module, exports) => {
89665
+
89666
+ "use strict";
89667
+
89668
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
89669
+ exports.APPROVAL_EVIDENCE_REASONS = exports.APPROVAL_EVIDENCE_PERMISSIONS = void 0;
89670
+ /** Closed vocabulary: no provider text, URLs, headers, policy values or credentials. */
89671
+ exports.APPROVAL_EVIDENCE_PERMISSIONS = Object.freeze({
89672
+ 'evidence': 'repository-read',
89673
+ 'pull-request': 'pull-requests-read',
89674
+ 'base-ref': 'contents-read',
89675
+ 'merge-commit': 'contents-read',
89676
+ 'policy': 'actions-variables-read',
89677
+ 'files': 'pull-requests-read',
89678
+ 'reviews': 'pull-requests-read',
89679
+ 'comments': 'issues-read',
89680
+ 'head-checks': 'checks-read',
89681
+ 'merge-checks': 'checks-read',
89682
+ 'head-runs': 'actions-read',
89683
+ 'merge-runs': 'actions-read',
89684
+ 'jobs': 'actions-read',
89685
+ 'rules': 'metadata-read',
89686
+ 'classic-protection': 'administration-read',
89687
+ 'authenticated-user': 'authenticated-user-read',
89688
+ 'coverage-artifacts': 'actions-read',
89689
+ 'coverage-download': 'actions-read',
89690
+ 'coverage-parse': 'actions-read',
89691
+ });
89692
+ exports.APPROVAL_EVIDENCE_REASONS = Object.freeze([
89693
+ 'http-400', 'http-401', 'http-403', 'http-404', 'http-409', 'http-422', 'http-429',
89694
+ 'http-500', 'http-502', 'http-503', 'http-504', 'transport-unavailable',
89695
+ 'invalid-response', 'invalid-page', 'page-limit', 'artifact-unavailable', 'artifact-invalid', 'artifact-mismatch',
89696
+ ]);
89697
+
89698
+
88932
89699
  /***/ }),
88933
89700
 
88934
89701
  /***/ 51114:
@@ -89105,10 +89872,15 @@ function matchesConstrainedHead(target, candidate) {
89105
89872
  /***/ }),
89106
89873
 
89107
89874
  /***/ 31011:
89108
- /***/ ((__unused_webpack_module, exports) => {
89875
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
89109
89876
 
89110
89877
  "use strict";
89111
89878
 
89879
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
89880
+ exports.isExistingFindingFullyResolved = isExistingFindingFullyResolved;
89881
+ exports.findExistingFindingInfo = findExistingFindingInfo;
89882
+ exports.findExistingFindingMatch = findExistingFindingMatch;
89883
+ exports.retainExistingFindingIds = retainExistingFindingIds;
89112
89884
  /**
89113
89885
  * Provider-neutral Bugbot finding and durable identity contracts.
89114
89886
  *
@@ -89116,9 +89888,7 @@ function matchesConstrainedHead(target, candidate) {
89116
89888
  * them in the domain prevents policies from depending on a particular use-case
89117
89889
  * folder and gives every adapter one stable semantic vocabulary.
89118
89890
  */
89119
- Object.defineProperty(exports, "__esModule", ({ value: true }));
89120
- exports.isExistingFindingFullyResolved = isExistingFindingFullyResolved;
89121
- exports.findExistingFindingInfo = findExistingFindingInfo;
89891
+ const finding_identity_1 = __nccwpck_require__(91853);
89122
89892
  function isExistingFindingFullyResolved(finding) {
89123
89893
  const destinations = [finding.issue, finding.pullRequest].filter((destination) => destination != null);
89124
89894
  return (destinations.length > 0 &&
@@ -89126,21 +89896,62 @@ function isExistingFindingFullyResolved(finding) {
89126
89896
  finding.pullRequest?.verificationRequired !== true);
89127
89897
  }
89128
89898
  function findExistingFindingInfo(existingByFindingId, finding) {
89899
+ return findExistingFindingMatch(existingByFindingId, finding)?.info;
89900
+ }
89901
+ /** A match carries its durable key so updating a comment cannot re-key it. */
89902
+ function findExistingFindingMatch(existingByFindingId, finding) {
89129
89903
  const direct = existingByFindingId[finding.id];
89130
89904
  if (direct && identitiesAreCompatible(direct, finding))
89131
- return direct;
89132
- const candidates = Object.values(existingByFindingId);
89905
+ return { id: finding.id, info: direct };
89906
+ const candidates = Object.entries(existingByFindingId);
89133
89907
  if (finding.fingerprint) {
89134
- const locationMatch = candidates.find((candidate) => candidate.issue?.fingerprint === finding.fingerprint
89908
+ const locationMatches = candidates.filter(([, candidate]) => candidate.issue?.fingerprint === finding.fingerprint
89135
89909
  || candidate.pullRequest?.fingerprint === finding.fingerprint);
89136
- if (locationMatch)
89137
- return locationMatch;
89910
+ if (locationMatches.length > 0)
89911
+ return uniqueFindingMatch(locationMatches);
89138
89912
  }
89139
89913
  if (!finding.semanticFingerprint)
89140
89914
  return undefined;
89141
- const semanticMatches = candidates.filter((candidate) => candidate.issue?.semanticFingerprint === finding.semanticFingerprint
89915
+ const semanticMatches = candidates.filter(([, candidate]) => candidate.issue?.semanticFingerprint === finding.semanticFingerprint
89142
89916
  || candidate.pullRequest?.semanticFingerprint === finding.semanticFingerprint);
89143
- return semanticMatches.length === 1 ? semanticMatches[0] : undefined;
89917
+ return uniqueFindingMatch(semanticMatches);
89918
+ }
89919
+ /**
89920
+ * Preserve trusted IDs across title/location changes, before limits, publication
89921
+ * and final projection. Multiple reports of one uniquely matched durable finding
89922
+ * share one record; unmatched or ambiguous reports remain independent evidence.
89923
+ */
89924
+ function retainExistingFindingIds(findings, existingByFindingId) {
89925
+ const retained = new Set();
89926
+ const durableIds = new Set(Object.keys(existingByFindingId));
89927
+ // Reserve the whole input up front so a generated ID cannot take another
89928
+ // report's ID, including one that occurs later in the response.
89929
+ const reservedIds = new Set([...durableIds, ...findings.map((finding) => finding.id)]);
89930
+ const emittedIds = new Set();
89931
+ return findings.flatMap((finding) => {
89932
+ const match = findExistingFindingMatch(existingByFindingId, finding);
89933
+ if (!match) {
89934
+ let id = finding.id;
89935
+ if (durableIds.has(id) || emittedIds.has(id)) {
89936
+ const base = `candidate-${(0, finding_identity_1.buildFindingFingerprint)(finding)}`;
89937
+ id = base;
89938
+ let suffix = 0;
89939
+ while (reservedIds.has(id))
89940
+ id = `${base}-${++suffix}`;
89941
+ reservedIds.add(id);
89942
+ }
89943
+ emittedIds.add(id);
89944
+ return [id === finding.id ? finding : { ...finding, id }];
89945
+ }
89946
+ if (retained.has(match.id))
89947
+ return [];
89948
+ retained.add(match.id);
89949
+ emittedIds.add(match.id);
89950
+ return [finding.id === match.id ? finding : { ...finding, id: match.id }];
89951
+ });
89952
+ }
89953
+ function uniqueFindingMatch(matches) {
89954
+ return matches.length === 1 ? { id: matches[0][0], info: matches[0][1] } : undefined;
89144
89955
  }
89145
89956
  function identitiesAreCompatible(existing, finding) {
89146
89957
  const existingFingerprints = [
@@ -89557,6 +90368,25 @@ function isNewerCliVersion(installedVersion, publishedVersion) {
89557
90368
  }
89558
90369
 
89559
90370
 
90371
+ /***/ }),
90372
+
90373
+ /***/ 21565:
90374
+ /***/ ((__unused_webpack_module, exports) => {
90375
+
90376
+ "use strict";
90377
+
90378
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
90379
+ exports.CLOSED_ISSUE_REASONS = exports.CLOSED_ISSUE_PHASES = exports.CLOSED_ISSUE_RESULTS = void 0;
90380
+ exports.CLOSED_ISSUE_RESULTS = Object.freeze([
90381
+ 'ReconcileClosedIssueMetadataUseCase', 'CloseIssueAfterMergingUseCase', 'RetireBranchSyncUseCase', 'RetireProgressUseCase',
90382
+ ]);
90383
+ exports.CLOSED_ISSUE_PHASES = Object.freeze([
90384
+ 'identity', 'read', 'native-fence', 'label-remove', 'label-add', 'metadata-verification',
90385
+ 'card-inventory', 'card-freshness', 'card-update', 'card-verification',
90386
+ ]);
90387
+ exports.CLOSED_ISSUE_REASONS = Object.freeze(['completed', 'not_planned', 'duplicate', 'reopened', 'unknown', 'unavailable']);
90388
+
90389
+
89560
90390
  /***/ }),
89561
90391
 
89562
90392
  /***/ 77454:
@@ -89731,6 +90561,63 @@ function isCopilotCommentRequest(commentBody, botLogin) {
89731
90561
  }
89732
90562
 
89733
90563
 
90564
+ /***/ }),
90565
+
90566
+ /***/ 33430:
90567
+ /***/ ((__unused_webpack_module, exports) => {
90568
+
90569
+ "use strict";
90570
+
90571
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
90572
+ exports.COPILOT_COMMENT_REMOTE_WORKFLOW = exports.COPILOT_COMMENT_SELF_WORKFLOW = exports.COPILOT_COMMENT_RUNTIME = void 0;
90573
+ exports.isCopilotCommentWorkflow = isCopilotCommentWorkflow;
90574
+ exports.isCopilotCommentRunner = isCopilotCommentRunner;
90575
+ exports.copilotCommentRunner = copilotCommentRunner;
90576
+ /** The comment coordinator is a versioned Copilot workflow, not an arbitrary reusable job. */
90577
+ exports.COPILOT_COMMENT_RUNTIME = 'copilot_comment_runtime.yml';
90578
+ exports.COPILOT_COMMENT_SELF_WORKFLOW = `$/.github/workflows/${exports.COPILOT_COMMENT_RUNTIME}`;
90579
+ exports.COPILOT_COMMENT_REMOTE_WORKFLOW = `vypdev/copilot/.github/workflows/${exports.COPILOT_COMMENT_RUNTIME}@v3`;
90580
+ function isCopilotCommentWorkflow(value) {
90581
+ return typeof value === 'string' && (value === exports.COPILOT_COMMENT_SELF_WORKFLOW
90582
+ || /^vypdev\/copilot\/\.github\/workflows\/copilot_comment_runtime\.yml@(?:v3(?:\.[0-9]+\.[0-9]+)?|[a-f0-9]{40})$/u.test(value));
90583
+ }
90584
+ const literal = (value) => typeof value === 'string' && value.length > 0 && value.length <= 100
90585
+ && value === value.trim() && !/[\p{Cc}\p{Cf}${}<>]/u.test(value);
90586
+ const labels = (value) => literal(value) || Array.isArray(value) && value.length > 0 && value.length <= 10
90587
+ && value.every(literal) && new Set(value.map(label => label.toLowerCase())).size === value.length;
90588
+ /** Runner routing is literal data; expressions need their original full workflow reviewed. */
90589
+ function isCopilotCommentRunner(value) {
90590
+ if (labels(value))
90591
+ return true;
90592
+ if (!value || typeof value !== 'object' || Array.isArray(value))
90593
+ return false;
90594
+ const route = value;
90595
+ const keys = Object.keys(route);
90596
+ return keys.length > 0 && (route.group !== undefined || route.labels !== undefined)
90597
+ && keys.every(key => key === 'group' || key === 'labels')
90598
+ && (route.group === undefined || literal(route.group))
90599
+ && (route.labels === undefined || labels(route.labels));
90600
+ }
90601
+ function copilotCommentRunner(job) {
90602
+ if (!job || !isCopilotCommentWorkflow(job.uses))
90603
+ return job?.['runs-on'];
90604
+ const inputs = job.with;
90605
+ if (typeof inputs?.['runs-on'] !== 'string')
90606
+ throw new Error('Comment workflow runner JSON is unavailable; review the workflow separately.');
90607
+ try {
90608
+ if (inputs['runs-on'].length > 16000)
90609
+ throw new Error('Runner JSON exceeds its bound.');
90610
+ const route = JSON.parse(inputs['runs-on']);
90611
+ if (!isCopilotCommentRunner(route))
90612
+ throw new Error('Unsupported execution route.');
90613
+ return route;
90614
+ }
90615
+ catch {
90616
+ throw new Error('Comment workflow runner JSON is invalid; review the workflow separately.');
90617
+ }
90618
+ }
90619
+
90620
+
89734
90621
  /***/ }),
89735
90622
 
89736
90623
  /***/ 72418:
@@ -91535,7 +92422,7 @@ function parsePositiveSafeInteger(value) {
91535
92422
  "use strict";
91536
92423
 
91537
92424
  Object.defineProperty(exports, "__esModule", ({ value: true }));
91538
- 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;
92425
+ 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;
91539
92426
  exports.retainSddAnswers = retainSddAnswers;
91540
92427
  exports.normalizeSddIssueTitle = normalizeSddIssueTitle;
91541
92428
  exports.isSafeSddPath = isSafeSddPath;
@@ -91546,6 +92433,7 @@ exports.isSddAnswerComment = isSddAnswerComment;
91546
92433
  exports.parseSddAnswer = parseSddAnswer;
91547
92434
  exports.validateSddMarkdown = validateSddMarkdown;
91548
92435
  exports.composeSddUpdate = composeSddUpdate;
92436
+ exports.recoverSddUpdate = recoverSddUpdate;
91549
92437
  exports.SDD_GATE_MARKER = 'copilot:sdd-gate:v1';
91550
92438
  exports.SDD_MIN_DRAFT_CHARACTERS = 1800;
91551
92439
  exports.SDD_MAX_DRAFT_CHARACTERS = 70000;
@@ -91573,6 +92461,15 @@ function normalizeSddIssueTitle(title) {
91573
92461
  function isSafeSddPath(path) {
91574
92462
  return SDD_PATH.test(path) && !['specs/CATALOG.md', 'specs/_template.md'].includes(path);
91575
92463
  }
92464
+ /** Closed diagnostics contain no model-selected identifiers or provider text. */
92465
+ class SddOwnershipFailure extends Error {
92466
+ constructor(reason) {
92467
+ super(`SDD ownership analysis rejected (${reason}).`);
92468
+ this.reason = reason;
92469
+ this.name = 'SddOwnershipFailure';
92470
+ }
92471
+ }
92472
+ exports.SddOwnershipFailure = SddOwnershipFailure;
91576
92473
  /** The agent may propose ownership but cannot invent a catalogued owner or arbitrary path. */
91577
92474
  function parseSddPlan(value, catalog) {
91578
92475
  if (!isRecord(value))
@@ -91590,14 +92487,16 @@ function parseSddPlan(value, catalog) {
91590
92487
  const ownerPaths = catalog.get(capabilityId);
91591
92488
  const registered = [...catalog.values()].some(paths => paths.includes(path));
91592
92489
  if (action === 'update' && (!ownerPaths?.includes(path) || !registered)) {
91593
- throw new Error('The requested SDD update is not owned by the selected catalog capability.');
91594
- }
91595
- if (action === 'companion' && (!ownerPaths || registered)) {
91596
- throw new Error('A companion SDD requires an existing owner and a new path.');
91597
- }
91598
- if (action === 'new' && (ownerPaths || registered)) {
91599
- throw new Error('A new SDD requires an unregistered capability and path.');
91600
- }
92490
+ throw new SddOwnershipFailure('update-owner-mismatch');
92491
+ }
92492
+ if (action === 'companion' && !ownerPaths)
92493
+ throw new SddOwnershipFailure('companion-owner-unknown');
92494
+ if (action === 'companion' && registered)
92495
+ throw new SddOwnershipFailure('companion-path-registered');
92496
+ if (action === 'new' && ownerPaths)
92497
+ throw new SddOwnershipFailure('new-owner-registered');
92498
+ if (action === 'new' && registered)
92499
+ throw new SddOwnershipFailure('new-path-registered');
91601
92500
  if (!Array.isArray(value.questions) || value.questions.length > 8) {
91602
92501
  throw new Error('The SDD analysis must contain at most eight blocking questions.');
91603
92502
  }
@@ -91838,8 +92737,24 @@ function composeSddUpdate(existing, change) {
91838
92737
  validateSddMarkdown(change);
91839
92738
  if (change.length > exports.SDD_MAX_UPDATE_CHARACTERS)
91840
92739
  throw new Error('An SDD update appendix exceeds 18000 characters; use a proportional change or a companion SDD.');
92740
+ const appendix = shiftSddHeadings(change, 1);
92741
+ const merged = `${existing.trimEnd()}\n\n${appendix.trim()}\n`;
92742
+ validateSddMarkdown(merged);
92743
+ return merged;
92744
+ }
92745
+ /** Recovery validates the original candidate, not a second copy of its retained baseline. */
92746
+ function recoverSddUpdate(existing, published) {
92747
+ const prefix = `${existing.trimEnd()}\n\n`;
92748
+ if (!published.startsWith(prefix))
92749
+ return undefined;
92750
+ // Composition normalizes outer whitespace and adds a publication newline.
92751
+ // Reconstruct an equivalent candidate inside the original size bounds.
92752
+ const change = shiftSddHeadings(published.slice(prefix.length), -1).trim().padEnd(exports.SDD_MIN_DRAFT_CHARACTERS, '\n');
92753
+ return composeSddUpdate(existing, change) === published ? change : undefined;
92754
+ }
92755
+ function shiftSddHeadings(source, direction) {
91841
92756
  let fence;
91842
- const appendix = change.split('\n').map(line => {
92757
+ return source.split('\n').map(line => {
91843
92758
  const boundary = line.match(/^\s*(`{3,}|~{3,})/);
91844
92759
  if (boundary) {
91845
92760
  if (!fence)
@@ -91848,11 +92763,11 @@ function composeSddUpdate(existing, change) {
91848
92763
  fence = undefined;
91849
92764
  return line;
91850
92765
  }
91851
- return !fence && /^#{1,5} /.test(line) ? `#${line}` : line;
92766
+ if (fence)
92767
+ return line;
92768
+ return direction === 1 ? (/^#{1,5} /.test(line) ? `#${line}` : line)
92769
+ : (/^#{2,6} /.test(line) ? line.slice(1) : line);
91852
92770
  }).join('\n');
91853
- const merged = `${existing.trimEnd()}\n\n${appendix.trim()}\n`;
91854
- validateSddMarkdown(merged);
91855
- return merged;
91856
92771
  }
91857
92772
  function serializeSddGateValue(value) {
91858
92773
  // Human answer text must never terminate its hidden state comment.
@@ -92449,6 +93364,254 @@ function replyRequestBodyDigest(body) {
92449
93364
  }
92450
93365
 
92451
93366
 
93367
+ /***/ }),
93368
+
93369
+ /***/ 27910:
93370
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
93371
+
93372
+ "use strict";
93373
+
93374
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
93375
+ exports.SDD_CONSISTENCY_PROMPT = void 0;
93376
+ exports.reservedSddCaseIds = reservedSddCaseIds;
93377
+ exports.validateSddDraftConsistency = validateSddDraftConsistency;
93378
+ const pre_branch_sdd_1 = __nccwpck_require__(34730);
93379
+ const CASE = /\b(?:[A-Za-z][A-Za-z0-9]*-)+C\d+\b/gu;
93380
+ const CASE_ID = /^(?:[A-Za-z][A-Za-z0-9]*-)+C\d+$/u;
93381
+ const REQUIREMENT_ID = /^[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+$/u;
93382
+ /** Generated candidates use visible tables; retained legacy owners are never reformatted. */
93383
+ exports.SDD_CONSISTENCY_PROMPT = `Consistency contract for the proposed draft/appendix (not the retained owner):
93384
+ In section 4 include one table: Requirement | Behavior. Give every goal a stable requirement ID.
93385
+ In section 14 include one budget table: Area | Minimum distinct cases | Behaviors/risks covered; positive integers and one Total.
93386
+ Also in section 14 include one inventory table: Case ID | Area | Requirements | Scenario.
93387
+ 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.
93388
+ 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.
93389
+ 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.`;
93390
+ function fail(reason) {
93391
+ // Closed diagnostics: rejected Markdown and repository text never become repair instructions.
93392
+ throw new pre_branch_sdd_1.SddDraftFormatFailure(reason, `The SDD draft violates its ${reason} consistency contract.`);
93393
+ }
93394
+ /** Excludes examples and hidden records from the contract. */
93395
+ function visible(source) {
93396
+ let fence;
93397
+ let comment = false;
93398
+ return source.replace(/\r\n/gu, '\n').split('\n').map(line => {
93399
+ const boundary = /^\s*(`{3,}|~{3,})/u.exec(line);
93400
+ if (fence) {
93401
+ // Comment syntax inside code is literal; only the original line can close it.
93402
+ if (boundary && boundary[1][0] === fence[0] && boundary[1].length >= fence.length
93403
+ && /^ {0,3}(?:`+|~+)[ \t]*$/u.test(line))
93404
+ fence = undefined;
93405
+ return '';
93406
+ }
93407
+ if (!comment && boundary) {
93408
+ fence = boundary[1];
93409
+ return '';
93410
+ }
93411
+ let result = '';
93412
+ let offset = 0;
93413
+ while (offset < line.length) {
93414
+ const marker = comment ? '-->' : '<!--';
93415
+ const next = line.indexOf(marker, offset);
93416
+ if (next < 0)
93417
+ return result + (comment ? '' : line.slice(offset));
93418
+ if (!comment)
93419
+ result += line.slice(offset, next) + ' ';
93420
+ offset = next + marker.length;
93421
+ comment = !comment;
93422
+ }
93423
+ return result;
93424
+ }).join('\n');
93425
+ }
93426
+ function clean(value) { return value.trim().replace(/^(?:\*\*|__|`)(.*?)(?:\*\*|__|`)$/u, '$1').trim(); }
93427
+ function table(source, section, headers, reason) {
93428
+ const sections = [...source.matchAll(/^## (\d+)\. [^\n]*$/gmu)];
93429
+ const matches = sections.filter(heading => Number(heading[1]) === section);
93430
+ if (matches.length !== 1)
93431
+ return fail(reason);
93432
+ const start = matches[0];
93433
+ const end = sections.find(heading => heading.index > start.index)?.index ?? source.length;
93434
+ const lines = source.slice(start.index + start[0].length, end).split('\n');
93435
+ const found = [];
93436
+ for (let index = 0; index < lines.length; index++) {
93437
+ if (!/^\s*\|/u.test(lines[index]))
93438
+ continue;
93439
+ const cells = (line) => line.trim().replace(/^\||\|$/gu, '').split('|').map(clean);
93440
+ const header = cells(lines[index]);
93441
+ if (!headers.every((value, position) => header[position] === value) || header.length !== headers.length)
93442
+ continue;
93443
+ const separator = cells(lines[++index] ?? '');
93444
+ if (separator.length !== headers.length || !separator.every(cell => /^:?-{3,}:?$/u.test(cell)))
93445
+ return fail(reason);
93446
+ const rows = [];
93447
+ while (++index < lines.length && /^\s*\|/u.test(lines[index])) {
93448
+ const row = cells(lines[index]);
93449
+ if (row.length !== headers.length || row.some(cell => !cell))
93450
+ return fail(reason);
93451
+ rows.push(row);
93452
+ }
93453
+ if (!rows.length)
93454
+ return fail(reason);
93455
+ found.push(rows);
93456
+ }
93457
+ return found.length === 1 ? found[0] : fail(reason);
93458
+ }
93459
+ function ids(value, pattern, reason) {
93460
+ const values = value.split(/\s*,\s*/u);
93461
+ if (!values.every(id => pattern.test(id)) || new Set(values).size !== values.length)
93462
+ return fail(reason);
93463
+ return values;
93464
+ }
93465
+ function reservedSddCaseIds(documents) {
93466
+ const reserved = new Set();
93467
+ for (const document of documents) {
93468
+ const source = visible(document.markdown);
93469
+ const qualified = source.match(CASE) ?? [];
93470
+ const namespaces = new Set(qualified.map(id => id.slice(0, id.lastIndexOf('-C') + 2)));
93471
+ for (const id of qualified)
93472
+ reserved.add(id);
93473
+ // Legacy inventories often qualify C01 and abbreviate the remaining rows.
93474
+ // Reserve every plausible namespace instead of silently assigning an alias a new meaning.
93475
+ for (const match of source.matchAll(/(?<![\w-])C(\d+)\b/gu)) {
93476
+ for (const namespace of namespaces)
93477
+ reserved.add(`${namespace}${match[1]}`);
93478
+ }
93479
+ for (const match of source.matchAll(/\bC(\d+)\s*[-–—]\s*C?(\d+)\b/gu)) {
93480
+ const start = Number(match[1]);
93481
+ const end = Number(match[2]);
93482
+ if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || end < start || end - start > 1000) {
93483
+ throw new Error('An owning SDD case range cannot be reconciled within the fixed bound; review the baseline before retrying.');
93484
+ }
93485
+ for (let number = start; number <= end; number++) {
93486
+ for (const namespace of namespaces)
93487
+ reserved.add(`${namespace}${String(number).padStart(match[1].length, '0')}`);
93488
+ }
93489
+ }
93490
+ }
93491
+ return [...reserved].sort();
93492
+ }
93493
+ function validateSddDraftConsistency(markdown, owners, inventory, sddPath) {
93494
+ const source = visible(markdown);
93495
+ const requirements = table(source, 4, ['Requirement', 'Behavior'], 'requirement-mapping');
93496
+ const requirementIds = requirements.map(row => row[0]);
93497
+ if (new Set(requirementIds).size !== requirementIds.length || !requirementIds.every(id => REQUIREMENT_ID.test(id)))
93498
+ fail('requirement-mapping');
93499
+ const cases = table(source, 14, ['Case ID', 'Area', 'Requirements', 'Scenario'], 'case-identity');
93500
+ const caseIds = cases.map(row => row[0]);
93501
+ const reserved = new Set(reservedSddCaseIds(owners));
93502
+ if (new Set(caseIds).size !== caseIds.length || caseIds.some(id => !CASE_ID.test(id) || reserved.has(id))
93503
+ || /(?<![\w-])C\d+\b/u.test(source))
93504
+ fail('case-identity');
93505
+ // References to existing owner cases are allowed, but cannot count as newly defined cases.
93506
+ if ([...source.matchAll(CASE)].some(([id]) => !caseIds.includes(id) && !reserved.has(id)))
93507
+ fail('case-identity');
93508
+ const budget = table(source, 14, ['Area', 'Minimum distinct cases', 'Behaviors/risks covered'], 'case-budget');
93509
+ const counts = new Map();
93510
+ let total;
93511
+ for (const [area, value] of budget) {
93512
+ const count = /^[1-9]\d*$/u.test(value) ? Number(value) : NaN;
93513
+ if (!Number.isSafeInteger(count) || counts.has(area) || total !== undefined)
93514
+ fail('case-budget');
93515
+ if (area === 'Total')
93516
+ total = count;
93517
+ else
93518
+ counts.set(area, count);
93519
+ }
93520
+ if (!counts.size || total !== caseIds.length || [...counts.values()].reduce((sum, count) => sum + count, 0) !== total
93521
+ || cases.some(row => !counts.has(row[1])))
93522
+ fail('case-budget');
93523
+ for (const [area, count] of counts)
93524
+ if (cases.filter(row => row[1] === area).length !== count)
93525
+ fail('case-budget');
93526
+ const edges = new Map(requirementIds.map(id => [id, new Set()]));
93527
+ for (const [id, , links] of cases) {
93528
+ for (const requirement of ids(links, REQUIREMENT_ID, 'requirement-mapping')) {
93529
+ const linked = edges.get(requirement);
93530
+ if (!linked)
93531
+ fail('requirement-mapping');
93532
+ linked.add(id);
93533
+ }
93534
+ }
93535
+ const traceability = table(source, 17, ['Requirement', 'Cases'], 'requirement-mapping');
93536
+ const seen = new Set();
93537
+ for (const [requirement, links] of traceability) {
93538
+ const expected = edges.get(requirement);
93539
+ const actual = ids(links, CASE_ID, 'requirement-mapping');
93540
+ if (!expected || seen.has(requirement) || expected.size !== actual.length || actual.some(id => !expected.has(id)))
93541
+ fail('requirement-mapping');
93542
+ seen.add(requirement);
93543
+ }
93544
+ if (seen.size !== edges.size || [...edges.values()].some(links => links.size === 0))
93545
+ fail('requirement-mapping');
93546
+ validatePaths(source, inventory, sddPath);
93547
+ }
93548
+ function safePath(value) {
93549
+ return value.length > 0 && !/[\\:*?"<>|\p{Cc}]/u.test(value)
93550
+ && value.split('/').every(segment => segment && segment !== '.' && segment !== '..' && segment.toLowerCase() !== '.git');
93551
+ }
93552
+ function validatePaths(source, inventory, sddPath) {
93553
+ const rows = table(source, 15, ['Path', 'Change'], 'repository-path');
93554
+ const expectedChange = inventory.files.has(sddPath) ? 'update' : 'create';
93555
+ if (!rows.some(([file, change]) => file === sddPath && change === expectedChange))
93556
+ fail('repository-path');
93557
+ const proposed = new Set();
93558
+ const seen = new Set();
93559
+ for (const [file, change] of rows) {
93560
+ if (!safePath(file) || seen.has(file) || inventory.blocked.has(file))
93561
+ fail('repository-path');
93562
+ seen.add(file);
93563
+ if (change === 'create') {
93564
+ if (inventory.files.has(file) || inventory.directories.has(file))
93565
+ fail('repository-path');
93566
+ if ([...proposed].some(other => file.startsWith(`${other}/`) || other.startsWith(`${file}/`)))
93567
+ fail('repository-path');
93568
+ const segments = file.split('/');
93569
+ if (segments.some((_, index) => inventory.files.has(segments.slice(0, index + 1).join('/')) || inventory.blocked.has(segments.slice(0, index + 1).join('/'))))
93570
+ fail('repository-path');
93571
+ proposed.add(file);
93572
+ }
93573
+ else if (!['update', 'reference'].includes(change) || !inventory.files.has(file))
93574
+ fail('repository-path');
93575
+ }
93576
+ const check = (file) => {
93577
+ if (!safePath(file) || (!inventory.files.has(file) && !inventory.directories.has(file) && !proposed.has(file)))
93578
+ fail('repository-path');
93579
+ };
93580
+ // Relative Markdown file links resolve against the selected SDD, never the current checkout.
93581
+ for (const match of source.matchAll(/\]\(([^\s)]+)\)/gu)) {
93582
+ const href = match[1].split(/[?#]/u)[0];
93583
+ if (!href || /^(?:[a-z][a-z0-9+.-]*:|\/)/iu.test(href))
93584
+ continue;
93585
+ let decoded;
93586
+ try {
93587
+ decoded = decodeURIComponent(href);
93588
+ }
93589
+ catch {
93590
+ return fail('repository-path');
93591
+ }
93592
+ const parts = sddPath.split('/').slice(0, -1);
93593
+ for (const part of decoded.split('/')) {
93594
+ if (part === '..') {
93595
+ if (!parts.length)
93596
+ fail('repository-path');
93597
+ parts.pop();
93598
+ }
93599
+ else if (part !== '.')
93600
+ parts.push(part);
93601
+ }
93602
+ check(parts.join('/'));
93603
+ }
93604
+ for (const match of source.matchAll(/`([^`\n]+)`/gu)) {
93605
+ const value = match[1];
93606
+ if (value.includes('/') && !/^(?:[a-z][a-z0-9+.-]*:|\/)/iu.test(value) && !/\s/u.test(value))
93607
+ check(value.replace(/\/$/u, ''));
93608
+ }
93609
+ const prose = source.replace(/\]\([^\s)]+\)/gu, ']()').replace(/[a-z][a-z0-9+.-]*:\/\/[^\s)>]+/giu, '');
93610
+ for (const match of prose.matchAll(/(?<![\w./:-])([A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)+\.[A-Za-z0-9]+)(?![\w/-])/gu))
93611
+ check(match[1]);
93612
+ }
93613
+
93614
+
92452
93615
  /***/ }),
92453
93616
 
92454
93617
  /***/ 47122:
@@ -92654,6 +93817,20 @@ exports.DEFAULT_SETUP_RUNNERS = Object.freeze({
92654
93817
  });
92655
93818
 
92656
93819
 
93820
+ /***/ }),
93821
+
93822
+ /***/ 33156:
93823
+ /***/ ((__unused_webpack_module, exports) => {
93824
+
93825
+ "use strict";
93826
+
93827
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
93828
+ exports.SETUP_VERIFICATION_ACTION_PARENTS = exports.SETUP_VERIFICATION_ACTION_PATH = void 0;
93829
+ /** Fixed consumer-owned asset: setup may create it, never regenerate or retire it. */
93830
+ exports.SETUP_VERIFICATION_ACTION_PATH = '.github/actions/copilot-verification-setup/action.yml';
93831
+ exports.SETUP_VERIFICATION_ACTION_PARENTS = ['.github', '.github/actions', '.github/actions/copilot-verification-setup'];
93832
+
93833
+
92657
93834
  /***/ }),
92658
93835
 
92659
93836
  /***/ 24596:
@@ -95391,12 +96568,14 @@ function createDeploymentOrchestrationUseCase(issueDescriptionQueryPort, publica
95391
96568
  });
95392
96569
  }
95393
96570
  const copilot_history_port_factory_1 = __nccwpck_require__(12321);
95394
- function createIssueCommentUseCaseCompositionRoot(binding) {
96571
+ const verification_setup_snapshot_1 = __nccwpck_require__(62148);
96572
+ const verification_setup_ports_1 = __nccwpck_require__(26509);
96573
+ function createIssueCommentUseCaseCompositionRoot(binding, setup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
95395
96574
  const bugbot = (0, bugbot_composition_root_1.createBugbotCompositionRoot)(binding);
95396
96575
  const findings = (0, agent_capability_composition_root_1.createFindingsQueryPort)();
95397
96576
  const language = (0, agent_capability_composition_root_1.createLanguageQueryPort)();
95398
96577
  const fixer = (0, agent_capability_composition_root_1.createFixerQueryPort)();
95399
- const gitCommit = new git_commit_adapter_1.GitCommitAdapter();
96578
+ const gitCommit = new git_commit_adapter_1.GitCommitAdapter(undefined, undefined, setup);
95400
96579
  const authenticatedUser = (0, authenticated_user_composition_root_1.createAuthenticatedUserCompositionRoot)();
95401
96580
  const bugbotGit = new bound_bugbot_git_mutation_adapter_1.BoundBugbotGitMutationAdapter(gitCommit, authenticatedUser, binding.token);
95402
96581
  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)());
@@ -95407,12 +96586,12 @@ function createIssueCommentUseCaseCompositionRoot(binding) {
95407
96586
  catalogResolver: new resolve_message_catalog_use_case_1.ResolveMessageCatalogUseCase(language),
95408
96587
  }), 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));
95409
96588
  }
95410
- function createPullRequestReviewCommentUseCaseCompositionRoot(binding) {
96589
+ function createPullRequestReviewCommentUseCaseCompositionRoot(binding, setup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
95411
96590
  const bugbot = (0, bugbot_composition_root_1.createBugbotCompositionRoot)(binding);
95412
96591
  const findings = (0, agent_capability_composition_root_1.createFindingsQueryPort)();
95413
96592
  const language = (0, agent_capability_composition_root_1.createLanguageQueryPort)();
95414
96593
  const fixer = (0, agent_capability_composition_root_1.createFixerQueryPort)();
95415
- const gitCommit = new git_commit_adapter_1.GitCommitAdapter();
96594
+ const gitCommit = new git_commit_adapter_1.GitCommitAdapter(undefined, undefined, setup);
95416
96595
  const authenticatedUser = (0, authenticated_user_composition_root_1.createAuthenticatedUserCompositionRoot)();
95417
96596
  const bugbotGit = new bound_bugbot_git_mutation_adapter_1.BoundBugbotGitMutationAdapter(gitCommit, authenticatedUser, binding.token);
95418
96597
  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)());
@@ -95439,7 +96618,7 @@ function createMainRunRouteCompositionRoot(projectBoardCommandPort, surface, set
95439
96618
  return singleAction.invoke(execution);
95440
96619
  },
95441
96620
  "issue-comment": async (execution) => {
95442
- issueComment ?? (issueComment = createIssueCommentUseCaseCompositionRoot(bugbotBinding(execution)));
96621
+ issueComment ?? (issueComment = createIssueCommentUseCaseCompositionRoot(bugbotBinding(execution), (0, verification_setup_snapshot_1.captureVerificationSetup)(execution.verificationSetup, execution.branches.main)));
95443
96622
  return issueComment.invoke(execution);
95444
96623
  },
95445
96624
  issue: async (execution) => {
@@ -95447,7 +96626,7 @@ function createMainRunRouteCompositionRoot(projectBoardCommandPort, surface, set
95447
96626
  return issue.invoke(execution);
95448
96627
  },
95449
96628
  "pull-request-review-comment": async (execution) => {
95450
- pullRequestReviewComment ?? (pullRequestReviewComment = createPullRequestReviewCommentUseCaseCompositionRoot(bugbotBinding(execution)));
96629
+ pullRequestReviewComment ?? (pullRequestReviewComment = createPullRequestReviewCommentUseCaseCompositionRoot(bugbotBinding(execution), (0, verification_setup_snapshot_1.captureVerificationSetup)(execution.verificationSetup, execution.branches.main)));
95451
96630
  return pullRequestReviewComment.invoke(execution);
95452
96631
  },
95453
96632
  "pull-request": async (execution) => {
@@ -96555,23 +97734,28 @@ var __importStar = (this && this.__importStar) || (function () {
96555
97734
  })();
96556
97735
  Object.defineProperty(exports, "__esModule", ({ value: true }));
96557
97736
  exports.GitCommitAdapter = void 0;
97737
+ const verification_executable_1 = __nccwpck_require__(20878);
97738
+ const native_verification_profiles_1 = __nccwpck_require__(22290);
96558
97739
  const exec = __importStar(__nccwpck_require__(18538));
96559
97740
  const git_authentication_environment_1 = __nccwpck_require__(16535);
96560
97741
  const untrusted_command_environment_1 = __nccwpck_require__(2304);
96561
97742
  const git_hook_isolation_1 = __nccwpck_require__(39764);
96562
97743
  const verification_runtime_preflight_1 = __nccwpck_require__(23100);
97744
+ const verification_setup_ports_1 = __nccwpck_require__(26509);
97745
+ const verification_setup_runner_1 = __nccwpck_require__(11709);
96563
97746
  class GitCommitAdapter {
96564
97747
  constructor(executeCommand = (program, args, options) => options
96565
- ? exec.exec(program, args, {
97748
+ ? exec.exec(options.resolveFromEnvironment && options.env ? (0, verification_executable_1.verificationExecutable)(program, options.env) : program, args, {
96566
97749
  // Captured Git reads can contain NUL-delimited records that
96567
97750
  // hide subsequent lines in GitHub's Actions log viewer.
96568
97751
  ...(options.stdout ? { silent: true } : {}),
96569
97752
  ...(options.stdout ? { listeners: { stdout: options.stdout } } : {}),
96570
97753
  ...(options.env ? { env: options.env } : {}),
96571
97754
  })
96572
- : exec.exec(program, args), checkPrerequisites = verification_runtime_preflight_1.assertVerificationRuntimePrerequisites) {
97755
+ : exec.exec(program, args), checkPrerequisites = verification_runtime_preflight_1.assertVerificationRuntimePrerequisites, verificationSetup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
96573
97756
  this.executeCommand = executeCommand;
96574
97757
  this.checkPrerequisites = checkPrerequisites;
97758
+ this.verificationSetup = verificationSetup;
96575
97759
  }
96576
97760
  async execute(program, args, options) {
96577
97761
  if (options?.verifyRuntimePrerequisites && !options.untrusted)
@@ -96582,15 +97766,19 @@ class GitCommitAdapter {
96582
97766
  throw new Error('Untrusted command execution does not accept a caller-supplied environment.');
96583
97767
  const runtime = (0, untrusted_command_environment_1.prepareUntrustedCommandEnvironment)();
96584
97768
  try {
96585
- if (options.verifyRuntimePrerequisites)
97769
+ if (options.verifyRuntimePrerequisites) {
97770
+ await (0, verification_setup_runner_1.prepareRepositoryVerification)(this.verificationSetup, runtime.environment);
96586
97771
  this.checkPrerequisites(runtime.environment);
97772
+ }
96587
97773
  return await this.executeCommand(program, args, {
96588
97774
  ...(options.stdout ? { stdout: options.stdout } : {}),
96589
97775
  env: runtime.environment,
97776
+ ...(options.verifyRuntimePrerequisites && this.verificationSetup.kind === 'ready' ? { resolveFromEnvironment: true } : {}),
96590
97777
  });
96591
97778
  }
96592
97779
  finally {
96593
- runtime.cleanup();
97780
+ if (!(0, native_verification_profiles_1.nativeVerificationRetainsProfile)(runtime.environment.HOME))
97781
+ runtime.cleanup();
96594
97782
  }
96595
97783
  }
96596
97784
  async configureAuthor(name, email) {
@@ -97578,6 +98766,233 @@ class LoggerWorkflowPollingObserverAdapter {
97578
98766
  exports.LoggerWorkflowPollingObserverAdapter = LoggerWorkflowPollingObserverAdapter;
97579
98767
 
97580
98768
 
98769
+ /***/ }),
98770
+
98771
+ /***/ 18883:
98772
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
98773
+
98774
+ "use strict";
98775
+
98776
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98777
+ exports.verificationCandidateIdentity = verificationCandidateIdentity;
98778
+ const node_child_process_1 = __nccwpck_require__(17718);
98779
+ const node_crypto_1 = __nccwpck_require__(6005);
98780
+ const node_fs_1 = __nccwpck_require__(87561);
98781
+ const node_path_1 = __nccwpck_require__(49411);
98782
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
98783
+ /** Bind setup to the exact HEAD, branch, index, tracked edits and publishable untracked files. */
98784
+ function verificationCandidateIdentity(workspace, environment) {
98785
+ const hash = (0, node_crypto_1.createHash)('sha256');
98786
+ const git = (...args) => {
98787
+ const result = (0, node_child_process_1.spawnSync)('git', ['--no-replace-objects', ...args], { cwd: workspace, env: environment, shell: false,
98788
+ windowsHide: true, timeout: 10000, maxBuffer: 16 * 1024 * 1024 });
98789
+ if (result.error || result.status !== 0)
98790
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
98791
+ hash.update(result.stdout).update('\0');
98792
+ return result.stdout;
98793
+ };
98794
+ git('rev-parse', '--verify', 'HEAD');
98795
+ git('rev-parse', '--symbolic-full-name', 'HEAD');
98796
+ git('ls-files', '--stage', '-z');
98797
+ git('diff', '--no-ext-diff', '--no-textconv', '--binary', 'HEAD', '--');
98798
+ const paths = git('ls-files', '--others', '--exclude-standard', '-z').toString('utf8').split('\0').filter(Boolean);
98799
+ let total = 0;
98800
+ if (paths.length > 256)
98801
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
98802
+ for (const path of paths) {
98803
+ const file = (0, node_path_1.join)(workspace, path);
98804
+ const stat = (0, node_fs_1.lstatSync)(file);
98805
+ total += stat.size;
98806
+ if (total > 16 * 1024 * 1024)
98807
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
98808
+ hash.update(path).update('\0');
98809
+ if (stat.isSymbolicLink())
98810
+ hash.update('120000\0').update((0, node_fs_1.readlinkSync)(file));
98811
+ else if (stat.isFile())
98812
+ hash.update(stat.mode & 0o100 ? '100755\0' : '100644\0').update((0, node_fs_1.readFileSync)(file));
98813
+ else
98814
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
98815
+ hash.update('\0');
98816
+ }
98817
+ return hash.digest('hex');
98818
+ }
98819
+
98820
+
98821
+ /***/ }),
98822
+
98823
+ /***/ 22290:
98824
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
98825
+
98826
+ "use strict";
98827
+
98828
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98829
+ exports.nativeVerificationProfilePaths = nativeVerificationProfilePaths;
98830
+ exports.registerNativeVerificationProfile = registerNativeVerificationProfile;
98831
+ exports.nativeVerificationRetainsProfile = nativeVerificationRetainsProfile;
98832
+ exports.removeNativeVerificationProfiles = removeNativeVerificationProfiles;
98833
+ const node_crypto_1 = __nccwpck_require__(6005);
98834
+ const node_fs_1 = __nccwpck_require__(87561);
98835
+ const node_path_1 = __nccwpck_require__(49411);
98836
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
98837
+ const native_verification_protocol_1 = __nccwpck_require__(88709);
98838
+ function nativeVerificationProfilePaths(root) {
98839
+ const stored = (0, native_verification_protocol_1.readNativeRecord)(root, 'profiles.json', 65536);
98840
+ const paths = stored === undefined ? [] : stored;
98841
+ if (!Array.isArray(paths) || paths.length > 20 || new Set(paths).size !== paths.length || paths.some(path => typeof path !== 'string'
98842
+ || (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))
98843
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98844
+ return paths;
98845
+ }
98846
+ /** Native actions may have post steps. Preserve dependency-only profiles until those steps finish. */
98847
+ function registerNativeVerificationProfile(root, profile) {
98848
+ const previous = nativeVerificationProfilePaths(root);
98849
+ if (previous.length >= 20 || previous.includes(profile) || (0, node_path_1.dirname)(profile) !== (0, node_path_1.dirname)(root)
98850
+ || profile === root || !/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(profile))
98851
+ || (0, node_fs_1.realpathSync)(profile) !== profile || !(0, node_fs_1.lstatSync)(profile).isDirectory() || (0, node_fs_1.lstatSync)(profile).isSymbolicLink())
98852
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98853
+ (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' });
98854
+ (0, native_verification_protocol_1.writeNativeRecord)(root, 'profiles.json', [...previous, profile]);
98855
+ }
98856
+ function nativeVerificationRetainsProfile(profile) {
98857
+ const root = process.env.COPILOT_NATIVE_WORKER_SESSION;
98858
+ return !!root && nativeVerificationProfilePaths(root).includes(profile);
98859
+ }
98860
+ function removeNativeVerificationProfiles(root) {
98861
+ for (const path of nativeVerificationProfilePaths(root)) {
98862
+ let stat;
98863
+ try {
98864
+ stat = (0, node_fs_1.lstatSync)(path);
98865
+ }
98866
+ catch (error) {
98867
+ if (error.code === 'ENOENT')
98868
+ continue;
98869
+ throw error;
98870
+ }
98871
+ 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'))
98872
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98873
+ (0, node_fs_1.rmSync)(path, { recursive: true, force: true });
98874
+ }
98875
+ }
98876
+
98877
+
98878
+ /***/ }),
98879
+
98880
+ /***/ 88709:
98881
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
98882
+
98883
+ "use strict";
98884
+
98885
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98886
+ exports.nativePause = void 0;
98887
+ exports.writeNativeRecord = writeNativeRecord;
98888
+ exports.readNativeRecord = readNativeRecord;
98889
+ exports.nativeSession = nativeSession;
98890
+ const node_fs_1 = __nccwpck_require__(87561);
98891
+ const node_path_1 = __nccwpck_require__(49411);
98892
+ const node_crypto_1 = __nccwpck_require__(6005);
98893
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
98894
+ function writeNativeRecord(root, name, value) {
98895
+ const temporary = (0, node_path_1.join)(root, `${(0, node_crypto_1.randomUUID)()}.tmp`);
98896
+ (0, node_fs_1.writeFileSync)(temporary, JSON.stringify(value), { mode: 0o600, flag: 'wx' });
98897
+ (0, node_fs_1.renameSync)(temporary, (0, node_path_1.join)(root, name));
98898
+ }
98899
+ function readNativeRecord(root, name, limit = 16384) {
98900
+ const file = (0, node_path_1.join)(root, name);
98901
+ let descriptor;
98902
+ try {
98903
+ const before = (0, node_fs_1.lstatSync)(file, { bigint: true });
98904
+ if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n || before.size > BigInt(limit))
98905
+ throw new Error();
98906
+ descriptor = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
98907
+ const after = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
98908
+ if (after.dev !== before.dev || after.ino !== before.ino || after.size !== before.size || after.mtimeNs !== before.mtimeNs)
98909
+ throw new Error();
98910
+ const data = (0, node_fs_1.readFileSync)(descriptor);
98911
+ const final = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
98912
+ if (data.length > limit || final.size !== after.size || final.mtimeNs !== after.mtimeNs)
98913
+ throw new Error();
98914
+ return JSON.parse(data.toString('utf8'));
98915
+ }
98916
+ catch (error) {
98917
+ if (error.code === 'ENOENT')
98918
+ return undefined;
98919
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98920
+ }
98921
+ finally {
98922
+ if (descriptor !== undefined)
98923
+ (0, node_fs_1.closeSync)(descriptor);
98924
+ }
98925
+ }
98926
+ function nativeSession(root, environment = process.env) {
98927
+ if (!/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(root)) || (0, node_fs_1.realpathSync)(root) !== root
98928
+ || !(0, node_fs_1.lstatSync)(root).isDirectory() || (0, node_fs_1.lstatSync)(root).isSymbolicLink())
98929
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98930
+ if (process.platform !== 'win32' && ((0, node_fs_1.lstatSync)(root).mode & 0o077) !== 0)
98931
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98932
+ const session = readNativeRecord(root, 'session.json');
98933
+ if (session?.schemaVersion !== 1 || session.workspace !== (0, node_fs_1.realpathSync)(process.cwd())
98934
+ || session.run !== (environment.GITHUB_RUN_ID ?? '') || session.attempt !== (environment.GITHUB_RUN_ATTEMPT ?? '')
98935
+ || session.job !== (environment.GITHUB_JOB ?? '') || !Number.isSafeInteger(session.pid) || session.pid <= 0)
98936
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98937
+ return session;
98938
+ }
98939
+ const nativePause = (milliseconds) => new Promise(resolve => setTimeout(resolve, milliseconds));
98940
+ exports.nativePause = nativePause;
98941
+
98942
+
98943
+ /***/ }),
98944
+
98945
+ /***/ 63587:
98946
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
98947
+
98948
+ "use strict";
98949
+
98950
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98951
+ exports.NATIVE_VERIFICATION_ACTION = void 0;
98952
+ exports.stageNativeVerificationAction = stageNativeVerificationAction;
98953
+ exports.cleanupNativeVerificationAction = cleanupNativeVerificationAction;
98954
+ const node_fs_1 = __nccwpck_require__(87561);
98955
+ const node_path_1 = __nccwpck_require__(49411);
98956
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
98957
+ const native_verification_protocol_1 = __nccwpck_require__(88709);
98958
+ exports.NATIVE_VERIFICATION_ACTION = '.git/copilot-verification-setup';
98959
+ function targetPath(workspace) {
98960
+ const metadata = (0, node_path_1.join)(workspace, '.git');
98961
+ const stat = (0, node_fs_1.lstatSync)(metadata);
98962
+ if (!stat.isDirectory() || stat.isSymbolicLink() || (0, node_fs_1.realpathSync)(metadata) !== metadata)
98963
+ throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required');
98964
+ return (0, node_path_1.join)(workspace, exports.NATIVE_VERIFICATION_ACTION);
98965
+ }
98966
+ /** Native composite metadata must remain available until its deferred post steps have finished. */
98967
+ function stageNativeVerificationAction(setup, session) {
98968
+ const target = targetPath(setup.workspace);
98969
+ const record = (0, native_verification_protocol_1.readNativeRecord)(session, 'staging.json');
98970
+ if (record && record.target !== target || !record && !!(0, node_fs_1.lstatSync)(target, { throwIfNoEntry: false }))
98971
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98972
+ (0, native_verification_protocol_1.writeNativeRecord)(session, 'staging.json', { target });
98973
+ (0, node_fs_1.rmSync)(target, { recursive: true, force: true });
98974
+ (0, node_fs_1.mkdirSync)(target, { mode: 0o700 });
98975
+ for (const file of setup.files) {
98976
+ const destination = (0, node_path_1.join)(target, file.path);
98977
+ const remainder = (0, node_path_1.relative)(target, destination);
98978
+ if (!remainder || remainder.startsWith(`..${node_path_1.sep}`) || remainder === '..')
98979
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
98980
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(destination), { recursive: true, mode: 0o700 });
98981
+ (0, node_fs_1.writeFileSync)(destination, Buffer.from(file.base64, 'base64'), { mode: file.executable ? 0o700 : 0o600, flag: 'wx' });
98982
+ }
98983
+ }
98984
+ function cleanupNativeVerificationAction(session, workspace) {
98985
+ const record = (0, native_verification_protocol_1.readNativeRecord)(session, 'staging.json');
98986
+ if (!record)
98987
+ return;
98988
+ const target = targetPath(workspace);
98989
+ if (record.target !== target)
98990
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98991
+ (0, node_fs_1.rmSync)(target, { recursive: true, force: true });
98992
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(session, 'staging.json'), { force: true });
98993
+ }
98994
+
98995
+
97581
98996
  /***/ }),
97582
98997
 
97583
98998
  /***/ 35849:
@@ -97627,6 +99042,7 @@ const node_crypto_1 = __nccwpck_require__(6005);
97627
99042
  const node_child_process_1 = __nccwpck_require__(17718);
97628
99043
  const node_util_1 = __nccwpck_require__(47261);
97629
99044
  const pre_branch_sdd_1 = __nccwpck_require__(34730);
99045
+ const sdd_draft_consistency_1 = __nccwpck_require__(27910);
97630
99046
  const git_authentication_environment_1 = __nccwpck_require__(16535);
97631
99047
  const git_hook_isolation_1 = __nccwpck_require__(39764);
97632
99048
  const runFile = (0, node_util_1.promisify)(node_child_process_1.execFile);
@@ -97700,6 +99116,17 @@ class PreBranchSddWorkspaceAdapter {
97700
99116
  if (fs.existsSync(target) !== (plan.action === 'update')) {
97701
99117
  throw new Error('The SDD owner changed since analysis; restart clarification.');
97702
99118
  }
99119
+ const owners = [];
99120
+ const inventory = await this.inventoryAt(snapshot.baseSha);
99121
+ for (const file of snapshot.capabilities.find(capability => capability.id === plan.capabilityId)?.specs ?? []) {
99122
+ if (!(0, pre_branch_sdd_1.isSafeSddPath)(file))
99123
+ throw new Error('An owning SDD path is unsafe.');
99124
+ if (!inventory.files.has(file))
99125
+ throw new Error('An owning SDD is not a regular file at the immutable base.');
99126
+ assertRegularSpecFile(path.join(root, file));
99127
+ owners.push({ path: file, markdown: await this.git(['show', `${snapshot.baseSha}:${file}`]) });
99128
+ }
99129
+ (0, sdd_draft_consistency_1.validateSddDraftConsistency)(markdown, owners, inventory, plan.path);
97703
99130
  if (plan.action === 'update') {
97704
99131
  assertRegularSpecFile(target);
97705
99132
  const owner = await this.git(['show', `${snapshot.baseSha}:${plan.path}`]);
@@ -97838,7 +99265,13 @@ class PreBranchSddWorkspaceAdapter {
97838
99265
  const raw = await this.git(['show', `${first}:specs/catalog.json`]);
97839
99266
  newCapability = JSON.parse(raw).capabilities.find(capability => capability.id === prepared.plan.capabilityId);
97840
99267
  }
97841
- const recovered = await this.validateDraft(snapshot, prepared.plan, content, newCapability);
99268
+ const candidate = prepared.plan.action === 'update'
99269
+ ? (0, pre_branch_sdd_1.recoverSddUpdate)(await this.git(['show', `${prepared.baseSha}:${prepared.plan.path}`]), content) : content;
99270
+ if (!candidate)
99271
+ return undefined;
99272
+ const recovered = await this.validateDraft(snapshot, prepared.plan, candidate, newCapability);
99273
+ if (recovered.markdown !== content)
99274
+ return undefined;
97842
99275
  const committedPaths = (await this.git(['diff-tree', '--no-commit-id', '--name-only', '-r', first])).trim().split('\n').filter(Boolean).sort();
97843
99276
  if (committedPaths.join('\n') !== recovered.changedPaths.join('\n'))
97844
99277
  return undefined;
@@ -97873,6 +99306,25 @@ class PreBranchSddWorkspaceAdapter {
97873
99306
  const output = await this.git(['status', '--porcelain', '--untracked-files=all'], root);
97874
99307
  return output.split('\n').filter(Boolean).map(line => line.slice(3)).sort();
97875
99308
  }
99309
+ async inventoryAt(sha) {
99310
+ const files = new Set();
99311
+ const directories = new Set();
99312
+ const blocked = new Set();
99313
+ const tree = await this.git(['ls-tree', '-rz', '--full-tree', sha]);
99314
+ for (const entry of tree.split('\0').filter(Boolean)) {
99315
+ const tab = entry.indexOf('\t');
99316
+ const file = entry.slice(tab + 1);
99317
+ const mode = entry.slice(0, 6);
99318
+ if (mode === '100644' || mode === '100755')
99319
+ files.add(file);
99320
+ else
99321
+ blocked.add(file);
99322
+ const parts = file.split('/');
99323
+ for (let index = 1; index < parts.length; index++)
99324
+ directories.add(parts.slice(0, index).join('/'));
99325
+ }
99326
+ return { files, directories, blocked };
99327
+ }
97876
99328
  async addDetachedWorktree(sha) {
97877
99329
  const root = fs.mkdtempSync(path.join(os.tmpdir(), 'copilot-sdd-'));
97878
99330
  try {
@@ -98384,6 +99836,7 @@ const setup_organization_variable_bindings_1 = __nccwpck_require__(19698);
98384
99836
  const setup_credential_health_1 = __nccwpck_require__(68136);
98385
99837
  const setup_batch_retry_policy_1 = __nccwpck_require__(70775);
98386
99838
  const setup_runner_1 = __nccwpck_require__(94301);
99839
+ const setup_verification_action_1 = __nccwpck_require__(33156);
98387
99840
  const managedVariables = new Set([...setup_organization_variable_bindings_1.SETUP_ORGANIZATION_VARIABLE_BINDINGS.flatMap(binding => [binding.variable, binding.fallbackVariable]),
98388
99841
  'PR_APPROVAL_POLICY', 'COPILOT_ISSUE_WORKFLOW_PROFILE', 'AGENT_ALLOWED_PROVIDERS', 'AGENT_ALLOWED_MODEL_PROVIDERS', setup_runner_1.SETUP_RUNNER_REGISTRY]);
98389
99842
  class SetupBatchProviderError extends Error {
@@ -98545,6 +99998,17 @@ class SetupBatchGithubReadAdapter {
98545
99998
  const response = batchObject(await this.transport.call(token, 'GET /repos/{owner}/{repo}/git/trees/{tree_sha}', { owner: target.owner, repo: target.name, tree_sha: target.baseSha, recursive: '1' }));
98546
99999
  if (!response || response.truncated !== false || !Array.isArray(response.tree) || response.tree.length > 100000)
98547
100000
  throw new SetupBatchProviderError('malformed');
100001
+ for (const raw of response.tree) {
100002
+ const item = batchObject(raw);
100003
+ if (typeof item?.path !== 'string')
100004
+ continue;
100005
+ const candidatePath = item.path;
100006
+ const fixed = [...setup_verification_action_1.SETUP_VERIFICATION_ACTION_PARENTS, setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH].find(path => path.toLowerCase() === candidatePath.toLowerCase());
100007
+ if (fixed && (item.path !== fixed || (fixed === setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH
100008
+ ? item.type !== 'blob' || !['100644', '100755'].includes(String(item.mode))
100009
+ : item.type !== 'tree' || item.mode !== '040000')))
100010
+ throw new SetupBatchProviderError('malformed');
100011
+ }
98548
100012
  const entries = response.tree.map(batchObject).filter(entry => entry?.type !== 'tree' && typeof entry?.path === 'string' && (0, setup_batch_policy_1.validSetupBatchAssetPath)(entry.path));
98549
100013
  if (entries.length > 300)
98550
100014
  throw new SetupBatchProviderError('malformed');
@@ -99016,10 +100480,13 @@ exports.SetupGithubIdentityQueryAdapter = SetupGithubIdentityQueryAdapter;
99016
100480
  /***/ }),
99017
100481
 
99018
100482
  /***/ 75545:
99019
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
100483
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
99020
100484
 
99021
100485
  "use strict";
99022
100486
 
100487
+ var __importDefault = (this && this.__importDefault) || function (mod) {
100488
+ return (mod && mod.__esModule) ? mod : { "default": mod };
100489
+ };
99023
100490
  Object.defineProperty(exports, "__esModule", ({ value: true }));
99024
100491
  exports.SetupManagementWorkspaceAdapter = void 0;
99025
100492
  const node_fs_1 = __nccwpck_require__(87561);
@@ -99027,6 +100494,8 @@ const node_path_1 = __nccwpck_require__(49411);
99027
100494
  const node_crypto_1 = __nccwpck_require__(6005);
99028
100495
  const js_yaml_1 = __nccwpck_require__(783);
99029
100496
  const sensitive_text_1 = __nccwpck_require__(47122);
100497
+ const copilot_comment_workflow_1 = __nccwpck_require__(33430);
100498
+ const copilot_comment_inputs_json_1 = __importDefault(__nccwpck_require__(78593));
99030
100499
  const object = (value) => value && typeof value === 'object' && !Array.isArray(value) ? value : {};
99031
100500
  const digest = (source) => (0, node_crypto_1.createHash)('sha256').update(source).digest('hex');
99032
100501
  function readDocument(path) {
@@ -99117,13 +100586,34 @@ class SetupManagementWorkspaceAdapter {
99117
100586
  inspectWorkflow(file, localAction) {
99118
100587
  const { source, document } = readDocument((0, node_path_1.join)(this.root, '.github', 'workflows', file));
99119
100588
  const steps = workflowSteps(document);
99120
- const knownLocalAction = steps.some(({ step }) => step.uses === './') ? Boolean(localAction()) : false;
99121
- return steps.flatMap(({ job, step }) => {
99122
- if (!this.isCopilotStep(step, knownLocalAction))
99123
- return [];
99124
- const inputs = Object.entries(object(step.with)).flatMap(([name, value]) => installedInput(name, value));
99125
- return [{ file, action: step.uses, digest: digest(source), environmentScoped: environmentScoped(document, job, step), inputs }];
100589
+ const jobs = Object.values(object(document.jobs)).map(object);
100590
+ if (jobs.some(job => typeof job.uses === 'string'
100591
+ && /^(?:vypdev\/copilot\/|[.$]\/)\.github\/workflows\/copilot_comment_runtime\.yml(?:@|$)/iu.test(job.uses)
100592
+ && !(0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(job.uses)))
100593
+ throw new Error('Unsupported comment workflow reference.');
100594
+ const calls = jobs.filter(job => (0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(job.uses));
100595
+ if (calls.some(job => job.uses === copilot_comment_workflow_1.COPILOT_COMMENT_SELF_WORKFLOW) && !localAction())
100596
+ throw new Error('Unverified source comment workflow.');
100597
+ const reusable = calls.map(job => {
100598
+ const overrides = object(job.with);
100599
+ if (Object.keys(overrides).some(key => !['runs-on', 'issue-managed-branches', 'pre-branch-sdd', 'ai-ignore-files', 'prepare-source-verification'].includes(key)))
100600
+ throw new Error('Unknown comment workflow input.');
100601
+ const bindings = { ...copilot_comment_inputs_json_1.default };
100602
+ for (const name of ['issue-managed-branches', 'pre-branch-sdd', 'ai-ignore-files']) {
100603
+ if (overrides[name] !== undefined && overrides[name] !== '')
100604
+ bindings[name] = overrides[name];
100605
+ }
100606
+ return { file, action: job.uses === copilot_comment_workflow_1.COPILOT_COMMENT_SELF_WORKFLOW ? './' : `vypdev/copilot@${String(job.uses).split('@').at(-1)}`,
100607
+ digest: digest(source), environmentScoped: environmentScoped(document, job, {}),
100608
+ inputs: Object.entries(bindings).flatMap(([name, value]) => installedInput(name, value)) };
99126
100609
  });
100610
+ const knownLocalAction = steps.some(({ step }) => step.uses === './') ? Boolean(localAction()) : false;
100611
+ return [...reusable, ...steps.flatMap(({ job, step }) => {
100612
+ if (!this.isCopilotStep(step, knownLocalAction))
100613
+ return [];
100614
+ const inputs = Object.entries(object(step.with)).flatMap(([name, value]) => installedInput(name, value));
100615
+ return [{ file, action: step.uses, digest: digest(source), environmentScoped: environmentScoped(document, job, step), inputs }];
100616
+ })];
99127
100617
  }
99128
100618
  isCopilotStep(step, knownLocalAction) {
99129
100619
  if (typeof step.uses !== 'string')
@@ -101853,6 +103343,190 @@ function boundedClient(client, deadline) {
101853
103343
  }
101854
103344
 
101855
103345
 
103346
+ /***/ }),
103347
+
103348
+ /***/ 12471:
103349
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
103350
+
103351
+ "use strict";
103352
+
103353
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
103354
+ if (k2 === undefined) k2 = k;
103355
+ var desc = Object.getOwnPropertyDescriptor(m, k);
103356
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
103357
+ desc = { enumerable: true, get: function() { return m[k]; } };
103358
+ }
103359
+ Object.defineProperty(o, k2, desc);
103360
+ }) : (function(o, m, k, k2) {
103361
+ if (k2 === undefined) k2 = k;
103362
+ o[k2] = m[k];
103363
+ }));
103364
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
103365
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
103366
+ }) : function(o, v) {
103367
+ o["default"] = v;
103368
+ });
103369
+ var __importStar = (this && this.__importStar) || (function () {
103370
+ var ownKeys = function(o) {
103371
+ ownKeys = Object.getOwnPropertyNames || function (o) {
103372
+ var ar = [];
103373
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
103374
+ return ar;
103375
+ };
103376
+ return ownKeys(o);
103377
+ };
103378
+ return function (mod) {
103379
+ if (mod && mod.__esModule) return mod;
103380
+ var result = {};
103381
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
103382
+ __setModuleDefault(result, mod);
103383
+ return result;
103384
+ };
103385
+ })();
103386
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
103387
+ exports.inspectSetupVerificationActionPath = inspectSetupVerificationActionPath;
103388
+ exports.readSetupVerificationActionStarter = readSetupVerificationActionStarter;
103389
+ exports.createSetupVerificationAction = createSetupVerificationAction;
103390
+ const fs = __importStar(__nccwpck_require__(87561));
103391
+ const node_path_1 = __nccwpck_require__(49411);
103392
+ const setup_verification_action_1 = __nccwpck_require__(33156);
103393
+ 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.`);
103394
+ 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.`);
103395
+ const sameDirectory = (left, right) => left.ino > 0n
103396
+ && left.dev === right.dev && left.ino === right.ino;
103397
+ const directoryFlags = fs.constants.O_RDONLY | (fs.constants.O_DIRECTORY ?? 0)
103398
+ | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0);
103399
+ function entry(path) {
103400
+ try {
103401
+ return fs.lstatSync(path, { bigint: true });
103402
+ }
103403
+ catch (error) {
103404
+ if (error.code === 'ENOENT')
103405
+ return undefined;
103406
+ throw error;
103407
+ }
103408
+ }
103409
+ /** Inspect metadata only: consumer action contents and auxiliary files are never read. */
103410
+ function inspectSetupVerificationActionPath(root) {
103411
+ for (const parent of setup_verification_action_1.SETUP_VERIFICATION_ACTION_PARENTS) {
103412
+ const info = entry((0, node_path_1.join)(root, parent));
103413
+ if (!info)
103414
+ return 'create';
103415
+ if (!info.isDirectory() || info.isSymbolicLink())
103416
+ throw unsafe();
103417
+ }
103418
+ const info = entry((0, node_path_1.join)(root, setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH));
103419
+ if (!info)
103420
+ return 'create';
103421
+ if (!info.isFile() || info.isSymbolicLink())
103422
+ throw unsafe();
103423
+ return 'preserve';
103424
+ }
103425
+ /** Resolve the package-controlled starter, independently of workflow test overrides. */
103426
+ function readSetupVerificationActionStarter() {
103427
+ return fs.readFileSync((0, node_path_1.join)(__dirname, '..', '..', 'setup/actions/copilot-verification-setup/action.yml'), 'utf8');
103428
+ }
103429
+ /** Exclusive creation cannot truncate a file that wins the Apply race. */
103430
+ function createSetupVerificationAction(root, expected) {
103431
+ const state = inspectSetupVerificationActionPath(root);
103432
+ if (expected && expected !== state)
103433
+ throw stale();
103434
+ if (state === 'preserve')
103435
+ return { copied: 0, skipped: 1 };
103436
+ const content = readSetupVerificationActionStarter();
103437
+ const absoluteRoot = fs.realpathSync(root);
103438
+ const previousDirectory = fs.realpathSync('.');
103439
+ // Node has no portable openat. Pin each validated directory as the OS cwd,
103440
+ // then use only single-component relative operations. On POSIX this retains
103441
+ // the directory even if renamed; Windows locks the current directory.
103442
+ // This critical section is synchronous: never await or invoke user callbacks
103443
+ // here. The installer owns this main-thread section and always restores cwd.
103444
+ try {
103445
+ enterPinnedDirectory(absoluteRoot);
103446
+ for (const segment of ['.github', 'actions', 'copilot-verification-setup']) {
103447
+ try {
103448
+ fs.mkdirSync(segment);
103449
+ }
103450
+ catch (error) {
103451
+ if (error.code !== 'EEXIST')
103452
+ throw error;
103453
+ }
103454
+ enterPinnedDirectory(segment);
103455
+ }
103456
+ // Detect a relocated route before creation as well as after writing. A
103457
+ // replacement after this check cannot redirect the cwd-relative open.
103458
+ inspectSetupVerificationActionPath(absoluteRoot);
103459
+ writeStarterInPinnedDirectory(absoluteRoot, content);
103460
+ }
103461
+ finally {
103462
+ process.chdir(previousDirectory);
103463
+ }
103464
+ return { copied: 1, skipped: 0 };
103465
+ }
103466
+ function enterPinnedDirectory(path) {
103467
+ let descriptor;
103468
+ try {
103469
+ descriptor = fs.openSync(path, directoryFlags);
103470
+ }
103471
+ catch (error) {
103472
+ if (['ELOOP', 'ENOTDIR'].includes(error.code))
103473
+ throw unsafe();
103474
+ throw error;
103475
+ }
103476
+ try {
103477
+ // Keep the directory handle open until cwd is pinned, preventing inode reuse.
103478
+ const bound = fs.fstatSync(descriptor, { bigint: true });
103479
+ const observed = fs.lstatSync(path, { bigint: true });
103480
+ if (!bound.isDirectory() || !observed.isDirectory() || observed.isSymbolicLink())
103481
+ throw unsafe();
103482
+ if (!sameDirectory(bound, observed))
103483
+ throw stale();
103484
+ process.chdir(path);
103485
+ if (!sameDirectory(bound, fs.lstatSync('.', { bigint: true })))
103486
+ throw stale();
103487
+ }
103488
+ finally {
103489
+ fs.closeSync(descriptor);
103490
+ }
103491
+ }
103492
+ function writeStarterInPinnedDirectory(root, content) {
103493
+ const destination = 'action.yml';
103494
+ let descriptor;
103495
+ try {
103496
+ descriptor = fs.openSync(destination, 'wx', 0o644);
103497
+ }
103498
+ catch (error) {
103499
+ if (error.code === 'EEXIST')
103500
+ throw stale();
103501
+ throw error;
103502
+ }
103503
+ let created;
103504
+ try {
103505
+ try {
103506
+ created = fs.fstatSync(descriptor, { bigint: true });
103507
+ fs.writeFileSync(descriptor, content, 'utf8');
103508
+ if (inspectSetupVerificationActionPath(root) !== 'preserve')
103509
+ throw stale();
103510
+ 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 })))
103511
+ throw stale();
103512
+ }
103513
+ finally {
103514
+ fs.closeSync(descriptor);
103515
+ }
103516
+ }
103517
+ catch (error) {
103518
+ // Remove only our incomplete file, never a concurrent replacement.
103519
+ try {
103520
+ const current = entry(destination);
103521
+ if (created && current?.dev === created.dev && current.ino === created.ino)
103522
+ fs.unlinkSync(destination);
103523
+ }
103524
+ catch { /* Preserve the original failure; an incomplete asset needs inspection. */ }
103525
+ throw error;
103526
+ }
103527
+ }
103528
+
103529
+
101856
103530
  /***/ }),
101857
103531
 
101858
103532
  /***/ 5729:
@@ -101882,6 +103556,7 @@ class SetupWorkspaceMutationAdapter {
101882
103556
  updateExistingWorkflows: selection?.updateExistingWorkflows,
101883
103557
  approvedWorkflowFiles: selection?.approvedWorkflowFiles,
101884
103558
  setupConfiguration: selection?.setupConfiguration,
103559
+ verificationActionState: selection.verificationActionState,
101885
103560
  });
101886
103561
  }
101887
103562
  hasValidToken(tokenOverride) {
@@ -102096,7 +103771,7 @@ const ALLOWED_VARIABLES = [
102096
103771
  * credentials or paths to local agent authentication stores.
102097
103772
  */
102098
103773
  function prepareUntrustedCommandEnvironment(source = process.env, platform = process.platform) {
102099
- const runtimeHome = (0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)();
103774
+ const runtimeHome = (0, node_fs_1.realpathSync)((0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)());
102100
103775
  const environment = { HOME: runtimeHome };
102101
103776
  for (const variable of ALLOWED_VARIABLES) {
102102
103777
  const value = source[variable];
@@ -102124,6 +103799,39 @@ function prepareUntrustedCommandEnvironment(source = process.env, platform = pro
102124
103799
  }
102125
103800
 
102126
103801
 
103802
+ /***/ }),
103803
+
103804
+ /***/ 20878:
103805
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
103806
+
103807
+ "use strict";
103808
+
103809
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
103810
+ exports.verificationExecutable = verificationExecutable;
103811
+ const node_fs_1 = __nccwpck_require__(87561);
103812
+ const node_path_1 = __nccwpck_require__(49411);
103813
+ /** @actions/exec resolves basenames against its own process PATH; native tools belong to the verifier PATH. */
103814
+ function verificationExecutable(program, environment, platform = process.platform) {
103815
+ const explicit = (0, node_path_1.isAbsolute)(program) || /[\\/]/u.test(program);
103816
+ 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)));
103817
+ const windowsExtensions = (environment.PATHEXT || '.COM;.EXE;.BAT;.CMD').split(';').filter(Boolean);
103818
+ const hasWindowsExtension = windowsExtensions.some(extension => program.toLowerCase().endsWith(extension.toLowerCase()));
103819
+ const extensions = platform === 'win32' && !hasWindowsExtension ? windowsExtensions : [''];
103820
+ for (const candidate of candidates)
103821
+ for (const extension of extensions) {
103822
+ const file = candidate + extension;
103823
+ try {
103824
+ if ((0, node_fs_1.statSync)(file).isFile()) {
103825
+ (0, node_fs_1.accessSync)(file, node_fs_1.constants.X_OK);
103826
+ return file;
103827
+ }
103828
+ }
103829
+ catch { /* Try only the next executable in the isolated PATH. */ }
103830
+ }
103831
+ throw new Error('Verification executable is unavailable in the isolated PATH.');
103832
+ }
103833
+
103834
+
102127
103835
  /***/ }),
102128
103836
 
102129
103837
  /***/ 91053:
@@ -102250,6 +103958,267 @@ function checkRuntime(requirement, environment, run, platform, job) {
102250
103958
  }
102251
103959
 
102252
103960
 
103961
+ /***/ }),
103962
+
103963
+ /***/ 23358:
103964
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
103965
+
103966
+ "use strict";
103967
+
103968
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
103969
+ exports.applyVerificationSetupResult = applyVerificationSetupResult;
103970
+ const node_fs_1 = __nccwpck_require__(87561);
103971
+ const node_path_1 = __nccwpck_require__(49411);
103972
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
103973
+ function contained(root, path) {
103974
+ const remainder = (0, node_path_1.relative)(root, path);
103975
+ return remainder === '' || (remainder !== '..' && !remainder.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(remainder));
103976
+ }
103977
+ /** Accept only existing contained directories, checking both lexical paths and symlink targets. */
103978
+ function approvedDirectory(value, roots) {
103979
+ if (!(0, node_path_1.isAbsolute)(value) || value.includes(node_path_1.delimiter) || value.split(/[\\/]/u).includes('..')
103980
+ || !roots.some(root => contained(root, value)))
103981
+ throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
103982
+ const actual = (0, node_fs_1.realpathSync)(value);
103983
+ if (!roots.some(root => contained(root, actual)) || !(0, node_fs_1.lstatSync)(actual).isDirectory())
103984
+ throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
103985
+ return actual;
103986
+ }
103987
+ function applyVerificationSetupResult(file, environment, roots) {
103988
+ let descriptor;
103989
+ try {
103990
+ let before;
103991
+ try {
103992
+ before = (0, node_fs_1.lstatSync)(file, { bigint: true });
103993
+ }
103994
+ catch (error) {
103995
+ if (error.code === 'ENOENT')
103996
+ return;
103997
+ throw error;
103998
+ }
103999
+ if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n || before.size > BigInt(verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes))
104000
+ throw new Error();
104001
+ descriptor = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
104002
+ const opened = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
104003
+ if (!opened.isFile() || opened.nlink !== 1n || opened.dev !== before.dev || opened.ino !== before.ino
104004
+ || opened.size !== before.size || opened.mtimeNs !== before.mtimeNs)
104005
+ throw new Error();
104006
+ const bytes = Buffer.alloc(verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes + 1);
104007
+ const size = (0, node_fs_1.readSync)(descriptor, bytes, 0, bytes.length, 0);
104008
+ if (size > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes)
104009
+ throw new Error();
104010
+ const after = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
104011
+ if (after.size !== opened.size || after.mtimeNs !== opened.mtimeNs)
104012
+ throw new Error();
104013
+ const result = (0, verification_setup_policy_1.parseVerificationSetupResult)(JSON.parse(bytes.subarray(0, size).toString('utf8')));
104014
+ const paths = result.path.map(value => approvedDirectory(value, roots));
104015
+ const javaHome = result.javaHome ? approvedDirectory(result.javaHome, roots) : undefined;
104016
+ if (paths.length)
104017
+ environment.PATH = [...paths, ...(environment.PATH ? [environment.PATH] : [])].join(node_path_1.delimiter);
104018
+ if (javaHome)
104019
+ environment.JAVA_HOME = javaHome;
104020
+ }
104021
+ catch {
104022
+ throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
104023
+ }
104024
+ finally {
104025
+ if (descriptor !== undefined)
104026
+ (0, node_fs_1.closeSync)(descriptor);
104027
+ }
104028
+ }
104029
+
104030
+
104031
+ /***/ }),
104032
+
104033
+ /***/ 11709:
104034
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
104035
+
104036
+ "use strict";
104037
+
104038
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
104039
+ exports.prepareRepositoryVerification = prepareRepositoryVerification;
104040
+ const verification_setup_snapshot_1 = __nccwpck_require__(62148);
104041
+ const native_verification_profiles_1 = __nccwpck_require__(22290);
104042
+ const node_fs_1 = __nccwpck_require__(87561);
104043
+ const node_path_1 = __nccwpck_require__(49411);
104044
+ const node_crypto_1 = __nccwpck_require__(6005);
104045
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
104046
+ const verification_setup_result_1 = __nccwpck_require__(23358);
104047
+ const logging_ports_1 = __nccwpck_require__(6152);
104048
+ const native_verification_protocol_1 = __nccwpck_require__(88709);
104049
+ const native_verification_staging_1 = __nccwpck_require__(63587);
104050
+ const native_verification_candidate_1 = __nccwpck_require__(18883);
104051
+ /** The runner executes YAML. This adapter pauses the admitted call stack at its verification boundary. */
104052
+ async function prepareRepositoryVerification(setup, environment) {
104053
+ if (setup.kind === 'disabled')
104054
+ return;
104055
+ if (setup.kind === 'blocked')
104056
+ throw new verification_setup_policy_1.VerificationSetupError(setup.reason, setup.sourceSha);
104057
+ const session = process.env.COPILOT_NATIVE_WORKER_SESSION;
104058
+ if (!session)
104059
+ throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required', setup.sourceSha);
104060
+ let requestCreated = false;
104061
+ try {
104062
+ (0, native_verification_protocol_1.nativeSession)(session);
104063
+ const requests = (0, native_verification_protocol_1.readNativeRecord)(session, 'request-count.json')?.count ?? 0;
104064
+ if (requests >= verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.requests)
104065
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
104066
+ (0, native_verification_protocol_1.writeNativeRecord)(session, 'request-count.json', { count: requests + 1 });
104067
+ if ((0, node_fs_1.realpathSync)(process.cwd()) !== setup.workspace)
104068
+ throw new verification_setup_policy_1.VerificationSetupError('workspace-changed');
104069
+ (0, native_verification_profiles_1.registerNativeVerificationProfile)(session, environment.HOME);
104070
+ const identity = (0, native_verification_candidate_1.verificationCandidateIdentity)(setup.workspace, environment);
104071
+ (0, native_verification_staging_1.stageNativeVerificationAction)(setup, session);
104072
+ const id = (0, node_crypto_1.randomUUID)();
104073
+ (0, native_verification_protocol_1.writeNativeRecord)(session, 'request.json', { id, sourceSha: setup.sourceSha, digest: (0, verification_setup_snapshot_1.verificationSetupDigest)(setup), environment });
104074
+ requestCreated = true;
104075
+ (0, logging_ports_1.logInfo)(`Preparing repository verification (${verification_setup_policy_1.VERIFICATION_SETUP_PATH}; trusted source SHA: ${setup.sourceSha}).`);
104076
+ const deadline = Date.now() + verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.timeoutMs;
104077
+ let response;
104078
+ while (!(response = (0, native_verification_protocol_1.readNativeRecord)(session, `response-${id}.json`))) {
104079
+ if ((0, native_verification_protocol_1.readNativeRecord)(session, 'cancel.json'))
104080
+ throw new verification_setup_policy_1.VerificationSetupError('cancelled');
104081
+ if (Date.now() >= deadline)
104082
+ throw new verification_setup_policy_1.VerificationSetupError('timeout');
104083
+ await (0, native_verification_protocol_1.nativePause)(100);
104084
+ }
104085
+ if (response.id !== id || response.success !== true)
104086
+ throw new verification_setup_policy_1.VerificationSetupError('process-failed');
104087
+ if ((0, native_verification_candidate_1.verificationCandidateIdentity)(setup.workspace, environment) !== identity)
104088
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
104089
+ if (typeof response.path !== 'string' || response.path.length > 16384 || response.javaHome !== undefined && typeof response.javaHome !== 'string')
104090
+ throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
104091
+ const original = new Set((environment.PATH ?? '').split(node_path_1.delimiter));
104092
+ const previousProfiles = (0, native_verification_profiles_1.nativeVerificationProfilePaths)(session).filter(profile => profile !== environment.HOME);
104093
+ const fromPreviousProfile = (path) => previousProfiles.some(profile => {
104094
+ const part = (0, node_path_1.relative)(profile, path);
104095
+ return part === '' || part !== '..' && !part.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(part);
104096
+ });
104097
+ const additions = [...new Set(response.path.split(node_path_1.delimiter).filter(path => path && !original.has(path) && !fromPreviousProfile(path)))];
104098
+ const result = (0, node_path_1.join)(environment.HOME, 'native-setup-result.json');
104099
+ (0, node_fs_1.writeFileSync)(result, JSON.stringify({ schemaVersion: 1, path: additions,
104100
+ environment: response.javaHome && response.javaHome !== environment.JAVA_HOME ? { JAVA_HOME: response.javaHome } : {} }), { mode: 0o600, flag: 'wx' });
104101
+ (0, verification_setup_result_1.applyVerificationSetupResult)(result, environment, [setup.workspace, environment.HOME, ...(setup.toolRoot ? [setup.toolRoot] : [])]);
104102
+ (0, logging_ports_1.logInfo)('Repository setup completed; runtime preflight and verification may proceed.');
104103
+ }
104104
+ catch (error) {
104105
+ throw new verification_setup_policy_1.VerificationSetupError(error instanceof verification_setup_policy_1.VerificationSetupError ? error.reason : 'handoff-invalid', setup.sourceSha);
104106
+ }
104107
+ finally {
104108
+ if (requestCreated)
104109
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(session, 'request.json'), { force: true });
104110
+ }
104111
+ }
104112
+
104113
+
104114
+ /***/ }),
104115
+
104116
+ /***/ 62148:
104117
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
104118
+
104119
+ "use strict";
104120
+
104121
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
104122
+ exports.verificationSetupDigest = verificationSetupDigest;
104123
+ exports.captureVerificationSetup = captureVerificationSetup;
104124
+ exports.captureVerificationSetupAtCommit = captureVerificationSetupAtCommit;
104125
+ const node_path_1 = __nccwpck_require__(49411);
104126
+ const node_child_process_1 = __nccwpck_require__(17718);
104127
+ const node_crypto_1 = __nccwpck_require__(6005);
104128
+ const node_fs_1 = __nccwpck_require__(87561);
104129
+ const js_yaml_1 = __nccwpck_require__(783);
104130
+ const verification_setup_ports_1 = __nccwpck_require__(26509);
104131
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
104132
+ const untrusted_command_environment_1 = __nccwpck_require__(2304);
104133
+ /** Only immutable Git objects are read. Errors remain deferred on non-verifying routes. */
104134
+ function verificationSetupDigest(setup) {
104135
+ return (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(setup.files)).digest('hex');
104136
+ }
104137
+ function captureVerificationSetup(enabled, mainBranch, root = process.cwd()) {
104138
+ return capture(enabled, mainBranch, root);
104139
+ }
104140
+ /** Post steps use the already pinned commit from runner state, never a mutable branch ref. */
104141
+ function captureVerificationSetupAtCommit(commit, root = process.cwd(), gitExecutable) {
104142
+ return capture(true, '', root, commit, gitExecutable);
104143
+ }
104144
+ function capture(enabled, mainBranch, root, pinned, gitExecutable) {
104145
+ if (!enabled)
104146
+ return verification_setup_ports_1.DISABLED_VERIFICATION_SETUP;
104147
+ let sourceSha;
104148
+ let runtime;
104149
+ let snapshot;
104150
+ try {
104151
+ runtime = (0, untrusted_command_environment_1.prepareUntrustedCommandEnvironment)();
104152
+ const environment = runtime.environment;
104153
+ if (!pinned && (!/^[A-Za-z0-9][A-Za-z0-9._/-]{0,200}$/u.test(mainBranch) || mainBranch.includes('..')
104154
+ || mainBranch.includes('//') || mainBranch.endsWith('/') || mainBranch.endsWith('.lock')))
104155
+ throw new Error();
104156
+ if (gitExecutable !== undefined && !(0, node_path_1.isAbsolute)(gitExecutable))
104157
+ throw new Error();
104158
+ const workspace = (0, node_fs_1.realpathSync)(root);
104159
+ const git = (...args) => {
104160
+ const result = (0, node_child_process_1.spawnSync)(gitExecutable ?? 'git', ['--no-replace-objects', ...args], { cwd: workspace, env: environment,
104161
+ shell: false, windowsHide: true, timeout: 5000, maxBuffer: verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.snapshotBytes + 4096 });
104162
+ if (result.error || result.status !== 0)
104163
+ throw new Error();
104164
+ return result.stdout;
104165
+ };
104166
+ const sha = pinned ?? git('rev-parse', '--verify', `refs/remotes/origin/${mainBranch}^{commit}`).toString('utf8').trim();
104167
+ if (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(sha))
104168
+ throw new Error();
104169
+ sourceSha = sha;
104170
+ const entries = git('ls-tree', '-rz', sourceSha, '--', verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY).toString('utf8').split('\0').filter(Boolean);
104171
+ if (!entries.length || entries.length > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.files)
104172
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104173
+ let total = 0;
104174
+ const files = entries.map(entry => {
104175
+ const match = /^(100644|100755) blob ([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(entry);
104176
+ if (!match || !match[3].startsWith(`${verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY}/`))
104177
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104178
+ const path = match[3].slice(verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY.length + 1);
104179
+ 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)))
104180
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104181
+ const bytes = git('cat-file', 'blob', match[2]);
104182
+ total += bytes.length;
104183
+ const digest = (0, node_crypto_1.createHash)(match[2].length === 40 ? 'sha1' : 'sha256').update(`blob ${bytes.length}\0`).update(bytes).digest('hex');
104184
+ if (bytes.length > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.scriptBytes || total > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.snapshotBytes || digest !== match[2])
104185
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104186
+ return Object.freeze({ path, base64: bytes.toString('base64'), executable: match[1] === '100755' });
104187
+ });
104188
+ const manifest = files.find(file => file.path === 'action.yml');
104189
+ if (!manifest)
104190
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104191
+ const bytes = Buffer.from(manifest.base64, 'base64');
104192
+ const text = bytes.toString('utf8');
104193
+ if (!bytes.length || !bytes.equals(Buffer.from(text)) || text.includes('\0'))
104194
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104195
+ let action;
104196
+ try {
104197
+ action = (0, js_yaml_1.load)(text);
104198
+ }
104199
+ catch {
104200
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104201
+ }
104202
+ if (action?.runs?.using !== 'composite' || !Array.isArray(action.runs.steps) || !action.runs.steps.length || action.runs.steps.length > 32)
104203
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104204
+ if (action.runs.steps.some(step => !step || typeof step !== 'object' || 'uses' in step && typeof step.uses === 'string' && step.uses.startsWith('./')))
104205
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104206
+ const toolRoot = environment.RUNNER_TOOL_CACHE ? (0, node_fs_1.realpathSync)(environment.RUNNER_TOOL_CACHE) : undefined;
104207
+ snapshot = Object.freeze({ kind: 'ready', files: Object.freeze(files), sourceSha, workspace, ...(toolRoot ? { toolRoot } : {}) });
104208
+ }
104209
+ catch (error) {
104210
+ snapshot = Object.freeze({ kind: 'blocked', reason: error instanceof verification_setup_policy_1.VerificationSetupError ? error.reason : 'source-unavailable', ...(sourceSha ? { sourceSha } : {}) });
104211
+ }
104212
+ try {
104213
+ runtime?.cleanup();
104214
+ }
104215
+ catch {
104216
+ snapshot = Object.freeze({ kind: 'blocked', reason: 'source-unavailable', ...(sourceSha ? { sourceSha } : {}) });
104217
+ }
104218
+ return snapshot;
104219
+ }
104220
+
104221
+
102253
104222
  /***/ }),
102254
104223
 
102255
104224
  /***/ 92540:
@@ -102407,26 +104376,64 @@ const logger_1 = __nccwpck_require__(91151);
102407
104376
  const issue_content_interface_1 = __nccwpck_require__(60608);
102408
104377
  const configuration_payload_policy_1 = __nccwpck_require__(58043);
102409
104378
  const application_error_1 = __nccwpck_require__(75999);
104379
+ const configuration_markers_1 = __nccwpck_require__(4586);
102410
104380
  class ConfigurationHandler extends issue_content_interface_1.IssueContentInterface {
102411
104381
  constructor() {
102412
104382
  super(...arguments);
104383
+ this.getContent = (description) => {
104384
+ const block = (0, configuration_markers_1.readConfigurationBlock)(description);
104385
+ return block.kind === 'present' ? block.content : undefined;
104386
+ };
104387
+ this.updateContent = (description, content) => {
104388
+ if (description === undefined || content === undefined)
104389
+ return undefined;
104390
+ const updated = (0, configuration_markers_1.writeConfigurationBlock)(description, content);
104391
+ if (updated === undefined)
104392
+ (0, logger_1.logError)('The content has a problem with open-close tags: stored configuration.');
104393
+ return updated;
104394
+ };
102413
104395
  this.update = async (query, context) => {
102414
104396
  const storedRaw = await this.internalGetter(query);
102415
104397
  return this.internalUpdate(query, (0, configuration_payload_policy_1.buildConfigurationPayload)(context, storedRaw));
102416
104398
  };
102417
104399
  this.get = async (query) => {
104400
+ let description;
104401
+ try {
104402
+ description = await this.issueDescriptionPort.getDescription(query.owner, query.repository, query.issueNumber, query.token);
104403
+ }
104404
+ catch (cause) {
104405
+ const semanticError = (0, application_error_1.toApplicationError)(cause, 'provider.unavailable', 'Unable to read issue configuration.');
104406
+ (0, logger_1.logError)(semanticError);
104407
+ throw semanticError;
104408
+ }
104409
+ const variables = { issueNumber: query.issueNumber, expectedVersion: config_1.CONFIG_SCHEMA_VERSION };
104410
+ let recovery = { id: 'stored-configuration-invalid', variables };
102418
104411
  try {
102419
- const description = await this.issueDescriptionPort.getDescription(query.owner, query.repository, query.issueNumber, query.token);
102420
104412
  const config = this.getContent(description);
102421
104413
  if (config === undefined) {
104414
+ if ((0, configuration_markers_1.readConfigurationBlock)(description).kind === 'invalid') {
104415
+ throw new Error('Stored configuration markers are inconsistent.');
104416
+ }
102422
104417
  return undefined;
102423
104418
  }
102424
- const branchConfig = (0, config_1.requireCurrentConfigurationPayload)(JSON.parse(config));
104419
+ const parsed = JSON.parse(config);
104420
+ if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
104421
+ const version = parsed.schemaVersion;
104422
+ if (version === undefined) {
104423
+ recovery = { id: 'stored-configuration-schema-missing', variables };
104424
+ }
104425
+ else if (typeof version === 'number' && Number.isSafeInteger(version)
104426
+ && version >= 0 && version !== config_1.CONFIG_SCHEMA_VERSION) {
104427
+ recovery = { id: 'stored-configuration-schema-unsupported', variables: { ...variables, actualVersion: version } };
104428
+ }
104429
+ }
104430
+ const branchConfig = (0, config_1.requireCurrentConfigurationPayload)(parsed);
102425
104431
  return new config_1.Config(branchConfig);
102426
104432
  }
102427
- catch (error) {
102428
- (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'configuration.invalid', 'Unable to read issue configuration.'));
102429
- throw error;
104433
+ catch (cause) {
104434
+ const semanticError = (0, application_error_1.toApplicationError)(cause, 'configuration.invalid', 'Stored issue/PR configuration is invalid.', { recovery });
104435
+ (0, logger_1.logError)(semanticError);
104436
+ throw semanticError;
102430
104437
  }
102431
104438
  };
102432
104439
  }
@@ -102440,6 +104447,96 @@ class ConfigurationHandler extends issue_content_interface_1.IssueContentInterfa
102440
104447
  exports.ConfigurationHandler = ConfigurationHandler;
102441
104448
 
102442
104449
 
104450
+ /***/ }),
104451
+
104452
+ /***/ 4586:
104453
+ /***/ ((__unused_webpack_module, exports) => {
104454
+
104455
+ "use strict";
104456
+
104457
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
104458
+ exports.CONFIGURATION_END = exports.CONFIGURATION_START = void 0;
104459
+ exports.readConfigurationBlock = readConfigurationBlock;
104460
+ exports.writeConfigurationBlock = writeConfigurationBlock;
104461
+ exports.CONFIGURATION_START = '<!-- copilot-configuration-start';
104462
+ exports.CONFIGURATION_END = 'copilot-configuration-end -->';
104463
+ /** Owned delimiters begin a line; ordinary mentions are not state. Complete legacy fenced records remain readable. */
104464
+ function readConfigurationBlock(description) {
104465
+ if (description === undefined)
104466
+ return { kind: 'absent' };
104467
+ let fence;
104468
+ let fencedMarker = false;
104469
+ let fencedStart;
104470
+ let nestedFencedStart = false;
104471
+ let start;
104472
+ let contentStart = 0;
104473
+ let block;
104474
+ let offset = 0;
104475
+ for (const line of description.match(/[^\n]*(?:\n|$)/gu) ?? []) {
104476
+ const text = line.replace(/\r?\n$/u, '');
104477
+ const starts = /^ {0,3}<!-- copilot-configuration-start(?:[ \t]|$)/u.test(text);
104478
+ const ends = /^ {0,3}copilot-configuration-end -->[ \t]*$/u.test(text);
104479
+ const boundary = /^ {0,3}(`{3,}|~{3,})(.*)$/u.exec(text);
104480
+ if (fence) {
104481
+ fencedMarker || (fencedMarker = starts || ends);
104482
+ if (starts) {
104483
+ if (fencedStart !== undefined)
104484
+ nestedFencedStart = true;
104485
+ else
104486
+ fencedStart = offset + text.indexOf(exports.CONFIGURATION_START);
104487
+ }
104488
+ const end = text.indexOf(exports.CONFIGURATION_END);
104489
+ if (fencedStart !== undefined && end >= 0 && !text.slice(end + exports.CONFIGURATION_END.length).trim()) {
104490
+ if (block || nestedFencedStart)
104491
+ return { kind: 'invalid' };
104492
+ block = { kind: 'present', start: fencedStart, end: offset + end + exports.CONFIGURATION_END.length,
104493
+ content: description.slice(fencedStart + exports.CONFIGURATION_START.length, offset + end) };
104494
+ fencedStart = undefined;
104495
+ }
104496
+ if (boundary && boundary[1][0] === fence[0] && boundary[1].length >= fence.length && !boundary[2].trim()) {
104497
+ fence = undefined;
104498
+ fencedMarker = false;
104499
+ fencedStart = undefined;
104500
+ nestedFencedStart = false;
104501
+ }
104502
+ }
104503
+ else if (start !== undefined || starts) {
104504
+ if (starts) {
104505
+ if (start !== undefined || block)
104506
+ return { kind: 'invalid' };
104507
+ start = offset + text.indexOf(exports.CONFIGURATION_START);
104508
+ contentStart = start + exports.CONFIGURATION_START.length;
104509
+ }
104510
+ const end = text.indexOf(exports.CONFIGURATION_END);
104511
+ if (end >= 0 && !text.slice(end + exports.CONFIGURATION_END.length).trim()) {
104512
+ block = { kind: 'present', start: start, end: offset + end + exports.CONFIGURATION_END.length,
104513
+ content: description.slice(contentStart, offset + end) };
104514
+ start = undefined;
104515
+ }
104516
+ }
104517
+ else if (ends)
104518
+ return { kind: 'invalid' };
104519
+ else if (boundary && (boundary[1][0] !== '`' || !boundary[2].includes('`')))
104520
+ fence = boundary[1];
104521
+ offset += line.length;
104522
+ }
104523
+ // A legacy block behind an unclosed fence is ambiguous: never silently discard its state.
104524
+ if (start !== undefined || fence && fencedMarker)
104525
+ return { kind: 'invalid' };
104526
+ return block ?? { kind: 'absent', ...(fence ? { closingFence: fence } : {}) };
104527
+ }
104528
+ function writeConfigurationBlock(description, content) {
104529
+ const block = readConfigurationBlock(description);
104530
+ if (block.kind === 'invalid')
104531
+ return undefined;
104532
+ const replacement = `${exports.CONFIGURATION_START}\n${content}\n${exports.CONFIGURATION_END}`;
104533
+ if (block.kind === 'present')
104534
+ return description.slice(0, block.start) + replacement + description.slice(block.end);
104535
+ // Closing an otherwise empty dangling example preserves its rendered text and keeps new state outside it.
104536
+ return `${description}\n\n${block.closingFence ? `${block.closingFence}\n\n` : ''}${replacement}`;
104537
+ }
104538
+
104539
+
102443
104540
  /***/ }),
102444
104541
 
102445
104542
  /***/ 58043:
@@ -102569,11 +104666,13 @@ function getBranchSyncConflictsPrompt(params) {
102569
104666
  "use strict";
102570
104667
 
102571
104668
  Object.defineProperty(exports, "__esModule", ({ value: true }));
104669
+ exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION = void 0;
102572
104670
  exports.getBugbotPrompt = getBugbotPrompt;
102573
104671
  /**
102574
104672
  * Prompt for Bugbot detection (detect potential problems on push).
102575
104673
  */
102576
104674
  const fill_1 = __nccwpck_require__(2559);
104675
+ 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.';
102577
104676
  const TEMPLATE = `You are analyzing the latest code changes for potential bugs and issues.
102578
104677
 
102579
104678
  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}}\`.
@@ -102609,6 +104708,8 @@ For every finding:
102609
104708
  - include the nearest stable \`symbol\` and a minimal exact \`codeSnippet\` when available so the finding can survive rebases, line movement, and file renames.
102610
104709
  - when a fix is a safe replacement of exactly the reported line range, include only the replacement text in \`suggestedCode\`; otherwise omit it.
102611
104710
 
104711
+ ${exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION}
104712
+
102612
104713
  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.
102613
104714
  {{previousBlock}}
102614
104715
 
@@ -103512,6 +105613,7 @@ exports.buildBugbotBenchmarkPrompt = buildBugbotBenchmarkPrompt;
103512
105613
  const schema_1 = __nccwpck_require__(16808);
103513
105614
  const untrusted_content_1 = __nccwpck_require__(67057);
103514
105615
  const prepare_bugbot_findings_policy_1 = __nccwpck_require__(3496);
105616
+ const bugbot_1 = __nccwpck_require__(56998);
103515
105617
  const MAX_BENCHMARK_CASES = 200;
103516
105618
  /** Executes the real configured findings agent against every case, sequentially. */
103517
105619
  async function runBugbotBenchmarkAgent(corpus, agent, configuration) {
@@ -103539,6 +105641,8 @@ function buildBugbotBenchmarkPrompt(testCase) {
103539
105641
  You are running a controlled Bugbot quality benchmark.
103540
105642
  Review only the supplied synthetic diff. Report actionable defects caused by added or changed code; do not report style, pre-existing issues, or speculative concerns. Return an empty findings array when the change is safe.
103541
105643
 
105644
+ ${bugbot_1.BUGBOT_FINDING_GROUNDING_INSTRUCTION}
105645
+
103542
105646
  Language: ${testCase.language}
103543
105647
  Repository-relative file: ${testCase.file}
103544
105648
  First displayed line: ${testCase.startLine}
@@ -104581,11 +106685,13 @@ const setup_approval_workflow_1 = __nccwpck_require__(9512);
104581
106685
  const setup_workflow_upgrade_1 = __nccwpck_require__(85493);
104582
106686
  const setup_installation_review_1 = __nccwpck_require__(23799);
104583
106687
  const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
106688
+ const setup_verification_action_1 = __nccwpck_require__(12471);
104584
106689
  /**
104585
106690
  * Ensure .github, .github/workflows and .github/ISSUE_TEMPLATE exist; create them if missing.
104586
106691
  * @param cwd - Directory (repo root)
104587
106692
  */
104588
106693
  function ensureGitHubDirs(cwd) {
106694
+ (0, setup_verification_action_1.inspectSetupVerificationActionPath)(cwd);
104589
106695
  const githubDir = path.join(cwd, '.github');
104590
106696
  const workflowsDir = path.join(cwd, '.github', 'workflows');
104591
106697
  const issueTemplateDir = path.join(cwd, '.github', 'ISSUE_TEMPLATE');
@@ -104618,6 +106724,7 @@ function copySetupFiles(cwd, setupDirOverride, features, options = {}) {
104618
106724
  const installationReview = options.setupConfiguration && (0, setup_installation_review_1.inspectSetupInstallation)(cwd, options.setupConfiguration, setupDir);
104619
106725
  if (installationReview?.blockers.length)
104620
106726
  throw new Error(installationReview.blockers.join(' '));
106727
+ const verificationAction = (0, setup_verification_action_1.createSetupVerificationAction)(cwd, options.verificationActionState);
104621
106728
  const preserveSourceGuidance = installationReview?.assets.some(asset => asset.path === repository_agent_guidance_policy_1.REPOSITORY_AGENT_GUIDE_PATH && asset.status === 'source-only');
104622
106729
  const sourceInstallation = installationReview?.assets.some(asset => asset.path.startsWith('.github/workflows/') && asset.status === 'source-only');
104623
106730
  const snapshotContent = options.setupConfiguration && (0, setup_installation_review_1.renderSetupRunnerSnapshot)(options.setupConfiguration);
@@ -104672,7 +106779,7 @@ function copySetupFiles(cwd, setupDirOverride, features, options = {}) {
104672
106779
  snapshot.copied++;
104673
106780
  }
104674
106781
  }
104675
- return [retired, workflows, approvalWorkflow, issueTemplates, pullRequestTemplate, guidance, snapshot].reduce((total, current) => ({
106782
+ return [verificationAction, retired, workflows, approvalWorkflow, issueTemplates, pullRequestTemplate, guidance, snapshot].reduce((total, current) => ({
104676
106783
  copied: total.copied + current.copied,
104677
106784
  skipped: total.skipped + current.skipped,
104678
106785
  }), { copied: 0, skipped: 0 });
@@ -104886,6 +106993,9 @@ const setup_workflow_upgrade_1 = __nccwpck_require__(85493);
104886
106993
  const setup_approval_workflow_1 = __nccwpck_require__(9512);
104887
106994
  const sensitive_text_1 = __nccwpck_require__(47122);
104888
106995
  const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
106996
+ const setup_verification_action_1 = __nccwpck_require__(33156);
106997
+ const setup_verification_action_2 = __nccwpck_require__(12471);
106998
+ const copilot_comment_workflow_1 = __nccwpck_require__(33430);
104889
106999
  exports.SETUP_RUNNER_SNAPSHOT = '.copilot/runner-profile.json';
104890
107000
  const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value)
104891
107001
  ? value : undefined;
@@ -104927,6 +107037,22 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
104927
107037
  const jobs = [];
104928
107038
  const changes = [];
104929
107039
  const blockers = [];
107040
+ let action;
107041
+ try {
107042
+ action = (0, setup_verification_action_2.inspectSetupVerificationActionPath)(root);
107043
+ }
107044
+ catch (error) {
107045
+ action = 'blocked';
107046
+ blockers.push(error instanceof Error ? error.message : 'Verification setup path could not be inspected.');
107047
+ }
107048
+ const verificationSetup = { action, enabled: configuration.repository.verificationSetup ?? false,
107049
+ mainBranch: configuration.repository.mainBranch };
107050
+ assets.push({ path: setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH, enabled: verificationSetup.enabled,
107051
+ status: action === 'create' ? 'missing' : action === 'preserve' ? 'customized' : 'incompatible' });
107052
+ if (action === 'blocked')
107053
+ return { assets, jobs, changes, blockers, verificationSetup };
107054
+ if (action === 'create')
107055
+ changes.push({ path: setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH, before: null, after: (0, setup_verification_action_2.readSetupVerificationActionStarter)() });
104930
107056
  const addJobs = (file, content, retained) => {
104931
107057
  const documents = (0, js_yaml_1.loadAll)(content);
104932
107058
  if (documents.length !== 1)
@@ -104935,7 +107061,7 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
104935
107061
  if (!parsedJobs)
104936
107062
  throw new Error('Workflow jobs are unavailable for review.');
104937
107063
  for (const [job, raw] of Object.entries(parsedJobs)) {
104938
- const runsOn = object(raw)?.['runs-on'];
107064
+ const runsOn = (0, copilot_comment_workflow_1.copilotCommentRunner)(object(raw));
104939
107065
  if (runsOn === undefined)
104940
107066
  continue; // reusable workflow calls have no runner
104941
107067
  jobs.push({ file, job, role: (0, setup_runner_policy_1.setupRunnerRole)(file, job) ?? 'validation',
@@ -105023,7 +107149,7 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
105023
107149
  before: before === undefined ? null : (0, sensitive_text_1.redactSensitiveText)(before), after: (0, sensitive_text_1.redactSensitiveText)(after) });
105024
107150
  if (after !== undefined && before !== undefined && !compatibleSetupRunnerSnapshot(before))
105025
107151
  blockers.push('Runner snapshot is incompatible. Retain it or restore a supported version before replacing routing.');
105026
- return { assets, jobs, changes, blockers };
107152
+ return { assets, jobs, changes, blockers, verificationSetup };
105027
107153
  }
105028
107154
 
105029
107155
 
@@ -105042,6 +107168,7 @@ const js_yaml_1 = __nccwpck_require__(783);
105042
107168
  const node_util_1 = __nccwpck_require__(47261);
105043
107169
  const setup_runner_policy_1 = __nccwpck_require__(91027);
105044
107170
  const action_types_1 = __nccwpck_require__(19625);
107171
+ const copilot_comment_workflow_1 = __nccwpck_require__(33430);
105045
107172
  const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
105046
107173
  const document = (value) => {
105047
107174
  try {
@@ -105063,6 +107190,8 @@ const runner = (value) => labels(value) || !!object(value)
105063
107190
  && (object(value).labels === undefined || labels(object(value).labels));
105064
107191
  const copilotCommands = new Set(Object.values(action_types_1.ACTIONS));
105065
107192
  const callsRootAction = (jobs) => !!jobs && Object.values(jobs).some(job => {
107193
+ if (object(job)?.uses === copilot_comment_workflow_1.COPILOT_COMMENT_SELF_WORKFLOW)
107194
+ return true;
105066
107195
  const steps = object(job)?.steps;
105067
107196
  return Array.isArray(steps) && steps.some(step => {
105068
107197
  const invocation = object(step);
@@ -105125,6 +107254,32 @@ function renderSetupWorkflowUpgrade(template, existing, selection) {
105125
107254
  const templateJobs = object(document(template)?.jobs);
105126
107255
  if (!previousJobs || !templateJobs)
105127
107256
  throw new Error('Workflow jobs cannot be inspected; review the workflow separately.');
107257
+ if (Object.values(templateJobs).some(job => (0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(object(job)?.uses))) {
107258
+ const parsed = document(template);
107259
+ const jobs = object(parsed.jobs);
107260
+ let changed = false;
107261
+ for (const [name, value] of Object.entries(jobs)) {
107262
+ const job = object(value);
107263
+ if (!(0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(job.uses))
107264
+ throw new Error('Mixed comment workflow jobs require separate workflow review before setup.');
107265
+ const previousJob = object(previousJobs[name]);
107266
+ if (Array.isArray(previousJob?.steps) && previousJob.steps.some(raw => {
107267
+ const uses = object(raw)?.uses;
107268
+ return typeof uses !== 'string' || !(uses.startsWith('actions/checkout@')
107269
+ || /^vypdev\/copilot@[^\s]+$/u.test(uses) || uses === './.git/copilot-verification-setup');
107270
+ }))
107271
+ 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.');
107272
+ const retained = (0, setup_runner_policy_1.selectedSetupRunsOn)(selection?.runners, selection && (0, setup_runner_policy_1.setupRunnerRole)(selection.file, name))
107273
+ ?? (0, copilot_comment_workflow_1.copilotCommentRunner)(previousJob) ?? (0, copilot_comment_workflow_1.copilotCommentRunner)(job);
107274
+ if (!runner(retained))
107275
+ throw new Error('Existing runner selection is invalid; review the workflow separately.');
107276
+ if (JSON.stringify(retained).includes('${{') && existing !== template)
107277
+ throw new Error('Dynamic runner selection requires separate workflow review before setup.');
107278
+ changed || (changed = !(0, node_util_1.isDeepStrictEqual)(retained, (0, copilot_comment_workflow_1.copilotCommentRunner)(job)));
107279
+ job.with = { ...object(job.with), 'runs-on': JSON.stringify(retained) };
107280
+ }
107281
+ return changed ? (0, js_yaml_1.dump)(parsed, { noRefs: true, lineWidth: -1 }) : template;
107282
+ }
105128
107283
  const lines = template.split('\n');
105129
107284
  let job = '';
105130
107285
  let insideJobs = false;
@@ -116955,6 +119110,14 @@ module.exports = JSON.parse('{"single":{"topLeft":"┌","top":"─","topRight":"
116955
119110
  "use strict";
116956
119111
  module.exports = JSON.parse('{"revision":"2026-10-02.standalone.1","providers":{"codex":{"executable":"codex","reviewedVersion":"codex-cli 0.156.1","legacyNpmPackage":"@openai/codex","installation":{"unixScript":"https://chatgpt.com/codex/install.sh","windowsScript":"https://chatgpt.com/codex/install.ps1"}},"opencode":{"executable":"opencode","reviewedVersion":"1.18.3","legacyNpmPackage":"opencode-ai","installation":{"unixScript":"https://opencode.ai/install","windowsReleaseApi":"https://api.github.com/repos/anomalyco/opencode/releases/latest"}},"cursor":{"executable":"agent","reviewedVersion":"2026.09.10-fd3934a","installation":{"unixScript":"https://cursor.com/install","windowsScript":"https://cursor.com/install?win32=true"}}}}');
116957
119112
 
119113
+ /***/ }),
119114
+
119115
+ /***/ 78593:
119116
+ /***/ ((module) => {
119117
+
119118
+ "use strict";
119119
+ module.exports = JSON.parse('{"repository-locale":"${{ vars.REPOSITORY_LOCALE || \'en-US\' }}","issues-locale":"${{ vars.ISSUES_LOCALE || \'\' }}","pull-requests-locale":"${{ vars.PULL_REQUESTS_LOCALE || \'\' }}","ai-ignore-files":"${{ vars.AI_IGNORE_FILES || \'build/*\' }}","debug":"${{ vars.DEBUG }}","main-branch":"${{ vars.MAIN_BRANCH || \'master\' }}","development-branch":"${{ vars.DEVELOPMENT_BRANCH || \'develop\' }}","feature-tree":"${{ vars.FEATURE_TREE || \'feature\' }}","bugfix-tree":"${{ vars.BUGFIX_TREE || \'bugfix\' }}","hotfix-tree":"${{ vars.HOTFIX_TREE || \'hotfix\' }}","release-tree":"${{ vars.RELEASE_TREE || \'release\' }}","docs-tree":"${{ vars.DOCS_TREE || \'docs\' }}","chore-tree":"${{ vars.CHORE_TREE || \'chore\' }}","issue-managed-branches":"${{ vars.ISSUE_MANAGED_BRANCHES || \'true\' }}","pre-branch-sdd":"${{ vars.PRE_BRANCH_SDD || \'false\' }}","verification-setup":"${{ vars.VERIFICATION_SETUP || \'false\' }}","issue-workflow-profile":"${{ vars.COPILOT_ISSUE_WORKFLOW_PROFILE || \'\' }}","reopen-issue-on-push":"${{ vars.REOPEN_ISSUE_ON_PUSH || \'true\' }}","desired-assignees-count":"${{ vars.DESIRED_ASSIGNEES_COUNT || \'1\' }}","desired-reviewers-count":"${{ vars.DESIRED_REVIEWERS_COUNT || \'1\' }}","commit-prefix-transforms":"${{ vars.COMMIT_PREFIX_TRANSFORMS || \'replace-slash\' }}","ai-pull-request-description-mode":"${{ vars.AI_PULL_REQUEST_DESCRIPTION_MODE || \'replace\' }}","ai-members-only":"${{ vars.AI_MEMBERS_ONLY || \'false\' }}","ai-include-reasoning":"${{ vars.AI_INCLUDE_REASONING || \'false\' }}","bugbot-severity":"${{ vars.BUGBOT_SEVERITY || \'low\' }}","bugbot-comment-limit":"${{ vars.BUGBOT_COMMENT_LIMIT || \'20\' }}","bugbot-fix-verify-commands":"${{ vars.BUGBOT_AUTOFIX_VERIFY_COMMANDS }}","bugbot-dry-run":"${{ vars.BUGBOT_DRY_RUN || \'false\' }}","bugbot-effort":"${{ vars.BUGBOT_EFFORT || \'smart\' }}","bugbot-review-drafts":"${{ vars.BUGBOT_REVIEW_DRAFTS || \'false\' }}","bugbot-trace-rules":"${{ vars.BUGBOT_TRACE_RULES || \'false\' }}","bugbot-suggested-changes":"${{ vars.BUGBOT_SUGGESTED_CHANGES || \'true\' }}","bugbot-telemetry":"${{ vars.BUGBOT_TELEMETRY || \'true\' }}","bugbot-fail-on-unresolved":"${{ vars.BUGBOT_FAIL_ON_UNRESOLVED || \'false\' }}","bugbot-organization-rules":"${{ vars.BUGBOT_ORGANIZATION_RULES }}","project-column-issue-created":"${{ vars.PROJECT_COLUMN_ISSUE_CREATED || \'Todo\' }}","project-column-pull-request-created":"${{ vars.PROJECT_COLUMN_PULL_REQUEST_CREATED || \'In Progress\' }}","project-column-issue-in-progress":"${{ vars.PROJECT_COLUMN_ISSUE_IN_PROGRESS || \'In Progress\' }}","project-column-pull-request-in-progress":"${{ vars.PROJECT_COLUMN_PULL_REQUEST_IN_PROGRESS || \'In Progress\' }}","agent-provider":"${{ vars.AGENT_PROVIDER || \'codex\' }}","agent-model-provider":"${{ vars.AGENT_MODEL_PROVIDER || \'openai\' }}","agent-model":"${{ vars.AGENT_MODEL || \'gpt-6-luna\' }}","agent-effort":"${{ vars.AGENT_EFFORT }}","agent-executable":"${{ vars.AGENT_EXECUTABLE }}","findings-provider":"${{ vars.FINDINGS_PROVIDER }}","findings-model-provider":"${{ vars.FINDINGS_MODEL_PROVIDER }}","findings-model":"${{ vars.FINDINGS_MODEL }}","findings-effort":"${{ vars.FINDINGS_EFFORT }}","findings-executable":"${{ vars.FINDINGS_EXECUTABLE }}","fixer-provider":"${{ vars.FIXER_PROVIDER }}","fixer-model-provider":"${{ vars.FIXER_MODEL_PROVIDER }}","fixer-model":"${{ vars.FIXER_MODEL }}","fixer-effort":"${{ vars.FIXER_EFFORT }}","fixer-executable":"${{ vars.FIXER_EXECUTABLE }}","planner-provider":"${{ vars.PLANNER_PROVIDER }}","planner-model-provider":"${{ vars.PLANNER_MODEL_PROVIDER }}","planner-model":"${{ vars.PLANNER_MODEL }}","planner-effort":"${{ vars.PLANNER_EFFORT }}","planner-executable":"${{ vars.PLANNER_EXECUTABLE }}","reviewer-provider":"${{ vars.REVIEWER_PROVIDER }}","reviewer-model-provider":"${{ vars.REVIEWER_MODEL_PROVIDER }}","reviewer-model":"${{ vars.REVIEWER_MODEL }}","reviewer-effort":"${{ vars.REVIEWER_EFFORT }}","reviewer-executable":"${{ vars.REVIEWER_EXECUTABLE }}","tester-provider":"${{ vars.TESTER_PROVIDER }}","tester-model-provider":"${{ vars.TESTER_MODEL_PROVIDER }}","tester-model":"${{ vars.TESTER_MODEL }}","tester-effort":"${{ vars.TESTER_EFFORT }}","tester-executable":"${{ vars.TESTER_EXECUTABLE }}","project-ids":"${{ vars.PROJECT_IDS }}"}');
119120
+
116958
119121
  /***/ })
116959
119122
 
116960
119123
  /******/ });