Skip to content

Commit 216ebda

Browse files
committed
Merge remote-tracking branch 'origin/main' into jahooma/composio-managed-auth
2 parents 73e1639 + 547e061 commit 216ebda

126 files changed

Lines changed: 2841 additions & 7200 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/cleanup/SKILL.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.agents/skills/meta/SKILL.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

.agents/skills/review/SKILL.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.agents/skills/simplify/SKILL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: simplify
3+
description: Simplify changes
4+
---
5+
6+
# Simplify
7+
8+
Take a new look at the whole change so far with fresh eyes. What opportunities do you see to simplify the design or implementation? What opportunities do you see to improve the design or implementation? Make a full pass to rethink the change and come up with the cleanest solution.

.github/actions/setup-bun-compile-runtime/action.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ runs:
1414
shell: bash
1515
run: echo "version=$(bun --version)" >> "$GITHUB_OUTPUT"
1616

17-
- name: Cache Bun compile runtime
18-
uses: actions/cache@v5
17+
- name: Restore Bun compile runtime cache
18+
id: compile-runtime-cache
19+
uses: actions/cache/restore@v5
20+
continue-on-error: true
1921
with:
2022
path: ${{ runner.temp }}/bun-compile-runtimes/${{ inputs.target }}-v${{ steps.bun-version.outputs.version }}
21-
key: ${{ runner.os }}-bun-compile-runtime-${{ inputs.target }}-v${{ steps.bun-version.outputs.version }}
23+
key: ${{ runner.os }}-bun-compile-runtime-v2-${{ inputs.target }}-v${{ steps.bun-version.outputs.version }}
2224

2325
- name: Prepare Bun compile runtime
2426
shell: pwsh
@@ -49,3 +51,11 @@ runs:
4951
}
5052
5153
"BUN_COMPILE_EXECUTABLE_PATH=$runtimePath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
54+
55+
- name: Save Bun compile runtime cache
56+
if: steps.compile-runtime-cache.outputs.cache-hit != 'true'
57+
uses: actions/cache/save@v5
58+
continue-on-error: true
59+
with:
60+
path: ${{ runner.temp }}/bun-compile-runtimes/${{ inputs.target }}-v${{ steps.bun-version.outputs.version }}
61+
key: ${{ runner.os }}-bun-compile-runtime-v2-${{ inputs.target }}-v${{ steps.bun-version.outputs.version }}

agents/base2/base2.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ import {
1818
type SecretAgentDefinition,
1919
} from '../types/secret-agent-definition'
2020

