agentus 0.6.0 → 0.7.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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/docs/installation.md +7 -2
- package/docs/installation.zh-CN.md +5 -2
- package/package.json +2 -1
- package/packages/server/mock/agent.mjs +19 -1
- package/packages/server/src/acp/cold-page.ts +82 -0
- package/packages/server/src/acp/session-manager.ts +57 -13
- package/packages/server/src/cockpit/api.ts +14 -2
- package/packages/server/src/dashscope.ts +29 -18
- package/packages/server/src/index.ts +31 -4
- package/packages/server/src/settings.ts +31 -2
- package/packages/server/src/speech/route.ts +31 -5
- package/packages/shared/src/index.ts +5 -0
- package/packages/web/dist/assets/{index-DDGyKK0Y.js → index-CVRWqhK2.js} +52 -52
- package/packages/web/dist/assets/index-D118Mu9V.css +32 -0
- package/packages/web/dist/index.html +2 -2
- package/packages/web/dist/assets/index-Cr0Hw9eP.css +0 -32
|
@@ -56,8 +56,10 @@ const BUILTIN: Record<string, { baseUrl: string; keys: string[]; baseEnv?: strin
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* ACP model ids arrive as `deepseek:deepseek-v4-flash` (provider prefix, wire form) or
|
|
59
|
-
* `openrouter:anthropic/claude-x
|
|
60
|
-
*
|
|
59
|
+
* `openrouter:anthropic/claude-x`. Returns "" for a bare id with no prefix — the caller then has to
|
|
60
|
+
* ask config.yaml who owns it. The `provider/model` form is NOT handled here (a prefix here can be
|
|
61
|
+
* a vendor namespace rather than a provider); `slashProvider()` below resolves it with the provider
|
|
62
|
+
* tables in hand (#36).
|
|
61
63
|
*/
|
|
62
64
|
export function splitModelId(raw: string | null | undefined): { provider: string; model: string } {
|
|
63
65
|
const id = String(raw ?? "").trim();
|
|
@@ -91,6 +93,21 @@ function readConfig(home: string | null): Record<string, unknown> {
|
|
|
91
93
|
const asString = (v: unknown): string => (typeof v === "string" ? v.trim() : typeof v === "number" ? String(v) : "");
|
|
92
94
|
const trimSlash = (u: string): string => u.replace(/\/+$/, "");
|
|
93
95
|
|
|
96
|
+
/**
|
|
97
|
+
* `provider/model` — the second id form a session can report. Only stripped when the prefix really
|
|
98
|
+
* names a provider this box knows (declared in config.yaml or in the builtin table): a catalogue
|
|
99
|
+
* slug like `anthropic/claude-x` must survive intact, or an OpenRouter model id would be mangled
|
|
100
|
+
* into provider `anthropic` + model `claude-x`.
|
|
101
|
+
*/
|
|
102
|
+
function slashProvider(cfgProviders: Record<string, unknown>, model: string): { provider: string; model: string } {
|
|
103
|
+
const slash = model.indexOf("/");
|
|
104
|
+
if (slash <= 0) return { provider: "", model };
|
|
105
|
+
const cand = model.slice(0, slash).trim().toLowerCase();
|
|
106
|
+
if (!(cand in BUILTIN) && !(cand in cfgProviders)) return { provider: "", model };
|
|
107
|
+
const rest = model.slice(slash + 1).trim();
|
|
108
|
+
return rest ? { provider: cand, model: rest } : { provider: "", model };
|
|
109
|
+
}
|
|
110
|
+
|
|
94
111
|
/**
|
|
95
112
|
* Resolve the route for one session's model. `home` is the home of the backend that session runs
|
|
96
113
|
* on (`planFor(row).home`) — reading a DIFFERENT agent's config would hand this call a key its
|
|
@@ -101,10 +118,19 @@ export function routeForModel(modelId: string | null | undefined, home: string |
|
|
|
101
118
|
why: string;
|
|
102
119
|
} {
|
|
103
120
|
const parsed = splitModelId(modelId);
|
|
104
|
-
|
|
105
|
-
if (!model) return { route: null, why: "会话还没报出模型(agent 未握手)" };
|
|
121
|
+
if (!parsed.model) return { route: null, why: "会话还没报出模型(agent 未握手)" };
|
|
106
122
|
|
|
107
123
|
const cfg = readConfig(home);
|
|
124
|
+
// Slash form is a LAST resort after the colon form (#36): `deepseek/deepseek-v4-flash` is what
|
|
125
|
+
// this session reports, and before this the split returned no provider at all, so the summary
|
|
126
|
+
// silently fell back to the voice endpoint on `qwen-flash`.
|
|
127
|
+
const slash = parsed.provider
|
|
128
|
+
? { provider: parsed.provider, model: parsed.model }
|
|
129
|
+
: slashProvider(
|
|
130
|
+
(cfg.providers && typeof cfg.providers === "object" ? cfg.providers : {}) as Record<string, unknown>,
|
|
131
|
+
parsed.model,
|
|
132
|
+
);
|
|
133
|
+
const model = slash.model;
|
|
108
134
|
// An alias row may rename the model as well as point at a provider (`lab-qwen38-27b` →
|
|
109
135
|
// `qwen38-27b`); the wire id is not the name the vendor knows.
|
|
110
136
|
const aliasRow = (aliases: Record<string, unknown>): Record<string, unknown> | null => {
|
|
@@ -121,7 +147,7 @@ export function routeForModel(modelId: string | null | undefined, home: string |
|
|
|
121
147
|
// Who owns this model? The id's own prefix wins; otherwise config.yaml's default provider, and
|
|
122
148
|
// only when the model really is that default (a session can be running a model the default no
|
|
123
149
|
// longer names — then guessing the provider would send the request to the wrong vendor).
|
|
124
|
-
let provider =
|
|
150
|
+
let provider = slash.provider;
|
|
125
151
|
if (!provider) {
|
|
126
152
|
if (aliasNow) provider = asString(aliasNow.provider).toLowerCase();
|
|
127
153
|
}
|
|
@@ -263,6 +263,11 @@ export interface BackgroundTask {
|
|
|
263
263
|
status: "running" | "exited";
|
|
264
264
|
uptimeSeconds?: number;
|
|
265
265
|
exitCode?: number | null;
|
|
266
|
+
/** Does this process OWE the session a wake-up (`notify_on_complete`)? Issue #35: that is the
|
|
267
|
+
* difference between 「agent 已经收工」 and 「agent 还在等这次唤醒才能继续」. Optional — an
|
|
268
|
+
* older agent never sends it, and `undefined` must read as "silent", never as "unknown so
|
|
269
|
+
* show it anyway". */
|
|
270
|
+
notifyOnComplete?: boolean;
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
export interface WebNotice {
|