slopwaresystems 0.4.21 → 0.4.22

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.
Files changed (2) hide show
  1. package/dist/index.js +47 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -29115,8 +29115,47 @@ function parseToolCallFromClaudeLine(line) {
29115
29115
  }
29116
29116
  return found;
29117
29117
  }
29118
+ var SCRIPT_STRING = /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`/;
29119
+ var SCRIPT_FIELD = new RegExp(`([A-Za-z_$][\\w$]*)\\s*:\\s*(${SCRIPT_STRING.source})`, "g");
29120
+ var SCRIPT_TOOL_CALL = /\btools\.([A-Za-z_$][\w$]*)\s*\(/g;
29121
+ var CODEX_QUIET_TOOLS = /* @__PURE__ */ new Set(["write_stdin"]);
29122
+ function parseScriptString(literal2) {
29123
+ if (literal2.startsWith('"')) {
29124
+ try {
29125
+ return JSON.parse(literal2);
29126
+ } catch {
29127
+ }
29128
+ }
29129
+ return literal2.slice(1, -1).replace(/\\n/g, "\n").replace(/\\(.)/g, "$1");
29130
+ }
29131
+ function parsePatchInput(patch) {
29132
+ const file2 = /\*\*\* (?:Add|Update|Delete) File: (.+)/.exec(patch)?.[1]?.trim();
29133
+ return file2 ? { file_path: file2 } : null;
29134
+ }
29135
+ function parseScriptArguments(name, text) {
29136
+ const trimmed = text.trimStart();
29137
+ if (trimmed.startsWith("{")) {
29138
+ const fields = {};
29139
+ for (const [, key, literal3] of trimmed.matchAll(SCRIPT_FIELD)) if (key && literal3 && !(key in fields)) fields[key] = parseScriptString(literal3);
29140
+ return fields;
29141
+ }
29142
+ const literal2 = new RegExp(`^(?:${SCRIPT_STRING.source})`).exec(trimmed)?.[0];
29143
+ if (!literal2) return null;
29144
+ const value = parseScriptString(literal2);
29145
+ return name === "apply_patch" ? parsePatchInput(value) : { input: value };
29146
+ }
29147
+ function parseToolCallFromCodexScript(script) {
29148
+ const calls = [...script.matchAll(SCRIPT_TOOL_CALL)];
29149
+ for (const [index, call] of calls.entries()) {
29150
+ const name = call[1];
29151
+ if (CODEX_QUIET_TOOLS.has(name)) continue;
29152
+ const start = call.index + call[0].length;
29153
+ return formatToolCallLine(name, parseScriptArguments(name, script.slice(start, calls[index + 1]?.index ?? script.length)));
29154
+ }
29155
+ return null;
29156
+ }
29118
29157
  function parseToolCallFromCodexLine(line) {
29119
- if (!line.includes("function_call") && !line.includes("shell_call")) return null;
29158
+ if (!line.includes("function_call") && !line.includes("shell_call") && !line.includes("custom_tool_call")) return null;
29120
29159
  let entry;
29121
29160
  try {
29122
29161
  entry = JSON.parse(line);
@@ -29127,6 +29166,10 @@ function parseToolCallFromCodexLine(line) {
29127
29166
  if (!payload) return null;
29128
29167
  if (payload.type === "function_call" && typeof payload.name === "string") return formatToolCallLine(payload.name, parseJsonOrNull(payload.arguments));
29129
29168
  if (payload.type === "local_shell_call") return formatToolCallLine("shell", payload.action);
29169
+ if (payload.type === "custom_tool_call" && typeof payload.name === "string" && typeof payload.input === "string") {
29170
+ if (payload.name === "exec") return parseToolCallFromCodexScript(payload.input);
29171
+ return formatToolCallLine(payload.name, payload.name === "apply_patch" ? parsePatchInput(payload.input) : { input: payload.input });
29172
+ }
29130
29173
  return null;
29131
29174
  }
29132
29175
  var fetchFileSize = (path2) => {
@@ -30977,7 +31020,7 @@ async function trustCodexHooks(codexHome) {
30977
31020
  const sendNotification = (method, params) => server.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", method, params })}
30978
31021
  `);
30979
31022
  try {
30980
- await callCodexMethod("initialize", { clientInfo: { name: "slop", version: "0.4.21" }, capabilities: { experimentalApi: true } });
31023
+ await callCodexMethod("initialize", { clientInfo: { name: "slop", version: "0.4.22" }, capabilities: { experimentalApi: true } });
30981
31024
  sendNotification("initialized", {});
30982
31025
  const listed = await callCodexMethod("hooks/list", { cwds: [process.cwd()] });
30983
31026
  const ours = listed.data.flatMap((entry) => entry.hooks).filter((hook) => hook.command?.startsWith("slop hook "));
@@ -31177,7 +31220,7 @@ ${written.map((path2) => ` ${path2}`).join("\n")}`);
31177
31220
  var args = process.argv.slice(2);
31178
31221
  var optionEnd = args.indexOf("--");
31179
31222
  updateJsonMode((optionEnd < 0 ? args : args.slice(0, optionEnd)).includes("--json"));
31180
- var program2 = new Command().name("slop").description("Slopware Tasks from the terminal. Everything a person can do on the board, an agent can do here.").version("0.4.21").option("--json", "machine-readable output: JSON on stdout, errors as JSON on stderr").configureOutput({
31223
+ var program2 = new Command().name("slop").description("Slopware Tasks from the terminal. Everything a person can do on the board, an agent can do here.").version("0.4.22").option("--json", "machine-readable output: JSON on stdout, errors as JSON on stderr").configureOutput({
31181
31224
  outputError: (message, write) => {
31182
31225
  if (!isJsonMode()) write(message);
31183
31226
  },
@@ -31192,7 +31235,7 @@ registerProjectCommands(program2);
31192
31235
  var taskCommand = registerTaskCommands(program2);
31193
31236
  registerSessionCommands(program2);
31194
31237
  registerThreadCommands(program2, taskCommand);
31195
- registerMcpCommands(program2, "0.4.21");
31238
+ registerMcpCommands(program2, "0.4.22");
31196
31239
  registerGuideCommand(program2);
31197
31240
  registerSkillCommands(program2);
31198
31241
  program2.parseAsync().catch(exitWithError);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slopwaresystems",
3
- "version": "0.4.21",
3
+ "version": "0.4.22",
4
4
  "private": false,
5
5
  "description": "slop: the Slopware Tasks board from the terminal, for people and coding agents.",
6
6
  "type": "module",