@vypdev/copilot 3.9.3 → 3.10.1

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
 
@@ -38119,6 +38123,46 @@ function approvalDiagnosticError(diagnostic) {
38119
38123
  }
38120
38124
 
38121
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
+
38122
38166
  /***/ }),
38123
38167
 
38124
38168
  /***/ 12183:
@@ -39313,7 +39357,26 @@ const SPANISH_CONTENT = Object.freeze({
39313
39357
  retainedState: PRESERVED_STATE_ES,
39314
39358
  }),
39315
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.';
39316
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
+ }),
39317
39380
  'closed-issue-reconciliation-failed': Object.freeze({
39318
39381
  impact: 'Issue cleanup remains unverified: {resultId}, phase {phase}; native state {state}, reason {reason}.',
39319
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.',
@@ -39329,6 +39392,26 @@ const ENGLISH_RECOVERY_CONTENT = Object.freeze({
39329
39392
  action: 'Inspect the rejected paths in the workflow and correct the workspace before retrying.',
39330
39393
  retainedState: 'The normal commit and push steps were skipped. Verify the current state before retrying.',
39331
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
+ }),
39332
39415
  'sdd-draft-format-invalid': Object.freeze({
39333
39416
  impact: 'SDD preparation stopped because the draft still lacked required headings or a numeric test budget after one automatic repair.',
39334
39417
  action: 'Retry SDD preparation with the canonical specification template and the explicit acceptance requirements.',
@@ -39391,6 +39474,21 @@ const ENGLISH_RECOVERY_CONTENT = Object.freeze({
39391
39474
  }),
39392
39475
  });
39393
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
+ }),
39394
39492
  'closed-issue-reconciliation-failed': Object.freeze({
39395
39493
  impact: 'La limpieza de la issue sigue sin verificarse: {resultId}, fase {phase}; estado nativo {state}, motivo {reason}.',
39396
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.',
@@ -39406,6 +39504,26 @@ const SPANISH_RECOVERY_CONTENT = Object.freeze({
39406
39504
  action: 'Revisa las rutas rechazadas en la ejecución y corrige el espacio de trabajo antes de reintentar.',
39407
39505
  retainedState: 'Se omitieron los pasos normales de commit y push. Comprueba el estado actual antes de reintentar.',
39408
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
+ }),
39409
39527
  'sdd-draft-format-invalid': Object.freeze({
39410
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.',
39411
39529
  action: 'Reintenta la preparación del SDD con la plantilla canónica y los criterios de aceptación explícitos.',
@@ -39520,12 +39638,16 @@ exports.buildApplicationErrorPresentation = buildApplicationErrorPresentation;
39520
39638
  exports.renderApplicationErrorText = renderApplicationErrorText;
39521
39639
  exports.renderApplicationErrorMarkdown = renderApplicationErrorMarkdown;
39522
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';
39523
39643
  /** Shared semantic view model for terminal, GitHub, and API presentation. */
39524
39644
  function buildApplicationErrorPresentation(error, message = application_error_message_catalog_1.readEnglishApplicationErrorMessage) {
39525
39645
  const descriptor = error.recovery
39526
39646
  ? `error.recovery.${error.recovery.id}`
39527
39647
  : `error.${error.code}`;
39528
- 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;
39529
39651
  return {
39530
39652
  impact: message(`${descriptor}.impact`, variables),
39531
39653
  code: error.code,
@@ -40641,6 +40763,7 @@ exports.BUGBOT_MESSAGE_IDS = Object.freeze([
40641
40763
  'bugbot.overflow.body',
40642
40764
  'bugbot.common.more',
40643
40765
  'bugbot.diagnostic.operationFailed',
40766
+ 'bugbot.diagnostic.findingMutationFailed',
40644
40767
  'bugbot.diagnostic.identityUnavailable',
40645
40768
  'bugbot.diagnostic.pullRequestCommentsFailed',
40646
40769
  'bugbot.diagnostic.reviewThreadsFailed',
@@ -40726,6 +40849,7 @@ const ENGLISH_MESSAGES = Object.freeze({
40726
40849
  'bugbot.overflow.heading': 'More findings (comment limit)',
40727
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.' }),
40728
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.',
40729
40853
  'bugbot.diagnostic.operationFailed': 'Bugbot could not complete one or more finding mutations.',
40730
40854
  'bugbot.diagnostic.identityUnavailable': 'The authenticated Bugbot identity is unavailable.',
40731
40855
  'bugbot.diagnostic.pullRequestCommentsFailed': 'Unable to re-read pull request review comments.',
@@ -40815,6 +40939,7 @@ const SPANISH_MESSAGES = Object.freeze({
40815
40939
  'bugbot.overflow.heading': 'Más hallazgos (límite de comentarios)',
40816
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.' }),
40817
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.',
40818
40943
  'bugbot.diagnostic.operationFailed': 'Bugbot no pudo completar una o más mutaciones de hallazgos.',
40819
40944
  'bugbot.diagnostic.identityUnavailable': 'La identidad autenticada de Bugbot no está disponible.',
40820
40945
  'bugbot.diagnostic.pullRequestCommentsFailed': 'No se pudieron volver a leer los comentarios del review del pull request.',
@@ -40854,6 +40979,7 @@ async function resolveBugbotCatalog(locale, configuration, resolver) {
40854
40979
  }
40855
40980
  function renderBugbotDiagnostic(diagnostic, catalog) {
40856
40981
  switch (diagnostic.code) {
40982
+ case 'finding-mutation-failed': return catalog.message('bugbot.diagnostic.findingMutationFailed', { ...diagnostic.mutation });
40857
40983
  case 'operation-failed': return catalog.message('bugbot.diagnostic.operationFailed');
40858
40984
  case 'identity-unavailable': return catalog.message('bugbot.diagnostic.identityUnavailable');
40859
40985
  case 'snapshot-pull-request-comments-failed': return catalog.message('bugbot.diagnostic.pullRequestCommentsFailed');
@@ -41481,6 +41607,10 @@ function renderBugbotStatusCard(projection, catalogOrLocale, links) {
41481
41607
  facts.push(catalog.message('bugbot.coverage.omitted', { count: source.omittedItems }));
41482
41608
  if (source.truncatedItems > 0)
41483
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(', ')}`);
41484
41614
  if (source.providerLimitReached)
41485
41615
  facts.push(catalog.message('bugbot.coverage.providerLimit'));
41486
41616
  return `- ${source.source}: ${source.status}; ${facts.join(', ')}`;
@@ -41570,9 +41700,21 @@ function normalizeHistoricalSnapshot(originalBody, analyzedHeadSha, catalog) {
41570
41700
  function renderFindingRow(finding) {
41571
41701
  const label = (0, github_comment_publication_policy_1.sanitizeAgentMarkdown)(finding.title || finding.id, 500).replace(/[\r\n]+/gu, ' ');
41572
41702
  const state = stateLabel(finding.state);
41703
+ const identity = finding.state === 'unknown'
41704
+ ? ` — ${renderFindingId(finding.id)}`
41705
+ : '';
41573
41706
  return finding.url
41574
- ? `- ${state} — [${label}](${finding.url})`
41575
- : `- ${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}`;
41576
41718
  }
41577
41719
  function stateLabel(state) {
41578
41720
  return `[ ] ${state}`;
@@ -46173,6 +46315,8 @@ The setup runner profile selects placement; it does not install the project's la
46173
46315
 
46174
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).
46175
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
+
46176
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).
46177
46321
  `;
46178
46322
  }
@@ -46392,6 +46536,40 @@ function calculateReviewersStillNeeded(desiredCount, currentCount, confirmedCoun
46392
46536
  }
46393
46537
 
46394
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
+
46395
46573
  /***/ }),
46396
46574
 
46397
46575
  /***/ 2230:
@@ -47487,6 +47665,7 @@ exports.isSetupBatchInstallationReceipt = isSetupBatchInstallationReceipt;
47487
47665
  exports.parseSetupBatchOperation = parseSetupBatchOperation;
47488
47666
  exports.validSetupBatchAssetPath = validSetupBatchAssetPath;
47489
47667
  const setup_batch_1 = __nccwpck_require__(88308);
47668
+ const setup_verification_action_1 = __nccwpck_require__(33156);
47490
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;
47491
47670
  const sha = /^[a-f0-9]{40}$/u;
47492
47671
  const digest = /^[a-f0-9]{64}$/u;
@@ -47592,6 +47771,7 @@ function validSetupBatchAssetPath(path) {
47592
47771
  if (path.length > 240 || path.split('/').some(part => !part || part === '.' || part === '..') || /[^A-Za-z0-9_./-]/u.test(path))
47593
47772
  return false;
47594
47773
  return path === 'AGENTS.md' || path === '.agents/skills/copilot-repository-workflow/SKILL.md'
47774
+ || path === setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH
47595
47775
  || /^\.github\/(?:workflows|ISSUE_TEMPLATE)\/[A-Za-z0-9_.-]+\.(?:yml|yaml)$/u.test(path)
47596
47776
  || path === '.github/pull_request_template.md' || /^\.copilot\/(?:repository-profile|setup-manifest|runner-profile)\.json$/u.test(path)
47597
47777
  || path === '.copilot/AGENT_GUIDE.md' || path.startsWith('.copilot/setup-backups/');
@@ -47856,6 +48036,7 @@ function createDefaultSetupConfiguration() {
47856
48036
  choreTree: 'chore',
47857
48037
  issueManagedBranches: true,
47858
48038
  preBranchSdd: false,
48039
+ verificationSetup: false,
47859
48040
  reopenIssueOnPush: true,
47860
48041
  desiredAssigneesCount: 1,
47861
48042
  desiredReviewersCount: 1,
@@ -48012,6 +48193,7 @@ Object.defineProperty(exports, "buildSetupCredentialRequirements", ({ enumerable
48012
48193
  const locale_1 = __nccwpck_require__(15386);
48013
48194
  const issue_workflow_profile_1 = __nccwpck_require__(26744);
48014
48195
  const setup_issue_workflow_policy_1 = __nccwpck_require__(81182);
48196
+ const setup_verification_action_1 = __nccwpck_require__(33156);
48015
48197
  const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
48016
48198
  function buildSetupPlan(configuration, mergeQueueReadiness = [], approvalReadiness = []) {
48017
48199
  const workflowFiles = (0, setup_workflow_catalog_1.enabledSetupWorkflowFiles)((0, setup_issue_workflow_policy_1.effectiveIssueWorkflowFeatures)(configuration))
@@ -48023,6 +48205,7 @@ function buildSetupPlan(configuration, mergeQueueReadiness = [], approvalReadine
48023
48205
  .filter(file => configuration.features.release !== false || file !== 'release.yml')
48024
48206
  .filter(file => configuration.features.hotfix !== false || file !== 'hotfix.yml');
48025
48207
  const selectedFiles = [
48208
+ setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH,
48026
48209
  ...(configuration.runners && configuration.runners.mode !== 'retain' ? ['.copilot/runner-profile.json'] : []),
48027
48210
  ...workflowFiles.map(file => `workflows/${file}`),
48028
48211
  ...issueTemplateFiles.map(file => `ISSUE_TEMPLATE/${file}`),
@@ -48123,6 +48306,7 @@ function buildSetupRepositoryVariables(configuration) {
48123
48306
  add('CHORE_TREE', repository.choreTree);
48124
48307
  add('ISSUE_MANAGED_BRANCHES', repository.issueManagedBranches);
48125
48308
  add('PRE_BRANCH_SDD', repository.preBranchSdd);
48309
+ add('VERIFICATION_SETUP', repository.verificationSetup ?? false);
48126
48310
  add('REOPEN_ISSUE_ON_PUSH', repository.reopenIssueOnPush);
48127
48311
  add('DESIRED_ASSIGNEES_COUNT', repository.desiredAssigneesCount);
48128
48312
  add('DESIRED_REVIEWERS_COUNT', repository.desiredReviewersCount);
@@ -48185,6 +48369,7 @@ function buildSetupActionInputs(configuration) {
48185
48369
  'chore-tree': repository.choreTree,
48186
48370
  'issue-managed-branches': String(repository.issueManagedBranches),
48187
48371
  'pre-branch-sdd': String(repository.preBranchSdd),
48372
+ 'verification-setup': String(repository.verificationSetup ?? false),
48188
48373
  'reopen-issue-on-push': String(repository.reopenIssueOnPush),
48189
48374
  'desired-assignees-count': String(repository.desiredAssigneesCount),
48190
48375
  'desired-reviewers-count': String(repository.desiredReviewersCount),
@@ -48630,6 +48815,9 @@ function validateSetupConfiguration(configuration, options = {}) {
48630
48815
  || typeof configuration.repository.preBranchSdd !== 'boolean') {
48631
48816
  errors.push('issue-managed-branches and pre-branch-sdd must be boolean values.');
48632
48817
  }
48818
+ if (configuration.repository.verificationSetup !== undefined && typeof configuration.repository.verificationSetup !== 'boolean') {
48819
+ errors.push('verification-setup must be a boolean value.');
48820
+ }
48633
48821
  if (configuration.repository.preBranchSdd && !configuration.repository.issueManagedBranches) {
48634
48822
  errors.push('pre-branch-sdd requires issue-managed-branches.');
48635
48823
  }
@@ -49861,6 +50049,7 @@ const repositoryFields = [
49861
50049
  ['HOTFIX_TREE', 'hotfixTree'], ['RELEASE_TREE', 'releaseTree'],
49862
50050
  ['DOCS_TREE', 'docsTree'], ['CHORE_TREE', 'choreTree'],
49863
50051
  ['ISSUE_MANAGED_BRANCHES', 'issueManagedBranches'], ['PRE_BRANCH_SDD', 'preBranchSdd'],
50052
+ ['VERIFICATION_SETUP', 'verificationSetup'],
49864
50053
  ['REOPEN_ISSUE_ON_PUSH', 'reopenIssueOnPush'], ['DESIRED_ASSIGNEES_COUNT', 'desiredAssigneesCount'],
49865
50054
  ['DESIRED_REVIEWERS_COUNT', 'desiredReviewersCount'], ['INACTIVITY_THRESHOLD_HOURS', 'inactivityThresholdHours'],
49866
50055
  ['REPOSITORY_LOCALE', 'repositoryLocale'], ['ISSUES_LOCALE', 'issueLocale'],
@@ -50325,6 +50514,8 @@ function setupQuestionDocumentation(question) {
50325
50514
  return docs.branchManagement;
50326
50515
  if (id === 'repository.preBranchSdd')
50327
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' };
50328
50519
  if (id === 'repository.inactivityThresholdHours' || id === 'features.inactiveIssueClosure')
50329
50520
  return docs.issueLifecycle;
50330
50521
  if (id === 'repository.desiredAssigneesCount' || id === 'repository.desiredReviewersCount')
@@ -50405,6 +50596,7 @@ const section = {
50405
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.' },
50406
50597
  };
50407
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.' },
50408
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.' },
50409
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.' },
50410
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.' },
@@ -50481,6 +50673,10 @@ const location = {
50481
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.' },
50482
50674
  };
50483
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
+ },
50484
50680
  'agents.findings.executable': {
50485
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.' },
50486
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.' },
@@ -50631,6 +50827,7 @@ const section = {
50631
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.' },
50632
50828
  };
50633
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.' },
50634
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.' },
50635
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.' },
50636
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.' },
@@ -50689,6 +50886,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50689
50886
  exports.questionLabelsFr = void 0;
50690
50887
  /** French presentation labels; semantic question IDs remain unchanged. */
50691
50888
  exports.questionLabelsFr = {
50889
+ 'repository.verificationSetup': 'Préparer les dépendances avec l’action de vérification du dépôt ?',
50692
50890
  'features.issues': 'Automatiser les tickets : branches, étiquettes, projets et cycle de vie',
50693
50891
  'features.pullRequests': 'Automatiser les pull requests : revue, description et cycle de vie',
50694
50892
  'features.commits': 'Automatiser les commits : progression, taille et analyse Bugbot',
@@ -50782,6 +50980,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50782
50980
  exports.questionLabelsPt = void 0;
50783
50981
  /** Portuguese presentation labels; semantic question IDs remain unchanged. */
50784
50982
  exports.questionLabelsPt = {
50983
+ 'repository.verificationSetup': 'Preparar dependências com a ação de verificação do repositório?',
50785
50984
  'features.issues': 'Automatizar questões: ramos, etiquetas, projetos e ciclo de vida',
50786
50985
  'features.pullRequests': 'Automatizar pull requests: revisão, descrição e ciclo de vida',
50787
50986
  'features.commits': 'Automatizar commits: progresso, tamanho e análise do Bugbot',
@@ -50922,6 +51121,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50922
51121
  exports.purposesFr = void 0;
50923
51122
  /** French question-specific purposes. */
50924
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.',
50925
51125
  'issueWorkflows.enabled': 'Choisissez les workflows de ticket que Copilot pourra exécuter ; chacun agit différemment sur les branches, étiquettes et automatisations.',
50926
51126
  'repositoryAgentGuidance.enabled': 'Générez des instructions pour aider les agents IA à travailler en sécurité dans ce projet.',
50927
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.',
@@ -50983,6 +51183,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50983
51183
  exports.purposesPt = void 0;
50984
51184
  /** Portuguese question-specific purposes. */
50985
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.',
50986
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.',
50987
51188
  'repositoryAgentGuidance.enabled': 'Gere instruções para ajudar os agentes de IA a trabalhar com segurança neste projeto.',
50988
51189
  'repositoryAgentGuidance.agentsPointer': 'Decida se o AGENTS.md da raiz aponta para as instruções geradas, é criado se faltar ou permanece intacto.',
@@ -51114,6 +51315,7 @@ exports.setupQuestionPurpose = setupQuestionPurpose;
51114
51315
  const setup_runner_guidance_policy_1 = __nccwpck_require__(10741);
51115
51316
  /** Field-specific meaning for choices whose label alone is easy to misinterpret. */
51116
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.' },
51117
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.' },
51118
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.' },
51119
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.' },
@@ -51236,6 +51438,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
51236
51438
  exports.spanishQuestionLabels = void 0;
51237
51439
  exports.spanishQuestionLabel = spanishQuestionLabel;
51238
51440
  exports.spanishQuestionLabels = {
51441
+ 'repository.verificationSetup': '¿Preparar dependencias con la acción de verificación del repositorio?',
51239
51442
  'features.issues': 'Automatizar issues: ramas, etiquetas, proyectos y ciclo de vida',
51240
51443
  'features.pullRequests': 'Automatizar pull requests: revisión, descripción y ciclo de vida',
51241
51444
  'features.commits': 'Automatizar commits: progreso, tamaño y análisis de Bugbot',
@@ -51681,6 +51884,7 @@ function repositoryQuestions() {
51681
51884
  ['choreTree', 'Chore branch prefix', 'text'],
51682
51885
  ['issueManagedBranches', 'Let the Action create linked branches after in-progress?', 'boolean'],
51683
51886
  ['preBranchSdd', 'Require an SDD before feature and contract-change branches?', 'boolean'],
51887
+ ['verificationSetup', 'Prepare dependencies with the repository verification setup action?', 'boolean'],
51684
51888
  ['reopenIssueOnPush', 'Reopen closed issues when a related branch receives a push?', 'boolean'],
51685
51889
  ['desiredAssigneesCount', 'Desired issue assignees (0 disables automatic assignment)', 'number'],
51686
51890
  ['desiredReviewersCount', 'Desired pull-request reviewers (0 disables automatic assignment)', 'number'],
@@ -51857,6 +52061,8 @@ function toQuestion(definition, draft, context) {
51857
52061
  }, context);
51858
52062
  }
51859
52063
  function readPath(configuration, path, allowedNames) {
52064
+ if (path === 'repository.verificationSetup')
52065
+ return configuration.repository.verificationSetup ?? false;
51860
52066
  const value = path.split('.').reduce((current, key) => current[key], configuration);
51861
52067
  if (path.endsWith('.overrides')) {
51862
52068
  const overrides = value;
@@ -52251,6 +52457,7 @@ function setupRunnerGuidance(question) {
52251
52457
  Object.defineProperty(exports, "__esModule", ({ value: true }));
52252
52458
  exports.setupRunnerInstallationSummary = setupRunnerInstallationSummary;
52253
52459
  const setup_runner_policy_1 = __nccwpck_require__(91027);
52460
+ const setup_verification_action_summary_policy_1 = __nccwpck_require__(15818);
52254
52461
  function routeBlock(route) {
52255
52462
  const json = JSON.stringify(route, null, 2);
52256
52463
  const longest = (json.match(/`+/g) ?? []).reduce((length, run) => Math.max(length, run.length), 2);
@@ -52274,6 +52481,7 @@ function setupRunnerInstallationSummary(plan) {
52274
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.`,
52275
52482
  'Inspect the complete Files changed view and `.copilot/runner-profile.json`. Any replacements retain setup backups under `.copilot/setup-backups/`.',
52276
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),
52277
52485
  ].join('\n');
52278
52486
  }
52279
52487
 
@@ -53025,6 +53233,27 @@ function levelRank(level) {
53025
53233
  }
53026
53234
 
53027
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
+
53028
53257
  /***/ }),
53029
53258
 
53030
53259
  /***/ 3449:
@@ -53256,6 +53485,58 @@ function verificationRuntimeMatches(required, observed) {
53256
53485
  }
53257
53486
 
53258
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
+
53259
53540
  /***/ }),
53260
53541
 
53261
53542
  /***/ 43193:
@@ -53421,6 +53702,13 @@ class PullRequestReviewOperationError extends Error {
53421
53702
  super(buildMessage(operation, context));
53422
53703
  this.name = "PullRequestReviewOperationError";
53423
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
+ }
53424
53712
  }
53425
53713
  }
53426
53714
  exports.PullRequestReviewOperationError = PullRequestReviewOperationError;
@@ -53461,6 +53749,18 @@ function bindSddEvidenceReadPorts(ports) {
53461
53749
  }
53462
53750
 
53463
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
+
53464
53764
  /***/ }),
53465
53765
 
53466
53766
  /***/ 84387:
@@ -55371,6 +55671,7 @@ async function runInitialSetupWorkflow(request, dependencies) {
55371
55671
  }
55372
55672
  (0, logging_ports_1.logInfo)('📋 Ensuring .github and copying setup files...');
55373
55673
  const workspaceSelection = {
55674
+ ...(request.verificationActionState ? { verificationActionState: request.verificationActionState } : {}),
55374
55675
  features: setupConfiguration?.features,
55375
55676
  setupConfiguration,
55376
55677
  ...(request.workflowUpdates.length > 0 ? {
@@ -55382,6 +55683,8 @@ async function runInitialSetupWorkflow(request, dependencies) {
55382
55683
  const filesResult = dependencies.setupWorkspacePort.prepare(workspaceSelection);
55383
55684
  mark('files', filesResult.copied > 0 ? 'completed' : 'skipped');
55384
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.`);
55385
55688
  if (setupConfiguration?.manageRepositorySecrets && secretValues > 0)
55386
55689
  mark('secrets', 'in-progress');
55387
55690
  const secrets = await (0, setup_resource_provisioning_1.ensureRepositorySecrets)(request, dependencies, setupConfiguration, remoteConfiguration);
@@ -60099,6 +60402,8 @@ function projectInitialSetupContext(source) {
60099
60402
  ...(credentials ? { setupCredentials: deepFreezeCopy(credentials) } : {}),
60100
60403
  ...(remote ? { setupRemoteConfiguration: deepFreezeCopy(remote) } : {}),
60101
60404
  workflowUpdates: Object.freeze(asStringArray(source.inputs?.setupWorkflowUpdates)),
60405
+ ...(source.inputs?.setupVerificationActionState === 'create' || source.inputs?.setupVerificationActionState === 'preserve'
60406
+ ? { verificationActionState: source.inputs.setupVerificationActionState } : {}),
60102
60407
  });
60103
60408
  }
60104
60409
  function projectIssueCommentActionContext(source) {
@@ -60604,6 +60909,7 @@ exports.draftSddMarkdown = draftSddMarkdown;
60604
60909
  const application_error_1 = __nccwpck_require__(75999);
60605
60910
  const pre_branch_sdd_1 = __nccwpck_require__(34730);
60606
60911
  const agent_response_length_failure_1 = __nccwpck_require__(28528);
60912
+ const sdd_draft_consistency_1 = __nccwpck_require__(27910);
60607
60913
  /** Size and typed format failures share one regeneration; the writer still validates every candidate. */
60608
60914
  async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
60609
60915
  const maximum = plan.action === 'update' ? pre_branch_sdd_1.SDD_MAX_UPDATE_CHARACTERS : pre_branch_sdd_1.SDD_MAX_DRAFT_CHARACTERS;
@@ -60615,13 +60921,13 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
60615
60921
  };
60616
60922
  let problem = 'size';
60617
60923
  let formatReason = 'required-heading';
60618
- 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.`;
60619
60925
  for (let attempt = 0; attempt < 2; attempt++) {
60620
60926
  let value;
60621
60927
  try {
60622
60928
  value = await agent.query({
60623
60929
  configuration, agentId: 'pre-branch-sdd-draft',
60624
- 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}`,
60625
60931
  options: { expectJson: true, schemaName: 'pre_branch_sdd_draft', schema },
60626
60932
  });
60627
60933
  }
@@ -60655,12 +60961,21 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
60655
60961
  }
60656
60962
  if (problem === 'format')
60657
60963
  throw new application_error_1.ApplicationError('validation.invalid-input', `The SDD draft still violates its ${formatReason} format contract after one bounded repair.`, {
60658
- recovery: { id: 'sdd-draft-format-invalid', variables: {} },
60964
+ recovery: { id: consistencyRecovery(formatReason), variables: {} },
60659
60965
  });
60660
60966
  throw new application_error_1.ApplicationError('validation.invalid-input', 'The SDD draft exceeded its size limit after one bounded repair.', {
60661
60967
  recovery: { id: 'sdd-draft-size-exceeded', variables: {} },
60662
60968
  });
60663
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
+ }
60664
60979
 
60665
60980
 
60666
60981
  /***/ }),
@@ -60678,8 +60993,10 @@ const issue_start_policy_1 = __nccwpck_require__(90332);
60678
60993
  const pre_branch_sdd_1 = __nccwpck_require__(34730);
60679
60994
  const recommendation_policy_1 = __nccwpck_require__(39410);
60680
60995
  const logging_ports_1 = __nccwpck_require__(6152);
60996
+ const sdd_analysis_status_policy_1 = __nccwpck_require__(81053);
60681
60997
  const application_error_1 = __nccwpck_require__(75999);
60682
60998
  const pre_branch_sdd_draft_workflow_1 = __nccwpck_require__(93454);
60999
+ const sdd_draft_consistency_1 = __nccwpck_require__(27910);
60683
61000
  const ANALYSIS_SCHEMA = {
60684
61001
  type: 'object',
60685
61002
  properties: {
@@ -60800,11 +61117,21 @@ class PreBranchSddGateUseCase {
60800
61117
  });
60801
61118
  const analysisValue = asRecord(analysis);
60802
61119
  const owners = new Map(snapshot.capabilities.map(capability => [capability.id, capability.specs]));
60803
- 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
+ }
60804
61130
  if (card?.record.branchName && (plan.action !== 'update'
60805
61131
  || plan.path !== card.record.plan.path || plan.capabilityId !== card.record.plan.capabilityId)) {
60806
61132
  throw new Error('An existing linked branch can only revise its owning SDD on the same path.');
60807
61133
  }
61134
+ await this.writeAnalysisStatus(context, allComments);
60808
61135
  const round = publicationRetry ? card.record.round
60809
61136
  : card?.record.phase === 'awaiting-answer' && card.record.issueDigest === digest && !staleAwaiting
60810
61137
  ? card.record.round + (plan.questions.length > 0 ? 1 : 0) : 1;
@@ -60824,9 +61151,19 @@ class PreBranchSddGateUseCase {
60824
61151
  const currentSdd = plan.action === 'update' ? await this.workspace.readSdd(snapshot.baseSha, plan.path) : undefined;
60825
61152
  if (plan.action === 'update' && !currentSdd)
60826
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.');
60827
61164
  const newCapability = plan.action === 'new' ? parseNewCapability(analysisValue.newCapability, plan) : undefined;
60828
61165
  let prepared;
60829
- 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) => {
60830
61167
  prepared = await this.workspace.validateDraft(snapshot, plan, markdown, newCapability);
60831
61168
  });
60832
61169
  if (!prepared)
@@ -60916,6 +61253,20 @@ class PreBranchSddGateUseCase {
60916
61253
  else
60917
61254
  await this.comments.updateComment(issueNumber, cardId, body);
60918
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
+ }
60919
61270
  async assertFresh(context, expectedBaseSha, sourceBranch) {
60920
61271
  const [liveBody, liveTitle, snapshot] = await Promise.all([
60921
61272
  this.descriptions.getDescription(context.issueNumber),
@@ -64488,7 +64839,7 @@ function partitionFailureCategory(error) {
64488
64839
  return error instanceof Error ? error.name : 'unknown';
64489
64840
  }
64490
64841
  function suppressDismissedFindings(execution, context, prepared) {
64491
- const activeFindings = (prepared.activeFindings ?? prepared.toPublish).filter((finding) => {
64842
+ const activeFindings = (0, finding_1.retainExistingFindingIds)(prepared.activeFindings ?? prepared.toPublish, context.existingByFindingId).filter((finding) => {
64492
64843
  const existing = (0, finding_1.findExistingFindingInfo)(context.existingByFindingId, finding);
64493
64844
  return existing?.issue?.resolution !== 'dismissed' && existing?.pullRequest?.resolution !== 'dismissed';
64494
64845
  });
@@ -64508,6 +64859,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
64508
64859
  exports.applyDetectedFindings = applyDetectedFindings;
64509
64860
  const mark_findings_resolved_use_case_1 = __nccwpck_require__(96963);
64510
64861
  const publish_findings_use_case_1 = __nccwpck_require__(88442);
64862
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
64511
64863
  const pull_request_review_errors_1 = __nccwpck_require__(46445);
64512
64864
  async function applyDetectedFindings(operation, context, prepared, publicationPorts, resolutionPorts, catalog) {
64513
64865
  try {
@@ -64523,7 +64875,7 @@ async function applyDetectedFindings(operation, context, prepared, publicationPo
64523
64875
  });
64524
64876
  }
64525
64877
  catch (error) {
64526
- 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
64527
64879
  ? error
64528
64880
  : new Error("Unable to publish findings.");
64529
64881
  return [publicationError];
@@ -65074,6 +65426,7 @@ function buildPreviousFindingsContext(previousFindings) {
65074
65426
  `;
65075
65427
  const suffix = `
65076
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.
65077
65430
  - If the problem **still exists** (same code or same issue present): do **not** include it in \`resolved_findings\`.
65078
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\`.
65079
65432
  - If the problem **has been fixed** (code was changed and the issue is resolved): include \`{ "id": "<exact id>", "resolution": "fixed" }\` in \`resolved_findings\`.
@@ -65193,6 +65546,10 @@ function buildReviewConversationContext(issueComments, commentsByPullRequest, bo
65193
65546
  omitted,
65194
65547
  truncated: chronological.filter((entry) => entry.truncated).length,
65195
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
+ } : {}),
65196
65553
  };
65197
65554
  }
65198
65555
  function appendConversationEntry(entries, author, kind, body, createdAt, providerId) {
@@ -66684,6 +67041,7 @@ async function loadBugbotContext(request, ports, resolvedPreflight) {
66684
67041
  itemsFetched: conversationContext.retained + conversationContext.omitted,
66685
67042
  omittedItems: conversationContext.omitted,
66686
67043
  truncatedItems: conversationContext.truncated,
67044
+ ...(conversationContext.truncatedItemIds ? { truncatedItemIds: conversationContext.truncatedItemIds } : {}),
66687
67045
  limitReached: conversationContext.omitted > 0 || conversationContext.truncated > 0,
66688
67046
  },
66689
67047
  {
@@ -66885,11 +67243,11 @@ Object.defineProperty(exports, "markFindingsResolved", ({ enumerable: true, get:
66885
67243
 
66886
67244
  Object.defineProperty(exports, "__esModule", ({ value: true }));
66887
67245
  exports.markFindingsResolved = markFindingsResolved;
66888
- const pull_request_review_errors_1 = __nccwpck_require__(46445);
66889
67246
  const logging_ports_1 = __nccwpck_require__(6152);
66890
67247
  const resolve_issue_finding_1 = __nccwpck_require__(35300);
66891
67248
  const resolve_pull_request_finding_1 = __nccwpck_require__(64567);
66892
67249
  const review_state_1 = __nccwpck_require__(79200);
67250
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
66893
67251
  const application_error_1 = __nccwpck_require__(75999);
66894
67252
  async function markFindingsResolved(param) {
66895
67253
  const errors = [];
@@ -66917,8 +67275,8 @@ async function repairExistingPullRequestFinding(ports, operation, findingId, des
66917
67275
  try {
66918
67276
  await ports.pullRequestComments.unresolvePullRequestReviewThread(destination.pullRequestNumber, destination.commentIdentity);
66919
67277
  }
66920
- catch {
66921
- addResolutionError(errors, 'pull request');
67278
+ catch (cause) {
67279
+ addResolutionError(errors, 'pull request', findingId, cause);
66922
67280
  }
66923
67281
  }
66924
67282
  }
@@ -66932,7 +67290,7 @@ async function resolveIssueIfNeeded(param, findingId, destination, errors) {
66932
67290
  return;
66933
67291
  const comment = param.context.issueComments.find(item => item.id === destination.commentId);
66934
67292
  if (comment?.body == null) {
66935
- addResolutionError(errors, 'issue');
67293
+ addResolutionError(errors, 'issue', findingId);
66936
67294
  return;
66937
67295
  }
66938
67296
  try {
@@ -66943,8 +67301,8 @@ async function resolveIssueIfNeeded(param, findingId, destination, errors) {
66943
67301
  resolution: param.resolvedFindingResolutions?.get(findingId),
66944
67302
  }, param.catalog);
66945
67303
  }
66946
- catch {
66947
- addResolutionError(errors, 'issue');
67304
+ catch (cause) {
67305
+ addResolutionError(errors, 'issue', findingId, cause);
66948
67306
  }
66949
67307
  }
66950
67308
  async function tryResolvePullRequestFinding(ports, findingId, destination, errors, resolution, catalog) {
@@ -66956,17 +67314,14 @@ async function tryResolvePullRequestFinding(ports, findingId, destination, error
66956
67314
  resolution,
66957
67315
  }, catalog);
66958
67316
  }
66959
- catch {
66960
- addResolutionError(errors, 'pull request');
67317
+ catch (cause) {
67318
+ addResolutionError(errors, 'pull request', findingId, cause);
66961
67319
  }
66962
67320
  }
66963
- function addResolutionError(errors, destination) {
66964
- const cause = destination === 'pull request'
66965
- ? new pull_request_review_errors_1.PullRequestReviewOperationError('mark-resolved')
66966
- : new Error('Unable to mark an issue finding as resolved.');
66967
- const semanticError = new application_error_1.ApplicationError('provider.unavailable', destination === 'pull request'
66968
- ? 'Unable to mark a pull request finding as resolved.'
66969
- : '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.');
66970
67325
  (0, logging_ports_1.logError)(semanticError);
66971
67326
  errors.push(semanticError);
66972
67327
  }
@@ -67219,6 +67574,7 @@ function isRecord(value) {
67219
67574
  */
67220
67575
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67221
67576
  exports.publishFindings = publishFindings;
67577
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
67222
67578
  const finding_1 = __nccwpck_require__(31011);
67223
67579
  const publish_issue_finding_comment_1 = __nccwpck_require__(84950);
67224
67580
  const publish_pr_review_comments_1 = __nccwpck_require__(50352);
@@ -67237,12 +67593,17 @@ async function publishFindings(param) {
67237
67593
  catalog,
67238
67594
  })
67239
67595
  : undefined;
67240
- for (const finding of findings) {
67596
+ for (const finding of (0, finding_1.retainExistingFindingIds)(findings, existingByFindingId)) {
67241
67597
  if (operation.target.issueNumber > 0 && !reviewPublisher) {
67242
67598
  await (0, publish_issue_finding_comment_1.publishIssueFindingComment)(ports.issueComments, operation.target.issueNumber, finding, (0, finding_1.findExistingFindingInfo)(existingByFindingId, finding), commitSha, catalog);
67243
67599
  }
67244
67600
  if (reviewPublisher) {
67245
- 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
+ }
67246
67607
  }
67247
67608
  }
67248
67609
  await reviewPublisher?.flush(overflowCount, overflowTitles);
@@ -67314,6 +67675,7 @@ ${catalog.message('bugbot.overflow.body', { count: `**${overflowCount}**` }, ove
67314
67675
 
67315
67676
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67316
67677
  exports.PullRequestReviewCommentPublisher = void 0;
67678
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
67317
67679
  const bugbot_finding_marker_policy_1 = __nccwpck_require__(98024);
67318
67680
  const path_validation_1 = __nccwpck_require__(70124);
67319
67681
  const logging_ports_1 = __nccwpck_require__(6152);
@@ -67385,11 +67747,16 @@ class PullRequestReviewCommentPublisher {
67385
67747
  if (this.findingsToCreate.length === 0 && overflowCount === 0)
67386
67748
  return;
67387
67749
  const { repository, operation, openPrNumber, prContext } = this.options;
67388
- await repository.createReviewWithComments(openPrNumber, prContext.prHeadSha, buildReviewSummary(this.findingsToCreate, this.commentsToCreate.length, this.unanchoredBodies, overflowCount, overflowTitles, operation.analysis.reviewConfiguration.traceRules
67389
- ? this.options.ruleSources ?? []
67390
- : [], operation.analysis.reviewConfiguration.traceRules
67391
- ? this.options.omittedRuleCount ?? 0
67392
- : 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
+ }
67393
67760
  }
67394
67761
  get catalog() {
67395
67762
  return this.options.catalog ?? (0, bugbot_message_catalog_1.resolveStaticBugbotCatalog)(this.options.operation.locale.pullRequest);
@@ -67545,6 +67912,8 @@ async function queryBugbotPartitionFindings(repository, configuration, prompt, t
67545
67912
 
67546
67913
  Object.defineProperty(exports, "__esModule", ({ value: true }));
67547
67914
  exports.reconcileBugbotReviewState = reconcileBugbotReviewState;
67915
+ const bugbot_mutation_error_1 = __nccwpck_require__(82937);
67916
+ const finding_1 = __nccwpck_require__(31011);
67548
67917
  const review_projection_1 = __nccwpck_require__(80859);
67549
67918
  const bugbot_reconciliation_policy_1 = __nccwpck_require__(78128);
67550
67919
  const bugbot_provider_projection_policy_1 = __nccwpck_require__(85821);
@@ -67575,11 +67944,12 @@ async function reconcileBugbotReviewState(input) {
67575
67944
  };
67576
67945
  }
67577
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);
67578
67949
  const diagnostics = [
67579
- ...(input.mutationErrors ?? []).map((error) => ({
67580
- code: 'operation-failed',
67581
- operatorMessage: toSafeOperationMessage(error),
67582
- })),
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) }),
67583
67953
  ...(!input.target.trustedAuthorLogin?.trim()
67584
67954
  ? [{ code: 'identity-unavailable' }]
67585
67955
  : []),
@@ -67588,7 +67958,7 @@ async function reconcileBugbotReviewState(input) {
67588
67958
  const providerProjection = (0, bugbot_provider_projection_policy_1.projectBugbotProviderEvidence)({
67589
67959
  snapshot,
67590
67960
  trustedAuthorLogin: input.target.trustedAuthorLogin,
67591
- activeFindings: input.activeFindings,
67961
+ activeFindings,
67592
67962
  existingByFindingId: input.loadedContext.existingByFindingId,
67593
67963
  });
67594
67964
  const plan = (0, bugbot_reconciliation_policy_1.buildBugbotReconciliationPlan)({
@@ -67598,8 +67968,8 @@ async function reconcileBugbotReviewState(input) {
67598
67968
  id,
67599
67969
  (0, bugbot_finding_marker_policy_1.extractTitleFromBody)(fullBody) || id,
67600
67970
  ])),
67601
- activeFindings: input.activeFindings,
67602
- expectedPublishedFindings: input.expectedPublishedFindings ?? input.activeFindings,
67971
+ activeFindings,
67972
+ expectedPublishedFindings,
67603
67973
  diagnostics,
67604
67974
  coverage: input.loadedContext.coverage,
67605
67975
  });
@@ -68103,14 +68473,16 @@ function toPresentationFailure(diagnostic) {
68103
68473
  const message = (0, bugbot_message_catalog_1.bugbotDiagnosticOperatorMessage)(diagnostic);
68104
68474
  return {
68105
68475
  diagnostic,
68106
- error: diagnostic.code === 'review-updates-pending'
68107
- ? new application_error_1.ApplicationError('workflow.presentation-pending', message, {
68108
- recovery: {
68109
- id: 'bugbot-review-blocks-pending',
68110
- variables: { pendingCount: diagnostic.count },
68111
- },
68112
- })
68113
- : 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),
68114
68486
  };
68115
68487
  }
68116
68488
  function report(projection, reviewUpdates, pendingReviewUpdates, statusCardOperation, errors) {
@@ -68223,6 +68595,7 @@ exports.runVerifyCommands = runVerifyCommands;
68223
68595
  const logging_ports_1 = __nccwpck_require__(6152);
68224
68596
  const verify_command_policy_1 = __nccwpck_require__(96031);
68225
68597
  const verification_runtime_policy_1 = __nccwpck_require__(89347);
68598
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
68226
68599
  async function runVerifyCommands(commands, execute) {
68227
68600
  for (const command of commands) {
68228
68601
  const result = await executeVerifyCommand(command, execute);
@@ -68242,7 +68615,7 @@ async function executeVerifyCommand(command, execute) {
68242
68615
  : { success: false, failedCommand: formatCommandForDiagnostics(parsed) };
68243
68616
  }
68244
68617
  catch (error) {
68245
- if (error instanceof verification_runtime_policy_1.VerificationPrerequisiteError) {
68618
+ if (error instanceof verification_runtime_policy_1.VerificationPrerequisiteError || error instanceof verification_setup_policy_1.VerificationSetupError) {
68246
68619
  return { success: false, failedCommand: formatCommandForDiagnostics(parsed),
68247
68620
  error: `${error.message} Verification command: ${formatCommandForDiagnostics(parsed)}.` };
68248
68621
  }
@@ -73862,7 +74235,7 @@ function registerSetupCommand(program) {
73862
74235
  .option('--update-workflows', 'Allow setup-managed workflows already in the repository to be updated', false)
73863
74236
  .option('--workflow-pat <token>', 'Workflow PAT for the bot account (prefer the hidden interactive prompt)')
73864
74237
  .option('--secret <name=value>', 'Secret value for non-interactive setup; repeat for each API key', setup_command_options_1.collectSecret, {})
73865
- .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`)
73866
74239
  .action(setup_execution_1.executeSetupCommand);
73867
74240
  }
73868
74241
 
@@ -73963,6 +74336,7 @@ async function executeSetupCommand(options) {
73963
74336
  let guardedFiles;
73964
74337
  let webApplySnapshot;
73965
74338
  let approvedWorkflowFiles = [];
74339
+ let verificationActionState;
73966
74340
  let credentialsCollection;
73967
74341
  try {
73968
74342
  if (options.confirmUnverifiableWritePermissions) {
@@ -74209,6 +74583,8 @@ async function executeSetupCommand(options) {
74209
74583
  return 'blocked';
74210
74584
  }
74211
74585
  configuration = result.configuration;
74586
+ const reviewedAction = result.plan.installationReview?.verificationSetup?.action;
74587
+ verificationActionState = reviewedAction === 'create' || reviewedAction === 'preserve' ? reviewedAction : undefined;
74212
74588
  remoteConfiguration = result.remoteConfiguration;
74213
74589
  guardedFiles = webBridge ? (0, setup_configuration_plan_1.setupPlanGuardPaths)(result.plan) : undefined;
74214
74590
  webApplySnapshot = guardedFiles ? (0, setup_apply_snapshot_1.captureSetupApplySnapshot)(checkoutRoot, guardedFiles) : undefined;
@@ -74249,7 +74625,7 @@ async function executeSetupCommand(options) {
74249
74625
  },
74250
74626
  apply: async (report) => {
74251
74627
  (0, logger_1.logInfo)('⚙️ Applying the approved setup plan...');
74252
- 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);
74253
74629
  setupMutationStarted = true;
74254
74630
  setupApplyStarted = true;
74255
74631
  const actionResults = await (0, local_action_1.runLocalAction)(params, {
@@ -74327,7 +74703,7 @@ exports.buildSetupParams = buildSetupParams;
74327
74703
  const action_types_1 = __nccwpck_require__(19625);
74328
74704
  const input_keys_1 = __nccwpck_require__(88539);
74329
74705
  const setup_configuration_policy_1 = __nccwpck_require__(56637);
74330
- function buildSetupParams(options, gitInfo, token, configuration, credentials, approvedWorkflowFiles = [], remoteConfiguration, configurationSource) {
74706
+ function buildSetupParams(options, gitInfo, token, configuration, credentials, approvedWorkflowFiles = [], remoteConfiguration, configurationSource, verificationActionState) {
74331
74707
  return {
74332
74708
  ...(configuration ? (0, setup_configuration_policy_1.buildSetupActionInputs)(configuration) : {}),
74333
74709
  [input_keys_1.INPUT_KEYS.DEBUG]: options.debug?.toString() ?? 'false',
@@ -74344,6 +74720,7 @@ function buildSetupParams(options, gitInfo, token, configuration, credentials, a
74344
74720
  ...(remoteConfiguration ? { setupRemoteConfiguration: remoteConfiguration } : {}),
74345
74721
  ...(configurationSource ? { setupConfigurationSource: configurationSource } : {}),
74346
74722
  setupWorkflowUpdates: approvedWorkflowFiles,
74723
+ ...(verificationActionState ? { setupVerificationActionState: verificationActionState } : {}),
74347
74724
  };
74348
74725
  }
74349
74726
 
@@ -75013,7 +75390,7 @@ const REPOSITORY_STRING_KEYS = new Set([
75013
75390
  'orchestrationPresentationMode',
75014
75391
  'orchestrationCommentMode',
75015
75392
  ]);
75016
- const REPOSITORY_BOOLEAN_KEYS = new Set(['issueManagedBranches', 'preBranchSdd', 'reopenIssueOnPush', 'orchestrationDiagrams']);
75393
+ const REPOSITORY_BOOLEAN_KEYS = new Set(['issueManagedBranches', 'preBranchSdd', 'verificationSetup', 'reopenIssueOnPush', 'orchestrationDiagrams']);
75017
75394
  const REPOSITORY_NUMBER_KEYS = new Set(['desiredAssigneesCount', 'desiredReviewersCount', 'inactivityThresholdHours']);
75018
75395
  const REPOSITORY_STRUCTURED_KEYS = new Set(['mergeQueueCheckAttestations']);
75019
75396
  const AI_STRING_KEYS = new Set(['ignoreFiles', 'pullRequestDescriptionMode', 'bugbotSeverity', 'bugbotFixVerifyCommands', 'bugbotEffort', 'bugbotOrganizationRules', 'provisioningMode']);
@@ -75752,8 +76129,11 @@ function doctorCheckLabel(id, catalog = (0, setup_doctor_message_catalog_1.resol
75752
76129
  Object.defineProperty(exports, "__esModule", ({ value: true }));
75753
76130
  exports.renderSetupInstallationReview = renderSetupInstallationReview;
75754
76131
  const setup_terminal_choice_policy_1 = __nccwpck_require__(64662);
76132
+ const setup_verification_action_summary_policy_1 = __nccwpck_require__(15818);
75755
76133
  function renderSetupInstallationReview(review) {
75756
- 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',
75757
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.',
75758
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))}`),
75759
76139
  'Asset inventory (disabled optional capabilities remain visible):',
@@ -75781,6 +76161,7 @@ class ConsoleSetupJourneyPresenter {
75781
76161
  present(view) {
75782
76162
  console.log(renderSetupJourney(view));
75783
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}`);
75784
76165
  console.log(`Next: install the reviewed files, then verify your first workflow: ${setup_documentation_1.SETUP_DOCUMENTATION.firstWorkflow}`);
75785
76166
  }
75786
76167
  else if (view.outcome === 'blocked' || view.outcome === 'partial') {
@@ -78370,9 +78751,16 @@ exports.APPLICATION_ERROR_RECOVERY_IDS = Object.freeze([
78370
78751
  'branch-sync-resolution-invalid',
78371
78752
  'sdd-draft-size-exceeded',
78372
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',
78373
78758
  'workspace-changes-rejected',
78374
78759
  'closed-issue-reconciliation-failed',
78375
78760
  'approval-evidence-read-failed',
78761
+ 'stored-configuration-schema-missing',
78762
+ 'stored-configuration-schema-unsupported',
78763
+ 'stored-configuration-invalid',
78376
78764
  ]);
78377
78765
  const PRESERVED_STATE = 'Existing persisted state and completed external effects were preserved.';
78378
78766
  const UNCHANGED_STATE = 'No new state or external effect was created.';
@@ -78564,6 +78952,9 @@ class ApplicationError extends Error {
78564
78952
  exports.ApplicationError = ApplicationError;
78565
78953
  _ApplicationError_cause = new WeakMap();
78566
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']),
78567
78958
  'closed-issue-reconciliation-failed': Object.freeze(['resultId', 'phase', 'state', 'reason', 'changed', 'remaining']),
78568
78959
  'approval-evidence-read-failed': Object.freeze(['operation', 'reason', 'permission']),
78569
78960
  'pull-request-link-restored': Object.freeze([]),
@@ -78578,6 +78969,10 @@ const RECOVERY_VARIABLE_KEYS = Object.freeze({
78578
78969
  'branch-sync-resolution-invalid': Object.freeze(['validationCode', 'command']),
78579
78970
  'sdd-draft-size-exceeded': Object.freeze([]),
78580
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([]),
78581
78976
  'workspace-changes-rejected': Object.freeze([]),
78582
78977
  });
78583
78978
  function normalizeApplicationErrorRecovery(recovery) {
@@ -78593,6 +78988,13 @@ function normalizeApplicationErrorRecovery(recovery) {
78593
78988
  || actualKeys.some((key, index) => key !== expectedKeys[index])) {
78594
78989
  throw new TypeError(`Application error recovery variables are invalid for ${recovery.id}.`);
78595
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
+ }
78596
78998
  if (recovery.id === 'managed-branch-enrichment-failed'
78597
78999
  && (typeof variables.branchName !== 'string'
78598
79000
  || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,254}$/u.test(variables.branchName))) {
@@ -78974,6 +79376,7 @@ class Execution {
78974
79376
  this.currentIssueWorkflowAdmission = components.issueWorkflowAdmission;
78975
79377
  this.currentConfiguration.issueWorkflowProfileDigest = components.issueWorkflowProfileDigest;
78976
79378
  this.preBranchSdd = components.preBranchSdd ?? false;
79379
+ this.verificationSetup = components.verificationSetup ?? false;
78977
79380
  }
78978
79381
  }
78979
79382
  exports.Execution = Execution;
@@ -83899,6 +84302,7 @@ function combineOrganizationAccess(secrets, variables) {
83899
84302
 
83900
84303
  Object.defineProperty(exports, "__esModule", ({ value: true }));
83901
84304
  exports.isGithubAlreadyExists = exports.isGithubPermissionDenied = exports.isGithubRateLimited = exports.isGithubNotFound = exports.getGithubErrorStatus = void 0;
84305
+ exports.githubReadErrorCode = githubReadErrorCode;
83902
84306
  const getGithubErrorStatus = (error) => {
83903
84307
  if (typeof error !== "object" || error === null)
83904
84308
  return undefined;
@@ -83908,6 +84312,23 @@ const getGithubErrorStatus = (error) => {
83908
84312
  exports.getGithubErrorStatus = getGithubErrorStatus;
83909
84313
  const isGithubNotFound = (error) => (0, exports.getGithubErrorStatus)(error) === 404;
83910
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
+ }
83911
84332
  const isGithubRateLimited = (error) => {
83912
84333
  const status = (0, exports.getGithubErrorStatus)(error);
83913
84334
  if (status === 429)
@@ -84618,8 +85039,9 @@ class IssueContentRepository {
84618
85039
  return issue.body ?? '';
84619
85040
  }
84620
85041
  catch (error) {
84621
- (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', `Unable to read issue #${issueNumber} description.`));
84622
- 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;
84623
85045
  }
84624
85046
  };
84625
85047
  this.getIssueDescription = async (owner, repository, issueNumber, token) => {
@@ -86624,12 +87046,13 @@ class PullRequestApprovalRepository {
86624
87046
  collectDiagnostic(diagnostics, cause);
86625
87047
  }
86626
87048
  }
87049
+ const checkClient = this.checkOctokit ?? this.octokit;
86627
87050
  const [files, reviews, comments, headChecks, mergeChecks, headRuns, mergeRuns, rules, user] = await Promise.all([
86628
87051
  this.allPages('files', this.octokit.rest.pulls.listFiles, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
86629
87052
  this.allPages('reviews', this.octokit.rest.pulls.listReviews, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
86630
87053
  this.allPages('comments', this.octokit.rest.issues.listComments, { owner: target.owner, repo: target.repository, issue_number: target.pullNumber }),
86631
- this.allPages('head-checks', this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: headSha, filter: 'all' }),
86632
- testedMergeSha ? this.allPages('merge-checks', this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: testedMergeSha, filter: 'all' }) : Promise.resolve([]),
87054
+ this.allPages('head-checks', checkClient.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: headSha, filter: 'all' }, checkClient),
87055
+ testedMergeSha ? this.allPages('merge-checks', checkClient.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: testedMergeSha, filter: 'all' }, checkClient) : Promise.resolve([]),
86633
87056
  this.allPages('head-runs', this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: headSha }),
86634
87057
  testedMergeSha ? this.allPages('merge-runs', this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: testedMergeSha }) : Promise.resolve([]),
86635
87058
  this.effectiveRules(target.owner, target.repository, pull.base.ref, diagnostics),
@@ -86887,10 +87310,10 @@ class PullRequestApprovalRepository {
86887
87310
  return { readable: false, dismissesStaleReviews: false, requiredChecks: [] };
86888
87311
  }
86889
87312
  }
86890
- async allPages(operation, method, params) {
87313
+ async allPages(operation, method, params, client = this.octokit) {
86891
87314
  return (0, approval_evidence_read_1.readApprovalEvidence)(operation, async () => {
86892
87315
  const result = [];
86893
- for await (const response of this.octokit.paginate.iterator(method, { ...params, per_page: 100 })) {
87316
+ for await (const response of client.paginate.iterator(method, { ...params, per_page: 100 })) {
86894
87317
  const page = Array.isArray(response.data) ? response.data
86895
87318
  : record(response.data)?.check_runs ?? record(response.data)?.workflow_runs
86896
87319
  ?? record(response.data)?.artifacts ?? record(response.data)?.jobs;
@@ -86981,8 +87404,8 @@ function collectDiagnostic(diagnostics, cause) {
86981
87404
 
86982
87405
  Object.defineProperty(exports, "__esModule", ({ value: true }));
86983
87406
  exports.PullRequestChangesRepository = void 0;
87407
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
86984
87408
  const logger_1 = __nccwpck_require__(91151);
86985
- const pull_request_review_errors_1 = __nccwpck_require__(46445);
86986
87409
  const github_pagination_policy_1 = __nccwpck_require__(44812);
86987
87410
  const application_error_1 = __nccwpck_require__(75999);
86988
87411
  class PullRequestChangesRepository {
@@ -86995,7 +87418,7 @@ class PullRequestChangesRepository {
86995
87418
  }
86996
87419
  catch (error) {
86997
87420
  (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request review diff.'));
86998
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-files');
87421
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-files');
86999
87422
  }
87000
87423
  };
87001
87424
  this.getBoundedBugbotReviewDiffSnapshot = async (owner, repository, pullNumber, token) => {
@@ -87037,7 +87460,7 @@ class PullRequestChangesRepository {
87037
87460
  }
87038
87461
  catch (error) {
87039
87462
  (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request review diff.'));
87040
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-files');
87463
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-files');
87041
87464
  }
87042
87465
  };
87043
87466
  /** Head commit SHA of the PR (for creating review). */
@@ -87056,7 +87479,7 @@ class PullRequestChangesRepository {
87056
87479
  }
87057
87480
  catch (error) {
87058
87481
  (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request head SHA.'));
87059
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "get-head-sha");
87482
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "get-head-sha");
87060
87483
  }
87061
87484
  };
87062
87485
  }
@@ -87399,6 +87822,7 @@ function toBugbotPullRequestIdentity(value) {
87399
87822
 
87400
87823
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87401
87824
  exports.PullRequestReviewCommentCommandRepository = void 0;
87825
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
87402
87826
  const pull_request_review_errors_1 = __nccwpck_require__(46445);
87403
87827
  const github_pagination_policy_1 = __nccwpck_require__(44812);
87404
87828
  class PullRequestReviewCommentCommandRepository {
@@ -87467,7 +87891,7 @@ class PullRequestReviewCommentCommandRepository {
87467
87891
  const context = comments.length > 0
87468
87892
  ? { failedCount: comments.length, totalCount: comments.length }
87469
87893
  : undefined;
87470
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "publish-comments", context);
87894
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "publish-comments", context);
87471
87895
  }
87472
87896
  }
87473
87897
  async updatePullRequestReview(owner, repository, pullRequestNumber, reviewIdentity, body, token) {
@@ -87488,7 +87912,7 @@ class PullRequestReviewCommentCommandRepository {
87488
87912
  throw new pull_request_review_errors_1.PullRequestReviewOperationError('update-review');
87489
87913
  }
87490
87914
  catch (error) {
87491
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'update-review');
87915
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'update-review');
87492
87916
  }
87493
87917
  }
87494
87918
  async updatePullRequestReviewComment(_owner, _repository, commentIdentity, body, token) {
@@ -87507,7 +87931,7 @@ class PullRequestReviewCommentCommandRepository {
87507
87931
  }
87508
87932
  }
87509
87933
  catch (error) {
87510
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "update-comment");
87934
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "update-comment");
87511
87935
  }
87512
87936
  }
87513
87937
  }
@@ -87523,7 +87947,7 @@ exports.PullRequestReviewCommentCommandRepository = PullRequestReviewCommentComm
87523
87947
 
87524
87948
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87525
87949
  exports.PullRequestReviewCommentQueryRepository = void 0;
87526
- const pull_request_review_errors_1 = __nccwpck_require__(46445);
87950
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
87527
87951
  const github_pagination_policy_1 = __nccwpck_require__(44812);
87528
87952
  function toReviewComment(comment) {
87529
87953
  if (typeof comment.node_id !== "string" || comment.node_id.length === 0) {
@@ -87579,7 +88003,7 @@ class PullRequestReviewCommentQueryRepository {
87579
88003
  return comments;
87580
88004
  }
87581
88005
  catch (error) {
87582
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "list-comments");
88006
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-comments");
87583
88007
  }
87584
88008
  }
87585
88009
  async listBugbotPullRequestReviewCommentsBounded(owner, repository, pullRequestNumber, token) {
@@ -87622,7 +88046,7 @@ class PullRequestReviewCommentQueryRepository {
87622
88046
  };
87623
88047
  }
87624
88048
  catch (error) {
87625
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "list-comments");
88049
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-comments");
87626
88050
  }
87627
88051
  }
87628
88052
  async listPullRequestReviews(owner, repository, pullRequestNumber, token) {
@@ -87636,7 +88060,7 @@ class PullRequestReviewCommentQueryRepository {
87636
88060
  return reviews;
87637
88061
  }
87638
88062
  catch (error) {
87639
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-reviews');
88063
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-reviews');
87640
88064
  }
87641
88065
  }
87642
88066
  async getPullRequestReviewCommentBody(owner, repository, _pullRequestNumber, commentId, token) {
@@ -87650,13 +88074,37 @@ class PullRequestReviewCommentQueryRepository {
87650
88074
  return data.body ?? null;
87651
88075
  }
87652
88076
  catch (error) {
87653
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "get-comment");
88077
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "get-comment");
87654
88078
  }
87655
88079
  }
87656
88080
  }
87657
88081
  exports.PullRequestReviewCommentQueryRepository = PullRequestReviewCommentQueryRepository;
87658
88082
 
87659
88083
 
88084
+ /***/ }),
88085
+
88086
+ /***/ 54354:
88087
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
88088
+
88089
+ "use strict";
88090
+
88091
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
88092
+ exports.toPullRequestReviewOperationError = toPullRequestReviewOperationError;
88093
+ const pull_request_review_errors_1 = __nccwpck_require__(46445);
88094
+ /** Only safe HTTP metadata crosses the provider boundary; provider prose never does. */
88095
+ function toPullRequestReviewOperationError(error, operation, context) {
88096
+ if (!error || typeof error !== 'object')
88097
+ return (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, operation, context);
88098
+ const record = error;
88099
+ return (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, operation, {
88100
+ ...context,
88101
+ ...(typeof record.status === 'number' ? { providerStatus: record.status } : {}),
88102
+ ...(typeof record.response?.headers?.['x-github-request-id'] === 'string'
88103
+ ? { providerReference: record.response.headers['x-github-request-id'] } : {}),
88104
+ });
88105
+ }
88106
+
88107
+
87660
88108
  /***/ }),
87661
88109
 
87662
88110
  /***/ 2307:
@@ -87767,6 +88215,7 @@ function nextConnectionCursor(pageInfo, seenCursors) {
87767
88215
 
87768
88216
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87769
88217
  exports.PullRequestReviewThreadRepository = void 0;
88218
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
87770
88219
  const logger_1 = __nccwpck_require__(91151);
87771
88220
  const pull_request_review_errors_1 = __nccwpck_require__(46445);
87772
88221
  const pull_request_review_thread_locator_1 = __nccwpck_require__(2307);
@@ -87814,7 +88263,7 @@ class PullRequestReviewThreadRepository {
87814
88263
  return states;
87815
88264
  }
87816
88265
  catch (error) {
87817
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-threads');
88266
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-threads');
87818
88267
  }
87819
88268
  };
87820
88269
  this.listBugbotPullRequestReviewThreadStatesBounded = async (owner, repository, pullNumber, token) => {
@@ -87883,7 +88332,7 @@ class PullRequestReviewThreadRepository {
87883
88332
  };
87884
88333
  }
87885
88334
  catch (error) {
87886
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'list-threads');
88335
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-threads');
87887
88336
  }
87888
88337
  };
87889
88338
  this.resolvePullRequestReviewThread = async (owner, repository, pullNumber, commentIdentity, token) => {
@@ -87907,7 +88356,7 @@ class PullRequestReviewThreadRepository {
87907
88356
  (0, logger_1.logDebugInfo)('Resolved pull request review thread.');
87908
88357
  }
87909
88358
  catch (error) {
87910
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'resolve-thread');
88359
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'resolve-thread');
87911
88360
  }
87912
88361
  };
87913
88362
  this.unresolvePullRequestReviewThread = async (owner, repository, pullNumber, commentIdentity, token) => {
@@ -87931,7 +88380,7 @@ class PullRequestReviewThreadRepository {
87931
88380
  (0, logger_1.logDebugInfo)('Reopened pull request review thread.');
87932
88381
  }
87933
88382
  catch (error) {
87934
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, 'unresolve-thread');
88383
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'unresolve-thread');
87935
88384
  }
87936
88385
  };
87937
88386
  }
@@ -87948,7 +88397,7 @@ exports.PullRequestReviewThreadRepository = PullRequestReviewThreadRepository;
87948
88397
 
87949
88398
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87950
88399
  exports.PullRequestReviewerRepository = void 0;
87951
- const pull_request_review_errors_1 = __nccwpck_require__(46445);
88400
+ const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
87952
88401
  const github_pagination_policy_1 = __nccwpck_require__(44812);
87953
88402
  const COMPLETED_REVIEW_STATES = new Set([
87954
88403
  "APPROVED",
@@ -87981,7 +88430,7 @@ class PullRequestReviewerRepository {
87981
88430
  return [...reviewers.values()];
87982
88431
  }
87983
88432
  catch (error) {
87984
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "list-reviewers");
88433
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-reviewers");
87985
88434
  }
87986
88435
  }
87987
88436
  async addReviewersToPullRequest(owner, repository, pullRequestNumber, reviewers, token) {
@@ -88006,7 +88455,7 @@ class PullRequestReviewerRepository {
88006
88455
  return [...confirmed.values()];
88007
88456
  }
88008
88457
  catch (error) {
88009
- throw (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, "request-reviewers");
88458
+ throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "request-reviewers");
88010
88459
  }
88011
88460
  }
88012
88461
  async listRequestedReviewers(client, parameters) {
@@ -89424,10 +89873,15 @@ function matchesConstrainedHead(target, candidate) {
89424
89873
  /***/ }),
89425
89874
 
89426
89875
  /***/ 31011:
89427
- /***/ ((__unused_webpack_module, exports) => {
89876
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
89428
89877
 
89429
89878
  "use strict";
89430
89879
 
89880
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
89881
+ exports.isExistingFindingFullyResolved = isExistingFindingFullyResolved;
89882
+ exports.findExistingFindingInfo = findExistingFindingInfo;
89883
+ exports.findExistingFindingMatch = findExistingFindingMatch;
89884
+ exports.retainExistingFindingIds = retainExistingFindingIds;
89431
89885
  /**
89432
89886
  * Provider-neutral Bugbot finding and durable identity contracts.
89433
89887
  *
@@ -89435,9 +89889,7 @@ function matchesConstrainedHead(target, candidate) {
89435
89889
  * them in the domain prevents policies from depending on a particular use-case
89436
89890
  * folder and gives every adapter one stable semantic vocabulary.
89437
89891
  */
89438
- Object.defineProperty(exports, "__esModule", ({ value: true }));
89439
- exports.isExistingFindingFullyResolved = isExistingFindingFullyResolved;
89440
- exports.findExistingFindingInfo = findExistingFindingInfo;
89892
+ const finding_identity_1 = __nccwpck_require__(91853);
89441
89893
  function isExistingFindingFullyResolved(finding) {
89442
89894
  const destinations = [finding.issue, finding.pullRequest].filter((destination) => destination != null);
89443
89895
  return (destinations.length > 0 &&
@@ -89445,21 +89897,62 @@ function isExistingFindingFullyResolved(finding) {
89445
89897
  finding.pullRequest?.verificationRequired !== true);
89446
89898
  }
89447
89899
  function findExistingFindingInfo(existingByFindingId, finding) {
89900
+ return findExistingFindingMatch(existingByFindingId, finding)?.info;
89901
+ }
89902
+ /** A match carries its durable key so updating a comment cannot re-key it. */
89903
+ function findExistingFindingMatch(existingByFindingId, finding) {
89448
89904
  const direct = existingByFindingId[finding.id];
89449
89905
  if (direct && identitiesAreCompatible(direct, finding))
89450
- return direct;
89451
- const candidates = Object.values(existingByFindingId);
89906
+ return { id: finding.id, info: direct };
89907
+ const candidates = Object.entries(existingByFindingId);
89452
89908
  if (finding.fingerprint) {
89453
- const locationMatch = candidates.find((candidate) => candidate.issue?.fingerprint === finding.fingerprint
89909
+ const locationMatches = candidates.filter(([, candidate]) => candidate.issue?.fingerprint === finding.fingerprint
89454
89910
  || candidate.pullRequest?.fingerprint === finding.fingerprint);
89455
- if (locationMatch)
89456
- return locationMatch;
89911
+ if (locationMatches.length > 0)
89912
+ return uniqueFindingMatch(locationMatches);
89457
89913
  }
89458
89914
  if (!finding.semanticFingerprint)
89459
89915
  return undefined;
89460
- const semanticMatches = candidates.filter((candidate) => candidate.issue?.semanticFingerprint === finding.semanticFingerprint
89916
+ const semanticMatches = candidates.filter(([, candidate]) => candidate.issue?.semanticFingerprint === finding.semanticFingerprint
89461
89917
  || candidate.pullRequest?.semanticFingerprint === finding.semanticFingerprint);
89462
- return semanticMatches.length === 1 ? semanticMatches[0] : undefined;
89918
+ return uniqueFindingMatch(semanticMatches);
89919
+ }
89920
+ /**
89921
+ * Preserve trusted IDs across title/location changes, before limits, publication
89922
+ * and final projection. Multiple reports of one uniquely matched durable finding
89923
+ * share one record; unmatched or ambiguous reports remain independent evidence.
89924
+ */
89925
+ function retainExistingFindingIds(findings, existingByFindingId) {
89926
+ const retained = new Set();
89927
+ const durableIds = new Set(Object.keys(existingByFindingId));
89928
+ // Reserve the whole input up front so a generated ID cannot take another
89929
+ // report's ID, including one that occurs later in the response.
89930
+ const reservedIds = new Set([...durableIds, ...findings.map((finding) => finding.id)]);
89931
+ const emittedIds = new Set();
89932
+ return findings.flatMap((finding) => {
89933
+ const match = findExistingFindingMatch(existingByFindingId, finding);
89934
+ if (!match) {
89935
+ let id = finding.id;
89936
+ if (durableIds.has(id) || emittedIds.has(id)) {
89937
+ const base = `candidate-${(0, finding_identity_1.buildFindingFingerprint)(finding)}`;
89938
+ id = base;
89939
+ let suffix = 0;
89940
+ while (reservedIds.has(id))
89941
+ id = `${base}-${++suffix}`;
89942
+ reservedIds.add(id);
89943
+ }
89944
+ emittedIds.add(id);
89945
+ return [id === finding.id ? finding : { ...finding, id }];
89946
+ }
89947
+ if (retained.has(match.id))
89948
+ return [];
89949
+ retained.add(match.id);
89950
+ emittedIds.add(match.id);
89951
+ return [finding.id === match.id ? finding : { ...finding, id: match.id }];
89952
+ });
89953
+ }
89954
+ function uniqueFindingMatch(matches) {
89955
+ return matches.length === 1 ? { id: matches[0][0], info: matches[0][1] } : undefined;
89463
89956
  }
89464
89957
  function identitiesAreCompatible(existing, finding) {
89465
89958
  const existingFingerprints = [
@@ -90069,6 +90562,63 @@ function isCopilotCommentRequest(commentBody, botLogin) {
90069
90562
  }
90070
90563
 
90071
90564
 
90565
+ /***/ }),
90566
+
90567
+ /***/ 33430:
90568
+ /***/ ((__unused_webpack_module, exports) => {
90569
+
90570
+ "use strict";
90571
+
90572
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
90573
+ exports.COPILOT_COMMENT_REMOTE_WORKFLOW = exports.COPILOT_COMMENT_SELF_WORKFLOW = exports.COPILOT_COMMENT_RUNTIME = void 0;
90574
+ exports.isCopilotCommentWorkflow = isCopilotCommentWorkflow;
90575
+ exports.isCopilotCommentRunner = isCopilotCommentRunner;
90576
+ exports.copilotCommentRunner = copilotCommentRunner;
90577
+ /** The comment coordinator is a versioned Copilot workflow, not an arbitrary reusable job. */
90578
+ exports.COPILOT_COMMENT_RUNTIME = 'copilot_comment_runtime.yml';
90579
+ exports.COPILOT_COMMENT_SELF_WORKFLOW = `$/.github/workflows/${exports.COPILOT_COMMENT_RUNTIME}`;
90580
+ exports.COPILOT_COMMENT_REMOTE_WORKFLOW = `vypdev/copilot/.github/workflows/${exports.COPILOT_COMMENT_RUNTIME}@v3`;
90581
+ function isCopilotCommentWorkflow(value) {
90582
+ return typeof value === 'string' && (value === exports.COPILOT_COMMENT_SELF_WORKFLOW
90583
+ || /^vypdev\/copilot\/\.github\/workflows\/copilot_comment_runtime\.yml@(?:v3(?:\.[0-9]+\.[0-9]+)?|[a-f0-9]{40})$/u.test(value));
90584
+ }
90585
+ const literal = (value) => typeof value === 'string' && value.length > 0 && value.length <= 100
90586
+ && value === value.trim() && !/[\p{Cc}\p{Cf}${}<>]/u.test(value);
90587
+ const labels = (value) => literal(value) || Array.isArray(value) && value.length > 0 && value.length <= 10
90588
+ && value.every(literal) && new Set(value.map(label => label.toLowerCase())).size === value.length;
90589
+ /** Runner routing is literal data; expressions need their original full workflow reviewed. */
90590
+ function isCopilotCommentRunner(value) {
90591
+ if (labels(value))
90592
+ return true;
90593
+ if (!value || typeof value !== 'object' || Array.isArray(value))
90594
+ return false;
90595
+ const route = value;
90596
+ const keys = Object.keys(route);
90597
+ return keys.length > 0 && (route.group !== undefined || route.labels !== undefined)
90598
+ && keys.every(key => key === 'group' || key === 'labels')
90599
+ && (route.group === undefined || literal(route.group))
90600
+ && (route.labels === undefined || labels(route.labels));
90601
+ }
90602
+ function copilotCommentRunner(job) {
90603
+ if (!job || !isCopilotCommentWorkflow(job.uses))
90604
+ return job?.['runs-on'];
90605
+ const inputs = job.with;
90606
+ if (typeof inputs?.['runs-on'] !== 'string')
90607
+ throw new Error('Comment workflow runner JSON is unavailable; review the workflow separately.');
90608
+ try {
90609
+ if (inputs['runs-on'].length > 16000)
90610
+ throw new Error('Runner JSON exceeds its bound.');
90611
+ const route = JSON.parse(inputs['runs-on']);
90612
+ if (!isCopilotCommentRunner(route))
90613
+ throw new Error('Unsupported execution route.');
90614
+ return route;
90615
+ }
90616
+ catch {
90617
+ throw new Error('Comment workflow runner JSON is invalid; review the workflow separately.');
90618
+ }
90619
+ }
90620
+
90621
+
90072
90622
  /***/ }),
90073
90623
 
90074
90624
  /***/ 72418:
@@ -91873,7 +92423,7 @@ function parsePositiveSafeInteger(value) {
91873
92423
  "use strict";
91874
92424
 
91875
92425
  Object.defineProperty(exports, "__esModule", ({ value: true }));
91876
- 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;
92426
+ 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;
91877
92427
  exports.retainSddAnswers = retainSddAnswers;
91878
92428
  exports.normalizeSddIssueTitle = normalizeSddIssueTitle;
91879
92429
  exports.isSafeSddPath = isSafeSddPath;
@@ -91884,6 +92434,7 @@ exports.isSddAnswerComment = isSddAnswerComment;
91884
92434
  exports.parseSddAnswer = parseSddAnswer;
91885
92435
  exports.validateSddMarkdown = validateSddMarkdown;
91886
92436
  exports.composeSddUpdate = composeSddUpdate;
92437
+ exports.recoverSddUpdate = recoverSddUpdate;
91887
92438
  exports.SDD_GATE_MARKER = 'copilot:sdd-gate:v1';
91888
92439
  exports.SDD_MIN_DRAFT_CHARACTERS = 1800;
91889
92440
  exports.SDD_MAX_DRAFT_CHARACTERS = 70000;
@@ -91911,6 +92462,15 @@ function normalizeSddIssueTitle(title) {
91911
92462
  function isSafeSddPath(path) {
91912
92463
  return SDD_PATH.test(path) && !['specs/CATALOG.md', 'specs/_template.md'].includes(path);
91913
92464
  }
92465
+ /** Closed diagnostics contain no model-selected identifiers or provider text. */
92466
+ class SddOwnershipFailure extends Error {
92467
+ constructor(reason) {
92468
+ super(`SDD ownership analysis rejected (${reason}).`);
92469
+ this.reason = reason;
92470
+ this.name = 'SddOwnershipFailure';
92471
+ }
92472
+ }
92473
+ exports.SddOwnershipFailure = SddOwnershipFailure;
91914
92474
  /** The agent may propose ownership but cannot invent a catalogued owner or arbitrary path. */
91915
92475
  function parseSddPlan(value, catalog) {
91916
92476
  if (!isRecord(value))
@@ -91928,14 +92488,16 @@ function parseSddPlan(value, catalog) {
91928
92488
  const ownerPaths = catalog.get(capabilityId);
91929
92489
  const registered = [...catalog.values()].some(paths => paths.includes(path));
91930
92490
  if (action === 'update' && (!ownerPaths?.includes(path) || !registered)) {
91931
- throw new Error('The requested SDD update is not owned by the selected catalog capability.');
91932
- }
91933
- if (action === 'companion' && (!ownerPaths || registered)) {
91934
- throw new Error('A companion SDD requires an existing owner and a new path.');
91935
- }
91936
- if (action === 'new' && (ownerPaths || registered)) {
91937
- throw new Error('A new SDD requires an unregistered capability and path.');
91938
- }
92491
+ throw new SddOwnershipFailure('update-owner-mismatch');
92492
+ }
92493
+ if (action === 'companion' && !ownerPaths)
92494
+ throw new SddOwnershipFailure('companion-owner-unknown');
92495
+ if (action === 'companion' && registered)
92496
+ throw new SddOwnershipFailure('companion-path-registered');
92497
+ if (action === 'new' && ownerPaths)
92498
+ throw new SddOwnershipFailure('new-owner-registered');
92499
+ if (action === 'new' && registered)
92500
+ throw new SddOwnershipFailure('new-path-registered');
91939
92501
  if (!Array.isArray(value.questions) || value.questions.length > 8) {
91940
92502
  throw new Error('The SDD analysis must contain at most eight blocking questions.');
91941
92503
  }
@@ -92176,8 +92738,24 @@ function composeSddUpdate(existing, change) {
92176
92738
  validateSddMarkdown(change);
92177
92739
  if (change.length > exports.SDD_MAX_UPDATE_CHARACTERS)
92178
92740
  throw new Error('An SDD update appendix exceeds 18000 characters; use a proportional change or a companion SDD.');
92741
+ const appendix = shiftSddHeadings(change, 1);
92742
+ const merged = `${existing.trimEnd()}\n\n${appendix.trim()}\n`;
92743
+ validateSddMarkdown(merged);
92744
+ return merged;
92745
+ }
92746
+ /** Recovery validates the original candidate, not a second copy of its retained baseline. */
92747
+ function recoverSddUpdate(existing, published) {
92748
+ const prefix = `${existing.trimEnd()}\n\n`;
92749
+ if (!published.startsWith(prefix))
92750
+ return undefined;
92751
+ // Composition normalizes outer whitespace and adds a publication newline.
92752
+ // Reconstruct an equivalent candidate inside the original size bounds.
92753
+ const change = shiftSddHeadings(published.slice(prefix.length), -1).trim().padEnd(exports.SDD_MIN_DRAFT_CHARACTERS, '\n');
92754
+ return composeSddUpdate(existing, change) === published ? change : undefined;
92755
+ }
92756
+ function shiftSddHeadings(source, direction) {
92179
92757
  let fence;
92180
- const appendix = change.split('\n').map(line => {
92758
+ return source.split('\n').map(line => {
92181
92759
  const boundary = line.match(/^\s*(`{3,}|~{3,})/);
92182
92760
  if (boundary) {
92183
92761
  if (!fence)
@@ -92186,11 +92764,11 @@ function composeSddUpdate(existing, change) {
92186
92764
  fence = undefined;
92187
92765
  return line;
92188
92766
  }
92189
- return !fence && /^#{1,5} /.test(line) ? `#${line}` : line;
92767
+ if (fence)
92768
+ return line;
92769
+ return direction === 1 ? (/^#{1,5} /.test(line) ? `#${line}` : line)
92770
+ : (/^#{2,6} /.test(line) ? line.slice(1) : line);
92190
92771
  }).join('\n');
92191
- const merged = `${existing.trimEnd()}\n\n${appendix.trim()}\n`;
92192
- validateSddMarkdown(merged);
92193
- return merged;
92194
92772
  }
92195
92773
  function serializeSddGateValue(value) {
92196
92774
  // Human answer text must never terminate its hidden state comment.
@@ -92787,6 +93365,254 @@ function replyRequestBodyDigest(body) {
92787
93365
  }
92788
93366
 
92789
93367
 
93368
+ /***/ }),
93369
+
93370
+ /***/ 27910:
93371
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
93372
+
93373
+ "use strict";
93374
+
93375
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
93376
+ exports.SDD_CONSISTENCY_PROMPT = void 0;
93377
+ exports.reservedSddCaseIds = reservedSddCaseIds;
93378
+ exports.validateSddDraftConsistency = validateSddDraftConsistency;
93379
+ const pre_branch_sdd_1 = __nccwpck_require__(34730);
93380
+ const CASE = /\b(?:[A-Za-z][A-Za-z0-9]*-)+C\d+\b/gu;
93381
+ const CASE_ID = /^(?:[A-Za-z][A-Za-z0-9]*-)+C\d+$/u;
93382
+ const REQUIREMENT_ID = /^[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+$/u;
93383
+ /** Generated candidates use visible tables; retained legacy owners are never reformatted. */
93384
+ exports.SDD_CONSISTENCY_PROMPT = `Consistency contract for the proposed draft/appendix (not the retained owner):
93385
+ In section 4 include one table: Requirement | Behavior. Give every goal a stable requirement ID.
93386
+ In section 14 include one budget table: Area | Minimum distinct cases | Behaviors/risks covered; positive integers and one Total.
93387
+ Also in section 14 include one inventory table: Case ID | Area | Requirements | Scenario.
93388
+ 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.
93389
+ 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.
93390
+ 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.`;
93391
+ function fail(reason) {
93392
+ // Closed diagnostics: rejected Markdown and repository text never become repair instructions.
93393
+ throw new pre_branch_sdd_1.SddDraftFormatFailure(reason, `The SDD draft violates its ${reason} consistency contract.`);
93394
+ }
93395
+ /** Excludes examples and hidden records from the contract. */
93396
+ function visible(source) {
93397
+ let fence;
93398
+ let comment = false;
93399
+ return source.replace(/\r\n/gu, '\n').split('\n').map(line => {
93400
+ const boundary = /^\s*(`{3,}|~{3,})/u.exec(line);
93401
+ if (fence) {
93402
+ // Comment syntax inside code is literal; only the original line can close it.
93403
+ if (boundary && boundary[1][0] === fence[0] && boundary[1].length >= fence.length
93404
+ && /^ {0,3}(?:`+|~+)[ \t]*$/u.test(line))
93405
+ fence = undefined;
93406
+ return '';
93407
+ }
93408
+ if (!comment && boundary) {
93409
+ fence = boundary[1];
93410
+ return '';
93411
+ }
93412
+ let result = '';
93413
+ let offset = 0;
93414
+ while (offset < line.length) {
93415
+ const marker = comment ? '-->' : '<!--';
93416
+ const next = line.indexOf(marker, offset);
93417
+ if (next < 0)
93418
+ return result + (comment ? '' : line.slice(offset));
93419
+ if (!comment)
93420
+ result += line.slice(offset, next) + ' ';
93421
+ offset = next + marker.length;
93422
+ comment = !comment;
93423
+ }
93424
+ return result;
93425
+ }).join('\n');
93426
+ }
93427
+ function clean(value) { return value.trim().replace(/^(?:\*\*|__|`)(.*?)(?:\*\*|__|`)$/u, '$1').trim(); }
93428
+ function table(source, section, headers, reason) {
93429
+ const sections = [...source.matchAll(/^## (\d+)\. [^\n]*$/gmu)];
93430
+ const matches = sections.filter(heading => Number(heading[1]) === section);
93431
+ if (matches.length !== 1)
93432
+ return fail(reason);
93433
+ const start = matches[0];
93434
+ const end = sections.find(heading => heading.index > start.index)?.index ?? source.length;
93435
+ const lines = source.slice(start.index + start[0].length, end).split('\n');
93436
+ const found = [];
93437
+ for (let index = 0; index < lines.length; index++) {
93438
+ if (!/^\s*\|/u.test(lines[index]))
93439
+ continue;
93440
+ const cells = (line) => line.trim().replace(/^\||\|$/gu, '').split('|').map(clean);
93441
+ const header = cells(lines[index]);
93442
+ if (!headers.every((value, position) => header[position] === value) || header.length !== headers.length)
93443
+ continue;
93444
+ const separator = cells(lines[++index] ?? '');
93445
+ if (separator.length !== headers.length || !separator.every(cell => /^:?-{3,}:?$/u.test(cell)))
93446
+ return fail(reason);
93447
+ const rows = [];
93448
+ while (++index < lines.length && /^\s*\|/u.test(lines[index])) {
93449
+ const row = cells(lines[index]);
93450
+ if (row.length !== headers.length || row.some(cell => !cell))
93451
+ return fail(reason);
93452
+ rows.push(row);
93453
+ }
93454
+ if (!rows.length)
93455
+ return fail(reason);
93456
+ found.push(rows);
93457
+ }
93458
+ return found.length === 1 ? found[0] : fail(reason);
93459
+ }
93460
+ function ids(value, pattern, reason) {
93461
+ const values = value.split(/\s*,\s*/u);
93462
+ if (!values.every(id => pattern.test(id)) || new Set(values).size !== values.length)
93463
+ return fail(reason);
93464
+ return values;
93465
+ }
93466
+ function reservedSddCaseIds(documents) {
93467
+ const reserved = new Set();
93468
+ for (const document of documents) {
93469
+ const source = visible(document.markdown);
93470
+ const qualified = source.match(CASE) ?? [];
93471
+ const namespaces = new Set(qualified.map(id => id.slice(0, id.lastIndexOf('-C') + 2)));
93472
+ for (const id of qualified)
93473
+ reserved.add(id);
93474
+ // Legacy inventories often qualify C01 and abbreviate the remaining rows.
93475
+ // Reserve every plausible namespace instead of silently assigning an alias a new meaning.
93476
+ for (const match of source.matchAll(/(?<![\w-])C(\d+)\b/gu)) {
93477
+ for (const namespace of namespaces)
93478
+ reserved.add(`${namespace}${match[1]}`);
93479
+ }
93480
+ for (const match of source.matchAll(/\bC(\d+)\s*[-–—]\s*C?(\d+)\b/gu)) {
93481
+ const start = Number(match[1]);
93482
+ const end = Number(match[2]);
93483
+ if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || end < start || end - start > 1000) {
93484
+ throw new Error('An owning SDD case range cannot be reconciled within the fixed bound; review the baseline before retrying.');
93485
+ }
93486
+ for (let number = start; number <= end; number++) {
93487
+ for (const namespace of namespaces)
93488
+ reserved.add(`${namespace}${String(number).padStart(match[1].length, '0')}`);
93489
+ }
93490
+ }
93491
+ }
93492
+ return [...reserved].sort();
93493
+ }
93494
+ function validateSddDraftConsistency(markdown, owners, inventory, sddPath) {
93495
+ const source = visible(markdown);
93496
+ const requirements = table(source, 4, ['Requirement', 'Behavior'], 'requirement-mapping');
93497
+ const requirementIds = requirements.map(row => row[0]);
93498
+ if (new Set(requirementIds).size !== requirementIds.length || !requirementIds.every(id => REQUIREMENT_ID.test(id)))
93499
+ fail('requirement-mapping');
93500
+ const cases = table(source, 14, ['Case ID', 'Area', 'Requirements', 'Scenario'], 'case-identity');
93501
+ const caseIds = cases.map(row => row[0]);
93502
+ const reserved = new Set(reservedSddCaseIds(owners));
93503
+ if (new Set(caseIds).size !== caseIds.length || caseIds.some(id => !CASE_ID.test(id) || reserved.has(id))
93504
+ || /(?<![\w-])C\d+\b/u.test(source))
93505
+ fail('case-identity');
93506
+ // References to existing owner cases are allowed, but cannot count as newly defined cases.
93507
+ if ([...source.matchAll(CASE)].some(([id]) => !caseIds.includes(id) && !reserved.has(id)))
93508
+ fail('case-identity');
93509
+ const budget = table(source, 14, ['Area', 'Minimum distinct cases', 'Behaviors/risks covered'], 'case-budget');
93510
+ const counts = new Map();
93511
+ let total;
93512
+ for (const [area, value] of budget) {
93513
+ const count = /^[1-9]\d*$/u.test(value) ? Number(value) : NaN;
93514
+ if (!Number.isSafeInteger(count) || counts.has(area) || total !== undefined)
93515
+ fail('case-budget');
93516
+ if (area === 'Total')
93517
+ total = count;
93518
+ else
93519
+ counts.set(area, count);
93520
+ }
93521
+ if (!counts.size || total !== caseIds.length || [...counts.values()].reduce((sum, count) => sum + count, 0) !== total
93522
+ || cases.some(row => !counts.has(row[1])))
93523
+ fail('case-budget');
93524
+ for (const [area, count] of counts)
93525
+ if (cases.filter(row => row[1] === area).length !== count)
93526
+ fail('case-budget');
93527
+ const edges = new Map(requirementIds.map(id => [id, new Set()]));
93528
+ for (const [id, , links] of cases) {
93529
+ for (const requirement of ids(links, REQUIREMENT_ID, 'requirement-mapping')) {
93530
+ const linked = edges.get(requirement);
93531
+ if (!linked)
93532
+ fail('requirement-mapping');
93533
+ linked.add(id);
93534
+ }
93535
+ }
93536
+ const traceability = table(source, 17, ['Requirement', 'Cases'], 'requirement-mapping');
93537
+ const seen = new Set();
93538
+ for (const [requirement, links] of traceability) {
93539
+ const expected = edges.get(requirement);
93540
+ const actual = ids(links, CASE_ID, 'requirement-mapping');
93541
+ if (!expected || seen.has(requirement) || expected.size !== actual.length || actual.some(id => !expected.has(id)))
93542
+ fail('requirement-mapping');
93543
+ seen.add(requirement);
93544
+ }
93545
+ if (seen.size !== edges.size || [...edges.values()].some(links => links.size === 0))
93546
+ fail('requirement-mapping');
93547
+ validatePaths(source, inventory, sddPath);
93548
+ }
93549
+ function safePath(value) {
93550
+ return value.length > 0 && !/[\\:*?"<>|\p{Cc}]/u.test(value)
93551
+ && value.split('/').every(segment => segment && segment !== '.' && segment !== '..' && segment.toLowerCase() !== '.git');
93552
+ }
93553
+ function validatePaths(source, inventory, sddPath) {
93554
+ const rows = table(source, 15, ['Path', 'Change'], 'repository-path');
93555
+ const expectedChange = inventory.files.has(sddPath) ? 'update' : 'create';
93556
+ if (!rows.some(([file, change]) => file === sddPath && change === expectedChange))
93557
+ fail('repository-path');
93558
+ const proposed = new Set();
93559
+ const seen = new Set();
93560
+ for (const [file, change] of rows) {
93561
+ if (!safePath(file) || seen.has(file) || inventory.blocked.has(file))
93562
+ fail('repository-path');
93563
+ seen.add(file);
93564
+ if (change === 'create') {
93565
+ if (inventory.files.has(file) || inventory.directories.has(file))
93566
+ fail('repository-path');
93567
+ if ([...proposed].some(other => file.startsWith(`${other}/`) || other.startsWith(`${file}/`)))
93568
+ fail('repository-path');
93569
+ const segments = file.split('/');
93570
+ if (segments.some((_, index) => inventory.files.has(segments.slice(0, index + 1).join('/')) || inventory.blocked.has(segments.slice(0, index + 1).join('/'))))
93571
+ fail('repository-path');
93572
+ proposed.add(file);
93573
+ }
93574
+ else if (!['update', 'reference'].includes(change) || !inventory.files.has(file))
93575
+ fail('repository-path');
93576
+ }
93577
+ const check = (file) => {
93578
+ if (!safePath(file) || (!inventory.files.has(file) && !inventory.directories.has(file) && !proposed.has(file)))
93579
+ fail('repository-path');
93580
+ };
93581
+ // Relative Markdown file links resolve against the selected SDD, never the current checkout.
93582
+ for (const match of source.matchAll(/\]\(([^\s)]+)\)/gu)) {
93583
+ const href = match[1].split(/[?#]/u)[0];
93584
+ if (!href || /^(?:[a-z][a-z0-9+.-]*:|\/)/iu.test(href))
93585
+ continue;
93586
+ let decoded;
93587
+ try {
93588
+ decoded = decodeURIComponent(href);
93589
+ }
93590
+ catch {
93591
+ return fail('repository-path');
93592
+ }
93593
+ const parts = sddPath.split('/').slice(0, -1);
93594
+ for (const part of decoded.split('/')) {
93595
+ if (part === '..') {
93596
+ if (!parts.length)
93597
+ fail('repository-path');
93598
+ parts.pop();
93599
+ }
93600
+ else if (part !== '.')
93601
+ parts.push(part);
93602
+ }
93603
+ check(parts.join('/'));
93604
+ }
93605
+ for (const match of source.matchAll(/`([^`\n]+)`/gu)) {
93606
+ const value = match[1];
93607
+ if (value.includes('/') && !/^(?:[a-z][a-z0-9+.-]*:|\/)/iu.test(value) && !/\s/u.test(value))
93608
+ check(value.replace(/\/$/u, ''));
93609
+ }
93610
+ const prose = source.replace(/\]\([^\s)]+\)/gu, ']()').replace(/[a-z][a-z0-9+.-]*:\/\/[^\s)>]+/giu, '');
93611
+ for (const match of prose.matchAll(/(?<![\w./:-])([A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)+\.[A-Za-z0-9]+)(?![\w/-])/gu))
93612
+ check(match[1]);
93613
+ }
93614
+
93615
+
92790
93616
  /***/ }),
92791
93617
 
92792
93618
  /***/ 47122:
@@ -92992,6 +93818,20 @@ exports.DEFAULT_SETUP_RUNNERS = Object.freeze({
92992
93818
  });
92993
93819
 
92994
93820
 
93821
+ /***/ }),
93822
+
93823
+ /***/ 33156:
93824
+ /***/ ((__unused_webpack_module, exports) => {
93825
+
93826
+ "use strict";
93827
+
93828
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
93829
+ exports.SETUP_VERIFICATION_ACTION_PARENTS = exports.SETUP_VERIFICATION_ACTION_PATH = void 0;
93830
+ /** Fixed consumer-owned asset: setup may create it, never regenerate or retire it. */
93831
+ exports.SETUP_VERIFICATION_ACTION_PATH = '.github/actions/copilot-verification-setup/action.yml';
93832
+ exports.SETUP_VERIFICATION_ACTION_PARENTS = ['.github', '.github/actions', '.github/actions/copilot-verification-setup'];
93833
+
93834
+
92995
93835
  /***/ }),
92996
93836
 
92997
93837
  /***/ 24596:
@@ -95729,12 +96569,14 @@ function createDeploymentOrchestrationUseCase(issueDescriptionQueryPort, publica
95729
96569
  });
95730
96570
  }
95731
96571
  const copilot_history_port_factory_1 = __nccwpck_require__(12321);
95732
- function createIssueCommentUseCaseCompositionRoot(binding) {
96572
+ const verification_setup_snapshot_1 = __nccwpck_require__(62148);
96573
+ const verification_setup_ports_1 = __nccwpck_require__(26509);
96574
+ function createIssueCommentUseCaseCompositionRoot(binding, setup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
95733
96575
  const bugbot = (0, bugbot_composition_root_1.createBugbotCompositionRoot)(binding);
95734
96576
  const findings = (0, agent_capability_composition_root_1.createFindingsQueryPort)();
95735
96577
  const language = (0, agent_capability_composition_root_1.createLanguageQueryPort)();
95736
96578
  const fixer = (0, agent_capability_composition_root_1.createFixerQueryPort)();
95737
- const gitCommit = new git_commit_adapter_1.GitCommitAdapter();
96579
+ const gitCommit = new git_commit_adapter_1.GitCommitAdapter(undefined, undefined, setup);
95738
96580
  const authenticatedUser = (0, authenticated_user_composition_root_1.createAuthenticatedUserCompositionRoot)();
95739
96581
  const bugbotGit = new bound_bugbot_git_mutation_adapter_1.BoundBugbotGitMutationAdapter(gitCommit, authenticatedUser, binding.token);
95740
96582
  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)());
@@ -95745,12 +96587,12 @@ function createIssueCommentUseCaseCompositionRoot(binding) {
95745
96587
  catalogResolver: new resolve_message_catalog_use_case_1.ResolveMessageCatalogUseCase(language),
95746
96588
  }), 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));
95747
96589
  }
95748
- function createPullRequestReviewCommentUseCaseCompositionRoot(binding) {
96590
+ function createPullRequestReviewCommentUseCaseCompositionRoot(binding, setup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
95749
96591
  const bugbot = (0, bugbot_composition_root_1.createBugbotCompositionRoot)(binding);
95750
96592
  const findings = (0, agent_capability_composition_root_1.createFindingsQueryPort)();
95751
96593
  const language = (0, agent_capability_composition_root_1.createLanguageQueryPort)();
95752
96594
  const fixer = (0, agent_capability_composition_root_1.createFixerQueryPort)();
95753
- const gitCommit = new git_commit_adapter_1.GitCommitAdapter();
96595
+ const gitCommit = new git_commit_adapter_1.GitCommitAdapter(undefined, undefined, setup);
95754
96596
  const authenticatedUser = (0, authenticated_user_composition_root_1.createAuthenticatedUserCompositionRoot)();
95755
96597
  const bugbotGit = new bound_bugbot_git_mutation_adapter_1.BoundBugbotGitMutationAdapter(gitCommit, authenticatedUser, binding.token);
95756
96598
  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)());
@@ -95777,7 +96619,7 @@ function createMainRunRouteCompositionRoot(projectBoardCommandPort, surface, set
95777
96619
  return singleAction.invoke(execution);
95778
96620
  },
95779
96621
  "issue-comment": async (execution) => {
95780
- issueComment ?? (issueComment = createIssueCommentUseCaseCompositionRoot(bugbotBinding(execution)));
96622
+ issueComment ?? (issueComment = createIssueCommentUseCaseCompositionRoot(bugbotBinding(execution), (0, verification_setup_snapshot_1.captureVerificationSetup)(execution.verificationSetup, execution.branches.main)));
95781
96623
  return issueComment.invoke(execution);
95782
96624
  },
95783
96625
  issue: async (execution) => {
@@ -95785,7 +96627,7 @@ function createMainRunRouteCompositionRoot(projectBoardCommandPort, surface, set
95785
96627
  return issue.invoke(execution);
95786
96628
  },
95787
96629
  "pull-request-review-comment": async (execution) => {
95788
- pullRequestReviewComment ?? (pullRequestReviewComment = createPullRequestReviewCommentUseCaseCompositionRoot(bugbotBinding(execution)));
96630
+ pullRequestReviewComment ?? (pullRequestReviewComment = createPullRequestReviewCommentUseCaseCompositionRoot(bugbotBinding(execution), (0, verification_setup_snapshot_1.captureVerificationSetup)(execution.verificationSetup, execution.branches.main)));
95789
96631
  return pullRequestReviewComment.invoke(execution);
95790
96632
  },
95791
96633
  "pull-request": async (execution) => {
@@ -96893,23 +97735,28 @@ var __importStar = (this && this.__importStar) || (function () {
96893
97735
  })();
96894
97736
  Object.defineProperty(exports, "__esModule", ({ value: true }));
96895
97737
  exports.GitCommitAdapter = void 0;
97738
+ const verification_executable_1 = __nccwpck_require__(20878);
97739
+ const native_verification_profiles_1 = __nccwpck_require__(22290);
96896
97740
  const exec = __importStar(__nccwpck_require__(18538));
96897
97741
  const git_authentication_environment_1 = __nccwpck_require__(16535);
96898
97742
  const untrusted_command_environment_1 = __nccwpck_require__(2304);
96899
97743
  const git_hook_isolation_1 = __nccwpck_require__(39764);
96900
97744
  const verification_runtime_preflight_1 = __nccwpck_require__(23100);
97745
+ const verification_setup_ports_1 = __nccwpck_require__(26509);
97746
+ const verification_setup_runner_1 = __nccwpck_require__(11709);
96901
97747
  class GitCommitAdapter {
96902
97748
  constructor(executeCommand = (program, args, options) => options
96903
- ? exec.exec(program, args, {
97749
+ ? exec.exec(options.resolveFromEnvironment && options.env ? (0, verification_executable_1.verificationExecutable)(program, options.env) : program, args, {
96904
97750
  // Captured Git reads can contain NUL-delimited records that
96905
97751
  // hide subsequent lines in GitHub's Actions log viewer.
96906
97752
  ...(options.stdout ? { silent: true } : {}),
96907
97753
  ...(options.stdout ? { listeners: { stdout: options.stdout } } : {}),
96908
97754
  ...(options.env ? { env: options.env } : {}),
96909
97755
  })
96910
- : exec.exec(program, args), checkPrerequisites = verification_runtime_preflight_1.assertVerificationRuntimePrerequisites) {
97756
+ : exec.exec(program, args), checkPrerequisites = verification_runtime_preflight_1.assertVerificationRuntimePrerequisites, verificationSetup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
96911
97757
  this.executeCommand = executeCommand;
96912
97758
  this.checkPrerequisites = checkPrerequisites;
97759
+ this.verificationSetup = verificationSetup;
96913
97760
  }
96914
97761
  async execute(program, args, options) {
96915
97762
  if (options?.verifyRuntimePrerequisites && !options.untrusted)
@@ -96920,15 +97767,19 @@ class GitCommitAdapter {
96920
97767
  throw new Error('Untrusted command execution does not accept a caller-supplied environment.');
96921
97768
  const runtime = (0, untrusted_command_environment_1.prepareUntrustedCommandEnvironment)();
96922
97769
  try {
96923
- if (options.verifyRuntimePrerequisites)
97770
+ if (options.verifyRuntimePrerequisites) {
97771
+ await (0, verification_setup_runner_1.prepareRepositoryVerification)(this.verificationSetup, runtime.environment);
96924
97772
  this.checkPrerequisites(runtime.environment);
97773
+ }
96925
97774
  return await this.executeCommand(program, args, {
96926
97775
  ...(options.stdout ? { stdout: options.stdout } : {}),
96927
97776
  env: runtime.environment,
97777
+ ...(options.verifyRuntimePrerequisites && this.verificationSetup.kind === 'ready' ? { resolveFromEnvironment: true } : {}),
96928
97778
  });
96929
97779
  }
96930
97780
  finally {
96931
- runtime.cleanup();
97781
+ if (!(0, native_verification_profiles_1.nativeVerificationRetainsProfile)(runtime.environment.HOME))
97782
+ runtime.cleanup();
96932
97783
  }
96933
97784
  }
96934
97785
  async configureAuthor(name, email) {
@@ -97916,6 +98767,233 @@ class LoggerWorkflowPollingObserverAdapter {
97916
98767
  exports.LoggerWorkflowPollingObserverAdapter = LoggerWorkflowPollingObserverAdapter;
97917
98768
 
97918
98769
 
98770
+ /***/ }),
98771
+
98772
+ /***/ 18883:
98773
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
98774
+
98775
+ "use strict";
98776
+
98777
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98778
+ exports.verificationCandidateIdentity = verificationCandidateIdentity;
98779
+ const node_child_process_1 = __nccwpck_require__(17718);
98780
+ const node_crypto_1 = __nccwpck_require__(6005);
98781
+ const node_fs_1 = __nccwpck_require__(87561);
98782
+ const node_path_1 = __nccwpck_require__(49411);
98783
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
98784
+ /** Bind setup to the exact HEAD, branch, index, tracked edits and publishable untracked files. */
98785
+ function verificationCandidateIdentity(workspace, environment) {
98786
+ const hash = (0, node_crypto_1.createHash)('sha256');
98787
+ const git = (...args) => {
98788
+ const result = (0, node_child_process_1.spawnSync)('git', ['--no-replace-objects', ...args], { cwd: workspace, env: environment, shell: false,
98789
+ windowsHide: true, timeout: 10000, maxBuffer: 16 * 1024 * 1024 });
98790
+ if (result.error || result.status !== 0)
98791
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
98792
+ hash.update(result.stdout).update('\0');
98793
+ return result.stdout;
98794
+ };
98795
+ git('rev-parse', '--verify', 'HEAD');
98796
+ git('rev-parse', '--symbolic-full-name', 'HEAD');
98797
+ git('ls-files', '--stage', '-z');
98798
+ git('diff', '--no-ext-diff', '--no-textconv', '--binary', 'HEAD', '--');
98799
+ const paths = git('ls-files', '--others', '--exclude-standard', '-z').toString('utf8').split('\0').filter(Boolean);
98800
+ let total = 0;
98801
+ if (paths.length > 256)
98802
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
98803
+ for (const path of paths) {
98804
+ const file = (0, node_path_1.join)(workspace, path);
98805
+ const stat = (0, node_fs_1.lstatSync)(file);
98806
+ total += stat.size;
98807
+ if (total > 16 * 1024 * 1024)
98808
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
98809
+ hash.update(path).update('\0');
98810
+ if (stat.isSymbolicLink())
98811
+ hash.update('120000\0').update((0, node_fs_1.readlinkSync)(file));
98812
+ else if (stat.isFile())
98813
+ hash.update(stat.mode & 0o100 ? '100755\0' : '100644\0').update((0, node_fs_1.readFileSync)(file));
98814
+ else
98815
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
98816
+ hash.update('\0');
98817
+ }
98818
+ return hash.digest('hex');
98819
+ }
98820
+
98821
+
98822
+ /***/ }),
98823
+
98824
+ /***/ 22290:
98825
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
98826
+
98827
+ "use strict";
98828
+
98829
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98830
+ exports.nativeVerificationProfilePaths = nativeVerificationProfilePaths;
98831
+ exports.registerNativeVerificationProfile = registerNativeVerificationProfile;
98832
+ exports.nativeVerificationRetainsProfile = nativeVerificationRetainsProfile;
98833
+ exports.removeNativeVerificationProfiles = removeNativeVerificationProfiles;
98834
+ const node_crypto_1 = __nccwpck_require__(6005);
98835
+ const node_fs_1 = __nccwpck_require__(87561);
98836
+ const node_path_1 = __nccwpck_require__(49411);
98837
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
98838
+ const native_verification_protocol_1 = __nccwpck_require__(88709);
98839
+ function nativeVerificationProfilePaths(root) {
98840
+ const stored = (0, native_verification_protocol_1.readNativeRecord)(root, 'profiles.json', 65536);
98841
+ const paths = stored === undefined ? [] : stored;
98842
+ if (!Array.isArray(paths) || paths.length > 20 || new Set(paths).size !== paths.length || paths.some(path => typeof path !== 'string'
98843
+ || (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))
98844
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98845
+ return paths;
98846
+ }
98847
+ /** Native actions may have post steps. Preserve dependency-only profiles until those steps finish. */
98848
+ function registerNativeVerificationProfile(root, profile) {
98849
+ const previous = nativeVerificationProfilePaths(root);
98850
+ if (previous.length >= 20 || previous.includes(profile) || (0, node_path_1.dirname)(profile) !== (0, node_path_1.dirname)(root)
98851
+ || profile === root || !/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(profile))
98852
+ || (0, node_fs_1.realpathSync)(profile) !== profile || !(0, node_fs_1.lstatSync)(profile).isDirectory() || (0, node_fs_1.lstatSync)(profile).isSymbolicLink())
98853
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98854
+ (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' });
98855
+ (0, native_verification_protocol_1.writeNativeRecord)(root, 'profiles.json', [...previous, profile]);
98856
+ }
98857
+ function nativeVerificationRetainsProfile(profile) {
98858
+ const root = process.env.COPILOT_NATIVE_WORKER_SESSION;
98859
+ return !!root && nativeVerificationProfilePaths(root).includes(profile);
98860
+ }
98861
+ function removeNativeVerificationProfiles(root) {
98862
+ for (const path of nativeVerificationProfilePaths(root)) {
98863
+ let stat;
98864
+ try {
98865
+ stat = (0, node_fs_1.lstatSync)(path);
98866
+ }
98867
+ catch (error) {
98868
+ if (error.code === 'ENOENT')
98869
+ continue;
98870
+ throw error;
98871
+ }
98872
+ 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'))
98873
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98874
+ (0, node_fs_1.rmSync)(path, { recursive: true, force: true });
98875
+ }
98876
+ }
98877
+
98878
+
98879
+ /***/ }),
98880
+
98881
+ /***/ 88709:
98882
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
98883
+
98884
+ "use strict";
98885
+
98886
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98887
+ exports.nativePause = void 0;
98888
+ exports.writeNativeRecord = writeNativeRecord;
98889
+ exports.readNativeRecord = readNativeRecord;
98890
+ exports.nativeSession = nativeSession;
98891
+ const node_fs_1 = __nccwpck_require__(87561);
98892
+ const node_path_1 = __nccwpck_require__(49411);
98893
+ const node_crypto_1 = __nccwpck_require__(6005);
98894
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
98895
+ function writeNativeRecord(root, name, value) {
98896
+ const temporary = (0, node_path_1.join)(root, `${(0, node_crypto_1.randomUUID)()}.tmp`);
98897
+ (0, node_fs_1.writeFileSync)(temporary, JSON.stringify(value), { mode: 0o600, flag: 'wx' });
98898
+ (0, node_fs_1.renameSync)(temporary, (0, node_path_1.join)(root, name));
98899
+ }
98900
+ function readNativeRecord(root, name, limit = 16384) {
98901
+ const file = (0, node_path_1.join)(root, name);
98902
+ let descriptor;
98903
+ try {
98904
+ const before = (0, node_fs_1.lstatSync)(file, { bigint: true });
98905
+ if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n || before.size > BigInt(limit))
98906
+ throw new Error();
98907
+ descriptor = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
98908
+ const after = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
98909
+ if (after.dev !== before.dev || after.ino !== before.ino || after.size !== before.size || after.mtimeNs !== before.mtimeNs)
98910
+ throw new Error();
98911
+ const data = (0, node_fs_1.readFileSync)(descriptor);
98912
+ const final = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
98913
+ if (data.length > limit || final.size !== after.size || final.mtimeNs !== after.mtimeNs)
98914
+ throw new Error();
98915
+ return JSON.parse(data.toString('utf8'));
98916
+ }
98917
+ catch (error) {
98918
+ if (error.code === 'ENOENT')
98919
+ return undefined;
98920
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98921
+ }
98922
+ finally {
98923
+ if (descriptor !== undefined)
98924
+ (0, node_fs_1.closeSync)(descriptor);
98925
+ }
98926
+ }
98927
+ function nativeSession(root, environment = process.env) {
98928
+ if (!/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(root)) || (0, node_fs_1.realpathSync)(root) !== root
98929
+ || !(0, node_fs_1.lstatSync)(root).isDirectory() || (0, node_fs_1.lstatSync)(root).isSymbolicLink())
98930
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98931
+ if (process.platform !== 'win32' && ((0, node_fs_1.lstatSync)(root).mode & 0o077) !== 0)
98932
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98933
+ const session = readNativeRecord(root, 'session.json');
98934
+ if (session?.schemaVersion !== 1 || session.workspace !== (0, node_fs_1.realpathSync)(process.cwd())
98935
+ || session.run !== (environment.GITHUB_RUN_ID ?? '') || session.attempt !== (environment.GITHUB_RUN_ATTEMPT ?? '')
98936
+ || session.job !== (environment.GITHUB_JOB ?? '') || !Number.isSafeInteger(session.pid) || session.pid <= 0)
98937
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98938
+ return session;
98939
+ }
98940
+ const nativePause = (milliseconds) => new Promise(resolve => setTimeout(resolve, milliseconds));
98941
+ exports.nativePause = nativePause;
98942
+
98943
+
98944
+ /***/ }),
98945
+
98946
+ /***/ 63587:
98947
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
98948
+
98949
+ "use strict";
98950
+
98951
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98952
+ exports.NATIVE_VERIFICATION_ACTION = void 0;
98953
+ exports.stageNativeVerificationAction = stageNativeVerificationAction;
98954
+ exports.cleanupNativeVerificationAction = cleanupNativeVerificationAction;
98955
+ const node_fs_1 = __nccwpck_require__(87561);
98956
+ const node_path_1 = __nccwpck_require__(49411);
98957
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
98958
+ const native_verification_protocol_1 = __nccwpck_require__(88709);
98959
+ exports.NATIVE_VERIFICATION_ACTION = '.git/copilot-verification-setup';
98960
+ function targetPath(workspace) {
98961
+ const metadata = (0, node_path_1.join)(workspace, '.git');
98962
+ const stat = (0, node_fs_1.lstatSync)(metadata);
98963
+ if (!stat.isDirectory() || stat.isSymbolicLink() || (0, node_fs_1.realpathSync)(metadata) !== metadata)
98964
+ throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required');
98965
+ return (0, node_path_1.join)(workspace, exports.NATIVE_VERIFICATION_ACTION);
98966
+ }
98967
+ /** Native composite metadata must remain available until its deferred post steps have finished. */
98968
+ function stageNativeVerificationAction(setup, session) {
98969
+ const target = targetPath(setup.workspace);
98970
+ const record = (0, native_verification_protocol_1.readNativeRecord)(session, 'staging.json');
98971
+ if (record && record.target !== target || !record && !!(0, node_fs_1.lstatSync)(target, { throwIfNoEntry: false }))
98972
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98973
+ (0, native_verification_protocol_1.writeNativeRecord)(session, 'staging.json', { target });
98974
+ (0, node_fs_1.rmSync)(target, { recursive: true, force: true });
98975
+ (0, node_fs_1.mkdirSync)(target, { mode: 0o700 });
98976
+ for (const file of setup.files) {
98977
+ const destination = (0, node_path_1.join)(target, file.path);
98978
+ const remainder = (0, node_path_1.relative)(target, destination);
98979
+ if (!remainder || remainder.startsWith(`..${node_path_1.sep}`) || remainder === '..')
98980
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
98981
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(destination), { recursive: true, mode: 0o700 });
98982
+ (0, node_fs_1.writeFileSync)(destination, Buffer.from(file.base64, 'base64'), { mode: file.executable ? 0o700 : 0o600, flag: 'wx' });
98983
+ }
98984
+ }
98985
+ function cleanupNativeVerificationAction(session, workspace) {
98986
+ const record = (0, native_verification_protocol_1.readNativeRecord)(session, 'staging.json');
98987
+ if (!record)
98988
+ return;
98989
+ const target = targetPath(workspace);
98990
+ if (record.target !== target)
98991
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
98992
+ (0, node_fs_1.rmSync)(target, { recursive: true, force: true });
98993
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(session, 'staging.json'), { force: true });
98994
+ }
98995
+
98996
+
97919
98997
  /***/ }),
97920
98998
 
97921
98999
  /***/ 35849:
@@ -97965,6 +99043,7 @@ const node_crypto_1 = __nccwpck_require__(6005);
97965
99043
  const node_child_process_1 = __nccwpck_require__(17718);
97966
99044
  const node_util_1 = __nccwpck_require__(47261);
97967
99045
  const pre_branch_sdd_1 = __nccwpck_require__(34730);
99046
+ const sdd_draft_consistency_1 = __nccwpck_require__(27910);
97968
99047
  const git_authentication_environment_1 = __nccwpck_require__(16535);
97969
99048
  const git_hook_isolation_1 = __nccwpck_require__(39764);
97970
99049
  const runFile = (0, node_util_1.promisify)(node_child_process_1.execFile);
@@ -98038,6 +99117,17 @@ class PreBranchSddWorkspaceAdapter {
98038
99117
  if (fs.existsSync(target) !== (plan.action === 'update')) {
98039
99118
  throw new Error('The SDD owner changed since analysis; restart clarification.');
98040
99119
  }
99120
+ const owners = [];
99121
+ const inventory = await this.inventoryAt(snapshot.baseSha);
99122
+ for (const file of snapshot.capabilities.find(capability => capability.id === plan.capabilityId)?.specs ?? []) {
99123
+ if (!(0, pre_branch_sdd_1.isSafeSddPath)(file))
99124
+ throw new Error('An owning SDD path is unsafe.');
99125
+ if (!inventory.files.has(file))
99126
+ throw new Error('An owning SDD is not a regular file at the immutable base.');
99127
+ assertRegularSpecFile(path.join(root, file));
99128
+ owners.push({ path: file, markdown: await this.git(['show', `${snapshot.baseSha}:${file}`]) });
99129
+ }
99130
+ (0, sdd_draft_consistency_1.validateSddDraftConsistency)(markdown, owners, inventory, plan.path);
98041
99131
  if (plan.action === 'update') {
98042
99132
  assertRegularSpecFile(target);
98043
99133
  const owner = await this.git(['show', `${snapshot.baseSha}:${plan.path}`]);
@@ -98176,7 +99266,13 @@ class PreBranchSddWorkspaceAdapter {
98176
99266
  const raw = await this.git(['show', `${first}:specs/catalog.json`]);
98177
99267
  newCapability = JSON.parse(raw).capabilities.find(capability => capability.id === prepared.plan.capabilityId);
98178
99268
  }
98179
- const recovered = await this.validateDraft(snapshot, prepared.plan, content, newCapability);
99269
+ const candidate = prepared.plan.action === 'update'
99270
+ ? (0, pre_branch_sdd_1.recoverSddUpdate)(await this.git(['show', `${prepared.baseSha}:${prepared.plan.path}`]), content) : content;
99271
+ if (!candidate)
99272
+ return undefined;
99273
+ const recovered = await this.validateDraft(snapshot, prepared.plan, candidate, newCapability);
99274
+ if (recovered.markdown !== content)
99275
+ return undefined;
98180
99276
  const committedPaths = (await this.git(['diff-tree', '--no-commit-id', '--name-only', '-r', first])).trim().split('\n').filter(Boolean).sort();
98181
99277
  if (committedPaths.join('\n') !== recovered.changedPaths.join('\n'))
98182
99278
  return undefined;
@@ -98211,6 +99307,25 @@ class PreBranchSddWorkspaceAdapter {
98211
99307
  const output = await this.git(['status', '--porcelain', '--untracked-files=all'], root);
98212
99308
  return output.split('\n').filter(Boolean).map(line => line.slice(3)).sort();
98213
99309
  }
99310
+ async inventoryAt(sha) {
99311
+ const files = new Set();
99312
+ const directories = new Set();
99313
+ const blocked = new Set();
99314
+ const tree = await this.git(['ls-tree', '-rz', '--full-tree', sha]);
99315
+ for (const entry of tree.split('\0').filter(Boolean)) {
99316
+ const tab = entry.indexOf('\t');
99317
+ const file = entry.slice(tab + 1);
99318
+ const mode = entry.slice(0, 6);
99319
+ if (mode === '100644' || mode === '100755')
99320
+ files.add(file);
99321
+ else
99322
+ blocked.add(file);
99323
+ const parts = file.split('/');
99324
+ for (let index = 1; index < parts.length; index++)
99325
+ directories.add(parts.slice(0, index).join('/'));
99326
+ }
99327
+ return { files, directories, blocked };
99328
+ }
98214
99329
  async addDetachedWorktree(sha) {
98215
99330
  const root = fs.mkdtempSync(path.join(os.tmpdir(), 'copilot-sdd-'));
98216
99331
  try {
@@ -98722,6 +99837,7 @@ const setup_organization_variable_bindings_1 = __nccwpck_require__(19698);
98722
99837
  const setup_credential_health_1 = __nccwpck_require__(68136);
98723
99838
  const setup_batch_retry_policy_1 = __nccwpck_require__(70775);
98724
99839
  const setup_runner_1 = __nccwpck_require__(94301);
99840
+ const setup_verification_action_1 = __nccwpck_require__(33156);
98725
99841
  const managedVariables = new Set([...setup_organization_variable_bindings_1.SETUP_ORGANIZATION_VARIABLE_BINDINGS.flatMap(binding => [binding.variable, binding.fallbackVariable]),
98726
99842
  'PR_APPROVAL_POLICY', 'COPILOT_ISSUE_WORKFLOW_PROFILE', 'AGENT_ALLOWED_PROVIDERS', 'AGENT_ALLOWED_MODEL_PROVIDERS', setup_runner_1.SETUP_RUNNER_REGISTRY]);
98727
99843
  class SetupBatchProviderError extends Error {
@@ -98883,6 +99999,17 @@ class SetupBatchGithubReadAdapter {
98883
99999
  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' }));
98884
100000
  if (!response || response.truncated !== false || !Array.isArray(response.tree) || response.tree.length > 100000)
98885
100001
  throw new SetupBatchProviderError('malformed');
100002
+ for (const raw of response.tree) {
100003
+ const item = batchObject(raw);
100004
+ if (typeof item?.path !== 'string')
100005
+ continue;
100006
+ const candidatePath = item.path;
100007
+ const fixed = [...setup_verification_action_1.SETUP_VERIFICATION_ACTION_PARENTS, setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH].find(path => path.toLowerCase() === candidatePath.toLowerCase());
100008
+ if (fixed && (item.path !== fixed || (fixed === setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH
100009
+ ? item.type !== 'blob' || !['100644', '100755'].includes(String(item.mode))
100010
+ : item.type !== 'tree' || item.mode !== '040000')))
100011
+ throw new SetupBatchProviderError('malformed');
100012
+ }
98886
100013
  const entries = response.tree.map(batchObject).filter(entry => entry?.type !== 'tree' && typeof entry?.path === 'string' && (0, setup_batch_policy_1.validSetupBatchAssetPath)(entry.path));
98887
100014
  if (entries.length > 300)
98888
100015
  throw new SetupBatchProviderError('malformed');
@@ -99354,10 +100481,13 @@ exports.SetupGithubIdentityQueryAdapter = SetupGithubIdentityQueryAdapter;
99354
100481
  /***/ }),
99355
100482
 
99356
100483
  /***/ 75545:
99357
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
100484
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
99358
100485
 
99359
100486
  "use strict";
99360
100487
 
100488
+ var __importDefault = (this && this.__importDefault) || function (mod) {
100489
+ return (mod && mod.__esModule) ? mod : { "default": mod };
100490
+ };
99361
100491
  Object.defineProperty(exports, "__esModule", ({ value: true }));
99362
100492
  exports.SetupManagementWorkspaceAdapter = void 0;
99363
100493
  const node_fs_1 = __nccwpck_require__(87561);
@@ -99365,6 +100495,8 @@ const node_path_1 = __nccwpck_require__(49411);
99365
100495
  const node_crypto_1 = __nccwpck_require__(6005);
99366
100496
  const js_yaml_1 = __nccwpck_require__(783);
99367
100497
  const sensitive_text_1 = __nccwpck_require__(47122);
100498
+ const copilot_comment_workflow_1 = __nccwpck_require__(33430);
100499
+ const copilot_comment_inputs_json_1 = __importDefault(__nccwpck_require__(78593));
99368
100500
  const object = (value) => value && typeof value === 'object' && !Array.isArray(value) ? value : {};
99369
100501
  const digest = (source) => (0, node_crypto_1.createHash)('sha256').update(source).digest('hex');
99370
100502
  function readDocument(path) {
@@ -99455,13 +100587,34 @@ class SetupManagementWorkspaceAdapter {
99455
100587
  inspectWorkflow(file, localAction) {
99456
100588
  const { source, document } = readDocument((0, node_path_1.join)(this.root, '.github', 'workflows', file));
99457
100589
  const steps = workflowSteps(document);
99458
- const knownLocalAction = steps.some(({ step }) => step.uses === './') ? Boolean(localAction()) : false;
99459
- return steps.flatMap(({ job, step }) => {
99460
- if (!this.isCopilotStep(step, knownLocalAction))
99461
- return [];
99462
- const inputs = Object.entries(object(step.with)).flatMap(([name, value]) => installedInput(name, value));
99463
- return [{ file, action: step.uses, digest: digest(source), environmentScoped: environmentScoped(document, job, step), inputs }];
100590
+ const jobs = Object.values(object(document.jobs)).map(object);
100591
+ if (jobs.some(job => typeof job.uses === 'string'
100592
+ && /^(?:vypdev\/copilot\/|[.$]\/)\.github\/workflows\/copilot_comment_runtime\.yml(?:@|$)/iu.test(job.uses)
100593
+ && !(0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(job.uses)))
100594
+ throw new Error('Unsupported comment workflow reference.');
100595
+ const calls = jobs.filter(job => (0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(job.uses));
100596
+ if (calls.some(job => job.uses === copilot_comment_workflow_1.COPILOT_COMMENT_SELF_WORKFLOW) && !localAction())
100597
+ throw new Error('Unverified source comment workflow.');
100598
+ const reusable = calls.map(job => {
100599
+ const overrides = object(job.with);
100600
+ if (Object.keys(overrides).some(key => !['runs-on', 'issue-managed-branches', 'pre-branch-sdd', 'ai-ignore-files', 'prepare-source-verification'].includes(key)))
100601
+ throw new Error('Unknown comment workflow input.');
100602
+ const bindings = { ...copilot_comment_inputs_json_1.default };
100603
+ for (const name of ['issue-managed-branches', 'pre-branch-sdd', 'ai-ignore-files']) {
100604
+ if (overrides[name] !== undefined && overrides[name] !== '')
100605
+ bindings[name] = overrides[name];
100606
+ }
100607
+ return { file, action: job.uses === copilot_comment_workflow_1.COPILOT_COMMENT_SELF_WORKFLOW ? './' : `vypdev/copilot@${String(job.uses).split('@').at(-1)}`,
100608
+ digest: digest(source), environmentScoped: environmentScoped(document, job, {}),
100609
+ inputs: Object.entries(bindings).flatMap(([name, value]) => installedInput(name, value)) };
99464
100610
  });
100611
+ const knownLocalAction = steps.some(({ step }) => step.uses === './') ? Boolean(localAction()) : false;
100612
+ return [...reusable, ...steps.flatMap(({ job, step }) => {
100613
+ if (!this.isCopilotStep(step, knownLocalAction))
100614
+ return [];
100615
+ const inputs = Object.entries(object(step.with)).flatMap(([name, value]) => installedInput(name, value));
100616
+ return [{ file, action: step.uses, digest: digest(source), environmentScoped: environmentScoped(document, job, step), inputs }];
100617
+ })];
99465
100618
  }
99466
100619
  isCopilotStep(step, knownLocalAction) {
99467
100620
  if (typeof step.uses !== 'string')
@@ -102191,6 +103344,190 @@ function boundedClient(client, deadline) {
102191
103344
  }
102192
103345
 
102193
103346
 
103347
+ /***/ }),
103348
+
103349
+ /***/ 12471:
103350
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
103351
+
103352
+ "use strict";
103353
+
103354
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
103355
+ if (k2 === undefined) k2 = k;
103356
+ var desc = Object.getOwnPropertyDescriptor(m, k);
103357
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
103358
+ desc = { enumerable: true, get: function() { return m[k]; } };
103359
+ }
103360
+ Object.defineProperty(o, k2, desc);
103361
+ }) : (function(o, m, k, k2) {
103362
+ if (k2 === undefined) k2 = k;
103363
+ o[k2] = m[k];
103364
+ }));
103365
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
103366
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
103367
+ }) : function(o, v) {
103368
+ o["default"] = v;
103369
+ });
103370
+ var __importStar = (this && this.__importStar) || (function () {
103371
+ var ownKeys = function(o) {
103372
+ ownKeys = Object.getOwnPropertyNames || function (o) {
103373
+ var ar = [];
103374
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
103375
+ return ar;
103376
+ };
103377
+ return ownKeys(o);
103378
+ };
103379
+ return function (mod) {
103380
+ if (mod && mod.__esModule) return mod;
103381
+ var result = {};
103382
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
103383
+ __setModuleDefault(result, mod);
103384
+ return result;
103385
+ };
103386
+ })();
103387
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
103388
+ exports.inspectSetupVerificationActionPath = inspectSetupVerificationActionPath;
103389
+ exports.readSetupVerificationActionStarter = readSetupVerificationActionStarter;
103390
+ exports.createSetupVerificationAction = createSetupVerificationAction;
103391
+ const fs = __importStar(__nccwpck_require__(87561));
103392
+ const node_path_1 = __nccwpck_require__(49411);
103393
+ const setup_verification_action_1 = __nccwpck_require__(33156);
103394
+ 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.`);
103395
+ 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.`);
103396
+ const sameDirectory = (left, right) => left.ino > 0n
103397
+ && left.dev === right.dev && left.ino === right.ino;
103398
+ const directoryFlags = fs.constants.O_RDONLY | (fs.constants.O_DIRECTORY ?? 0)
103399
+ | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0);
103400
+ function entry(path) {
103401
+ try {
103402
+ return fs.lstatSync(path, { bigint: true });
103403
+ }
103404
+ catch (error) {
103405
+ if (error.code === 'ENOENT')
103406
+ return undefined;
103407
+ throw error;
103408
+ }
103409
+ }
103410
+ /** Inspect metadata only: consumer action contents and auxiliary files are never read. */
103411
+ function inspectSetupVerificationActionPath(root) {
103412
+ for (const parent of setup_verification_action_1.SETUP_VERIFICATION_ACTION_PARENTS) {
103413
+ const info = entry((0, node_path_1.join)(root, parent));
103414
+ if (!info)
103415
+ return 'create';
103416
+ if (!info.isDirectory() || info.isSymbolicLink())
103417
+ throw unsafe();
103418
+ }
103419
+ const info = entry((0, node_path_1.join)(root, setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH));
103420
+ if (!info)
103421
+ return 'create';
103422
+ if (!info.isFile() || info.isSymbolicLink())
103423
+ throw unsafe();
103424
+ return 'preserve';
103425
+ }
103426
+ /** Resolve the package-controlled starter, independently of workflow test overrides. */
103427
+ function readSetupVerificationActionStarter() {
103428
+ return fs.readFileSync((0, node_path_1.join)(__dirname, '..', '..', 'setup/actions/copilot-verification-setup/action.yml'), 'utf8');
103429
+ }
103430
+ /** Exclusive creation cannot truncate a file that wins the Apply race. */
103431
+ function createSetupVerificationAction(root, expected) {
103432
+ const state = inspectSetupVerificationActionPath(root);
103433
+ if (expected && expected !== state)
103434
+ throw stale();
103435
+ if (state === 'preserve')
103436
+ return { copied: 0, skipped: 1 };
103437
+ const content = readSetupVerificationActionStarter();
103438
+ const absoluteRoot = fs.realpathSync(root);
103439
+ const previousDirectory = fs.realpathSync('.');
103440
+ // Node has no portable openat. Pin each validated directory as the OS cwd,
103441
+ // then use only single-component relative operations. On POSIX this retains
103442
+ // the directory even if renamed; Windows locks the current directory.
103443
+ // This critical section is synchronous: never await or invoke user callbacks
103444
+ // here. The installer owns this main-thread section and always restores cwd.
103445
+ try {
103446
+ enterPinnedDirectory(absoluteRoot);
103447
+ for (const segment of ['.github', 'actions', 'copilot-verification-setup']) {
103448
+ try {
103449
+ fs.mkdirSync(segment);
103450
+ }
103451
+ catch (error) {
103452
+ if (error.code !== 'EEXIST')
103453
+ throw error;
103454
+ }
103455
+ enterPinnedDirectory(segment);
103456
+ }
103457
+ // Detect a relocated route before creation as well as after writing. A
103458
+ // replacement after this check cannot redirect the cwd-relative open.
103459
+ inspectSetupVerificationActionPath(absoluteRoot);
103460
+ writeStarterInPinnedDirectory(absoluteRoot, content);
103461
+ }
103462
+ finally {
103463
+ process.chdir(previousDirectory);
103464
+ }
103465
+ return { copied: 1, skipped: 0 };
103466
+ }
103467
+ function enterPinnedDirectory(path) {
103468
+ let descriptor;
103469
+ try {
103470
+ descriptor = fs.openSync(path, directoryFlags);
103471
+ }
103472
+ catch (error) {
103473
+ if (['ELOOP', 'ENOTDIR'].includes(error.code))
103474
+ throw unsafe();
103475
+ throw error;
103476
+ }
103477
+ try {
103478
+ // Keep the directory handle open until cwd is pinned, preventing inode reuse.
103479
+ const bound = fs.fstatSync(descriptor, { bigint: true });
103480
+ const observed = fs.lstatSync(path, { bigint: true });
103481
+ if (!bound.isDirectory() || !observed.isDirectory() || observed.isSymbolicLink())
103482
+ throw unsafe();
103483
+ if (!sameDirectory(bound, observed))
103484
+ throw stale();
103485
+ process.chdir(path);
103486
+ if (!sameDirectory(bound, fs.lstatSync('.', { bigint: true })))
103487
+ throw stale();
103488
+ }
103489
+ finally {
103490
+ fs.closeSync(descriptor);
103491
+ }
103492
+ }
103493
+ function writeStarterInPinnedDirectory(root, content) {
103494
+ const destination = 'action.yml';
103495
+ let descriptor;
103496
+ try {
103497
+ descriptor = fs.openSync(destination, 'wx', 0o644);
103498
+ }
103499
+ catch (error) {
103500
+ if (error.code === 'EEXIST')
103501
+ throw stale();
103502
+ throw error;
103503
+ }
103504
+ let created;
103505
+ try {
103506
+ try {
103507
+ created = fs.fstatSync(descriptor, { bigint: true });
103508
+ fs.writeFileSync(descriptor, content, 'utf8');
103509
+ if (inspectSetupVerificationActionPath(root) !== 'preserve')
103510
+ throw stale();
103511
+ 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 })))
103512
+ throw stale();
103513
+ }
103514
+ finally {
103515
+ fs.closeSync(descriptor);
103516
+ }
103517
+ }
103518
+ catch (error) {
103519
+ // Remove only our incomplete file, never a concurrent replacement.
103520
+ try {
103521
+ const current = entry(destination);
103522
+ if (created && current?.dev === created.dev && current.ino === created.ino)
103523
+ fs.unlinkSync(destination);
103524
+ }
103525
+ catch { /* Preserve the original failure; an incomplete asset needs inspection. */ }
103526
+ throw error;
103527
+ }
103528
+ }
103529
+
103530
+
102194
103531
  /***/ }),
102195
103532
 
102196
103533
  /***/ 5729:
@@ -102220,6 +103557,7 @@ class SetupWorkspaceMutationAdapter {
102220
103557
  updateExistingWorkflows: selection?.updateExistingWorkflows,
102221
103558
  approvedWorkflowFiles: selection?.approvedWorkflowFiles,
102222
103559
  setupConfiguration: selection?.setupConfiguration,
103560
+ verificationActionState: selection.verificationActionState,
102223
103561
  });
102224
103562
  }
102225
103563
  hasValidToken(tokenOverride) {
@@ -102434,7 +103772,7 @@ const ALLOWED_VARIABLES = [
102434
103772
  * credentials or paths to local agent authentication stores.
102435
103773
  */
102436
103774
  function prepareUntrustedCommandEnvironment(source = process.env, platform = process.platform) {
102437
- const runtimeHome = (0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)();
103775
+ const runtimeHome = (0, node_fs_1.realpathSync)((0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)());
102438
103776
  const environment = { HOME: runtimeHome };
102439
103777
  for (const variable of ALLOWED_VARIABLES) {
102440
103778
  const value = source[variable];
@@ -102462,6 +103800,39 @@ function prepareUntrustedCommandEnvironment(source = process.env, platform = pro
102462
103800
  }
102463
103801
 
102464
103802
 
103803
+ /***/ }),
103804
+
103805
+ /***/ 20878:
103806
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
103807
+
103808
+ "use strict";
103809
+
103810
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
103811
+ exports.verificationExecutable = verificationExecutable;
103812
+ const node_fs_1 = __nccwpck_require__(87561);
103813
+ const node_path_1 = __nccwpck_require__(49411);
103814
+ /** @actions/exec resolves basenames against its own process PATH; native tools belong to the verifier PATH. */
103815
+ function verificationExecutable(program, environment, platform = process.platform) {
103816
+ const explicit = (0, node_path_1.isAbsolute)(program) || /[\\/]/u.test(program);
103817
+ 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)));
103818
+ const windowsExtensions = (environment.PATHEXT || '.COM;.EXE;.BAT;.CMD').split(';').filter(Boolean);
103819
+ const hasWindowsExtension = windowsExtensions.some(extension => program.toLowerCase().endsWith(extension.toLowerCase()));
103820
+ const extensions = platform === 'win32' && !hasWindowsExtension ? windowsExtensions : [''];
103821
+ for (const candidate of candidates)
103822
+ for (const extension of extensions) {
103823
+ const file = candidate + extension;
103824
+ try {
103825
+ if ((0, node_fs_1.statSync)(file).isFile()) {
103826
+ (0, node_fs_1.accessSync)(file, node_fs_1.constants.X_OK);
103827
+ return file;
103828
+ }
103829
+ }
103830
+ catch { /* Try only the next executable in the isolated PATH. */ }
103831
+ }
103832
+ throw new Error('Verification executable is unavailable in the isolated PATH.');
103833
+ }
103834
+
103835
+
102465
103836
  /***/ }),
102466
103837
 
102467
103838
  /***/ 91053:
@@ -102588,6 +103959,267 @@ function checkRuntime(requirement, environment, run, platform, job) {
102588
103959
  }
102589
103960
 
102590
103961
 
103962
+ /***/ }),
103963
+
103964
+ /***/ 23358:
103965
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
103966
+
103967
+ "use strict";
103968
+
103969
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
103970
+ exports.applyVerificationSetupResult = applyVerificationSetupResult;
103971
+ const node_fs_1 = __nccwpck_require__(87561);
103972
+ const node_path_1 = __nccwpck_require__(49411);
103973
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
103974
+ function contained(root, path) {
103975
+ const remainder = (0, node_path_1.relative)(root, path);
103976
+ return remainder === '' || (remainder !== '..' && !remainder.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(remainder));
103977
+ }
103978
+ /** Accept only existing contained directories, checking both lexical paths and symlink targets. */
103979
+ function approvedDirectory(value, roots) {
103980
+ if (!(0, node_path_1.isAbsolute)(value) || value.includes(node_path_1.delimiter) || value.split(/[\\/]/u).includes('..')
103981
+ || !roots.some(root => contained(root, value)))
103982
+ throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
103983
+ const actual = (0, node_fs_1.realpathSync)(value);
103984
+ if (!roots.some(root => contained(root, actual)) || !(0, node_fs_1.lstatSync)(actual).isDirectory())
103985
+ throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
103986
+ return actual;
103987
+ }
103988
+ function applyVerificationSetupResult(file, environment, roots) {
103989
+ let descriptor;
103990
+ try {
103991
+ let before;
103992
+ try {
103993
+ before = (0, node_fs_1.lstatSync)(file, { bigint: true });
103994
+ }
103995
+ catch (error) {
103996
+ if (error.code === 'ENOENT')
103997
+ return;
103998
+ throw error;
103999
+ }
104000
+ if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n || before.size > BigInt(verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes))
104001
+ throw new Error();
104002
+ descriptor = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
104003
+ const opened = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
104004
+ if (!opened.isFile() || opened.nlink !== 1n || opened.dev !== before.dev || opened.ino !== before.ino
104005
+ || opened.size !== before.size || opened.mtimeNs !== before.mtimeNs)
104006
+ throw new Error();
104007
+ const bytes = Buffer.alloc(verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes + 1);
104008
+ const size = (0, node_fs_1.readSync)(descriptor, bytes, 0, bytes.length, 0);
104009
+ if (size > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes)
104010
+ throw new Error();
104011
+ const after = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
104012
+ if (after.size !== opened.size || after.mtimeNs !== opened.mtimeNs)
104013
+ throw new Error();
104014
+ const result = (0, verification_setup_policy_1.parseVerificationSetupResult)(JSON.parse(bytes.subarray(0, size).toString('utf8')));
104015
+ const paths = result.path.map(value => approvedDirectory(value, roots));
104016
+ const javaHome = result.javaHome ? approvedDirectory(result.javaHome, roots) : undefined;
104017
+ if (paths.length)
104018
+ environment.PATH = [...paths, ...(environment.PATH ? [environment.PATH] : [])].join(node_path_1.delimiter);
104019
+ if (javaHome)
104020
+ environment.JAVA_HOME = javaHome;
104021
+ }
104022
+ catch {
104023
+ throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
104024
+ }
104025
+ finally {
104026
+ if (descriptor !== undefined)
104027
+ (0, node_fs_1.closeSync)(descriptor);
104028
+ }
104029
+ }
104030
+
104031
+
104032
+ /***/ }),
104033
+
104034
+ /***/ 11709:
104035
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
104036
+
104037
+ "use strict";
104038
+
104039
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
104040
+ exports.prepareRepositoryVerification = prepareRepositoryVerification;
104041
+ const verification_setup_snapshot_1 = __nccwpck_require__(62148);
104042
+ const native_verification_profiles_1 = __nccwpck_require__(22290);
104043
+ const node_fs_1 = __nccwpck_require__(87561);
104044
+ const node_path_1 = __nccwpck_require__(49411);
104045
+ const node_crypto_1 = __nccwpck_require__(6005);
104046
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
104047
+ const verification_setup_result_1 = __nccwpck_require__(23358);
104048
+ const logging_ports_1 = __nccwpck_require__(6152);
104049
+ const native_verification_protocol_1 = __nccwpck_require__(88709);
104050
+ const native_verification_staging_1 = __nccwpck_require__(63587);
104051
+ const native_verification_candidate_1 = __nccwpck_require__(18883);
104052
+ /** The runner executes YAML. This adapter pauses the admitted call stack at its verification boundary. */
104053
+ async function prepareRepositoryVerification(setup, environment) {
104054
+ if (setup.kind === 'disabled')
104055
+ return;
104056
+ if (setup.kind === 'blocked')
104057
+ throw new verification_setup_policy_1.VerificationSetupError(setup.reason, setup.sourceSha);
104058
+ const session = process.env.COPILOT_NATIVE_WORKER_SESSION;
104059
+ if (!session)
104060
+ throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required', setup.sourceSha);
104061
+ let requestCreated = false;
104062
+ try {
104063
+ (0, native_verification_protocol_1.nativeSession)(session);
104064
+ const requests = (0, native_verification_protocol_1.readNativeRecord)(session, 'request-count.json')?.count ?? 0;
104065
+ if (requests >= verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.requests)
104066
+ throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
104067
+ (0, native_verification_protocol_1.writeNativeRecord)(session, 'request-count.json', { count: requests + 1 });
104068
+ if ((0, node_fs_1.realpathSync)(process.cwd()) !== setup.workspace)
104069
+ throw new verification_setup_policy_1.VerificationSetupError('workspace-changed');
104070
+ (0, native_verification_profiles_1.registerNativeVerificationProfile)(session, environment.HOME);
104071
+ const identity = (0, native_verification_candidate_1.verificationCandidateIdentity)(setup.workspace, environment);
104072
+ (0, native_verification_staging_1.stageNativeVerificationAction)(setup, session);
104073
+ const id = (0, node_crypto_1.randomUUID)();
104074
+ (0, native_verification_protocol_1.writeNativeRecord)(session, 'request.json', { id, sourceSha: setup.sourceSha, digest: (0, verification_setup_snapshot_1.verificationSetupDigest)(setup), environment });
104075
+ requestCreated = true;
104076
+ (0, logging_ports_1.logInfo)(`Preparing repository verification (${verification_setup_policy_1.VERIFICATION_SETUP_PATH}; trusted source SHA: ${setup.sourceSha}).`);
104077
+ const deadline = Date.now() + verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.timeoutMs;
104078
+ let response;
104079
+ while (!(response = (0, native_verification_protocol_1.readNativeRecord)(session, `response-${id}.json`))) {
104080
+ if ((0, native_verification_protocol_1.readNativeRecord)(session, 'cancel.json'))
104081
+ throw new verification_setup_policy_1.VerificationSetupError('cancelled');
104082
+ if (Date.now() >= deadline)
104083
+ throw new verification_setup_policy_1.VerificationSetupError('timeout');
104084
+ await (0, native_verification_protocol_1.nativePause)(100);
104085
+ }
104086
+ if (response.id !== id || response.success !== true)
104087
+ throw new verification_setup_policy_1.VerificationSetupError('process-failed');
104088
+ if ((0, native_verification_candidate_1.verificationCandidateIdentity)(setup.workspace, environment) !== identity)
104089
+ throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
104090
+ if (typeof response.path !== 'string' || response.path.length > 16384 || response.javaHome !== undefined && typeof response.javaHome !== 'string')
104091
+ throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
104092
+ const original = new Set((environment.PATH ?? '').split(node_path_1.delimiter));
104093
+ const previousProfiles = (0, native_verification_profiles_1.nativeVerificationProfilePaths)(session).filter(profile => profile !== environment.HOME);
104094
+ const fromPreviousProfile = (path) => previousProfiles.some(profile => {
104095
+ const part = (0, node_path_1.relative)(profile, path);
104096
+ return part === '' || part !== '..' && !part.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(part);
104097
+ });
104098
+ const additions = [...new Set(response.path.split(node_path_1.delimiter).filter(path => path && !original.has(path) && !fromPreviousProfile(path)))];
104099
+ const result = (0, node_path_1.join)(environment.HOME, 'native-setup-result.json');
104100
+ (0, node_fs_1.writeFileSync)(result, JSON.stringify({ schemaVersion: 1, path: additions,
104101
+ environment: response.javaHome && response.javaHome !== environment.JAVA_HOME ? { JAVA_HOME: response.javaHome } : {} }), { mode: 0o600, flag: 'wx' });
104102
+ (0, verification_setup_result_1.applyVerificationSetupResult)(result, environment, [setup.workspace, environment.HOME, ...(setup.toolRoot ? [setup.toolRoot] : [])]);
104103
+ (0, logging_ports_1.logInfo)('Repository setup completed; runtime preflight and verification may proceed.');
104104
+ }
104105
+ catch (error) {
104106
+ throw new verification_setup_policy_1.VerificationSetupError(error instanceof verification_setup_policy_1.VerificationSetupError ? error.reason : 'handoff-invalid', setup.sourceSha);
104107
+ }
104108
+ finally {
104109
+ if (requestCreated)
104110
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(session, 'request.json'), { force: true });
104111
+ }
104112
+ }
104113
+
104114
+
104115
+ /***/ }),
104116
+
104117
+ /***/ 62148:
104118
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
104119
+
104120
+ "use strict";
104121
+
104122
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
104123
+ exports.verificationSetupDigest = verificationSetupDigest;
104124
+ exports.captureVerificationSetup = captureVerificationSetup;
104125
+ exports.captureVerificationSetupAtCommit = captureVerificationSetupAtCommit;
104126
+ const node_path_1 = __nccwpck_require__(49411);
104127
+ const node_child_process_1 = __nccwpck_require__(17718);
104128
+ const node_crypto_1 = __nccwpck_require__(6005);
104129
+ const node_fs_1 = __nccwpck_require__(87561);
104130
+ const js_yaml_1 = __nccwpck_require__(783);
104131
+ const verification_setup_ports_1 = __nccwpck_require__(26509);
104132
+ const verification_setup_policy_1 = __nccwpck_require__(65326);
104133
+ const untrusted_command_environment_1 = __nccwpck_require__(2304);
104134
+ /** Only immutable Git objects are read. Errors remain deferred on non-verifying routes. */
104135
+ function verificationSetupDigest(setup) {
104136
+ return (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(setup.files)).digest('hex');
104137
+ }
104138
+ function captureVerificationSetup(enabled, mainBranch, root = process.cwd()) {
104139
+ return capture(enabled, mainBranch, root);
104140
+ }
104141
+ /** Post steps use the already pinned commit from runner state, never a mutable branch ref. */
104142
+ function captureVerificationSetupAtCommit(commit, root = process.cwd(), gitExecutable) {
104143
+ return capture(true, '', root, commit, gitExecutable);
104144
+ }
104145
+ function capture(enabled, mainBranch, root, pinned, gitExecutable) {
104146
+ if (!enabled)
104147
+ return verification_setup_ports_1.DISABLED_VERIFICATION_SETUP;
104148
+ let sourceSha;
104149
+ let runtime;
104150
+ let snapshot;
104151
+ try {
104152
+ runtime = (0, untrusted_command_environment_1.prepareUntrustedCommandEnvironment)();
104153
+ const environment = runtime.environment;
104154
+ if (!pinned && (!/^[A-Za-z0-9][A-Za-z0-9._/-]{0,200}$/u.test(mainBranch) || mainBranch.includes('..')
104155
+ || mainBranch.includes('//') || mainBranch.endsWith('/') || mainBranch.endsWith('.lock')))
104156
+ throw new Error();
104157
+ if (gitExecutable !== undefined && !(0, node_path_1.isAbsolute)(gitExecutable))
104158
+ throw new Error();
104159
+ const workspace = (0, node_fs_1.realpathSync)(root);
104160
+ const git = (...args) => {
104161
+ const result = (0, node_child_process_1.spawnSync)(gitExecutable ?? 'git', ['--no-replace-objects', ...args], { cwd: workspace, env: environment,
104162
+ shell: false, windowsHide: true, timeout: 5000, maxBuffer: verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.snapshotBytes + 4096 });
104163
+ if (result.error || result.status !== 0)
104164
+ throw new Error();
104165
+ return result.stdout;
104166
+ };
104167
+ const sha = pinned ?? git('rev-parse', '--verify', `refs/remotes/origin/${mainBranch}^{commit}`).toString('utf8').trim();
104168
+ if (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(sha))
104169
+ throw new Error();
104170
+ sourceSha = sha;
104171
+ const entries = git('ls-tree', '-rz', sourceSha, '--', verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY).toString('utf8').split('\0').filter(Boolean);
104172
+ if (!entries.length || entries.length > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.files)
104173
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104174
+ let total = 0;
104175
+ const files = entries.map(entry => {
104176
+ const match = /^(100644|100755) blob ([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(entry);
104177
+ if (!match || !match[3].startsWith(`${verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY}/`))
104178
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104179
+ const path = match[3].slice(verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY.length + 1);
104180
+ 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)))
104181
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104182
+ const bytes = git('cat-file', 'blob', match[2]);
104183
+ total += bytes.length;
104184
+ const digest = (0, node_crypto_1.createHash)(match[2].length === 40 ? 'sha1' : 'sha256').update(`blob ${bytes.length}\0`).update(bytes).digest('hex');
104185
+ if (bytes.length > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.scriptBytes || total > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.snapshotBytes || digest !== match[2])
104186
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104187
+ return Object.freeze({ path, base64: bytes.toString('base64'), executable: match[1] === '100755' });
104188
+ });
104189
+ const manifest = files.find(file => file.path === 'action.yml');
104190
+ if (!manifest)
104191
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104192
+ const bytes = Buffer.from(manifest.base64, 'base64');
104193
+ const text = bytes.toString('utf8');
104194
+ if (!bytes.length || !bytes.equals(Buffer.from(text)) || text.includes('\0'))
104195
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104196
+ let action;
104197
+ try {
104198
+ action = (0, js_yaml_1.load)(text);
104199
+ }
104200
+ catch {
104201
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104202
+ }
104203
+ if (action?.runs?.using !== 'composite' || !Array.isArray(action.runs.steps) || !action.runs.steps.length || action.runs.steps.length > 32)
104204
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104205
+ if (action.runs.steps.some(step => !step || typeof step !== 'object' || 'uses' in step && typeof step.uses === 'string' && step.uses.startsWith('./')))
104206
+ throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
104207
+ const toolRoot = environment.RUNNER_TOOL_CACHE ? (0, node_fs_1.realpathSync)(environment.RUNNER_TOOL_CACHE) : undefined;
104208
+ snapshot = Object.freeze({ kind: 'ready', files: Object.freeze(files), sourceSha, workspace, ...(toolRoot ? { toolRoot } : {}) });
104209
+ }
104210
+ catch (error) {
104211
+ snapshot = Object.freeze({ kind: 'blocked', reason: error instanceof verification_setup_policy_1.VerificationSetupError ? error.reason : 'source-unavailable', ...(sourceSha ? { sourceSha } : {}) });
104212
+ }
104213
+ try {
104214
+ runtime?.cleanup();
104215
+ }
104216
+ catch {
104217
+ snapshot = Object.freeze({ kind: 'blocked', reason: 'source-unavailable', ...(sourceSha ? { sourceSha } : {}) });
104218
+ }
104219
+ return snapshot;
104220
+ }
104221
+
104222
+
102591
104223
  /***/ }),
102592
104224
 
102593
104225
  /***/ 92540:
@@ -102745,26 +104377,64 @@ const logger_1 = __nccwpck_require__(91151);
102745
104377
  const issue_content_interface_1 = __nccwpck_require__(60608);
102746
104378
  const configuration_payload_policy_1 = __nccwpck_require__(58043);
102747
104379
  const application_error_1 = __nccwpck_require__(75999);
104380
+ const configuration_markers_1 = __nccwpck_require__(4586);
102748
104381
  class ConfigurationHandler extends issue_content_interface_1.IssueContentInterface {
102749
104382
  constructor() {
102750
104383
  super(...arguments);
104384
+ this.getContent = (description) => {
104385
+ const block = (0, configuration_markers_1.readConfigurationBlock)(description);
104386
+ return block.kind === 'present' ? block.content : undefined;
104387
+ };
104388
+ this.updateContent = (description, content) => {
104389
+ if (description === undefined || content === undefined)
104390
+ return undefined;
104391
+ const updated = (0, configuration_markers_1.writeConfigurationBlock)(description, content);
104392
+ if (updated === undefined)
104393
+ (0, logger_1.logError)('The content has a problem with open-close tags: stored configuration.');
104394
+ return updated;
104395
+ };
102751
104396
  this.update = async (query, context) => {
102752
104397
  const storedRaw = await this.internalGetter(query);
102753
104398
  return this.internalUpdate(query, (0, configuration_payload_policy_1.buildConfigurationPayload)(context, storedRaw));
102754
104399
  };
102755
104400
  this.get = async (query) => {
104401
+ let description;
104402
+ try {
104403
+ description = await this.issueDescriptionPort.getDescription(query.owner, query.repository, query.issueNumber, query.token);
104404
+ }
104405
+ catch (cause) {
104406
+ const semanticError = (0, application_error_1.toApplicationError)(cause, 'provider.unavailable', 'Unable to read issue configuration.');
104407
+ (0, logger_1.logError)(semanticError);
104408
+ throw semanticError;
104409
+ }
104410
+ const variables = { issueNumber: query.issueNumber, expectedVersion: config_1.CONFIG_SCHEMA_VERSION };
104411
+ let recovery = { id: 'stored-configuration-invalid', variables };
102756
104412
  try {
102757
- const description = await this.issueDescriptionPort.getDescription(query.owner, query.repository, query.issueNumber, query.token);
102758
104413
  const config = this.getContent(description);
102759
104414
  if (config === undefined) {
104415
+ if ((0, configuration_markers_1.readConfigurationBlock)(description).kind === 'invalid') {
104416
+ throw new Error('Stored configuration markers are inconsistent.');
104417
+ }
102760
104418
  return undefined;
102761
104419
  }
102762
- const branchConfig = (0, config_1.requireCurrentConfigurationPayload)(JSON.parse(config));
104420
+ const parsed = JSON.parse(config);
104421
+ if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
104422
+ const version = parsed.schemaVersion;
104423
+ if (version === undefined) {
104424
+ recovery = { id: 'stored-configuration-schema-missing', variables };
104425
+ }
104426
+ else if (typeof version === 'number' && Number.isSafeInteger(version)
104427
+ && version >= 0 && version !== config_1.CONFIG_SCHEMA_VERSION) {
104428
+ recovery = { id: 'stored-configuration-schema-unsupported', variables: { ...variables, actualVersion: version } };
104429
+ }
104430
+ }
104431
+ const branchConfig = (0, config_1.requireCurrentConfigurationPayload)(parsed);
102763
104432
  return new config_1.Config(branchConfig);
102764
104433
  }
102765
- catch (error) {
102766
- (0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'configuration.invalid', 'Unable to read issue configuration.'));
102767
- throw error;
104434
+ catch (cause) {
104435
+ const semanticError = (0, application_error_1.toApplicationError)(cause, 'configuration.invalid', 'Stored issue/PR configuration is invalid.', { recovery });
104436
+ (0, logger_1.logError)(semanticError);
104437
+ throw semanticError;
102768
104438
  }
102769
104439
  };
102770
104440
  }
@@ -102778,6 +104448,96 @@ class ConfigurationHandler extends issue_content_interface_1.IssueContentInterfa
102778
104448
  exports.ConfigurationHandler = ConfigurationHandler;
102779
104449
 
102780
104450
 
104451
+ /***/ }),
104452
+
104453
+ /***/ 4586:
104454
+ /***/ ((__unused_webpack_module, exports) => {
104455
+
104456
+ "use strict";
104457
+
104458
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
104459
+ exports.CONFIGURATION_END = exports.CONFIGURATION_START = void 0;
104460
+ exports.readConfigurationBlock = readConfigurationBlock;
104461
+ exports.writeConfigurationBlock = writeConfigurationBlock;
104462
+ exports.CONFIGURATION_START = '<!-- copilot-configuration-start';
104463
+ exports.CONFIGURATION_END = 'copilot-configuration-end -->';
104464
+ /** Owned delimiters begin a line; ordinary mentions are not state. Complete legacy fenced records remain readable. */
104465
+ function readConfigurationBlock(description) {
104466
+ if (description === undefined)
104467
+ return { kind: 'absent' };
104468
+ let fence;
104469
+ let fencedMarker = false;
104470
+ let fencedStart;
104471
+ let nestedFencedStart = false;
104472
+ let start;
104473
+ let contentStart = 0;
104474
+ let block;
104475
+ let offset = 0;
104476
+ for (const line of description.match(/[^\n]*(?:\n|$)/gu) ?? []) {
104477
+ const text = line.replace(/\r?\n$/u, '');
104478
+ const starts = /^ {0,3}<!-- copilot-configuration-start(?:[ \t]|$)/u.test(text);
104479
+ const ends = /^ {0,3}copilot-configuration-end -->[ \t]*$/u.test(text);
104480
+ const boundary = /^ {0,3}(`{3,}|~{3,})(.*)$/u.exec(text);
104481
+ if (fence) {
104482
+ fencedMarker || (fencedMarker = starts || ends);
104483
+ if (starts) {
104484
+ if (fencedStart !== undefined)
104485
+ nestedFencedStart = true;
104486
+ else
104487
+ fencedStart = offset + text.indexOf(exports.CONFIGURATION_START);
104488
+ }
104489
+ const end = text.indexOf(exports.CONFIGURATION_END);
104490
+ if (fencedStart !== undefined && end >= 0 && !text.slice(end + exports.CONFIGURATION_END.length).trim()) {
104491
+ if (block || nestedFencedStart)
104492
+ return { kind: 'invalid' };
104493
+ block = { kind: 'present', start: fencedStart, end: offset + end + exports.CONFIGURATION_END.length,
104494
+ content: description.slice(fencedStart + exports.CONFIGURATION_START.length, offset + end) };
104495
+ fencedStart = undefined;
104496
+ }
104497
+ if (boundary && boundary[1][0] === fence[0] && boundary[1].length >= fence.length && !boundary[2].trim()) {
104498
+ fence = undefined;
104499
+ fencedMarker = false;
104500
+ fencedStart = undefined;
104501
+ nestedFencedStart = false;
104502
+ }
104503
+ }
104504
+ else if (start !== undefined || starts) {
104505
+ if (starts) {
104506
+ if (start !== undefined || block)
104507
+ return { kind: 'invalid' };
104508
+ start = offset + text.indexOf(exports.CONFIGURATION_START);
104509
+ contentStart = start + exports.CONFIGURATION_START.length;
104510
+ }
104511
+ const end = text.indexOf(exports.CONFIGURATION_END);
104512
+ if (end >= 0 && !text.slice(end + exports.CONFIGURATION_END.length).trim()) {
104513
+ block = { kind: 'present', start: start, end: offset + end + exports.CONFIGURATION_END.length,
104514
+ content: description.slice(contentStart, offset + end) };
104515
+ start = undefined;
104516
+ }
104517
+ }
104518
+ else if (ends)
104519
+ return { kind: 'invalid' };
104520
+ else if (boundary && (boundary[1][0] !== '`' || !boundary[2].includes('`')))
104521
+ fence = boundary[1];
104522
+ offset += line.length;
104523
+ }
104524
+ // A legacy block behind an unclosed fence is ambiguous: never silently discard its state.
104525
+ if (start !== undefined || fence && fencedMarker)
104526
+ return { kind: 'invalid' };
104527
+ return block ?? { kind: 'absent', ...(fence ? { closingFence: fence } : {}) };
104528
+ }
104529
+ function writeConfigurationBlock(description, content) {
104530
+ const block = readConfigurationBlock(description);
104531
+ if (block.kind === 'invalid')
104532
+ return undefined;
104533
+ const replacement = `${exports.CONFIGURATION_START}\n${content}\n${exports.CONFIGURATION_END}`;
104534
+ if (block.kind === 'present')
104535
+ return description.slice(0, block.start) + replacement + description.slice(block.end);
104536
+ // Closing an otherwise empty dangling example preserves its rendered text and keeps new state outside it.
104537
+ return `${description}\n\n${block.closingFence ? `${block.closingFence}\n\n` : ''}${replacement}`;
104538
+ }
104539
+
104540
+
102781
104541
  /***/ }),
102782
104542
 
102783
104543
  /***/ 58043:
@@ -102907,11 +104667,13 @@ function getBranchSyncConflictsPrompt(params) {
102907
104667
  "use strict";
102908
104668
 
102909
104669
  Object.defineProperty(exports, "__esModule", ({ value: true }));
104670
+ exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION = void 0;
102910
104671
  exports.getBugbotPrompt = getBugbotPrompt;
102911
104672
  /**
102912
104673
  * Prompt for Bugbot detection (detect potential problems on push).
102913
104674
  */
102914
104675
  const fill_1 = __nccwpck_require__(2559);
104676
+ 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.';
102915
104677
  const TEMPLATE = `You are analyzing the latest code changes for potential bugs and issues.
102916
104678
 
102917
104679
  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}}\`.
@@ -102947,6 +104709,8 @@ For every finding:
102947
104709
  - include the nearest stable \`symbol\` and a minimal exact \`codeSnippet\` when available so the finding can survive rebases, line movement, and file renames.
102948
104710
  - when a fix is a safe replacement of exactly the reported line range, include only the replacement text in \`suggestedCode\`; otherwise omit it.
102949
104711
 
104712
+ ${exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION}
104713
+
102950
104714
  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.
102951
104715
  {{previousBlock}}
102952
104716
 
@@ -103850,6 +105614,7 @@ exports.buildBugbotBenchmarkPrompt = buildBugbotBenchmarkPrompt;
103850
105614
  const schema_1 = __nccwpck_require__(16808);
103851
105615
  const untrusted_content_1 = __nccwpck_require__(67057);
103852
105616
  const prepare_bugbot_findings_policy_1 = __nccwpck_require__(3496);
105617
+ const bugbot_1 = __nccwpck_require__(56998);
103853
105618
  const MAX_BENCHMARK_CASES = 200;
103854
105619
  /** Executes the real configured findings agent against every case, sequentially. */
103855
105620
  async function runBugbotBenchmarkAgent(corpus, agent, configuration) {
@@ -103877,6 +105642,8 @@ function buildBugbotBenchmarkPrompt(testCase) {
103877
105642
  You are running a controlled Bugbot quality benchmark.
103878
105643
  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.
103879
105644
 
105645
+ ${bugbot_1.BUGBOT_FINDING_GROUNDING_INSTRUCTION}
105646
+
103880
105647
  Language: ${testCase.language}
103881
105648
  Repository-relative file: ${testCase.file}
103882
105649
  First displayed line: ${testCase.startLine}
@@ -104919,11 +106686,13 @@ const setup_approval_workflow_1 = __nccwpck_require__(9512);
104919
106686
  const setup_workflow_upgrade_1 = __nccwpck_require__(85493);
104920
106687
  const setup_installation_review_1 = __nccwpck_require__(23799);
104921
106688
  const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
106689
+ const setup_verification_action_1 = __nccwpck_require__(12471);
104922
106690
  /**
104923
106691
  * Ensure .github, .github/workflows and .github/ISSUE_TEMPLATE exist; create them if missing.
104924
106692
  * @param cwd - Directory (repo root)
104925
106693
  */
104926
106694
  function ensureGitHubDirs(cwd) {
106695
+ (0, setup_verification_action_1.inspectSetupVerificationActionPath)(cwd);
104927
106696
  const githubDir = path.join(cwd, '.github');
104928
106697
  const workflowsDir = path.join(cwd, '.github', 'workflows');
104929
106698
  const issueTemplateDir = path.join(cwd, '.github', 'ISSUE_TEMPLATE');
@@ -104956,6 +106725,7 @@ function copySetupFiles(cwd, setupDirOverride, features, options = {}) {
104956
106725
  const installationReview = options.setupConfiguration && (0, setup_installation_review_1.inspectSetupInstallation)(cwd, options.setupConfiguration, setupDir);
104957
106726
  if (installationReview?.blockers.length)
104958
106727
  throw new Error(installationReview.blockers.join(' '));
106728
+ const verificationAction = (0, setup_verification_action_1.createSetupVerificationAction)(cwd, options.verificationActionState);
104959
106729
  const preserveSourceGuidance = installationReview?.assets.some(asset => asset.path === repository_agent_guidance_policy_1.REPOSITORY_AGENT_GUIDE_PATH && asset.status === 'source-only');
104960
106730
  const sourceInstallation = installationReview?.assets.some(asset => asset.path.startsWith('.github/workflows/') && asset.status === 'source-only');
104961
106731
  const snapshotContent = options.setupConfiguration && (0, setup_installation_review_1.renderSetupRunnerSnapshot)(options.setupConfiguration);
@@ -105010,7 +106780,7 @@ function copySetupFiles(cwd, setupDirOverride, features, options = {}) {
105010
106780
  snapshot.copied++;
105011
106781
  }
105012
106782
  }
105013
- return [retired, workflows, approvalWorkflow, issueTemplates, pullRequestTemplate, guidance, snapshot].reduce((total, current) => ({
106783
+ return [verificationAction, retired, workflows, approvalWorkflow, issueTemplates, pullRequestTemplate, guidance, snapshot].reduce((total, current) => ({
105014
106784
  copied: total.copied + current.copied,
105015
106785
  skipped: total.skipped + current.skipped,
105016
106786
  }), { copied: 0, skipped: 0 });
@@ -105224,6 +106994,9 @@ const setup_workflow_upgrade_1 = __nccwpck_require__(85493);
105224
106994
  const setup_approval_workflow_1 = __nccwpck_require__(9512);
105225
106995
  const sensitive_text_1 = __nccwpck_require__(47122);
105226
106996
  const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
106997
+ const setup_verification_action_1 = __nccwpck_require__(33156);
106998
+ const setup_verification_action_2 = __nccwpck_require__(12471);
106999
+ const copilot_comment_workflow_1 = __nccwpck_require__(33430);
105227
107000
  exports.SETUP_RUNNER_SNAPSHOT = '.copilot/runner-profile.json';
105228
107001
  const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value)
105229
107002
  ? value : undefined;
@@ -105265,6 +107038,22 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
105265
107038
  const jobs = [];
105266
107039
  const changes = [];
105267
107040
  const blockers = [];
107041
+ let action;
107042
+ try {
107043
+ action = (0, setup_verification_action_2.inspectSetupVerificationActionPath)(root);
107044
+ }
107045
+ catch (error) {
107046
+ action = 'blocked';
107047
+ blockers.push(error instanceof Error ? error.message : 'Verification setup path could not be inspected.');
107048
+ }
107049
+ const verificationSetup = { action, enabled: configuration.repository.verificationSetup ?? false,
107050
+ mainBranch: configuration.repository.mainBranch };
107051
+ assets.push({ path: setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH, enabled: verificationSetup.enabled,
107052
+ status: action === 'create' ? 'missing' : action === 'preserve' ? 'customized' : 'incompatible' });
107053
+ if (action === 'blocked')
107054
+ return { assets, jobs, changes, blockers, verificationSetup };
107055
+ if (action === 'create')
107056
+ changes.push({ path: setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH, before: null, after: (0, setup_verification_action_2.readSetupVerificationActionStarter)() });
105268
107057
  const addJobs = (file, content, retained) => {
105269
107058
  const documents = (0, js_yaml_1.loadAll)(content);
105270
107059
  if (documents.length !== 1)
@@ -105273,7 +107062,7 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
105273
107062
  if (!parsedJobs)
105274
107063
  throw new Error('Workflow jobs are unavailable for review.');
105275
107064
  for (const [job, raw] of Object.entries(parsedJobs)) {
105276
- const runsOn = object(raw)?.['runs-on'];
107065
+ const runsOn = (0, copilot_comment_workflow_1.copilotCommentRunner)(object(raw));
105277
107066
  if (runsOn === undefined)
105278
107067
  continue; // reusable workflow calls have no runner
105279
107068
  jobs.push({ file, job, role: (0, setup_runner_policy_1.setupRunnerRole)(file, job) ?? 'validation',
@@ -105361,7 +107150,7 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
105361
107150
  before: before === undefined ? null : (0, sensitive_text_1.redactSensitiveText)(before), after: (0, sensitive_text_1.redactSensitiveText)(after) });
105362
107151
  if (after !== undefined && before !== undefined && !compatibleSetupRunnerSnapshot(before))
105363
107152
  blockers.push('Runner snapshot is incompatible. Retain it or restore a supported version before replacing routing.');
105364
- return { assets, jobs, changes, blockers };
107153
+ return { assets, jobs, changes, blockers, verificationSetup };
105365
107154
  }
105366
107155
 
105367
107156
 
@@ -105380,6 +107169,7 @@ const js_yaml_1 = __nccwpck_require__(783);
105380
107169
  const node_util_1 = __nccwpck_require__(47261);
105381
107170
  const setup_runner_policy_1 = __nccwpck_require__(91027);
105382
107171
  const action_types_1 = __nccwpck_require__(19625);
107172
+ const copilot_comment_workflow_1 = __nccwpck_require__(33430);
105383
107173
  const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
105384
107174
  const document = (value) => {
105385
107175
  try {
@@ -105401,6 +107191,8 @@ const runner = (value) => labels(value) || !!object(value)
105401
107191
  && (object(value).labels === undefined || labels(object(value).labels));
105402
107192
  const copilotCommands = new Set(Object.values(action_types_1.ACTIONS));
105403
107193
  const callsRootAction = (jobs) => !!jobs && Object.values(jobs).some(job => {
107194
+ if (object(job)?.uses === copilot_comment_workflow_1.COPILOT_COMMENT_SELF_WORKFLOW)
107195
+ return true;
105404
107196
  const steps = object(job)?.steps;
105405
107197
  return Array.isArray(steps) && steps.some(step => {
105406
107198
  const invocation = object(step);
@@ -105463,6 +107255,32 @@ function renderSetupWorkflowUpgrade(template, existing, selection) {
105463
107255
  const templateJobs = object(document(template)?.jobs);
105464
107256
  if (!previousJobs || !templateJobs)
105465
107257
  throw new Error('Workflow jobs cannot be inspected; review the workflow separately.');
107258
+ if (Object.values(templateJobs).some(job => (0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(object(job)?.uses))) {
107259
+ const parsed = document(template);
107260
+ const jobs = object(parsed.jobs);
107261
+ let changed = false;
107262
+ for (const [name, value] of Object.entries(jobs)) {
107263
+ const job = object(value);
107264
+ if (!(0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(job.uses))
107265
+ throw new Error('Mixed comment workflow jobs require separate workflow review before setup.');
107266
+ const previousJob = object(previousJobs[name]);
107267
+ if (Array.isArray(previousJob?.steps) && previousJob.steps.some(raw => {
107268
+ const uses = object(raw)?.uses;
107269
+ return typeof uses !== 'string' || !(uses.startsWith('actions/checkout@')
107270
+ || /^vypdev\/copilot@[^\s]+$/u.test(uses) || uses === './.git/copilot-verification-setup');
107271
+ }))
107272
+ 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.');
107273
+ const retained = (0, setup_runner_policy_1.selectedSetupRunsOn)(selection?.runners, selection && (0, setup_runner_policy_1.setupRunnerRole)(selection.file, name))
107274
+ ?? (0, copilot_comment_workflow_1.copilotCommentRunner)(previousJob) ?? (0, copilot_comment_workflow_1.copilotCommentRunner)(job);
107275
+ if (!runner(retained))
107276
+ throw new Error('Existing runner selection is invalid; review the workflow separately.');
107277
+ if (JSON.stringify(retained).includes('${{') && existing !== template)
107278
+ throw new Error('Dynamic runner selection requires separate workflow review before setup.');
107279
+ changed || (changed = !(0, node_util_1.isDeepStrictEqual)(retained, (0, copilot_comment_workflow_1.copilotCommentRunner)(job)));
107280
+ job.with = { ...object(job.with), 'runs-on': JSON.stringify(retained) };
107281
+ }
107282
+ return changed ? (0, js_yaml_1.dump)(parsed, { noRefs: true, lineWidth: -1 }) : template;
107283
+ }
105466
107284
  const lines = template.split('\n');
105467
107285
  let job = '';
105468
107286
  let insideJobs = false;
@@ -117293,6 +119111,14 @@ module.exports = JSON.parse('{"single":{"topLeft":"┌","top":"─","topRight":"
117293
119111
  "use strict";
117294
119112
  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"}}}}');
117295
119113
 
119114
+ /***/ }),
119115
+
119116
+ /***/ 78593:
119117
+ /***/ ((module) => {
119118
+
119119
+ "use strict";
119120
+ 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 }}"}');
119121
+
117296
119122
  /***/ })
117297
119123
 
117298
119124
  /******/ });