@zixt/host 0.0.160 → 0.0.162
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.js +44 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import { homedir as homedir6 } from "node:os";
|
|
|
28
28
|
// package.json
|
|
29
29
|
var package_default = {
|
|
30
30
|
name: "@zixt/host",
|
|
31
|
-
version: "0.0.
|
|
31
|
+
version: "0.0.162",
|
|
32
32
|
type: "module",
|
|
33
33
|
exports: {
|
|
34
34
|
".": "./src/client.ts",
|
|
@@ -43795,6 +43795,43 @@ import { readFile as readFile13 } from "node:fs/promises";
|
|
|
43795
43795
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
43796
43796
|
import { homedir as homedir10 } from "node:os";
|
|
43797
43797
|
import { dirname as dirname10, join as join23 } from "node:path";
|
|
43798
|
+
|
|
43799
|
+
// src/runners/feed-labels.ts
|
|
43800
|
+
var SENTENCE_KEYS = ["title", "question", "description", "url", "query"];
|
|
43801
|
+
var LOCATOR_KEYS = ["file_path", "path", "pattern", "name"];
|
|
43802
|
+
function toolCallLabel(tool, args) {
|
|
43803
|
+
if (args && typeof args === "object" && !Array.isArray(args)) {
|
|
43804
|
+
const record2 = args;
|
|
43805
|
+
for (const key of SENTENCE_KEYS) {
|
|
43806
|
+
const value = record2[key];
|
|
43807
|
+
if (typeof value === "string" && value.trim()) {
|
|
43808
|
+
return value.trim().slice(0, 100);
|
|
43809
|
+
}
|
|
43810
|
+
}
|
|
43811
|
+
for (const key of LOCATOR_KEYS) {
|
|
43812
|
+
const value = record2[key];
|
|
43813
|
+
if (typeof value === "string" && value.trim()) {
|
|
43814
|
+
return `${tool}: ${value.trim().slice(0, 100)}`;
|
|
43815
|
+
}
|
|
43816
|
+
}
|
|
43817
|
+
return tool;
|
|
43818
|
+
}
|
|
43819
|
+
if (typeof args === "string" && args.trim() && args.trim() !== "{}") {
|
|
43820
|
+
return `${tool}: ${args.trim().slice(0, 100)}`;
|
|
43821
|
+
}
|
|
43822
|
+
return tool;
|
|
43823
|
+
}
|
|
43824
|
+
function shellCommandLabel(command) {
|
|
43825
|
+
const trimmed = command.trim();
|
|
43826
|
+
if (!trimmed) return "shell";
|
|
43827
|
+
const quoted = /^"([^"]+)"\s*(.*)$/s.exec(trimmed);
|
|
43828
|
+
const executable = quoted ? quoted[1] : trimmed.split(/\s+/, 1)[0] ?? trimmed;
|
|
43829
|
+
const rest = quoted ? quoted[2] : trimmed.slice(executable.length).trimStart();
|
|
43830
|
+
const basename8 = (executable.split(/[\\/]/).pop() ?? executable).replace(/\.(exe|cmd|bat)$/i, "");
|
|
43831
|
+
return `shell: ${`${basename8}${rest ? ` ${rest}` : ""}`.slice(0, 100)}`;
|
|
43832
|
+
}
|
|
43833
|
+
|
|
43834
|
+
// src/runners/codex.ts
|
|
43798
43835
|
var CODEX_NOT_FOUND_MESSAGE = "The `codex` CLI was not found on this Machine. Install it (npm install -g @openai/codex) and sign in with `codex login`, or switch the agent to API-key auth.";
|
|
43799
43836
|
function defaultCodexThreadIndexRoot() {
|
|
43800
43837
|
return join23(homedir10(), ".zixt", "codex-threads");
|
|
@@ -43973,18 +44010,6 @@ function delay2(ms) {
|
|
|
43973
44010
|
timer.unref?.();
|
|
43974
44011
|
});
|
|
43975
44012
|
}
|
|
43976
|
-
function toolCallLabel(tool, args, rawParameter) {
|
|
43977
|
-
if (args && typeof args === "object" && !Array.isArray(args)) {
|
|
43978
|
-
const record2 = args;
|
|
43979
|
-
for (const key of ["title", "question", "url", "query", "path", "name"]) {
|
|
43980
|
-
const value = record2[key];
|
|
43981
|
-
if (typeof value === "string" && value.trim()) {
|
|
43982
|
-
return `${tool}: ${value.trim().slice(0, 100)}`;
|
|
43983
|
-
}
|
|
43984
|
-
}
|
|
43985
|
-
}
|
|
43986
|
-
return `${tool}${rawParameter ? `: ${rawParameter.slice(0, 100)}` : ""}`;
|
|
43987
|
-
}
|
|
43988
44013
|
async function reportCodexRuntime(args) {
|
|
43989
44014
|
const { task, runner, env, command, commandPrefixArgs } = args.input;
|
|
43990
44015
|
for (let attempt = 0; attempt < RUNTIME_READ_ATTEMPTS; attempt += 1) {
|
|
@@ -44070,7 +44095,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
44070
44095
|
}
|
|
44071
44096
|
if (type === "commandExecution") {
|
|
44072
44097
|
const parameter = String(item["command"] ?? "").slice(0, 2e3);
|
|
44073
|
-
onStream("action",
|
|
44098
|
+
onStream("action", shellCommandLabel(parameter), {
|
|
44074
44099
|
tool: "shell",
|
|
44075
44100
|
...parameter ? { parameter } : {},
|
|
44076
44101
|
ephemeral: true
|
|
@@ -44087,7 +44112,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
44087
44112
|
0,
|
|
44088
44113
|
2e3
|
|
44089
44114
|
);
|
|
44090
|
-
onStream("action", toolCallLabel(tool, args
|
|
44115
|
+
onStream("action", toolCallLabel(tool, args), {
|
|
44091
44116
|
tool,
|
|
44092
44117
|
...parameter ? { parameter } : {},
|
|
44093
44118
|
ephemeral: true
|
|
@@ -44298,7 +44323,7 @@ function createCodexStreamParser(onStream, hooks = {}) {
|
|
|
44298
44323
|
if (typeof item["text"] === "string") onStream("thought", truncateThought(item["text"]));
|
|
44299
44324
|
} else if (phase === "item.started" && itemType === "command_execution") {
|
|
44300
44325
|
const parameter = String(item["command"] ?? "").slice(0, 2e3);
|
|
44301
|
-
onStream("action",
|
|
44326
|
+
onStream("action", shellCommandLabel(parameter), {
|
|
44302
44327
|
tool: "shell",
|
|
44303
44328
|
...parameter ? { parameter } : {},
|
|
44304
44329
|
ephemeral: true
|
|
@@ -44313,7 +44338,7 @@ function createCodexStreamParser(onStream, hooks = {}) {
|
|
|
44313
44338
|
0,
|
|
44314
44339
|
2e3
|
|
44315
44340
|
);
|
|
44316
|
-
onStream("action", toolCallLabel(tool, args
|
|
44341
|
+
onStream("action", toolCallLabel(tool, args), {
|
|
44317
44342
|
tool,
|
|
44318
44343
|
...parameter ? { parameter } : {},
|
|
44319
44344
|
ephemeral: true
|
|
@@ -46349,9 +46374,9 @@ function createStreamParser(onStream, hooks = {}) {
|
|
|
46349
46374
|
const target = input?.["description"] ?? input?.["command"] ?? input?.["pattern"] ?? input?.["file_path"] ?? (typeof input?.["question"] === "string" ? input["question"] : void 0) ?? "";
|
|
46350
46375
|
const tool = String(block["name"]).slice(0, 200);
|
|
46351
46376
|
const parameter = String(target).slice(0, 2e3);
|
|
46352
|
-
const shortParameter = parameter.slice(0, 100);
|
|
46353
46377
|
const localPath = typeof input?.["file_path"] === "string" ? input["file_path"] : null;
|
|
46354
|
-
|
|
46378
|
+
const label = typeof input?.["command"] === "string" && input["command"].trim() ? shellCommandLabel(input["command"]) : toolCallLabel(tool, input ?? {});
|
|
46379
|
+
onStream("action", label, {
|
|
46355
46380
|
tool,
|
|
46356
46381
|
...parameter ? { parameter } : {},
|
|
46357
46382
|
ephemeral: true,
|