@toddzheng024/dscode-bundle 0.7.6 → 0.7.8
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/THIRD_PARTY_NOTICES.md +3 -3
- package/cordis.patch.yml +26 -5
- package/package.json +4 -4
- package/plugins/auto-review/index.mjs +6 -1
- package/plugins/code-review/index.mjs +109 -62
- package/plugins/compaction/tetris.mjs +65 -0
- package/plugins/compaction/threshold.mjs +46 -0
- package/plugins/credentials/index.mjs +2 -2
- package/plugins/i18n/messages.mjs +18 -0
- package/plugins/memory/index.mjs +1 -1
- package/plugins/memory/pipeline.mjs +2 -1
- package/plugins/openrouter/adapter.mjs +157 -0
- package/plugins/openrouter/index.mjs +112 -0
- package/plugins/openrouter/models.mjs +157 -0
- package/plugins/openrouter/search.mjs +109 -0
- package/plugins/openrouter/wire.mjs +416 -0
- package/plugins/providers/catalog.mjs +18 -68
- package/plugins/providers/openrouter-account.mjs +171 -0
- package/plugins/session-bridge/communication.mjs +11 -0
- package/plugins/session-bridge/mailbox.mjs +58 -3
- package/plugins/session-bridge/server.mjs +3 -1
- package/plugins/session-cards/manager.mjs +13 -4
- package/plugins/session-metrics/balance.mjs +29 -19
- package/plugins/session-metrics/index.mjs +19 -9
- package/plugins/session-metrics/pricing.mjs +26 -6
- package/plugins/session-metrics/rate.mjs +3 -2
- package/plugins/session-metrics/store.mjs +59 -8
- package/plugins/session-metrics/view.mjs +13 -3
- package/plugins/tui-tools/index.mjs +2 -1
- package/plugins/ultra/policy.mjs +0 -16
- package/presets/dscode/agent.cordis.yml +12 -1
- package/vendor/compaction-basic/index.js +983 -0
- package/vendor/compaction-basic/types/config.d.ts +37 -0
- package/vendor/compaction-basic/types/index.d.ts +84 -0
- package/vendor/compaction-basic/types/region.d.ts +65 -0
- package/vendor/compaction-basic/types/summarizer.d.ts +64 -0
- package/vendor/compaction-basic/types/types.d.ts +73 -0
- package/vendor/tui/dscode-providers/catalog.mjs +18 -68
- package/vendor/tui/dscode-providers/openrouter-account.mjs +171 -0
- package/vendor/tui/index.mjs +390 -165
- package/plugins/session-metrics/openrouter-prices.mjs +0 -96
- package/vendor/pi-ai/index.js +0 -2701
- package/vendor/pi-ai/types/adapter.d.ts +0 -105
- package/vendor/pi-ai/types/auth.d.ts +0 -60
- package/vendor/pi-ai/types/catalog.d.ts +0 -355
- package/vendor/pi-ai/types/config.d.ts +0 -208
- package/vendor/pi-ai/types/context.d.ts +0 -42
- package/vendor/pi-ai/types/discovery.d.ts +0 -43
- package/vendor/pi-ai/types/index.d.ts +0 -69
- package/vendor/pi-ai/types/login.d.ts +0 -21
- package/vendor/pi-ai/types/provider.d.ts +0 -59
- package/vendor/pi-ai/types/replay.d.ts +0 -63
- package/vendor/pi-ai/types/stream.d.ts +0 -43
- /package/vendor/{pi-ai → compaction-basic}/LICENSE +0 -0
|
@@ -18,6 +18,8 @@ export function summarize(rows, events = [], corrupt = false) {
|
|
|
18
18
|
const history = [];
|
|
19
19
|
for (const event of events) {
|
|
20
20
|
if (event.type === 'request/header') route = event.data.header.config;
|
|
21
|
+
// Ledger rows cover everything from the first row's time on, so only older events are
|
|
22
|
+
// backfilled. `continue`, not `break`: the loop must not depend on event ordering.
|
|
21
23
|
if (event.time >= first) continue;
|
|
22
24
|
if (event.type === 'assistant/message' || event.type === 'compaction/summary' && event.data.llmStreamCall) {
|
|
23
25
|
const r = event.type === 'compaction/summary' ? event.data : route;
|
|
@@ -34,7 +36,7 @@ export function summarize(rows, events = [], corrupt = false) {
|
|
|
34
36
|
const u = row.usage;
|
|
35
37
|
if (!u || !Number.isFinite(u.inputTokens) || !Number.isFinite(u.outputTokens)) { cacheUnknown = true; continue; }
|
|
36
38
|
const total = u.inputTokens + (u.cacheReadTokens ?? 0) + (u.cacheWriteTokens ?? 0);
|
|
37
|
-
//
|
|
39
|
+
// OpenRouter reports cache reads only when there are some: a missing count is zero, not unknown.
|
|
38
40
|
input += total; hit += u.cacheReadTokens ?? 0;
|
|
39
41
|
}
|
|
40
42
|
return { cost, unknown, calls, pending, cache: input > 0 && !cacheUnknown ? Math.min(100, hit / input * 100) : null };
|
|
@@ -82,14 +84,22 @@ export function formatFooter(metrics, context, columns = 80, rates, locale = 'en
|
|
|
82
84
|
for (const char of floor) { if (displayWidth(clipped + char) > columns) break; clipped += char; }
|
|
83
85
|
return clipped;
|
|
84
86
|
}
|
|
87
|
+
/** Per-events memo: the status line renders up to once a second, and summarize/average are O(events). */
|
|
88
|
+
const footerCache = new WeakMap();
|
|
85
89
|
export function footerFor(id, stats, columns, header = '', locale = 'en') {
|
|
86
90
|
try {
|
|
87
91
|
const data = id ? source?.(id) : undefined;
|
|
88
92
|
const ledger = id && process.env.DSH_HOME ? readMetrics(process.env.DSH_HOME, id) : { rows: [], corrupt: false };
|
|
89
|
-
const
|
|
93
|
+
const events = data?.events ?? [];
|
|
94
|
+
// Identity alone is not enough: a session event list may be appended to in place.
|
|
95
|
+
const hit = events.length > 0 ? footerCache.get(events) : undefined;
|
|
96
|
+
const tail = events.at(-1)?.time;
|
|
97
|
+
const fresh = hit !== undefined && hit.key === ledger.rows && hit.length === events.length && hit.tail === tail;
|
|
98
|
+
const summary = fresh ? hit.summary : summarize(ledger.rows, events, ledger.corrupt);
|
|
90
99
|
const used = data?.used;
|
|
91
100
|
const capacity = data?.capacity ?? stats.contextWindow;
|
|
92
|
-
const average = sessionAverageTps(
|
|
101
|
+
const average = fresh ? hit.average : sessionAverageTps(events);
|
|
102
|
+
if (events.length > 0 && !fresh) footerCache.set(events, { key: ledger.rows, length: events.length, tail, summary, average });
|
|
93
103
|
return formatFooter(summary, Number.isFinite(used) && capacity > 0 ? used / capacity * 100 : undefined, columns, { current: data?.currentTps, average }, locale, header);
|
|
94
104
|
} catch { return formatFooter({ cost: 0, unknown: true, cache: null }, undefined, columns, { current: null, average: null }, locale, header); }
|
|
95
105
|
}
|
|
@@ -62,7 +62,8 @@ export async function findConflicts(cwd, configs, winners, env = process.env) {
|
|
|
62
62
|
|
|
63
63
|
export function apply(ctx) {
|
|
64
64
|
const diagnosticsHome = process.env.DSH_HOME ?? process.env.DSCODE_HOME;
|
|
65
|
-
|
|
65
|
+
// A minimal composition (and the unit fixtures) may mount no logger; diagnostics are best-effort.
|
|
66
|
+
if (diagnosticsHome) ctx.logger?.exporter?.({ levels: { default: 2 }, export: message => recordRuntimeLog(diagnosticsHome, message) });
|
|
66
67
|
const entries = agent => [
|
|
67
68
|
...(ctx.get('loader')?.entries() ?? []),
|
|
68
69
|
...(agent?.ctx ? standingMountFor(agent.ctx)?.tree.entries() ?? [] : []),
|
package/plugins/ultra/policy.mjs
CHANGED
|
@@ -16,22 +16,6 @@ export function flashRequest(options, messages) {
|
|
|
16
16
|
return copy;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* The same shaping for pi-ai routes (OpenRouter), on harness-format options:
|
|
21
|
-
* Ultra sends max and adds the collaboration policy. Delegation tools are offered
|
|
22
|
-
* at every effort (the shell policy keeps delegation rare below Ultra); workflow
|
|
23
|
-
* and ralph never are. Returns a copy; the logged input is never mutated.
|
|
24
|
-
*/
|
|
25
|
-
export function piAiRequest(options) {
|
|
26
|
-
const ultra = options.reasoningEffort === 'ultra';
|
|
27
|
-
const next = { ...options, ...(options.tools ? { tools: options.tools.filter(tool => tool.name !== 'workflow' && tool.name !== 'ralph') } : {}), ...(ultra ? { reasoningEffort: 'max' } : {}) };
|
|
28
|
-
if (!ultra || options.purpose || !options.tools?.some(t => t.name === 'subagent' || t.name === 'subagent_fork')) return next;
|
|
29
|
-
if (typeof next.system === 'string') return { ...next, system: next.system + '\n\n' + ULTRA_POLICY };
|
|
30
|
-
const [first, ...rest] = next.messages ?? [];
|
|
31
|
-
if (first?.role === 'system' && Array.isArray(first.content)) return { ...next, messages: [{ ...first, content: [...first.content, { type: 'text', text: '\n\n' + ULTRA_POLICY }] }, ...rest] };
|
|
32
|
-
return { ...next, messages: [{ role: 'system', content: [{ type: 'text', text: ULTRA_POLICY }] }, ...(next.messages ?? [])] };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
19
|
export function ultraRequest(options, messages) {
|
|
36
20
|
if (options.reasoningEffort !== 'ultra' || options.purpose || !options.tools?.some(t => t.name === 'subagent' || t.name === 'subagent_fork')) return messages;
|
|
37
21
|
const copy = messages.map(m => ({ ...m }));
|
|
@@ -28,10 +28,21 @@
|
|
|
28
28
|
prefix: >-
|
|
29
29
|
You are a coding agent powered by the {{model}} model, working through a persistent shell.
|
|
30
30
|
Reply in the language the user writes in.
|
|
31
|
+
Keep the user informed during tool-driven work with ordinary assistant text, visible even when verbose mode is off. Reasoning blocks and tool descriptions do not count as progress updates.
|
|
32
|
+
Before the first tool call, briefly state what you will check or change. For a simple answer without tools, answer directly.
|
|
33
|
+
During sustained work, give a concise progress update roughly every minute when you have control, and when a significant finding, blocker or change of direction occurs. If a long tool call prevents an update, summarize its result when control returns; do not claim to speak while a tool is blocking.
|
|
34
|
+
Use one or two sentences explaining what you learned and what the next step will resolve. Report observable facts and decisions, not private reasoning, raw tool payloads or a narration of every command. Avoid repetitive filler and invented progress.
|
|
35
|
+
Continue working after each update without asking permission for already-authorized steps. Progress text is not the final answer; finish with a self-contained result and any remaining gaps.
|
|
31
36
|
Before changing code, read the relevant code and any project instructions; reuse existing functions and patterns instead of adding new machinery.
|
|
32
37
|
Make routine judgment calls yourself and ask only when different answers would lead to materially different work.
|
|
33
38
|
Deliver the whole requested scope; if part of it is blocked, finish the rest and say what was left out and why.
|
|
34
39
|
Verify changes by running the relevant checks, and report outcomes faithfully: say when a check fails, when a step was skipped, and when something could not be verified.
|
|
40
|
+
Before editing, identify the requested scope and observable acceptance checks. Keep them stable unless the user changes the task or evidence shows a necessary dependency.
|
|
41
|
+
Once the requested behavior and required checks pass, move to delivery. Do not turn a finished task into optional optimization, refactoring or speculative hardening.
|
|
42
|
+
Treat review findings as claims to verify against the actual code and requirements, not automatic instructions. Fix confirmed defects affecting this task; report unrelated opportunities separately.
|
|
43
|
+
After a fix, rerun affected checks. Repeat broader checks only when changed behavior or a failure invalidates the earlier result; do not rerun passing suites just to feel more certain.
|
|
44
|
+
If a check suddenly becomes much slower, inspect the changed workload and the existing output before rerunning it. Keep test fixtures small and independent of production-sized limits.
|
|
45
|
+
Respect the automatic review budget. Reaching it is not proof of correctness: finish necessary fixes and focused checks, report unresolved issues honestly, and continue already-authorized delivery steps when their requirements are met.
|
|
35
46
|
Keep the final reply concise, lead with the outcome, and never claim work you did not do.
|
|
36
47
|
|
|
37
48
|
- id: agent-instructions
|
|
@@ -180,7 +191,7 @@
|
|
|
180
191
|
toolResultPruner: true
|
|
181
192
|
config:
|
|
182
193
|
- id: compaction-basic
|
|
183
|
-
name: '@
|
|
194
|
+
name: '@toddzheng024/dscode-bundle/compaction-basic'
|
|
184
195
|
|
|
185
196
|
- id: command-compact
|
|
186
197
|
name: '@deepseek-ai/dsh-command-compact'
|