@agentxm/client-utils 0.1.6
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/LICENSE +21 -0
- package/dist/src/unstable/env/env.d.ts +5 -0
- package/dist/src/unstable/env/env.d.ts.map +1 -0
- package/dist/src/unstable/env/env.js +8 -0
- package/dist/src/unstable/env/env.js.map +1 -0
- package/dist/src/unstable/env/index.d.ts +2 -0
- package/dist/src/unstable/env/index.d.ts.map +1 -0
- package/dist/src/unstable/env/index.js +2 -0
- package/dist/src/unstable/env/index.js.map +1 -0
- package/dist/src/unstable/interaction/interaction.d.ts +9 -0
- package/dist/src/unstable/interaction/interaction.d.ts.map +1 -0
- package/dist/src/unstable/interaction/interaction.js +11 -0
- package/dist/src/unstable/interaction/interaction.js.map +1 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AgentXM, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const readEnv: (env: NodeJS.ProcessEnv, name: string) => string | undefined;
|
|
2
|
+
export declare const readEnvWithDefault: (env: NodeJS.ProcessEnv, name: string, fallback: string) => string;
|
|
3
|
+
export declare const hasEnv: (env: NodeJS.ProcessEnv, name: string) => boolean;
|
|
4
|
+
export declare const hasAnyEnv: (env: NodeJS.ProcessEnv, names: ReadonlyArray<string>) => boolean;
|
|
5
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../src/unstable/env/env.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,SAAsB,CAAC;AAE/F,eAAO,MAAM,kBAAkB,GAC7B,KAAK,MAAM,CAAC,UAAU,EACtB,MAAM,MAAM,EACZ,UAAU,MAAM,KACf,MAAwC,CAAC;AAE5C,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,MAAM,KAAG,OAG7D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,CAAC,UAAU,EAAE,OAAO,aAAa,CAAC,MAAM,CAAC,KAAG,OACxC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const readEnv = (env, name) => env[name];
|
|
2
|
+
export const readEnvWithDefault = (env, name, fallback) => readEnv(env, name) ?? fallback;
|
|
3
|
+
export const hasEnv = (env, name) => {
|
|
4
|
+
const value = readEnv(env, name);
|
|
5
|
+
return value !== undefined && value !== "";
|
|
6
|
+
};
|
|
7
|
+
export const hasAnyEnv = (env, names) => names.some((name) => hasEnv(env, name));
|
|
8
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../src/unstable/env/env.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAsB,EAAE,IAAY,EAAsB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAE/F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,GAAsB,EACtB,IAAY,EACZ,QAAgB,EACR,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,QAAQ,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAsB,EAAE,IAAY,EAAW,EAAE;IACtE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAsB,EAAE,KAA4B,EAAW,EAAE,CACzF,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/unstable/env/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/unstable/env/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface InteractionEnvOptions {
|
|
2
|
+
readonly isTTY: boolean | undefined;
|
|
3
|
+
readonly env: NodeJS.ProcessEnv;
|
|
4
|
+
}
|
|
5
|
+
export declare const isCI: (env: NodeJS.ProcessEnv) => boolean;
|
|
6
|
+
export declare const isAgent: (env: NodeJS.ProcessEnv) => boolean;
|
|
7
|
+
export declare const isInteractive: ({ isTTY, env }: InteractionEnvOptions) => boolean;
|
|
8
|
+
export declare const isHumanInteractive: ({ isTTY, env }: InteractionEnvOptions) => boolean;
|
|
9
|
+
//# sourceMappingURL=interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../src/unstable/interaction/interaction.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACjC;AAQD,eAAO,MAAM,IAAI,GAAI,KAAK,MAAM,CAAC,UAAU,KAAG,OAA4B,CAAC;AAE3E,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,CAAC,UAAU,KAAG,OAAyC,CAAC;AAE3F,eAAO,MAAM,aAAa,GAAI,gBAAgB,qBAAqB,KAAG,OACxC,CAAC;AAE/B,eAAO,MAAM,kBAAkB,GAAI,gBAAgB,qBAAqB,KAAG,OAC3B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { hasAnyEnv, hasEnv } from "../env/index.js";
|
|
2
|
+
const AGENT_ENV_KEYS = [
|
|
3
|
+
"CLAUDECODE",
|
|
4
|
+
"GEMINI_CLI",
|
|
5
|
+
"CURSOR_AGENT",
|
|
6
|
+
];
|
|
7
|
+
export const isCI = (env) => hasEnv(env, "CI");
|
|
8
|
+
export const isAgent = (env) => hasAnyEnv(env, AGENT_ENV_KEYS);
|
|
9
|
+
export const isInteractive = ({ isTTY, env }) => isTTY === true && !isCI(env);
|
|
10
|
+
export const isHumanInteractive = ({ isTTY, env }) => isInteractive({ isTTY, env }) && !isAgent(env);
|
|
11
|
+
//# sourceMappingURL=interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../../../src/unstable/interaction/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAOpD,MAAM,cAAc,GAAG;IACrB,YAAY;IACZ,YAAY;IACZ,cAAc;CAC0B,CAAC;AAE3C,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAsB,EAAW,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAsB,EAAW,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;AAE3F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAyB,EAAW,EAAE,CAC9E,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAyB,EAAW,EAAE,CACnF,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentxm/client-utils",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "Shared primitive utilities for axm workspaces",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/agentxm/axm.git",
|
|
10
|
+
"directory": "packages/utils"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./unstable/env": {
|
|
14
|
+
"types": "./src/unstable/env/index.ts",
|
|
15
|
+
"default": "./dist/src/unstable/env/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./unstable/interaction": {
|
|
18
|
+
"types": "./src/unstable/interaction/interaction.ts",
|
|
19
|
+
"default": "./dist/src/unstable/interaction/interaction.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/src/"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22 <23"
|
|
30
|
+
},
|
|
31
|
+
"nx": {
|
|
32
|
+
"includedScripts": []
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/bun": "^1.3.11",
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
|
+
"vitest": "^4.0.0"
|
|
38
|
+
}
|
|
39
|
+
}
|