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

Function call

src/commands/summary/summary.ts:21–62  ·  view source on GitHub ↗
(args, context)

Source from the content-addressed store, hash-verified

19}
20
21export const call: LocalCommandCall = async (args, context) => {
22 if ((process.env.NCODE_BUILD_MODE !== 'noumena' && process.env.USER_TYPE !== 'ant')) {
23 return text('`/summary` is only available in ANT builds.')
24 }
25
26 const trimmed = args.trim()
27 if (trimmed && HELP_FLAGS.has(trimmed.toLowerCase())) {
28 return text(usage())
29 }
30 if (trimmed) {
31 return text(`Unknown argument "${trimmed}".\n\n${usage()}`)
32 }
33
34 const messages = getMessagesAfterCompactBoundary(context.messages)
35 if (messages.length === 0) {
36 return text('No messages to summarize.')
37 }
38
39 await waitForSessionMemoryExtraction()
40
41 const result = await manuallyExtractSessionMemory(messages, context)
42 if (!result.success) {
43 return text(
44 `Session summary update failed: ${result.error ?? 'unknown error'}`,
45 )
46 }
47
48 await waitForSessionMemoryExtraction()
49
50 const memoryPath = result.memoryPath ?? getSessionMemoryPath()
51 const sessionMemory = await getSessionMemoryContent()
52
53 if (!sessionMemory) {
54 return text(
55 `Session summary updated at ${getDisplayPath(memoryPath)}, but no summary content is currently available.`,
56 )
57 }
58
59 return text(
60 `Session summary updated: ${getDisplayPath(memoryPath)}\n\n${sessionMemory}`,
61 )
62}

Callers

nothing calls this directly

Calls 9

getSessionMemoryPathFunction · 0.85
getSessionMemoryContentFunction · 0.85
getDisplayPathFunction · 0.85
textFunction · 0.70
usageFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected