ummaya 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/prompts/manifest.yaml +2 -2
- package/prompts/session_guidance_v1.md +3 -1
- package/prompts/system_v1.md +8 -7
- package/pyproject.toml +2 -7
- package/src/ummaya/context/builder.py +17 -11
- package/src/ummaya/engine/engine.py +27 -7
- package/src/ummaya/engine/query.py +20 -0
- package/src/ummaya/evidence/__init__.py +25 -0
- package/src/ummaya/evidence/__main__.py +7 -0
- package/src/ummaya/evidence/models.py +58 -0
- package/src/ummaya/evidence/runner.py +308 -0
- package/src/ummaya/evidence/task_registry.py +264 -0
- package/src/ummaya/ipc/frame_schema.py +47 -0
- package/src/ummaya/ipc/stdio.py +1287 -54
- package/src/ummaya/llm/client.py +132 -56
- package/src/ummaya/llm/reasoning.py +84 -0
- package/src/ummaya/tools/discovery_bridge.py +17 -1
- package/src/ummaya/tools/executor.py +32 -12
- package/src/ummaya/tools/geocoding/kakao_client.py +1 -2
- package/src/ummaya/tools/kma/apihub_catalog.py +984 -1
- package/src/ummaya/tools/kma/apihub_structured_adapter.py +86 -6
- package/src/ummaya/tools/kma/apihub_url_adapter.py +593 -0
- package/src/ummaya/tools/kma/apihub_url_catalog.py +296 -0
- package/src/ummaya/tools/location_adapters.py +8 -6
- package/src/ummaya/tools/manifest_metadata.py +16 -3
- package/src/ummaya/tools/mvp_surface.py +2 -2
- package/src/ummaya/tools/nmc/emergency_search.py +8 -6
- package/src/ummaya/tools/register_all.py +9 -0
- package/src/ummaya/tools/resolve_location.py +4 -4
- package/src/ummaya/tools/search.py +664 -18
- package/src/ummaya/tools/verified_data_go_kr/_manifest.py +115 -25
- package/src/ummaya/tools/verified_data_go_kr/airkorea_air_quality.py +109 -4
- package/src/ummaya/tools/verified_data_go_kr/nmc_aed_site.py +108 -2
- package/src/ummaya/tools/verified_data_go_kr/pps_bid_public_info.py +174 -9
- package/src/ummaya/tools/verified_data_go_kr/tago_bus_arrival.py +66 -3
- package/src/ummaya/tools/verified_data_go_kr/tago_bus_location.py +12 -2
- package/src/ummaya/tools/verified_data_go_kr/tago_bus_route.py +8 -2
- package/src/ummaya/tools/verified_data_go_kr/tago_bus_route_station.py +114 -0
- package/src/ummaya/tools/verified_data_go_kr/tago_bus_station.py +14 -3
- package/src/ummaya/tools/verify_canonical_map.py +21 -0
- package/tui/package.json +1 -2
- package/tui/src/QueryEngine.ts +4 -0
- package/tui/src/cli/handlers/auth.ts +1 -1
- package/tui/src/cli/handlers/mcp.tsx +3 -3
- package/tui/src/cli/print.ts +69 -18
- package/tui/src/cli/update.ts +13 -13
- package/tui/src/commands/copy/index.ts +1 -1
- package/tui/src/commands/cost/cost.ts +2 -2
- package/tui/src/commands/init-verifiers.ts +5 -5
- package/tui/src/commands/init.ts +30 -30
- package/tui/src/commands/insights.ts +43 -43
- package/tui/src/commands/install-github-app/install-github-app.tsx +2 -2
- package/tui/src/commands/install-github-app/setupGitHubActions.ts +3 -3
- package/tui/src/commands/install.tsx +5 -5
- package/tui/src/commands/mcp/addCommand.ts +5 -5
- package/tui/src/commands/mcp/xaaIdpCommand.ts +2 -2
- package/tui/src/commands/plugin/ManageMarketplaces.tsx +2 -2
- package/tui/src/commands/reasoning/index.ts +13 -0
- package/tui/src/commands/reasoning/reasoning.tsx +177 -0
- package/tui/src/commands/thinkback/thinkback.tsx +3 -3
- package/tui/src/commands.ts +2 -0
- package/tui/src/components/Messages.tsx +2 -1
- package/tui/src/components/Spinner.tsx +2 -2
- package/tui/src/components/design-system/LoadingState.tsx +2 -2
- package/tui/src/ipc/codec.ts +26 -0
- package/tui/src/ipc/frames.generated.ts +398 -303
- package/tui/src/ipc/llmClient.ts +130 -51
- package/tui/src/ipc/llmTypes.ts +16 -1
- package/tui/src/ipc/schema/frame.schema.json +1 -3475
- package/tui/src/main.tsx +3 -0
- package/tui/src/query.ts +467 -2
- package/tui/src/screens/REPL.tsx +3 -3
- package/tui/src/services/api/claude.ts +48 -18
- package/tui/src/services/api/client.ts +33 -12
- package/tui/src/services/api/ummaya.ts +70 -16
- package/tui/src/skills/bundled/stuck.ts +12 -12
- package/tui/src/state/AppStateStore.ts +7 -0
- package/tui/src/tools/AdapterTool/AdapterTool.ts +590 -7
- package/tui/src/tools/LookupPrimitive/LookupPrimitive.ts +43 -17
- package/tui/src/tools/LookupPrimitive/prompt.ts +7 -6
- package/tui/src/tools/ResolveLocationPrimitive/ResolveLocationPrimitive.ts +40 -19
- package/tui/src/tools/SubmitPrimitive/SubmitPrimitive.ts +25 -9
- package/tui/src/tools/VerifyPrimitive/VerifyPrimitive.ts +25 -9
- package/tui/src/tools/_shared/citizenUserText.ts +49 -0
- package/tui/src/tools/_shared/directPublicDataGuard.ts +362 -0
- package/tui/src/tools/_shared/kmaAnalysisGuard.ts +197 -0
- package/tui/src/tools/_shared/kmaAviationGuard.ts +70 -0
- package/tui/src/tools/_shared/locationInputRepair.ts +112 -0
- package/tui/src/tools/_shared/nmcAedGuard.ts +234 -0
- package/tui/src/tools/_shared/protectedCheckGuard.ts +207 -0
- package/tui/src/tools/_shared/rootPrimitiveInput.ts +67 -0
- package/tui/src/tools/_shared/textToolCallGuard.ts +91 -0
- package/tui/src/tools/_shared/toolChoiceRepair.ts +866 -0
- package/tui/src/utils/attachments.ts +1 -1
- package/tui/src/utils/kExaoneReasoning.ts +138 -0
- package/tui/src/utils/messages.ts +1 -0
- package/tui/src/utils/multiToolLayout.ts +13 -0
- package/tui/src/utils/processUserInput/processSlashCommand.tsx +2 -2
- package/tui/src/utils/processUserInput/processUserInput.ts +26 -0
- package/tui/src/utils/settings/applySettingsChange.ts +4 -0
- package/tui/src/utils/settings/types.ts +9 -3
- package/tui/src/utils/stats.ts +1 -1
- package/uv.lock +1 -15
- package/assets/copilot-gate-logo.svg +0 -58
- package/assets/govon-logo.svg +0 -40
- package/src/ummaya/eval/__init__.py +0 -5
- package/src/ummaya/eval/retrieval.py +0 -713
- package/tui/src/utils/messageStream.ts +0 -186
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { textFromContent } from './nmcAedGuard.js'
|
|
2
|
+
|
|
3
|
+
const TEXT_TOOL_CALL_RE =
|
|
4
|
+
/<tool_call>|<\/tool_call>|"name"\s*:\s*"[^"]+"[\s\S]*"arguments"\s*:\s*\{/iu
|
|
5
|
+
const TEXT_TOOL_CALL_BLOCK_RE = /\s*<tool_call>[\s\S]*?<\/tool_call>\s*/giu
|
|
6
|
+
const TEXT_TOOL_CALL_REPAIR_MARKER = 'Textual tool-call final-answer repair'
|
|
7
|
+
const TEXT_TOOL_CALL_REPAIR_PROMPT =
|
|
8
|
+
'Textual tool-call final-answer repair: the previous assistant message was invalid because it printed a tool call as text. Never emit <tool_call> text, JSON tool-call text, or a JSON object with name/arguments in prose. If a tool is still needed, call it only through the native structured tool_use interface. If the needed tool has already been attempted, do not call or print any tool; write one Korean prose answer from the actual tool results already in this conversation. If the available result is no-data, upstream failure, approval-required, or insufficient for the requested detail, state that directly and give the official handoff or next action.'
|
|
9
|
+
|
|
10
|
+
function asRecord(value: unknown): Record<string, unknown> | undefined {
|
|
11
|
+
return typeof value === 'object' && value !== null
|
|
12
|
+
? (value as Record<string, unknown>)
|
|
13
|
+
: undefined
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function messageRecord(message: unknown): Record<string, unknown> | undefined {
|
|
17
|
+
return asRecord(asRecord(message)?.message)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function messageRole(message: unknown): string | undefined {
|
|
21
|
+
const outer = asRecord(message)
|
|
22
|
+
const inner = messageRecord(message)
|
|
23
|
+
if (typeof inner?.role === 'string') return inner.role
|
|
24
|
+
if (typeof outer?.role === 'string') return outer.role
|
|
25
|
+
return typeof outer?.type === 'string' ? outer.type : undefined
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function messageContent(message: unknown): unknown {
|
|
29
|
+
return messageRecord(message)?.content ?? asRecord(message)?.content
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function contentBlocks(message: unknown): readonly unknown[] {
|
|
33
|
+
const content = messageContent(message)
|
|
34
|
+
return Array.isArray(content) ? content : []
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function hasToolUseBlock(message: unknown): boolean {
|
|
38
|
+
return contentBlocks(message).some(block => asRecord(block)?.type === 'tool_use')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function assistantTextContainsToolCall(message: unknown): boolean {
|
|
42
|
+
if (messageRole(message) !== 'assistant') return false
|
|
43
|
+
if (hasToolUseBlock(message)) return false
|
|
44
|
+
return TEXT_TOOL_CALL_RE.test(textFromContent(messageContent(message)))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function hasRepairPrompt(messages: readonly unknown[]): boolean {
|
|
48
|
+
return messages.some(message =>
|
|
49
|
+
textFromContent(messageContent(message)).includes(TEXT_TOOL_CALL_REPAIR_MARKER),
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function latestAssistantMessage(messages: readonly unknown[]): unknown | undefined {
|
|
54
|
+
for (let idx = messages.length - 1; idx >= 0; idx -= 1) {
|
|
55
|
+
if (messageRole(messages[idx]) === 'assistant') return messages[idx]
|
|
56
|
+
}
|
|
57
|
+
return undefined
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function buildTextToolCallFinalAnswerRepairPromptIfNeeded({
|
|
61
|
+
messages,
|
|
62
|
+
}: {
|
|
63
|
+
messages: readonly unknown[]
|
|
64
|
+
}): string | undefined {
|
|
65
|
+
if (hasRepairPrompt(messages)) return undefined
|
|
66
|
+
const latestAssistant = latestAssistantMessage(messages)
|
|
67
|
+
if (!assistantTextContainsToolCall(latestAssistant)) return undefined
|
|
68
|
+
return TEXT_TOOL_CALL_REPAIR_PROMPT
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function shouldWithholdTextToolCallFinalAnswer({
|
|
72
|
+
messages,
|
|
73
|
+
candidate,
|
|
74
|
+
}: {
|
|
75
|
+
messages: readonly unknown[]
|
|
76
|
+
candidate: unknown
|
|
77
|
+
}): boolean {
|
|
78
|
+
if (hasRepairPrompt(messages)) return false
|
|
79
|
+
return assistantTextContainsToolCall(candidate)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function textContainsToolCall(text: string): boolean {
|
|
83
|
+
return TEXT_TOOL_CALL_RE.test(text)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function stripTextToolCallBlocks(text: string): string {
|
|
87
|
+
return text
|
|
88
|
+
.replace(TEXT_TOOL_CALL_BLOCK_RE, '\n')
|
|
89
|
+
.replace(/\n{3,}/gu, '\n\n')
|
|
90
|
+
.trim()
|
|
91
|
+
}
|