codex-copilot-dx 1.4.0 → 1.4.1
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 +1 -0
- package/docs/ARCHITECTURE.md +6 -0
- package/docs/REFERENCE.md +9 -0
- package/package.json +1 -1
- package/src/antigravity-handler.mjs +6 -2
- package/src/claude-gateway.mjs +3 -1
- package/src/cli-command-spec.mjs +2 -1
- package/src/cli-management.mjs +7 -0
- package/src/context-metrics.mjs +2 -1
- package/src/dashboard/console.js +1 -1
- package/src/dashboard/index.html +7 -0
- package/src/dashboard/language.js +29 -0
- package/src/dashboard/status.js +2 -2
- package/src/dashboard/tool-activity.js +153 -0
- package/src/dashboard/ui.css +26 -0
- package/src/dashboard/ui.js +2 -2
- package/src/dashboard.mjs +1 -0
- package/src/responses-bridge.mjs +2 -0
- package/src/responses-handler.mjs +2 -0
- package/src/responses-proxy.mjs +4 -0
- package/src/stream-performance.mjs +16 -0
- package/src/tool-activity.mjs +135 -0
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ Model availability depends on your account and service. Microsoft 365 also requi
|
|
|
56
56
|
| Set up Antigravity | `ccdx app antigravity status` / `enable` / `open` |
|
|
57
57
|
| Inspect compression | `ccdx compact status` / `ccdx compact enable` / `ccdx compact disable` |
|
|
58
58
|
| Inspect failures | `ccdx requests --failed` |
|
|
59
|
+
| Inspect observed tool calls | `ccdx requests tools` / `ccdx requests tools --active` |
|
|
59
60
|
| Capture one upstream error | `ccdx requests diagnose --source api_work --model model-id --yes` |
|
|
60
61
|
| Read usage | `ccdx usage` / `ccdx usage --provider google --days 7` / `ccdx usage --purpose diagnostic` / `ccdx usage --scope run` |
|
|
61
62
|
| Inspect preferences | `ccdx config show --effective` |
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -1229,3 +1229,9 @@ Responses accepts both the compact endpoint and a terminal inline compaction tri
|
|
|
1229
1229
|
|
|
1230
1230
|
|
|
1231
1231
|
The implementation takes the native/gateway-state ownership separation from [Magpie's native compaction design](https://github.com/yetone/magpie/blob/main/internal/gateway/native_compaction.go). The empty-reasoning boundary follows [Floway's input fix](https://github.com/Menci/Floway/commit/02f819f41a2e), and source/model-scoped observations follow its isolation principle. Counting/generation control parity follows [LiteLLM's correction](https://github.com/BerriAI/litellm/commit/5849906ddb2f); source endpoint declarations retain the protocol-selection principle demonstrated by [CC Switch](https://github.com/farion1231/cc-switch/commit/86c749b98e76). No upstream runtime, Redis or wholesale intermediate representation is added.
|
|
1232
|
+
|
|
1233
|
+
## Tool activity
|
|
1234
|
+
|
|
1235
|
+
`tool-activity.mjs` stores bounded, memory-only metadata behind each stream-performance observer. Existing parsed Responses items, Messages blocks and Gemini function calls supply tool names and scoped identifiers; no argument or output body is copied. The existing session/profile HMAC and application label isolate result matching. Results match call IDs, with a unique-name-only fallback for Gemini. Request completion changes generated calls to waiting, never to successful execution. Observable returned results, source failures and cancellation terminate the corresponding observations. Live response activity renews preparing observations with at most one notification per second per request. Missing evidence becomes unknown after 90 seconds, with a bounded late-result window. Snapshot reads perform lazy retention cleanup; there is no server polling loop.
|
|
1236
|
+
|
|
1237
|
+
The WebUI consumes this metadata through the existing activity subscription. `dashboard/tool-activity.js` draws only the selected style, caches layout/theme measurements, caps drawing at 30 fps and DPR 1.5, pauses hidden/off-screen/reduced-motion views, and stops terminal cues within 0.9 seconds. Local deadline timers stop stale activity even when the stream has no new events. Native controls, theme variables and the language dictionary preserve the existing UI contract. The read-only `requests tools` grammar also drives TUI discovery.
|
package/docs/REFERENCE.md
CHANGED
|
@@ -39,6 +39,7 @@ For installation and first use, start with the [README](../README.md). This refe
|
|
|
39
39
|
| `ccdx config reset --preview` / `restore` | Preview defaults or restore the pre-reset backup |
|
|
40
40
|
| `ccdx requests [--failed] [--active]` | Inspect retained requests |
|
|
41
41
|
| `ccdx requests show <request_id>` | Read one retained request |
|
|
42
|
+
| `ccdx requests tools [--active]` | Read observed tool-call metadata; no arguments or outputs |
|
|
42
43
|
| `ccdx usage [--scope all\|run] [--provider ID] [--model ID] [--purpose VALUE] [--days N\|all]` | Read filtered retained usage or current-run totals |
|
|
43
44
|
| `ccdx doctor [--online] [--compat] [--fix] [--json]` | Check local setup; optional access checks and repairs |
|
|
44
45
|
| `ccdx doctor config` / `network` / `report` | Read configuration, routing or a redacted local report |
|
|
@@ -113,6 +114,14 @@ Only explicit, bounded session IDs can link requests. Local display identifiers
|
|
|
113
114
|
|
|
114
115
|
Each protocol observer retains at most 64 series of 64 request points and 16 compaction records, plus 20 unidentified requests. These numeric observations are memory-only and reset on restart. The page reads them on demand and after observed request completion through the existing dashboard refresh controller; ordinary status payloads do not include them. There is no prompt storage, text tokenization, transcript scan, extra provider request, content breakdown or compression control.
|
|
115
116
|
|
|
117
|
+
## Observed tool calls
|
|
118
|
+
|
|
119
|
+
**Requests → Tool calls** uses the existing activity stream for Codex, Claude and Antigravity. Choose Grid, Beam ring, Orbit rings, Woven field or Off; this browser remembers the choice. Captions change with observed call preparation, waiting and returned results. Motion runs at a faster presentation cadence, independent of event frequency; it is not a progress percentage or a call counter. System reduced motion, hidden/off-screen views and Off stop continuous drawing. Returned results have at most a 0.9-second finish cue; failure, cancellation and unavailable evidence stop continuous motion.
|
|
120
|
+
|
|
121
|
+
Calls are correlated using their IDs and the existing app/profile/session scope. A model emitting a tool call does not prove that the client executed it. Only a matching returned result ends the wait; ambiguous name-only Gemini results stay unconfirmed. Without a reliable session, completed requests show unconfirmed tool state. After 90 seconds without observable tool or response activity, the UI pauses and shows that fresh status is needed. Late results can update retained unconfirmed observations for another five minutes. These display deadlines never cancel tools or change source timeouts.
|
|
122
|
+
|
|
123
|
+
The service retains at most 128 metadata observations per protocol observer, shows at most 32, and captures at most 32 calls per request. Finished observations remain for 15 seconds. It keeps safe tool names and local display IDs in memory, not arguments, outputs or raw conversation/call IDs. Input correlation checks a bounded recent suffix rather than scanning a transcript. It adds no provider calls, tokenization, activity connections or polling. `ccdx requests tools --format json` and the TUI Requests menu expose the same observations; `--active` selects preparing/waiting calls. Restarting clears these diagnostic observations.
|
|
124
|
+
|
|
116
125
|
## Sources and client access
|
|
117
126
|
|
|
118
127
|
When Claude App encrypts a CCDX-owned gateway key, synchronization keeps the encrypted value and can still update owned model fields. The expected local key must match CCDX's ownership record; foreign profiles, addresses, rotated keys and user edits are not adopted. The sync result can report that the key was kept encrypted without claiming verified access. No system keystore decryption or extra permission is used.
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import {ANTIGRAVITY_MODEL_PREFIX,antigravityCopilotModels,mergeAntigravityModels
|
|
|
8
8
|
import {createPrivacyTextFragments} from "./privacy-stream.mjs";
|
|
9
9
|
import {createGoogleResponseObserver,googleUsageEvent} from "./antigravity-usage.mjs";
|
|
10
10
|
import {currentRequestContext,observeRequestedModel} from "./request-context.mjs";
|
|
11
|
-
import {markUpstreamStarted,markUpstreamHeaders,markFirstOutput,markOutputTokens,markRequestObservation,markResponseModel,markResponseTerminal} from "./stream-performance.mjs";
|
|
11
|
+
import {markUpstreamStarted,markUpstreamHeaders,markFirstOutput,markOutputTokens,markRequestObservation,markResponseModel,markResponseTerminal,markToolActivity} from "./stream-performance.mjs";
|
|
12
12
|
import {isCompactionRequest} from "./context-compaction.mjs";
|
|
13
13
|
import {compactionSummarizer} from "./context-compaction-wire.mjs";
|
|
14
14
|
import {requestPurpose} from "./request-context.mjs";
|
|
@@ -85,6 +85,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
85
85
|
usageModel=body.model;usageProvider="google";usageMode=method==="streamGenerateContent"?"sse":"json";
|
|
86
86
|
if(context){context.provider="google";context.streamPerformance?.setProvider?.("google")}
|
|
87
87
|
observeContextSession(null,{session_id:body.request?.labels?.root_cascade_id||body.request?.labels?.cascade_id},{profileId:()=>"google:gemini-native"},"gemini");
|
|
88
|
+
context?.streamPerformance?.observeToolInput?.(body.request,"gemini");
|
|
88
89
|
markRequestObservation({usage_state:"pending"});
|
|
89
90
|
}
|
|
90
91
|
const open=async(value,options={})=>{
|
|
@@ -107,6 +108,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
107
108
|
const nativeStreaming=/text\/event-stream/i.test(upstream.headers.get("content-type")||"");
|
|
108
109
|
if(generation)usageMode=nativeStreaming?"sse":"json";
|
|
109
110
|
const observer=generation&&upstream.ok?createGoogleResponseObserver({streaming:nativeStreaming,onEvent:value=>{
|
|
111
|
+
markToolActivity(value,"gemini");
|
|
110
112
|
const response=value?.response||value,event=googleUsageEvent(value);if(event)captureUsage(event);
|
|
111
113
|
const candidates=response?.candidates||[];
|
|
112
114
|
if(candidates.some(candidate=>candidate.content?.parts?.some(part=>part.functionCall||!part.thought&&typeof part.text==="string"&&part.text)))markFirstOutput("delta");
|
|
@@ -145,6 +147,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
145
147
|
observed=true;counts.copilot++;
|
|
146
148
|
if(context){context.provider="github";context.streamPerformance?.setProvider?.("github")}
|
|
147
149
|
observeContextSession(null,{session_id:body.request?.labels?.root_cascade_id||body.request?.labels?.cascade_id},{profileId:()=>"github:codex"},"chat");
|
|
150
|
+
context?.streamPerformance?.observeToolInput?.(body.request,"gemini");
|
|
148
151
|
const request=body.request;
|
|
149
152
|
if(body.requestType==="web_search"){
|
|
150
153
|
counts.search++;if(!searchFn)throw httpError("Copilot search is unavailable",503);
|
|
@@ -177,7 +180,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
177
180
|
if(!upstream.ok){await upstream.body?.cancel();throw httpError("Copilot generation was refused (HTTP "+upstream.status+")",upstream.status)}
|
|
178
181
|
if(!stream){
|
|
179
182
|
const data=JSON.parse(await readBoundedResponseText(upstream,{maxBytes:MAX_REPLY,signal:abort.signal,label:"Copilot response"}));captureUsage(data);
|
|
180
|
-
const result=chatToAntigravity(data,converted.originalNames);
|
|
183
|
+
const result=chatToAntigravity(data,converted.originalNames);markToolActivity(result,"gemini");
|
|
181
184
|
outcome=result.candidates[0].finishReason==="STOP"?"completed":"incomplete";markResponseTerminal(outcome);
|
|
182
185
|
res.writeHead(200,{"Content-Type":"application/json"});res.end(JSON.stringify({response:session.restoreValue(result)}));return;
|
|
183
186
|
}
|
|
@@ -185,6 +188,7 @@ export function createAntigravityHandler({client,models=()=>[],selectedModels=()
|
|
|
185
188
|
res.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache"});
|
|
186
189
|
const emit=chunk=>writeOrDrain(res,"data: "+JSON.stringify(chunk)+"\n\n",{signal:abort.signal});
|
|
187
190
|
for await(const chunk of chatStreamToAntigravity(upstream,converted.originalNames,{onChunk:()=>abort.setTimeout(streamIdleTimeoutMs,"stream_idle_timeout"),onUsage:captureUsage})){
|
|
191
|
+
markToolActivity(chunk,"gemini");
|
|
188
192
|
const candidate=chunk.response?.candidates?.[0];
|
|
189
193
|
for(const part of candidate?.content?.parts||[]){
|
|
190
194
|
if(part.functionCall||typeof part.text==="string"&&part.text&&!part.thought)markFirstOutput("delta");
|
package/src/claude-gateway.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { isLoopbackAddress, isLoopbackHostHeader } from "./security.mjs";
|
|
|
9
9
|
import { safeUpstreamResponseHeaders } from "./upstream-headers.mjs";
|
|
10
10
|
import { runWithRequestContext, currentRequestContext, observeRequestedModel } from "./request-context.mjs";
|
|
11
11
|
import { upstreamErrorEvidence, requestOptionsEvidence } from "./response-failures.mjs";
|
|
12
|
-
import { createStreamPerformanceMetrics, isMessagesOutputDelta, markRequestObservation } from "./stream-performance.mjs";
|
|
12
|
+
import { createStreamPerformanceMetrics, isMessagesOutputDelta, markRequestObservation, markToolActivity } from "./stream-performance.mjs";
|
|
13
13
|
import { buildMessagesUsageRecord, recordUsage } from "./usage-store.mjs";
|
|
14
14
|
import { redactDiagnosticText } from "./diagnostic-text.mjs";
|
|
15
15
|
import { decodedBodyLimitPreference } from "./user-settings.mjs";
|
|
@@ -337,6 +337,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
|
|
|
337
337
|
if (!upstream.ok) context.onHttpError?.({ ...upstreamErrorEvidence(raw, { status: upstream.status }),
|
|
338
338
|
origin: context.countObservation?.cached ? "capability_cache" : "upstream_http", headers: upstream.headers });
|
|
339
339
|
if (!countTokens && upstream.ok && value?.type === "message" && Array.isArray(value.content)) {
|
|
340
|
+
markToolActivity(value, "messages");
|
|
340
341
|
if (value.content.some(hasMessageState)) await conversation?.commit?.({ tool: value.content.some(block => block?.type === "tool_use") });
|
|
341
342
|
abort.signal.throwIfAborted();
|
|
342
343
|
model = value.model || model;responseId = value.id;usage = value.usage;stopReason = value.stop_reason;
|
|
@@ -363,6 +364,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
|
|
|
363
364
|
context.onHttpError?.({ ...evidence, code: evidence.code || evidence.error_type || "upstream_error", model_error: true, origin: "upstream_event", headers: upstream.headers });return;
|
|
364
365
|
}
|
|
365
366
|
if (sawStop || failedEvent) return;
|
|
367
|
+
if (event.type === "content_block_start") markToolActivity(event, "messages");
|
|
366
368
|
if (event.type === "content_block_start" && hasMessageState(event.content_block)
|
|
367
369
|
|| event.type === "content_block_delta" && (isMessagesOutputDelta(event.delta) || event.delta?.type === "signature_delta" && event.delta.signature)) {
|
|
368
370
|
if (!conversationCommitted) commitState = { tool: commitState?.tool === true || event.content_block?.type === "tool_use" };
|
package/src/cli-command-spec.mjs
CHANGED
|
@@ -183,6 +183,7 @@ export const MANAGED_COMMANDS = [
|
|
|
183
183
|
"--limit": "integer",
|
|
184
184
|
}),
|
|
185
185
|
command("requests show <request>", "Show a retained request and its original diagnostic fields", read),
|
|
186
|
+
command("requests tools", "Show observed tool-call metadata without arguments or outputs", { ...read, "--active": "flag" }),
|
|
186
187
|
command("requests diagnose", "Capture one redacted upstream Messages error; expires after ten minutes", { ...read, ...confirm, "--source": "value", "--model": "value", "--cancel": "flag" }),
|
|
187
188
|
command("compact status", "Show native and gateway compression observations without model calls", read),
|
|
188
189
|
command("compact enable", "Enable bounded recovery using the current source and model; uses quota", { ...read, ...confirm }),
|
|
@@ -291,7 +292,7 @@ const extras = {
|
|
|
291
292
|
config:
|
|
292
293
|
"Only service and terminal preferences are in scope. Browser appearance stays in WebUI.\nReset keeps accounts, keys, model plans and chats and stores a pre-reset backup.\nSaved and effective values can differ; restart requirements remain explicit.",
|
|
293
294
|
requests:
|
|
294
|
-
"Only retained records are available. Unknown clients are not guessed from an API route.\nApp filters: codex, claude-app, claude-code, antigravity.\n--failed filters failed model outcomes and structured HTTP/model errors.\nUsage records, HTTP calls and model outcomes are distinct counters.",
|
|
295
|
+
"Only retained records are available. Use requests tools to inspect observed tool metadata without model calls. Unknown clients are not guessed from an API route.\nApp filters: codex, claude-app, claude-code, antigravity.\n--failed filters failed model outcomes and structured HTTP/model errors.\nUsage records, HTTP calls and model outcomes are distinct counters.",
|
|
295
296
|
status:
|
|
296
297
|
"Default interactive status is brief; --details retains the complete diagnostic view.\nThe installed package version can differ from the running service.\nA listening gateway does not prove upstream model access.",
|
|
297
298
|
usage:
|
package/src/cli-management.mjs
CHANGED
|
@@ -122,6 +122,13 @@ export async function runManagementCommand(command, options = {}) {
|
|
|
122
122
|
return print(result.compaction);
|
|
123
123
|
}
|
|
124
124
|
if (group === "requests") {
|
|
125
|
+
if (action === "tools") {
|
|
126
|
+
const { data } = await readStatus();
|
|
127
|
+
const parts = [data.stream_performance, (data.providers?.claude || data.providers?.m365?.claude)?.requests?.performance].filter(Boolean);
|
|
128
|
+
if (!parts.some(part => part.tool_activity)) throw new Error("This command needs the updated running service; no settings changed.");
|
|
129
|
+
const items = parts.flatMap(part => part.tool_activity?.items || []).filter(row => !flags.active || ["preparing", "waiting"].includes(row.state));
|
|
130
|
+
return print(items, [["application", "Client"], ["provider", "Source"], ["model", "Model"], ["name", "Tool"], ["state", "State"]]);
|
|
131
|
+
}
|
|
125
132
|
if (action === "diagnose") {
|
|
126
133
|
if (flags.source || flags.model || flags.cancel) {
|
|
127
134
|
if (!flags.cancel && (!flags.source || !flags.model)) throw new Error("Use --source ID and --model ID together.");
|
package/src/context-metrics.mjs
CHANGED
|
@@ -14,7 +14,7 @@ export function observeContextSession(body, headers = {}, provider, protocol = "
|
|
|
14
14
|
try { session = JSON.parse(body.metadata.user_id)?.session_id; }
|
|
15
15
|
catch { session = /(?:^|_)session_([\w-]{8,128})$/.exec(body.metadata.user_id)?.[1]; }
|
|
16
16
|
}
|
|
17
|
-
if (!bounded(session)) return;
|
|
17
|
+
if (!bounded(session)) { tracker.observeToolInput?.(body, protocol);return; }
|
|
18
18
|
try {
|
|
19
19
|
const profile = provider?.profileId?.(protocol);
|
|
20
20
|
if (!bounded(profile)) return;
|
|
@@ -22,6 +22,7 @@ export function observeContextSession(body, headers = {}, provider, protocol = "
|
|
|
22
22
|
const key = createHmac("sha256", salt).update(`${profile}\0${session}\0${bounded(agent) ? agent : ""}`).digest("hex");
|
|
23
23
|
tracker.observeSession(key);
|
|
24
24
|
} catch { /* Optional metadata cannot change request admission or routing. */ }
|
|
25
|
+
tracker.observeToolInput?.(body, protocol);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export function createContextMetrics() {
|
package/src/dashboard/console.js
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
if (snapshot) render(snapshot);
|
|
60
60
|
void refreshStatus();
|
|
61
61
|
globalThis.ccdxDashboardActivity?.visibilityChanged();
|
|
62
|
-
globalThis.ccdxDashboardFlow?.visibilityChanged();
|
|
62
|
+
globalThis.ccdxDashboardFlow?.visibilityChanged();globalThis.ccdxToolActivity?.visibilityChanged();
|
|
63
63
|
for (const item of document.querySelectorAll("[data-route]")) {
|
|
64
64
|
if (item.dataset.route === next) item.setAttribute("aria-current", "page");else item.removeAttribute("aria-current");
|
|
65
65
|
}
|
package/src/dashboard/index.html
CHANGED
|
@@ -369,6 +369,13 @@
|
|
|
369
369
|
<div class="flow-caption"><span id="flow-caption" data-i18n="flow_status_unknown">Status unavailable</span><button id="flow-clear" type="button" data-i18n="flow_show_all" hidden>Show all</button><button id="flow-more" type="button" hidden>More models</button></div>
|
|
370
370
|
<details id="flow-active" class="tool-details"><summary id="flow-active-title" data-i18n="flow_active_requests">Active requests</summary><div class="table-wrap"><table><thead><tr><th data-i18n="client">App</th><th data-i18n="source">Source</th><th data-i18n="model">Model</th><th data-i18n="state">State</th><th data-i18n="flow_elapsed">Elapsed</th><th data-i18n="attempts">Attempts</th></tr></thead><tbody id="flow-active-body"></tbody></table></div></details>
|
|
371
371
|
</section>
|
|
372
|
+
<section id="tool-activity" class="panel dashboard-section" aria-labelledby="tool-title" data-paused="true">
|
|
373
|
+
<div class="panel-heading"><h2 id="tool-title" data-i18n="tool_heading">TOOL CALLS</h2><label class="tool-style" for="tool-style"><span data-i18n="tool_style">Style</span><select id="tool-style"><option value="grid" data-i18n="tool_style_grid">Grid</option><option value="halo" data-i18n="tool_style_halo">Beam ring</option><option value="orbit" data-i18n="tool_style_orbit">Orbit rings</option><option value="weave" data-i18n="tool_style_weave">Woven field</option><option value="off" data-i18n="tool_style_off">Off</option></select></label></div>
|
|
374
|
+
<div id="tool-stage" class="tool-stage" data-style="grid">
|
|
375
|
+
<div class="tool-visual"><div class="tool-orbit"><canvas id="tool-canvas" role="img" data-i18n-label="tool_heading" aria-label="Tool calls"></canvas></div><p class="tool-narration"><span id="tool-state" role="status" aria-live="polite" data-i18n="flow_status_unknown">Waiting for a fresh status</span><span id="tool-cursor" aria-hidden="true" hidden> ···</span></p></div>
|
|
376
|
+
<div class="tool-content"><p id="tool-context" class="tool-context" hidden></p><div id="tool-list"></div><p id="tool-more" class="hint" hidden></p><details id="tool-details" class="tool-details tool-technical" hidden><summary data-i18n="tool_details">Call details</summary><div id="tool-technical"></div></details></div>
|
|
377
|
+
</div>
|
|
378
|
+
</section>
|
|
372
379
|
<details class="panel dashboard-section" id="source-requests" open>
|
|
373
380
|
<summary data-i18n="requests_by_source">REQUESTS BY SOURCE</summary>
|
|
374
381
|
<p class="hint" data-i18n="results_since_startup_partial_usage_is_marked_separately">Results since startup. Partial usage is marked separately.</p>
|
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
const translations = {
|
|
3
|
+
"tool_heading": ["Tool calls","工具调用"],
|
|
4
|
+
"tool_style": ["Style","样式"],
|
|
5
|
+
"tool_style_grid": ["Grid","格子进度条"],
|
|
6
|
+
"tool_style_halo": ["Beam ring","光束圆环"],
|
|
7
|
+
"tool_style_orbit": ["Orbit rings","轨道圆环"],
|
|
8
|
+
"tool_style_weave": ["Woven field","编织光场"],
|
|
9
|
+
"tool_style_off": ["Off","关闭"],
|
|
10
|
+
"tool_preparing": ["Preparing a tool call","正在准备调用"],
|
|
11
|
+
"tool_preparing_many": ["Preparing {count} calls","并行准备 {count} 项调用"],
|
|
12
|
+
"tool_waiting": ["Waiting for tool results","等待工具返回"],
|
|
13
|
+
"tool_returned": ["Tool results received","工具结果已返回"],
|
|
14
|
+
"tool_failed": ["A tool call failed","调用失败"],
|
|
15
|
+
"tool_cancelled": ["Request cancelled","请求已取消"],
|
|
16
|
+
"tool_idle": ["Waiting for the next call","等待下一次调用"],
|
|
17
|
+
"tool_groups": ["{count} app and model groups","{count} 个应用及模型分组"],
|
|
18
|
+
"tool_more": ["{count} more observations in call details","另有 {count} 项观测,见调用详情"],
|
|
19
|
+
"tool_details": ["Call details","调用详情"],
|
|
20
|
+
"tool_action_read": ["Read file","读取文件"],
|
|
21
|
+
"tool_action_search": ["Search files","搜索文件"],
|
|
22
|
+
"tool_action_command": ["Run command","运行命令"],
|
|
23
|
+
"tool_action_edit": ["Edit file","修改文件"],
|
|
24
|
+
"tool_action_web": ["Search web","检索网页"],
|
|
25
|
+
"tool_action_generic": ["Tool call","工具调用"],
|
|
26
|
+
"tool_row_preparing": ["Preparing","准备中"],
|
|
27
|
+
"tool_row_waiting": ["Waiting for result","等待返回"],
|
|
28
|
+
"tool_row_returned": ["Returned","已返回"],
|
|
29
|
+
"tool_row_failed": ["Failed","失败"],
|
|
30
|
+
"tool_row_cancelled": ["Cancelled","已取消"],
|
|
31
|
+
"tool_row_unknown": ["Waiting for a fresh status","状态待更新"],
|
|
3
32
|
gemini_access_title: ["Copilot access", "Copilot 接入"],
|
|
4
33
|
gemini_model_selection: ["Model selection", "模型选择"],
|
|
5
34
|
gemini_route_waiting: ["No Antigravity request observed yet", "尚未观察到 Antigravity 请求"],
|
package/src/dashboard/status.js
CHANGED
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
for (const source of data.providers?.connections?.providers || []) sourceNames.set(source.id, source.name);
|
|
236
236
|
globalThis.ccdxConnections?.updateMemory?.(data.providers?.connections);
|
|
237
237
|
globalThis.ccdxDashboardActivity?.update(data.model_activity);
|
|
238
|
-
globalThis.ccdxDashboardFlow?.update(data);
|
|
238
|
+
globalThis.ccdxDashboardFlow?.update(data);globalThis.ccdxToolActivity?.update(data);
|
|
239
239
|
text("version", `v${data.version || "?"}`);
|
|
240
240
|
text("uptime", "pid_pid_uptime_duration", { pid: number(data.pid), duration: duration(data.uptime_ms) });
|
|
241
241
|
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
}
|
|
332
332
|
function renderActivity(data) {
|
|
333
333
|
globalThis.ccdxDashboardActivity?.update(data.model_activity, { live: true });
|
|
334
|
-
globalThis.ccdxDashboardFlow?.update(data, { live: true });
|
|
334
|
+
globalThis.ccdxDashboardFlow?.update(data, { live: true });globalThis.ccdxToolActivity?.update(data);
|
|
335
335
|
text("version", `v${data.version || "?"}`);
|
|
336
336
|
text("uptime", "pid_pid_uptime_duration", { pid: number(data.pid), duration: duration(data.uptime_ms) });
|
|
337
337
|
text("requests", number(data.requests?.total));
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const root = document.getElementById("tool-activity");if (!root) return;
|
|
3
|
+
const el = id => document.getElementById(id), canvas = el("tool-canvas"), ctx = canvas.getContext?.("2d");
|
|
4
|
+
const styles = new Set(["grid", "halo", "orbit", "weave", "off"]), storageKey = "ccdx.dashboard.toolMotionStyle";
|
|
5
|
+
const pending = state => ["preparing", "waiting"].includes(state);
|
|
6
|
+
const phrase = (key, values = {}) => globalThis.ccdxLanguage.format(key, values);
|
|
7
|
+
const text = (id, key, values) => globalThis.ccdxLanguage.set(el(id), key, values);
|
|
8
|
+
const state = { scene: "idle", style: "grid", intensity: .8, reduce: false };
|
|
9
|
+
try { const saved = localStorage.getItem(storageKey);if (styles.has(saved)) state.style = saved; } catch {}
|
|
10
|
+
const motion = globalThis.matchMedia?.("(prefers-reduced-motion: reduce)") || { matches: false, addEventListener() {} };
|
|
11
|
+
let records = [], fresh = false, supported = false, visible = true, raf = 0, last = 0, start = performance.now(), expiry = null;
|
|
12
|
+
let signature = "", box = { width: 0, height: 0 }, color = "", omitted = 0;
|
|
13
|
+
const shown = () => document.visibilityState === "visible" && !root.closest("[hidden]") && visible;
|
|
14
|
+
function measure() {
|
|
15
|
+
box = canvas.getBoundingClientRect();color = getComputedStyle(document.documentElement).getPropertyValue("--accent").trim();
|
|
16
|
+
refreshAnimation();
|
|
17
|
+
}
|
|
18
|
+
function draw(now=performance.now()){
|
|
19
|
+
if(!ctx||!box.width||!box.height)return;
|
|
20
|
+
const dpr=Math.min(devicePixelRatio||1,1.5),w=box.width,h=box.height;
|
|
21
|
+
if(canvas.width!==Math.round(w*dpr)||canvas.height!==Math.round(h*dpr)){canvas.width=Math.round(w*dpr);canvas.height=Math.round(h*dpr);}
|
|
22
|
+
ctx.setTransform(dpr,0,0,dpr,0,0);ctx.clearRect(0,0,w,h);
|
|
23
|
+
const cx=w/2,cy=h/2,r=Math.min(w,h)*.31;
|
|
24
|
+
const reduced=motion.matches||state.reduce,t=reduced?0:(now-start)/1000,active=['calling','parallel'].includes(state.scene),waiting=state.scene==='waiting',returned=state.scene==='returned';
|
|
25
|
+
const quiet=state.scene==='idle'||state.scene==='responding',power=quiet?.12:waiting?.5:returned?.5:state.intensity;
|
|
26
|
+
ctx.strokeStyle=color;ctx.fillStyle=color;ctx.lineWidth=.8;
|
|
27
|
+
function arc(radius,a,b,alpha){ctx.globalAlpha=alpha;ctx.beginPath();ctx.arc(cx,cy,radius,a,b);ctx.stroke();}
|
|
28
|
+
if(state.style==='grid'){
|
|
29
|
+
const cols=12,rows=3,gap=5,size=Math.min(13,(w-32)/cols-gap),left=cx-(cols*size+(cols-1)*gap)/2,top=cy-(rows*size+(rows-1)*gap)/2;
|
|
30
|
+
const head=active||waiting?(t*(waiting?11:19))%(cols*rows):-8;
|
|
31
|
+
for(let row=0;row<rows;row++)for(let col=0;col<cols;col++){
|
|
32
|
+
const index=row*cols+(row%2?cols-col-1:col),distance=(head-index+cols*rows)%(cols*rows),wave=Math.max(0,1-distance/8);
|
|
33
|
+
ctx.globalAlpha=quiet?.1:returned?.16+Math.max(0,1-(now-start)/900)*.42:.1+wave*power;
|
|
34
|
+
ctx.fillRect(left+col*(size+gap),top+row*(size+gap),size,size);
|
|
35
|
+
}
|
|
36
|
+
ctx.globalAlpha=1;return;
|
|
37
|
+
}
|
|
38
|
+
arc(r,0,Math.PI*2,.25);arc(r*.85,0,Math.PI*2,.13);arc(r*1.12,0,Math.PI*2,.1);
|
|
39
|
+
const spin=active?t*1.6:waiting?t*.9:0;
|
|
40
|
+
if(state.style==='halo'){
|
|
41
|
+
for(let i=0;i<64;i++){
|
|
42
|
+
const a=i/64*Math.PI*2+spin,pulse=active||waiting?(Math.sin(t*7+i*.7)*.5+.5):returned?.6:.05;
|
|
43
|
+
const length=3+(i%4===0?8:3)+pulse*(active?20:waiting?9:2)*state.intensity;
|
|
44
|
+
ctx.globalAlpha=(.16+pulse*.55)*power;ctx.lineWidth=i%8===0?1.4:.75;
|
|
45
|
+
ctx.beginPath();ctx.moveTo(cx+Math.cos(a)*r*1.17,cy+Math.sin(a)*r*1.17);ctx.lineTo(cx+Math.cos(a)*(r*1.17+length),cy+Math.sin(a)*(r*1.17+length));ctx.stroke();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if(state.style==='weave'||state.style==='halo'){
|
|
49
|
+
ctx.lineWidth=.65;const strands=state.style==='weave'?62:28;
|
|
50
|
+
for(let i=0;i<strands;i++){
|
|
51
|
+
const a=i/strands*Math.PI*2+spin*.6,b=a+2.35+Math.sin(i*.68+t*1.7)*.48,inner=r*(state.style==='weave'?.84:.68);
|
|
52
|
+
ctx.globalAlpha=(.1+power*.2)*(quiet?.45:1);ctx.beginPath();ctx.moveTo(cx+Math.cos(a)*inner,cy+Math.sin(a)*inner);ctx.quadraticCurveTo(cx+Math.sin(t*1.3+i)*r*.35,cy+Math.cos(i*.5+t*.7)*r*.3,cx+Math.cos(b)*inner,cy+Math.sin(b)*inner);ctx.stroke();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
for(let i=0;i<3;i++){
|
|
56
|
+
const a=spin*(i%2?-1:1)+i*2.08,track=r*(state.style==='orbit'?.58+i*.25:.89+i*.06);
|
|
57
|
+
ctx.lineWidth=1.3;arc(track,a,a+(active?1.25:waiting?.75:.18),quiet?.15:.75);
|
|
58
|
+
if(state.style==='orbit'){arc(track,0,Math.PI*2,.12);ctx.globalAlpha=quiet?.2:.8;ctx.beginPath();ctx.arc(cx+Math.cos(a)*track,cy+Math.sin(a)*track,active?2.8:2,0,Math.PI*2);ctx.fill();}
|
|
59
|
+
}
|
|
60
|
+
if(active||waiting){for(let i=0;i<3;i++){const q=(t*.85+i/3)%1;arc(r*(.55+q*.5),0,Math.PI*2,(1-q)*.12*power);}}
|
|
61
|
+
if(returned&&!reduced){const q=Math.min((now-start)/850,1);arc(r*(1+q*.32),0,Math.PI*2,(1-q)*.5);}
|
|
62
|
+
ctx.globalAlpha=1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function animate(now) {
|
|
66
|
+
raf = 0;
|
|
67
|
+
if (!shown() || motion.matches || state.style === "off" || !["calling", "parallel", "waiting"].includes(state.scene) && !(state.scene === "returned" && now - start < 900)) return;
|
|
68
|
+
if (now - last >= 1000 / 30) { last = now;draw(now); }raf = requestAnimationFrame(animate);
|
|
69
|
+
}
|
|
70
|
+
function refreshAnimation() {
|
|
71
|
+
cancelAnimationFrame(raf);raf = 0;root.dataset.paused = String(!shown() || motion.matches);
|
|
72
|
+
if (!shown() || state.style === "off") return;
|
|
73
|
+
draw();if (!motion.matches && (["calling", "parallel", "waiting"].includes(state.scene) || state.scene === "returned" && performance.now() - start < 900)) raf = requestAnimationFrame(animate);
|
|
74
|
+
}
|
|
75
|
+
function category(name) {
|
|
76
|
+
const value = String(name || "").toLowerCase().split(/__|\./).at(-1);
|
|
77
|
+
if (["read_file", "readfile", "view_file", "open_file", "get_file_content"].includes(value)) return "tool_action_read";
|
|
78
|
+
if (["search_files", "file_search", "grep", "rg"].includes(value)) return "tool_action_search";
|
|
79
|
+
if (["exec_command", "run_command", "bash", "shell"].includes(value)) return "tool_action_command";
|
|
80
|
+
if (["write_file", "edit_file", "apply_patch"].includes(value)) return "tool_action_edit";
|
|
81
|
+
if (["web_search", "search_web"].includes(value)) return "tool_action_web";
|
|
82
|
+
return "tool_action_generic";
|
|
83
|
+
}
|
|
84
|
+
function appName(id) { return phrase(`flow_app_${id}`); }
|
|
85
|
+
const sourceName = id => id === "github" ? "GitHub Copilot" : id === "m365" ? "Microsoft 365" : id === "google" ? "Google" : globalThis.ccdxConnectionNames?.[id] || phrase("flow_source_unknown");
|
|
86
|
+
function render(force = false) {
|
|
87
|
+
if (root.closest("[hidden]")) { signature = "";refreshAnimation();return; }
|
|
88
|
+
const time = performance.now();
|
|
89
|
+
for (const row of records) if (row.until <= time && pending(row.state)) { row.state = "unknown";row.until = time + 300000; }
|
|
90
|
+
records = records.filter(row => row.until > time);
|
|
91
|
+
const rows = records.slice(0, 32).map(row => fresh || !pending(row.state) ? row : { ...row, state: "unknown" });
|
|
92
|
+
const next = JSON.stringify([fresh, supported, state.style, omitted, rows.map(({ until, ...row }) => row)]);
|
|
93
|
+
clearTimeout(expiry);expiry = null;
|
|
94
|
+
if (records.length) expiry = setTimeout(() => render(), Math.max(1, Math.min(...records.map(row => row.until - time))));
|
|
95
|
+
if (!force && next === signature) return;
|
|
96
|
+
signature = next;
|
|
97
|
+
const active = rows.filter(row => pending(row.state)), preparing = active.some(row => row.state === "preparing");
|
|
98
|
+
const scene = active.length ? preparing ? active.length > 1 ? "parallel" : "calling" : "waiting"
|
|
99
|
+
: rows.some(row => row.state === "returned") && !rows.some(row => ["failed", "cancelled", "unknown"].includes(row.state)) ? "returned" : "idle";
|
|
100
|
+
if (scene !== state.scene) start = performance.now();state.scene = scene;
|
|
101
|
+
const key = !supported || !fresh ? "flow_status_unknown" : active.length ? preparing ? active.length > 1 ? "tool_preparing_many" : "tool_preparing" : "tool_waiting"
|
|
102
|
+
: rows.some(row => row.state === "failed") ? "tool_failed" : rows.some(row => row.state === "cancelled") ? "tool_cancelled"
|
|
103
|
+
: rows.some(row => row.state === "unknown") ? "flow_status_unknown" : rows.length ? "tool_returned" : "tool_idle";
|
|
104
|
+
text("tool-state", key, { count: active.length });
|
|
105
|
+
canvas.setAttribute("aria-label", phrase(key, { count: active.length }));
|
|
106
|
+
el("tool-style").value = state.style;el("tool-stage").dataset.style = state.style;
|
|
107
|
+
el("tool-cursor").hidden = !active.length || state.style === "off" || !fresh;
|
|
108
|
+
const groups = new Map(rows.map(row => [`${row.application}:${row.provider}:${row.model}`, row]));
|
|
109
|
+
el("tool-context").hidden = !rows.length;
|
|
110
|
+
el("tool-context").textContent = groups.size === 1 ? `${appName(rows[0].application)} · ${rows[0].model === "other" ? phrase("flow_model_pending") : rows[0].model}` : phrase("tool_groups", { count: groups.size });
|
|
111
|
+
const list = el("tool-list");list.replaceChildren();
|
|
112
|
+
for (const row of rows.slice(0, 6)) {
|
|
113
|
+
const item = document.createElement("div");item.className = "tool-entry";item.dataset.state = row.state;
|
|
114
|
+
const mark = document.createElement("span");mark.className = "tool-mark";mark.setAttribute("aria-hidden", "true");
|
|
115
|
+
const name = document.createElement("span");name.className = "tool-name";name.textContent = phrase(category(row.name));
|
|
116
|
+
const status = document.createElement("span");status.textContent = phrase(`tool_row_${row.state}`);
|
|
117
|
+
item.append(mark, name, status);list.append(item);
|
|
118
|
+
}
|
|
119
|
+
el("tool-details").hidden = !rows.length;
|
|
120
|
+
el("tool-technical").replaceChildren();
|
|
121
|
+
for (const row of rows) {
|
|
122
|
+
const line = document.createElement("p");line.textContent = `${appName(row.application)} · ${sourceName(row.provider)} · ${row.model} · ${row.name || phrase("tool_action_generic")} · ${phrase(`tool_row_${row.state}`)}`;el("tool-technical").append(line);
|
|
123
|
+
}
|
|
124
|
+
el("tool-more").hidden = rows.length <= 6 && !omitted;
|
|
125
|
+
text("tool-more", "tool_more", { count: Math.max(0, rows.length - 6) + omitted });
|
|
126
|
+
measure();
|
|
127
|
+
}
|
|
128
|
+
el("tool-style").addEventListener("change", () => {
|
|
129
|
+
const next = el("tool-style").value;if (!styles.has(next)) return;state.style = next;
|
|
130
|
+
try { localStorage.setItem(storageKey, next); } catch {}render(true);
|
|
131
|
+
});
|
|
132
|
+
document.addEventListener("visibilitychange", () => { if (shown()) render();refreshAnimation(); });
|
|
133
|
+
globalThis.addEventListener("pagehide", () => { cancelAnimationFrame(raf);raf = 0;root.dataset.paused = "true"; });
|
|
134
|
+
motion.addEventListener("change", refreshAnimation);
|
|
135
|
+
new ResizeObserver(measure).observe(canvas.parentElement);
|
|
136
|
+
new IntersectionObserver(entries => { visible = entries[0].isIntersecting;refreshAnimation(); }, { threshold: .05 }).observe(canvas);
|
|
137
|
+
new MutationObserver(() => render(true)).observe(document.documentElement, { attributes: true, attributeFilter: ["lang", "data-theme", "data-palette"] });
|
|
138
|
+
globalThis.ccdxToolActivity = {
|
|
139
|
+
update(data) {
|
|
140
|
+
const parts = [data?.stream_performance, (data?.providers?.claude || data?.providers?.m365?.claude)?.requests?.performance].filter(Boolean);
|
|
141
|
+
const views = parts.map(part => part.tool_activity).filter(value => Array.isArray(value?.items));
|
|
142
|
+
supported = views.length > 0;fresh = supported;const time = performance.now();
|
|
143
|
+
const merged = views.flatMap((view, index) => view.items.slice(0, 32).filter(row => row && typeof row.id === "string" && ["preparing", "waiting", "returned", "failed", "cancelled", "unknown"].includes(row.state)
|
|
144
|
+
&& Number.isFinite(row.expires_in_ms) && row.expires_in_ms > 0).map(row => ({ id: `${index}-${row.id}`, application: row.application || "api", provider: row.provider, model: row.model || "other", name: row.name,
|
|
145
|
+
state: row.state, until: time + Math.min(row.expires_in_ms, 300000) })));
|
|
146
|
+
merged.sort((a, b) => Number(pending(b.state)) - Number(pending(a.state)));records = merged.slice(0, 32);
|
|
147
|
+
omitted = Math.max(0, merged.length - records.length) + views.reduce((sum, view) => sum + (Number.isSafeInteger(view.omitted) ? view.omitted : 0), 0);render();
|
|
148
|
+
},
|
|
149
|
+
unavailable() { fresh = false;render(); },
|
|
150
|
+
visibilityChanged() { render();refreshAnimation(); },
|
|
151
|
+
};
|
|
152
|
+
render();
|
|
153
|
+
})();
|
package/src/dashboard/ui.css
CHANGED
|
@@ -671,3 +671,29 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
671
671
|
.image-model-choice { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
|
|
672
672
|
.image-model-choice input { flex: 0 0 auto; }
|
|
673
673
|
.image-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
|
|
674
|
+
|
|
675
|
+
.tool-style { display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);white-space:nowrap; }
|
|
676
|
+
.tool-style select { max-width:160px; }
|
|
677
|
+
.tool-stage { display:grid;grid-template-columns:minmax(180px,250px) minmax(0,1fr);align-items:center;gap:24px;min-height:230px; }
|
|
678
|
+
.tool-visual,.tool-content { min-width:0; }
|
|
679
|
+
.tool-orbit { width:100%;height:190px;position:relative; }
|
|
680
|
+
.tool-orbit canvas { display:block;width:100%;height:100%; }
|
|
681
|
+
.tool-stage[data-style="grid"] .tool-orbit { max-height:140px; }
|
|
682
|
+
.tool-stage[data-style="off"] { grid-template-columns:1fr;min-height:110px; }
|
|
683
|
+
.tool-stage[data-style="off"] .tool-visual { display:none; }
|
|
684
|
+
.tool-narration { margin:0;min-height:24px;text-align:center;color:var(--text);font-size:12px;line-height:1.7; }
|
|
685
|
+
.tool-context { color:var(--muted);font-size:11px;line-height:1.6;margin:0 0 16px; }
|
|
686
|
+
.tool-entry { display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:10px;align-items:center;min-height:48px;padding-block:8px;border-bottom:1px solid var(--border); }
|
|
687
|
+
.tool-entry:last-child { border-bottom:0; }
|
|
688
|
+
.tool-name { font-size:12px; }
|
|
689
|
+
.tool-entry > span:last-child { color:var(--muted);font-size:11px;white-space:nowrap; }
|
|
690
|
+
.tool-mark { display:inline-block;width:7px;height:7px;border:1px solid var(--accent);border-radius:50%; }
|
|
691
|
+
.tool-entry[data-state="preparing"] .tool-mark { background:var(--accent); }
|
|
692
|
+
.tool-entry[data-state="returned"] .tool-mark { width:9px;height:5px;border-top:0;border-right:0;border-radius:0;transform:rotate(-45deg); }
|
|
693
|
+
.tool-technical { margin:12px 0 0;color:var(--muted);font-size:11px; }
|
|
694
|
+
.tool-technical p { overflow-wrap:anywhere;line-height:1.7;margin:6px 0; }
|
|
695
|
+
#tool-cursor { display:inline-block;animation:tool-cursor 1s steps(1) infinite; }
|
|
696
|
+
#tool-activity[data-paused="true"] #tool-cursor { animation:none; }
|
|
697
|
+
@keyframes tool-cursor { 50% { opacity:0; } }
|
|
698
|
+
@media(max-width:620px) { .tool-stage { grid-template-columns:1fr;gap:8px; }.tool-visual { width:100%;max-width:330px;margin:auto; }.tool-content { padding-bottom:8px; }.tool-context { margin-bottom:4px; } }
|
|
699
|
+
@media(prefers-reduced-motion:reduce) { #tool-cursor { animation:none; } }
|
package/src/dashboard/ui.js
CHANGED
|
@@ -271,7 +271,7 @@ for (const [key, ids] of [["auth", ["account-authorization", "client-features",
|
|
|
271
271
|
const updateView = globalThis.ccdxDashboardUpdates.create(viewHelpers);
|
|
272
272
|
function statusState(state) {
|
|
273
273
|
if (!liveActivity.current && (state.error || !state.value)) globalThis.ccdxDashboardActivity?.unavailable();
|
|
274
|
-
if (!liveActivity.current && (state.error || !state.value) && statusResourceKey() === "status") globalThis.ccdxDashboardFlow?.unavailable();
|
|
274
|
+
if (!liveActivity.current && (state.error || !state.value) && statusResourceKey() === "status") { globalThis.ccdxDashboardFlow?.unavailable();globalThis.ccdxToolActivity?.unavailable(); }
|
|
275
275
|
text("connection", state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable");
|
|
276
276
|
element("connection").className = `badge ${state.pending ? "neutral" : state.error ? "bad" : "good"}`;
|
|
277
277
|
globalThis.ccdxIcons?.set(element("connection"), state.pending && !state.value ? "reading" : state.error ? "unavailable_eb0be" : "service_reachable",
|
|
@@ -457,7 +457,7 @@ const liveActivity = globalThis.ccdxLive.create({
|
|
|
457
457
|
element("connection").className = "badge good";
|
|
458
458
|
globalThis.ccdxIcons?.set(element("connection"), "service_reachable", "connected");
|
|
459
459
|
} else {
|
|
460
|
-
globalThis.ccdxDashboardActivity?.unavailable();globalThis.ccdxDashboardFlow?.unavailable();
|
|
460
|
+
globalThis.ccdxDashboardActivity?.unavailable();globalThis.ccdxDashboardFlow?.unavailable();globalThis.ccdxToolActivity?.unavailable();
|
|
461
461
|
if (value !== "paused") {
|
|
462
462
|
element("connection").className = "badge neutral";
|
|
463
463
|
globalThis.ccdxIcons?.set(element("connection"), "reading", "unknown");
|
package/src/dashboard.mjs
CHANGED
|
@@ -17,6 +17,7 @@ const ASSETS = new Map([
|
|
|
17
17
|
["/status.js", ["./dashboard/status.js", "text/javascript; charset=utf-8"]],
|
|
18
18
|
["/activity.js", ["./dashboard/activity.js", "text/javascript; charset=utf-8"]],
|
|
19
19
|
["/flow.js", ["./dashboard/flow.js", "text/javascript; charset=utf-8"]],
|
|
20
|
+
["/tool-activity.js", ["./dashboard/tool-activity.js", "text/javascript; charset=utf-8"]],
|
|
20
21
|
["/usage.js", ["./dashboard/usage.js", "text/javascript; charset=utf-8"]],
|
|
21
22
|
["/context.js", ["./dashboard/context.js", "text/javascript; charset=utf-8"]],
|
|
22
23
|
["/updates.js", ["./dashboard/updates.js", "text/javascript; charset=utf-8"]],
|
package/src/responses-bridge.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { markToolActivity } from "./stream-performance.mjs";
|
|
1
2
|
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { chatCompletions } from "./copilot.mjs";
|
|
3
4
|
import { webStreamLines } from "./stream.mjs";
|
|
@@ -383,6 +384,7 @@ export async function forwardToChat(chatReq, emitEvent, onDone, onError, options
|
|
|
383
384
|
emitEvent = async (...args) => {
|
|
384
385
|
const written = await configuredEmitEvent(...args);
|
|
385
386
|
if (written === false) throw downstreamClosed;
|
|
387
|
+
if (args[1]?.item || args[1]?.response?.output) markToolActivity(args[1]);
|
|
386
388
|
return written;
|
|
387
389
|
};
|
|
388
390
|
let performanceOutputSeen = false;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { markToolActivity } from "./stream-performance.mjs";
|
|
1
2
|
import { defaultGithubProvider } from "./providers/github.mjs";
|
|
2
3
|
import { observeContextSession } from "./context-metrics.mjs";
|
|
3
4
|
import {
|
|
@@ -484,6 +485,7 @@ export function createResponsesHandler(options) {
|
|
|
484
485
|
return;
|
|
485
486
|
}
|
|
486
487
|
const response = chatToResponses(JSON.parse(data), model, { toolChoice, ...(carbonBridge ? { toolAdapter: carbonBridge } : {}) });
|
|
488
|
+
markToolActivity(response);
|
|
487
489
|
markResponseTerminal(response.status, {
|
|
488
490
|
model: response.model || model, origin: "chat_completion", reason: response.incomplete_details?.reason,
|
|
489
491
|
});
|
package/src/responses-proxy.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { markToolActivity } from "./stream-performance.mjs";
|
|
1
2
|
import { responses as copilotResponses } from "./copilot.mjs";
|
|
2
3
|
import {
|
|
3
4
|
logRequestFailure,
|
|
@@ -124,6 +125,7 @@ function inspectResponseSseEvent(state, eventName, data) {
|
|
|
124
125
|
);
|
|
125
126
|
}
|
|
126
127
|
const eventType = event.type || (event.error ? "error" : eventName);
|
|
128
|
+
if (event.item || event.response?.output) markToolActivity(event);
|
|
127
129
|
const previousSequence = state.lastSequence;
|
|
128
130
|
state.lastSequence = event.sequence_number ?? previousSequence + 1;
|
|
129
131
|
if (event.response && typeof event.response === "object" && !Array.isArray(event.response)) {
|
|
@@ -673,6 +675,7 @@ export async function proxyCopilotResponses(reqContext, req, res, upstream = cop
|
|
|
673
675
|
data,
|
|
674
676
|
);
|
|
675
677
|
response = reqContext.protectCompactionResult?.(response) || response;
|
|
678
|
+
markToolActivity(response);
|
|
676
679
|
rememberResponseHistory(reqContext, reqContext.privacyRestore?.(response) || response);
|
|
677
680
|
if (!resp[COMPACTION_USAGE_RECORDED]) recordResponsesUsage({
|
|
678
681
|
surface: reqContext.surface,
|
|
@@ -722,6 +725,7 @@ export async function proxyCopilotResponses(reqContext, req, res, upstream = cop
|
|
|
722
725
|
continue;
|
|
723
726
|
}
|
|
724
727
|
}
|
|
728
|
+
markToolActivity(response);
|
|
725
729
|
rememberResponseHistory(reqContext, reqContext.privacyRestore?.(response) || response);
|
|
726
730
|
if (!reqContext.compactionUsageRecorded) recordResponsesUsage({
|
|
727
731
|
surface: reqContext.surface,
|
|
@@ -5,6 +5,7 @@ import { applicationLabel } from "./request-application.mjs";
|
|
|
5
5
|
import { createContextMetrics } from "./context-metrics.mjs";
|
|
6
6
|
import { createChangeSignal } from "./activity-events.mjs";
|
|
7
7
|
import { redactDiagnosticText } from "./diagnostic-text.mjs";
|
|
8
|
+
import { createToolActivity, isToolActivityOutput } from "./tool-activity.mjs";
|
|
8
9
|
|
|
9
10
|
const PERFORMANCE_ROUTES = Object.freeze(["responses", "responses_compact"]);
|
|
10
11
|
const PREPARATION_STAGES = Object.freeze(["admission", "body", "history", "images", "serialization"]);
|
|
@@ -217,6 +218,7 @@ function routeSnapshot(route) {
|
|
|
217
218
|
|
|
218
219
|
export function createStreamPerformanceMetrics({ now = () => performance.now(), wallNow = () => new Date().toISOString(), routeNames = PERFORMANCE_ROUTES } = {}) {
|
|
219
220
|
const changes = createChangeSignal();
|
|
221
|
+
const toolActivity = createToolActivity({ now, changed: changes.changed });
|
|
220
222
|
const routes = Object.fromEntries(routeNames.map((name) => [name, createRoutePerformance()]));
|
|
221
223
|
const recentRequests = [];
|
|
222
224
|
const contexts = createContextMetrics();
|
|
@@ -260,6 +262,9 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
260
262
|
let terminalAt = null;
|
|
261
263
|
const context = { payload_bytes: null, images: null, input_tokens: null, context_window_tokens: null, output_tokens: null, max_output_tokens_requested: null, max_output_tokens_sent: null };
|
|
262
264
|
let stopReason = null;
|
|
265
|
+
let toolObserver = null;
|
|
266
|
+
const tools = () => toolObserver ||= toolActivity.request(() => ({ application: client, session,
|
|
267
|
+
provider: provider || currentRequestContext()?.provider, model: model === "other" ? currentRequestContext()?.requestedModel || model : model }));
|
|
263
268
|
const elapsed = (time) => time === null ? null : Number(Math.max(0, time - requestStartedAt).toFixed(1));
|
|
264
269
|
if (activeRequests.size < MAX_ACTIVE_REQUESTS) activeRequests.set(activeId, () => ({
|
|
265
270
|
request_id: safeRequestId, session_id: session ? session.slice(0, 16) : null, application: client, purpose: purposeLabel, route: routeName, provider, model, phase,
|
|
@@ -299,6 +304,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
299
304
|
},
|
|
300
305
|
upstreamStarted(streaming = true) {
|
|
301
306
|
if (finished) return;
|
|
307
|
+
if (attempts && toolObserver) { toolObserver.finish("unknown");toolObserver = null; }
|
|
302
308
|
const time = now();
|
|
303
309
|
attempts += 1;
|
|
304
310
|
if (attemptTimings.length === 3) attemptTimings.splice(1, 1);
|
|
@@ -322,6 +328,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
322
328
|
},
|
|
323
329
|
upstreamActivity() {
|
|
324
330
|
if (finished) return;
|
|
331
|
+
toolObserver?.activity();
|
|
325
332
|
lastActivityAt = now();
|
|
326
333
|
if (phase !== "upstream_stream") { phase = "upstream_stream";changes.changed(); }
|
|
327
334
|
},
|
|
@@ -344,6 +351,8 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
344
351
|
setProvider: assignProvider,
|
|
345
352
|
setPurpose(value) { if (!finished) { purposeLabel = requestPurpose(value);changes.changed(); } },
|
|
346
353
|
observeSession(key) { if (!finished && typeof key === "string" && /^[a-f0-9]{64}$/.test(key)) session = key; },
|
|
354
|
+
observeToolInput(body, protocol) { if (!finished && purposeLabel === "conversation" && toolActivity.size) tools().input(body, protocol); },
|
|
355
|
+
observeToolOutput(value, protocol) { if (!finished && purposeLabel === "conversation" && isToolActivityOutput(value, protocol)) tools().output(value, protocol); },
|
|
347
356
|
attemptCount() { return attempts; },
|
|
348
357
|
attemptTimings() { return attemptTimings.map(attempt => ({ ...attempt })); },
|
|
349
358
|
observeContext(values) {
|
|
@@ -390,6 +399,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
390
399
|
changes.changed();
|
|
391
400
|
failed ||= finishFailed;
|
|
392
401
|
const outcome = terminalOutcome || (aborted ? "cancelled" : "unknown");
|
|
402
|
+
toolObserver?.finish(aborted ? "cancelled" : statusCode >= 400 ? "failed" : outcome);
|
|
393
403
|
const emptyStreamCompletion = outcome === "completed" && upstreamStartedAt !== null
|
|
394
404
|
&& firstOutputAt === null && outputTokens === 0;
|
|
395
405
|
if (emptyStreamCompletion) route.empty_stream_completions += 1;
|
|
@@ -464,6 +474,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
464
474
|
contextSnapshot: () => contexts.snapshot(),
|
|
465
475
|
activitySnapshot() {
|
|
466
476
|
return {
|
|
477
|
+
tool_activity: toolActivity.snapshot(),
|
|
467
478
|
by_route: Object.fromEntries(routeNames.map(name => [name, {
|
|
468
479
|
terminal_outcomes: { totals: { ...routes[name].terminalTotals } },
|
|
469
480
|
by_provider: Object.fromEntries([...routes[name].providers].map(([id, value]) => [id, {
|
|
@@ -477,6 +488,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
477
488
|
},
|
|
478
489
|
snapshot() {
|
|
479
490
|
return {
|
|
491
|
+
tool_activity: toolActivity.snapshot(),
|
|
480
492
|
by_route: Object.fromEntries(routeNames.map((name) => [name, routeSnapshot(routes[name])])),
|
|
481
493
|
active_requests: [...activeRequests.values()].map(snapshot => snapshot()),
|
|
482
494
|
active_total: activeTotal,
|
|
@@ -557,3 +569,7 @@ export function markResponseErrorOrigin(origin) {
|
|
|
557
569
|
export function markResponseTerminal(outcome, options) {
|
|
558
570
|
tracker()?.terminal?.(outcome, options);
|
|
559
571
|
}
|
|
572
|
+
|
|
573
|
+
export function markToolActivity(value, protocol = "responses") {
|
|
574
|
+
tracker()?.observeToolOutput?.(value, protocol);
|
|
575
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { hash } from "node:crypto";
|
|
2
|
+
import { redactDiagnosticText } from "./diagnostic-text.mjs";
|
|
3
|
+
|
|
4
|
+
export const TOOL_ACTIVITY_LIMITS = Object.freeze({ retained: 128, visible: 32, per_request: 32, stale_ms: 90_000, terminal_ms: 15_000, unknown_ms: 300_000 });
|
|
5
|
+
const pending = state => state === "preparing" || state === "waiting";
|
|
6
|
+
const nameOf = value => typeof value === "string" && /^[\w./:@-]{1,80}$/.test(value) && redactDiagnosticText(value) === value ? value : null;
|
|
7
|
+
const idOf = value => typeof value === "string" && value.length > 0 && value.length <= 256 ? value : null;
|
|
8
|
+
const toolTypes = new Set(["function_call", "custom_tool_call", "web_search_call", "file_search_call", "computer_call", "tool_search_call", "mcp_call", "shell_call", "image_generation_call", "program", "multi_agent_call"]);
|
|
9
|
+
const hostedTools = new Set(["web_search_call", "file_search_call", "mcp_call", "image_generation_call"]);
|
|
10
|
+
const messageResult = value => typeof value?.type === "string" && value.type.endsWith("_tool_result") && idOf(value.tool_use_id);
|
|
11
|
+
const items = value => Array.isArray(value) ? value.slice(0, 64) : [];
|
|
12
|
+
export function isToolActivityOutput(value, protocol = "responses") {
|
|
13
|
+
if (!value || typeof value !== "object") return false;
|
|
14
|
+
if (protocol === "messages") return ["tool_use", "server_tool_use", "mcp_tool_use"].includes((value.content_block || value).type) || Boolean(messageResult(value.content_block || value))
|
|
15
|
+
|| items(value.content).some(item => ["tool_use", "server_tool_use", "mcp_tool_use"].includes(item?.type) || messageResult(item));
|
|
16
|
+
if (protocol === "gemini") return Boolean(value.functionCall) || items((value.response || value).candidates).some(candidate => items(candidate?.content?.parts).some(part => part?.functionCall));
|
|
17
|
+
return toolTypes.has((value.item || value).type) || items(value.response?.output || value.output).some(item => toolTypes.has(item?.type));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Metadata only: arguments, input/output text and raw conversation/call IDs never leave the request.
|
|
21
|
+
export function createToolActivity({ now = Date.now, changed = () => {} } = {}) {
|
|
22
|
+
const entries = new Map();let sequence = 0;
|
|
23
|
+
function sweep() {
|
|
24
|
+
const time = now();
|
|
25
|
+
for (const [key, entry] of entries) {
|
|
26
|
+
if (pending(entry.state) && time - entry.updated >= TOOL_ACTIVITY_LIMITS.stale_ms) { entry.state = "unknown";entry.updated = time; }
|
|
27
|
+
if (!pending(entry.state) && time - entry.updated >= (entry.state === "unknown" ? TOOL_ACTIVITY_LIMITS.unknown_ms : TOOL_ACTIVITY_LIMITS.terminal_ms)) entries.delete(key);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const change = (entry, state) => {
|
|
31
|
+
if (!entry || entry.state === state || !pending(entry.state) && entry.state !== "unknown") return;
|
|
32
|
+
entry.state = state;entry.updated = now();changed();
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
get size() { return entries.size; },
|
|
36
|
+
request(metadata) {
|
|
37
|
+
const aliases = new Map(), owned = new Set(), local = ++sequence;
|
|
38
|
+
let lastNotice = now();
|
|
39
|
+
const scope = () => { const m = metadata();return m.session ? `${m.application}\0${m.session}` : `request:${local}`; };
|
|
40
|
+
const keyFor = id => hash("sha256", `${scope()}\0${id}`, "hex");
|
|
41
|
+
function record(id, name, alias, resultId) {
|
|
42
|
+
id = idOf(id);const known = aliases.get(id) || aliases.get(alias);
|
|
43
|
+
if (known) { const next = nameOf(name);if (next && known.name !== next) { known.name = next;changed(); }if (id) aliases.set(id, known);if (idOf(resultId)) known.result_key = keyFor(resultId);return known; }
|
|
44
|
+
if (owned.size >= TOOL_ACTIVITY_LIMITS.per_request) return null;
|
|
45
|
+
sweep();const key = keyFor(id || `anonymous:${local}:${owned.size}`), m = metadata();
|
|
46
|
+
if (entries.has(key) && pending(entries.get(key).state)) return entries.get(key);
|
|
47
|
+
const entry = { id: `tool-${++sequence}`, application: m.application, provider: m.provider || "unknown", model: m.model,
|
|
48
|
+
name: nameOf(name), state: "preparing", updated: now(), key, scope: scope(), ...(idOf(resultId) ? { result_key: keyFor(resultId) } : {}) };
|
|
49
|
+
entries.set(key, entry);owned.add(entry);if (id) aliases.set(id, entry);if (alias !== undefined) aliases.set(alias, entry);
|
|
50
|
+
while (entries.size > TOOL_ACTIVITY_LIMITS.retained) entries.delete(entries.keys().next().value);
|
|
51
|
+
changed();return entry;
|
|
52
|
+
}
|
|
53
|
+
function output(value, protocol = "responses") {
|
|
54
|
+
if (!value || typeof value !== "object") return;
|
|
55
|
+
if (protocol === "messages") {
|
|
56
|
+
const block = value.type === "content_block_start" ? value.content_block : value;
|
|
57
|
+
if (["tool_use", "server_tool_use", "mcp_tool_use"].includes(block?.type)) record(block.id, block.name, value.index);
|
|
58
|
+
else if (messageResult(block)) change(aliases.get(block.tool_use_id), block.is_error === true ? "failed" : "returned");
|
|
59
|
+
else if (Array.isArray(value.content)) for (const item of value.content.slice(0, 64)) output(item, protocol);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (protocol === "gemini") {
|
|
63
|
+
if (value.functionCall) {
|
|
64
|
+
const id = idOf(value.functionCall.id), name = nameOf(value.functionCall.name);
|
|
65
|
+
if (!id && !name) return;
|
|
66
|
+
const alias = id ? undefined : `gemini:${name}:${value.index ?? 0}`;
|
|
67
|
+
const prior = alias === undefined ? null : aliases.get(alias);
|
|
68
|
+
if (prior) prior.ambiguous = true;
|
|
69
|
+
record(id, name, alias);
|
|
70
|
+
}
|
|
71
|
+
else for (const candidate of items((value.response || value).candidates)) for (const [index, part] of items(candidate?.content?.parts).entries()) {
|
|
72
|
+
if (part?.functionCall) output({ functionCall: part.functionCall, index }, protocol);
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const item = value.item || value;
|
|
77
|
+
if (toolTypes.has(item.type)) {
|
|
78
|
+
const entry = record(item.call_id || item.id, item.name || item.type, value.output_index ?? item.id, item.call_id);
|
|
79
|
+
if (["completed", "failed", "cancelled"].includes(item.status) && hostedTools.has(item.type)) {
|
|
80
|
+
change(entry, item.status === "completed" ? "returned" : item.status);
|
|
81
|
+
}
|
|
82
|
+
} else if (value.response?.output || value.output) {
|
|
83
|
+
for (const item of items(value.response?.output || value.output)) output(item, protocol);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
output,
|
|
88
|
+
activity() {
|
|
89
|
+
const time = now();let active = false;
|
|
90
|
+
for (const entry of owned) if (entry.state === "preparing") { entry.updated = time;active = true; }
|
|
91
|
+
if (active && time - lastNotice >= 1000) { lastNotice = time;changed(); }
|
|
92
|
+
},
|
|
93
|
+
input(body, protocol) {
|
|
94
|
+
if (!entries.size || !metadata().session || !body || typeof body !== "object") return;
|
|
95
|
+
const results = [];
|
|
96
|
+
const inspect = part => {
|
|
97
|
+
if (["function_call_output", "custom_tool_call_output", "computer_call_output", "shell_call_output"].includes(part?.type)) results.push({ id: part.call_id });
|
|
98
|
+
else if (part?.type === "tool_result") results.push({ id: part.tool_use_id, error: part.is_error === true });
|
|
99
|
+
else if (part?.role === "tool") results.push({ id: part.tool_call_id });
|
|
100
|
+
else if (part?.functionResponse) results.push({ id: part.functionResponse.id, name: nameOf(part.functionResponse.name) });
|
|
101
|
+
};
|
|
102
|
+
if (Array.isArray(body.input)) for (const item of body.input.slice(-64)) inspect(item);
|
|
103
|
+
else if (Array.isArray(body.messages)) for (const message of body.messages.slice(-8)) {
|
|
104
|
+
inspect(message);if (Array.isArray(message?.content)) for (const part of message.content.slice(-64)) inspect(part);
|
|
105
|
+
}
|
|
106
|
+
else if (protocol === "gemini" && Array.isArray(body.contents)) for (const message of body.contents.slice(-8)) {
|
|
107
|
+
for (const part of items(message?.parts)) inspect(part);
|
|
108
|
+
}
|
|
109
|
+
for (const result of results) {
|
|
110
|
+
const resultKey = idOf(result.id) ? keyFor(result.id) : null;
|
|
111
|
+
let entry = resultKey ? entries.get(resultKey) || [...entries.values()].find(item => item.result_key === resultKey) : null;
|
|
112
|
+
if (!entry && result.name) {
|
|
113
|
+
const matches = [...entries.values()].filter(item => pending(item.state) && item.scope === scope() && item.name === result.name);
|
|
114
|
+
if (matches.length === 1) entry = matches[0];
|
|
115
|
+
}
|
|
116
|
+
change(entry, result.error ? "failed" : "returned");
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
finish(outcome) {
|
|
120
|
+
for (const entry of owned) {
|
|
121
|
+
entry.scope = scope();
|
|
122
|
+
change(entry, outcome === "completed" ? metadata().session && !entry.ambiguous ? "waiting" : "unknown" : ["failed", "cancelled"].includes(outcome) ? outcome : "unknown");
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
snapshot() {
|
|
128
|
+
sweep();const time = now(), all = [...entries.values()].reverse();
|
|
129
|
+
all.sort((a, b) => Number(pending(b.state)) - Number(pending(a.state)));
|
|
130
|
+
return { items: all.slice(0, TOOL_ACTIVITY_LIMITS.visible).map(({ key, scope, result_key, ambiguous, updated, ...entry }) => ({ ...entry,
|
|
131
|
+
expires_in_ms: Math.max(0, (pending(entry.state) ? TOOL_ACTIVITY_LIMITS.stale_ms : entry.state === "unknown" ? TOOL_ACTIVITY_LIMITS.unknown_ms : TOOL_ACTIVITY_LIMITS.terminal_ms) - (time - updated)) })),
|
|
132
|
+
omitted: Math.max(0, all.length - TOOL_ACTIVITY_LIMITS.visible), limits: TOOL_ACTIVITY_LIMITS };
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|