MCPcopy Create free account
hub / github.com/Noumena-Network/code / getInitialPasteId

Function getInitialPasteId

src/components/PromptInput/PromptInput.tsx:1739–1763  ·  view source on GitHub ↗

* Compute the initial paste ID by finding the max ID used in existing messages. * This handles --continue/--resume scenarios where we need to avoid ID collisions.

(messages: Message[])

Source from the content-addressed store, hash-verified

1737 * This handles --continue/--resume scenarios where we need to avoid ID collisions.
1738 */
1739function getInitialPasteId(messages: Message[]): number {
1740 let maxId = 0;
1741 for (const message of messages) {
1742 if (message.type === 'user') {
1743 // Check image paste IDs
1744 if (message.imagePasteIds) {
1745 for (const id of message.imagePasteIds) {
1746 if (id > maxId) maxId = id;
1747 }
1748 }
1749 // Check text paste references in message content
1750 if (Array.isArray(message.message.content)) {
1751 for (const block of message.message.content) {
1752 if (block.type === 'text') {
1753 const refs = parseReferences(block.text);
1754 for (const ref of refs) {
1755 if (ref.id > maxId) maxId = ref.id;
1756 }
1757 }
1758 }
1759 }
1760 }
1761 }
1762 return maxId + 1;
1763}
1764function buildBorderText(showFastIcon: boolean, showFastIconHint: boolean, fastModeCooldown: boolean): BorderTextOptions | undefined {
1765 if (!showFastIcon) return undefined;
1766 const fastSeg = showFastIconHint ? `${getFastIconString(true, fastModeCooldown)} ${chalk.dim('/fast')}` : getFastIconString(true, fastModeCooldown);

Callers 1

PromptInputFunction · 0.85

Calls 1

parseReferencesFunction · 0.85

Tested by

no test coverage detected