mirror of
https://github.com/stablyai/orca.git
synced 2026-11-02 01:57:57 +00:00
* perf(orcad): keep the server bundle ASCII so V8 stores it one byte per character 129 non-ASCII characters in regex literals (and three in a String.raw plugin template) made V8 hold the whole ~11 MB orcad-server.js source as a two-byte string. Write them as \uXXXX escapes and fail the build if any return. Co-Authored-By: Claude <noreply@anthropic.com> * fix(orcad): keep license comments ASCII and name the module the guard trips on esbuild gathers legal comments at the end of the bundle; escape that comment so a dependency's license text cannot fail the ASCII guard, while licenses still ship with the code. The guard now reports the offset and, from an unminified rebuild, the module the character came from. A dark-switch build is covered. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
62 lines
2.4 KiB
TypeScript
62 lines
2.4 KiB
TypeScript
import { agentSessionSignInCopyId } from './agent-session-availability'
|
|
import type { AgentSessionFailureFact } from './agent-session-failure'
|
|
import type { AgentSessionFailureSay } from './agent-session-failure-copy'
|
|
import type {
|
|
AgentSessionFailureWordsContext,
|
|
AgentSessionFailureSurface
|
|
} from './agent-session-failure-words'
|
|
import { joinSentences } from './sentence-joining'
|
|
import { agentSessionSignInFor } from './agent-session-sign-in'
|
|
|
|
const SENTENCE_END = /[.!?\u3002\uFF01\uFF1F][\p{Pe}\p{Pf}"']*\s*$/u
|
|
|
|
// The sentences for a start no account or CLI on this host can make: also the chat's notice.
|
|
|
|
function agent(say: AgentSessionFailureSay, { agentName }: AgentSessionFailureWordsContext) {
|
|
return { agent: agentName ?? say('theAgent') }
|
|
}
|
|
|
|
export function notSignedInSentence(
|
|
context: AgentSessionFailureWordsContext,
|
|
fact: AgentSessionFailureFact,
|
|
say: AgentSessionFailureSay,
|
|
surface: AgentSessionFailureSurface = 'row'
|
|
): string {
|
|
const signIn = agentSessionSignInFor(context.agentName ?? context.provider)
|
|
const copy = say(signIn ? agentSessionSignInCopyId(signIn.agent, fact.account) : 'notSignedIn', {
|
|
...agent(say, context),
|
|
loginCommand: signIn?.loginCommand.join(' '),
|
|
slashCommand: signIn && 'slashCommand' in signIn ? signIn.slashCommand : undefined
|
|
})
|
|
const next = context.retryControl
|
|
? undefined
|
|
: context.command
|
|
? say('runCommandAgain', { command: context.command })
|
|
: surface === 'rejection' &&
|
|
context.messageSubmitted !== false &&
|
|
signIn?.agent !== 'claude' &&
|
|
signIn?.agent !== 'codex' &&
|
|
signIn?.agent !== 'antigravity'
|
|
? say(signIn ? 'thenSendAgain' : 'signInThenSend')
|
|
: undefined
|
|
const detail = fact.detail?.audience === 'person' ? fact.detail.text : undefined
|
|
const detailSentence =
|
|
detail && next && !SENTENCE_END.test(detail) ? `${detail.trimEnd()}.` : detail
|
|
return joinSentences(
|
|
[copy, detailSentence, next].filter((sentence): sentence is string => sentence !== undefined)
|
|
)
|
|
}
|
|
|
|
/** A command the start was for is still run again once the CLI is installed. */
|
|
export function cliMissingSentence(
|
|
context: AgentSessionFailureWordsContext,
|
|
say: AgentSessionFailureSay
|
|
): string {
|
|
return joinSentences([
|
|
say('cliMissing', agent(say, context)),
|
|
...(context.command && !context.retryControl
|
|
? [say('runCommandAgain', { command: context.command })]
|
|
: [])
|
|
])
|
|
}
|