@vypdev/copilot 3.5.4 → 3.5.6

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.
@@ -38516,13 +38516,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
38516
38516
  exports.buildCodexExecutionPolicy = buildCodexExecutionPolicy;
38517
38517
  const agent_execution_plan_1 = __nccwpck_require__(12253);
38518
38518
  const provider_execution_policy_1 = __nccwpck_require__(50480);
38519
- const strict_output_schema_policy_1 = __nccwpck_require__(56743);
38519
+ const codex_output_schema_policy_1 = __nccwpck_require__(71503);
38520
38520
  function buildCodexExecutionPolicy(input) {
38521
38521
  const { configuration } = input;
38522
38522
  if (configuration.provider !== 'codex')
38523
38523
  throw new Error('Codex policy requires Codex configuration.');
38524
- if (input.outputSchema)
38525
- (0, strict_output_schema_policy_1.assertStrictOutputSchema)(input.outputSchema);
38524
+ const nativeSchema = input.outputSchema ? (0, codex_output_schema_policy_1.projectCodexOutputSchema)(input.outputSchema) : undefined;
38526
38525
  const workspaceMode = (0, agent_execution_plan_1.workspaceModeForCapability)(input.capability);
38527
38526
  const outputSchemaPath = input.outputSchema
38528
38527
  ? (0, provider_execution_policy_1.managedArtifactPath)(input.runtimeDirectory, 'response.schema.json')
@@ -38530,7 +38529,7 @@ function buildCodexExecutionPolicy(input) {
38530
38529
  const moduleCache = (0, provider_execution_policy_1.managedArtifactPath)(input.runtimeDirectory, 'shell/local/powershell-module-analysis.cache');
38531
38530
  const artifacts = outputSchemaPath ? [{
38532
38531
  path: outputSchemaPath,
38533
- contents: JSON.stringify(input.outputSchema),
38532
+ contents: JSON.stringify(nativeSchema),
38534
38533
  purpose: 'output-schema',
38535
38534
  }] : [];
38536
38535
  const argv = [
@@ -38584,6 +38583,38 @@ function tomlString(value) {
38584
38583
  }
38585
38584
 
38586
38585
 
38586
+ /***/ }),
38587
+
38588
+ /***/ 71503:
38589
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
38590
+
38591
+ "use strict";
38592
+
38593
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
38594
+ exports.projectCodexOutputSchema = projectCodexOutputSchema;
38595
+ const strict_output_schema_policy_1 = __nccwpck_require__(56743);
38596
+ /** Keep string-size acceptance local; Codex's native decoder receives the compatible closed shape. */
38597
+ function projectCodexOutputSchema(schema) {
38598
+ (0, strict_output_schema_policy_1.assertStrictOutputSchema)(schema);
38599
+ return projectNode(schema);
38600
+ }
38601
+ function projectNode(schema) {
38602
+ const projected = { ...schema };
38603
+ const types = typeof schema.type === 'string' ? [schema.type] : schema.type;
38604
+ if (types.includes('string')) {
38605
+ delete projected.minLength;
38606
+ delete projected.maxLength;
38607
+ }
38608
+ if (types.includes('object')) {
38609
+ projected.properties = Object.fromEntries(Object.entries(schema.properties)
38610
+ .map(([name, nested]) => [name, projectNode(nested)]));
38611
+ }
38612
+ if (types.includes('array'))
38613
+ projected.items = projectNode(schema.items);
38614
+ return projected;
38615
+ }
38616
+
38617
+
38587
38618
  /***/ }),
38588
38619
 
38589
38620
  /***/ 93955:
@@ -42297,7 +42328,7 @@ const resolved_message_catalog_policy_1 = __nccwpck_require__(55069);
42297
42328
  const merge_queue_message_catalog_1 = __nccwpck_require__(56033);
42298
42329
  const application_error_message_catalog_1 = __nccwpck_require__(64809);
