@codeam/shared 2.65.0 → 2.65.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -482,6 +482,79 @@ function isHeadroomWrappable(agentId) {
482
482
  return headroomKindFor(agentId) !== null;
483
483
  }
484
484
 
485
+ // src/agents/install-snippets.ts
486
+ var CODEX = `
487
+ if ! command -v codex >/dev/null 2>&1; then
488
+ npm install -g @openai/codex >/dev/null
489
+ fi`;
490
+ var GEMINI = `
491
+ if ! command -v gemini >/dev/null 2>&1; then
492
+ npm install -g @google/gemini-cli >/dev/null
493
+ fi`;
494
+ var KIMI = `
495
+ if ! command -v kimi >/dev/null 2>&1; then
496
+ curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash \\
497
+ || { echo '[codeam:step] kimi_install_retry' >&2; sleep 2; curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash; } \\
498
+ || { echo '[ERROR] Kimi Code install failed (code.kimi.com/kimi-code/install.sh)' >&2; exit 1; }
499
+ echo 'export PATH="$HOME/.kimi-code/bin:$PATH"' >> ~/.bashrc
500
+ export PATH="$HOME/.kimi-code/bin:$PATH"
501
+ fi
502
+ # Integrity guard: the installer can leave a TRUNCATED binary (SIGSEGV on run)
503
+ # when the ~157MB download is interrupted mid-bootstrap \u2014 the ELF ends up
504
+ # missing its section headers and every \`kimi\` invocation segfaults, so the ACP
505
+ # adapter dies. Verify \`kimi\` actually runs; re-install once if it doesn't.
506
+ if ! kimi --version >/dev/null 2>&1; then
507
+ echo '[codeam:step] kimi_binary_broken_reinstall' >&2
508
+ curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash || true
509
+ export PATH="$HOME/.kimi-code/bin:$PATH"
510
+ fi`;
511
+ var CURSOR = `
512
+ if ! command -v cursor-agent >/dev/null 2>&1; then
513
+ # Retry the installer once \u2014 under the bootstrap's \`set -euo pipefail\`
514
+ # a single transient failure of this unguarded network pipe would
515
+ # otherwise abort the whole bootstrap with a bare exit 1. The
516
+ # \`[ERROR]\` prefix on final failure is picked up by the stderr
517
+ # error-detector and the captured summary.
518
+ curl https://cursor.com/install -fsS | bash \\
519
+ || { echo '[codeam:step] cursor_install_retry' >&2; sleep 2; curl https://cursor.com/install -fsS | bash; } \\
520
+ || { echo '[ERROR] cursor-agent install failed (cursor.com/install)' >&2; exit 1; }
521
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
522
+ export PATH="$HOME/.local/bin:$PATH"
523
+ fi`;
524
+ var OPENCODE = `
525
+ if ! command -v opencode >/dev/null 2>&1; then
526
+ curl -fsSL https://opencode.ai/install | bash \\
527
+ || { echo '[codeam:step] opencode_install_retry' >&2; sleep 2; curl -fsSL https://opencode.ai/install | bash; } \\
528
+ || { echo '[ERROR] opencode install failed (opencode.ai/install)' >&2; exit 1; }
529
+ echo 'export PATH="$HOME/.opencode/bin:$PATH"' >> ~/.bashrc
530
+ export PATH="$HOME/.opencode/bin:$PATH"
531
+ fi`;
532
+ var AIDER = `
533
+ if ! command -v aider >/dev/null 2>&1; then
534
+ pip install --no-cache-dir --break-system-packages aider-chat \\
535
+ || { echo '[codeam:step] aider_install_retry' >&2; sleep 2; pip install --no-cache-dir --break-system-packages aider-chat; } \\
536
+ || { echo '[ERROR] aider install failed (pip aider-chat)' >&2; exit 1; }
537
+ fi`;
538
+ var CODERABBIT = `echo '[codeam:step] coderabbit_reviewer_credential_only'`;
539
+ var INSTALL_SNIPPETS = Object.freeze({
540
+ codex: CODEX,
541
+ gemini: GEMINI,
542
+ kimi: KIMI,
543
+ cursor: CURSOR,
544
+ opencode: OPENCODE,
545
+ aider: AIDER,
546
+ coderabbit: CODERABBIT
547
+ });
548
+ function installableAgentIds() {
549
+ return Object.keys(INSTALL_SNIPPETS).filter(
550
+ (id) => !isNoopInstallSnippet(INSTALL_SNIPPETS[id])
551
+ );
552
+ }
553
+ function isNoopInstallSnippet(snippet) {
554
+ if (!snippet) return true;
555
+ return /^\s*echo\s/.test(snippet) && !/\n/.test(snippet.trim());
556
+ }
557
+
485
558
  // src/integrations/registry.ts
486
559
  var INTEGRATION_REGISTRY = {
487
560
  jira: {
@@ -2837,6 +2910,7 @@ export {
2837
2910
  HOUSE_AGENT_PROVIDER,
2838
2911
  HOUSE_AGENT_SUBTITLE,
2839
2912
  HOUSE_AGENT_VENDOR,
2913
+ INSTALL_SNIPPETS,
2840
2914
  INTEGRATION_BRANDING,
2841
2915
  INTEGRATION_REGISTRY,
2842
2916
  INTERNAL_TO_PUBLIC,
@@ -2886,6 +2960,7 @@ export {
2886
2960
  headroomModelPredownloadScript,
2887
2961
  headroomPipPackage,
2888
2962
  headroomSnapshotDownloadLine,
2963
+ installableAgentIds,
2889
2964
  internalToPublic,
2890
2965
  isGuardrailDisposition,
2891
2966
  isHeadroomWrappable,
@@ -2893,6 +2968,7 @@ export {
2893
2968
  isKnownIntegrationId,
2894
2969
  isKnownModel,
2895
2970
  isLinkedAgentId,
2971
+ isNoopInstallSnippet,
2896
2972
  isPackId,
2897
2973
  isSkillId,
2898
2974
  normalizeAgentId,