21-
function formatCurrentDate(date: Date): string {
22-
return new Intl.DateTimeFormat('en-US', {
23-
year: 'numeric',
24-
month: 'long',
25-
day: 'numeric',
26-
}).format(date)
27-
}
28-
2921
export function createBase2(
3022
mode: 'default' | 'free' | 'lite' | 'max' | 'fast',
3123
options?: {
@@ -140,7 +132,7 @@ export function createBase2(
140132

141133
systemPrompt: `You are Buffy, a strategic assistant that orchestrates complex coding tasks through specialized sub-agents. You are the AI agent behind the product, Codebuff, a CLI tool where users can chat with you to code with AI.
142134
143-
Current date: ${formatCurrentDate(new Date())}.
135+
Current date: ${PLACEHOLDER.CURRENT_DATE}.
144136
145137
# Core Mandates
146138

agents/types/secret-agent-definition.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface SecretAgentDefinition extends Omit<
2727
const placeholderNames = [
2828
'AGENT_NAME',
2929
'AGENTS_PROMPT',
30+
'CURRENT_DATE',
3031
'FILE_TREE_PROMPT_SMALL',
3132
'FILE_TREE_PROMPT',
3233
'FILE_TREE_PROMPT_LARGE',

bun.lock

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/release-staging/index.js

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ const packageName = 'codecane'
1717
* Terminal escape sequences to reset terminal state after the child process exits.
1818
* When the binary is SIGKILL'd, it can't clean up its own terminal state.
1919
* The wrapper (this process) survives and must reset these modes.
20-
*
21-
* Keep in sync with TERMINAL_RESET_SEQUENCES in cli/src/utils/renderer-cleanup.ts
2220
*/
23-
const TERMINAL_RESET_SEQUENCES =
24-
'\x1b[?1049l' + // Exit alternate screen buffer
21+
const EXIT_ALTERNATE_SCREEN_SEQUENCE = '\x1b[?1049l'
22+
const SAFE_TERMINAL_RESET_SEQUENCES =
2523
'\x1b[?1000l' + // Disable X10 mouse mode
2624
'\x1b[?1002l' + // Disable button event mouse mode
2725
'\x1b[?1003l' + // Disable any-event mouse mode (all motion)
@@ -30,7 +28,12 @@ const TERMINAL_RESET_SEQUENCES =
3028
'\x1b[?2004l' + // Disable bracketed paste mode
3129
'\x1b[?25h' // Show cursor
3230

33-
function resetTerminal() {
31+
const FULL_TERMINAL_RESET_SEQUENCES =
32+
EXIT_ALTERNATE_SCREEN_SEQUENCE + SAFE_TERMINAL_RESET_SEQUENCES
33+
34+
function resetTerminal(options = {}) {
35+
const { exitAlternateScreen = false } = options
36+
3437
try {
3538
if (process.stdin.isTTY && process.stdin.setRawMode) {
3639
process.stdin.setRawMode(false)
@@ -40,13 +43,37 @@ function resetTerminal() {
4043
}
4144
try {
4245
if (process.stdout.isTTY) {
43-
process.stdout.write(TERMINAL_RESET_SEQUENCES)
46+
// Exiting the alternate screen is only safe after an interactive child.
47+
// Plain CLI paths like --help never enter it, and ?1049l can erase output.
48+
process.stdout.write(
49+
exitAlternateScreen
50+
? FULL_TERMINAL_RESET_SEQUENCES
51+
: SAFE_TERMINAL_RESET_SEQUENCES,
52+
)
4453
}
4554
} catch {
4655
// stdout may be closed
4756
}
4857
}
4958

59+
function getUnsignedExitCode(code) {
60+
return code != null && code < 0 ? (code >>> 0) : code
61+
}
62+
63+
function isWindowsNativeCrashCode(code) {
64+
const unsignedCode = getUnsignedExitCode(code)
65+
return (
66+
process.platform === 'win32' &&
67+
(unsignedCode === 0xC000001D ||
68+
unsignedCode === 0xC0000005 ||
69+
unsignedCode === 0xC0000409)
70+
)
71+
}
72+
73+
function shouldExitAlternateScreen(code, signal) {
74+
return Boolean(signal) || isWindowsNativeCrashCode(code)
75+
}
76+
5077
function createConfig(packageName) {
5178
const homeDir = os.homedir()
5279
const configDir = path.join(homeDir, '.config', 'manicode')
@@ -465,7 +492,7 @@ async function checkForUpdates(runningProcess, exitListener) {
465492
}, 5000)
466493
})
467494

468-
resetTerminal()
495+
resetTerminal({ exitAlternateScreen: true })
469496
console.log(`Update available: ${currentVersion}${latestVersion}`)
470497

471498
await downloadBinary(latestVersion)
@@ -476,7 +503,9 @@ async function checkForUpdates(runningProcess, exitListener) {
476503
})
477504

478505
newChild.on('exit', (code, signal) => {
479-
resetTerminal()
506+
resetTerminal({
507+
exitAlternateScreen: shouldExitAlternateScreen(code, signal),
508+
})
480509
printCrashDiagnostics(code, signal)
481510
process.exit(signal ? 1 : (code || 0))
482511
})
@@ -495,7 +524,7 @@ async function checkForUpdates(runningProcess, exitListener) {
495524

496525
function printCrashDiagnostics(code, signal) {
497526
// Windows NTSTATUS codes (unsigned DWORD)
498-
const unsignedCode = code != null && code < 0 ? (code >>> 0) : code
527+
const unsignedCode = getUnsignedExitCode(code)
499528
const isIllegalInstruction =
500529
signal === 'SIGILL' ||
501530
(process.platform === 'win32' && unsignedCode === 0xC000001D)
@@ -557,7 +586,9 @@ async function main() {
557586
})
558587

559588
const exitListener = (code, signal) => {
560-
resetTerminal()
589+
resetTerminal({
590+
exitAlternateScreen: shouldExitAlternateScreen(code, signal),
591+
})
561592
printCrashDiagnostics(code, signal)
562593
process.exit(signal ? 1 : (code || 0))
563594
}

0 commit comments

Comments
 (0)