42299
42330
  const SIMPLE_MESSAGE_KEYS = Object.freeze([
42300
- 'release', 'hotfix', 'currentStatus', 'noAction', 'actionRequired', 'progress',
42331
+ 'release', 'hotfix', 'currentStatus', 'noAction', 'completionNotice', 'actionRequired', 'progress',
42301
42332
  'currentTransition', 'whatNext', 'links', 'technical', 'alreadyPublished',
42302
42333
  'notPublished', 'productionUpdated', 'developmentSynchronized', 'yes', 'no',
42303
42334
  'from', 'to', 'state', 'compare', 'controlCenter', 'purpose', 'afterMerge',
@@ -42353,6 +42384,7 @@ exports.DEPLOYMENT_MESSAGE_IDS = Object.freeze([
42353
42384
  const ENGLISH_SIMPLE = Object.freeze({
42354
42385
  release: 'Release', hotfix: 'Hotfix', currentStatus: 'Current status',
42355
42386
  noAction: 'No action is required while GitHub owns the pending transition.', actionRequired: 'Action required',
42387
+ completionNotice: 'Deployment is complete. No further action is required.',
42356
42388
  progress: 'Progress', currentTransition: 'Current transition', whatNext: 'What happens next', links: 'Links',
42357
42389
  technical: 'Technical details', alreadyPublished: 'Package status: already published', notPublished: 'Package status: not published',
42358
42390
  productionUpdated: 'Production updated', developmentSynchronized: 'Development synchronized', yes: 'Yes', no: 'No',
@@ -42385,6 +42417,7 @@ const ENGLISH_SIMPLE = Object.freeze({
42385
42417
  const SPANISH_SIMPLE = Object.freeze({
42386
42418
  release: 'Release', hotfix: 'Hotfix', currentStatus: 'Estado actual',
42387
42419
  noAction: 'No se requiere ninguna acción mientras GitHub gestiona la transición pendiente.', actionRequired: 'Acción necesaria',
42420
+ completionNotice: 'El despliegue ha terminado. No se requiere ninguna acción adicional.',
42388
42421
  progress: 'Progreso', currentTransition: 'Transición actual', whatNext: 'Qué ocurrirá después', links: 'Enlaces',
42389
42422
  technical: 'Detalles técnicos', alreadyPublished: 'Estado del paquete: ya publicado', notPublished: 'Estado del paquete: no publicado',
42390
42423
  productionUpdated: 'Producción actualizada', developmentSynchronized: 'Desarrollo sincronizado', yes: 'Sí', no: 'No',
@@ -42932,6 +42965,8 @@ function nextDescription(operation, messages, catalog) {
42932
42965
  });
42933
42966
  }
42934
42967
  function deploymentAction(operation, messages) {
42968
+ if (operation.phase === 'completed')
42969
+ return { required: false, message: messages.completionNotice };
42935
42970
  const manual = (operation.selectedPrMode ?? operation.prMode) === 'create-only'
42936
42971
  && (operation.phase === 'promotion_pr_pending' || operation.phase === 'reconciliation_pending');
42937
42972
  if (manual)
@@ -45861,7 +45896,7 @@ Do not add the \`${profile.deployment.launcherLabel}\` label, dispatch a deploym
45861
45896
 
45862
45897
  Never expose credentials, tokens, private keys, or other secrets in issues, commits, pull requests, logs, or diagnostic comments.
45863
45898
 
45864
- For the full contributor flow, read [repository collaboration](../docs/agents/repository-collaboration.mdx). For drift and recovery, read [guidance troubleshooting](../docs/agents/repository-guidance-troubleshooting.mdx).
45899
+ 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).
45865
45900
  `;
45866
45901
  }
45867
45902
  function renderRepositoryAgentSkill() {
@@ -51265,7 +51300,7 @@ function buildSetupPatPermissionRequirements() {
51265
51300
  requirement({ role: 'setup', scope: 'repository', permission: 'Issues', level: 'write', applicability: 'conditional', condition: 'Issue workflows enabled', reason: 'Provision labels and issue resources.', probe: 'issues' }),
51266
51301
  requirement({ role: 'setup', scope: 'repository', permission: 'Actions', level: 'write', applicability: 'conditional', condition: 'Credential health enabled', reason: 'Inspect and dispatch credential-health workflows.', probe: 'actions' }),
51267
51302
  requirement({ role: 'setup', scope: 'repository', permission: 'Actions', level: 'read', idSuffix: 'read', applicability: 'conditional', condition: 'Pull-request approval enabled', reason: 'Inspect CI workflow runs and jobs for exact producer identities.', probe: 'actions' }),
51268
- requirement({ role: 'setup', scope: 'repository', permission: 'Checks', level: 'read', applicability: 'conditional', condition: 'Pull-request approval enabled', reason: 'Discover exact CI check and producer identities.', probe: 'checks' }),
51303
+ requirement({ role: 'setup', scope: 'repository', permission: 'Checks', level: 'read', applicability: 'conditional', condition: 'Guarded pull-request approval enabled', reason: 'Discover exact CI check and producer identities for guarded approval.', probe: 'checks' }),
51269
51304
  requirement({ role: 'setup', scope: 'repository', permission: 'Administration', level: 'read', applicability: 'conditional', condition: 'Release, hotfix, or guarded approval enabled', reason: 'Inspect branch protection and rulesets.', probe: 'administration' }),
51270
51305
  requirement({ role: 'setup', scope: 'repository', permission: 'Workflows', level: 'write', applicability: 'conditional', condition: 'Temporary health workflow required', reason: 'Bootstrap a missing credential-health workflow.', probe: 'workflows' }),
51271
51306
  requirement({ role: 'setup', scope: 'organization', permission: 'Secrets', level: 'write', applicability: 'conditional', condition: 'Organization Secret storage selected', reason: 'Inspect and provision organization Actions Secrets.', probe: 'secrets' }),
@@ -51383,7 +51418,12 @@ function buildSetupPatRequirements(configuration, organization, remote, projects
51383
51418
  })] : []),
51384
51419
  ...(approvalEnabled ? [
51385
51420
  requirement({ role: 'setup', scope: 'repository', permission: 'Actions', level: 'read', reason: 'Inspect CI workflow runs and jobs for approval evidence.', probe: 'actions' }),
51386
- requirement({ role: 'setup', scope: 'repository', permission: 'Checks', level: 'read', reason: 'Discover exact CI check and producer identities.', probe: 'checks' }),
51421
+ ] : []),
51422
+ // Recommendation installs can use explicitly selected producer tuples
51423
+ // while discovery remains unverified. Fine-grained operator PATs cannot
51424
+ // call the Checks API; guarded setup and the runtime bot still need it.
51425
+ ...(guardedApproval ? [
51426
+ requirement({ role: 'setup', scope: 'repository', permission: 'Checks', level: 'read', reason: 'Discover exact CI check and producer identities for guarded approval.', probe: 'checks' }),
51387
51427
  ] : []),
51388
51428
  ...(needsCredentialHealthBootstrap || needsBotActionsFixture ? [
51389
51429
  requirement({ role: 'setup', scope: 'repository', permission: 'Workflows', level: 'write',
@@ -58766,6 +58806,7 @@ const agent_response_length_failure_1 = __nccwpck_require__(28528);
58766
58806
  /** Size and typed format failures share one regeneration; the writer still validates every candidate. */
58767
58807
  async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
58768
58808
  const maximum = plan.action === 'update' ? pre_branch_sdd_1.SDD_MAX_UPDATE_CHARACTERS : pre_branch_sdd_1.SDD_MAX_DRAFT_CHARACTERS;
58809
+ const target = Math.min(10000, Math.floor(maximum / 3));
58769
58810
  const schema = {
58770
58811
  type: 'object',
58771
58812
  properties: { markdown: { type: 'string', minLength: pre_branch_sdd_1.SDD_MIN_DRAFT_CHARACTERS, maxLength: maximum } },
@@ -58773,7 +58814,7 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
58773
58814
  };
58774
58815
  let problem = 'size';
58775
58816
  let formatReason = 'required-heading';
58776
- const contractPrompt = `${prompt}\n\nDraft contract: keep the complete draft within ${maximum} characters; aim for ${Math.floor(maximum * 2 / 3)} 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.`;
58817
+ 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.`;
58777
58818
  for (let attempt = 0; attempt < 2; attempt++) {
58778
58819
  let value;
58779
58820
  try {
@@ -77493,6 +77534,7 @@ function createAgentProcessLifecycle(child, plan, signal, resolve, reject, onToo
77493
77534
  const stdoutChunks = [];
77494
77535
  let stderrBytes = 0;
77495
77536
  const stderrChunks = [];
77537
+ let stderrTail = Buffer.alloc(0);
77496
77538
  let outputBytes = 0;
77497
77539
  let settled = false;
77498
77540
  let terminationError;
@@ -77558,6 +77600,9 @@ function createAgentProcessLifecycle(child, plan, signal, resolve, reject, onToo
77558
77600
  stderrChunks.push(retained);
77559
77601
  stderrBytes += retained.byteLength;
77560
77602
  }
77603
+ const retainedTail = chunk.subarray(-MAX_STDERR_BYTES);
77604
+ const previousTail = stderrTail.subarray(Math.max(0, stderrTail.length + retainedTail.length - MAX_STDERR_BYTES));
77605
+ stderrTail = Buffer.concat([previousTail, retainedTail]);
77561
77606
  };
77562
77607
  const onStdinError = () => beginTermination(new agent_cli_contracts_1.AgentCliError('Unable to send the prompt to the agent CLI.', 'process'));
77563
77608
  const onError = () => finishReject(new agent_cli_contracts_1.AgentCliError('Unable to start agent CLI.', 'process'));
@@ -77568,8 +77613,11 @@ function createAgentProcessLifecycle(child, plan, signal, resolve, reject, onToo
77568
77613
  }
77569
77614
  if (code !== 0) {
77570
77615
  const diagnostic = stderrBytes > 0 ? ' Diagnostic output was suppressed for safety.' : '';
77616
+ const terminalDiagnostic = (0, agent_cli_exit_diagnostic_1.classifyAgentCliExitDiagnostic)(stderrTail.toString('utf8'));
77571
77617
  const exitDiagnostic = stderrBytes > 0
77572
- ? (0, agent_cli_exit_diagnostic_1.classifyAgentCliExitDiagnostic)(Buffer.concat(stderrChunks).toString('utf8'))
77618
+ ? terminalDiagnostic === 'unclassified'
77619
+ ? (0, agent_cli_exit_diagnostic_1.classifyAgentCliExitDiagnostic)(Buffer.concat(stderrChunks).toString('utf8'))
77620
+ : terminalDiagnostic
77573
77621
  : undefined;
77574
77622
  finishReject(new agent_cli_contracts_1.AgentCliError(`Agent CLI exited with code ${code}.${diagnostic}`, 'process', code === 75, code ?? undefined, exitDiagnostic));
77575
77623
  return;
@@ -77759,6 +77807,9 @@ function classifyAgentCliToolDiagnostic(stderr) {
77759
77807
  }
77760
77808
  /** Provider stderr is untrusted and may contain credentials. Return a fixed code only. */
77761
77809
  function classifyAgentCliExitDiagnostic(stderr) {
77810
+ if (/^ERROR: Incomplete response returned, reason: max_output_tokens\r?$/mu.test(stderr)) {
77811
+ return 'reported-output-token-limit';
77812
+ }
77762
77813
  const toolDiagnostic = classifyAgentCliToolDiagnostic(stderr);
77763
77814
  if (toolDiagnostic)
77764
77815
  return toolDiagnostic;
@@ -39628,13 +39628,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
39628
39628
  exports.buildCodexExecutionPolicy = buildCodexExecutionPolicy;
39629
39629
  const agent_execution_plan_1 = __nccwpck_require__(12253);
39630
39630
  const provider_execution_policy_1 = __nccwpck_require__(50480);
39631
- const strict_output_schema_policy_1 = __nccwpck_require__(56743);
39631
+ const codex_output_schema_policy_1 = __nccwpck_require__(71503);
39632
39632
  function buildCodexExecutionPolicy(input) {
39633
39633
  const { configuration } = input;
39634
39634
  if (configuration.provider !== 'codex')
39635
39635
  throw new Error('Codex policy requires Codex configuration.');
39636
- if (input.outputSchema)
39637
- (0, strict_output_schema_policy_1.assertStrictOutputSchema)(input.outputSchema);
39636
+ const nativeSchema = input.outputSchema ? (0, codex_output_schema_policy_1.projectCodexOutputSchema)(input.outputSchema) : undefined;
39638
39637
  const workspaceMode = (0, agent_execution_plan_1.workspaceModeForCapability)(input.capability);
39639
39638
  const outputSchemaPath = input.outputSchema
39640
39639
  ? (0, provider_execution_policy_1.managedArtifactPath)(input.runtimeDirectory, 'response.schema.json')
@@ -39642,7 +39641,7 @@ function buildCodexExecutionPolicy(input) {
39642
39641
  const moduleCache = (0, provider_execution_policy_1.managedArtifactPath)(input.runtimeDirectory, 'shell/local/powershell-module-analysis.cache');
39643
39642
  const artifacts = outputSchemaPath ? [{
39644
39643
  path: outputSchemaPath,
39645
- contents: JSON.stringify(input.outputSchema),
39644
+ contents: JSON.stringify(nativeSchema),
39646
39645
  purpose: 'output-schema',
39647
39646
  }] : [];
39648
39647
  const argv = [
@@ -39696,6 +39695,38 @@ function tomlString(value) {
39696
39695
  }
39697
39696
 
39698
39697
 
39698
+ /***/ }),
39699
+
39700
+ /***/ 71503:
39701
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
39702
+
39703
+ "use strict";
39704
+
39705
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
39706
+ exports.projectCodexOutputSchema = projectCodexOutputSchema;
39707
+ const strict_output_schema_policy_1 = __nccwpck_require__(56743);
39708
+ /** Keep string-size acceptance local; Codex's native decoder receives the compatible closed shape. */
39709
+ function projectCodexOutputSchema(schema) {
39710
+ (0, strict_output_schema_policy_1.assertStrictOutputSchema)(schema);
39711
+ return projectNode(schema);
39712
+ }
39713
+ function projectNode(schema) {
39714
+ const projected = { ...schema };
39715
+ const types = typeof schema.type === 'string' ? [schema.type] : schema.type;
39716
+ if (types.includes('string')) {
39717
+ delete projected.minLength;
39718
+ delete projected.maxLength;
39719
+ }
39720
+ if (types.includes('object')) {
39721
+ projected.properties = Object.fromEntries(Object.entries(schema.properties)
39722
+ .map(([name, nested]) => [name, projectNode(nested)]));
39723
+ }
39724
+ if (types.includes('array'))
39725
+ projected.items = projectNode(schema.items);
39726
+ return projected;
39727
+ }
39728
+
39729
+
39699
39730
  /***/ }),
39700
39731
 
39701
39732
  /***/ 93955:
@@ -43633,7 +43664,7 @@ const resolved_message_catalog_policy_1 = __nccwpck_require__(55069);
43633
43664
  const merge_queue_message_catalog_1 = __nccwpck_require__(56033);
43634
43665
  const application_error_message_catalog_1 = __nccwpck_require__(64809);
43635
43666
  const SIMPLE_MESSAGE_KEYS = Object.freeze([
43636
- 'release', 'hotfix', 'currentStatus', 'noAction', 'actionRequired', 'progress',
43667
+ 'release', 'hotfix', 'currentStatus', 'noAction', 'completionNotice', 'actionRequired', 'progress',
43637
43668
  'currentTransition', 'whatNext', 'links', 'technical', 'alreadyPublished',
43638
43669
  'notPublished', 'productionUpdated', 'developmentSynchronized', 'yes', 'no',
43639
43670
  'from', 'to', 'state', 'compare', 'controlCenter', 'purpose', 'afterMerge',
@@ -43689,6 +43720,7 @@ exports.DEPLOYMENT_MESSAGE_IDS = Object.freeze([
43689
43720
  const ENGLISH_SIMPLE = Object.freeze({
43690
43721
  release: 'Release', hotfix: 'Hotfix', currentStatus: 'Current status',
43691
43722
  noAction: 'No action is required while GitHub owns the pending transition.', actionRequired: 'Action required',
43723
+ completionNotice: 'Deployment is complete. No further action is required.',
43692
43724
  progress: 'Progress', currentTransition: 'Current transition', whatNext: 'What happens next', links: 'Links',
43693
43725
  technical: 'Technical details', alreadyPublished: 'Package status: already published', notPublished: 'Package status: not published',
43694
43726
  productionUpdated: 'Production updated', developmentSynchronized: 'Development synchronized', yes: 'Yes', no: 'No',
@@ -43721,6 +43753,7 @@ const ENGLISH_SIMPLE = Object.freeze({
43721
43753
  const SPANISH_SIMPLE = Object.freeze({
43722
43754
  release: 'Release', hotfix: 'Hotfix', currentStatus: 'Estado actual',
43723
43755
  noAction: 'No se requiere ninguna acción mientras GitHub gestiona la transición pendiente.', actionRequired: 'Acción necesaria',
43756
+ completionNotice: 'El despliegue ha terminado. No se requiere ninguna acción adicional.',
43724
43757
  progress: 'Progreso', currentTransition: 'Transición actual', whatNext: 'Qué ocurrirá después', links: 'Enlaces',
43725
43758
  technical: 'Detalles técnicos', alreadyPublished: 'Estado del paquete: ya publicado', notPublished: 'Estado del paquete: no publicado',
43726
43759
  productionUpdated: 'Producción actualizada', developmentSynchronized: 'Desarrollo sincronizado', yes: 'Sí', no: 'No',
@@ -44268,6 +44301,8 @@ function nextDescription(operation, messages, catalog) {
44268
44301
  });
44269
44302
  }
44270
44303
  function deploymentAction(operation, messages) {
44304
+ if (operation.phase === 'completed')
44305
+ return { required: false, message: messages.completionNotice };
44271
44306
  const manual = (operation.selectedPrMode ?? operation.prMode) === 'create-only'
44272
44307
  && (operation.phase === 'promotion_pr_pending' || operation.phase === 'reconciliation_pending');
44273
44308
  if (manual)
@@ -47356,7 +47391,7 @@ Do not add the \`${profile.deployment.launcherLabel}\` label, dispatch a deploym
47356
47391
 
47357
47392
  Never expose credentials, tokens, private keys, or other secrets in issues, commits, pull requests, logs, or diagnostic comments.
47358
47393
 
47359
- For the full contributor flow, read [repository collaboration](../docs/agents/repository-collaboration.mdx). For drift and recovery, read [guidance troubleshooting](../docs/agents/repository-guidance-troubleshooting.mdx).
47394
+ 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).
47360
47395
  `;
47361
47396
  }
47362
47397
  function renderRepositoryAgentSkill() {
@@ -57350,6 +57385,7 @@ const agent_response_length_failure_1 = __nccwpck_require__(28528);
57350
57385
  /** Size and typed format failures share one regeneration; the writer still validates every candidate. */
57351
57386
  async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
57352
57387
  const maximum = plan.action === 'update' ? pre_branch_sdd_1.SDD_MAX_UPDATE_CHARACTERS : pre_branch_sdd_1.SDD_MAX_DRAFT_CHARACTERS;
57388
+ const target = Math.min(10000, Math.floor(maximum / 3));
57353
57389
  const schema = {
57354
57390
  type: 'object',
57355
57391
  properties: { markdown: { type: 'string', minLength: pre_branch_sdd_1.SDD_MIN_DRAFT_CHARACTERS, maxLength: maximum } },
@@ -57357,7 +57393,7 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
57357
57393
  };
57358
57394
  let problem = 'size';
57359
57395
  let formatReason = 'required-heading';
57360
- const contractPrompt = `${prompt}\n\nDraft contract: keep the complete draft within ${maximum} characters; aim for ${Math.floor(maximum * 2 / 3)} 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.`;
57396
+ 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.`;
57361
57397
  for (let attempt = 0; attempt < 2; attempt++) {
57362
57398
  let value;
57363
57399
  try {
@@ -69606,6 +69642,7 @@ function createAgentProcessLifecycle(child, plan, signal, resolve, reject, onToo
69606
69642
  const stdoutChunks = [];
69607
69643
  let stderrBytes = 0;
69608
69644
  const stderrChunks = [];
69645
+ let stderrTail = Buffer.alloc(0);
69609
69646
  let outputBytes = 0;
69610
69647
  let settled = false;
69611
69648
  let terminationError;
@@ -69671,6 +69708,9 @@ function createAgentProcessLifecycle(child, plan, signal, resolve, reject, onToo
69671
69708
  stderrChunks.push(retained);
69672
69709
  stderrBytes += retained.byteLength;
69673
69710
  }
69711
+ const retainedTail = chunk.subarray(-MAX_STDERR_BYTES);
69712
+ const previousTail = stderrTail.subarray(Math.max(0, stderrTail.length + retainedTail.length - MAX_STDERR_BYTES));
69713
+ stderrTail = Buffer.concat([previousTail, retainedTail]);
69674
69714
  };
69675
69715
  const onStdinError = () => beginTermination(new agent_cli_contracts_1.AgentCliError('Unable to send the prompt to the agent CLI.', 'process'));
69676
69716
  const onError = () => finishReject(new agent_cli_contracts_1.AgentCliError('Unable to start agent CLI.', 'process'));
@@ -69681,8 +69721,11 @@ function createAgentProcessLifecycle(child, plan, signal, resolve, reject, onToo
69681
69721
  }
69682
69722
  if (code !== 0) {
69683
69723
  const diagnostic = stderrBytes > 0 ? ' Diagnostic output was suppressed for safety.' : '';
69724
+ const terminalDiagnostic = (0, agent_cli_exit_diagnostic_1.classifyAgentCliExitDiagnostic)(stderrTail.toString('utf8'));
69684
69725
  const exitDiagnostic = stderrBytes > 0
69685
- ? (0, agent_cli_exit_diagnostic_1.classifyAgentCliExitDiagnostic)(Buffer.concat(stderrChunks).toString('utf8'))
69726
+ ? terminalDiagnostic === 'unclassified'
69727
+ ? (0, agent_cli_exit_diagnostic_1.classifyAgentCliExitDiagnostic)(Buffer.concat(stderrChunks).toString('utf8'))
69728
+ : terminalDiagnostic
69686
69729
  : undefined;
69687
69730
  finishReject(new agent_cli_contracts_1.AgentCliError(`Agent CLI exited with code ${code}.${diagnostic}`, 'process', code === 75, code ?? undefined, exitDiagnostic));
69688
69731
  return;
@@ -69872,6 +69915,9 @@ function classifyAgentCliToolDiagnostic(stderr) {
69872
69915
  }
69873
69916
  /** Provider stderr is untrusted and may contain credentials. Return a fixed code only. */
69874
69917
  function classifyAgentCliExitDiagnostic(stderr) {
69918
+ if (/^ERROR: Incomplete response returned, reason: max_output_tokens\r?$/mu.test(stderr)) {
69919
+ return 'reported-output-token-limit';
69920
+ }
69875
69921
  const toolDiagnostic = classifyAgentCliToolDiagnostic(stderr);
69876
69922
  if (toolDiagnostic)
69877
69923
  return toolDiagnostic;