tinker-agent 1.0.65 → 1.2.0
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/CHANGELOG.md +36 -0
- package/LICENSE +201 -0
- package/NOTICE +6 -0
- package/README.md +90 -9
- package/bin/tinker.js +39 -0
- package/node_modules/ansi-regex/index.d.ts +33 -0
- package/node_modules/ansi-regex/index.js +14 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +61 -0
- package/node_modules/ansi-regex/readme.md +66 -0
- package/node_modules/ansi-styles/index.d.ts +236 -0
- package/node_modules/ansi-styles/index.js +223 -0
- package/node_modules/ansi-styles/license +9 -0
- package/node_modules/ansi-styles/package.json +54 -0
- package/node_modules/ansi-styles/readme.md +173 -0
- package/node_modules/chalk/license +9 -0
- package/node_modules/chalk/package.json +83 -0
- package/node_modules/chalk/readme.md +297 -0
- package/node_modules/chalk/source/index.d.ts +325 -0
- package/node_modules/chalk/source/index.js +225 -0
- package/node_modules/chalk/source/utilities.js +33 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/node_modules/character-entities/index.d.ts +6 -0
- package/node_modules/character-entities/index.js +2132 -0
- package/node_modules/character-entities/license +22 -0
- package/node_modules/character-entities/package.json +78 -0
- package/node_modules/character-entities/readme.md +152 -0
- package/node_modules/decode-named-character-reference/index.d.ts +13 -0
- package/node_modules/decode-named-character-reference/index.d.ts.map +1 -0
- package/node_modules/decode-named-character-reference/index.dom.d.ts +6 -0
- package/node_modules/decode-named-character-reference/index.dom.d.ts.map +1 -0
- package/node_modules/decode-named-character-reference/index.dom.js +32 -0
- package/node_modules/decode-named-character-reference/index.js +19 -0
- package/node_modules/decode-named-character-reference/license +22 -0
- package/node_modules/decode-named-character-reference/package.json +90 -0
- package/node_modules/decode-named-character-reference/readme.md +136 -0
- package/node_modules/get-east-asian-width/index.d.ts +60 -0
- package/node_modules/get-east-asian-width/index.js +30 -0
- package/node_modules/get-east-asian-width/license +9 -0
- package/node_modules/get-east-asian-width/lookup-data.js +21 -0
- package/node_modules/get-east-asian-width/lookup.js +138 -0
- package/node_modules/get-east-asian-width/package.json +71 -0
- package/node_modules/get-east-asian-width/readme.md +65 -0
- package/node_modules/get-east-asian-width/utilities.js +24 -0
- package/node_modules/has-flag/index.d.ts +39 -0
- package/node_modules/has-flag/index.js +8 -0
- package/node_modules/has-flag/license +9 -0
- package/node_modules/has-flag/package.json +49 -0
- package/node_modules/has-flag/readme.md +74 -0
- package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/node_modules/is-fullwidth-code-point/index.js +12 -0
- package/node_modules/is-fullwidth-code-point/license +9 -0
- package/node_modules/is-fullwidth-code-point/package.json +53 -0
- package/node_modules/is-fullwidth-code-point/readme.md +31 -0
- package/node_modules/markdansi/LICENSE +21 -0
- package/node_modules/markdansi/README.md +167 -0
- package/node_modules/markdansi/dist/ast.d.ts +99 -0
- package/node_modules/markdansi/dist/ast.js +1 -0
- package/node_modules/markdansi/dist/cli.d.ts +17 -0
- package/node_modules/markdansi/dist/cli.js +208 -0
- package/node_modules/markdansi/dist/hyperlink.d.ts +9 -0
- package/node_modules/markdansi/dist/hyperlink.js +26 -0
- package/node_modules/markdansi/dist/index.d.ts +10 -0
- package/node_modules/markdansi/dist/index.js +16 -0
- package/node_modules/markdansi/dist/parser.d.ts +2 -0
- package/node_modules/markdansi/dist/parser.js +205 -0
- package/node_modules/markdansi/dist/render.d.ts +9 -0
- package/node_modules/markdansi/dist/render.js +680 -0
- package/node_modules/markdansi/dist/stream.d.ts +39 -0
- package/node_modules/markdansi/dist/stream.js +192 -0
- package/node_modules/markdansi/dist/theme.d.ts +18 -0
- package/node_modules/markdansi/dist/theme.js +105 -0
- package/node_modules/markdansi/dist/types.d.ts +58 -0
- package/node_modules/markdansi/dist/types.js +1 -0
- package/node_modules/markdansi/dist/wrap.d.ts +10 -0
- package/node_modules/markdansi/dist/wrap.js +73 -0
- package/node_modules/markdansi/docs/spec.md +110 -0
- package/node_modules/markdansi/package.json +78 -0
- package/node_modules/markdansi/tsconfig.json +18 -0
- package/node_modules/marked/LICENSE +44 -0
- package/node_modules/marked/README.md +115 -0
- package/node_modules/marked/bin/main.js +284 -0
- package/node_modules/marked/bin/marked.js +16 -0
- package/node_modules/marked/lib/marked.d.ts +760 -0
- package/node_modules/marked/lib/marked.esm.js +77 -0
- package/node_modules/marked/lib/marked.esm.js.map +7 -0
- package/node_modules/marked/lib/marked.umd.js +79 -0
- package/node_modules/marked/lib/marked.umd.js.map +7 -0
- package/node_modules/marked/man/marked.1 +113 -0
- package/node_modules/marked/man/marked.1.md +93 -0
- package/node_modules/marked/package.json +103 -0
- package/node_modules/slice-ansi/index.d.ts +19 -0
- package/node_modules/slice-ansi/index.js +317 -0
- package/node_modules/slice-ansi/license +10 -0
- package/node_modules/slice-ansi/package.json +59 -0
- package/node_modules/slice-ansi/readme.md +55 -0
- package/node_modules/slice-ansi/tokenize-ansi.js +752 -0
- package/node_modules/string-width/index.d.ts +39 -0
- package/node_modules/string-width/index.js +203 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +65 -0
- package/node_modules/string-width/readme.md +66 -0
- package/node_modules/strip-ansi/index.d.ts +15 -0
- package/node_modules/strip-ansi/index.js +19 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +59 -0
- package/node_modules/strip-ansi/readme.md +37 -0
- package/node_modules/supports-color/browser.d.ts +1 -0
- package/node_modules/supports-color/browser.js +35 -0
- package/node_modules/supports-color/index.d.ts +55 -0
- package/node_modules/supports-color/index.js +202 -0
- package/node_modules/supports-color/license +9 -0
- package/node_modules/supports-color/package.json +64 -0
- package/node_modules/supports-color/readme.md +75 -0
- package/node_modules/supports-hyperlinks/browser.js +10 -0
- package/node_modules/supports-hyperlinks/index.d.ts +25 -0
- package/node_modules/supports-hyperlinks/index.js +163 -0
- package/node_modules/supports-hyperlinks/license +10 -0
- package/node_modules/supports-hyperlinks/package.json +47 -0
- package/node_modules/supports-hyperlinks/readme.md +45 -0
- package/package.json +41 -10
- package/patches/markdansi@0.3.2.patch +22 -2
- package/src/agent/context-builder.ts +24 -10
- package/src/agent/context-meter.ts +89 -5
- package/src/agent/loop.ts +107 -10
- package/src/agent/runtime-session.ts +1437 -82
- package/src/agent/session-ledger.ts +169 -29
- package/src/agent/types.ts +12 -1
- package/src/agent/user-prompt-projection.ts +62 -0
- package/src/cli/config.ts +57 -14
- package/src/cli/model-profiles.ts +124 -0
- package/src/cli/run-runner.ts +4 -1
- package/src/cli/tui-runner.tsx +68 -30
- package/src/context/compiled-context-hash.ts +1 -1
- package/src/context/compiled-context-validator.ts +92 -15
- package/src/context/context-automation-policy.ts +121 -0
- package/src/context/context-manager.ts +390 -11
- package/src/context/context-policy.ts +8 -0
- package/src/context/context-protocol-validator.ts +11 -1
- package/src/context/context-revision-compiler.ts +190 -27
- package/src/context/context-revision.ts +105 -19
- package/src/context/context-surface.ts +329 -0
- package/src/context/prefix-retirement-planner.ts +570 -0
- package/src/context/protocol-frame.ts +30 -3
- package/src/context/recall-retirement-contract.ts +27 -0
- package/src/context/swap-planner.ts +34 -10
- package/src/events/observation-text-log.ts +3 -3
- package/src/events/stdout-event-printer.ts +39 -3
- package/src/events/types.ts +172 -35
- package/src/ids/runtime-id.ts +6 -0
- package/src/ids/uuid-v7.ts +7 -0
- package/src/image/image-asset-store.ts +319 -0
- package/src/image/image-input-policy.ts +14 -0
- package/src/image/image-probe.ts +233 -0
- package/src/image/image-types.ts +262 -0
- package/src/instructions/project-instructions.ts +4 -1
- package/src/mcp/mcp-manager.ts +83 -19
- package/src/model/fake-model-client.ts +9 -1
- package/src/model/input-token-estimator.ts +25 -0
- package/src/model/model-client.ts +60 -0
- package/src/model/model-request-preflight.ts +1 -0
- package/src/model/moonshot-input-token-estimator.ts +107 -0
- package/src/model/openai-chat-mapping.ts +77 -1
- package/src/model/openai-chat-model-client.ts +389 -59
- package/src/model/openai-chat-stream.ts +272 -0
- package/src/model/prompt-prefix-hash.ts +2 -4
- package/src/model/token-estimator.ts +4 -0
- package/src/observation/observation-builder.ts +29 -0
- package/src/session/resume-projection.ts +94 -34
- package/src/session/session-catalog.ts +4 -4
- package/src/session/session-errors.ts +1 -1
- package/src/session/session-history-reader.ts +151 -4
- package/src/session/session-last-response-reader.ts +189 -0
- package/src/session/session-schema.ts +349 -35
- package/src/session/session-store.ts +3266 -255
- package/src/session/sqlite-session-ledger.ts +9 -4
- package/src/skills/skill-catalog.ts +182 -0
- package/src/skills/skill-context.ts +364 -0
- package/src/skills/skill-loader.ts +779 -0
- package/src/skills/skill-tool.ts +297 -0
- package/src/tools/edit.ts +51 -64
- package/src/tools/ensure-parent-directory.ts +6 -0
- package/src/tools/read.ts +2 -2
- package/src/tools/recall.ts +43 -40
- package/src/tools/registry.ts +24 -3
- package/src/tools/ripgrep.ts +3 -2
- package/src/tools/types.ts +43 -4
- package/src/tools/write.ts +20 -31
- package/src/tui/app.tsx +333 -96
- package/src/tui/clipboard.ts +5 -0
- package/src/tui/components/mcp-panel.tsx +28 -0
- package/src/tui/components/prompt-input.tsx +790 -257
- package/src/tui/components/skills-panel.tsx +31 -0
- package/src/tui/components/timeline.tsx +30 -1
- package/src/tui/event-store.ts +85 -2
- package/src/tui/file-mention.ts +234 -0
- package/src/tui/line-editor.ts +1 -0
- package/src/tui/project-slash-commands.ts +229 -0
- package/src/tui/prompt-draft.ts +510 -0
- package/src/tui/prompt-history.ts +294 -22
- package/src/tui/slash-commands.ts +46 -2
- package/src/tui/tui-session-controller.ts +110 -48
- package/src/tui/workspace-file-search.ts +94 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-env browser */
|
|
2
|
+
|
|
3
|
+
const level = (() => {
|
|
4
|
+
if (!('navigator' in globalThis)) {
|
|
5
|
+
return 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (globalThis.navigator.userAgentData) {
|
|
9
|
+
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
|
|
10
|
+
if (brand && brand.version > 93) {
|
|
11
|
+
return 3;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
|
|
16
|
+
return 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return 0;
|
|
20
|
+
})();
|
|
21
|
+
|
|
22
|
+
const colorSupport = level !== 0 && {
|
|
23
|
+
level,
|
|
24
|
+
hasBasic: true,
|
|
25
|
+
has256: level >= 2,
|
|
26
|
+
has16m: level >= 3,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const supportsColor = {
|
|
30
|
+
stdout: colorSupport,
|
|
31
|
+
stderr: colorSupport,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default supportsColor;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type {WriteStream} from 'node:tty';
|
|
2
|
+
|
|
3
|
+
export type Options = {
|
|
4
|
+
/**
|
|
5
|
+
Whether `process.argv` should be sniffed for `--color` and `--no-color` flags.
|
|
6
|
+
|
|
7
|
+
@default true
|
|
8
|
+
*/
|
|
9
|
+
readonly sniffFlags?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
Levels:
|
|
14
|
+
- `0` - All colors disabled.
|
|
15
|
+
- `1` - Basic 16 colors support.
|
|
16
|
+
- `2` - ANSI 256 colors support.
|
|
17
|
+
- `3` - Truecolor 16 million colors support.
|
|
18
|
+
*/
|
|
19
|
+
export type ColorSupportLevel = 0 | 1 | 2 | 3;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
Detect whether the terminal supports color.
|
|
23
|
+
*/
|
|
24
|
+
export type ColorSupport = {
|
|
25
|
+
/**
|
|
26
|
+
The color level.
|
|
27
|
+
*/
|
|
28
|
+
level: ColorSupportLevel;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
Whether basic 16 colors are supported.
|
|
32
|
+
*/
|
|
33
|
+
hasBasic: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
Whether ANSI 256 colors are supported.
|
|
37
|
+
*/
|
|
38
|
+
has256: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
Whether Truecolor 16 million colors are supported.
|
|
42
|
+
*/
|
|
43
|
+
has16m: boolean;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type ColorInfo = ColorSupport | false;
|
|
47
|
+
|
|
48
|
+
export function createSupportsColor(stream?: WriteStream, options?: Options): ColorInfo;
|
|
49
|
+
|
|
50
|
+
declare const supportsColor: {
|
|
51
|
+
stdout: ColorInfo;
|
|
52
|
+
stderr: ColorInfo;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default supportsColor;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import tty from 'node:tty';
|
|
4
|
+
|
|
5
|
+
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
|
|
6
|
+
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
|
|
7
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
|
|
8
|
+
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
9
|
+
const position = argv.indexOf(prefix + flag);
|
|
10
|
+
const terminatorPosition = argv.indexOf('--');
|
|
11
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {env} = process;
|
|
15
|
+
|
|
16
|
+
let flagForceColor;
|
|
17
|
+
if (
|
|
18
|
+
hasFlag('no-color')
|
|
19
|
+
|| hasFlag('no-colors')
|
|
20
|
+
|| hasFlag('color=false')
|
|
21
|
+
|| hasFlag('color=never')
|
|
22
|
+
) {
|
|
23
|
+
flagForceColor = 0;
|
|
24
|
+
} else if (
|
|
25
|
+
hasFlag('color')
|
|
26
|
+
|| hasFlag('colors')
|
|
27
|
+
|| hasFlag('color=true')
|
|
28
|
+
|| hasFlag('color=always')
|
|
29
|
+
) {
|
|
30
|
+
flagForceColor = 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function envForceColor() {
|
|
34
|
+
if ('FORCE_COLOR' in env) {
|
|
35
|
+
if (env.FORCE_COLOR === 'true') {
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (env.FORCE_COLOR === 'false') {
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function translateLevel(level) {
|
|
48
|
+
if (level === 0) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
level,
|
|
54
|
+
hasBasic: true,
|
|
55
|
+
has256: level >= 2,
|
|
56
|
+
has16m: level >= 3,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
61
|
+
const noFlagForceColor = envForceColor();
|
|
62
|
+
if (noFlagForceColor !== undefined) {
|
|
63
|
+
flagForceColor = noFlagForceColor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
67
|
+
|
|
68
|
+
if (forceColor === 0) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (sniffFlags) {
|
|
73
|
+
if (hasFlag('color=16m')
|
|
74
|
+
|| hasFlag('color=full')
|
|
75
|
+
|| hasFlag('color=truecolor')) {
|
|
76
|
+
return 3;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (hasFlag('color=256')) {
|
|
80
|
+
return 2;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Check for Azure DevOps pipelines.
|
|
85
|
+
// Has to be above the `!streamIsTTY` check.
|
|
86
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
|
87
|
+
return 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const min = forceColor || 0;
|
|
95
|
+
|
|
96
|
+
if (env.TERM === 'dumb') {
|
|
97
|
+
return min;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (process.platform === 'win32') {
|
|
101
|
+
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
102
|
+
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
103
|
+
const osRelease = os.release().split('.');
|
|
104
|
+
if (
|
|
105
|
+
Number(osRelease[0]) >= 10
|
|
106
|
+
&& Number(osRelease[2]) >= 10_586
|
|
107
|
+
) {
|
|
108
|
+
return Number(osRelease[2]) >= 14_931 ? 3 : 2;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if ('CI' in env) {
|
|
115
|
+
if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {
|
|
116
|
+
return 3;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
120
|
+
return 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return min;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if ('TEAMCITY_VERSION' in env) {
|
|
127
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (env.COLORTERM === 'truecolor') {
|
|
131
|
+
return 3;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (env.TERM === 'xterm-kitty') {
|
|
135
|
+
return 3;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (env.TERM === 'xterm-ghostty') {
|
|
139
|
+
return 3;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (env.TERM === 'wezterm') {
|
|
143
|
+
return 3;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if ('TERM_PROGRAM' in env) {
|
|
147
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
148
|
+
|
|
149
|
+
switch (env.TERM_PROGRAM) {
|
|
150
|
+
case 'iTerm.app': {
|
|
151
|
+
return version >= 3 ? 3 : 2;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
case 'Apple_Terminal': {
|
|
155
|
+
return 2;
|
|
156
|
+
}
|
|
157
|
+
// No default
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
162
|
+
return 2;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
166
|
+
return 1;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if ('COLORTERM' in env) {
|
|
170
|
+
return 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return min;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function createSupportsColor(stream, options = {}) {
|
|
177
|
+
const level = _supportsColor(stream, {
|
|
178
|
+
streamIsTTY: stream && stream.isTTY,
|
|
179
|
+
...options,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
return translateLevel(level);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const supportsColor = {
|
|
186
|
+
stdout: createSupportsColor({isTTY: tty.isatty(1)}),
|
|
187
|
+
stderr: createSupportsColor({isTTY: tty.isatty(2)}),
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export default supportsColor;
|