@swmansion/argent 0.26.1-next.1 → 0.26.1-next.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.
Binary file
Binary file
Binary file
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -1847,9 +1847,13 @@ async function terminatePid(pid, stillOurs) {
1847
1847
  }
1848
1848
  async function killToolServer(bundlePath) {
1849
1849
  const state2 = await readState(bundlePath);
1850
- if (!state2) return;
1851
- await terminatePid(state2.pid);
1850
+ if (!state2) return false;
1851
+ const stillOurs = () => couldBeOurToolServer(state2.pid, state2.bundlePath);
1852
+ const alive = isProcessAlive(state2.pid);
1853
+ if (alive && !stillOurs()) return false;
1854
+ if (alive) await terminatePid(state2.pid, stillOurs);
1852
1855
  await clearToolsServerState(bundlePath ?? state2.bundlePath);
1856
+ return alive;
1853
1857
  }
1854
1858
  var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs.existsSync(p)) ?? "ps";
1855
1859
  var PS_WIDTH_FLAGS = ["-ww"];
@@ -21877,7 +21881,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
21877
21881
  var SESSION_ID2 = randomUUID5();
21878
21882
  function readCliVersion() {
21879
21883
  if (true) {
21880
- return "0.26.1-next.1";
21884
+ return "0.26.1-next.11";
21881
21885
  }
21882
21886
  return "0.0.0";
21883
21887
  }
@@ -23416,7 +23420,7 @@ function renderFailedFlows(failed) {
23416
23420
  var SAFE_ARTIFACT_NAME = FLOW_NAME_PATTERN;
23417
23421
  var SAFE_FLOW_NAME = FLOW_NAME_PATTERN;
23418
23422
  var FLOWS_DIR = path14.join(".argent", "flows");
23419
- var SHELL_SAFE_ARG = /^[A-Za-z0-9_@%+=:,./-]+$/;
23423
+ var SHELL_SAFE_ARG = /^(?!=)[A-Za-z0-9_@%+=:,./-]+$/;
23420
23424
  function shellQuoteArg(arg) {
23421
23425
  if (SHELL_SAFE_ARG.test(arg)) return arg;
23422
23426
  return `'${arg.replaceAll("'", "'\\''")}'`;
@@ -24188,8 +24192,13 @@ async function stopCmd(paths) {
24188
24192
  Stop one with: kill <pid>`);
24189
24193
  return;
24190
24194
  }
24191
- await killToolServer(paths?.bundlePath);
24192
- console.log(`tool-server stopped (pid ${state2.pid}).`);
24195
+ if (await killToolServer(paths?.bundlePath)) {
24196
+ console.log(`tool-server stopped (pid ${state2.pid}).`);
24197
+ } else {
24198
+ console.log(
24199
+ `tool-server: not running (pid ${state2.pid} is gone or not an argent tool-server).`
24200
+ );
24201
+ }
24193
24202
  }
24194
24203
  function logsCmd(follow) {
24195
24204
  if (!fs11.existsSync(LOG_FILE2)) {
@@ -0,0 +1,48 @@
1
+ export interface ArgentTool {
2
+ name: string;
3
+ description: string;
4
+ /** JSON Schema of the tool's arguments. */
5
+ inputSchema: Record<string, unknown>;
6
+ }
7
+ export interface ArgentToolResult<T = unknown> {
8
+ /** The tool's result. Artifacts (screenshots, recordings) are local file paths. */
9
+ data: T;
10
+ /** Optional advisory note the tool attached to the result. */
11
+ note?: string;
12
+ }
13
+ export interface CallToolOptions {
14
+ /** Receive progress events while a long-running tool works. */
15
+ onProgress?: (event: unknown) => void;
16
+ }
17
+ /** The tool-server rejected or failed a call. */
18
+ export declare class ArgentToolError extends Error {
19
+ /** Stable failure code, when the server sent one. */
20
+ readonly code?: string;
21
+ /** Failure category, e.g. "subprocess", when the server sent one. */
22
+ readonly kind?: string;
23
+ /** Schema issues of a rejected argument object; set only on a validation failure. */
24
+ readonly issues?: readonly unknown[];
25
+ constructor(message: string, details?: {
26
+ code?: string;
27
+ kind?: string;
28
+ issues?: readonly unknown[];
29
+ });
30
+ }
31
+ export interface ArgentFlag {
32
+ name: string;
33
+ description: string;
34
+ /** Effective state, as `argent flags` reports it. */
35
+ enabled: boolean;
36
+ }
37
+ /** Feature flags and their effective state: project overrides global, then the default. */
38
+ export declare function listFlags(): ArgentFlag[];
39
+ export interface ArgentClient {
40
+ listTools(): Promise<ArgentTool[]>;
41
+ callTool<T = unknown>(name: string, args?: Record<string, unknown>, options?: CallToolOptions): Promise<ArgentToolResult<T>>;
42
+ /**
43
+ * Stop this install's local tool-server, like `argent server stop`. The next
44
+ * call starts a fresh one. Resolves false when none was running.
45
+ */
46
+ stopServer(): Promise<boolean>;
47
+ }
48
+ export declare function createArgentClient(): ArgentClient;