@nextclaw/server 0.4.10 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +9 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ type AgentProfileView = {
|
|
|
32
32
|
workspace?: string;
|
|
33
33
|
model?: string;
|
|
34
34
|
maxTokens?: number;
|
|
35
|
+
contextTokens?: number;
|
|
35
36
|
maxToolIterations?: number;
|
|
36
37
|
};
|
|
37
38
|
type BindingPeerView = {
|
|
@@ -54,6 +55,9 @@ type SessionConfigView = {
|
|
|
54
55
|
};
|
|
55
56
|
type RuntimeConfigUpdate = {
|
|
56
57
|
agents?: {
|
|
58
|
+
defaults?: {
|
|
59
|
+
contextTokens?: number;
|
|
60
|
+
};
|
|
57
61
|
list?: AgentProfileView[];
|
|
58
62
|
};
|
|
59
63
|
bindings?: AgentBindingView[];
|
|
@@ -65,6 +69,7 @@ type ConfigView = {
|
|
|
65
69
|
model: string;
|
|
66
70
|
workspace?: string;
|
|
67
71
|
maxTokens?: number;
|
|
72
|
+
contextTokens?: number;
|
|
68
73
|
maxToolIterations?: number;
|
|
69
74
|
};
|
|
70
75
|
list?: AgentProfileView[];
|
package/dist/index.js
CHANGED
|
@@ -393,6 +393,12 @@ function updateChannel(configPath, channelName, patch) {
|
|
|
393
393
|
}
|
|
394
394
|
function updateRuntime(configPath, patch) {
|
|
395
395
|
const config = loadConfigOrDefault(configPath);
|
|
396
|
+
if (patch.agents?.defaults && Object.prototype.hasOwnProperty.call(patch.agents.defaults, "contextTokens")) {
|
|
397
|
+
const nextContextTokens = patch.agents.defaults.contextTokens;
|
|
398
|
+
if (typeof nextContextTokens === "number" && Number.isFinite(nextContextTokens)) {
|
|
399
|
+
config.agents.defaults.contextTokens = Math.max(1e3, Math.trunc(nextContextTokens));
|
|
400
|
+
}
|
|
401
|
+
}
|
|
396
402
|
if (patch.agents && Object.prototype.hasOwnProperty.call(patch.agents, "list")) {
|
|
397
403
|
config.agents.list = (patch.agents.list ?? []).map((entry) => ({
|
|
398
404
|
...entry,
|
|
@@ -495,6 +501,9 @@ function createUiRouter(options) {
|
|
|
495
501
|
return c.json(err("INVALID_BODY", "invalid json body"), 400);
|
|
496
502
|
}
|
|
497
503
|
const result = updateRuntime(options.configPath, body.data);
|
|
504
|
+
if (body.data.agents?.defaults && Object.prototype.hasOwnProperty.call(body.data.agents.defaults, "contextTokens")) {
|
|
505
|
+
options.publish({ type: "config.updated", payload: { path: "agents.defaults.contextTokens" } });
|
|
506
|
+
}
|
|
498
507
|
options.publish({ type: "config.updated", payload: { path: "agents.list" } });
|
|
499
508
|
options.publish({ type: "config.updated", payload: { path: "bindings" } });
|
|
500
509
|
options.publish({ type: "config.updated", payload: { path: "session" } });
|