( modelId: string, additionalWorkingDirectories?: string[], )
| 604 | } |
| 605 | |
| 606 | export async function computeEnvInfo( |
| 607 | modelId: string, |
| 608 | additionalWorkingDirectories?: string[], |
| 609 | ): Promise<string> { |
| 610 | const [isGit, unameSR] = await Promise.all([getIsGit(), getUnameSR()]) |
| 611 | |
| 612 | // Undercover: keep ALL model names/IDs out of the system prompt so nothing |
| 613 | // internal can leak into public commits/PRs. This includes the public |
| 614 | // FRONTIER_MODEL_* constants — if those ever point at an unannounced model, |
| 615 | // we don't want them in context. Go fully dark. |
| 616 | // |
| 617 | // DCE: `process.env.USER_TYPE === 'ant'` is build-time --define. It MUST be |
| 618 | // inlined at each callsite (not hoisted to a const) so the bundler can |
| 619 | // constant-fold it to `false` in external builds and eliminate the branch. |
| 620 | let modelDescription = '' |
| 621 | if (process.env.USER_TYPE === 'ant' && isUndercover()) { |
| 622 | // suppress |
| 623 | } else { |
| 624 | const marketingName = getMarketingNameForModel(modelId) |
| 625 | modelDescription = marketingName |
| 626 | ? `You are powered by the model named ${marketingName}. The exact model ID is ${modelId}.` |
| 627 | : `You are powered by the model ${modelId}.` |
| 628 | } |
| 629 | |
| 630 | const additionalDirsInfo = |
| 631 | additionalWorkingDirectories && additionalWorkingDirectories.length > 0 |
| 632 | ? `Additional working directories: ${additionalWorkingDirectories.join(', ')}\n` |
| 633 | : '' |
| 634 | |
| 635 | const cutoff = getKnowledgeCutoff(modelId) |
| 636 | const knowledgeCutoffMessage = cutoff |
| 637 | ? `\n\nAssistant knowledge cutoff is ${cutoff}.` |
| 638 | : '' |
| 639 | |
| 640 | return `Here is useful information about the environment you are running in: |
| 641 | <env> |
| 642 | Working directory: ${getCwd()} |
| 643 | Is directory a git repo: ${isGit ? 'Yes' : 'No'} |
| 644 | ${additionalDirsInfo}Platform: ${env.platform} |
| 645 | ${getShellInfoLine()} |
| 646 | OS Version: ${unameSR} |
| 647 | </env> |
| 648 | ${modelDescription}${knowledgeCutoffMessage}` |
| 649 | } |
| 650 | |
| 651 | export async function computeSimpleEnvInfo( |
| 652 | modelId: string, |
no test coverage detected