@circuitwall/jarela 0.9.3 → 0.10.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +2 -2
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +2 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +72 -5
- package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/route.js +2 -2
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +2 -2
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +136 -26
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.map +1 -1
- package/.next/standalone/.next/server/app/api/v1/tools/route.js +2 -2
- package/.next/standalone/.next/server/app/index.html +2 -2
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page.js +266 -40
- package/.next/standalone/.next/server/app/page.js.map +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup.html +1 -1
- package/.next/standalone/.next/server/app/setup.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/setup.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/setup/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/setup.segments/setup.segment.rsc +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +2 -2
- package/.next/standalone/.next/server/chunks/210.js +1 -1
- package/.next/standalone/.next/server/chunks/2151.js +60 -2
- package/.next/standalone/.next/server/chunks/2151.js.map +1 -1
- package/.next/standalone/.next/server/chunks/614.js +336 -93
- package/.next/standalone/.next/server/chunks/614.js.map +1 -1
- package/.next/standalone/.next/server/chunks/6765.js +35 -0
- package/.next/standalone/.next/server/chunks/6765.js.map +1 -1
- package/.next/standalone/.next/server/chunks/8697.js +15246 -15002
- package/.next/standalone/.next/server/chunks/8697.js.map +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
- package/.next/standalone/.next/server/pages/404.html +2 -2
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/{3741-344e2bfc5028b9c8.js → 3741-2d64471ff763b8fa.js} +36 -1
- package/.next/standalone/.next/static/chunks/3741-2d64471ff763b8fa.js.map +1 -0
- package/.next/standalone/.next/static/chunks/app/{page-c77ab600642bbfc2.js → page-318743bf47fac345.js} +267 -41
- package/.next/standalone/.next/static/chunks/app/page-318743bf47fac345.js.map +1 -0
- package/.next/standalone/.next/static/css/b6b85b0f13bc0e98.css +5 -0
- package/.next/standalone/.next/static/css/b6b85b0f13bc0e98.css.map +1 -0
- package/.next/standalone/package.json +1 -1
- package/CHANGELOG.md +48 -0
- package/README.md +2 -0
- package/api/client.ts +37 -1
- package/api/types.ts +18 -0
- package/app/api/v1/threads/[thread_id]/run/route.ts +69 -22
- package/components/agents/AgentEditor.tsx +7 -4
- package/components/chat/MessageBubble.tsx +108 -1
- package/components/dashboard/DashboardPanel.tsx +79 -21
- package/hooks/useSSE.ts +22 -9
- package/lib/agents/prepare/system-prompt.ts +30 -0
- package/lib/agents/run-registry.test.ts +94 -0
- package/lib/agents/run-registry.ts +60 -1
- package/lib/stores/dashboard-metrics.test.ts +33 -0
- package/lib/stores/dashboard-metrics.ts +93 -1
- package/lib/tools/exec.ts +9 -5
- package/lib/tools/files.ts +6 -0
- package/lib/tools/safety.test.ts +95 -0
- package/lib/tools/safety.ts +147 -0
- package/package.json +1 -1
- package/.next/standalone/.next/static/chunks/3741-344e2bfc5028b9c8.js.map +0 -1
- package/.next/standalone/.next/static/chunks/app/page-c77ab600642bbfc2.js.map +0 -1
- package/.next/standalone/.next/static/css/53f85613a5500253.css +0 -5
- package/.next/standalone/.next/static/css/53f85613a5500253.css.map +0 -1
- /package/.next/standalone/.next/static/{6uLoytvvEtLKIblEB53e0 → 8qTBpUDFnSMYwe3Zc0bGV}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{6uLoytvvEtLKIblEB53e0 → 8qTBpUDFnSMYwe3Zc0bGV}/_ssgManifest.js +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
2:I[7121,[],""]
|
|
3
3
|
3:I[4581,[],""]
|
|
4
4
|
4:[]
|
|
5
|
-
0:{"rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"isPartial":false,"staleTime":300,"varyParams":"$W4","buildId":"
|
|
5
|
+
0:{"rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"isPartial":false,"staleTime":300,"varyParams":"$W4","buildId":"8qTBpUDFnSMYwe3Zc0bGV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
:HL["/_next/static/css/
|
|
2
|
-
0:{"tree":{"name":"","param":null,"prefetchHints":16,"slots":{"children":{"name":"_not-found","param":null,"prefetchHints":0,"slots":{"children":{"name":"__PAGE__","param":null,"prefetchHints":0,"slots":null}}}}},"staleTime":300,"buildId":"
|
|
1
|
+
:HL["/_next/static/css/b6b85b0f13bc0e98.css","style"]
|
|
2
|
+
0:{"tree":{"name":"","param":null,"prefetchHints":16,"slots":{"children":{"name":"_not-found","param":null,"prefetchHints":0,"slots":{"children":{"name":"__PAGE__","param":null,"prefetchHints":0,"slots":null}}}}},"staleTime":300,"buildId":"8qTBpUDFnSMYwe3Zc0bGV"}
|
|
@@ -619,7 +619,11 @@ async function getDashboardMetrics(days = DEFAULT_WINDOW_DAYS) {
|
|
|
619
619
|
mu.model_id AS mu_model_id,
|
|
620
620
|
mu.model_config_name AS mu_model_config_name,
|
|
621
621
|
mu.agent_id AS mu_agent_id,
|
|
622
|
-
mu.agent_name AS mu_agent_name
|
|
622
|
+
mu.agent_name AS mu_agent_name,
|
|
623
|
+
mu.hot_tokens AS mu_hot_tokens,
|
|
624
|
+
mu.warm_tokens AS mu_warm_tokens,
|
|
625
|
+
mu.facts_tokens AS mu_facts_tokens,
|
|
626
|
+
mu.overhead_tokens AS mu_overhead_tokens
|
|
623
627
|
FROM messages m
|
|
624
628
|
JOIN threads t ON t.thread_id = m.thread_id
|
|
625
629
|
LEFT JOIN agent_configs a ON a.id = t.agent_id
|
|
@@ -676,6 +680,16 @@ async function getDashboardMetrics(days = DEFAULT_WINDOW_DAYS) {
|
|
|
676
680
|
let totalCalls = 0;
|
|
677
681
|
let totalSuccesses = 0;
|
|
678
682
|
let totalErrors = 0;
|
|
683
|
+
const tierTotals = {
|
|
684
|
+
hot: 0,
|
|
685
|
+
warm: 0,
|
|
686
|
+
facts: 0,
|
|
687
|
+
overhead: 0
|
|
688
|
+
};
|
|
689
|
+
// Data-quality counters: only assistant turns are eligible since
|
|
690
|
+
// user/system rows never carry a message_usage snapshot by design.
|
|
691
|
+
let measuredAssistantMessages = 0;
|
|
692
|
+
let estimatedAssistantMessages = 0;
|
|
679
693
|
for (const row of usageRows){
|
|
680
694
|
const day = row.created_at.slice(0, 10);
|
|
681
695
|
const dayBucket = dayMap.get(day);
|
|
@@ -703,6 +717,22 @@ async function getDashboardMetrics(days = DEFAULT_WINDOW_DAYS) {
|
|
|
703
717
|
attribModelConfig = row.mu_model_config_name ?? attribModelConfig;
|
|
704
718
|
attribAgentId = row.mu_agent_id ?? attribAgentId;
|
|
705
719
|
attribAgentName = row.mu_agent_name ?? attribAgentName;
|
|
720
|
+
if (row.role === "assistant") measuredAssistantMessages += 1;
|
|
721
|
+
// Accumulate tier breakdown — null columns (legacy snapshots
|
|
722
|
+
// before the tier wire-up) contribute zero, which is the right
|
|
723
|
+
// behaviour for a stacked bar that visualises *known* tier split.
|
|
724
|
+
const hot = row.mu_hot_tokens ?? 0;
|
|
725
|
+
const warm = row.mu_warm_tokens ?? 0;
|
|
726
|
+
const facts = row.mu_facts_tokens ?? 0;
|
|
727
|
+
const overhead = row.mu_overhead_tokens ?? 0;
|
|
728
|
+
tierTotals.hot += hot;
|
|
729
|
+
tierTotals.warm += warm;
|
|
730
|
+
tierTotals.facts += facts;
|
|
731
|
+
tierTotals.overhead += overhead;
|
|
732
|
+
dayBucket.tier.hot += hot;
|
|
733
|
+
dayBucket.tier.warm += warm;
|
|
734
|
+
dayBucket.tier.facts += facts;
|
|
735
|
+
dayBucket.tier.overhead += overhead;
|
|
706
736
|
} else if (row.role === "user" && threadHasSnapshot) {
|
|
707
737
|
// Suppressed: snapshotted assistant turns in this thread already
|
|
708
738
|
// capture this user message's tokens in their input_tokens.
|
|
@@ -714,6 +744,7 @@ async function getDashboardMetrics(days = DEFAULT_WINDOW_DAYS) {
|
|
|
714
744
|
outputTokens = isInput ? 0 : tokenEstimate;
|
|
715
745
|
const rates = modelRatesFor(byProvider, byProviderModel, byModel, row.provider, row.model_id);
|
|
716
746
|
estCost = estimateCostUsd(inputTokens, outputTokens, rates);
|
|
747
|
+
if (row.role === "assistant") estimatedAssistantMessages += 1;
|
|
717
748
|
}
|
|
718
749
|
dayBucket.inputTokens += inputTokens;
|
|
719
750
|
dayBucket.outputTokens += outputTokens;
|
|
@@ -831,7 +862,8 @@ async function getDashboardMetrics(days = DEFAULT_WINDOW_DAYS) {
|
|
|
831
862
|
tool_successes: b.toolSuccesses,
|
|
832
863
|
tool_errors: b.toolErrors,
|
|
833
864
|
success_rate: round4(successRate),
|
|
834
|
-
error_rate: round4(errorRate)
|
|
865
|
+
error_rate: round4(errorRate),
|
|
866
|
+
tier_tokens: tierBucketToTokens(b.tier)
|
|
835
867
|
};
|
|
836
868
|
});
|
|
837
869
|
const top_tools = (0,tool_stats/* listToolStats */._r)().map((row)=>{
|
|
@@ -920,7 +952,8 @@ async function getDashboardMetrics(days = DEFAULT_WINDOW_DAYS) {
|
|
|
920
952
|
tool_successes: dayPoint?.tool_successes ?? 0,
|
|
921
953
|
tool_errors: dayPoint?.tool_errors ?? 0,
|
|
922
954
|
success_rate: dayPoint?.success_rate ?? 1,
|
|
923
|
-
error_rate: dayPoint?.error_rate ?? 0
|
|
955
|
+
error_rate: dayPoint?.error_rate ?? 0,
|
|
956
|
+
tier_tokens: dayPoint?.tier_tokens ?? emptyTierTokens()
|
|
924
957
|
},
|
|
925
958
|
top_agents: dayAgents,
|
|
926
959
|
by_provider: dayProviders,
|
|
@@ -938,7 +971,9 @@ async function getDashboardMetrics(days = DEFAULT_WINDOW_DAYS) {
|
|
|
938
971
|
tool_successes: totalSuccesses,
|
|
939
972
|
tool_errors: totalErrors,
|
|
940
973
|
success_rate: round4(overallSuccessRate),
|
|
941
|
-
error_rate: round4(overallErrorRate)
|
|
974
|
+
error_rate: round4(overallErrorRate),
|
|
975
|
+
tier_tokens: tierBucketToTokens(tierTotals),
|
|
976
|
+
data_quality: computeDataQuality(measuredAssistantMessages, estimatedAssistantMessages)
|
|
942
977
|
},
|
|
943
978
|
series,
|
|
944
979
|
top_tools,
|
|
@@ -998,11 +1033,43 @@ function seedDayBuckets(now, days) {
|
|
|
998
1033
|
estimatedCost: 0,
|
|
999
1034
|
toolCalls: 0,
|
|
1000
1035
|
toolSuccesses: 0,
|
|
1001
|
-
toolErrors: 0
|
|
1036
|
+
toolErrors: 0,
|
|
1037
|
+
tier: {
|
|
1038
|
+
hot: 0,
|
|
1039
|
+
warm: 0,
|
|
1040
|
+
facts: 0,
|
|
1041
|
+
overhead: 0
|
|
1042
|
+
}
|
|
1002
1043
|
});
|
|
1003
1044
|
}
|
|
1004
1045
|
return out;
|
|
1005
1046
|
}
|
|
1047
|
+
function emptyTierTokens() {
|
|
1048
|
+
return {
|
|
1049
|
+
hot_tokens: 0,
|
|
1050
|
+
warm_tokens: 0,
|
|
1051
|
+
facts_tokens: 0,
|
|
1052
|
+
overhead_tokens: 0,
|
|
1053
|
+
measured_input_tokens: 0
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
function tierBucketToTokens(b) {
|
|
1057
|
+
return {
|
|
1058
|
+
hot_tokens: b.hot,
|
|
1059
|
+
warm_tokens: b.warm,
|
|
1060
|
+
facts_tokens: b.facts,
|
|
1061
|
+
overhead_tokens: b.overhead,
|
|
1062
|
+
measured_input_tokens: b.hot + b.warm + b.facts + b.overhead
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
function computeDataQuality(measured, estimated) {
|
|
1066
|
+
const total = measured + estimated;
|
|
1067
|
+
return {
|
|
1068
|
+
measured_messages: measured,
|
|
1069
|
+
estimated_messages: estimated,
|
|
1070
|
+
measured_pct: total === 0 ? 1 : round4(measured / total)
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1006
1073
|
function estimateTokens(text) {
|
|
1007
1074
|
const trimmed = text.trim();
|
|
1008
1075
|
if (!trimmed) return 0;
|