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

Function call

src/commands/break-cache/break-cache.ts:78–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78export const call: LocalCommandCall = async args => {
79 if ((process.env.NCODE_BUILD_MODE !== 'noumena' && process.env.USER_TYPE !== 'ant')) {
80 return text('`/break-cache` is only available in ANT builds.')
81 }
82
83 const trimmed = args.trim()
84 if (!trimmed) {
85 const bumpValue = buildBumpValue(null)
86 return text(
87 setInjectionAndDescribe(
88 bumpValue,
89 `Set cache breaker injection using default bump value.`,
90 ),
91 )
92 }
93
94 const tokens = trimmed.split(/\s+/)
95 const subcommand = tokens[0]?.toLowerCase() ?? ''
96
97 if (HELP_FLAGS.has(subcommand)) {
98 return text(usage())
99 }
100
101 if (subcommand === 'status') {
102 return text(formatStatus())
103 }
104
105 if (subcommand === 'reset-state') {
106 resetPromptCacheBreakDetection()
107 return text(
108 'Cleared prompt cache break detection tracking state for all tracked sources.',
109 )
110 }
111
112 if (CLEAR_FLAGS.has(subcommand)) {
113 return text(setInjectionAndDescribe(null, 'Cleared cache breaker injection.'))
114 }
115
116 if (subcommand === 'set') {
117 const rest = tokens.slice(1).join(' ')
118 if (!rest) {
119 return text(`Missing value for "set".\n\n${usage()}`)
120 }
121 const sanitized = sanitizeValue(rest)
122 if (!sanitized) {
123 return text(`Value becomes empty after sanitization.\n\n${usage()}`)
124 }
125 return text(
126 setInjectionAndDescribe(
127 sanitized,
128 `Set cache breaker injection from explicit value.`,
129 ),
130 )
131 }
132
133 if (subcommand === 'bump') {
134 const reason = tokens.slice(1).join(' ')
135 const bumpValue = buildBumpValue(reason.length ? reason : null)

Callers

nothing calls this directly

Calls 8

buildBumpValueFunction · 0.85
setInjectionAndDescribeFunction · 0.85
sanitizeValueFunction · 0.85
textFunction · 0.70
usageFunction · 0.70
formatStatusFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected