@codeam/shared 2.64.0 → 2.65.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.
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: {
@@ -2592,6 +2665,15 @@ var SWITCH_AGENT_COMMAND = "switch_agent";
2592
2665
 
2593
2666
  // src/types/agent-squad.ts
2594
2667
  var HANDOFF_FENCE_TAG = "codeam-handoff";
2668
+ var SQUAD_CONFIGURE_COMMAND = "squad_configure";
2669
+ var SQUAD_STATS_COMMAND = "squad_stats";
2670
+ var SQUAD_HOP_BUDGET_DEFAULT = 3;
2671
+ var SQUAD_HOP_BUDGET_MIN = 1;
2672
+ var SQUAD_HOP_BUDGET_MAX = 10;
2673
+ function clampHopBudget(value) {
2674
+ if (typeof value !== "number" || !Number.isFinite(value)) return SQUAD_HOP_BUDGET_DEFAULT;
2675
+ return Math.min(SQUAD_HOP_BUDGET_MAX, Math.max(SQUAD_HOP_BUDGET_MIN, Math.round(value)));
2676
+ }
2595
2677
  var SQUAD_SPECIALTIES = {
2596
2678
  claude: "deep reasoning, refactors, and multi-step architecture work",
2597
2679
  codex: "fast, focused implementation and test fixing",
@@ -2828,6 +2910,7 @@ export {
2828
2910
  HOUSE_AGENT_PROVIDER,
2829
2911
  HOUSE_AGENT_SUBTITLE,
2830
2912
  HOUSE_AGENT_VENDOR,
2913
+ INSTALL_SNIPPETS,
2831
2914
  INTEGRATION_BRANDING,
2832
2915
  INTEGRATION_REGISTRY,
2833
2916
  INTERNAL_TO_PUBLIC,
@@ -2847,7 +2930,12 @@ export {
2847
2930
  REVIEWER_PROMPT,
2848
2931
  SKILL_REGISTRY,
2849
2932
  SPECIFIER_PROMPT,
2933
+ SQUAD_CONFIGURE_COMMAND,
2934
+ SQUAD_HOP_BUDGET_DEFAULT,
2935
+ SQUAD_HOP_BUDGET_MAX,
2936
+ SQUAD_HOP_BUDGET_MIN,
2850
2937
  SQUAD_SPECIALTIES,
2938
+ SQUAD_STATS_COMMAND,
2851
2939
  SSE_SOCKET_TIMEOUT_MS,
2852
2940
  STACK_TO_RECOMMENDED,
2853
2941
  SWITCH_AGENT_COMMAND,
@@ -2855,6 +2943,7 @@ export {
2855
2943
  UNKNOWN_MODEL_PRICING,
2856
2944
  UPCOMING_INTEGRATION_IDS,
2857
2945
  USER_EVENTS,
2946
+ clampHopBudget,
2858
2947
  classifyStack,
2859
2948
  detectedIntegrationsFromDeps,
2860
2949
  getAgent,
@@ -2871,6 +2960,7 @@ export {
2871
2960
  headroomModelPredownloadScript,
2872
2961
  headroomPipPackage,
2873
2962
  headroomSnapshotDownloadLine,
2963
+ installableAgentIds,
2874
2964
  internalToPublic,
2875
2965
  isGuardrailDisposition,
2876
2966
  isHeadroomWrappable,
@@ -2878,6 +2968,7 @@ export {
2878
2968
  isKnownIntegrationId,
2879
2969
  isKnownModel,
2880
2970
  isLinkedAgentId,
2971
+ isNoopInstallSnippet,
2881
2972
  isPackId,
2882
2973
  isSkillId,
2883
2974
  normalizeAgentId,