@agentprojectcontext/apx 1.48.0 → 1.48.2
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/package.json +1 -1
- package/src/core/voice/stt-hardware.js +13 -4
- package/src/host/daemon/api/sessions.js +6 -10
- package/src/host/daemon/api/shared.js +24 -0
- package/src/host/daemon/api/tasks.js +8 -14
- package/src/host/daemon/api/transcribe.js +5 -1
- package/src/interfaces/web/dist/assets/{index-C9O1GTZ_.js → index-Bgu-xy_L.js} +134 -134
- package/src/interfaces/web/dist/assets/{index-C9O1GTZ_.js.map → index-Bgu-xy_L.js.map} +1 -1
- package/src/interfaces/web/dist/assets/index-C53eJujd.css +1 -0
- package/src/interfaces/web/dist/index.html +2 -2
- package/src/interfaces/web/src/components/voice/VoiceSttCard.tsx +123 -17
- package/src/interfaces/web/src/i18n/en.ts +7 -0
- package/src/interfaces/web/src/i18n/es.ts +7 -0
- package/src/interfaces/web/src/lib/api/sessions.ts +6 -6
- package/src/interfaces/web/src/lib/api/tasks.ts +6 -9
- package/src/interfaces/web/src/lib/api/voice.ts +37 -1
- package/src/interfaces/web/src/lib/http.ts +25 -27
- package/src/interfaces/web/dist/assets/index-CilEtMjV.css +0 -1
package/package.json
CHANGED
|
@@ -31,19 +31,28 @@ export function detectHardware() {
|
|
|
31
31
|
const platform = os.platform(); // "darwin" | "linux" | "win32"
|
|
32
32
|
const arch = os.arch(); // "arm64" | "x64" | ...
|
|
33
33
|
const appleSilicon = platform === "darwin" && arch === "arm64";
|
|
34
|
+
const mem_gb = Math.round((os.totalmem() / 1024 ** 3) * 10) / 10;
|
|
34
35
|
|
|
35
36
|
if (appleSilicon) {
|
|
36
|
-
|
|
37
|
+
// Unified memory: the GPU shares system RAM, so mem_gb is also the VRAM ceiling.
|
|
38
|
+
return { platform, arch, appleSilicon: true, gpu: "metal", gpuName: cpuBrand(), mem_gb, unified_memory: true };
|
|
37
39
|
}
|
|
38
40
|
// NVIDIA: nvidia-smi exits 0 when a CUDA GPU + driver are present.
|
|
39
41
|
if (cmdOk("nvidia-smi", ["-L"])) {
|
|
40
|
-
return { platform, arch, appleSilicon: false, gpu: "cuda" };
|
|
42
|
+
return { platform, arch, appleSilicon: false, gpu: "cuda", gpuName: nvidiaName(), mem_gb };
|
|
41
43
|
}
|
|
42
44
|
// AMD/Radeon: rocminfo (ROCm stack) is the clearest signal on Linux.
|
|
43
45
|
if (platform === "linux" && cmdOk("rocminfo")) {
|
|
44
|
-
return { platform, arch, appleSilicon: false, gpu: "rocm" };
|
|
46
|
+
return { platform, arch, appleSilicon: false, gpu: "rocm", mem_gb };
|
|
45
47
|
}
|
|
46
|
-
return { platform, arch, appleSilicon: false, gpu: "none" };
|
|
48
|
+
return { platform, arch, appleSilicon: false, gpu: "none", gpuName: cpuBrand(), mem_gb };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function nvidiaName() {
|
|
52
|
+
try {
|
|
53
|
+
const r = spawnSync("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], { timeout: 1500, encoding: "utf8" });
|
|
54
|
+
return r.status === 0 ? (r.stdout || "").split("\n")[0].trim() || undefined : undefined;
|
|
55
|
+
} catch { return undefined; }
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
function cpuBrand() {
|
|
@@ -13,26 +13,22 @@ import {
|
|
|
13
13
|
createAgentSessionFile,
|
|
14
14
|
} from "#core/stores/sessions.js";
|
|
15
15
|
import { collectAllSessions } from "#interfaces/cli/commands/sessions.js";
|
|
16
|
+
import { pageEnvelope } from "./shared.js";
|
|
16
17
|
|
|
17
18
|
export function register(app, { projects, project }) {
|
|
18
|
-
// Cross-engine sessions (apx · claude · codex), newest first.
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// ({ sessions }) is unchanged for backward compatibility.
|
|
19
|
+
// Cross-engine sessions (apx · claude · codex), newest first. Returns a
|
|
20
|
+
// { meta, data } envelope (meta = pagination info, data = rows). Paginated
|
|
21
|
+
// via ?limit & ?offset; with no limit, data is the full set as one page.
|
|
22
22
|
app.get("/sessions", (req, res) => {
|
|
23
23
|
const engineId = req.query.engine ? String(req.query.engine) : null;
|
|
24
|
-
const limit = Math.min(parseInt(req.query.limit, 10) || 200, 1000);
|
|
25
|
-
const offset = Math.max(parseInt(req.query.offset, 10) || 0, 0);
|
|
26
24
|
let rows = [];
|
|
27
25
|
try {
|
|
28
26
|
rows = collectAllSessions({}, { engineId });
|
|
29
27
|
} catch (e) {
|
|
30
|
-
return res.status(500).json({ error: e.message,
|
|
28
|
+
return res.status(500).json({ error: e.message, meta: { total: 0, offset: 0, limit: null, pageSize: 0, page: 1, pageCount: 1 }, data: [] });
|
|
31
29
|
}
|
|
32
30
|
rows.sort((a, b) => (b.mtime || 0) - (a.mtime || 0));
|
|
33
|
-
res.
|
|
34
|
-
res.set("Access-Control-Expose-Headers", "X-Total-Count");
|
|
35
|
-
res.json({ sessions: rows.slice(offset, offset + limit) });
|
|
31
|
+
res.json(pageEnvelope(rows, req.query));
|
|
36
32
|
});
|
|
37
33
|
|
|
38
34
|
app.get("/projects/:pid/agents/:slug/sessions", (req, res) => {
|
|
@@ -14,6 +14,30 @@ import { CHANNELS } from "#core/constants/channels.js";
|
|
|
14
14
|
export const nowIso = () =>
|
|
15
15
|
new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
16
16
|
|
|
17
|
+
// Build a { meta, data } pagination envelope from an already-sorted array.
|
|
18
|
+
// Reads ?limit & ?offset from the request query. With no `limit`, returns the
|
|
19
|
+
// full set as a single page (data = 100% of rows) so non-paginated callers get
|
|
20
|
+
// the same shape — meta just reports one page covering everything.
|
|
21
|
+
// meta: { total, offset, limit, pageSize, page, pageCount }
|
|
22
|
+
export function pageEnvelope(rows, query = {}) {
|
|
23
|
+
const total = rows.length;
|
|
24
|
+
const hasLimit = query.limit != null && query.limit !== "";
|
|
25
|
+
const limit = hasLimit ? Math.min(Math.max(parseInt(query.limit, 10) || 0, 0), 1000) : null;
|
|
26
|
+
const offset = Math.max(parseInt(query.offset, 10) || 0, 0);
|
|
27
|
+
const data = limit != null ? rows.slice(offset, offset + limit) : rows.slice(offset);
|
|
28
|
+
return {
|
|
29
|
+
meta: {
|
|
30
|
+
total,
|
|
31
|
+
offset,
|
|
32
|
+
limit,
|
|
33
|
+
pageSize: limit != null ? limit : total,
|
|
34
|
+
page: limit ? Math.floor(offset / limit) + 1 : 1,
|
|
35
|
+
pageCount: limit ? Math.max(1, Math.ceil(total / limit)) : 1,
|
|
36
|
+
},
|
|
37
|
+
data,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
17
41
|
// Trace id middleware — populates req.apxTraceId and echoes it on the response.
|
|
18
42
|
export function traceIdMiddleware(req, res, next) {
|
|
19
43
|
req.apxTraceId = req.get("x-apx-trace-id") || randomUUID();
|
|
@@ -16,16 +16,14 @@ import {
|
|
|
16
16
|
reopenTask,
|
|
17
17
|
countTasks,
|
|
18
18
|
} from "#core/stores/tasks.js";
|
|
19
|
+
import { pageEnvelope } from "./shared.js";
|
|
19
20
|
|
|
20
21
|
export function register(app, { project, projects }) {
|
|
21
|
-
// Global tasks across every project, newest first.
|
|
22
|
-
// ?limit & ?offset;
|
|
23
|
-
//
|
|
24
|
-
// omit pagination get the same first-N behavior).
|
|
22
|
+
// Global tasks across every project, newest first. Returns a { meta, data }
|
|
23
|
+
// envelope. Paginated via ?limit & ?offset; with no limit, data is the full
|
|
24
|
+
// set as one page.
|
|
25
25
|
app.get("/tasks", (req, res) => {
|
|
26
26
|
const state = req.query.state || "open";
|
|
27
|
-
const limit = req.query.limit ? Math.min(parseInt(req.query.limit, 10) || 0, 1000) : undefined;
|
|
28
|
-
const offset = Math.max(parseInt(req.query.offset, 10) || 0, 0);
|
|
29
27
|
const out = [];
|
|
30
28
|
for (const entry of projects.list()) {
|
|
31
29
|
const p = projects.get(entry.id);
|
|
@@ -39,17 +37,15 @@ export function register(app, { project, projects }) {
|
|
|
39
37
|
for (const t of tasks) out.push({ ...t, project_id: entry.id, project_name: entry.name || entry.path });
|
|
40
38
|
}
|
|
41
39
|
out.sort((a, b) => (b.created_at || "").localeCompare(a.created_at || ""));
|
|
42
|
-
res.
|
|
43
|
-
res.set("Access-Control-Expose-Headers", "X-Total-Count");
|
|
44
|
-
res.json(limit != null ? out.slice(offset, offset + limit) : out.slice(offset));
|
|
40
|
+
res.json(pageEnvelope(out, req.query));
|
|
45
41
|
});
|
|
46
42
|
|
|
43
|
+
// Per-project tasks. Returns a { meta, data } envelope; with no ?limit the
|
|
44
|
+
// data array is the full filtered set (one page).
|
|
47
45
|
app.get("/projects/:pid/tasks", (req, res) => {
|
|
48
46
|
const p = project(req, res);
|
|
49
47
|
if (!p) return;
|
|
50
48
|
const { state, tag, agent, due_before, due_after } = req.query;
|
|
51
|
-
const limit = req.query.limit ? Math.min(parseInt(req.query.limit, 10) || 0, 1000) : undefined;
|
|
52
|
-
const offset = Math.max(parseInt(req.query.offset, 10) || 0, 0);
|
|
53
49
|
const all = listTasks(p.storagePath, {
|
|
54
50
|
state: state || undefined,
|
|
55
51
|
tag: tag || undefined,
|
|
@@ -57,9 +53,7 @@ export function register(app, { project, projects }) {
|
|
|
57
53
|
due_before: due_before || undefined,
|
|
58
54
|
due_after: due_after || undefined,
|
|
59
55
|
});
|
|
60
|
-
res.
|
|
61
|
-
res.set("Access-Control-Expose-Headers", "X-Total-Count");
|
|
62
|
-
res.json(limit != null ? all.slice(offset, offset + limit) : all.slice(offset));
|
|
56
|
+
res.json(pageEnvelope(all, req.query));
|
|
63
57
|
});
|
|
64
58
|
|
|
65
59
|
app.post("/projects/:pid/tasks", (req, res) => {
|
|
@@ -70,7 +70,11 @@ export function register(app) {
|
|
|
70
70
|
try {
|
|
71
71
|
const { transcribeBuffer } = await import("#core/voice/transcription.js");
|
|
72
72
|
const result = await transcribeBuffer(buf, format, {
|
|
73
|
-
|
|
73
|
+
// Only override the language when the caller pins a real one. An
|
|
74
|
+
// "auto" header must NOT clobber the configured language (e.g. the
|
|
75
|
+
// desktop always sends "auto", which used to override config.user
|
|
76
|
+
// .language="es" with detection — hurting accuracy on short clips).
|
|
77
|
+
...(language && language !== "auto" ? { language } : {}),
|
|
74
78
|
beam_size: 3,
|
|
75
79
|
...(provider ? { provider } : {}),
|
|
76
80
|
});
|