@blokkli/editor 2.0.0-alpha.34 → 2.0.0-alpha.36
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/global/types/blockOptions.d.ts +9 -2
- package/dist/global/types/definitions.d.ts +12 -5
- package/dist/module.d.mts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +56 -4
- package/dist/modules/agent/index.d.mts +1 -1
- package/dist/modules/agent/index.mjs +38 -20
- package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +2 -2
- package/dist/modules/agent/runtime/app/composables/agentProvider.js +3 -3
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +34 -60
- package/dist/modules/agent/runtime/app/features/agent/Transcript/index.d.vue.ts +8 -0
- package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +138 -0
- package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue.d.ts +8 -0
- package/dist/modules/agent/runtime/app/features/agent/index.vue +5 -1
- package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +175 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +5 -0
- package/dist/modules/agent/runtime/app/tools/schemas.d.ts +9 -0
- package/dist/modules/agent/runtime/app/tools/schemas.js +36 -23
- package/dist/modules/agent/runtime/server/Session.d.ts +4 -2
- package/dist/modules/agent/runtime/server/Session.js +61 -57
- package/dist/modules/agent/runtime/server/agentPrompt.d.ts +9 -1
- package/dist/modules/agent/runtime/server/agentPrompt.js +26 -0
- package/dist/modules/agent/runtime/shared/types.d.ts +35 -1
- package/dist/modules/charts/index.d.mts +35 -0
- package/dist/modules/charts/index.mjs +43 -0
- package/dist/modules/charts/runtime/blokkli/skills/charts.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/skills/charts.js +42 -0
- package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +63 -0
- package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +98 -0
- package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.js +86 -0
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.js +74 -0
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.js +42 -0
- package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.js +101 -0
- package/dist/modules/charts/runtime/chartTypes/area.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/area.js +68 -0
- package/dist/modules/charts/runtime/chartTypes/bar.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/bar.js +76 -0
- package/dist/modules/charts/runtime/chartTypes/define.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/define.js +3 -0
- package/dist/modules/charts/runtime/chartTypes/donut.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/donut.js +45 -0
- package/dist/modules/charts/runtime/chartTypes/heatmap.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/heatmap.js +54 -0
- package/dist/modules/charts/runtime/chartTypes/index.d.ts +21 -0
- package/dist/modules/charts/runtime/chartTypes/index.js +47 -0
- package/dist/modules/charts/runtime/chartTypes/line.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/line.js +68 -0
- package/dist/modules/charts/runtime/chartTypes/pie.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/pie.js +28 -0
- package/dist/modules/charts/runtime/chartTypes/radar.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/radar.js +52 -0
- package/dist/modules/charts/runtime/chartTypes/radialBar.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/radialBar.js +44 -0
- package/dist/modules/charts/runtime/chartTypes/shared.d.ts +52 -0
- package/dist/modules/charts/runtime/chartTypes/shared.js +103 -0
- package/dist/modules/charts/runtime/chartTypes/types.d.ts +29 -0
- package/dist/modules/charts/runtime/chartTypes/types.js +0 -0
- package/dist/modules/charts/runtime/components/ChartRenderer/index.d.vue.ts +4 -0
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +120 -0
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue.d.ts +4 -0
- package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.d.vue.ts +3 -0
- package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue +29 -0
- package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue.d.ts +3 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.d.vue.ts +15 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue +97 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue.d.ts +15 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.d.vue.ts +11 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue +34 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue.d.ts +11 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.d.vue.ts +12 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +49 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue.d.ts +12 -0
- package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.d.vue.ts +19 -0
- package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue +90 -0
- package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue.d.ts +19 -0
- package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.d.vue.ts +23 -0
- package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue +224 -0
- package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue.d.ts +23 -0
- package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.d.vue.ts +10 -0
- package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue +61 -0
- package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue.d.ts +10 -0
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.d.vue.ts +8 -0
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue +23 -0
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue.d.ts +8 -0
- package/dist/modules/charts/runtime/features/charts/Editor/index.d.vue.ts +10 -0
- package/dist/modules/charts/runtime/features/charts/Editor/index.vue +243 -0
- package/dist/modules/charts/runtime/features/charts/Editor/index.vue.d.ts +10 -0
- package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +17 -0
- package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.js +90 -0
- package/dist/modules/charts/runtime/features/charts/index.d.vue.ts +3 -0
- package/dist/modules/charts/runtime/features/charts/index.vue +72 -0
- package/dist/modules/charts/runtime/features/charts/index.vue.d.ts +3 -0
- package/dist/modules/charts/runtime/helpers/index.d.ts +1 -0
- package/dist/modules/charts/runtime/helpers/index.js +17 -0
- package/dist/modules/charts/runtime/types.d.ts +51 -0
- package/dist/modules/charts/runtime/types.js +64 -0
- package/dist/modules/drupal/graphql/features/fragments.graphql +2 -0
- package/dist/modules/drupal/index.d.mts +1 -1
- package/dist/modules/drupal/runtime/adapter/index.js +12 -8
- package/dist/modules/table-of-contents/index.d.mts +11 -0
- package/dist/modules/table-of-contents/index.mjs +24 -0
- package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.d.vue.ts +44 -0
- package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue +43 -0
- package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue.d.ts +44 -0
- package/dist/modules/table-of-contents/runtime/types/index.d.ts +4 -0
- package/dist/modules/table-of-contents/runtime/types/index.js +0 -0
- package/dist/runtime/components/Blocks/Fragment/index.vue +6 -2
- package/dist/runtime/components/BlokkliField.d.vue.ts +6 -0
- package/dist/runtime/components/BlokkliField.vue +4 -0
- package/dist/runtime/components/BlokkliField.vue.d.ts +6 -0
- package/dist/runtime/components/BlokkliItem.vue +8 -3
- package/dist/runtime/components/BlokkliProvider.d.vue.ts +7 -0
- package/dist/runtime/components/BlokkliProvider.vue +7 -1
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +7 -0
- package/dist/runtime/composables/useBlokkliHelper.js +4 -2
- package/dist/runtime/editor/components/AnimationCanvas/index.vue +31 -22
- package/dist/runtime/editor/components/Banner/index.d.vue.ts +12 -2
- package/dist/runtime/editor/components/Banner/index.vue +4 -2
- package/dist/runtime/editor/components/Banner/index.vue.d.ts +12 -2
- package/dist/runtime/editor/components/DraggableList.d.vue.ts +2 -0
- package/dist/runtime/editor/components/DraggableList.vue +4 -1
- package/dist/runtime/editor/components/DraggableList.vue.d.ts +2 -0
- package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +27 -0
- package/dist/runtime/editor/components/Dropdown/index.vue +107 -0
- package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +27 -0
- package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue +1 -1
- package/dist/runtime/editor/components/EditProvider.d.vue.ts +2 -0
- package/dist/runtime/editor/components/EditProvider.vue +4 -3
- package/dist/runtime/editor/components/EditProvider.vue.d.ts +2 -0
- package/dist/runtime/editor/components/Form/Radio/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/Form/Radio/index.vue +3 -2
- package/dist/runtime/editor/components/Form/Radio/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/ItemIcon/index.vue +10 -2
- package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +13 -3
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +15 -7
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +13 -3
- package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +2 -0
- package/dist/runtime/editor/components/PreviewProvider.vue +3 -2
- package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +2 -0
- package/dist/runtime/editor/components/ShortcutIndicator/index.vue +1 -1
- package/dist/runtime/editor/components/index.d.ts +3 -1
- package/dist/runtime/editor/components/index.js +4 -0
- package/dist/runtime/editor/composables/onElementResize.js +0 -1
- package/dist/runtime/editor/composables/useEditableFieldOverride.js +4 -5
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/events/index.d.ts +7 -0
- package/dist/runtime/editor/features/add-list/Help/Item.vue +5 -2
- package/dist/runtime/editor/features/artboard/Renderer.vue +1 -1
- package/dist/runtime/editor/features/clipboard/index.vue +1 -1
- package/dist/runtime/editor/features/debug/index.vue +1 -1
- package/dist/runtime/editor/features/dev-mode/index.vue +86 -2
- package/dist/runtime/editor/features/edit/index.vue +20 -0
- package/dist/runtime/editor/features/fragments/types.d.ts +1 -0
- package/dist/runtime/editor/features/hover/Renderer/index.vue +30 -3
- package/dist/runtime/editor/features/hover/index.vue +1 -1
- package/dist/runtime/editor/features/options/Form/Checkbox/index.d.vue.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +3 -3
- package/dist/runtime/editor/features/options/Form/Checkbox/index.vue.d.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Checkboxes/index.d.vue.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +5 -5
- package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue.d.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Item.vue +14 -48
- package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Number/index.d.vue.ts +3 -3
- package/dist/runtime/editor/features/options/Form/Number/index.vue +7 -17
- package/dist/runtime/editor/features/options/Form/Number/index.vue.d.ts +3 -3
- package/dist/runtime/editor/features/options/Form/Range/index.d.vue.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Range/index.vue +4 -4
- package/dist/runtime/editor/features/options/Form/Range/index.vue.d.ts +2 -2
- package/dist/runtime/editor/features/options/Form/index.vue +10 -5
- package/dist/runtime/editor/features/selection/index.vue +2 -2
- package/dist/runtime/editor/features/transform/index.vue +1 -3
- package/dist/runtime/editor/providers/definition.d.ts +2 -2
- package/dist/runtime/editor/providers/definition.js +7 -1
- package/dist/runtime/editor/providers/dom.d.ts +5 -0
- package/dist/runtime/editor/providers/dom.js +11 -2
- package/dist/runtime/editor/providers/fields.d.ts +19 -1
- package/dist/runtime/editor/providers/fields.js +54 -2
- package/dist/runtime/editor/translations/de.json +269 -1
- package/dist/runtime/editor/translations/fr.json +269 -1
- package/dist/runtime/editor/translations/gsw_CH.json +269 -1
- package/dist/runtime/editor/translations/it.json +269 -1
- package/dist/runtime/editor/types/field.d.ts +2 -1
- package/dist/runtime/helpers/imports/index.d.ts +8 -1
- package/dist/runtime/helpers/imports/index.js +15 -6
- package/dist/runtime/helpers/injections.d.ts +10 -1
- package/dist/runtime/helpers/injections.js +6 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +14 -0
- package/dist/runtime/types/definitions.d.ts +8 -5
- package/dist/runtime/types/provider.d.ts +2 -0
- package/dist/shared/editor.6D5vApr0.mjs +30 -0
- package/dist/shared/{editor.DMFfaLVE.mjs → editor.BFIzNSQM.mjs} +1 -30
- package/dist/shared/{editor.Iax3GCvt.d.mts → editor.CWQIFIEQ.d.mts} +22 -0
- package/dist/types.d.mts +1 -1
- package/package.json +17 -1
- package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +0 -104
- /package/dist/modules/agent/runtime/app/tools/{get_available_bundles → get_bundle_info}/index.d.ts +0 -0
- /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.d.vue.ts +0 -0
- /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue.d.ts +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bk-agent-transcript">
|
|
3
|
+
<section class="bk-agent-transcript-section">
|
|
4
|
+
<h3>System Prompts ({{ transcript.system.length }})</h3>
|
|
5
|
+
<details
|
|
6
|
+
v-for="prompt in transcript.system"
|
|
7
|
+
:key="prompt.id"
|
|
8
|
+
class="bk-agent-transcript-entry"
|
|
9
|
+
>
|
|
10
|
+
<summary>{{ prompt.name }}</summary>
|
|
11
|
+
<pre class="bk-agent-transcript-block">{{ prompt.content }}</pre>
|
|
12
|
+
</details>
|
|
13
|
+
</section>
|
|
14
|
+
|
|
15
|
+
<section class="bk-agent-transcript-section">
|
|
16
|
+
<h3>Tools ({{ transcript.tools.length }})</h3>
|
|
17
|
+
<details
|
|
18
|
+
v-for="tool in transcript.tools"
|
|
19
|
+
:key="tool.name"
|
|
20
|
+
class="bk-agent-transcript-entry"
|
|
21
|
+
>
|
|
22
|
+
<summary>{{ tool.name }}</summary>
|
|
23
|
+
<div class="bk-agent-transcript-block">
|
|
24
|
+
<p>{{ tool.description }}</p>
|
|
25
|
+
<pre>{{ JSON.stringify(tool.input_schema, null, 2) }}</pre>
|
|
26
|
+
</div>
|
|
27
|
+
</details>
|
|
28
|
+
</section>
|
|
29
|
+
|
|
30
|
+
<section class="bk-agent-transcript-section">
|
|
31
|
+
<h3>Messages ({{ transcript.messages.length }})</h3>
|
|
32
|
+
<div
|
|
33
|
+
v-for="(message, i) in transcript.messages"
|
|
34
|
+
:key="i"
|
|
35
|
+
class="bk-agent-transcript-message"
|
|
36
|
+
>
|
|
37
|
+
<div class="bk-agent-transcript-role">
|
|
38
|
+
{{ message.type === "agent" ? "AGENT" : "USER" }}
|
|
39
|
+
<span v-if="message.full" class="bk-agent-transcript-pruned"
|
|
40
|
+
>(pruned)</span
|
|
41
|
+
>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="bk-agent-transcript-content">
|
|
44
|
+
<template v-if="typeof message.seen === 'string'">
|
|
45
|
+
<pre class="bk-agent-transcript-block">{{ message.seen }}</pre>
|
|
46
|
+
</template>
|
|
47
|
+
<template v-else>
|
|
48
|
+
<div
|
|
49
|
+
v-for="(block, j) in message.seen"
|
|
50
|
+
:key="j"
|
|
51
|
+
class="bk-agent-transcript-block"
|
|
52
|
+
>
|
|
53
|
+
<template v-if="block.type === 'text'">
|
|
54
|
+
<pre>{{ block.text }}</pre>
|
|
55
|
+
</template>
|
|
56
|
+
<template v-else-if="block.type === 'skill'">
|
|
57
|
+
<div class="bk-agent-transcript-label">
|
|
58
|
+
Skill: {{ block.name }}
|
|
59
|
+
</div>
|
|
60
|
+
<pre>{{ block.text }}</pre>
|
|
61
|
+
</template>
|
|
62
|
+
<template v-else-if="block.type === 'tool_use'">
|
|
63
|
+
<div class="bk-agent-transcript-label">
|
|
64
|
+
Tool Use: {{ block.name }} ({{ block.id }})
|
|
65
|
+
</div>
|
|
66
|
+
<pre>{{ JSON.stringify(block.input, null, 2) }}</pre>
|
|
67
|
+
</template>
|
|
68
|
+
<template v-else-if="block.type === 'tool_result'">
|
|
69
|
+
<div class="bk-agent-transcript-label">
|
|
70
|
+
Tool Result ({{ block.tool_use_id }})
|
|
71
|
+
<span v-if="block.is_error" class="bk-agent-transcript-error"
|
|
72
|
+
>ERROR</span
|
|
73
|
+
>
|
|
74
|
+
</div>
|
|
75
|
+
<pre>{{ block.content }}</pre>
|
|
76
|
+
</template>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<details v-if="message.full" class="bk-agent-transcript-entry">
|
|
82
|
+
<summary>Original (before pruning)</summary>
|
|
83
|
+
<div class="bk-agent-transcript-content">
|
|
84
|
+
<template v-if="typeof message.full === 'string'">
|
|
85
|
+
<pre class="bk-agent-transcript-block">{{ message.full }}</pre>
|
|
86
|
+
</template>
|
|
87
|
+
<template v-else>
|
|
88
|
+
<div
|
|
89
|
+
v-for="(block, j) in message.full"
|
|
90
|
+
:key="j"
|
|
91
|
+
class="bk-agent-transcript-block"
|
|
92
|
+
>
|
|
93
|
+
<template v-if="block.type === 'text'">
|
|
94
|
+
<pre>{{ block.text }}</pre>
|
|
95
|
+
</template>
|
|
96
|
+
<template v-else-if="block.type === 'skill'">
|
|
97
|
+
<div class="bk-agent-transcript-label">
|
|
98
|
+
Skill: {{ block.name }}
|
|
99
|
+
</div>
|
|
100
|
+
<pre>{{ block.text }}</pre>
|
|
101
|
+
</template>
|
|
102
|
+
<template v-else-if="block.type === 'tool_use'">
|
|
103
|
+
<div class="bk-agent-transcript-label">
|
|
104
|
+
Tool Use: {{ block.name }} ({{ block.id }})
|
|
105
|
+
</div>
|
|
106
|
+
<pre>{{ JSON.stringify(block.input, null, 2) }}</pre>
|
|
107
|
+
</template>
|
|
108
|
+
<template v-else-if="block.type === 'tool_result'">
|
|
109
|
+
<div class="bk-agent-transcript-label">
|
|
110
|
+
Tool Result ({{ block.tool_use_id }})
|
|
111
|
+
<span
|
|
112
|
+
v-if="block.is_error"
|
|
113
|
+
class="bk-agent-transcript-error"
|
|
114
|
+
>ERROR</span
|
|
115
|
+
>
|
|
116
|
+
</div>
|
|
117
|
+
<pre>{{ block.content }}</pre>
|
|
118
|
+
</template>
|
|
119
|
+
</div>
|
|
120
|
+
</template>
|
|
121
|
+
</div>
|
|
122
|
+
</details>
|
|
123
|
+
</div>
|
|
124
|
+
</section>
|
|
125
|
+
</div>
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<script setup>
|
|
129
|
+
defineProps({
|
|
130
|
+
transcript: { type: Object, required: true }
|
|
131
|
+
});
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<script>
|
|
135
|
+
export default {
|
|
136
|
+
name: "AgentTranscript"
|
|
137
|
+
};
|
|
138
|
+
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Transcript } from '#blokkli/agent/shared/types';
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<{
|
|
5
|
+
transcript: Transcript;
|
|
6
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
7
|
+
transcript: Transcript;
|
|
8
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -58,7 +58,10 @@
|
|
|
58
58
|
full-screen
|
|
59
59
|
@cancel="showTranscript = false"
|
|
60
60
|
>
|
|
61
|
-
<
|
|
61
|
+
<AgentTranscript
|
|
62
|
+
v-if="transcriptContent"
|
|
63
|
+
:transcript="transcriptContent"
|
|
64
|
+
/>
|
|
62
65
|
</DialogModal>
|
|
63
66
|
</BlokkliTransition>
|
|
64
67
|
</Teleport>
|
|
@@ -71,6 +74,7 @@ import { DialogModal, BlokkliTransition } from "#blokkli/editor/components";
|
|
|
71
74
|
import agentProvider from "#blokkli/agent/app/composables/agentProvider";
|
|
72
75
|
import { agentPrompts, agentName } from "#blokkli-build/agent-client";
|
|
73
76
|
import AgentPanel from "./Panel/index.vue";
|
|
77
|
+
import AgentTranscript from "./Transcript/index.vue";
|
|
74
78
|
import { defineItemDropdownAction } from "#blokkli/editor/composables";
|
|
75
79
|
const DEBUG_STYLING = false;
|
|
76
80
|
const { adapter } = defineBlokkliFeature({
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import { getAvailableOptions } from "#blokkli/editor/helpers/options";
|
|
4
|
+
import { getRuntimeOptionValue } from "#blokkli/runtime-helpers";
|
|
5
|
+
import { blockOptionsMapSchema, extractOptionLabels } from "../schemas.js";
|
|
6
|
+
const paramsSchema = z.object({
|
|
7
|
+
parentUuid: z.string().describe("The parent entity UUID"),
|
|
8
|
+
field: z.string().describe("The field name"),
|
|
9
|
+
bundles: z.array(z.string()).optional().describe(
|
|
10
|
+
"Optional list of bundle names to filter by. If omitted, returns all allowed bundles."
|
|
11
|
+
)
|
|
12
|
+
});
|
|
13
|
+
const bundleSchema = z.object({
|
|
14
|
+
bundle: z.string().describe("The paragraph type identifier"),
|
|
15
|
+
label: z.string().describe("Human-readable label"),
|
|
16
|
+
description: z.string().optional().describe("Bundle description if available"),
|
|
17
|
+
contentFields: z.record(
|
|
18
|
+
z.string(),
|
|
19
|
+
z.object({
|
|
20
|
+
type: z.string().describe("Field type: plain, markup, reference, or link")
|
|
21
|
+
})
|
|
22
|
+
).describe(
|
|
23
|
+
"Content fields (text, media, links) on this bundle, keyed by field name"
|
|
24
|
+
),
|
|
25
|
+
paragraphFields: z.record(
|
|
26
|
+
z.string(),
|
|
27
|
+
z.object({
|
|
28
|
+
label: z.string().describe("Human-readable label"),
|
|
29
|
+
allowedBundles: z.array(z.string()).describe("Paragraph types allowed in this field"),
|
|
30
|
+
cardinality: z.number().describe("Max paragraphs allowed (-1 = unlimited)")
|
|
31
|
+
})
|
|
32
|
+
).describe(
|
|
33
|
+
"Paragraph fields (for nested paragraphs) on this bundle, keyed by field name"
|
|
34
|
+
),
|
|
35
|
+
options: blockOptionsMapSchema.optional().describe(
|
|
36
|
+
"Available options for this bundle with their default values (only included when few bundles are returned)"
|
|
37
|
+
)
|
|
38
|
+
});
|
|
39
|
+
const resultSchema = z.object({
|
|
40
|
+
fieldLabel: z.string().describe("Human-readable field label"),
|
|
41
|
+
cardinality: z.number().describe("Max paragraphs allowed (-1 = unlimited)"),
|
|
42
|
+
currentCount: z.number().describe("Current number of paragraphs in the field"),
|
|
43
|
+
bundles: z.array(bundleSchema).describe("Available paragraph types"),
|
|
44
|
+
nestingInfo: z.string().optional().describe(
|
|
45
|
+
"Summary of which bundles have paragraph fields for nested paragraphs. Use get_child_paragraphs after adding these bundles to populate their nested fields."
|
|
46
|
+
)
|
|
47
|
+
});
|
|
48
|
+
export default defineBlokkliAgentTool({
|
|
49
|
+
name: "get_bundle_info",
|
|
50
|
+
description: "Get detailed information about which paragraph types can be added to a specific field, including their content fields and paragraph fields (for nested paragraphs).",
|
|
51
|
+
category: "query",
|
|
52
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
53
|
+
label($t) {
|
|
54
|
+
return $t("aiAgentGetBundleInfoRunning", "Getting bundle info...");
|
|
55
|
+
},
|
|
56
|
+
paramsSchema,
|
|
57
|
+
resultSchema,
|
|
58
|
+
execute(ctx, params) {
|
|
59
|
+
const { fields, types, state, definitions, $t } = ctx.app;
|
|
60
|
+
const label = $t(
|
|
61
|
+
"aiAgentGetBundleInfoDone",
|
|
62
|
+
"Got bundle info for @field"
|
|
63
|
+
).replace("@field", params.field);
|
|
64
|
+
const field = fields.find(params.parentUuid, params.field);
|
|
65
|
+
if (!field) {
|
|
66
|
+
return {
|
|
67
|
+
label,
|
|
68
|
+
result: {
|
|
69
|
+
fieldLabel: params.field,
|
|
70
|
+
cardinality: -1,
|
|
71
|
+
currentCount: 0,
|
|
72
|
+
bundles: []
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const fieldKey = `${params.parentUuid}:${params.field}`;
|
|
77
|
+
const currentCount = state.getFieldBlockCount(fieldKey);
|
|
78
|
+
const allowedBundles = params.bundles ? field.allowedBundles.filter((b) => params.bundles.includes(b)) : field.allowedBundles;
|
|
79
|
+
const includeOptions = allowedBundles.length < 3;
|
|
80
|
+
const bundles = allowedBundles.map((bundle) => {
|
|
81
|
+
const bundleDefinition = types.getBlockBundleDefinition(bundle);
|
|
82
|
+
const contentFields = {};
|
|
83
|
+
for (const c of types.editableFieldConfig.forEntityTypeAndBundle(ctx.itemEntityType, bundle).filter((c2) => c2.type !== "table")) {
|
|
84
|
+
contentFields[c.name] = {
|
|
85
|
+
type: c.type === "frame" || c.type === "markup" ? "markup" : "plain"
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
for (const c of types.droppableFieldConfig.forEntityTypeAndBundle(
|
|
89
|
+
ctx.itemEntityType,
|
|
90
|
+
bundle
|
|
91
|
+
)) {
|
|
92
|
+
contentFields[c.name] = { type: c.type };
|
|
93
|
+
}
|
|
94
|
+
const paragraphFields = {};
|
|
95
|
+
for (const c of types.fieldConfig.forEntityTypeAndBundle(
|
|
96
|
+
ctx.itemEntityType,
|
|
97
|
+
bundle
|
|
98
|
+
)) {
|
|
99
|
+
paragraphFields[c.name] = {
|
|
100
|
+
label: c.label,
|
|
101
|
+
allowedBundles: c.allowedBundles,
|
|
102
|
+
cardinality: c.cardinality
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
let options;
|
|
106
|
+
if (includeOptions) {
|
|
107
|
+
const definition = definitions.getBlockDefinition(bundle, "default");
|
|
108
|
+
if (definition) {
|
|
109
|
+
const availableOptions = getAvailableOptions(
|
|
110
|
+
definition.options,
|
|
111
|
+
definition.globalOptions,
|
|
112
|
+
definitions.globalOptions.value
|
|
113
|
+
);
|
|
114
|
+
if (availableOptions.length > 0) {
|
|
115
|
+
options = {};
|
|
116
|
+
for (const opt of availableOptions) {
|
|
117
|
+
const currentValue = getRuntimeOptionValue(
|
|
118
|
+
opt.option,
|
|
119
|
+
opt.option.default
|
|
120
|
+
);
|
|
121
|
+
const entry = {
|
|
122
|
+
type: opt.option.type,
|
|
123
|
+
label: opt.option.label,
|
|
124
|
+
currentValue
|
|
125
|
+
};
|
|
126
|
+
if (opt.option.description) {
|
|
127
|
+
entry.description = opt.option.description;
|
|
128
|
+
}
|
|
129
|
+
const labels = extractOptionLabels(opt.option);
|
|
130
|
+
if (labels) {
|
|
131
|
+
entry.options = labels;
|
|
132
|
+
}
|
|
133
|
+
if ("min" in opt.option) {
|
|
134
|
+
entry.min = opt.option.min;
|
|
135
|
+
}
|
|
136
|
+
if ("max" in opt.option) {
|
|
137
|
+
entry.max = opt.option.max;
|
|
138
|
+
}
|
|
139
|
+
if ("step" in opt.option && opt.option.type === "range") {
|
|
140
|
+
entry.step = opt.option.step;
|
|
141
|
+
}
|
|
142
|
+
options[opt.property] = entry;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
bundle,
|
|
149
|
+
label: bundleDefinition?.label ?? bundle,
|
|
150
|
+
description: bundleDefinition?.description,
|
|
151
|
+
contentFields,
|
|
152
|
+
paragraphFields,
|
|
153
|
+
options
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
const nestingBundles = bundles.filter(
|
|
157
|
+
(b) => Object.keys(b.paragraphFields).length > 0
|
|
158
|
+
);
|
|
159
|
+
const nestingInfo = nestingBundles.length ? nestingBundles.map(
|
|
160
|
+
(b) => `${b.bundle} has paragraph fields: ${Object.entries(
|
|
161
|
+
b.paragraphFields
|
|
162
|
+
).map(([name, f]) => `${name} (${f.allowedBundles.join(", ")})`).join(", ")}`
|
|
163
|
+
).join("; ") : void 0;
|
|
164
|
+
return {
|
|
165
|
+
label,
|
|
166
|
+
result: {
|
|
167
|
+
fieldLabel: field.label,
|
|
168
|
+
cardinality: field.cardinality,
|
|
169
|
+
currentCount,
|
|
170
|
+
bundles,
|
|
171
|
+
nestingInfo
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
buildBlockOptionsMap
|
|
7
7
|
} from "../schemas.js";
|
|
8
8
|
import { getAvailableOptions } from "#blokkli/editor/helpers/options";
|
|
9
|
+
import { fragmentBlockBundle } from "#blokkli-build/config";
|
|
9
10
|
const paramsSchema = z.object({
|
|
10
11
|
uuid: z.string().describe("The paragraph UUID"),
|
|
11
12
|
includeParentChain: z.boolean().optional().default(true).describe("Include ancestor parent paragraphs up to the page"),
|
|
@@ -77,6 +78,7 @@ const resultSchema = z.object({
|
|
|
77
78
|
uuid: z.string().describe("The paragraph UUID"),
|
|
78
79
|
bundle: z.string().describe("The paragraph type"),
|
|
79
80
|
label: z.string().describe("Human-readable paragraph label"),
|
|
81
|
+
fragmentName: z.string().optional().describe("The fragment name, if this paragraph is a fragment block"),
|
|
80
82
|
nestingLevel: z.number().describe("Nesting depth (0 = root level)"),
|
|
81
83
|
parent: parentSchema.nullable().describe("The parent entity containing this paragraph"),
|
|
82
84
|
parentChain: z.array(parentChainItemSchema).optional().describe("Ancestor parent paragraphs from immediate parent to page"),
|
|
@@ -132,6 +134,9 @@ export default defineBlokkliAgentTool({
|
|
|
132
134
|
nestingLevel: state.getNestingLevel(params.uuid),
|
|
133
135
|
parent
|
|
134
136
|
};
|
|
137
|
+
if (block.bundle === fragmentBlockBundle && block.fragment?.name) {
|
|
138
|
+
result.fragmentName = block.fragment.name;
|
|
139
|
+
}
|
|
135
140
|
if (params.includeParentChain) {
|
|
136
141
|
const parentChain = [];
|
|
137
142
|
let currentUuid = state.getParentEntityUuid(params.uuid);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { OptionItem } from '#blokkli/editor/helpers/options';
|
|
3
3
|
import type { BlokkliApp } from '#blokkli/editor/types/app';
|
|
4
|
+
/**
|
|
5
|
+
* Extract a simple key→label map from the various radios/checkboxes option formats.
|
|
6
|
+
* Handles plain strings, icon objects, color objects, grid objects, etc.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractOptionLabels(option: Record<string, unknown>): Record<string, string> | undefined;
|
|
4
9
|
/**
|
|
5
10
|
* Shared schema for a single block option with its current value.
|
|
6
11
|
*/
|
|
@@ -32,6 +37,10 @@ export type BlockOptionsMap = z.infer<typeof blockOptionsMapSchema>;
|
|
|
32
37
|
* Build a block options map from available options and mutated state.
|
|
33
38
|
*/
|
|
34
39
|
export declare function buildBlockOptionsMap(availableOptions: OptionItem[], mutatedOptions: Record<string, Record<string, string>>, uuid: string): BlockOptionsMap;
|
|
40
|
+
/**
|
|
41
|
+
* Build a block options map from option definitions, using defaults as current values.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildBlockOptionsMapFromDefinitions(options: Record<string, Record<string, unknown>>): BlockOptionsMap;
|
|
35
44
|
/**
|
|
36
45
|
* Schema for a parent entity (the container of a block).
|
|
37
46
|
* A parent is an entity + field combination where blocks can be placed.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { getMutatedOptionValue } from "#blokkli/editor/helpers/options";
|
|
3
3
|
import { getRuntimeOptionValue } from "#blokkli/runtime-helpers";
|
|
4
|
-
function extractOptionLabels(option) {
|
|
4
|
+
export function extractOptionLabels(option) {
|
|
5
5
|
if (!("options" in option) || !option.options) return void 0;
|
|
6
6
|
const raw = option.options;
|
|
7
7
|
const labels = {};
|
|
@@ -42,31 +42,44 @@ export function buildBlockOptionsMap(availableOptions, mutatedOptions, uuid) {
|
|
|
42
42
|
opt.option.default
|
|
43
43
|
);
|
|
44
44
|
const currentValue = getRuntimeOptionValue(opt.option, rawValue);
|
|
45
|
-
|
|
46
|
-
type: opt.option.type,
|
|
47
|
-
label: opt.option.label,
|
|
48
|
-
currentValue
|
|
49
|
-
};
|
|
50
|
-
if (opt.option.description) {
|
|
51
|
-
entry.description = opt.option.description;
|
|
52
|
-
}
|
|
53
|
-
const labels = extractOptionLabels(opt.option);
|
|
54
|
-
if (labels) {
|
|
55
|
-
entry.options = labels;
|
|
56
|
-
}
|
|
57
|
-
if ("min" in opt.option) {
|
|
58
|
-
entry.min = opt.option.min;
|
|
59
|
-
}
|
|
60
|
-
if ("max" in opt.option) {
|
|
61
|
-
entry.max = opt.option.max;
|
|
62
|
-
}
|
|
63
|
-
if ("step" in opt.option && opt.option.type === "range") {
|
|
64
|
-
entry.step = opt.option.step;
|
|
65
|
-
}
|
|
66
|
-
result[opt.property] = entry;
|
|
45
|
+
result[opt.property] = buildBlockOptionEntry(opt.option, currentValue);
|
|
67
46
|
}
|
|
68
47
|
return result;
|
|
69
48
|
}
|
|
49
|
+
export function buildBlockOptionsMapFromDefinitions(options) {
|
|
50
|
+
const result = {};
|
|
51
|
+
for (const [key, opt] of Object.entries(options)) {
|
|
52
|
+
result[key] = buildBlockOptionEntry(
|
|
53
|
+
opt,
|
|
54
|
+
opt.default
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
function buildBlockOptionEntry(opt, currentValue) {
|
|
60
|
+
const entry = {
|
|
61
|
+
type: opt.type,
|
|
62
|
+
label: opt.label,
|
|
63
|
+
currentValue
|
|
64
|
+
};
|
|
65
|
+
if (opt.description) {
|
|
66
|
+
entry.description = opt.description;
|
|
67
|
+
}
|
|
68
|
+
const labels = extractOptionLabels(opt);
|
|
69
|
+
if (labels) {
|
|
70
|
+
entry.options = labels;
|
|
71
|
+
}
|
|
72
|
+
if ("min" in opt) {
|
|
73
|
+
entry.min = opt.min;
|
|
74
|
+
}
|
|
75
|
+
if ("max" in opt) {
|
|
76
|
+
entry.max = opt.max;
|
|
77
|
+
}
|
|
78
|
+
if ("step" in opt && opt.type === "range") {
|
|
79
|
+
entry.step = opt.step;
|
|
80
|
+
}
|
|
81
|
+
return entry;
|
|
82
|
+
}
|
|
70
83
|
export const parentSchema = z.object({
|
|
71
84
|
type: z.string().describe(
|
|
72
85
|
"The entity type of the parent. Do NOT guess this - always use the parent object returned by get_child_paragraphs."
|
|
@@ -28,8 +28,10 @@ export declare class Session {
|
|
|
28
28
|
pendingPlanApproval: {
|
|
29
29
|
resolve: (approved: boolean) => void;
|
|
30
30
|
} | null;
|
|
31
|
-
/**
|
|
32
|
-
private
|
|
31
|
+
/** Pre-pruned messages snapshot for transcript (captured before pruneMessages) */
|
|
32
|
+
private unprunedMessages;
|
|
33
|
+
/** Last generic tool definitions for transcript */
|
|
34
|
+
private lastTools;
|
|
33
35
|
init(tools: ClientToolDefinition[], pageContext: PageContext): void;
|
|
34
36
|
start(peer: Peer, prompt: string, apiKey: string, authSecret: string, selectedUuids?: string[]): void;
|
|
35
37
|
resolveToolResult(callId: string, result: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildSystemPrompt,
|
|
1
|
+
import { buildSystemPrompt, buildSystemPromptEntries } from "./agentPrompt.js";
|
|
2
2
|
import { provider, models } from "#blokkli-build/agent-server";
|
|
3
3
|
import {
|
|
4
4
|
send,
|
|
@@ -42,8 +42,10 @@ export class Session {
|
|
|
42
42
|
plan = null;
|
|
43
43
|
/** Pending plan approval promise resolver */
|
|
44
44
|
pendingPlanApproval = null;
|
|
45
|
-
/**
|
|
46
|
-
|
|
45
|
+
/** Pre-pruned messages snapshot for transcript (captured before pruneMessages) */
|
|
46
|
+
unprunedMessages = [];
|
|
47
|
+
/** Last generic tool definitions for transcript */
|
|
48
|
+
lastTools = [];
|
|
47
49
|
// --------------------------------------------------------------------------
|
|
48
50
|
// Public methods
|
|
49
51
|
// --------------------------------------------------------------------------
|
|
@@ -110,12 +112,14 @@ export class Session {
|
|
|
110
112
|
getTranscript(peer) {
|
|
111
113
|
send(peer, {
|
|
112
114
|
type: "transcript",
|
|
113
|
-
|
|
115
|
+
transcript: this.buildTranscript()
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
118
|
newConversation(peer, authSecret) {
|
|
117
119
|
this.abortController?.abort();
|
|
118
120
|
this.messages = [];
|
|
121
|
+
this.unprunedMessages = [];
|
|
122
|
+
this.lastTools = [];
|
|
119
123
|
this.activatedLazyTools.clear();
|
|
120
124
|
this.loadedSkills.clear();
|
|
121
125
|
this.plan = null;
|
|
@@ -182,6 +186,8 @@ export class Session {
|
|
|
182
186
|
return { success: false, reason: "Invalid message structure" };
|
|
183
187
|
}
|
|
184
188
|
this.messages = state.messages;
|
|
189
|
+
this.unprunedMessages = [];
|
|
190
|
+
this.lastTools = [];
|
|
185
191
|
const validLazyToolNames = new Set(this.lazyTools.map((t) => t.name));
|
|
186
192
|
this.activatedLazyTools = new Set(
|
|
187
193
|
state.activatedLazyTools.filter((name) => validLazyToolNames.has(name))
|
|
@@ -273,6 +279,9 @@ export class Session {
|
|
|
273
279
|
let planRetryCount = 0;
|
|
274
280
|
let streamRetryCount = 0;
|
|
275
281
|
const MAX_STREAM_RETRIES = 1;
|
|
282
|
+
let lastToolCallKey = "";
|
|
283
|
+
let consecutiveIdenticalCalls = 0;
|
|
284
|
+
const MAX_IDENTICAL_CALLS = 2;
|
|
276
285
|
try {
|
|
277
286
|
while (true) {
|
|
278
287
|
if (this.abortController.signal.aborted) {
|
|
@@ -299,6 +308,7 @@ export class Session {
|
|
|
299
308
|
};
|
|
300
309
|
const serverToolDefs = serverTools.map((t) => buildDefinition(t, defCtx)).filter((d) => d !== null);
|
|
301
310
|
const allTools = [...serverToolDefs, ...this.tools, ...activatedTools];
|
|
311
|
+
this.lastTools = allTools;
|
|
302
312
|
const systemPrompt = buildSystemPrompt(
|
|
303
313
|
this.pageContext,
|
|
304
314
|
resolvedSkills,
|
|
@@ -326,7 +336,6 @@ export class Session {
|
|
|
326
336
|
}
|
|
327
337
|
switch (event.type) {
|
|
328
338
|
case "debug_request":
|
|
329
|
-
this.lastProviderTools = event.tools;
|
|
330
339
|
break;
|
|
331
340
|
case "text_start":
|
|
332
341
|
inTextBlock = true;
|
|
@@ -392,6 +401,25 @@ export class Session {
|
|
|
392
401
|
name: currentToolUse.name,
|
|
393
402
|
input
|
|
394
403
|
});
|
|
404
|
+
const toolCallKey = currentToolUse.name + ":" + currentToolUse.inputJson;
|
|
405
|
+
if (toolCallKey === lastToolCallKey) {
|
|
406
|
+
consecutiveIdenticalCalls++;
|
|
407
|
+
} else {
|
|
408
|
+
lastToolCallKey = toolCallKey;
|
|
409
|
+
consecutiveIdenticalCalls = 1;
|
|
410
|
+
}
|
|
411
|
+
if (consecutiveIdenticalCalls > MAX_IDENTICAL_CALLS) {
|
|
412
|
+
toolResults.push({
|
|
413
|
+
type: "tool_result",
|
|
414
|
+
tool_use_id: currentToolUse.id,
|
|
415
|
+
content: JSON.stringify({
|
|
416
|
+
error: `You have called "${currentToolUse.name}" ${consecutiveIdenticalCalls} times in a row with identical parameters and received the same result each time. Stop repeating this call. Use the information you already have or try a different approach.`
|
|
417
|
+
}),
|
|
418
|
+
is_error: true
|
|
419
|
+
});
|
|
420
|
+
currentToolUse = null;
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
395
423
|
const matchedServerTool = serverTools.find(
|
|
396
424
|
(t) => t.name === currentToolUse.name
|
|
397
425
|
);
|
|
@@ -600,6 +628,7 @@ export class Session {
|
|
|
600
628
|
} finally {
|
|
601
629
|
this.isProcessing = false;
|
|
602
630
|
this.abortController = null;
|
|
631
|
+
this.unprunedMessages = structuredClone(this.messages);
|
|
603
632
|
pruneMessages(
|
|
604
633
|
this.messages,
|
|
605
634
|
KEEP_RECENT_TURNS,
|
|
@@ -674,61 +703,36 @@ export class Session {
|
|
|
674
703
|
return map;
|
|
675
704
|
}
|
|
676
705
|
buildTranscript() {
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
const lazyToolSummaries = this.lazyTools.map((t) => ({
|
|
706
|
+
const system = this.pageContext ? buildSystemPromptEntries(
|
|
707
|
+
this.pageContext,
|
|
708
|
+
resolveSkills(this.pageContext),
|
|
709
|
+
this.lazyTools.map((t) => ({
|
|
682
710
|
name: t.name,
|
|
683
711
|
description: t.description
|
|
684
|
-
}))
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
lines.push("TOOLS (exact payload sent to provider)");
|
|
700
|
-
lines.push("=".repeat(80));
|
|
701
|
-
lines.push(JSON.stringify(this.lastProviderTools, null, 2));
|
|
702
|
-
lines.push("");
|
|
703
|
-
}
|
|
704
|
-
for (const message of this.messages) {
|
|
705
|
-
lines.push("=".repeat(80));
|
|
706
|
-
lines.push(`${message.role.toUpperCase()}`);
|
|
707
|
-
lines.push("=".repeat(80));
|
|
708
|
-
if (typeof message.content === "string") {
|
|
709
|
-
lines.push(message.content);
|
|
710
|
-
} else if (Array.isArray(message.content)) {
|
|
711
|
-
for (const block of message.content) {
|
|
712
|
-
if (block.type === "text") {
|
|
713
|
-
lines.push(block.text);
|
|
714
|
-
} else if (block.type === "skill") {
|
|
715
|
-
lines.push(`[Skill: ${block.name}]`);
|
|
716
|
-
lines.push(block.text);
|
|
717
|
-
} else if (block.type === "tool_use") {
|
|
718
|
-
lines.push(`[Tool Call: ${block.name}]`);
|
|
719
|
-
lines.push(JSON.stringify(block.input, null, 2));
|
|
720
|
-
} else if (block.type === "tool_result") {
|
|
721
|
-
lines.push(`[Tool Result: ${block.tool_use_id}]`);
|
|
722
|
-
try {
|
|
723
|
-
lines.push(JSON.stringify(JSON.parse(block.content), null, 2));
|
|
724
|
-
} catch {
|
|
725
|
-
lines.push(block.content);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
712
|
+
})),
|
|
713
|
+
this.getActivePlanContext(),
|
|
714
|
+
this.loadedSkills
|
|
715
|
+
) : [];
|
|
716
|
+
const messages = this.messages.map((msg, i) => {
|
|
717
|
+
const entry = {
|
|
718
|
+
type: msg.role === "assistant" ? "agent" : "user",
|
|
719
|
+
seen: msg.content
|
|
720
|
+
};
|
|
721
|
+
const unpruned = this.unprunedMessages[i];
|
|
722
|
+
if (unpruned) {
|
|
723
|
+
const seenJson = JSON.stringify(msg.content);
|
|
724
|
+
const fullJson = JSON.stringify(unpruned.content);
|
|
725
|
+
if (seenJson !== fullJson) {
|
|
726
|
+
entry.full = unpruned.content;
|
|
728
727
|
}
|
|
729
728
|
}
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
|
|
729
|
+
return entry;
|
|
730
|
+
});
|
|
731
|
+
const tools = this.lastTools.map((t) => ({
|
|
732
|
+
name: t.name,
|
|
733
|
+
description: t.description,
|
|
734
|
+
input_schema: t.input_schema
|
|
735
|
+
}));
|
|
736
|
+
return { system, messages, tools };
|
|
733
737
|
}
|
|
734
738
|
}
|