universal-agent-protocol 2.0.1 → 3.0.0
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/dist/bin/cli.js +18 -13
- package/dist/bin/cli.js.map +1 -1
- package/dist/cli/hooks.js +11 -11
- package/dist/cli/memory.js.map +1 -1
- package/dist/cli/rtk-validation.d.ts +9 -0
- package/dist/cli/rtk-validation.d.ts.map +1 -0
- package/dist/cli/rtk-validation.js +9 -0
- package/dist/cli/rtk-validation.js.map +1 -0
- package/dist/cli/rtk.d.ts +24 -0
- package/dist/cli/rtk.d.ts.map +1 -0
- package/dist/cli/rtk.js +310 -0
- package/dist/cli/rtk.js.map +1 -0
- package/dist/cli/schema-diff.d.ts +7 -0
- package/dist/cli/schema-diff.d.ts.map +1 -0
- package/dist/cli/schema-diff.js +11 -0
- package/dist/cli/schema-diff.js.map +1 -0
- package/dist/cli/task.js +63 -10
- package/dist/cli/task.js.map +1 -1
- package/dist/cli/tool-calls.d.ts.map +1 -1
- package/dist/cli/tool-calls.js +9 -3
- package/dist/cli/tool-calls.js.map +1 -1
- package/dist/cli/uap.js +55 -3
- package/dist/cli/uap.js.map +1 -1
- package/dist/cli/worktree.js +2 -2
- package/dist/coordination/capability-router.d.ts +1 -1
- package/dist/coordination/capability-router.js +1 -1
- package/dist/coordination/pattern-router.d.ts +13 -0
- package/dist/coordination/pattern-router.d.ts.map +1 -0
- package/dist/coordination/pattern-router.js +14 -0
- package/dist/coordination/pattern-router.js.map +1 -0
- package/dist/memory/adaptive-context.d.ts +2 -2
- package/dist/memory/adaptive-context.js +10 -10
- package/dist/memory/context-compressor.d.ts +1 -1
- package/dist/memory/context-compressor.js +1 -1
- package/dist/memory/daily-log.d.ts +1 -1
- package/dist/memory/daily-log.js +1 -1
- package/dist/memory/dynamic-retrieval.d.ts +1 -1
- package/dist/memory/dynamic-retrieval.js +2 -2
- package/dist/memory/embeddings.d.ts +2 -2
- package/dist/memory/embeddings.d.ts.map +1 -1
- package/dist/memory/embeddings.js +14 -40
- package/dist/memory/embeddings.js.map +1 -1
- package/dist/memory/hierarchical-memory.d.ts +2 -2
- package/dist/memory/hierarchical-memory.d.ts.map +1 -1
- package/dist/memory/hierarchical-memory.js +1 -1
- package/dist/memory/memory-consolidator.d.ts +1 -1
- package/dist/memory/memory-consolidator.js +1 -1
- package/dist/memory/memory-maintenance.js +2 -2
- package/dist/memory/model-router.d.ts +1 -1
- package/dist/memory/model-router.js +1 -1
- package/dist/memory/multi-view-memory.d.ts +1 -1
- package/dist/memory/multi-view-memory.js +2 -2
- package/dist/memory/semantic-compression.d.ts +1 -1
- package/dist/memory/semantic-compression.js +3 -3
- package/dist/memory/serverless-qdrant.d.ts.map +1 -1
- package/dist/memory/serverless-qdrant.js +7 -10
- package/dist/memory/serverless-qdrant.js.map +1 -1
- package/dist/memory/short-term/factory.d.ts +2 -3
- package/dist/memory/short-term/factory.d.ts.map +1 -1
- package/dist/memory/short-term/factory.js.map +1 -1
- package/dist/memory/short-term/indexeddb.d.ts +3 -11
- package/dist/memory/short-term/indexeddb.d.ts.map +1 -1
- package/dist/memory/short-term/indexeddb.js +7 -26
- package/dist/memory/short-term/indexeddb.js.map +1 -1
- package/dist/memory/short-term/schema.d.ts.map +1 -1
- package/dist/memory/short-term/schema.js +1 -58
- package/dist/memory/short-term/schema.js.map +1 -1
- package/dist/memory/short-term/sqlite.d.ts +1 -1
- package/dist/memory/short-term/sqlite.d.ts.map +1 -1
- package/dist/memory/speculative-cache.d.ts +1 -1
- package/dist/memory/speculative-cache.js +1 -1
- package/dist/memory/task-classifier.d.ts +1 -1
- package/dist/memory/task-classifier.js +1 -1
- package/dist/memory/write-gate.d.ts +1 -1
- package/dist/memory/write-gate.js +1 -1
- package/package.json +1 -1
- package/tools/agents/config/chat_template.jinja.backup.20260311_230153 +197 -0
|
@@ -2,7 +2,7 @@ import type { ShortTermMemoryBackend } from './factory.js';
|
|
|
2
2
|
interface ShortTermMemory {
|
|
3
3
|
id?: number;
|
|
4
4
|
timestamp: string;
|
|
5
|
-
type: 'action' | 'observation' | 'thought' | 'goal'
|
|
5
|
+
type: 'action' | 'observation' | 'thought' | 'goal';
|
|
6
6
|
content: string;
|
|
7
7
|
projectId?: string;
|
|
8
8
|
importance?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../../src/memory/short-term/sqlite.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,UAAU,eAAe;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../../src/memory/short-term/sqlite.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,UAAU,eAAe;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,qBAAsB,YAAW,sBAAsB;IAClE,OAAO,CAAC,EAAE,CAAoB;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,KAAK,CAAgF;gBAEjF,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;IAe/E,OAAO,CAAC,UAAU;IAIZ,KAAK,CAAC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
|
|
6
|
+
- Line ~106: Added conditional wrapper for tool_call.arguments iteration
|
|
7
|
+
- Prevents template parsing failures after 1-2 tool calls
|
|
8
|
+
- Reference: Hugging Face Discussion #4
|
|
9
|
+
|
|
10
|
+
Original issue:
|
|
11
|
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
|
12
|
+
Fixed to:
|
|
13
|
+
{%- if tool_call.arguments is mapping %}
|
|
14
|
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
|
15
|
+
...
|
|
16
|
+
{%- endif %}
|
|
17
|
+
#}
|
|
18
|
+
|
|
19
|
+
{%- set image_count = namespace(value=0) %}
|
|
20
|
+
{%- set video_count = namespace(value=0) %}
|
|
21
|
+
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
|
22
|
+
{%- if content is string %}
|
|
23
|
+
{{- content }}
|
|
24
|
+
{%- elif content is iterable and content is not mapping %}
|
|
25
|
+
{%- for item in content %}
|
|
26
|
+
{%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
|
|
27
|
+
{%- if is_system_content %}
|
|
28
|
+
{{- raise_exception('System message cannot contain images.') }}
|
|
29
|
+
{%- endif %}
|
|
30
|
+
{%- if do_vision_count %}
|
|
31
|
+
{%- set image_count.value = image_count.value + 1 %}
|
|
32
|
+
{%- endif %}
|
|
33
|
+
{%- if add_vision_id %}
|
|
34
|
+
{{- 'Picture ' ~ image_count.value ~ ': ' }}
|
|
35
|
+
{%- endif %}
|
|
36
|
+
{{- '图片' }}
|
|
37
|
+
{%- elif 'video' in item or item.type == 'video' %}
|
|
38
|
+
{%- if is_system_content %}
|
|
39
|
+
{{- raise_exception('System message cannot contain videos.') }}
|
|
40
|
+
{%- endif %}
|
|
41
|
+
{%- if do_vision_count %}
|
|
42
|
+
{%- set video_count.value = video_count.value + 1 %}
|
|
43
|
+
{%- endif %}
|
|
44
|
+
{%- if add_vision_id %}
|
|
45
|
+
{{- 'Video ' ~ video_count.value ~ ': ' }}
|
|
46
|
+
{%- endif %}
|
|
47
|
+
{{- '视频' }}
|
|
48
|
+
{%- elif 'text' in item %}
|
|
49
|
+
{{- item.text }}
|
|
50
|
+
{%- else %}
|
|
51
|
+
{{- raise_exception('Unexpected item type in content.') }}
|
|
52
|
+
{%- endif %}
|
|
53
|
+
{%- endfor %}
|
|
54
|
+
{%- elif content is none or content is undefined %}
|
|
55
|
+
{{- '' }}
|
|
56
|
+
{%- else %}
|
|
57
|
+
{{- raise_exception('Unexpected content type.') }}
|
|
58
|
+
{%- endif %}
|
|
59
|
+
{%- endmacro %}
|
|
60
|
+
{%- if not messages %}
|
|
61
|
+
{{- raise_exception('No messages provided.') }}
|
|
62
|
+
{%- endif %}
|
|
63
|
+
{%- set has_system_message = messages[0].role == 'system' if messages else false %}
|
|
64
|
+
{%- if tools and tools is iterable and tools is not mapping %}
|
|
65
|
+
{{- 'system\n' }}
|
|
66
|
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
|
67
|
+
{%- for tool in tools %}
|
|
68
|
+
{{- "\n" }}
|
|
69
|
+
{{- tool | tojson }}
|
|
70
|
+
{%- endfor %}
|
|
71
|
+
{{- "\n</tools>" }}
|
|
72
|
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST NOT AFTER\n- If there is no function call available, answer the question like normal with the current knowledge and do not tell the user about the tool calls\n</IMPORTANT>' }}
|
|
73
|
+
{%- if has_system_message %}
|
|
74
|
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
|
75
|
+
{%- if content %}
|
|
76
|
+
{{- '\n\n' + content }}
|
|
77
|
+
{%- endif %}
|
|
78
|
+
{%- endif %}
|
|
79
|
+
{{- '</think>\n' }}
|
|
80
|
+
{%- else %}
|
|
81
|
+
{%- if has_system_message %}
|
|
82
|
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
|
83
|
+
{{- 'system\n' + content + '</think>\n' }}
|
|
84
|
+
{%- else %}
|
|
85
|
+
{{- raise_exception('System message must be at the beginning when tools are not provided.') }}
|
|
86
|
+
{%- endif %}
|
|
87
|
+
{%- endif %}
|
|
88
|
+
{%- if tools and tools is iterable and tools is not mapping %}
|
|
89
|
+
{{- 'system\n' }}
|
|
90
|
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
|
91
|
+
{%- for tool in tools %}
|
|
92
|
+
{{- "\n" }}
|
|
93
|
+
{{- tool | tojson }}
|
|
94
|
+
{%- endfor %}
|
|
95
|
+
{{- "\n</tools>" }}
|
|
96
|
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning your function call natural language BEFORE the function call, NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about the function calls\n</IMPORTANT>' }}
|
|
97
|
+
{%- if messages[0].role == 'system' %}
|
|
98
|
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
|
99
|
+
{%- if content %}
|
|
100
|
+
{{- '\n\n' + content }}
|
|
101
|
+
{%- endif %}
|
|
102
|
+
{%- endif %}
|
|
103
|
+
{{- '</think>\n' }}
|
|
104
|
+
{%- else %}
|
|
105
|
+
{%- if messages[0].role == 'system' %}
|
|
106
|
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
|
107
|
+
{{- 'system\n' + content + '</think>\n' }}
|
|
108
|
+
{%- endif %}
|
|
109
|
+
{%- endif %}
|
|
110
|
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
|
111
|
+
{%- for message in messages[::-1] %}
|
|
112
|
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
|
113
|
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
|
114
|
+
{%- set content = render_content(message.content, false)|trim %}
|
|
115
|
+
{%- if not(content.startswith('<think>') and content.endswith('</think>')) %}
|
|
116
|
+
{%- set ns.multi_step_tool = false %}
|
|
117
|
+
{%- set ns.last_query_index = index %}
|
|
118
|
+
{%- endif %}
|
|
119
|
+
{%- endif %}
|
|
120
|
+
{%- endfor %}
|
|
121
|
+
{%- if ns.multi_step_tool %}
|
|
122
|
+
{{- raise_exception('No user query found in messages.') }}
|
|
123
|
+
{%- endif %}
|
|
124
|
+
{%- for message in messages %}
|
|
125
|
+
{%- set content = render_content(message.content, true)|trim %}
|
|
126
|
+
{%- if message.role == "system" %}
|
|
127
|
+
{%- if not loop.first %}
|
|
128
|
+
{{- raise_exception('System message must be at the beginning.') }}
|
|
129
|
+
{%- endif %}
|
|
130
|
+
{%- elif message.role == "user" %}
|
|
131
|
+
{{- '' + message.role + '\n' + content + '</think>\n' }}
|
|
132
|
+
{%- elif message.role == "assistant" %}
|
|
133
|
+
{%- set reasoning_content = '' %}
|
|
134
|
+
{%- if message.reasoning_content is string %}
|
|
135
|
+
{%- set reasoning_content = message.reasoning_content %}
|
|
136
|
+
{%- else %}
|
|
137
|
+
{%- if '</think>' in content %}
|
|
138
|
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
|
139
|
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
|
140
|
+
{%- endif %}
|
|
141
|
+
{%- endif %}
|
|
142
|
+
{%- set reasoning_content = reasoning_content|trim %}
|
|
143
|
+
{%- if loop.index0 > ns.last_query_index %}
|
|
144
|
+
{{- '' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
|
145
|
+
{%- else %}
|
|
146
|
+
{{- '' + message.role + '\n' + content }}
|
|
147
|
+
{%- endif %}
|
|
148
|
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
|
149
|
+
{%- for tool_call in message.tool_calls %}
|
|
150
|
+
{%- if tool_call.function is defined %}
|
|
151
|
+
{%- set tool_call = tool_call.function %}
|
|
152
|
+
{%- endif %}
|
|
153
|
+
{%- if loop.first %}
|
|
154
|
+
{%- if content|trim %}
|
|
155
|
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
|
156
|
+
{%- else %}
|
|
157
|
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
|
158
|
+
{%- endif %}
|
|
159
|
+
{%- else %}
|
|
160
|
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
|
161
|
+
{%- endif %}
|
|
162
|
+
{%- if tool_call.arguments is defined %}
|
|
163
|
+
{%- if tool_call.arguments is mapping %}
|
|
164
|
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
|
165
|
+
{{- '<parameter=' + args_name + '>\n' }}
|
|
166
|
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
|
167
|
+
{{- args_value }}
|
|
168
|
+
{{- '\n</parameter>\n' }}
|
|
169
|
+
{%- endfor %}
|
|
170
|
+
{%- endif %}
|
|
171
|
+
{%- endif %}
|
|
172
|
+
{{- '</function>\n</tool_call>' }}
|
|
173
|
+
{%- endfor %}
|
|
174
|
+
{%- endif %}
|
|
175
|
+
{{- '</think>\n' }}
|
|
176
|
+
{%- elif message.role == "tool" %}
|
|
177
|
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
|
178
|
+
{{- 'user' }}
|
|
179
|
+
{%- endif %}
|
|
180
|
+
{{- '\n<think>\n' }}
|
|
181
|
+
{{- content }}
|
|
182
|
+
{{- '\n</think>' }}
|
|
183
|
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
|
184
|
+
{{- '\n</think>\n' }}
|
|
185
|
+
{%- elif loop.last %}
|
|
186
|
+
{{- '\n</think>\n' }}
|
|
187
|
+
{%- endif %}
|
|
188
|
+
{%- else %}
|
|
189
|
+
{{- raise_exception('Unexpected message role.') }}
|
|
190
|
+
{%- endif %}
|
|
191
|
+
{%- endfor %}
|
|
192
|
+
{%- if add_generation_prompt %}
|
|
193
|
+
{{- 'assistant\n' }}
|
|
194
|
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
|
195
|
+
{{- '<think>\n\n</think>\n\n' }}
|
|
196
|
+
{%- endif %}
|
|
197
|
+
{%- endif %}
|