dsh-ntr 0.3.1 → 0.3.3
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.en.md +3 -1
- package/README.md +3 -1
- package/cordis.patch.yml +17 -1
- package/lib/bridge.js +2436 -82
- package/lib/client/acp-ui.js +103 -3
- package/lib/client/acp-view.js +24 -4
- package/lib/client/activity-pill.js +156 -0
- package/lib/client/branch-action.js +149 -0
- package/lib/client/composer-mode.js +48 -13
- package/lib/client/context-meter.js +86 -0
- package/lib/client/index.js +279 -16
- package/lib/client/model-seat.js +8 -2
- package/lib/client/panel.js +96 -29
- package/lib/client/released-banner.js +66 -0
- package/lib/client/session-controls.js +38 -13
- package/lib/client/slash-isolation.js +2 -2
- package/lib/client/store.js +380 -13
- package/lib/client.js +1364 -70
- package/lib/client.js.map +1 -1
- package/lib/impl.js +1229 -8
- package/lib/index.js +34 -0
- package/lib/protocol.js +19 -0
- package/lib/tps.js +32 -0
- package/lib/types/bridge.d.ts +850 -18
- package/lib/types/client/acp-ui.d.ts +34 -2
- package/lib/types/client/acp-view.d.ts +13 -2
- package/lib/types/client/activity-pill.d.ts +81 -0
- package/lib/types/client/branch-action.d.ts +47 -0
- package/lib/types/client/composer-mode.d.ts +28 -0
- package/lib/types/client/context-meter.d.ts +51 -0
- package/lib/types/client/model-seat.d.ts +21 -0
- package/lib/types/client/released-banner.d.ts +34 -0
- package/lib/types/client/slash-isolation.d.ts +1 -1
- package/lib/types/client/store.d.ts +108 -1
- package/lib/types/impl.d.ts +94 -7
- package/lib/types/protocol.d.ts +145 -0
- package/lib/types/tps.d.ts +17 -0
- package/package.json +2 -1
- package/src/bridge.ts +2754 -86
- package/src/client/acp-ui.tsx +123 -2
- package/src/client/acp-view.tsx +30 -5
- package/src/client/activity-pill.tsx +201 -0
- package/src/client/branch-action.tsx +178 -0
- package/src/client/composer-mode.tsx +59 -13
- package/src/client/context-meter.tsx +128 -0
- package/src/client/index.tsx +298 -15
- package/src/client/model-seat.tsx +28 -3
- package/src/client/panel.tsx +157 -40
- package/src/client/primitives.d.ts +27 -0
- package/src/client/released-banner.tsx +97 -0
- package/src/client/session-controls.tsx +34 -11
- package/src/client/slash-isolation.ts +2 -1
- package/src/client/store.ts +412 -14
- package/src/impl.ts +1251 -13
- package/src/index.ts +33 -0
- package/src/protocol.ts +145 -0
- package/src/tps.ts +40 -0
package/lib/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export function apply(ctx, config) {
|
|
|
32
32
|
turnStallMs: resolved.turnStallMs,
|
|
33
33
|
turnStallToolMs: resolved.turnStallToolMs,
|
|
34
34
|
turnStallTickMs: resolved.turnStallTickMs,
|
|
35
|
+
idleTimeoutMs: resolved.idleTimeoutMs,
|
|
35
36
|
});
|
|
36
37
|
const adapter = new AcpLlmAdapter(manager);
|
|
37
38
|
// Built-in update: the plugin never downloads or swaps files itself. The
|
|
@@ -66,6 +67,12 @@ export function apply(ctx, config) {
|
|
|
66
67
|
? rawConfig.permissionTimeoutMode
|
|
67
68
|
: undefined;
|
|
68
69
|
manager.setConfiguredApprovalDeadlines(configuredDeadlines, configuredMode);
|
|
70
|
+
// The idle-release baseline the settings page's pick outranks. Only the
|
|
71
|
+
// raw value counts: `validateConfig` fills a default in, so the
|
|
72
|
+
// validated number cannot tell "the file says 10 minutes" from
|
|
73
|
+
// "the file says nothing, so 30 minutes applies".
|
|
74
|
+
const configuredIdleTimeoutMs = typeof rawConfig.idleTimeoutMs === 'number' ? rawConfig.idleTimeoutMs : undefined;
|
|
75
|
+
manager.setConfiguredIdleRelease(configuredIdleTimeoutMs);
|
|
69
76
|
// Boot hook kept only so this entry point's shape does not change:
|
|
70
77
|
// `bootstrapCatalogs` is intentionally empty — boot never spawns an agent,
|
|
71
78
|
// in any environment and for any `probeModelsOnBoot` value. Catalogs fill
|
|
@@ -209,6 +216,33 @@ export function apply(ctx, config) {
|
|
|
209
216
|
wireAcpMode();
|
|
210
217
|
});
|
|
211
218
|
}
|
|
219
|
+
const wireAttachments = (injectedCtx) => {
|
|
220
|
+
const c = injectedCtx ?? ctx;
|
|
221
|
+
let attachments;
|
|
222
|
+
try {
|
|
223
|
+
if (typeof c.get === 'function') {
|
|
224
|
+
attachments = c.get('attachments') ?? c.get('attachmentService');
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
catch { }
|
|
228
|
+
try {
|
|
229
|
+
if (attachments === undefined) {
|
|
230
|
+
attachments = c.attachments ?? c.attachmentService;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch { }
|
|
234
|
+
if (attachments !== undefined) {
|
|
235
|
+
manager.setAttachmentResolver(attachments);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
manager.setAttachmentResolver(c);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
wireAttachments();
|
|
242
|
+
if (typeof ctx.inject === 'function') {
|
|
243
|
+
ctx.inject(['attachments'], injectedCtx => { wireAttachments(injectedCtx); });
|
|
244
|
+
ctx.inject(['attachmentService'], injectedCtx => { wireAttachments(injectedCtx); });
|
|
245
|
+
}
|
|
212
246
|
const registerLlm = (llmHandle) => {
|
|
213
247
|
ctx.effect(() => {
|
|
214
248
|
// The route exists so the host's driver can reach this adapter at all:
|
package/lib/protocol.js
CHANGED
|
@@ -17,3 +17,22 @@
|
|
|
17
17
|
*/
|
|
18
18
|
/** Default when nothing was ever saved: the breathing halo at normal speed. */
|
|
19
19
|
export const DEFAULT_TAG_HALO = { mode: 'breath', speed: 'normal' };
|
|
20
|
+
/**
|
|
21
|
+
* The idle-release windows the settings page offers, in MILLISECONDS.
|
|
22
|
+
*
|
|
23
|
+
* ONE ladder, shared by both halves: the browser snaps its slider to these
|
|
24
|
+
* values and the host accepts only these values, so a window the slider can
|
|
25
|
+
* produce is always a window the host runs. The first rung is 1 minute (an
|
|
26
|
+
* aggressive release), the rest are 5-minute steps up to an hour.
|
|
27
|
+
*/
|
|
28
|
+
export const IDLE_RELEASE_MS = [
|
|
29
|
+
60_000, 300_000, 600_000, 900_000, 1_200_000, 1_500_000, 1_800_000, 2_100_000, 2_400_000, 2_700_000, 3_000_000, 3_300_000, 3_600_000,
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* The built-in idle-release window for chat processes: 30 minutes.
|
|
33
|
+
*
|
|
34
|
+
* Lives beside the ladder it is a rung of, so the two cannot drift: a
|
|
35
|
+
* deployment that names no window of its own runs this, and the settings
|
|
36
|
+
* page's reset returns to it.
|
|
37
|
+
*/
|
|
38
|
+
export const DEFAULT_IDLE_TIMEOUT_MS = 1_800_000;
|
package/lib/tps.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** ACP `usage_update` is context occupancy, not request tokens; this is the plugin's 4-chars/token OUTPUT estimate (tool args excluded). */
|
|
2
|
+
export const OUTPUT_CHARS_PER_TOKEN = 4;
|
|
3
|
+
export const BURST_GAP_MS = 1000;
|
|
4
|
+
export class TurnTpsTracker {
|
|
5
|
+
gapMs;
|
|
6
|
+
lastProseAt;
|
|
7
|
+
outputChars = 0;
|
|
8
|
+
burstMs = 0;
|
|
9
|
+
constructor(gapMs = BURST_GAP_MS) {
|
|
10
|
+
this.gapMs = gapMs;
|
|
11
|
+
}
|
|
12
|
+
onProse(text, at) {
|
|
13
|
+
if (text === '')
|
|
14
|
+
return;
|
|
15
|
+
if (this.lastProseAt !== undefined) {
|
|
16
|
+
const gap = at - this.lastProseAt;
|
|
17
|
+
if (gap <= this.gapMs)
|
|
18
|
+
this.burstMs += gap;
|
|
19
|
+
}
|
|
20
|
+
this.lastProseAt = at;
|
|
21
|
+
this.outputChars += text.length;
|
|
22
|
+
}
|
|
23
|
+
onBreak() {
|
|
24
|
+
this.lastProseAt = undefined;
|
|
25
|
+
}
|
|
26
|
+
snapshot() {
|
|
27
|
+
return {
|
|
28
|
+
outputTokens: Math.round(this.outputChars / OUTPUT_CHARS_PER_TOKEN),
|
|
29
|
+
burstMs: this.burstMs,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|